diff --git a/fsspec/asyn.py b/fsspec/asyn.py index a040efc4b..31a816836 100644 --- a/fsspec/asyn.py +++ b/fsspec/asyn.py @@ -577,7 +577,7 @@ async def _put( rdirs = [r for l, r in zip(lpaths, rpaths) if is_dir[l]] file_pairs = [(l, r) for l, r in zip(lpaths, rpaths) if not is_dir[l]] - await asyncio.gather(*[self._makedirs(d, exist_ok=True) for d in rdirs]) + await self._bulk_makedirs(rdirs, exist_ok=True) batch_size = batch_size or self.batch_size coros = [] @@ -590,6 +590,9 @@ async def _put( coros, batch_size=batch_size, callback=callback ) + async def _bulk_makedirs(self, dirs, **kw): + await asyncio.gather(*[self._makedirs(_, **kw) for _ in dirs]) + async def _get_file(self, rpath, lpath, **kwargs): raise NotImplementedError diff --git a/fsspec/spec.py b/fsspec/spec.py index 9a7e4e8b9..f830f7c2c 100644 --- a/fsspec/spec.py +++ b/fsspec/spec.py @@ -306,6 +306,9 @@ def makedirs(self, path, exist_ok=False): """ pass # not necessary to implement, may not have directories + def bulk_makedirs(self, path, **kw): + [self.makedirs(_, **kw) for _ in path] + def rmdir(self, path): """Remove a directory, if empty""" pass # not necessary to implement, may not have directories