Skip to content

Commit

Permalink
Merge 4861d81 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 + 4861d81 commit fe71bd5
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 9 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
4 changes: 2 additions & 2 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
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 fe71bd5

Please sign in to comment.