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

Class PathToken

lib/sqlalchemy/orm/path_registry.py:445–467  ·  view source on GitHub ↗

cacheable string token

Source from the content-addressed store, hash-verified

443
444
445class PathToken(orm_base.InspectionAttr, HasCacheKey, str):
446 """cacheable string token"""
447
448 _intern: Mapping[str, PathToken]
449 """the :class:`.PathToken` for each of :data:`._PATH_TOKENS`.
450
451 this collection is fully populated below at module import time and is
452 never added to afterwards; it's typed as :class:`.Mapping` so that a
453 mutation is flagged by type checkers.
454 :meth:`.PathRegistry._deserialize_path` relies on it being complete,
455 distinguishing a token from a mapped attribute key by testing
456 membership here.
457
458 """
459
460 def _gen_cache_key(
461 self, anon_map: anon_map, bindparams: List[BindParameter[Any]]
462 ) -> Tuple[Any, ...]:
463 return (str(self),)
464
465 @property
466 def _path_for_compare(self) -> Optional[_PathRepresentation]:
467 return None
468
469
470PathToken._intern = {token: PathToken(token) for token in _PATH_TOKENS}

Callers 1

path_registry.pyFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected