diff --git a/bumble/avc.py b/bumble/avc.py index 81502780..7e60d83a 100644 --- a/bumble/avc.py +++ b/bumble/avc.py @@ -134,6 +134,8 @@ class Frame: opcode_offset = 3 elif subunit_id == 6: raise core.InvalidPacketError("reserved subunit ID") + else: + raise core.InvalidPacketError("invalid subunit ID") opcode = Frame.OperationCode(data[opcode_offset]) operands = data[opcode_offset + 1 :] diff --git a/bumble/l2cap.py b/bumble/l2cap.py index 53c84d5a..75e554c8 100644 --- a/bumble/l2cap.py +++ b/bumble/l2cap.py @@ -1911,6 +1911,7 @@ class ChannelManager: data = sum(1 << cid for cid in self.fixed_channels).to_bytes(8, 'little') else: result = L2CAP_Information_Response.NOT_SUPPORTED + data = b'' self.send_control_frame( connection, diff --git a/bumble/link.py b/bumble/link.py index 8971e21b..9c7f4664 100644 --- a/bumble/link.py +++ b/bumble/link.py @@ -122,6 +122,8 @@ class LocalLink: elif transport == BT_BR_EDR_TRANSPORT: destination_controller = self.find_classic_controller(destination_address) source_address = sender_controller.public_address + else: + raise ValueError("unsupported transport type") if destination_controller is not None: destination_controller.on_link_acl_data(source_address, transport, data) diff --git a/bumble/profiles/bap.py b/bumble/profiles/bap.py index 8a00eafe..cd14bf19 100644 --- a/bumble/profiles/bap.py +++ b/bumble/profiles/bap.py @@ -350,6 +350,7 @@ class CodecSpecificCapabilities: supported_max_codec_frames_per_sdu = value # It is expected here that if some fields are missing, an error should be raised. + # pylint: disable=possibly-used-before-assignment,used-before-assignment return CodecSpecificCapabilities( supported_sampling_frequencies=supported_sampling_frequencies, supported_frame_durations=supported_frame_durations, @@ -426,6 +427,7 @@ class CodecSpecificConfiguration: codec_frames_per_sdu = value # It is expected here that if some fields are missing, an error should be raised. + # pylint: disable=possibly-used-before-assignment,used-before-assignment return CodecSpecificConfiguration( sampling_frequency=sampling_frequency, frame_duration=frame_duration, diff --git a/bumble/sdp.py b/bumble/sdp.py index 88c575d2..90ac07c7 100644 --- a/bumble/sdp.py +++ b/bumble/sdp.py @@ -434,6 +434,8 @@ class DataElement: if size != 1: raise InvalidArgumentError('boolean must be 1 byte') size_index = 0 + else: + raise RuntimeError("internal error - self.type not supported") self.bytes = bytes([self.type << 3 | size_index]) + size_bytes + data return self.bytes diff --git a/examples/run_extended_advertiser_2.py b/examples/run_extended_advertiser_2.py index 735e1c5f..6f8d123a 100644 --- a/examples/run_extended_advertiser_2.py +++ b/examples/run_extended_advertiser_2.py @@ -64,6 +64,7 @@ async def main() -> None: [(AdvertisingData.COMPLETE_LOCAL_NAME, "Bumble 2".encode("utf-8"))] ) + # pylint: disable=possibly-used-before-assignment if device.host.number_of_supported_advertising_sets >= 2: set2 = await device.create_advertising_set( random_address=Address("F0:F0:F0:F0:F0:F1"), diff --git a/examples/run_hfp_handsfree.py b/examples/run_hfp_handsfree.py index 5433284c..be1d1ba6 100644 --- a/examples/run_hfp_handsfree.py +++ b/examples/run_hfp_handsfree.py @@ -57,6 +57,9 @@ def on_dlc(dlc: rfcomm.DLC, configuration: hfp.HfConfiguration): esco_parameters = hfp.ESCO_PARAMETERS[ hfp.DefaultCodecParameters.ESCO_CVSD_S4 ] + else: + raise RuntimeError("unknown active codec") + connection.abort_on( 'disconnection', connection.device.send_command( diff --git a/pyproject.toml b/pyproject.toml index eb22842c..8aa13c43 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -45,6 +45,7 @@ ignore="pandora" # FIXME: pylint does not support stubs yet: [tool.pylint.typecheck] signature-mutators="AsyncRunner.run_in_task" +disable="not-callable" [tool.black] skip-string-normalization = true