Skip to content

Commit 123b9c8

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent e9bfb28 commit 123b9c8

1 file changed

Lines changed: 11 additions & 3 deletions

File tree

src/cachier/config.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ def _default_cache_dir():
2222
"""Return default cache directory based on XDG specification.
2323
2424
Uses $XDG_CACHE_HOME if defined, otherwise falls back to ~/.cachier/
25+
2526
"""
2627
xdg_cache_home = os.environ.get("XDG_CACHE_HOME")
2728
if xdg_cache_home:
@@ -41,7 +42,9 @@ class Params:
4142
mongetter: Optional[Mongetter] = None
4243
stale_after: timedelta = timedelta.max
4344
next_time: bool = False
44-
_cache_dir: Union[str, os.PathLike] = field(default_factory=_default_cache_dir)
45+
_cache_dir: Union[str, os.PathLike] = field(
46+
default_factory=_default_cache_dir
47+
)
4548
pickle_reload: bool = True
4649
separate_files: bool = False
4750
wait_for_calc_timeout: int = 0
@@ -51,7 +54,10 @@ class Params:
5154
def cache_dir(self) -> Union[str, os.PathLike]:
5255
"""Dynamically get the cache directory, respecting XDG_CACHE_HOME."""
5356
default_cache = os.path.expanduser("~/.cachier/")
54-
if self._cache_dir == _default_cache_dir or self._cache_dir == default_cache:
57+
if (
58+
self._cache_dir == _default_cache_dir
59+
or self._cache_dir == default_cache
60+
):
5561
return _default_cache_dir()
5662
return self._cache_dir
5763

@@ -116,7 +122,9 @@ def set_global_params(**params: Any) -> None:
116122
only have an effect on decorators applied after this function is run.
117123
118124
"""
119-
valid_params = {k: v for k, v in params.items() if hasattr(_global_params, k)}
125+
valid_params = {
126+
k: v for k, v in params.items() if hasattr(_global_params, k)
127+
}
120128
for k, v in valid_params.items():
121129
setattr(_global_params, k, v)
122130

0 commit comments

Comments
 (0)