Skip to content

Commit 27e379c

Browse files
fix: resolve Pyright strict-mode typing errors
1 parent ef26e73 commit 27e379c

2 files changed

Lines changed: 5 additions & 6 deletions

File tree

src/bernstein/cli/aliases.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,8 @@ def _load_user_aliases() -> dict[str, str]:
6161
return {}
6262
try:
6363
with open(_USER_ALIASES_PATH) as f:
64-
data = yaml.safe_load(f) or {}
65-
if not isinstance(data, dict):
66-
return {}
64+
raw: object = yaml.safe_load(f) or {}
65+
data: dict[str, object] = raw if isinstance(raw, dict) else {}
6766
return {str(k): str(v) for k, v in data.items() if isinstance(k, str) and isinstance(v, str)}
6867
except Exception:
6968
logger.debug("Failed to load user aliases from %s", _USER_ALIASES_PATH, exc_info=True)

src/bernstein/cli/config_diff_cli.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ def _load_current_config() -> dict[str, object]:
1616
p = Path.cwd() / name
1717
if p.is_file():
1818
with open(p) as f:
19-
data = yaml.safe_load(f) or {}
20-
if isinstance(data, dict):
21-
return data
19+
raw: object = yaml.safe_load(f) or {}
20+
data: dict[str, object] = raw if isinstance(raw, dict) else {}
21+
return data
2222
return {}
2323

2424

0 commit comments

Comments
 (0)