ó ÃÌ4]c@sdZddlmZddlZddlmZddlmZddlmZdd lm Z ej e ƒZ d „Z d Zd Zd efd„ƒYZdefd„ƒYZeƒe_defd„ƒYZdefd„ƒYZdeefd„ƒYZdS(s@Path tracking utilities, representing mapper graph traversals. iÿÿÿÿ(tchainNi(t class_mapperi(texc(t inspection(tutilcCs tj|ƒS(N(t PathRegistryt deserialize(tpath((sO/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/path_registry.pyt_unreduce_pathst*t _sa_defaultRcBsÎeZdZeZeZd„Zd„Zd„Zdd„Z d„Z e d„ƒZ d„Zd„Zd „Zd „Zd „Zed „ƒZed „ƒZed„ƒZd„Zd„Zd„ZRS(sÜRepresent 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. cCs|dk o|j|jkS(N(tNoneR(tselftother((sO/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/path_registry.pyt__eq__<scCs-tjd|||ƒ||||jfŒt(RtreduceR3(R/traw((sO/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/path_registry.pyR.ŠscCsZ|jdtƒr t||ƒS|jdtƒrCt|j|ƒStjd|ƒ‚dS(Nt:sinvalid token: %s(tendswitht_WILDCARD_TOKENt TokenRegistryt_DEFAULT_TOKENR3Rt ArgumentError(R ttoken((sO/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/path_registry.pyRAŽs  cCstjd„|j|ƒS(NcSs||S(N((R5R6((sO/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/path_registry.pyR7—R8(RR9R(R R ((sO/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/path_registry.pyt__add__–scCsd|jj|jfS(Ns%s(%r)(t __class__t__name__R(R ((sO/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/path_registry.pyt__repr__™sN(RDt __module__t__doc__R!tis_tokentis_rootRRRR RRtpropertyRRR$R%R'R&t classmethodRR4R.RARBRE(((sO/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/path_registry.pyRs(            t RootRegistrycBs3eZdZdZZeZeZeZ d„Z RS(sXRoot registry, defers to mappers so that paths are maintained per-root-mapper. cCs|jS(N(t_path_registry(R tentity((sO/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/path_registry.pyt __getitem__¨s(( RDRFRGRRR!t has_entitytis_aliased_classR RIRO(((sO/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/path_registry.pyRLs  R>cBs/eZd„ZeZeZd„Zd„ZRS(cCs<||_||_|j|f|_|j|f|_dS(N(RAtparentRR(R RRRA((sO/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/path_registry.pyt__init__°s  ccs¶|jj rU|jj rUx•|jjjƒD]!}t|jj||jƒVq-Wn]|jjr­|jjjr­|Vx:|jjj D]!}t|jj||jƒVq…Wn|VdS(N( RRRQRIR"titerate_to_rootR>RARNt_is_with_polymorphict_with_polymorphic_entities(R tent((sO/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/path_registry.pytgenerate_for_superclassesºs" "cCs tƒ‚dS(N(tNotImplementedError(R RN((sO/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/path_registry.pyROÈs( RDRFRSR!RPR RHRXRO(((sO/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/path_registry.pyR>¯s   t PropRegistrycBseeZd„Zd„Zejd„ƒZejd„ƒZed„ƒZ ed„ƒZ d„Z RS(cCstj|dƒ}|j s&|jr9|j|j}n_|jr˜|jr˜|j|jk r˜|j|jkr˜|dj|jƒ}|j|}q˜n||_||_|j |f|_ |j |f|_ d|jj |jj f|_ |jj |_ d|j f|_dS(Niÿÿÿÿtloader(RtinspectRQt_use_mapper_pathRRtwith_polymorphic_mappersR"t_entity_for_mappertpropRRt_wildcard_tokent_wildcard_path_loader_keyt_default_path_loader_keyt _loader_key(R RRR`tinsptsubclass_entity((sO/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/path_registry.pyRSÍs   cCsdjd„|jDƒƒS(Ns -> css|]}t|ƒVqdS(N(tstr(t.0telem((sO/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/path_registry.pys ès(tjoinR(R ((sO/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/path_registry.pyt__str__çscCst|jdƒS(NR"(thasattrR`(R ((sO/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/path_registry.pyRPêscCs |jjS(N(R`R"(R ((sO/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/path_registry.pyRNîscCs|jS(N(RN(R ((sO/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/path_registry.pyR"òscCs ||jS(N(RN(R ((sO/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/path_registry.pyt entity_pathöscCs1t|ttfƒr |j|St||ƒSdS(N(t isinstancetinttsliceRR2(R RN((sO/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/path_registry.pyROús ( RDRFRSRkRtmemoized_propertyRPRNRJR"RmRO(((sO/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/path_registry.pyRZÌs  R2cBsMeZeZeZd„Zed„ƒZd„Z e Z d„Z d„Z RS(cCsº||_||_|j|_||_|j|f|_|jr¡|jr¡|jj|jdjƒr|j|jf|_q­|j|jdjf|_n |j|_||_dS(Niÿÿÿÿ( RRRRQRNRR"RRRm(R RRRN((sO/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/path_registry.pyRSs      cCstj|jƒjS(N(RR\RNR"(R ((sO/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/path_registry.pyR"scCstS(N(R (R ((sO/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/path_registry.pyt__bool__#scCs4t|ttfƒr |j|Stj||ƒSdS(N(RnRoRpRtdictRO(R RN((sO/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/path_registry.pyRO(s cCst||ƒ||<}|S(N(RZ(R Rtitem((sO/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/path_registry.pyt __missing__.s( RDRFR!RQR RPRSRJR"Rrt __nonzero__RORu(((sO/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/path_registry.pyR2s   (RGt itertoolsRtloggingtbaseRR8RRRt getLoggerRDRRR=R?tobjectRRLR3R>RZRsR2(((sO/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/path_registry.pyt s   ~ 5