summary refs log tree commit diff
diff options
context:
space:
mode:
authorAndrew Morgan <andrew@amorgan.xyz>2020-03-25 15:50:40 +0000
committerAndrew Morgan <andrew@amorgan.xyz>2020-03-25 15:50:40 +0000
commit3dace4b1aa9c45cf9d0b5d0ba06956a832c35b8f (patch)
tree3831e77021823de02989d424a331b07ce46230f4
parentPossibly appease mypy (diff)
downloadsynapse-anoa/mypy_sqlite3_check.tar.xz
-rw-r--r--synapse/storage/engines/__init__.py7
1 files changed, 2 insertions, 5 deletions
diff --git a/synapse/storage/engines/__init__.py b/synapse/storage/engines/__init__.py
index 396143c66c..41d3ccd25b 100644
--- a/synapse/storage/engines/__init__.py
+++ b/synapse/storage/engines/__init__.py
@@ -17,21 +17,18 @@ import platform
 from ._base import BaseDatabaseEngine, IncorrectDatabaseSetup
 
 MYPY = False
-if MYPY:
-    from .sqlite import Sqlite3Engine
-    from .postgres import PostgresEngine
 
 
 def create_engine(database_config) -> BaseDatabaseEngine:
     name = database_config["name"]
 
-    if name == "sqlite3":
+    if name == "sqlite3" or MYPY:
         import sqlite3
         from .sqlite import Sqlite3Engine
 
         return Sqlite3Engine(sqlite3, database_config)
 
-    if name == "psycopg2":
+    if name == "psycopg2" or MYPY:
         # pypy requires psycopg2cffi rather than psycopg2
         if platform.python_implementation() == "PyPy":
             import psycopg2cffi as psycopg2  # type: ignore