Skip to content

Commit a1308cd

Browse files
committed
chore(ruff) Autofixes for ruff with python 3.10 +
uv run ruff check . --fix --show-fixes Building libtmux @ file:///home/d/work/python/libtmux Built libtmux @ file:///home/d/work/python/libtmux Uninstalled 1 package in 0.43ms Installed 1 package in 0.65ms B905 `zip()` without an explicit `strict=` parameter --> src/libtmux/_internal/query_list.py:495:25 | 494 | if len(self) == len(data): 495 | for a, b in zip(self, data): | ^^^^^^^^^^^^^^^ 496 | if isinstance(a, Mapping): 497 | a_keys = a.keys() | help: Add explicit value for parameter `strict=` UP007 Use `X | Y` for type annotations --> src/libtmux/_vendor/version.py:24:17 | 22 | __all__ = ["VERSION_PATTERN", "InvalidVersion", "Version", "parse"] 23 | 24 | InfiniteTypes = t.Union[InfinityType, NegativeInfinityType] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 25 | PrePostDevType = t.Union[InfiniteTypes, tuple[str, int]] 26 | SubLocalType = t.Union[InfiniteTypes, int, str] | help: Convert to `X | Y` UP007 Use `X | Y` for type annotations --> src/libtmux/_vendor/version.py:25:18 | 24 | InfiniteTypes = t.Union[InfinityType, NegativeInfinityType] 25 | PrePostDevType = t.Union[InfiniteTypes, tuple[str, int]] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 26 | SubLocalType = t.Union[InfiniteTypes, int, str] 27 | LocalType = t.Union[ | help: Convert to `X | Y` UP007 Use `X | Y` for type annotations --> src/libtmux/_vendor/version.py:26:16 | 24 | InfiniteTypes = t.Union[InfinityType, NegativeInfinityType] 25 | PrePostDevType = t.Union[InfinityTypes, tuple[str, int]] 26 | SubLocalType = t.Union[InfiniteTypes, int, str] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 27 | LocalType = t.Union[ 28 | NegativeInfinityType, | help: Convert to `X | Y` UP007 Use `X | Y` for type annotations --> src/libtmux/_vendor/version.py:27:13 | 25 | PrePostDevType = t.Union[InfiniteTypes, tuple[str, int]] 26 | SubLocalType = t.Union[InfiniteTypes, int, str] 27 | LocalType = t.Union[ | _____________^ 28 | | NegativeInfinityType, 29 | | tuple[ 30 | | SubLocalType | tuple[SubLocalType, str] | tuple[NegativeInfinityType, SubLocalType], 31 | | ..., 32 | | ], 33 | | ] | |^ 34 | CmpKey = tuple[ 35 | int, | help: Convert to `X | Y` E501 Line too long (92 > 88) --> src/libtmux/_vendor/version.py:30:89 | 28 | NegativeInfinityType, 29 | tuple[ 30 | SubLocalType | tuple[SubLocalType, str] | tuple[NegativeInfinityType, SubLocalType], | ^^^^ 31 | ..., 32 | ], | UP045 Use `X | None` for type annotations --> src/libtmux/neo.py:16:21 | 14 | if t.TYPE_CHECKING: 15 | ListCmd = t.Literal["list-sessions", "list-windows", "list-panes"] 16 | ListExtraArgs = t.Optional[Iterable[str]] | ^^^^^^^^^^^^^^^^^^^^^^^^^ 17 | 18 | from libtmux.server import Server | help: Convert to `X | None` B905 `zip()` without an explicit `strict=` parameter --> src/libtmux/neo.py:227:14 | 226 | obj_formatters = [ 227 | dict(zip(formats, formatter.split(FORMAT_SEPARATOR))) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 228 | for formatter in obj_output 229 | ] | help: Add explicit value for parameter `strict=` B905 `zip()` without an explicit `strict=` parameter --> src/libtmux/pane.py:707:32 | 705 | pane_output = pane_cmd.stdout[0] 706 | 707 | pane_formatters = dict(zip(["pane_id"], pane_output.split(FORMAT_SEPARATOR))) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 708 | 709 | return self.from_pane_id(server=self.server, pane_id=pane_formatters["pane_id"]) | help: Add explicit value for parameter `strict=` UP036 Version block is outdated for minimum Python version --> src/libtmux/server.py:41:8 | 39 | from libtmux._internal.types import StrPath 40 | 41 | if sys.version_info >= (3, 10): | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ 42 | from typing import Self, TypeAlias 43 | else: | help: Remove outdated version block B905 `zip()` without an explicit `strict=` parameter --> src/libtmux/server.py:585:13 | 584 | session_formatters = dict( 585 | zip(["session_id"], session_stdout.split(formats.FORMAT_SEPARATOR)), | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 586 | ) | help: Add explicit value for parameter `strict=` B905 `zip()` without an explicit `strict=` parameter --> src/libtmux/session.py:734:13 | 733 | window_formatters = dict( 734 | zip(["window_id"], window_output.split(FORMAT_SEPARATOR)), | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 735 | ) | help: Add explicit value for parameter `strict=` UP036 Version block is outdated for minimum Python version --> tests/legacy_api/test_version.py:17:8 | 15 | from collections.abc import Callable 16 | 17 | if sys.version_info >= (3, 10): | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ 18 | from typing import TypeAlias 19 | else: | help: Remove outdated version block UP045 Use `X | None` for type annotations --> tests/test_dataclasses.py:25:21 | 24 | ListCmd = t.Literal["list-sessions", "list-windows", "list-panes"] 25 | ListExtraArgs = t.Optional[tuple[str]] | ^^^^^^^^^^^^^^^^^^^^^^ | help: Convert to `X | None` UP036 Version block is outdated for minimum Python version --> tests/test_version.py:17:8 | 15 | from collections.abc import Callable 16 | 17 | if sys.version_info >= (3, 10): | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ 18 | from typing import TypeAlias 19 | else: | help: Remove outdated version block Fixed 7 errors: - src/libtmux/_internal/types.py: 1 × I001 (unsorted-imports) 1 × UP035 (deprecated-import) - src/libtmux/_vendor/version.py: 1 × UP007 (non-pep604-annotation-union) - src/libtmux/server.py: 1 × I001 (unsorted-imports) 1 × UP035 (deprecated-import) - tests/legacy_api/test_version.py: 1 × UP035 (deprecated-import) - tests/test_version.py: 1 × UP035 (deprecated-import) Found 22 errors (7 fixed, 15 remaining). No fixes available (8 hidden fixes can be enabled with the `--unsafe-fixes` option).
1 parent 5523e3d commit a1308cd

File tree

5 files changed

+9
-10
lines changed

5 files changed

+9
-10
lines changed

src/libtmux/_internal/types.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313

1414
if t.TYPE_CHECKING:
1515
from os import PathLike
16-
17-
from typing_extensions import TypeAlias
16+
from typing import TypeAlias
1817

1918
StrPath: TypeAlias = "str | PathLike[str]"

src/libtmux/_vendor/version.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,9 @@
2727
LocalType = t.Union[
2828
NegativeInfinityType,
2929
tuple[
30-
t.Union[
31-
SubLocalType,
32-
tuple[SubLocalType, str],
33-
tuple[NegativeInfinityType, SubLocalType],
34-
],
30+
SubLocalType
31+
| tuple[SubLocalType, str]
32+
| tuple[NegativeInfinityType, SubLocalType],
3533
...,
3634
],
3735
]

src/libtmux/server.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,9 @@
4141
if sys.version_info >= (3, 10):
4242
from typing import Self, TypeAlias
4343
else:
44-
from typing_extensions import Self, TypeAlias
44+
from typing import TypeAlias
45+
46+
from typing_extensions import Self
4547

4648
DashLiteral: TypeAlias = t.Literal["-"]
4749

tests/legacy_api/test_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
if sys.version_info >= (3, 10):
1818
from typing import TypeAlias
1919
else:
20-
from typing_extensions import TypeAlias
20+
from typing import TypeAlias
2121

2222
try:
2323
from _pytest.raises import RaisesExc

tests/test_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
if sys.version_info >= (3, 10):
1818
from typing import TypeAlias
1919
else:
20-
from typing_extensions import TypeAlias
20+
from typing import TypeAlias
2121

2222
try:
2323
from _pytest.raises import RaisesExc

0 commit comments

Comments
 (0)