numpy_pickle_utils.py 文件源码

python
阅读 23 收藏 0 点赞 0 评论 0

项目:mlens 作者: flennerhag 项目源码 文件源码
def write(self, data):
        """Write a byte string to the file.

        Returns the number of uncompressed bytes written, which is
        always len(data). Note that due to buffering, the file on disk
        may not reflect the data written until close() is called.
        """
        with self._lock:
            self._check_can_write()
            # Convert data type if called by io.BufferedWriter.
            if isinstance(data, memoryview):
                data = data.tobytes()

            compressed = self._compressor.compress(data)
            self._fp.write(compressed)
            self._pos += len(data)
            return len(data)

    # Rewind the file to the beginning of the data stream.
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号