Skip to content

Commit 18e74b5

Browse files
committed
chore(ruff): fixes from ruff 0.4.5
ruff check --select ALL . --fix --unsafe-fixes --preview --show-fixes --ignore T201 --ignore F401 --ignore PT014 --ignore RUF100; ruff format . Fixed 29 errors: - conftest.py: 1 × UP037 (quoted-annotation) - src/tmuxp/_internal/config_reader.py: 1 × UP037 (quoted-annotation) - src/tmuxp/cli/convert.py: 1 × UP037 (quoted-annotation) - src/tmuxp/cli/debug_info.py: 3 × COM812 (missing-trailing-comma) - src/tmuxp/cli/freeze.py: 1 × UP037 (quoted-annotation) 1 × COM812 (missing-trailing-comma) - src/tmuxp/cli/load.py: 1 × COM812 (missing-trailing-comma) - src/tmuxp/plugin.py: 1 × UP037 (quoted-annotation) - src/tmuxp/shell.py: 6 × PGH004 (blanket-noqa) - src/tmuxp/util.py: 1 × PGH004 (blanket-noqa) - src/tmuxp/workspace/builder.py: 1 × UP037 (quoted-annotation) - tests/fixtures/pluginsystem/partials/all_pass.py: 1 × UP037 (quoted-annotation) - tests/fixtures/pluginsystem/partials/libtmux_version_fail.py: 3 × UP037 (quoted-annotation) - tests/fixtures/pluginsystem/partials/tmux_version_fail.py: 3 × UP037 (quoted-annotation) - tests/fixtures/pluginsystem/partials/tmuxp_version_fail.py: 3 × UP037 (quoted-annotation) - tests/fixtures/pluginsystem/plugins/tmuxp_test_plugin_fail/tmuxp_test_plugin_fail/plugin.py: 1 × UP037 (quoted-annotation)
1 parent e2035bd commit 18e74b5

File tree

15 files changed

+29
-29
lines changed

15 files changed

+29
-29
lines changed

conftest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ def add_doctest_fixtures(
105105
"""Harness pytest fixtures to doctests namespace."""
106106
if isinstance(request._pyfuncitem, DoctestItem) and shutil.which("tmux"):
107107
doctest_namespace["server"] = request.getfixturevalue("server")
108-
session: "Session" = request.getfixturevalue("session")
108+
session: Session = request.getfixturevalue("session")
109109
doctest_namespace["session"] = session
110110
doctest_namespace["window"] = session.active_window
111111
doctest_namespace["pane"] = session.active_pane

src/tmuxp/_internal/config_reader.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ def _from_file(cls, path: pathlib.Path) -> t.Dict[str, t.Any]:
107107
content = path.open().read()
108108

109109
if path.suffix in {".yaml", ".yml"}:
110-
fmt: "FormatLiteral" = "yaml"
110+
fmt: FormatLiteral = "yaml"
111111
elif path.suffix == ".json":
112112
fmt = "json"
113113
else:

src/tmuxp/cli/convert.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ def command_convert(
6868

6969
_, ext = os.path.splitext(workspace_file)
7070
ext = ext.lower()
71-
to_filetype: "AllowedFileTypes"
71+
to_filetype: AllowedFileTypes
7272
if ext == ".json":
7373
to_filetype = "yaml"
7474
elif ext in {".yaml", ".yml"}:

src/tmuxp/cli/debug_info.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ def format_tmux_resp(std_resp: tmux_cmd) -> str:
6262
f"version: {platform.version()}",
6363
],
6464
),
65-
)
65+
),
6666
),
6767
output_break(),
6868
"python version: {}".format(" ".join(sys.version.split("\n"))),
@@ -78,10 +78,10 @@ def format_tmux_resp(std_resp: tmux_cmd) -> str:
7878
"tmux windows:\n{}".format(format_tmux_resp(tmux_cmd("list-windows"))),
7979
"tmux panes:\n{}".format(format_tmux_resp(tmux_cmd("list-panes"))),
8080
"tmux global options:\n{}".format(
81-
format_tmux_resp(tmux_cmd("show-options", "-g"))
81+
format_tmux_resp(tmux_cmd("show-options", "-g")),
8282
),
8383
"tmux window options:\n{}".format(
84-
format_tmux_resp(tmux_cmd("show-window-options", "-g"))
84+
format_tmux_resp(tmux_cmd("show-window-options", "-g")),
8585
),
8686
]
8787

src/tmuxp/cli/freeze.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ def command_freeze(
165165
dest = os.path.abspath(os.path.relpath(os.path.expanduser(dest)))
166166
workspace_format = args.workspace_format
167167

168-
valid_workspace_formats: t.List["CLIOutputFormatLiteral"] = ["json", "yaml"]
168+
valid_workspace_formats: t.List[CLIOutputFormatLiteral] = ["json", "yaml"]
169169

170170
def is_valid_ext(stem: t.Optional[str]) -> "TypeGuard[CLIOutputFormatLiteral]":
171171
return stem in valid_workspace_formats
@@ -186,7 +186,7 @@ def extract_workspace_format(
186186
if not is_valid_ext(workspace_format):
187187
_workspace_format = prompt_choices(
188188
"Couldn't ascertain one of [{}] from file name. Convert to".format(
189-
", ".join(valid_workspace_formats)
189+
", ".join(valid_workspace_formats),
190190
),
191191
choices=t.cast(t.List[str], valid_workspace_formats),
192192
default="yaml",

src/tmuxp/cli/load.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,7 @@ def load_workspace(
344344
answer_yes
345345
or prompt_yes_no(
346346
"{} is already running. Attach?".format(
347-
style(session_name, fg="green")
347+
style(session_name, fg="green"),
348348
),
349349
default=True,
350350
)

src/tmuxp/plugin.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ def __init__(self, **kwargs: "Unpack[PluginConfigSchema]") -> None:
152152
self.libtmux_version = libtmux.__about__.__version__
153153
self.tmuxp_version = Version(__version__)
154154

155-
self.version_constraints: "TmuxpPluginVersionConstraints" = {
155+
self.version_constraints: TmuxpPluginVersionConstraints = {
156156
"tmux": {
157157
"version": self.tmux_version,
158158
"vmin": config["tmux_min_version"],

src/tmuxp/shell.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,10 @@ class LaunchImports(t.TypedDict):
5151
def has_ipython() -> bool:
5252
"""Return True if ipython is installed."""
5353
try:
54-
from IPython import start_ipython # NOQA F841
54+
from IPython import start_ipython # NOQA: F841
5555
except ImportError:
5656
try:
57-
from IPython.Shell import IPShell # NOQA F841
57+
from IPython.Shell import IPShell # NOQA: F841
5858
except ImportError:
5959
return False
6060

@@ -67,7 +67,7 @@ def has_ptpython() -> bool:
6767
from ptpython.repl import embed, run_config # F841
6868
except ImportError:
6969
try:
70-
from prompt_toolkit.contrib.repl import embed, run_config # NOQA F841
70+
from prompt_toolkit.contrib.repl import embed, run_config # NOQA: F841
7171
except ImportError:
7272
return False
7373

@@ -81,8 +81,8 @@ def has_ptipython() -> bool:
8181
from ptpython.repl import run_config # F841
8282
except ImportError:
8383
try:
84-
from prompt_toolkit.contrib.ipython import embed # NOQA F841
85-
from prompt_toolkit.contrib.repl import run_config # NOQA F841
84+
from prompt_toolkit.contrib.ipython import embed # NOQA: F841
85+
from prompt_toolkit.contrib.repl import run_config # NOQA: F841
8686
except ImportError:
8787
return False
8888

@@ -92,7 +92,7 @@ def has_ptipython() -> bool:
9292
def has_bpython() -> bool:
9393
"""Return True if bpython is installed."""
9494
try:
95-
from bpython import embed # NOQA F841
95+
from bpython import embed # NOQA: F841
9696
except ImportError:
9797
return False
9898
return True

src/tmuxp/util.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ def oh_my_zsh_auto_title() -> None:
6969
if (
7070
"SHELL" in os.environ
7171
and "zsh" in os.environ.get("SHELL", "")
72-
and os.path.exists(os.path.expanduser("~/.oh-my-zsh")) # NOQA PTH110, PTH111
72+
and os.path.exists(os.path.expanduser("~/.oh-my-zsh")) # NOQA: PTH110, PTH111
7373
and (
7474
"DISABLE_AUTO_TITLE" not in os.environ
7575
or os.environ.get("DISABLE_AUTO_TITLE") == "false"

src/tmuxp/workspace/builder.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ def build(self, session: t.Optional[Session] = None, append: bool = False) -> No
271271

272272
assert session.server is not None
273273

274-
self.server: "Server" = session.server
274+
self.server: Server = session.server
275275
assert self.server.sessions is not None
276276
assert self.server.has_session(session.name)
277277
assert session.id

tests/fixtures/pluginsystem/partials/all_pass.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ class AllVersionPassPlugin(MyTestTmuxpPlugin):
1212
"""Tmuxp plugin with config constraints guaranteed to validate."""
1313

1414
def __init__(self) -> None:
15-
config: "PluginTestConfigSchema" = {
15+
config: PluginTestConfigSchema = {
1616
"plugin_name": "tmuxp-plugin-my-tmuxp-plugin",
1717
"tmux_min_version": "1.8",
1818
"tmux_max_version": "100.0",

tests/fixtures/pluginsystem/partials/libtmux_version_fail.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ class LibtmuxVersionFailMinPlugin(MyTestTmuxpPlugin):
1212
"""Tmuxp plugin that fails when libtmux below minimum version constraint."""
1313

1414
def __init__(self) -> None:
15-
config: "PluginTestConfigSchema" = {
15+
config: PluginTestConfigSchema = {
1616
"plugin_name": "libtmux-min-version-fail",
1717
"libtmux_min_version": "0.8.3",
1818
"libtmux_version": "0.7.0",
@@ -24,7 +24,7 @@ class LibtmuxVersionFailMaxPlugin(MyTestTmuxpPlugin):
2424
"""Tmuxp plugin that fails when libtmux above maximum version constraint."""
2525

2626
def __init__(self) -> None:
27-
config: "PluginTestConfigSchema" = {
27+
config: PluginTestConfigSchema = {
2828
"plugin_name": "libtmux-max-version-fail",
2929
"libtmux_max_version": "3.0",
3030
"libtmux_version": "3.5",
@@ -36,7 +36,7 @@ class LibtmuxVersionFailIncompatiblePlugin(MyTestTmuxpPlugin):
3636
"""Tmuxp plugin that fails when libtmux version constraint is invalid."""
3737

3838
def __init__(self) -> None:
39-
config: "PluginTestConfigSchema" = {
39+
config: PluginTestConfigSchema = {
4040
"plugin_name": "libtmux-incompatible-version-fail",
4141
"libtmux_version_incompatible": ["0.7.1"],
4242
"libtmux_version": "0.7.1",

tests/fixtures/pluginsystem/partials/tmux_version_fail.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ class TmuxVersionFailMinPlugin(MyTestTmuxpPlugin):
1212
"""Tmuxp plugin that fails when tmux below minimum version constraint."""
1313

1414
def __init__(self) -> None:
15-
config: "PluginTestConfigSchema" = {
15+
config: PluginTestConfigSchema = {
1616
"plugin_name": "tmux-min-version-fail",
1717
"tmux_min_version": "1.8",
1818
"tmux_version": "1.7",
@@ -24,7 +24,7 @@ class TmuxVersionFailMaxPlugin(MyTestTmuxpPlugin):
2424
"""Tmuxp plugin that fails when tmux above maximum version constraint."""
2525

2626
def __init__(self) -> None:
27-
config: "PluginTestConfigSchema" = {
27+
config: PluginTestConfigSchema = {
2828
"plugin_name": "tmux-max-version-fail",
2929
"tmux_max_version": "3.0",
3030
"tmux_version": "3.5",
@@ -36,7 +36,7 @@ class TmuxVersionFailIncompatiblePlugin(MyTestTmuxpPlugin):
3636
"""Tmuxp plugin that fails when tmux version constraint is invalid."""
3737

3838
def __init__(self) -> None:
39-
config: "PluginTestConfigSchema" = {
39+
config: PluginTestConfigSchema = {
4040
"plugin_name": "tmux-incompatible-version-fail",
4141
"tmux_version_incompatible": ["2.3"],
4242
"tmux_version": "2.3",

tests/fixtures/pluginsystem/partials/tmuxp_version_fail.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ class TmuxpVersionFailMinPlugin(MyTestTmuxpPlugin):
1212
"""Tmuxp plugin that fails when tmuxp below minimum version constraint."""
1313

1414
def __init__(self) -> None:
15-
config: "PluginTestConfigSchema" = {
15+
config: PluginTestConfigSchema = {
1616
"plugin_name": "tmuxp-min-version-fail",
1717
"tmuxp_min_version": "1.7.0",
1818
"tmuxp_version": "1.6.3",
@@ -24,7 +24,7 @@ class TmuxpVersionFailMaxPlugin(MyTestTmuxpPlugin):
2424
"""Tmuxp plugin that fails when tmuxp above maximum version constraint."""
2525

2626
def __init__(self) -> None:
27-
config: "PluginTestConfigSchema" = {
27+
config: PluginTestConfigSchema = {
2828
"plugin_name": "tmuxp-max-version-fail",
2929
"tmuxp_max_version": "2.0.0",
3030
"tmuxp_version": "2.5",
@@ -36,7 +36,7 @@ class TmuxpVersionFailIncompatiblePlugin(MyTestTmuxpPlugin):
3636
"""Tmuxp plugin that fails when tmuxp version constraint is invalid."""
3737

3838
def __init__(self) -> None:
39-
config: "PluginTestConfigSchema" = {
39+
config: PluginTestConfigSchema = {
4040
"plugin_name": "tmuxp-incompatible-version-fail",
4141
"tmuxp_version_incompatible": ["1.5.0"],
4242
"tmuxp_version": "1.5.0",

tests/fixtures/pluginsystem/plugins/tmuxp_test_plugin_fail/tmuxp_test_plugin_fail/plugin.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ class PluginFailVersion(TmuxpPlugin):
1212
"""A tmuxp plugin that is doomed to fail. DOOMED."""
1313

1414
def __init__(self) -> None:
15-
config: "PluginConfigSchema" = {
15+
config: PluginConfigSchema = {
1616
"plugin_name": "tmuxp-plugin-fail-version",
1717
"tmuxp_max_version": "0.0.0",
1818
}

0 commit comments

Comments
 (0)