-
-
Notifications
You must be signed in to change notification settings - Fork 410
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
Add typing to Layer.__init__ #6796
base: main
Are you sure you want to change the base?
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #6796 +/- ##
==========================================
+ Coverage 92.41% 92.43% +0.02%
==========================================
Files 615 614 -1
Lines 54892 55170 +278
==========================================
+ Hits 50729 50998 +269
- Misses 4163 4172 +9 ☔ View full report in Codecov by Sentry. |
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.
Small suggestion
Co-authored-by: Grzegorz Bokota <bokota+github@gmail.com>
Co-authored-by: Peter Sobolewski <76622105+psobolewskiPhD@users.noreply.github.com>
@@ -306,25 +307,29 @@ class Layer(KeymapProvider, MousemapProvider, ABC, metaclass=PostInit): | |||
|
|||
def __init__( | |||
self, | |||
data, | |||
ndim, | |||
data: Union[npt.NDArray, list[npt.NDArray]], |
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.
It could be also dask, zarr, tensorstore.
translate=None, | ||
visible=True, | ||
): | ||
affine: Optional[Union[npt.NDArray, Affine]] = None, |
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.
affine: Optional[Union[npt.NDArray, Affine]] = None, | |
affine: Union[npt.NDArray, Affine, None] = None, |
experimental_clipping_planes: Optional[ | ||
Union[list[dict], list[ClippingPlane], ClippingPlaneList] | ||
] = None, |
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.
experimental_clipping_planes: Optional[ | |
Union[list[dict], list[ClippingPlane], ClippingPlaneList] | |
] = None, | |
experimental_clipping_planes: Union[list[dict], list[ClippingPlane], ClippingPlaneList, None] = None, |
rotate: Optional[ | ||
Union[float, tuple[float, float, float], npt.NDArray] | ||
] = None, | ||
scale: Optional[tuple[float, ...]] = None, |
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.
scale: Optional[tuple[float, ...]] = None, | |
scale: Optional[Sequence[float, ...]] = None, |
] = None, | ||
scale: Optional[tuple[float, ...]] = None, | ||
shear: Optional[npt.NDArray] = None, | ||
translate: Optional[tuple[float, ...]] = None, |
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.
translate: Optional[tuple[float, ...]] = None, | |
translate: Optional[Sequence[float, ...]] = None, |
@@ -596,7 +596,7 @@ def compute_multiscale_level_and_corners( | |||
|
|||
|
|||
def coerce_affine( | |||
affine: Union[npt.ArrayLike, Affine], | |||
affine: Optional[Union[npt.ArrayLike, Affine]], |
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.
affine: Optional[Union[npt.ArrayLike, Affine]], | |
affine: Union[npt.ArrayLike, Affine, None], |
Co-authored-by: Grzegorz Bokota <bokota+github@gmail.com>
The mypy CI check is currently failing due to the new
Two options to fix this:
|
Some more typing - there were also a couple of code fixes I had to make after adding the typing.