move typing.Callable def so Event doesn't have to be in " "
This commit is contained in:
parent
40a340e94f
commit
9b349f8cc0
1 changed files with 2 additions and 2 deletions
|
@ -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,
|
||||||
|
|
Loading…
Reference in a new issue