
    ,hEG                       % S r SSKJ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  SSKJr  SSKJr  SSKJr  SSKJr  \(       a  SSKJr  SSKJr  \	\ \4   r!\RD                  r#S\$S'    " S S \5      r% " S! S"\%5      r& " S# S$\&5      r' " S% S&\%5      r(0 r)S'\$S('   \" S)S S*9r*S5S+ jr+ S6S,S,SS-.             S7S. jjjr,\ S6     S8S/ jj5       r-\ S6     S9S0 jj5       r- S6     S:S1 jjr-S;S2 jr.      S<S3 jr/      S=S4 jr0g)>a*  The :class:`.Annotated` class and related routines; creates hash-equivalent
copies of SQL constructs which contain context-specific markers and
associations.

Note that the :class:`.Annotated` concept as implemented in this module is not
related in any way to the pep-593 concept of "Annotated".


    )annotationsN)Any)Callable)cast)Dict)	FrozenSet)Mapping)Optional)overload)Sequence)Tuple)Type)TYPE_CHECKING)TypeVar   )	operators)HasCacheKey)anon_map)ExternallyTraversible)InternalTraversal   )util)Literal)Self)_EntityNamespace)_TraverseInternalsTypeutil.immutabledict[str, Any]EMPTY_ANNOTATIONSc                      \ rS rSr% Sr\rS\S'   S\S'   S\S'   SS	 jr\	  S     SS
 jj5       r
\	  S     SS jj5       r
  S     SS jjr
\R                  SS j5       r    SS jrSrg)SupportsAnnotations5    r   _annotationsz*util.generic_fn_descriptor[FrozenSet[Any]]	proxy_setbool_is_immutablec                    [        5       eNNotImplementedErrorselfvaluess     Q/var/www/auris/envauris/lib/python3.13/site-packages/sqlalchemy/sql/annotation.py	_annotateSupportsAnnotations._annotate>   s    !##    c                    g r(   r"   r,   r-   clones      r.   _deannotateSupportsAnnotations._deannotateA       
 r1   c                    g r(   r"   r3   s      r.   r5   r6   H       
 "r1   Nc                    [        5       er(   r)   r3   s      r.   r5   r6   O   s    
 "##r1   c                8    [        5       nU R                  U5      $ r(   )r   _gen_annotations_cache_key)r,   	anon_map_s     r.   _annotations_cache_key*SupportsAnnotations._annotations_cache_keyV   s    J	..y99r1   c           
        ^ S[        U4S j[        U R                  5       Vs/ s H  nX R                  U   4PM     sn 5       5      4$ s  snf )Nr#   c              3  ~   >#    U  H2  u  pU[        U[        5      (       a  UR                  T/ 5      OU4v   M4     g 7fr(   )
isinstancer   _gen_cache_key).0keyvaluer   s      r.   	<genexpr>ASupportsAnnotations._gen_annotations_cache_key.<locals>.<genexpr>a   sG      #JC  &e[99 ,,Xr:"#s   :=)tuplesortedr#   )r,   r   rE   s    ` r.   r<   .SupportsAnnotations._gen_annotations_cache_key\   s_        &d&7&78#8 ++C018# 
 	
#s   Ar-   _AnnotationDictreturnr   ..r-   Literal[None]r4   r%   rN   r   r-   Sequence[str]r4   r%   rN   r    NFr-   Optional[Sequence[str]]r4   r%   rN   r    )rN   Tuple[Any, ...])r   r   rN   rW   )__name__
__module____qualname____firstlineno__	__slots__r   r#   __annotations__r/   r   r5   r   memoized_propertyr>   r<   __static_attributes__r"   r1   r.   r    r    5   s    I1BL.B99$  !$  
	   !$"" " 
	" " +/$'$ $ 
	$ 
: :

 
	
r1   r    c                      \ rS rSr% SrS\S'   \(       a  \R                  SS j5       r	SS jr
SS jr\  S     SS jj5       r\  S     SS	 jj5       r  S     SS jjrSrg
)SupportsWrappingAnnotationsr   r"   z*Callable[..., SupportsWrappingAnnotations]_constructorc                    g r(   r"   r,   s    r.   entity_namespace,SupportsWrappingAnnotations.entity_namespacey   s    8;r1   c                ,    [         R                  X5      $ )Wreturn a copy of this ClauseElement with annotations
updated by the given dictionary.

	Annotated_as_annotated_instancer+   s     r.   r/   %SupportsWrappingAnnotations._annotate|       
 //==r1   c                ,    [         R                  X5      $ )Xreturn a copy of this ClauseElement with annotations
replaced by the given dictionary.

rj   r+   s     r.   _with_annotations-SupportsWrappingAnnotations._with_annotations   rn   r1   c                    g r(   r"   r3   s      r.   r5   'SupportsWrappingAnnotations._deannotate   r7   r1   c                    g r(   r"   r3   s      r.   r5   rt      r9   r1   Nc                8    U(       a  U R                  5       nU$ U $ )return a copy of this :class:`_expression.ClauseElement`
with annotations
removed.

:param values: optional tuple of individual values
 to remove.

)_clone)r,   r-   r4   ss       r.   r5   rt      s     AHKr1   rN   r   rL   rO   rP   rR   rT   rU   )rX   rY   rZ   r[   r\   r]   r   r   ro_non_memoized_propertyrf   r/   rq   r   r5   r_   r"   r1   r.   ra   ra   r   s    I<<		&	&; 
';>>  !$  
	   !$"" " 
	" " +/'  
	 r1   ra   c                      \ rS rSr% \R
                  (       d  SrS\R                  4/r	S\
S'   SS jrSS jr\  S     SS jj5       r\  S     SS	 jj5       r  S     SS jjrSrg
)SupportsCloneAnnotations   r"   r#   r   %_clone_annotations_traverse_internalsc                    U R                  5       nUR                  R                  U5      Ul        UR                  R	                  SS5        UR                  R	                  SS5        U$ )ri   r>   N_generate_cache_key)rx   r#   union__dict__popr,   r-   news      r.   r/   "SupportsCloneAnnotations._annotate   sW    
 kkm++11&9148.5
r1   c                    U R                  5       n[        R                  " U5      Ul        UR                  R                  SS5        UR                  R                  SS5        U$ )rp   r>   Nr   )rx   r   immutabledictr#   r   r   r   s      r.   rq   *SupportsCloneAnnotations._with_annotations   sQ    
 kkm--f5148.5
r1   c                    g r(   r"   r3   s      r.   r5   $SupportsCloneAnnotations._deannotate   r7   r1   c                    g r(   r"   r3   s      r.   r5   r      r9   r1   Nc                    U(       d  U R                   (       aH  U R                  5       n[        R                  " 5       Ul         UR                  R                  SS5        U$ U $ )rw   r>   N)r#   rx   r   r   r   r   )r,   r-   r4   r   s       r.   r5   r      sL     D%% ++-C#113CLL5t<JKr1   rL   rO   rP   rR   rT   rU   )rX   rY   rZ   r[   typingr   r\   r   dp_annotations_keyr   r]   r/   rq   r   r5   r_   r"   r1   r.   r}   r}      s     	 
*==>E)+A 		  !$  
	   !$"" " 
	" " +/'  
	 r1   r}   c                     \ rS rSr% SrSr\      SS j5       rS\S'   S\S'   S	\S
'   SS jr	    SS jr
SS jrSS jr\  S     S S jj5       r\  S     S!S jj5       r  S"     S#S jjr\R                   (       d  S$S jr\S 5       rS%S jrS&S jrS'S jrS(S jr\R2                  S)S j5       rSrg)*rk      a  clones a SupportsAnnotations and applies an 'annotations' dictionary.

Unlike regular clones, this clone also mimics __hash__() and
__eq__() of the original element so that it takes its place
in hashed collections.

A reference to the original element is maintained, for the important
reason of keeping its hash value current.  When GC'ed, the
hash value may be reused, causing conflicts.

.. note::  The rationale for Annotated producing a brand new class,
   rather than placing the functionality directly within ClauseElement,
   is **performance**.  The __hash__() method is absent on plain
   ClauseElement which leads to significantly reduced function call
   overhead, as the use of sets and dictionaries against ClauseElement
   objects is prevalent, but most are not "annotated".

Fra   c                     [         UR                     n U " X5      $ ! [         a    [        UR                  U 5      n  N*f = fr(   )annotated_classes	__class__KeyError_new_annotation_type)clselementr-   s      r.   rl    Annotated._as_annotated_instance  sG    	?#G$5$56C 7##  	?&w'8'8#>C	?s     A A r   r#   _Annotated__elementint_hashc                ,    [         R                  U 5      $ r(   )object__new__)r   argss     r.   r   Annotated.__new__  s    ~~c""r1   c                   UR                   R                  5       U l         U R                   R                  SS 5        U R                   R                  SS 5        Xl        [        R
                  " U5      U l        [        U5      U l        g Nr>   r   )	r   copyr   r   r   r   r#   hashr   )r,   r   r-   s      r.   __init__Annotated.__init__  sg      ((--/2D9/6  ..v6']
r1   c                ^    U R                   R                  U5      nU R                  U5      nU$ r(   )r#   r   rq   )r,   r-   _valuesr   s       r.   r/   Annotated._annotate(  s-    ##))&1$$W-
r1   c                4   U R                   R                  U R                   5      nU R                  R                  5       Ul        UR                  R	                  SS 5        UR                  R	                  SS 5        [
        R                  " U5      Ul        U$ r   )r   r   r   r   r   r   r   r#   r3   s      r.   rq   Annotated._with_annotations-  sp    &&t~~6++-3T:0$7!//7r1   c                    g r(   r"   r3   s      r.   r5   Annotated._deannotate5  r7   r1   c                    g r(   r"   r3   s      r.   r5   r   <  s    
 r1   Nc           
         Uc  U R                   $ U R                  [        R                  " U R                  R                  5        VVs0 s H  u  p4X1;  d  M  X4_M     snn5      5      $ s  snnf r(   )r   rq   r   r   r#   items)r,   r-   r4   rE   rF   s        r.   r5   r   C  sq    
 >>>!))"" +/*;*;*A*A*C*CJC, #
*C s   A)A)c                P    U R                   R                  R                  " X40 UD6$ r(   )r   r   _compiler_dispatch)r,   visitorkws      r.   r   Annotated._compiler_dispatchW  s*    >>++>>!# r1   c                .    U R                   R                  $ r(   )r   rc   re   s    r.   rc   Annotated._constructor\  s    >>...r1   c                    U R                   R                  " S0 UD6nX R                   L a  U $ UR                  R                  U R                  5        U R	                  X R
                  5      $ )Nr"   )r   rx   r   updater   r#   )r,   r   r4   s      r.   rx   Annotated._clone`  sU    %%++NN"K NN!!$--0>>%):):;;r1   c                J    U R                   U R                  U R                  44$ r(   )r   r   r#   re   s    r.   
__reduce__Annotated.__reduce__k  s     ~~0A0ABBBr1   c                    U R                   $ r(   )r   re   s    r.   __hash__Annotated.__hash__n  s    zzr1   c                    U R                   (       a%  U R                  R                  R                  X5      $ [	        U5      [	        U 5      :H  $ r(   )_is_column_operatorsr   r   __eq__r   )r,   others     r.   r   Annotated.__eq__q  s9    $$>>++224??;$t*,,r1   c                    SU R                   ;   a'  [        [        U R                   S   5      R                  $ U R                  R                  $ )Nrf   )r#   r   ra   rf   r   re   s    r.   rf   Annotated.entity_namespacew  sI    !2!22+!!"45 
 >>222r1   )r   	__elementr#   r   )r   ra   r-   rM   rN   rk   )r   z
Type[Self]r   r   rN   r   )r   ra   r-   rM   rL   rO   rP   )r-   rS   r4   r%   rN   rk   )NTrU   )r   r   r   r   rN   r   )r   r   rN   r   )rN   z'Tuple[Type[Annotated], Tuple[Any, ...]])rN   r   )r   r   rN   r%   rz   )rX   rY   rZ   r[   __doc__r   classmethodrl   r]   r   r   r/   rq   r   r5   r   r   r   propertyrc   rx   r   r   r   r   r{   rf   r_   r"   r1   r.   rk   rk      s\   & !$1$;J$	$ $ /.**J##2#<K#
  !$  
	   !$  
	  +/'  
	$ 	
 
	/ 
	/	<C- 
""3 #3r1   rk   z8Dict[Type[SupportsWrappingAnnotations], Type[Annotated]]r   _SA)boundc                P     U R                   nU" U5      $ ! [         a    U s $ f = fr(   )r/   AttributeError)to_annotater   r/   s      r.   _safe_annotater     s8    &))	 %%   	s    %%F)detect_subquery_colsind_cols_on_fromclauseannotate_callablec               j   ^^^^^^^ 0 mSUUUUUUU4S jjmU b  [        [        T" U 5      5      n SmU $ )zDeep copy the given ClauseElement, annotating each element
with the given annotations dictionary.

Elements within the exclude collection will be cloned but not annotated.

c                  > T	US'   [        U 5      nUT;   a  TU   $ T
(       aF  [        U S5      (       a5  U R                  R                  T
5      (       a  U R                  " SST0UD6nO_TU R
                  :w  aM  T	(       a&  U R                  (       a  U R                  " SST0UD6nOU nT(       a
  T" UT5      nO[        UT5      nOU nUR                  TTS9  UTU'   U$ )Nr   r$   r4   )r4   r   r"   )	idhasattrr$   intersectionrx   r#   r&   r   _copy_internals)elemr   id_newelemr   r   r   r4   
cloned_idsr   excluder   s        r.   r4   _deep_annotate.<locals>.clone  s     &:!"h*c?" k**++G44kk444GD---#(:(:"kk<<<" +KE(kBG0F 	  	
 "
3r1   Nr   r    r   r   rN   r    r   r   )r   r   r   r   r   r   r4   r   s    `````@@r.   _deep_annotater     s7    * 24J' 'R sE'N+ENr1   c                    g r(   r"   r   r-   s     r.   _deep_deannotater     s     r1   c                    g r(   r"   r   s     r.   r   r     s     r1   c                Z   ^^^ 0 mSUUU4S jjmU b  [        [        T" U 5      5      n SmU $ )z2Deep copy the given element, removing annotations.c                   > T(       a  [        U 5      nOU nUT;  a&  U R                  TSS9nUR                  TS9  UTU'   U$ TU   $ )NT)r-   r4   )r4   )r   r5   r   )r   r   rE   r   r4   clonedr-   s       r.   r4   _deep_deannotate.<locals>.clone  sZ    T(CCf&&fD&AG##%#0!F3KN#;r1   Nr   r   )r   r-   r4   r   s    `@@r.   r   r     s6    
 .0F  sE'N+ENr1   c                H    U R                  U5      n U R                  5         U $ )zAnnotate the given ClauseElement and copy its internals so that
internal objects refer to the new annotated object.

Basically used to apply a "don't traverse" annotation to a
selectable, without digging throughout the whole
structure wasting time.
)r/   r   )r   r   s     r.   _shallow_annotater     s%     ,GNr1   c                D   [        U [        5      (       a  U $ U [        ;   a	  [        U    $ U R                   H  nU[        ;   d  M  [        U   n  O   [	        [
        [           [        SU R                  -  X40 5      5      =[        U '   nU[        5       SU R                  -  '   SU R                  ;   a/  [        U R                  5      S[        R                  4/-   Ul        OOU R                  R                  SS5      (       a.  [        U R                  5      S[        R                  4/-   Ul        U R                  R                  SS5      (       a  SUl        O$SU R                  ;   a  U R                  S   Ul        [        U [         R"                  5      Ul        U$ )zSGenerates a new class that subclasses Annotated and proxies a given
element type.

zAnnotated%s_traverse_internalsr#   inherit_cacheFT)
issubclassrk   r   __mro__r   r   typerX   globalsr   listr   r   r   getr   r   ColumnOperatorsr   )r   base_clssuper_anno_clss       r.   r   r     su    #y!!
	!	! %%++ &&(0H  )-Y]S\\)H?B?) cX /7GImcll*+,'+C,C,C'D.AABH
 (
$ 
		/5	1	1'+C,C,C'D.AABH
 (
$ ||//!%	CLL	(!$o!>$.sI4M4M$NH!Or1   c                T    [         R                  " U 5       H  n[        X!5        M     g r(   )r   walk_subclassesr   )target_hierarchyr   r   s      r.   _prepare_annotationsr   D  s"     ##$45S+ 6r1   )r   r   r   rM   rN   r   r(   )r   r   r   rM   r   z'Optional[Sequence[SupportsAnnotations]]r   r%   r   r%   r   zOOptional[Callable[[SupportsAnnotations, _AnnotationDict], SupportsAnnotations]]rN   r   )r   rQ   r-   rV   rN   rQ   )r   r   r-   rV   rN   r   )r   Optional[_SA]r-   rV   rN   r  )r   r   r   rM   rN   r   )r   !Type[SupportsWrappingAnnotations]r   Type[Annotated]rN   r  )r   r  r   r  rN   None)1r   
__future__r   r   r   r   r   r   r   r	   r
   r   r   r   r   r   r    r   	cache_keyr   visitorsr   r   r   r   util.typingr   r   baser   r   strrM   
EMPTY_DICTr   r]   r    ra   r}   rk   r   r   r   r   r   r   r   r   r"   r1   r.   <module>r     s   #                 "  + '  ! &0#s(#26// / A:
/ :
z7"5 7tH: HVH3# H3b  K  e01	& 8<C
 "'#( 	CC C 5C
 C !CC 	CL 
>B$; 

 
481 
 ?C$;8
,	*,6E,,^,7,, 
,r1   