💅 black

This commit is contained in:
Mr. Outis
2019-12-13 18:04:15 -06:00
parent 37a2844a74
commit 299fb9022f
10 changed files with 20 additions and 20 deletions
+1 -1
View File
@@ -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))
+3 -3
View File
@@ -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
+2 -2
View File
@@ -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)
+1 -1
View File
@@ -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",
+4 -4
View File
@@ -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
+1 -1
View File
@@ -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:
+3 -3
View File
@@ -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"
+1 -1
View File
@@ -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)
+2 -2
View File
@@ -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)
+2 -2
View File
@@ -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()