Skip to content

Commit d55b65b

Browse files
committed
docs(docstrings): Add docstrings to dataclasses, fix citation syntax
why: Dataclasses without docstrings cause "Inline strong start-string without end-string" warnings. Citation syntax [1]_ not resolving properly. what: - Add docstrings to ServerOptions, SessionOptions, WindowOptions, PaneOptions, Options dataclasses (constants.py) - Simplify EnvironmentVarGuard docstring, convert citation to inline URL (environment.py)
1 parent ae5a5b5 commit d55b65b

File tree

2 files changed

+12
-8
lines changed

2 files changed

+12
-8
lines changed

src/libtmux/_internal/constants.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@
2626
class ServerOptions(
2727
SkipDefaultFieldsReprMixin,
2828
):
29+
"""Container for tmux server options."""
30+
2931
backspace: str | None = field(default=None)
3032
buffer_limit: int | None = field(default=None)
3133
command_alias: SparseArray[str] = field(default_factory=SparseArray)
@@ -59,6 +61,8 @@ def __init__(self, **kwargs: object) -> None:
5961
class SessionOptions(
6062
SkipDefaultFieldsReprMixin,
6163
):
64+
"""Container for tmux session options."""
65+
6266
activity_action: t.Literal["any", "none", "current", "other"] | None = field(
6367
default=None,
6468
)
@@ -134,6 +138,8 @@ def __init__(self, **kwargs: object) -> None:
134138
class WindowOptions(
135139
SkipDefaultFieldsReprMixin,
136140
):
141+
"""Container for tmux window options."""
142+
137143
aggressive_resize: t.Literal["on", "off"] | None = field(default=None)
138144
automatic_rename: t.Literal["on", "off"] | None = field(default=None)
139145
automatic_rename_format: str | None = field(default=None)
@@ -197,6 +203,8 @@ def __init__(self, **kwargs: object) -> None:
197203
class PaneOptions(
198204
SkipDefaultFieldsReprMixin,
199205
):
206+
"""Container for tmux pane options."""
207+
200208
allow_passthrough: t.Literal["on", "off", "all"] | None = field(default=None)
201209
allow_rename: t.Literal["on", "off"] | None = field(default=None)
202210
alternate_screen: t.Literal["on", "off"] | None = field(default=None)
@@ -239,6 +247,8 @@ class Options(
239247
PaneOptions,
240248
SkipDefaultFieldsReprMixin,
241249
):
250+
"""Container for all tmux options (server, session, window, and pane)."""
251+
242252
def __init__(self, **kwargs: object) -> None:
243253
# Convert hyphenated keys to underscored attribute names and assign values
244254
# Remove asaterisk from inherited options

src/libtmux/test/environment.py

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,19 +21,13 @@
2121
class EnvironmentVarGuard:
2222
"""Mock environmental variables safely.
2323
24-
Helps rotect the environment variable properly. Can be used as context
24+
Helps protect the environment variable properly. Can be used as context
2525
manager.
2626
2727
Notes
2828
-----
2929
Vendorized to fix issue with Anaconda Python 2 not including test module,
30-
see #121 [1]_
31-
32-
References
33-
----------
34-
.. [1] Just installed, "ImportError: cannot import name test_support".
35-
GitHub issue for tmuxp. https://github.com/tmux-python/tmuxp/issues/121.
36-
Created October 12th, 2015. Accessed April 7th, 2018.
30+
see `tmuxp#121 <https://github.com/tmux-python/tmuxp/issues/121>`_.
3731
"""
3832

3933
def __init__(self) -> None:

0 commit comments

Comments
 (0)