@@ -100,11 +100,15 @@ def cmd(self, cmd, *args, **kwargs):
100100 Specifying ``('-t', 'custom-target')`` or ``('-tcustom_target')`` in
101101 ``args`` will override using the object's ``window_id`` as target.
102102
103- :rtype: :class:`Server.cmd`
103+ Returns
104+ -------
105+ :class:`Server.cmd`
104106
107+ Notes
108+ -----
105109 .. versionchanged:: 0.8
106- Renamed from ``.tmux`` to ``.cmd``.
107110
111+ Renamed from ``.tmux`` to ``.cmd``.
108112 """
109113 if not any (arg .startswith ('-t' ) for arg in args ):
110114 args = ('-t' , self .id ) + args
@@ -114,29 +118,31 @@ def cmd(self, cmd, *args, **kwargs):
114118 def select_layout (self , layout = None ):
115119 """Wrapper for ``$ tmux select-layout <layout>``.
116120
117- even-horizontal: Panes are spread out evenly from left to right across
118- the window.
119-
120- even-vertical: Panes are spread evenly from top to bottom.
121-
122- main-horizontal: A large (main) pane is shown at the top of the window
123- and the remaining panes are spread from left to right in the leftover
124- space at the bottom.
125-
126- main-vertical: Similar to main-horizontal but the large pane is placed
127- on the left and the others spread from top to bottom along the right.
128-
129- tiled: Panes are spread out as evenly as possible over the window in
130- both rows and columns.
131-
132- custom: custom dimensions (see :term:`tmux(1)` manpages).
133-
134- :param layout: string of the layout, 'even-horizontal', 'tiled', etc.
135- Entering None (leaving this blank) is same as ``select-layout``
136- with no layout. In recent tmux versions, it picks the most recently
137- set layout.
138- :type layout: str
139-
121+ Parameters
122+ ----------
123+ layout : str, optional
124+ string of the layout, 'even-horizontal', 'tiled', etc. Entering
125+ None (leaving this blank) is same as ``select-layout`` with no
126+ layout. In recent tmux versions, it picks the most recently
127+ set layout.
128+
129+ 'even-horizontal'
130+ Panes are spread out evenly from left to right across the
131+ window.
132+ 'even-vertical'
133+ Panes are spread evenly from top to bottom.
134+ 'main-horizontal'
135+ A large (main) pane is shown at the top of the window and the
136+ remaining panes are spread from left to right in the leftover
137+ space at the bottom.
138+ 'main-vertical'
139+ Similar to main-horizontal but the large pane is placed on the
140+ left and the others spread from top to bottom along the right.
141+ 'tiled'
142+ Panes are spread out as evenly as possible over the window in
143+ both rows and columns.
144+ 'custom'
145+ custom dimensions (see :term:`tmux(1)` manpages).
140146 """
141147 cmd = [
142148 'select-layout' ,
@@ -152,15 +158,21 @@ def select_layout(self, layout=None):
152158 raise exc .LibTmuxException (proc .stderr )
153159
154160 def set_window_option (self , option , value ):
155- """Wrapper for ``$ tmux set-window-option <option> <value>``.
156-
157- :param option: option to set, e.g. 'aggressive-resize'
158- :type option: str
159- :param value: window value. True/False will turn in 'on' and 'off',
161+ """
162+ Wrapper for ``$ tmux set-window-option <option> <value>``.
163+
164+ Parameters
165+ ----------
166+ option : str
167+ option to set, e.g. 'aggressive-resize'
168+ value : str
169+ window option value. True/False will turn in 'on' and 'off',
160170 also accepts string of 'on' or 'off' directly.
161- :type value: bool
162- :raises: :exc:`exc.OptionError`, :exc:`exc.UnknownOption`,
163- :exc:`exc.InvalidOption`, :exc:`exc.AmbiguousOption`
171+
172+ Raises
173+ ------
174+ :exc:`exc.OptionError`, :exc:`exc.UnknownOption`,
175+ :exc:`exc.InvalidOption`, :exc:`exc.AmbiguousOption`
164176 """
165177
166178 self .server ._update_windows ()
@@ -181,17 +193,22 @@ def set_window_option(self, option, value):
181193 handle_option_error (cmd .stderr [0 ])
182194
183195 def show_window_options (self , option = None , g = False ):
184- """Return a dict of options for the window.
196+ """
197+ Return a dict of options for the window.
185198
186- For familiarity with tmux, the option ``option`` param forwards to pick
187- a single option, forwarding to :meth:`Window.show_window_option`.
199+ For familiarity with tmux, the option ``option`` param forwards to
200+ pick a single option, forwarding to :meth:`Window.show_window_option`.
188201
189- :param option: optional. show a single option.
190- :type option: str
191- :param g: Pass ``-g`` flag for global variable
192- :type g: bool
193- :rtype: :py:obj:`dict`
202+ Parameters
203+ ----------
204+ option : str, optional
205+ show a single option.
206+ g : str, optional
207+ Pass ``-g`` flag for global variable, default False.
194208
209+ Returns
210+ -------
211+ dict
195212 """
196213
197214 tmux_args = tuple ()
@@ -221,18 +238,25 @@ def show_window_options(self, option=None, g=False):
221238 return window_options
222239
223240 def show_window_option (self , option , g = False ):
224- """Return a list of options for the window.
241+ """
242+ Return a list of options for the window.
225243
226244 todo: test and return True/False for on/off string
227245
228- :param option: option to return.
229- :type option: str
230- :param g: Pass ``-g`` flag, global.
231- :type g: bool
232- :rtype: str, int
233- :raises: :exc:`exc.OptionError`, :exc:`exc.UnknownOption`,
234- :exc:`exc.InvalidOption`, :exc:`exc.AmbiguousOption`
246+ Parameters
247+ ----------
248+ option : str
249+ g : bool, optional
250+ Pass ``-g`` flag, global. Default False.
235251
252+ Returns
253+ -------
254+ str, int
255+
256+ Raises
257+ ------
258+ :exc:`exc.OptionError`, :exc:`exc.UnknownOption`,
259+ :exc:`exc.InvalidOption`, :exc:`exc.AmbiguousOption`
236260 """
237261
238262 tmux_args = tuple ()
@@ -260,11 +284,13 @@ def show_window_option(self, option, g=False):
260284 return option [1 ]
261285
262286 def rename_window (self , new_name ):
263- """Return :class:`Window` object ``$ tmux rename-window <new_name>``.
264-
265- :param new_name: name of the window
266- :type new_name: str
287+ """
288+ Return :class:`Window` object ``$ tmux rename-window <new_name>``.
267289
290+ Parameters
291+ ----------
292+ new_name : str
293+ name of the window
268294 """
269295
270296 import shlex
@@ -300,15 +326,17 @@ def kill_window(self):
300326 self .server ._update_windows ()
301327
302328 def move_window (self , destination = "" , session = None ):
303- """Move the current :class:`Window` object ``$ tmux move-window``.
304-
305- :param destination: the ``target window`` or index to move the window
306- to, default: empty string
307- :type destination: str
308- :param session: the ``target session`` or index to move the
309- window to, default: current session.
310- :type session: str
311-
329+ """
330+ Move the current :class:`Window` object ``$ tmux move-window``.
331+
332+ Parameters
333+ ----------
334+ destination : str, optional
335+ the ``target window`` or index to move the window to, default:
336+ empty string
337+ session : str, optional
338+ the ``target session`` or index to move the window to, default:
339+ current session.
312340 """
313341 session = session or self .get ('session_id' )
314342 proc = self .cmd (
@@ -323,26 +351,32 @@ def move_window(self, destination="", session=None):
323351 self .server ._update_windows ()
324352
325353 def select_window (self ):
326- """Select window. Return ``self``.
354+ """
355+ Select window. Return ``self``.
327356
328357 To select a window object asynchrously. If a ``window`` object exists
329358 and is no longer longer the current window, ``w.select_window()``
330359 will make ``w`` the current window.
331360
332- :rtype: :class:`Window`
333-
361+ Returns
362+ -------
363+ :class:`Window`
334364 """
335365 target = '%s:%s' % (self .get ('session_id' ), self .index ),
336366 return self .session .select_window (target )
337367
338368 def select_pane (self , target_pane ):
339- """Return selected :class:`Pane` through ``$ tmux select-pane``.
369+ """
370+ Return selected :class:`Pane` through ``$ tmux select-pane``.
340371
341- :param target_pane: ``target_pane``, or ``-U``,``-D``, ``-L``, ``-R``
342- or ``-l``.
343- :type target_pane: str
344- :rtype: :class:`Pane`
372+ Parameters
373+ ----------
374+ target_pane : str
375+ 'target_pane', '-U' ,'-D', '-L', '-R', or '-l'.
345376
377+ Return
378+ ------
379+ :class:`Pane`
346380 """
347381
348382 if target_pane in ['-l' , '-U' , '-D' , '-L' , '-R' ]:
@@ -371,43 +405,46 @@ def split_window(
371405 vertical = True ,
372406 shell = None
373407 ):
374- """Split window and return the created :class:`Pane`.
375-
376- .. note::
377-
378- :term:`tmux(1)` will move window to the new pane if the
379- ``split-window`` target is off screen. tmux handles the ``-d`` the
380- same way as ``new-window`` and ``attach`` in
381- :class:`Session.new_window`.
382-
383- By default, this will make the window the pane is created in
384- active. To remain on the same window and split the pane in another
385- target window, pass in ``attach=False``.
386-
408+ """
409+ Split window and return the created :class:`Pane`.
387410
388411 Used for splitting window and holding in a python object.
389412
390- :param attach: make new window the current window after creating it,
391- default True.
392- :type attach: bool
393- :param start_directory: specifies the working directory in which the
394- new window is created.
395- :type start_directory: str
396- :param target: ``target_pane`` to split.
397- :type target: bool
398- :param vertical: split vertically
399- :type vertical: bool
400- :param shell: execute a command on splitting the window. The
401- pane will close when the command exits.
413+ Parameters
414+ ----------
415+ attach : bool, optional
416+ make new window the current window after creating it, default
417+ True.
418+ start_directory : str, optional
419+ specifies the working directory in which the new window is created.
420+ target : str
421+ ``target_pane`` to split.
422+ vertical : str
423+ split vertically
424+ shell : str, optional
425+ execute a command on splitting the window. The pane will close
426+ when the command exits.
427+
402428 NOTE: When this command exits the pane will close. This feature
403429 is useful for long-running processes where the closing of the
404430 window upon completion is desired.
405- :type shell: str
406431
407- :rtype: :class:`Pane`
432+ Returns
433+ -------
434+ :class:`Pane`
408435
409- """
436+ Notes
437+ -----
410438
439+ :term:`tmux(1)` will move window to the new pane if the
440+ ``split-window`` target is off screen. tmux handles the ``-d`` the
441+ same way as ``new-window`` and ``attach`` in
442+ :class:`Session.new_window`.
443+
444+ By default, this will make the window the pane is created in
445+ active. To remain on the same window and split the pane in another
446+ target window, pass in ``attach=False``.
447+ """
411448 pformats = ['session_name' , 'session_id' ,
412449 'window_index' , 'window_id' ] + formats .PANE_FORMATS
413450 tmux_formats = ['#{%s}\t ' % f for f in pformats ]
@@ -465,10 +502,12 @@ def split_window(
465502
466503 @property
467504 def attached_pane (self ):
468- """Return the attached :class:`Pane`.
469-
470- :rtype: :class:`Pane`
505+ """
506+ Return the attached :class:`Pane`.
471507
508+ Returns
509+ -------
510+ :class:`Pane`
472511 """
473512 for pane in self ._panes :
474513 if 'pane_active' in pane :
@@ -498,10 +537,12 @@ def _panes(self):
498537 return self ._list_panes ()
499538
500539 def list_panes (self ):
501- """Return list of :class:`Pane` for the window.
502-
503- :rtype: list of :class:`Pane`
540+ """
541+ Return list of :class:`Pane` for the window.
504542
543+ Returns
544+ -------
545+ list of :class:`Pane`
505546 """
506547
507548 return [Pane (window = self , ** pane ) for pane in self ._panes ]
0 commit comments