Skip to content

Commit bb13d70

Browse files
committed
chore: Refine imports to use t namespace
1 parent 2863201 commit bb13d70

File tree

13 files changed

+31
-33
lines changed

13 files changed

+31
-33
lines changed

src/libtmux/_vendor/version.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,19 +14,19 @@
1414
import collections
1515
import itertools
1616
import re
17-
from typing import Callable, SupportsInt, Union
17+
import typing as t
1818

1919
from ._structures import Infinity, InfinityType, NegativeInfinity, NegativeInfinityType
2020

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

23-
InfiniteTypes = Union[InfinityType, NegativeInfinityType]
24-
PrePostDevType = Union[InfiniteTypes, tuple[str, int]]
25-
SubLocalType = Union[InfiniteTypes, int, str]
26-
LocalType = Union[
23+
InfiniteTypes = t.Union[InfinityType, NegativeInfinityType]
24+
PrePostDevType = t.Union[InfiniteTypes, tuple[str, int]]
25+
SubLocalType = t.Union[InfiniteTypes, int, str]
26+
LocalType = t.Union[
2727
NegativeInfinityType,
2828
tuple[
29-
Union[
29+
t.Union[
3030
SubLocalType,
3131
tuple[SubLocalType, str],
3232
tuple[NegativeInfinityType, SubLocalType],
@@ -42,7 +42,7 @@
4242
PrePostDevType,
4343
LocalType,
4444
]
45-
VersionComparisonMethod = Callable[[CmpKey, CmpKey], bool]
45+
VersionComparisonMethod = t.Callable[[CmpKey, CmpKey], bool]
4646

4747
_Version = collections.namedtuple(
4848
"_Version",
@@ -477,7 +477,7 @@ def micro(self) -> int:
477477

478478
def _parse_letter_version(
479479
letter: str,
480-
number: str | bytes | SupportsInt,
480+
number: str | bytes | t.SupportsInt,
481481
) -> tuple[str, int] | None:
482482
if letter:
483483
# We consider there to be an implicit 0 in a pre-release if there is

src/libtmux/pane.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
import pathlib
1313
import typing as t
1414
import warnings
15-
from typing import overload
1615

1716
from libtmux.common import has_gte_version, has_lt_version, tmux_cmd
1817
from libtmux.constants import (
@@ -349,14 +348,14 @@ def send_keys(
349348
if enter:
350349
self.enter()
351350

352-
@overload
351+
@t.overload
353352
def display_message(
354353
self,
355354
cmd: str,
356355
get_text: t.Literal[True],
357356
) -> str | list[str]: ...
358357

359-
@overload
358+
@t.overload
360359
def display_message(self, cmd: str, get_text: t.Literal[False]) -> None: ...
361360

362361
def display_message(

src/libtmux/test.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
import random
1010
import time
1111
import typing as t
12-
from typing import Callable
1312

1413
from typing_extensions import Self
1514

@@ -65,7 +64,7 @@ def __next__(self) -> str:
6564

6665

6766
def retry_until(
68-
fun: Callable[[], bool],
67+
fun: t.Callable[[], bool],
6968
seconds: float = RETRY_TIMEOUT_SECONDS,
7069
*,
7170
interval: float = RETRY_INTERVAL_SECONDS,

tests/legacy_api/test_pane.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44

55
import logging
66
import shutil
7-
from typing import TYPE_CHECKING
7+
import typing as t
88

9-
if TYPE_CHECKING:
9+
if t.TYPE_CHECKING:
1010
from libtmux.session import Session
1111

1212
logger = logging.getLogger(__name__)

tests/legacy_api/test_server.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@
44

55
import logging
66
import subprocess
7-
from typing import TYPE_CHECKING
7+
import typing as t
88

99
import pytest
1010

1111
from libtmux.common import has_gte_version
1212
from libtmux.server import Server
1313

14-
if TYPE_CHECKING:
14+
if t.TYPE_CHECKING:
1515
from libtmux.session import Session
1616

1717
logger = logging.getLogger(__name__)

tests/legacy_api/test_session.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
import logging
66
import shutil
7-
from typing import TYPE_CHECKING
7+
import typing as t
88

99
import pytest
1010

@@ -15,7 +15,7 @@
1515
from libtmux.test import TEST_SESSION_PREFIX, namer
1616
from libtmux.window import Window
1717

18-
if TYPE_CHECKING:
18+
if t.TYPE_CHECKING:
1919
from libtmux.server import Server
2020

2121
logger = logging.getLogger(__name__)

tests/legacy_api/test_tmuxobject.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@
33
from __future__ import annotations
44

55
import logging
6-
from typing import TYPE_CHECKING
6+
import typing as t
77

88
from libtmux.pane import Pane
99
from libtmux.session import Session
1010
from libtmux.test import TEST_SESSION_PREFIX, namer
1111
from libtmux.window import Window
1212

13-
if TYPE_CHECKING:
13+
if t.TYPE_CHECKING:
1414
from libtmux.server import Server
1515

1616
logger = logging.getLogger(__name__)

tests/legacy_api/test_window.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import logging
66
import shutil
77
import time
8-
from typing import TYPE_CHECKING
8+
import typing as t
99

1010
import pytest
1111

@@ -15,7 +15,7 @@
1515
from libtmux.server import Server
1616
from libtmux.window import Window
1717

18-
if TYPE_CHECKING:
18+
if t.TYPE_CHECKING:
1919
from libtmux.session import Session
2020

2121
logger = logging.getLogger(__name__)

tests/test_pane.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@
44

55
import logging
66
import shutil
7-
from typing import TYPE_CHECKING
7+
import typing as t
88

99
import pytest
1010

1111
from libtmux.common import has_gte_version, has_lt_version, has_lte_version
1212
from libtmux.constants import PaneDirection, ResizeAdjustmentDirection
1313
from libtmux.test import retry_until
1414

15-
if TYPE_CHECKING:
15+
if t.TYPE_CHECKING:
1616
from libtmux.session import Session
1717

1818
logger = logging.getLogger(__name__)

tests/test_pytest_plugin.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
from __future__ import annotations
44

55
import textwrap
6-
from typing import TYPE_CHECKING
6+
import typing as t
77

8-
if TYPE_CHECKING:
8+
if t.TYPE_CHECKING:
99
import pytest
1010

1111

tests/test_server.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@
66
import os
77
import subprocess
88
import time
9-
from typing import TYPE_CHECKING
9+
import typing as t
1010

1111
import pytest
1212

1313
from libtmux.common import has_gte_version, has_version
1414
from libtmux.server import Server
1515

16-
if TYPE_CHECKING:
16+
if t.TYPE_CHECKING:
1717
from libtmux.session import Session
1818

1919
logger = logging.getLogger(__name__)

tests/test_tmuxobject.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@
33
from __future__ import annotations
44

55
import logging
6-
from typing import TYPE_CHECKING
6+
import typing as t
77

88
from libtmux.pane import Pane
99
from libtmux.session import Session
1010
from libtmux.test import TEST_SESSION_PREFIX, namer
1111
from libtmux.window import Window
1212

13-
if TYPE_CHECKING:
13+
if t.TYPE_CHECKING:
1414
from libtmux.server import Server
1515

1616
logger = logging.getLogger(__name__)

tests/test_window.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import logging
66
import shutil
77
import time
8-
from typing import TYPE_CHECKING
8+
import typing as t
99

1010
import pytest
1111

@@ -21,7 +21,7 @@
2121
from libtmux.server import Server
2222
from libtmux.window import Window
2323

24-
if TYPE_CHECKING:
24+
if t.TYPE_CHECKING:
2525
from libtmux.session import Session
2626

2727
logger = logging.getLogger(__name__)

0 commit comments

Comments
 (0)