L iz dZddlmZddlmZddlmZddlmZddlmZddlmZddlm Z dd lm Z dd lm Z dd lm Z dd lm Z dd lmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlm Z ddlm!Z!ddlm"Z"ddlm#Z#ddl$m%Z%dd l&m'Z'd!dlmZ(d!d"lm)Z)d!d#lm*Z*d!d$lm&Z&d!d%l+m,Z,d!d&l+m-Z-d!d'l.m/Z/d!d(l0m1Z1d!d)l0m2Z2d!d*l3m4Z4d!d+l5m6Z6d!d,l5m7Z7d!d-l5m8Z8d!d.l5m9Z9d!d/l5m:Z:d!d0l5m;Z;d!d1l5mm?Z?dd4l>m@Z@dd5l>mAZAdd6l>mBZBdd7lmCZCdd8lDmEZEdd9lFmGZGdd:lHmIZIdd;lJmKZKddlOmPZPd!d?lOmQZQd!d@lRmSZSd!dAl5mTZTd!dBl5mUZUedCeDZVedEeDZWedFdGDZXgdHZYe*jGdIdJe eVe#eVee*jZ\GdKdLe\eVeeVZ]GdMdNee eVeeVZ^yO)Pz|MapperProperty implementations. This is a private module which defines the behavior of individual ORM- mapped attributes. ) annotations)Any)cast)Dict)List)Optional)Sequence)Set)Tuple)Type) TYPE_CHECKING)TypeVar)Union) attributes)exc)strategy_options)_DeclarativeMapped) class_mapper)CompositeProperty)ConcreteInheritedProperty)SynonymProperty)_AttributeOptions)_DEFAULT_ATTRIBUTE_OPTIONS)_IntrospectsAnnotations) _MapsColumns)MapperProperty)PropComparator)StrategizedProperty)RelationshipProperty)de_stringify_annotation) ForeignKey)log)util) coercions)roles)_NoArg)Column) SchemaConst) TypeEngine)de_optionalize_union_types)get_args) includes_none) is_a_type) is_fwd_ref) is_pep593) is_pep695)Self)_IdentityKeyType) _InstanceDict)_ORMColumnExprArgument) _RegistryType)Mapped)_ClassScanMapperConfig)Mapper)Session)_InstallLoaderCallableProto) InstanceState) _InfoType) ColumnElement) NamedColumn) OperatorType)_AnnotationScanType)RODescriptorReference_T)bound_PT_NCzNamedColumn[Any])ColumnPropertyrrr rc (eZdZUdZej ZdZ dZde d<de d<de d <d e d <d Z d d ddd ddd d ddd d!fdZ d"dZ e d#dZe d$dZd%dZej$dd d&dZej$dd d&dZd'dZe d'dZd(dZd)fd Zd*dZ d+dZGddej6eeZd,d ZxZ S)-rHzDescribes an object attribute that corresponds to a table column or other column expression. Public constructor is the :func:`_orm.column_property` function. TFzList[NamedColumn[Any]]columnsbool_is_polymorphic_discriminator Optional[str]_mapped_by_synonymzType[PropComparator[_T]]comparator_factory)rJgroupdeferred instrumentrOactive_historyexpire_on_flush_creation_orderrLrN_deferred_column_loader_raise_column_loader_renders_in_subqueries raiseloadN) attribute_optionsrPrQrYrOrSrTinfodoc _instrument_assume_readonly_dc_attributesc t||| |f| z}|Dcgc]&}tjtj |(c}|_||_||_||_ | |_ ||n|jj|_ ||_||_| |j j#| | | |_n9t'|j D]}t)|dd} | | |_nd|_t+j,|d|jfd|jff|_|jr|xj.dz c_yycc}w)N)rZr^r\rQrR))rYT)super__init__r&expectr'LabeledColumnExprRolerJrPrQrYrR __class__ ComparatorrOrSrTr[updater\reversedgetattrr%set_creation_order strategy_key)selfcolumnrZrPrQrYrOrSrTr[r\r]r^additional_columnsrJccolrds _/mnt/ssd/data/python-lab/Trading/venv/lib/python3.12/site-packages/sqlalchemy/orm/properties.pyrazColumnProperty.__init__sb /+I  )00FM ABI  U88! <     "%"- **  -.   II  T " ?DH - c5$/?"DH    % ' 4?? +  >>   !7 7  G s+Ec p|jd} | j|| _| j|| _yyNr)rJkeyname) rk decl_scanregistryclsoriginating_modulersmapped_container annotationextracted_mapped_annotationis_dataclass_fieldrls rpdeclarative_scanzColumnProperty.declarative_scans8a :: FJ ;; FK c|SNrks rpmapper_property_to_assignz(ColumnProperty.mapper_property_to_assigns r~c||jDcgc]"}t|tr|j|df$c}Scc}wrr)rJ isinstancer)table)rkrns rpcolumns_to_assignz ColumnProperty.columns_to_assigns> \\ !V$F   s'9cd|jvr|jjSd|jvxs||jjvS)N)query_expressionT)rQT)rjstrategy_have_default_expressionparent_readonly_propsrs rp%_memoized_attr__renders_in_subqueriesz4ColumnProperty._memoized_attr__renders_in_subqueriessJ %):): :==99 9!):)::  33 3 r~zsqlalchemy.orm.statezsqlalchemy.orm.strategiesctjj}tjj}|jj |j j|j|j|jSr r% preloaded orm_stateorm_strategiesr="_instance_level_callable_processorr class_managerLoadDeferredColumnsrsrkstate strategiess rp&_memoized_attr__deferred_column_loaderz5ColumnProperty._memoized_attr__deferred_column_loadersa((^^22 ""EE KK % %  * *488 4 HH  r~ctjj}tjj}|jj |j j|j|jd|jS)NTrrs rp#_memoized_attr__raise_column_loaderz2ColumnProperty._memoized_attr__raise_column_loadersc((^^22 ""EE KK % %  * *488T : HH  r~c|jS)zsAllow the ColumnProperty to work in expression before it is turned into an instrumented attribute. ) expressionrs rp__clause_element__z!ColumnProperty.__clause_element__s r~c |jdS)aReturn the primary column or expression for this ColumnProperty. E.g.:: class File(Base): # ... name = Column(String(64)) extension = Column(String(8)) filename = column_property(name + "." + extension) path = column_property("C:/" + filename.expression) .. seealso:: :ref:`mapper_column_property_sql_expressions_composed` r)rJrs rprzColumnProperty.expressions(||Ar~c|jsytj|j|j|j ||||j y)N) comparator parententityr\)rRrregister_descriptorclass_rsrOr\)rkmappers rpinstrument_classzColumnProperty.instrument_class%sB && MM HH..tV<  r~c ft|t|jdkDrt |j j j|jrQtjd|j d|jdd|jdd|jd yyy)Nrz On mapper z, primary key column 'z6' is being combined with distinct primary key column 'rz' in attribute 'zM'. Use explicit properties to give each column its own mapped attribute name.) r`do_initlenrJsetr primary_key issupersetr%warnrs)rkrds rprzColumnProperty.do_init1s  t|| q S)@)@%A%L%L LL&  II;; Qa$(( L & r~clt|j|j|j|jdS)N)rQrPrS)rHrJrQrPrSrs rpcopyzColumnProperty.copyAs- \\]]**..   r~c R|jsy|j|vrQ||j} |s| ||j<y|j|j} | j||| dy|jr/|j|vr |j ||jgdyyy)NT) no_loader)rRrsget_implr has_identity_expire_attributes) rksession source_state source_dict dest_state dest_dictload _recursive_resolve_conflict_mapvalueimpls rpmergezColumnProperty.mergeIs  XX $)E&+ $((#!**4884Yt<  $ $)B  ) )DHH: * *C $r~ceZdZUdZesdZded<ded< ddZerddZ dd Z dd Z dd Z dd Z dd Z ddZy)ColumnProperty.ComparatoraProduce boolean, comparison, and other operators for :class:`.ColumnProperty` attributes. See the documentation for :class:`.PropComparator` for a brief overview. .. seealso:: :class:`.PropComparator` :class:`.ColumnOperators` :ref:`types_operators` :attr:`.TypeEngine.comparator_factory` )rr[ expressionsz*RODescriptorReference[ColumnProperty[_PT]]propSequence[NamedColumn[Any]]rc|j}||||jjd}|}|jjr,|}|jjj |}||d<|j |jd|dS)aannotate and possibly adapt a column to be returned as the mapped-attribute exposed version of the column. The column in this context needs to act as much like the column in an ORM mapped context as possible, so includes annotations to give hints to various ORM functions as to the source entity of this column. It also adapts it to the mapper's with_polymorphic selectable if one is present. )entity_namespacer parentmapper proxy_key adapt_columnorm)compile_state_pluginplugin_subject) _parententityrrs _parentmapper_polymorphic_adaptertraverse _annotate_set_propagate_attrs)rkrlperromapper_local_cols rp_orm_annotate_columnz.ColumnProperty.Comparator._orm_annotate_columns##B$& " "!YY]] +KC !!66#& ((==FFsK /? N+==-BB)."E r~cyrrrs rprz,ColumnProperty.Comparator.__clause_element__sr~c|jr=|j|jjd|jjS|j |jjdSrradapterrrJrsrrs rp#_memoized_method___clause_element__z=ColumnProperty.Comparator._memoized_method___clause_element__sS||||DII$5$5a$8$))--HH001B1B11EFFr~c|j} |jS#t$r|jjcYSwxYw)z(The .info dictionary for this attribute.)rr[AttributeErrorr)rkces rp_memoized_attr_infoz-ColumnProperty.Comparator._memoized_attr_infos=((*B &ww! &yy~~% &s AAc$|jrH|jjDcgc](}|j||jj*c}S|jjDcgc]}|j |c}Scc}wcc}w)zThe full sequence of columns referenced by this attribute, adjusted for any aliasing in progress. .. versionadded:: 1.3.17 r)rkros rp_memoized_attr_expressionsz4ColumnProperty.Comparator._memoized_attr_expressionss|| $yy00LLdiimm4 ?Cii>O>O7:D--c2  s -B-B c6t|j|S)zproxy attribute access down to the mapped column. this allows user-defined comparison methods to be accessed. )rhr)rkrss rp_fallback_getattrz+ColumnProperty.Comparator._fallback_getattrs 4224c: :r~c6||jg|i|Srrrkopotherkwargss rpoperatez!ColumnProperty.Comparator.operates"d--/B%B6B Br~c V|j}||j|||fi|Srr _bind_paramrkrrrros rpreverse_operatez)ColumnProperty.Comparator.reverse_operates/))+Ccoob%0#@@ @r~N)rlrGreturnrG)rzNamedColumn[_PT])rr>)rr)rsstrrrrrArrrrrzColumnElement[Any])__name__ __module__ __qualname____doc__r __slots____annotations__rrrrrrrrrr~rprercs $CI88// & P  A G  G & " ; C" C,/ C;> C  C  A" A+. A:= A  Ar~rec|jr |jstj|St |jj j dz|jzS)N.)rrsobject__repr__rrrrs rp__str__zColumnProperty.__str__sG{{$((??4( (4;;%%../#5@@r~)rlz_ORMColumnExprArgument[_T]rmz_ORMColumnExprArgument[Any]rZzOptional[_AttributeOptions]rPrMrQrKrYrKrOz"Optional[Type[PropComparator[_T]]]rSrKrTrKr[zOptional[_InfoType]r\rMr]rKr^rKrur9rvr7rw Type[Any]rxrMrsrryzOptional[Type[Mapped[Any]]]rzOptional[_AnnotationScanType]r{rr|rKrNonerzOptional[MapperProperty[_T]]rzList[Tuple[Column[Any], int]])rrK)rz _InstallLoaderCallableProto[Any])rzroles.ColumnsClauseRole)rz Mapper[Any]rr)rr)rzColumnProperty[_T])rr;rInstanceState[Any]rr5rrrr5rrKrzDict[Any, object]rz#Dict[_IdentityKeyType[Any], object]rrrr)!rrrrr _COLUMN_TOKENstrategy_wildcard_key inherit_cache_links_to_entityrrrar}propertyrrrr%preload_modulerrrrrrrr MemoizedSlotsrrFrer __classcell__)rds@rprHrHas-::M ###''%%00I*:>#AE$ $$(! /498*989987 98  98  9898?989898"989898)-98v)   *   62&C! $   T/1LM  )  N  T/1LM  )  N  *    )#  '  ! & C 4BAT'')<BAHAr~rHceZdZdZdZy)MappedSQLExpressionaNDeclarative front-end for the :class:`.ColumnProperty` class. Public constructor is the :func:`_orm.column_property` function. .. versionchanged:: 2.0 Added :class:`_orm.MappedSQLExpression` as a Declarative compatible subclass for :class:`_orm.ColumnProperty`. .. seealso:: :class:`.MappedColumn` TN)rrrrrrr~rprrs Mr~rceZdZUdZdZded<ded<ded<d ed <d ed <d ed<ddZddZed dZ ed!dZ ed"dZ d#dZ d$dZ d$dZd%dZ d&dZ d'dZej&d d(dZ d)dZy)* MappedColumna_Maps a single :class:`_schema.Column` on a class. :class:`_orm.MappedColumn` is a specialization of the :class:`_orm.ColumnProperty` class and is oriented towards declarative configuration. To construct :class:`_orm.MappedColumn` objects, use the :func:`_orm.mapped_column` constructor function. .. versionadded:: 2.0 ) rlrU _sort_order foreign_keys _has_nullable_has_insert_defaultrQdeferred_groupdeferred_raiseloadrS_attribute_options_has_dataclass_arguments_use_existing_columnzUnion[_NoArg, bool]rQrKrrMr Column[_T]rlzOptional[Set[ForeignKey]]rrrc|jdtx|_|jdd|_duxr2tk7xr't fdt j D|_|jdtj}|tju|_ |jr||d<n+jtjurj|d<|jdd|_ |jdd|_ |jd tj|_|jd d|_|jd tj|_t#d t%|i||_|j&j(|_d |vxr#|j+d dt,j.fv|_t3j4|y)NrZuse_existing_columnFc3XK|]!\}}|dk7r|tju#yw)dataclasses_defaultN)r(NO_ARG).0iattr attr_optss rp z(MappedColumn.__init__..4s3At00! FMM1s'*insert_defaultdefaultrrrQrS sort_orderrnullable)poprrrany enumerate_fieldsrr(r rrrrrQrSrrr)rlrgetr*NULL_UNSPECIFIEDrr%ri)rkargkwr&r$s @rprazMappedColumn.__init__*s.0ff !;/  )%'FF+@%$H! T ! 77 ():):; % 0&--@#1#F  # #*ByM  * *&-- ?%99ByM ff%5t<"$&&)=t"Dz6==9  ff%5u=66, ><););<  KK44'2- "&&2D   ( (M 3  %r~c F|jj|j}|jjdi||_|j|_|j |_|j |_|jj|_|j|_|j|_ |j|_ |j|_ |j|_ |j|_ |j|_tj ||S)Nr)rd__new__rl_copyrQrrrrSrrrrrrr%ri)rkr1news rpr4zMappedColumn._copyQsnn$$T^^4&T[[&&,, }} !00!%!8!8::22!00 ..!%!8!8"&":":'+'D'D$#'#<#< ** $ r~c.|jjSr)rlrtrs rprtzMappedColumn.namebs{{r~c(|j}|tjur#t|jxs |j }|s |j rCt|j||j|j |j|j Sy)N)rQrPrYrZrS) rQr(r rKrrrSrHrlr)rkeffective_deferreds rprz&MappedColumn.mapper_property_to_assignfs!]]  .!%##>t'>'>"  !4!4! +))11"&"9"9#22  r~ct|j|jtjur|jfgSdfgSrr)rlrr(r rs rprzMappedColumn.columns_to_assignzsM ''v}}<$$       r~c|jSr)rlrs rprzMappedColumn.__clause_element__s {{r~c6||jg|i|Srrrs rprzMappedColumn.operates"$))+>e>v>>r~c V|j}||j|||fi|Srrrs rprzMappedColumn.reverse_operates/%%'#//"e,c.s)CqAaS()Csz are resolvable by the registryzSCould not locate SQLAlchemy Core type when resolving for Python type indicated by 'z)' inside the Mapped[] annotation for the z attribute; zThe object provided inside the zC attribute Mapped annotation is not a Python type, it's the object z. Expected a Python type.)/rlrKr0r!r.rr)r,r2 __value__r-r1rrrIrr'_mergerQr(r rrrrSrrsrtr%warn_deprecatedrr,rr-replacerLrinsert _resolve_typer+ issubclassorm_excMappedAnnotationErrorr/rjoin _set_type)rkrwrursrvargumentrxrOr)find_mapped_inour_type_is_pep593raw_pep_593_typeraw_pep_695_typeour_typeour_argspep_593_componentselem use_args_fromidxr0checks check_type new_sqltypedetails rprNz(MappedColumn._init_column_for_annotations+++""  D &1 11.X14H!*!!#+DKK *,"28< X ' 12B2L2LMH 01H#H- X !% !)(!3 1!4 #=>N#O /3N# !D$ - $  ! !M  $'CC3 DK ,,!((00<&* #  ' ' 4kk&&G&&fmm;MMV]]2 - 6 6 ,,8''/&3&B&B#00<++3*7*J*J'2211,0)++&3&B&B#))5$$ 5#0#<#< $$((4 '',,8$$K 55 )!44<<! HC&88=%}}-"kk."=,,(.DD%   ??4;;#;#;!"$45"+ a!12$.  &44jH.D5 * . h 3x."8Z8!777 7JKN#*$DF vay)6{a'OV)'q {'&)E== !) $ )CF)C C)== "7799? D77;{{6IJ&&,X /"779$++//9LM++3,7   KK ! !+ .u$rIr}r%r rVrNrr~rprrs$ I "!!! ++))%&N"  &    ??(+?7:? ? =='*=69= =  )!   2& )&  &  & * &  & 6& 2& &C& !&  & PT34 )     *     .   5 {/ {/*{/ {/  {/ & {/*{/ {/r~rN)_r __future__rtypingrrrrrr r r r r rrr\rrrhrbaserrdescriptor_propsrrr interfacesrrrrrrr relationshipsr r%r!rCr#r$sqlr&r'sql.baser( sql.schemar)r* sql.type_apir+ util.typingr,r-r.r/r0r1r2r3_typingr4r5r6r7r8rUr9rr:rr;rr<r= sql._typingr> sql.elementsr?r@ sql.operatorsrArBrCrDrFrG__all__ class_logger IdentifiedrHrrrr~rprss# $/7-)2/$&&+/)$%4"'#$##)&/&1 2$',*,13 T e3 e-. HANN HAHAV .,.@.D$h/rh/r~