Skip to content

Add NoReturn to mypy_extensions #2637

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jan 9, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions extensions/mypy_extensions.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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.
Expand Down Expand Up @@ -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