
    [h<e                    .   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 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+m,Z, dd!l-m.Z. dd"l-m/Z/ dLd'Z0dMd)Z1n  ej2        d*          Z0 ej2        d+          Z1ee
         Z3e4Z5ee5d,d-f         Z6ee6d.f         Z7ed,         Z8eed-e4f                  Z9 ej:        e;          Z<dNd0Z=d1Z>d2e?d3<   d4Z@ G d5 d$e          ZA G d6 d7eA          ZB G d8 d9eB          ZC eC            eA_D         G d: d;ejE        ee4          ZF G d< d=eA          ZG G d> d?eA          ZH G d@ dAeB          ZI G dB dCeI          ZJ G dD dEee
e
f                   ZK G dF dGeI          ZLer
dMdHZMdOdJZNdS  ej2        d+          ZM ej2        dK          ZNdS )Pz@Path tracking utilities, representing mapper graph traversals.

    )annotations)reduce)chainN)Any)cast)Dict)Iterator)List)Optional)overload)Sequence)Tuple)TYPE_CHECKING)Union   )base)insp_is_mapper_property   )exc)util)visitors)HasCacheKey)_InternalEntityType)StrategizedProperty)Mapper)RelationshipProperty)AliasedInsp)_CacheKeyTraversalType)BindParameter)anon_map)_LiteralStar)	TypeGuardpathPathRegistryreturnTypeGuard[RootRegistry]c                    d S N r#   s    k/var/www/api.easyaligner.net/htdocs/venv_linux/lib/python3.11/site-packages/sqlalchemy/orm/path_registry.pyis_rootr,   0             !TypeGuard[AbstractEntityRegistry]c                    d S r(   r)   r*   s    r+   	is_entityr1   2   r-   r.   r,   r1   _InternalEntityType[Any]StrategizedProperty[Any]._SerializedPathc                6    t                               |           S r(   )r$   deserializer*   s    r+   _unreduce_pathr7   P   s    ##D)))r.   *r!   _WILDCARD_TOKEN_sa_defaultc                     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<   dOdZdOdZedPd            ZdQdZdRdZdRd Z	 dSdTd#ZdUd$ZdUd%ZedVd)            ZedWd+            ZedXd-            ZedYd/            ZedZd2            Zd[d5ZedUd6            Zd\d8Zd]d;Zd^d<Zd_d=Ze d`d?            Z!e dad@            Z"dbdAZ#e dcdB            Z$ee dddD                        Z%ee dedG                        Z%e dfdH            Z%e dgdJ            Z&dhdKZ'didMZ(didNZ)d!S )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_traversalotherr   r%   c                    	 |d uo| j         |j        k    S # t          $ r( t          j        dt          |          z             Y dS w xY w)N1Comparison of PathRegistry to %r is not supportedFr#   _path_for_compareAttributeErrorr   warntypeselfrD   s     r+   __eq__zPathRegistry.__eq__   sj    	$Me6M)MM 	 	 	IC;;    55	    .AAc                    	 |d u p| j         |j        k    S # t          $ r( t          j        dt          |          z             Y dS w xY w)NrF   TrG   rL   s     r+   __ne__zPathRegistry.__ne__   si    	D=HDI1H$HH 	 	 	IC;;    44	rO   Optional[_PathRepresentation]c                    | j         S r(   r*   rM   s    r+   rH   zPathRegistry._path_for_compare   s
    yr.   indexintr2   c                    | j         |         S r(   r*   )rM   rU   s     r+   odd_elementzPathRegistry.odd_element   s    yr.   
attributesDict[Any, Any]keyvalueNonec                X    t                               d|| |           |||| j        f<   d S )Nzset '%s' on path '%s' to '%s')logdebugr?   rM   rY   r[   r\   s       r+   setzPathRegistry.set   s3    		13eDDD/4
C*+,,,r.   c                z    t                               d|| |           |                    || j        f|           d S )Nz$setdefault '%s' on path '%s' to '%s')r_   r`   
setdefaultr?   ra   s       r+   rd   zPathRegistry.setdefault   sA     			8#tUKKKsD$56>>>>>r.   NOptional[Any]c                0    || j         f}||v r||         S |S r(   )r?   ra   s       r+   getzPathRegistry.get   s+     D%&*c?"Lr.   c                *    t          | j                  S r(   lenr#   rT   s    r+   __len__zPathRegistry.__len__   s    49~~r.   c                     t          |           S r(   )idrT   s    r+   __hash__zPathRegistry.__hash__   s    $xxr.   entity_StrPathTokenTokenRegistryc                    d S r(   r)   rM   ro   s     r+   __getitem__zPathRegistry.__getitem__   s    CF3r.   _PathElementTypec                    d S r(   r)   rs   s     r+   rt   zPathRegistry.__getitem__   s    <?Cr.   slicec                    d S r(   r)   rs   s     r+   rt   zPathRegistry.__getitem__   s    ADr.   AbstractEntityRegistryc                    d S r(   r)   rs   s     r+   rt   zPathRegistry.__getitem__   s	     "%r.   r3   PropRegistryc                    d S r(   r)   rs   s     r+   rt   zPathRegistry.__getitem__   s	     sr.   TUnion[_StrPathToken, int, slice, _InternalEntityType[Any], StrategizedProperty[Any]]aUnion[TokenRegistry, _PathElementType, _PathRepresentation, PropRegistry, AbstractEntityRegistry]c                    t                      r(   )NotImplementedErrorrs   s     r+   rt   zPathRegistry.__getitem__   s      "###r.   c                *    t          | j                  S r(   ri   rT   s    r+   lengthzPathRegistry.length   s    49~~r.   OIterator[Tuple[_InternalEntityType[Any], Union[str, StrategizedProperty[Any]]]]c              #     K   t          t          | j                  }t          t          |          }t	          dt          |          d          D ]}||         ||dz            fV  d S )Nr   r   r   )r   _OddPathRepresentationr#   _EvenPathRepresentationrangerj   )rM   odd_path	even_pathis       r+   pairszPathRegistry.pairs   sv      
 .	::0(;;	q#h--++ 	0 	0A1+yQ//////	0 	0r.   mapperMapper[Any]c                    t          t          | j                  fdt          dt	                    d          D             D ]}|j                            |          r dS  dS )Nc                     g | ]
}|         S r)   r)   .0r   _m_paths     r+   
<listcomp>z0PathRegistry.contains_mapper.<locals>.<listcomp>   s    JJJ1GAJJJJr.   r   r   TF)r   r   r#   r   rj   r   isa)rM   r   path_mapperr   s      @r+   contains_mapperzPathRegistry.contains_mapper   sv    -ty99JJJJaWq0I0IJJJ 	 	K!%%f-- tt 5r.   c                    || j         f|v S r(   r*   )rM   rY   r[   s      r+   containszPathRegistry.contains   s    TY:--r.   c                :    t           |                                 ffS r(   )r7   	serializerT   s    r+   
__reduce__zPathRegistry.__reduce__   s     0 0222r.   r4   c                   t          t          |          t          t          |          t          t	          t          d fdt          dt                    d          D             D                       t          d fdt          dt                    d          D             D                       dz                       S )	Nc              3  ^   K   | ](}|j         s|j        r|j        nt          |          V  )d S r(   )	is_mapperis_aliased_classclass_str)r   ms     r+   	<genexpr>z/PathRegistry._serialize_path.<locals>.<genexpr>  sQ         "#O0BOAHHQ     r.   c                     g | ]
}|         S r)   r)   r   s     r+   r   z0PathRegistry._serialize_path.<locals>.<listcomp>      LLLQgajLLLr.   r   r   c              3  `   K   | ])}t          |          r|j        nt          |          V  *d S r(   )r   r[   r   )r   ps     r+   r   z/PathRegistry._serialize_path.<locals>.<genexpr>  sO         5Q77CAEESVV     r.   c                     g | ]
}|         S r)   r)   )r   r   _p_paths     r+   r   z0PathRegistry._serialize_path.<locals>.<listcomp>  r   r.   r   r(   )r   r   r   listziptupler   rj   )clsr#   r   r   s     @@r+   _serialize_pathzPathRegistry._serialize_path   s    -t44.55  LLLL%3w<<2K2KLLL       LLLL%3w<<2K2KLLL     	
 

 
 	
r.   c                    d
dddt          t          fd|D                        }|r|d         
|d	d         }|S )Nmclsr   r%   c                n    | t           j        vrt          j        | d          nt           j        |          S NT)	configure)	PathToken_internorm_base_inspect_mapped_class)r   s    r+   _deserialize_mapper_tokenzAPathRegistry._deserialize_path.<locals>._deserialize_mapper_token  s:    
 y000 .ttDDDD&t,r.   r[   c                    |d S |t           j        v rt           j        |         S t          j        | d          }|J |j        |         S r   )r   r   r   r   attrs)r   r[   mps      r+   _deserialize_key_tokenz>PathRegistry._deserialize_path.<locals>._deserialize_key_token  sR    {t	))) (--3DDIII~~~x}$r.   c                D    g | ]\  }} |           ||          fS r)   r)   )r   r   r[   r   r   s      r+   r   z2PathRegistry._deserialize_path.<locals>.<listcomp>%  sO       
 "c 21$77..tS99  r.   r   )r   r   r%   r   )r   r   r[   r   r%   r   )r   r   )r   r#   r   r   r   s      @@r+   _deserialize_pathzPathRegistry._deserialize_path  s    	 	 	 		% 	% 	% 	%     
 &*  

 

  	2!B$Ar.   c                :    | j         }|                     |          S r(   )r#   r   )rM   r#   s     r+   r   zPathRegistry.serialize2  s    y##D)))r.   c                ^    |J |                      |          }|                     |          S r(   )r   coerce)r   r#   r   s      r+   r6   zPathRegistry.deserialize6  s1    !!$''zz!}}r.   CachingEntityRegistryc                    d S r(   r)   r   r   s     r+   
per_mapperzPathRegistry.per_mapper<  s    GJsr.   AliasedInsp[Any]SlotsEntityRegistryc                    d S r(   r)   r   s     r+   r   zPathRegistry.per_mapper@  s    JM#r.   c                d    |j         rt          | j        |          S t          | j        |          S r(   )r   r   rB   r   r   s     r+   r   zPathRegistry.per_mapperD  s3      	9(6:::&sx888r.   rawc                6    dd}t          ||| j                  S )Nprevr$   next_ru   r%   c                    | |         S r(   r)   r   r   s     r+   _redz!PathRegistry.coerce.<locals>._redO      ;r.   r   r$   r   ru   r%   r$   )r   rB   )r   r   r   s      r+   r   zPathRegistry.coerceM  s,    	 	 	 	 dC***r.   c                6    dd}t          ||j        |           S )Nr   r$   r   ru   r%   c                    | |         S r(   r)   r   s     r+   r   z"PathRegistry.__add__.<locals>._redV  r   r.   r   )r   r#   )rM   rD   r   s      r+   __add__zPathRegistry.__add__U  s,    	 	 	 	 dEJ---r.   r   c                R    dd                     d | j        D                        dS )Nz	ORM Path[z -> c              3  4   K   | ]}t          |          V  d S r(   r   )r   elems     r+   r   z'PathRegistry.__str__.<locals>.<genexpr>\  s(      &G&GTs4yy&G&G&G&G&G&Gr.   ])joinr#   rT   s    r+   __str__zPathRegistry.__str__[  s0    J6;;&G&GTY&G&G&GGGJJJJr.   c                0    | j         j         d| j        dS )N())	__class____name__r#   rT   s    r+   __repr__zPathRegistry.__repr__^  s     .)::DI::::r.   )rD   r   r%   r<   r%   rR   )rU   rV   r%   r2   )rY   rZ   r[   r   r\   r   r%   r]   r(   )rY   rZ   r[   r   r\   re   r%   r   )r%   rV   )ro   rp   r%   rq   )ro   rV   r%   ru   )ro   rw   r%   r>   )ro   r2   r%   ry   )ro   r3   r%   r{   )ro   r}   r%   r~   )r%   r   )r   r   r%   r<   )rY   rZ   r[   r   r%   r<   )r%   r   )r#   r>   r%   r4   )r#   r4   r%   r>   )r%   r4   r#   r4   r%   r$   )r   r   r%   r   )r   r   r%   r   )r   r2   r%   ry   )r   r>   r%   r$   )rD   r$   r%   r$   )r%   r   )*r   
__module____qualname____doc__	__slots__is_tokenr,   
has_entityis_propertyr1   __annotations__r   ExtendedInternalTraversaldp_has_cache_key_listrC   rN   rQ   propertyrH   rX   rb   rd   rg   rk   rn   r   rt   r   r   r   r   r   classmethodr   r   r   r6   r   r   r   r   r   r)   r.   r+   r$   r$   X   s         2 IHGJKI%%%%"""" 
3IJ4              X       5 5 5 5? ? ? ? LP           FFF XF??? X?DDD XD% % % X%    X$ $ $ $&    X0 0 0 0   . . . .3 3 3 3 
 
 
 [
$ ! ! ! [!F* * * *    [
 JJJ [ XJMMM [ XM9 9 9 [9 + + + [+. . . .K K K K; ; ; ; ; ;r.   c                  0    e Zd ZU dZded<   ded<   dd	Zd
S )CreatesTokenr)   r<   r   r,   tokenrp   r%   rq   c                    |                     dt                     rt          | |          S |                     dt                     rt          | j        |          S t          j        d|           )N:zinvalid token: )endswithr9   rq   _DEFAULT_TOKENrB   r   ArgumentError)rM   r   s     r+   r   zCreatesToken.tokenh  sx    >>/o//00 	? u---^^00011 	? E222#$=e$=$=>>>r.   N)r   rp   r%   rq   )r   r   r   r   r   r   r)   r.   r+   r   r   b  sD         IMMM? ? ? ? ? ?r.   r   c                  N    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dS dS )rA   zXRoot registry, defers to mappers so that
    paths are maintained per-root-mapper.

    r)   TFro   r   r%   ,Union[TokenRegistry, AbstractEntityRegistry]c                    |t           j        v r>t          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   
isinstancerp   rq   _path_registryrI   
IndexErrorrs   s     r+   _getitemzRootRegistry._getitem  s     Y&&& 9!&-88888 y'8'@AAA,,!    NfNN  s   A A2c                    | S r(   r)   rT   s    r+   _truncate_recursivez RootRegistry._truncate_recursive  s    r.   N)ro   r   r%   r   )r%   rA   )r   r   r   r   r   inherit_cacher#   r?   r   r   r,   r=   r   r  r   rt   r)   r.   r+   rA   rA   q  s         
 IMD<JGL         r.   rA   c                  Z    e Zd ZU dZi Zded<   dd	Zedd            Ze	dd            Z
dS )r   zcacheable string tokenzDict[str, PathToken]r   r    
bindparamsList[BindParameter[Any]]r%   Tuple[Any, ...]c                "    t          |           fS r(   r   )rM   r    r  s      r+   _gen_cache_keyzPathToken._gen_cache_key  s     D		|r.   rR   c                    d S r(   r)   rT   s    r+   rH   zPathToken._path_for_compare  s    tr.   strvaluer   c                d    || j         v r| j         |         S t          |          x| j         |<   }|S r(   )r   r   )r   r  results      r+   internzPathToken.intern  s:    s{"";x((-6x-@-@@CK!FMr.   N)r    r    r  r  r%   r  r   )r  r   r%   r   )r   r   r   r   r   r   r	  r   rH   r   r  r)   r.   r+   r   r     s           $&G&&&&   
    X    [  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dS dS )rq   )r   r@   r#   r?   Trp   r   r   r@   c                    t                               |          }|| _        || _        |j        |fz   | _        |j        |fz   | _        d S r(   )r   r  r   r@   r#   r?   )rM   r@   r   s      r+   __init__zTokenRegistry.__init__  sK      ''
K5(*	"/5(:r.   Fr%   Iterator[PathRegistry]c              #    K   | j         }t          |          r| V  d S t          rt          |t                    sJ |j        s@|j                                        D ]$}t          |j         |         | j	                  V  %d S |j        r_t          d|j                  j        rE| V  t          d|j                  j        D ]$}t          |j         |         | j	                  V  %d S | V  d S Nr   )r@   r,   r   r   ry   r   r   iterate_to_rootrq   r   r   ro   _is_with_polymorphic_with_polymorphic_entitiesrM   r@   mp_entents       r+   generate_for_superclassesz'TokenRegistry.generate_for_superclasses  s;     6?? 	JJJF 	>f&<=====& 	 -7799 G G#FM&$94:FFFFFFG G #	"  #	 JJJ"FM (D D $FM#$6
CCCCCCD D
 JJJJJr.   Iterator[_PathRepresentation]c              #     K   | j         }t          |          r| j        V  d S t          rt	          |t
                    sJ |j                                        D ])}t          |j         |         | j	                  j        V  *|j
        rit          d|j                  j        rO| j        V  t          d|j                  j        D ])}t          |j         |         | j	                  j        V  *d S | j        V  d S r  )r@   r,   r?   r   r   ry   r   r  rq   r   r   r   ro   r  r  r  s       r+   "_generate_natural_for_superclassesz0TokenRegistry._generate_natural_for_superclasses  sB      6?? 	####F 	>f&<=====m3355 	P 	PFf 5tzBBOOOOO#	$"  #	$ ####"FM (  "&-"4djAAN     ######r.   ro   r   c                d    	 | j         |         S # t          $ r}t          |           |d }~ww xY wr(   )r#   	TypeErrorr   )rM   ro   errs      r+   r   zTokenRegistry._getitem  sE    	39V$$ 	3 	3 	3[))s2	3s    
/*/N)r@   r   r   rp   )r%   r  )r%   r  ro   r   r%   r   )r   r   r   r   r  r   r  r   r   r  r  r   r   rt   r)   r.   r+   rq   rq     s         ;IM; ; ; ; JH   6$ $ $ $:3 3 3 3   r.   rq   c                  v    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dS dS )r{   )propr@   r#   r?   r   ro   r   _wildcard_path_loader_key_default_path_loader_key_loader_keyr=   Tr3   r$  zOptional[Mapper[Any]]r   z"Optional[_InternalEntityType[Any]]ro   r@   ry   c                   t          d|d                   }|}|j        j        pt          |j        j                  | _        |j        r|j        r|j        |j                 x}}n|j        rf|j        r_|j        |j        v rQ|d         	                    |j                  }|j        |         }|j        r|j        |j                 }d| _        nP|}nM|j        rF|j        r?|j        |j        ur1|j        
                    |j                  r|j        |j                 }|| _        || _        |j        |fz   | _        |j        |fz   | _        |j        | _        |j        r7t"          rt%          |t&                    sJ |j        | _        |j        | _        nd | _        d | _        d|j        | j        j        z   f| _        | j        j        | _        d| j        f| _        d S )Nr2   r   Tloader)r   r@   r=   r<   r   inheritsr   _use_mapper_pathwith_polymorphic_mappers_entity_for_mapperr   r$  r#   r?   _links_to_entityr   _is_relationshipr   r   r   ro   _wildcard_tokenr%  r&  r'  )rM   r@   r$  inspnatural_parentsubclass_entitys         r+   r  zPropRegistry.__init__  s    .r
;;17 #M6 
$M";
 ;
 $ 4	8(= 4	8&,mDK&@@F^^!2	8-2	8 t<<<8>r
8U8UVZVa8b8bO]?3F@ } (!'/E!F$(!!!'!	8%	8 ; ,, $]4;7N	K4')	*74'A/  	 >!$(<=====+DK+DKKDKDK $)";;*
& )-	(J%$d&78r.   r%   c                    d }t          t          | j        d d                             D ]\  }}|| j        u r|}|| S |                     | j        d|dz                       S )Nr   r   r   )	enumeratereversedr#   r$  r   )rM   earliestr   r   s       r+   r  z PropRegistry._truncate_recursivev  sv    !(49SbS>":":;; 	 	HAu	!!K;;tyx!|_)<=>>>r.   c                .    | j         J | | j                  S r(   )ro   rT   s    r+   entity_pathzPropRegistry.entity_path  s    {&&&DK  r.   +Union[int, slice, _InternalEntityType[Any]]DUnion[AbstractEntityRegistry, _PathElementType, _PathRepresentation]c                t    t          |t          t          f          r| j        |         S t	          | |          S r(   )r   rV   rw   r#   r   rs   s     r+   r   zPropRegistry._getitem  s7     fsEl++ 	59V$$&tV444r.   N)r@   ry   r$  r3   )r%   r{   r%   ry   )ro   r:  r%   r;  )r   r   r   r   r  r   r   r  r  r   r9  r   r   rt   r)   r.   r+   r{   r{     s         I MK""""!!!!....X9 X9 X9 X9t	? 	? 	? 	? ! ! ! X!5 5 5 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dS dS )ry   )r[   r@   r   r#   ro   r?   T!Union[RootRegistry, PropRegistry]r@   r2   r[   ro   r<   r   c                p   || _         || _        |j        | _        || _        |j        |fz   | _        |j        rq| j        s|j        rc|j                            |j        d         j                  r|j        |j        fz   | _        d S |j        |j        d         j        fz   | _        d S | j        | _        d S )Nr   )	r[   r@   r   ro   r#   r=   r   r   r?   )rM   r@   ro   s      r+   r  zAbstractEntityRegistry.__init__  s    
  & 7K6)+	$ ; 	*D1 	*V5H 	* }  !4R!8!?@@ $*$76=:J$J!!!$*$7'+2; %!!! !%	Dr.   r%   c                J    | j                                         | j                 S r(   )r@   r  ro   rT   s    r+   r  z*AbstractEntityRegistry._truncate_recursive  s    {..00==r.   c                ,    |                      d          S )Nr   )rX   rT   s    r+   root_entityz"AbstractEntityRegistry.root_entity  s    """r.   r$   c                    | S r(   r)   rT   s    r+   r9  z"AbstractEntityRegistry.entity_path  s    r.   r   c                    | j         j        S r(   )ro   r   rT   s    r+   r   zAbstractEntityRegistry.mapper  s    {!!r.   c                    dS )NTr)   rT   s    r+   __bool__zAbstractEntityRegistry.__bool__  s    tr.   r   :Union[_PathElementType, _PathRepresentation, PathRegistry]c                    t          |t          t          f          r| j        |         S |t          j        v r t          | t          j        |                   S t          | |          S r(   )r   rV   rw   r#   r   r   rq   r{   rs   s     r+   r   zAbstractEntityRegistry._getitem  s]     fsEl++ 	.9V$$y((( y'8'@AAAf---r.   Nr@   r?  ro   r2   r=  )r%   r2   )r%   r$   )r%   r   )r%   r<   )ro   r   r%   rH  )r   r   r   r   r   r1   r   r  r  r   rC  r9  r   rG  r   r   rt   r)   r.   r+   ry   ry     s        I JI----!!!!$$$$,* ,* ,* ,*\> > > > # # # X#    X " " " X"   . . . .   r.   ry   c                      e Zd ZdZdS )r   TN)r   r   r   r  r)   r.   r+   r   r     s         MMMr.   r   c                      e Zd Zd
dZddZd	S )_ERDictregistryr   c                    || _         d S r(   )rN  )rM   rN  s     r+   r  z_ERDict.__init__  s     r.   r[   r   r%   r{   c                :    t          | j        |          x| |<   }|S r(   )r{   rN  )rM   r[   items      r+   __missing__z_ERDict.__missing__  s!    's;;;S	Dr.   N)rN  r   )r[   r   r%   r{   )r   r   r   r  rR  r)   r.   r+   rM  rM    s<        ! ! ! !     r.   rM  c                  H     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   )_cacheTr@   r?  ro   r2   c                t    t                                          ||           t          |           | _        d S r(   )superr  rM  rT  )rM   r@   ro   r   s      r+   r  zCachingEntityRegistry.__init__
  s0    
 	(((dmmr.   r[   r   defaultr%   c                8    | j                             ||          S r(   )rT  pop)rM   r[   rW  s      r+   rY  zCachingEntityRegistry.pop  s    {sG,,,r.   c                    t          |t          t          f          r| j        |         S t          |t                    rt          | |          S | j        |         S r(   )r   rV   rw   r#   r   rq   rT  rs   s     r+   r   zCachingEntityRegistry._getitem  sT    fsEl++ 	'9V$$	** 	' v...;v&&r.   rJ  )r[   r   rW  r   r%   r   r"  )r   r   r   r   r  r  rY  r   r   rt   __classcell__)r   s   @r+   r   r     s         IM$ $ $ $ $ $- - - -' ' ' '     r.   r   c                    d S r(   r)   r*   s    r+   path_is_entityr]  #  s    ,/Cr.   TypeGuard[PropRegistry]c                    d S r(   r)   r*   s    r+   path_is_propertyr`  '  r-   r.   r   )r#   r$   r%   r&   )r#   r$   r%   r/   r   )r#   r$   r%   r^  )Or   
__future__r   	functoolsr   	itertoolsr   loggingoperatortypingr   r   r   r	   r
   r   r   r   r   r   r    r   r   _typingr   r   r   sqlr   sql.cache_keyr   r   
interfacesr   r   r   relationshipsr   r   r   sql.elementsr   sql.visitorsr    util.typingr!   r"   r,   r1   
attrgetterr4   r   rp   ru   r>   r   r   	getLoggerr   r_   r7   r9   r   r   r$   r   rA   rB   InspectionAttrr   rq   r{   ry   r   rM  r   r]  r`  r)   r.   r+   <module>rs     su     # " " " " "                                                                                             , , , , , ,                   ' ' ' ' ' ' 1,,,,,,//////333333!!!!!!666666,,,,,,''''''******''''''CCCCOOOOO "h!),,G##K00I s)-/II  ,c12  ""<= "5)CS)H#IJ  g!!* * * * !$ # # # #G; G; G; G; G;; G; G; G;T? ? ? ? ?< ? ? ?# # # # #< # # #L !LNN     'c   .S S S S SL S S SlH H H H H< H H HV] ] ] ] ]\ ] ] ]@    0       d38n       2   >  
:0 0 0 0 MLLLLL )X(55N*x*=99r.   