Move ellipsis definition to types (#11223)

This commit is contained in:
Shantanu
2024-01-02 16:14:53 -08:00
committed by GitHub
parent 6aa6722fe1
commit 6fcd37456d
2 changed files with 12 additions and 5 deletions

View File

@@ -1914,9 +1914,13 @@ def __import__(
def __build_class__(__func: Callable[[], _Cell | Any], __name: str, *bases: Any, metaclass: Any = ..., **kwds: Any) -> Any: ...
if sys.version_info >= (3, 10):
# In Python 3.10, EllipsisType is exposed publicly in the types module.
@final
class ellipsis: ...
from types import EllipsisType
# Backwards compatibility hack for folks who relied on the ellipsis type
# existing in typeshed in Python 3.9 and earlier.
ellipsis = EllipsisType
Ellipsis: EllipsisType
else:
# Actually the type of Ellipsis is <type 'ellipsis'>, but since it's
@@ -1925,7 +1929,7 @@ else:
@type_check_only
class ellipsis: ...
Ellipsis: ellipsis
Ellipsis: ellipsis
class BaseException:
args: tuple[Any, ...]

View File

@@ -626,7 +626,10 @@ if sys.version_info >= (3, 10):
@final
class NoneType:
def __bool__(self) -> Literal[False]: ...
EllipsisType = ellipsis # noqa: F821 from builtins
@final
class EllipsisType: ...
from builtins import _NotImplementedType
NotImplementedType = _NotImplementedType