a ÕDOgO!ã@s‚ddlmZmZddlmZddlZgd¢ZGdd„dejj ƒZ Gdd„dejj ƒZ Gd d „d e ƒZ Gd d „d e ƒ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 ú+/opt/alt/python39/lib64/python3.9/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.||_|durd}||_||_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¡|jvSr%©Úencoder!r©r Úkeyr r rÚ __contains__eszShelf.__contains__cCs| |j¡|jvr||S|Sr%r))r r,Údefaultr r rÚgethsz Shelf.getcCsXz|j|}WnDtyRt|j| |j¡ƒ}t|ƒ ¡}|jrN||j|<Yn0|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__cCs4|j| |j¡=z |j|=Wnty.Yn0dSr%)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 Cs„|jdurdSzN| ¡z|j ¡Wnty8Yn0Wz tƒ|_Wq€d|_Yq€0n"z tƒ|_Wnd|_Yn00dSr%)rÚsyncr9ÚAttributeErrorr rr 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ÿ   rc@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 ÿ rc@seZdZddd„ZdS)rÚcNFcCs$ddl}t || ||¡||¡dS)Nr)Údbmrr$r)r ÚfilenameÚflagr#rrIr r rr$ászDbfilenameShelf.__init__)rHNF)rrrr$r r r rrÚsrrHFcCst||||ƒSr%)r)rJrKr#rr r rræs r)rHNF)ÚpicklerrÚiorÚcollections.abcÚ collectionsÚ__all__ÚabcÚMutableMappingr rrrrr r r rÚ;s  b+