Skip to content

Commit d0ec48d

Browse files
committed
Use SupportsBytes
1 parent d470573 commit d0ec48d

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

stubs/3.2/builtins.pyi

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
from typing import (
44
TypeVar, Iterator, Iterable, overload,
55
Sequence, MutableSequence, Mapping, MutableMapping, Tuple, List, Any, Dict, Callable, Generic,
6-
Set, AbstractSet, MutableSet, Sized, Reversible, SupportsInt, SupportsFloat, SupportsAbs,
7-
SupportsRound, IO, Union, ItemsView, KeysView, ValuesView, ByteString
6+
Set, AbstractSet, MutableSet, Sized, Reversible, SupportsInt, SupportsFloat, SupportsBytes,
7+
SupportsAbs, SupportsRound, IO, Union, ItemsView, KeysView, ValuesView, ByteString
88
)
99
from abc import abstractmethod, ABCMeta
1010

@@ -255,6 +255,8 @@ class bytes(ByteString):
255255
def __init__(self, length: int) -> None: ...
256256
@overload
257257
def __init__(self) -> None: ...
258+
@overload
259+
def __init__(self, o: SupportsBytes) -> None: ...
258260
def capitalize(self) -> bytes: ...
259261
def center(self, width: int, fillchar: bytes = None) -> bytes: ...
260262
def count(self, x: bytes) -> int: ...

stubs/3.2/typing.pyi

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,14 @@ class SupportsFloat(metaclass=ABCMeta):
5656
@abstractmethod
5757
def __float__(self) -> float: ...
5858

59+
class SupportsComplex(metaclass=ABCMeta):
60+
@abstractmethod
61+
def __complex__(self) -> complex: pass
62+
63+
class SupportsBytes(metaclass=ABCMeta):
64+
@abstractmethod
65+
def __bytes__(self) -> bytes: pass
66+
5967
class SupportsAbs(Generic[_T]):
6068
@abstractmethod
6169
def __abs__(self) -> _T: ...

0 commit comments

Comments
 (0)