make handler._get_spec return only specs

This commit is contained in:
birdi 2019-07-30 12:25:42 +03:00
parent ddd92acc09
commit d2d49282f5

View file

@ -23,11 +23,10 @@ class CancelHandler(Exception):
def _get_spec(func: callable):
wrapped_function = func
while hasattr(func, '__wrapped__'): # Try to resolve decorated callbacks
func = func.__wrapped__
spec = inspect.getfullargspec(func)
return spec, wrapped_function
return spec
def _check_spec(spec: inspect.FullArgSpec, kwargs: dict):
@ -56,7 +55,7 @@ class Handler:
:param filters: list of filters
:param index: you can reorder handlers
"""
spec, handler = _get_spec(handler)
spec = _get_spec(handler)
if filters and not isinstance(filters, (list, tuple, set)):
filters = [filters]