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

@@ -72,6 +72,27 @@ class CodeType:
freevars: Tuple[str, ...] = ...,
cellvars: Tuple[str, ...] = ...,
) -> None: ...
if sys.version_info >= (3, 8):
def replace(
self,
*,
co_argcount: int = ...,
co_posonlyargcount: int = ...,
co_kwonlyargcount: int = ...,
co_nlocals: int = ...,
co_stacksize: int = ...,
co_flags: int = ...,
co_firstlineno: int = ...,
co_code: bytes = ...,
co_consts: Tuple[Any, ...] = ...,
co_names: Tuple[str, ...] = ...,
co_varnames: Tuple[str, ...] = ...,
co_freevars: Tuple[str, ...] = ...,
co_cellvars: Tuple[str, ...] = ...,
co_filename: str = ...,
co_name: str = ...,
co_lnotab: bytes = ...,
) -> CodeType: ...
class MappingProxyType(Mapping[_KT, _VT], Generic[_KT, _VT]):
def __init__(self, mapping: Mapping[_KT, _VT]) -> None: ...