-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
added typing IntervalClosedType where needed #52894
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
added typing IntervalClosedType where needed #52894
Conversation
pandas/core/dtypes/dtypes.py
Outdated
@@ -1099,7 +1100,7 @@ class IntervalDtype(PandasExtensionDtype): | |||
|
|||
_cache_dtypes: dict[str_type, PandasExtensionDtype] = {} | |||
|
|||
def __new__(cls, subtype=None, closed: str_type | None = None): | |||
def __new__(cls, subtype=None, closed=None): |
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 you add it here too?
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 tried, but I have an issue with mypy if I do this: it complains about the variable reassignement l.1141:
closed = gd["closed"]
pandas/core/dtypes/dtypes.py:1141: error: Incompatible types in assignment (expression has type "Union[str, Any]", variable has type "Optional[Union[Literal['left', 'right'], Literal['both', 'neither']]]") [assignment]
Do you know if there is a way to fix this?
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.
Adding # type: ignore[assignment]
in 1141 would work here. This isn't ideal, but it's better if the function signature is typed more strictly
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 added what you suggested but I have a check that fails, I don't know why..
Do you have an idea of what's the reason?
this is unrelated, minimum versions is sometimes flaky |
thx @gmollard |
doc/source/whatsnew/vX.X.X.rst
file if fixing a bug or adding a new feature.@phofl