mirror of https://github.com/jesopo/ircstates
decorators.line_handler_decorator -> decorators.handler_decorator
This commit is contained in:
parent
2626cdb7a1
commit
6b12f3290f
|
@ -1,11 +1,11 @@
|
|||
from typing import Any, Dict, List
|
||||
|
||||
def line_handler_decorator(d: Dict[str, List[Any]]):
|
||||
def line_handler(command: str):
|
||||
def handler_decorator(d: Dict[str, List[Any]]):
|
||||
def _handler(command: str):
|
||||
def _(func: Any):
|
||||
if not command in d:
|
||||
d[command] = []
|
||||
d[command].append(func)
|
||||
return func
|
||||
return _
|
||||
return line_handler
|
||||
return _handler
|
||||
|
|
|
@ -7,12 +7,12 @@ from .user import User
|
|||
from .channel import Channel
|
||||
from .channel_user import ChannelUser
|
||||
from .isupport import ISupport
|
||||
from .decorators import line_handler_decorator
|
||||
from .decorators import handler_decorator
|
||||
from .casemap import casefold
|
||||
from .emit import *
|
||||
|
||||
LINE_HANDLERS: Dict[str, List[Callable[["Server", Line], Emits]]] = {}
|
||||
line_handler = line_handler_decorator(LINE_HANDLERS)
|
||||
line_handler = handler_decorator(LINE_HANDLERS)
|
||||
|
||||
class ServerException(Exception):
|
||||
pass
|
||||
|
|
Loading…
Reference in New Issue