Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 0655497

Browse filesBrowse files
ppentchevtony
authored andcommitted
Only import from typing_extensions if needed
TypeAlias was included in the typing module in Python 3.10. Self was included in the typing module in Python 3.11.
1 parent 22e3b31 commit 0655497
Copy full SHA for 0655497

File tree

Expand file treeCollapse file tree

4 files changed

+25
-5
lines changed
Filter options
Expand file treeCollapse file tree

4 files changed

+25
-5
lines changed

‎src/libtmux/server.py

Copy file name to clipboardExpand all lines: src/libtmux/server.py
+6-1Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,12 @@
3333
)
3434

3535
if t.TYPE_CHECKING:
36-
from typing_extensions import TypeAlias
36+
import sys
37+
38+
if sys.version_info >= (3, 10):
39+
from typing import TypeAlias
40+
else:
41+
from typing_extensions import TypeAlias
3742

3843
DashLiteral: TypeAlias = t.Literal["-"]
3944

‎src/libtmux/test.py

Copy file name to clipboardExpand all lines: src/libtmux/test.py
+7-2Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,20 @@
1515
logger = logging.getLogger(__name__)
1616

1717
if t.TYPE_CHECKING:
18+
import sys
1819
import types
1920
from collections.abc import Callable, Generator
2021

21-
from typing_extensions import Self
22-
2322
from libtmux.server import Server
2423
from libtmux.session import Session
2524
from libtmux.window import Window
2625

26+
if sys.version_info >= (3, 11):
27+
from typing import Self
28+
else:
29+
from typing_extensions import Self
30+
31+
2732
TEST_SESSION_PREFIX = "libtmux_"
2833
RETRY_TIMEOUT_SECONDS = int(os.getenv("RETRY_TIMEOUT_SECONDS", 8))
2934
RETRY_INTERVAL_SECONDS = float(os.getenv("RETRY_INTERVAL_SECONDS", 0.05))

‎tests/legacy_api/test_version.py

Copy file name to clipboardExpand all lines: tests/legacy_api/test_version.py
+6-1Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,15 @@
1111
from libtmux._compat import LooseVersion
1212

1313
if t.TYPE_CHECKING:
14+
import sys
1415
from collections.abc import Callable
1516

1617
from _pytest.python_api import RaisesContext
17-
from typing_extensions import TypeAlias
18+
19+
if sys.version_info >= (3, 10):
20+
from typing import TypeAlias
21+
else:
22+
from typing_extensions import TypeAlias
1823

1924
VersionCompareOp: TypeAlias = Callable[
2025
[t.Any, t.Any],

‎tests/test_version.py

Copy file name to clipboardExpand all lines: tests/test_version.py
+6-1Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,15 @@
1111
from libtmux._compat import LooseVersion
1212

1313
if t.TYPE_CHECKING:
14+
import sys
1415
from collections.abc import Callable
1516

1617
from _pytest.python_api import RaisesContext
17-
from typing_extensions import TypeAlias
18+
19+
if sys.version_info >= (3, 10):
20+
from typing import TypeAlias
21+
else:
22+
from typing_extensions import TypeAlias
1823

1924
VersionCompareOp: TypeAlias = Callable[
2025
[t.Any, t.Any],

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.