https://t.me/RX1948
Server : Apache
System : Linux iad1-shared-b8-43 6.6.49-grsec-jammy+ #10 SMP Thu Sep 12 23:23:08 UTC 2024 x86_64
User : dh_edsupp ( 6597262)
PHP Version : 8.2.26
Disable Function : NONE
Directory :  /lib/python3/dist-packages/boto/glacier/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //lib/python3/dist-packages/boto/glacier/__pycache__/vault.cpython-310.pyc
o

ckF[�D�@s�ddlZddlmZddlmZddlmZmZmZddl	m
Z
ddlmZm
Z
ddlZdZdeZd	eZd
ZGdd�de�ZdS)
�N)�UploadArchiveError��Job)�compute_hashes_from_fileobj�resume_file_upload�Writer)�ConcurrentUploader)�minimum_part_size�DEFAULT_PART_SIZEiii@�i'c@s�eZdZeZdeZdZd&dd�Zdd�Z	dd	�Z
d&d
d�Zdd
�Zedfdd�Z
		d'dd�Zedd��Z		d(dd�Zdd�Z		d(dd�Z				d)dd�Zdd�Zdd�Zd d!�Zd(d"d#�Zd$d%�ZdS)*�Vault�d))�	VaultName�nameN)�VaultARN�arnN)�CreationDate�
creation_dateN)�LastInventoryDate�last_inventory_dateN)�SizeInBytes�sizer)�NumberOfArchives�number_of_archivesrNcCsV||_|r|jD]\}}}||}t|||�qdS|jD]\}}}t|||�qdS�N)�layer1�ResponseDataElements�setattr)�selfr�
response_data�
response_name�	attr_name�default�value�r#�4/usr/lib/python3/dist-packages/boto/glacier/vault.py�__init__5s��zVault.__init__cCs
d|jS)NzVault("%s"))r�rr#r#r$�__repr__?s
zVault.__repr__cCs|j�|j�dS)z/
        Delete's this vault. WARNING!
        N)r�delete_vaultrr&r#r#r$�deleteBszVault.deletecCs,tj�|�|jkr|j||d�S|�||�S)ar
        Adds an archive to a vault. For archives greater than 100MB the
        multipart upload will be used.

        :type file: str
        :param file: A filename to upload

        :type description: str
        :param description: An optional description for the archive.

        :rtype: str
        :return: The archive id of the newly created archive
        )�description)�os�path�getsize�SingleOperationThreshold�create_archive_from_file� _upload_archive_single_operation)r�filenamer*r#r#r$�upload_archiveHszVault.upload_archivecCsdt|d��!}t|�\}}|�d�|j�|j||||�}Wd�|dS1s)wY|dS)ai
        Adds an archive to a vault in a single operation. It's recommended for
        archives less than 100MB

        :type file: str
        :param file: A filename to upload

        :type description: str
        :param description: A description for the archive.

        :rtype: str
        :return: The archive id of the newly created archive
        �rbrN�	ArchiveId)�openr�seekrr2r)rr1r*�fileobj�linear_hash�	tree_hash�responser#r#r$r0Zs
�
��z&Vault._upload_archive_single_operationcCs$|j�|j||�}t||d|d�S)a�
        Create a new archive and begin a multi-part upload to it.
        Returns a file-like object to which the data for the archive
        can be written. Once all the data is written the file-like
        object should be closed, you can then call the get_archive_id
        method on it to get the ID of the created archive.

        :type part_size: int
        :param part_size: The part size for the multipart upload.

        :type description: str
        :param description: An optional description for the archive.

        :rtype: :class:`boto.glacier.writer.Writer`
        :return: A Writer object that to which the archive data
            should be written.
        �UploadId)�	part_size)r�initiate_multipart_uploadrr)rr<r*r:r#r#r$�create_archive_writerps

�zVault.create_archive_writerc	Cs�|j}|s#tj�|�}zt||�}Wntytd��wt|d�}|j||d�}|r1||j	�	|�
|�}|s:n|�|�q2|��|�
�S)a�
        Create a new archive and upload the data from the given file
        or file-like object.

        :type filename: str
        :param filename: A filename to upload

        :type file_obj: file
        :param file_obj: A file-like object to upload

        :type description: str
        :param description: An optional description for the archive.

        :type upload_id_callback: function
        :param upload_id_callback: if set, call with the upload_id as the
            only parameter when it becomes known, to enable future calls
            to resume_archive_from_file in case resume is needed.

        :rtype: str
        :return: The archive id of the newly created archive
        zAFile size of %s bytes exceeds 40,000 GB archive limit of Glacier.r3)r*r<)�DefaultPartSizer+r,r-r	�
ValueErrorrr5r>�	upload_id�read�write�close�get_archive_id)	rr1�file_objr*�upload_id_callbackr<�	file_size�writer�datar#r#r$r/�s.�
�


�zVault.create_archive_from_filecCstdd�|�d�D�\}}|d}||}||dkr&|d8}|d8}|d8}||r.Jd��||ks6Jd��||S)NcSsg|]}t|��qSr#)�int)�.0r"r#r#r$�
<listcomp>�sz5Vault._range_string_to_part_index.<locals>.<listcomp>�-�z0upload part start byte is not on a part boundaryz$upload part is bigger than part size)�split)�range_stringr<�start�
inside_end�end�lengthr#r#r$�_range_string_to_part_index�s
�z!Vault._range_string_to_part_indexc
Csj|�|�}|d}i}|dD]}|�|d|�}t�|dd�}	|	||<q|s-t|d�}t|||||�S)a'Resume upload of a file already part-uploaded to Glacier.

        The resumption of an upload where the part-uploaded section is empty
        is a valid degenerate case that this function can handle.

        One and only one of filename or file_obj must be specified.

        :type upload_id: str
        :param upload_id: existing Glacier upload id of upload being resumed.

        :type filename: str
        :param filename: file to open for resume

        :type fobj: file
        :param fobj: file-like object containing local data to resume. This
            must read from the start of the entire upload, not just from the
            point being resumed. Use fobj.seek(0) to achieve this if necessary.

        :rtype: str
        :return: The archive id of the newly created archive

        �PartSizeInBytes�Parts�RangeInBytes�SHA256TreeHash�	hex_codecr3)�list_all_partsrV�codecs�decoder5r)
rrAr1rF�part_list_responser<�
part_hash_map�	part_desc�
part_index�part_tree_hashr#r#r$�resume_archive_from_file�s
�


�zVault.resume_archive_from_filecKs&t|j|jfi|��}|�||�}|S)a�
        Create a new archive from a file and upload the given
        file.

        This is a convenience method around the
        :class:`boto.glacier.concurrent.ConcurrentUploader`
        class.  This method will perform a multipart upload
        and upload the parts of the file concurrently.

        :type filename: str
        :param filename: A filename to upload

        :param kwargs: Additional kwargs to pass through to
            :py:class:`boto.glacier.concurrent.ConcurrentUploader`.
            You can pass any argument besides the ``api`` and
            ``vault_name`` param (these arguments are already
            passed to the ``ConcurrentUploader`` for you).

        :raises: `boto.glacier.exception.UploadArchiveError` is an error
            occurs during the upload process.

        :rtype: str
        :return: The archive id of the newly created archive

        )rrr�upload)rr1r*�kwargs�uploader�
archive_idr#r#r$�#concurrent_create_archive_from_file�sz)Vault.concurrent_create_archive_from_filecCsHd|d�}|dur
||d<|dur||d<|j�|j|�}|�|d�S)a�
        Initiate a archive retrieval job to download the data from an
        archive. You will need to wait for the notification from
        Amazon (via SNS) before you can actually download the data,
        this takes around 4 hours.

        :type archive_id: str
        :param archive_id: The id of the archive

        :type description: str
        :param description: An optional description for the job.

        :type sns_topic: str
        :param sns_topic: The Amazon SNS topic ARN where Amazon Glacier
            sends notification when the job is completed and the output
            is ready for you to download.

        :rtype: :class:`boto.glacier.job.Job`
        :return: A Job object representing the retrieval job.
        zarchive-retrieval)�Typer4N�SNSTopic�Description�JobId)r�initiate_jobr�get_job)rrh�	sns_topicr*�job_datar:r#r#r$�retrieve_archive
s�zVault.retrieve_archivec
Cs�ddi}|dur||d<|dur||d<|dur||d<|dus(|dus(|durLi}|dur5|�d�|d<|dur@|�d�|d	<|durH||d
<||d<|j�|j|�}	|	dS)
a�
        Initiate a inventory retrieval job to list the items in the
        vault. You will need to wait for the notification from
        Amazon (via SNS) before you can actually download the data,
        this takes around 4 hours.

        :type description: str
        :param description: An optional description for the job.

        :type sns_topic: str
        :param sns_topic: The Amazon SNS topic ARN where Amazon Glacier
            sends notification when the job is completed and the output
            is ready for you to download.

        :type byte_range: str
        :param byte_range: Range of bytes to retrieve.

        :type start_date: DateTime
        :param start_date: Beginning of the date range to query.

        :type end_date: DateTime
        :param end_date: End of the date range to query.

        :type limit: int
        :param limit: Limits the number of results returned.

        :rtype: str
        :return: The ID of the job
        rjzinventory-retrievalNrkrl�RetrievalByteRangez%Y-%m-%dT%H:%M:%S%Z�	StartDate�EndDate�Limit�InventoryRetrievalParametersrm)�strftimerrnr)
rrpr*�
byte_range�
start_date�end_date�limitrq�rparamsr:r#r#r$�retrieve_inventory-s$!zVault.retrieve_inventorycKs|jdi|��}|�|�S)a�
        Identical to ``retrieve_inventory``, but returns a ``Job`` instance
        instead of just the job ID.

        :type description: str
        :param description: An optional description for the job.

        :type sns_topic: str
        :param sns_topic: The Amazon SNS topic ARN where Amazon Glacier
            sends notification when the job is completed and the output
            is ready for you to download.

        :type byte_range: str
        :param byte_range: Range of bytes to retrieve.

        :type start_date: DateTime
        :param start_date: Beginning of the date range to query.

        :type end_date: DateTime
        :param end_date: End of the date range to query.

        :type limit: int
        :param limit: Limits the number of results returned.

        :rtype: :class:`boto.glacier.job.Job`
        :return: A Job object representing the retrieval job.
        Nr#)r~ro)rrf�job_idr#r#r$�retrieve_inventory_jobds
zVault.retrieve_inventory_jobcCs|j�|j|�S)z�
        This operation deletes an archive from the vault.

        :type archive_id: str
        :param archive_id: The ID for the archive to be deleted.
        )r�delete_archiver)rrhr#r#r$r��szVault.delete_archivecCs|j�|j|�}t||�S)z�
        Get an object representing a job in progress.

        :type job_id: str
        :param job_id: The ID of the job

        :rtype: :class:`boto.glacier.job.Job`
        :return: A Job object representing the job.
        )r�describe_jobrr)rrrr#r#r$ro�s

z
Vault.get_jobcs(�j��j||�}�fdd�|dD�S)a�
        Return a list of Job objects related to this vault.

        :type completed: boolean
        :param completed: Specifies the state of the jobs to return.
            If a value of True is passed, only completed jobs will
            be returned.  If a value of False is passed, only
            uncompleted jobs will be returned.  If no value is
            passed, all jobs will be returned.

        :type status_code: string
        :param status_code: Specifies the type of job status to return.
            Valid values are: InProgress|Succeeded|Failed.  If not
            specified, jobs with all status codes are returned.

        :rtype: list of :class:`boto.glacier.job.Job`
        :return: A list of Job objects related to this vault.
        csg|]}t�|��qSr#r)rL�jdr&r#r$rM�sz#Vault.list_jobs.<locals>.<listcomp>�JobList)r�	list_jobsr)r�	completed�status_coderr#r&r$r��s�zVault.list_jobscCsZ|j�|j|�}|d}|r'|jj|j||d�}|d�|d�|d}|sd|d<|S)z�Automatically make and combine multiple calls to list_parts.

        Call list_parts as necessary, combining the results in case multiple
        calls were required to get data on all available parts.

        �Marker)�markerrXN)r�
list_partsr�extend)rrA�resultr��additional_resultr#r#r$r\�s��zVault.list_all_partsr)NNNN)NN)NNNNNN)�__name__�
__module__�__qualname__r
r?�	_MEGABYTEr.rr%r'r)r2r0r>r/�staticmethodrVrdrirrr~r�r�ror�r\r#r#r#r$r)sD



�
�-

�(
� 
�7	

r)r]�boto.glacier.exceptionsr�boto.glacier.jobr�boto.glacier.writerrrr�boto.glacier.concurrentr�boto.glacier.utilsr	r
�os.pathr+r��	_GIGABYTE�MAXIMUM_ARCHIVE_SIZE�MAXIMUM_NUMBER_OF_PARTS�objectrr#r#r#r$�<module>s

https://t.me/RX1948 - 2025