-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
TYP: fix ignores #40452
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: fix ignores #40452
Conversation
def ensure_dtype_can_hold_na(dtype: ExtensionDtype) -> ExtensionDtype: | ||
... | ||
|
||
|
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.
could perhaps create a _DtypeObjT typvar (local to the module if we don't need elsewhere) instead of an overload here since ensure_dtype_can_hold_na is type-preserving
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 considered that and ended up not pulling the trigger, would be OK with it if you feel strongly about it
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.
if you feel strongly about it
I wouldn't block on this, so i'll leave it to you.
I won't be able to fully review this PR till tomorrow, so the comments so far are just some bits that stood out.
) -> Union[np.ndarray, DatetimeArray]: | ||
... | ||
|
||
|
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.
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.
may not be needed if this is internal
yah this shouldnt be user-facing
cls, result, dtype=dtype # type: ignore[arg-type] | ||
) | ||
if isinstance(dtype, ExtensionDtype): | ||
if not is_categorical_dtype(dtype) and dtype.kind != "M": |
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.
The logic has changed here slightly. is there a latent bug here that needs a test.
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.
looking some more, maybe the type annotations for maybe_downcast_to_dtype are incorrect?
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.
since this is only called from one place and that is with numeric_only=True (ought to remove that kwarg) and the two cases excluded here dont have is_numeric_dtype(dtype), the behavior will end up being the same before and after
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.
looking some more, maybe the type annotations for maybe_downcast_to_dtype are incorrect?
it does look sketchy, yah
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.
and the two cases excluded here dont have is_numeric_dtype(dtype), the behavior will end up being the same before and after
so it does.
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.
lgtm. making good progress clearing down the numpy related ignores. Thanks @jbrockmendel .
@@ -1471,7 +1463,7 @@ def soft_convert_objects( | |||
|
|||
|
|||
def convert_dtypes( | |||
input_array: AnyArrayLike, | |||
input_array: ArrayLike, |
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.
This is now inconsistent with the docstring
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.
updated
Thanks @jbrockmendel |
No description provided.