Skip to content

Commit bb33e7c

Browse files
committed
Revert "refactor(ruff,mypy) Adjust typing targets for Python 3.10"
This reverts commit 8fdb96f.
1 parent 8fdb96f commit bb33e7c

File tree

10 files changed

+41
-33
lines changed

10 files changed

+41
-33
lines changed

src/libtmux/_internal/query_list.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -492,7 +492,7 @@ def __eq__(
492492
return False
493493

494494
if len(self) == len(data):
495-
for a, b in zip(self, data, strict=False):
495+
for a, b in zip(self, data):
496496
if isinstance(a, Mapping):
497497
a_keys = a.keys()
498498
if a.keys == b.keys():

src/libtmux/_internal/types.py

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

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

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

src/libtmux/_vendor/version.py

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -21,20 +21,20 @@
2121

2222
__all__ = ["VERSION_PATTERN", "InvalidVersion", "Version", "parse"]
2323

24-
InfiniteTypes = InfinityType | NegativeInfinityType
25-
PrePostDevType = InfiniteTypes | tuple[str, int]
26-
SubLocalType = InfiniteTypes | int | str
27-
LocalType = (
28-
NegativeInfinityType
29-
| tuple[
30-
(
31-
SubLocalType
32-
| tuple[SubLocalType, str]
33-
| tuple[NegativeInfinityType, SubLocalType]
34-
),
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[
28+
NegativeInfinityType,
29+
tuple[
30+
t.Union[
31+
SubLocalType,
32+
tuple[SubLocalType, str],
33+
tuple[NegativeInfinityType, SubLocalType],
34+
],
3535
...,
36-
]
37-
)
36+
],
37+
]
3838
CmpKey = tuple[
3939
int,
4040
tuple[int, ...],

src/libtmux/neo.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
if t.TYPE_CHECKING:
1515
ListCmd = t.Literal["list-sessions", "list-windows", "list-panes"]
16-
ListExtraArgs = Iterable[str] | None
16+
ListExtraArgs = t.Optional[Iterable[str]]
1717

1818
from libtmux.server import Server
1919

@@ -224,7 +224,7 @@ def fetch_objs(
224224
obj_output = proc.stdout
225225

226226
obj_formatters = [
227-
dict(zip(formats, formatter.split(FORMAT_SEPARATOR), strict=False))
227+
dict(zip(formats, formatter.split(FORMAT_SEPARATOR)))
228228
for formatter in obj_output
229229
]
230230

@@ -237,7 +237,7 @@ def fetch_obj(
237237
obj_key: str,
238238
obj_id: str,
239239
list_cmd: ListCmd = "list-panes",
240-
list_extra_args: ListExtraArgs = None,
240+
list_extra_args: ListExtraArgs | None = None,
241241
) -> OutputRaw:
242242
"""Fetch raw data from tmux command."""
243243
obj_formatters_filtered = fetch_objs(

src/libtmux/pane.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -704,9 +704,7 @@ def split(
704704

705705
pane_output = pane_cmd.stdout[0]
706706

707-
pane_formatters = dict(
708-
zip(["pane_id"], pane_output.split(FORMAT_SEPARATOR), strict=False)
709-
)
707+
pane_formatters = dict(zip(["pane_id"], pane_output.split(FORMAT_SEPARATOR)))
710708

711709
return self.from_pane_id(server=self.server, pane_id=pane_formatters["pane_id"])
712710

src/libtmux/server.py

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,16 @@
3333
)
3434

3535
if t.TYPE_CHECKING:
36+
import sys
3637
import types
37-
from typing import TypeAlias
38-
39-
from typing_extensions import Self
4038

4139
from libtmux._internal.types import StrPath
4240

41+
if sys.version_info >= (3, 10):
42+
from typing import Self, TypeAlias
43+
else:
44+
from typing_extensions import Self, TypeAlias
45+
4346
DashLiteral: TypeAlias = t.Literal["-"]
4447

4548
logger = logging.getLogger(__name__)
@@ -577,11 +580,7 @@ def new_session(
577580
os.environ["TMUX"] = env
578581

579582
session_formatters = dict(
580-
zip(
581-
["session_id"],
582-
session_stdout.split(formats.FORMAT_SEPARATOR),
583-
strict=False,
584-
),
583+
zip(["session_id"], session_stdout.split(formats.FORMAT_SEPARATOR)),
585584
)
586585

587586
return Session.from_session_id(

src/libtmux/session.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -731,7 +731,7 @@ def new_window(
731731
window_output = cmd.stdout[0]
732732

733733
window_formatters = dict(
734-
zip(["window_id"], window_output.split(FORMAT_SEPARATOR), strict=False),
734+
zip(["window_id"], window_output.split(FORMAT_SEPARATOR)),
735735
)
736736

737737
return Window.from_window_id(

tests/legacy_api/test_version.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,13 @@
1111
from libtmux._compat import LooseVersion
1212

1313
if t.TYPE_CHECKING:
14+
import sys
1415
from collections.abc import Callable
15-
from typing import TypeAlias
16+
17+
if sys.version_info >= (3, 10):
18+
from typing import TypeAlias
19+
else:
20+
from typing_extensions import TypeAlias
1621

1722
try:
1823
from _pytest.raises import RaisesExc

tests/test_dataclasses.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
from libtmux.server import Server
2323

2424
ListCmd = t.Literal["list-sessions", "list-windows", "list-panes"]
25-
ListExtraArgs = tuple[str] | None
25+
ListExtraArgs = t.Optional[tuple[str]]
2626

2727

2828
OutputRaw = dict[str, t.Any]

tests/test_version.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,13 @@
1111
from libtmux._compat import LooseVersion
1212

1313
if t.TYPE_CHECKING:
14+
import sys
1415
from collections.abc import Callable
15-
from typing import TypeAlias
16+
17+
if sys.version_info >= (3, 10):
18+
from typing import TypeAlias
19+
else:
20+
from typing_extensions import TypeAlias
1621

1722
try:
1823
from _pytest.raises import RaisesExc

0 commit comments

Comments
 (0)