Skip to content
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

[typing] Boolean operators like Series.__xor__ do not support scalar operands. #17048

Closed
2 tasks done
randolf-scholz opened this issue Jun 18, 2024 · 1 comment · Fixed by #17053
Closed
2 tasks done
Labels
bug Something isn't working python Related to Python Polars

Comments

@randolf-scholz
Copy link

Checks

  • I have checked that this issue has not already been reported.
  • I have confirmed this bug exists on the latest version of Polars.

Reproducible example

import polars as pl
s = pl.Series([True, False])
s ^ True   # mypy: Unsupported operand types for ^ ("Series" and "bool") 

Log output

No response

Issue description

Boolean methods annotations lack support for scalar operands (despite being supported at runtime)

Expected behavior

Type hints should support scalar operands, as in Series.__add__ or Series.__mul__.

Installed versions

--------Version info---------
Polars:               0.20.31
Index type:           UInt32
Platform:             Linux-6.5.0-35-generic-x86_64-with-glibc2.35
Python:               3.11.7 (main, Feb  5 2024, 11:39:05) [GCC 11.4.0]

----Optional dependencies----
adbc_driver_manager:  <not installed>
cloudpickle:          <not installed>
connectorx:           <not installed>
deltalake:            <not installed>
fastexcel:            <not installed>
fsspec:               2024.6.0
gevent:               <not installed>
hvplot:               <not installed>
matplotlib:           3.9.0
nest_asyncio:         1.6.0
numpy:                2.0.0
openpyxl:             3.1.4
pandas:               2.2.2
pyarrow:              16.1.0
pydantic:             2.7.4
pyiceberg:            <not installed>
pyxlsb:               <not installed>
sqlalchemy:           <not installed>
torch:                2.3.1+cu121
xlsx2csv:             <not installed>
xlsxwriter:           <not installed>
@randolf-scholz randolf-scholz added bug Something isn't working needs triage Awaiting prioritization by a maintainer python Related to Python Polars labels Jun 18, 2024
@alexander-beedie alexander-beedie removed the needs triage Awaiting prioritization by a maintainer label Jun 18, 2024
@alexander-beedie
Copy link
Collaborator

Yup, the typing is off here; will make a quick fix, thanks for the heads-up.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working python Related to Python Polars
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants