Skip to content

Commit cdeeee7

Browse files
committed
pep257, pep8, docstrings
1 parent 7e3313e commit cdeeee7

File tree

4 files changed

+19
-15
lines changed

4 files changed

+19
-15
lines changed

tmuxp/pane.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ def tmux(self, cmd, *args, **kwargs):
6565
Specifying ``('-t', 'custom-target')`` or ``('-tcustom_target')`` in
6666
``args`` will override using the object's ``pane_id`` as target.
6767
68-
:rtype: :class:`util.tmux`
68+
:rtype: :class:`Server.tmux`
6969
7070
"""
7171
if not len([arg for arg in args if '-t' in arg]):

tmuxp/server.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,6 @@ def __list_panes(self):
250250

251251
panes = self.tmux(
252252
'list-panes',
253-
#'-t%s:%s' % (self.get('session_name'), self.get('window_id')),
254253
'-a',
255254
'-F%s' % ''.join(tmux_formats), # output
256255
)
@@ -340,7 +339,7 @@ def kill_server(self):
340339
self.tmux('kill-server')
341340

342341
def kill_session(self, target_session=None):
343-
"""Kill the tmux session with ``$ tmux kill-session``.
342+
"""Kill the tmux session with ``$ tmux kill-session``, return ``self``.
344343
345344
:param: target_session: str. note this accepts ``fnmatch(3)``. 'asdf'
346345
will kill 'asdfasd'.

tmuxp/session.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -64,16 +64,21 @@ def by(val, *args):
6464
logger.error(self.server._sessions)
6565

6666
def tmux(self, *args, **kwargs):
67-
# if '-t' not in kwargs:
68-
# kwargs['-t'] = self.get['session_id']
67+
"""Return :meth:`Server.tmux`.
68+
69+
:rtype: :class:`Server.tmux`
70+
71+
"""
72+
if '-t' not in kwargs:
73+
kwargs['-t'] = self.get('session_id')
6974
return self.server.tmux(*args, **kwargs)
7075

7176
def attach_session(self, target_session=None):
72-
'''
73-
``$ tmux attach-session`` aka alias: ``$ tmux attach``
77+
""" Return ``$ tmux attach-session`` aka alias: ``$ tmux attach``.
7478
7579
:param: target_session: str. name of the session. fnmatch(3) works.
76-
'''
80+
81+
"""
7782
proc = self.tmux('attach-session', '-t%s' % self.get('session_id'))
7883

7984
if proc.stderr:

tmuxp/window.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,7 @@
2323

2424
class Window(util.TmuxMappingObject, util.TmuxRelationalObject):
2525

26-
'''
27-
``tmux(1) window``.
28-
'''
26+
""":ref:`tmux(1)` window."""
2927

3028
childIdAttribute = 'pane_id'
3129

@@ -42,14 +40,12 @@ def __init__(self, session=None, **kwargs):
4240

4341
self._window_id = kwargs['window_id']
4442

45-
#self.server._update_windows()
46-
4743
def __repr__(self):
4844
return "%s(%s %s:%s, %s)" % (
4945
self.__class__.__name__,
5046
self.get('window_id'),
5147
self.get('window_index'),
52-
self.get('window_name'), # @todo, bug when window name blank
48+
self.get('window_name'),
5349
self.session
5450
)
5551

@@ -73,11 +69,15 @@ def by(val, *args):
7369
return list(filter(by, self.server._windows))[0]
7470

7571
def tmux(self, cmd, *args, **kwargs):
76-
"""Send command to tmux with :attr:`window_id` as ``target-window``.
72+
"""Return :meth:`Server.tmux` defaulting ``target_window`` as target.
73+
74+
Send command to tmux with :attr:`window_id` as ``target-window``.
7775
7876
Specifying ``('-t', 'custom-target')`` or ``('-tcustom_target')`` in
7977
``args`` will override using the object's ``window_id`` as target.
8078
79+
:rtype: :class:`Server.tmux`
80+
8181
"""
8282
if not len([arg for arg in args if '-t' in str(arg)]):
8383
args = ('-t', self.get('window_id')) + args

0 commit comments

Comments
 (0)