3
ƒ”Reå ã @ s d dl mZ G dd„ deƒZdS )é )ÚBytesIOc @ sB e Zd ZdZdd„ Zdd„ Zdd„ Zdd „ Zddd„Zd
d„ Z d
S )Ú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 C s t ƒ | _|| _|| _d S )N)r Ú_CallbackFileWrapper__bufÚ_CallbackFileWrapper__fpÚ_CallbackFileWrapper__callback)ÚselfÚfpÚcallback© r
ú“/builddir/build/BUILDROOT/alt-python36-pip-20.2.4-5.el9.x86_64/opt/alt/python36/lib/python3.6/site-packages/pip/_vendor/cachecontrol/filewrapper.pyÚ__init__ s zCallbackFileWrapper.__init__c C s | j dƒ}t||ƒS )Nr )Ú__getattribute__Úgetattr)r Únamer r
r
r Ú__getattr__ s
zCallbackFileWrapper.__getattr__c C sD y| j jd kS tk
r Y nX y| j jS tk
r> Y nX dS )NF)r r ÚAttributeErrorÚclosed)r r
r
r Ú__is_fp_closed! s z"CallbackFileWrapper.__is_fp_closedc C s | j r| j | jjƒ ƒ d | _ d S )N)r r Úgetvalue)r r
r
r Ú_close2 s zCallbackFileWrapper._closeNc C s, | j j|ƒ}| jj|ƒ | jƒ r(| jƒ |S )N)r Úreadr ÚwriteÚ"_CallbackFileWrapper__is_fp_closedr )r ÚamtÚdatar
r
r r = s
zCallbackFileWrapper.readc C s@ | j j|ƒ}|dkr |dkr |S | jj|ƒ | jƒ r<| jƒ |S )Né s
)r Ú
_safe_readr r r r )r r r r
r
r r E s zCallbackFileWrapper._safe_read)N)
Ú__name__Ú
__module__Ú__qualname__Ú__doc__r r r r r r r
r
r
r r s
r N)Úior Úobjectr r
r
r
r Ú