Skip to content

Commit

Permalink
Merge pull request #3220 from jorgeorpinel/master
Browse files Browse the repository at this point in the history
get: copy edits aroud --show-url, "dvc", et al.
  • Loading branch information
efiop authored Jan 23, 2020
2 parents e9caa44 + 69c1aa5 commit da6399d
Show file tree
Hide file tree
Showing 24 changed files with 38 additions and 35 deletions.
2 changes: 1 addition & 1 deletion dvc/__main__.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
4 changes: 2 additions & 2 deletions dvc/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
4 changes: 2 additions & 2 deletions dvc/cache.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""Manages cache of a dvc repo."""
"""Manages cache of a DVC repo."""
import os
from collections import defaultdict

Expand Down Expand Up @@ -58,7 +58,7 @@ def getter(self):


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.
Expand Down
4 changes: 2 additions & 2 deletions dvc/cli.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""Command line interface for dvc."""
"""DVC command line interface"""
import argparse
import logging
import sys
Expand Down Expand Up @@ -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)
Expand Down
3 changes: 2 additions & 1 deletion dvc/command/cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
3 changes: 2 additions & 1 deletion dvc/command/daemon.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
5 changes: 3 additions & 2 deletions dvc/command/get.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def _show_url(self):
)
logger.info(url)
except DvcException:
logger.exception("failed to show url")
logger.exception("failed to show URL")
return 1

return 0
Expand Down Expand Up @@ -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)
4 changes: 2 additions & 2 deletions dvc/command/init.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def run(self):
)
self.config = self.repo.config
except InitError:
logger.exception("failed to initiate dvc")
logger.exception("failed to initiate DVC")
return 1
return 0

Expand All @@ -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(
Expand Down
2 changes: 1 addition & 1 deletion dvc/command/install.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def run(self):
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

Expand Down
2 changes: 1 addition & 1 deletion dvc/command/metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion dvc/command/pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion dvc/command/remote.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion dvc/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions dvc/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def __init__(self, output, repo=None):
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)
)
)
Expand Down Expand Up @@ -112,15 +112,15 @@ def __init__(self, path):


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.
"""

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))
Expand Down
6 changes: 3 additions & 3 deletions dvc/lock.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@


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.
"""
Expand Down Expand Up @@ -80,7 +80,7 @@ def __exit__(self, typ, value, tbck):


class HardlinkLock(flufl.lock.Lock):
"""Class for dvc repo lock.
"""Class for DVC repo lock.
Args:
lockfile (str): the lock filename
Expand Down
2 changes: 1 addition & 1 deletion dvc/logger.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""Manages logging configuration for dvc repo."""
"""Manages logging configuration for DVC repo."""

import traceback
import logging.config
Expand Down
2 changes: 1 addition & 1 deletion dvc/progress.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""Manages progress bars for dvc repo."""
"""Manages progress bars for DVC repo."""

import logging
import sys
Expand Down
2 changes: 1 addition & 1 deletion dvc/remote/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def get_settings(self, name):

if settings is None:
raise ConfigError(
"unable to find remote section '{}'".format(name)
"Unable to find remote section '{}'".format(name)
)

parsed = urlparse(settings["url"])
Expand Down
2 changes: 1 addition & 1 deletion dvc/scm/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion dvc/stage.py
Original file line number Diff line number Diff line change
Expand Up @@ -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))


Expand Down
4 changes: 2 additions & 2 deletions tests/dir_helpers.py
Original file line number Diff line number Diff line change
@@ -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")
Expand Down
2 changes: 1 addition & 1 deletion tests/func/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
4 changes: 2 additions & 2 deletions tests/func/test_get.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,12 +190,12 @@ 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):
tmp_dir.scm_gen({"foo": "foo"}, commit="initial")

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
2 changes: 1 addition & 1 deletion tests/func/test_remote.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")

0 comments on commit da6399d

Please sign in to comment.