Skip to content

Commit 7dc6d38

Browse files
committed
numpy-style docs for panaes
1 parent 36a25e4 commit 7dc6d38

File tree

1 file changed

+69
-40
lines changed

1 file changed

+69
-40
lines changed

libtmux/pane.py

+69-40
Original file line numberDiff line numberDiff line change
@@ -85,27 +85,30 @@ def cmd(self, cmd, *args, **kwargs):
8585
Specifying ``('-t', 'custom-target')`` or ``('-tcustom_target')`` in
8686
``args`` will override using the object's ``pane_id`` as target.
8787
88-
:rtype: :class:`Server.cmd`
89-
88+
Returns
89+
-------
90+
:class:`Server.cmd`
9091
"""
9192
if not any(arg.startswith('-t') for arg in args):
9293
args = ('-t', self.get('pane_id')) + args
9394

9495
return self.server.cmd(cmd, *args, **kwargs)
9596

9697
def send_keys(self, cmd, enter=True, suppress_history=True):
97-
"""``$ tmux send-keys`` to the pane.
98+
"""
99+
``$ tmux send-keys`` to the pane.
98100
99101
A leading space character is added to cmd to avoid polluting the
100102
user's history.
101103
102-
:param cmd: Text or input into pane
103-
:type cmd: str
104-
:param enter: Send enter after sending the input.
105-
:type enter: bool
106-
:param suppress_history: Don't add these keys to the shell history
107-
:type suppress_history: bool
108-
104+
Parameters
105+
----------
106+
cmd : str
107+
Text or input into pane
108+
enter : bool, optional
109+
Send enter after sending the input, default True.
110+
suppress_history : bool, optional
111+
Don't add these keys to the shell history, default True.
109112
"""
110113
prefix = ' ' if suppress_history else ''
111114
self.cmd('send-keys', prefix + cmd)
@@ -123,17 +126,21 @@ def reset(self):
123126
self.cmd('send-keys', '-R \; clear-history')
124127

125128
def split_window(self, attach=False, vertical=True, start_directory=None):
126-
"""Split window at pane and return newly created :class:`Pane`.
127-
128-
:param attach: Attach / select pane after creation.
129-
:type attach: bool
130-
:param vertical: split vertically
131-
:type vertical: bool
132-
:rtype: :class:`Pane`.
133-
:param start_directory: specifies the working directory in which the
134-
new pane is created.
135-
:type start_directory: str
136-
129+
"""
130+
Split window at pane and return newly created :class:`Pane`.
131+
132+
Parameters
133+
----------
134+
attach : bool, optional
135+
Attach / select pane after creation.
136+
vertical : bool, optional
137+
split vertically
138+
start_directory : str, optional
139+
specifies the working directory in which the new pane is created.
140+
141+
Returns
142+
-------
143+
:class:`Pane`
137144
"""
138145
return self.window.split_window(
139146
target=self.get('pane_id'),
@@ -143,30 +150,50 @@ def split_window(self, attach=False, vertical=True, start_directory=None):
143150
)
144151

145152
def set_width(self, width):
146-
"""Set width of pane.
147-
148-
:param width: pane width, in cells.
149-
:type width: int
153+
"""
154+
Set width of pane.
150155
156+
Parameters
157+
----------
158+
width : int
159+
pane width, in cells
151160
"""
152161
self.resize_pane(width=width)
153162

154163
def set_height(self, height):
155-
"""Set height of pane.
156-
157-
:param height: pane height, in cells.
158-
:type height: int
164+
"""
165+
Set height of pane.
159166
167+
Parameters
168+
----------
169+
height : int
170+
height of pain, in cells
160171
"""
161172
self.resize_pane(height=height)
162173

163174
def resize_pane(self, *args, **kwargs):
164-
"""``$ tmux resize-pane`` of pane and return ``self``.
165-
166-
:param target_pane: ``target_pane``, or ``-U``,``-D``, ``-L``, ``-R``.
167-
:type target_pane: str
168-
:rtype: :class:`Pane`
169-
175+
"""
176+
``$ tmux resize-pane`` of pane and return ``self``.
177+
178+
Parameters
179+
----------
180+
target_pane : str
181+
``target_pane``, or ``-U``,``-D``, ``-L``, ``-R``.
182+
183+
Optional Parameters
184+
-------------------
185+
height : int
186+
``resize-pane -y`` dimensions
187+
width : int
188+
``resize-pane -x`` dimensions
189+
190+
Returns
191+
-------
192+
:class:`Pane`
193+
194+
Raises
195+
------
196+
exc.LibTmuxException
170197
"""
171198

172199
if 'height' in kwargs:
@@ -183,22 +210,24 @@ def resize_pane(self, *args, **kwargs):
183210
return self
184211

185212
def enter(self):
186-
"""Send carriage return to pane.
213+
"""
214+
Send carriage return to pane.
187215
188216
``$ tmux send-keys`` send Enter to the pane.
189-
190217
"""
191218
self.cmd('send-keys', 'Enter')
192219

193220
def select_pane(self):
194-
"""Select pane. Return ``self``.
221+
"""
222+
Select pane. Return ``self``.
195223
196224
To select a window object asynchrously. If a ``pane`` object exists
197225
and is no longer longer the current window, ``w.select_pane()``
198226
will make ``p`` the current pane.
199227
200-
:rtype: :class:`pane`
201-
228+
Returns
229+
-------
230+
:class:`pane`
202231
"""
203232
return self.window.select_pane(self.get('pane_id'))
204233

0 commit comments

Comments
 (0)