mirror of
https://github.com/element-hq/synapse.git
synced 2024-12-22 20:50:23 +03:00
uh
This commit is contained in:
parent
4ac60a17a5
commit
3dace4b1aa
1 changed files with 2 additions and 5 deletions
|
@ -17,21 +17,18 @@ import platform
|
||||||
from ._base import BaseDatabaseEngine, IncorrectDatabaseSetup
|
from ._base import BaseDatabaseEngine, IncorrectDatabaseSetup
|
||||||
|
|
||||||
MYPY = False
|
MYPY = False
|
||||||
if MYPY:
|
|
||||||
from .sqlite import Sqlite3Engine
|
|
||||||
from .postgres import PostgresEngine
|
|
||||||
|
|
||||||
|
|
||||||
def create_engine(database_config) -> BaseDatabaseEngine:
|
def create_engine(database_config) -> BaseDatabaseEngine:
|
||||||
name = database_config["name"]
|
name = database_config["name"]
|
||||||
|
|
||||||
if name == "sqlite3":
|
if name == "sqlite3" or MYPY:
|
||||||
import sqlite3
|
import sqlite3
|
||||||
from .sqlite import Sqlite3Engine
|
from .sqlite import Sqlite3Engine
|
||||||
|
|
||||||
return Sqlite3Engine(sqlite3, database_config)
|
return Sqlite3Engine(sqlite3, database_config)
|
||||||
|
|
||||||
if name == "psycopg2":
|
if name == "psycopg2" or MYPY:
|
||||||
# pypy requires psycopg2cffi rather than psycopg2
|
# pypy requires psycopg2cffi rather than psycopg2
|
||||||
if platform.python_implementation() == "PyPy":
|
if platform.python_implementation() == "PyPy":
|
||||||
import psycopg2cffi as psycopg2 # type: ignore
|
import psycopg2cffi as psycopg2 # type: ignore
|
||||||
|
|
Loading…
Reference in a new issue