77import logging
88import os
99import shlex
10+ import typing as t
1011
1112from . import exc , formats
12- from .common import TmuxMappingObject , TmuxRelationalObject , handle_option_error
13+ from .common import (
14+ PaneDict ,
15+ TmuxMappingObject ,
16+ TmuxRelationalObject ,
17+ handle_option_error ,
18+ )
1319from .pane import Pane
1420
1521logger = logging .getLogger (__name__ )
@@ -270,7 +276,7 @@ def show_window_option(self, option, g=False):
270276
271277 return option [1 ]
272278
273- def rename_window (self , new_name ) :
279+ def rename_window (self , new_name : str ) -> "Window" :
274280 """
275281 Return :class:`Window` object ``$ tmux rename-window <new_name>``.
276282
@@ -335,7 +341,7 @@ def move_window(self, destination="", session=None):
335341
336342 self .server ._update_windows ()
337343
338- def select_window (self ):
344+ def select_window (self ) -> "Window" :
339345 """
340346 Select window. Return ``self``.
341347
@@ -349,7 +355,7 @@ def select_window(self):
349355 """
350356 return self .session .select_window (self .index )
351357
352- def select_pane (self , target_pane ) :
358+ def select_pane (self , target_pane : str ) -> Pane :
353359 """
354360 Return selected :class:`Pane` through ``$ tmux select-pane``.
355361
@@ -373,7 +379,7 @@ def select_pane(self, target_pane):
373379
374380 return self .attached_pane
375381
376- def last_pane (self ):
382+ def last_pane (self ) -> Pane :
377383 """Return last pane."""
378384 return self .select_pane ("-l" )
379385
@@ -385,7 +391,7 @@ def split_window(
385391 vertical = True ,
386392 shell = None ,
387393 percent = None ,
388- ):
394+ ) -> Pane :
389395 """
390396 Split window and return the created :class:`Pane`.
391397
@@ -486,7 +492,7 @@ def split_window(
486492 return Pane (window = self , ** pane )
487493
488494 @property
489- def attached_pane (self ):
495+ def attached_pane (self ) -> Pane :
490496 """
491497 Return the attached :class:`Pane`.
492498
@@ -504,20 +510,20 @@ def attached_pane(self):
504510
505511 return []
506512
507- def _list_panes (self ):
513+ def _list_panes (self ) -> t . List [ PaneDict ] :
508514 panes = self .server ._update_panes ()._panes
509515
510516 panes = [p for p in panes if p ["session_id" ] == self .get ("session_id" )]
511517 panes = [p for p in panes if p ["window_id" ] == self .id ]
512518 return panes
513519
514520 @property
515- def _panes (self ):
521+ def _panes (self ) -> t . List [ PaneDict ] :
516522 """Property / alias to return :meth:`~._list_panes`."""
517523
518524 return self ._list_panes ()
519525
520- def list_panes (self ):
526+ def list_panes (self ) -> t . List [ Pane ] :
521527 """
522528 Return list of :class:`Pane` for the window.
523529
@@ -529,7 +535,7 @@ def list_panes(self):
529535 return [Pane (window = self , ** pane ) for pane in self ._panes ]
530536
531537 @property
532- def panes (self ):
538+ def panes (self ) -> t . List [ Pane ] :
533539 """Property / alias to return :meth:`~.list_panes`."""
534540 return self .list_panes ()
535541
0 commit comments