go|UdZddlmZddlmZddlZddlZddlZddlZddlm Z ddlm Z ddlm Z ddlm Z dd lm Z dd lmZdd lmZdd lmZdd lmZddlmZddlmZddlmZddlZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddl m!Z!ddl m"Z"ddl m#Z#ddl m$Z$ddl m%Z%ddlm&Z&ddlm'Z'd d!lm(Z(d d"lm)Z*d d#lm+Z+d d$lm,Z,d dlmZd d%l,m-Z-d d&l,m.Z.d d'l/m0Z0d d(l1m2Z2d d)l1m3Z3d d*l1m4Z4ej$rdd+l5m6Z6dd,l5m7Z7dd-lm8Z8dd.lm9Z9dd/lm:Z:dd0l;mZ>dd2l?m@Z@dd3lAmBZBdd4lAmCZCdd5lDmEZEd d6lFmGZGd d7lHmIZId d8lJmKZKd d9lJmLZLd d:l/mMZMd d;l/mNZNd dlSmTZTd d?l1mUZUd d@l1mVZVd dAl1mWZWd dBl1mXZXedCe DZYedEe DZZGdFdGe$eYZ[ee\dHdIdJdKfZ]edLe DZ^ejZ`dMeadN<GdOdPe#e^e"e[e^ZbGdQdRebeYeeYZcGdSdTe[eYZdGdUdVe[eYZeGdWdXeeeYeeYZfy)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_PTcheZdZUdZdZded<dZdZded<ejf d dZ d d Z y) DescriptorPropertyzO:class:`.MapperProperty` which proxies access to a user-defined descriptor.N Optional[str]docFzDescriptorReference[Any] descriptorctN)NotImplementedError)selfstatedict_passives P/opt/hc_python/lib64/python3.12/site-packages/sqlalchemy/orm/descriptor_props.py get_historyzDescriptorProperty.get_historyfs "##cGfddtj}jDtjj d}j j |r|_j%d fd }d fd }d fd }t|||_tjjjjj jfdj}|j |_ jjj |y) NcjeZdZdZdZdZedfd ZddZe jf d fd Z y) 7DescriptorProperty.instrument_class.._ProxyImplFTcjSrM) uses_objectsrOprops rSrZzDDescriptorProperty.instrument_class.._ProxyImpl.uses_objectsvs(((rUc||_yrM)key)rOr^s rS__init__z@DescriptorProperty.instrument_class.._ProxyImpl.__init__zs rUc*j|||SrM)rT)rOrPrQrRr\s rSrTzCDescriptorProperty.instrument_class.._ProxyImpl.get_history}s ''ug>>rUNreturnbool)r^strrPInstanceState[Any]rQr,rRrrbr.) __name__ __module__ __qualname__accepts_scalar_loaderload_on_unexpire collectionpropertyrZr_r PASSIVE_OFFrT)r\srS _ProxyImplrXqsa$) !# J  ) ) (3'>'>  ?) ?% ?%  ?   ?rUroc4t|j|yrM)setattrname)objvaluerOs rSfsetz1DescriptorProperty.instrument_class..fsetsTYY.rUc2t|jyrM)delattrrrrsrOs rSfdelz1DescriptorProperty.instrument_class..fdelsTYY'rUc0t|jSrM)getattrrrrxs rSfgetz1DescriptorProperty.instrument_class..fgetssDII..rU)r|ruryc&jSrM)_comparator_factory)mapperrOsrSz5DescriptorProperty.instrument_class..sD,,V4rU)rJoriginal_property)rsrrtrrbNone)rsrrbr)rsrrbr)r AttributeImplrKr{class_r^_is_userland_descriptorrmcreate_proxied_attributeparentrJimpl class_managerinstrument_attribute) rOrrodescruryr| proxy_attrr\s `` @rSinstrument_classz#DescriptorProperty.instrument_classns ?11 ?( ?? "6==$((D9D--dhh="& ?? " / ( /'Dt$GDOIZ88I KK   HH OO 4"  %TXX. 11$((JGrUrer Mapper[Any]rbr) rgrhri__doc__rJ__annotations__rZ_links_to_entityrrnrTrrUrSrHrH[s` CL(( +66 $!$$ $  $2HrUrHz Column[_T]zMappedColumn[_T]zInstrumentedAttribute[_T]z Mapped[_T]_CCzFweakref.WeakKeyDictionary[Type[Any], Callable[[Any], Tuple[Any, ...]]]_composite_getterscpeZdZUdZded<ded<ded<ded < d(d d d d d d d  d)fd Zd*fd Zd+dZd,dZe Z d,dZ e jd d-dZd,dZe jde jd d.dZe j"d/dZe j"e jdd0dZe j(e jdd1dZed2dZed3dZe jdd,dZd,dZe j"d4dZ d5d Zej<f d6d!Z d7d"Z Gd#d$e!jDe#Z$Gd%d&e%e&Z'd8d'Z(xZ)S)9CompositePropertyzDefines 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_accessorzType[Comparator[_CC]]comparator_factoryNF)attribute_optionsactive_historydeferredgrouprinfoct ||t|ttt j fr|f|z|_d|_n||_||_||_ ||_ ||_ ||n|jj|_d|_||j j#|t%j&||j)|j+yN)r)superr_ isinstancerrdr$r<rrrrr __class__ Comparatorrrrupdaterset_creation_order_create_descriptor_init_accessor) rO_class_or_attrrrrrrrrkwargsrs rSr_zCompositeProperty.__init__s +<= nvsC4E4E&F G(*U2DJ#'D #1D DJ,   "- **  .2*   II  T " % ! rUcDt|||jyrM)rr_setup_event_handlers)rOrrs rSrz"CompositeProperty.instrument_classs  ( ""$rUc|jr|j|S |j}|S#t$r3}tjd|j j d|d}~wwxYw)NzComposite class zX is not a dataclass and does not define a __composite_values__() method; can't get state)r__composite_values__AttributeErrorsa_excInvalidRequestErrorrrg)rOrtaccessoraes rS_composite_values_from_instancez1CompositeProperty._composite_values_from_instances  - -55e< < " 55 z!" 00&t';';'D'D&EF//  s 2 A..A))A.c$|jy)zwInitialization which occurs after the :class:`.Composite` has been associated with its parent mapper. N)_setup_arguments_on_columnsrOs rSdo_initzCompositeProperty.do_inits ((*rUcTdfd dfd }dfd }t||_y)ztCreate the Python descriptor that will serve as the access point on instances of the mapped class. c tj|}tj|}j|vrjDcgc]}t ||}}j|vry|jt j|sXj||j<|jjj|jjg|jjdScc}wrM)r instance_dictinstance_stater^_attribute_keysr{r issupersetrmanagerdispatchrefresh_COMPOSITE_FGETget)instancerQrPr^valuesrOs rSr|z2CompositeProperty._create_descriptor..fgets,,X6E--h7Exxu$ 7;6J6J6JsGHc*6J885(II)1E1Ef1M&:d&:&:F&CE$((OMM**22t33dhhZ99TXXt, ,#sDcRtj|}tj|}|j j}|j j r |}n*|j jtj}|j jD]}|||||j}|| j<| jD]}t||dyt j j|D]\}}t|||yrM)rrrrr^r_active_historyrrNO_VALUEsetrrrqzipr) rrtrQrPattrpreviousfnr^r|rOs rSruz2CompositeProperty._create_descriptor..fset1s,,X6E--h7E==*D}},,> 99TXX/C/L/LMmm''5%499=(#E$((O}//CHc400#&((88?#JCHc51 #rUctj|}tj|}|jj}|j j r%|}|jjdn*|jjtj}|jj}|j j|||jjD]}t||dyrM)rrrrr^rrpoprrremoverrrq)rrPrQrrr^r|rOs rSryz2CompositeProperty._create_descriptor..fdelHs--h7E,,X6E==*D}},,> $((D) 99TXX/C/L/LM==*D MM $)) <++#t,,rUN)rrrbr)rrrtrrbr)rrrbr)rmrK)rOruryr|s` @rSrz$CompositeProperty._create_descriptors$  -6 2. - #4t4rUsqlalchemy.orm.propertiesc tjjj} |j||j |||} t | rt| d} | r|jtt| ts t| drP|?t| dr | jn t| } tjd| d| dt|| |d} | |_t!|jr|j#||||nO|j$D]@} t| | t&j(fs | j*-tjd |j-y) NrT) check_generic__forward_arg__zCan'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 preloadedorm_propertiesr5r_raise_for_requiredr+r)rrdr*hasattrrr ArgumentErrorrr_setup_for_dataclassrr#r>rrr)rO decl_scanregistryclsoriginating_moduler^mapped_container annotationextracted_mapped_annotationis_dataclass_fieldr5argumentstr_argrs rSdeclarative_scanz"CompositeProperty.declarative_scanZsj~~44AA  (+3  $ $S# .. X )!,H ,,4(C(J-&-#8->?!00 ] !..0 ;EELIQP3#5t$,D ,, -  % %h5G M tlFMM%BC ) ..5 # rUct|jrt|jdstj|j}t j |jjDcgc]}|jc}t|jdk(r fd|_ n|_ |jt|jtri|jtvrV|j|jt|j<yt|jdrdt|j<yyyyycc}w)Nrrc|fSrMr)rsgetters rSrz2CompositeProperty._init_accessor..s &+rUc"|jSrMr)rss rSrz2CompositeProperty._init_accessor..s  8 8 :rU)rrrinspect signatureoperator attrgetter parametersrrrlenrrtyper)rOinspprs @rSrz CompositeProperty._init_accessors& ,, -g  "87 $$T%9%9:D(("&//"8"8":;":Q!&&":;F4??#q(5O25;2  ,4//6$$,>>11=66#4#7#78--/EF:#4#7#78G ?7 -_undefer_column_name) rOrrrr^r5 decl_baserparamrs rSrz&CompositeProperty._setup_for_dataclasss<~~44AA NN00   !5!56$00 OO " " $djj KE4}**54::'(A++445Qs4??7K6LN |#~ tg% $ -33&JJ$$ D&--0..uzz4@3 rUc|jDcgc],}t|jj|j.c}Scc}wrM)propsr{rrr^r[s rS_comparable_elementsz&CompositeProperty._comparable_elementss3BF**M*$ **DHH5*MMMs1Azorm.propertiesc\g}tjjj}|jD]}t |t r|jj|d}nt |tjr|jj|}nYt ||r$|jj|j}n)t |tjr |j}nd}t |t st#j$d||j'||S)NF)_configure_mapperszYComposite expects Column objects or mapped attributes/attribute names as arguments, got: )rrrr5rrrdr get_propertyr#r>_columntopropertycolumnrr/rmrrrappend)rOrr5rr\s rSrzCompositeProperty.propss~~44AA JJD$${{///OD&--0{{44T:D,/{{44T[[AD*"B"BC}}dN3**EEIHN LL %& rUctjjj}|jDcgc]8}t |t j|frt ||r |jn|:c}Scc}wrM) rrrr5rrr#r>r)rOr5as rScolumnszCompositeProperty.columnssi~~44AA ZZ !fmm\:;#1l3AHH :   s=A3c|SrMrrs rSmapper_property_to_assignz+CompositeProperty.mapper_property_to_assigns rUc^|jDcgc]}|j|dfc}Scc}w)Nr)r table)rOcs rScolumns_to_assignz#CompositeProperty.columns_to_assigns* $ @ 1A @@@s**ctjjj}|jD]W}t ||s|}|j |_|jr|j|_d|_|j|_ Yy)zwPropagate configuration arguments made on this composite to the target columns, for those that apply. ))rT) instrumentTN) rrrr4rrrr strategy_keyr)rOr4r\cprops rSrz-CompositeProperty._setup_arguments_on_columns sl 66EEJJDdN3#'#6#6E }}!%%O"**EKrUc dfd } dfd } dfd  dfd } dfd }tjjd|dtjjd |dtjjd |dd tjjd |dd tjjd |dd jjj}|j |j _j|j j _y)z>Establish events that populate/expire the composite attribute.c||ddy)NF is_refreshr)rPcontext_load_refresh_handlers rS load_handlerz=CompositeProperty._setup_event_handlers..load_handler s "%$5 IrUc|r5jhjjj|r |||dyy)NTr)r^unionr intersection)rPrto_loadrrOs rSrefresh_handlerz@CompositeProperty._setup_event_handlers..refresh_handler%sF   !5!56l7#$&eWg$O$rUc|j}|r|jurj|vryjD]}||vsyjjDcgc]}|j|c}|j<ycc}wrM)dictrr^rr)rPrr!rrQkr^rOs rSrzFCompositeProperty._setup_event_handlers.._load_refresh_handler1s JJE'T-A-A"A((e# ))E>*3d22-1-A-AB-Ac%**S/-ABE$((OBsBc|$tjj|r'|jj j dyyrM)rrr r$rr^)rPkeysrOs rSexpire_handlerz?CompositeProperty._setup_event_handlers..expire_handlerRs>|s4#7#78EEdK txx. LrUcR|jjjdy)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)r$rr^)r connectionrPrOs rSinsert_update_handlerzFCompositeProperty._setup_event_handlers..insert_update_handlerXs JJNN488T *rU after_insertT)raw after_updateload)r- propagaterexpireN)rPrfrr1rbr)rPrfrr1r!Optional[Sequence[str]]rbr) rPrfrr1r!r2rrcrbr)rPrfr'r2rbr)rrr*r7rPrfrbr) r!listenrrr^rrrr)rOrr"r(r+rrs` @rSrz'CompositeProperty._setup_event_handlerss J% J0? J  J P% P$ P- P P % $ -      B /% /-D /  / + +" +& + +  KK)>D   KK)>D   KK44   KKO   KK>tt [[..txx8 #-#6#6  373F3F   0rUcT|jDcgc]}|jc}Scc}wrM)rr^r[s rSrz!CompositeProperty._attribute_keys|s"%)ZZ0ZTZ000s%cjr jnddjDcgc]}|jc}dfd }|Scc}w)Nc"|jSrMr)vals rS get_valueszOCompositeProperty._populate_composite_bulk_save_mappings_fn..get_valuess//11rUc |jt|jjDcic]\}}|| c}}ycc}}wrM)rrrr^) dest_dictr^r7rr8rOs rSpopulatezMCompositeProperty._populate_composite_bulk_save_mappings_fn..populates[   %(z)--*AB%%SH% s A )r7rrbz Tuple[Any])r:zDict[str, Any]rbr)rrr^)rOr\r;rr8s` @@rS)_populate_composite_bulk_save_mappings_fnz;CompositeProperty._populate_composite_bulk_save_mappings_fnsM  - -;;J 2'+jj1jdj1 2sAcNg}g}d}|jD]}|j}|j|jj ||} | j rd}| j } | r|j| n|jd| jr|j| j|jd|r3tj|j|gd|j|gStjd|j|gdS)z>Provided for userland code that uses attributes.get_history().FTNr) rr^rrrT has_changes non_deletedextendr deletedrr.r) rOrPrQrRaddedrA has_historyr\r^histr?s rSrTzCompositeProperty.get_historys JJD((C==%**66ueDD!" **,K [) T"||t||,t$ %%%%%u-.%%%w/0  %%b+?4+?+?+G*H"M MrUc&|j||SrM)r)rOrs rSr~z%CompositeProperty._comparator_factorys&&tV44rUc@eZdZ dfd Z ddZxZS)!CompositeProperty.CompositeBundlecH||_t||jg|yrM)rmrr_r^)rO property_exprrs rSr_z*CompositeProperty.CompositeBundle.__init__s" &DM G Y]] 2T 2rUcdfd }|S)NchjjDcgc] }|| c}Scc}wrM)rmr)rowprocprocsrOs rSrNzDCompositeProperty.CompositeBundle.create_row_processor..procs54t}}44,12EDd3iE22s/)rMzRow[Any]rbrr)rOqueryrOlabelsrNs` ` rScreate_row_processorz6CompositeProperty.CompositeBundle.create_row_processors   KrU)rIz Composite[_T]rJr;)rPz Select[Any]rOz#Sequence[Callable[[Row[Any]], Any]]rQ Sequence[str]rbzCallable[[Row[Any]], Any])rgrhrir_rR __classcell__rs@rSCompositeBundlerGsE 3$ 3 3  7 "  ' rUrVceZdZUdZdZded<ejddZddZ ejddZ ddZ ejdd Z dd Z dd Zdd Zdd ZddZddZ ddZy)CompositeProperty.ComparatoraProduce 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@tj|jddiS)NrF)r&r;rrs rSclausesz$CompositeProperty.Comparator.clausess&(("77 rUc|jSrMr%rs rS__clause_element__z/CompositeProperty.Comparator.__clause_element__s ?? "rUc|jj|j|j|jjd}t j |j|S)N) parententity parentmapper proxy_key)rZ _annotate _parententityr\r^rrV)rOrZs rSr&z'CompositeProperty.Comparator.expressionsQll,,$($6$6$($6$6!%G%44TYYH HrUct|tr |j}|$|jjDcgc]}d}}nt|jj t r? ?Es C'c|jrL|jjDcgc],}t|jj|j .c}S|jjScc}wrM)_adapt_to_entityr\rr{entityr^r[s rSrz1CompositeProperty.Comparator._comparable_elementsse$$!% > > >D1188$((C > yy555 s1A/cB|jtj|SrM)_comparer'eqrOothers rS__eq__z#CompositeProperty.Comparator.__eq__&==u5 5rUcB|jtj|SrM)rjr'nerls rS__ne__z#CompositeProperty.Comparator.__ne__)rorUcB|jtj|SrM)rjr'ltrls rS__lt__z#CompositeProperty.Comparator.__lt__,rorUcB|jtj|SrM)rjr'gtrls rS__gt__z#CompositeProperty.Comparator.__gt__/rorUcB|jtj|SrM)rjr'lerls rS__le__z#CompositeProperty.Comparator.__le__2rorUcB|jtj|SrM)rjr'gerls rS__ge__z#CompositeProperty.Comparator.__ge__5rorUc|$dgt|jjz}n|jj|}t |jj|Dcgc]\}}|||}}}|j r,|j J|Dcgc]}|j |}}tj|Scc}}wcc}wrM) rr\rrrrgadapterr$and_)rOrrmrr b comparisonsxs rSrjz%CompositeProperty.Comparator._compare?s}#dii&D&D"EEBB5I  > >GGDAqAG $$||///8CD 1t||A D88[) ) Es %CC )rbr;)rbz&CompositeProperty.CompositeBundle[_PT])rtrrbz(Sequence[Tuple[_DMLColumnArgument, Any]]rbz!Sequence[QueryableAttribute[Any]])rmrrbColumnElement[bool])rr=rmrrbr)rgrhrir__hash__rrmemoized_propertyrZr\r&rerrnrrrurxr{r~rjrrUrSrrXs &33       #    I  I @ @ 5 @0    6  6 6 6 6 6 6 6 *( *14 *  *rUrctt|jjjdz|jzS)N.)rdrrrgr^rs rS__str__zCompositeProperty.__str__Ps+4;;%%../#5@@rUrM)rzCUnion[None, Type[_CC], Callable[..., _CC], _CompositeAttrType[Any]]rz_CompositeAttrType[Any]rOptional[_AttributeOptions]rrcrrcrrIrzOptional[Type[Comparator[_CC]]]rOptional[_InfoType]rrr)rtrrbzTuple[Any, ...]rbr)rr2rr-r Type[Any]rrIr^rdrzOptional[Type[Mapped[Any]]]rOptional[_AnnotationScanType]rrrrcrbr) rr-rrrrIr^rdrbrr)rbzSequence[MapperProperty[Any]])rbzSequence[Column[Any]])rbzOptional[MapperProperty[_CC]])rbz$List[Tuple[schema.Column[Any], int]])rbrS)rbz Callable[[Dict[str, Any]], None]re)rrrbzComposite.Comparator[_CC])rbrd)*rgrhrirrr_rrrobjectrrrpreload_modulerrrrrrnon_memoized_propertyr rmrrrrrr<rrnrTr~orm_utilBundlerDrVrrFrrrTrUs@rSrrs7 :9 ..$.-  & :>$#>B$(& & ( & 7 &&&&<&"&&P% "+hOH5TT457)7 7 7 * 7  76727&C7!7 767r6T45T34%A%A%A* %A  %A  %A56%AN NN T)*+2 T)* +  AAT)*%+%&[G~ 11 )8 +66 #N!#N#N #N  #NJ5!5 "5 (//"-,v*^C(v*pArUrceZdZdZdZy) CompositeaSDeclarative-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` TNrgrhrir inherit_cacherrUrSrrTs MrUrc4eZdZdZ ddZdfd ZxZS)ConcreteInheritedPropertya4A '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. cd}|jjD]6}|j|j}t |dd*|j }n|J||S)Nr)riterate_to_root_propsr^r{r)rOrcomparator_callablemrs rSr~z-ConcreteInheritedProperty._comparator_factoryxsm#,,.A"Aq.5A&'&:&:# / #..."1f--rUcdtdfd Gfdd}|_y)Nc jtdjdjdjd)Nz Concrete z does not implement attribute z9 at the instance level. Add this property explicitly to r)rrr^rsrSwarnz0ConcreteInheritedProperty.__init__..warns* ;;$++7 rUc4eZdZdfd Zdfd Zdfd Zy)DConcreteInheritedProperty.__init__..NoninheritedConcretePropcyrMr)srsrtrs rS__set__zLConcreteInheritedProperty.__init__..NoninheritedConcreteProp.__set__rUcyrMr)rrsrs rS __delete__zOConcreteInheritedProperty.__init__..NoninheritedConcreteProp.__delete__rrUc0| jSyrM)rK)rrsownerrOrs rS__get__zLConcreteInheritedProperty.__init__..NoninheritedConcreteProp.__get__s;??*rUN)rrrsrrtrrbr )rrrsrrbr )rrrsrrrrbr)rgrhrirrr)rOrsrSNoninheritedConcreteProprs   rUr)rbr )rr_rK)rOrrrs` @rSr_z"ConcreteInheritedProperty.__init__s)    34rU)rrrbzType[PropComparator[_T]]r)rgrhrirr~r_rTrUs@rSrrgs' .! . ! .55rUrceZdZUdZded< d d fd Zes ed dZe j ddZ ddZ e jf ddZe j d dd ZxZS)SynonymPropertya8Denote 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]]]rc$t||||_||_||_||_|r||_n'|r|jr|j|_nd|_|r|jj|tj|yr) rr_rr map_columnrKrrJrrrrr) rOrrrrKrrrrJrs rSr_zSynonymProperty.__init__s +<= $$"4 DH J..!))DHDH  II  T " %rUc~t|jj|jjj SrM)r{rrrrrrZrs rSrZzSynonymProperty.uses_objectss)4;;--tyy9>>KK KrUct|jj|j}t |drt |j ts~t |tjr |jSt |tr|Stjd|jjjd|jd||j S)Nrmzsynonym() attribute "rz+" only supports ORM mapped attributes, got )r{rrrrrrrmrrr0 comparatorrrrrg)rOrs rS_proxied_objectzSynonymProperty._proxied_objectst{{))4995tZ( MM>1 $ = =>&D"23 ,,;;%%.. 4A  }}rUc|j}t|tr4|jr|j||}|S|j||}|S|SrM)rrrr)rOrr\comps rSr~z#SynonymProperty._comparator_factorysW## dN +&&..tV<K..tV<KKrUct|jj|j}|jj |||S)N)rR)r{rrrrrrT)rOrPrQrRrs rSrTzSynonymProperty.get_historys: )0 0B0BDII(Nyy$$UE7$CCrUrc ttjj}|jr|j|j j vrGtjd|jd|j jd|jd|j j |j|jvr|j|j j |jj|jk(rItjd|jd|jd|jd|j|j|j j |j}|j|j||d |j|_||_y) NzCan'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)rrrrr^persist_selectablerrrrr descriptionrr4_configure_property_mapped_by_synonymr)rOrr propertiesrs rS set_parentzSynonymProperty.set_parentsV^^22 ??xxv88:::** 11== ))++DHH5++,,,--//9#99 **xxDIItxxA &0%>%>))++DHH5&A  & &tyy!$$ & O#'88A  rU)NNNNNN)rrrdrzOptional[bool]rKz Optional[Any]rrrrrrrJrIra)rbz/Union[MapperProperty[_T], SQLORMOperations[_T]])rrrbzSQLORMOperations[_T]re)rrrrcrbr)rgrhrirrr_rrmrZrrrr~rrnrTrrrTrUs@rSrrs  ;: &*$(AE9=$(!&&#&" & ? & 7 &"&&6   L  L   8,  +66 D!DD D  DT45#6#rUrceZdZdZdZy)SynonymaKDeclarative 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 TNrrrUrSrr&s MrUr)gr __future__r dataclassesrrrrtypingrrrrr r r r r rrrweakrefrrrbaserrrrr interfacesrrrrrrrr!r"rr#r$r&r' sql.elementsr( util.typingr)r*r+_typingr,r-r.r/r0rr1rr2rr3rr4r5rPr6 engine.baser7 engine.rowr8 sql._typingr9r:r;r< sql.operatorsr= sql.schemar>sql.selectabler?r@rArBrCrDrFrHrd_CompositeAttrTyperWeakKeyDictionaryrrrrrrrrrUrSrs #$  $&")/$&&)("$# &&#1.(1*($( 0'),,#'1/13 T e3EH+EHP e3 G ] A.0B30G] A@!"%'9"'=&55 22 655pD(,DNob!#5b#9rU