Skip to content

Commit b8d8365

Browse files
committed
Fixes.
1 parent ed41598 commit b8d8365

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

src/_pytask/build.py

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
import json
55
import sys
6+
from contextlib import suppress
67
from pathlib import Path
78
from typing import Any
89
from typing import Callable
@@ -45,22 +46,19 @@ def pytask_extend_command_line_interface(cli: click.Group) -> None:
4546
@hookimpl
4647
def pytask_post_parse(config: dict[str, Any]) -> None:
4748
"""Fill cache of file hashes with stored hashes."""
48-
try:
49+
with suppress(Exception):
4950
path = config["root"] / ".pytask" / "file_hashes.json"
5051
cache = json.loads(path.read_text())
51-
except Exception: # noqa: BLE001
52-
cache = {}
5352

54-
for key, value in cache.items():
55-
HashPathCache.add(key, value)
53+
for key, value in cache.items():
54+
HashPathCache.add(key, value)
5655

5756

5857
@hookimpl
5958
def pytask_unconfigure(session: Session) -> None:
6059
"""Save calculated file hashes to file."""
61-
path = session.config["root"] / ".pytask"
62-
path.mkdir(exist_ok=True, parents=True)
63-
path.joinpath("file_hashes.json").write_text(json.dumps(HashPathCache._cache))
60+
path = session.config["root"] / ".pytask" / "file_hashes.json"
61+
path.write_text(json.dumps(HashPathCache._cache))
6462

6563

6664
def build( # noqa: C901, PLR0912, PLR0913

0 commit comments

Comments
 (0)