From 5e8cf06a45470118249518e76dfdc1075b3deea2 Mon Sep 17 00:00:00 2001 From: jesopo Date: Fri, 15 Nov 2019 13:41:03 +0000 Subject: [PATCH] dont expose has_magic/get_magic in utils/__init__.py, ref directly --- src/ModuleManager.py | 9 +++++---- src/utils/__init__.py | 4 ++-- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/ModuleManager.py b/src/ModuleManager.py index 65f7c11e..50af3493 100644 --- a/src/ModuleManager.py +++ b/src/ModuleManager.py @@ -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) diff --git a/src/utils/__init__.py b/src/utils/__init__.py index 1013b2ac..b7b581e2 100644 --- a/src/utils/__init__.py +++ b/src/utils/__init__.py @@ -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)