Skip to content

Simplify bool stub #6782

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

Closed
wants to merge 1 commit into from
Closed
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
31 changes: 7 additions & 24 deletions stdlib/builtins.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ _TBE = TypeVar("_TBE", bound="BaseException")
_R = TypeVar("_R") # Return-type TypeVar
_SupportsNextT = TypeVar("_SupportsNextT", bound=SupportsNext[Any], covariant=True)
_SupportsAnextT = TypeVar("_SupportsAnextT", bound=SupportsAnext[Any], covariant=True)
_B = TypeVar("_B", bool, int)
Copy link
Member

Choose a reason for hiding this comment

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

In my experience mypy does not have ideal support for TypeVars with values (and bugs in this field are really hard to fix!). It might be the root cause in pandas case.


class _SupportsIter(Protocol[_T_co]):
def __iter__(self) -> _T_co: ...
Expand Down Expand Up @@ -702,30 +703,12 @@ class memoryview(Sized, Sequence[int]):
@final
class bool(int):
def __new__(cls: Type[_T], __o: object = ...) -> _T: ...
@overload
def __and__(self, __x: bool) -> bool: ...
@overload
def __and__(self, __x: int) -> int: ...
@overload
def __or__(self, __x: bool) -> bool: ...
@overload
def __or__(self, __x: int) -> int: ...
@overload
def __xor__(self, __x: bool) -> bool: ...
@overload
def __xor__(self, __x: int) -> int: ...
@overload
def __rand__(self, __x: bool) -> bool: ...
@overload
def __rand__(self, __x: int) -> int: ...
@overload
def __ror__(self, __x: bool) -> bool: ...
@overload
def __ror__(self, __x: int) -> int: ...
@overload
def __rxor__(self, __x: bool) -> bool: ...
@overload
def __rxor__(self, __x: int) -> int: ...
def __and__(self, __x: _B) -> _B: ...
def __or__(self, __x: _B) -> _B: ...
def __xor__(self, __x: _B) -> _B: ...
def __rand__(self, __x: _B) -> _B: ...
def __ror__(self, __x: _B) -> _B: ...
def __rxor__(self, __x: _B) -> _B: ...
def __getnewargs__(self) -> tuple[int]: ...

@final
Expand Down