Skip to content

Commit 3b913b3

Browse files
committed
chore(Pane): Add window, session, server instance for typings
1 parent 53d4ad8 commit 3b913b3

File tree

1 file changed

+15
-5
lines changed

1 file changed

+15
-5
lines changed

libtmux/pane.py

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,17 @@
66
77
"""
88
import logging
9+
import typing as t
910

1011
from . import exc
1112
from .common import TmuxMappingObject, TmuxRelationalObject
1213

14+
if t.TYPE_CHECKING:
15+
from .server import Server
16+
from .session import Session
17+
from .window import Window
18+
19+
1320
logger = logging.getLogger(__name__)
1421

1522

@@ -44,11 +51,14 @@ class Pane(TmuxMappingObject, TmuxRelationalObject):
4451

4552
#: namespace used :class:`~libtmux.common.TmuxMappingObject`
4653
formatter_prefix = "pane_"
47-
48-
def __init__(self, window=None, **kwargs):
49-
if not window:
50-
raise ValueError("Pane must have ``Window`` object")
51-
54+
#: :class:`libtmux.window.Window` pane is linked to
55+
window: "Window"
56+
#: :class:`libtmux.session.Session` pane is linked to
57+
session: "Session"
58+
#: :class:`libtmux.server.Server` pane is linked to
59+
server: "Server"
60+
61+
def __init__(self, window: "Window", **kwargs):
5262
self.window = window
5363
self.session = self.window.session
5464
self.server = self.session.server

0 commit comments

Comments
 (0)