
    ,ho                    t   % S r SSKJr  SSKJr  SSKrSSK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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.  S S'K/J0r0  S S(K1J2r2  S S)K1J3r3  S S*K1J4r4  \R$                  (       a  SS+K5J6r6  SS,K5J7r7  SS-KJ8r8  SS.KJ9r9  SS/KJ:r:  SS0K;J<r<  SS1K=J>r>  SS2K?J@r@  SS3KAJBrB  SS4KAJCrC  SS5KDJErE  S S6KFJGrG  S S7KHJIrI  S S8KJJKrK  S S9KJJLrL  S S:K/JMrM  S S;K/JNrN  S S<KOJPrP  S S=KQJRrR  S S>KSJTrT  S S?K1JUrU  S S@K1JVrV  S SAK1JWrW  S SBK1JXrX  \" SC\	SD9rY\" SE\	SD9rZ " SF SG\$\Y   5      r[\\\SHSISJSK4   r]\" SL\	SD9r^\R                  " 5       r`SM\aSN'    " SO SP\#\^   \"\[\^   5      rb " SQ SR\b\Y   \\Y   5      rc " SS ST\[\Y   5      rd " SU SV\[\Y   5      re " SW SX\e\Y   \\Y   5      rfg)YzDescriptor properties are more "auxiliary" properties
that exist as configurational elements, but don't participate
as actively in the load/persist ORM loop.

    )annotations)is_dataclassN)Any)Callable)Dict)List)NoReturn)Optional)Sequence)Tuple)Type)TYPE_CHECKING)TypeVar)Union   )
attributes)util)_DeclarativeMapped)LoaderCallableStatus)Mapped)PassiveFlag)SQLORMOperations)_AttributeOptions)_IntrospectsAnnotations)_MapsColumns)MapperProperty)PropComparator)	_none_set)de_stringify_annotation   )event)exc)schema)sql
expression)	operators)BindParameter)get_args)
is_fwd_ref)	is_pep593)_InstanceDict)_RegistryType)History)InstrumentedAttribute)QueryableAttribute)ORMCompileState)_ClassScanMapperConfig)Mapper)ColumnProperty)MappedColumn)InstanceState)
Connection)Row)_DMLColumnArgument)	_InfoType)
ClauseList)ColumnElement)OperatorType)Column)Select)_AnnotationScanType)CallableReference)DescriptorReference)RODescriptorReference_T)bound_PTc                  v    \ rS rSr% SrSrS\S'   SrSrS\S'   \	R                  4       SS	 jjrSS
 jrSrg)DescriptorProperty[   zK:class:`.MapperProperty` which proxies access to a
user-defined descriptor.NOptional[str]docFzDescriptorReference[Any]
descriptorc                    [        5       eN)NotImplementedError)selfstatedict_passives       W/var/www/auris/envauris/lib/python3.13/site-packages/sqlalchemy/orm/descriptor_props.pyget_historyDescriptorProperty.get_historyf   s     "##    c           	       ^ ^^ T m " U4S jS[         R                  5      nT R                  cI  [        TR                  T R
                  S 5      nTR                  T R
                  U5      (       a  UT l        T R                  c'  S	U 4S jjnS
U 4S jjnSU 4S jjn[        XdUS9T l        [         R                  " T R                  5      " T R                  R                  T R
                  T R                  UU 4S jT R                  T S9nU" T R
                  5      Ul        TR                  R                  T R
                  U5        g )Nc                  ~   > \ rS rSrSrSrSr\S	U 4S jj5       rS
S jr	\
R                  4       SU 4S jjjrSrg)7DescriptorProperty.instrument_class.<locals>._ProxyImplq   FTc                   > TR                   $ rN   )uses_objectsrP   props    rT   r]   DDescriptorProperty.instrument_class.<locals>._ProxyImpl.uses_objectsv   s    (((rW   c                    Xl         g rN   key)rP   rc   s     rT   __init__@DescriptorProperty.instrument_class.<locals>._ProxyImpl.__init__z   s    rW   c                (   > TR                  XU5      $ rN   )rU   )rP   rQ   rR   rS   r_   s       rT   rU   CDescriptorProperty.instrument_class.<locals>._ProxyImpl.get_history}   s     ''g>>rW   rb   Nreturnbool)rc   strrQ   InstanceState[Any]rR   r,   rS   r   ri   r.   )__name__
__module____qualname____firstlineno__accepts_scalar_loaderload_on_unexpire
collectionpropertyr]   rd   r   PASSIVE_OFFrU   __static_attributes__)r_   s   rT   
_ProxyImplrZ   q   sf    $)!#J) ) (3'>'>	?)? %? %	?
 ? ?rW   rx   c                4   > [        U TR                  U5        g rN   )setattrname)objvaluerP   s     rT   fset1DescriptorProperty.instrument_class.<locals>.fset   s    TYY.rW   c                2   > [        U TR                  5        g rN   )delattrr{   r|   rP   s    rT   fdel1DescriptorProperty.instrument_class.<locals>.fdel   s    TYY'rW   c                0   > [        U TR                  5      $ rN   )getattrr{   r   s    rT   fget1DescriptorProperty.instrument_class.<locals>.fget   s    sDII..rW   )r   r~   r   c                 &   > TR                  T 5      $ rN   )_comparator_factory)mapperrP   s   rT   <lambda>5DescriptorProperty.instrument_class.<locals>.<lambda>   s    D,,V4rW   )rK   original_property)r|   r   r}   r   ri   None)r|   r   ri   r   )r|   r   ri   r   )r   AttributeImplrL   r   class_rc   _is_userland_descriptorru   create_proxied_attributeparentrK   implclass_managerinstrument_attribute)	rP   r   rx   descr~   r   r   
proxy_attrr_   s	   ``      @rT   instrument_class#DescriptorProperty.instrument_classn   s    	?11 	?( ??"6==$((D9D--dhh=="&??"/(/ 'D$GDO88IKKHHOO4"

 %TXX.
11$((JGrW   rL   rl   r   Mapper[Any]ri   r   )rn   ro   rp   rq   __doc__rK   __annotations__r]   _links_to_entityr   rv   rU   r   rw    rW   rT   rH   rH   [   s`      CL((  +66	$!$ $ 	$
 
$2HrW   rH   z
Column[_T]zMappedColumn[_T]zInstrumentedAttribute[_T]z
Mapped[_T]_CCzFweakref.WeakKeyDictionary[Type[Any], Callable[[Any], Tuple[Any, ...]]]_composite_gettersc                    ^  \ rS rSr% SrS\S'   S\S'   S\S'   S	\S
'    S*SSSSSSS.                 S+U 4S jjjjrS,U 4S jjrS-S jrS.S jr	\
" 5       rS.S jr\R                  " S5                          S/S j5       rS.S jr\R                  " S5      \R                  " S5                S0S j5       5       r\R$                  S1S j5       r\R$                  \R                  " S5      S2S j5       5       r\R*                  \R                  " S5      S3S j5       5       r\S4S j5       r\S5S j5       r\R                  " S5      S.S j5       rS.S jr\R$                  S6S  j5       r  S7S! jr\R>                  4       S8S" jjr     S9S# jr! " S$ S%\"RF                  \$   5      r% " S& S'\&\'   5      r(S:S( jr)S)r*U =r+$ );CompositeProperty   zDefines a "composite" mapped attribute, representing a collection
of columns as one attribute.

:class:`.CompositeProperty` is constructed using the :func:`.composite`
function.

.. seealso::

    :ref:`mapper_composite`

z$Union[Type[_CC], Callable[..., _CC]]composite_classz#Tuple[_CompositeAttrType[Any], ...]attrsz=CallableReference[Optional[Callable[[_CC], Tuple[Any, ...]]]]_generated_composite_accessorzType[Comparator[_CC]]comparator_factoryNF)attribute_optionsactive_historydeferredgroupr   infoc                 > [         T
U ]  US9  [        U[        [        [
        R                  45      (       a  U4U-   U l        S U l        OXl        Xl        X0l	        X@l
        XPl        Ub  UOU R                  R                  U l        S U l        Ub  U R                   R#                  U5        [$        R&                  " U 5        U R)                  5         U R+                  5         g N)r   )superrd   
isinstancer   rk   r$   r<   r   r   r   r   r   	__class__
Comparatorr   r   r   updater   set_creation_order_create_descriptor_init_accessor)rP   _class_or_attrr   r   r   r   r   r   r   kwargsr   s             rT   rd   CompositeProperty.__init__   s     	+<=nvsC4E4E&FGG(*U2DJ#'D #1 J, 
 "- ** 	
 .2*IIT"%!rW   c                D   > [         TU ]  U5        U R                  5         g rN   )r   r   _setup_event_handlers)rP   r   r   s     rT   r   "CompositeProperty.instrument_class   s     (""$rW   c                    U R                   (       a  U R                  U5      $  UR                  nU" 5       $ ! [         a4  n[        R                  " SU R
                  R                   S35      UeS nAff = f)NzComposite class zX is not a dataclass and does not define a __composite_values__() method; can't get state)r   __composite_values__AttributeErrorsa_excInvalidRequestErrorr   rn   )rP   r}   accessoraes       rT   _composite_values_from_instance1CompositeProperty._composite_values_from_instance   s    --55e<<	" 55  z! " 00&t';';'D'D&E F/ / 	s   7 
A5/A00A5c                $    U R                  5         g)zgInitialization which occurs after the :class:`.Composite`
has been associated with its parent mapper.

N)_setup_arguments_on_columnsrP   s    rT   do_initCompositeProperty.do_init  s    
 	((*rW   c                ^   ^ ^ SU 4S jjmSUU 4S jjnSUU 4S jjn[        TX5      T l        g)zdCreate the Python descriptor that will serve as
the access point on instances of the mapped class.

c                (  > [         R                  " U 5      n[         R                  " U 5      nTR                  U;  a  TR                   Vs/ s H  n[        X5      PM     nnTR                  U;  a  UR                  c  [        R                  " U5      (       dX  TR                  " U6 UTR                  '   UR                  R                  R                  UTR                  TR                  /5        UR                  TR                  S 5      $ s  snf rN   )r   instance_dictinstance_staterc   _attribute_keysr   r   
issupersetr   managerdispatchrefresh_COMPOSITE_FGETget)instancerR   rQ   rc   valuesrP   s        rT   r   2CompositeProperty._create_descriptor.<locals>.fget  s    ,,X6E--h7Exxu$
 7;6J6J6JsGH*6J   885(II)1E1Ef1M1M&*&:&:F&CE$((OMM**22t33dhhZ 99TXXt,,#s   Dc                b  > [         R                  " U 5      n[         R                  " U 5      nUR                  T	R                     nUR
                  R                  (       a	  T" U 5      nO*UR                  T	R                  [        R                  5      nUR
                  R                   H  nU" X1XTR                  5      nM     XT	R                  '   Uc   T	R                   H  n[        XS 5        M     g [        T	R                  T	R                  U5      5       H  u  pq[        XU5        M     g rN   )r   r   r   r   rc   r   _active_historyr   r   NO_VALUEsetr   r   rz   zipr   )
r   r}   rR   rQ   attrpreviousfnrc   r   rP   s
           rT   r~   2CompositeProperty._create_descriptor.<locals>.fset1  s    ,,X6E--h7E==*D}},,> 99TXX/C/L/LMmm''599= (#$((O}//CH40 0 #&((88?#JC H51	#rW   c                   > [         R                  " U 5      n[         R                  " U 5      nUR                  TR                     nUR
                  R                  (       a%  T" U 5      nUR                  TR                  S 5        O*UR                  TR                  [        R                  5      nUR                  TR                     nUR
                  R                  XUR                  5        TR                   H  n[        XS 5        M     g rN   )r   r   r   r   rc   r   r   popr   r   remover   r   rz   )r   rQ   rR   r   r   rc   r   rP   s         rT   r   2CompositeProperty._create_descriptor.<locals>.fdelH  s    --h7E,,X6E==*D}},,>		$((D) 99TXX/C/L/LM==*DMM  $))<++t, ,rW   N)r   r   ri   r   )r   r   r}   r   ri   r   )r   r   ri   r   )ru   rL   )rP   r~   r   r   s   `  @rT   r   $CompositeProperty._create_descriptor  s,    	-6	2 	2.	- 	-  #44rW   sqlalchemy.orm.propertiesc
                   [         R                  R                  R                  n
U R                  c  Uc  U R                  XS5        Un[        U5      (       a  [        U5      S   nU(       a  U R                  c}  [        U[        5      (       d  [        USS9(       aS  UcE  [        US5      (       a  UR                  O
[        U5      n[        R                  " SU SU S35      e[        X;USS9nXl        [!        U R                  5      (       a  U R#                  X#XE5        OXU R$                   HH  n[        X[&        R(                  45      (       d  M%  UR*                  b  M4  [        R                  " S	5      e   U R-                  5         g )
Nr   T)check_generic__forward_arg__zCan't use forward ref z9 for composite class argument; set up the type as Mapped[])include_genericzIComposite class column arguments must be named unless a dataclass is used)r   	preloadedorm_propertiesr5   r   _raise_for_requiredr+   r)   r   rk   r*   hasattrr   r   ArgumentErrorr   r   _setup_for_dataclassr   r#   r>   r{   r   )rP   	decl_scanregistryclsoriginating_modulerc   mapped_container
annotationextracted_mapped_annotationis_dataclass_fieldr5   argumentstr_argr   s                 rT   declarative_scan"CompositeProperty.declarative_scanZ  sm    ~~44AA  (+3$$S..X)!,H,,4(C((J- &- #8->?? !00 ] 
 !..0
 ;EELIQP  3#5t $, ,,--%%h5GM

tFMM%BCC		) ..5  # 	rW   c                  ^ [        U R                  5      (       a  [        U R                  S5      (       d  [        R                  " U R                  5      n[
        R                  " UR                  R                  5        Vs/ s H  o"R                  PM     sn6 m[        UR                  5      S:X  a  U4S jU l        OTU l        U R                  b  [        U R                  [        5      (       aq  U R                  [        ;  a\  U R                  b  U R                  [        U R                  '   g [        U R                  S5      (       a  S [        U R                  '   g g g g g s  snf )Nr   r   c                   > T" U 5      4$ rN   r   )r|   getters    rT   r   2CompositeProperty._init_accessor.<locals>.<lambda>  s    &+rW   c                "    U R                  5       $ rN   r   )r|   s    rT   r   r    s     8 8 :rW   )r   r   r   inspect	signatureoperator
attrgetter
parametersr   r{   lenr   r   typer   )rP   insppr  s      @rT   r    CompositeProperty._init_accessor  s2   ,,--g  "87
 7
 $$T%9%9:D(("&//"8"8":;":Q&&":;F 4??#q(5O25;2   ,4//66$$,>>11=66 #4#7#78 --/EFF: #4#7#78 G ? 7 - <s   E'zsqlalchemy.orm.decl_basec                .   [         R                  R                  R                  n[         R                  R                  n[
        R                  " U R                  5      n[        R                  " UR                  R                  5       U R                  5       H  u  pUcY  [        R                  " S[        U R                  5       SU R                  R                    S[        UR                  5       35      eU	c  U" 5       n	U =R                  U	4-  sl        [#        X5      (       a,  U	R%                  UUUUUR&                  UR(                  5        M  [#        U	[*        R,                  5      (       d  M  UR/                  UR&                  U	5        M     g )Nznumber of composite attributes z3 exceeds that of the number of attributes in class  )r   r   r   r5   orm_decl_baser	  r
  r   	itertoolszip_longestr  r   r   r   r   r  rn   r   declarative_scan_for_compositer{   r   r#   r>   _undefer_column_name)
rP   r   r   r   rc   r5   	decl_baser  paramr   s
             rT   r   &CompositeProperty._setup_for_dataclass  s>    ~~44AANN00	  !5!56$00OO""$djj
KE }**54::' (A++445Qs4??7K6LN  |#~

tg%
$--33&JJ$$ D&--00..uzz4@3
rW   c                    U R                    Vs/ s H-  n[        U R                  R                  UR                  5      PM/     sn$ s  snf rN   )propsr   r   r   rc   r^   s     rT   _comparable_elements&CompositeProperty._comparable_elements  s3    BF**M*$**DHH5*MMMs   4Azorm.propertiesc                   / n[         R                  R                  R                  nU R                   GH  n[        U[        5      (       a  U R                  R                  USS9nO[        U[        R                  5      (       a  U R                  R                  U   nOb[        X25      (       a$  U R                  R                  UR                     nO.[        U[        R                  5      (       a  UR                  nOS n[        U[         5      (       d  ["        R$                  " SU< 35      eUR'                  U5        GM     U$ )NF)_configure_mapperszYComposite expects Column objects or mapped attributes/attribute names as arguments, got: )r   r   r   r5   r   r   rk   r   get_propertyr#   r>   _columntopropertycolumnr   r/   ru   r   r   r   append)rP   r  r5   r   r_   s        rT   r  CompositeProperty.props  s    ~~44AAJJD$$${{///OD&--00{{44T:D//{{44T[[AD*"B"BCC}}dN33**EEIHN 
 LL% & rW   c                   [         R                  R                  R                  nU R                   Vs/ s HD  n[        U[        R                  U45      (       d  M&  [        X!5      (       a  UR                  OUPMF     sn$ s  snf rN   )	r   r   r   r5   r   r   r#   r>   r%  )rP   r5   as      rT   columnsCompositeProperty.columns  sl     ~~44AA ZZ
!fmm\:; ;
133AHH:
 	
 
s   %B"Bc                    U $ rN   r   r   s    rT   mapper_property_to_assign+CompositeProperty.mapper_property_to_assign  s    rW   c                f    U R                    Vs/ s H  oR                  b  M  US4PM     sn$ s  snf )Nr   )r*  table)rP   cs     rT   columns_to_assign#CompositeProperty.columns_to_assign  s(     $@1A@@@s   ..c                0   [         R                  R                  R                  nU R                   Hb  n[        X!5      (       d  M  UnU R                  Ul        U R                  (       a  U R                  Ul        SUl        U R                  Ul	        Md     g)zgPropagate configuration arguments made on this composite
to the target columns, for those that apply.

))r   T)
instrumentTN)
r   r   r   r4   r  r   r   r   strategy_keyr   )rP   r4   r_   cprops       rT   r   -CompositeProperty._setup_arguments_on_columns	  sm     66EEJJDd33#'#6#6E }}!%%O"**EK rW   c                  ^ ^       SU4S jjn        SUU 4S jjn          SU 4S jjm      SU 4S jjn        SU 4S jjn[         R                  " T R                  SUSS9  [         R                  " T R                  S	USS9  [         R                  " T R                  S
USSS9  [         R                  " T R                  SUSSS9  [         R                  " T R                  SUSSS9  T R                  R                  T R                     nUR
                  UR                  l        T R                  UR                  R
                  l        g)z>Establish events that populate/expire the composite attribute.c                   > T" XS SS9  g )NF
is_refreshr   )rQ   context_load_refresh_handlers     rT   load_handler=CompositeProperty._setup_event_handlers.<locals>.load_handler   s     "%$5IrW   c                   > U(       a:  TR                   1R                  TR                  5      R                  U5      (       a	  T" XUSS9  g g )NTr;  )rc   unionr   intersection)rQ   r=  to_loadr>  rP   s      rT   refresh_handler@CompositeProperty._setup_event_handlers.<locals>.refresh_handler%  sD     
  !5!56l7#$ &eg$O$rW   c                0  > U R                   nU(       a  UTR                  L a  TR                  U;   a  g TR                   H
  nXT;  d  M
    g    TR                  " TR                   Vs/ s H  o`R                   U   PM     sn6 UTR                  '   g s  snf rN   )dictr   rc   r   r   )rQ   r=  rD  r<  rR   krc   rP   s          rT   r>  FCompositeProperty._setup_event_handlers.<locals>._load_refresh_handler1  s     JJE 'T-A-A"A((e#
 ))> * #22-1-A-AB-Ac**S/-ABE$((OBs   )Bc                   > Ub)  [        TR                  5      R                  U5      (       a'  U R                  R	                  TR
                  S 5        g g rN   )r   r   rC  rH  r   rc   )rQ   keysrP   s     rT   expire_handler?CompositeProperty._setup_event_handlers.<locals>.expire_handlerR  sA     |s4#7#78EEdKK

txx.  LrW   c                R   > UR                   R                  TR                  S5        g)zAfter an insert or update, some columns may be expired due
to server side defaults, or re-populated due to client side
defaults.  Pop out the composite value here so that it
recreates.

N)rH  r   rc   )r   
connectionrQ   rP   s      rT   insert_update_handlerFCompositeProperty._setup_event_handlers.<locals>.insert_update_handlerX  s     JJNN488T*rW   after_insertT)rawafter_updateload)rT  	propagater   expireN)rQ   rm   r=  r1   ri   r   )rQ   rm   r=  r1   rD  Optional[Sequence[str]]ri   r   )
rQ   rm   r=  r1   rD  rY  r<  rj   ri   r   )rQ   rm   rL  rY  ri   r   )r   r   rP  r7   rQ   rm   ri   r   )	r!   listenr   r   rc   r   r   r   r   )rP   r?  rE  rM  rQ  r   r>  s   `     @rT   r   'CompositeProperty._setup_event_handlers  s   	J%	J0?	J	J

	P%
	P$
	P -
	P 	
	P 
	P	%	$	 -	 		
 	B	/%	/-D	/	/	+	+"	+ &	+ 		+ 	KK)>D	
 	KK)>D	
 	KK44	
 	KKO	
 	KK>tt	
 [[..txx8
#-#6#6
 373F3F
  0rW   c                X    U R                    Vs/ s H  oR                  PM     sn$ s  snf rN   )r  rc   r^   s     rT   r   !CompositeProperty._attribute_keys|  s     %)ZZ0ZTZ000s   'c                   ^ ^^ T R                   (       a  T R                   mOSS jmT R                   Vs/ s H  oR                  PM     snmSUUU 4S jjnU$ s  snf )Nc                "    U R                  5       $ rN   r  )vals    rT   
get_valuesOCompositeProperty._populate_composite_bulk_save_mappings_fn.<locals>.get_values  s    //11rW   c           
        > U R                  [        TT" U R                  TR                  5      5      5       VVs0 s H  u  pX_M	     snn5        g s  snnf rN   )r   r   r   rc   )	dest_dictrc   r`  r   ra  rP   s      rT   populateMCompositeProperty._populate_composite_bulk_save_mappings_fn.<locals>.populate  sW     %(z)--*AB%% H%s   A
)r`  r   ri   z
Tuple[Any])rd  zDict[str, Any]ri   r   )r   r  rc   )rP   r_   re  r   ra  s   `  @@rT   )_populate_composite_bulk_save_mappings_fn;CompositeProperty._populate_composite_bulk_save_mappings_fn  sP     --;;J2 '+jj1jdj1	 	  2s   Ac                ~   / n/ nSnU R                    H  nUR                  nUR                  U   R                  R	                  X5      n	U	R                  5       (       a  SnU	R                  5       n
U
(       a  UR                  U
5        OUR                  S5        U	R                  (       a  UR                  U	R                  5        M  UR                  S5        M     U(       a4  [        R                  " U R                  " U6 /SU R                  " U6 /5      $ [        R                  " SU R                  " U6 /S5      $ )z>Provided for userland code that uses attributes.get_history().FTNr   )r  rc   r   r   rU   has_changesnon_deletedextendr&  deletedr   r.   r   )rP   rQ   rR   rS   addedrm  has_historyr_   rc   histrk  s              rT   rU   CompositeProperty.get_history  s    JJD((C==%**66uDD!!"**,K[)T"||t||,t$   %%%%u-.%%w/0  %%b4+?+?+G*H"MMrW   c                $    U R                  X5      $ rN   )r   )rP   r   s     rT   r   %CompositeProperty._comparator_factory  s     &&t44rW   c                  N   ^  \ rS rSr    SU 4S jjr        SS jrSrU =r$ )!CompositeProperty.CompositeBundlei  c                H   > Xl         [        TU ]  " UR                  /UQ76   g rN   )ru   r   rd   rc   )rP   	property_exprr   s      rT   rd   *CompositeProperty.CompositeBundle.__init__  s     
 &MGY]]2T2rW   c                   ^ ^ SUU 4S jjnU$ )Nc                l   > TR                   R                  " T Vs/ s H
  o" U 5      PM     sn6 $ s  snf rN   )ru   r   )rowprocprocsrP   s     rT   r}  DCompositeProperty.CompositeBundle.create_row_processor.<locals>.proc  s3    }}44,12EDd3iE2 2s   1)r|  zRow[Any]ri   r   r   )rP   queryr~  labelsr}  s   ` `  rT   create_row_processor6CompositeProperty.CompositeBundle.create_row_processor  s     
 KrW   )ru   )rw  zComposite[_T]rx  r;   )r  zSelect[Any]r~  z#Sequence[Callable[[Row[Any]], Any]]r  Sequence[str]ri   zCallable[[Row[Any]], Any])rn   ro   rp   rq   rd   r  rw   __classcell__r   s   @rT   CompositeBundleru    sJ    	3$	3 	3		 7	 "		
 '	 	rW   r  c                     \ rS rSr% SrSrS\S'   \R                  SS j5       r	SS jr
\R                  SS j5       r    SS	 jr\R                  SS
 j5       rSS jrSS jrSS jrSS jrSS jrSS jr      SS jrSrg)CompositeProperty.Comparatori  ao  Produce boolean, comparison, and other operators for
:class:`.Composite` attributes.

See the example in :ref:`composite_operations` for an overview
of usage , as well as the documentation for :class:`.PropComparator`.

.. seealso::

    :class:`.PropComparator`

    :class:`.ColumnOperators`

    :ref:`types_operators`

    :attr:`.TypeEngine.comparator_factory`

Nz%RODescriptorReference[Composite[_PT]]r_   c                B    [         R                  " U R                  SS06$ )Nr   F)r&   r;   r  r   s    rT   clauses$CompositeProperty.Comparator.clauses  s&    (("77 rW   c                    U R                   $ rN   r%   r   s    rT   __clause_element__/CompositeProperty.Comparator.__clause_element__  s    ??"rW   c                    U R                   R                  U R                  U R                  U R                  R                  S.5      n[
        R                  U R                  U5      $ )N)parententityparentmapper	proxy_key)r  	_annotate_parententityr_   rc   r   r  )rP   r  s     rT   r&   'CompositeProperty.Comparator.expression  sQ    ll,,$($6$6$($6$6!%G %44TYYHHrW   c                   [        U[        5      (       a  UR                  nUc'  U R                  R                   Vs/ s H  nS PM     nnO[        U R                  R
                  [        5      (       a@  [        XR                  R
                  5      (       a  U R                  R                  U5      nO([        R                  " SU R                  < SU< 35      e[        [        U R                  U5      5      $ s  snf )Nz!Can't UPDATE composite attribute z to )r   r(   r}   r_   r   r   r  r   r   r   listr   r  )rP   r}   rc   r   s       rT   _bulk_update_tuples0CompositeProperty.Comparator._bulk_update_tuples  s     %// }*.))*C*CD*C3$*CDDII55t<<yy00B B BB **yy%) 
 D55v>?? Es   C<c                    U R                   (       aO  U R                  R                   Vs/ s H-  n[        U R                   R                  UR
                  5      PM/     sn$ U R                  R                  $ s  snf rN   )_adapt_to_entityr_   r  r   entityrc   r^   s     rT   r  1CompositeProperty.Comparator._comparable_elements  se    $$ !%		 > > > D1188$((C > 
 yy555s   4A7c                B    U R                  [        R                  U5      $ rN   )_comparer'   eqrP   others     rT   __eq__#CompositeProperty.Comparator.__eq__&      ==u55rW   c                B    U R                  [        R                  U5      $ rN   )r  r'   ner  s     rT   __ne__#CompositeProperty.Comparator.__ne__)  r  rW   c                B    U R                  [        R                  U5      $ rN   )r  r'   ltr  s     rT   __lt__#CompositeProperty.Comparator.__lt__,  r  rW   c                B    U R                  [        R                  U5      $ rN   )r  r'   gtr  s     rT   __gt__#CompositeProperty.Comparator.__gt__/  r  rW   c                B    U R                  [        R                  U5      $ rN   )r  r'   ler  s     rT   __le__#CompositeProperty.Comparator.__le__2  r  rW   c                B    U R                  [        R                  U5      $ rN   )r  r'   ger  s     rT   __ge__#CompositeProperty.Comparator.__ge__5  r  rW   c                   Uc$  S /[        U R                  R                  5      -  nOU R                  R                  U5      n[	        U R                  R                  U5       VVs/ s H  u  pEU" XE5      PM     nnnU R
                  (       a/  U R                  c   eU Vs/ s H  opR                  U5      PM     nn[        R                  " U6 $ s  snnf s  snf rN   )	r  r_   r  r   r   r  adapterr$   and_)rP   r  r  r   r)  bcomparisonsxs           rT   r  %CompositeProperty.Comparator._compare?  s     }#dii&D&D"EEBB5I  		 > >GGDA G   $$||///8CD1||AD88[)) Es   &C!Cr   )ri   r;   )ri   z&CompositeProperty.CompositeBundle[_PT])r}   r   ri   z(Sequence[Tuple[_DMLColumnArgument, Any]]ri   z!Sequence[QueryableAttribute[Any]])r  r   ri   ColumnElement[bool])r  r=   r  r   ri   r  )rn   ro   rp   rq   r   __hash__r   r   memoized_propertyr  r  r&   r  r  r  r  r  r  r  r  r  rw   r   rW   rT   r   r    s    	& 33				 
 	
	# 
			I 
 	I	@	@5	@0 
			6 
 	6	6	6	6	6	6	6	*(	*14	* 	*rW   r   c                t    [        U R                  R                  R                  5      S-   U R                  -   $ )N.)rk   r   r   rn   rc   r   s    rT   __str__CompositeProperty.__str__P  s+    4;;%%../#5@@rW   )r   r   r   r   r   r   rL   r   rN   )r   zCUnion[None, Type[_CC], Callable[..., _CC], _CompositeAttrType[Any]]r   z_CompositeAttrType[Any]r   Optional[_AttributeOptions]r   rj   r   rj   r   rJ   r   zOptional[Type[Comparator[_CC]]]r   Optional[_InfoType]r   r   r   )r}   r   ri   zTuple[Any, ...]ri   r   )r   r2   r   r-   r   	Type[Any]r   rJ   rc   rk   r   zOptional[Type[Mapped[Any]]]r   Optional[_AnnotationScanType]r   r  r   rj   ri   r   )
r   r-   r   r  r   rJ   rc   rk   ri   r   r  )ri   zSequence[MapperProperty[Any]])ri   zSequence[Column[Any]])ri   zOptional[MapperProperty[_CC]])ri   z$List[Tuple[schema.Column[Any], int]])ri   r  )ri   z Callable[[Dict[str, Any]], None]rl   )r   r   ri   zComposite.Comparator[_CC])ri   rk   ),rn   ro   rp   rq   r   r   rd   r   r   r   objectr   r   r   preload_moduler  r   r   r  r  r  non_memoized_propertyr*  ru   r-  r2  r   r   r   rg  r   rv   rU   r   orm_utilBundlerD   r  r   rF   r   r  rw   r  r  s   @rT   r   r      s6   
 :9..$  .- 	& :>$#>B$(&
&
 (& 7& & & & <& "& & &P%"+ hOH5T 
457)7  7 	7
 *7 7 67 27 &C7 !7 
7 67r6 
45	34%A%A %A *	%A
 %A 
%A 5 6%AN 
N N 
	)* + 2 
	)*
 +  
   A A 
)*% +%&[G~ 
1 1	)8  +66	#N!#N #N 	#N
 
#NJ5!5	"5
(//"- ,v*^C( v*pA ArW   r   c                      \ rS rSrSrSrSrg)	CompositeiT  a7  Declarative-compatible front-end for the :class:`.CompositeProperty`
class.

Public constructor is the :func:`_orm.composite` function.

.. versionchanged:: 2.0 Added :class:`_orm.Composite` as a Declarative
   compatible subclass of :class:`_orm.CompositeProperty`.

.. seealso::

    :ref:`mapper_composite`

Tr   Nrn   ro   rp   rq   r   inherit_cacherw   r   rW   rT   r  r  T  s     MrW   r  c                  B   ^  \ rS rSrSr    SS jrSU 4S jjrSrU =r$ )ConcreteInheritedPropertyig  a  A 'do nothing' :class:`.MapperProperty` that disables
an attribute on a concrete subclass that is only present
on the inherited mapper, not the concrete classes' mapper.

Cases where this occurs include:

* When the superclass mapper is mapped against a
  "polymorphic union", which includes all attributes from
  all subclasses.
* When a relationship() is configured on an inherited mapper,
  but not on the subclass mapper.  Concrete mappers require
  that relationship() is configured explicitly on each
  subclass.

c                    S nU R                   R                  5        H8  nUR                  U R                     n[	        USS 5      c  M,  UR
                  n  O   Uc   eU" WU5      $ )Nr   )r   iterate_to_root_propsrc   r   r   )rP   r   comparator_callablemr  s        rT   r   -ConcreteInheritedProperty._comparator_factoryx  sm     #,,.A"Aq.5A&'&:&:#	 /
 #..."1f--rW   c                j   >^ ^ [         TT ]  5         SU 4S jjm " U U4S jS5      nU" 5       T l        g )Nc            	     p   > [        ST R                  < ST R                  < ST R                  < S35      e)Nz	Concrete z does not implement attribute z9 at the instance level.  Add this property explicitly to r  )r   r   rc   r   s   rT   warn0ConcreteInheritedProperty.__init__.<locals>.warn  s*      ;;$++7 rW   c                  H   > \ rS rSrSU4S jjrSU4S jjrS	U U4S jjrSrg)
DConcreteInheritedProperty.__init__.<locals>.NoninheritedConcretePropi  c                   > T" 5         g rN   r   )sr|   r}   r  s      rT   __set__LConcreteInheritedProperty.__init__.<locals>.NoninheritedConcreteProp.__set__      rW   c                   > T" 5         g rN   r   )r  r|   r  s     rT   
__delete__OConcreteInheritedProperty.__init__.<locals>.NoninheritedConcreteProp.__delete__  r  rW   c                2   > Uc  TR                   $ T" 5         g rN   r   )r  r|   ownerrP   r  s      rT   __get__LConcreteInheritedProperty.__init__.<locals>.NoninheritedConcreteProp.__get__  s    ;??*rW   r   N)r  r   r|   r   r}   r   ri   r	   )r  r   r|   r   ri   r	   )r  r   r|   r   r  r   ri   r   )rn   ro   rp   rq   r  r  r  rw   )rP   r  s   rT   NoninheritedConcretePropr    s     rW   r  )ri   r	   )r   rd   rL   )rP   r  r  r   s   ` @rT   rd   "ConcreteInheritedProperty.__init__  s)    	
	 
	 34rW   r   )r   r   ri   zType[PropComparator[_T]]r  )	rn   ro   rp   rq   r   r   rd   rw   r  r  s   @rT   r  r  g  s'     .!.	!.5 5rW   r  c                  $  ^  \ rS rSr% SrS\S'         S             SU 4S jjjr\(       d
  \SS j5       r	\
R                    SS j5       rSS jr\R                  4       SS	 jjr\
R"                  " S
5      SS j5       rSrU =r$ )SynonymPropertyi  a  Denote an attribute name as a synonym to a mapped property,
in that the attribute will mirror the value and expression behavior
of another attribute.

:class:`.Synonym` is constructed using the :func:`_orm.synonym`
function.

.. seealso::

    :ref:`synonyms` - Overview of synonyms

"Optional[Type[PropComparator[_T]]]r   c                >  > [         TU ]  US9  Xl        X l        X0l        X@l        U(       a  Xpl        O1U(       a#  UR                  (       a  UR                  U l        OS U l        U(       a  U R                  R                  U5        [        R                  " U 5        g r   )r   rd   r{   
map_columnrL   r   rK   r   r   r   r   r   )	rP   r{   r  rL   r   r   r   rK   r   s	           rT   rd   SynonymProperty.__init__  su     	+<=	$$"4HJ..!))DHDHIIT"%rW   c                ~    [        U R                  R                  U R                  5      R                  R
                  $ rN   )r   r   r   r{   r   r]   r   s    rT   r]   SynonymProperty.uses_objects  s)    4;;--tyy9>>KKKrW   c                   [        U R                  R                  U R                  5      n[	        US5      (       a  [        UR                  [        5      (       d  [        U[        R                  5      (       a  UR                  $ [        U[        5      (       a  U$ [        R                  " SU R                  R                  R                  < SU R                  < SU< 35      eUR                  $ )Nru   zsynonym() attribute "r  z+" only supports ORM mapped attributes, got )r   r   r   r{   r   r   ru   r   r   r0   
comparatorr   r   r   rn   )rP   r   s     rT   _proxied_objectSynonymProperty._proxied_object  s     t{{))4995tZ((
MM>1
 1

 $
 = =>>&D"233,, ;;%%..		4A 
 }}rW   c                    U R                   n[        U[        5      (       a7  U R                  (       a  U R                  X!5      nU$ UR                  X!5      nU$ U$ rN   )r  r   r   r   )rP   r   r_   comps       rT   r   #SynonymProperty._comparator_factory  sV    ##dN++&&..t< K ..t<KKrW   c                    [        U R                  R                  U R                  5      nUR                  R                  XUS9$ )N)rS   )r   r   r   r{   r   rU   )rP   rQ   rR   rS   r   s        rT   rU   SynonymProperty.get_history  s8     )00B0BDII(Nyy$$U7$CCrW   r   c           
        [         R                  R                  nU R                  (       Ga  U R                  UR
                  R                  ;  aK  [        R                  " SU R                  < SUR
                  R                  < SU R                  < S35      eUR
                  R                  U R                     UR                  ;   a  UR                  UR
                  R                  U R                        R                  U R                  :X  aN  [        R                  " SU R                  < SU R                  < SU R                  < SU R                  < 35      eUR                  UR
                  R                  U R                     5      nUR                  U R                  XBS	S
9  U R                  Ul        Xl        g )NzCan't compile synonym 'z': no column on table 'z	' named ''z'Can't call map_column=True for synonym =z4, a ColumnProperty already exists keyed to the name z for column T)init	setparent)r   r   r   r  rc   persist_selectabler1  r   r   r{   descriptionr$  r4   _configure_property_mapped_by_synonymr   )rP   r   r  
propertiesr  s        rT   
set_parentSynonymProperty.set_parent  sT   ^^22
???xxv88:::** 		11==  ))++DHH5++,,,--//9#99
 ** xxDIItxxA  &0%>%>))++DHH5&A &&tyy!$&O#'88A rW   )r   rL   rK   r  r{   r   )NNNNNN)r{   rk   r  zOptional[bool]rL   zOptional[Any]r   r  r   r  r   r  rK   rJ   rh   )ri   z/Union[MapperProperty[_T], SQLORMOperations[_T]])r   r   ri   zSQLORMOperations[_T]rl   )r   r   r  rj   ri   r   )rn   ro   rp   rq   r   r   rd   r   ru   r]   r   r  r  r   r   rv   rU   r  r  rw   r  r  s   @rT   r  r    s    ;:
 &*$(AE9=$(!&& #& "	&
 ?& 7& "& & &6 		L 
	L 
	8 ,
   +66	D!D D 	D
 
D 
45# 6#rW   r  c                      \ rS rSrSrSrSrg)Synonymi&  a3  Declarative front-end for the :class:`.SynonymProperty` class.

Public constructor is the :func:`_orm.synonym` function.

.. versionchanged:: 2.0 Added :class:`_orm.Synonym` as a Declarative
   compatible subclass for :class:`_orm.SynonymProperty`

.. seealso::

    :ref:`synonyms` - Overview of synonyms

Tr   Nr  r   rW   rT   r  r  &  s     MrW   r  )gr   
__future__r   dataclassesr   r	  r  r  typingr   r   r   r   r	   r
   r   r   r   r   r   r   weakref r   r   r  baser   r   r   r   r   
interfacesr   r   r   r   r   r   r   r!   r"   r   r#   r$   r&   r'   sql.elementsr(   util.typingr)   r*   r+   _typingr,   r-   r.   r/   r0   r=  r1   r  r2   r   r3   r  r4   r5   rQ   r6   engine.baser7   
engine.rowr8   sql._typingr9   r:   r;   r<   sql.operatorsr=   
sql.schemar>   sql.selectabler?   r@   rA   rB   rC   rD   rF   rH   rk   _CompositeAttrTyper   WeakKeyDictionaryr   r   r   r  r  r  r  r   rW   rT   <module>r%     s  
 # $                     $ &   " ) / $ & &  )        ( " $ # 
&&#1.(1*($( 0'),,#'1/13Te3EH+ EHP 	  e3
     
]
A.0B30G]
A@!"%'9"'= &55 22 6 55pD(, DNob!#5b#9 rW   