From ffc74a8bbe5ebb53c8fe966023c046b0acbff87a Mon Sep 17 00:00:00 2001 From: David Fisher Date: Wed, 4 Jan 2017 11:52:22 -0800 Subject: [PATCH 1/2] Add NoReturn to mypy_extensions --- extensions/mypy_extensions.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/extensions/mypy_extensions.py b/extensions/mypy_extensions.py index efa3c35e8e03..43bdb3b14132 100644 --- a/extensions/mypy_extensions.py +++ b/extensions/mypy_extensions.py @@ -88,3 +88,6 @@ 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 From 622c9ee4903b74a0cce17d2b636325cb0fda0fc4 Mon Sep 17 00:00:00 2001 From: David Fisher Date: Wed, 4 Jan 2017 13:11:03 -0800 Subject: [PATCH 2/2] fix whitespace errors --- extensions/mypy_extensions.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/extensions/mypy_extensions.py b/extensions/mypy_extensions.py index 43bdb3b14132..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. @@ -89,5 +92,6 @@ class Point2D(TypedDict): syntax forms work for Python 2.7 and 3.2+ """ + # Return type that indicates a function does not return class NoReturn: pass