
    ,h<e                       % S r SSKJr  SSKJr  SSKJr  SSKrSSKrSSK	J
r
  SSK	Jr  SSK	Jr  SS	K	Jr  SS
K	Jr  SSK	Jr  SSK	Jr  SSK	Jr  SSK	Jr  SSK	Jr  SSK	Jr  SSKJr  SSKJr  SSKJr  SSKJr  SSKJr  SSKJr  \(       aG  SSKJ r   SSK!J"r"  SSK#J$r$  SSK%J&r&  SSKJ'r'  SSKJ(r(  SSK)J*r*  SS K+J,r,  SS!K-J.r.  SS"K-J/r/  SFS$ jr0SGS% jr1O$\Rd                  " S&5      r0\Rd                  " S'5      r1\\
   r3\4r5\\5S(S)4   r6\\6S*4   r7\S(   r8\\S)\44      r9\Rt                  " \;5      r<SHS+ jr=S,r>S-\?S.'   S/r@ " S0 S#\5      rA " S1 S2\A5      rB " S3 S4\B5      rC\C" 5       \AlD         " S5 S6\R                  \\45      rF " S7 S8\A5      rG " S9 S:\A5      rH " S; S<\B5      rI " S= S>\I5      rJ " S? S@\\
\
4   5      rK " SA SB\I5      rL\(       a      SGSC jrMSISD jrNg\Rd                  " S'5      rM\Rd                  " SE5      rNg)Jz@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PathRegistryc                    g N paths    T/var/www/auris/envauris/lib/python3.13/site-packages/sqlalchemy/orm/path_registry.pyis_rootr*   0   s        c                    g r%   r&   r'   s    r)   	is_entityr-   2   s    Cr+   r*   r-   _InternalEntityType[Any]StrategizedProperty[Any].c                ,    [         R                  U 5      $ r%   )r#   deserializer'   s    r)   _unreduce_pathr2   P   s    ##D))r+   *r!   _WILDCARD_TOKEN_sa_defaultc                     \ rS rSr% SrSrSrSrSrSr	Sr
S\S'   S\S'   S\S	'   S
\S'   S\S'   S\R                  R                  4/rS\S'   S0S jrS0S jr\S1S j5       rS2S jrS3S jr        S3S jr S4       S5S jjrS6S jrS6S jr\S7S j5       r\S8S j5       r\S9S j5       r\    S:S j5       r\    S;S j5       r    S<S jr\S6S  j5       r  S=S! jrS>S" jrS?S# jrS@S$ jr \!SAS% j5       r"\!SBS& j5       r#SCS' jr$\!SDS( j5       r%\\!SES) j5       5       r&\\!SFS* j5       5       r&\!    SGS+ j5       r&\!SHS, j5       r'SIS- jr(SJS. jr)SJS/ jr*Sr+g)Kr#   X   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                     US L=(       a    U R                   UR                  :H  $ ! [         a%    [        R                  " S[        U5      -  5         gf = f)N1Comparison of PathRegistry to %r is not supportedFr(   _path_for_compareAttributeErrorr   warntypeselfothers     r)   __eq__PathRegistry.__eq__   sU    	$Me6M6M)MM 	IIC;  	   #& ,AAc                     US L =(       d    U R                   UR                  :g  $ ! [         a%    [        R                  " S[        U5      -  5         gf = f)NrA   TrB   rG   s     r)   __ne__PathRegistry.__ne__   sT    	D=HDII1H1H$HH 	IIC;  	rL   c                    U R                   $ r%   r'   rH   s    r)   rC   PathRegistry._path_for_compare   s    yyr+   c                     U R                   U   $ r%   r'   )rH   indexs     r)   odd_elementPathRegistry.odd_element   s    yyr+   c                P    [         R                  SX U5        X1X R                  4'   g )Nzset '%s' on path '%s' to '%s')logdebugr;   rH   
attributeskeyvalues       r)   setPathRegistry.set   s$    		13eD/4C**+,r+   c                l    [         R                  SX U5        UR                  X R                  4U5        g )Nz$setdefault '%s' on path '%s' to '%s')rX   rY   
setdefaultr;   rZ   s       r)   ra   PathRegistry.setdefault   s.     			8#UKs$5$56>r+   Nc                2    X R                   4nX!;   a  X   $ U$ r%   )r;   rZ   s       r)   getPathRegistry.get   s%     %%&?"Lr+   c                ,    [        U R                  5      $ r%   lenr(   rQ   s    r)   __len__PathRegistry.__len__   s    499~r+   c                    [        U 5      $ r%   )idrQ   s    r)   __hash__PathRegistry.__hash__   s    $xr+   c                    g r%   r&   rH   entitys     r)   __getitem__PathRegistry.__getitem__   s    CFr+   c                    g r%   r&   rp   s     r)   rr   rs      s    <?r+   c                    g r%   r&   rp   s     r)   rr   rs      s    ADr+   c                    g r%   r&   rp   s     r)   rr   rs      s     "%r+   c                    g r%   r&   rp   s     r)   rr   rs      s     r+   c                    [        5       er%   )NotImplementedErrorrp   s     r)   rr   rs      s      "##r+   c                ,    [        U R                  5      $ r%   rg   rQ   s    r)   lengthPathRegistry.length   s    499~r+   c              #     #    [        [        U R                  5      n[        [        U5      n[	        S[        U5      S5       H  nX   X#S-      4v   M     g 7f)Nr   r   r   )r   _OddPathRepresentationr(   _EvenPathRepresentationrangerh   )rH   odd_path	even_pathis       r)   pairsPathRegistry.pairs   sP     
 .		:0(;	q#h-+A+yQ/// ,s   AAc                    [        [        U R                  5      n[        S[	        U5      S5       Vs/ s H  o2U   PM	     sn H%  nUR
                  R                  U5      (       d  M%    g   gs  snf )Nr   r   TF)r   r~   r(   r   rh   mapperisa)rH   r   _m_pathr   path_mappers        r)   contains_mapperPathRegistry.contains_mapper   sc    -tyy905aWq0IJ0I1AJ0IJK!!%%f-- K 	 Ks   A.c                "    X R                   4U;   $ r%   r'   )rH   r[   r\   s      r)   containsPathRegistry.contains   s    YY:--r+   c                0    [         U R                  5       44$ r%   )r2   	serializerQ   s    r)   
__reduce__PathRegistry.__reduce__   s     0222r+   c                b   [        [        U5      n[        [        U5      n[        [	        [        S [        S[        U5      S5       Vs/ s H  oBU   PM	     sn 5       5      [        S [        S[        U5      S5       Vs/ s H  oCU   PM	     sn 5       5      S-   5      5      $ s  snf s  snf )Nc              3     #    U  H>  nUR                   (       d  UR                  (       a  UR                  O
[        U5      v   M@     g 7fr%   )	is_mapperis_aliased_classclass_str).0ms     r)   	<genexpr>/PathRegistry._serialize_path.<locals>.<genexpr>  s2      L "#0B0BAHHQOLs   AAr   r   c              3  p   #    U  H,  n[        U5      (       a  UR                  O
[        U5      v   M.     g 7fr%   )r   r\   r   )r   ps     r)   r   r     s.      L 5Q77AEESVCLs   46r   r%   )r   r~   r   listziptupler   rh   )clsr(   r   _p_pathr   s        r)   _serialize_pathPathRegistry._serialize_path   s    -t4.5 273w<2KL2KQaj2KL   273w<2KL2KQaj2KL  	

 	
 M Ms   
B'B,c                    SS jnSS jn[        [        U VVs/ s H  u  pEU" U5      U" XE5      4PM     snn6 5      nU(       a  US   c  USS nU$ s  snnf )Nc                z    U [         R                  ;  a  [        R                  " U SS9$ [         R                  U    $ NT)	configure)	PathToken_internorm_base_inspect_mapped_class)mclss    r)   _deserialize_mapper_tokenAPathRegistry._deserialize_path.<locals>._deserialize_mapper_token  s>    
 y000 ..ttD
 &&t,r+   c                    Uc  g U[         R                  ;   a  [         R                  U   $ [        R                  " U SS9nUc   eUR                  U   $ r   )r   r   r   r   attrs)r   r\   mps      r)   _deserialize_key_token>PathRegistry._deserialize_path.<locals>._deserialize_key_token  sS    {	))) ((--33DDI~%~xx}$r+   r   )r   r   returnr   )r   r   r\   r   r   r   )r   r   )r   r(   r   r   r   r\   r   s          r)   _deserialize_pathPathRegistry._deserialize_path  sw    		%  &*
 &*	 2$7.t9 &*

 2!BAs   Ac                <    U R                   nU R                  U5      $ r%   )r(   r   )rH   r(   s     r)   r   PathRegistry.serialize2  s    yy##D))r+   c                P    Uc   eU R                  U5      nU R                  U5      $ r%   )r   coerce)r   r(   r   s      r)   r1   PathRegistry.deserialize6  s,    !!$'zz!}r+   c                    g r%   r&   r   r   s     r)   
per_mapperPathRegistry.per_mapper<  s    GJr+   c                    g r%   r&   r   s     r)   r   r   @  s    JMr+   c                |    UR                   (       a  [        U R                  U5      $ [        U R                  U5      $ r%   )r   CachingEntityRegistryr>   SlotsEntityRegistryr   s     r)   r   r   D  s/     (6::&sxx88r+   c                8    SS jn[        X!U R                  5      $ )Nc                
    X   $ r%   r&   prevnext_s     r)   _red!PathRegistry.coerce.<locals>._redO  
    ;r+   r   r#   r   _PathElementTyper   r#   )r   r>   )r   rawr   s      r)   r   PathRegistry.coerceM  s    	 d**r+   c                8    SS jn[        X!R                  U 5      $ )Nc                
    X   $ r%   r&   r   s     r)   r   "PathRegistry.__add__.<locals>._redV  r   r+   r   )r   r(   )rH   rI   r   s      r)   __add__PathRegistry.__add__U  s    	 dJJ--r+   c                N    SSR                  S U R                   5       5       S3$ )Nz	ORM Path[z -> c              3  8   #    U  H  n[        U5      v   M     g 7fr%   r   )r   elems     r)   r   'PathRegistry.__str__.<locals>.<genexpr>\  s     &GYTs4yyYs   ])joinr(   rQ   s    r)   __str__PathRegistry.__str__[  s%    6;;&GTYY&GGHJJr+   c                P    U R                   R                   SU R                  < S3$ )N())	__class____name__r(   rQ   s    r)   __repr__PathRegistry.__repr__^  s$    ..))*!DII=::r+   )rI   r   r   r8   r   zOptional[_PathRepresentation])rT   intr   r.   )r[   Dict[Any, Any]r\   r   r]   r   r   Noner%   )r[   r   r\   r   r]   zOptional[Any]r   r   )r   r   )rq   _StrPathTokenr   TokenRegistry)rq   r   r   r   )rq   slicer   r:   )rq   r.   r   AbstractEntityRegistry)rq   r/   r   PropRegistry)rq   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   r8   )r[   r   r\   r   r   r8   )r   r   )r(   r:   r   _SerializedPath)r(   r   r   r:   )r   r   r(   r   r   r#   )r   r   r   r   )r   AliasedInsp[Any]r   r   )r   r.   r   r   )r   r:   r   r#   )rI   r#   r   r#   )r   r   ),r   
__module____qualname____firstlineno____doc__	__slots__is_tokenr*   
has_entityis_propertyr-   __annotations__r   ExtendedInternalTraversaldp_has_cache_key_listr?   rJ   rN   propertyrC   rU   r^   ra   rd   ri   rm   r   rr   r{   r   r   r   r   classmethodr   r   r   r1   r   r   r   r   r   __static_attributes__r&   r+   r)   r#   r#   X   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                  8    \ rS rSr% SrS\S'   S\S'   SS jrSrg)	CreatesTokenib  r&   r8   r   r*   c                    UR                  S[         35      (       a  [        X5      $ UR                  S[         35      (       a  [        U R                  U5      $ [
        R                  " SU 35      e)N:zinvalid token: )endswithr4   r   _DEFAULT_TOKENr>   r   ArgumentError)rH   tokens     r)   r  CreatesToken.tokenh  sd    >>Ao./00 --^^a/011 E22##oeW$=>>r+   N)r  r   r   r   )r   r   r   r   r   r   r  r  r&   r+   r)   r  r  b  s    IM?r+   r  c                  l    \ rS rSrSrSrSrS=rrSr	Sr
SrSr    S	S jrS
S jr\(       d  \rSrgSrg)r=   iq  zPRoot registry, defers to mappers so that
paths are maintained per-root-mapper.

r&   TFc                    U[         R                  ;   a?  [        (       a  [        U[        5      (       d   e[        U [         R                  U   5      $  UR                  $ ! [         a    [        SU 35      ef = f)Nz/invalid argument for RootRegistry.__getitem__: )	r   r   r   
isinstancer   r   _path_registryrD   
IndexErrorrp   s     r)   _getitemRootRegistry._getitem  sy     Y&&&}!&-8888 y'8'8'@AA,,,!  EfXN s   A! !A:c                    U $ r%   r&   rQ   s    r)   _truncate_recursive RootRegistry._truncate_recursive  s    r+   N)rq   r   r   z,Union[TokenRegistry, AbstractEntityRegistry])r   r=   )r   r   r   r   r   r   inherit_cacher(   r;   r   r   r*   r9   r  r  r   rr   r  r&   r+   r)   r=   r=   q  s[    
 IMD<JGL	5  r+   r=   c                  f    \ rS rSr% Sr0 rS\S'         S
S jr\SS j5       r	\
SS j5       rSrg	)r   i  zcacheable string tokenzDict[str, PathToken]r   c                    [        U 5      4$ r%   r   )rH   r    
bindparamss      r)   _gen_cache_keyPathToken._gen_cache_key  s     D	|r+   c                    g r%   r&   rQ   s    r)   rC   PathToken._path_for_compare  s    r+   c                v    XR                   ;   a  U R                   U   $ [        U5      =U R                   U'   nU$ r%   )r   r   )r   strvalueresults      r)   internPathToken.intern  s8    {{";;x((-6x-@@CKK!FMr+   r&   N)r    r    r  zList[BindParameter[Any]]r   zTuple[Any, ...]r   )r   r   r   r   )r   r   r   r   r   r   r   r  r  rC   r  r"  r  r&   r+   r)   r   r     sU     $&G!& .F	
    r+   r   c                  ~    \ rS rSr% SrSrS\S'   S\S'   SS jrS	rSr	SS
 jr
  SS jrSS jr\(       d  \rSrgSrg)r   i  )r  r<   r(   r;   Tr   r  r  r<   c                    [         R                  U5      nX l        Xl        UR                  U4-   U l        UR
                  U4-   U l        g r%   )r   r"  r  r<   r(   r;   )rH   r<   r  s      r)   __init__TokenRegistry.__init__  sC      '
KK5(*	"//5(:r+   Fc              #  X  #    U R                   n[        U5      (       a  U v   g [        (       a  [        U[        5      (       d   eUR
                  (       dG  UR                  R                  5        H(  n[        UR                   U   U R                  5      v   M*     g UR
                  (       av  [        SUR                  5      R                  (       aQ  U v   [        SUR                  5      R                   H(  n[        UR                   U   U R                  5      v   M*     g U v   g 7fNr   )r<   r*   r   r  r   r   r   iterate_to_rootr   r  r   rq   _is_with_polymorphic_with_polymorphic_entitiesrH   r<   mp_entents       r)   generate_for_superclasses'TokenRegistry.generate_for_superclasses  s     6??J=f&<====&& --779#FMM&$94::FF : ##" #"#
 J"FMM(() $FMM#$6

CC)
 Js   D(D*c              #    #    U R                   n[        U5      (       a  U R                  v   g [        (       a  [	        U[
        5      (       d   eUR                  R                  5        H2  n[        UR                   U   U R                  5      R                  v   M4     UR                  (       a  [        SUR                  5      R                  (       ae  U R                  v   [        SUR                  5      R                   H2  n[        UR                   U   U R                  5      R                  v   M4     g U R                  v   g 7fr)  )r<   r*   r;   r   r  r   r   r*  r   r  r   r   rq   r+  r,  r-  s       r)   "_generate_natural_for_superclasses0TokenRegistry._generate_natural_for_superclasses  s     6??###=f&<====mm335Ff 5tzzBOOO 6 ##" #"#
 ###"FMM(() "&--"4djjANN) ###s   EE
c                `     U R                   U   $ ! [         a  n[        U 5      UeS nAff = fr%   )r(   	TypeErrorr  )rH   rq   errs      r)   r  TokenRegistry._getitem  s5    	399V$$ 	3x)s2	3s    
-(-)r;   r<   r(   r  N)r<   r  r  r   )r   zIterator[PathRegistry])r   zIterator[_PathRepresentation]rq   r   r   r   )r   r   r   r   r   r  r   r&  r   r   r0  r3  r  r   rr   r  r&   r+   r)   r   r     sO    ;IM; JH6$	&$:3  r+   r   c                      \ rS rSr% SrSrSrS\S'   S\S'   S\S	'       SS
 jrSS jr	\
SS j5       r    SS jr\(       d  \rSrgSrg)r   i  )propr<   r(   r;   r   rq   r   _wildcard_path_loader_key_default_path_loader_key_loader_keyr9   Tr/   r;  zOptional[Mapper[Any]]r   z"Optional[_InternalEntityType[Any]]rq   c                b   [        SUS   5      nUnUR                  R                  =(       d    [        UR                  R
                  5      U l        UR                  (       a  UR                  (       a  UR                  UR                     =pGOUR                  (       a  UR                  (       a|  UR                  UR                  ;   ab  US   R                  UR                  5      nUR                  U   nUR                  (       a!  UR                  UR                     nSU l        OUnO~UR                  (       am  UR                  (       a\  UR                  UR                  LaC  UR                  R                  UR                  5      (       a  UR                  UR                     nX l        Xl        UR                  U4-   U l        UR                  U4-   U l        UR                  U l        UR                   (       aE  ["        (       a  [%        U[&        5      (       d   eUR(                  U l        UR                  U l        OS U l        S U l        SUR                  U R                  R*                  -   4U l        U R                  R.                  U l        SU R                  4U l        g )Nr.   r   Tloader)r   r<   r9   r8   r   inheritsr   _use_mapper_pathwith_polymorphic_mappers_entity_for_mapperr   r;  r(   r;   _links_to_entityr   _is_relationshipr   r  r   rq   _wildcard_tokenr<  r=  r>  )rH   r<   r;  inspnatural_parentsubclass_entitys         r)   r&  PropRegistry.__init__  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                    S n[        [        U R                  S S 5      5       H  u  p#X0R                  L d  M  UnM     Uc  U $ U R	                  U R                  SUS-   *  5      $ )Nr   r   r   )	enumeratereversedr(   r;  r   )rH   earliestr   r  s       r)   r   PropRegistry._truncate_recursivev  sc    !(499Sb>":;HA		! < K;;tyyx!|_=>>r+   c                <    U R                   c   eX R                      $ r%   )rq   rQ   s    r)   entity_pathPropRegistry.entity_path  s    {{&&&KK  r+   c                l    [        U[        [        45      (       a  U R                  U   $ [	        X5      $ r%   )r  r   r   r(   r   rp   s     r)   r  PropRegistry._getitem  s/     fsEl++99V$$&t44r+   )r=  r>  r<  rq   r   r9   r   r;   r<   r(   r;  N)r<   r   r;  r/   )r   r   r   r   )rq   z+Union[int, slice, _InternalEntityType[Any]]r   zDUnion[AbstractEntityRegistry, _PathElementType, _PathRepresentation])r   r   r   r   r   r  r   r   r&  r  r  rR  r  r   rr   r  r&   r+   r)   r   r     s}    I MK
""!!..X9,X94LX9t	? ! !5A5	M5  r+   r   c                      \ rS rSr% SrSrSrS\S'   S\S'   S\S'   S	\S
'       SS jrSS jr	\
SS j5       r\
SS j5       r\
SS j5       rSS jr    SS jr\(       d  \rSrgSrg)r   i  )r\   r<   r   r(   rq   r;   T!Union[RootRegistry, PropRegistry]r<   r.   r\   rq   r8   r   c                   X l         Xl        UR                  U l        X l        UR                  U4-   U l        UR                  (       a  U R                  (       d  UR
                  (       a  UR                  R                  UR                  S   R                  5      (       a   UR                  UR                  4-   U l        g UR                  UR                  S   R                  4-   U l        g U R                  U l        g )Nr   )	r\   r<   r   rq   r(   r9   r   r   r;   )rH   r<   rq   s      r)   r&  AbstractEntityRegistry.__init__  s    
  & 7 7KK6)+	$ ;;D11V5H5H }}  !4!4R!8!?!?@@$*$7$76==:J$J!$*$7$7''+22; %! !%		Dr+   c                P    U R                   R                  5       U R                     $ r%   )r<   r  rq   rQ   s    r)   r  *AbstractEntityRegistry._truncate_recursive  s    {{..0==r+   c                $    U R                  S5      $ )Nr   )rU   rQ   s    r)   root_entity"AbstractEntityRegistry.root_entity  s    ""r+   c                    U $ r%   r&   rQ   s    r)   rR  "AbstractEntityRegistry.entity_path  s    r+   c                .    U R                   R                  $ r%   )rq   r   rQ   s    r)   r   AbstractEntityRegistry.mapper  s    {{!!!r+   c                    g)NTr&   rQ   s    r)   __bool__AbstractEntityRegistry.__bool__  s    r+   c                    [        U[        [        45      (       a  U R                  U   $ U[        R
                  ;   a  [        U [        R
                  U   5      $ [        X5      $ r%   )r  r   r   r(   r   r   r   r   rp   s     r)   r  AbstractEntityRegistry._getitem  sU     fsEl++99V$$y((( y'8'8'@AA--r+   )rq   r   r\   r;   r<   r(   Nr<   rX  rq   r.   rV  )r   r.   )r   r#   )r   r   )r   r8   )rq   r   r   z:Union[_PathElementType, _PathRepresentation, PathRegistry])r   r   r   r   r   r   r-   r   r&  r  r  r^  rR  r   re  r  r   rr   r  r&   r+   r)   r   r     s    I JI--	!!$$,*1,* ),*\> # #   " "..	C.  r+   r   c                      \ rS rSrSrSrg)r   i  Tr&   N)r   r   r   r   r  r  r&   r+   r)   r   r     s	     Mr+   r   c                  (    \ rS rSrSS jrSS jrSrg)_ERDicti  c                    Xl         g r%   registry)rH   ro  s     r)   r&  _ERDict.__init__  s     r+   c                :    [        U R                  U5      =X'   nU$ r%   )r   ro  )rH   r\   items      r)   __missing___ERDict.__missing__  s    's;;	Dr+   rn  N)ro  r   )r\   r   r   r   )r   r   r   r   r&  rs  r  r&   r+   r)   rl  rl    s    !r+   rl  c                  n   ^  \ rS rSrSrSr    SU 4S jjrSS jrS	S jr\	(       d  \r
SrU =r$ SrU =r$ )
r   i  )_cacheTc                D   > [         TU ]  X5        [        U 5      U l        g r%   )superr&  rl  rv  )rH   r<   rq   r   s      r)   r&  CachingEntityRegistry.__init__
  s    
 	(dmr+   c                8    U R                   R                  X5      $ r%   )rv  pop)rH   r\   defaults      r)   r{  CachingEntityRegistry.pop  s    {{s,,r+   c                    [        U[        [        45      (       a  U R                  U   $ [        U[        5      (       a  [        X5      $ U R                  U   $ r%   )r  r   r   r(   r   r   rv  rp   s     r)   r  CachingEntityRegistry._getitem  sI    fsEl++99V$$	** ..;;v&&r+   ri  )r\   r   r|  r   r   r   r9  )r   r   r   r   r   r  r&  r{  r  r   rr   r  __classcell__)r   s   @r)   r   r     s?     IM$1$ )$-'  r+   r   c                    g r%   r&   r'   s    r)   path_is_entityr  #  s    ,/r+   c                    g r%   r&   r'   s    r)   path_is_propertyr  '  s    r+   r   )r(   r#   r   zTypeGuard[RootRegistry])r(   r#   r   z!TypeGuard[AbstractEntityRegistry]r   )r(   r#   r   zTypeGuard[PropRegistry])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*   r-   
attrgetterr   r   r   r   r:   r~   r   	getLoggerr   rX   r2   r4   r   r	  r#   r  r=   r>   InspectionAttrr   r   r   r   r   rl  r   r  r  r&   r+   r)   <module>r     s   #                  ,    ',/3!6,'*'CO !!),G##K0I s)-/II  ,c12  ""<= "5)CS)H#IJ  !* !$ #G;; G;T?< ?#< #L !N ''c .SL SlH< HV]\ ]@0 d38n 2 > 00	*0 M ((5N**=9r+   