diff options
author | Patrick Cloke <clokep@users.noreply.github.com> | 2021-05-24 15:32:01 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-05-24 15:32:01 -0400 |
commit | 7adcb20fc02d614b4a2b03b128b279f25633e2bd (patch) | |
tree | 00bfca91a453c3611274f28a27d58b979ad9f104 /synapse/util/module_loader.py | |
parent | Fix docker image to not log at `/homeserver.log` (#10045) (diff) | |
download | synapse-7adcb20fc02d614b4a2b03b128b279f25633e2bd.tar.xz |
Add missing type hints to synapse.util (#9982)
Diffstat (limited to 'synapse/util/module_loader.py')
-rw-r--r-- | synapse/util/module_loader.py | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/synapse/util/module_loader.py b/synapse/util/module_loader.py index 8acbe276e4..cbfbd097f9 100644 --- a/synapse/util/module_loader.py +++ b/synapse/util/module_loader.py @@ -15,6 +15,7 @@ import importlib import importlib.util import itertools +from types import ModuleType from typing import Any, Iterable, Tuple, Type import jsonschema @@ -44,8 +45,8 @@ def load_module(provider: dict, config_path: Iterable[str]) -> Tuple[Type, Any]: # We need to import the module, and then pick the class out of # that, so we split based on the last dot. - module, clz = modulename.rsplit(".", 1) - module = importlib.import_module(module) + module_name, clz = modulename.rsplit(".", 1) + module = importlib.import_module(module_name) provider_class = getattr(module, clz) # Load the module config. If None, pass an empty dictionary instead @@ -69,11 +70,11 @@ def load_module(provider: dict, config_path: Iterable[str]) -> Tuple[Type, Any]: return provider_class, provider_config -def load_python_module(location: str): +def load_python_module(location: str) -> ModuleType: """Load a python module, and return a reference to its global namespace Args: - location (str): path to the module + location: path to the module Returns: python module object |