Skip to content

Commit 1bba33b

Browse files
committed
chore(Window): Add session / server instance typings
1 parent c9283c9 commit 1bba33b

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

libtmux/window.py

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@
1818
)
1919
from .pane import Pane
2020

21+
if t.TYPE_CHECKING:
22+
from .server import Server
23+
from .session import Session
24+
2125
logger = logging.getLogger(__name__)
2226

2327

@@ -41,16 +45,16 @@ class Window(TmuxMappingObject, TmuxRelationalObject):
4145
https://man.openbsd.org/tmux.1#DESCRIPTION. Accessed April 1st, 2018.
4246
"""
4347

44-
#: unique child ID key for :class:`~libtmux.common.TmuxRelationalObject`
4548
child_id_attribute = "pane_id"
46-
#: namespace used :class:`~libtmux.common.TmuxMappingObject`
49+
"""Unique child ID key for :class:`~libtmux.common.TmuxRelationalObject`"""
4750
formatter_prefix = "window_"
51+
"""Namespace used for :class:`~libtmux.common.TmuxMappingObject`"""
52+
server: "Server"
53+
""":class:`libtmux.Server` window is linked to"""
54+
session: "Session"
55+
""":class:`libtmux.Session` window is linked to"""
4856

49-
def __init__(self, session=None, **kwargs):
50-
51-
if not session:
52-
raise ValueError("Window requires a Session, session=Session")
53-
57+
def __init__(self, session: "Session", **kwargs):
5458
self.session = session
5559
self.server = self.session.server
5660

0 commit comments

Comments
 (0)