Skip to content

Commit

Permalink
chore: Format with ruff 0.9.0
Browse files Browse the repository at this point in the history
  • Loading branch information
tony committed Jan 9, 2025
1 parent 92451f8 commit dc41d3f
Show file tree
Hide file tree
Showing 10 changed files with 38 additions and 38 deletions.
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@
}

# linkify_issues
issue_url_tpl = f'{about["__github__"]}/issues/{{issue_id}}'
issue_url_tpl = f"{about['__github__']}/issues/{{issue_id}}"

# sphinx.ext.autodoc
autoclass_content = "both"
Expand Down
2 changes: 1 addition & 1 deletion src/libtmux/exc.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def __init__(
if all(arg is not None for arg in [obj_key, obj_id, list_cmd, list_extra_args]):
return super().__init__(
f"Could not find {obj_key}={obj_id} for {list_cmd} "
f'{list_extra_args if list_extra_args is not None else ""}',
f"{list_extra_args if list_extra_args is not None else ''}",
)
return super().__init__("Could not find object")

Expand Down
4 changes: 2 additions & 2 deletions src/libtmux/pane.py
Original file line number Diff line number Diff line change
Expand Up @@ -604,7 +604,7 @@ def split(
if size is not None:
if has_lt_version("3.1"):
if isinstance(size, str) and size.endswith("%"):
tmux_args += (f'-p{str(size).rstrip("%")}',)
tmux_args += (f"-p{str(size).rstrip('%')}",)
else:
warnings.warn(
'Ignored size. Use percent in tmux < 3.1, e.g. "size=50%"',
Expand Down Expand Up @@ -857,7 +857,7 @@ def split_window(
stacklevel=2,
)
if size is None and percent is not None:
size = f'{str(percent).rstrip("%")}%'
size = f"{str(percent).rstrip('%')}%"
return self.split(
target=target,
attach=attach,
Expand Down
2 changes: 1 addition & 1 deletion src/libtmux/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,7 @@ def attach(
flags += ("-x",)

if flags_ is not None and isinstance(flags_, list):
flags += tuple(f'{",".join(flags_)}')
flags += tuple(f"{','.join(flags_)}")

proc = self.cmd(
"attach-session",
Expand Down
12 changes: 6 additions & 6 deletions tests/legacy_api/test_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@ def mock_tmux_cmd(*args: t.Any, **kwargs: t.Any) -> Hi:
assert has_minimum_version()
assert has_gte_version(TMUX_MIN_VERSION)
assert has_gt_version(TMUX_MAX_VERSION), "Greater than the max-supported version"
assert (
get_version() == f"{TMUX_MAX_VERSION}-master"
), "Is the latest supported version with -master appended"
assert get_version() == f"{TMUX_MAX_VERSION}-master", (
"Is the latest supported version with -master appended"
)


def test_allows_next_version(monkeypatch: pytest.MonkeyPatch) -> None:
Expand Down Expand Up @@ -85,9 +85,9 @@ def mock_tmux_cmd(*args: t.Any, **kwargs: t.Any) -> Hi:
assert has_minimum_version()
assert has_gte_version(TMUX_MIN_VERSION)
assert has_gt_version(TMUX_MAX_VERSION), "Greater than the max-supported version"
assert (
get_version() == f"{TMUX_MAX_VERSION}-openbsd"
), "Is the latest supported version with -openbsd appended"
assert get_version() == f"{TMUX_MAX_VERSION}-openbsd", (
"Is the latest supported version with -openbsd appended"
)


def test_get_version_too_low(monkeypatch: pytest.MonkeyPatch) -> None:
Expand Down
6 changes: 3 additions & 3 deletions tests/legacy_api/test_session.py
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,6 @@ def test_new_window_with_environment_logs_warning_for_old_tmux(
environment={"ENV_VAR": "window"},
)

assert any(
"Environment flag ignored" in record.msg for record in caplog.records
), "Warning missing"
assert any("Environment flag ignored" in record.msg for record in caplog.records), (
"Warning missing"
)
6 changes: 3 additions & 3 deletions tests/legacy_api/test_window.py
Original file line number Diff line number Diff line change
Expand Up @@ -439,6 +439,6 @@ def test_split_window_with_environment_logs_warning_for_old_tmux(
environment={"ENV_VAR": "pane"},
)

assert any(
"Environment flag ignored" in record.msg for record in caplog.records
), "Warning missing"
assert any("Environment flag ignored" in record.msg for record in caplog.records), (
"Warning missing"
)
12 changes: 6 additions & 6 deletions tests/test_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@ def mock_tmux_cmd(*args: t.Any, **kwargs: t.Any) -> Hi:
assert has_minimum_version()
assert has_gte_version(TMUX_MIN_VERSION)
assert has_gt_version(TMUX_MAX_VERSION), "Greater than the max-supported version"
assert (
get_version() == f"{TMUX_MAX_VERSION}-master"
), "Is the latest supported version with -master appended"
assert get_version() == f"{TMUX_MAX_VERSION}-master", (
"Is the latest supported version with -master appended"
)


def test_allows_next_version(monkeypatch: pytest.MonkeyPatch) -> None:
Expand Down Expand Up @@ -85,9 +85,9 @@ def mock_tmux_cmd(*args: t.Any, **kwargs: t.Any) -> Hi:
assert has_minimum_version()
assert has_gte_version(TMUX_MIN_VERSION)
assert has_gt_version(TMUX_MAX_VERSION), "Greater than the max-supported version"
assert (
get_version() == f"{TMUX_MAX_VERSION}-openbsd"
), "Is the latest supported version with -openbsd appended"
assert get_version() == f"{TMUX_MAX_VERSION}-openbsd", (
"Is the latest supported version with -openbsd appended"
)


def test_get_version_too_low(monkeypatch: pytest.MonkeyPatch) -> None:
Expand Down
12 changes: 6 additions & 6 deletions tests/test_session.py
Original file line number Diff line number Diff line change
Expand Up @@ -326,9 +326,9 @@ def test_new_window_with_environment_logs_warning_for_old_tmux(
environment={"ENV_VAR": "window"},
)

assert any(
"Environment flag ignored" in record.msg for record in caplog.records
), "Warning missing"
assert any("Environment flag ignored" in record.msg for record in caplog.records), (
"Warning missing"
)


@pytest.mark.skipif(
Expand Down Expand Up @@ -378,6 +378,6 @@ def test_session_new_window_with_direction_logs_warning_for_old_tmux(
direction=WindowDirection.After,
)

assert any(
"Direction flag ignored" in record.msg for record in caplog.records
), "Warning missing"
assert any("Direction flag ignored" in record.msg for record in caplog.records), (
"Warning missing"
)
18 changes: 9 additions & 9 deletions tests/test_window.py
Original file line number Diff line number Diff line change
Expand Up @@ -461,9 +461,9 @@ def test_split_with_environment_logs_warning_for_old_tmux(
environment={"ENV_VAR": "pane"},
)

assert any(
"Environment flag ignored" in record.msg for record in caplog.records
), "Warning missing"
assert any("Environment flag ignored" in record.msg for record in caplog.records), (
"Warning missing"
)


@pytest.mark.skipif(
Expand Down Expand Up @@ -596,10 +596,10 @@ def test_new_window_with_direction_logs_warning_for_old_tmux(
direction=WindowDirection.After,
)

assert any(
"Window target ignored" in record.msg for record in caplog.records
), "Warning missing"
assert any("Window target ignored" in record.msg for record in caplog.records), (
"Warning missing"
)

assert any(
"Direction flag ignored" in record.msg for record in caplog.records
), "Warning missing"
assert any("Direction flag ignored" in record.msg for record in caplog.records), (
"Warning missing"
)

0 comments on commit dc41d3f

Please sign in to comment.