o
    Šåg<e  ã                   @  sú  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rÌ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/ dOd'd(„Z0dPd*d+„Z1n
e 2d(¡Z0e 2d+¡Z1ee
 Z3e4Z5ee5d,d-f Z6ee6d.f Z7ed, Z8eed-e4f  Z9e :e;¡Z<dQd0d1„Z=d2Z>d3e?d4< d5Z@G d6d$„ d$eƒZAG d7d8„ d8eAƒZBG d9d:„ d:eBƒZCeCƒ eA_DG d;d<„ d<ejEee4ƒZFG d=d>„ d>eAƒZGG d?d@„ d@eAƒZHG dAdB„ dBeBƒZIG dCdD„ dDeIƒZJG dEdF„ dFee
e
f ƒZKG dGdH„ dHeIƒZLe�rqdPdIdJ„ZMdRdLdM„ZNdS e 2d+¡ZMe 2dN¡ZNdS )Sz@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                 C  ó   d S ©N© ©r"   r(   r(   úX/var/www/html/flaskapp/venv/lib/python3.10/site-packages/sqlalchemy/orm/path_registry.pyÚis_root0   ó    r+   ú!TypeGuard[AbstractEntityRegistry]c                 C  r&   r'   r(   r)   r(   r(   r*   Ú	is_entity2   r,   r.   ú_InternalEntityType[Any]úStrategizedProperty[Any].Ú_SerializedPathc                 C  s
   t  | ¡S r'   )r#   Údeserializer)   r(   r(   r*   Ú_unreduce_pathP   ó   
r3   Ú*r    Ú_WILDCARD_TOKENÚ_sa_defaultc                   @  sâ  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< dgdd„Zdgdd„Zedhdd„ƒZdidd„Zdjd#d$„Zdjd%d&„Z	'dkdld)d*„Zdmd+d,„Zdmd-d.„Zednd2d3„ƒZedod5d3„ƒZedpd7d3„ƒZedqd9d3„ƒZedrd<d3„ƒZdsd?d3„Zedmd@dA„ƒZdtdCdD„ZdudGdH„ZdvdIdJ„ZdwdKdL„Ze dxdNdO„ƒZ!e dydPdQ„ƒZ"dzdRdS„Z#e d{dTdU„ƒZ$ee d|dWdX„ƒƒZ%ee d}d[dX„ƒƒZ%e d~d\dX„ƒZ%e dd^d_„ƒZ&d€d`da„Z'd�dcdd„Z(d�dedf„Z)d'S )‚r#   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                 C  s>   z|d uo
| j |jkW S  ty   t dt|ƒ ¡ Y dS w )Nú1Comparison of PathRegistry to %r is not supportedF©r"   Ú_path_for_compareÚAttributeErrorr   ÚwarnÚtype©Úselfr@   r(   r(   r*   Ú__eq__…   ó   ÿÿûzPathRegistry.__eq__c                 C  s>   z|d u p
| j |jkW S  ty   t dt|ƒ ¡ Y dS w )NrA   TrB   rG   r(   r(   r*   Ú__ne__�   rJ   zPathRegistry.__ne__úOptional[_PathRepresentation]c                 C  s   | j S r'   r)   ©rH   r(   r(   r*   rC   ™   s   zPathRegistry._path_for_compareÚindexÚintr/   c                 C  s
   | j | S r'   r)   )rH   rN   r(   r(   r*   Úodd_element�   r4   zPathRegistry.odd_elementÚ
attributesúDict[Any, Any]ÚkeyÚvalueÚNonec                 C  s"   t  d|| |¡ |||| jf< d S )Nzset '%s' on path '%s' to '%s')ÚlogÚdebugr;   ©rH   rQ   rS   rT   r(   r(   r*   Úset    s   zPathRegistry.setc                 C  s&   t  d|| |¡ | || jf|¡ d S )Nz$setdefault '%s' on path '%s' to '%s')rV   rW   Ú
setdefaultr;   rX   r(   r(   r*   rZ   ¤   s   zPathRegistry.setdefaultNúOptional[Any]c                 C  s   || j f}||v r|| S |S r'   )r;   rX   r(   r(   r*   Úgetª   s   
zPathRegistry.getc                 C  ó
   t | jƒS r'   ©Úlenr"   rM   r(   r(   r*   Ú__len__³   r4   zPathRegistry.__len__c                 C  s   t | ƒS r'   )ÚidrM   r(   r(   r*   Ú__hash__¶   ó   zPathRegistry.__hash__ÚentityÚ_StrPathTokenÚTokenRegistryc                 C  r&   r'   r(   ©rH   rd   r(   r(   r*   Ú__getitem__¹   ó   zPathRegistry.__getitem__Ú_PathElementTypec                 C  r&   r'   r(   rg   r(   r(   r*   rh   ¼   ri   Úslicec                 C  r&   r'   r(   rg   r(   r(   r*   rh   ¿   ri   ÚAbstractEntityRegistryc                 C  r&   r'   r(   rg   r(   r(   r*   rh   Â   ó   r0   ÚPropRegistryc                 C  r&   r'   r(   rg   r(   r(   r*   rh   Ç   rm   úTUnion[_StrPathToken, int, slice, _InternalEntityType[Any], StrategizedProperty[Any]]úaUnion[TokenRegistry, _PathElementType, _PathRepresentation, PropRegistry, AbstractEntityRegistry]c                 C  s   t ƒ ‚r'   )ÚNotImplementedErrorrg   r(   r(   r*   rh   Ì   s   c                 C  r]   r'   r^   rM   r(   r(   r*   Úlengthß   ó   
zPathRegistry.lengthúOIterator[Tuple[_InternalEntityType[Any], Union[str, StrategizedProperty[Any]]]]c                 c  sH   � t t| jƒ}t t|ƒ}tdt|ƒdƒD ]}|| ||d  fV  qd S )Nr   r   r   )r   Ú_OddPathRepresentationr"   Ú_EvenPathRepresentationÚranger_   )rH   Úodd_pathÚ	even_pathÚir(   r(   r*   Úpairsã   s   €
ÿzPathRegistry.pairsÚmapperúMapper[Any]c                   sF   t t| jƒ‰ ‡ fdd„tdtˆ ƒdƒD ƒD ]}|j |¡r  dS qdS )Nc                   ó   g | ]}ˆ | ‘qS r(   r(   ©Ú.0rz   ©Ú_m_pathr(   r*   Ú
<listcomp>ï   ó    z0PathRegistry.contains_mapper.<locals>.<listcomp>r   r   TF)r   ru   r"   rw   r_   r|   Úisa)rH   r|   Úpath_mapperr(   r�   r*   Úcontains_mapperí   s   "ÿzPathRegistry.contains_mapperc                 C  s   || j f|v S r'   r)   )rH   rQ   rS   r(   r(   r*   Úcontainsõ   ó   zPathRegistry.containsc                 C  s   t |  ¡ ffS r'   )r3   Ú	serializerM   r(   r(   r*   Ú
__reduce__ø   r‰   zPathRegistry.__reduce__r1   c              
     sv   t t|ƒ‰ t t|ƒ‰tttdd„ ‡ fdd„tdtˆ ƒdƒD ƒD ƒƒtdd„ ‡fdd„td	tˆƒdƒD ƒD ƒƒd
 ƒƒS )Nc                 s  s*   � | ]}|j s
|jr|jnt|ƒV  qd S r'   )Ú	is_mapperÚis_aliased_classÚclass_Ústr)r€   Úmr(   r(   r*   Ú	<genexpr>  s
   € ÿ
ÿz/PathRegistry._serialize_path.<locals>.<genexpr>c                   r~   r(   r(   r   r�   r(   r*   rƒ     r„   z0PathRegistry._serialize_path.<locals>.<listcomp>r   r   c                 s  s&   � | ]}t |ƒr|jnt|ƒV  qd S r'   )r   rS   r�   )r€   Úpr(   r(   r*   r‘     s
   € ÿ
ÿc                   r~   r(   r(   r   )Ú_p_pathr(   r*   rƒ     r„   r   r'   )r   ru   rv   ÚlistÚzipÚtuplerw   r_   )Úclsr"   r(   )r‚   r“   r*   Ú_serialize_pathû   s   

þþüûÿzPathRegistry._serialize_pathc                   sP   ddd„‰ddd„‰ t t‡ ‡fd	d
„|D ƒŽ ƒ}|r&|d d u r&|dd… }|S )NÚmclsr   r$   c                 S  s"   | t jvrtj| dd�S t j|  S ©NT)Ú	configure)Ú	PathTokenÚ_internÚorm_baseÚ_inspect_mapped_class)r™   r(   r(   r*   Ú_deserialize_mapper_token  s
   
ÿýûzAPathRegistry._deserialize_path.<locals>._deserialize_mapper_tokenrS   c                 S  sD   |d u rd S |t jv rt j| S tj| dd�}|d usJ ‚|j| S rš   )rœ   r�   rž   rŸ   Úattrs)r™   rS   Úmpr(   r(   r*   Ú_deserialize_key_token  s   


z>PathRegistry._deserialize_path.<locals>._deserialize_key_tokenc                   s"   g | ]\}}ˆ|ƒˆ ||ƒf‘qS r(   r(   )r€   r™   rS   ©r£   r    r(   r*   rƒ   %  s    ýþÿz2PathRegistry._deserialize_path.<locals>.<listcomp>éÿÿÿÿr   )r™   r   r$   r   )r™   r   rS   r   r$   r   )r–   r   ©r—   r"   r’   r(   r¤   r*   Ú_deserialize_path  s   

	
ûÿÿzPathRegistry._deserialize_pathc                 C  s   | j }|  |¡S r'   )r"   r˜   )rH   r"   r(   r(   r*   rŠ   2  s   
zPathRegistry.serializec                 C  s    |d usJ ‚|   |¡}|  |¡S r'   )r§   Úcoercer¦   r(   r(   r*   r2   6  s   

zPathRegistry.deserializeÚCachingEntityRegistryc                 C  r&   r'   r(   ©r—   r|   r(   r(   r*   Ú
per_mapper<  ó   zPathRegistry.per_mapperúAliasedInsp[Any]ÚSlotsEntityRegistryc                 C  r&   r'   r(   rª   r(   r(   r*   r«   @  r¬   c                 C  s   |j r	t| j|ƒS t| j|ƒS r'   )rŒ   r©   r>   r®   rª   r(   r(   r*   r«   D  s   Úrawc                 C  s   ddd„}t ||| jƒS )	NÚprevr#   Únext_rj   r$   c                 S  ó   | | S r'   r(   ©r°   r±   r(   r(   r*   Ú_redO  rc   z!PathRegistry.coerce.<locals>._red©r°   r#   r±   rj   r$   r#   )r   r>   )r—   r¯   r´   r(   r(   r*   r¨   M  s   
zPathRegistry.coercec                 C  s   ddd„}t ||j| ƒS )	Nr°   r#   r±   rj   r$   c                 S  r²   r'   r(   r³   r(   r(   r*   r´   V  rc   z"PathRegistry.__add__.<locals>._redrµ   )r   r"   )rH   r@   r´   r(   r(   r*   Ú__add__U  s   
zPathRegistry.__add__r�   c                 C  s   dd  dd„ | jD ƒ¡› d�S )Nz	ORM Path[z -> c                 s  s   � | ]}t |ƒV  qd S r'   ©r�   )r€   Úelemr(   r(   r*   r‘   \  s   € z'PathRegistry.__str__.<locals>.<genexpr>ú])Újoinr"   rM   r(   r(   r*   Ú__str__[  s   zPathRegistry.__str__c                 C  s   | j j› d| j›d�S )Nú(ú))Ú	__class__Ú__name__r"   rM   r(   r(   r*   Ú__repr__^  s   zPathRegistry.__repr__)r@   r   r$   r8   ©r$   rL   )rN   rO   r$   r/   )rQ   rR   rS   r   rT   r   r$   rU   r'   )rQ   rR   rS   r   rT   r[   r$   r   )r$   rO   )rd   re   r$   rf   )rd   rO   r$   rj   )rd   rk   r$   r:   )rd   r/   r$   rl   )rd   r0   r$   rn   )rd   ro   r$   rp   )r$   rt   )r|   r}   r$   r8   )rQ   rR   rS   r   r$   r8   )r$   r   )r"   r:   r$   r1   )r"   r1   r$   r:   )r$   r1   ©r"   r1   r$   r#   )r|   r}   r$   r©   )r|   r­   r$   r®   )r|   r/   r$   rl   )r¯   r:   r$   r#   )r@   r#   r$   r#   )r$   r�   )*r¿   Ú
__module__Ú__qualname__Ú__doc__Ú	__slots__Úis_tokenr+   Ú
has_entityÚis_propertyr.   Ú__annotations__r   ÚExtendedInternalTraversalÚdp_has_cache_key_listr?   rI   rK   ÚpropertyrC   rP   rY   rZ   r\   r`   rb   r   rh   rr   r{   r‡   rˆ   r‹   Úclassmethodr˜   r§   rŠ   r2   r«   r¨   r¶   r»   rÀ   r(   r(   r(   r*   r#   X   s~   
 
ÿ






ÿ
	







#

c                   @  s,   e Zd ZU dZded< ded< dd	d
„ZdS )ÚCreatesTokenr(   r8   r�   r+   Útokenre   r$   rf   c                 C  sF   |  dt› �¡rt| |ƒS |  dt› �¡rt| j|ƒS t d|› �¡‚)Nú:zinvalid token: )Úendswithr6   rf   Ú_DEFAULT_TOKENr>   r   ÚArgumentError)rH   rÐ   r(   r(   r*   rÐ   h  s
   
zCreatesToken.tokenN)rÐ   re   r$   rf   )r¿   rÃ   rÄ   rÆ   rÊ   rÐ   r(   r(   r(   r*   rÏ   b  s
   
 rÏ   c                   @  sP   e Zd ZdZdZdZd ZZdZdZ	dZ
dZdd	d
„Zddd„Zes&eZdS dS )r=   zXRoot registry, defers to mappers so that
    paths are maintained per-root-mapper.

    r(   TFrd   r   r$   ú,Union[TokenRegistry, AbstractEntityRegistry]c                 C  sR   |t jv rtrt|tƒsJ ‚t| t j| ƒS z|jW S  ty(   td|› �ƒ‚w )Nz/invalid argument for RootRegistry.__getitem__: )	rœ   r�   r   Ú
isinstancere   rf   Ú_path_registryrD   Ú
IndexErrorrg   r(   r(   r*   Ú_getitem�  s   
ÿÿzRootRegistry._getitemc                 C  ó   | S r'   r(   rM   r(   r(   r*   Ú_truncate_recursive�  ri   z RootRegistry._truncate_recursiveN)rd   r   r$   rÕ   )r$   r=   )r¿   rÃ   rÄ   rÅ   rÆ   Úinherit_cacher"   r;   rÈ   r�   r+   r9   rÙ   rÛ   r   rh   r(   r(   r(   r*   r=   q  s    

ÿr=   c                   @  sD   e Zd ZU dZi Zded< dd	d
„Zeddd„ƒZe	ddd„ƒZ
dS )rœ   zcacheable string tokenzDict[str, PathToken]r�   r   Ú
bindparamsúList[BindParameter[Any]]r$   úTuple[Any, ...]c                 C  s
   t | ƒfS r'   r·   )rH   r   rÝ   r(   r(   r*   Ú_gen_cache_keyŸ  s   
zPathToken._gen_cache_keyrL   c                 C  r&   r'   r(   rM   r(   r(   r*   rC   ¤  r¬   zPathToken._path_for_compareÚstrvaluer�   c                 C  s*   || j v r
| j | S t|ƒ | j |< }|S r'   )r�   rœ   )r—   rá   Úresultr(   r(   r*   Úintern¨  s   

zPathToken.internN)r   r   rÝ   rÞ   r$   rß   rÁ   )rá   r�   r$   rœ   )r¿   rÃ   rÄ   rÅ   r�   rÊ   rà   rÍ   rC   rÎ   rã   r(   r(   r(   r*   rœ   š  s   
 
rœ   c                   @  sb   e Zd ZU dZdZded< ded< ddd„Zd	ZdZddd„Z	ddd„Z
ddd„Zes/eZdS dS )rf   )rÐ   r<   r"   r;   Tre   rÐ   rÏ   r<   c                 C  s6   t  |¡}|| _|| _|j|f | _|j|f | _d S r'   )rœ   rã   rÐ   r<   r"   r;   )rH   r<   rÐ   r(   r(   r*   Ú__init__¹  s
   
zTokenRegistry.__init__Fr$   úIterator[PathRegistry]c                 c  sª   � | j }t|ƒr| V  d S trt|tƒsJ ‚|js-|j ¡ D ]}t|j | | j	ƒV  qd S |jrPt
d|jƒjrP| V  t
d|jƒjD ]}t|j | | j	ƒV  qAd S | V  d S ©Nr­   )r<   r+   r   rÖ   rl   r�   r|   Úiterate_to_rootrf   rÐ   r   rd   Ú_is_with_polymorphicÚ_with_polymorphic_entities©rH   r<   Úmp_entÚentr(   r(   r*   Úgenerate_for_superclassesÅ  s8   €ÿÿþûÿþý
z'TokenRegistry.generate_for_superclassesúIterator[_PathRepresentation]c                 c  sª   � | j }t|ƒr| jV  d S trt|tƒsJ ‚|j ¡ D ]}t|j | | j	ƒjV  q|j
rOtd|jƒjrO| jV  td|jƒjD ]}t|j | | j	ƒjV  q?d S | jV  d S ræ   )r<   r+   r;   r   rÖ   rl   r|   rç   rf   rÐ   r�   r   rd   rè   ré   rê   r(   r(   r*   Ú"_generate_natural_for_superclassesà  s6   €ÿþûÿþÿýz0TokenRegistry._generate_natural_for_superclassesrd   r   c              
   C  s2   z| j | W S  ty } zt|› ƒ|‚d }~ww r'   )r"   Ú	TypeErrorrØ   )rH   rd   Úerrr(   r(   r*   rÙ   ý  s   €ÿzTokenRegistry._getitemN)r<   rÏ   rÐ   re   )r$   rå   )r$   rî   ©rd   r   r$   r   )r¿   rÃ   rÄ   rÆ   rÜ   rÊ   rä   rÈ   rÇ   rí   rï   rÙ   r   rh   r(   r(   r(   r*   rf   ±  s   
 



ÿrf   c                   @  sj   e Zd ZU dZdZdZded< ded< ded< ddd„Zddd„Ze	ddd„ƒZ
ddd„Zes3eZdS dS )rn   )Úpropr<   r"   r;   rÈ   rd   r|   Ú_wildcard_path_loader_keyÚ_default_path_loader_keyÚ_loader_keyr9   Tr0   ró   zOptional[Mapper[Any]]r|   z"Optional[_InternalEntityType[Any]]rd   r<   rl   c                 C  s^  t d|d ƒ}|}|jjpt|jjƒ| _|jr|jr#|j|j  }}nB|jrL|jrL|j|jv rL|d  	|j¡}|j| }|jrI|j|j }d| _n|}n|jre|jre|j|jure|j 
|j¡re|j|j }|| _|| _|j|f | _|j|f | _|j| _|jr’tr‰t|tƒs‰J ‚|j| _|j| _nd | _d | _d|j| jj f| _| jj| _d| jf| _d S )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   rd   Ú_wildcard_tokenrô   rõ   rö   )rH   r<   ró   ÚinspÚnatural_parentÚsubclass_entityr(   r(   r*   rä     sZ   
ÿÿþ
 ÿþÿþ
þ
zPropRegistry.__init__r$   c                 C  sX   d }t t| jd d… ƒƒD ]\}}|| ju r|}q|d u r| S |  | jd|d  … ¡S )Nr¥   r   r   )Ú	enumerateÚreversedr"   ró   r¨   )rH   Úearliestrz   rÐ   r(   r(   r*   rÛ   v  s   
€z PropRegistry._truncate_recursivec                 C  s   | j d usJ ‚| | j  S r'   )rd   rM   r(   r(   r*   Úentity_path�  s   
zPropRegistry.entity_pathú+Union[int, slice, _InternalEntityType[Any]]úDUnion[AbstractEntityRegistry, _PathElementType, _PathRepresentation]c                 C  s"   t |ttfƒr| j| S t| |ƒS r'   )rÖ   rO   rk   r"   r®   rg   r(   r(   r*   rÙ   †  s   

zPropRegistry._getitemN)r<   rl   ró   r0   )r$   rn   ©r$   rl   )rd   r  r$   r  )r¿   rÃ   rÄ   rÆ   rÜ   rÉ   rÊ   rä   rÛ   rÍ   r  rÙ   r   rh   r(   r(   r(   r*   rn     s   
 

Z
ÿrn   c                   @  s˜   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
d„Zddd„Ze	d dd„ƒZ
e	d!dd„ƒZe	d"dd„ƒZd#dd„Zd$dd„ZesJeZdS dS )%rl   )rS   r<   r�   r"   rd   r;   Tú!Union[RootRegistry, PropRegistry]r<   r/   rS   rd   r8   r�   c                 C  sˆ   || _ || _|j| _|| _|j|f | _|jr>| js|jr>|j |jd j¡r1|j|jf | _d S |j|jd jf | _d S | j| _d S )Nr¥   )	rS   r<   r�   rd   r"   r9   r|   r…   r;   ©rH   r<   rd   r(   r(   r*   rä   ¤  s   
ÿzAbstractEntityRegistry.__init__r$   c                 C  s   | j  ¡ | j S r'   )r<   rÛ   rd   rM   r(   r(   r*   rÛ   Ò  s   z*AbstractEntityRegistry._truncate_recursivec                 C  s
   |   d¡S )Nr   )rP   rM   r(   r(   r*   Úroot_entityÕ  rs   z"AbstractEntityRegistry.root_entityr#   c                 C  rÚ   r'   r(   rM   r(   r(   r*   r  Ù  r¬   z"AbstractEntityRegistry.entity_pathr}   c                 C  s   | j jS r'   )rd   r|   rM   r(   r(   r*   r|   Ý  s   zAbstractEntityRegistry.mapperc                 C  s   dS )NTr(   rM   r(   r(   r*   Ú__bool__á  ri   zAbstractEntityRegistry.__bool__r   ú:Union[_PathElementType, _PathRepresentation, PathRegistry]c                 C  s<   t |ttfƒr| j| S |tjv rt| tj| ƒS t| |ƒS r'   )rÖ   rO   rk   r"   rœ   r�   rf   rn   rg   r(   r(   r*   rÙ   ä  s
   


zAbstractEntityRegistry._getitemN©r<   r	  rd   r/   r  )r$   r/   )r$   r#   )r$   r}   )r$   r8   )rd   r   r$   r  )r¿   rÃ   rÄ   rÆ   rÈ   r.   rÊ   rä   rÛ   rÍ   r  r  r|   r  rÙ   r   rh   r(   r(   r(   r*   rl   ’  s*   
 	

.


ÿrl   c                   @  s   e Zd ZdZdS )r®   TN)r¿   rÃ   rÄ   rÜ   r(   r(   r(   r*   r®   ò  s    r®   c                   @  s    e Zd Zddd„Zdd	d
„ZdS )Ú_ERDictÚregistryr©   c                 C  s
   || _ d S r'   )r  )rH   r  r(   r(   r*   rä   ù  r4   z_ERDict.__init__rS   r   r$   rn   c                 C  s   t | j|ƒ | |< }|S r'   )rn   r  )rH   rS   Úitemr(   r(   r*   Ú__missing__ü  s   z_ERDict.__missing__N)r  r©   )rS   r   r$   rn   )r¿   rÃ   rÄ   rä   r  r(   r(   r(   r*   r  ø  s    
r  c                      sJ   e Zd ZdZdZd‡ fdd„Zddd„Zddd„Zes!eZ	‡  Z
S ‡  Z
S )r©   )Ú_cacheTr<   r	  rd   r/   c                   s   t ƒ  ||¡ t| ƒ| _d S r'   )Úsuperrä   r  r  r
  ©r¾   r(   r*   rä   
  s   zCachingEntityRegistry.__init__rS   r   Údefaultr$   c                 C  s   | j  ||¡S r'   )r  Úpop)rH   rS   r  r(   r(   r*   r    r‰   zCachingEntityRegistry.popc                 C  s6   t |ttfƒr| j| S t |tƒrt| |ƒS | j| S r'   )rÖ   rO   rk   r"   rœ   rf   r  rg   r(   r(   r*   rÙ     s
   



zCachingEntityRegistry._getitemr  )rS   r   r  r   r$   r   rò   )r¿   rÃ   rÄ   rÆ   rÜ   rä   r  rÙ   r   rh   Ú__classcell__r(   r(   r  r*   r©     s    

ÿr©   c                 C  r&   r'   r(   r)   r(   r(   r*   Úpath_is_entity#  r¬   r  úTypeGuard[PropRegistry]c                 C  r&   r'   r(   r)   r(   r(   r*   Úpath_is_property'  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+   r.   Ú
attrgetterr1   r�   re   rj   r:   ru   rv   Ú	getLoggerr¿   rV   r3   r6   rÊ   rÓ   r#   rÏ   r=   r>   ÚInspectionAttrrœ   rf   rn   rl   r®   r  r©   r  r  r(   r(   r(   r*   Ú<module>   sŠ   


ÿ


  &V `


