Skip to content

Commit 9f1ab61

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

File tree

1 file changed

+11
-19
lines changed

1 file changed

+11
-19
lines changed

src/libtmux/session.py

Lines changed: 11 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,7 @@
3636

3737
@dataclasses.dataclass()
3838
class Session(Obj, EnvironmentMixin):
39-
"""
40-
A :term:`tmux(1)` :term:`Session` [session_manual]_.
39+
""":term:`tmux(1)` :term:`Session` [session_manual]_.
4140
4241
Holds :class:`Window` objects.
4342
@@ -97,7 +96,7 @@ def from_session_id(cls, server: "Server", session_id: str) -> "Session":
9796
#
9897
@property
9998
def windows(self) -> QueryList["Window"]: # type:ignore
100-
"""Windows belonging session.
99+
"""Windows contained by session.
101100
102101
Can be accessed via
103102
:meth:`.windows.get() <libtmux._internal.query_list.QueryList.get()>` and
@@ -117,7 +116,7 @@ def windows(self) -> QueryList["Window"]: # type:ignore
117116

118117
@property
119118
def panes(self) -> QueryList["Pane"]: # type:ignore
120-
"""Panes belonging session.
119+
"""Panes contained by session's windows.
121120
122121
Can be accessed via
123122
:meth:`.panes.get() <libtmux._internal.query_list.QueryList.get()>` and
@@ -139,8 +138,7 @@ def panes(self) -> QueryList["Pane"]: # type:ignore
139138
# Command
140139
#
141140
def cmd(self, *args: t.Any, **kwargs: t.Any) -> tmux_cmd:
142-
"""
143-
Return :meth:`server.cmd`.
141+
"""Execute tmux subcommand against target session. See :meth:`server.cmd`.
144142
145143
Returns
146144
-------
@@ -173,8 +171,7 @@ def cmd(self, *args: t.Any, **kwargs: t.Any) -> tmux_cmd:
173171
def set_option(
174172
self, option: str, value: t.Union[str, int], _global: bool = False
175173
) -> "Session":
176-
"""
177-
Set option ``$ tmux set-option <option> <value>``.
174+
"""Set option ``$ tmux set-option <option> <value>``.
178175
179176
Parameters
180177
----------
@@ -225,8 +222,7 @@ def set_option(
225222
def show_options(
226223
self, _global: t.Optional[bool] = False
227224
) -> t.Dict[str, t.Union[str, int]]:
228-
"""
229-
Return a dict of options for the window.
225+
"""Return dict of options for the session.
230226
231227
Parameters
232228
----------
@@ -316,8 +312,7 @@ def show_option(
316312
return value
317313

318314
def select_window(self, target_window: t.Union[str, int]) -> "Window":
319-
"""
320-
Return :class:`Window` selected via ``$ tmux select-window``.
315+
"""Select window, return selected window.
321316
322317
Parameters
323318
----------
@@ -377,15 +372,14 @@ def attach_session(self) -> "Session":
377372
return self
378373

379374
def kill_session(self) -> None:
380-
"""``$ tmux kill-session``."""
375+
"""Destroy session."""
381376
proc = self.cmd("kill-session", "-t%s" % self.session_id)
382377

383378
if proc.stderr:
384379
raise exc.LibTmuxException(proc.stderr)
385380

386381
def switch_client(self) -> "Session":
387-
"""
388-
Switch client to this session.
382+
"""Switch client to session.
389383
390384
Raises
391385
------
@@ -399,8 +393,7 @@ def switch_client(self) -> "Session":
399393
return self
400394

401395
def rename_session(self, new_name: str) -> "Session":
402-
"""
403-
Rename session and return new :class:`Session` object.
396+
"""Rename session and return new :class:`Session` object.
404397
405398
Parameters
406399
----------
@@ -440,8 +433,7 @@ def new_window(
440433
window_shell: t.Optional[str] = None,
441434
environment: t.Optional[t.Dict[str, str]] = None,
442435
) -> "Window":
443-
"""
444-
Return :class:`Window` from ``$ tmux new-window``.
436+
"""Create new window, returns new :class:`Window`.
445437
446438
By default, this will make the window active. For the new window
447439
to be created and not set to current, pass in ``attach=False``.

0 commit comments

Comments
 (0)