Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # содержимое /plugins/__init__.py
- import importlib
- import pkgutil
- __all__ = []
- def import_plugins(package):
- if isinstance(package, str):
- package = importlib.import_module(package)
- for loader, name, is_pkg in pkgutil.walk_packages(package.__path__):
- full_name = package.__name__ + '.' + name
- module = importlib.import_module(full_name)
- for name in dir(module):
- if name[0] == "_":
- continue
- e = module.__getattribute__(name)
- if e in __all__:
- continue
- if True:
- __all__.append(e.__name__)
- globals()[e.__name__] = e
- if is_pkg:
- import_plugins(full_name)
- import_plugins(__name__)
- from Plugins import *
- class Settings:
- __slots__ = ("inner_data", "plugins", "user_plugins")
- def __init__(self):
- self.plugins = ()
- self.user_plugins = ()
- self.inner_data = InnerDataPlugin()
- self.plugins = (
- AntiFloodPlugin(),
- self.inner_data,
- PairPlugin("pair test", "pt"),
- TestingPlugin("test", "tst"),
- )
- self.user_plugins = (
- PairUP("pair test", "pt"),
- )
Add Comment
Please, Sign In to add comment