Remove _convert_bluetooth_le_name as it did not need to be its own function (#423)

This commit is contained in:
J. Nick Koston 2023-04-19 20:47:26 -10:00 committed by GitHub
parent 4abe5fd959
commit d1951ebd90
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -842,10 +842,6 @@ def _convert_bluetooth_le_manufacturer_data(
return {int(v.uuid, 16): bytes(v.legacy_data) for v in value} # type: ignore return {int(v.uuid, 16): bytes(v.legacy_data) for v in value} # type: ignore
def _convert_bluetooth_le_name(value: bytes) -> str:
return value.decode("utf-8", errors="replace")
@dataclass(frozen=True) @dataclass(frozen=True)
class BluetoothLEAdvertisement(APIModelBase): class BluetoothLEAdvertisement(APIModelBase):
def __post_init__(self) -> None: def __post_init__(self) -> None:
@ -867,7 +863,7 @@ class BluetoothLEAdvertisement(APIModelBase):
address=data.address, address=data.address,
rssi=data.rssi, rssi=data.rssi,
address_type=data.address_type, address_type=data.address_type,
name=_convert_bluetooth_le_name(data.name), name=data.name.decode("utf-8", errors="replace"),
service_uuids=_convert_bluetooth_le_service_uuids(data.service_uuids), service_uuids=_convert_bluetooth_le_service_uuids(data.service_uuids),
service_data=_convert_bluetooth_le_service_data(data.service_data), service_data=_convert_bluetooth_le_service_data(data.service_data),
manufacturer_data=_convert_bluetooth_le_manufacturer_data( manufacturer_data=_convert_bluetooth_le_manufacturer_data(