Add docstring, fix spelling mistake
This commit is contained in:
parent
6e76661492
commit
2a975f55fc
@ -81,6 +81,10 @@ class FunctionDispatcher(Generic[T]):
|
||||
self.registry = Registry(*axis)
|
||||
|
||||
def check_rule(self, rule: T, *argtypes: KeyType) -> None:
|
||||
""" Check if the argument types match wrt number of arguments.
|
||||
|
||||
Raise TypeError in case of failure.
|
||||
"""
|
||||
# Check if we have the right number of parametrized types
|
||||
if len(argtypes) != self.params_arity:
|
||||
raise TypeError(
|
||||
@ -111,6 +115,7 @@ class FunctionDispatcher(Generic[T]):
|
||||
"""
|
||||
|
||||
def register_rule(func: T) -> T:
|
||||
""" Register rule wrapper function."""
|
||||
self.register_rule(func, *argtypes)
|
||||
return func
|
||||
|
||||
|
@ -105,7 +105,7 @@ class MethodDispatcher(FunctionDispatcher[T]):
|
||||
|
||||
@property
|
||||
def otherwise(self) -> Callable[[T], T]:
|
||||
""" Decorator which registeres "catch-all" case for multimethod"""
|
||||
""" Decorator which registers "catch-all" case for multimethod"""
|
||||
|
||||
def make_declaration(meth):
|
||||
self.register_unbound_rule(meth, *([object] * (self.params_arity - 1)))
|
||||
|
Loading…
x
Reference in New Issue
Block a user