Skip to content

Commit 85b982d

Browse files
committed
Aggressive ruff fixes
ruff check --select ALL . --fix --unsafe-fixes --preview --show-fixes --ignore T201 --ignore F401 --ignore PT014 --ignore RUF100 --ignore PGH004; ruff format . Fixed 8 errors: - docs/_ext/aafig.py: 2 × COM812 (missing-trailing-comma) - src/tmuxp/cli/load.py: 1 × PLR5501 (collapsible-else-if) - src/tmuxp/plugin.py: 3 × FURB110 (if-exp-instead-of-or-operator) - src/tmuxp/workspace/builder.py: 2 × COM812 (missing-trailing-comma) Found 1243 errors (8 fixed, 1235 remaining).
1 parent 4b5518f commit 85b982d

File tree

4 files changed

+12
-16
lines changed

4 files changed

+12
-16
lines changed

docs/_ext/aafig.py

+5-2
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,8 @@ def render_aafigure(
193193
try:
194194
try:
195195
with open(
196-
metadata_fname, encoding=locale.getpreferredencoding(False)
196+
metadata_fname,
197+
encoding=locale.getpreferredencoding(False),
197198
) as f:
198199
extra = f.read()
199200
except Exception as e:
@@ -217,7 +218,9 @@ def render_aafigure(
217218
if options["format"].lower() == "svg":
218219
extra = visitor.get_size_attrs()
219220
with open(
220-
metadata_fname, "w", encoding=locale.getpreferredencoding(False)
221+
metadata_fname,
222+
"w",
223+
encoding=locale.getpreferredencoding(False),
221224
) as f:
222225
f.write(extra)
223226

src/tmuxp/cli/load.py

+2-3
Original file line numberDiff line numberDiff line change
@@ -143,9 +143,8 @@ def _load_attached(builder: WorkspaceBuilder, detached: bool) -> None:
143143
builder.session.switch_client() # switch client to new session
144144

145145
os.environ["TMUX"] = tmux_env # set TMUX back again
146-
else:
147-
if not detached:
148-
builder.session.attach_session()
146+
elif not detached:
147+
builder.session.attach_session()
149148

150149

151150
def _load_detached(builder: WorkspaceBuilder) -> None:

src/tmuxp/plugin.py

+3-9
Original file line numberDiff line numberDiff line change
@@ -157,25 +157,19 @@ def __init__(self, **kwargs: "Unpack[PluginConfigSchema]") -> None:
157157
"version": self.tmux_version,
158158
"vmin": config["tmux_min_version"],
159159
"vmax": config["tmux_max_version"],
160-
"incompatible": config["tmux_version_incompatible"]
161-
if config["tmux_version_incompatible"]
162-
else [],
160+
"incompatible": config["tmux_version_incompatible"] or [],
163161
},
164162
"libtmux": {
165163
"version": self.libtmux_version,
166164
"vmin": config["libtmux_min_version"],
167165
"vmax": config["libtmux_max_version"],
168-
"incompatible": config["libtmux_version_incompatible"]
169-
if config["libtmux_version_incompatible"]
170-
else [],
166+
"incompatible": config["libtmux_version_incompatible"] or [],
171167
},
172168
"tmuxp": {
173169
"version": self.tmuxp_version,
174170
"vmin": config["tmuxp_min_version"],
175171
"vmax": config["tmuxp_max_version"],
176-
"incompatible": config["tmuxp_version_incompatible"]
177-
if config["tmuxp_version_incompatible"]
178-
else [],
172+
"incompatible": config["tmuxp_version_incompatible"] or [],
179173
},
180174
}
181175

src/tmuxp/workspace/builder.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
def get_default_columns() -> int:
2525
"""Return default session column size use when building new tmux sessions."""
2626
return int(
27-
os.getenv("TMUXP_DEFAULT_COLUMNS", os.getenv("COLUMNS", COLUMNS_FALLBACK))
27+
os.getenv("TMUXP_DEFAULT_COLUMNS", os.getenv("COLUMNS", COLUMNS_FALLBACK)),
2828
)
2929

3030

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

0 commit comments

Comments
 (0)