diff --git a/dvc/api.py b/dvc/api.py index bf976dcf0..8da4cf6ba 100644 --- a/dvc/api.py +++ b/dvc/api.py @@ -15,7 +15,7 @@ def get_url(path, repo=None, rev=None, remote=None): """Returns an url of a resource specified by path in repo""" with _make_repo(repo, rev=rev) as _repo: abspath = os.path.join(_repo.root_dir, path) - out, = _repo.find_outs_by_path(abspath) + (out,) = _repo.find_outs_by_path(abspath) remote_obj = _repo.cloud.get_remote(remote) return str(remote_obj.checksum_to_path_info(out.checksum)) diff --git a/dvc/repo/__init__.py b/dvc/repo/__init__.py index 8a0afc2d3..94f792880 100644 --- a/dvc/repo/__init__.py +++ b/dvc/repo/__init__.py @@ -263,7 +263,7 @@ class Repo(object): for stage in stages: if stage.is_repo_import: - dep, = stage.deps + (dep,) = stage.deps cache.external[dep.repo_pair].add(dep.def_path) continue @@ -445,7 +445,7 @@ class Repo(object): def find_out_by_relpath(self, relpath): path = os.path.join(self.root_dir, relpath) - out, = self.find_outs_by_path(path) + (out,) = self.find_outs_by_path(path) return out def is_dvc_internal(self, path): @@ -457,7 +457,7 @@ class Repo(object): """Opens a specified resource as a file descriptor""" cause = None try: - out, = self.find_outs_by_path(path) + (out,) = self.find_outs_by_path(path) except OutputNotFoundError as e: out = None cause = e diff --git a/dvc/repo/get_url.py b/dvc/repo/get_url.py index fbc173b64..5718b20ec 100644 --- a/dvc/repo/get_url.py +++ b/dvc/repo/get_url.py @@ -14,6 +14,6 @@ def get_url(url, out=None): out = os.path.abspath(out) - dep, = dependency.loads_from(None, [url]) - out, = output.loads_from(None, [out], use_cache=False) + (dep,) = dependency.loads_from(None, [url]) + (out,) = output.loads_from(None, [out], use_cache=False) dep.download(out) diff --git a/setup.py b/setup.py index 29a4a0936..81dadf1cb 100644 --- a/setup.py +++ b/setup.py @@ -141,7 +141,7 @@ tests_requirements = [ ] if (sys.version_info) >= (3, 6): - tests_requirements.append("black==19.3b0") + tests_requirements.append("black==19.10b0") setup( name="dvc", diff --git a/tests/func/test_add.py b/tests/func/test_add.py index 8a76263da..bbb4fc4bf 100644 --- a/tests/func/test_add.py +++ b/tests/func/test_add.py @@ -32,7 +32,7 @@ from tests.utils import spy def test_add(tmp_dir, dvc): - stage, = tmp_dir.dvc_gen({"foo": "foo"}) + (stage,) = tmp_dir.dvc_gen({"foo": "foo"}) md5, _ = file_md5("foo") assert stage is not None @@ -50,7 +50,7 @@ def test_add_unicode(tmp_dir, dvc): with open("\xe1", "wb") as fd: fd.write("something".encode("utf-8")) - stage, = dvc.add("\xe1") + (stage,) = dvc.add("\xe1") assert os.path.isfile(stage.path) @@ -61,7 +61,7 @@ def test_add_unsupported_file(dvc): def test_add_directory(tmp_dir, dvc): - stage, = tmp_dir.dvc_gen({"dir": {"file": "file"}}) + (stage,) = tmp_dir.dvc_gen({"dir": {"file": "file"}}) assert stage is not None assert len(stage.deps) == 0 @@ -162,7 +162,7 @@ def test_add_file_in_dir(tmp_dir, dvc): tmp_dir.gen({"dir": {"subdir": {"subdata": "subdata content"}}}) subdir_path = os.path.join("dir", "subdir", "subdata") - stage, = dvc.add(subdir_path) + (stage,) = dvc.add(subdir_path) assert stage is not None assert len(stage.deps) == 0 diff --git a/tests/func/test_api.py b/tests/func/test_api.py index 54623c080..b6ddc9dd5 100644 --- a/tests/func/test_api.py +++ b/tests/func/test_api.py @@ -101,7 +101,7 @@ def _set_remote_url_and_commit(repo, remote_url): # FIXME: this test doesn't use scm ;D def test_open_scm_controlled(dvc_repo, repo_dir): - stage, = dvc_repo.add(repo_dir.FOO) + (stage,) = dvc_repo.add(repo_dir.FOO) stage_content = open(stage.path, "r").read() with api.open(stage.path) as fd: diff --git a/tests/func/test_commit.py b/tests/func/test_commit.py index 8d6a8e57d..85c3623b5 100644 --- a/tests/func/test_commit.py +++ b/tests/func/test_commit.py @@ -20,7 +20,7 @@ def test_commit_recursive(tmp_dir, dvc): def test_commit_force(tmp_dir, dvc): tmp_dir.gen({"dir": {"file": "text1", "file2": "text2"}}) - stage, = dvc.add("dir", no_commit=True) + (stage,) = dvc.add("dir", no_commit=True) with dvc.state: assert stage.outs[0].changed_cache() @@ -42,7 +42,7 @@ def test_commit_force(tmp_dir, dvc): def test_commit_with_deps(tmp_dir, dvc, run_copy): tmp_dir.gen("foo", "foo") - foo_stage, = dvc.add("foo", no_commit=True) + (foo_stage,) = dvc.add("foo", no_commit=True) assert foo_stage is not None assert len(foo_stage.outs) == 1 @@ -62,7 +62,7 @@ def test_commit_with_deps(tmp_dir, dvc, run_copy): def test_commit_changed_md5(tmp_dir, dvc): tmp_dir.gen({"file": "file content"}) - stage, = dvc.add("file", no_commit=True) + (stage,) = dvc.add("file", no_commit=True) stage_file_content = load_stage_file(stage.path) stage_file_content["md5"] = "1111111111" diff --git a/tests/func/test_gc.py b/tests/func/test_gc.py index 7d06cb9a3..2fb46eb0c 100644 --- a/tests/func/test_gc.py +++ b/tests/func/test_gc.py @@ -192,7 +192,7 @@ def test_all_commits(tmp_dir, scm, dvc): def test_gc_no_dir_cache(tmp_dir, dvc, repo_template): dvc.add(["foo", "bar"]) - dir_stage, = dvc.add("dir") + (dir_stage,) = dvc.add("dir") os.unlink(dir_stage.outs[0].cache_path) diff --git a/tests/func/test_stage.py b/tests/func/test_stage.py index b87a32d76..d4e9e8b97 100644 --- a/tests/func/test_stage.py +++ b/tests/func/test_stage.py @@ -155,7 +155,7 @@ class TestExternalRemoteResolution(TestDvc): def test_md5_ignores_comments(repo_dir, dvc_repo): - stage, = dvc_repo.add("foo") + (stage,) = dvc_repo.add("foo") with open(stage.path, "a") as f: f.write("# End comment\n") @@ -165,7 +165,7 @@ def test_md5_ignores_comments(repo_dir, dvc_repo): def test_meta_is_preserved(dvc_repo): - stage, = dvc_repo.add("foo") + (stage,) = dvc_repo.add("foo") # Add meta to DVC-file data = load_stage_file(stage.path) diff --git a/tests/unit/test_repo.py b/tests/unit/test_repo.py index aafec4de0..2e0720a45 100644 --- a/tests/unit/test_repo.py +++ b/tests/unit/test_repo.py @@ -12,8 +12,8 @@ def test_is_dvc_internal(tmp_dir, dvc): def test_destroy(tmp_dir, dvc): dvc.config.set("cache", "type", "symlink") - tmp_dir.dvc_gen('file', 'text') - tmp_dir.dvc_gen({'dir': {'file': 'lorem', 'subdir/file': 'ipsum'}}) + tmp_dir.dvc_gen("file", "text") + tmp_dir.dvc_gen({"dir": {"file": "lorem", "subdir/file": "ipsum"}}) dvc.destroy()