Viewing File: /usr/lib/python3.6/site-packages/pip/_vendor/cachecontrol/__pycache__/filewrapper.cpython-36.pyc

3

£éajã	ã@s ddlmZGdd„deƒZdS)é)ÚBytesIOc@sBeZdZdZdd„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.
    cCstƒ|_||_||_dS)N)rÚ_CallbackFileWrapper__bufÚ_CallbackFileWrapper__fpÚ_CallbackFileWrapper__callback)ÚselfÚfpÚcallback©r
ú!/usr/lib/python3.6/filewrapper.pyÚ__init__szCallbackFileWrapper.__init__cCs|jdƒ}t||ƒS)Nr)Ú__getattribute__Úgetattr)rÚnamerr
r
rÚ__getattr__s	
zCallbackFileWrapper.__getattr__cCsDy|jjdkStk
r YnXy|jjStk
r>YnXdS)NF)rrÚAttributeErrorÚclosed)rr
r
rZ__is_fp_closed!sz"CallbackFileWrapper.__is_fp_closedcCs |jr|j|jjƒƒd|_dS)N)rrÚgetvalue)rr
r
rÚ_close0szCallbackFileWrapper._closeNcCs,|jj|ƒ}|jj|ƒ|jƒr(|jƒ|S)N)rÚreadrÚwriteÚ"_CallbackFileWrapper__is_fp_closedr)rÚamtÚdatar
r
rr;s
zCallbackFileWrapper.readcCs@|jj|ƒ}|dkr |dkr |S|jj|ƒ|jƒr<|jƒ|S)Nés
)rÚ
_safe_readrrrr)rrrr
r
rrCszCallbackFileWrapper._safe_read)N)
Ú__name__Ú
__module__Ú__qualname__Ú__doc__rrrrrrr
r
r
rrs

rN)ÚiorÚobjectrr
r
r
rÚ<module>s
Back to Directory File Manager