|
22 | 22 | ``` |
23 | 23 | """ |
24 | 24 |
|
| 25 | +# ruff: noqa: BLE001 |
| 26 | + |
25 | 27 | import asyncio |
26 | 28 | import datetime |
27 | 29 | import functools |
|
38 | 40 | import click |
39 | 41 | import click_shell |
40 | 42 | import yaml |
41 | | - from pyshark import FileCapture # type: ignore |
42 | | - from pyshark.capture.live_capture import LiveCapture, UnknownInterfaceException # type: ignore |
43 | | - from pyshark.packet.packet import Packet # type: ignore |
| 43 | + from pyshark import FileCapture # type: ignore[import-untyped] |
| 44 | + from pyshark.capture.live_capture import LiveCapture, UnknownInterfaceException # type: ignore[import-untyped] |
| 45 | + from pyshark.packet.packet import Packet # type: ignore[import-untyped] |
44 | 46 | except ImportError as err: |
45 | 47 | raise SystemExit( |
46 | 48 | f"The 'roborock' command line tool requires extra dependencies that are not installed ({err.name}).\n" |
@@ -307,7 +309,7 @@ async def set(self, value: CacheData) -> None: |
307 | 309 | @click.pass_context |
308 | 310 | def cli(ctx, debug: int): |
309 | 311 | logging_config: dict[str, Any] = {"level": logging.DEBUG if debug > 0 else logging.INFO} |
310 | | - logging.basicConfig(**logging_config) # type: ignore |
| 312 | + logging.basicConfig(**logging_config) # type: ignore[call-overload] |
311 | 313 | ctx.obj = RoborockContext() |
312 | 314 |
|
313 | 315 |
|
@@ -988,26 +990,24 @@ def on_package(packet: Packet): |
988 | 990 | local_key, |
989 | 991 | ) |
990 | 992 | print(f"Received request: {f}") |
991 | | - except BaseException as e: |
| 993 | + except Exception as e: |
992 | 994 | print(e) |
993 | | - pass |
994 | 995 | elif packet.ip.src == device_ip: |
995 | 996 | try: |
996 | 997 | f, buffer["data"] = MessageParser.parse( |
997 | 998 | buffer["data"] + bytes.fromhex(packet.DATA.data), |
998 | 999 | local_key, |
999 | 1000 | ) |
1000 | 1001 | print(f"Received response: {f}") |
1001 | | - except BaseException as e: |
| 1002 | + except Exception as e: |
1002 | 1003 | print(e) |
1003 | | - pass |
1004 | 1004 |
|
1005 | 1005 | try: |
1006 | 1006 | await capture.packets_from_tshark(on_package, close_tshark=not file_provided) |
1007 | | - except UnknownInterfaceException: |
| 1007 | + except UnknownInterfaceException as err: |
1008 | 1008 | raise RoborockException( |
1009 | 1009 | "You need to run 'rvictl -s XXXXXXXX-XXXXXXXXXXXXXXXX' first, with an iPhone connected to usb port" |
1010 | | - ) |
| 1010 | + ) from err |
1011 | 1011 |
|
1012 | 1012 |
|
1013 | 1013 | def _parse_diagnostic_file(diagnostic_path: Path) -> dict[str, dict[str, Any]]: |
@@ -1319,7 +1319,7 @@ def write_markdown_table(product_features: dict[str, dict[str, any]], all_featur |
1319 | 1319 | ] |
1320 | 1320 | # Regular features are the remaining keys, sorted alphabetically |
1321 | 1321 | # We filter out the special rows to avoid duplicating them. |
1322 | | - sorted_features = sorted(list(all_features - set(special_rows))) |
| 1322 | + sorted_features = sorted(all_features - set(special_rows)) |
1323 | 1323 |
|
1324 | 1324 | header = ["Feature"] + sorted_products |
1325 | 1325 |
|
|
0 commit comments