Skip to content

Commit 0304421

Browse files
asottileJelleZijlstra
authored andcommitted
Add typings for bool __{r,}{and,or,xor}__ (#1795)
1 parent 64ca731 commit 0304421

File tree

2 files changed

+48
-0
lines changed

2 files changed

+48
-0
lines changed

stdlib/2/__builtin__.pyi

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -472,6 +472,30 @@ class bytearray(MutableSequence[int]):
472472

473473
class bool(int):
474474
def __init__(self, o: object = ...) -> None: ...
475+
@overload # type: ignore
476+
def __and__(self, x: bool) -> bool: ...
477+
@overload # type: ignore
478+
def __and__(self, x: int) -> int: ...
479+
@overload # type: ignore
480+
def __or__(self, x: bool) -> bool: ...
481+
@overload # type: ignore
482+
def __or__(self, x: int) -> int: ...
483+
@overload # type: ignore
484+
def __xor__(self, x: bool) -> bool: ...
485+
@overload # type: ignore
486+
def __xor__(self, x: int) -> int: ...
487+
@overload # type: ignore
488+
def __rand__(self, x: bool) -> bool: ...
489+
@overload # type: ignore
490+
def __rand__(self, x: int) -> int: ...
491+
@overload # type: ignore
492+
def __ror__(self, x: bool) -> bool: ...
493+
@overload # type: ignore
494+
def __ror__(self, x: int) -> int: ...
495+
@overload # type: ignore
496+
def __rxor__(self, x: bool) -> bool: ...
497+
@overload # type: ignore
498+
def __rxor__(self, x: int) -> int: ...
475499

476500
class slice(object):
477501
start = ... # type: Optional[int]

stdlib/3/builtins.pyi

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -537,6 +537,30 @@ class memoryview(Sized, Container[bytes]):
537537

538538
class bool(int):
539539
def __init__(self, o: object = ...) -> None: ...
540+
@overload # type: ignore
541+
def __and__(self, x: bool) -> bool: ...
542+
@overload # type: ignore
543+
def __and__(self, x: int) -> int: ...
544+
@overload # type: ignore
545+
def __or__(self, x: bool) -> bool: ...
546+
@overload # type: ignore
547+
def __or__(self, x: int) -> int: ...
548+
@overload # type: ignore
549+
def __xor__(self, x: bool) -> bool: ...
550+
@overload # type: ignore
551+
def __xor__(self, x: int) -> int: ...
552+
@overload # type: ignore
553+
def __rand__(self, x: bool) -> bool: ...
554+
@overload # type: ignore
555+
def __rand__(self, x: int) -> int: ...
556+
@overload # type: ignore
557+
def __ror__(self, x: bool) -> bool: ...
558+
@overload # type: ignore
559+
def __ror__(self, x: int) -> int: ...
560+
@overload # type: ignore
561+
def __rxor__(self, x: bool) -> bool: ...
562+
@overload # type: ignore
563+
def __rxor__(self, x: int) -> int: ...
540564

541565
class slice:
542566
start = ... # type: Optional[int]

0 commit comments

Comments
 (0)