summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/sql/cache_key.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2022-03-13 13:37:11 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2022-03-15 21:38:29 -0400
commit6acf5d2fca4a988a77481b82662174e8015a6b37 (patch)
tree73e2868a51b8b7ac46d7b3b7f9562c1d011f6e1b /lib/sqlalchemy/sql/cache_key.py
parent35f82173e04b3209e07fcfc0606a7614108d018e (diff)
downloadsqlalchemy-6acf5d2fca4a988a77481b82662174e8015a6b37.tar.gz
pep-484 - SQL column operations
note we are taking out the ColumnOperartors[SQLCoreOperations] thing; not really clear why that was needed and at the moment it seems I was likely confused. Change-Id: I834b75f9b44f91b97e29f2e1a7b1029bd910e0a1
Diffstat (limited to 'lib/sqlalchemy/sql/cache_key.py')
-rw-r--r--lib/sqlalchemy/sql/cache_key.py14
1 files changed, 5 insertions, 9 deletions
diff --git a/lib/sqlalchemy/sql/cache_key.py b/lib/sqlalchemy/sql/cache_key.py
index fca58f98e..19a232c56 100644
--- a/lib/sqlalchemy/sql/cache_key.py
+++ b/lib/sqlalchemy/sql/cache_key.py
@@ -11,15 +11,14 @@ import enum
from itertools import zip_longest
import typing
from typing import Any
-from typing import cast
from typing import Dict
from typing import Iterator
from typing import List
+from typing import MutableMapping
from typing import NamedTuple
from typing import Optional
from typing import Sequence
from typing import Tuple
-from typing import Type
from typing import Union
from .visitors import anon_map
@@ -91,7 +90,7 @@ class HasCacheKey:
__slots__ = ()
_cache_key_traversal: Union[
- _TraverseInternalsType, Literal[CacheConst.NO_CACHE]
+ _TraverseInternalsType, Literal[CacheConst.NO_CACHE], Literal[None]
] = NO_CACHE
_is_has_cache_key = True
@@ -147,11 +146,8 @@ class HasCacheKey:
_cache_key_traversal = getattr(cls, "_cache_key_traversal", None)
if _cache_key_traversal is None:
try:
- # check for _traverse_internals, which is part of
- # HasTraverseInternals
- _cache_key_traversal = cast(
- "Type[HasTraverseInternals]", cls
- )._traverse_internals
+ assert issubclass(cls, HasTraverseInternals)
+ _cache_key_traversal = cls._traverse_internals
except AttributeError:
cls._generated_cache_key_traversal = NO_CACHE
return NO_CACHE
@@ -417,7 +413,7 @@ class CacheKey(NamedTuple):
def to_offline_string(
self,
- statement_cache: _CompiledCacheType,
+ statement_cache: MutableMapping[Any, str],
statement: ClauseElement,
parameters: _CoreSingleExecuteParams,
) -> str: