@@ -893,7 +893,7 @@ def _find_impl(cls, registry):
893893 match = t
894894 return registry .get (match )
895895
896- def _get_singledispatch_annotated_param (func , functype ):
896+ def _get_singledispatch_annotated_param (func , role ):
897897 """Find the first positional and user-specified parameter in a callable
898898 or descriptor.
899899
@@ -907,7 +907,7 @@ def _get_singledispatch_annotated_param(func, functype):
907907 func = func .__func__
908908 else :
909909 # Assume and skip bound parameter when singledispatchmethod is used.
910- idx = 1 if functype == "method" else 0
910+ idx = 1 if role == "method" else 0
911911 # Fast path: emulate `inspect._signature_from_function` if possible.
912912 if isinstance (func , FunctionType ) and not hasattr (func , "__wrapped__" ):
913913 func_code = func .__code__
@@ -978,7 +978,7 @@ def _is_valid_dispatch_type(cls):
978978 return (isinstance (cls , UnionType ) and
979979 all (isinstance (arg , type ) for arg in cls .__args__ ))
980980
981- def register (cls , func = None , __functype__ = "function" ):
981+ def register (cls , func = None , __role__ = "function" ):
982982 """generic_func.register(cls, func) -> func
983983
984984 Registers a new implementation for the given *cls* on a *generic_func*.
@@ -1003,7 +1003,7 @@ def register(cls, func=None, __functype__="function"):
10031003 )
10041004 func = cls
10051005
1006- argname = _get_singledispatch_annotated_param (func , functype = __functype__ )
1006+ argname = _get_singledispatch_annotated_param (func , role = __role__ )
10071007
10081008 # only import typing if annotation parsing is necessary
10091009 from typing import get_type_hints
@@ -1055,7 +1055,7 @@ def wrapper(*args, **kw):
10551055 funcname = getattr (func , '__name__' , 'singledispatch function' )
10561056 registry [object ] = func
10571057 wrapper .register = register
1058- wrapper .register .__text_signature__ = "(cls, func)" # Hide __functype__ from help().
1058+ wrapper .register .__text_signature__ = "(cls, func)" # Hide __role__ from help().
10591059 wrapper .dispatch = dispatch
10601060 wrapper .registry = MappingProxyType (registry )
10611061 wrapper ._clear_cache = dispatch_cache .clear
@@ -1083,7 +1083,7 @@ def register(self, cls, method=None):
10831083
10841084 Registers a new implementation for the given *cls* on a *generic_method*.
10851085 """
1086- return self .dispatcher .register (cls , func = method , __functype__ = "method" )
1086+ return self .dispatcher .register (cls , func = method , __role__ = "method" )
10871087
10881088 def __get__ (self , obj , cls = None ):
10891089 return _singledispatchmethod_get (self , obj , cls )
0 commit comments