Skip to content

Commit a92743f

Browse files
committed
poetry: bump dbus-fast to 3.1.2 in the lock file
This pulls in some fixes to prevent leaking resources and allows us to drop a bunch of "assert reply" lines that were only there to keep type checkers happy. We still allow older versions of dbus-fast for better compatibility with existing installations.
1 parent 0df017d commit a92743f

File tree

4 files changed

+39
-67
lines changed

4 files changed

+39
-67
lines changed

bleak/backends/bluezdbus/client.py

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,6 @@ async def disconnect_device() -> None:
272272
],
273273
)
274274
)
275-
assert reply
276275
assert_reply(reply)
277276

278277
# REVIST: This leaves "Trusted" property set if we
@@ -306,7 +305,6 @@ async def disconnect_device() -> None:
306305
member="Connect",
307306
)
308307
)
309-
assert reply
310308

311309
if reply.message_type == MessageType.ERROR:
312310
# This error is often caused by RF interference
@@ -459,7 +457,6 @@ async def disconnect(self) -> None:
459457
member="Disconnect",
460458
)
461459
)
462-
assert reply
463460
assert_reply(reply)
464461
async with async_timeout(10):
465462
await self._disconnecting_event.wait()
@@ -489,7 +486,6 @@ async def pair(self, *args: Any, **kwargs: Any) -> None:
489486
body=[defs.DEVICE_INTERFACE, "Paired"],
490487
)
491488
)
492-
assert reply
493489
assert_reply(reply)
494490
if reply.body[0].value:
495491
logger.debug("BLE device @ %s is already paired", self.address)
@@ -506,7 +502,6 @@ async def pair(self, *args: Any, **kwargs: Any) -> None:
506502
body=[defs.DEVICE_INTERFACE, "Trusted", Variant("b", True)],
507503
)
508504
)
509-
assert reply
510505
assert_reply(reply)
511506

512507
logger.debug("Pairing to BLE device @ %s", self.address)
@@ -519,7 +514,6 @@ async def pair(self, *args: Any, **kwargs: Any) -> None:
519514
member="Pair",
520515
)
521516
)
522-
assert reply
523517
assert_reply(reply)
524518

525519
# For resolvable private addresses, the address will
@@ -568,7 +562,6 @@ async def unpair(self) -> None:
568562
body=[device_path],
569563
)
570564
)
571-
assert reply
572565
assert_reply(reply)
573566
except BleakDBusError as e:
574567
if e.dbus_error == "org.bluez.Error.DoesNotExist":
@@ -632,7 +625,6 @@ async def _acquire_mtu(self) -> None:
632625
body=[{}],
633626
)
634627
)
635-
assert reply
636628
assert_reply(reply)
637629

638630
# we aren't actually using the write or notify, we just want the MTU
@@ -750,8 +742,6 @@ async def read_gatt_char(
750742
)
751743
)
752744

753-
assert reply
754-
755745
if reply.error_name == "org.bluez.Error.InProgress":
756746
logger.debug("retrying characteristic ReadValue due to InProgress")
757747
# Avoid calling in a tight loop. There is no dbus signal to
@@ -800,8 +790,6 @@ async def read_gatt_descriptor(
800790
)
801791
)
802792

803-
assert reply
804-
805793
if reply.error_name == "org.bluez.Error.InProgress":
806794
logger.debug("retrying descriptor ReadValue due to InProgress")
807795
# Avoid calling in a tight loop. There is no dbus signal to
@@ -843,8 +831,6 @@ async def write_gatt_char(
843831
)
844832
)
845833

846-
assert reply
847-
848834
if reply.error_name == "org.bluez.Error.InProgress":
849835
logger.debug("retrying characteristic WriteValue due to InProgress")
850836
# Avoid calling in a tight loop. There is no dbus signal to
@@ -890,8 +876,6 @@ async def write_gatt_descriptor(
890876
)
891877
)
892878

893-
assert reply
894-
895879
if reply.error_name == "org.bluez.Error.InProgress":
896880
logger.debug("retrying descriptor WriteValue due to InProgress")
897881
# Avoid calling in a tight loop. There is no dbus signal to
@@ -975,7 +959,6 @@ async def start_notify(
975959
signature="a{sv}",
976960
)
977961
)
978-
assert reply
979962
assert_reply(reply)
980963

981964
unix_fd = reply.unix_fds[0]
@@ -991,7 +974,6 @@ async def start_notify(
991974
member="StartNotify",
992975
)
993976
)
994-
assert reply
995977
assert_reply(reply)
996978

997979
@override
@@ -1041,6 +1023,5 @@ async def stop_notify(self, characteristic: BleakGATTCharacteristic) -> None:
10411023
member="StopNotify",
10421024
)
10431025
)
1044-
assert reply
10451026
assert_reply(reply)
10461027
self._notification_callbacks.pop(characteristic.obj[0], None)

bleak/backends/bluezdbus/manager.py

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,6 @@ async def async_init(self) -> None:
308308
interface=defs.OBJECT_MANAGER_INTERFACE,
309309
)
310310
)
311-
assert reply
312311
assert_reply(reply)
313312

314313
# dictionaries are cleared in case AddInterfaces was received first
@@ -465,7 +464,6 @@ async def active_scan(
465464
body=[filters],
466465
)
467466
)
468-
assert reply
469467
assert_reply(reply)
470468

471469
# Start scanning
@@ -477,7 +475,6 @@ async def active_scan(
477475
member="StartDiscovery",
478476
)
479477
)
480-
assert reply
481478
assert_reply(reply)
482479

483480
async def stop() -> None:
@@ -502,7 +499,6 @@ async def stop() -> None:
502499
member="StopDiscovery",
503500
)
504501
)
505-
assert reply
506502

507503
try:
508504
assert_reply(reply)
@@ -521,7 +517,6 @@ async def stop() -> None:
521517
body=[{}],
522518
)
523519
)
524-
assert reply
525520
assert_reply(reply)
526521

527522
return stop
@@ -589,7 +584,6 @@ async def passive_scan(
589584
body=[monitor_path],
590585
)
591586
)
592-
assert reply
593587

594588
if (
595589
reply.message_type == MessageType.ERROR
@@ -631,7 +625,6 @@ async def stop() -> None:
631625
body=[monitor_path],
632626
)
633627
)
634-
assert reply
635628
assert_reply(reply)
636629

637630
return stop

bleak/backends/bluezdbus/signals.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,6 @@ async def add_match(bus: MessageBus, rules: MatchRules) -> Message:
193193
body=[str(rules)],
194194
)
195195
)
196-
assert reply
197196

198197
return reply
199198

@@ -210,6 +209,5 @@ async def remove_match(bus: MessageBus, rules: MatchRules) -> Message:
210209
body=[str(rules)],
211210
)
212211
)
213-
assert reply
214212

215213
return reply

poetry.lock

Lines changed: 39 additions & 39 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)