當前位置: 首頁>>代碼示例>>Python>>正文


Python six.BytesIO方法代碼示例

本文整理匯總了Python中botocore.compat.six.BytesIO方法的典型用法代碼示例。如果您正苦於以下問題:Python six.BytesIO方法的具體用法?Python six.BytesIO怎麽用?Python six.BytesIO使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在botocore.compat.six的用法示例。


在下文中一共展示了six.BytesIO方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: _wrap_data

# 需要導入模塊: from botocore.compat import six [as 別名]
# 或者: from botocore.compat.six import BytesIO [as 別名]
def _wrap_data(self, data, callbacks, close_callbacks):
        """
        Wraps data with the interrupt reader and the file chunk reader.

        :type data: bytes
        :param data: The data to wrap.

        :type callbacks: list
        :param callbacks: The callbacks associated with the transfer future.

        :type close_callbacks: list
        :param close_callbacks: The callbacks to be called when closing the
            wrapper for the data.

        :return: Fully wrapped data.
        """
        fileobj = self._wrap_with_interrupt_reader(six.BytesIO(data))
        return self._osutil.open_file_chunk_reader_from_fileobj(
            fileobj=fileobj, chunk_size=len(data), full_file_size=len(data),
            callbacks=callbacks, close_callbacks=close_callbacks) 
開發者ID:skarlekar,項目名稱:faces,代碼行數:22,代碼來源:upload.py

示例2: _wrap_data

# 需要導入模塊: from botocore.compat import six [as 別名]
# 或者: from botocore.compat.six import BytesIO [as 別名]
def _wrap_data(self, data, callbacks, close_callbacks):
        """
        Wraps data with the interrupt reader and the file chunk reader.

        :type data: bytes
        :param data: The data to wrap.

        :type callbacks: list
        :param callbacks: The callbacks associated with the transfer future.

        :type close_callbacks: list
        :param close_callbacks: The callbacks to be called when closing the
            wrapper for the data.

        :return: Fully wrapped data.
        """
        fileobj = self._wrap_fileobj(six.BytesIO(data))
        return self._osutil.open_file_chunk_reader_from_fileobj(
            fileobj=fileobj, chunk_size=len(data), full_file_size=len(data),
            callbacks=callbacks, close_callbacks=close_callbacks) 
開發者ID:gkrizek,項目名稱:bash-lambda-layer,代碼行數:22,代碼來源:upload.py

示例3: _get_upload_part_fileobj_with_full_size

# 需要導入模塊: from botocore.compat import six [as 別名]
# 或者: from botocore.compat.six import BytesIO [as 別名]
def _get_upload_part_fileobj_with_full_size(self, fileobj, **kwargs):
        # Note: It is unfortunate that in order to do a multithreaded
        # multipart upload we cannot simply copy the filelike object
        # since there is not really a mechanism in python (i.e. os.dup
        # points to the same OS filehandle which causes concurrency
        # issues). So instead we need to read from the fileobj and
        # chunk the data out to seperate file-like objects in memory.
        data = fileobj.read(kwargs['part_size'])
        # We return the length of the data instead of the full_file_size
        # because we partitioned the data into seperate BytesIO objects
        # meaning the BytesIO object has no knowledge of its start position
        # relative the input source nor access to the rest of the input
        # source. So we must treat it as its own standalone file.
        return six.BytesIO(data), len(data) 
開發者ID:skarlekar,項目名稱:faces,代碼行數:16,代碼來源:upload.py

示例4: _get_upload_part_fileobj_with_full_size

# 需要導入模塊: from botocore.compat import six [as 別名]
# 或者: from botocore.compat.six import BytesIO [as 別名]
def _get_upload_part_fileobj_with_full_size(self, fileobj, **kwargs):
        # Note: It is unfortunate that in order to do a multithreaded
        # multipart upload we cannot simply copy the filelike object
        # since there is not really a mechanism in python (i.e. os.dup
        # points to the same OS filehandle which causes concurrency
        # issues). So instead we need to read from the fileobj and
        # chunk the data out to separate file-like objects in memory.
        data = fileobj.read(kwargs['part_size'])
        # We return the length of the data instead of the full_file_size
        # because we partitioned the data into separate BytesIO objects
        # meaning the BytesIO object has no knowledge of its start position
        # relative the input source nor access to the rest of the input
        # source. So we must treat it as its own standalone file.
        return six.BytesIO(data), len(data) 
開發者ID:gkrizek,項目名稱:bash-lambda-layer,代碼行數:16,代碼來源:upload.py


注:本文中的botocore.compat.six.BytesIO方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。