Don't fail get_kwarg when self.kwarg[name] is falsey

This commit is contained in:
jesopo 2019-06-16 18:39:56 +01:00
parent 77126e5807
commit 18004c23e1

View file

@ -42,8 +42,11 @@ class EventCallback(object):
return self.function(event)
def get_kwarg(self, name: str, default=None) -> typing.Any:
item = self.kwargs.get(name, default)
return item or self.docstring.items.get(name, default)
if name in self.kwargs:
return self.kwargs[name]
elif name in self.docstring.items:
return self.docstring.items[name]
return default
class EventHook(object):
def __init__(self, log: Logging.Log, name: str = None,