当前位置: 首页>>代码示例>>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;未经允许,请勿转载。