U nÏ aå ã@s ddlmZGdd„deƒZdS)é)ÚBytesIOc@sBeZdZdZdd„Zdd„Zdd„Zdd „Zdd d „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 úeC:\Users\vtejo\AppData\Local\Temp\pip-unpacked-wheel-6mt8ur68\pip\_vendor\cachecontrol\filewrapper.pyÚ__init__szCallbackFileWrapper.__init__cCs| d¡}t||ƒS)Nr)Ú__getattribute__Úgetattr)rÚnamer r r r Ú __getattr__s zCallbackFileWrapper.__getattr__cCsHz|jjdkWStk r"YnXz |jjWStk rBYnXdS)NF)rr ÚAttributeErrorÚclosed©rr r r Ú__is_fp_closed!s z"CallbackFileWrapper.__is_fp_closedcCs |jr| |j ¡¡d|_dSr)rrÚgetvaluerr r r Ú_close2szCallbackFileWrapper._closeNcCs,|j |¡}|j |¡| ¡r(| ¡|Sr)rÚreadrÚwriteÚ"_CallbackFileWrapper__is_fp_closedr©rÚamtÚdatar r r r=s   zCallbackFileWrapper.readcCs@|j |¡}|dkr |dkr |S|j |¡| ¡r<| ¡|S)Nés )rÚ _safe_readrrrrrr r r rEs  zCallbackFileWrapper._safe_read)N) Ú__name__Ú __module__Ú __qualname__Ú__doc__r rrrrrr r r r rs   rN)ÚiorÚobjectrr r r r Ús