Server : LiteSpeed
System : Linux server51.dnsbootclub.com 4.18.0-553.62.1.lve.el8.x86_64 #1 SMP Mon Jul 21 17:50:35 UTC 2025 x86_64
User : nandedex ( 1060)
PHP Version : 8.1.33
Disable Function : NONE
Directory :  /opt/cppython/lib/python3.8/site-packages/boto3/s3/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]


Current File : //opt/cppython/lib/python3.8/site-packages/boto3/s3/__pycache__/inject.cpython-38.pyc
U

Q��g�r�@s�ddlZddlmZddlmZddlmZddlm	Z	m
Z
mZmZzddl
mZWn*ek
r~ddlmZd8dd	�ZYnXzdd
lmZWnek
r�dd�ZYnXd
d�Zdd�Zdd�Zdd�Zdd�Zdd�Zeeed��d9dd��Zeeed��d:dd��Zd;dd�Zd<d d!�Zd=d"d#�Zd>d$d%�Zeeed��d?d&d'��Zd@d(d)�ZdAd*d+�Z eeed��dBd,d-��Z!dCd.d/�Z"dDd0d1�Z#eeed��dEd2d3��Z$dFd4d5�Z%dGd6d7�Z&dS)H�N)�partial)�ClientError)�utils)�ProgressCallbackInvoker�
S3Transfer�TransferConfig�create_transfer_manager)�with_current_context��wrapscCsdd�}|S)Ncst���fdd��}|S)Ncs
�||�S�N�)�args�kwargs��funcr
�</opt/cppython/lib/python3.8/site-packages/boto3/s3/inject.py�wrapper!sz8with_current_context.<locals>.decorator.<locals>.wrapperr
)rrr
rr�	decorator sz'with_current_context.<locals>.decoratorr
)�hookrr
r
rr	sr	)�register_feature_idcCsdSrr
)Z
feature_idr
r
rr.srcKsJt�|dt�t�|dt�t�|dt�t�|dt�t�|dt�dS�N�upload_file�
download_file�copy�upload_fileobj�download_fileobj)r�inject_attributerrrrr�Zclass_attributesrr
r
r�inject_s3_transfer_methods2s�rcKsXt�|dt�t�|dt�t�|dt�t�|dt�t�|dt�t�|dt�dS)N�loadrrrrr)rr�bucket_load�bucket_upload_file�bucket_download_file�bucket_copy�bucket_upload_fileobj�bucket_download_fileobjrr
r
r�inject_bucket_methods<s$���r'cKsJt�|dt�t�|dt�t�|dt�t�|dt�t�|dt�dSr)rr�object_upload_file�object_download_file�object_copy�object_upload_fileobj�object_download_fileobjrr
r
r�inject_object_methodsKs"���r-cKst�|dt�dS)Nr )rr�object_summary_loadrr
r
r�inject_object_summary_methodsYsr/c
Os�i|j_z8|jj��}|dD]}|d|jkr||j_q>qWn<tk
r|}z|j�di��d�dksl�W5d}~XYnXdS)z]
    Calls s3.Client.list_buckets() to update the attributes of the Bucket
    resource.
    ZBuckets�Name�ErrorZCodeZAccessDeniedN)�meta�data�clientZlist_buckets�namer�response�get)�selfrrr6Zbucket_data�er
r
rr!]s

r!cOs8|jjj|j|jd�}d|kr,|�d�|d<||j_dS)za
    Calls s3.Client.head_object to update the attributes of the ObjectSummary
    resource.
    )�Bucket�KeyZ
ContentLength�SizeN)r2r4Zhead_object�bucket_name�key�popr3)r8rrr6r
r
rr.vs�r.ZS3_TRANSFERc
Cs6t||��"}|j|||||d�W5QR�SQRXdS)acUpload a file to an S3 object.

    Usage::

        import boto3
        s3 = boto3.client('s3')
        s3.upload_file('/tmp/hello.txt', 'amzn-s3-demo-bucket', 'hello.txt')

    Similar behavior as S3Transfer's upload_file() method, except that
    argument names are capitalized. Detailed examples can be found at
    :ref:`S3Transfer's Usage <ref_s3transfer_usage>`.

    :type Filename: str
    :param Filename: The path to the file to upload.

    :type Bucket: str
    :param Bucket: The name of the bucket to upload to.

    :type Key: str
    :param Key: The name of the key to upload to.

    :type ExtraArgs: dict
    :param ExtraArgs: Extra arguments that may be passed to the
        client operation. For allowed upload arguments see
        :py:attr:`boto3.s3.transfer.S3Transfer.ALLOWED_UPLOAD_ARGS`.

    :type Callback: function
    :param Callback: A method which takes a number of bytes transferred to
        be periodically called during the upload.

    :type Config: boto3.s3.transfer.TransferConfig
    :param Config: The transfer configuration to be used when performing the
        transfer.
    )�filename�bucketr>�
extra_args�callbackN)rr)r8�Filenamer:r;�	ExtraArgs�Callback�Config�transferr
r
rr�s&�rc
Cs6t||��"}|j|||||d�W5QR�SQRXdS)axDownload an S3 object to a file.

    Usage::

        import boto3
        s3 = boto3.client('s3')
        s3.download_file('amzn-s3-demo-bucket', 'hello.txt', '/tmp/hello.txt')

    Similar behavior as S3Transfer's download_file() method,
    except that parameters are capitalized. Detailed examples can be found at
    :ref:`S3Transfer's Usage <ref_s3transfer_usage>`.

    :type Bucket: str
    :param Bucket: The name of the bucket to download from.

    :type Key: str
    :param Key: The name of the key to download from.

    :type Filename: str
    :param Filename: The path to the file to download to.

    :type ExtraArgs: dict
    :param ExtraArgs: Extra arguments that may be passed to the
        client operation. For allowed download arguments see
        :py:attr:`boto3.s3.transfer.S3Transfer.ALLOWED_DOWNLOAD_ARGS`.

    :type Callback: function
    :param Callback: A method which takes a number of bytes transferred to
        be periodically called during the download.

    :type Config: boto3.s3.transfer.TransferConfig
    :param Config: The transfer configuration to be used when performing the
        transfer.
    )rAr>r@rBrCN)rr)r8r:r;rDrErFrGrHr
r
rr�s&�rcCs|jjj||j||||d�S)aUpload a file to an S3 object.

    Usage::

        import boto3
        s3 = boto3.resource('s3')
        s3.Bucket('amzn-s3-demo-bucket').upload_file('/tmp/hello.txt', 'hello.txt')

    Similar behavior as S3Transfer's upload_file() method,
    except that parameters are capitalized. Detailed examples can be found at
    :ref:`S3Transfer's Usage <ref_s3transfer_usage>`.

    :type Filename: str
    :param Filename: The path to the file to upload.

    :type Key: str
    :param Key: The name of the key to upload to.

    :type ExtraArgs: dict
    :param ExtraArgs: Extra arguments that may be passed to the
        client operation. For allowed upload arguments see
        :py:attr:`boto3.s3.transfer.S3Transfer.ALLOWED_UPLOAD_ARGS`.

    :type Callback: function
    :param Callback: A method which takes a number of bytes transferred to
        be periodically called during the upload.

    :type Config: boto3.s3.transfer.TransferConfig
    :param Config: The transfer configuration to be used when performing the
        transfer.
    �rDr:r;rErFrG)r2r4rr5)r8rDr;rErFrGr
r
rr"�s"�r"cCs|jjj|j|||||d�S)a.Download an S3 object to a file.

    Usage::

        import boto3
        s3 = boto3.resource('s3')
        s3.Bucket('amzn-s3-demo-bucket').download_file('hello.txt', '/tmp/hello.txt')

    Similar behavior as S3Transfer's download_file() method,
    except that parameters are capitalized. Detailed examples can be found at
    :ref:`S3Transfer's Usage <ref_s3transfer_usage>`.

    :type Key: str
    :param Key: The name of the key to download from.

    :type Filename: str
    :param Filename: The path to the file to download to.

    :type ExtraArgs: dict
    :param ExtraArgs: Extra arguments that may be passed to the
        client operation. For allowed download arguments see
        :py:attr:`boto3.s3.transfer.S3Transfer.ALLOWED_DOWNLOAD_ARGS`.

    :type Callback: function
    :param Callback: A method which takes a number of bytes transferred to
        be periodically called during the download.

    :type Config: boto3.s3.transfer.TransferConfig
    :param Config: The transfer configuration to be used when performing the
        transfer.
    �r:r;rDrErFrG)r2r4rr5)r8r;rDrErFrGr
r
rr#s"�r#cCs|jjj||j|j|||d�S)a�Upload a file to an S3 object.

    Usage::

        import boto3
        s3 = boto3.resource('s3')
        s3.Object('amzn-s3-demo-bucket', 'hello.txt').upload_file('/tmp/hello.txt')

    Similar behavior as S3Transfer's upload_file() method,
    except that parameters are capitalized. Detailed examples can be found at
    :ref:`S3Transfer's Usage <ref_s3transfer_usage>`.

    :type Filename: str
    :param Filename: The path to the file to upload.

    :type ExtraArgs: dict
    :param ExtraArgs: Extra arguments that may be passed to the
        client operation. For allowed upload arguments see
        :py:attr:`boto3.s3.transfer.S3Transfer.ALLOWED_UPLOAD_ARGS`.

    :type Callback: function
    :param Callback: A method which takes a number of bytes transferred to
        be periodically called during the upload.

    :type Config: boto3.s3.transfer.TransferConfig
    :param Config: The transfer configuration to be used when performing the
        transfer.
    rI)r2r4rr=r>�r8rDrErFrGr
r
rr(;s�r(cCs|jjj|j|j||||d�S)a�Download an S3 object to a file.

    Usage::

        import boto3
        s3 = boto3.resource('s3')
        s3.Object('amzn-s3-demo-bucket', 'hello.txt').download_file('/tmp/hello.txt')

    Similar behavior as S3Transfer's download_file() method,
    except that parameters are capitalized. Detailed examples can be found at
    :ref:`S3Transfer's Usage <ref_s3transfer_usage>`.

    :type Filename: str
    :param Filename: The path to the file to download to.

    :type ExtraArgs: dict
    :param ExtraArgs: Extra arguments that may be passed to the
        client operation. For allowed download arguments see
        :py:attr:`boto3.s3.transfer.S3Transfer.ALLOWED_DOWNLOAD_ARGS`.

    :type Callback: function
    :param Callback: A method which takes a number of bytes transferred to
        be periodically called during the download.

    :type Config: boto3.s3.transfer.TransferConfig
    :param Config: The transfer configuration to be used when performing the
        transfer.
    rJ)r2r4rr=r>rKr
r
rr)ds�r)c

Csxd}|dk	rt|�g}|}	|	dkr(t�}	t�|	�}
d|
_t||
��,}|j||||||d�}|��W5QR�SQRXdS)a�Copy an object from one S3 location to another.

    This is a managed transfer which will perform a multipart copy in
    multiple threads if necessary.

    Usage::

        import boto3
        s3 = boto3.resource('s3')
        copy_source = {
            'Bucket': 'amzn-s3-demo-bucket1',
            'Key': 'mykey'
        }
        s3.meta.client.copy(copy_source, 'amzn-s3-demo-bucket2', 'otherkey')

    :type CopySource: dict
    :param CopySource: The name of the source bucket, key name of the
        source object, and optional version ID of the source object. The
        dictionary format is:
        ``{'Bucket': 'bucket', 'Key': 'key', 'VersionId': 'id'}``. Note
        that the ``VersionId`` key is optional and may be omitted.

    :type Bucket: str
    :param Bucket: The name of the bucket to copy to

    :type Key: str
    :param Key: The name of the key to copy to

    :type ExtraArgs: dict
    :param ExtraArgs: Extra arguments that may be passed to the
        client operation. For allowed download arguments see
        :py:attr:`boto3.s3.transfer.S3Transfer.ALLOWED_DOWNLOAD_ARGS`.

    :type Callback: function
    :param Callback: A method which takes a number of bytes transferred to
        be periodically called during the copy.

    :type SourceClient: botocore or boto3 Client
    :param SourceClient: The client to be used for operation that
        may happen at the source object. For example, this client is
        used for the head_object that determines the size of the copy.
        If no client is provided, the current client is used as the client
        for the source object.

    :type Config: boto3.s3.transfer.TransferConfig
    :param Config: The transfer configuration to be used when performing the
        copy.
    NZclassic)Zcopy_sourcerAr>rB�subscribersZ
source_client)rr�python_copyrZpreferred_transfer_clientr�result)
r8�
CopySourcer:r;rErF�SourceClientrGrL�configZ
new_config�manager�futurer
r
rr�s$;

�rc	Cs|jjj||j|||||d�S)a�Copy an object from one S3 location to an object in this bucket.

    This is a managed transfer which will perform a multipart copy in
    multiple threads if necessary.

    Usage::

        import boto3
        s3 = boto3.resource('s3')
        copy_source = {
            'Bucket': 'amzn-s3-demo-bucket1',
            'Key': 'mykey'
        }
        bucket = s3.Bucket('amzn-s3-demo-bucket2')
        bucket.copy(copy_source, 'otherkey')

    :type CopySource: dict
    :param CopySource: The name of the source bucket, key name of the
        source object, and optional version ID of the source object. The
        dictionary format is:
        ``{'Bucket': 'bucket', 'Key': 'key', 'VersionId': 'id'}``. Note
        that the ``VersionId`` key is optional and may be omitted.

    :type Key: str
    :param Key: The name of the key to copy to

    :type ExtraArgs: dict
    :param ExtraArgs: Extra arguments that may be passed to the
        client operation. For allowed download arguments see
        :py:attr:`boto3.s3.transfer.S3Transfer.ALLOWED_DOWNLOAD_ARGS`.

    :type Callback: function
    :param Callback: A method which takes a number of bytes transferred to
        be periodically called during the copy.

    :type SourceClient: botocore or boto3 Client
    :param SourceClient: The client to be used for operation that
        may happen at the source object. For example, this client is
        used for the head_object that determines the size of the copy.
        If no client is provided, the current client is used as the client
        for the source object.

    :type Config: boto3.s3.transfer.TransferConfig
    :param Config: The transfer configuration to be used when performing the
        copy.
    �rOr:r;rErFrPrG)r2r4rr5)r8rOr;rErFrPrGr
r
rr$�s7�r$c	Cs |jjj||j|j||||d�S)a�Copy an object from one S3 location to this object.

    This is a managed transfer which will perform a multipart copy in
    multiple threads if necessary.

    Usage::

        import boto3
        s3 = boto3.resource('s3')
        copy_source = {
            'Bucket': 'amzn-s3-demo-bucket1',
            'Key': 'mykey'
        }
        bucket = s3.Bucket('amzn-s3-demo-bucket2')
        obj = bucket.Object('otherkey')
        obj.copy(copy_source)

    :type CopySource: dict
    :param CopySource: The name of the source bucket, key name of the
        source object, and optional version ID of the source object. The
        dictionary format is:
        ``{'Bucket': 'bucket', 'Key': 'key', 'VersionId': 'id'}``. Note
        that the ``VersionId`` key is optional and may be omitted.

    :type ExtraArgs: dict
    :param ExtraArgs: Extra arguments that may be passed to the
        client operation. For allowed download arguments see
        :py:attr:`boto3.s3.transfer.S3Transfer.ALLOWED_DOWNLOAD_ARGS`.

    :type Callback: function
    :param Callback: A method which takes a number of bytes transferred to
        be periodically called during the copy.

    :type SourceClient: botocore or boto3 Client
    :param SourceClient: The client to be used for operation that
        may happen at the source object. For example, this client is
        used for the head_object that determines the size of the copy.
        If no client is provided, the current client is used as the client
        for the source object.

    :type Config: boto3.s3.transfer.TransferConfig
    :param Config: The transfer configuration to be used when performing the
        copy.
    rT)r2r4rr=r>)r8rOrErFrPrGr
r
rr*"s4�r*c
Csxt|d�std��d}|dk	r(t|�g}|}|dkr:t�}t||��*}	|	j|||||d�}
|
��W5QR�SQRXdS)a�Upload a file-like object to S3.

    The file-like object must be in binary mode.

    This is a managed transfer which will perform a multipart upload in
    multiple threads if necessary.

    Usage::

        import boto3
        s3 = boto3.client('s3')

        with open('filename', 'rb') as data:
            s3.upload_fileobj(data, 'amzn-s3-demo-bucket', 'mykey')

    :type Fileobj: a file-like object
    :param Fileobj: A file-like object to upload. At a minimum, it must
        implement the `read` method, and must return bytes.

    :type Bucket: str
    :param Bucket: The name of the bucket to upload to.

    :type Key: str
    :param Key: The name of the key to upload to.

    :type ExtraArgs: dict
    :param ExtraArgs: Extra arguments that may be passed to the
        client operation. For allowed upload arguments see
        :py:attr:`boto3.s3.transfer.S3Transfer.ALLOWED_UPLOAD_ARGS`.

    :type Callback: function
    :param Callback: A method which takes a number of bytes transferred to
        be periodically called during the upload.

    :type Config: boto3.s3.transfer.TransferConfig
    :param Config: The transfer configuration to be used when performing the
        upload.
    �readzFileobj must implement readN)�fileobjrAr>rBrL)�hasattr�
ValueErrorrrr�uploadrN)r8�Fileobjr:r;rErFrGrLrQrRrSr
r
rras"*

�rcCs|jjj||j||||d�S)a�Upload a file-like object to this bucket.

    The file-like object must be in binary mode.

    This is a managed transfer which will perform a multipart upload in
    multiple threads if necessary.

    Usage::

        import boto3
        s3 = boto3.resource('s3')
        bucket = s3.Bucket('amzn-s3-demo-bucket')

        with open('filename', 'rb') as data:
            bucket.upload_fileobj(data, 'mykey')

    :type Fileobj: a file-like object
    :param Fileobj: A file-like object to upload. At a minimum, it must
        implement the `read` method, and must return bytes.

    :type Key: str
    :param Key: The name of the key to upload to.

    :type ExtraArgs: dict
    :param ExtraArgs: Extra arguments that may be passed to the
        client operation. For allowed upload arguments see
        :py:attr:`boto3.s3.transfer.S3Transfer.ALLOWED_UPLOAD_ARGS`.

    :type Callback: function
    :param Callback: A method which takes a number of bytes transferred to
        be periodically called during the upload.

    :type Config: boto3.s3.transfer.TransferConfig
    :param Config: The transfer configuration to be used when performing the
        upload.
    �rZr:r;rErFrG)r2r4rr5)r8rZr;rErFrGr
r
rr%�s'�r%cCs|jjj||j|j|||d�S)amUpload a file-like object to this object.

    The file-like object must be in binary mode.

    This is a managed transfer which will perform a multipart upload in
    multiple threads if necessary.

    Usage::

        import boto3
        s3 = boto3.resource('s3')
        bucket = s3.Bucket('amzn-s3-demo-bucket')
        obj = bucket.Object('mykey')

        with open('filename', 'rb') as data:
            obj.upload_fileobj(data)

    :type Fileobj: a file-like object
    :param Fileobj: A file-like object to upload. At a minimum, it must
        implement the `read` method, and must return bytes.

    :type ExtraArgs: dict
    :param ExtraArgs: Extra arguments that may be passed to the
        client operation. For allowed upload arguments see
        :py:attr:`boto3.s3.transfer.S3Transfer.ALLOWED_UPLOAD_ARGS`.

    :type Callback: function
    :param Callback: A method which takes a number of bytes transferred to
        be periodically called during the upload.

    :type Config: boto3.s3.transfer.TransferConfig
    :param Config: The transfer configuration to be used when performing the
        upload.
    r[)r2r4rr=r>�r8rZrErFrGr
r
rr+�s%�r+c
Csxt|d�std��d}|dk	r(t|�g}|}|dkr:t�}t||��*}	|	j|||||d�}
|
��W5QR�SQRXdS)a�Download an object from S3 to a file-like object.

    The file-like object must be in binary mode.

    This is a managed transfer which will perform a multipart download in
    multiple threads if necessary.

    Usage::

        import boto3
        s3 = boto3.client('s3')

        with open('filename', 'wb') as data:
            s3.download_fileobj('amzn-s3-demo-bucket', 'mykey', data)

    :type Bucket: str
    :param Bucket: The name of the bucket to download from.

    :type Key: str
    :param Key: The name of the key to download from.

    :type Fileobj: a file-like object
    :param Fileobj: A file-like object to download into. At a minimum, it must
        implement the `write` method and must accept bytes.

    :type ExtraArgs: dict
    :param ExtraArgs: Extra arguments that may be passed to the
        client operation. For allowed download arguments see
        :py:attr:`boto3.s3.transfer.S3Transfer.ALLOWED_DOWNLOAD_ARGS`.

    :type Callback: function
    :param Callback: A method which takes a number of bytes transferred to
        be periodically called during the download.

    :type Config: boto3.s3.transfer.TransferConfig
    :param Config: The transfer configuration to be used when performing the
        download.
    �writezFileobj must implement writeN)rAr>rVrBrL)rWrXrrr�downloadrN)r8r:r;rZrErFrGrLrQrRrSr
r
rrs"*

�rcCs|jjj|j|||||d�S)a�Download an object from this bucket to a file-like-object.

    The file-like object must be in binary mode.

    This is a managed transfer which will perform a multipart download in
    multiple threads if necessary.

    Usage::

        import boto3
        s3 = boto3.resource('s3')
        bucket = s3.Bucket('amzn-s3-demo-bucket')

        with open('filename', 'wb') as data:
            bucket.download_fileobj('mykey', data)

    :type Fileobj: a file-like object
    :param Fileobj: A file-like object to download into. At a minimum, it must
        implement the `write` method and must accept bytes.

    :type Key: str
    :param Key: The name of the key to download from.

    :type ExtraArgs: dict
    :param ExtraArgs: Extra arguments that may be passed to the
        client operation. For allowed download arguments see
        :py:attr:`boto3.s3.transfer.S3Transfer.ALLOWED_DOWNLOAD_ARGS`.

    :type Callback: function
    :param Callback: A method which takes a number of bytes transferred to
        be periodically called during the download.

    :type Config: boto3.s3.transfer.TransferConfig
    :param Config: The transfer configuration to be used when performing the
        download.
    �r:r;rZrErFrG)r2r4rr5)r8r;rZrErFrGr
r
rr&As'�r&cCs|jjj|j|j||||d�S)a�Download this object from S3 to a file-like object.

    The file-like object must be in binary mode.

    This is a managed transfer which will perform a multipart download in
    multiple threads if necessary.

    Usage::

        import boto3
        s3 = boto3.resource('s3')
        bucket = s3.Bucket('amzn-s3-demo-bucket')
        obj = bucket.Object('mykey')

        with open('filename', 'wb') as data:
            obj.download_fileobj(data)

    :type Fileobj: a file-like object
    :param Fileobj: A file-like object to download into. At a minimum, it must
        implement the `write` method and must accept bytes.

    :type ExtraArgs: dict
    :param ExtraArgs: Extra arguments that may be passed to the
        client operation. For allowed download arguments see
        :py:attr:`boto3.s3.transfer.S3Transfer.ALLOWED_DOWNLOAD_ARGS`.

    :type Callback: function
    :param Callback: A method which takes a number of bytes transferred to
        be periodically called during the download.

    :type Config: boto3.s3.transfer.TransferConfig
    :param Config: The transfer configuration to be used when performing the
        download.
    r_)r2r4rr=r>r\r
r
rr,rs%�r,)N)NNN)NNN)NNN)NNN)NNN)NNN)NNNN)NNNN)NNNN)NNN)NNN)NNN)NNN)NNN)NNN)'rrM�	functoolsrZbotocore.exceptionsrZboto3rZboto3.s3.transferrrrrZbotocore.contextr	�ImportErrorrZbotocore.useragentrrr'r-r/r!r.rrr"r#r(r)r$r*rr%r+rr&r,r
r
r
r�<module>
s�

�/�0�
-�
-�
*�
)�V�
E�
?�@�
2�
/�@�
2�

F1le Man4ger