diff --git a/extensions/mypy_extensions.py b/extensions/mypy_extensions.py index efa3c35e8e03..26e568cc0a27 100644 --- a/extensions/mypy_extensions.py +++ b/extensions/mypy_extensions.py @@ -22,9 +22,11 @@ def _check_fails(cls, other): pass return False + def _dict_new(cls, *args, **kwargs): return dict(*args, **kwargs) + def _typeddict_new(cls, _typename, _fields=None, **kwargs): if _fields is None: _fields = kwargs @@ -33,6 +35,7 @@ def _typeddict_new(cls, _typename, _fields=None, **kwargs): " but not both") return _TypedDictMeta(_typename, (), {'__annotations__': dict(_fields)}) + class _TypedDictMeta(type): def __new__(cls, name, bases, ns): # Create new typed dict class object. @@ -88,3 +91,7 @@ class Point2D(TypedDict): The latter syntax is only supported in Python 3.6+, while two other syntax forms work for Python 2.7 and 3.2+ """ + + +# Return type that indicates a function does not return +class NoReturn: pass