| Server IP : 3.138.164.131 / Your IP : 216.73.216.136 Web Server : Apache System : Linux ns1.techtime.me 4.18.0-147.8.1.el8.lve.1.x86_64 #1 SMP Mon Jun 29 09:55:57 EDT 2020 x86_64 User : injazaat ( 1471) PHP Version : 8.1.20 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /usr/local/lib/python3.6/site-packages/s3transfer/__pycache__/ |
Upload File : |
3
�b`�m � @ s� d dl Z d dlZd dlZd dlmZ d dlmZ d dlmZ d dl m
Z
d dlmZ d dlm
Z
d dlmZ d d lmZ d d
lmZ d dlmZ d dlmZ d d
lmZ d dlmZ d dlmZ d dlmZ e je�ZG dd� de�ZG dd� de�ZG dd� de�ZG dd� de�ZG dd� de�Z G dd� de�Z!G dd� de�Z"G dd � d e"�Z#G d!d"� d"e�Z$G d#d$� d$e�Z%G d%d&� d&e�Z&G d'd(� d(e�Z'G d)d*� d*e�Z(G d+d,� d,e�Z)G d-d.� d.e�Z*dS )/� N)�six)�seekable)�RetriesExceededError)�IN_MEMORY_DOWNLOAD_TAG)�S3_RETRYABLE_DOWNLOAD_ERRORS)�
get_callbacks)�invoke_progress_callbacks)�calculate_num_parts)�calculate_range_parameter)�FunctionContainer)�CountCallbackInvoker)�StreamReaderProgress)�DeferredOpenFile)�Task)�SubmissionTaskc @ sT e Zd ZdZdd� Zedd� �Zdd� Zdd � Zd
d� Z dd
� Z
dd� Zdd� ZdS )�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 C s || _ || _|| _d S )N)�_osutil�_transfer_coordinator�_io_executor)�self�osutil�transfer_coordinator�io_executor� r �9/tmp/pip-build-t4pk6ic9/s3transfer/s3transfer/download.py�__init__4 s zDownloadOutputManager.__init__c C s t d��dS )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()N)�NotImplementedError)�cls�download_targetr r r r �
is_compatible9 s z#DownloadOutputManager.is_compatiblec C s dS )z�Get the tag (if any) to associate all GetObjectTasks
:rtype: s3transfer.futures.TaskTag
:returns: The tag to associate all GetObjectTasks with
Nr )r r r r �get_download_task_tagG s z+DownloadOutputManager.get_download_task_tagc C s t d��dS )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()N)r )r �transfer_futurer r r �get_fileobj_for_io_writesO s z/DownloadOutputManager.get_fileobj_for_io_writesc C s | j j| j| j|||�� dS )a Queue IO write for submission to the IO executor.
This method accepts an IO executor and information about the
downloaded data, and handles submitting this to the IO executor.
This method may defer submission to the IO executor if necessary.
N)r �submitr �get_io_write_task)r �fileobj�data�offsetr r r �queue_file_io_taskY s z(DownloadOutputManager.queue_file_io_taskc C s t | j|||d�d�S )a Get an IO write task for the requested set of data
This task can be ran immediately or be submitted to the IO executor
for it to run.
:type fileobj: file-like object
:param fileobj: The file-like object to write to
:type data: bytes
:param data: The data to write out
:type offset: integer
:param offset: The offset to write the data to in the file-like object
:returns: An IO task to be used to write data to a file-like object
)r% r&