Skip to content

Commit 49bce8c

Browse files
committed
chore(builder,loader): ruff 0.2.0 fixes
src/tmuxp/workspace/builder.py:302:20: RUF019 [*] Unnecessary key check before dictionary access src/tmuxp/workspace/builder.py:305:16: RUF019 [*] Unnecessary key check before dictionary access src/tmuxp/workspace/builder.py:409:16: RUF019 [*] Unnecessary key check before dictionary access src/tmuxp/workspace/builder.py:527:16: RUF019 [*] Unnecessary key check before dictionary access src/tmuxp/workspace/loader.py:209:31: SIM910 [*] Use `workspace_dict.get("start_directory")` instead of `workspace_dict.get("start_directory", None)` src/tmuxp/workspace/loader.py:211:24: SIM910 [*] Use `workspace_dict.get("suppress_history")` instead of `workspace_dict.get("suppress_history", None)` Found 6 errors. [*] 6 fixable with the `--fix` option.
1 parent 3fbacdd commit 49bce8c

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

src/tmuxp/workspace/builder.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -299,10 +299,10 @@ def build(self, session: t.Optional[Session] = None, append: bool = False) -> No
299299
if "layout" in window_config:
300300
window.select_layout(window_config["layout"])
301301

302-
if "focus" in pane_config and pane_config["focus"]:
302+
if pane_config.get("focus"):
303303
focus_pane = pane
304304

305-
if "focus" in window_config and window_config["focus"]:
305+
if window_config.get("focus"):
306306
focus = window
307307

308308
self.config_after_window(window, window_config)
@@ -406,7 +406,7 @@ def iter_create_windows(
406406
for key, val in window_config["options"].items():
407407
window.set_window_option(key, val)
408408

409-
if "focus" in window_config and window_config["focus"]:
409+
if window_config.get("focus"):
410410
window.select_window()
411411

412412
yield window, window_config
@@ -524,7 +524,7 @@ def get_pane_shell(
524524
if sleep_after is not None:
525525
time.sleep(sleep_after)
526526

527-
if "focus" in pane_config and pane_config["focus"]:
527+
if pane_config.get("focus"):
528528
assert pane.pane_id is not None
529529
window.select_pane(pane.pane_id)
530530

src/tmuxp/workspace/loader.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -206,9 +206,9 @@ def trickle(workspace_dict: t.Dict[str, t.Any]) -> t.Dict[str, t.Any]:
206206
# prepends a pane's ``shell_command`` list with the window and sessions'
207207
# ``shell_command_before``.
208208

209-
session_start_directory = workspace_dict.get("start_directory", None)
209+
session_start_directory = workspace_dict.get("start_directory")
210210

211-
suppress_history = workspace_dict.get("suppress_history", None)
211+
suppress_history = workspace_dict.get("suppress_history")
212212

213213
for window_dict in workspace_dict["windows"]:
214214
# Prepend start_directory to relative window commands

0 commit comments

Comments
 (0)