Skip to content

Commit b95b438

Browse files
committed
chore(session): Add TYPE_CHECKING: Try to avoid circular imports
1 parent e161277 commit b95b438

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

libtmux/session.py

+7-3
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,13 @@
1818
has_version,
1919
session_check_name,
2020
)
21-
from .pane import Pane
2221
from .window import Window
2322

23+
if t.TYPE_CHECKING:
24+
from .pane import Pane
25+
from .server import Server
26+
27+
2428
logger = logging.getLogger(__name__)
2529

2630

@@ -52,7 +56,7 @@ class Session(TmuxMappingObject, TmuxRelationalObject, EnvironmentMixin):
5256
#: namespace used :class:`~libtmux.common.TmuxMappingObject`
5357
formatter_prefix = "session_"
5458

55-
def __init__(self, server=None, **kwargs):
59+
def __init__(self, server: t.Optional["Server"] = None, **kwargs):
5660
EnvironmentMixin.__init__(self)
5761
self.server = server
5862

@@ -367,7 +371,7 @@ def select_window(self, target_window: str) -> Window:
367371
return self.attached_window
368372

369373
@property
370-
def attached_pane(self) -> t.Optional[Pane]:
374+
def attached_pane(self) -> t.Optional["Pane"]:
371375
"""Return active :class:`Pane` object."""
372376

373377
return self.attached_window.attached_pane

0 commit comments

Comments
 (0)