nixbot

builds
1treefmt v2.5.0ERRO formatter | ruff-check: failed to apply with options '[check --fix]': exit status 123EXE001 Shebang is present but file is not executable4 --> doc/generate_command_reference.py:1:15 |61 | #!/usr/bin/env python7 | ^^^^^^^^^^^^^^^^^^^^^82 |93 | import os.path10 |1112BLE001 Do not catch blind exception: `Exception`13 --> examples/asyncio_example.py:15:1214 |1513 | try:1614 | await client.connect("localhost", 6600)1715 | except Exception as e:18 | ^^^^^^^^^1916 | print("Connection failed:", e)2017 | return21 |2223BLE001 Do not catch blind exception: `Exception`24 --> examples/asyncio_example.py:23:1225 |2621 | try:2722 | status = await client.status()2823 | except Exception as e:29 | ^^^^^^^^^3024 | print("Status error:", e)3125 | return32 |3334BLE001 Do not catch blind exception: `Exception`35 --> examples/asyncio_example.py:47:1236 |3745 | try:3846 | await client.addid()3947 | except Exception as e:40 | ^^^^^^^^^4148 | print("An erroneous command, as expected, raised:", e)42 |4344BLE001 Do not catch blind exception: `Exception`45 --> examples/asyncio_example.py:53:1246 |4751 | async for x in client.plchangesposid():4852 | print("Why does this work?")4953 | except Exception as e:50 | ^^^^^^^^^5154 | print("An erroneous asynchronously looped command, as expected, raised:", e)52 |5354EXE001 Shebang is present but file is not executable55 --> examples/coverart.py:1:156 |571 | #!/usr/bin/env python58 | ^^^^^^^^^^^^^^^^^^^^^592 |603 | # IMPORTS61 |6263TRY201 Use `raise` without specifying exception name64 --> examples/coverart.py:39:1565 |6637 | # mpd.base.CommandError: [50@0] {albumart} No file exists6738 | if error.errno is not FailureResponseCode.NO_EXIST:6839 | raise error69 | ^^^^^7040 |7141 | try:72 |73help: Remove exception name7475EXE001 Shebang is present but file is not executable76 --> examples/errorhandling.py:1:177 |781 | #! /usr/bin/env python79 | ^^^^^^^^^^^^^^^^^^^^^^802 | #813 | # Introduction82 |8384RUF059 Unpacked variable `errno` is never used85 --> examples/errorhandling.py:30:1386 |8728 | # Catch socket errors8829 | except OSError as err:8930 | errno, strerror = err90 | ^^^^^9131 | raise PollerError("Could not connect to '%s': %s" % (self._host, strerror))92 |93help: Prefix it with an underscore or any other dummy variable pattern9495UP031 Use format specifiers instead of percent format96 --> examples/errorhandling.py:31:3197 |9829 | except OSError as err:9930 | errno, strerror = err10031 | raise PollerError("Could not connect to '%s': %s" % (self._host, strerror))101 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^10232 |10333 | # Catch all other possible errors104 |105help: Replace with format specifiers106107UP031 Use format specifiers instead of percent format108 --> examples/errorhandling.py:38:31109 |11036 | # they are instead of ignoring them.11137 | except MPDError as e:11238 | raise PollerError("Could not connect to '%s': %s" % (self._host, e))113 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^11439 |11540 | if self._password:116 |117help: Replace with format specifiers118119UP031 Use format specifiers instead of percent format120 --> examples/errorhandling.py:49:21121 |12247 | # split into errno, offset, command and msg.12348 | raise PollerError(12449 | / "Could not connect to '%s': "12550 | | "password commmand failed: [%d] %s" % (self._host, e.errno, e.msg)126 | |_______________________________________________________^12751 | )128 |129help: Replace with format specifiers130131UP031 Use format specifiers instead of percent format132 --> examples/errorhandling.py:56:21133 |13454 | except (OSError, MPDError) as e:13555 | raise PollerError(13656 | / "Could not connect to '%s': "13757 | | "error with password command: %s" % (self._host, e)138 | |_______________________________________________________________________^13958 | )140 |141help: Replace with format specifiers142143UP031 Use format specifiers instead of percent format144 --> examples/errorhandling.py:94:35145 |14692 | # Reconnecting failed14793 | except PollerError as e:14894 | raise PollerError("Reconnecting failed: %s" % e)149 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^15095 |15196 | try:152 |153help: Replace with format specifiers154155UP031 Use format specifiers instead of percent format156 --> examples/errorhandling.py:101:35157 |158 99 | # Failed again, just give up159100 | except (OSError, MPDError) as e:160101 | raise PollerError("Couldn't retrieve current song: %s" % e)161 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^162102 |163103 | # Hurray! We got the current song without any errors!164 |165help: Replace with format specifiers166167UP031 Use format specifiers instead of percent format168 --> examples/errorhandling.py:126:15169 |170124 | # Catch fatal poller errors171125 | except PollerError as e:172126 | print("Fatal poller error: %s" % e, file=sys.stderr)173 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^174127 | sys.exit(1)175 |176help: Replace with format specifiers177178BLE001 Do not catch blind exception: `Exception`179 --> examples/errorhandling.py:130:12180 |181129 | # Catch all other non-exit errors182130 | except Exception as e:183 | ^^^^^^^^^184131 | print("Unexpected exception: %s" % e, file=sys.stderr)185132 | sys.exit(1)186 |187188UP031 Use format specifiers instead of percent format189 --> examples/errorhandling.py:131:15190 |191129 | # Catch all other non-exit errors192130 | except Exception as e:193131 | print("Unexpected exception: %s" % e, file=sys.stderr)194 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^195132 | sys.exit(1)196 |197help: Replace with format specifiers198199BLE001 Do not catch blind exception: `Exception`200 --> examples/errorhandling.py:135:12201 |202134 | # Catch the remaining exit errors203135 | except Exception:204 | ^^^^^^^^^205136 | sys.exit(0)206 |207208B025 try-except block with duplicate exception `Exception`209 --> examples/errorhandling.py:135:12210 |211134 | # Catch the remaining exit errors212135 | except Exception:213 | ^^^^^^^^^214136 | sys.exit(0)215 |216217EXE001 Shebang is present but file is not executable218 --> examples/helloworld.py:1:1219 |2201 | #!/usr/bin/python221 | ^^^^^^^^^^^^^^^^^2222 | import mpd223 |224225UP031 Use format specifiers instead of percent format226 --> examples/helloworld.py:8:11227 |228 7 | for entry in client.lsinfo("/"):229 8 | print("%s" % entry)230 | ^^^^^^^^^^^^231 9 | for key, value in client.status().items():23210 | print("%s: %s" % (key, value))233 |234help: Replace with format specifiers235236UP031 Use format specifiers instead of percent format237 --> examples/helloworld.py:10:11238 |239 8 | print("%s" % entry)240 9 | for key, value in client.status().items():24110 | print("%s: %s" % (key, value))242 | ^^^^^^^^^^^^^^^^^^^^^^^243help: Replace with format specifiers244245EXE001 Shebang is present but file is not executable246 --> examples/randomqueue.py:1:1247 |2481 | #!/usr/bin/env python249 | ^^^^^^^^^^^^^^^^^^^^^2502 |2513 | # IMPORTS252 |253254EXE001 Shebang is present but file is not executable255 --> examples/stats.py:1:1256 |2571 | #!/usr/bin/env python258 | ^^^^^^^^^^^^^^^^^^^^^2592 |2603 | # IMPORTS261 |262263EXE001 Shebang is present but file is not executable264 --> examples/stickers.py:26:1265 |26624 | # sticker.py26725 |26826 | #! /usr/bin/env python269 | ^^^^^^^^^^^^^^^^^^^^^^27027 |27128 | from optparse import OptionParser272 |273274EXE005 Shebang should be at the beginning of the file275 --> examples/stickers.py:26:1276 |27724 | # sticker.py27825 |27926 | #! /usr/bin/env python280 | ^^^^^^^^^^^^^^^^^^^^^^28127 |28228 | from optparse import OptionParser283 |284285UP031 Use format specifiers instead of percent format286 --> examples/stickers.py:74:22287 |28873 | if len(args) < 1:28974 | parser.error("no action specified, must be one of: %s" % " ".join(ACTIONS))290 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^29175 | action = args.pop(0)292 |293help: Replace with format specifiers294295UP031 Use format specifiers instead of percent format296 --> examples/stickers.py:78:22297 |29877 | if action not in ACTIONS:29978 | parser.error("action must be one of: %s" % " ".join(ACTIONS))300 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^30179 |30280 | if len(args) < 1:303 |304help: Replace with format specifiers305306UP031 Use format specifiers instead of percent format307 --> examples/stickers.py:102:13308 |309100 | except OSError as e:310101 | print(311102 | "%s: error with connection to MPD: %s" % (parser.get_prog_name(), e[1]),312 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^313103 | file=stderr,314104 | )315 |316help: Replace with format specifiers317318UP031 Use format specifiers instead of percent format319 --> examples/stickers.py:107:13320 |321105 | except MPDError as e:322106 | print(323107 | "%s: error executing action: %s" % (parser.get_prog_name(), e), file=stderr324 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^325108 | )326 |327help: Replace with format specifiers328329TRY002 Create your own exception330 --> mpd/__init__.py:37:19331 |33235 | class MPDProtocolDummy:33336 | def __init__(self) -> None:33437 | raise Exception("No twisted module found")335 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^33638 |33739 | MPDProtocol = MPDProtocolDummy # type: ignore338 |339340BLE001 Do not catch blind exception: `Exception`341 --> mpd/asyncio.py:157:16342 |343155 | async for r in self:344156 | result.append(r)345157 | except Exception as e:346 | ^^^^^^^^^347158 | self.set_exception(e)348159 | else:349 |350351C405 Unnecessary list literal (rewrite as a set literal)352 --> mpd/asyncio.py:339:38353 |354337 | # The presumably most quiet subsystem -- in this case,355338 | # idle is only used to keep the connection alive.356339 | subsystems = set(["database"])357 | ^^^^^^^^^^^^^^^^^358340 |359341 | # Careful: There can't be any await points between the360 |361help: Rewrite as a set literal362363B006 Do not use mutable data structures for argument defaults364 --> mpd/asyncio.py:472:33365 |366470 | self,367471 | lines: "asyncio.Queue[str]",368472 | delimiters: list[str] = [],369 | ^^370473 | lookup_delimiter: bool = False,371474 | ) -> AsyncIterator[dict[str, str]]:372 |373help: Replace with `None`; initialize within function374375T100 Trace found: `breakpoint` used376 --> mpd/asyncio.py:546:17377 |378544 | args[-1] = len(data)379545 | if len(data) > size:380546 | breakpoint()381 | ^^^^^^^^^^^^382547 | raise CommandListError("Binary data announced size exceeded")383548 | elif len(data) == size:384 |385386ISC004 Unparenthesized implicit string concatenation in collection387 --> mpd/asyncio.py:618:25388 |389616 | except asyncio.QueueFull as e:390617 | e.args = (391618 | / "Command queue overflowing; this indicates the"392619 | | " application sending commands in an uncontrolled"393620 | | " fashion without awaiting them, and typically"394621 | | " indicates a memory leak.",395 | |___________________________________________________^396622 | )397623 | # While we *could* indicate to the queued result that it has398 |399help: Did you forget a comma?400help: Wrap implicitly concatenated strings in parentheses401402BLE001 Do not catch blind exception: `BaseException`403 --> mpd/asyncio.py:639:24404 |405637 | try:406638 | self._write_command(result._command, result._args)407639 | except BaseException as e:408 | ^^^^^^^^^^^^^409640 | self.disconnect()410641 | result.set_exception(e)411 |412413B006 Do not use mutable data structures for argument defaults414 --> mpd/asyncio.py:650:52415 |416648 | # commands that just work differently417649 | async def idle(418650 | self, subsystems: list[str] | tuple[str] = []419 | ^^420651 | ) -> AsyncIterator[list[str] | Exception]:421652 | if self.__idle_consumers is None:422 |423help: Replace with `None`; initialize within function424425UP031 Use format specifiers instead of percent format426 --> mpd/base.py:127:17427 |428125 | if kwargs:429126 | raise AttributeError(430127 | "mpd_commands() got unexpected keyword arguments %s" % ",".join(kwargs)431 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^432128 | )433 |434help: Replace with format specifiers435436B006 Do not use mutable data structures for argument defaults437 --> mpd/base.py:213:33438 |439211 | self,440212 | lines: Iterable[str],441213 | delimiters: list[str] = [],442 | ^^443214 | lookup_delimiter: bool = False,444215 | ) -> Iterator[dict[str, str]]:445 |446help: Replace with `None`; initialize within function447448RUF059 Unpacked variable `key` is never used449 --> mpd/base.py:419:9450 |451417 | @mpd_commands("sticker get")452418 | def _parse_sticker(self, lines: list[str]) -> str:453419 | key, value = list(self._parse_raw_stickers(lines))[0]454 | ^^^455420 | return value456 |457help: Prefix it with an underscore or any other dummy variable pattern458459RUF015 Prefer `next(iter(self._parse_raw_stickers(lines)))` over single element slice460 --> mpd/base.py:419:22461 |462417 | @mpd_commands("sticker get")463418 | def _parse_sticker(self, lines: list[str]) -> str:464419 | key, value = list(self._parse_raw_stickers(lines))[0]465 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^466420 | return value467 |468help: Replace with `next(iter(self._parse_raw_stickers(lines)))`469470B006 Do not use mutable data structures for argument defaults471 --> mpd/base.py:440:59472 |473439 | def collect(474440 | cls: Any, callbacks: dict[str, tuple[Any, Any]] = {}475 | ^^476441 | ) -> dict[str, tuple[Any, Any]]:477442 | """Collect MPD command callbacks from given class.478 |479help: Replace with `None`; initialize within function480481PERF102 When using only the values of a dict use the `values()` method482 --> mpd/base.py:456:24483 |484454 | return callbacks485455 |486456 | for name, value in collect(cls).items():487 | ^^^^^^^^^^^^^^^^^^488457 | callback, from_ = value489458 | for command in callback.mpd_commands:490 |491help: Replace `.items()` with `.values()`492493RUF059 Unpacked variable `from_` is never used494 --> mpd/base.py:457:19495 |496456 | for name, value in collect(cls).items():497457 | callback, from_ = value498 | ^^^^^499458 | for command in callback.mpd_commands:500459 | cls.add_command(command, callback)501 |502help: Prefix it with an underscore or any other dummy variable pattern503504RUF012 Mutable default value for class attribute505 --> mpd/base.py:506:30506 |507504 | idletimeout = None508505 | _timeout = None509506 | _wrap_iterator_parsers = [510 | ______________________________^511507 | | MPDClientBase._parse_list,512508 | | MPDClientBase._parse_list_groups,513509 | | MPDClientBase._parse_playlist,514510 | | MPDClientBase._parse_changes,515511 | | MPDClientBase._parse_songs,516512 | | MPDClientBase._parse_mounts,517513 | | MPDClientBase._parse_neighbors,518514 | | MPDClientBase._parse_partitions,519515 | | MPDClientBase._parse_playlists,520516 | | MPDClientBase._parse_database,521517 | | MPDClientBase._parse_messages,522518 | | MPDClientBase._parse_outputs,523519 | | MPDClientBase._parse_plugins,524520 | | ]525 | |_____^526521 |527522 | def __init__(self, use_unicode: bool | None = None) -> None:528 |529help: Consider initializing in `__init__` or annotating with `typing.ClassVar`530531B006 Do not use mutable data structures for argument defaults532 --> mpd/base.py:567:62533 |534565 | raise e.with_traceback(sys.exc_info()[2])535566 |536567 | def _write_command(self, command: str, args: list[Any] = []) -> None:537 | ^^538568 | parts = [command]539569 | for arg in args:540 |541help: Replace with `None`; initialize within function542543UP031 Use format specifiers instead of percent format544 --> mpd/base.py:648:25545 |546646 | self.disconnect()547647 | raise ConnectionError(548648 | / "Connection lost while reading binary data: "549649 | | "expected %d bytes, got %d" % (chunk_size, len(value))550 | |___________________________________________________^551650 | )552 |553help: Replace with format specifiers554555UP028 Replace `yield` over `for` loop with `yield from`556 --> mpd/base.py:735:13557 |558733 | ) -> Iterator[dict[str, str]]:559734 | try:560735 | / for item in iterator:561736 | | yield item562 | |__________________________^563737 | finally:564738 | self._iterating = False565 |566help: Replace with `yield from`567568RUF059 Unpacked variable `canonname` is never used569 --> mpd/base.py:775:34570 |571773 | socket.AI_ADDRCONFIG,572774 | ):573775 | af, socktype, proto, canonname, sa = res574 | ^^^^^^^^^575776 | sock = None576777 | try:577 |578help: Prefix it with an underscore or any other dummy variable pattern579580UP031 Use format specifiers instead of percent format581 --> mpd/tests.py:1269:24582 |5831267 | next_write = self._expectations[0][0][0]5841268 | except IndexError:5851269 | self.error("Data written to mock even though none expected: %r" % data)586 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^5871270 | if next_write == data:5881271 | self._expectations[0][0].pop(0)589 |590help: Replace with format specifiers591592UP031 Use format specifiers instead of percent format593 --> mpd/tests.py:1274:24594 |5951272 | self._feed()5961273 | else:5971274 | self.error("Mock got %r, expected %r" % (data, next_write))598 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^5991275 |6001276 | def close(self) -> None:601 |602help: Replace with format specifiers603604B006 Do not use mutable data structures for argument defaults605 --> mpd/twisted.py:153:47606 |607151 | @lock608152 | def _execute(609153 | self, command: str, args: list[str] = [], parser: Callable | None = None610 | ^^611154 | ) -> defer.Deferred:612155 | # close or kill command in command list not allowed613 |614help: Replace with `None`; initialize within function615616B006 Do not use mutable data structures for argument defaults617 --> mpd/twisted.py:178:63618 |619176 | return deferred620177 |621178 | def _create_command(self, command: str, args: list[str] = []) -> bytes:622 | ^^623179 | # XXX: this function should be generalized in future. There exists624180 | # almost identical code in ``MPDClient._write_command``, with the625 |626help: Replace with `None`; initialize within function627628B006 Do not use mutable data structures for argument defaults629 --> mpd/twisted.py:195:62630 |631193 | return " ".join(parts).encode("utf-8")632194 |633195 | def _write_command(self, command: str, args: list[str] = []) -> None:634 | ^^635196 | self.sendLine(self._create_command(command, args))636 |637help: Replace with `None`; initialize within function638639Found 298 errors (242 fixed, 56 remaining).640No fixes available (33 hidden fixes can be enabled with the `--unsafe-fixes` option).641642traversed 45 files643emitted 18 files for processing644formatted 0 files (14 changed) in 145ms645Error: failed to finalise formatting: formatting failures detected