� ��^i� ��.�ddlmZGd�de��ZdS)�)�BytesIOc�8�eZdZdZd�Zd�Zd�Zd�Zd d�Zd�Z dS) �CallbackFileWrapperav Small wrapper around a fp object which will tee everything read into a buffer, and when that file is closed it will execute a callback with the contents of that buffer. All attributes are proxied to the underlying file object. This class uses members with a double underscore (__) leading prefix so as not to accidentally shadow an attribute. c�H�t��|_||_||_dS�N)r�_CallbackFileWrapper__buf�_CallbackFileWrapper__fp�_CallbackFileWrapper__callback)�self�fp�callbacks ��/builddir/build/BUILDROOT/alt-python311-pip-21.3.1-4.el8.x86_64/opt/alt/python311/lib/python3.11/site-packages/pip/_vendor/cachecontrol/filewrapper.py�__init__zCallbackFileWrapper.__init__s���Y�Y�� ��� �"�����c�L�|�d��}t||��S)Nr )�__getattribute__�getattr)r �namer s r� __getattr__zCallbackFileWrapper.__getattr__s(��� "� "�#=� >� >���r�4� � � rc�~� |jjduS#t$rYnwxYw |jjS#t$rYnwxYwdS)NF)r r �AttributeError�closed�r s r�__is_fp_closedz"CallbackFileWrapper.__is_fp_closed!sm�� ��9�<�4�'� '��� � � � �D� ���� ��9�#� #��� � � � �D� ���� �us� � �� -� :�:c�z�|jr,|�|j�����d|_dSr)r r�getvaluers r�_closezCallbackFileWrapper._close2s9�� �?� 3� �O�O�D�J�/�/�1�1� 2� 2� 2�����rNc��|j�|��}|j�|��|���r|���|Sr)r �readr�write�"_CallbackFileWrapper__is_fp_closedr�r �amt�datas rrzCallbackFileWrapper.read=sQ���y�~�~�c�"�"�� � ������� � � � � � � �K�K�M�M�M�� rc���|j�|��}|dkr|dkr|S|j�|��|���r|���|S)N�s )r � _safe_readrr r!rr"s rr'zCallbackFileWrapper._safe_readEsk���y�#�#�C�(�(�� �!�8�8������K� � ������� � � � � � � �K�K�M�M�M�� rr) �__name__� __module__� __qualname__�__doc__rrr!rrr'�rrrrs}������ � �#�#�#� !� !� !����" � � ����� � � � � rrN)�ior�objectrr,rr�r/sU��������L�L�L�L�L�&�L�L�L�L�Lr