Skip to content
This repository was archived by the owner on Aug 19, 2025. It is now read-only.

Commit e4c95a7

Browse files
committed
chore: changes for linting and typechecking
1 parent 4cd7451 commit e4c95a7

2 files changed

Lines changed: 5 additions & 2 deletions

File tree

databases/core.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import typing
66
from contextvars import ContextVar
77
from types import TracebackType
8-
from typing import Dict, Optional
8+
from typing import Dict
99
from urllib.parse import SplitResult, parse_qsl, unquote, urlsplit
1010

1111
from sqlalchemy import text
@@ -127,6 +127,7 @@ async def disconnect(self) -> None:
127127
self._global_connection = None
128128
else:
129129
task = asyncio.current_task()
130+
assert task is not None, "Not running in an asyncio task"
130131
connections = _get_connection_contextmap()
131132
if (self, task) in connections:
132133
del connections[self, task]
@@ -204,6 +205,7 @@ def connection(self) -> "Connection":
204205
return self._global_connection
205206

206207
task = asyncio.current_task()
208+
assert task is not None, "Not running in an asyncio task"
207209
connections = _get_connection_contextmap()
208210
if (self, task) not in connections:
209211
connections[self, task] = Connection(self._backend)

tests/test_databases.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,11 @@
22
import datetime
33
import decimal
44
import functools
5+
import itertools
56
import os
67
import re
78
from unittest.mock import MagicMock, patch
8-
import itertools
9+
910
import pytest
1011
import sqlalchemy
1112

0 commit comments

Comments
 (0)