Use SupportsBytes

This commit is contained in:
Ben Longbons
2015-10-10 21:14:24 -07:00
committed by Matthias Kramm
parent 75b3d91e02
commit f2a12774ee
2 changed files with 12 additions and 2 deletions

View File

@@ -3,8 +3,8 @@
from typing import (
TypeVar, Iterator, Iterable, overload,
Sequence, MutableSequence, Mapping, MutableMapping, Tuple, List, Any, Dict, Callable, Generic,
Set, AbstractSet, MutableSet, Sized, Reversible, SupportsInt, SupportsFloat, SupportsAbs,
SupportsRound, IO, Union, ItemsView, KeysView, ValuesView, ByteString
Set, AbstractSet, MutableSet, Sized, Reversible, SupportsInt, SupportsFloat, SupportsBytes,
SupportsAbs, SupportsRound, IO, Union, ItemsView, KeysView, ValuesView, ByteString
)
from abc import abstractmethod, ABCMeta
@@ -255,6 +255,8 @@ class bytes(ByteString):
def __init__(self, length: int) -> None: ...
@overload
def __init__(self) -> None: ...
@overload
def __init__(self, o: SupportsBytes) -> None: ...
def capitalize(self) -> bytes: ...
def center(self, width: int, fillchar: bytes = None) -> bytes: ...
def count(self, x: bytes) -> int: ...

View File

@@ -56,6 +56,14 @@ class SupportsFloat(metaclass=ABCMeta):
@abstractmethod
def __float__(self) -> float: ...
class SupportsComplex(metaclass=ABCMeta):
@abstractmethod
def __complex__(self) -> complex: pass
class SupportsBytes(metaclass=ABCMeta):
@abstractmethod
def __bytes__(self) -> bytes: pass
class SupportsAbs(Generic[_T]):
@abstractmethod
def __abs__(self) -> _T: ...