Skip to content

Commit

Permalink
fsspec: move more api to fsspec localfs (#162)
Browse files Browse the repository at this point in the history
  • Loading branch information
skshetry authored Oct 20, 2022
1 parent f53a2dc commit af83d0a
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions src/dvc_objects/fs/local.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,23 +22,18 @@ def __init__(self, *args, **kwargs):
self.fs = fsspec.filesystem("file")

def makedirs(self, path, exist_ok=False):
makedirs(path, exist_ok=exist_ok)
self.fs.makedirs(path, exist_ok=exist_ok)

def mkdir(self, path, create_parents=True, **kwargs):
if self.exists(path):
raise FileExistsError(path)
if create_parents:
self.makedirs(path, exist_ok=True)
else:
os.mkdir(path, **kwargs)
self.fs.mkdir(path, create_parents=create_parents, **kwargs)

def lexists(self, path, **kwargs):
return os.path.lexists(path)
return self.fs.lexists(path, **kwargs)

def exists(self, path, **kwargs):
# TODO: replace this with os.path.exists once the problem is fixed on
# the fsspec https://github.com/intake/filesystem_spec/issues/742
return os.path.lexists(path)
return self.lexists(path)

def checksum(self, path) -> str:
from fsspec.utils import tokenize
Expand Down Expand Up @@ -112,7 +107,7 @@ def mv(self, path1, path2, **kwargs):
move(path1, path2)

def rmdir(self, path):
os.rmdir(path)
self.fs.rmdir(path)

def rm_file(self, path):
remove(path)
Expand Down

0 comments on commit af83d0a

Please sign in to comment.