Skip to content

Commit 4fb9815

Browse files
committed
chore(Window): Add session / server instance typings
1 parent 973ddab commit 4fb9815

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

libtmux/window.py

Lines changed: 9 additions & 5 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

@@ -45,12 +49,12 @@ class Window(TmuxMappingObject, TmuxRelationalObject):
4549
child_id_attribute = "pane_id"
4650
#: namespace used :class:`~libtmux.common.TmuxMappingObject`
4751
formatter_prefix = "window_"
52+
#: :class:`libtmux.server.Server` window is linked to
53+
server: "Server"
54+
#: :class:`libtmux.session.Session` window is linked to
55+
session: "Session"
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)