Skip to content

Commit

Permalink
chore: Aggressive ruff fixes (#928)
Browse files Browse the repository at this point in the history
  • Loading branch information
tony authored Apr 13, 2024
2 parents 4b5518f + b0281c0 commit df98fce
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 16 deletions.
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

0 comments on commit df98fce

Please sign in to comment.