Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def copy(self, path1, path2, recursive=False, **kwargs):
paths = self.expand_path(path1, recursive=recursive)
path2 = other_paths(paths, path2)
sync(self.loop, self._copy, paths, path2)
def copy(self, path1, path2, recursive=False, **kwargs):
""" Copy within two locations in the filesystem"""
paths = self.expand_path(path1, recursive=recursive)
path2 = other_paths(paths, path2)
for p1, p2 in zip(paths, path2):
self.cp_file(p1, p2, **kwargs)
"""Copy file(s) from local.
Copies a specific file or tree of files (if recursive=True). If rpath
ends with a "/", it will be assumed to be a directory, and target files
will go within.
Calls put_file for each source.
"""
from .implementations.local import make_path_posix, LocalFileSystem
rpath = self._strip_protocol(rpath)
if isinstance(lpath, str):
lpath = make_path_posix(lpath)
fs = LocalFileSystem()
lpaths = fs.expand_path(lpath, recursive=recursive)
rpaths = other_paths(lpaths, rpath)
for lpath, rpath in zip(lpaths, rpaths):
self.put_file(lpath, rpath, **kwargs)
def put(self, lpath, rpath, recursive=False, **kwargs):
from .implementations.local import make_path_posix, LocalFileSystem
rpath = self._strip_protocol(rpath)
if isinstance(lpath, str):
lpath = make_path_posix(lpath)
fs = LocalFileSystem()
lpaths = fs.expand_path(lpath, recursive=recursive)
rpaths = other_paths(lpaths, rpath)
sync(self.loop, self._put, lpaths, rpaths, **kwargs)
def get(self, rpath, lpath, recursive=False, **kwargs):
from fsspec.implementations.local import make_path_posix
rpath = self._strip_protocol(rpath)
lpath = make_path_posix(lpath)
rpaths = self.expand_path(rpath, recursive=recursive)
lpaths = other_paths(rpaths, lpath)
return sync(self.loop, self._get, rpaths, lpaths)
"""Copy file(s) to local.
Copies a specific file or tree of files (if recursive=True). If lpath
ends with a "/", it will be assumed to be a directory, and target files
will go within. Can submit a list of paths, which may be glob-patterns
and will be expanded.
Calls get_file for each source.
"""
from .implementations.local import make_path_posix
rpath = self._strip_protocol(rpath)
if isinstance(lpath, str):
lpath = make_path_posix(lpath)
rpaths = self.expand_path(rpath, recursive=recursive)
lpaths = other_paths(rpaths, lpath)
for lpath, rpath in zip(lpaths, rpaths):
self.get_file(rpath, lpath, **kwargs)