dvc: fix comment style

This commit is contained in:
Zhanibek
2019-04-05 15:02:28 +06:00
parent 1c9d72942b
commit 3499c277ff
3 changed files with 26 additions and 18 deletions
+9 -8
View File
@@ -94,14 +94,15 @@ def _diff_file(self, target, diff_dct):
def diff(self, target, a_ref=None, b_ref=None):
"""
Gerenates diff message string output
input:
target - file/folder to check diff of
a_ref - first git ref/tag
b_ref(optional) - second git ref/tag
output:
string of output message with diff info
"""Gerenates diff message string output
Args:
target(str) - file/directory to check diff of
a_ref(str) - first git tag
(optional) b_ref(str) - second git tag
Returns:
string: string of output message with diff info
"""
diff_dct = self.scm.diff(target, a_ref=a_ref, b_ref=b_ref)
msg = "dvc diff for '{}' from {} to {} \n\n".format(
+12 -7
View File
@@ -266,7 +266,7 @@ class Git(Base):
except (BadName, BadObject) as e:
raise SCMError(e)
if len(diff_obj) == 0:
msg = "Have not found file/folder '{}' in the commits"
msg = "Have not found file/directory '{}' in the commits"
raise FileNotInRepoError(msg.format(file_name))
return diff_obj[0], commits
@@ -279,11 +279,16 @@ class Git(Base):
return None, None
def diff(self, file_name, a_ref, **kwargs):
"""
function for diff between two git tag commits
returns the dvc hash names of changed file/folder
file_name - file on which to calculate diff
returns dictionary with keys: (new_file, a_file_name, b_file_name)
"""Method for diff between two git tag commits
returns the dvc hash names of changed file/directory
Args:
file_name(str) - file/directory to perform diff of
a_ref(str) - git reference
b_ref(str) - optional second git reference
Returns:
dict - dictionary with keys: (new_file, a_file_name, b_file_name)
"""
diff_dct = {"equal": False}
diff_obj, commit_refs = self._get_diff_obj(file_name, a_ref, **kwargs)
@@ -298,7 +303,7 @@ class Git(Base):
" to dvc?"
)
raise SCMError(msg.format(file_name))
# this function doesn't support an indicating of moved of a file/folder
# function doesn't support an indicating of moved of a file/directory
diff_dct["new_file"] = diff_obj.new_file
diff_dct["deleted_file"] = diff_obj.deleted_file
diff_dct["a_hash"], diff_dct["a_fname"] = self._extract_fname(
+5 -3
View File
@@ -60,7 +60,7 @@ class TestDiffDir(TestDvc):
self.assertEqual(
self.DATA_DIR + ".dvc",
out["file_path"],
"path to file/folder is incorrect",
"path to file/directory is incorrect",
)
@@ -82,7 +82,7 @@ class TestDiffFileNotFound(TestDiffDir):
) as context:
self.dvc.scm.diff(self.unknown_file, self.a_ref)
self.assertTrue(
"Have not found file/folder" in str(context.exception),
"Have not found file/directory" in str(context.exception),
"scm raises with incorrect error message",
)
@@ -93,4 +93,6 @@ class TestDiffFileNotFoundRepo(TestDiffFileNotFound):
FileNotInRepoError, msg="diff with incorrect arg"
) as context:
self.dvc.diff(self.unknown_file, a_ref=self.a_ref)
self.assertTrue("Have not found file/folder" in str(context.exception))
self.assertTrue(
"Have not found file/directory" in str(context.exception)
)