mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-13 07:18:25 +01:00
pylint: enable no-else-return (#5294)
From https://github.com/iterative/dvc/pull/5270#discussion_r559440586
This commit is contained in:
@@ -184,7 +184,8 @@ disable=format,
|
||||
# either give multiple identifier separated by comma (,) or put this option
|
||||
# multiple time (only on the command line, not in the configuration file where
|
||||
# it should appear only once). See also the "--disable" option for examples.
|
||||
enable=c-extension-no-member
|
||||
enable=c-extension-no-member,
|
||||
no-else-return,
|
||||
|
||||
|
||||
[REPORTS]
|
||||
|
||||
Vendored
+1
-2
@@ -355,8 +355,7 @@ class CloudCache:
|
||||
jobs=jobs,
|
||||
no_progress_bar=no_progress_bar,
|
||||
)
|
||||
else:
|
||||
return self._transfer_file(from_tree, from_info)
|
||||
return self._transfer_file(from_tree, from_info)
|
||||
|
||||
def _cache_is_copy(self, path_info):
|
||||
"""Checks whether cache uses copies."""
|
||||
|
||||
@@ -212,9 +212,9 @@ def _format_field(val, precision=DEFAULT_PRECISION):
|
||||
if isinstance(val, float):
|
||||
fmt = f"{{:.{precision}g}}"
|
||||
return fmt.format(val)
|
||||
elif isinstance(val, Mapping):
|
||||
if isinstance(val, Mapping):
|
||||
return {k: _format_field(v) for k, v in val.items()}
|
||||
elif isinstance(val, list):
|
||||
if isinstance(val, list):
|
||||
return [_format_field(x) for x in val]
|
||||
return str(val)
|
||||
|
||||
|
||||
+1
-2
@@ -289,8 +289,7 @@ class DvcIgnoreFilter:
|
||||
ignore_pattern = self._get_trie_pattern(dirname)
|
||||
if ignore_pattern:
|
||||
return ignore_pattern.matches(dirname, basename, is_dir)
|
||||
else:
|
||||
return False
|
||||
return False
|
||||
|
||||
def _is_subrepo(self, path):
|
||||
dirname, basename = os.path.split(os.path.normpath(path))
|
||||
|
||||
@@ -169,18 +169,17 @@ class Container(Node, ABC):
|
||||
if value is None or isinstance(value, PRIMITIVES):
|
||||
assert meta
|
||||
return Value(value, meta=meta)
|
||||
elif isinstance(value, Node):
|
||||
if isinstance(value, Node):
|
||||
return value
|
||||
elif isinstance(value, (list, dict)):
|
||||
if isinstance(value, (list, dict)):
|
||||
assert meta
|
||||
container = CtxDict if isinstance(value, dict) else CtxList
|
||||
return container(value, meta=meta)
|
||||
else:
|
||||
msg = (
|
||||
"Unsupported value of type "
|
||||
f"'{type(value).__name__}' in '{meta}'"
|
||||
)
|
||||
raise TypeError(msg)
|
||||
msg = (
|
||||
"Unsupported value of type "
|
||||
f"'{type(value).__name__}' in '{meta}'"
|
||||
)
|
||||
raise TypeError(msg)
|
||||
|
||||
def __repr__(self):
|
||||
return repr(self.data)
|
||||
|
||||
@@ -109,9 +109,9 @@ def recurse(f):
|
||||
g = rpartial(wrapper, *args)
|
||||
if isinstance(data, Mapping):
|
||||
return {g(k): g(v) for k, v in data.items()}
|
||||
elif isinstance(data, Seq):
|
||||
if isinstance(data, Seq):
|
||||
return type(data)(map(g, data))
|
||||
elif isinstance(data, str):
|
||||
if isinstance(data, str):
|
||||
return f(data, *args)
|
||||
return data
|
||||
|
||||
|
||||
@@ -78,7 +78,7 @@ def merge_patterns(pattern_a, prefix_a, pattern_b, prefix_b):
|
||||
"""
|
||||
if not pattern_a:
|
||||
return pattern_b, prefix_b
|
||||
elif not pattern_b:
|
||||
if not pattern_b:
|
||||
return pattern_a, prefix_a
|
||||
|
||||
longest_common_dir = os.path.commonpath([prefix_a, prefix_b])
|
||||
|
||||
@@ -38,11 +38,11 @@ def plot_data(filename, revision, content):
|
||||
_, extension = os.path.splitext(filename.lower())
|
||||
if extension == ".json":
|
||||
return JSONPlotData(filename, revision, content)
|
||||
elif extension == ".csv":
|
||||
if extension == ".csv":
|
||||
return CSVPlotData(filename, revision, content)
|
||||
elif extension == ".tsv":
|
||||
if extension == ".tsv":
|
||||
return CSVPlotData(filename, revision, content, delimiter="\t")
|
||||
elif extension == ".yaml":
|
||||
if extension == ".yaml":
|
||||
return YAMLPlotData(filename, revision, content)
|
||||
raise PlotMetricTypeError(filename)
|
||||
|
||||
|
||||
+1
-1
@@ -170,7 +170,7 @@ class StageLoad:
|
||||
|
||||
if accept_group and stages.is_foreach_generated(name):
|
||||
return self._get_group_keys(stages, name)
|
||||
elif glob:
|
||||
if glob:
|
||||
return fnmatch.filter(stages.keys(), name)
|
||||
return [name]
|
||||
|
||||
|
||||
@@ -377,8 +377,7 @@ class GitPythonBackend(BaseGitBackend): # pylint:disable=abstract-method
|
||||
try:
|
||||
if follow or self.repo.head.is_detached:
|
||||
return self.repo.head.commit.hexsha
|
||||
else:
|
||||
return f"refs/heads/{self.repo.active_branch}"
|
||||
return f"refs/heads/{self.repo.active_branch}"
|
||||
except (GitCommandError, ValueError):
|
||||
return None
|
||||
elif name.startswith("refs/heads/"):
|
||||
|
||||
@@ -1140,11 +1140,10 @@ def _format_dvc_line(line):
|
||||
if "cache:" in line or "md5:" in line:
|
||||
return line + " # line comment"
|
||||
# Format command as one word per line
|
||||
elif line.startswith("cmd: "):
|
||||
if line.startswith("cmd: "):
|
||||
pre, command = line.split(None, 1)
|
||||
return pre + " >\n" + "\n".join(" " + s for s in command.split())
|
||||
else:
|
||||
return line
|
||||
return line
|
||||
|
||||
|
||||
def test_downstream(dvc):
|
||||
|
||||
Reference in New Issue
Block a user