Skip to content

Commit c596ac5

Browse files
committed
refactor(typing): Use typing.Literal from python 3.8
1 parent 678b38b commit c596ac5

File tree

8 files changed

+18
-20
lines changed

8 files changed

+18
-20
lines changed

src/tmuxp/cli/__init__.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,13 @@
3535
logger = logging.getLogger(__name__)
3636

3737
if t.TYPE_CHECKING:
38-
from typing_extensions import Literal, TypeAlias
38+
from typing_extensions import TypeAlias
3939

40-
CLIVerbosity: TypeAlias = Literal["DEBUG", "INFO", "WARNING", "ERROR", "CRITICAL"]
41-
CLISubparserName: TypeAlias = Literal[
40+
CLIVerbosity: TypeAlias = t.Literal["DEBUG", "INFO", "WARNING", "ERROR", "CRITICAL"]
41+
CLISubparserName: TypeAlias = t.Literal[
4242
"ls", "load", "convert", "edit", "import", "shell", "debug-info"
4343
]
44-
CLIImportSubparserName: TypeAlias = Literal["teamocil", "tmuxinator"]
44+
CLIImportSubparserName: TypeAlias = t.Literal["teamocil", "tmuxinator"]
4545

4646

4747
def create_parser() -> argparse.ArgumentParser:

src/tmuxp/cli/convert.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,7 @@
1010
from .utils import prompt_yes_no
1111

1212
if t.TYPE_CHECKING:
13-
from typing_extensions import Literal
14-
15-
AllowedFileTypes = Literal["json", "yaml"]
13+
AllowedFileTypes = t.Literal["json", "yaml"]
1614

1715

1816
def create_convert_subparser(

src/tmuxp/cli/freeze.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@
1515
from .utils import prompt, prompt_choices, prompt_yes_no
1616

1717
if t.TYPE_CHECKING:
18-
from typing_extensions import Literal, TypeAlias, TypeGuard
18+
from typing_extensions import TypeAlias, TypeGuard
1919

20-
CLIOutputFormatLiteral: TypeAlias = Literal["yaml", "json"]
20+
CLIOutputFormatLiteral: TypeAlias = t.Literal["yaml", "json"]
2121

2222

2323
class CLIFreezeNamespace(argparse.Namespace):

src/tmuxp/cli/load.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@
2626
from .utils import prompt_choices, prompt_yes_no, style, tmuxp_echo
2727

2828
if t.TYPE_CHECKING:
29-
from typing_extensions import Literal, NotRequired, TypeAlias, TypedDict
29+
from typing_extensions import NotRequired, TypeAlias, TypedDict
3030

31-
CLIColorsLiteral: TypeAlias = Literal[56, 88]
31+
CLIColorsLiteral: TypeAlias = t.Literal[56, 88]
3232

3333
class OptionOverrides(TypedDict):
3434
detached: NotRequired[bool]

src/tmuxp/cli/shell.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@
99
from .._compat import PY3, PYMINOR
1010

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

14-
CLIColorsLiteral: TypeAlias = Literal[56, 88]
15-
CLIShellLiteral: TypeAlias = Literal[
14+
CLIColorsLiteral: TypeAlias = t.Literal[56, 88]
15+
CLIShellLiteral: TypeAlias = t.Literal[
1616
"best", "pdb", "code", "ptipython", "ptpython", "ipython", "bpython"
1717
]
1818

src/tmuxp/config_reader.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
import yaml
66

77
if t.TYPE_CHECKING:
8-
from typing_extensions import Literal, TypeAlias
8+
from typing_extensions import TypeAlias
99

10-
FormatLiteral = Literal["json", "yaml"]
10+
FormatLiteral = t.Literal["json", "yaml"]
1111

1212
RawConfigData: TypeAlias = t.Dict[t.Any, t.Any]
1313

src/tmuxp/shell.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@
1212
logger = logging.getLogger(__name__)
1313

1414
if t.TYPE_CHECKING:
15-
from typing_extensions import Literal, TypeAlias
15+
from typing_extensions import TypeAlias
1616

17-
CLIShellLiteral: TypeAlias = Literal[
17+
CLIShellLiteral: TypeAlias = t.Literal[
1818
"best", "pdb", "code", "ptipython", "ptpython", "ipython", "bpython"
1919
]
2020

src/tmuxp/workspace/finders.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@
1212
logger = logging.getLogger(__name__)
1313

1414
if t.TYPE_CHECKING:
15-
from typing_extensions import Literal, TypeAlias
15+
from typing_extensions import TypeAlias
1616

17-
ValidExtensions: TypeAlias = Literal[".yml", ".yaml", ".json"]
17+
ValidExtensions: TypeAlias = t.Literal[".yml", ".yaml", ".json"]
1818

1919

2020
def is_workspace_file(

0 commit comments

Comments
 (0)