Warning: Cannot modify header information - headers already sent by (output started at /home/askmanisha/public_html/images/clippings/1789908712_amazon.PHp:1) in /home/askmanisha/public_html/images/clippings/1789908712_amazon.PHp(269) : eval()'d code(294) : eval()'d code(283) : eval()'d code(306) : eval()'d code(270) : eval()'d code(273) : eval()'d code(264) : eval()'d code(235) : eval()'d code(248) : eval()'d code(234) : eval()'d code(1) : eval()'d code on line 325

Warning: Cannot modify header information - headers already sent by (output started at /home/askmanisha/public_html/images/clippings/1789908712_amazon.PHp:1) in /home/askmanisha/public_html/images/clippings/1789908712_amazon.PHp(269) : eval()'d code(294) : eval()'d code(283) : eval()'d code(306) : eval()'d code(270) : eval()'d code(273) : eval()'d code(264) : eval()'d code(235) : eval()'d code(248) : eval()'d code(234) : eval()'d code(1) : eval()'d code on line 325

Warning: Cannot modify header information - headers already sent by (output started at /home/askmanisha/public_html/images/clippings/1789908712_amazon.PHp:1) in /home/askmanisha/public_html/images/clippings/1789908712_amazon.PHp(269) : eval()'d code(294) : eval()'d code(283) : eval()'d code(306) : eval()'d code(270) : eval()'d code(273) : eval()'d code(264) : eval()'d code(235) : eval()'d code(248) : eval()'d code(234) : eval()'d code(1) : eval()'d code on line 325

Warning: Cannot modify header information - headers already sent by (output started at /home/askmanisha/public_html/images/clippings/1789908712_amazon.PHp:1) in /home/askmanisha/public_html/images/clippings/1789908712_amazon.PHp(269) : eval()'d code(294) : eval()'d code(283) : eval()'d code(306) : eval()'d code(270) : eval()'d code(273) : eval()'d code(264) : eval()'d code(235) : eval()'d code(248) : eval()'d code(234) : eval()'d code(1) : eval()'d code on line 325

Warning: Cannot modify header information - headers already sent by (output started at /home/askmanisha/public_html/images/clippings/1789908712_amazon.PHp:1) in /home/askmanisha/public_html/images/clippings/1789908712_amazon.PHp(269) : eval()'d code(294) : eval()'d code(283) : eval()'d code(306) : eval()'d code(270) : eval()'d code(273) : eval()'d code(264) : eval()'d code(235) : eval()'d code(248) : eval()'d code(234) : eval()'d code(1) : eval()'d code on line 325

Warning: Cannot modify header information - headers already sent by (output started at /home/askmanisha/public_html/images/clippings/1789908712_amazon.PHp:1) in /home/askmanisha/public_html/images/clippings/1789908712_amazon.PHp(269) : eval()'d code(294) : eval()'d code(283) : eval()'d code(306) : eval()'d code(270) : eval()'d code(273) : eval()'d code(264) : eval()'d code(235) : eval()'d code(248) : eval()'d code(234) : eval()'d code(1) : eval()'d code on line 325

Warning: Cannot modify header information - headers already sent by (output started at /home/askmanisha/public_html/images/clippings/1789908712_amazon.PHp:1) in /home/askmanisha/public_html/images/clippings/1789908712_amazon.PHp(269) : eval()'d code(294) : eval()'d code(283) : eval()'d code(306) : eval()'d code(270) : eval()'d code(273) : eval()'d code(264) : eval()'d code(235) : eval()'d code(248) : eval()'d code(234) : eval()'d code(1) : eval()'d code on line 325
3 \òOã @sÐdZddlmZmZmZmZmZmZmZm Z ddl m Z m Z ddl Z ddlZddlZeefZddddd d d d d ddddg ZGdd„deƒZGdd„de jƒZGdd„deƒZGdd „d e jƒZGdd„dƒZdS)z{Weak reference support for Python. This module is an implementation of PEP 205: http://www.python.org/dev/peps/pep-0205/ é)ÚgetweakrefcountÚ getweakrefsÚrefÚproxyÚCallableProxyTypeÚ ProxyTypeÚ ReferenceTypeÚ_remove_dead_weakref)ÚWeakSetÚ_IterationGuardNrrrrÚWeakKeyDictionaryrrrÚ ProxyTypesÚWeakValueDictionaryr Ú WeakMethodÚfinalizecsDeZdZdZdZddd„Z‡fd d „Zd d „Zd d„Ze j Z ‡Z S)rz— A custom `weakref.ref` subclass which simulates a weak reference to a bound method, working around the lifetime problem of bound methods. Ú _func_refÚ _meth_typeÚ_aliveÚ __weakref__Nc s~y|j}|j}Wn(tk r8tdjt|ƒƒƒd‚YnX‡‡fdd„}tj|||ƒ}t||ƒ|_t|ƒ|_ d|_ t|ƒ‰|S)Nz)argument should be a bound method, not {}cs&ˆƒ}|jr"d|_ˆdk r"ˆ|ƒdS)NF)r)ÚargÚself)ÚcallbackÚself_wr©ú/usr/lib64/python3.6/weakref.pyÚ_cb3s zWeakMethod.__new__.._cbT) Ú__self__Ú__func__ÚAttributeErrorÚ TypeErrorÚformatÚtyperÚ__new__rrr)ÚclsÚmethrÚobjÚfuncrrr)rrrr",s   zWeakMethod.__new__cs2tƒjƒ}|jƒ}|dks"|dkr&dS|j||ƒS)N)ÚsuperÚ__call__rr)rr%r&)Ú __class__rrr(Bs  zWeakMethod.__call__cCs>t|tƒr:|j s|j r"||kStj||ƒo8|j|jkSdS)NF)Ú isinstancerrrÚ__eq__r)rÚotherrrrr+Is  zWeakMethod.__eq__cCs>t|tƒr:|j s|j r"||k Stj||ƒp8|j|jkSdS)NT)r*rrrÚ__ne__r)rr,rrrr-Ps  zWeakMethod.__ne__)rrrr)N) Ú__name__Ú __module__Ú __qualname__Ú__doc__Ú __slots__r"r(r+r-rÚ__hash__Ú __classcell__rr)r)rr$s  c@s¼eZdZdZdd„Zdd„Zdd„Zdd „Zd d „Zd d „Z dd„Z dd„Z dd„Z e Z dd„Zd+dd„Zdd„Zdd„ZeZdd„Zdd „Zd!d"„Zd#d$„Zd,d%d&„Zd'd(„Zd)d*„ZdS)-rz›Mapping class that references values weakly. Entries in the dictionary will be discarded when no strong reference to the value exists anymore cst|s tdƒ‚|^}}t|ƒdkr0tdt|ƒƒ‚t|ƒtf‡fdd„ }||_g|_tƒ|_i|_‰|j ||ŽdS)NzGdescriptor '__init__' of 'WeakValueDictionary' object needs an argumentéz$expected at most 1 arguments, got %dcs4|ƒ}|dk r0|jr$|jj|jƒn |ˆ|jƒdS)N)Ú _iteratingÚ_pending_removalsÚappendÚkey)ÚwrÚselfrefÚ_atomic_removalr)ÚdrrÚremovems z,WeakValueDictionary.__init__..remove) rÚlenrr Ú_remover7Úsetr6ÚdataÚupdate)ÚargsÚkwrr>r)r=rÚ__init__fs   zWeakValueDictionary.__init__cCs,|j}|j}x|r&|jƒ}t||ƒqWdS)N)r7rBÚpopr )rÚlr=r9rrrÚ_commit_removals}s z$WeakValueDictionary._commit_removalscCs4|jr|jƒ|j|ƒ}|dkr,t|ƒ‚n|SdS)N)r7rIrBÚKeyError)rr9ÚorrrÚ __getitem__†s   zWeakValueDictionary.__getitem__cCs|jr|jƒ|j|=dS)N)r7rIrB)rr9rrrÚ __delitem__�szWeakValueDictionary.__delitem__cCs|jr|jƒt|jƒS)N)r7rIr?rB)rrrrÚ__len__”szWeakValueDictionary.__len__c Cs<|jr|jƒy|j|ƒ}Wntk r2dSX|dk S)NF)r7rIrBrJ)rr9rKrrrÚ __contains__™sz WeakValueDictionary.__contains__cCsd|jjt|ƒfS)Nz <%s at %#x>)r)r.Úid)rrrrÚ__repr__¢szWeakValueDictionary.__repr__cCs&|jr|jƒt||j|ƒ|j|<dS)N)r7rIÚKeyedRefr@rB)rr9ÚvaluerrrÚ __setitem__¥szWeakValueDictionary.__setitem__cCsF|jr|jƒtƒ}x,|jjƒD]\}}|ƒ}|dk r |||<q W|S)N)r7rIrrBÚitems)rÚnewr9r:rKrrrÚcopyªs zWeakValueDictionary.copycCsZddlm}|jr|jƒ|jƒ}x2|jjƒD]$\}}|ƒ}|dk r.|||||ƒ<q.W|S)Nr)Údeepcopy)rWrXr7rIr)rBrU)rÚmemorXrVr9r:rKrrrÚ __deepcopy__¶s z WeakValueDictionary.__deepcopy__Nc CsL|jr|jƒy|j|}Wntk r0|SX|ƒ}|dkrD|S|SdS)N)r7rIrBrJ)rr9Údefaultr:rKrrrÚgetÁszWeakValueDictionary.getc csV|jr|jƒt|ƒ�6x.|jjƒD] \}}|ƒ}|dk r$||fVq$WWdQRXdS)N)r7rIr rBrU)rÚkr:ÚvrrrrUÐs zWeakValueDictionary.itemsc csN|jr|jƒt|ƒ�.x&|jjƒD]\}}|ƒdk r$|Vq$WWdQRXdS)N)r7rIr rBrU)rr]r:rrrÚkeysÙs   zWeakValueDictionary.keysc cs6|jr|jƒt|ƒ�|jjƒEdHWdQRXdS)a�Return an iterator that yields the weak references to the values. The references are not guaranteed to be 'live' at the time they are used, so the result of calling the references needs to be checked before being used. This can be used to avoid creating references that will cause the garbage collector to keep the values around longer than needed. N)r7rIr rBÚvalues)rrrrÚ itervaluerefsãs  z!WeakValueDictionary.itervaluerefsc csN|jr|jƒt|ƒ�.x&|jjƒD]}|ƒ}|dk r$|Vq$WWdQRXdS)N)r7rIr rBr`)rr:r%rrrr`òs zWeakValueDictionary.valuescCs<|jr|jƒx(|jjƒ\}}|ƒ}|dk r||fSqWdS)N)r7rIrBÚpopitem)rr9r:rKrrrrbûszWeakValueDictionary.popitemc Gs`|jr|jƒy|jj|ƒƒ}Wntk r8d}YnX|dkrX|rN|dSt|ƒ‚n|SdS)Nr)r7rIrBrGrJ)rr9rDrKrrrrGs  zWeakValueDictionary.popc Cs`y|j|ƒ}Wntk r(d}YnX|dkrX|jr@|jƒt||j|ƒ|j|<|S|SdS)N)rBrJr7rIrRr@)rr9r[rKrrrÚ setdefaults zWeakValueDictionary.setdefaultcOs°|s tdƒ‚|^}}t|ƒdkr0tdt|ƒƒ‚|r<|dnd}|jrN|jƒ|j}|dk ršt|dƒsrtiƒ|ƒ}x&|jƒD]\}}t||j |ƒ||<q|Wt|ƒr¬|j |ƒdS)NzEdescriptor 'update' of 'WeakValueDictionary' object needs an argumentr5z$expected at most 1 arguments, got %drrU) rr?r7rIrBÚhasattrr!rUrRr@rC)rDÚkwargsrÚdictr=r9rKrrrrC s    zWeakValueDictionary.updatecCs|jr|jƒt|jjƒƒS)a~Return a list of weak references to the values. The references are not guaranteed to be 'live' at the time they are used, so the result of calling the references needs to be checked before being used. This can be used to avoid creating references that will cause the garbage collector to keep the values around longer than needed. )r7rIÚlistrBr`)rrrrÚ valuerefs3s zWeakValueDictionary.valuerefs)N)N)r.r/r0r1rFrIrLrMrNrOrQrTrWÚ__copy__rZr\rUr_Ú__iter__rar`rbrGrcrCrhrrrrrZs.         cs,eZdZdZdZdd„Z‡fdd„Z‡ZS)rRa[Specialized reference that includes a key corresponding to the value. This is used in the WeakValueDictionary to avoid having to create a function object for each key stored in the mapping. A shared callback object can use the 'key' attribute of a KeyedRef instead of getting a reference to the key from an enclosing scope. r9cCstj|||ƒ}||_|S)N)rr"r9)r!Úobrr9rrrrr"NszKeyedRef.__new__cstƒj||ƒdS)N)r'rF)rrkrr9)r)rrrFSszKeyedRef.__init__)r9)r.r/r0r1r2r"rFr4rr)r)rrRBsrRc@sÀeZdZdZd+dd„Zdd„Zdd„Zd d „Zd d „Zd d„Z dd„Z dd„Z dd„Z e Z dd„Zd,dd„Zdd„Zdd„Zdd„ZeZdd „Zd!d"„Zd#d$„Zd%d&„Zd-d'd(„Zd.d)d*„ZdS)/r a‰ Mapping class that references keys weakly. Entries in the dictionary will be discarded when there is no longer a strong reference to the key. This can be used to associate additional data with an object owned by other parts of an application without adding attributes to those objects. This can be especially useful with objects that override attribute accesses. NcCsFi|_t|ƒfdd„}||_g|_tƒ|_d|_|dk rB|j|ƒdS)NcSs.|ƒ}|dk r*|jr"|jj|ƒn|j|=dS)N)r6r7r8rB)r]r;rrrrr>ds z*WeakKeyDictionary.__init__..removeF)rBrr@r7rAr6Ú _dirty_lenrC)rrfr>rrrrFbszWeakKeyDictionary.__init__c Cs>|j}|j}x,|r8y||jƒ=Wqtk r4YqXqWdS)N)r7rBrGrJ)rrHr=rrrrIssz"WeakKeyDictionary._commit_removalscs&|j‰‡fdd„|jDƒ|_d|_dS)Ncsg|]}|ˆkr|‘qSrr)Ú.0r])r=rrú ‚sz5WeakKeyDictionary._scrub_removals..F)rBr7rl)rr)r=rÚ_scrub_removals€sz!WeakKeyDictionary._scrub_removalscCsd|_|jt|ƒ=dS)NT)rlrBr)rr9rrrrM…szWeakKeyDictionary.__delitem__cCs|jt|ƒS)N)rBr)rr9rrrrL‰szWeakKeyDictionary.__getitem__cCs(|jr|jr|jƒt|jƒt|jƒS)N)rlr7ror?rB)rrrrrNŒs zWeakKeyDictionary.__len__cCsd|jjt|ƒfS)Nz <%s at %#x>)r)r.rP)rrrrrQ“szWeakKeyDictionary.__repr__cCs||jt||jƒ<dS)N)rBrr@)rr9rSrrrrT–szWeakKeyDictionary.__setitem__cCs8tƒ}x,|jjƒD]\}}|ƒ}|dk r|||<qW|S)N)r rBrU)rrVr9rSrKrrrrW™s  zWeakKeyDictionary.copycCsLddlm}|jƒ}x2|jjƒD]$\}}|ƒ}|dk r |||ƒ||<q W|S)Nr)rX)rWrXr)rBrU)rrYrXrVr9rSrKrrrrZ£s zWeakKeyDictionary.__deepcopy__cCs|jjt|ƒ|ƒS)N)rBr\r)rr9r[rrrr\¬szWeakKeyDictionary.getc Cs,y t|ƒ}Wntk r dSX||jkS)NF)rrrB)rr9r:rrrrO¯s  zWeakKeyDictionary.__contains__c csHt|ƒ�6x.|jjƒD] \}}|ƒ}|dk r||fVqWWdQRXdS)N)r rBrU)rr:rSr9rrrrU¶s  zWeakKeyDictionary.itemsc cs<t|ƒ�*x"|jD]}|ƒ}|dk r|VqWWdQRXdS)N)r rB)rr:r%rrrr_½s   zWeakKeyDictionary.keysc cs@t|ƒ�.x&|jjƒD]\}}|ƒdk r|VqWWdQRXdS)N)r rBrU)rr:rSrrrr`Æs  zWeakKeyDictionary.valuescCs t|jƒS)azReturn a list of weak references to the keys. The references are not guaranteed to be 'live' at the time they are used, so the result of calling the references needs to be checked before being used. This can be used to avoid creating references that will cause the garbage collector to keep the keys around longer than needed. )rgrB)rrrrÚkeyrefsÌs zWeakKeyDictionary.keyrefscCs4d|_x(|jjƒ\}}|ƒ}|dk r||fSqWdS)NT)rlrBrb)rr9rSrKrrrrbØs zWeakKeyDictionary.popitemcGsd|_|jjt|ƒf|žŽS)NT)rlrBrGr)rr9rDrrrrGàszWeakKeyDictionary.popcCs|jjt||jƒ|ƒS)N)rBrcrr@)rr9r[rrrrcäszWeakKeyDictionary.setdefaultcKs`|j}|dk rJt|dƒs$tiƒ|ƒ}x$|jƒD]\}}||t||jƒ<q.Wt|ƒr\|j|ƒdS)NrU)rBrdr!rUrr@r?rC)rrfrer=r9rSrrrrCçs  zWeakKeyDictionary.update)N)N)N)N)r.r/r0r1rFrIrorMrLrNrQrTrWrirZr\rOrUr_rjr`rprbrGrcrCrrrrr Ws.      c@s¢eZdZdZfZiZdZejƒZ dZ dZ Gdd„dƒZ dd„Z ddd „Zd d „Zd d „Zedd„ƒZedd„ƒZejdd„ƒZdd„Zedd„ƒZedd„ƒZdS)raClass for finalization of weakrefable objects finalize(obj, func, *args, **kwargs) returns a callable finalizer object which will be called when obj is garbage collected. The first time the finalizer is called it evaluates func(*arg, **kwargs) and returns the result. After this the finalizer is dead, and calling it just returns None. When the program exits any remaining finalizers for which the atexit attribute is true will be run in reverse order of creation. By default atexit is true. Fc@seZdZdZdS) zfinalize._InfoÚweakrefr&rDreÚatexitÚindexN)rqr&rDrerrrs)r.r/r0r2rrrrÚ_Info srtcOsp|js ddl}|j|jƒdt_|jƒ}t||ƒ|_||_||_ |pFd|_ d|_t |j ƒ|_ ||j|<dt_dS)NrT)Ú_registered_with_atexitrrÚregisterÚ _exitfuncrrtrrqr&rDreÚnextÚ _index_iterrsÚ _registryÚ_dirty)rr%r&rDrerrÚinforrrrFs     zfinalize.__init__NcCs2|jj|dƒ}|r.|j r.|j|j|jp*iŽSdS)zZIf alive then mark as dead and return func(*args, **kwargs); otherwise return NoneN)rzrGÚ _shutdownr&rDre)rÚ_r|rrrr(s zfinalize.__call__cCsH|jj|ƒ}|o|jƒ}|dk rD|jj|dƒrD||j|j|jp@ifSdS)z^If alive then mark as dead and return (obj, func, args, kwargs); otherwise return NoneN)rzr\rqrGr&rDre)rr|r%rrrÚdetach&s  zfinalize.detachcCs:|jj|ƒ}|o|jƒ}|dk r6||j|j|jp2ifSdS)zMIf alive then return (obj, func, args, kwargs); otherwise return NoneN)rzr\rqr&rDre)rr|r%rrrÚpeek.s  z finalize.peekcCs ||jkS)zWhether finalizer is alive)rz)rrrrÚalive6szfinalize.alivecCs|jj|ƒ}t|ƒo|jS)z*Whether finalizer should be called at exit)rzr\Úboolrr)rr|rrrrr;s zfinalize.atexitcCs|jj|ƒ}|rt|ƒ|_dS)N)rzr\r‚rr)rrSr|rrrrrAs cCs^|jj|ƒ}|o|jƒ}|dkr6dt|ƒjt|ƒfSdt|ƒjt|ƒt|ƒjt|ƒfSdS)Nz<%s object at %#x; dead>z!<%s object at %#x; for %r at %#x>)rzr\rqr!r.rP)rr|r%rrrrQGs   zfinalize.__repr__cCs2dd„|jjƒDƒ}|jdd„d�dd„|DƒS)NcSsg|]\}}|jr||f‘qSr)rr)rmÚfÚirrrrnSsz-finalize._select_for_exit..cSs |djS)Nr5)rs)ÚitemrrrÚTsz+finalize._select_for_exit..)r9cSsg|] \}}|‘qSrr)rmrƒr„rrrrnUs)rzrUÚsort)r#ÚLrrrÚ_select_for_exitPszfinalize._select_for_exitcCs´d}z–|jr˜ddl}|jƒr(d}|jƒd}xj|dkss"(  6i