-
Notifications
You must be signed in to change notification settings - Fork 54
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
mypy implementation for adapters in tiled #700
Merged
+3,049
−452
Merged
Changes from 1 commit
Commits
Show all changes
45 commits
Select commit
Hold shift + click to select a range
fe79576
some more changes
1038553
typed zarr.py
7595639
typed tiff.py
06ac19c
xarray.py typed
a80caba
some more typing added
786a275
some more typing. still few problems in mapping.py
82a3d01
more typing
c5ac22b
still 1 mypy problem left
1a0b167
docstring skeletons added
2265002
some more improvement
c6358fd
solved some docs build problems
2777e3c
few more changes
84e64ac
change type_alliases.py
9a9486f
some more changes
64a3fdb
some more changes
8c32d0b
update python to 3.11 in doc compilation
090eda3
fixed failing tests
1f4536a
Add protocols
danielballan 6a20cb9
change docs python to 3.10
be14c77
preliminary addressing to the comments
8509083
some tests for protocols
1be2018
some corrections in protocols tests
9331763
fix small bug in test_protocols.py
edf4e1f
try to solve EllipsisType that only exists in python 3.10
9c7aa41
change python version check
b066f41
some more fix
5c05e13
Bump Python version of docs build.
danielballan ed2a731
tests
95ffb51
some more unit tests for protocols
4d1f6b0
add accesspolicy protocol tests
bb0f108
few more fixes
809089c
python 3.8 MutableMapping problem: try to replacse with the one from …
126eed2
try to change collections.abc.MApping with typing.Mapping if python<3.8
b268500
small fixes for typing errors appeared in python 3.8
e9dfa6d
one more typing fix for python 3.8
07f717a
some more fix python3.8
6f4e773
Type awkward buffers dict more strictly
danielballan 7038db5
Tighten typing on data_uris.
danielballan 9f10eb9
Fix typing of partition parameter in read_partition.
danielballan d923f4f
Zarr accepts array data, not dataframe/tabular.
danielballan 557e32f
Remove commented unused code
danielballan 7d4a34e
Fix typo
danielballan d000794
Fix type of partition
danielballan 453b807
added a changelog entry
e863422
Make python-version consistent for docs
danielballan File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
some more changes
commit 9a9486fe0f554f40190b69c9b9797a3e67faedbb
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -24,8 +24,9 @@ | |||||
StructureFamilyQuery, | ||||||
) | ||||||
from ..query_registration import QueryTranslationRegistry | ||||||
from ..server.schemas import NodeStructure, SortingItem | ||||||
from ..server.schemas import SortingItem | ||||||
from ..structures.core import Spec, StructureFamily | ||||||
from ..structures.table import TableStructure | ||||||
from ..utils import UNCHANGED, Sentinel | ||||||
from .table import TableAdapter | ||||||
from .type_alliases import JSON | ||||||
|
@@ -61,7 +62,7 @@ def __init__( | |||||
self, | ||||||
mapping: dict[str, TableAdapter], | ||||||
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.
Suggested change
|
||||||
*, | ||||||
structure: Optional[NodeStructure] = None, | ||||||
structure: Optional[TableStructure] = None, | ||||||
metadata: Optional[JSON] = None, | ||||||
sorting: Optional[List[SortingItem]] = None, | ||||||
specs: Optional[List[Spec]] = None, | ||||||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,3 @@ | ||
from typing import Dict, List, Union | ||
|
||
JSON= Dict[ | ||
str, Union[str, int, float, bool, Dict[str, "JSON"], List["JSON"]] | ||
] | ||
JSON = Dict[str, Union[str, int, float, bool, Dict[str, "JSON"], List["JSON"]]] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -2,7 +2,7 @@ | |||||
import collections.abc | ||||||
import os | ||||||
from types import EllipsisType | ||||||
from typing import Any, Iterator, List, Optional, Tuple, Union | ||||||
from typing import Any, Callable, Iterator, List, Optional, Tuple, Union | ||||||
|
||||||
import dask | ||||||
import pandas | ||||||
|
@@ -14,9 +14,9 @@ | |||||
from ..access_policies import DummyAccessPolicy, SimpleAccessPolicy | ||||||
from ..adapters.utils import IndexersMixin | ||||||
from ..iterviews import ItemsView, KeysView, ValuesView | ||||||
from ..server.schemas import NodeStructure | ||||||
from ..structures.array import ArrayStructure | ||||||
from ..structures.core import Spec, StructureFamily | ||||||
from ..structures.table import TableStructure | ||||||
from ..utils import node_repr, path_from_uri | ||||||
from .array import ArrayAdapter, slice_and_shape_from_block_and_chunks | ||||||
from .type_alliases import JSON | ||||||
|
@@ -25,7 +25,9 @@ | |||||
|
||||||
|
||||||
def read_zarr( | ||||||
data_uri: Union[str, List[str]], structure: Optional[NodeStructure], **kwargs: Any | ||||||
data_uri: Union[str, List[str]], | ||||||
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.
Suggested change
|
||||||
structure: Optional[ArrayStructure], | ||||||
**kwargs: Any, | ||||||
) -> Union["ZarrGroupAdapter", ArrayAdapter]: | ||||||
""" | ||||||
|
||||||
|
@@ -101,7 +103,7 @@ def _stencil(self) -> Tuple[slice, ...]: | |||||
""" | ||||||
return tuple(builtins.slice(0, dim) for dim in self.structure().shape) | ||||||
|
||||||
def read(self, slice: Optional[slice]) -> NDArray[Any]: | ||||||
def read(self, slice: ...) -> NDArray[Any]: | ||||||
""" | ||||||
|
||||||
Parameters | ||||||
|
@@ -114,9 +116,7 @@ def read(self, slice: Optional[slice]) -> NDArray[Any]: | |||||
""" | ||||||
return self._array[self._stencil()][slice] | ||||||
|
||||||
def read_block( | ||||||
self, block: Tuple[int, ...], slice: Optional[Union[slice, EllipsisType]] | ||||||
) -> NDArray[Any]: | ||||||
def read_block(self, block: Tuple[int, ...], slice: ...) -> NDArray[Any]: | ||||||
""" | ||||||
|
||||||
Parameters | ||||||
|
@@ -138,7 +138,7 @@ def read_block( | |||||
def write( | ||||||
self, | ||||||
data: Union[dask.dataframe.DataFrame, pandas.DataFrame], | ||||||
slice: Optional[Union[slice, EllipsisType]], | ||||||
slice: ..., | ||||||
) -> None: | ||||||
""" | ||||||
|
||||||
|
@@ -159,7 +159,7 @@ async def write_block( | |||||
self, | ||||||
data: Union[dask.dataframe.DataFrame, pandas.DataFrame], | ||||||
block: Tuple[int, ...], | ||||||
slice: Optional[Union[slice, EllipsisType]], | ||||||
slice: ..., | ||||||
) -> None: | ||||||
""" | ||||||
|
||||||
|
@@ -193,7 +193,7 @@ def __init__( | |||||
self, | ||||||
node: Any, | ||||||
*, | ||||||
structure: Optional[Union[NodeStructure, ArrayStructure]] = None, | ||||||
structure: Optional[ArrayStructure] = None, | ||||||
metadata: Optional[JSON] = None, | ||||||
specs: Optional[List[Spec]] = None, | ||||||
access_policy: Optional[Union[SimpleAccessPolicy, DummyAccessPolicy]] = None, | ||||||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.