Skip to content

Commit df98fce

Browse files
authored
chore: Aggressive ruff fixes (#928)
2 parents 4b5518f + b0281c0 commit df98fce

File tree

5 files changed

+13
-16
lines changed

5 files changed

+13
-16
lines changed

CHANGES

+1
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ environment and file an issue on the tracker.
5050

5151
### Development
5252

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

5556
See also: https://github.com/python-poetry/poetry/blob/1.8.2/CHANGELOG.md

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)