diff options
| author | mike bayer <mike_mp@zzzcomputing.com> | 2022-07-19 19:38:59 +0000 |
|---|---|---|
| committer | Gerrit Code Review <gerrit@ci3.zzzcomputing.com> | 2022-07-19 19:38:59 +0000 |
| commit | d5e31d130808c94f09e51e9afb222c4efa63875c (patch) | |
| tree | adada8eb5fcb2683b4955336f7ac4b141df57cd2 /lib/sqlalchemy/sql | |
| parent | af4ee658d5ba5129066381d7870bc73a9ede523a (diff) | |
| parent | 3e3ea70df4a753e9f774f222d3722d2c9bfdbca7 (diff) | |
| download | sqlalchemy-d5e31d130808c94f09e51e9afb222c4efa63875c.tar.gz | |
Merge "fixes for mypy 0.971" into main
Diffstat (limited to 'lib/sqlalchemy/sql')
| -rw-r--r-- | lib/sqlalchemy/sql/__init__.py | 16 | ||||
| -rw-r--r-- | lib/sqlalchemy/sql/cache_key.py | 2 |
2 files changed, 10 insertions, 8 deletions
diff --git a/lib/sqlalchemy/sql/__init__.py b/lib/sqlalchemy/sql/__init__.py index c3ebb4596..5702d6c25 100644 --- a/lib/sqlalchemy/sql/__init__.py +++ b/lib/sqlalchemy/sql/__init__.py @@ -5,6 +5,7 @@ # This module is part of SQLAlchemy and is released under # the MIT License: https://www.opensource.org/licenses/mit-license.php from typing import Any +from typing import TYPE_CHECKING from .base import Executable as Executable from .compiler import COLLECT_CARTESIAN_PRODUCTS as COLLECT_CARTESIAN_PRODUCTS @@ -114,13 +115,14 @@ def __go(lcls: Any) -> None: from . import traversals from . import type_api - base.coercions = elements.coercions = coercions - base.elements = elements - base.type_api = type_api - coercions.elements = elements - coercions.lambdas = lambdas - coercions.schema = schema - coercions.selectable = selectable + if not TYPE_CHECKING: + base.coercions = elements.coercions = coercions + base.elements = elements + base.type_api = type_api + coercions.elements = elements + coercions.lambdas = lambdas + coercions.schema = schema + coercions.selectable = selectable from .annotation import _prepare_annotations from .annotation import Annotated diff --git a/lib/sqlalchemy/sql/cache_key.py b/lib/sqlalchemy/sql/cache_key.py index 5922c2db0..88148285c 100644 --- a/lib/sqlalchemy/sql/cache_key.py +++ b/lib/sqlalchemy/sql/cache_key.py @@ -272,7 +272,7 @@ class HasCacheKey: elif meth is ANON_NAME: elements = util.preloaded.sql_elements if isinstance(obj, elements._anonymous_label): - obj = obj.apply_map(anon_map) + obj = obj.apply_map(anon_map) # type: ignore result += (attrname, obj) elif meth is CALL_GEN_CACHE_KEY: result += ( |
