Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Aggressive ruff fixes #928

Merged
merged 2 commits into from
Apr 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGES
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ environment and file an issue on the tracker.

### Development

- Another `ruff` linting pass, this time with ruff 0.3.7 (#928)
- poetry: 1.8.1 -> 1.8.2

See also: https://github.com/python-poetry/poetry/blob/1.8.2/CHANGELOG.md
Expand Down
7 changes: 5 additions & 2 deletions docs/_ext/aafig.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,8 @@ def render_aafigure(
try:
try:
with open(
metadata_fname, encoding=locale.getpreferredencoding(False)
metadata_fname,
encoding=locale.getpreferredencoding(False),
) as f:
extra = f.read()
except Exception as e:
Expand All @@ -217,7 +218,9 @@ def render_aafigure(
if options["format"].lower() == "svg":
extra = visitor.get_size_attrs()
with open(
metadata_fname, "w", encoding=locale.getpreferredencoding(False)
metadata_fname,
"w",
encoding=locale.getpreferredencoding(False),
) as f:
f.write(extra)

Expand Down
5 changes: 2 additions & 3 deletions src/tmuxp/cli/load.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,9 +143,8 @@ def _load_attached(builder: WorkspaceBuilder, detached: bool) -> None:
builder.session.switch_client() # switch client to new session

os.environ["TMUX"] = tmux_env # set TMUX back again
else:
if not detached:
builder.session.attach_session()
elif not detached:
builder.session.attach_session()


def _load_detached(builder: WorkspaceBuilder) -> None:
Expand Down
12 changes: 3 additions & 9 deletions src/tmuxp/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,25 +157,19 @@ def __init__(self, **kwargs: "Unpack[PluginConfigSchema]") -> None:
"version": self.tmux_version,
"vmin": config["tmux_min_version"],
"vmax": config["tmux_max_version"],
"incompatible": config["tmux_version_incompatible"]
if config["tmux_version_incompatible"]
else [],
"incompatible": config["tmux_version_incompatible"] or [],
},
"libtmux": {
"version": self.libtmux_version,
"vmin": config["libtmux_min_version"],
"vmax": config["libtmux_max_version"],
"incompatible": config["libtmux_version_incompatible"]
if config["libtmux_version_incompatible"]
else [],
"incompatible": config["libtmux_version_incompatible"] or [],
},
"tmuxp": {
"version": self.tmuxp_version,
"vmin": config["tmuxp_min_version"],
"vmax": config["tmuxp_max_version"],
"incompatible": config["tmuxp_version_incompatible"]
if config["tmuxp_version_incompatible"]
else [],
"incompatible": config["tmuxp_version_incompatible"] or [],
},
}

Expand Down
4 changes: 2 additions & 2 deletions src/tmuxp/workspace/builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
def get_default_columns() -> int:
"""Return default session column size use when building new tmux sessions."""
return int(
os.getenv("TMUXP_DEFAULT_COLUMNS", os.getenv("COLUMNS", COLUMNS_FALLBACK))
os.getenv("TMUXP_DEFAULT_COLUMNS", os.getenv("COLUMNS", COLUMNS_FALLBACK)),
)


Expand Down Expand Up @@ -250,7 +250,7 @@ def build(self, session: t.Optional[Session] = None, append: bool = False) -> No
and os.getenv("TMUXP_DETECT_TERMINAL_SIZE", "1") == "1"
):
terminal_size = shutil.get_terminal_size(
fallback=(get_default_columns(), get_default_rows())
fallback=(get_default_columns(), get_default_rows()),
)
new_session_kwargs["x"] = terminal_size.columns
new_session_kwargs["y"] = terminal_size.lines
Expand Down