Skip to content

feat(series): arithmetic mul #1332

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 2 commits into from
Aug 19, 2025

Conversation

cmp0xff
Copy link
Contributor

@cmp0xff cmp0xff commented Aug 19, 2025

This is inspired by #1274 and a follow-up for #1312.

  • Tests added: Please use assert_type() to assert the type of any return value

Copy link
Collaborator

@Dr-Irv Dr-Irv left a comment

Choose a reason for hiding this comment

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

found a workarond for the mypy issue, otherwise looks good

Comment on lines 46 to 49
check(assert_type(b * left, pd.Series), pd.Series) # type: ignore[assert-type]
check(assert_type(i * left, pd.Series), pd.Series) # type: ignore[assert-type]
check(assert_type(f * left, pd.Series), pd.Series) # type: ignore[assert-type]
check(assert_type(c * left, pd.Series), pd.Series) # type: ignore[assert-type]
Copy link
Collaborator

Choose a reason for hiding this comment

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

Somehow mypy thinks that Series has the protocol SupportsIndex. So here i a fix. Add this line to the beginning of class Series:

# Define __index__ because mypy thinks Series follows protocol `SupportsIndex`
__index__: ClassVar[None]

Then you can get rid of the ignores.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Collaborator

Choose a reason for hiding this comment

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

Looks like this is known: python/mypy#19341

@cmp0xff cmp0xff requested a review from Dr-Irv August 19, 2025 17:40
Copy link
Collaborator

@Dr-Irv Dr-Irv left a comment

Choose a reason for hiding this comment

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

thanks @cmp0xff

@Dr-Irv Dr-Irv merged commit 766cc1d into pandas-dev:main Aug 19, 2025
13 checks passed
@cmp0xff cmp0xff deleted the feature/cmp0xff/arithmetic-mul branch August 19, 2025 18:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants