Skip to content

Commit d2cb291

Browse files
committed
docs(Server): Tighten and correct docstrings
1 parent 9f1ab61 commit d2cb291

File tree

1 file changed

+16
-25
lines changed

1 file changed

+16
-25
lines changed

src/libtmux/server.py

Lines changed: 16 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
"""Pythonization of the :term:`tmux(1)` server.
1+
"""Wrapper for :term:`tmux(1)` server.
22
33
libtmux.server
44
~~~~~~~~~~~~~~
@@ -38,8 +38,7 @@
3838

3939

4040
class Server(EnvironmentMixin):
41-
"""
42-
The :term:`tmux(1)` :term:`Server` [server_manual]_.
41+
""":term:`tmux(1)` :term:`Server` [server_manual]_.
4342
4443
- :attr:`Server.sessions` [:class:`Session`, ...]
4544
@@ -136,7 +135,7 @@ def __init__(
136135
self.colors = colors
137136

138137
def is_alive(self) -> bool:
139-
"""If server alive or not.
138+
"""Return True if tmux server alive.
140139
141140
>>> tmux = Server(socket_name="no_exist")
142141
>>> assert not tmux.is_alive()
@@ -175,8 +174,7 @@ def raise_if_dead(self) -> None:
175174
# Command
176175
#
177176
def cmd(self, *args: t.Any, **kwargs: t.Any) -> tmux_cmd:
178-
"""
179-
Execute tmux command and return output.
177+
"""Execute tmux command, rsepective of socket name and file, return output.
180178
181179
Examples
182180
--------
@@ -212,8 +210,7 @@ def cmd(self, *args: t.Any, **kwargs: t.Any) -> tmux_cmd:
212210

213211
@property
214212
def attached_sessions(self) -> t.List[Session]:
215-
"""
216-
Return active :class:`Session` objects.
213+
"""Return active :class:`Session`s.
217214
218215
Examples
219216
--------
@@ -242,8 +239,7 @@ def attached_sessions(self) -> t.List[Session]:
242239
return attached_sessions
243240

244241
def has_session(self, target_session: str, exact: bool = True) -> bool:
245-
"""
246-
Return True if session exists. ``$ tmux has-session``.
242+
"""Return True if session exists.
247243
248244
Parameters
249245
----------
@@ -275,12 +271,11 @@ def has_session(self, target_session: str, exact: bool = True) -> bool:
275271
return False
276272

277273
def kill_server(self) -> None:
278-
"""``$ tmux kill-server``."""
274+
"""Kill tmux server."""
279275
self.cmd("kill-server")
280276

281277
def kill_session(self, target_session: t.Union[str, int]) -> "Server":
282-
"""
283-
Kill the tmux session with ``$ tmux kill-session``, return ``self``.
278+
"""Kill tmux session.
284279
285280
Parameters
286281
----------
@@ -304,8 +299,7 @@ def kill_session(self, target_session: t.Union[str, int]) -> "Server":
304299
return self
305300

306301
def switch_client(self, target_session: str) -> None:
307-
"""
308-
``$ tmux switch-client``.
302+
"""Switch tmux client.
309303
310304
Parameters
311305
----------
@@ -324,7 +318,7 @@ def switch_client(self, target_session: str) -> None:
324318
raise exc.LibTmuxException(proc.stderr)
325319

326320
def attach_session(self, target_session: t.Optional[str] = None) -> None:
327-
"""``$ tmux attach-session`` aka alias: ``$ tmux attach``.
321+
"""Attach tmux session.
328322
329323
Parameters
330324
----------
@@ -359,8 +353,7 @@ def new_session(
359353
*args: t.Any,
360354
**kwargs: t.Any,
361355
) -> Session:
362-
"""
363-
Return :class:`Session` from ``$ tmux new-session``.
356+
"""Create new session, returns new :class:`Session`.
364357
365358
Uses ``-P`` flag to print session info, ``-F`` for return formatting
366359
returns new Session object.
@@ -498,7 +491,7 @@ def new_session(
498491
#
499492
@property
500493
def sessions(self) -> QueryList[Session]: # type:ignore
501-
"""Sessions belonging server.
494+
"""Sessions contained in server.
502495
503496
Can be accessed via
504497
:meth:`.sessions.get() <libtmux._internal.query_list.QueryList.get()>` and
@@ -519,7 +512,7 @@ def sessions(self) -> QueryList[Session]: # type:ignore
519512

520513
@property
521514
def windows(self) -> QueryList[Window]: # type:ignore
522-
"""Windows belonging server.
515+
"""Windows contained in server's sessions.
523516
524517
Can be accessed via
525518
:meth:`.windows.get() <libtmux._internal.query_list.QueryList.get()>` and
@@ -538,7 +531,7 @@ def windows(self) -> QueryList[Window]: # type:ignore
538531

539532
@property
540533
def panes(self) -> QueryList[Pane]: # type:ignore
541-
"""Panes belonging server.
534+
"""Panes contained in tmux server (across all windows in all sessions).
542535
543536
Can be accessed via
544537
:meth:`.panes.get() <libtmux._internal.query_list.QueryList.get()>` and
@@ -582,8 +575,7 @@ def __repr__(self) -> str:
582575
# Legacy: Redundant stuff we want to remove
583576
#
584577
def _list_panes(self) -> t.List[PaneDict]:
585-
"""
586-
Return list of panes in :py:obj:`dict` form.
578+
"""Return list of panes in :py:obj:`dict` form.
587579
588580
Retrieved from ``$ tmux(1) list-panes`` stdout.
589581
@@ -599,8 +591,7 @@ def _list_panes(self) -> t.List[PaneDict]:
599591
return [p.__dict__ for p in self.panes]
600592

601593
def _update_panes(self) -> "Server":
602-
"""
603-
Update internal pane data and return ``self`` for chainability.
594+
"""Update internal pane data and return ``self`` for chainability.
604595
605596
.. deprecated:: 0.16
606597

0 commit comments

Comments
 (0)