@classmethod
def checkout(cls, pool: Pool) -> _ConnectionFairy:
- rec = cast(_ConnectionRecord, pool._do_get())
+ if TYPE_CHECKING:
+ rec = cast(_ConnectionRecord, pool._do_get())
+ else:
+ rec = pool._do_get()
+
try:
dbapi_connection = rec.get_connection()
except Exception as err:
from typing import Optional
from typing import Set
from typing import Type
+from typing import TYPE_CHECKING
from typing import Union
import weakref
def _do_get(self) -> ConnectionPoolEntry:
try:
- c = cast(ConnectionPoolEntry, self._conn.current())
+ if TYPE_CHECKING:
+ c = cast(ConnectionPoolEntry, self._conn.current())
+ else:
+ c = self._conn.current()
if c:
return c
except AttributeError:
from typing import Set
from typing import Tuple
from typing import Type
+from typing import TYPE_CHECKING
from typing import Union
from . import base
else:
schema_prefix = ""
- tablename = cast("NamedFromClause", table).name
+ if TYPE_CHECKING:
+ assert isinstance(table, NamedFromClause)
+ tablename = table.name
if (
not effective_schema
# TEST: test.aaa_profiling.test_orm.JoinedEagerLoadTest.test_fetch_results
-test.aaa_profiling.test_orm.JoinedEagerLoadTest.test_fetch_results x86_64_linux_cpython_3.10_sqlite_pysqlite_dbapiunicode_cextensions 431905
-test.aaa_profiling.test_orm.JoinedEagerLoadTest.test_fetch_results x86_64_linux_cpython_3.10_sqlite_pysqlite_dbapiunicode_nocextensions 450605
+test.aaa_profiling.test_orm.JoinedEagerLoadTest.test_fetch_results x86_64_linux_cpython_3.10_sqlite_pysqlite_dbapiunicode_cextensions 440705
+test.aaa_profiling.test_orm.JoinedEagerLoadTest.test_fetch_results x86_64_linux_cpython_3.10_sqlite_pysqlite_dbapiunicode_nocextensions 458805
# TEST: test.aaa_profiling.test_orm.LoadManyToOneFromIdentityTest.test_many_to_one_load_identity