mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-10 07:18:27 +01:00
Merge pull request #3024 from mroutis/unicode-str
py3: remove string compat related code
This commit is contained in:
+1
-1
@@ -17,7 +17,7 @@ from dvc.lock import Lock, LockError
|
||||
from dvc.repo import Repo
|
||||
from dvc.scm import SCM
|
||||
from dvc.utils import env2bool, is_binary, makedirs
|
||||
from dvc.utils.compat import str, FileNotFoundError
|
||||
from dvc.utils.compat import FileNotFoundError
|
||||
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
+1
-3
@@ -9,7 +9,7 @@ try:
|
||||
except ImportError:
|
||||
from contextlib import GeneratorContextManager as GCM
|
||||
|
||||
from dvc.utils.compat import urlparse, builtin_str
|
||||
from dvc.utils.compat import urlparse
|
||||
|
||||
import ruamel.yaml
|
||||
from voluptuous import Schema, Required, Invalid
|
||||
@@ -188,8 +188,6 @@ def _import_string(import_name):
|
||||
|
||||
:return: imported object
|
||||
"""
|
||||
import_name = builtin_str(import_name)
|
||||
|
||||
if "." in import_name:
|
||||
module, obj = import_name.rsplit(".", 1)
|
||||
else:
|
||||
|
||||
+1
-2
@@ -5,7 +5,6 @@ from collections import defaultdict
|
||||
from funcy import cached_property
|
||||
|
||||
from dvc.config import Config
|
||||
from dvc.utils.compat import builtin_str
|
||||
|
||||
|
||||
class CacheConfig(object):
|
||||
@@ -54,7 +53,7 @@ def _make_remote_property(name):
|
||||
|
||||
return Remote(self.repo, name=remote)
|
||||
|
||||
getter.__name__ = builtin_str(name)
|
||||
getter.__name__ = str(name)
|
||||
return cached_property(getter)
|
||||
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import argparse
|
||||
import logging
|
||||
from dvc.utils.compat import str
|
||||
|
||||
from dvc.command.base import CmdBase, append_doc_link, fix_subparsers
|
||||
from dvc.exceptions import DvcException
|
||||
@@ -102,7 +101,7 @@ class CmdPipelineShow(CmdBase):
|
||||
tree.show()
|
||||
|
||||
def __write_dot(self, target, commands, outs):
|
||||
from dvc.utils.compat import StringIO
|
||||
import io
|
||||
import networkx
|
||||
from networkx.drawing.nx_pydot import write_dot
|
||||
|
||||
@@ -112,7 +111,7 @@ class CmdPipelineShow(CmdBase):
|
||||
simple_g = networkx.DiGraph()
|
||||
simple_g.add_edges_from(edges)
|
||||
|
||||
dot_file = StringIO()
|
||||
dot_file = io.StringIO()
|
||||
write_dot(simple_g, dot_file)
|
||||
logger.info(dot_file.getvalue())
|
||||
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import logging
|
||||
|
||||
from dvc.command.data_sync import CmdDataBase
|
||||
from dvc.utils.compat import str
|
||||
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
+1
-1
@@ -12,7 +12,7 @@ from voluptuous import All, Any, Lower, Range, Coerce, Match
|
||||
|
||||
from dvc.exceptions import DvcException
|
||||
from dvc.exceptions import NotDvcRepoError
|
||||
from dvc.utils.compat import open, str
|
||||
from dvc.utils.compat import open
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@@ -7,7 +7,6 @@ from funcy import merge
|
||||
|
||||
from .local import DependencyLOCAL
|
||||
from dvc.external_repo import external_repo
|
||||
from dvc.utils.compat import str
|
||||
from dvc.exceptions import OutputNotFoundError
|
||||
from dvc.exceptions import PathMissingError
|
||||
from dvc.utils.fs import fs_copy
|
||||
|
||||
+4
-6
@@ -3,8 +3,6 @@
|
||||
import traceback
|
||||
|
||||
from dvc.utils import relpath
|
||||
from dvc.utils.compat import builtin_str
|
||||
from dvc.utils.compat import str
|
||||
|
||||
|
||||
class DvcException(Exception):
|
||||
@@ -38,7 +36,7 @@ class OutputDuplicationError(DvcException):
|
||||
"""
|
||||
|
||||
def __init__(self, output, stages):
|
||||
assert isinstance(output, (str, builtin_str))
|
||||
assert isinstance(output, str)
|
||||
assert all(hasattr(stage, "relpath") for stage in stages)
|
||||
msg = (
|
||||
"file/directory '{}' is specified as an output in more than one "
|
||||
@@ -75,7 +73,7 @@ class StagePathAsOutputError(DvcException):
|
||||
"""
|
||||
|
||||
def __init__(self, stage, output):
|
||||
assert isinstance(output, (str, builtin_str))
|
||||
assert isinstance(output, str)
|
||||
super(StagePathAsOutputError, self).__init__(
|
||||
"'{stage}' is within an output '{output}' of another stage".format(
|
||||
stage=stage.relpath, output=output
|
||||
@@ -92,7 +90,7 @@ class CircularDependencyError(DvcException):
|
||||
"""
|
||||
|
||||
def __init__(self, dependency):
|
||||
assert isinstance(dependency, (str, builtin_str))
|
||||
assert isinstance(dependency, str)
|
||||
|
||||
msg = (
|
||||
"file/directory '{}' is specified as an output and as a "
|
||||
@@ -110,7 +108,7 @@ class ArgumentDuplicationError(DvcException):
|
||||
"""
|
||||
|
||||
def __init__(self, path):
|
||||
assert isinstance(path, (str, builtin_str))
|
||||
assert isinstance(path, str)
|
||||
msg = "file '{}' is specified more than once."
|
||||
super(ArgumentDuplicationError, self).__init__(msg.format(path))
|
||||
|
||||
|
||||
+2
-3
@@ -1,5 +1,6 @@
|
||||
"""Manages logging configuration for dvc repo."""
|
||||
|
||||
import io
|
||||
import logging.config
|
||||
import logging.handlers
|
||||
|
||||
@@ -7,8 +8,6 @@ import colorama
|
||||
|
||||
from dvc.progress import Tqdm
|
||||
from dvc.utils.compat import RecursionError
|
||||
from dvc.utils.compat import str
|
||||
from dvc.utils.compat import StringIO
|
||||
|
||||
|
||||
FOOTER = (
|
||||
@@ -105,7 +104,7 @@ class ColorFormatter(logging.Formatter):
|
||||
def _walk_exc(self, exc_info):
|
||||
import traceback
|
||||
|
||||
buffer = StringIO()
|
||||
buffer = io.StringIO()
|
||||
|
||||
traceback.print_exception(*exc_info, file=buffer)
|
||||
|
||||
|
||||
@@ -11,7 +11,6 @@ from dvc.remote.hdfs import RemoteHDFS
|
||||
from dvc.remote.local import RemoteLOCAL
|
||||
from dvc.remote.s3 import RemoteS3
|
||||
from dvc.scheme import Schemes
|
||||
from dvc.utils.compat import str
|
||||
from dvc.utils.compat import urlparse
|
||||
|
||||
OUTS = [
|
||||
|
||||
@@ -8,7 +8,6 @@ from dvc.cache import NamedCache
|
||||
from dvc.exceptions import CollectCacheError
|
||||
from dvc.exceptions import DvcException
|
||||
from dvc.remote.base import RemoteBASE
|
||||
from dvc.utils.compat import str
|
||||
from dvc.utils.compat import urlparse
|
||||
|
||||
|
||||
|
||||
@@ -7,7 +7,6 @@ from dvc.output.base import OutputBase
|
||||
from dvc.remote.local import RemoteLOCAL
|
||||
from dvc.utils import relpath
|
||||
from dvc.utils.compat import fspath_py35
|
||||
from dvc.utils.compat import str
|
||||
from dvc.utils.compat import urlparse
|
||||
from dvc.utils.fs import path_isin
|
||||
|
||||
|
||||
+8
-11
@@ -4,16 +4,13 @@ import posixpath
|
||||
from funcy import cached_property
|
||||
|
||||
from dvc.utils import relpath
|
||||
from dvc.utils.compat import basestring
|
||||
from dvc.utils.compat import builtin_str
|
||||
from dvc.utils.compat import pathlib
|
||||
from dvc.utils.compat import str
|
||||
from dvc.utils.compat import urlparse
|
||||
|
||||
|
||||
class _BasePath(object):
|
||||
def overlaps(self, other):
|
||||
if isinstance(other, basestring):
|
||||
if isinstance(other, (str, bytes)):
|
||||
other = self.__class__(other)
|
||||
elif self.__class__ != other.__class__:
|
||||
return False
|
||||
@@ -54,7 +51,7 @@ class PathInfo(pathlib.PurePath, _BasePath):
|
||||
return relpath(path)
|
||||
|
||||
def __repr__(self):
|
||||
return builtin_str("{}: '{}'").format(type(self).__name__, self)
|
||||
return str("{}: '{}'").format(type(self).__name__, self)
|
||||
|
||||
# This permits passing it to file utils directly in Python 3.6+
|
||||
# With Python 2.7, Python 3.5+ we are stuck with path_info.fspath for now
|
||||
@@ -71,7 +68,7 @@ class PathInfo(pathlib.PurePath, _BasePath):
|
||||
return self.__class__(relpath(self, other))
|
||||
|
||||
def isin(self, other):
|
||||
if isinstance(other, basestring):
|
||||
if isinstance(other, (str, bytes)):
|
||||
other = self.__class__(other)
|
||||
elif self.__class__ != other.__class__:
|
||||
return False
|
||||
@@ -135,13 +132,13 @@ class URLInfo(_BasePath):
|
||||
|
||||
def fill_parts(self, scheme, host, user, port, path):
|
||||
assert scheme != "remote"
|
||||
assert isinstance(path, (basestring, _URLPathInfo))
|
||||
assert isinstance(path, (str, bytes, _URLPathInfo))
|
||||
|
||||
self.scheme, self.host, self.user = scheme, host, user
|
||||
self.port = int(port) if port else self.DEFAULT_PORTS.get(self.scheme)
|
||||
|
||||
if isinstance(path, _URLPathInfo):
|
||||
self._spath = builtin_str(path)
|
||||
self._spath = str(path)
|
||||
self._path = path
|
||||
else:
|
||||
if path and path[0] != "/":
|
||||
@@ -170,7 +167,7 @@ class URLInfo(_BasePath):
|
||||
return "{}: '{}'".format(type(self).__name__, self)
|
||||
|
||||
def __eq__(self, other):
|
||||
if isinstance(other, basestring):
|
||||
if isinstance(other, (str, bytes)):
|
||||
other = self.__class__(other)
|
||||
return (
|
||||
self.__class__ == other.__class__
|
||||
@@ -220,7 +217,7 @@ class URLInfo(_BasePath):
|
||||
return _URLPathParents(self)
|
||||
|
||||
def relative_to(self, other):
|
||||
if isinstance(other, basestring):
|
||||
if isinstance(other, (str, bytes)):
|
||||
other = self.__class__(other)
|
||||
if self.__class__ != other.__class__:
|
||||
msg = "'{}' has incompatible class with '{}'".format(self, other)
|
||||
@@ -231,7 +228,7 @@ class URLInfo(_BasePath):
|
||||
return self._path.relative_to(other._path)
|
||||
|
||||
def isin(self, other):
|
||||
if isinstance(other, basestring):
|
||||
if isinstance(other, (str, bytes)):
|
||||
other = self.__class__(other)
|
||||
elif self.__class__ != other.__class__:
|
||||
return False
|
||||
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
import errno
|
||||
|
||||
from dvc.utils.compat import basestring, FileNotFoundError, str, urlparse
|
||||
from dvc.utils.compat import FileNotFoundError, urlparse
|
||||
|
||||
import itertools
|
||||
import json
|
||||
@@ -153,7 +153,7 @@ class RemoteBASE(object):
|
||||
|
||||
@classmethod
|
||||
def supported(cls, config):
|
||||
if isinstance(config, basestring):
|
||||
if isinstance(config, (str, bytes)):
|
||||
url = config
|
||||
else:
|
||||
url = config[Config.SECTION_REMOTE_URL]
|
||||
|
||||
+1
-2
@@ -30,7 +30,6 @@ from dvc.utils import tmp_fname
|
||||
from dvc.utils import walk_files
|
||||
from dvc.utils.compat import fspath_py35
|
||||
from dvc.utils.compat import open
|
||||
from dvc.utils.compat import str
|
||||
from dvc.utils.fs import move
|
||||
from dvc.utils.fs import remove
|
||||
|
||||
@@ -411,7 +410,7 @@ class RemoteLOCAL(RemoteBASE):
|
||||
def _unprotect_file(path):
|
||||
if System.is_symlink(path) or System.is_hardlink(path):
|
||||
logger.debug("Unprotecting '{}'".format(path))
|
||||
tmp = os.path.join(os.path.dirname(path), "." + str(uuid()))
|
||||
tmp = os.path.join(os.path.dirname(path), "." + uuid())
|
||||
|
||||
# The operations order is important here - if some application
|
||||
# would access the file during the process of copyfile then it
|
||||
|
||||
@@ -17,7 +17,6 @@ from dvc.remote.base import RemoteBASE
|
||||
from dvc.remote.pool import get_connection
|
||||
from dvc.scheme import Schemes
|
||||
from dvc.utils import to_chunks
|
||||
from dvc.utils.compat import StringIO
|
||||
from dvc.utils.compat import urlparse
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
@@ -104,7 +103,7 @@ class RemoteSSH(RemoteBASE):
|
||||
ssh_config = paramiko.SSHConfig()
|
||||
with open(user_config_file) as f:
|
||||
# For whatever reason parsing directly from f is unreliable
|
||||
f_copy = StringIO(f.read())
|
||||
f_copy = io.StringIO(f.read())
|
||||
ssh_config.parse(f_copy)
|
||||
user_ssh_config = ssh_config.lookup(hostname)
|
||||
return user_ssh_config
|
||||
|
||||
@@ -3,16 +3,15 @@ import errno
|
||||
import json
|
||||
import logging
|
||||
import os
|
||||
import io
|
||||
|
||||
from jsonpath_ng.ext import parse
|
||||
|
||||
from dvc.exceptions import NoMetricsError
|
||||
from dvc.exceptions import OutputNotFoundError
|
||||
from dvc.repo import locked
|
||||
from dvc.utils.compat import builtin_str
|
||||
from dvc.utils.compat import csv_reader
|
||||
from dvc.utils.compat import open
|
||||
from dvc.utils.compat import StringIO
|
||||
|
||||
NO_METRICS_FILE_AT_REFERENCE_WARNING = (
|
||||
"Metrics file '{}' does not exist at the reference '{}'."
|
||||
@@ -48,7 +47,7 @@ def _read_metric_hxsv(fd, hxsv_path, delimiter):
|
||||
row = indices[0]
|
||||
row = int(row) if row else None
|
||||
col = indices[1] if len(indices) > 1 and indices[1] else None
|
||||
reader = list(csv.DictReader(fd, delimiter=builtin_str(delimiter)))
|
||||
reader = list(csv.DictReader(fd, delimiter=delimiter))
|
||||
return _do_read_metric_xsv(reader, row, col)
|
||||
|
||||
|
||||
@@ -57,7 +56,7 @@ def _read_metric_xsv(fd, xsv_path, delimiter):
|
||||
row = indices[0]
|
||||
row = int(row) if row else None
|
||||
col = int(indices[1]) if len(indices) > 1 and indices[1] else None
|
||||
reader = list(csv.reader(fd, delimiter=builtin_str(delimiter)))
|
||||
reader = list(csv.reader(fd, delimiter=delimiter))
|
||||
return _do_read_metric_xsv(reader, row, col)
|
||||
|
||||
|
||||
@@ -102,7 +101,7 @@ def _format_csv(content, delimiter):
|
||||
"0.67528 0.289545 testing\n"
|
||||
"0.671502 0.297848 validation\n"
|
||||
"""
|
||||
reader = csv_reader(StringIO(content), delimiter=builtin_str(delimiter))
|
||||
reader = csv_reader(io.StringIO(content), delimiter=delimiter)
|
||||
rows = [row for row in reader]
|
||||
max_widths = [max(map(len, column)) for column in zip(*rows)]
|
||||
|
||||
@@ -128,10 +127,10 @@ def _format_output(content, typ):
|
||||
str: Content in a raw or tabular format.
|
||||
"""
|
||||
|
||||
if "csv" in str(typ):
|
||||
if "csv" in typ:
|
||||
return _format_csv(content, delimiter=",")
|
||||
|
||||
if "tsv" in str(typ):
|
||||
if "tsv" in typ:
|
||||
return _format_csv(content, delimiter="\t")
|
||||
|
||||
return content
|
||||
|
||||
@@ -19,7 +19,6 @@ from dvc.utils import relpath
|
||||
from dvc.utils.fs import path_isin
|
||||
from dvc.utils.compat import cast_bytes_py2
|
||||
from dvc.utils.compat import open
|
||||
from dvc.utils.compat import str
|
||||
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
+3
-4
@@ -1,11 +1,10 @@
|
||||
import io
|
||||
import errno
|
||||
import os
|
||||
|
||||
from dvc.exceptions import DvcException
|
||||
from dvc.scm.tree import BaseTree
|
||||
from dvc.utils import relpath
|
||||
from dvc.utils.compat import BytesIO
|
||||
from dvc.utils.compat import StringIO
|
||||
|
||||
|
||||
# see git-fast-import(1)
|
||||
@@ -63,8 +62,8 @@ class GitTree(BaseTree):
|
||||
# and `open` with default "r" mode returns str)
|
||||
data = obj.data_stream.read()
|
||||
if mode == "rb":
|
||||
return BytesIO(data)
|
||||
return StringIO(data.decode(encoding))
|
||||
return io.BytesIO(data)
|
||||
return io.StringIO(data.decode(encoding))
|
||||
|
||||
def exists(self, path):
|
||||
return self.git_object_by_path(path) is not None
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
from dvc.utils.compat import pathlib, str
|
||||
from dvc.utils.compat import pathlib
|
||||
import logging
|
||||
import os
|
||||
import re
|
||||
|
||||
@@ -5,7 +5,6 @@ import shutil
|
||||
|
||||
from dvc.utils.compat import fspath
|
||||
from dvc.utils.compat import open
|
||||
from dvc.utils.compat import str
|
||||
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
+7
-11
@@ -8,20 +8,18 @@ import os
|
||||
import re
|
||||
import sys
|
||||
import time
|
||||
import io
|
||||
|
||||
import colorama
|
||||
import nanotime
|
||||
from ruamel.yaml import YAML
|
||||
from shortuuid import uuid
|
||||
|
||||
from dvc.utils.compat import builtin_str
|
||||
from dvc.utils.compat import cast_bytes_py2
|
||||
from dvc.utils.compat import fspath
|
||||
from dvc.utils.compat import fspath_py35
|
||||
from dvc.utils.compat import makedirs as _makedirs
|
||||
from dvc.utils.compat import open
|
||||
from dvc.utils.compat import str
|
||||
from dvc.utils.compat import StringIO
|
||||
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
@@ -92,16 +90,14 @@ def dict_filter(d, exclude=()):
|
||||
Exclude specified keys from a nested dict
|
||||
"""
|
||||
|
||||
def fix_key(k):
|
||||
return str(k) if isinstance(k, builtin_str) else k
|
||||
|
||||
if isinstance(d, list):
|
||||
return [dict_filter(e, exclude) for e in d]
|
||||
|
||||
if isinstance(d, dict):
|
||||
items = ((fix_key(k), v) for k, v in d.items())
|
||||
return {
|
||||
k: dict_filter(v, exclude) for k, v in items if k not in exclude
|
||||
k: dict_filter(v, exclude)
|
||||
for k, v in d.items()
|
||||
if k not in exclude
|
||||
}
|
||||
|
||||
return d
|
||||
@@ -268,7 +264,7 @@ def fix_env(env=None):
|
||||
|
||||
def tmp_fname(fname):
|
||||
""" Temporary name for a partial download """
|
||||
return fspath(fname) + "." + str(uuid()) + ".tmp"
|
||||
return fspath(fname) + "." + uuid() + ".tmp"
|
||||
|
||||
|
||||
def current_timestamp():
|
||||
@@ -276,11 +272,11 @@ def current_timestamp():
|
||||
|
||||
|
||||
def from_yaml_string(s):
|
||||
return YAML().load(StringIO(s))
|
||||
return YAML().load(io.StringIO(s))
|
||||
|
||||
|
||||
def to_yaml_string(data):
|
||||
stream = StringIO()
|
||||
stream = io.StringIO()
|
||||
yaml = YAML()
|
||||
yaml.default_flow_style = False
|
||||
yaml.dump(data, stream)
|
||||
|
||||
+1
-2
@@ -13,7 +13,6 @@ from dvc.utils import dict_md5
|
||||
from dvc.utils import fspath
|
||||
from dvc.utils import fspath_py35
|
||||
from dvc.utils import relpath
|
||||
from dvc.utils.compat import str
|
||||
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
@@ -101,7 +100,7 @@ def move(src, dst, mode=None):
|
||||
dst = fspath_py35(dst)
|
||||
|
||||
dst = os.path.abspath(dst)
|
||||
tmp = "{}.{}".format(dst, str(uuid()))
|
||||
tmp = "{}.{}".format(dst, uuid())
|
||||
|
||||
if os.path.islink(src):
|
||||
shutil.copy(os.readlink(src), tmp)
|
||||
|
||||
@@ -13,7 +13,6 @@ from git.exc import GitCommandNotFound
|
||||
|
||||
from dvc.repo import Repo as DvcRepo
|
||||
from dvc.utils.compat import open
|
||||
from dvc.utils.compat import str
|
||||
from dvc.utils.fs import remove
|
||||
|
||||
|
||||
|
||||
@@ -49,7 +49,7 @@ import pytest
|
||||
from funcy.py3 import lmap, retry
|
||||
|
||||
from dvc.utils import makedirs
|
||||
from dvc.utils.compat import basestring, pathlib, fspath, fspath_py35, bytes
|
||||
from dvc.utils.compat import pathlib, fspath, fspath_py35
|
||||
|
||||
|
||||
__all__ = ["tmp_dir", "scm", "dvc", "repo_template", "run_copy", "erepo_dir"]
|
||||
@@ -87,7 +87,7 @@ class TmpDir(pathlib.Path):
|
||||
)
|
||||
|
||||
def gen(self, struct, text=""):
|
||||
if isinstance(struct, (basestring, pathlib.PurePath)):
|
||||
if isinstance(struct, (str, bytes, pathlib.PurePath)):
|
||||
struct = {struct: text}
|
||||
|
||||
self._gen(struct)
|
||||
@@ -142,7 +142,7 @@ class TmpDir(pathlib.Path):
|
||||
|
||||
|
||||
def _coerce_filenames(filenames):
|
||||
if isinstance(filenames, (basestring, pathlib.PurePath)):
|
||||
if isinstance(filenames, (str, bytes, pathlib.PurePath)):
|
||||
filenames = [filenames]
|
||||
return lmap(fspath, filenames)
|
||||
|
||||
|
||||
@@ -25,7 +25,6 @@ from dvc.remote.base import STATUS_DELETED
|
||||
from dvc.remote.base import STATUS_NEW
|
||||
from dvc.remote.base import STATUS_OK
|
||||
from dvc.utils import file_md5
|
||||
from dvc.utils.compat import str
|
||||
from dvc.utils.stage import dump_stage_file
|
||||
from dvc.utils.stage import load_stage_file
|
||||
from tests.basic_env import TestDvc
|
||||
|
||||
@@ -8,7 +8,6 @@ from mock import patch
|
||||
import dvc
|
||||
from dvc.main import main
|
||||
from dvc.utils import makedirs
|
||||
from dvc.utils.compat import str
|
||||
from tests.basic_env import TestDvc
|
||||
from tests.utils import spy
|
||||
|
||||
|
||||
@@ -29,7 +29,6 @@ from dvc.system import System
|
||||
from dvc.utils import file_md5
|
||||
from dvc.utils import relpath
|
||||
from dvc.utils.compat import pathlib
|
||||
from dvc.utils.compat import str
|
||||
from dvc.utils.compat import urljoin
|
||||
from dvc.utils.stage import dump_stage_file
|
||||
from dvc.utils.stage import load_stage_file
|
||||
|
||||
@@ -6,7 +6,6 @@ from dvc.scm import Git
|
||||
from dvc.scm import NoSCM
|
||||
from dvc.scm import SCM
|
||||
from dvc.system import System
|
||||
from dvc.utils.compat import str # noqa: F401
|
||||
from tests.basic_env import TestDir
|
||||
from tests.basic_env import TestGit
|
||||
from tests.basic_env import TestGitSubmodule
|
||||
|
||||
@@ -6,7 +6,6 @@ from dvc.main import main
|
||||
from dvc.path_info import PathInfo
|
||||
from dvc.state import State
|
||||
from dvc.utils import file_md5
|
||||
from dvc.utils.compat import str
|
||||
|
||||
|
||||
def test_state(dvc_repo, repo_dir):
|
||||
|
||||
@@ -7,10 +7,6 @@ from voluptuous import Schema, Any
|
||||
|
||||
from dvc import analytics
|
||||
from dvc.cli import parse_args
|
||||
from dvc.utils.compat import str, builtin_str
|
||||
|
||||
|
||||
string = Any(str, builtin_str)
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
@@ -51,10 +47,10 @@ def test_collect_and_send_report(mock_json, mock_daemon, tmp_global_config):
|
||||
def test_runtime_info(tmp_global_config):
|
||||
schema = Schema(
|
||||
{
|
||||
"dvc_version": string,
|
||||
"dvc_version": str,
|
||||
"is_binary": bool,
|
||||
"scm_class": Any("Git", None),
|
||||
"user_id": string,
|
||||
"user_id": str,
|
||||
"system_info": dict,
|
||||
},
|
||||
required=True,
|
||||
@@ -109,19 +105,19 @@ def test_system_info():
|
||||
"windows_version_build": int,
|
||||
"windows_version_major": int,
|
||||
"windows_version_minor": int,
|
||||
"windows_version_service_pack": string,
|
||||
"windows_version_service_pack": str,
|
||||
}
|
||||
)
|
||||
|
||||
if system == "Darwin":
|
||||
schema = schema.extend({"mac_version": string})
|
||||
schema = schema.extend({"mac_version": str})
|
||||
|
||||
if system == "Linux":
|
||||
schema = schema.extend(
|
||||
{
|
||||
"linux_distro": string,
|
||||
"linux_distro_like": string,
|
||||
"linux_distro_version": string,
|
||||
"linux_distro": str,
|
||||
"linux_distro_like": str,
|
||||
"linux_distro_version": str,
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
@@ -10,7 +10,6 @@ from dvc.path_info import PathInfo
|
||||
from dvc.scm.tree import WorkingTree
|
||||
from dvc.system import System
|
||||
from dvc.utils import relpath
|
||||
from dvc.utils.compat import str
|
||||
from dvc.utils.fs import BasePathNotInCheckedPathException
|
||||
from dvc.utils.fs import contains_symlink_up_to
|
||||
from dvc.utils.fs import get_inode
|
||||
|
||||
Reference in New Issue
Block a user