move typing.Callable def so Event doesn't have to be in " "

This commit is contained in:
jesopo 2019-10-29 18:00:59 +00:00
parent 40a340e94f
commit 9b349f8cc0

View file

@ -11,8 +11,6 @@ DEFAULT_PRIORITY = PRIORITY_MEDIUM
DEFAULT_EVENT_DELIMITER = "." DEFAULT_EVENT_DELIMITER = "."
DEFAULT_MULTI_DELIMITER = "|" DEFAULT_MULTI_DELIMITER = "|"
CALLBACK_TYPE = typing.Callable[["Event"], typing.Any]
class Event(object): class Event(object):
def __init__(self, name: str, kwargs): def __init__(self, name: str, kwargs):
self.name = name self.name = name
@ -27,6 +25,8 @@ class Event(object):
def eat(self): def eat(self):
self.eaten = True self.eaten = True
CALLBACK_TYPE = typing.Callable[[Event], typing.Any]
class EventHook(object): class EventHook(object):
def __init__(self, event_name: str, func: CALLBACK_TYPE, def __init__(self, event_name: str, func: CALLBACK_TYPE,
context: typing.Optional[str], priority: int, context: typing.Optional[str], priority: int,