add bytes.__mod__ (#1212)

Fixes python/mypy#3247

Also reviewed some related logic:
- __mod__ was added to both bytes and bytearray with PEP 461, which went into 3.5
- str.__mod__ takes only one argument, and the signature calls it "value"
- In Python 2, bytearray doesn't have __mod__ (and typeshed correctly omits it)
This commit is contained in:
Jelle Zijlstra
2017-04-27 08:07:59 -07:00
committed by Matthias Kramm
parent c133a3aca7
commit d1da44dc1b

View File

@@ -287,7 +287,7 @@ class str(Sequence[str]):
def __add__(self, s: str) -> str: ...
def __mul__(self, n: int) -> str: ...
def __rmul__(self, n: int) -> str: ...
def __mod__(self, *args: Any) -> str: ...
def __mod__(self, value: Any) -> str: ...
def __eq__(self, x: object) -> bool: ...
def __ne__(self, x: object) -> bool: ...
def __lt__(self, x: str) -> bool: ...
@@ -388,6 +388,8 @@ class bytes(ByteString):
def __add__(self, s: bytes) -> bytes: ...
def __mul__(self, n: int) -> bytes: ...
def __rmul__(self, n: int) -> bytes: ...
if sys.version_info >= (3, 5):
def __mod__(self, value: Any) -> bytes: ...
def __contains__(self, o: object) -> bool: ...
def __eq__(self, x: object) -> bool: ...
def __ne__(self, x: object) -> bool: ...
@@ -485,6 +487,8 @@ class bytearray(MutableSequence[int], ByteString):
def __mul__(self, n: int) -> bytearray: ...
def __rmul__(self, n: int) -> bytearray: ...
def __imul__(self, n: int) -> bytearray: ...
if sys.version_info >= (3, 5):
def __mod__(self, value: Any) -> bytes: ...
def __contains__(self, o: object) -> bool: ...
def __eq__(self, x: object) -> bool: ...
def __ne__(self, x: object) -> bool: ...