-
Notifications
You must be signed in to change notification settings - Fork 302
Refactor: replace np.ndarray with npt.NDArray in type hints #5346
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
base: main
Are you sure you want to change the base?
Changes from 8 commits
511aab1
44687be
6a41449
02a690c
c8af3ab
1709f67
2f935f8
c8aad3d
fb0c7a7
3a69c29
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 |
|---|---|---|
|
|
@@ -109,3 +109,4 @@ doc/source/quickstart/.ipynb_checkpoints/ | |
| dist | ||
| .python-version | ||
| answer_nosetests.xml | ||
| .venv/ | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,7 @@ | ||
| from typing import Any, Optional | ||
|
|
||
| import numpy as np | ||
| import numpy.typing as npt | ||
|
|
||
| from yt.data_objects.selection_objects.region import YTRegion | ||
| from yt.geometry.selection_routines import ( | ||
|
|
@@ -49,8 +50,8 @@ | |
|
|
||
|
|
||
| def hilbert3d( | ||
| ijk: "np.ndarray[Any, np.dtype[np.int64]]", bit_length: int | ||
| ) -> "np.ndarray[Any, np.dtype[np.float64]]": | ||
| ijk: "npt.NDArray[np.int64]", bit_length: int | ||
| ) -> "npt.NDArray[np.int64]": | ||
| """Compute the order using Hilbert indexing. | ||
|
|
||
| Arguments | ||
|
|
@@ -70,11 +71,11 @@ def hilbert3d( | |
| def get_intersecting_cpus( | ||
| ds, | ||
| region: YTRegion, | ||
| LE: Optional["np.ndarray[Any, np.dtype[np.float64]]"] = None, | ||
| LE: Optional["npt.NDArray[np.float64]"] = None, | ||
|
Contributor
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. oh! nothing to change here, but I just remembered: the
Contributor
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. |
||
| dx: float = 1.0, | ||
| dx_cond: float | None = None, | ||
| factor: float = 4.0, | ||
| bound_keys: Optional["np.ndarray[Any, np.dtype[np.float64]]"] = None, | ||
| bound_keys: Optional["npt.NDArray[np.float64]"] = None, | ||
| ) -> set[int]: | ||
| """ | ||
| Find the subset of CPUs that intersect the bbox in a recursive fashion. | ||
|
|
@@ -119,8 +120,8 @@ def get_intersecting_cpus( | |
|
|
||
| def get_cpu_list_cuboid( | ||
| ds, | ||
| X: "np.ndarray[Any, np.dtype[np.float64]]", | ||
| bound_keys: "np.ndarray[Any, np.dtype[np.float64]]", | ||
| X: "npt.NDArray[np.float64]", | ||
| bound_keys: "npt.NDArray[np.float64]", | ||
| ) -> set[int]: | ||
| """ | ||
| Return the list of the CPU intersecting with the cuboid containing the positions. | ||
|
|
||
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.
@cphyc mind double checking my fix here? the hilbert index arrays will always be
intarrays from what I can see.(also if you're up for reviewing the rest of the PR it'd be welcome!)