ÿØÿàJFIFÿþ ÿÛC       ÿÛC ÿÀÿÄÿÄ"#QrÿÄÿÄ&1!A"2qQaáÿÚ ?Øy,æ/3JæÝ¹È߲؋5êXw²±ÉyˆR”¾I0ó2—PI¾IÌÚiMö¯–þrìN&"KgX:Šíµ•nTJnLK„…@!‰-ý ùúmë;ºgµŒ&ó±hw’¯Õ@”Ü— 9ñ-ë.²1<yà‚¹ïQÐU„ہ?.’¦èûbß±©Ö«Âw*VŒ) `$‰bØÔŸ’ëXÖ-ËTÜíGÚ3ð«g Ÿ§¯—Jx„–’U/ÂÅv_s(Hÿ@TñJÑãõçn­‚!ÈgfbÓc­:él[ðQe 9ÀPLbÃãCµm[5¿ç'ªjglå‡Ûí_§Úõl-;"PkÞÞÁQâ¼_Ñ^¢SŸx?"¸¦ùY騐ÒOÈ q’`~~ÚtËU¹CڒêV  I1Áß_ÿÙ 4]c@s9dZddlZddlmZddlmZddlmZddlmZddlm Z dd lm Z dd lm Z dd lm Z dd lm Z dd lmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlm Z d d!lm!Z!d d"lm"Z"d d#lm#Z#e"j$d$ej%ej&ej'fd%YZ(d&e(fd'YZ)d(Z*e#j+d)Z,e#j+d*Z-e#j+d+Z.e#j+d,Z/e#j+d-Z0d.e1fd/YZ2d0e1fd1YZ3d2e3fd3YZ4d4e4fd5YZ5d6e3fd7YZ6d8Z7e#j+d9Z8e9e:ee:ee:egZ;e#j<d:d;d<d=gZ=d:e=fd>YZ=e=e>e>e>Z?ed?Z@ed@ZAeBdAZCdBZDeBe>eBe>e>dCZEe>e>e>dDZFdEZGdFZHdGZIdHZJe>dIZKdJZLdKZMdLZNdMZOdS(NsDefines instrumentation for class attributes and their interaction with instances. This module is usually not directly visible to user applications, but defines a large part of the ORM's interactivity. iNi(t collections(texc(t interfaces(t ATTR_EMPTY(t ATTR_WAS_SET(t CALLABLES_OK(tINIT_OK(t instance_dict(tinstance_state(t instance_str(tLOAD_AGAINST_COMMITTED(tmanager_of_class(t NEVER_SET(t NO_AUTOFLUSH(t NO_CHANGE(tNO_RAISE(tNO_VALUE(tNON_PERSISTENT_OK(tPASSIVE_NO_FETCH(tPASSIVE_NO_FETCH_RELATED(tPASSIVE_NO_INITIALIZE(tPASSIVE_NO_RESULT(t PASSIVE_OFF(tPASSIVE_ONLY_PERSISTENT(tPASSIVE_RETURN_NEVER_SET(tRELATED_OBJECT_OK(tSQL_OK(t state_stri(tevent(t inspection(tutiltQueryableAttributecBs eZdZeZdddddZejdZ e dZ e dZ dZejdZejdZe dZd Zd Zd Zd Zd ZdZdZdZedZdZdZejdZ RS(sBase class for :term:`descriptor` objects that intercept attribute events on behalf of a :class:`.MapperProperty` object. The actual :class:`.MapperProperty` is accessible via the :attr:`.QueryableAttribute.property` attribute. .. seealso:: :class:`.InstrumentedAttribute` :class:`.MapperProperty` :attr:`.Mapper.all_orm_descriptors` :attr:`.Mapper.attrs` c Cs||_||_||_||_||_||_t|}|rxY|jD]K}||krR|jj ||j||jj rt |j_ qqRqRWndS(N( tclass_tkeytimplt comparatort _parententityt_of_typeR t_basestdispatcht_updatet_active_historytTrue( tselfR R!R"R#t parententitytof_typetmanagertbase((sL/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/attributes.pyt__init__Ns        cCs |jjS(N(R"tsupports_population(R+((sL/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/attributes.pyt_supports_populationiscCs |jjS(N(R"t uses_objects(R+((sL/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/attributes.pyt_impl_uses_objectsmscCs"|jjt|t||S(N(R"t get_historyRR(R+tinstancetpassive((sL/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/attributes.pyR5qs cCs|S(N((R+((sL/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/attributes.pyt__selectable__vscCs |jjS(sReturn the 'info' dictionary for the underlying SQL element. The behavior here is as follows: * If the attribute is a column-mapped property, i.e. :class:`.ColumnProperty`, which is mapped directly to a schema-level :class:`.Column` object, this attribute will return the :attr:`.SchemaItem.info` dictionary associated with the core-level :class:`.Column` object. * If the attribute is a :class:`.ColumnProperty` but is mapped to any other kind of SQL expression other than a :class:`.Column`, the attribute will refer to the :attr:`.MapperProperty.info` dictionary associated directly with the :class:`.ColumnProperty`, assuming the SQL expression itself does not have its own ``.info`` attribute (which should be the case, unless a user-defined SQL construct has defined one). * If the attribute refers to any other kind of :class:`.MapperProperty`, including :class:`.RelationshipProperty`, the attribute will refer to the :attr:`.MapperProperty.info` dictionary associated with that :class:`.MapperProperty`. * To access the :attr:`.MapperProperty.info` dictionary of the :class:`.MapperProperty` unconditionally, including for a :class:`.ColumnProperty` that's associated directly with a :class:`.schema.Column`, the attribute can be referred to using :attr:`.QueryableAttribute.property` attribute, as ``MyClass.someattribute.property.info``. .. seealso:: :attr:`.SchemaItem.info` :attr:`.MapperProperty.info` (R#tinfo(R+((sL/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/attributes.pyR9zs'cCstj|jS(sReturn an inspection instance representing the parent. This will be either an instance of :class:`.Mapper` or :class:`.AliasedInsp`, depending upon the nature of the parent entity which this attribute is associated with. (RtinspectR$(R+((sL/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/attributes.pytparents cCs |jjS(N(R#t__clause_element__(R+((sL/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/attributes.pyt expressionscCs |jjS(N(R#R<(R+((sL/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/attributes.pyR<scCs |jjS(shlike __clause_element__(), but called specifically by :class:`.Query` to allow special behavior.(R#t_query_clause_element(R+((sL/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/attributes.pyR>scCs|jj|S(s'Return setter tuples for a bulk UPDATE.(R#t_bulk_update_tuples(R+tvalue((sL/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/attributes.pyR?sc CsG|j st|j|j|jd|jd|jj|d|S(NR"R#R,(R%tAssertionErrort __class__tentityR!R"R#tadapt_to_entity(R+RD((sL/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/attributes.pyRDs  cCs4t|j|j|j|jj||jd|S(NR-(RR R!R"R#R-R$(R+tcls((sL/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/attributes.pyR-s cCs|jj|S(N(R>tlabel(R+tname((sL/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/attributes.pyRFscOs||j||S(N(R#(R+toptothertkwargs((sL/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/attributes.pytoperatescKs|||j|S(N(R#(R+RHRIRJ((sL/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/attributes.pytreverse_operatescCs|jj|d|tk S(Nt optimistic(R"t hasparenttFalse(R+tstateRM((sL/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/attributes.pyRNscCs]yt|j|SWnBtk rXtdt|jt|jj||fnXdS(NsFNeither %r object nor %r object associated with %s has an attribute %r(tgetattrR#tAttributeErrorttypet__name__(R+R!((sL/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/attributes.pyt __getattr__s  cCsd|jj|jfS(Ns%s.%s(R RTR!(R+((sL/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/attributes.pyt__str__scCs |jjS(sReturn the :class:`.MapperProperty` associated with this :class:`.QueryableAttribute`. Return values here will commonly be instances of :class:`.ColumnProperty` or :class:`.RelationshipProperty`. (R#tproperty(R+((sL/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/attributes.pyRWs N(RTt __module__t__doc__R*t is_attributetNoneR0Rtmemoized_propertyR2RWR4RR5R8R9R;R=R<R>R?RDR-RFRKRLRORNRURV(((sL/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/attributes.pyR4s2   )          tInstrumentedAttributecBs)eZdZdZdZdZRS(sClass bound instrumented attribute which adds basic :term:`descriptor` methods. See :class:`.QueryableAttribute` for a description of most features. cCs)|jjt|t||ddS(N(R"tsetRRR[(R+R6R@((sL/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/attributes.pyt__set__ s cCs#|jjt|t|dS(N(R"tdeleteRR(R+R6((sL/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/attributes.pyt __delete__scCs\|dkr|St|}|jr?|j|kr?||jS|jjt||SdS(N(R[RR2R!R"tgetR(R+R6townertdict_((sL/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/attributes.pyt__get__s    (RTRXRYR_RaRe(((sL/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/attributes.pyR]s  csXdtffdY}tjd|_tj|tddd|S(sCreate an QueryableAttribute / user descriptor hybrid. Returns a new QueryableAttribute type that delegates descriptor behavior and getattr() to the given descriptor. tProxycseZdZd d d dZeZedZedZe j dZ dZ dZ dZfdZRS( sPresents the :class:`.QueryableAttribute` interface as a proxy on top of a Python descriptor / :class:`.PropComparator` combination. cSsC||_||_||_||_||_||_||_dS(N(R R!t descriptortoriginal_propertyt _comparatort_adapt_to_entityRY(R+R R!RgR#RDtdocRh((sL/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/attributes.pyR0.s      cSs(|jdk o't|j|jjjS(N(RhR[RQR R!R"R3(R+((sL/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/attributes.pyR4BscSs |jjS(N(R#RW(R+((sL/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/attributes.pyRWIscSsOtj|jr$|j|_n|jrH|jj|j|_n|jS(N(RtcallableRiRjRD(R+((sL/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/attributes.pyR#Ms   cSs%|j|j|j|j|j|S(N(RBRCR!RgRi(R+RD((sL/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/attributes.pyRDWs cSs<|jj||}||jkr4|dkr4|S|SdS(N(RgReR[(R+R6Rctretval((sL/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/attributes.pyRe`scSsd|jj|jfS(Ns%s.%s(R RTR!(R+((sL/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/attributes.pyRVjscsyt|SWntk r|dkr<tdny |j}Wn3tk r~tdtj||fqXyt||SWqtk rtdtjt|j||fqXnXdS(sNDelegate __getattr__ to the original descriptor and/or comparator.R#s[Neither %r object nor unconfigured comparator object associated with %s has an attribute %rsFNeither %r object nor %r object associated with %s has an attribute %rN(RQRRR#RSRT(R+t attributeR#(Rg(sL/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/attributes.pyRUms(        N(RTRXRYR[R0R*t_is_internal_proxyRWR4RR\R#RDReRVRU((Rg(sL/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/attributes.pyRf's  RGRgt from_instance(RRSRTRtmonkeypatch_proxied_specials(RgRf((RgsL/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/attributes.pytcreate_proxied_attributes ftREMOVEtAPPENDtREPLACEt BULK_REPLACEtMODIFIEDtEventcBs>eZdZdZdZdZedZdZRS( sA token propagated throughout the course of a chain of attribute events. Serves as an indicator of the source of the event and also provides a means of controlling propagation across a chain of attribute operations. The :class:`.Event` object is sent as the ``initiator`` argument when dealing with events such as :meth:`.AttributeEvents.append`, :meth:`.AttributeEvents.set`, and :meth:`.AttributeEvents.remove`. The :class:`.Event` object is currently interpreted by the backref event handlers, and is used to control the propagation of operations across two mutually-dependent attributes. .. versionadded:: 0.9.0 :var impl: The :class:`.AttributeImpl` which is the current event initiator. :var op: The symbol :attr:`.OP_APPEND`, :attr:`.OP_REMOVE`, :attr:`.OP_REPLACE`, or :attr:`.OP_BULK_REPLACE`, indicating the source operation. R"RHt parent_tokencCs%||_||_|jj|_dS(N(R"RHRy(R+tattribute_implRH((sL/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/attributes.pyR0s  cCs1t|to0|j|jko0|j|jkS(N(t isinstanceRxR"RH(R+RI((sL/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/attributes.pyt__eq__scCs |jjS(N(R"R!(R+((sL/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/attributes.pyR!scCs|jj|S(N(R"RN(R+RP((sL/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/attributes.pyRNs(R"RHRy( RTRXRYt __slots__R0R|RWR!RN(((sL/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/attributes.pyRxs   t AttributeImplc BseZdZeddedeeddZdZd ZdZ dZ e e e Z edZ dZedZedZdZedZedZedZedZededZedZdZRS(s4internal implementation for instrumented attributes.c Ks||_||_||_||_||_| p6||_| |_|dkr`tj |_ n ||_ | dk r| |_ n |j |_ t ||}x-tj|pgD]}|j||qW|rt|j_n| |_t|t|_dS(s&Construct an AttributeImpl. :param \class_: associated class :param key: string name of the attribute :param \callable_: optional function which generates a callable based on a parent instance, which produces the "default" values for a scalar or collection attribute when it's first accessed, if not present already. :param trackparent: if True, attempt to track if an instance has a parent attached to it via this attribute. :param extension: a single or list of AttributeExtension object(s) which will receive set/delete/append/remove/etc. events. The event package is now used. .. deprecated:: 1.3 The :paramref:`.AttributeImpl.extension` parameter is deprecated and will be removed in a future release, corresponding to the "extension" parameter on the :class:`.MapperProprty` classes like :func:`.column_property` and :func:`.relationship` The events system is now used. :param compare_function: a function that compares two values which are normally assignable to this attribute. :param active_history: indicates that get_history() should always return the "old" value, even if it means executing a lazy callable upon attribute change. :param parent_token: Usually references the MapperProperty, used as a key for the hasparent() function to identify an "owning" attribute. Allows multiple AttributeImpls to all match a single owner attribute. :param expire_missing: if False, don't add an "expiry" callable to this attribute during state.expire_attributes(None), if no value is present for this key. :param send_modified_events: if False, the InstanceState._modified_event method will have no effect; this means the attribute will never show up as changed in a history entry. N(R R!t callable_R't trackparentRytsend_modified_eventsR[toperatorteqtis_equaltaccepts_scalar_loadertdefault_accepts_scalar_loaderR Rtto_listt_adapt_listenerR*R)texpire_missingRxt OP_MODIFIEDt_modified_token(R+R R!RR'Rt extensiontcompare_functiontactive_historyRyRRRRJtattrtext((sL/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/attributes.pyR0s(F            R R!RR'RRyRRRRRcCsd|jj|jfS(Ns%s.%s(R RTR!(R+((sL/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/attributes.pyRVCscCs |jjS(s(Backwards compat for impl.active_history(R'R)(R+((sL/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/attributes.pyt_get_active_historyFscCs||j_dS(N(R'R)(R+R@((sL/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/attributes.pyt_set_active_historyKscCs=d}|jst||jjt|j|tk S(s4Return the boolean value of a `hasparent` flag attached to the given state. The `optimistic` flag determines what the default return value should be if no `hasparent` flag can be located. As this function is used to determine if an instance is an *orphan*, instances that were loaded from storage should be assumed to not be orphans, until a True/False value for this flag is set. An instance attribute that is loaded by a callable function will also not have a `hasparent` flag. s6This AttributeImpl is not configured to track parents.(RRAtparentsRbtidRyRO(R+RPRMtmsg((sL/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/attributes.pyRNPscCsd}|jst|t|j}|r@||j|W|j|||dS(N( RR[RRROR'RRR(R+RPRdR@RR((sL/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/attributes.pyRs cCs|jrI||k rI|dttfkrI|jt||tqInx2|jjD]$}|||||pt|j }qVW|j ||||jr|dk r|jt||t qn|S(N( RR[RR RRROR'R^RRR*(R+RPRdR@RRR((sL/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/attributes.pyRs    (N(RTRXRYRORR*R3R1RR}R`RR5RRR[R^RR(((sL/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/attributes.pyRgs $ & tCollectionAttributeImplcBseZdZeZeZeZeZeZ dZ deddddZ dZ ed Zed Zd Zd Zd ZdZdZdZedZedZedZdeeedZdZdZdedZRS(sA collection-holding attribute that instruments changes in membership. Only handles collections of instrumented objects. InstrumentedCollectionAttribute holds an arbitrary, user-specified container object (defaulting to a list) and brokers access to the CollectionAdapter, a "view" onto that object that presents consistent bag semantics to the orm layer independent of the user data implementation. tcopytcollection_factoryRRt_bulk_replace_tokent_duck_typed_asc Kstt|j||||d|d|d| | |dkrL|j}n||_||_t|t|_ t|t |_ t|t |_ tj|j|_t|jddrtj|dd} tj|dd} ndS( NRRRt _sa_linkertinit_collectioncSs|j|dS(N(R(ttargetRtcollection_adapter((sL/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/attributes.pytlinkNstdispose_collectioncSs|jddS(N(RR[(RRR((sL/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/attributes.pytunlinkRs(RRR0R[t_CollectionAttributeImpl__copyRRRxt OP_APPENDRRRtOP_BULK_REPLACERRtduck_type_collectionRRQRt listens_for( R+R R!RR't typecallableRRt copy_functionRRJRR((sL/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/attributes.pyR0)s*     cCs gtj|D] }|^qS(N(RR(R+titemty((sL/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/attributes.pyt__copyVscCs?|j||d|}|tkr(tStj|||SdS(NR7(RbRRRtfrom_collection(R+RPRdR7R((sL/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/attributes.pyR5Ys c Cs|j|krgS||j}t|d}|j|jkry|j|j}|ttfkryg|D]*}|dk rt|pd|f^qj}g|D]*}|dk rt|pd|f^q}t|} t|} g|D]$\} } | | kr| | f^qg|D]$\} } | | kr| | f^qg|D]$\} } | | krM| | f^qMSng|D]} t| | f^qS(Nt _sa_adapter(R!RQRRR R[Rtdict( R+RPRdR7RRtctcurrent_statestoriginal_statest current_sett original_settsto((sL/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/attributes.pyR`s$ 44  ] cCs}x/|jjD]!}||||p(|j}q W|j||tt|jry|dk ry|jt ||tn|S(N( R'RRRR R*RR[RR(R+RPRdR@RR((sL/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/attributes.pytfire_append_events cCs|j||ttdS(sfA special event used for pop() operations. The "remove" event needs to have the item to be removed passed to it, which in the case of pop from a set, we don't have a way to access the item before the operation. the event is used for all pop() operations (even though set.pop is the one where it is really needed). N(RR R*(R+RPRdR((sL/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/attributes.pytfire_pre_remove_events cCs{|jr1|dk r1|jt||tnx-|jjD]}||||pY|jq>W|j||t t dS(N( RR[RRROR'RRRR R*(R+RPRdR@RR((sL/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/attributes.pyRs cCsV|j|krdS|j||tt|j||j}|j||j=dS(N(R!RR R*tget_collectionRtclear_with_event(R+RPRdR((sL/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/attributes.pyR`s  cCs&|j|\}}|||j<|S(s3Initialize this attribute with an empty collection.(t_initialize_collectionR!(R+RPRdt_t user_data((sL/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/attributes.pyRs cCsD|jj|j||j\}}|jj|||||fS(N(R.tinitialize_collectionR!RR'R(R+RPtadapterR((sL/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/attributes.pyRs cCs|j||d|}|tkrs|j||||}|j|ksWtd|j|jj|n|j||dS(NR7s,Collection was loaded during event handling.(RRRR!RAt_get_pending_mutationRtappend_with_event(R+RPRdR@RR7R((sL/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/attributes.pyRs  cCs|j||jd|}|tkrt|j|||||j|ksXtd|j|jj|n|j||dS(NR7s,Collection was loaded during event handling.( RRRRR!RARRtremove_with_event(R+RPRdR@RR7R((sL/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/attributes.pyRs  cCsAy |j||||d|Wntttfk r<nXdS(NR7(RRRt IndexError(R+RPRdR@RR7((sL/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/attributes.pyRs cCs|}} |j|\} } |r| jdk rF| j|}qtj|} |j} | | k r|dkr|dp|jj}|jj}td||fnt |dr|j }q| t kr tj r|j }qt|d|j }qt|}nt|}|j}|jj||||j||dt}|tkr}|j||}n|| krdS|j|||t|j}| ||jg|jD]$}|dk rt|pd^qoS(N(RRR[RR0R1(R+R((sL/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/attributes.pytas_statefs..cCs|jj|jt}|tkrV|tkr@|dddS|d|gdSn|j||tkr|d|gdSt|tkrd}t|tkrd}qn |g}|tkr|d d |S||gd |SdS( N(((((((((((( RRbR!t _NO_HISTORYR RR*Rt_NO_STATE_SYMBOLSR[(RERnRPRRR1((sL/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/attributes.pyRvs     cCs|jj|jt}|tkrb|tks<|tkrL|dddS|d|gdSn||kr|tk r|d|gdSt|tks|dkrd}t|tkrd}qn |g}|tks|tkr|d d |S||gd |SdS( N(((((((((((( RRbR!R:RR RR;R[(RERnRPRRR1((sL/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/attributes.pyRs   c Cs|jj|jt}|tks0|tkr@|dddSt|d}|ttfkrw|t|ddS|tkr|dt|dSg|D]*}|dk rt |pd|f^q}g|D]*}|dk rt |pd|f^q}t |}t |} |g|D]\} } | | kr)| ^q)g|D]\} } | | krQ| ^qQg|D]\} } | |kry| ^qySdS( NR(((((((( RRbR!R:RR RQRR[RR( RERnRPRRRRRRRRR((sL/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/attributes.pyRs$ 44  (((RTRXRYR2t __nonzero__R4R5R6R7R8R9t classmethodRRR(((sL/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/attributes.pyR*s       cCsZ|tkr"tjdt}n"|tkrDtjdt}ntt|||S(s Return a :class:`.History` record for the given object and attribute key. This is the **pre-flush** history for a given attribute, which is reset each time the :class:`.Session` flushes changes to the current database transaction. .. note:: Prefer to use the :attr:`.AttributeState.history` and :meth:`.AttributeState.load_history` accessors to retrieve the :class:`.History` for instance attributes. :param obj: an object whose class is instrumented by the attributes package. :param key: string attribute name. :param passive: indicates loading behavior for the attribute if the value is not already present. This is a bitflag attribute, which defaults to the symbol :attr:`.PASSIVE_OFF` indicating all necessary SQL should be emitted. .. seealso:: :attr:`.AttributeState.history` :meth:`.AttributeState.load_history` - retrieve history using loader callables if the value is not locally present. sNPassing True for 'passive' is deprecated. Use attributes.PASSIVE_NO_INITIALIZEsFPassing False for 'passive' is deprecated. Use attributes.PASSIVE_OFF(R*Rtwarn_deprecatedRRORtget_state_historyR(RR!R7((sL/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/attributes.pyR5s"    cCs|j||S(N(R5(RPR!R7((sL/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/attributes.pyR? scCs+t|}t|}|j|||S(tTODO(R Rt has_parent(RERR!RMR.RP((sL/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/attributes.pyRA s  cKse|jdd}|jdd}|jdd}t||||d|}t||||S(NR#R,Rk(RR[tregister_descriptortregister_attribute_impl(R R!RR#R,Rktdesc((sL/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/attributes.pytregister_attributes c Kst|}|r?|jdd} |j|| p6t} n|jdd} ||j} |r|||| | |} n`|rt|||| d| |} n9|rt|||| |} nt|||| |} | ||_ |r t ||||n|j |||S(NR( R RR[tinstrument_collection_classRR'RRRR"R.tpost_configure_attribute( R R!R*Rt useobjectt impl_classtbackrefRR.tfactoryRR'R"((sL/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/attributes.pyRCs*    cCsDt|}t||d|d|}||_|j|||S(NR#R,(R R]RYtinstrument_attribute(R R!R#R,RkR.Rg((sL/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/attributes.pyRBIs   cCst|j|dS(N(R tuninstrument_attribute(R R!((sL/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/attributes.pytunregister_attributeXscCs%t|}|j}t|||S(s4Initialize a collection attribute and return the collection adapter. This function is used to provide direct access to collection internals for a previously unloaded attribute. e.g.:: collection_adapter = init_collection(someobject, 'elements') for elem in values: collection_adapter.append_without_event(elem) For an easier way to do the above, see :func:`~sqlalchemy.orm.attributes.set_committed_value`. :param obj: a mapped object :param key: string attribute name where the collection is located. (RRtinit_state_collection(RR!RPRd((sL/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/attributes.pyR\s  cCs5|j|j}|j||}|j|||S(sDInitialize a collection attribute and return the collection adapter.(R.R"RR(RPRdR!RR((sL/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/attributes.pyROsscCs:t|t|}}|j|jj|||dS(s[Set the value of an attribute with no history events. Cancels any previous history present. The value should be a scalar value for scalar-holding attributes, or an iterable for any collection-holding attribute. This is the same underlying method used when a lazy loader fires off and loads additional data from the database. In particular, this method can be used by application code which has loaded additional attributes or collections through separate queries, which can then be attached to an instance as though it were part of its original loaded state. N(RRR.R"R(R6R!R@RPRd((sL/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/attributes.pyR{scCs=t|t|}}|j|jj||||dS(ssSet the value of an attribute, firing history events. This function may be used regardless of instrumentation applied directly to the class, i.e. no descriptors are required. Custom attribute management schemes will need to make usage of this method to establish attribute state as understood by SQLAlchemy. :param instance: the object that will be modified :param key: string name of the attribute :param value: value to assign :param initiator: an instance of :class:`.Event` that would have been propagated from a previous event listener. This argument is used when the :func:`.set_attribute` function is being used within an existing event listening function where an :class:`.Event` object is being supplied; the object may be used to track the origin of the chain of events. .. versionadded:: 1.2.3 N(RRR.R"R^(R6R!R@RRPRd((sL/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/attributes.pyt set_attributescCs3t|t|}}|j|jj||S(sZGet the value of an attribute, firing any callables required. This function may be used regardless of instrumentation applied directly to the class, i.e. no descriptors are required. Custom attribute management schemes will need to make usage of this method to make usage of attribute state as understood by SQLAlchemy. (RRR.R"Rb(R6R!RPRd((sL/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/attributes.pyt get_attributes cCs7t|t|}}|j|jj||dS(sQDelete the value of an attribute, firing history events. This function may be used regardless of instrumentation applied directly to the class, i.e. no descriptors are required. Custom attribute management schemes will need to make usage of this method to establish attribute state as understood by SQLAlchemy. N(RRR.R"R`(R6R!RPRd((sL/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/attributes.pyt del_attributes cCs\t|t|}}|j|j}|jj||j|j||tdt dS(sMark an attribute on an instance as 'modified'. This sets the 'modified' flag on the instance and establishes an unconditional change event for the given attribute. The attribute must have a value present, else an :class:`.InvalidRequestError` is raised. To mark an object "dirty" without referring to any specific attribute so that it is considered within a flush, use the :func:`.attributes.flag_dirty` call. .. seealso:: :func:`.attributes.flag_dirty` t is_userlandN( RRR.R"R'tmodifiedRRRR*(R6R!RPRdR"((sL/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/attributes.pyt flag_modifiedscCs6t|t|}}|j|dtdtdS(sMark an instance as 'dirty' without any specific attribute mentioned. This is a special operation that will allow the object to travel through the flush process for interception by events such as :meth:`.SessionEvents.before_flush`. Note that no SQL will be emitted in the flush process for an object that has no changes, even if marked dirty via this method. However, a :meth:`.SessionEvents.before_flush` handler will be able to see the object in the :attr:`.Session.dirty` collection and may establish changes on it, which will then be included in the SQL emitted. .. versionadded:: 1.2 .. seealso:: :func:`.attributes.flag_modified` RSN(RRRR[RR*(R6RPRd((sL/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/attributes.pyt flag_dirtys(PRYRtRRRRR/RRRRRRR R R R R RRRRRRRRRRRRRRRRRt_self_inspectst_MappedAttributetInspectionAttrtPropComparatorRR]RrtsymbolRRRRRtobjectRxR~RRRR.R:t frozensetRR;t namedtupleRR[RR5R?RORARERCRBRNRRORRPRQRRRURV(((sL/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/attributes.pyts   x2EUQ $ 2    &