Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ default_stages: [pre-commit, manual]
repos:

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.11.13
rev: v0.12.0
hooks:
- id: ruff
args: [
Expand All @@ -14,7 +14,7 @@ repos:
- id: ruff-format

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.16.0
rev: v1.16.1
hooks:
- id: mypy
additional_dependencies: [types-beautifulsoup4,types-requests]
Expand Down
4 changes: 2 additions & 2 deletions src/disk_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@
T = TypeVar("T", dict, list)


def save_json(data: T, fname: str) -> None:
def save_json[T: (dict, list)](data: T, fname: str) -> None:

Check warning on line 10 in src/disk_utils.py

View check run for this annotation

Codecov / codecov/patch

src/disk_utils.py#L10

Added line #L10 was not covered by tests
with Path(fname).open("w", encoding="utf-8") as f:
json.dump(data, f)


def load_json(fname: str, default_factory: type[T]) -> T:
def load_json[T: (dict, list)](fname: str, default_factory: type[T]) -> T:

Check warning on line 15 in src/disk_utils.py

View check run for this annotation

Codecov / codecov/patch

src/disk_utils.py#L15

Added line #L15 was not covered by tests
try:
with Path(fname).open(encoding="utf-8") as f:
data = json.load(f)
Expand Down