From 9dd9111f853207ba06f22f1f538ab6fa1648c5d3 Mon Sep 17 00:00:00 2001 From: jesopo Date: Sun, 2 Dec 2018 16:00:55 +0000 Subject: [PATCH] Further clarification of type hints in ModuleManager.py, including now making it explicit that module objects MUST inherit from BaseModule --- src/ModuleManager.py | 7 +++++-- 1 file 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")))