diff options
| author | 2018-12-02 16:00:55 +0000 | |
|---|---|---|
| committer | 2018-12-02 16:00:55 +0000 | |
| commit | 9dd9111f853207ba06f22f1f538ab6fa1648c5d3 (patch) | |
| tree | 345400589842df19f93da85eba01cc0c6f68ae12 | |
| parent | Use `getattr` to get `Module` classes out of modules in ModuleManager.py; this (diff) | |
| signature | ||
Further clarification of type hints in ModuleManager.py, including now making it
explicit that module objects MUST inherit from BaseModule
| -rw-r--r-- | src/ModuleManager.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/ModuleManager.py b/src/ModuleManager.py index 1072df20..3600129b 100644 --- a/src/ModuleManager.py +++ b/src/ModuleManager.py @@ -19,6 +19,7 @@ class ModuleNotLoadedWarning(ModuleWarning): pass class BaseModule(object): + _context = "" def __init__(self, bot: "IRCBot.Bot", events: EventManager.EventHook, @@ -33,6 +34,8 @@ class BaseModule(object): self.on_load() def on_load(self): pass + def unload(self): + pass class ModuleManager(object): def __init__(self, @@ -49,8 +52,8 @@ class ModuleManager(object): self.log = log self.directory = directory - self.modules = {} - self.waiting_requirement = {} + self.modules = {} # type: typing.Dict[str, BaseModule] + self.waiting_requirement = {} # type: typing.Dict[str, typing.Set[str]] def list_modules(self) -> typing.List[str]: return sorted(glob.glob(os.path.join(self.directory, "*.py"))) |
