Change function name and add docs

This commit is contained in:
bswck 2025-10-17 16:20:18 +02:00
parent cf1da17c23
commit 041ceaa1fb
No known key found for this signature in database

View file

@ -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()))