-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
TYP: stubs for reshape, ops, ops_dispatch, hashing #40455
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
Merged
+74
−0
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
b42cfbc
TYP: ops.pyi, hashing.pyi
jbrockmendel 28cf04a
TYP: ops_dispatch.pyi
jbrockmendel cc974bb
TYP: reshape.pyi
jbrockmendel a68cd8a
Merge branch 'master' into typ-libs-3
jbrockmendel a2ab5ab
update per suggestions
jbrockmendel 82fbef9
Merge branch 'master' into typ-libs-3
jbrockmendel 6db2ea3
remove extraneous info
jbrockmendel 22d4cf6
Merge branch 'master' into typ-libs-3
jbrockmendel 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
There are no files selected for viewing
This file contains hidden or 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 |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import numpy as np | ||
|
||
def hash_object_array( | ||
arr: np.ndarray, # np.ndarray[object] | ||
key: str, | ||
encoding: str = ..., | ||
) -> np.ndarray: ... # np.ndarray[np.uint64] |
This file contains hidden or 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 |
---|---|---|
@@ -0,0 +1,43 @@ | ||
from typing import ( | ||
Any, | ||
Callable, | ||
) | ||
|
||
import numpy as np | ||
|
||
_BinOp = Callable[[Any, Any], Any] | ||
_BoolOp = Callable[[Any, Any], bool] | ||
|
||
|
||
def scalar_compare( | ||
values: np.ndarray, # object[:] | ||
val: object, | ||
op: _BoolOp, # {operator.eq, operator.ne, ...} | ||
) -> np.ndarray: ... # np.ndarray[bool] | ||
|
||
def vec_compare( | ||
left: np.ndarray, # np.ndarray[object] | ||
right: np.ndarray, # np.ndarray[object] | ||
op: _BoolOp, # {operator.eq, operator.ne, ...} | ||
) -> np.ndarray: ... # np.ndarray[bool] | ||
|
||
|
||
def scalar_binop( | ||
values: np.ndarray, # object[:] | ||
val: object, | ||
op: _BinOp, # binary operator | ||
) -> np.ndarray: ... | ||
|
||
|
||
def vec_binop( | ||
left: np.ndarray, # object[:] | ||
right: np.ndarray, # object[:] | ||
op: _BinOp, # binary operator | ||
) -> np.ndarray: ... | ||
|
||
|
||
def maybe_convert_bool( | ||
arr: np.ndarray, # np.ndarray[object] | ||
true_values=..., | ||
false_values=... | ||
) -> np.ndarray: ... |
This file contains hidden or 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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import numpy as np | ||
|
||
def maybe_dispatch_ufunc_to_dunder_op( | ||
self, ufunc: np.ufunc, method: str, *inputs, **kwargs | ||
): ... |
This file contains hidden or 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 |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import numpy as np | ||
|
||
def unstack( | ||
values: np.ndarray, # reshape_t[:, :] | ||
mask: np.ndarray, # const uint8_t[:] | ||
stride: int, | ||
length: int, | ||
width: int, | ||
new_values: np.ndarray, # reshape_t[:, :] | ||
new_mask: np.ndarray, # uint8_t[:, :] | ||
) -> None: ... | ||
|
||
|
||
def explode( | ||
values: np.ndarray, # np.ndarray[object] | ||
) -> tuple[ | ||
np.ndarray, # np.ndarray[object] | ||
np.ndarray, # np.ndarray[np.int64] | ||
]: ... |
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.
maybe type self, since function is not a method
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.
will take some tracking down, since it is called via arraylike.array_ufunc, which doesnt type self