Merge pull request #3220 from jorgeorpinel/master

get: copy edits aroud --show-url, "dvc", et al.
This commit is contained in:
Ruslan Kuprieiev
2020-01-23 09:14:00 +02:00
committed by GitHub
24 changed files with 38 additions and 35 deletions
+1 -1
View File
@@ -1,4 +1,4 @@
"""Main entry point for dvc command line tool."""
"""Main entry point for DVC command line tool."""
import sys
from dvc.main import main
+2 -2
View File
@@ -47,11 +47,11 @@ class UrlNotDvcRepoError(DvcException):
"""Thrown if given url is not a DVC repository.
Args:
url (str): url to the repository.
url (str): URL to the repository
"""
def __init__(self, url):
super().__init__("URL '{}' is not a dvc repository.".format(url))
super().__init__("'{}' is not a DVC repository.".format(url))
def get_url(path, repo=None, rev=None, remote=None):
+2 -2
View File
@@ -1,4 +1,4 @@
"""Manages cache of a dvc repo."""
"""Manages cache of a DVC repo."""
import os
from collections import defaultdict
@@ -58,7 +58,7 @@ def _make_remote_property(name):
class Cache(object):
"""Class that manages cache locations of a dvc repo.
"""Class that manages cache locations of a DVC repo.
Args:
repo (dvc.repo.Repo): repo instance that this cache belongs to.
+2 -2
View File
@@ -1,4 +1,4 @@
"""Command line interface for dvc."""
"""DVC command line interface"""
import argparse
import logging
import sys
@@ -170,7 +170,7 @@ def parse_args(argv=None):
title="Available Commands",
metavar="COMMAND",
dest="cmd",
help="Use dvc COMMAND --help for command-specific help.",
help="Use `dvc COMMAND --help` for command-specific help.",
)
fix_subparsers(subparsers)
+2 -1
View File
@@ -30,7 +30,8 @@ def add_parser(subparsers, parent_parser):
)
cache_subparsers = cache_parser.add_subparsers(
dest="cmd", help="Use dvc cache CMD --help for command-specific help."
dest="cmd",
help="Use `dvc cache CMD --help` for command-specific " "help.",
)
fix_subparsers(cache_subparsers)
+2 -1
View File
@@ -44,7 +44,8 @@ def add_parser(subparsers, parent_parser):
)
daemon_subparsers = daemon_parser.add_subparsers(
dest="cmd", help="Use dvc daemon CMD --help for command-specific help."
dest="cmd",
help="Use `dvc daemon CMD --help` for command-specific " "help.",
)
fix_subparsers(daemon_subparsers)
+3 -2
View File
@@ -19,7 +19,7 @@ class CmdGet(CmdBaseNoRepo):
)
logger.info(url)
except DvcException:
logger.exception("failed to show url")
logger.exception("failed to show URL")
return 1
return 0
@@ -78,6 +78,7 @@ def add_parser(subparsers, parent_parser):
get_parser.add_argument(
"--show-url",
action="store_true",
help="Returns path/url to the location in remote for specified path",
help="Print the storage location (URL) the target data would be "
"downloaded from, and exit.",
)
get_parser.set_defaults(func=CmdGet)
+2 -2
View File
@@ -19,7 +19,7 @@ class CmdInit(CmdBaseNoRepo):
)
self.config = self.repo.config
except InitError:
logger.exception("failed to initiate dvc")
logger.exception("failed to initiate DVC")
return 1
return 0
@@ -43,7 +43,7 @@ def add_parser(subparsers, parent_parser):
"--no-scm",
action="store_true",
default=False,
help="Initiate dvc in directory that is "
help="Initiate DVC in directory that is "
"not tracked by any scm tool (e.g. git).",
)
init_parser.add_argument(
+1 -1
View File
@@ -13,7 +13,7 @@ class CmdInstall(CmdBase):
try:
self.repo.install()
except Exception:
logger.exception("failed to install dvc hooks")
logger.exception("failed to install DVC Git hooks")
return 1
return 0
+1 -1
View File
@@ -171,7 +171,7 @@ def add_parser(subparsers, parent_parser):
metrics_subparsers = metrics_parser.add_subparsers(
dest="cmd",
help="Use dvc metrics CMD --help to display command-specific help.",
help="Use `dvc metrics CMD --help` to display command-specific help.",
)
fix_subparsers(metrics_subparsers)
+1 -1
View File
@@ -172,7 +172,7 @@ def add_parser(subparsers, parent_parser):
pipeline_subparsers = pipeline_parser.add_subparsers(
dest="cmd",
help="Use dvc pipeline CMD --help for command-specific help.",
help="Use `dvc pipeline CMD --help` for command-specific help.",
)
fix_subparsers(pipeline_subparsers)
+1 -1
View File
@@ -83,7 +83,7 @@ def add_parser(subparsers, parent_parser):
remote_subparsers = remote_parser.add_subparsers(
dest="cmd",
help="Use dvc remote CMD --help for " "command-specific help.",
help="Use `dvc remote CMD --help` for " "command-specific help.",
)
fix_subparsers(remote_subparsers)
+1 -1
View File
@@ -76,7 +76,7 @@ def Choices(*choices):
class Config(object): # pylint: disable=too-many-instance-attributes
"""Class that manages configuration files for a dvc repo.
"""Class that manages configuration files for a DVC repo.
Args:
dvc_dir (str): optional path to `.dvc` directory, that is used to
+3 -3
View File
@@ -38,7 +38,7 @@ class OutputNotFoundError(DvcException):
self.output = output
self.repo = repo
super().__init__(
"unable to find DVC-file with output '{path}'".format(
"Unable to find DVC-file with output '{path}'".format(
path=relpath(self.output)
)
)
@@ -112,7 +112,7 @@ class MoveNotDataSourceError(DvcException):
class NotDvcRepoError(DvcException):
"""Thrown if a directory is not a dvc repo.
"""Thrown if a directory is not a DVC repo.
Args:
root (str): path to the directory.
@@ -120,7 +120,7 @@ class NotDvcRepoError(DvcException):
def __init__(self, root):
msg = (
"you are not inside of a dvc repository "
"you are not inside of a DVC repository "
"(checked up to mount point '{}')"
)
super().__init__(msg.format(root))
+3 -3
View File
@@ -22,11 +22,11 @@ FAILED_TO_LOCK_MESSAGE = (
class LockError(DvcException):
"""Thrown when unable to acquire the lock for dvc repo."""
"""Thrown when unable to acquire the lock for DVC repo."""
class Lock(object):
"""Class for dvc repo lock.
"""Class for DVC repo lock.
Uses zc.lockfile as backend.
"""
@@ -80,7 +80,7 @@ class Lock(object):
class HardlinkLock(flufl.lock.Lock):
"""Class for dvc repo lock.
"""Class for DVC repo lock.
Args:
lockfile (str): the lock filename
+1 -1
View File
@@ -1,4 +1,4 @@
"""Manages logging configuration for dvc repo."""
"""Manages logging configuration for DVC repo."""
import traceback
import logging.config
+1 -1
View File
@@ -1,4 +1,4 @@
"""Manages progress bars for dvc repo."""
"""Manages progress bars for DVC repo."""
import logging
import sys
+1 -1
View File
@@ -33,7 +33,7 @@ class RemoteConfig(object):
if settings is None:
raise ConfigError(
"unable to find remote section '{}'".format(name)
"Unable to find remote section '{}'".format(name)
)
parsed = urlparse(settings["url"])
+1 -1
View File
@@ -16,7 +16,7 @@ def SCM(root_dir): # pylint: disable=invalid-name
Args:
root_dir (str): path to a root directory of the repo.
repo (dvc.repo.Repo): dvc repo instance that root_dir belongs to.
repo (dvc.repo.Repo): DVC repo instance that root_dir belongs to.
Returns:
dvc.scm.base.Base: SCM instance.
+1 -1
View File
@@ -76,7 +76,7 @@ class StageFileBadNameError(DvcException):
class StagePathOutsideError(DvcException):
def __init__(self, path):
msg = "stage working or file path '{}' is outside of dvc repo"
msg = "stage working or file path '{}' is outside of DVC repo"
super().__init__(msg.format(path))
+2 -2
View File
@@ -1,11 +1,11 @@
"""
The goal of this module is making dvc functional tests setup a breeze. This
includes a temporary dir, initializing git and dvc repos and bootstrapping some
includes a temporary dir, initializing git and DVC repos and bootstrapping some
file structure.
The cornerstone of these fixtures is `tmp_dir`, which creates a temporary dir
and changes path to it, it might be combined with `scm` and `dvc` to initialize
empty git and dvc repos. `tmp_dir` returns a Path instance, which should save
empty git and DVC repos. `tmp_dir` returns a Path instance, which should save
you from using `open()`, `os` and `os.path` utils many times:
(tmp_dir / "some_file").write_text("some text")
+1 -1
View File
@@ -54,7 +54,7 @@ def test_get_url_external(erepo_dir, remote_url):
def test_get_url_requires_dvc(tmp_dir, scm):
tmp_dir.scm_gen({"foo": "foo"}, commit="initial")
with pytest.raises(NotDvcRepoError, match="not inside of a dvc repo"):
with pytest.raises(NotDvcRepoError, match="not inside of a DVC repo"):
api.get_url("foo", repo=fspath(tmp_dir))
with pytest.raises(UrlNotDvcRepoError):
+2 -2
View File
@@ -190,7 +190,7 @@ def test_get_url_not_existing(tmp_dir, erepo_dir, caplog):
main(["get", fspath(erepo_dir), "not-existing-file", "--show-url"])
== 1
)
assert "failed to show url" in caplog.text
assert "failed to show URL" in caplog.text
def test_get_url_git_only_repo(tmp_dir, scm, caplog):
@@ -198,4 +198,4 @@ def test_get_url_git_only_repo(tmp_dir, scm, caplog):
with caplog.at_level(logging.ERROR):
assert main(["get", fspath(tmp_dir), "foo", "--show-url"]) == 1
assert "failed to show url" in caplog.text
assert "failed to show URL" in caplog.text
+1 -1
View File
@@ -255,5 +255,5 @@ def test_raise_on_too_many_open_files(tmp_dir, dvc, tmp_path_factory, mocker):
def test_modify_missing_remote(dvc):
remote_config = RemoteConfig(dvc.config)
with pytest.raises(ConfigError, match=r"unable to find remote section"):
with pytest.raises(ConfigError, match=r"Unable to find remote section"):
remote_config.modify("myremote", "gdrive_client_id", "xxx")