Drop dependency on six
We're going to remove python2 support so we can remove six as well.
--- a/__pkginfo__.py Wed Nov 06 11:27:36 2019 +0100
+++ b/__pkginfo__.py Wed Nov 06 11:22:40 2019 +0100
@@ -98,6 +98,5 @@
'logilab-database >= 1.6.0',
'yapps2 >= 2.2.0', # XXX to ensure we don't use the broken pypi version
'logilab-constraint >= 0.5.0', # fallback if the gecode compiled module is missing
- 'six >= 1.4.0',
'setuptools',
]
--- a/debian/changelog Wed Nov 06 11:27:36 2019 +0100
+++ b/debian/changelog Wed Nov 06 11:22:40 2019 +0100
@@ -1,6 +1,7 @@
rql (0.35.2-1.1) UNRELEASED; urgency=medium
* Drop python2 packaging
+ * Drop dependency on python3-six
-- Philippe Pepiot <philippe.pepiot@logilab.fr> Wed, 06 Nov 2019 11:20:39 +0100
--- a/debian/control Wed Nov 06 11:27:36 2019 +0100
+++ b/debian/control Wed Nov 06 11:22:40 2019 +0100
@@ -13,7 +13,6 @@
libgecode-dev,
python3-sphinx,
python3-setuptools,
- python3-six
X-Python3-Version: >= 3.4
Standards-Version: 4.3.0
Testsuite: autopkgtest-pkg-python
--- a/rql/__init__.py Wed Nov 06 11:27:36 2019 +0100
+++ b/rql/__init__.py Wed Nov 06 11:22:40 2019 +0100
@@ -24,7 +24,7 @@
import threading
import pkg_resources
-from six import StringIO
+from io import StringIO
from rql._exceptions import *
--- a/rql/analyze.py Wed Nov 06 11:27:36 2019 +0100
+++ b/rql/analyze.py Wed Nov 06 11:22:40 2019 +0100
@@ -24,8 +24,7 @@
import os
-from six import StringIO, string_types
-from six.moves import zip
+from io import StringIO
from rql import TypeResolverException, nodes
@@ -91,13 +90,13 @@
self.scons.append(expr)
def var_has_type(self, var, etype):
- assert isinstance(etype, string_types)
+ assert isinstance(etype, str)
self.add_expr((var,), '%s == %r' % (var, etype))
def var_has_types(self, var, etypes):
etypes = tuple(etypes)
for t in etypes:
- assert isinstance(t, string_types)
+ assert isinstance(t, str)
if len(etypes) == 1:
cstr = '%s == "%s"' % (var, etypes[0])
else:
@@ -115,7 +114,7 @@
for vars, types in orred_expr:
types = tuple(types)
for t in types:
- assert isinstance(t, string_types)
+ assert isinstance(t, str)
if len(types) == 1:
anded.add('%s == "%s"' % ('=='.join(vars), types[0]))
else:
@@ -245,7 +244,7 @@
def var_has_types(self, var, etypes):
for t in etypes:
- assert isinstance(t, string_types)
+ assert isinstance(t, str)
if len(etypes) == 1:
self.and_eq(var, tuple(etypes)[0])
else:
@@ -271,7 +270,7 @@
for vars, types in orred_expr:
self.equal_vars(vars)
for t in types:
- assert isinstance(t, string_types)
+ assert isinstance(t, str)
for var in vars:
if len(types) == 1:
anded.append([_EQ, self.variables[var], self.values[types[0]]])
--- a/rql/compare.py Wed Nov 06 11:27:36 2019 +0100
+++ b/rql/compare.py Wed Nov 06 11:22:40 2019 +0100
@@ -23,8 +23,6 @@
__docformat__ = "restructuredtext en"
-from six.moves import range
-
from rql.nodes import VariableRef, Variable, Function, Relation, Comparison
--- a/rql/nodes.py Wed Nov 06 11:27:36 2019 +0100
+++ b/rql/nodes.py Wed Nov 06 11:22:40 2019 +0100
@@ -27,8 +27,6 @@
from decimal import Decimal
from datetime import datetime, date, time, timedelta
-from six import string_types
-
from rql import CoercionError, RQLException
from rql.base import BaseNode, Node, BinaryNode, LeafNode
from rql.utils import (function_description, uquote, common_parent,
@@ -230,7 +228,7 @@
etypes = (istarget.value,)
else: # Function (IN)
etypes = [et.value for et in istarget.children]
- if isinstance(etype, string_types):
+ if isinstance(etype, str):
restr_etypes = {etype}
else:
restr_etypes = set(etype)
@@ -767,13 +765,13 @@
# and linked relation
if kwargs is not None:
value = kwargs.get(self.value, '???')
- if isinstance(value, string_types):
+ if isinstance(value, str):
value = uquote(value)
else:
value = repr(value)
return value
return '%%(%s)s' % self.value
- if isinstance(self.value, string_types):
+ if isinstance(self.value, str):
return uquote(self.value)
return repr(self.value)
--- a/rql/rqlgen.py Wed Nov 06 11:27:36 2019 +0100
+++ b/rql/rqlgen.py Wed Nov 06 11:22:40 2019 +0100
@@ -20,8 +20,6 @@
"""
__docformat__ = "restructuredtext en"
-from six.moves import range
-
NOT = 1
--- a/rql/stmts.py Wed Nov 06 11:27:36 2019 +0100
+++ b/rql/stmts.py Wed Nov 06 11:22:40 2019 +0100
@@ -28,9 +28,6 @@
from copy import deepcopy
from warnings import warn
-from six import integer_types
-from six.moves import range
-
from logilab.common.deprecation import deprecated
from rql import BadRQLQuery, CoercionError, nodes
@@ -579,7 +576,7 @@
self.distinct = value
def set_limit(self, limit):
- if limit is not None and (not isinstance(limit, integer_types) or limit <= 0):
+ if limit is not None and (not isinstance(limit, int) or limit <= 0):
raise BadRQLQuery('bad limit %s' % limit)
if self.should_register_op and limit != self.limit:
from rql.undo import SetLimitOperation
@@ -587,7 +584,7 @@
self.limit = limit
def set_offset(self, offset):
- if offset is not None and (not isinstance(offset, integer_types) or offset < 0):
+ if offset is not None and (not isinstance(offset, int) or offset < 0):
raise BadRQLQuery('bad offset %s' % offset)
if self.should_register_op and offset != self.offset:
from rql.undo import SetOffsetOperation
--- a/test/unittest_parser.py Wed Nov 06 11:27:36 2019 +0100
+++ b/test/unittest_parser.py Wed Nov 06 11:22:40 2019 +0100
@@ -18,7 +18,7 @@
# with rql. If not, see <http://www.gnu.org/licenses/>.
from __future__ import print_function
-from six import text_type, PY2
+import unittest
from yapps.runtime import print_error, SyntaxError
@@ -26,11 +26,6 @@
from rql import BadRQLQuery, RQLSyntaxError, nodes
from rql import parse
-if PY2:
- import unittest2 as unittest
-else:
- import unittest
-
BAD_SYNTAX_QUERIES = (
'ANY X WHERE X name Nulll;',
@@ -212,7 +207,7 @@
comparison = base.children[1]
self.assertIsInstance(comparison, nodes.Comparison)
rhs = comparison.children[0]
- self.assertIsInstance(rhs.value, text_type)
+ self.assertIsInstance(rhs.value, str)
def test_precedence_1(self):
tree = self.parse("Any X WHERE X firstname 'lulu' AND X name 'toto' OR X name 'tutu';")
--- a/test/unittest_stcheck.py Wed Nov 06 11:27:36 2019 +0100
+++ b/test/unittest_stcheck.py Wed Nov 06 11:22:40 2019 +0100
@@ -17,15 +17,12 @@
# with rql. If not, see <http://www.gnu.org/licenses/>.
from __future__ import print_function
-import six
+
+import unittest
from rql import RQLHelper, BadRQLQuery, stmts, nodes
from unittest_analyze import DummySchema
-if six.PY2:
- import unittest2 as unittest
-else:
- import unittest
BAD_QUERIES = (
'Any X, Y GROUPBY X',
--- a/test/unittest_utils.py Wed Nov 06 11:27:36 2019 +0100
+++ b/test/unittest_utils.py Wed Nov 06 11:22:40 2019 +0100
@@ -16,8 +16,6 @@
# You should have received a copy of the GNU Lesser General Public License along
# with rql. If not, see <http://www.gnu.org/licenses/>.
-from six.moves import range
-
from logilab.common.testlib import TestCase, unittest_main
from rql import utils, nodes, parse