Current File : //proc/self/root/lib/python3/dist-packages/s3transfer/__pycache__/download.cpython-312.pyc |
�
�<�e�m � �� � d dl Z d dlZd dlZd dlmZ d dlmZ d dlmZ d dl m
Z
mZ d dlm
Z
mZmZmZmZmZmZmZmZ ej, e� Z G d� d� Z G d � d
e� Z G d� de� Z G d
� de� Z G d� de� Z G d� de
� Z G d� de� Z G d� de� Z G d� de� Z! G d� de� Z" G d� de� Z# G d� de� Z$ G d� d e� Z% G d!� d"� Z& G d#� d$� Z'y)%� N��seekable)�RetriesExceededError��IN_MEMORY_DOWNLOAD_TAG)�SubmissionTask�Task) �S3_RETRYABLE_DOWNLOAD_ERRORS�CountCallbackInvoker�DeferredOpenFile�FunctionContainer�StreamReaderProgress�calculate_num_parts�calculate_range_parameter�
get_callbacks�invoke_progress_callbacksc �J � e Zd ZdZd� Zed� � Zd� Zd� Zd� Z d� Z
d� Zd � Zy
)�DownloadOutputManagera� Base manager class for handling various types of files for downloads
This class is typically used for the DownloadSubmissionTask class to help
determine the following:
* Provides the fileobj to write to downloads to
* Get a task to complete once everything downloaded has been written
The answers/implementations differ for the various types of file outputs
that may be accepted. All implementations must subclass and override
public methods from this class.
c �. � || _ || _ || _ y �N)�_osutil�_transfer_coordinator�_io_executor)�self�osutil�transfer_coordinator�io_executors �5/usr/lib/python3/dist-packages/s3transfer/download.py�__init__zDownloadOutputManager.__init__2 s � ����%9��"�'��� c � � t d� �)ae Determines if the target for the download is compatible with manager
:param download_target: The target for which the upload will write
data to.
:param osutil: The os utility to be used for the transfer
:returns: True if the manager can handle the type of target specified
otherwise returns False.
zmust implement is_compatible()��NotImplementedError��cls�download_targetr s r �
is_compatiblez#DownloadOutputManager.is_compatible7 s � � "�"B�C�Cr c � � y)z�Get the tag (if any) to associate all GetObjectTasks
:rtype: s3transfer.futures.TaskTag
:returns: The tag to associate all GetObjectTasks with
N� �r s r �get_download_task_tagz+DownloadOutputManager.get_download_task_tagE s � � r c � � t d� �)a Get file-like object to use for io writes in the io executor
:type transfer_future: s3transfer.futures.TransferFuture
:param transfer_future: The future associated with upload request
returns: A file-like object to write to
z*must implement get_fileobj_for_io_writes()r"