-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
TYP: Update pyright #56892
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
TYP: Update pyright #56892
Changes from all commits
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 |
---|---|---|
|
@@ -132,7 +132,7 @@ repos: | |
types: [python] | ||
stages: [manual] | ||
additional_dependencies: &pyright_dependencies | ||
- [email protected].339 | ||
- [email protected].347 | ||
- id: pyright | ||
# note: assumes python env is setup and activated | ||
name: pyright reportGeneralTypeIssues | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,7 @@ | |
TYPE_CHECKING, | ||
ClassVar, | ||
Literal, | ||
cast, | ||
) | ||
|
||
import numpy as np | ||
|
@@ -637,7 +638,7 @@ def _str_map( | |
# error: Argument 1 to "dtype" has incompatible type | ||
# "Union[ExtensionDtype, str, dtype[Any], Type[object]]"; expected | ||
# "Type[object]" | ||
dtype=np.dtype(dtype), # type: ignore[arg-type] | ||
dtype=np.dtype(cast(type, dtype)), | ||
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.
|
||
) | ||
|
||
if not na_value_is_na: | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9802,7 +9802,9 @@ def explode( | |
|
||
return result.__finalize__(self, method="explode") | ||
|
||
def unstack(self, level: IndexLabel = -1, fill_value=None, sort: bool = True): | ||
def unstack( | ||
self, level: IndexLabel = -1, fill_value=None, sort: bool = True | ||
) -> DataFrame | Series: | ||
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. returns a Series when a DataFrame has a non-MultiIndex index (this is also documented; a series with a non-MultiIndex raises instead). Pyright's magic was able to infer that DataFrame | Series can be returned, unfortunately, this requires quite a few ignore codes. |
||
""" | ||
Pivot a level of the (necessarily hierarchical) index labels. | ||
|
||
|
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_convert_objects
returns anExtensionArray
or annp.ndarray
. Most functions callmaybe_convert_objects
only whenconvert=True
and otherwise return annp.ndarray
(see the overloads).