gd-e?d.<d/Z@Gd0d#eZAGd1d2eAZBGd3d4eBZCeCeA_DGd5d6ejee4ZFGd7d8eAZGGd9d:eAZHGd;deIZJGd?d@e e e fZKGdAdBeIZLer dGdCZMdIdDZNyejdd'ZMejddEZNy)Jz@Path tracking utilities, representing mapper graph traversals. ) annotations)reduce)chainN)Any)cast)Dict)Iterator)List)Optional)overload)Sequence)Tuple) TYPE_CHECKING)Union)base)insp_is_mapper_property)exc)util)visitors) HasCacheKey)_InternalEntityType)StrategizedProperty)Mapper)RelationshipProperty) AliasedInsp)_CacheKeyTraversalType) BindParameter)anon_map) _LiteralStar) TypeGuard PathRegistrycyNpaths M/opt/hc_python/lib64/python3.12/site-packages/sqlalchemy/orm/path_registry.pyis_rootr*0scyr%r&r's r) is_entityr-2sCr+r*r-_InternalEntityType[Any]StrategizedProperty[Any].c,tj|Sr%)r# deserializer's r)_unreduce_pathr2Ps  # #D ))r+*r!_WILDCARD_TOKEN _sa_defaultcveZdZUdZdZdZdZdZdZdZ de d<de d<de d<d e d <d e d <de jjfgZd e d<d/dZd/dZed0dZd1dZd2dZ d2dZ d3 d4dZd5dZd5dZed6dZed7dZed8dZe d9dZe d:dZ d;dZed5dZ dd"Zd?d#Ze d@d$Z!e dAd%Z"dBd&Z#e dCd'Z$ee dDd(Z%ee dEd)Z%e dFd*Z%e dGd+Z&dHd,Z'dId-Z(dId.Z)y)Jr#aRepresent query load paths and registry functions. Basically represents structures like: (, "orders", , "items", ) These structures are generated by things like query options (joinedload(), subqueryload(), etc.) and are used to compose keys stored in the query._attributes dictionary for various options. They are then re-composed at query compile/result row time as the query is formed and as rows are fetched, where they again serve to compose keys to look up options in the context.attributes dictionary, which is copied from query._attributes. The path structure has a limited amount of caching, where each "root" ultimately pulls from a fixed registry associated with the first mapper, that also contains elements for each of its property keys. However paths longer than two elements, which are the exception rather than the rule, are generated on an as-needed basis. r&Fbool is_unnatural_PathRepresentationr( natural_pathzOptional[PathRegistry]parent RootRegistryrootr_cache_key_traversalc |duxr|j|jk(S#t$r$tjdt |zYywxYw)N1Comparison of PathRegistry to %r is not supportedFr(_path_for_compareAttributeErrorrwarntypeselfothers r)__eq__zPathRegistry.__eq__sU $Me6M6M)M M  IIC;    !*A Ac |duxs|j|jk7S#t$r$tjdt |zYywxYw)Nr@TrArFs r)__ne__zPathRegistry.__ne__sT D=HDII1H1H$H H  IIC;    rJc|jSr%r'rGs r)rBzPathRegistry._path_for_compares yyr+c |j|Sr%r')rGindexs r) odd_elementzPathRegistry.odd_elementsyyr+cVtjd|||||||jf<y)Nzset '%s' on path '%s' to '%s')logdebugr:rG attributeskeyvalues r)setzPathRegistry.sets* 13eD/4 C**+,r+cptjd||||j||jf|y)Nz$setdefault '%s' on path '%s' to '%s')rSrT setdefaultr:rUs r)r[zPathRegistry.setdefaults2 8#tUKsD$5$56>r+Nc4||jf}||vr||S|Sr%)r:rUs r)getzPathRegistry.gets+D%%& * c? "Lr+c,t|jSr%lenr(rNs r)__len__zPathRegistry.__len__s499~r+ct|Sr%)idrNs r)__hash__zPathRegistry.__hash__s $xr+cyr%r&rGentitys r) __getitem__zPathRegistry.__getitem__sCFr+cyr%r&rfs r)rhzPathRegistry.__getitem__sz/PathRegistry._serialize_path..s3L"#0B0BAHHQOLs9;rrc3`K|]&}t|r |jn t|(ywr%)rrWr)rps r)rz/PathRegistry._serialize_path..s,L5Q7AEESVCLs,.rr%)rrrrslistziptuplertr`)clsr(r|_p_pathrws r)_serialize_pathzPathRegistry._serialize_paths-t4.5 273w<2KL2KQgaj2KL273w<2KL2KQgaj2KL    MMs B# B(c dd}dd}tt|Dcgc]\}}|||||fc}}}|r |d|dd}|Scc}}w)Ncz|tjvrtj|dStj|SNT) configure) PathToken_internorm_base_inspect_mapped_class)mclss r)_deserialize_mapper_tokenzAPathRegistry._deserialize_path.._deserialize_mapper_tokens> y000..ttD  &&t,  r+c|y|tjvrtj|Stj|d}|J|j|Sr)rrrrattrs)rrWmps r)_deserialize_key_tokenz>PathRegistry._deserialize_path.._deserialize_key_tokensS{ ))) ((--33DDI~%~xx}$r+r)rrreturnr)rrrWrrr)rr)rr(rrrrWrs r)_deserialize_pathzPathRegistry._deserialize_paths{  %   &*  &* c2$7.tS9&*    2!BAsA c<|j}|j|Sr%)r(r)rGr(s r)rzPathRegistry.serialize2syy##D))r+cN|J|j|}|j|Sr%)rcoerce)rr(rs r)r1zPathRegistry.deserialize6s,  ! !$ 'zz!}r+cyr%r&rrzs r) per_mapperzPathRegistry.per_mapper<sGJr+cyr%r&rs r)rzPathRegistry.per_mapper@sJMr+cr|jrt|j|St|j|Sr%)rCachingEntityRegistryr=SlotsEntityRegistryrs r)rzPathRegistry.per_mapperDs/   (6: :&sxx8 8r+c8dd}t|||jS)Nc ||Sr%r&prevnext_s r)_redz!PathRegistry.coerce.._redO ; r+rr#r_PathElementTyperr#)rr=)rrawrs r)rzPathRegistry.coerceMs dC**r+c8dd}t||j|S)Nc ||Sr%r&rs r)rz"PathRegistry.__add__.._redVrr+r)rr()rGrHrs r)__add__zPathRegistry.__add__Us dEJJ--r+cNddjd|jDdS)Nz ORM Path[z -> c32K|]}t|ywr%r)relems r)rz'PathRegistry.__str__..\s&GYTs4yYs])joinr(rNs r)__str__zPathRegistry.__str__[s%6;;>YY&GGHJJr+cN|jjd|jdS)N()) __class____name__r(rNs r)__repr__zPathRegistry.__repr__^s$..))*!DII=::r+)rHrrr7rzOptional[_PathRepresentation])rPintrr.)rVDict[Any, Any]rWrrXrrNoner%)rVrrWrrXz Optional[Any]rr)rr)rg _StrPathTokenr TokenRegistry)rgrrr)rgslicerr9)rgr.rAbstractEntityRegistry)rgr/r PropRegistry)rgzTUnion[_StrPathToken, int, slice, _InternalEntityType[Any], StrategizedProperty[Any]]rzaUnion[TokenRegistry, _PathElementType, _PathRepresentation, PropRegistry, AbstractEntityRegistry])rzOIterator[Tuple[_InternalEntityType[Any], Union[str, StrategizedProperty[Any]]]])rz Mapper[Any]rr7)rVrrWrrr7)rr)r(r9r_SerializedPath)r(rrr9)rrr(rrr#)rzrrr)rzAliasedInsp[Any]rr)rzr.rr)rr9rr#)rHr#rr#)rr)*r __module__ __qualname____doc__ __slots__is_tokenr* has_entity is_propertyr-__annotations__rExtendedInternalTraversaldp_has_cache_key_listr>rIrLpropertyrBrQrYr[r]rardr rhrprxr~rr classmethodrrrr1rrrrrr&r+r)r#r#Xsa2IHGJKI %% ""  33IIJ40 5?(?/2?;>? ?LP(/2;H FF ?? DD %.% %%. $ $ $&0 0.3  $!!F* JJ MM9-9 99++. K;r+c.eZdZUdZded<ded<ddZy) CreatesTokenr&r7rr*c|jdtr t||S|jdtrt|j|St j d|)N:zinvalid token: )endswithr4r_DEFAULT_TOKENr=r ArgumentError)rGtokens r)rzCreatesToken.tokenhs` >>Ao./ 0 u- - ^^a/0 1 E2 2##oeW$=> >r+N)rrrr)rrrrrrr&r+r)rrbsI M?r+rcReZdZdZdZdZdxZZdZdZ dZ dZ ddZ d dZ ese Zyy) r<zXRoot registry, defers to mappers so that paths are maintained per-root-mapper. r&TFc|tjvr5trt|tsJt |tj|S |j S#t$rtd|wxYw)Nz/invalid argument for RootRegistry.__getitem__: ) rrr isinstancerr_path_registryrC IndexErrorrfs r)_getitemzRootRegistry._getitemst Y&& &!&-888 y'8'8'@A A ,,,!  EfXN s AA-c|Sr%r&rNs r)_truncate_recursivez RootRegistry._truncate_recursives r+N)rgrrz,Union[TokenRegistry, AbstractEntityRegistry])rr<)rrrrr inherit_cacher(r:rrr*r8rrrrhr&r+r)r<r<qs[ IMD<JGL   5    r+r<cXeZdZUdZiZded< ddZed dZe d dZ y) rzcacheable string tokenzDict[str, PathToken]rct|fSr%r)rGr bindparamss r)_gen_cache_keyzPathToken._gen_cache_keysD |r+cyr%r&rNs r)rBzPathToken._path_for_comparesr+ct||jvr|j|St|x|j|<}|Sr%)rr)rstrvalueresults r)internzPathToken.interns: s{{ ";;x( (-6x-@ @CKK !FMr+N)r r rzList[BindParameter[Any]]rzTuple[Any, ...]r)rrrr) rrrrrrrrrBrrr&r+r)rrsU $&G !& .F  r+rc`eZdZUdZdZded<ded<d dZdZdZdd Z dd Z dd Z e se Z y y )r)rr;r(r:Trrrr;ctj|}||_||_|j|fz|_|j |fz|_yr%)rrrr;r(r:)rGr;rs r)__init__zTokenRegistry.__init__sG  '  KK5(* "//5(:r+Fc#K|j}t|r|ytrt|tsJ|j sE|j jD]'}t|j||j)y|j rotd|jjrO|td|jjD]'}t|j||j)y|ywNr)r;r*rrrrrziterate_to_rootrrrrg_is_with_polymorphic_with_polymorphic_entitiesrGr;mp_entents r)generate_for_superclassesz'TokenRegistry.generate_for_superclassess 6?J  f&<= ==&& --779#FMM&$94::FF:  # #" #"# J"FMM(()$FMM#$6 CC) JsDDc#^K|j}t|r|jytrt |t sJ|j jD]1}t|j||jj3|jrtd|jjrc|jtd|jjD]1}t|j||jj3y|jywr)r;r*r:rrrrzrrrrrrgrrrs r)"_generate_natural_for_superclassesz0TokenRegistry._generate_natural_for_superclassess 6?## #  f&<= ==mm335F f 5tzzBOO O6  # #" #"# ## #"FMM(()"&--"4djjANN)## #sD+D-c^ |j|S#t$r}t||d}~wwxYwr%)r( TypeErrorr)rGrgerrs r)rzTokenRegistry._getitems5 399V$ $ 3x)s 2 3s , ',N)r;rrr)rzIterator[PathRegistry])rzIterator[_PathRepresentation]rgrrr)rrrrrrrrrrr rrrhr&r+r)rrsO;IM  ;JH6$ &$:3   r+rc|eZdZUdZdZdZded<ded<ded< dd Zdd Ze dd Z dd Z e se Z y y )r) propr;r(r:rrgrz_wildcard_path_loader_key_default_path_loader_key _loader_keyr8Tr/rzOptional[Mapper[Any]]rzz"Optional[_InternalEntityType[Any]]rgctd|d}|}|jjxst|jj |_|j r |jr|j|jx}}n|j r|jru|j|jvr]|dj|j}|j|}|jr!|j|j}d|_nq|}nn|jrb|j rV|j|jur>|jj|jr|j|j}||_ ||_|j|fz|_ |j|fz|_ |j|_|j r;t"rt%|t&sJ|j(|_|j|_nd|_d|_d|j|jj*zf|_|jj.|_d|jf|_y)Nr.rTloader)rr;r8r7rzinheritsr_use_mapper_pathwith_polymorphic_mappers_entity_for_mapperr{rr(r:_links_to_entityr_is_relationshiprrrrg_wildcard_tokenrrr)rGr;rinspnatural_parentsubclass_entitys r)rzPropRegistry.__init__s .r ;17#MM66 $ MM " "; $$(=(=&,mmDKK&@ @F^  ! !-- t<<<8>r 8U8UVZVaVa8bO]]?3F@}}!'/E/E!F$(!!'  ! !%% ;;  ,#]]4;;7N  KK4') *774'A//  !$(<===++DK++DKDKDK    $))";"; ;* &)- (J(J%$d&7&78r+cd}tt|jddD]\}}||jus|}||S|j |jd|dz S)Nrrr) enumeratereversedr(rr)rGearliestrwrs r)rz PropRegistry._truncate_recursivevsg!(499Sb>":;HAu !<  K;;tyyx!|_=> >r+c<|jJ||jSr%)rgrNs r) entity_pathzPropRegistry.entity_paths!{{&&&DKK  r+cdt|ttfr|j|St ||Sr%)rrrr(rrfs r)rzPropRegistry._getitems. fsEl +99V$ $&tV4 4r+N)r;rrr/)rrrr)rgz+Union[int, slice, _InternalEntityType[Any]]rzDUnion[AbstractEntityRegistry, _PathElementType, _PathRepresentation])rrrrrrrrrrr%rrrhr&r+r)rrs} IMK "" !! ..X9,X94LX9t ?!!5A5 M5   r+rceZdZUdZdZdZded<ded<ded<ded < dd Zdd Ze dd Z e dd Z e ddZ ddZ ddZeseZyy)r)rWr;rr(rgr:T!Union[RootRegistry, PropRegistry]r;r.rWrgr7rc||_||_|j|_||_|j|fz|_|jr|js |j r|j j|jdj r |j|j fz|_y|j|jdjfz|_y|j|_y)Nr) rWr;rrgr(r8rzr{r:)rGr;rgs r)rzAbstractEntityRegistry.__init__s  & 7 7 KK6)+ $ ;;D11V5H5H}}  !4!4R!8!?!?@$*$7$76==:J$J!$*$7$7''+22;%!!% D r+cP|jj|jSr%)r;rrgrNs r)rz*AbstractEntityRegistry._truncate_recursives{{..0==r+c$|jdS)Nr)rQrNs r) root_entityz"AbstractEntityRegistry.root_entitys""r+c|Sr%r&rNs r)r%z"AbstractEntityRegistry.entity_paths r+c.|jjSr%)rgrzrNs r)rzzAbstractEntityRegistry.mappers{{!!!r+cy)NTr&rNs r)__bool__zAbstractEntityRegistry.__bool__sr+ct|ttfr|j|S|tj vrt |tj |St||Sr%)rrrr(rrrrrfs r)rzAbstractEntityRegistry._getitemsT fsEl +99V$ $ y(( ( y'8'8'@A Af- -r+Nr;r)rgr.r')rr.)rr#)rr)rr7)rgrrz:Union[_PathElementType, _PathRepresentation, PathRegistry])rrrrrr-rrrrr-r%rzr1rrrhr&r+r)rrsIJI -- !! $$,*1,*),*\>##"".. C.   r+rceZdZdZy)rTN)rrrrr&r+r)rrs Mr+rceZdZddZddZy)_ERDictc||_yr%)registry)rGr8s r)rz_ERDict.__init__s   r+c<t|j|x||<}|Sr%)rr8)rGrWitems r) __missing__z_ERDict.__missing__s ' s;;S D r+N)r8r)rWrrr)rrrrr;r&r+r)r6r6s !r+r6cPeZdZdZdZ dfd ZddZddZeseZ xZ SxZ S) r)_cacheTcFt|||t||_yr%)superrr6r=)rGr;rgrs r)rzCachingEntityRegistry.__init__ s (dm r+c:|jj||Sr%)r=pop)rGrWdefaults r)rAzCachingEntityRegistry.pops{{sG,,r+ct|ttfr|j|St|tr t ||S|j |Sr%)rrrr(rrr=rfs r)rzCachingEntityRegistry._getitemsE fsEl +99V$ $  * v. .;;v& &r+r3)rWrrBrrrr) rrrrrrrArrrh __classcell__)rs@r)rrs?IM$1$)$-'   r+rcyr%r&r's r)path_is_entityrF#s,/r+cyr%r&r's r)path_is_propertyrH'sr+r)r(r#rzTypeGuard[RootRegistry])r(r#rz!TypeGuard[AbstractEntityRegistry]r)r(r#rzTypeGuard[PropRegistry])Or __future__r functoolsr itertoolsrloggingoperatortypingrrrr r r r r rrrrr_typingrrrsqlr sql.cache_keyrr interfacesrrzr relationshipsrrr sql.elementsr sql.visitorsr util.typingr!r"r*r- attrgetterrrrrr9rrrs getLoggerrrSr2r4rrr#rr<r=InspectionAttrrrrrrr6rrFrHr&r+r)r[s# ,',/3!6,'*'CO"h!!),G###K0Is) -/II,c12""<="5)CS)H#IJg!*!$#G;;G;T ?< ?#<#L!N ''c.SLSlH<HV]\]@0 d38n2>00 *0M)X((5N*x**=9r+