Python3.8 additions and changes (#3337)

* Add as_integer_ratio() to a few types

* Add dirs_exist_ok to copytree()

* int, float, complex accept __index__ args

Also fix complex.__init__ argument names

* Add __reversed__ to dict et al.

* Python 3.8 date(time) arithmetic fixes

* Add CodeType.replace()
This commit is contained in:
Sebastian Rittau
2019-10-11 05:51:27 +02:00
committed by Jelle Zijlstra
parent d0beab9b8e
commit 8a7d61741d
7 changed files with 97 additions and 27 deletions

View File

@@ -339,6 +339,8 @@ class ItemsView(MappingView, AbstractSet[Tuple[_KT_co, _VT_co]], Generic[_KT_co,
def __rand__(self, o: Iterable[_T]) -> Set[_T]: ...
def __contains__(self, o: object) -> bool: ...
def __iter__(self) -> Iterator[Tuple[_KT_co, _VT_co]]: ...
if sys.version_info >= (3, 8):
def __reversed__(self) -> Iterator[Tuple[_KT_co, _VT_co]]: ...
def __or__(self, o: Iterable[_T]) -> Set[Union[Tuple[_KT_co, _VT_co], _T]]: ...
def __ror__(self, o: Iterable[_T]) -> Set[Union[Tuple[_KT_co, _VT_co], _T]]: ...
def __sub__(self, o: Iterable[Any]) -> Set[Tuple[_KT_co, _VT_co]]: ...
@@ -351,6 +353,8 @@ class KeysView(MappingView, AbstractSet[_KT_co], Generic[_KT_co]):
def __rand__(self, o: Iterable[_T]) -> Set[_T]: ...
def __contains__(self, o: object) -> bool: ...
def __iter__(self) -> Iterator[_KT_co]: ...
if sys.version_info >= (3, 8):
def __reversed__(self) -> Iterator[_KT_co]: ...
def __or__(self, o: Iterable[_T]) -> Set[Union[_KT_co, _T]]: ...
def __ror__(self, o: Iterable[_T]) -> Set[Union[_KT_co, _T]]: ...
def __sub__(self, o: Iterable[Any]) -> Set[_KT_co]: ...
@@ -361,6 +365,8 @@ class KeysView(MappingView, AbstractSet[_KT_co], Generic[_KT_co]):
class ValuesView(MappingView, Iterable[_VT_co], Generic[_VT_co]):
def __contains__(self, o: object) -> bool: ...
def __iter__(self) -> Iterator[_VT_co]: ...
if sys.version_info >= (3, 8):
def __reversed__(self) -> Iterator[_VT_co]: ...
@runtime_checkable
class ContextManager(Protocol[_T_co]):