From b543e31cd2a665b25aab4554e46a0ed5067d1bfe Mon Sep 17 00:00:00 2001 From: jesopo Date: Tue, 30 Oct 2018 17:49:35 +0000 Subject: Fix/refactor issues brought up by type hint linting --- src/Cache.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/Cache.py') diff --git a/src/Cache.py b/src/Cache.py index 46b39bda..73e1fd4d 100644 --- a/src/Cache.py +++ b/src/Cache.py @@ -8,14 +8,14 @@ class Cache(object): def cache(self, item: typing.Any) -> str: return self._cache(item, None) def temporary_cache(self, item: typing.Any, timeout: float)-> str: - return self._cache(item, timeout) - def _cache(self, item: typing.Any, timeout: float) -> str: + return self._cache(item, time.monotonic()+timeout) + def _cache(self, item: typing.Any, timeout: typing.Optional[float]) -> str: id = str(uuid.uuid4()) - self._items[id] = [item, time.monotonic()+timeout] + self._items[id] = [item, timeout] self._item_to_id[item] = id return id - def next_expiration(self) -> float: + def next_expiration(self) -> typing.Optional[float]: expirations = [self._items[id][1] for id in self._items] expirations = list(filter(None, expirations)) if not expirations: -- cgit v1.3.1-10-gc9f91