cacheable string token
| 409 | |
| 410 | |
| 411 | class 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 | |
| 434 | class _TokenRegistry(PathRegistry): |