1111import logging
1212import pathlib
1313import typing as t
14- import warnings
1514
1615from libtmux import exc
1716from libtmux .common import tmux_cmd
@@ -554,16 +553,11 @@ def select_pane(self) -> Pane:
554553
555554 Deprecated in favor of :meth:`.select()`.
556555 """
557- warnings . warn (
558- "Pane.select_pane() is deprecated in favor of Pane.select ()" ,
559- category = DeprecationWarning ,
560- stacklevel = 2 ,
556+ raise exc . DeprecatedError (
557+ deprecated = "Pane.select_pane()" ,
558+ replacement = "Pane.select()" ,
559+ version = "0.30.0" ,
561560 )
562- assert isinstance (self .pane_id , str )
563- pane = self .window .select_pane (self .pane_id )
564- if pane is None :
565- raise exc .PaneNotFound (pane_id = self .pane_id )
566- return pane
567561
568562 def split (
569563 self ,
@@ -731,7 +725,7 @@ def set_width(self, width: int) -> Pane:
731725 :class:`Pane`
732726 Self, for method chaining.
733727 """
734- self .resize_pane (width = width )
728+ self .resize (width = width )
735729 return self
736730
737731 def set_height (self , height : int ) -> Pane :
@@ -747,7 +741,7 @@ def set_height(self, height: int) -> Pane:
747741 :class:`Pane`
748742 Self, for method chaining.
749743 """
750- self .resize_pane (height = height )
744+ self .resize (height = height )
751745 return self
752746
753747 def enter (self ) -> Pane :
@@ -915,21 +909,10 @@ def split_window(
915909
916910 Deprecated in favor of :meth:`.split`.
917911 """
918- warnings .warn (
919- "Pane.split_window() is deprecated in favor of Pane.split()" ,
920- category = DeprecationWarning ,
921- stacklevel = 2 ,
922- )
923- if size is None and percent is not None :
924- size = f"{ str (percent ).rstrip ('%' )} %"
925- return self .split (
926- target = target ,
927- attach = attach ,
928- start_directory = start_directory ,
929- direction = PaneDirection .Below if vertical else PaneDirection .Right ,
930- shell = shell ,
931- size = size ,
932- environment = environment ,
912+ raise exc .DeprecatedError (
913+ deprecated = "Pane.split_window()" ,
914+ replacement = "Pane.split()" ,
915+ version = "0.33.0" ,
933916 )
934917
935918 def get (self , key : str , default : t .Any | None = None ) -> t .Any :
@@ -941,12 +924,11 @@ def get(self, key: str, default: t.Any | None = None) -> t.Any:
941924 accessed via ``pane.window_name``.
942925
943926 """
944- warnings . warn (
945- "Pane.get() is deprecated " ,
946- category = DeprecationWarning ,
947- stacklevel = 2 ,
927+ raise exc . DeprecatedError (
928+ deprecated = "Pane.get()" ,
929+ replacement = "direct attribute access (e.g., pane.pane_id)" ,
930+ version = "0.16.0" ,
948931 )
949- return getattr (self , key , default )
950932
951933 def __getitem__ (self , key : str ) -> t .Any :
952934 """Return item lookup by key. Deprecated in favor of attributes.
@@ -957,12 +939,11 @@ def __getitem__(self, key: str) -> t.Any:
957939 accessed via ``pane.window_name``.
958940
959941 """
960- warnings . warn (
961- f"Item lookups, e.g. pane[' { key } '] is deprecated " ,
962- category = DeprecationWarning ,
963- stacklevel = 2 ,
942+ raise exc . DeprecatedError (
943+ deprecated = "Pane[ key] lookup " ,
944+ replacement = "direct attribute access (e.g., pane.pane_id)" ,
945+ version = "0.16.0" ,
964946 )
965- return getattr (self , key )
966947
967948 def resize_pane (
968949 self ,
@@ -985,17 +966,8 @@ def resize_pane(
985966
986967 Deprecated by :meth:`Pane.resize`.
987968 """
988- warnings .warn (
989- "Deprecated: Use Pane.resize() instead of Pane.resize_pane()" ,
990- category = DeprecationWarning ,
991- stacklevel = 2 ,
992- )
993- return self .resize (
994- adjustment_direction = adjustment_direction ,
995- adjustment = adjustment ,
996- height = height ,
997- width = width ,
998- zoom = zoom ,
999- mouse = mouse ,
1000- trim_below = trim_below ,
969+ raise exc .DeprecatedError (
970+ deprecated = "Pane.resize_pane()" ,
971+ replacement = "Pane.resize()" ,
972+ version = "0.28.0" ,
1001973 )
0 commit comments