Strip bucket on GdriveFileSystem (#6618)

This commit is contained in:
Saugat Pachhai
2021-09-15 16:12:46 +05:45
committed by GitHub
parent 18d147e2f8
commit 7521e91d05
2 changed files with 10 additions and 3 deletions
+9
View File
@@ -296,6 +296,15 @@ class GDriveFileSystem(FSSpecWrapper): # pylint:disable=abstract-method
return super()._with_bucket(path)
def _strip_bucket(self, entry):
try:
bucket, path = entry.split("/", 1)
except ValueError:
# If there is no path attached, only returns
# the bucket (top-level).
bucket, path = entry, None
return path or bucket
def upload_fobj(self, fobj, to_info, **kwargs):
rpath = self._with_bucket(to_info)
self.makedirs(os.path.dirname(rpath))
+1 -3
View File
@@ -493,9 +493,7 @@ def test_download_callback(tmp_dir, dvc, cloud):
os.name == "nt", reason="unsupported on Windows."
),
),
pytest.param(
pytest.lazy_fixture("gdrive"), marks=pytest.mark.xfail(strict=True)
),
pytest.lazy_fixture("gdrive"),
],
)
def test_download_dir_callback(tmp_dir, dvc, cloud):