Skip to content

Commit 3d9ab89

Browse files
committed
refactor(typing): Use typing.Literal from python 3.8
1 parent 5fd88aa commit 3d9ab89

File tree

4 files changed

+8
-14
lines changed

4 files changed

+8
-14
lines changed

src/libtmux/neo.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,7 @@
77
from libtmux.formats import FORMAT_SEPARATOR
88

99
if t.TYPE_CHECKING:
10-
from typing_extensions import Literal
11-
12-
ListCmd = Literal["list-sessions", "list-windows", "list-panes"]
10+
ListCmd = t.Literal["list-sessions", "list-windows", "list-panes"]
1311
ListExtraArgs = t.Optional[t.Iterable[str]]
1412

1513
from libtmux.server import Server

src/libtmux/pane.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@
1717
from . import exc
1818

1919
if t.TYPE_CHECKING:
20-
from typing_extensions import Literal
21-
2220
from .server import Server
2321
from .session import Session
2422
from .window import Window
@@ -158,8 +156,8 @@ def resize_pane(self, *args: t.Any, **kwargs: t.Any) -> "Pane":
158156

159157
def capture_pane(
160158
self,
161-
start: t.Union["Literal['-']", t.Optional[int]] = None,
162-
end: t.Union["Literal['-']", t.Optional[int]] = None,
159+
start: t.Union["t.Literal['-']", t.Optional[int]] = None,
160+
end: t.Union["t.Literal['-']", t.Optional[int]] = None,
163161
) -> t.Union[str, t.List[str]]:
164162
"""
165163
Capture text from pane.
@@ -248,12 +246,12 @@ def send_keys(
248246

249247
@overload
250248
def display_message(
251-
self, cmd: str, get_text: "Literal[True]"
249+
self, cmd: str, get_text: "t.Literal[True]"
252250
) -> t.Union[str, t.List[str]]:
253251
...
254252

255253
@overload
256-
def display_message(self, cmd: str, get_text: "Literal[False]") -> None:
254+
def display_message(self, cmd: str, get_text: "t.Literal[False]") -> None:
257255
...
258256

259257
def display_message(

src/libtmux/server.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@
3030
)
3131

3232
if t.TYPE_CHECKING:
33-
from typing_extensions import Literal, TypeAlias
33+
from typing_extensions import TypeAlias
3434

35-
DashLiteral: TypeAlias = Literal["-"]
35+
DashLiteral: TypeAlias = t.Literal["-"]
3636

3737
logger = logging.getLogger(__name__)
3838

tests/test_dataclasses.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,7 @@
1414
from libtmux.window import Window
1515

1616
if t.TYPE_CHECKING:
17-
from typing_extensions import Literal
18-
19-
ListCmd = Literal["list-sessions", "list-windows", "list-panes"]
17+
ListCmd = t.Literal["list-sessions", "list-windows", "list-panes"]
2018
ListExtraArgs = t.Optional[t.Tuple[str]]
2119

2220

0 commit comments

Comments
 (0)