Skip to content
Snippets Groups Projects
Unverified Commit fbf0782c authored by David Vo's avatar David Vo Committed by GitHub
Browse files

Only import sqlite3 when type checking (#7155)


Fixes: #7127
Signed-off-by: default avatarDavid Vo <david@vovo.id.au>
parent 7496d3d2
No related branches found
No related tags found
No related merge requests found
Avoid importing `sqlite3` when using the postgres backend. Contributed by David Vo.
...@@ -12,14 +12,17 @@ ...@@ -12,14 +12,17 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
import sqlite3
import struct import struct
import threading import threading
import typing
from synapse.storage.engines import BaseDatabaseEngine from synapse.storage.engines import BaseDatabaseEngine
if typing.TYPE_CHECKING:
import sqlite3 # noqa: F401
class Sqlite3Engine(BaseDatabaseEngine[sqlite3.Connection]):
class Sqlite3Engine(BaseDatabaseEngine["sqlite3.Connection"]):
def __init__(self, database_module, database_config): def __init__(self, database_module, database_config):
super().__init__(database_module, database_config) super().__init__(database_module, database_config)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment