MCPcopy Create free account
hub / github.com/sqlalchemy/sqlalchemy / _gen_cache_key

Method _gen_cache_key

lib/sqlalchemy/sql/lambdas.py:394–420  ·  view source on GitHub ↗
(self, anon_map, bindparams)

Source from the content-addressed store, hash-verified

392 return expr
393
394 def _gen_cache_key(self, anon_map, bindparams):
395 if self.closure_cache_key is _cache_key.NO_CACHE:
396 anon_map[_cache_key.NO_CACHE] = True
397 return None
398
399 cache_key = (
400 self.fn.__code__,
401 self.__class__,
402 ) + self.closure_cache_key
403
404 parent = self.parent_lambda
405
406 while parent is not None:
407 assert parent.closure_cache_key is not CacheConst.NO_CACHE
408 parent_closure_cache_key: Tuple[Any, ...] = (
409 parent.closure_cache_key
410 )
411
412 cache_key = (
413 (parent.fn.__code__,) + parent_closure_cache_key + cache_key
414 )
415
416 parent = parent.parent_lambda
417
418 if self._resolved_bindparams:
419 bindparams.extend(self._resolved_bindparams)
420 return cache_key
421
422 def _invoke_user_fn(self, fn: _AnyLambdaType, *arg: Any) -> ClauseElement:
423 return fn() # type: ignore[no-any-return]

Callers 1

getMethod · 0.45

Calls 1

extendMethod · 0.45

Tested by

no test coverage detected