Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Relax ignore-missing-imports for modules that have stubs now and update mypy #11006

Merged
merged 15 commits into from
Oct 8, 2021
Prev Previous commit
Next Next commit
Explicit error for spec is None
David Robertson committed Oct 8, 2021

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
commit 57ba17db36f845ad4b393fd8264e84e67cf01d41
5 changes: 4 additions & 1 deletion synapse/storage/prepare_database.py
Original file line number Diff line number Diff line change
@@ -487,7 +487,10 @@ def _upgrade_existing_database(
spec = importlib.util.spec_from_file_location(
module_name, absolute_path
)
assert spec is not None
if spec is None:
raise RuntimeError(
f"Could not build a module spec for {module_name} at {absolute_path}"
)
module = importlib.util.module_from_spec(spec)
spec.loader.exec_module(module) # type: ignore