Ejemplo n.º 1
0
    def __call__(self, *args, **kwargs):
        import partd

        path = tempfile.mkdtemp(suffix=".partd", dir=self.tempdir)

        try:
            partd_compression = (
                getattr(partd.compressed, self.compression)
                if self.compression
                else None
            )
        except AttributeError as e:
            raise ImportError(
                "Not able to import and load {0} as compression algorithm."
                "Please check if the library is installed and supported by Partd.".format(
                    self.compression
                )
            ) from e
        file = partd.File(path)
        partd.file.cleanup_files.append(path)
        # Envelope partd file with compression, if set and available
        if partd_compression:
            file = partd_compression(file)
        if self.buffer:
            return partd.PandasBlocks(partd.Buffer(partd.Dict(), file))
        else:
            return partd.PandasBlocks(file)
Ejemplo n.º 2
0
 def __call__(self, *args, **kwargs):
     import partd
     if self.tempdir:
         file = partd.File(dir=self.tempdir)
     else:
         file = partd.File()
     if self.buffer:
         return partd.PandasBlocks(partd.Buffer(partd.Dict(), file))
     else:
         return partd.PandasBlocks(file)
Ejemplo n.º 3
0
 def __call__(self, *args, **kwargs):
     import partd
     if self.buffer:
         return partd.PandasBlocks(partd.Buffer(partd.Dict(), partd.File()))
     else:
         return partd.PandasBlocks(partd.File())