s3pipeline/pipelines.py
def _make_fileobj(self):
        """
        Build file object from items.
        """

        bio = BytesIO()
        f = gzip.GzipFile(mode='wb', fileobj=bio) if self.use_gzip else bio

        # Build file object using ItemExporter
        exporter = JsonLinesItemExporter(f)
        exporter.start_exporting()
        for item in self.items:
            exporter.export_item(item)
        exporter.finish_exporting()

        if f is not bio:
            f.close()  # Close the file if GzipFile

        # Seek to the top of file to be read later
        bio.seek(0)

        return bio
def _make_fileobj(self):
        bio = BytesIO()
        f = gzip.GzipFile(mode='wb', fileobj=bio) if self.use_gzip else bio

        # Build file object using ItemExporter
        exporter = JsonLinesItemExporter(f)
        exporter.start_exporting()
        for item in self.items:
            exporter.export_item(item)
        exporter.finish_exporting()

        if f is not bio:
            f.close()  # Close the file if GzipFile

        # Seek to the top of file to be read later
        bio.seek(0)

        return bio
def _make_fileobj ( self ) : bio = BytesIO ( ) f = gzip . GzipFile ( mode = 'wb' , fileobj = bio ) if self . use_gzip else bio # Build file object using ItemExporter exporter = JsonLinesItemExporter ( f ) exporter . start_exporting ( ) for item in self . items : exporter . export_item ( item ) exporter . finish_exporting ( ) if f is not bio : f . close ( ) # Close the file if GzipFile # Seek to the top of file to be read later bio . seek ( 0 ) return bio
Build file object from items.
Build file object from items .