Skip to content

Commit

Permalink
fix some linter warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
barbibulle committed Oct 28, 2024
1 parent f169cea commit a00abd6
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 0 deletions.
2 changes: 2 additions & 0 deletions bumble/avc.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,8 @@ def from_bytes(data: bytes) -> 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 :]
Expand Down
1 change: 1 addition & 0 deletions bumble/l2cap.py
Original file line number Diff line number Diff line change
Expand Up @@ -1911,6 +1911,7 @@ def on_l2cap_information_request(
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,
Expand Down
2 changes: 2 additions & 0 deletions bumble/link.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,8 @@ def send_acl_data(self, sender_controller, destination_address, transport, data)
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)
Expand Down
2 changes: 2 additions & 0 deletions bumble/profiles/bap.py
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,7 @@ def from_bytes(cls, data: bytes) -> 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,
Expand Down Expand Up @@ -426,6 +427,7 @@ def from_bytes(cls, data: bytes) -> 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,
Expand Down
2 changes: 2 additions & 0 deletions bumble/sdp.py
Original file line number Diff line number Diff line change
Expand Up @@ -434,6 +434,8 @@ def __bytes__(self):
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
Expand Down
1 change: 1 addition & 0 deletions examples/run_extended_advertiser_2.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
Expand Down
3 changes: 3 additions & 0 deletions examples/run_hfp_handsfree.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ def on_sco_request(connection: Connection, link_type: int, protocol: HfProtocol)
esco_parameters = hfp.ESCO_PARAMETERS[
hfp.DefaultCodecParameters.ESCO_CVSD_S4
]
else:
raise RuntimeError("unknown active codec")

connection.abort_on(
'disconnection',
connection.device.send_command(
Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit a00abd6

Please sign in to comment.