mirror of
https://github.com/python/cpython.git
synced 2025-11-01 06:01:29 +00:00
Change function name and add docs
This commit is contained in:
parent
cf1da17c23
commit
041ceaa1fb
1 changed files with 3 additions and 2 deletions
|
|
@ -935,7 +935,8 @@ def _is_valid_dispatch_type(cls):
|
|||
return (isinstance(cls, UnionType) and
|
||||
all(isinstance(arg, type) for arg in cls.__args__))
|
||||
|
||||
def _get_type_hints(func):
|
||||
def _get_func_type_hints(func):
|
||||
"""Called when type hints are needed to choose the first argument to dispatch on."""
|
||||
ann = getattr(func, '__annotate__', None)
|
||||
if ann is None:
|
||||
raise TypeError(
|
||||
|
|
@ -977,7 +978,7 @@ def register(cls, func=None):
|
|||
f"{cls!r} is not a class or union type."
|
||||
)
|
||||
func = cls
|
||||
type_hints = _get_type_hints(func)
|
||||
type_hints = _get_func_type_hints(func)
|
||||
|
||||
argname, cls = next(iter(type_hints.items()))
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue