Add EllipsisType, NoneType, and NotImplementedType (Python 3.10) (#4822)

This commit is contained in:
Sebastian Rittau
2020-12-14 18:38:35 +01:00
committed by GitHub
parent e5d3a47632
commit 1c6ac09b82
2 changed files with 15 additions and 4 deletions

View File

@@ -170,7 +170,10 @@ else:
ReadableBuffer = Union[bytes, bytearray, memoryview, array.array, mmap.mmap, buffer]
WriteableBuffer = Union[bytearray, memoryview, array.array, mmap.mmap, buffer]
# Used by type checkers for checks involving None (does not exist at runtime)
@final
class NoneType:
def __bool__(self) -> Literal[False]: ...
if sys.version_info >= (3, 10):
from types import NoneType as NoneType
else:
# Used by type checkers for checks involving None (does not exist at runtime)
@final
class NoneType:
def __bool__(self) -> Literal[False]: ...

View File

@@ -15,6 +15,7 @@ from typing import (
Union,
overload,
)
from typing_extensions import Literal, final
# ModuleType is exported from this module, but for circular import
# reasons exists in its own stub file (with ModuleSpec and Loader).
@@ -324,3 +325,10 @@ if sys.version_info >= (3, 9):
__parameters__: Tuple[Any, ...]
def __init__(self, origin: type, args: Any) -> None: ...
def __getattr__(self, name: str) -> Any: ... # incomplete
if sys.version_info >= (3, 10):
@final
class NoneType:
def __bool__(self) -> Literal[False]: ...
EllipsisType = ellipsis # noqa F811 from builtins
NotImplementedType = _NotImplementedType # noqa F811 from builtins