New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Resolve Mypy erorrs in v3
branch
#1692
Changes from 4 commits
c0452be
d541a2b
94972d6
d3379b4
f2635e3
a30af88
f57527a
e1fdd1e
db6da34
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,7 +26,8 @@ def __init__(self, store: Store, path: Optional[str] = None): | |
|
||
@classmethod | ||
def from_path(cls, pth: Path) -> StorePath: | ||
return cls(Store.from_path(pth)) | ||
# NOT SOLVED: This is instantiating an ABC + there is no from_path method | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not solved here, as per comment. What subclass of There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good catch. I don't think we're using |
||
return cls(Store.from_path(pth)) # type: ignore | ||
|
||
async def get( | ||
self, byte_range: Optional[Tuple[int, Optional[int]]] = None | ||
|
@@ -76,7 +77,8 @@ def make_store_path(store_like: StoreLike) -> StorePath: | |
try: | ||
from upath import UPath | ||
|
||
return StorePath(Store.from_path(UPath(store_like))) | ||
# NOT SOLVED: Similar here, ABC instantiation + no from_path method | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Similar here There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. See above. |
||
return StorePath(Store.from_path(UPath(store_like))) # type: ignore | ||
except ImportError as e: | ||
raise e | ||
# return StorePath(LocalStore(Path(store_like))) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,6 @@ | |
from typing import ( | ||
Any, | ||
AsyncIterator, | ||
Callable, | ||
Coroutine, | ||
List, | ||
Optional, | ||
|
@@ -112,11 +111,10 @@ def _sync(self, coroutine: Coroutine[Any, Any, T]) -> T: | |
# this should allow us to better type the sync wrapper | ||
return sync(coroutine, loop=self._sync_configuration.asyncio_loop) | ||
|
||
def _sync_iter( | ||
self, func: Callable[P, AsyncIterator[T]], *args: P.args, **kwargs: P.kwargs | ||
) -> List[T]: | ||
def _sync_iter(self, coroutine: Coroutine[Any, Any, AsyncIterator[T]]) -> List[T]: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I removed the args/kwargs here to make it handle a coroutine, which is how it's so far being used. |
||
async def iter_to_list() -> List[T]: | ||
# TODO: replace with generators so we don't materialize the entire iterator at once | ||
return [item async for item in func(*args, **kwargs)] | ||
async_iterator = await coroutine | ||
return [item async for item in async_iterator] | ||
|
||
return self._sync(iter_to_list()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Flagging that this was actually a bug in hiding. I believe it should have been something like:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Addressed in a30af88