Skip to content

Conversation

@topper-123
Copy link
Contributor

@topper-123 topper-123 commented Feb 20, 2023

Progress towards #51233.

Follow-up to #51493, in this PR I do pandas/core/arrays/.

@topper-123 topper-123 changed the title TYP: Use Self for type checking (pandas/core/arrays/) TYP: Use Self instead of class-bound TypeVar II (pandas/core/arrays/) Feb 20, 2023
@simonjayhawkins simonjayhawkins added the Typing type annotations, mypy/pyright type checking label Feb 21, 2023
@simonjayhawkins simonjayhawkins added this to the 2.1 milestone Feb 21, 2023
@simonjayhawkins simonjayhawkins marked this pull request as draft February 24, 2023 15:19
@topper-123 topper-123 marked this pull request as ready for review March 14, 2023 06:04
def _concat_same_type(
cls: type[IntervalArrayT], to_concat: Sequence[IntervalArrayT]
) -> IntervalArrayT:
def _concat_same_type(cls, to_concat: Sequence[IntervalArray]) -> Self:
Copy link
Member

Choose a reason for hiding this comment

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

to_concat: Sequence[Self]?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

When I read the code, I see that to_concat can hold different subclasses of IntervalArray than self (probably unusual to subclass IntervalArray, but the type system allows it).

@twoertwein twoertwein merged commit f8a37a7 into pandas-dev:main Mar 15, 2023
@twoertwein
Copy link
Member

Thanks @topper-123

@topper-123 topper-123 deleted the use_typing.Self_II branch March 15, 2023 00:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Typing type annotations, mypy/pyright type checking

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants