Файловый менеджер - Редактировать - /opt/imh-python/lib/python3.9/site-packages/libcloud/utils/__pycache__/files.cpython-39.pyc
Ðазад
a r�h) � @ sR d dl Z d dlZd dlmZ d dlmZ dZg d�Zd dd�Zd d � Zdd� Z dS )� N)�next)�bi� )�read_in_chunks�exhaust_iterator�guess_file_mime_typeFc c s� |pt }z| j}|f}W n ty4 t}| f}Y n0 td�}d}|rRt|�dkr�|s�z*t||� �}t|�dkrz||7 }nd}W n ty� d}Y n0 t|�dkr�|r�|r�td�V dS |r�|s�t|�|kr�|d|� V ||d� }qB|V td�}qBdS )a: Return a generator which yields data in chunks. :param iterator: An object which implements an iterator interface or a File like object with read method. :type iterator: :class:`object` which implements iterator interface. :param chunk_size: Optional chunk size (defaults to CHUNK_SIZE) :type chunk_size: ``int`` :param fill_size: If True, make sure chunks are exactly chunk_size in length (except for last chunk). :type fill_size: ``bool`` :param yield_empty: If true and iterator returned no data, only yield empty bytes object :type yield_empty: ``bool`` TODO: At some point in the future we could use byte arrays here if version >= Python 3. This should speed things up a bit and reduce memory usage. � Fr TN)� CHUNK_SIZE�read�AttributeErrorr r �len� StopIteration) �iterator� chunk_sizeZ fill_sizeZyield_empty�get_data�args�data�empty�chunk� r ��/root/rpmbuild/BUILDROOT/imh-python39-modules-3.9.7-92.el8.x86_64/opt/imh-python/lib/python3.9/site-packages/libcloud/utils/files.pyr s8 r c C sz t d�}zt t| ��}W n ty2 t d�}Y n0 t|�dkrv||7 }zt t| ��}W q4 tyr t d�}Y q40 q4|S )aM Exhaust an iterator and return all data returned by it. :type iterator: :class:`object` which implements iterator interface. :param iterator: An object which implements an iterator interface or a File like object with read method. :rtype ``str`` :return Data returned by the iterator. r r )r r r r )r r r r r r r \ s r c C s"