From 03044212d484201e447721a1792ecdd467761072 Mon Sep 17 00:00:00 2001 From: Anthony Sottile Date: Wed, 20 Dec 2017 21:04:55 -0800 Subject: [PATCH] Add typings for bool __{r,}{and,or,xor}__ (#1795) --- stdlib/2/__builtin__.pyi | 24 ++++++++++++++++++++++++ stdlib/3/builtins.pyi | 24 ++++++++++++++++++++++++ 2 files changed, 48 insertions(+) diff --git a/stdlib/2/__builtin__.pyi b/stdlib/2/__builtin__.pyi index 0c476cec7..f64476f86 100644 --- a/stdlib/2/__builtin__.pyi +++ b/stdlib/2/__builtin__.pyi @@ -472,6 +472,30 @@ class bytearray(MutableSequence[int]): class bool(int): def __init__(self, o: object = ...) -> None: ... + @overload # type: ignore + def __and__(self, x: bool) -> bool: ... + @overload # type: ignore + def __and__(self, x: int) -> int: ... + @overload # type: ignore + def __or__(self, x: bool) -> bool: ... + @overload # type: ignore + def __or__(self, x: int) -> int: ... + @overload # type: ignore + def __xor__(self, x: bool) -> bool: ... + @overload # type: ignore + def __xor__(self, x: int) -> int: ... + @overload # type: ignore + def __rand__(self, x: bool) -> bool: ... + @overload # type: ignore + def __rand__(self, x: int) -> int: ... + @overload # type: ignore + def __ror__(self, x: bool) -> bool: ... + @overload # type: ignore + def __ror__(self, x: int) -> int: ... + @overload # type: ignore + def __rxor__(self, x: bool) -> bool: ... + @overload # type: ignore + def __rxor__(self, x: int) -> int: ... class slice(object): start = ... # type: Optional[int] diff --git a/stdlib/3/builtins.pyi b/stdlib/3/builtins.pyi index f2cea0f93..74eb80635 100644 --- a/stdlib/3/builtins.pyi +++ b/stdlib/3/builtins.pyi @@ -537,6 +537,30 @@ class memoryview(Sized, Container[bytes]): class bool(int): def __init__(self, o: object = ...) -> None: ... + @overload # type: ignore + def __and__(self, x: bool) -> bool: ... + @overload # type: ignore + def __and__(self, x: int) -> int: ... + @overload # type: ignore + def __or__(self, x: bool) -> bool: ... + @overload # type: ignore + def __or__(self, x: int) -> int: ... + @overload # type: ignore + def __xor__(self, x: bool) -> bool: ... + @overload # type: ignore + def __xor__(self, x: int) -> int: ... + @overload # type: ignore + def __rand__(self, x: bool) -> bool: ... + @overload # type: ignore + def __rand__(self, x: int) -> int: ... + @overload # type: ignore + def __ror__(self, x: bool) -> bool: ... + @overload # type: ignore + def __ror__(self, x: int) -> int: ... + @overload # type: ignore + def __rxor__(self, x: bool) -> bool: ... + @overload # type: ignore + def __rxor__(self, x: int) -> int: ... class slice: start = ... # type: Optional[int]