Repository URL to install this package:
|
Version:
0.1.31 ▾
|
odigos-demo-inventory
/
opt
/
odigos-demo-inventory
/
site-packages
/
cachecontrol
/
__pycache__
/
filewrapper.cpython-311.pyc
|
|---|
§
iµµhÄ ã ód d dl mZ d dlZd dlmZ d dlmZmZmZ erd dl m
Z
G d d¦ « ZdS )é )ÚannotationsN)ÚNamedTemporaryFile)Ú
TYPE_CHECKINGÚAnyÚCallable)ÚHTTPResponsec óD e Zd ZdZddZddZddZddZdddZddZ dS )ÚCallbackFileWrappera
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.
The data is stored in a temporary file until it is all available. As long
as the temporary files directory is disk-based (sometimes it's a
memory-backed-``tmpfs`` on Linux), data will be unloaded to disk if memory
pressure is high. For small files the disk usually won't be used at all,
it'll all be in the filesystem memory cache, so there should be no
performance impact.
Úfpr ÚcallbackúCallable[[bytes], None] | NoneÚreturnÚNonec óN t dd¬¦ « | _ || _ || _ d S )Nzrb+T)Údelete)r Ú_CallbackFileWrapper__bufÚ_CallbackFileWrapper__fpÚ_CallbackFileWrapper__callback)Úselfr r s úC/usr/local/lib/python3.11/site-packages/cachecontrol/filewrapper.pyÚ__init__zCallbackFileWrapper.__init__! s* õ (¨°dÐ;Ñ;Ô;
Ø Ø"ó ÚnameÚstrr c óL | d¦ « }t ||¦ « S )Nr )Ú__getattribute__Úgetattr)r r r s r Ú__getattr__zCallbackFileWrapper.__getattr__( s( ð ×
"Ò
"Ð#=Ñ
>Ô
>Ýr4Ñ Ô Ð r Úboolc ó | j j d u S # t $ r Y nw xY w | j j }|S # t $ r Y nw xY wdS )NF)r r ÚAttributeErrorÚclosed)r r" s r Ú__is_fp_closedz"CallbackFileWrapper.__is_fp_closed4 sq ð Ø9< 4Ð'Ð'øåð ð ð ØDð øøøð Ø9Ô+FØMøåð ð ð ØDð øøøð
us
¡
/ ¯
<»<c ó~ | j r| j ¦ « dk rd}n`| j dd¦ « t t j | j ¦ « dt
j ¬¦ « ¦ « }| |¦ « d | _ | j ¦ « d S )Nr r )Úaccess) r r ÚtellÚseekÚ
memoryviewÚmmapÚfilenoÚACCESS_READÚclose)r Úresults r Ú_closezCallbackFileWrapper._closeF s¯ Ø?ð
$ØzÑ Ô AÒ%Ð%àð
1Ñ%Ô%Ð%Ý#ÝIdj×/Ò/Ñ1Ô1°1½TÔ=MÐNÑNÔNñô ð
OOFÑ#Ô#Ð#ð ð
×ÒÑÔÐÐÐr NÚamtú
int | NoneÚbytesc óÂ | j |¦ « }|r| j |¦ « | ¦ « r| ¦ « |S ©N)r Úreadr ÚwriteÚ"_CallbackFileWrapper__is_fp_closedr. ©r r/ Údatas r r4 zCallbackFileWrapper.reada s[ Øinn SÑ)Ô)Øð #ð
J×ÒTÑ"Ô"Ð"Ø×ÒÑ Ô ð ØKKMMMàr Úintc óÚ | j |¦ « }|dk r|dk r|S | j |¦ « | ¦ « r| ¦ « |S )Né s
)r Ú
_safe_readr r5 r6 r. r7 s r r<