Skip to content

'Fix' mypy-nightly #788

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 1 commit into from
Oct 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pandas-stubs/_typing.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -517,7 +517,7 @@ S1 = TypeVar(
| datetime.datetime # includes pd.Timestamp
| datetime.timedelta # includes pd.Timedelta
| Period
| Interval[int | float | Timestamp | Timedelta]
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mypy can't match _OrderableT with a Union of _OrderableT's bound

| Interval
| CategoricalDtype,
)

Expand Down
3 changes: 1 addition & 2 deletions pandas-stubs/core/indexes/base.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -203,8 +203,7 @@ class Index(IndexOpsMixin[S1]):
@overload
def __new__( # type: ignore[misc]
cls,
data: Sequence[Interval[_OrderableT]] # type: ignore[type-var]
| IndexOpsMixin[Interval[_OrderableT]],
data: Sequence[Interval[_OrderableT]] | IndexOpsMixin[Interval[_OrderableT]],
*,
dtype: Literal["Interval"] = ...,
copy: bool = ...,
Expand Down
4 changes: 2 additions & 2 deletions pandas-stubs/core/series.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ class Series(IndexOpsMixin[S1], NDFrame):
copy: bool = ...,
) -> TimedeltaSeries: ...
@overload
def __new__(
def __new__( # type: ignore[misc]
cls,
data: IntervalIndex[Interval[_OrderableT]]
| Interval[_OrderableT]
Expand Down Expand Up @@ -2134,6 +2134,6 @@ class OffsetSeries(Series):
@overload
def __radd__(self, other: BaseOffset) -> OffsetSeries: ...

class IntervalSeries(Series, Generic[_OrderableT]):
class IntervalSeries(Series[Interval[_OrderableT]], Generic[_OrderableT]):
@property
def array(self) -> IntervalArray: ...