From 8e642991d557bd902b749ddd84e41d65c48f79cf Mon Sep 17 00:00:00 2001 From: Trygve Laugstøl Date: Wed, 20 Mar 2019 15:30:05 +0100 Subject: o Adding OPL downloader from Seeed studio. o Adding to --- src/ee/_utils.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src/ee/_utils.py') 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() -- cgit v1.2.3