Use ``class TD(TypedDict): pass`` or ``TD = TypedDict("TD", {})``
to create a TypedDict with zero field.
- * The :func:`typing.no_type_check_decorator` decorator function
+ * The :func:`!typing.no_type_check_decorator` decorator function
has been deprecated since Python 3.13.
After eight years in the :mod:`typing` module,
it has yet to be supported by any major type checker.
``@no_type_check`` mutates the decorated object in place.
-.. decorator:: no_type_check_decorator
-
- Decorator to give another decorator the :func:`no_type_check` effect.
-
- This wraps the decorator with something that wraps the decorated
- function in :func:`no_type_check`.
-
- .. deprecated-removed:: 3.13 3.15
- No type checker ever added support for ``@no_type_check_decorator``. It
- is therefore deprecated, and will be removed in Python 3.15.
-
.. decorator:: override
Decorator to indicate that a method in a subclass is intended to override a
- 3.12
- Undecided
- :pep:`695`
- * - :func:`@typing.no_type_check_decorator <no_type_check_decorator>`
- - 3.13
- - 3.15
- - :gh:`106309`
* - :data:`typing.AnyStr`
- 3.13
- 3.18
use ``class TD(TypedDict): pass`` or ``TD = TypedDict("TD", {})``.
(Contributed by Alex Waygood in :gh:`105566` and :gh:`105570`.)
- * Deprecate the :func:`typing.no_type_check_decorator` decorator function,
+ * Deprecate the :func:`!typing.no_type_check_decorator` decorator function,
to be removed in Python 3.15.
After eight years in the :mod:`typing` module,
it has yet to be supported by any major type checker.
:func:`issubclass`, but warnings were not previously emitted if it was merely
imported or accessed from the :mod:`!typing` module.
+* Deprecated :func:`!typing.no_type_check_decorator` has been removed.
+ (Contributed by Nikita Sobolev in :gh:`133601`.)
+
unicodedata
-----------
from typing import is_typeddict, is_protocol
from typing import reveal_type
from typing import dataclass_transform
-from typing import no_type_check, no_type_check_decorator
+from typing import no_type_check
from typing import Type
from typing import NamedTuple, NotRequired, Required, ReadOnly, TypedDict, NoExtraItems
from typing import IO, TextIO, BinaryIO
for clazz in [C, D, E, F]:
self.assertEqual(get_type_hints(clazz), expected_result)
- def test_meta_no_type_check(self):
- depr_msg = (
- "'typing.no_type_check_decorator' is deprecated "
- "and slated for removal in Python 3.15"
- )
- with self.assertWarnsRegex(DeprecationWarning, depr_msg):
- @no_type_check_decorator
- def magic_decorator(func):
- return func
-
- self.assertEqual(magic_decorator.__name__, 'magic_decorator')
-
- @magic_decorator
- def foo(a: 'whatevers') -> {}:
- pass
-
- @magic_decorator
- class C:
- def foo(a: 'whatevers') -> {}:
- pass
-
- self.assertEqual(foo.__name__, 'foo')
- th = get_type_hints(foo)
- self.assertEqual(th, {})
- cth = get_type_hints(C.foo)
- self.assertEqual(cth, {})
- ith = get_type_hints(C().foo)
- self.assertEqual(ith, {})
-
class InternalsTests(BaseTestCase):
def test_collect_parameters(self):
'Never',
'NewType',
'no_type_check',
- 'no_type_check_decorator',
'NoDefault',
'NoExtraItems',
'NoReturn',
return arg
-def no_type_check_decorator(decorator):
- """Decorator to give another decorator the @no_type_check effect.
-
- This wraps the decorator with something that wraps the decorated
- function in @no_type_check.
- """
- import warnings
- warnings._deprecated("typing.no_type_check_decorator", remove=(3, 15))
- @functools.wraps(decorator)
- def wrapped_decorator(*args, **kwds):
- func = decorator(*args, **kwds)
- func = no_type_check(func)
- return func
-
- return wrapped_decorator
-
-
def _overload_dummy(*args, **kwds):
"""Helper for @overload to raise when called."""
raise NotImplementedError(
.. nonce: hSlB17
.. section: Library
-Deprecate :func:`typing.no_type_check_decorator`. No major type checker ever
+Deprecate :func:`!typing.no_type_check_decorator`. No major type checker ever
added support for this decorator. Patch by Alex Waygood.
..
--- /dev/null
+Remove deprecated :func:`!typing.no_type_check_decorator`.