diff options
Diffstat (limited to 'Lib/typing.py')
-rw-r--r-- | Lib/typing.py | 43 |
1 files changed, 1 insertions, 42 deletions
diff --git a/Lib/typing.py b/Lib/typing.py index 96393d6..95dbc0b 100644 --- a/Lib/typing.py +++ b/Lib/typing.py @@ -16,7 +16,6 @@ At large scale, the structure of the module is following: no_type_check_decorator. * Generic aliases for collections.abc ABCs and few additional protocols. * Special types: NewType, NamedTuple, TypedDict. -* Wrapper submodules for re and io related types. """ from abc import abstractmethod, ABCMeta @@ -27,7 +26,7 @@ import copyreg import contextlib import functools import operator -import re as stdlib_re # Avoid confusion with the re we export. +import re as stdlib_re # Avoid confusion with the typing.re namespace on <=3.11 import sys import types import warnings @@ -158,10 +157,6 @@ __all__ = [ 'Unpack', ] -# The pseudo-submodules 're' and 'io' are part of the public -# namespace, but excluded from __all__ because they might stomp on -# legitimate imports of those modules. - def _type_convert(arg, module=None, *, allow_special_forms=False): """For converting None to type(None), and strings to ForwardRef.""" @@ -3150,45 +3145,9 @@ class TextIO(IO[str]): pass -class _DeprecatedType(type): - def __getattribute__(cls, name): - if name not in ("__dict__", "__module__") and name in cls.__dict__: - warnings.warn( - f"{cls.__name__} is deprecated, import directly " - f"from typing instead. {cls.__name__} will be removed " - "in Python 3.12.", - DeprecationWarning, - stacklevel=2, - ) - return super().__getattribute__(name) - - -class io(metaclass=_DeprecatedType): - """Wrapper namespace for IO generic classes.""" - - __all__ = ['IO', 'TextIO', 'BinaryIO'] - IO = IO - TextIO = TextIO - BinaryIO = BinaryIO - - -io.__name__ = __name__ + '.io' -sys.modules[io.__name__] = io - Pattern = _alias(stdlib_re.Pattern, 1) Match = _alias(stdlib_re.Match, 1) -class re(metaclass=_DeprecatedType): - """Wrapper namespace for re type aliases.""" - - __all__ = ['Pattern', 'Match'] - Pattern = Pattern - Match = Match - - -re.__name__ = __name__ + '.re' -sys.modules[re.__name__] = re - def reveal_type[T](obj: T, /) -> T: """Reveal the inferred type of a variable. |