From 3dace4b1aa9c45cf9d0b5d0ba06956a832c35b8f Mon Sep 17 00:00:00 2001 From: Andrew Morgan Date: Wed, 25 Mar 2020 15:50:40 +0000 Subject: [PATCH] uh --- synapse/storage/engines/__init__.py | 7 ++----- 1 file 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