Commit a52efa3f authored by François Ferry's avatar François Ferry
Browse files

feat(2to3): remove six dependencie

parent 40d0a4586fb2
......@@ -15,7 +15,6 @@ description = "Data validation and transformation process"
web = "http://www.cubicweb.org/project/%s" % distname
__depends__ = {
"six": ">= 1.4.0",
"cubicweb": ">= 3.24.0.dev0",
"cubicweb-file": None,
}
......
......@@ -15,9 +15,6 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
"""cubicweb-dataprocessing entity's classes"""
from six import text_type
import json
from subprocess import Popen, PIPE, list2cmdline
import sys
......@@ -78,7 +75,7 @@ class DataProcessAdapter(EntityAdapter):
if parameters:
params = json.loads(parameters)
for pname, pvalue in list(params.items()):
if not isinstance(pvalue, text_type):
if not isinstance(pvalue, str):
raise ValueError(
'invalid parameter value for "{0}": {1}, '
"must be a string".format(pname, pvalue)
......
"""cubicweb-dataprocessing tests"""
from six import text_type
from cubicweb import Binary
import codecs
......@@ -25,7 +23,7 @@ def script_from_code(cnx, kind, code, name, **kwargs):
def script_from_file(cnx, kind, fpath, **kwargs):
"""Build a Script entity from the content of file at `fpath`."""
name = text_type(fpath)
name = str(fpath)
with codecs.open(fpath) as f:
return script_from_code(cnx, kind, f.read(), name)
......
......@@ -4,8 +4,6 @@
import json
import unittest
from six import text_type
from cubicweb.devtools.testlib import CubicWebTC
from cubicweb_dataprocessing.entities import process_type_from_etype
......@@ -81,7 +79,7 @@ class DataProcessAdapterTC(CubicWebTC):
with self.admin_access.repo_cnx() as cnx:
script = script_from_file(cnx, "transformation", self.datapath("iconv.py"))
parameters = json.dumps(params)
if not isinstance(parameters, text_type):
if not isinstance(parameters, str):
parameters = parameters.decode("utf-8")
proc = create_process(
cnx, "DataTransformationProcess", script, parameters=parameters
......
"""cubicweb-dataprocessing unit tests for schema"""
from six import text_type
from cubicweb import ValidationError
from cubicweb.devtools import testlib
......@@ -44,11 +39,11 @@ class TransformationSequenceTC(testlib.CubicWebTC):
cnx.commit()
cnx.rollback()
self.assertIn(
"index is part of violated unicity constraint", text_type(cm.exception)
"index is part of violated unicity constraint", str(cm.exception)
)
self.assertIn(
"in_sequence is part of violated unicity constraint",
text_type(cm.exception),
str(cm.exception),
)
# Distinct indices: OK.
cnx.create_entity(
......@@ -81,11 +76,11 @@ class TransformationSequenceTC(testlib.CubicWebTC):
cnx.rollback()
self.assertIn(
"step_script is part of violated unicity constraint",
text_type(cm.exception),
str(cm.exception),
)
self.assertIn(
"in_sequence is part of violated unicity constraint",
text_type(cm.exception),
str(cm.exception),
)
# Distinct indices: OK.
cnx.create_entity(
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment