Skip to content

Commit 3403238

Browse files
committed
Spruce up formatter_prefix, child_id_attr docs, mixin docs
1 parent 64ee135 commit 3403238

File tree

5 files changed

+31
-20
lines changed

5 files changed

+31
-20
lines changed

libtmux/common.py

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,14 @@ class TmuxMappingObject(collections.MutableMapping):
202202
Session, Window, Pane, stored :attr:`self._info`. For example, a
203203
:class:`Window` will have a ``window_id`` and ``window_name``.
204204
205+
================ ================================== ==============
206+
Object formatter_prefix value
207+
================ ================================== ==============
208+
:class:`Server` n/a n/a
209+
:class:`Session` :attr:`Session.formatter_prefix` session\_
210+
:class:`Window` :attr:`Window.formatter_prefix` window\_
211+
:class:`Pane` :attr:`Pane.formatter_prefix` pane\_
212+
================ ================================== ==============
205213
"""
206214

207215
def __getitem__(self, key):
@@ -242,24 +250,24 @@ class TmuxRelationalObject(object):
242250
:class:`Window`)
243251
244252
Children of :class:`TmuxRelationalObject` are going to have a
245-
``self.children``, ``self.child_id_attribute`` and ``self.list_children``.
253+
``self.children``, ``self.child_id_attribute``.
246254
247-
================ ======================== ==================================
248-
Object .children method
249-
================ ======================== ==================================
250-
:class:`Server` :attr:`Server._sessions` :meth:`Server.list_sessions`
251-
:class:`Session` :attr:`Windows._windows` :meth:`Session.list_windows`
252-
:class:`Window` :attr:`Panes._panes` :meth:`Window.list_panes`
253-
:class:`Pane`
254-
================ ======================== ==================================
255+
================ ========================= =================================
256+
Object .children method
257+
================ ========================= =================================
258+
:class:`Server` :attr:`Server._sessions` :meth:`Server.list_sessions`
259+
:class:`Session` :attr:`Sessions._windows` :meth:`Session.list_windows`
260+
:class:`Window` :attr:`Windows._panes` :meth:`Window.list_panes`
261+
:class:`Pane` n/a n/a
262+
================ ========================= =================================
255263
256264
================ ================================== ==============
257265
Object child_id_attribute value
258266
================ ================================== ==============
259-
:class:`Server` :attr:`Server.child_id_attribute`` ``session_id``
260-
:class:`Session` :attr:`Session.window_id` ``window_id``
261-
:class:`Window` :attr:`Window.pane_id` ``pane_id``
262-
:class:`Pane`
267+
:class:`Server` :attr:`Server.child_id_attribute` session_id
268+
:class:`Session` :attr:`Session.child_id_attribute` window_id
269+
:class:`Window` :attr:`Window.child_id_attribute` pane_id
270+
:class:`Pane` n/a n/a
263271
================ ================================== ==============
264272
"""
265273

libtmux/pane.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ class Pane(TmuxMappingObject, TmuxRelationalObject):
2424
2525
:versionchanged: 0.8
2626
Renamed from ``.tmux`` to ``.cmd``.
27-
2827
"""
28+
#: namespace used :class:`TmuxMappingObject`
2929
formatter_prefix = 'pane_'
3030

3131
def __init__(self, window=None, **kwargs):

libtmux/server.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,9 @@ class Server(TmuxRelationalObject, EnvironmentMixin):
4343
config_file = None
4444
#: ``-2`` or ``-8``
4545
colors = None
46-
#: unique child ID key
46+
#: unique child ID key used by :class:`TmuxRelationalObject`
4747
child_id_attribute = 'session_id'
48-
#: namespace used by tmux formatter variables
48+
#: namespace used :class:`TmuxMappingObject`
4949
formatter_prefix = 'server_'
5050

5151
def __init__(
@@ -162,7 +162,7 @@ def list_sessions(self):
162162
def sessions(self):
163163
"""Property / alias to return :meth:`~.list_sessions`."""
164164
return self.list_sessions()
165-
#: Alias of :attr:`sessions`.
165+
#: Alias of :attr:`sessions`, , used by :class:`TmuxRelationalObject`
166166
children = sessions
167167

168168
def _list_windows(self):

libtmux/session.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,11 @@ class Session(
2626
""":term:`tmux(1)` session.
2727
2828
Holds :class:`Window` objects.
29-
3029
"""
3130

31+
#: unique child ID key used by :class:`TmuxRelationalObject`
3232
child_id_attribute = 'window_id'
33+
#: namespace used :class:`TmuxMappingObject`
3334
formatter_prefix = 'session_'
3435

3536
def __init__(self, server=None, **kwargs):
@@ -268,7 +269,7 @@ def windows(self):
268269
"""Property / alias to return :meth:`~.list_windows`."""
269270
return self.list_windows()
270271

271-
#: Alias of :attr:`windows`.
272+
#: Alias of :attr:`windows`, used by :class:`TmuxRelationalObject`
272273
children = windows
273274

274275
@property

libtmux/window.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@
2121
class Window(TmuxMappingObject, TmuxRelationalObject):
2222
""":term:`tmux(1)` window."""
2323

24+
#: unique child ID key used by :class:`TmuxRelationalObject`
2425
child_id_attribute = 'pane_id'
26+
#: namespace used :class:`TmuxMappingObject`
2527
formatter_prefix = 'window_'
2628

2729
def __init__(self, session=None, **kwargs):
@@ -463,5 +465,5 @@ def panes(self):
463465
"""Property / alias to return :meth:`~.list_panes`."""
464466
return self.list_panes()
465467

466-
#: Alias of :attr:`panes`.
468+
#: Alias of :attr:`panes`, used by :class:`TmuxRelationalObject`
467469
children = panes

0 commit comments

Comments
 (0)