diff --git a/df_io/__init__.py b/df_io/__init__.py index d0322a8..69d040c 100644 --- a/df_io/__init__.py +++ b/df_io/__init__.py @@ -28,6 +28,9 @@ def __init__(self, files, max_workers=None): self._files = files self._executor = ThreadPoolExecutor(max_workers) + def read(self): + raise NotImplemented("Can only write") + def write(self, data): futures = {self._executor.submit(f.write, data): f for f in self._files} for future in as_completed(futures): @@ -46,6 +49,23 @@ def __enter__(self): def __exit__(self, exc_type, exc_value, exc_traceback): self.close() + def __iter__(self, *args, **kwargs): + """Pandas is_file_like needs this to exist.""" + raise NotImplementedError + + def readable(self): + return False + + def seekable(self): + return False + + def writable(self): + return True + + @property + def closed(self): + return all([x.closed for x in self._files]) + def read_df(path, fmt="csv", reader_args=[], reader_options={}): pd_reader = getattr(pd, 'read_{}'.format(fmt)) @@ -149,4 +169,4 @@ def flush_and_close(f): flush_and_close(f) -__version__ = '0.0.7' +__version__ = '0.0.8'