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 �/usr/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+