MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / PathToken

Class PathToken

lib/sqlalchemy/orm/path_registry.py:411–431  ·  view source on GitHub ↗

cacheable string token

Source from the content-addressed store, hash-verified

409
410
411class PathToken(orm_base.InspectionAttr, HasCacheKey, str):
412 """cacheable string token"""
413
414 _intern: Dict[str, PathToken] = {}
415
416 def _gen_cache_key(
417 self, anon_map: anon_map, bindparams: List[BindParameter[Any]]
418 ) -> Tuple[Any, ...]:
419 return (str(self),)
420
421 @property
422 def _path_for_compare(self) -> Optional[_PathRepresentation]:
423 return None
424
425 @classmethod
426 def intern(cls, strvalue: str) -> PathToken:
427 if strvalue in cls._intern:
428 return cls._intern[strvalue]
429 else:
430 cls._intern[strvalue] = result = PathToken(strvalue)
431 return result
432
433
434class _TokenRegistry(PathRegistry):

Callers 1

internMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected