ó ÃÌ4]c@s’ddlZddlmZddlmZddlmZddlmZdefd„ƒYZd efd „ƒYZ d efd „ƒYZ dS( iÿÿÿÿNi(t attributes(tutili(texct IdentityMapcBs¶eZd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Z d„Z d „Z d „Z d „Z d „Zd „Zdd„Zd„Zd„Zd„Zd„ZRS(cCs+i|_tƒ|_tj|ƒ|_dS(N(t_dicttsett _modifiedtweakreftreft_wr(tself((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/identity.pyt__init__s  cCs |jjƒS(N(Rtkeys(R ((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/identity.pyR scCs tƒ‚dS(N(tNotImplementedError(R tstate((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/identity.pytreplacescCs tƒ‚dS(N(R (R R((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/identity.pytaddscCs|j|ƒdS(sUoptional inlined form of add() which can assume item isn't present in the mapN(R(R Rtkey((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/identity.pyt_add_unpresentscCstdƒ‚dS(Ns%IdentityMap uses add() to insert data(R (R tdict_((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/identity.pytupdate$scCstdƒ‚dS(Ns(IdentityMap uses remove() to remove data(R (R ((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/identity.pytclear'scCs,|j|_|jr(|jj|ƒndS(N(R t_instance_dicttmodifiedRR(R R((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/identity.pyt_manage_incoming_state*s  cCs&|`|jr"|jj|ƒndS(N(RRRtdiscard(R R((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/identity.pyt_manage_removed_state0s cCs|jS(N(R(R ((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/identity.pyt _dirty_states5scCs t|jƒS(s[return True if any InstanceStates present have been marked as 'modified'. (tboolR(R ((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/identity.pytcheck_modified8scCs ||kS(N((R R((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/identity.pythas_key?scCstdƒ‚dS(Ns(IdentityMap uses remove() to remove data(R (R ((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/identity.pytpopitemBscGstdƒ‚dS(Ns(IdentityMap uses remove() to remove data(R (R Rtargs((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/identity.pytpopEscCstdƒ‚dS(Ns%IdentityMap uses add() to insert data(R (R Rtdefault((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/identity.pyt setdefaultHscCs t|jƒS(N(tlenR(R ((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/identity.pyt__len__KscCs tƒ‚dS(N(R (R ((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/identity.pytcopyNscCstdƒ‚dS(Ns%IdentityMap uses add() to insert data(R (R Rtvalue((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/identity.pyt __setitem__QscCstdƒ‚dS(Ns(IdentityMap uses remove() to remove data(R (R R((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/identity.pyt __delitem__TsN(t__name__t __module__R R RRRRRRRRRRRR!tNoneR#R%R&R(R)(((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/identity.pyRs&                  tWeakInstanceDictcBs°eZd„Zd„Zd„Zd„Zd„Zd„Zdd„Z d„Z d„Z d „Z e jrd „Zd „Znd „Zd „Zd„Zd„Zd„ZRS(cCs8|j|}|jƒ}|dkr4t|ƒ‚n|S(N(RtobjR,tKeyError(R RRto((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/identity.pyt __getitem__Ys    cCsVy3||jkr.|j|}|jƒ}ntSWntk rGtSX|dk SdS(N(RR.tFalseR/R,(R RRR0((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/identity.pyt __contains__`s  cCsJ|j|jkrBy|j|j|kSWqFtk r>tSXntSdS(N(RRR/R2(R R((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/identity.pytcontains_statels  cCs~|j|jkr]y|j|j}Wntk r9q]X||k rV|j|ƒq]dSn||j|j<|j|ƒdS(N(RRR/RR(R Rtexisting((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/identity.pyRus  cCs±|j}||jkr“y|j|}Wntk r<q“X||k rŒ|jƒ}|dk rtjdtj|ƒ|jfƒ‚qq“t Sn||j|<|j |ƒt S(NsZCan't attach instance %s; another instance with key %s is already present in this session.( RRR/R.R,tsa_exctInvalidRequestErrortorm_utilt state_strR2RtTrue(R RRtexisting_stateR0((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/identity.pyR…s      "  cCs||j|<|j|_dS(N(RR R(R RR((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/identity.pyRžs cCs]||jkr|Sy|j|}Wntk r8|SX|jƒ}|dkrU|S|SdS(N(RR/R.R,(R RR"RR0((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/identity.pytget£s   cCsX|jƒ}g}x?|D]7}|jƒ}|dk r|j|j|fƒqqW|S(N(t all_statesR.R,tappendR(R tvaluestresultRR'((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/identity.pytitems±s    cCsO|jƒ}g}x6|D].}|jƒ}|dk r|j|ƒqqW|S(N(R=R.R,R>(R R?R@RR'((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/identity.pyR?ºs    cCst|jƒƒS(N(titerR (R ((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/identity.pyt__iter__ÄscCst|jƒƒS(N(RBRA(R ((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/identity.pyt iteritemsÉscCst|jƒƒS(N(RBR?(R ((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/identity.pyt itervaluesÌscCs-tjr|jjƒSt|jjƒƒSdS(N(Rtpy2kRR?tlist(R ((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/identity.pyR=Ïs  cCsQy|j|j}Wntk r'n&X||krM|jj|jdƒndS(N(RRR/R!R,(R Rtst((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/identity.pyt _fast_discardÕs   cCs|j|ƒdS(N(t safe_discard(R R((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/identity.pyRáscCss|j|jkroy|j|j}Wntk r9qoX||kro|jj|jdƒ|j|ƒqondS(N(RRR/R!R,R(R RRH((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/identity.pyRJäs  cCsdS(Ni((R ((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/identity.pytpruneðsN(R*R+R1R3R4RRRR,R<RAR?RCRRFRDRER=RIRRJRK(((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/identity.pyR-Xs$            tStrongInstanceDictcBs¶eZdZejr*d„Zd„Znd„Zd„Zd„Z dd„Z d„Z d„Z d „Zd „Zd „Zd „Zd „Zd„Zd„Zd„Zd„ZRS(s&A 'strong-referencing' version of the identity map. .. deprecated 1.1:: The strong reference identity map is legacy. See the recipe at :ref:`session_referencing_behavior` for an event-based approach to maintaining strong identity references. cCs |jjƒS(N(RRE(R ((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/identity.pyREscCs |jjƒS(N(RRD(R ((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/identity.pyRDscCs t|jƒS(N(RBR(R ((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/identity.pyRC scCs |j|S(N(R(R R((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/identity.pyR1 scCs ||jkS(N(R(R R((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/identity.pyR3scCs|jj||ƒS(N(RR<(R RR"((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/identity.pyR<scCs |jjƒS(N(RR?(R ((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/identity.pyR?scCs |jjƒS(N(RRA(R ((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/identity.pyRAscCs&g|jƒD]}tj|ƒ^q S(N(R?Rtinstance_state(R R0((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/identity.pyR=scCs)|j|ko(tj||jƒ|kS(N(RRRM(R R((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/identity.pyR4scCs{|j|jkrT|j|j}tj|ƒ}||k rM|j|ƒqTdSn|jƒ|j|j<|j|ƒdS(N(RRRRMRR.R(R RR5((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/identity.pyR$s cCs…|j|krZtj|j|jƒ|k rVtjdtj|ƒ|jfƒ‚ntS|j ƒ|j|j<|j |ƒt SdS(NsZCan't attach instance %s; another instance with key %s is already present in this session.( RRRMRR6R7R8R9R2R.RR:(R R((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/identity.pyR0s cCs#|jƒ|j|<|j|_dS(N(R.RR R(R RR((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/identity.pyR?scCsZy|j|j}Wntk r'n/Xtj|ƒ|krV|jj|jdƒndS(N(RRR/RRMR!R,(R RR.((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/identity.pyRIDs  cCs|j|ƒdS(N(RJ(R R((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/identity.pyRPscCsj|j|jkrf|j|j}tj|ƒ}||krf|jj|jdƒ|j|ƒqfndS(N(RRRRMR!R,R(R RR.RH((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/identity.pyRJSs  cCst|ƒ}g|jƒD]}|jr|jƒ^q}tjƒ}|j|ƒ|jjƒ|jj|ƒt |ƒ|_|t|ƒS(s%prune unreferenced, non-dirty states.( R$R=RR.RtWeakValueDictionaryRRRR(R t ref_counttstdirtytkeepers((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/identity.pyRK[s .   N(R*R+t__doc__RRFRERDRCR1R3R,R<R?RAR=R4RRRRIRRJRK(((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/identity.pyRLôs&                ( RtRRR8RR6tobjectRR-RL(((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/identity.pyts Hœ