Skip to content

Commit 2fcda55

Browse files
committed
ruff(pydocstyle): Run automated fixes (unsafe ones)
`ruff --show-fixes --fix-only --unsafe-fixes .` Fixed 35 errors: - conftest.py: 1 × D400 (ends-in-period) - docs/_ext/aafig.py: 2 × D200 (fits-on-one-line) 1 × D400 (ends-in-period) - docs/conf.py: 1 × D400 (ends-in-period) - src/tmuxp/_types.py: 1 × D400 (ends-in-period) - src/tmuxp/cli/debug_info.py: 4 × D200 (fits-on-one-line) - src/tmuxp/cli/load.py: 6 × D400 (ends-in-period) 1 × D200 (fits-on-one-line) - src/tmuxp/cli/utils.py: 5 × D400 (ends-in-period) 1 × D200 (fits-on-one-line) - src/tmuxp/config_reader.py: 1 × D400 (ends-in-period) - src/tmuxp/plugin.py: 2 × D200 (fits-on-one-line) - src/tmuxp/shell.py: 1 × D400 (ends-in-period) - src/tmuxp/types.py: 1 × D400 (ends-in-period) - src/tmuxp/util.py: 1 × D400 (ends-in-period) - tests/fixtures/pluginsystem/partials/_types.py: 2 × D400 (ends-in-period) - tests/fixtures/utils.py: 2 × D400 (ends-in-period) - tests/tests/test_helpers.py: 1 × D400 (ends-in-period) - tests/workspace/conftest.py: 1 × D400 (ends-in-period) Fixed 35 errors.
1 parent 567a04b commit 2fcda55

File tree

16 files changed

+33
-53
lines changed

16 files changed

+33
-53
lines changed

conftest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
"""Conftest.py (root-level)
1+
"""Conftest.py (root-level).
22
33
We keep this in root pytest fixtures in pytest's doctest plugin to be available, as well
44
as avoiding conftest.py from being included in the wheel.

docs/_ext/aafig.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
"""
2-
sphinxcontrib.aafig
2+
sphinxcontrib.aafig.
33
~~~~~~~~~~~~~~~~~~~
44
55
Allow embedded ASCII art to be rendered as nice looking images
@@ -61,9 +61,7 @@ class AafigError(SphinxError):
6161

6262

6363
class AafigDirective(images.Image): # type:ignore
64-
"""
65-
Directive to insert an ASCII art figure to be rendered by aafigure.
66-
"""
64+
"""Directive to insert an ASCII art figure to be rendered by aafigure."""
6765

6866
has_content = True
6967
required_arguments = 0
@@ -155,9 +153,7 @@ def __init__(self, *args: object, **kwargs: object) -> None:
155153
def render_aafigure(
156154
app: "Sphinx", text: str, options: t.Dict[str, str]
157155
) -> t.Tuple[str, str, t.Optional[str], t.Optional[str]]:
158-
"""
159-
Render an ASCII art figure into the requested format output file.
160-
"""
156+
"""Render an ASCII art figure into the requested format output file."""
161157
if aafigure is None:
162158
raise AafigureNotInstalled()
163159

docs/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@
142142

143143
def linkcode_resolve(domain: str, info: t.Dict[str, str]) -> t.Union[None, str]:
144144
"""
145-
Determine the URL corresponding to Python object
145+
Determine the URL corresponding to Python object.
146146
147147
Notes
148148
-----

src/tmuxp/_types.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
"""Internal, :const:`typing.TYPE_CHECKING` guarded :term:`type annotations <annotation>`
1+
"""Internal, :const:`typing.TYPE_CHECKING` guarded :term:`type annotations <annotation>`.
22
33
These are _not_ to be imported at runtime as `typing_extensions` is not
44
bundled with tmuxp. Usage example:

src/tmuxp/cli/debug_info.py

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -25,26 +25,18 @@ def create_debug_info_subparser(
2525
def command_debug_info(
2626
parser: t.Optional[argparse.ArgumentParser] = None,
2727
) -> None:
28-
"""
29-
Print debug info to submit with Issues.
30-
"""
28+
"""Print debug info to submit with Issues."""
3129

3230
def prepend_tab(strings: t.List[str]) -> t.List[str]:
33-
"""
34-
Prepend tab to strings in list.
35-
"""
31+
"""Prepend tab to strings in list."""
3632
return ["\t%s" % x for x in strings]
3733

3834
def output_break() -> str:
39-
"""
40-
Generate output break.
41-
"""
35+
"""Generate output break."""
4236
return "-" * 25
4337

4438
def format_tmux_resp(std_resp: tmux_cmd) -> str:
45-
"""
46-
Format tmux command response for tmuxp stdout.
47-
"""
39+
"""Format tmux command response for tmuxp stdout."""
4840
return "\n".join(
4941
[
5042
"\n".join(prepend_tab(std_resp.stdout)),

src/tmuxp/cli/load.py

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -105,9 +105,7 @@ def set_layout_hook(session: Session, hook_name: str) -> None:
105105

106106

107107
def load_plugins(session_config: t.Dict[str, t.Any]) -> t.List[t.Any]:
108-
"""
109-
Load and return plugins in workspace
110-
"""
108+
"""Load and return plugins in workspace."""
111109
plugins = []
112110
if "plugins" in session_config:
113111
for plugin in session_config["plugins"]:
@@ -155,7 +153,7 @@ def load_plugins(session_config: t.Dict[str, t.Any]) -> t.List[t.Any]:
155153

156154
def _reattach(builder: WorkspaceBuilder) -> None:
157155
"""
158-
Reattach session (depending on env being inside tmux already or not)
156+
Reattach session (depending on env being inside tmux already or not).
159157
160158
Parameters
161159
----------
@@ -185,7 +183,7 @@ def _reattach(builder: WorkspaceBuilder) -> None:
185183

186184
def _load_attached(builder: WorkspaceBuilder, detached: bool) -> None:
187185
"""
188-
Load workspace in new session
186+
Load workspace in new session.
189187
190188
Parameters
191189
----------
@@ -219,7 +217,7 @@ def _load_attached(builder: WorkspaceBuilder, detached: bool) -> None:
219217

220218
def _load_detached(builder: WorkspaceBuilder) -> None:
221219
"""
222-
Load workspace in new session but don't attach
220+
Load workspace in new session but don't attach.
223221
224222
Parameters
225223
----------
@@ -238,7 +236,7 @@ def _load_detached(builder: WorkspaceBuilder) -> None:
238236

239237
def _load_append_windows_to_current_session(builder: WorkspaceBuilder) -> None:
240238
"""
241-
Load workspace as new windows in current session
239+
Load workspace as new windows in current session.
242240
243241
Parameters
244242
----------
@@ -254,7 +252,7 @@ def _load_append_windows_to_current_session(builder: WorkspaceBuilder) -> None:
254252

255253
def _setup_plugins(builder: WorkspaceBuilder) -> Session:
256254
"""
257-
Runs after before_script
255+
Runs after before_script.
258256
259257
Parameters
260258
----------

src/tmuxp/cli/utils.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,7 @@ def tmuxp_echo(
1818
log_level: str = "INFO",
1919
style_log: bool = False,
2020
) -> None:
21-
"""
22-
Combines logging.log and click.echo
23-
"""
21+
"""Combines logging.log and click.echo."""
2422
if message is None:
2523
return
2624

@@ -45,7 +43,7 @@ def prompt(
4543
https://github.com/techniq/flask-script/blob/master/LICENSE
4644
:param name: prompt text
4745
:param default: default value if no input provided.
48-
:rtype: string
46+
:rtype: string.
4947
"""
5048
_prompt = name + (default and " [%s]" % default or "")
5149
_prompt += name.endswith("?") and " " or ": "
@@ -75,7 +73,7 @@ def prompt_bool(
7573
:param default: default value if no input provided.
7674
:param yes_choices: default 'y', 'yes', '1', 'on', 'true', 't'
7775
:param no_choices: default 'n', 'no', '0', 'off', 'false', 'f'
78-
:rtype: bool
76+
:rtype: bool.
7977
"""
8078
yes_choices = yes_choices or ("y", "yes", "1", "on", "true", "t")
8179
no_choices = no_choices or ("n", "no", "0", "off", "false", "f")
@@ -117,7 +115,7 @@ def prompt_choices(
117115
single strings or (key, value) tuples.
118116
:param default: default value if no input provided.
119117
:param no_choice: acceptable list of strings for "null choice"
120-
:rtype: str
118+
:rtype: str.
121119
"""
122120
_choices: t.List[str] = []
123121
options: t.List[str] = []
@@ -202,7 +200,7 @@ def style(
202200
strikethrough: t.Optional[bool] = None,
203201
reset: bool = True,
204202
) -> str:
205-
"""Credit: click"""
203+
"""Credit: click."""
206204
if not isinstance(text, str):
207205
text = str(text)
208206

src/tmuxp/config_reader.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ def _from_file(cls, path: pathlib.Path) -> t.Dict[str, t.Any]:
118118

119119
@classmethod
120120
def from_file(cls, path: pathlib.Path) -> "ConfigReader":
121-
r"""Load data from file path
121+
r"""Load data from file path.
122122
123123
**YAML file**
124124

src/tmuxp/plugin.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -169,9 +169,7 @@ def __init__(self, **kwargs: "Unpack[PluginConfigSchema]") -> None:
169169
self._version_check()
170170

171171
def _version_check(self) -> None:
172-
"""
173-
Check all dependency versions for compatibility.
174-
"""
172+
"""Check all dependency versions for compatibility."""
175173
for dep, constraints in self.version_constraints.items():
176174
assert isinstance(constraints, dict)
177175
try:
@@ -192,9 +190,7 @@ def _pass_version_check(
192190
vmax: t.Optional[str],
193191
incompatible: t.List[t.Union[t.Any, str]],
194192
) -> bool:
195-
"""
196-
Provide affirmative if version compatibility is correct.
197-
"""
193+
"""Provide affirmative if version compatibility is correct."""
198194
if vmin and version < Version(vmin):
199195
return False
200196
if vmax and version > Version(vmax):

src/tmuxp/shell.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ def launch_ptpython() -> None:
170170

171171

172172
def get_ptipython(options: "LaunchOptionalImports", vi_mode: bool = False) -> t.Any:
173-
"""Based on django-extensions
173+
"""Based on django-extensions.
174174
175175
Run renamed to launch, get_imported_objects renamed to get_launch_args
176176
"""

src/tmuxp/types.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
"""Internal :term:`type annotations <annotation>`
1+
"""Internal :term:`type annotations <annotation>`.
22
33
Notes
44
-----

src/tmuxp/util.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ def oh_my_zsh_auto_title() -> None:
9191

9292

9393
def get_current_pane(server: "Server") -> t.Optional["Pane"]:
94-
"""Return Pane if one found in env"""
94+
"""Return Pane if one found in env."""
9595
if os.getenv("TMUX_PANE") is not None:
9696
try:
9797
return next(p for p in server.panes if p.pane_id == os.getenv("TMUX_PANE"))

tests/fixtures/pluginsystem/partials/_types.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
"""Internal, :const:`typing.TYPE_CHECKING` guarded :term:`type annotations <annotation>`
1+
"""Internal, :const:`typing.TYPE_CHECKING` guarded :term:`type annotations <annotation>`.
22
33
These are _not_ to be imported at runtime as `typing_extensions` is not
44
bundled with tmuxp. Usage example:
@@ -15,7 +15,7 @@
1515

1616

1717
class PluginTestConfigSchema(TypedDict):
18-
"""Same as PluginConfigSchema, but with tmux, libtmux, and tmuxp version"""
18+
"""Same as PluginConfigSchema, but with tmux, libtmux, and tmuxp version."""
1919

2020
tmux_version: NotRequired[str]
2121
libtmux_version: NotRequired[str]

tests/fixtures/utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,15 @@
77
def get_workspace_file(
88
_file: t.Union[str, pathlib.Path],
99
) -> pathlib.Path:
10-
"""Return fixture data, relative to __file__"""
10+
"""Return fixture data, relative to __file__."""
1111
if isinstance(_file, str):
1212
_file = pathlib.Path(_file)
1313

1414
return FIXTURE_PATH / _file
1515

1616

1717
def read_workspace_file(_file: t.Union[pathlib.Path, str]) -> str:
18-
"""Return fixture data, relative to __file__"""
18+
"""Return fixture data, relative to __file__."""
1919
if isinstance(_file, str):
2020
_file = pathlib.Path(_file)
2121

tests/tests/test_helpers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ def test_kills_session(server: Server) -> None:
1717

1818
@pytest.mark.flaky(reruns=5)
1919
def test_if_session_killed_before(server: Server) -> None:
20-
"""Handles situation where session already closed within context"""
20+
"""Handles situation where session already closed within context."""
2121
server = server
2222
session_name = get_test_session_name(server=server)
2323

tests/workspace/conftest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
@pytest.fixture
99
def config_fixture() -> WorkspaceTestData:
10-
"""Deferred import of tmuxp.tests.fixtures.*
10+
"""Deferred import of tmuxp.tests.fixtures.*.
1111
1212
pytest setup (conftest.py) patches os.environ["HOME"], delay execution of
1313
os.path.expanduser until here.

0 commit comments

Comments
 (0)