File: //opt/alt/python311/lib/python3.11/site-packages/s3transfer/__pycache__/upload.cpython-311.pyc
�
/�;f)w � �\ � d dl Z d dlmZ d dlmZmZ d dlmZ d dlm Z m
Z
mZmZ d dl
mZmZmZmZ G d� d� � Z G d � d
� � Z G d� d� � Z G d
� de� � Z G d� de� � Z G d� de� � Z G d� de� � Z G d� de� � Z G d� de� � ZdS )� N)�BytesIO��readable�seekable)�IN_MEMORY_UPLOAD_TAG)�CompleteMultipartUploadTask�CreateMultipartUploadTask�SubmissionTask�Task)�ChunksizeAdjuster�DeferredOpenFile�
get_callbacks�get_filtered_dictc �( � e Zd Zdd�Zd� Zd� Zd� ZdS )�AggregatedProgressCallback� c �0 � || _ || _ d| _ dS )a� Aggregates progress updates for every provided progress callback
:type callbacks: A list of functions that accepts bytes_transferred
as a single argument
:param callbacks: The callbacks to invoke when threshold is reached
:type threshold: int
:param threshold: The progress threshold in which to take the
aggregated progress and invoke the progress callback with that
aggregated progress total
r N)�
_callbacks�
_threshold�_bytes_seen)�self� callbacks� thresholds �D/opt/alt/python311/lib/python3.11/site-packages/s3transfer/upload.py�__init__z#AggregatedProgressCallback.__init__! s � � $���#�������� c �r � | xj |z
c_ | j | j k r| � � � d S d S �N)r r �_trigger_callbacks)r �bytes_transferreds r �__call__z#AggregatedProgressCallback.__call__1 sG � ����-�-�����t��.�.��#�#�%�%�%�%�%� /�.r c �H � | j dk r| � � � dS dS )z@Flushes out any progress that has not been sent to its callbacksr N)r r �r s r �flushz AggregatedProgressCallback.flush6 s0 � ���a����#�#�%�%�%�%�%� �r c �J � | j D ]} || j �� � �d| _ d S )N)r r )r r )r �callbacks r r z-AggregatedProgressCallback._trigger_callbacks; s: � ��� 9� 9�H��H�t�'7�8�8�8�8�8�����r N)r )�__name__�
__module__�__qualname__r r! r$ r � r r r r sU � � � � � �� � � � &� &� &�
&� &� &�
� � � � r r c �@ � e Zd ZdZd� Zdd�Zdd�Zd� Zd� Zd � Z d
� Z
dS )
�InterruptReadera� Wrapper that can interrupt reading using an error
It uses a transfer coordinator to propagate an error if it notices
that a read is being made while the file is being read from.
:type fileobj: file-like obj
:param fileobj: The file-like object to read from
:type transfer_coordinator: s3transfer.futures.TransferCoordinator
:param transfer_coordinator: The transfer coordinator to use if the
reader needs to be interrupted.
c �"