Skip to content
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

Fix "accepts only single type" error messages #1130

Merged
merged 1 commit into from Apr 11, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 7 additions & 7 deletions typing_extensions/src/typing_extensions.py
Expand Up @@ -157,7 +157,7 @@ def __repr__(self):

def __getitem__(self, parameters):
item = typing._type_check(parameters,
f'{self._name} accepts only single type')
f'{self._name} accepts only a single type.')
return typing._GenericAlias(self, (item,))

Final = _FinalForm('Final',
Expand Down Expand Up @@ -1336,7 +1336,7 @@ def is_str(val: Union[str, float]):
``TypeGuard`` also works with type variables. For more information, see
PEP 647 (User-Defined Type Guards).
"""
item = typing._type_check(parameters, f'{self} accepts only single type.')
item = typing._type_check(parameters, f'{self} accepts only a single type.')
return typing._GenericAlias(self, (item,))
# 3.7-3.8
else:
Expand Down Expand Up @@ -1539,7 +1539,7 @@ class Movie(TypedDict, total=False):
There is no runtime checking that a required key is actually provided
when instantiating a related TypedDict.
"""
item = typing._type_check(parameters, f'{self._name} accepts only single type')
item = typing._type_check(parameters, f'{self._name} accepts only a single type.')
return typing._GenericAlias(self, (item,))

@_ExtensionsSpecialForm
Expand All @@ -1556,7 +1556,7 @@ class Movie(TypedDict):
year=1999,
)
"""
item = typing._type_check(parameters, f'{self._name} accepts only single type')
item = typing._type_check(parameters, f'{self._name} accepts only a single type.')
return typing._GenericAlias(self, (item,))

else:
Expand All @@ -1566,7 +1566,7 @@ def __repr__(self):

def __getitem__(self, parameters):
item = typing._type_check(parameters,
'{} accepts only single type'.format(self._name))
f'{self._name} accepts only a single type.')
return typing._GenericAlias(self, (item,))

Required = _RequiredForm(
Expand Down Expand Up @@ -1622,7 +1622,7 @@ def add_batch_axis(
) -> Array[Batch, Unpack[Shape]]: ...

"""
item = typing._type_check(parameters, f'{self._name} accepts only single type')
item = typing._type_check(parameters, f'{self._name} accepts only a single type.')
return _UnpackAlias(self, (item,))

def _is_unpack(obj):
Expand All @@ -1638,7 +1638,7 @@ def __repr__(self):

def __getitem__(self, parameters):
item = typing._type_check(parameters,
f'{self._name} accepts only single type')
f'{self._name} accepts only a single type.')
return _UnpackAlias(self, (item,))

Unpack = _UnpackForm(
Expand Down