-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
TYP: numba stub #44233
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
Merged
TYP: numba stub #44233
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
37bf1b8
TYP: numba stub
simonjayhawkins a0d7075
Merge branch 'master' into numba-stub
simonjayhawkins 72d666b
remove unused "type: ignore" comments
simonjayhawkins 3ba5975
rename directory stubs -> typings
simonjayhawkins a3a42ea
include stubs in type checks for mypy
simonjayhawkins e32e300
Merge remote-tracking branch 'upstream/master' into numba-stub
simonjayhawkins 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
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
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
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
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
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
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,41 @@ | ||
from typing import ( | ||
Any, | ||
Callable, | ||
Literal, | ||
overload, | ||
) | ||
|
||
import numba | ||
|
||
from pandas._typing import F | ||
|
||
def __getattr__(name: str) -> Any: ... # incomplete | ||
@overload | ||
def jit( | ||
signature_or_function: F = ..., | ||
) -> F: ... | ||
@overload | ||
def jit( | ||
signature_or_function: str | ||
| list[str] | ||
| numba.core.types.abstract.Type | ||
| list[numba.core.types.abstract.Type] = ..., | ||
locals: dict = ..., # TODO: Mapping of local variable names to Numba types | ||
cache: bool = ..., | ||
pipeline_class: numba.compiler.CompilerBase = ..., | ||
boundscheck: bool | None = ..., | ||
*, | ||
nopython: bool = ..., | ||
forceobj: bool = ..., | ||
looplift: bool = ..., | ||
error_model: Literal["python", "numpy"] = ..., | ||
inline: Literal["never", "always"] | Callable = ..., | ||
# TODO: If a callable is provided it will be called with the call expression | ||
# node that is requesting inlining, the caller's IR and callee's IR as | ||
# arguments, it is expected to return Truthy as to whether to inline. | ||
target: Literal["cpu", "gpu", "npyufunc", "cuda"] = ..., # deprecated | ||
nogil: bool = ..., | ||
parallel: bool = ..., | ||
) -> Callable[[F], F]: ... | ||
|
||
njit = jit |
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.
partial stub does not include numba types so they resolve to Any (and not callable)
@mroeschke not sure of best practice, is it preferable to use the numba types instead of the string representation for production code?
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.
Either is recommended in the docs. Strings just have some parsing overhead looking at the code, but probably just fine to use the string representation if it makes typing here easier.
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.
I think we could evolve the stubs as needed so will leave as-is for now.