dont expose has_magic/get_magic in utils/__init__.py, ref directly

This commit is contained in:
jesopo 2019-11-15 13:41:03 +00:00
parent bfcf40edd7
commit 5e8cf06a45
2 changed files with 7 additions and 6 deletions

View file

@ -239,15 +239,16 @@ class ModuleManager(object):
# @utils.hook() magic
for attribute_name in dir(module_object):
attribute = getattr(module_object, attribute_name)
if inspect.ismethod(attribute) and utils.has_magic(attribute):
magic = utils.get_magic(attribute)
if (inspect.ismethod(attribute) and
utils.decorators.has_magic(attribute)):
magic = utils.decorators.get_magic(attribute)
for hook, kwargs in magic.get_hooks():
context_events.on(hook)._hook(attribute, kwargs=kwargs)
# @utils.export() magic
if utils.has_magic(module_object):
magic = utils.get_magic(module_object)
if utils.decorators.has_magic(module_object):
magic = utils.decorators.get_magic(module_object)
for key, value in magic.get_exports():
context_exports.add(key, value)

View file

@ -1,8 +1,8 @@
import contextlib, datetime, decimal, enum, io, ipaddress, multiprocessing
import queue, re, signal, threading, typing
from . import cli, consts, irc, http, parse, security
from . import cli, consts, decorators, irc, http, parse, security
from .decorators import export, get_magic, has_magic, hook, kwarg
from .decorators import export, hook, kwarg
from .settings import (BoolSetting, FunctionSetting, IntRangeSetting,
IntSetting, OptionsSetting, sensitive_format, SensitiveSetting, Setting)