From eac2af5320e5a3b48558a8103d56984e201b2696 Mon Sep 17 00:00:00 2001 From: TheTechromancer Date: Thu, 14 Sep 2023 16:46:04 -0400 Subject: [PATCH] even more scanner docs --- bbot/scanner/scanner.py | 28 +++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/bbot/scanner/scanner.py b/bbot/scanner/scanner.py index 64d8526480..fd7847d05e 100644 --- a/bbot/scanner/scanner.py +++ b/bbot/scanner/scanner.py @@ -465,9 +465,31 @@ async def setup_modules(self, remove_failed=True): } async def load_modules(self): - """ - Import and instantiate all scan modules (including internal ones). - Module dependencies will be installed as part of this process. + """Asynchronously import and instantiate all scan modules, including internal and output modules. + + This method is automatically invoked by `setup_modules()`. It performs several key tasks in the following sequence: + + 1. Install dependencies for each module via `self.helpers.depsinstaller.install()`. + 2. Load scan modules and updates the `modules` dictionary. + 3. Load internal modules and updates the `modules` dictionary. + 4. Load output modules and updates the `modules` dictionary. + 5. Sorts modules based on their `_priority` attribute. + + If any modules fail to load or their dependencies fail to install, a ScanError will be raised (unless `self.force_start` is set to True). + + Attributes: + succeeded, failed (tuple): A tuple containing lists of modules that succeeded or failed during the dependency installation. + loaded_modules, loaded_internal_modules, loaded_output_modules (dict): Dictionaries of successfully loaded modules. + failed, failed_internal, failed_output (list): Lists of module names that failed to load. + + Raises: + ScanError: If any module dependencies fail to install or modules fail to load, and if self.force_start is False. + + Returns: + None + + Note: + After all modules are loaded, they are sorted by `_priority` and stored in the `modules` dictionary. """ if not self._modules_loaded: all_modules = list(set(self._scan_modules + self._output_modules + self._internal_modules))