Further clarification of type hints in ModuleManager.py, including now making it
explicit that module objects MUST inherit from BaseModule
This commit is contained in:
parent
9466f57efc
commit
9dd9111f85
1 changed files with 5 additions and 2 deletions
|
@ -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")))
|
||||
|
|
Loading…
Reference in a new issue