
    j1n                       U d Z ddlmZ ddlmZ ddlmZ ddlZddlZddl	m
Z
 ddl	mZ ddl	mZ dd	l	mZ dd
l	mZ ddl	mZ ddl	mZ ddl	mZ ddl	mZ ddl	mZ ddl	mZ ddl	mZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlm Z  ddl!m"Z" ddl!m#Z# erEddlm$Z$ ddl%m&Z& ddl'm(Z( ddl)m*Z* dd lm+Z+ dd!lm,Z, dd"l-m.Z. dd#l/m0Z0 dd$l!m1Z1 dd%l!m2Z2 dPd'Z3dQd(Z4n$ ejj                  d)      Z3 ejj                  d*      Z4ee
   Z6e7Z8ee8d+d,f   Z9ee9d-f   Z:ed+   Z;eed,e7f      Z< ejz                  e>      Z?dRd.Z@d/ZAd0eBd1<   d2ZCd3ZDd4eBd5<   d6ZEd7eBd8<    eFeAeCg      ZG	  eFd9 eDeEfD              ZH	 eGeHz  ZI	  G d: d&e       ZJ G d; d<eJ      ZK G d= d>eK      ZL eL       eJ_M         G d? d@ej                  e e7      ZOeHD  ci c]  } |  eO|        c} eO_P         G dA dBeJ      ZQ G dC dDeJ      ZR G dE dFeK      ZS G dG dHeS      ZT G dI dJee
e
f         ZU G dK dLeS      ZVer	 	 	 	 dQdMZWdSdNZXy ejj                  d*      ZW ejj                  dO      ZXyc c} w )Tz>Path tracking utilities, representing mapper graph traversals.    )annotations)reduce)chainN)Any)cast)Dict)Iterator)List)Mapping)Optional)overload)Sequence)Tuple)TYPE_CHECKING)Union   )base)insp_is_mapper_property   )exc)util)visitors)HasCacheKey)Final)Literal)_InternalEntityType)StrategizedProperty)Mapper)RelationshipProperty)AliasedInsp)_CacheKeyTraversalType)BindParameter)anon_map)_LiteralStar)	TypeGuardPathRegistryc                     y N paths    C/tmp/pip-target-jj7clzyk/lib/python/sqlalchemy/orm/path_registry.pyis_rootr-   1           c                     y r(   r)   r*   s    r,   	is_entityr1   3   r.   r/   r-   r1   _InternalEntityType[Any]StrategizedProperty[Any].c                ,    t         j                  |       S r(   )r&   deserializer*   s    r,   _unreduce_pathr6   Q   s    ##D))r/   *r$   _WILDCARD_TOKEN_sa_defaultrelationshipzFinal[Literal['relationship']]_RELATIONSHIP_TOKENcolumnzFinal[Literal['column']]_COLUMN_TOKENc              #  L   K   | ]  }t         t        fD ]  }| d |    yw):N)r8   _DEFAULT_TOKEN).0wildcard_keysuffixs      r,   	<genexpr>rD   d   s=      "N3 	 nAfXs   "$c                  v   e Zd ZU dZdZdZdZdZdZdZ	de
d<   de
d<   de
d<   d	e
d
<   de
d<   dej                  j                  fgZde
d<   d/dZd/dZed0d       Zd1dZd2dZ	 	 	 	 	 	 	 	 d2dZ	 d3	 	 	 	 	 	 	 d4dZd5dZd5dZed6d       Zed7d       Zed8d       Ze	 	 	 	 d9d       Ze	 	 	 	 d:d       Z	 	 	 	 d;dZed5d       Z	 	 d<d Zd=d!Zd>d"Zd?d#Ze d@d$       Z!e dAd%       Z"dBd&Z#e dCd'       Z$ee dDd(              Z%ee dEd)              Z%e 	 	 	 	 dFd*       Z%e dGd+       Z&dHd,Z'dId-Z(dId.Z)y)Jr&   a  Represent query load paths and registry functions.

    Basically represents structures like:

    (<User mapper>, "orders", <Order mapper>, "items", <Item mapper>)

    These structures are generated by things like
    query options (joinedload(), subqueryload(), etc.) and are
    used to compose keys stored in the query._attributes dictionary
    for various options.

    They are then re-composed at query compile/result row time as
    the query is formed and as rows are fetched, where they again
    serve to compose keys to look up options in the context.attributes
    dictionary, which is copied from query._attributes.

    The path structure has a limited amount of caching, where each
    "root" ultimately pulls from a fixed registry associated with
    the first mapper, that also contains elements for each of its
    property keys.  However paths longer than two elements, which
    are the exception rather than the rule, are generated on an
    as-needed basis.

    r)   Fboolis_unnatural_PathRepresentationr+   natural_pathzOptional[PathRegistry]parentRootRegistryrootr!   _cache_key_traversalc                    	 |d uxr | j                   |j                  k(  S # t        $ r$ t        j                  dt        |      z         Y yw xY w)N1Comparison of PathRegistry to %r is not supportedFr+   _path_for_compareAttributeErrorr   warntypeselfothers     r,   __eq__zPathRegistry.__eq__   sU    	$Me6M6M)MM 	IIC;  	   ! *AAc                    	 |d u xs | j                   |j                  k7  S # t        $ r$ t        j                  dt        |      z         Y yw xY w)NrO   TrP   rU   s     r,   __ne__zPathRegistry.__ne__   sT    	D=HDII1H1H$HH 	IIC;  	rY   c                    | j                   S r(   r*   rV   s    r,   rQ   zPathRegistry._path_for_compare   s    yyr/   c                     | j                   |   S r(   r*   )rV   indexs     r,   odd_elementzPathRegistry.odd_element   s    yyr/   c                V    t         j                  d|| |       |||| j                  f<   y )Nzset '%s' on path '%s' to '%s')logdebugrI   rV   
attributeskeyvalues       r,   setzPathRegistry.set   s*    		13eD/4
C**+,r/   c                p    t         j                  d|| |       |j                  || j                  f|       y )Nz$setdefault '%s' on path '%s' to '%s')rb   rc   
setdefaultrI   rd   s       r,   rj   zPathRegistry.setdefault   s2     			8#tUKsD$5$56>r/   Nc                4    || j                   f}||v r||   S |S r(   )rI   rd   s       r,   getzPathRegistry.get   s+     D%%&*c?"Lr/   c                ,    t        | j                        S r(   lenr+   r]   s    r,   __len__zPathRegistry.__len__   s    499~r/   c                    t        |       S r(   )idr]   s    r,   __hash__zPathRegistry.__hash__   s    $xr/   c                     y r(   r)   rV   entitys     r,   __getitem__zPathRegistry.__getitem__   s    CFr/   c                     y r(   r)   ru   s     r,   rw   zPathRegistry.__getitem__   s    <?r/   c                     y r(   r)   ru   s     r,   rw   zPathRegistry.__getitem__   s    ADr/   c                     y r(   r)   ru   s     r,   rw   zPathRegistry.__getitem__   s     "%r/   c                     y r(   r)   ru   s     r,   rw   zPathRegistry.__getitem__   s     r/   c                    t               r(   )NotImplementedErrorru   s     r,   rw   zPathRegistry.__getitem__   s      "##r/   c                ,    t        | j                        S r(   rn   r]   s    r,   lengthzPathRegistry.length  s    499~r/   c              #     K   t        t        | j                        }t        t        |      }t	        dt        |      d      D ]  }||   ||dz      f  y w)Nr   r   r   )r   _OddPathRepresentationr+   _EvenPathRepresentationrangero   )rV   odd_path	even_pathis       r,   pairszPathRegistry.pairs  sZ     
 .		:0(;	q#h-+ 	0A1+yQ///	0s   AAc                    t        t        | j                        }t        dt	        |      d      D cg c]  }||   	 c}D ]  }|j
                  j                  |      s y yc c}w )Nr   r   TF)r   r   r+   r   ro   mapperisa)rV   r   _m_pathr   path_mappers        r,   contains_mapperzPathRegistry.contains_mapper  s`    -tyy905aWq0IJ1GAJJ 	K!!%%f-	 	 Ks   A%c                "    || j                   f|v S r(   r*   )rV   re   rf   s      r,   containszPathRegistry.contains  s    TYY:--r/   c                0    t         | j                         ffS r(   )r6   	serializer]   s    r,   
__reduce__zPathRegistry.__reduce__  s     0222r/   c                Z   t        t        |      }t        t        |      }t        t	        t        d t        dt        |      d      D cg c]  }||   	 c}D              t        d t        dt        |      d      D cg c]  }||   	 c}D              dz               S c c}w c c}w )Nc              3  z   K   | ]3  }|j                   s|j                  r|j                  n
t        |       5 y wr(   )	is_mapperis_aliased_classclass_str)rA   ms     r,   rD   z/PathRegistry._serialize_path.<locals>.<genexpr>%  s3       "#0B0BAHHQOs   9;r   r   c              3  `   K   | ]&  }t        |      r|j                  n
t        |       ( y wr(   )r   rf   r   )rA   ps     r,   rD   z/PathRegistry._serialize_path.<locals>.<genexpr>)  s,       5Q7AEESVCs   ,.r   r(   )r   r   r   listziptupler   ro   )clsr+   r   _p_pathr   s        r,   _serialize_pathzPathRegistry._serialize_path  s    -t4.5 273w<2KLQgajL   273w<2KLQgajL  	

 	
 M Ms   
B# B(c                    dd}dd}t        t        |D cg c]  \  }} ||       |||      f c}}       }|r
|d   |dd }|S c c}}w )Nc                z    | t         j                  vrt        j                  | d      S t         j                  |    S NT)	configure)	PathToken_internorm_base_inspect_mapped_class)mclss    r,   _deserialize_mapper_tokenzAPathRegistry._deserialize_path.<locals>._deserialize_mapper_token3  s>    
 y000 ..ttD
 &&t,r/   c                    |y |t         j                  v rt         j                  |   S t        j                  | d      }|J |j                  |   S r   )r   r   r   r   attrs)r   rf   mps      r,   _deserialize_key_tokenz>PathRegistry._deserialize_path.<locals>._deserialize_key_token<  sS    {	))) ((--33DDI~%~xx}$r/   r   )r   r   returnr   )r   r   rf   r   r   r   )r   r   )r   r+   r   r   r   rf   r   s          r,   _deserialize_pathzPathRegistry._deserialize_path1  st    		%  &*
 "c 2$7.tS9

 2!BAs   A
c                <    | j                   }| j                  |      S r(   )r+   r   )rV   r+   s     r,   r   zPathRegistry.serializeU  s    yy##D))r/   c                N    |J | j                  |      }| j                  |      S r(   )r   coerce)r   r+   r   s      r,   r5   zPathRegistry.deserializeY  s,    !!$'zz!}r/   c                     y r(   r)   r   r   s     r,   
per_mapperzPathRegistry.per_mapper_  s    GJr/   c                     y r(   r)   r   s     r,   r   zPathRegistry.per_mapperc  s    JMr/   c                r    |j                   rt        | j                  |      S t        | j                  |      S r(   )r   CachingEntityRegistryrL   SlotsEntityRegistryr   s     r,   r   zPathRegistry.per_mapperg  s/     (6::&sxx88r/   c                8    dd}t        ||| j                        S )Nc                    | |   S r(   r)   prevnext_s     r,   _redz!PathRegistry.coerce.<locals>._redr      ;r/   r   r&   r   _PathElementTyper   r&   )r   rL   )r   rawr   s      r,   r   zPathRegistry.coercep  s    	 dC**r/   c                8    dd}t        ||j                  |       S )Nc                    | |   S r(   r)   r   s     r,   r   z"PathRegistry.__add__.<locals>._redy  r   r/   r   )r   r+   )rV   rW   r   s      r,   __add__zPathRegistry.__add__x  s    	 dEJJ--r/   c                N    ddj                  d | j                  D               dS )Nz	ORM Path[z -> c              3  2   K   | ]  }t        |        y wr(   r   )rA   elems     r,   rD   z'PathRegistry.__str__.<locals>.<genexpr>  s     &GTs4y&Gs   ])joinr+   r]   s    r,   __str__zPathRegistry.__str__~  s%    6;;&GTYY&GGHJJr/   c                N    | j                   j                   d| j                  dS )N())	__class____name__r+   r]   s    r,   __repr__zPathRegistry.__repr__  s$    ..))*!DII=::r/   )rW   r   r   rF   r   zOptional[_PathRepresentation])r_   intr   r2   )re   Dict[Any, Any]rf   r   rg   r   r   Noner(   )re   r   rf   r   rg   zOptional[Any]r   r   )r   r   )rv   _StrPathTokenr   TokenRegistry)rv   r   r   r   )rv   slicer   rH   )rv   r2   r   AbstractEntityRegistry)rv   r3   r   PropRegistry)rv   zTUnion[_StrPathToken, int, slice, _InternalEntityType[Any], StrategizedProperty[Any]]r   zaUnion[TokenRegistry, _PathElementType, _PathRepresentation, PropRegistry, AbstractEntityRegistry])r   zOIterator[Tuple[_InternalEntityType[Any], Union[str, StrategizedProperty[Any]]]])r   Mapper[Any]r   rF   )re   r   rf   r   r   rF   )r   r   )r+   rH   r   _SerializedPath)r+   r   r   rH   )r   r   r+   r   r   r&   )r   r   r   r   )r   AliasedInsp[Any]r   r   )r   r2   r   r   )r   rH   r   r&   )rW   r&   r   r&   )r   r   )*r   
__module____qualname____doc__	__slots__is_tokenr-   
has_entityis_propertyr1   __annotations__r   ExtendedInternalTraversaldp_has_cache_key_listrM   rX   r[   propertyrQ   r`   rh   rj   rl   rp   rs   r   rw   r   r   r   r   r   classmethodr   r   r   r5   r   r   r   r   r   r)   r/   r,   r&   r&   {   sa   2 IHGJKI
%%""
 
33IIJ40    5?(?/2?;>?	? LP(/2;H	 F F? ?D D%.%	% % .	 $
$
$&  0
0.3 
 
$ ! !F*  
 J  JM  M9-9	9 9 + +.K;r/   c                  .    e Zd ZU dZded<   ded<   ddZy)CreatesTokenr)   rF   r   r-   c                    |t         j                  vrt        j                  d|       |j	                  dt
               rt        | |      S t        | j                  |      S )Nzinvalid token: r?   )r   r   r   ArgumentErrorendswithr8   r   rL   )rV   tokens     r,   r   zCreatesToken.token  sZ    	)))##oeW$=>>^^a012 u-- E22r/   N)r   r   r   r   )r   r   r   r   r   r   r)   r/   r,   r   r     s    IM3r/   r   c                  R    e Zd ZdZdZdZdxZZdZdZ	dZ
dZ	 	 	 	 ddZd	dZeseZyy)
rK   zXRoot registry, defers to mappers so that
    paths are maintained per-root-mapper.

    r)   TFc                    |t         j                  v r5t        rt        |t              sJ t        | t         j                  |         S 	 |j                  S # t        $ r t        d|       w xY w)Nz/invalid argument for RootRegistry.__getitem__: )	r   r   r   
isinstancer   r   _path_registryrR   
IndexErrorru   s     r,   _getitemzRootRegistry._getitem  st     Y&&&!&-888 y'8'8'@AA,,,!  EfXN s   	A A-c                    | S r(   r)   r]   s    r,   _truncate_recursivez RootRegistry._truncate_recursive  s    r/   N)rv   r   r   z,Union[TokenRegistry, AbstractEntityRegistry])r   rK   )r   r   r   r   r   inherit_cacher+   rI   r   r   r-   rG   r   r   r   rw   r)   r/   r,   rK   rK     s[    
 IMD<JGL	5  r/   rK   c                  D    e Zd ZU dZded<   	 	 	 	 	 	 	 ddZedd       Zy)	r   zcacheable string tokenzMapping[str, PathToken]r   c                    t        |       fS r(   r   )rV   r#   
bindparamss      r,   _gen_cache_keyzPathToken._gen_cache_key  s     D	|r/   c                     y r(   r)   r]   s    r,   rQ   zPathToken._path_for_compare  s    r/   N)r#   r#   r  zList[BindParameter[Any]]r   zTuple[Any, ...]r   )r   r   r   r   r   r  r   rQ   r)   r/   r,   r   r     sA     $$	 .F	
  r/   r   c                  `    e Zd ZU dZdZded<   ded<   ddZdZdZdd	Z		 	 dd
Z
ddZeseZyy)r   )r   rJ   r+   rI   Tr   r   r   rJ   c                    t         j                  |   }|| _        || _        |j                  |fz   | _        |j
                  |fz   | _        y r(   )r   r   r   rJ   r+   rI   )rV   rJ   r   s      r,   __init__zTokenRegistry.__init__  sG    !!%(
KK5(*	"//5(:r/   Fc              #    K   | j                   }t        |      r|  y t        rt        |t              sJ |j
                  sE|j                  j                         D ]'  }t        |j                   |   | j                         ) y |j
                  rot        d|j                        j                  rO|  t        d|j                        j                  D ]'  }t        |j                   |   | j                         ) y |  y wNr   )rJ   r-   r   r   r   r   r   iterate_to_rootr   r   r   rv   _is_with_polymorphic_with_polymorphic_entitiesrV   rJ   mp_entents       r,   generate_for_superclassesz'TokenRegistry.generate_for_superclasses  s     6?Jf&<===&& --779 G#FMM&$94::FFG ##" #"#
 J"FMM((D $FMM#$6

CCD
 Js   DDc              #  ^  K   | j                   }t        |      r| j                   y t        rt	        |t
              sJ |j                  j                         D ]1  }t        |j                   |   | j                        j                   3 |j                  rt        d|j                        j                  rc| j                   t        d|j                        j                  D ]1  }t        |j                   |   | j                        j                   3 y | j                   y wr  )rJ   r-   rI   r   r   r   r   r	  r   r   r   r   rv   r
  r  r  s       r,   "_generate_natural_for_superclassesz0TokenRegistry._generate_natural_for_superclasses  s     6?###f&<===mm335 	PFf 5tzzBOOO	P ##" #"#
 ###"FMM(( "&--"4djjANN ###s   D+D-c                ^    	 | j                   |   S # t        $ r}t        |       |d }~ww xY wr(   )r+   	TypeErrorr   )rV   rv   errs      r,   r   zTokenRegistry._getitem%  s5    	399V$$ 	3x)s2	3s    	,',N)rJ   r   r   r   )r   zIterator[PathRegistry])r   zIterator[_PathRepresentation]rv   r   r   r   )r   r   r   r   r   r   r  r   r   r  r  r   r   rw   r)   r/   r,   r   r     sO    ;IM; JH6$	&$:3  r/   r   c                  |    e Zd ZU dZdZdZded<   ded<   ded<   	 	 	 	 dd	Zdd
Ze	dd       Z
	 	 	 	 ddZeseZyy)r   )proprJ   r+   rI   r   rv   r   _wildcard_path_loader_key_default_path_loader_key_loader_keyrG   Tr3   r  zOptional[Mapper[Any]]r   z"Optional[_InternalEntityType[Any]]rv   c                   t        d|d         }|}|j                  j                  xs t        |j                  j
                        | _        |j                  r|j                  r|j                  |j                     x}}n|j                  r|j                  ru|j                  |j                  v r]|d   j                  |j                        }|j                  |   }|j                  r!|j                  |j                     }d| _        nq|}nn|j                  rb|j                  rV|j                  |j                  ur>|j                  j                  |j                        r|j                  |j                     }|| _        || _        |j                  |fz   | _        |j                  |fz   | _        |j                  | _        |j                   r;t"        rt%        |t&              sJ |j(                  | _        |j                  | _        nd | _        d | _        d|j                  | j                  j*                  z   f| _        | j                  j.                  | _        d| j                  f| _        y )Nr2   r   Tloader)r   rJ   rG   rF   r   inheritsr   _use_mapper_pathwith_polymorphic_mappers_entity_for_mapperr   r  r+   rI   _links_to_entityr   _is_relationshipr   r   r   rv   _wildcard_tokenr  r  r  )rV   rJ   r  inspnatural_parentsubclass_entitys         r,   r  zPropRegistry.__init__D  s    .r
;17 #MM66 
$MM"";
 $$(=(=&,mmDKK&@@F^!!--t<<<8>r
8U8UVZVaVa8bO]]?3F@ }}!'/E/E!F$(!!'!!%%;;,#]]4;;7N	KK4')	*774'A//  !$(<===++DK++DKDKDK $))";";;*
& )-		(J(J%$d&7&78r/   c                    d }t        t        | j                  d d             D ]  \  }}|| j                  u s|} || S | j	                  | j                  d|dz           S )Nr   r   r   )	enumeratereversedr+   r  r   )rV   earliestr   r   s       r,   r   z PropRegistry._truncate_recursive  sl    !(499Sb>":; 	HAu		!	 K;;tyyx!|_=>>r/   c                <    | j                   J | | j                      S r(   )rv   r]   s    r,   entity_pathzPropRegistry.entity_path  s!    {{&&&DKK  r/   c                d    t        |t        t        f      r| j                  |   S t	        | |      S r(   )r   r   r   r+   r   ru   s     r,   r   zPropRegistry._getitem  s.     fsEl+99V$$&tV44r/   N)rJ   r   r  r3   )r   r   r   r   )rv   z+Union[int, slice, _InternalEntityType[Any]]r   zDUnion[AbstractEntityRegistry, _PathElementType, _PathRepresentation])r   r   r   r   r   r   r   r  r   r   r,  r   r   rw   r)   r/   r,   r   r   /  s}    I MK
""!!..X9,X94LX9t	? ! !5A5	M5  r/   r   c                      e Zd ZU dZdZdZded<   ded<   ded<   ded	<   	 	 	 	 dd
ZddZe	dd       Z
e	dd       Ze	dd       ZddZ	 	 	 	 ddZeseZyy)r   )rf   rJ   r   r+   rv   rI   T!Union[RootRegistry, PropRegistry]rJ   r2   rf   rv   rF   r   c                   || _         || _        |j                  | _        || _        |j                  |fz   | _        |j                  r| j                  s|j
                  r|j                  d   }|j                  j                  |j                        s%|j                  j                  |j                        r |j                  |j                  fz   | _        y |j                  |j                  fz   | _        y | j                  | _        y )Nr   )	rf   rJ   r   rv   r+   rG   rI   r   r   )rV   rJ   rv   parent_natural_entitys       r,   r  zAbstractEntityRegistry.__init__  s    
  & 7 7KK6)+	$ ;;D11V5H5H %+$7$7$;!}}  %,,&--11 %+$7$76==:J$J!$*$7$7)00; %! !%		Dr/   c                P    | j                   j                         | j                     S r(   )rJ   r   rv   r]   s    r,   r   z*AbstractEntityRegistry._truncate_recursive	  s    {{..0==r/   c                $    | j                  d      S )Nr   )r`   r]   s    r,   root_entityz"AbstractEntityRegistry.root_entity  s    ""r/   c                    | S r(   r)   r]   s    r,   r,  z"AbstractEntityRegistry.entity_path  s    r/   c                .    | j                   j                  S r(   )rv   r   r]   s    r,   r   zAbstractEntityRegistry.mapper  s    {{!!!r/   c                     y)NTr)   r]   s    r,   __bool__zAbstractEntityRegistry.__bool__  s    r/   c                    t        |t        t        f      r| j                  |   S |t        j
                  v rt        | t        j
                  |         S t        | |      S r(   )r   r   r   r+   r   r   r   r   ru   s     r,   r   zAbstractEntityRegistry._getitem  sT     fsEl+99V$$y((( y'8'8'@AAf--r/   NrJ   r0  rv   r2   r.  )r   r2   )r   r&   )r   r   )r   rF   )rv   r   r   z:Union[_PathElementType, _PathRepresentation, PathRegistry])r   r   r   r   r   r1   r   r  r   r   r5  r,  r   r9  r   r   rw   r)   r/   r,   r   r     s    I JI--	!!$$;*1;* );*z> # #   " "..	C.  r/   r   c                      e Zd ZdZy)r   TN)r   r   r   r   r)   r/   r,   r   r   )  s	     Mr/   r   c                      e Zd ZddZddZy)_ERDictc                    || _         y r(   )registry)rV   r@  s     r,   r  z_ERDict.__init__0  s	     r/   c                <    t        | j                  |      x| |<   }|S r(   )r   r@  )rV   rf   items      r,   __missing__z_ERDict.__missing__3  s     's;;S	Dr/   N)r@  r   )rf   r   r   r   )r   r   r   r  rC  r)   r/   r,   r>  r>  /  s    !r/   r>  c                  P     e Zd ZdZdZ	 	 	 	 d fdZddZddZeseZ	 xZ
S  xZ
S )	r   )_cacheTc                F    t         |   ||       t        |       | _        y r(   )superr  r>  rE  )rV   rJ   rv   r   s      r,   r  zCachingEntityRegistry.__init__A  s    
 	(dmr/   c                :    | j                   j                  ||      S r(   )rE  pop)rV   rf   defaults      r,   rI  zCachingEntityRegistry.popI  s    {{sG,,r/   c                    t        |t        t        f      r| j                  |   S t        |t              rt        | |      S | j                  |   S r(   )r   r   r   r+   r   r   rE  ru   s     r,   r   zCachingEntityRegistry._getitemL  sE    fsEl+99V$$	* v..;;v&&r/   r;  )rf   r   rJ  r   r   r   r  )r   r   r   r   r   r  rI  r   r   rw   __classcell__)r   s   @r,   r   r   9  s?     IM$1$ )$-'  r/   r   c                     y r(   r)   r*   s    r,   path_is_entityrN  Z  s    ,/r/   c                     y r(   r)   r*   s    r,   path_is_propertyrP  ^  r.   r/   r   )r+   r&   r   zTypeGuard[RootRegistry])r+   r&   r   z!TypeGuard[AbstractEntityRegistry]r   )r+   r&   r   zTypeGuard[PropRegistry])Yr   
__future__r   	functoolsr   	itertoolsr   loggingoperatortypingr   r   r   r	   r
   r   r   r   r   r   r   r    r   r   _typingr   r   r   sqlr   sql.cache_keyr   util.typingr   r   r   
interfacesr   r   r   relationshipsr   r    r!   sql.elementsr"   sql.visitorsr#   r$   r%   r-   r1   
attrgetterr   r   r   r   rH   r   r   	getLoggerr   rb   r6   r8   r   r@   r;   r=   	frozenset_UNPREFIXED_TOKENS_PATH_TOKENS_ACCEPTED_TOKENSr&   r   rK   rL   InspectionAttrr   r   r   r   r   r   r>  r   rN  rP  )r   s   0r,   <module>rg     s   E "                   ,    '  !,/3!6,'*'CO "h!!),G###K0I s)-/II  ,c12  ""<= "5)CS)H#IJ  g!* !$ #6D 3 D*2' 2@A   ,m< 
 &4 G;; G;T3< 3#< #L !N ''c 2 ;GGUIe,,G	 SL SlH< HVl\ l^0 d38n 2 > 00	*0 M )X((5N*x**=9Y Hs   >I