U e5dO!ã@s†ddlmZmZddlmZddlZddddgZGdd „d ejj ƒZ Gd d„dejj ƒZ Gd d„de ƒZ Gd d„de ƒZ ddd„ZdS)é)ÚPicklerÚ Unpickler)ÚBytesIONÚShelfÚ BsdDbShelfÚDbfilenameShelfÚopenc@s4eZdZdd„ZeZZZZZZ dd„Z dS)Ú _ClosedDictcGs tdƒ‚dS)Nz!invalid operation on closed shelf)Ú ValueError)ÚselfÚargs©r ú/usr/lib64/python3.8/shelve.pyÚclosedEsz_ClosedDict.closedcCsdS)Nzr ©r r r rÚ__repr__Isz_ClosedDict.__repr__N) Ú__name__Ú __module__Ú __qualname__rÚ__iter__Ú__len__Ú __getitem__Ú __setitem__Ú __delitem__Úkeysrr r r rr Bsr c@sxeZdZddd„Zdd„Zdd „Zd d „Zdd d „Zdd„Zdd„Z dd„Z dd„Z dd„Z dd„Z dd„Zdd„ZdS) rNFúutf-8cCs.||_|dkrd}||_||_i|_||_dS)Né)ÚdictÚ _protocolÚ writebackÚcacheÚ keyencoding©r rÚprotocolrr!r r rÚ__init__TszShelf.__init__ccs"|j ¡D]}| |j¡Vq dS©N)rrÚdecoder!)r Úkr r rr^szShelf.__iter__cCs t|jƒSr%)Úlenrrr r rrbsz Shelf.__len__cCs| |j¡|jkSr%©Úencoder!r©r Úkeyr r rÚ __contains__eszShelf.__contains__cCs| |j¡|jkr||S|Sr%r))r r,Údefaultr r rÚgethsz Shelf.getcCsZz|j|}WnFtk rTt|j| |j¡ƒ}t|ƒ ¡}|jrP||j|<YnX|Sr%) r ÚKeyErrorrrr*r!rÚloadr©r r,ÚvalueÚfr r rrms zShelf.__getitem__cCsF|jr||j|<tƒ}t||jƒ}| |¡| ¡|j| |j ¡<dSr%) rr rrrÚdumpÚgetvaluerr*r!)r r,r3r4Úpr r rrws    zShelf.__setitem__cCs6|j| |j¡=z |j|=Wntk r0YnXdSr%)rr*r!r r0r+r r rrs  zShelf.__delitem__cCs|Sr%r rr r rÚ __enter__†szShelf.__enter__cCs | ¡dSr%)Úclose)r Útyper3Ú tracebackr r rÚ__exit__‰szShelf.__exit__c Csf|jdkrdSz0| ¡z|j ¡Wntk r:YnXW5z tƒ|_Wnd|_YnXXdSr%)rr Úsyncr9ÚAttributeErrorrr r rr9Œs   z Shelf.closecCst|dƒsdS| ¡dS)Nr)Úhasattrr9rr r rÚ__del__s z Shelf.__del__cCsT|jr:|jr:d|_|j ¡D]\}}|||<qd|_i|_t|jdƒrP|j ¡dS)NFTr=)rr Úitemsr?rr=)r r,Úentryr r rr=¤s   z Shelf.sync)NFr)N)rrrr$rrr-r/rrrr8r<r9r@r=r r r rrMsÿ   c@s>eZdZddd„Zdd„Zdd „Zd d „Zd d „Zdd„ZdS)rNFrcCst |||||¡dSr%)rr$r"r r rr$¼szBsdDbShelf.__init__cCs0|j |¡\}}t|ƒ}| |j¡t|ƒ ¡fSr%)rÚ set_locationrr&r!rr1r2r r rrCÀszBsdDbShelf.set_locationcCs.t|jƒ\}}t|ƒ}| |j¡t|ƒ ¡fSr%)Únextrrr&r!rr1r2r r rrDÅszBsdDbShelf.nextcCs.|j ¡\}}t|ƒ}| |j¡t|ƒ ¡fSr%)rÚpreviousrr&r!rr1r2r r rrEÊszBsdDbShelf.previouscCs.|j ¡\}}t|ƒ}| |j¡t|ƒ ¡fSr%)rÚfirstrr&r!rr1r2r r rrFÏszBsdDbShelf.firstcCs.|j ¡\}}t|ƒ}| |j¡t|ƒ ¡fSr%)rÚlastrr&r!rr1r2r r rrGÔszBsdDbShelf.last)NFr) rrrr$rCrDrErFrGr r r rr¯s ÿ c@seZdZddd„ZdS)rÚcNFcCs$ddl}t || ||¡||¡dS)Nr)Údbmrr$r)r ÚfilenameÚflagr#rrIr r rr$ászDbfilenameShelf.__init__)rHNF)rrrr$r r r rrÚsrHFcCst||||ƒSr%)r)rJrKr#rr r rræs )rHNF)ÚpicklerrÚiorZcollections.abcÚ collectionsÚ__all__ÚabcÚMutableMappingr rrrrr r r rÚ;s   b+