Drop dead python2 code
authorPhilippe Pepiot <philippe.pepiot@logilab.fr>
Thu, 07 Nov 2019 18:28:41 +0100
changeset 873 3a9447ea6ebf
parent 872 90c1fd047f21
child 874 a35ff5755d82
Drop dead python2 code
rql/base.py
rql/nodes.py
test/unittest_nodes.py
--- a/rql/base.py	Wed Nov 06 11:55:34 2019 +0100
+++ b/rql/base.py	Thu Nov 07 18:28:41 2019 +0100
@@ -22,8 +22,6 @@
 
 __docformat__ = "restructuredtext en"
 
-import sys
-
 from rql.utils import VisitableMixIn
 
 
@@ -32,7 +30,6 @@
 
     def __str__(self):
         s = self.as_string()
-        s = s.encode('unicode_escape') if sys.version_info < (3,) else s
         return s
 
     def as_string(self, kwargs=None):
--- a/rql/nodes.py	Wed Nov 06 11:55:34 2019 +0100
+++ b/rql/nodes.py	Thu Nov 07 18:28:41 2019 +0100
@@ -23,7 +23,6 @@
 
 __docformat__ = "restructuredtext en"
 
-import sys
 from decimal import Decimal
 from datetime import datetime, date, time, timedelta
 
@@ -46,10 +45,6 @@
                    time: 'Time',
                    timedelta: 'Interval',
                    }
-if sys.version_info < (3,):
-    ETYPE_PYOBJ_MAP[long] = 'Int' # noqa
-    ETYPE_PYOBJ_MAP[unicode] = 'String' # noqa
-
 KEYWORD_MAP = {'NOW': datetime.now,
                'TODAY': date.today}
 
@@ -777,7 +772,6 @@
 
     def __repr__(self):
         s = self.as_string()
-        s = s.encode('unicode_escape') if sys.version_info < (3,) else s
         return s
 
     def eval(self, kwargs):
--- a/test/unittest_nodes.py	Wed Nov 06 11:55:34 2019 +0100
+++ b/test/unittest_nodes.py	Thu Nov 07 18:28:41 2019 +0100
@@ -17,7 +17,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/>.
 
-import sys
 import itertools
 from datetime import date, datetime
 
@@ -45,9 +44,6 @@
 
     def test_int(self):
         self.assertEqual(nodes.etype_from_pyobj(0), 'Int')
-        if sys.version_info < (3,):
-            l = long # noqa
-            self.assertEqual(nodes.etype_from_pyobj(l('1L')), 'Int')
 
     def test_float(self):
         self.assertEqual(nodes.etype_from_pyobj(0.), 'Float')