Skip to content

Commit cc43dc3

Browse files
committed
type cleanup based on review from @ft
1 parent 2d169bd commit cc43dc3

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/pyff/resource.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@
1010
from copy import deepcopy
1111
from datetime import datetime
1212
from threading import Condition, Lock
13-
from typing import Optional, Dict, Mapping, Any
13+
from typing import Optional, Dict, Mapping, Any, Callable, Tuple
14+
from requests.adapters import Response
1415

1516
import requests
1617

@@ -247,8 +248,8 @@ def is_expired(self) -> bool:
247248
def is_valid(self) -> bool:
248249
return not self.is_expired() and self.last_seen is not None and self.last_parser is not None
249250

250-
def add_info(self) -> Mapping[str, Optional[Any]]:
251-
info: Dict[str, Optional[Any]] = dict()
251+
def add_info(self) -> Dict[str, Any]:
252+
info: Dict[str, Any] = dict()
252253
info['State'] = None
253254
info['Resource'] = self.url
254255
self._infos.append(info)
@@ -319,7 +320,7 @@ def save_backup(self, data):
319320
except IOError as ex:
320321
log.warning("unable to save backup copy of {}: {}".format(self.url, ex))
321322

322-
def load_resource(self, getter):
323+
def load_resource(self, getter: Callable[[str], Response]) -> Tuple[Optional[str], int, Dict[str, Any]]:
323324
data: Optional[str] = None
324325
status: int = 500
325326
info = self.add_info()

0 commit comments

Comments
 (0)