cacheable string token
| 443 | |
| 444 | |
| 445 | class 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 | |
| 470 | PathToken._intern = {token: PathToken(token) for token in _PATH_TOKENS} |