diff options
author | Trygve Laugstøl <trygvis@inamo.no> | 2019-03-20 15:30:05 +0100 |
---|---|---|
committer | Trygve Laugstøl <trygvis@inamo.no> | 2019-03-20 15:30:05 +0100 |
commit | 8e642991d557bd902b749ddd84e41d65c48f79cf (patch) | |
tree | 29b80dd0b6237b485a95a9404bb5b5e9e3380e4e /src/ee/_utils.py | |
parent | 237a6faa8a23826e68bbc00bc107b2d6f97235d0 (diff) | |
download | ee-python-8e642991d557bd902b749ddd84e41d65c48f79cf.tar.gz ee-python-8e642991d557bd902b749ddd84e41d65c48f79cf.tar.bz2 ee-python-8e642991d557bd902b749ddd84e41d65c48f79cf.tar.xz ee-python-8e642991d557bd902b749ddd84e41d65c48f79cf.zip |
o Adding OPL downloader from Seeed studio.
o Adding <description> to <part>
Diffstat (limited to 'src/ee/_utils.py')
-rw-r--r-- | src/ee/_utils.py | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/ee/_utils.py b/src/ee/_utils.py index f917847..08e75fa 100644 --- a/src/ee/_utils.py +++ b/src/ee/_utils.py @@ -44,8 +44,9 @@ def all(filters): class HttpCache(object): - def __init__(self, path: Path): + def __init__(self, path: Path, ext="html"): self.path = path + self.ext = ext def lookup(self, key): cache_path = self._make_path(key) @@ -62,7 +63,7 @@ class HttpCache(object): f.write(value) def _make_path(self, key) -> Path: - return self.path / "{}.html".format(key) + return self.path / "{}.{}".format(key, self.ext) class EmptyHttpCache(object): @@ -74,5 +75,5 @@ class EmptyHttpCache(object): pass -def maybe_cache(path: Optional[Path]) -> HttpCache: - return HttpCache(path) if path is not None else EmptyHttpCache() +def maybe_cache(path: Optional[Path], **kwargs) -> HttpCache: + return HttpCache(path, **kwargs) if path is not None else EmptyHttpCache() |