Skip to content

Commit

Permalink
Merge 03bd990 into d80d791
Browse files Browse the repository at this point in the history
  • Loading branch information
mrdon-reciprocity committed Dec 4, 2019
2 parents d80d791 + 03bd990 commit 91ba0f3
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 10 deletions.
12 changes: 6 additions & 6 deletions promise/dataloader.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
from collections import Iterable, namedtuple
from collections import namedtuple
try:
from collections.abc import Iterable
except ImportError:
from collections import Iterable
from functools import partial

from .promise import Promise, async_instance, get_default_scheduler
Expand Down Expand Up @@ -67,16 +71,12 @@ def __init__(
if cache is not None:
self.cache = cache

if get_cache_key is not None:
self.get_cache_key = get_cache_key
self.get_cache_key = get_cache_key or (lambda x: x)

self._promise_cache = cache_map or {}
self._queue = [] # type: List[Loader]
self._scheduler = scheduler

def get_cache_key(self, key): # type: ignore
return key

def load(self, key=None):
# type: (Hashable) -> Promise
"""
Expand Down
6 changes: 3 additions & 3 deletions promise/promise.py
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ def _settle_promise(
if async_guaranteed:
promise._is_async_guaranteed = True # type: ignore
self._settle_promise_from_handler( # type: ignore
handler, value, promise
handler, value, promise # type: ignore
) # type: ignore
elif is_promise:
if async_guaranteed:
Expand Down Expand Up @@ -567,7 +567,7 @@ def _then(
did_reject=None, # type: Optional[Callable[[Exception], S]]
):
# type: (...) -> Promise[S]
promise = self.__class__()
promise = self.__class__() # type: Promise
target = self._target()

state = target._state
Expand Down Expand Up @@ -791,7 +791,7 @@ def for_dict(cls, m):
dict_type = type(m) # type: Type[Dict]

if not m:
return cls.resolve(dict_type())
return cls.resolve(dict_type()) # type: ignore

def handle_success(resolved_values):
# type: (List[S]) -> Dict[Hashable, S]
Expand Down
5 changes: 4 additions & 1 deletion promise/promise_list.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
from functools import partial
from collections import Iterable
try:
from collections.abc import Iterable
except ImportError:
from collections import Iterable

if False:
from .promise import Promise
Expand Down

0 comments on commit 91ba0f3

Please sign in to comment.