mypy: Add type ignore in botserver/server.py.

This commit is contained in:
neiljp (Neil Pilgrim) 2019-11-06 08:06:19 -08:00 committed by Tim Abbott
parent 436b619021
commit fca2404b46

View file

@ -70,13 +70,14 @@ def parse_config_file(config_file_path: str) -> configparser.ConfigParser:
parser.read(config_file_path) parser.read(config_file_path)
return parser return parser
# TODO: Could we use the function from the bots library for this instead?
def load_module_from_file(file_path: str) -> ModuleType: def load_module_from_file(file_path: str) -> ModuleType:
# Wrapper around importutil; see https://stackoverflow.com/a/67692/3909240. # Wrapper around importutil; see https://stackoverflow.com/a/67692/3909240.
spec = importlib.util.spec_from_file_location("custom_bot_module", file_path) spec = importlib.util.spec_from_file_location("custom_bot_module", file_path)
lib_module = importlib.util.module_from_spec(spec) lib_module = importlib.util.module_from_spec(spec)
assert spec is not None assert spec is not None
assert spec.loader is not None assert spec.loader is not None
spec.loader.exec_module(lib_module) spec.loader.exec_module(lib_module) # type: ignore # FIXME: typeshed issue?
return lib_module return lib_module
def load_lib_modules(available_bots: List[str]) -> Dict[str, Any]: def load_lib_modules(available_bots: List[str]) -> Dict[str, Any]: