From c6d2eac3679b41fbf4c11547b53c6333c9e263d1 Mon Sep 17 00:00:00 2001 From: Anthony Sottile Date: Tue, 19 Dec 2017 12:45:58 -0800 Subject: [PATCH] Add typings for bool __{r,}{and,or,xor}__ --- 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 0c476cec735e..f64476f865fc 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 f2cea0f93459..74eb80635af2 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]