Skip to content

Commit

Permalink
dvc: use replace instead of posixpath
Browse files Browse the repository at this point in the history
  • Loading branch information
skshetry committed Nov 28, 2019
1 parent 0c08c09 commit fe248aa
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions dvc/remote/gs.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
from functools import wraps
import io
import os.path
import posixpath

from funcy import cached_property

Expand Down Expand Up @@ -148,7 +147,7 @@ def list_cache_paths(self):

def walk_files(self, path_info):
for fname in self._list_paths(path_info.bucket, path_info.path):
yield path_info / posixpath.relpath(fname, path_info.path)
yield path_info.replace(fname)

def isdir(self, path_info):
dir_path = path_info / ""
Expand All @@ -160,10 +159,10 @@ def isdir(self, path_info):

def exists(self, path_info):
dir_path = path_info / ""
file = next(
fname = next(
self._list_paths(path_info.bucket, path_info.path, max_items=1), ""
)
return path_info.path == file or file.startswith(dir_path.path)
return path_info.path == fname or fname.startswith(dir_path.path)

def _upload(self, from_file, to_info, name=None, no_progress_bar=True):
bucket = self.gs.bucket(to_info.bucket)
Expand Down

0 comments on commit fe248aa

Please sign in to comment.