mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-02 07:18:25 +01:00
py3: remove convert_to_unicode noop
This commit is contained in:
+2
-7
@@ -9,12 +9,7 @@ from funcy.py3 import lmap, lfilter, lmapcat
|
||||
|
||||
from .exceptions import DvcException
|
||||
from .lock import LockError
|
||||
from .utils.compat import (
|
||||
convert_to_unicode,
|
||||
FileNotFoundError,
|
||||
JSONDecodeError,
|
||||
str,
|
||||
)
|
||||
from .utils.compat import FileNotFoundError, JSONDecodeError, str
|
||||
from .utils.fs import relpath
|
||||
|
||||
INFO_SCHEMA = {"pid": int, "cmd": str}
|
||||
@@ -44,7 +39,7 @@ def _edit_rwlock(lock_dir):
|
||||
try:
|
||||
with open(path, "r") as fobj:
|
||||
lock = json.load(fobj)
|
||||
lock = SCHEMA(convert_to_unicode(lock))
|
||||
lock = SCHEMA(lock)
|
||||
except FileNotFoundError:
|
||||
lock = SCHEMA({})
|
||||
except JSONDecodeError as exc:
|
||||
|
||||
+1
-3
@@ -421,10 +421,8 @@ class Stage(object):
|
||||
|
||||
@staticmethod
|
||||
def validate(d, fname=None):
|
||||
from dvc.utils.compat import convert_to_unicode
|
||||
|
||||
try:
|
||||
Stage.COMPILED_SCHEMA(convert_to_unicode(d))
|
||||
Stage.COMPILED_SCHEMA(d)
|
||||
except MultipleInvalid as exc:
|
||||
raise StageFileFormatError(fname, exc)
|
||||
|
||||
|
||||
@@ -116,15 +116,6 @@ if is_py2:
|
||||
def __exit__(self, *args):
|
||||
self.close()
|
||||
|
||||
def convert_to_unicode(data):
|
||||
if isinstance(data, builtin_str):
|
||||
return str(data)
|
||||
if isinstance(data, dict):
|
||||
return dict(map(convert_to_unicode, data.items()))
|
||||
if isinstance(data, (list, tuple)):
|
||||
return type(data)(map(convert_to_unicode, data))
|
||||
return data
|
||||
|
||||
|
||||
elif is_py3:
|
||||
import pathlib # noqa: F401
|
||||
@@ -152,9 +143,6 @@ elif is_py3:
|
||||
range = range # noqa: F821
|
||||
FileNotFoundError = FileNotFoundError
|
||||
|
||||
def convert_to_unicode(data):
|
||||
return data
|
||||
|
||||
|
||||
# Backport os.fspath() from Python 3.6
|
||||
try:
|
||||
|
||||
Reference in New Issue
Block a user