ó T!ś\c@s§ddlmZddlmZddlmZmZddlmZddlmZd„Z d„Z d„Z d „Z d „Z d „Zdddd „Zdddd „Zdddd„Zdddd„Zdddd„Zdddd„Zddddd„Zddddd„Zddddd„Zdddd„Zdddd„Zdddd„Zdddd„Zdddd„Zdddd„ZdS(i˙˙˙˙(t ClientError(tcreate_transfer_manager(tTransferConfigt S3Transfer(tProgressCallbackInvoker(tutilscKsctj|dtƒtj|dtƒtj|dtƒtj|dtƒtj|dtƒdS(Nt upload_filet download_filetcopytupload_fileobjtdownload_fileobj(Rtinject_attributeRRRR R (tclass_attributestkwargs((s0/tmp/pip-install-usGedi/boto3/boto3/s3/inject.pytinject_s3_transfer_methodss cKsvtj|dtƒtj|dtƒtj|dtƒtj|dtƒtj|dtƒtj|dtƒdS(NtloadRRRR R (RR t bucket_loadtbucket_upload_filetbucket_download_filet bucket_copytbucket_upload_fileobjtbucket_download_fileobj(R R ((s0/tmp/pip-install-usGedi/boto3/boto3/s3/inject.pytinject_bucket_methodss  cKsctj|dtƒtj|dtƒtj|dtƒtj|dtƒtj|dtƒdS(NRRRR R (RR tobject_upload_filetobject_download_filet object_copytobject_upload_fileobjtobject_download_fileobj(R R ((s0/tmp/pip-install-usGedi/boto3/boto3/s3/inject.pytinject_object_methods*s  cKstj|dtƒdS(NR(RR tobject_summary_load(R R ((s0/tmp/pip-install-usGedi/boto3/boto3/s3/inject.pytinject_object_summary_methods5scOsži|j_yN|jjjƒ}x5|dD])}|d|jkr,||j_Pq,q,WWn=tk r™}|jjdiƒjdƒdksš‚qšnXdS(s] Calls s3.Client.list_buckets() to update the attributes of the Bucket resource. tBucketstNametErrortCodet AccessDeniedN(tmetatdatatclientt list_bucketstnameRtresponsetget(tselftargsR R)t bucket_datate((s0/tmp/pip-install-usGedi/boto3/boto3/s3/inject.pyR9s   $cOsV|jjjd|jd|jƒ}d|krF|jdƒ|d`. :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. :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. tfilenametbucketR5t extra_argstcallbackN(RR(R+tFilenameR/R0t ExtraArgstCallbacktConfigttransfer((s0/tmp/pip-install-usGedi/boto3/boto3/s3/inject.pyR]s# cCsDt||ƒ/}|jd|d|d|d|d|ƒSWdQXdS(sDownload an S3 object to a file. Usage:: import boto3 s3 = boto3.resource('s3') s3.meta.client.download_file('mybucket', '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 `. :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. :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. R8R5R7R9R:N(RR(R+R/R0R;R<R=R>R?((s0/tmp/pip-install-usGedi/boto3/boto3/s3/inject.pyR†s# c Cs7|jjjd|d|jd|d|d|d|ƒS(s¨Upload a file to an S3 object. Usage:: import boto3 s3 = boto3.resource('s3') s3.Bucket('mybucket').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 `. :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. :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. R;R/R0R<R=R>(R$R&RR((R+R;R0R<R=R>((s0/tmp/pip-install-usGedi/boto3/boto3/s3/inject.pyRŻs c Cs7|jjjd|jd|d|d|d|d|ƒS(sšDownload an S3 object to a file. Usage:: import boto3 s3 = boto3.resource('s3') s3.Bucket('mybucket').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 `. :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. :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/R0R;R<R=R>(R$R&RR((R+R0R;R<R=R>((s0/tmp/pip-install-usGedi/boto3/boto3/s3/inject.pyRÔs c Cs:|jjjd|d|jd|jd|d|d|ƒS(sbUpload a file to an S3 object. Usage:: import boto3 s3 = boto3.resource('s3') s3.Object('mybucket', '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 `. :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. :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. R;R/R0R<R=R>(R$R&RR4R5(R+R;R<R=R>((s0/tmp/pip-install-usGedi/boto3/boto3/s3/inject.pyRůsc Cs:|jjjd|jd|jd|d|d|d|ƒS(soDownload an S3 object to a file. Usage:: import boto3 s3 = boto3.resource('s3') s3.Object('mybucket', '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 `. :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. :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/R0R;R<R=R>(R$R&RR4R5(R+R;R<R=R>((s0/tmp/pip-install-usGedi/boto3/boto3/s3/inject.pyRsc Cs˜d}|dk r$t|ƒg}n|} | dkrBtƒ} nt|| ƒA} | jd|d|d|d|d|d|ƒ} | jƒSWdQXdS(soCopy 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': 'mybucket', 'Key': 'mykey' } s3.meta.client.copy(copy_source, 'otherbucket', '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 :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. t copy_sourceR8R5R9t subscriberst source_clientN(tNoneRRRRtresult( R+t CopySourceR/R0R<R=t SourceClientR>RAtconfigtmanagertfuture((s0/tmp/pip-install-usGedi/boto3/boto3/s3/inject.pyR=s1      cCs=|jjjd|d|jd|d|d|d|d|ƒS(sGCopy 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': 'mybucket', 'Key': 'mykey' } bucket = s3.Bucket('otherbucket') 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 :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. RER/R0R<R=RFR>(R$R&RR((R+RER0R<R=RFR>((s0/tmp/pip-install-usGedi/boto3/boto3/s3/inject.pyR~s/cCs@|jjjd|d|jd|jd|d|d|d|ƒS(sCopy 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': 'mybucket', 'Key': 'mykey' } bucket = s3.Bucket('otherbucket') 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 :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. RER/R0R<R=RFR>(R$R&RR4R5(R+RER<R=RFR>((s0/tmp/pip-install-usGedi/boto3/boto3/s3/inject.pyR˛s-c Cs°t|dƒstdƒ‚nd}|dk rBt|ƒg}n|}|dkr`tƒ}nt||ƒ;} | jd|d|d|d|d|ƒ} | jƒSWdQXdS( sNUpload 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, 'mybucket', '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. :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. treadsFileobj must implement readtfileobjR8R5R9RAN(thasattrt ValueErrorRCRRRtuploadRD( R+tFileobjR/R0R<R=R>RARGRHRI((s0/tmp/pip-install-usGedi/boto3/boto3/s3/inject.pyR ĺs'    c Cs7|jjjd|d|jd|d|d|d|ƒS(s)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('mybucket') 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. :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. ROR/R0R<R=R>(R$R&R R((R+ROR0R<R=R>((s0/tmp/pip-install-usGedi/boto3/boto3/s3/inject.pyRs%c Cs:|jjjd|d|jd|jd|d|d|ƒS(süUpload 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('mybucket') 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. :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. ROR/R0R<R=R>(R$R&R R4R5(R+ROR<R=R>((s0/tmp/pip-install-usGedi/boto3/boto3/s3/inject.pyRHs#c Cs°t|dƒstdƒ‚nd}|dk rBt|ƒg}n|}|dkr`tƒ}nt||ƒ;} | jd|d|d|d|d|ƒ} | jƒSWdQXdS( svDownload 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('mybucket', '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 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 ExtraArgs: dict :param ExtraArgs: Extra arguments that may be passed to the client operation. :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. twritesFileobj must implement writeR8R5RKR9RAN(RLRMRCRRRtdownloadRD( R+R/R0ROR<R=R>RARGRHRI((s0/tmp/pip-install-usGedi/boto3/boto3/s3/inject.pyR ps'    c Cs7|jjjd|jd|d|d|d|d|ƒS(sMDownload 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('mybucket') 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. :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/R0ROR<R=R>(R$R&R R((R+R0ROR<R=R>((s0/tmp/pip-install-usGedi/boto3/boto3/s3/inject.pyRŠs%c Cs:|jjjd|jd|jd|d|d|d|ƒS(sDownload 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('mybucket') 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. :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/R0ROR<R=R>(R$R&R R4R5(R+ROR<R=R>((s0/tmp/pip-install-usGedi/boto3/boto3/s3/inject.pyRÓs#N(tbotocore.exceptionsRtboto3.s3.transferRRRRtboto3RRRRRRRRCRRRRRRRRRR RRR RR(((s0/tmp/pip-install-usGedi/boto3/boto3/s3/inject.pyt sH   ()%%"!@328) '8)