Skip to content

Commit f32527d

Browse files
committed
ruff(pydocstyle): Run automated fixes
`ruff --show-fixes --fix-only .` Fixed 72 errors: - src/libtmux/_internal/dataclasses.py: 2 × D412 (blank-lines-between-header-and-content) - src/libtmux/_vendor/version.py: 1 × D202 (no-blank-line-after-function) - src/libtmux/common.py: 3 × D412 (blank-lines-between-header-and-content) 2 × D211 (blank-line-before-class) - src/libtmux/exc.py: 16 × D211 (blank-line-before-class) - src/libtmux/pane.py: 2 × D412 (blank-lines-between-header-and-content) 1 × D202 (no-blank-line-after-function) - src/libtmux/server.py: 1 × D202 (no-blank-line-after-function) - src/libtmux/session.py: 5 × D202 (no-blank-line-after-function) - src/libtmux/test.py: 1 × D202 (no-blank-line-after-function) - src/libtmux/window.py: 3 × D202 (no-blank-line-after-function) 2 × D412 (blank-lines-between-header-and-content) - tests/legacy_api/test_pane.py: 1 × D202 (no-blank-line-after-function) - tests/legacy_api/test_server.py: 1 × D209 (new-line-after-last-paragraph) - tests/legacy_api/test_session.py: 5 × D202 (no-blank-line-after-function) - tests/legacy_api/test_tmuxobject.py: 4 × D202 (no-blank-line-after-function) - tests/legacy_api/test_window.py: 4 × D202 (no-blank-line-after-function) 1 × D403 (first-line-capitalized) - tests/test_pane.py: 1 × D202 (no-blank-line-after-function) - tests/test_server.py: 2 × D209 (new-line-after-last-paragraph) - tests/test_session.py: 5 × D202 (no-blank-line-after-function) - tests/test_tmuxobject.py: 4 × D202 (no-blank-line-after-function) - tests/test_window.py: 4 × D202 (no-blank-line-after-function) 1 × D403 (first-line-capitalized) Fixed 72 errors (77 additional fixes available with `--unsafe-fixes`).
1 parent fba07b8 commit f32527d

File tree

19 files changed

+8
-72
lines changed

19 files changed

+8
-72
lines changed

src/libtmux/_internal/dataclasses.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,12 @@ class SkipDefaultFieldsReprMixin:
1818
1919
Notes
2020
-----
21-
2221
Credit: Pietro Oldrati, 2022-05-08, Unilicense
2322
2423
https://stackoverflow.com/a/72161437/1396928
2524
2625
Examples
2726
--------
28-
2927
>>> @dataclasses.dataclass()
3028
... class Item:
3129
... name: str

src/libtmux/_vendor/version.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,6 @@ def __init__(self, version: str) -> None:
194194
If the ``version`` does not conform to PEP 440 in any way then this
195195
exception will be raised.
196196
"""
197-
198197
# Validate the version and parse it into pieces
199198
match = self._regex.search(version)
200199
if not match:

src/libtmux/common.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@
3636

3737

3838
class EnvironmentMixin:
39-
4039
"""
4140
Mixin class for managing session and server level environment variables in
4241
tmux.
@@ -194,13 +193,11 @@ def getenv(self, name: str) -> Optional[t.Union[str, bool]]:
194193

195194

196195
class tmux_cmd:
197-
198196
"""
199197
:term:`tmux(1)` command via :py:mod:`subprocess`.
200198
201199
Examples
202200
--------
203-
204201
.. code-block:: python
205202
206203
proc = tmux_cmd('new-session', '-s%' % 'my session')
@@ -220,7 +217,6 @@ class tmux_cmd:
220217
221218
Notes
222219
-----
223-
224220
.. versionchanged:: 0.8
225221
Renamed from ``tmux`` to ``tmux_cmd``.
226222
"""
@@ -413,7 +409,6 @@ def has_minimum_version(raises: bool = True) -> bool:
413409
414410
Notes
415411
-----
416-
417412
.. versionchanged:: 0.7.0
418413
No longer returns version, returns True or False
419414

src/libtmux/exc.py

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,14 @@
1313

1414

1515
class LibTmuxException(Exception):
16-
1716
"""Base Exception for libtmux Errors."""
1817

1918

2019
class TmuxSessionExists(LibTmuxException):
21-
2220
"""Session does not exist in the server."""
2321

2422

2523
class TmuxCommandNotFound(LibTmuxException):
26-
2724
"""Application binary for tmux not found."""
2825

2926

@@ -47,12 +44,10 @@ def __init__(
4744

4845

4946
class VersionTooLow(LibTmuxException):
50-
5147
"""Raised if tmux below the minimum version to use libtmux."""
5248

5349

5450
class BadSessionName(LibTmuxException):
55-
5651
"""Disallowed session name for tmux (empty, contains periods or colons)."""
5752

5853
def __init__(
@@ -65,40 +60,33 @@ def __init__(
6560

6661

6762
class OptionError(LibTmuxException):
68-
6963
"""Root error for any error involving invalid, ambiguous or bad options."""
7064

7165

7266
class UnknownOption(OptionError):
73-
7467
"""Option unknown to tmux show-option(s) or show-window-option(s)."""
7568

7669

7770
class UnknownColorOption(UnknownOption):
78-
7971
"""Unknown color option."""
8072

8173
def __init__(self, *args: object):
8274
return super().__init__("Server.colors must equal 88 or 256")
8375

8476

8577
class InvalidOption(OptionError):
86-
8778
"""Option invalid to tmux, introduced in tmux v2.4."""
8879

8980

9081
class AmbiguousOption(OptionError):
91-
9282
"""Option that could potentially match more than one."""
9383

9484

9585
class WaitTimeout(LibTmuxException):
96-
9786
"""Function timed out without meeting condition"""
9887

9988

10089
class VariableUnpackingError(LibTmuxException):
101-
10290
"""Error unpacking variable"""
10391

10492
def __init__(self, variable: t.Optional[t.Any] = None, *args: object):
@@ -119,28 +107,24 @@ def __init__(self, pane_id: t.Optional[str] = None, *args: object):
119107

120108

121109
class WindowError(LibTmuxException):
122-
123110
"""Any type of window related error"""
124111

125112

126113
class MultipleActiveWindows(WindowError):
127-
128114
"""Multiple active windows"""
129115

130116
def __init__(self, count: int, *args: object):
131117
return super().__init__(f"Multiple active windows: {count} found")
132118

133119

134120
class NoActiveWindow(WindowError):
135-
136121
"""No active window found"""
137122

138123
def __init__(self, *args: object):
139124
return super().__init__("No active windows found")
140125

141126

142127
class NoWindowsExist(WindowError):
143-
144128
"""No windows exist for object"""
145129

146130
def __init__(self, *args: object):

src/libtmux/pane.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,13 +53,11 @@ class Pane(Obj):
5353
5454
Notes
5555
-----
56-
5756
.. versionchanged:: 0.8
5857
Renamed from ``.tmux`` to ``.cmd``.
5958
6059
References
6160
----------
62-
6361
.. [pane_manual] tmux pane. openbsd manpage for TMUX(1).
6462
"Each window displayed by tmux may be split into one or more
6563
panes; each pane takes up a certain area of the display and is
@@ -370,7 +368,6 @@ def clear(self) -> "Pane":
370368

371369
def reset(self) -> "Pane":
372370
"""Reset and clear pane history."""
373-
374371
self.cmd("send-keys", r"-R \; clear-history")
375372
return self
376373

src/libtmux/server.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,6 @@ def cmd(self, *args: t.Any, **kwargs: t.Any) -> tmux_cmd:
193193
194194
Renamed from ``.tmux`` to ``.cmd``.
195195
"""
196-
197196
cmd_args: t.List[t.Union[str, int]] = list(args)
198197
if self.socket_name:
199198
cmd_args.insert(0, f"-L{self.socket_name}")

src/libtmux/session.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,6 @@ def show_option(
290290
291291
Test and return True/False for on/off string.
292292
"""
293-
294293
tmux_args: t.Tuple[str, ...] = ()
295294

296295
if _global:
@@ -337,7 +336,6 @@ def select_window(self, target_window: t.Union[str, int]) -> "Window":
337336
338337
assure ``-l``, ``-n``, ``-p`` work.
339338
"""
340-
341339
# Note that we also provide the session ID here, since cmd()
342340
# will not automatically add it as there is already a '-t'
343341
# argument provided.
@@ -383,7 +381,6 @@ def attach_session(self) -> "Session":
383381

384382
def kill_session(self) -> None:
385383
"""``$ tmux kill-session``."""
386-
387384
proc = self.cmd("kill-session", "-t%s" % self.session_id)
388385

389386
if proc.stderr:
@@ -534,7 +531,6 @@ def kill_window(self, target_window: t.Optional[str] = None) -> None:
534531
target_window : str, optional
535532
window to kill
536533
"""
537-
538534
if target_window:
539535
if isinstance(target_window, int):
540536
target = "-t%s:%d" % (self.window_name, target_window)
@@ -552,7 +548,6 @@ def kill_window(self, target_window: t.Optional[str] = None) -> None:
552548
@property
553549
def attached_pane(self) -> t.Optional["Pane"]:
554550
"""Return active :class:`Pane` object."""
555-
556551
return self.attached_window.attached_pane
557552

558553
#

src/libtmux/test.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,6 @@ def temp_session(
209209
... session.new_window(window_name='my window')
210210
Window(@3 2:my window, Session($... ...))
211211
"""
212-
213212
if "session_name" in kwargs:
214213
session_name = kwargs.pop("session_name")
215214
else:

src/libtmux/window.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,6 @@ def select_pane(self, target_pane: t.Union[str, int]) -> t.Optional["Pane"]:
159159
------
160160
:class:`Pane`
161161
"""
162-
163162
if target_pane in ["-l", "-U", "-D", "-L", "-R"]:
164163
proc = self.cmd("select-pane", "-t%s" % self.window_id, target_pane)
165164
else:
@@ -210,7 +209,6 @@ def split_window(
210209
211210
Notes
212211
-----
213-
214212
:term:`tmux(1)` will move window to the new pane if the
215213
``split-window`` target is off screen. tmux handles the ``-d`` the
216214
same way as ``new-window`` and ``attach`` in
@@ -454,7 +452,6 @@ def rename_window(self, new_name: str) -> "Window":
454452
455453
Examples
456454
--------
457-
458455
>>> window = session.attached_window
459456
460457
>>> window.rename_window('My project')
@@ -463,7 +460,6 @@ def rename_window(self, new_name: str) -> "Window":
463460
>>> window.rename_window('New name')
464461
Window(@1 1:New name, Session($1 ...))
465462
"""
466-
467463
import shlex
468464

469465
lex = shlex.shlex(new_name)
@@ -482,7 +478,6 @@ def rename_window(self, new_name: str) -> "Window":
482478

483479
def kill_window(self) -> None:
484480
"""Kill the current :class:`Window` object. ``$ tmux kill-window``."""
485-
486481
proc = self.cmd(
487482
"kill-window",
488483
f"-t{self.session_id}:{self.window_index}",

tests/legacy_api/test_pane.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99

1010
def test_resize_pane(session: Session) -> None:
1111
"""Test Pane.resize_pane()."""
12-
1312
window = session.attached_window
1413
window.rename_window("test_resize_pane")
1514

0 commit comments

Comments
 (0)