From 3b6a1c441edd4d0343b3427c40bbde3a068fd8a4 Mon Sep 17 00:00:00 2001 From: Jorge Orpinel Date: Mon, 12 Oct 2020 04:51:57 -0500 Subject: [PATCH] term: "metrics" plural in output messages (#4699) * api: update to latest definitions to match iterative/dvc.org/pull/908 * Update dvc/api.py * metrics show: update -h output to match docs per https://github.com/iterative/dvc.org/pull/1014/commits/2c3452119545987f77b764e4aa6fc94d051092a7 * api: update docstrings to match iterative/dvc.org/pull/908 * api: refactor DVC repo check in get_url, and document it * dvc: cosmetic edits as I explored exceptions that api functions may raise * api: copy default info to read() docstring from open() per https://github.com/iterative/dvc/pull/3426#pullrequestreview-366949501 * api: improve open() docstring for clarity and add example per https://github.com/iterative/dvc/pull/3426#pullrequestreview-366956856 * api: remove unnecessary info from get_url docstring per https://github.com/iterative/dvc/pull/3426#discussion_r386203064 * api: produces->generated in open() docstring * api: simplify open docstring per https://github.com/iterative/dvc/pull/3426#discussion_r388218147 * term: "metrics" plural in output messages https://github.com/iterative/dvc.org/pull/1848#pullrequestreview-506217071 * typo Co-authored-by: Ruslan Kuprieiev --- dvc/api.py | 2 +- dvc/command/metrics.py | 13 ++++++------- dvc/command/plots.py | 4 ++-- dvc/command/run.py | 4 ++-- dvc/dependency/__init__.py | 2 +- dvc/exceptions.py | 6 +++--- dvc/repo/metrics/show.py | 4 ++-- 7 files changed, 17 insertions(+), 18 deletions(-) diff --git a/dvc/api.py b/dvc/api.py index d7c584b36..f9b2f4fe5 100644 --- a/dvc/api.py +++ b/dvc/api.py @@ -20,7 +20,7 @@ def get_url(path, repo=None, rev=None, remote=None): in a DVC repo. For Git repos, HEAD is used unless a rev argument is supplied. The default remote is tried unless a remote argument is supplied. - Raises OutputNotFoundError if the file is not a dvc-tracked file. + Raises OutputNotFoundError if the file is not tracked by DVC. NOTE: This function does not check for the actual existence of the file or directory in the remote storage. diff --git a/dvc/command/metrics.py b/dvc/command/metrics.py index 9daf5984a..de1147969 100644 --- a/dvc/command/metrics.py +++ b/dvc/command/metrics.py @@ -171,9 +171,8 @@ def add_parser(subparsers, parent_parser): "targets", nargs="*", help=( - "Limit command scope to these metric files (supports any file, " - "even when not found as `metrics` in `dvc.yaml`). Using -R, " - "directories to search metric files in can also be given." + "Limit command scope to these metrics files. Using -R, " + "directories to search metrics files in can also be given." ), ).complete = completion.FILE metrics_show_parser.add_argument( @@ -209,7 +208,7 @@ def add_parser(subparsers, parent_parser): default=False, help=( "If any target is a directory, recursively search and process " - "metric files." + "metrics files." ), ) metrics_show_parser.set_defaults(func=CmdMetricsShow) @@ -237,8 +236,8 @@ def add_parser(subparsers, parent_parser): "--targets", nargs="*", help=( - "Limit command scope to these metric files. Using -R, " - "directories to search metric files in can also be given." + "Limit command scope to these metrics files. Using -R, " + "directories to search metrics files in can also be given." ), metavar="", ).complete = completion.FILE @@ -249,7 +248,7 @@ def add_parser(subparsers, parent_parser): default=False, help=( "If any target is a directory, recursively search and process " - "metric files." + "metrics files." ), ) metrics_diff_parser.add_argument( diff --git a/dvc/command/plots.py b/dvc/command/plots.py index e100c9189..ed4ade772 100644 --- a/dvc/command/plots.py +++ b/dvc/command/plots.py @@ -124,7 +124,7 @@ def add_parser(subparsers, parent_parser): fix_subparsers(plots_subparsers) - SHOW_HELP = "Generate plots from metric files." + SHOW_HELP = "Generate plots from metrics files." plots_show_parser = plots_subparsers.add_parser( "show", parents=[parent_parser], @@ -176,7 +176,7 @@ def add_parser(subparsers, parent_parser): _add_output_arguments(plots_diff_parser) plots_diff_parser.set_defaults(func=CmdPlotsDiff) - PLOTS_MODIFY_HELP = "Modify display properties of plot metric files." + PLOTS_MODIFY_HELP = "Modify display properties of plot metrics files." plots_modify_parser = plots_subparsers.add_parser( "modify", parents=[parent_parser], diff --git a/dvc/command/run.py b/dvc/command/run.py index 3278eaceb..735fc044e 100644 --- a/dvc/command/run.py +++ b/dvc/command/run.py @@ -134,7 +134,7 @@ def add_parser(subparsers, parent_parser): "--metrics", action="append", default=[], - help="Declare output metric file.", + help="Declare output metrics file.", metavar="", ) run_parser.add_argument( @@ -142,7 +142,7 @@ def add_parser(subparsers, parent_parser): "--metrics-no-cache", action="append", default=[], - help="Declare output metric file (do not put into DVC cache).", + help="Declare output metrics file (do not put into DVC cache).", metavar="", ) run_parser.add_argument( diff --git a/dvc/dependency/__init__.py b/dvc/dependency/__init__.py index 76e1c87cc..7ed45fd96 100644 --- a/dvc/dependency/__init__.py +++ b/dvc/dependency/__init__.py @@ -49,7 +49,7 @@ DEP_MAP = { # NOTE: schema for dependencies is basically the same as for outputs, but # without output-specific entries like 'cache' (whether or not output is # cached, see -o and -O flags for `dvc run`) and 'metric' (whether or not -# output is a metric file and how to parse it, see `-M` flag for `dvc run`). +# output is a metrics file and how to parse it, see `-M` flag for `dvc run`). SCHEMA = output.SCHEMA.copy() del SCHEMA[BaseOutput.PARAM_CACHE] del SCHEMA[BaseOutput.PARAM_METRIC] diff --git a/dvc/exceptions.py b/dvc/exceptions.py index fad60df90..783e4eec9 100644 --- a/dvc/exceptions.py +++ b/dvc/exceptions.py @@ -42,7 +42,7 @@ class OutputDuplicationError(DvcException): class OutputNotFoundError(DvcException): - """Thrown if a file/directory not found in repository pipelines. + """Thrown if a file/directory is not found as an output in any pipeline. Args: output (unicode): path to the file/directory. @@ -105,7 +105,7 @@ class ArgumentDuplicationError(DvcException): class MoveNotDataSourceError(DvcException): - """Thrown if attempted to move a file/directory that is not an output + """Thrown when trying to move a file/directory that is not an output in a data source stage. Args: @@ -164,7 +164,7 @@ class BadMetricError(DvcException): def __init__(self, paths): super().__init__( "the following metrics do not exist, " - "are not metric files or are malformed: {paths}".format( + "are not metrics files or are malformed: {paths}".format( paths=", ".join(f"'{path}'" for path in paths) ) ) diff --git a/dvc/repo/metrics/show.py b/dvc/repo/metrics/show.py index 81a34151e..9d3d2c956 100644 --- a/dvc/repo/metrics/show.py +++ b/dvc/repo/metrics/show.py @@ -100,12 +100,12 @@ def show( if not res: if metrics_found: msg = ( - "Could not parse metric files. Use `-v` option to see more " + "Could not parse metrics files. Use `-v` option to see more " "details." ) else: msg = ( - "no metric files in this repository. Use `-m/-M` options for " + "no metrics files in this repository. Use `-m/-M` options for " "`dvc run` to mark stage outputs as metrics." ) raise NoMetricsError(msg)