move utils.consts.BITBOT_MAGIC to utils.decorators

This commit is contained in:
jesopo 2019-11-15 14:09:35 +00:00
parent 5d01db8514
commit 5d55086847
2 changed files with 5 additions and 6 deletions

View file

@ -1,8 +1,6 @@
import typing
from . import _consts_256_color
BITBOT_MAGIC = "__bitbot"
class IRCColor(object):
def __init__(self, irc: int, ansi: int, is_256):
self.irc = irc

View file

@ -1,5 +1,6 @@
import typing
from . import consts
BITBOT_MAGIC = "__bitbot"
class BitBotMagic(object):
def __init__(self):
@ -24,10 +25,10 @@ class BitBotMagic(object):
def get_magic(obj: typing.Any):
if not has_magic(obj):
setattr(obj, consts.BITBOT_MAGIC, BitBotMagic())
return getattr(obj, consts.BITBOT_MAGIC)
setattr(obj, BITBOT_MAGIC, BitBotMagic())
return getattr(obj, BITBOT_MAGIC)
def has_magic(obj: typing.Any):
return hasattr(obj, consts.BITBOT_MAGIC)
return hasattr(obj, BITBOT_MAGIC)
def hook(event: str, **kwargs):
def _hook_func(func):