mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-02 07:18:25 +01:00
Upgrade to modern Python syntax (#6296)
This commit is contained in:
@@ -39,7 +39,7 @@ class CmdDataStatus(CmdDataBase):
|
||||
|
||||
for key, value in status.items():
|
||||
if isinstance(value, str):
|
||||
ui.write("{}{}{}".format(ind, self._normalize(value), key))
|
||||
ui.write(f"{ind}{self._normalize(value)}{key}")
|
||||
elif value:
|
||||
ui.write(f"{ind}{key}:")
|
||||
self._show(value, indent + 1)
|
||||
|
||||
@@ -41,7 +41,7 @@ class RepoDependency(Dependency):
|
||||
return False
|
||||
|
||||
def __str__(self):
|
||||
return "{} ({})".format(self.def_path, self.def_repo[self.PARAM_URL])
|
||||
return f"{self.def_path} ({self.def_repo[self.PARAM_URL]})"
|
||||
|
||||
def workspace_status(self):
|
||||
current = self.get_obj(locked=True).hash_info
|
||||
|
||||
+2
-4
@@ -200,9 +200,7 @@ class SingleStageFile(FileMixin):
|
||||
assert not isinstance(stage, PipelineStage)
|
||||
if self.verify:
|
||||
check_dvcfile_path(self.repo, self.path)
|
||||
logger.debug(
|
||||
"Saving information to '{file}'.".format(file=relpath(self.path))
|
||||
)
|
||||
logger.debug(f"Saving information to '{relpath(self.path)}'.")
|
||||
dump_yaml(self.path, serialize.to_single_stage_file(stage))
|
||||
self.repo.scm.track_file(self.relpath)
|
||||
|
||||
@@ -300,7 +298,7 @@ class PipelineFile(FileMixin):
|
||||
if not self.exists():
|
||||
return
|
||||
|
||||
with open(self.path, "r", encoding="utf-8") as f:
|
||||
with open(self.path, encoding="utf-8") as f:
|
||||
d = parse_yaml_for_update(f.read(), self.path)
|
||||
|
||||
self.validate(d, self.path)
|
||||
|
||||
+2
-2
@@ -57,7 +57,7 @@ class DvcIgnorePatterns(DvcIgnore):
|
||||
dirname = os.path.normpath(os.path.dirname(path))
|
||||
with fs.open(path, encoding="utf-8") as fobj:
|
||||
path_spec_lines = [
|
||||
PatternInfo(line, "{}:{}:{}".format(name, line_no + 1, line))
|
||||
PatternInfo(line, f"{name}:{line_no + 1}:{line}")
|
||||
for line_no, line in enumerate(
|
||||
map(str.strip, fobj.readlines())
|
||||
)
|
||||
@@ -166,7 +166,7 @@ class DvcIgnoreFilter:
|
||||
".hg/",
|
||||
".git/",
|
||||
".git",
|
||||
"{}/".format(Repo.DVC_DIR),
|
||||
f"{Repo.DVC_DIR}/",
|
||||
]
|
||||
|
||||
self.fs = fs
|
||||
|
||||
+2
-4
@@ -42,9 +42,7 @@ def get_dvc_info():
|
||||
# later decides to enable shared cache mode with
|
||||
# `dvc config cache.shared group`.
|
||||
if os.path.exists(repo.odb.local.cache_dir):
|
||||
info.append(
|
||||
"Cache types: {}".format(_get_linktype_support_info(repo))
|
||||
)
|
||||
info.append(f"Cache types: {_get_linktype_support_info(repo)}")
|
||||
fs_type = get_fs_type(repo.odb.local.cache_dir)
|
||||
info.append(f"Cache directory: {fs_type}")
|
||||
else:
|
||||
@@ -56,7 +54,7 @@ def get_dvc_info():
|
||||
root_directory = repo.root_dir
|
||||
fs_root = get_fs_type(os.path.abspath(root_directory))
|
||||
info.append(f"Workspace directory: {fs_root}")
|
||||
info.append("Repo: {}".format(_get_dvc_repo_info(repo)))
|
||||
info.append(f"Repo: {_get_dvc_repo_info(repo)}")
|
||||
except NotDvcRepoError:
|
||||
pass
|
||||
except SCMError:
|
||||
|
||||
+1
-1
@@ -62,7 +62,7 @@ def addLoggingLevel(levelName, levelNum, methodName=None):
|
||||
|
||||
class LoggingException(Exception):
|
||||
def __init__(self, record):
|
||||
msg = "failed to log {}".format(str(record))
|
||||
msg = f"failed to log {str(record)}"
|
||||
super().__init__(msg)
|
||||
|
||||
|
||||
|
||||
@@ -396,9 +396,7 @@ class ObjectDB:
|
||||
"""Return list of the specified hashes which exist in this fs.
|
||||
Hashes will be queried individually.
|
||||
"""
|
||||
logger.debug(
|
||||
"Querying {} hashes via object_exists".format(len(hashes))
|
||||
)
|
||||
logger.debug(f"Querying {len(hashes)} hashes via object_exists")
|
||||
with Tqdm(
|
||||
desc="Querying "
|
||||
+ ("cache in " + name if name else "remote cache"),
|
||||
@@ -493,7 +491,7 @@ class ObjectDB:
|
||||
hashes - remote_hashes, jobs, name
|
||||
)
|
||||
|
||||
logger.debug("Querying '{}' hashes via traverse".format(len(hashes)))
|
||||
logger.debug(f"Querying '{len(hashes)}' hashes via traverse")
|
||||
remote_hashes = set(
|
||||
self.list_hashes_traverse(remote_size, remote_hashes, jobs, name)
|
||||
)
|
||||
|
||||
@@ -112,7 +112,7 @@ class LocalObjectDB(ObjectDB):
|
||||
# would get only the part of file. So, at first, the file should be
|
||||
# copied with the temporary name, and then original file should be
|
||||
# replaced by new.
|
||||
copyfile(path, tmp, name="Unprotecting '{}'".format(relpath(path)))
|
||||
copyfile(path, tmp, name=f"Unprotecting '{relpath(path)}'")
|
||||
remove(path)
|
||||
os.rename(tmp, path)
|
||||
|
||||
|
||||
+2
-2
@@ -52,7 +52,7 @@ class PathInfo(pathlib.PurePath, _BasePath):
|
||||
return relpath(path)
|
||||
|
||||
def __repr__(self):
|
||||
return "{}: '{}'".format(type(self).__name__, self)
|
||||
return f"{type(self).__name__}: '{self}'"
|
||||
|
||||
# This permits passing it to file utils directly in Python 3.6+
|
||||
def __fspath__(self):
|
||||
@@ -174,7 +174,7 @@ class URLInfo(_BasePath):
|
||||
return self.url
|
||||
|
||||
def __repr__(self):
|
||||
return "{}: '{}'".format(type(self).__name__, self)
|
||||
return f"{type(self).__name__}: '{self}'"
|
||||
|
||||
def __eq__(self, other):
|
||||
if isinstance(other, (str, bytes)):
|
||||
|
||||
+1
-1
@@ -138,7 +138,7 @@ class Remote:
|
||||
indexed_hashes = set(self.index.intersection(hashes))
|
||||
hashes -= indexed_hashes
|
||||
indexed_hashes = list(indexed_hashes)
|
||||
logger.debug("Matched '{}' indexed hashes".format(len(indexed_hashes)))
|
||||
logger.debug(f"Matched '{len(indexed_hashes)}' indexed hashes")
|
||||
if not hashes:
|
||||
return indexed_hashes
|
||||
|
||||
|
||||
@@ -585,7 +585,7 @@ class Experiments:
|
||||
|
||||
logger.debug(
|
||||
"Reproducing experiment revs '%s'",
|
||||
", ".join((rev[:7] for rev in to_run)),
|
||||
", ".join(rev[:7] for rev in to_run),
|
||||
)
|
||||
|
||||
executors = self._init_executors(to_run)
|
||||
|
||||
@@ -84,7 +84,7 @@ class Template:
|
||||
|
||||
@classmethod
|
||||
def _anchor_str(cls, name):
|
||||
return '"{}"'.format(cls.anchor(name))
|
||||
return f'"{cls.anchor(name)}"'
|
||||
|
||||
@classmethod
|
||||
def _fill_metadata(cls, content, props):
|
||||
|
||||
+1
-3
@@ -28,9 +28,7 @@ class RWLockFileCorruptedError(DvcException):
|
||||
|
||||
class RWLockFileFormatError(DvcException):
|
||||
def __init__(self, path):
|
||||
super().__init__(
|
||||
"RWLock-file '{}' format error.".format(relpath(path))
|
||||
)
|
||||
super().__init__(f"RWLock-file '{relpath(path)}' format error.")
|
||||
|
||||
|
||||
@contextmanager
|
||||
|
||||
@@ -163,7 +163,7 @@ class Git(Base):
|
||||
if self.is_ignored(path):
|
||||
return
|
||||
|
||||
msg = "Adding '{}' to '{}'.".format(relpath(path), relpath(gitignore))
|
||||
msg = f"Adding '{relpath(path)}' to '{relpath(gitignore)}'."
|
||||
logger.debug(msg)
|
||||
|
||||
self._add_entry_to_gitignore(entry, gitignore)
|
||||
|
||||
@@ -46,7 +46,7 @@ class Stash:
|
||||
|
||||
def pop(self):
|
||||
logger.debug("Popping from stash '%s'", self.ref)
|
||||
ref = "{0}@{{0}}".format(self.ref)
|
||||
ref = f"{self.ref}@{{0}}"
|
||||
rev = self.scm.resolve_rev(ref)
|
||||
try:
|
||||
self.apply(rev)
|
||||
|
||||
+1
-1
@@ -116,7 +116,7 @@ def _get_monitor_tasks(stage, checkpoint_func, proc):
|
||||
|
||||
result.append(CheckpointTask(stage, checkpoint_func, proc))
|
||||
|
||||
live = first((o for o in stage.outs if (o.live and o.live["html"])))
|
||||
live = first(o for o in stage.outs if (o.live and o.live["html"]))
|
||||
if live:
|
||||
from .monitor import LiveTask
|
||||
|
||||
|
||||
@@ -170,10 +170,10 @@ def to_single_stage_lockfile(stage: "Stage") -> dict:
|
||||
|
||||
res = OrderedDict([("cmd", stage.cmd)])
|
||||
params, deps = split_params_deps(stage)
|
||||
deps, outs = [
|
||||
deps, outs = (
|
||||
[_dumpd(item) for item in sort_by_path(items)]
|
||||
for items in [deps, stage.outs]
|
||||
]
|
||||
)
|
||||
params = _serialize_params_values(params)
|
||||
if deps:
|
||||
res[PARAM_DEPS] = deps
|
||||
|
||||
+1
-1
@@ -82,7 +82,7 @@ def write(
|
||||
):
|
||||
page_html = None
|
||||
if template_path:
|
||||
with open(template_path, "r") as fobj:
|
||||
with open(template_path) as fobj:
|
||||
page_html = fobj.read()
|
||||
|
||||
document = HTML(page_html)
|
||||
|
||||
+1
-2
@@ -81,8 +81,7 @@ def get_args(cls, dist, header=None): # noqa: D205,D400
|
||||
)
|
||||
# pylint: disable=E1101,protected-access
|
||||
args = cls._get_script_args(type_, name, header, script_text)
|
||||
for res in args:
|
||||
yield res
|
||||
yield from args
|
||||
|
||||
|
||||
# pylint: disable=E1101
|
||||
|
||||
@@ -39,7 +39,7 @@ class build_py(_build_py):
|
||||
self.mkpath(path)
|
||||
with open(os.path.join(path, "version.py"), "w") as fobj:
|
||||
fobj.write("# AUTOGENERATED at build time by setup.py\n")
|
||||
fobj.write('__version__ = "{}"\n'.format(version))
|
||||
fobj.write(f'__version__ = "{version}"\n')
|
||||
|
||||
def run(self):
|
||||
self.execute(self.pin_version, ())
|
||||
@@ -123,7 +123,7 @@ setup(
|
||||
name="dvc",
|
||||
version=version,
|
||||
description="Git for data scientists - manage your code and data together",
|
||||
long_description=open("README.rst", "r", encoding="UTF-8").read(),
|
||||
long_description=open("README.rst", encoding="UTF-8").read(),
|
||||
author="Dmitry Petrov",
|
||||
author_email="[email protected]",
|
||||
download_url="https://github.com/iterative/dvc",
|
||||
|
||||
@@ -9,7 +9,7 @@ from dvc.repo.experiments.utils import exp_refs_by_rev
|
||||
|
||||
@pytest.fixture
|
||||
def git_upstream(tmp_dir, erepo_dir):
|
||||
url = "file://{}".format(erepo_dir.resolve().as_posix())
|
||||
url = f"file://{erepo_dir.resolve().as_posix()}"
|
||||
tmp_dir.scm.gitpython.repo.create_remote("upstream", url)
|
||||
erepo_dir.remote = "upstream"
|
||||
erepo_dir.url = url
|
||||
@@ -18,7 +18,7 @@ def git_upstream(tmp_dir, erepo_dir):
|
||||
|
||||
@pytest.fixture
|
||||
def git_downstream(tmp_dir, erepo_dir):
|
||||
url = "file://{}".format(tmp_dir.resolve().as_posix())
|
||||
url = f"file://{tmp_dir.resolve().as_posix()}"
|
||||
erepo_dir.scm.gitpython.repo.create_remote("upstream", url)
|
||||
erepo_dir.remote = "upstream"
|
||||
erepo_dir.url = url
|
||||
|
||||
@@ -5,10 +5,10 @@ import shutil
|
||||
import stat
|
||||
import textwrap
|
||||
import time
|
||||
from unittest.mock import call, patch
|
||||
|
||||
import colorama
|
||||
import pytest
|
||||
from mock import call, patch
|
||||
|
||||
import dvc as dvc_module
|
||||
from dvc.dvcfile import DVC_FILE_SUFFIX
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import os
|
||||
|
||||
import mock
|
||||
from unittest import mock
|
||||
|
||||
from dvc.analytics import _scm_in_use
|
||||
from dvc.main import main
|
||||
|
||||
@@ -22,8 +22,8 @@ def test_check_ignore(tmp_dir, dvc, file, ret, output, caplog, capsys):
|
||||
@pytest.mark.parametrize(
|
||||
"file,ret,output",
|
||||
[
|
||||
("file", 0, "{}:1:f*\tfile\n".format(DvcIgnore.DVCIGNORE_FILE)),
|
||||
("foo", 0, "{}:2:!foo\tfoo\n".format(DvcIgnore.DVCIGNORE_FILE)),
|
||||
("file", 0, f"{DvcIgnore.DVCIGNORE_FILE}:1:f*\tfile\n"),
|
||||
("foo", 0, f"{DvcIgnore.DVCIGNORE_FILE}:2:!foo\tfoo\n"),
|
||||
(
|
||||
os.path.join("dir", "foobar"),
|
||||
0,
|
||||
@@ -129,8 +129,8 @@ def test_check_ignore_details_all(tmp_dir, dvc, capsys):
|
||||
|
||||
assert main(["check-ignore", "-d", "-a", "foo"]) == 0
|
||||
out, _ = capsys.readouterr()
|
||||
assert "{}:1:f*\tfoo\n".format(DvcIgnore.DVCIGNORE_FILE) in out
|
||||
assert "{}:2:!foo\tfoo\n".format(DvcIgnore.DVCIGNORE_FILE) in out
|
||||
assert f"{DvcIgnore.DVCIGNORE_FILE}:1:f*\tfoo\n" in out
|
||||
assert f"{DvcIgnore.DVCIGNORE_FILE}:2:!foo\tfoo\n" in out
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
|
||||
@@ -5,9 +5,9 @@ import os
|
||||
import shutil
|
||||
import stat
|
||||
import textwrap
|
||||
from unittest.mock import patch
|
||||
|
||||
import pytest
|
||||
from mock import patch
|
||||
|
||||
from dvc.dvcfile import DVC_FILE_SUFFIX, PIPELINE_FILE, Dvcfile
|
||||
from dvc.exceptions import (
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import os
|
||||
|
||||
from mock import ANY, patch
|
||||
from unittest.mock import ANY, patch
|
||||
|
||||
from dvc.external_repo import CLONES, external_repo
|
||||
from dvc.fs.local import LocalFileSystem
|
||||
|
||||
@@ -266,7 +266,7 @@ def test_get_pipeline_tracked_outs(
|
||||
dvc.scm.commit("add pipeline stage")
|
||||
|
||||
with git_dir.chdir():
|
||||
Repo.get("file:///{}".format(os.fspath(tmp_dir)), "bar", out="baz")
|
||||
Repo.get(f"file:///{os.fspath(tmp_dir)}", "bar", out="baz")
|
||||
assert (git_dir / "baz").read_text() == "foo"
|
||||
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ def _to_pattern_info_list(str_list: List):
|
||||
@pytest.mark.parametrize("filename", ["ignored", "тест"])
|
||||
def test_ignore(tmp_dir, dvc, filename):
|
||||
tmp_dir.gen({"dir": {filename: filename, "other": "text2"}})
|
||||
tmp_dir.gen(DvcIgnore.DVCIGNORE_FILE, "dir/{}".format(filename))
|
||||
tmp_dir.gen(DvcIgnore.DVCIGNORE_FILE, f"dir/{filename}")
|
||||
|
||||
dvc._reset()
|
||||
|
||||
@@ -342,17 +342,17 @@ def test_pattern_trie_fs(tmp_dir, dvc):
|
||||
first_pattern = merge_patterns(
|
||||
*base_pattern,
|
||||
_to_pattern_info_list(["a", "b", "c"]),
|
||||
os.fspath(tmp_dir / "top" / "first")
|
||||
os.fspath(tmp_dir / "top" / "first"),
|
||||
)
|
||||
second_pattern = merge_patterns(
|
||||
*first_pattern,
|
||||
_to_pattern_info_list(["d", "e", "f"]),
|
||||
os.fspath(tmp_dir / "top" / "first" / "middle" / "second")
|
||||
os.fspath(tmp_dir / "top" / "first" / "middle" / "second"),
|
||||
)
|
||||
other_pattern = merge_patterns(
|
||||
*base_pattern,
|
||||
_to_pattern_info_list(["1", "2", "3"]),
|
||||
os.fspath(tmp_dir / "other")
|
||||
os.fspath(tmp_dir / "other"),
|
||||
)
|
||||
|
||||
assert DvcIgnorePatterns(*base_pattern) == ignore_pattern_top
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import filecmp
|
||||
import os
|
||||
from unittest.mock import patch
|
||||
|
||||
import pytest
|
||||
from funcy import first
|
||||
from mock import patch
|
||||
|
||||
import dvc.data_cloud as cloud
|
||||
from dvc.config import NoRemoteError
|
||||
@@ -407,9 +407,7 @@ def test_import_pipeline_tracked_outs(
|
||||
dvc.scm.commit("add pipeline stage")
|
||||
|
||||
with erepo_dir.chdir():
|
||||
erepo_dir.dvc.imp(
|
||||
"file:///{}".format(os.fspath(tmp_dir)), "bar", out="baz"
|
||||
)
|
||||
erepo_dir.dvc.imp(f"file:///{os.fspath(tmp_dir)}", "bar", out="baz")
|
||||
assert (erepo_dir / "baz").read_text() == "foo"
|
||||
|
||||
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import errno
|
||||
import os
|
||||
import stat
|
||||
from unittest.mock import patch
|
||||
|
||||
import configobj
|
||||
import pytest
|
||||
from mock import patch
|
||||
|
||||
from dvc.config import Config
|
||||
from dvc.exceptions import DownloadError, RemoteCacheRequiredError, UploadError
|
||||
|
||||
@@ -3,9 +3,9 @@ import os
|
||||
import re
|
||||
import shutil
|
||||
from pathlib import Path
|
||||
from unittest.mock import patch
|
||||
|
||||
import pytest
|
||||
from mock import patch
|
||||
|
||||
from dvc.dvcfile import DVC_FILE, Dvcfile
|
||||
from dvc.exceptions import (
|
||||
|
||||
@@ -4,8 +4,8 @@ import os
|
||||
import textwrap
|
||||
import uuid
|
||||
from pathlib import Path
|
||||
from unittest import mock
|
||||
|
||||
import mock
|
||||
import pytest
|
||||
|
||||
from dvc.dependency.base import DependencyIsStageFileError
|
||||
|
||||
@@ -67,9 +67,7 @@ def test_status_before_and_after_dvc_init(tmp_dir, dvc, git_dir):
|
||||
|
||||
(status,) = dvc.status(["file.dvc"])["file.dvc"]
|
||||
assert status == {
|
||||
"changed deps": {
|
||||
"file ({})".format(os.fspath(git_dir)): "update available"
|
||||
}
|
||||
"changed deps": {f"file ({os.fspath(git_dir)})": "update available"}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -144,7 +144,7 @@ def test_update_before_and_after_dvc_init(tmp_dir, dvc, git_dir):
|
||||
"file.dvc": [
|
||||
{
|
||||
"changed deps": {
|
||||
"file ({})".format(os.fspath(git_dir)): "update available"
|
||||
f"file ({os.fspath(git_dir)})": "update available"
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import collections
|
||||
import os
|
||||
from unittest import mock
|
||||
|
||||
import mock
|
||||
import pytest
|
||||
|
||||
from dvc.cli import parse_args
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import os
|
||||
|
||||
from mock import patch
|
||||
from unittest.mock import patch
|
||||
|
||||
from dvc.hash_info import HashInfo
|
||||
from dvc.output import Output
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import getpass
|
||||
import os
|
||||
import sys
|
||||
from unittest.mock import mock_open, patch
|
||||
|
||||
import pytest
|
||||
from mock import mock_open, patch
|
||||
|
||||
from dvc.fs.ssh import SSHFileSystem
|
||||
from dvc.system import System
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import math
|
||||
from unittest import mock
|
||||
|
||||
import mock
|
||||
import pytest
|
||||
|
||||
from dvc.fs.base import BaseFileSystem, RemoteCmdError
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import mock
|
||||
from unittest import mock
|
||||
|
||||
import pytest
|
||||
|
||||
import dvc.remote.slow_link_detection
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import mock
|
||||
from unittest import mock
|
||||
|
||||
|
||||
@mock.patch("dvc.repo.reproduce._reproduce_stage", returns=[])
|
||||
|
||||
@@ -238,7 +238,7 @@ def test_push_refspec(tmp_dir, scm, make_tmp_dir, use_url):
|
||||
}
|
||||
)
|
||||
remote_dir = make_tmp_dir("git-remote", scm=True)
|
||||
url = "file://{}".format(remote_dir.resolve().as_posix())
|
||||
url = f"file://{remote_dir.resolve().as_posix()}"
|
||||
scm.gitpython.repo.create_remote("origin", url)
|
||||
|
||||
with pytest.raises(SCMError):
|
||||
@@ -261,7 +261,7 @@ def test_push_refspec(tmp_dir, scm, make_tmp_dir, use_url):
|
||||
|
||||
def test_fetch_refspecs(tmp_dir, scm, make_tmp_dir):
|
||||
remote_dir = make_tmp_dir("git-remote", scm=True)
|
||||
url = "file://{}".format(remote_dir.resolve().as_posix())
|
||||
url = f"file://{remote_dir.resolve().as_posix()}"
|
||||
|
||||
remote_dir.scm_gen({"file": "0"}, commit="init")
|
||||
init_rev = remote_dir.scm.get_rev()
|
||||
@@ -428,7 +428,7 @@ def test_resolve_rev(tmp_dir, scm, make_tmp_dir, git):
|
||||
pytest.skip()
|
||||
|
||||
remote_dir = make_tmp_dir("git-remote", scm=True)
|
||||
url = "file://{}".format(remote_dir.resolve().as_posix())
|
||||
url = f"file://{remote_dir.resolve().as_posix()}"
|
||||
scm.gitpython.repo.create_remote("origin", url)
|
||||
scm.gitpython.repo.create_remote("upstream", url)
|
||||
|
||||
|
||||
@@ -2,8 +2,8 @@ import os
|
||||
import signal
|
||||
import subprocess
|
||||
import threading
|
||||
from unittest import mock
|
||||
|
||||
import mock
|
||||
import pytest
|
||||
|
||||
from dvc.dependency.repo import RepoDependency
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
import inspect
|
||||
import os
|
||||
from unittest import TestCase
|
||||
|
||||
import mock
|
||||
from unittest import TestCase, mock
|
||||
|
||||
from dvc import daemon
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import os
|
||||
from unittest.mock import MagicMock, mock_open, patch
|
||||
|
||||
import pytest
|
||||
from mock import MagicMock, mock_open, patch
|
||||
|
||||
from dvc.ignore import DvcIgnorePatterns
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ def test_metrics_order(tmp_dir, dvc):
|
||||
)
|
||||
with (tmp_dir / "sub").chdir():
|
||||
dvc.stage.add(
|
||||
metrics=[str(tmp_dir / "p1.json"), str("p3.json")],
|
||||
metrics=[str(tmp_dir / "p1.json"), "p3.json"],
|
||||
cmd="cmd2",
|
||||
name="stage2",
|
||||
)
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import logging
|
||||
import sys
|
||||
|
||||
import mock
|
||||
from unittest import mock
|
||||
|
||||
from dvc.progress import Tqdm
|
||||
from dvc.utils import env2bool
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
from unittest import TestCase
|
||||
|
||||
import mock
|
||||
from unittest import TestCase, mock
|
||||
|
||||
from dvc.prompt import confirm
|
||||
|
||||
|
||||
@@ -2,8 +2,8 @@ import json
|
||||
import logging
|
||||
import os
|
||||
import time
|
||||
from unittest import mock
|
||||
|
||||
import mock
|
||||
import pytest
|
||||
|
||||
from dvc import __version__
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import subprocess
|
||||
|
||||
import mock
|
||||
from unittest import mock
|
||||
|
||||
import dvc.version
|
||||
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import filecmp
|
||||
import os
|
||||
from unittest import TestCase
|
||||
from unittest.mock import patch
|
||||
|
||||
import pytest
|
||||
from mock import patch
|
||||
|
||||
import dvc
|
||||
from dvc.fs.local import LocalFileSystem
|
||||
|
||||
Reference in New Issue
Block a user