Skip to content

Commit 71aaba3

Browse files
committed
chore(ruff): Autofixes for ruff with Python 3.10+
uv run ruff check . --fix --show-fixes Fixed 20 errors: - src/tmuxp/_internal/config_reader.py: 1 × UP035 (deprecated-import) - src/tmuxp/cli/__init__.py: 1 × I001 (unsorted-imports) 1 × UP035 (deprecated-import) - src/tmuxp/cli/freeze.py: 1 × UP035 (deprecated-import) - src/tmuxp/cli/load.py: 1 × I001 (unsorted-imports) 1 × UP035 (deprecated-import) - src/tmuxp/cli/shell.py: 1 × UP035 (deprecated-import) - src/tmuxp/cli/utils.py: 1 × UP007 (non-pep604-annotation-union) 1 × I001 (unsorted-imports) 1 × UP035 (deprecated-import) - src/tmuxp/plugin.py: 1 × I001 (unsorted-imports) 1 × UP035 (deprecated-import) - src/tmuxp/shell.py: 1 × I001 (unsorted-imports) 1 × UP035 (deprecated-import) - src/tmuxp/workspace/finders.py: 1 × I001 (unsorted-imports) 1 × UP035 (deprecated-import) - tests/cli/test_load.py: 1 × UP007 (non-pep604-annotation-union) 1 × UP035 (deprecated-import) 1 × I001 (unsorted-imports) 1 × UP045 (non-pep604-annotation-optional) Found 24 errors (20 fixed, 4 remaining). No fixes available (4 hidden fixes can be enabled with the `--unsafe-fixes` option).
1 parent a1d0d59 commit 71aaba3

File tree

10 files changed

+18
-15
lines changed

10 files changed

+18
-15
lines changed

src/tmuxp/_internal/config_reader.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
import yaml
1010

1111
if t.TYPE_CHECKING:
12-
from typing_extensions import TypeAlias
12+
from typing import TypeAlias
1313

1414
FormatLiteral = t.Literal["json", "yaml"]
1515

src/tmuxp/cli/__init__.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,7 @@
3434

3535
if t.TYPE_CHECKING:
3636
import pathlib
37-
38-
from typing_extensions import TypeAlias
37+
from typing import TypeAlias
3938

4039
CLIVerbosity: TypeAlias = t.Literal["DEBUG", "INFO", "WARNING", "ERROR", "CRITICAL"]
4140
CLISubparserName: TypeAlias = t.Literal[

src/tmuxp/cli/freeze.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
from .utils import prompt, prompt_choices, prompt_yes_no
2121

2222
if t.TYPE_CHECKING:
23-
from typing_extensions import TypeAlias, TypeGuard
23+
from typing import TypeAlias, TypeGuard
2424

2525
CLIOutputFormatLiteral: TypeAlias = t.Literal["yaml", "json"]
2626

src/tmuxp/cli/load.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,10 @@
2222
from .utils import prompt_choices, prompt_yes_no, style, tmuxp_echo
2323

2424
if t.TYPE_CHECKING:
25+
from typing import TypeAlias
26+
2527
from libtmux.session import Session
26-
from typing_extensions import NotRequired, TypeAlias, TypedDict
28+
from typing_extensions import NotRequired, TypedDict
2729

2830
from tmuxp.types import StrPath
2931

src/tmuxp/cli/shell.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
from tmuxp._compat import PY3, PYMINOR
1414

1515
if t.TYPE_CHECKING:
16-
from typing_extensions import TypeAlias
16+
from typing import TypeAlias
1717

1818
CLIColorsLiteral: TypeAlias = t.Literal[56, 88]
1919
CLIShellLiteral: TypeAlias = t.Literal[

src/tmuxp/cli/utils.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,9 @@
1010

1111
if t.TYPE_CHECKING:
1212
from collections.abc import Callable, Sequence
13+
from typing import TypeAlias
1314

14-
from typing_extensions import TypeAlias
15-
16-
CLIColour: TypeAlias = t.Union[int, tuple[int, int, int], str]
15+
CLIColour: TypeAlias = int | tuple[int, int, int] | str
1716

1817

1918
logger = logging.getLogger(__name__)

src/tmuxp/plugin.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,11 @@
3131

3232

3333
if t.TYPE_CHECKING:
34+
from typing import TypeGuard
35+
3436
from libtmux.session import Session
3537
from libtmux.window import Window
36-
from typing_extensions import TypedDict, TypeGuard, Unpack
38+
from typing_extensions import TypedDict, Unpack
3739

3840
from ._internal.types import PluginConfigSchema
3941

src/tmuxp/shell.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,13 @@
1313
if t.TYPE_CHECKING:
1414
from collections.abc import Callable
1515
from types import ModuleType
16+
from typing import TypeAlias
1617

1718
from libtmux.pane import Pane
1819
from libtmux.server import Server
1920
from libtmux.session import Session
2021
from libtmux.window import Window
21-
from typing_extensions import NotRequired, TypeAlias, TypedDict, Unpack
22+
from typing_extensions import NotRequired, TypedDict, Unpack
2223

2324
CLIShellLiteral: TypeAlias = t.Literal[
2425
"best",

src/tmuxp/workspace/finders.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,7 @@
1515

1616
if t.TYPE_CHECKING:
1717
import pathlib
18-
19-
from typing_extensions import TypeAlias
18+
from typing import TypeAlias
2019

2120
from tmuxp.types import StrPath
2221

tests/cli/test_load.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -186,10 +186,11 @@ def test_load_symlinked_workspace(
186186

187187

188188
if t.TYPE_CHECKING:
189+
from typing import TypeAlias
190+
189191
from pytest_mock import MockerFixture
190-
from typing_extensions import TypeAlias
191192

192-
ExpectedOutput: TypeAlias = t.Optional[t.Union[str, list[str]]]
193+
ExpectedOutput: TypeAlias = str | list[str] | None
193194

194195

195196
class CLILoadFixture(t.NamedTuple):

0 commit comments

Comments
 (0)