Skip to content

Commit 567a04b

Browse files
committed
ruff(pydocstyle): Run automated fixes
`ruff --show-fixes --fix-only .` Fixed 45 errors: - docs/_ext/aafig.py: 7 × D208 (over-indentation) 1 × D202 (no-blank-line-after-function) - src/tmuxp/cli/__init__.py: 2 × D202 (no-blank-line-after-function) 1 × D209 (new-line-after-last-paragraph) - src/tmuxp/cli/freeze.py: 1 × D209 (new-line-after-last-paragraph) - src/tmuxp/cli/import_config.py: 2 × D209 (new-line-after-last-paragraph) - src/tmuxp/cli/load.py: 2 × D412 (blank-lines-between-header-and-content) 1 × D406 (new-line-after-section-name) 1 × D407 (dashed-underline-after-section) - src/tmuxp/cli/utils.py: 3 × D202 (no-blank-line-after-function) - src/tmuxp/exc.py: 5 × D211 (blank-line-before-class) - src/tmuxp/log.py: 1 × D202 (no-blank-line-after-function) - src/tmuxp/types.py: 1 × D412 (blank-lines-between-header-and-content) - src/tmuxp/workspace/builder.py: 2 × D202 (no-blank-line-after-function) 1 × D412 (blank-lines-between-header-and-content) - src/tmuxp/workspace/finders.py: 1 × D202 (no-blank-line-after-function) - src/tmuxp/workspace/freezer.py: 1 × D202 (no-blank-line-after-function) - src/tmuxp/workspace/importers.py: 2 × D202 (no-blank-line-after-function) 1 × D412 (blank-lines-between-header-and-content) - src/tmuxp/workspace/loader.py: 2 × D202 (no-blank-line-after-function) - tests/cli/test_cli.py: 1 × D202 (no-blank-line-after-function) - tests/tests/test_helpers.py: 1 × D202 (no-blank-line-after-function) - tests/workspace/test_finder.py: 3 × D202 (no-blank-line-after-function) - tests/workspace/test_freezer.py: 1 × D202 (no-blank-line-after-function) - tests/workspace/test_import_teamocil.py: 1 × D209 (new-line-after-last-paragraph) Fixed 45 errors (35 additional fixes available with `--unsafe-fixes`).
1 parent 86886ad commit 567a04b

File tree

19 files changed

+19
-44
lines changed

19 files changed

+19
-44
lines changed

docs/_ext/aafig.py

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
"""
2-
sphinxcontrib.aafig
3-
~~~~~~~~~~~~~~~~~~~
2+
sphinxcontrib.aafig
3+
~~~~~~~~~~~~~~~~~~~
44
5-
Allow embedded ASCII art to be rendered as nice looking images
6-
using the aafigure reStructuredText extension.
5+
Allow embedded ASCII art to be rendered as nice looking images
6+
using the aafigure reStructuredText extension.
77
8-
See the README file for details.
8+
See the README file for details.
99
10-
:author: Leandro Lucarella <llucax@gmail.com>
11-
:license: BOLA, see LICENSE for details
10+
:author: Leandro Lucarella <llucax@gmail.com>
11+
:license: BOLA, see LICENSE for details
1212
"""
1313
import logging
1414
import posixpath
@@ -158,7 +158,6 @@ def render_aafigure(
158158
"""
159159
Render an ASCII art figure into the requested format output file.
160160
"""
161-
162161
if aafigure is None:
163162
raise AafigureNotInstalled()
164163

src/tmuxp/cli/__init__.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,8 @@ def cli(_args: t.Optional[t.List[str]] = None) -> None:
111111
112112
Pass the "--help" argument to any command to see detailed help.
113113
See detailed documentation and examples at:
114-
http://tmuxp.git-pull.com/"""
115-
114+
http://tmuxp.git-pull.com/
115+
"""
116116
try:
117117
has_minimum_version()
118118
except TmuxCommandNotFound:
@@ -186,6 +186,5 @@ def startup(config_dir: pathlib.Path) -> None:
186186
----------
187187
str : get_workspace_dir(): Config directory to search
188188
"""
189-
190189
if not os.path.exists(config_dir):
191190
os.makedirs(config_dir)

src/tmuxp/cli/freeze.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,8 @@ def command_freeze(
9090
"""Snapshot a tmux session into a tmuxp workspace.
9191
9292
If SESSION_NAME is provided, snapshot that session. Otherwise, use the
93-
current session."""
93+
current session.
94+
"""
9495
server = Server(socket_name=args.socket_name, socket_path=args.socket_path)
9596

9697
try:

src/tmuxp/cli/import_config.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,8 @@ def command_import_tmuxinator(
176176
parser: t.Optional[argparse.ArgumentParser] = None,
177177
) -> None:
178178
"""Convert a tmuxinator config from workspace_file to tmuxp format and import
179-
it into tmuxp."""
179+
it into tmuxp.
180+
"""
180181
workspace_file = find_workspace_file(
181182
workspace_file, workspace_dir=get_tmuxinator_dir()
182183
)
@@ -188,7 +189,8 @@ def command_import_teamocil(
188189
parser: t.Optional[argparse.ArgumentParser] = None,
189190
) -> None:
190191
"""Convert a teamocil config from workspace_file to tmuxp format and import
191-
it into tmuxp."""
192+
it into tmuxp.
193+
"""
192194
workspace_file = find_workspace_file(
193195
workspace_file, workspace_dir=get_teamocil_dir()
194196
)

src/tmuxp/cli/load.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@ class CLILoadNamespace(argparse.Namespace):
5050
def set_layout_hook(session: Session, hook_name: str) -> None:
5151
"""Set layout hooks to normalize layout.
5252
53-
References:
54-
53+
References
54+
----------
5555
- tmuxp issue: https://github.com/tmux-python/tmuxp/issues/309
5656
- tmux issue: https://github.com/tmux/tmux/issues/1106
5757
@@ -305,7 +305,6 @@ def load_workspace(
305305
306306
Notes
307307
-----
308-
309308
tmuxp will check and load a workspace file. The file will use ConfigReader
310309
to load a JSON/YAML into a :py:obj:`dict`. Then :func:`loader.expand` and
311310
:func:`loader.trickle` will be used to expand any shorthands, template

src/tmuxp/cli/utils.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ def prompt(
4747
:param default: default value if no input provided.
4848
:rtype: string
4949
"""
50-
5150
_prompt = name + (default and " [%s]" % default or "")
5251
_prompt += name.endswith("?") and " " or ": "
5352
while True:
@@ -78,7 +77,6 @@ def prompt_bool(
7877
:param no_choices: default 'n', 'no', '0', 'off', 'false', 'f'
7978
:rtype: bool
8079
"""
81-
8280
yes_choices = yes_choices or ("y", "yes", "1", "on", "true", "t")
8381
no_choices = no_choices or ("n", "no", "0", "off", "false", "f")
8482

@@ -121,7 +119,6 @@ def prompt_choices(
121119
:param no_choice: acceptable list of strings for "null choice"
122120
:rtype: str
123121
"""
124-
125122
_choices: t.List[str] = []
126123
options: t.List[str] = []
127124

src/tmuxp/exc.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,10 @@
1212

1313

1414
class TmuxpException(Exception):
15-
1615
"""Base Exception for Tmuxp Errors."""
1716

1817

1918
class WorkspaceError(TmuxpException):
20-
2119
"""Error parsing tmuxp workspace data."""
2220

2321

@@ -52,7 +50,6 @@ def __init__(
5250

5351

5452
class EmptyWorkspaceException(WorkspaceError):
55-
5653
"""Workspace file is empty."""
5754

5855
def __init__(self, *args: object, **kwargs: object) -> None:
@@ -75,7 +72,6 @@ def __init__(self, *args: object, **kwargs: object) -> None:
7572

7673

7774
class TmuxpPluginException(TmuxpException):
78-
7975
"""Base Exception for Tmuxp Errors."""
8076

8177

@@ -88,7 +84,6 @@ def __init__(self, *args: object, **kwargs: object) -> None:
8884

8985
@implements_to_string
9086
class BeforeLoadScriptError(Exception):
91-
9287
"""Exception replacing :py:class:`subprocess.CalledProcessError` for
9388
:meth:`tmuxp.util.run_before_script`.
9489
"""

src/tmuxp/log.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,6 @@ def debug_log_template(
155155
str
156156
Log template.
157157
"""
158-
159158
reset = Style.RESET_ALL
160159
levelname = (
161160
LEVEL_COLORS.get(record.levelname, "")

src/tmuxp/types.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
33
Notes
44
-----
5-
65
:class:`StrPath` and :class:`StrOrBytesPath` is based on `typeshed's`_.
76
87
.. _typeshed's: https://github.com/python/typeshed/blob/9687d5/stdlib/_typeshed/__init__.pyi#L98

src/tmuxp/workspace/builder.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ class WorkspaceBuilder:
3333
3434
Examples
3535
--------
36-
3736
>>> import yaml
3837
3938
>>> session_config = yaml.load('''
@@ -161,7 +160,6 @@ def __init__(
161160
TODO: Initialize :class:`libtmux.Session` from here, in
162161
``self.session``.
163162
"""
164-
165163
if plugins is None:
166164
plugins = []
167165
if not session_config:
@@ -222,7 +220,6 @@ def build(self, session: t.Optional[Session] = None, append: bool = False) -> No
222220
append : bool
223221
append windows in current active session
224222
"""
225-
226223
if not session:
227224
if not self.server:
228225
raise exc.TmuxpException(

src/tmuxp/workspace/finders.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,6 @@ def get_workspace_dir() -> str:
113113
str :
114114
absolute path to tmuxp config directory
115115
"""
116-
117116
paths = []
118117
if "TMUXP_CONFIGDIR" in os.environ:
119118
paths.append(os.environ["TMUXP_CONFIGDIR"])

src/tmuxp/workspace/freezer.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ def inline(workspace_dict: t.Dict[str, t.Any]) -> t.Any:
1919
dict
2020
workspace with shorthands inlined.
2121
"""
22-
2322
if (
2423
"shell_command" in workspace_dict
2524
and isinstance(workspace_dict["shell_command"], list)

src/tmuxp/workspace/importers.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ def import_tmuxinator(workspace_dict: t.Dict[str, t.Any]) -> t.Dict[str, t.Any]:
1515
-------
1616
dict
1717
"""
18-
1918
tmuxp_workspace = {}
2019

2120
if "project_name" in workspace_dict:
@@ -111,7 +110,6 @@ def import_teamocil(workspace_dict: t.Dict[str, t.Any]) -> t.Dict[str, t.Any]:
111110
112111
Notes
113112
-----
114-
115113
Todos:
116114
117115
- change 'root' to a cd or start_directory
@@ -120,7 +118,6 @@ def import_teamocil(workspace_dict: t.Dict[str, t.Any]) -> t.Dict[str, t.Any]:
120118
- clear
121119
- cmd_separator
122120
"""
123-
124121
tmuxp_workspace = {}
125122

126123
if "session" in workspace_dict:

src/tmuxp/workspace/loader.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,6 @@ def expand(
102102
-------
103103
dict
104104
"""
105-
106105
# Note: cli.py will expand workspaces relative to project's workspace directory
107106
# for the first cwd argument.
108107
cwd = pathlib.Path().cwd() if not cwd else pathlib.Path(cwd)
@@ -208,7 +207,6 @@ def trickle(workspace_dict: t.Dict[str, t.Any]) -> t.Dict[str, t.Any]:
208207
-------
209208
dict
210209
"""
211-
212210
# prepends a pane's ``shell_command`` list with the window and sessions'
213211
# ``shell_command_before``.
214212

tests/cli/test_cli.py

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

2525
def test_creates_config_dir_not_exists(tmp_path: pathlib.Path) -> None:
2626
"""cli.startup() creates config dir if not exists."""
27-
2827
cli.startup(tmp_path)
2928
assert tmp_path.exists()
3029

tests/tests/test_helpers.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ def test_kills_session(server: Server) -> None:
1818
@pytest.mark.flaky(reruns=5)
1919
def test_if_session_killed_before(server: Server) -> None:
2020
"""Handles situation where session already closed within context"""
21-
2221
server = server
2322
session_name = get_test_session_name(server=server)
2423

tests/workspace/test_finder.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020

2121
def test_in_dir_from_config_dir(tmp_path: pathlib.Path) -> None:
2222
"""config.in_dir() finds configs config dir."""
23-
2423
cli.startup(tmp_path)
2524
yaml_config = tmp_path / "myconfig.yaml"
2625
yaml_config.touch()
@@ -33,7 +32,6 @@ def test_in_dir_from_config_dir(tmp_path: pathlib.Path) -> None:
3332

3433
def test_ignore_non_configs_from_current_dir(tmp_path: pathlib.Path) -> None:
3534
"""cli.in_dir() ignore non-config from config dir."""
36-
3735
cli.startup(tmp_path)
3836

3937
junk_config = tmp_path / "myconfig.psd"
@@ -48,7 +46,6 @@ def test_get_configs_cwd(
4846
tmp_path: pathlib.Path, monkeypatch: pytest.MonkeyPatch
4947
) -> None:
5048
"""config.in_cwd() find config in shell current working directory."""
51-
5249
confdir = tmp_path / "tmuxpconf2"
5350
confdir.mkdir()
5451

tests/workspace/test_freezer.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,6 @@ def test_freeze_config(session: Session) -> None:
8080

8181
def test_inline_workspace() -> None:
8282
""":meth:`freezer.inline()` shell commands list to string."""
83-
8483
test_workspace = freezer.inline(ibefore_workspace)
8584
assert test_workspace == iafter_workspace
8685

tests/workspace/test_import_teamocil.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,8 @@ def multisession_config() -> (
5959
"""Return loaded multisession teamocil config as a dictionary.
6060
6161
Also prevents re-running assertion the loads the yaml, since ordering of
62-
deep list items like panes will be inconsistent."""
62+
deep list items like panes will be inconsistent.
63+
"""
6364
teamocil_yaml_file = fixtures.layouts.teamocil_yaml_file
6465
test_config = config_reader.ConfigReader._from_file(teamocil_yaml_file)
6566
teamocil_dict: t.Dict[str, t.Any] = fixtures.layouts.teamocil_dict

0 commit comments

Comments
 (0)