cubicweb/server/sqlutils.py
changeset 12567 26744ad37953
parent 12508 a8c1ea390400
child 12808 6cbb1e2a6e49
--- a/cubicweb/server/sqlutils.py	Fri Apr 05 17:21:14 2019 +0200
+++ b/cubicweb/server/sqlutils.py	Fri Apr 05 17:58:19 2019 +0200
@@ -17,8 +17,6 @@
 # with CubicWeb.  If not, see <http://www.gnu.org/licenses/>.
 """SQL utilities functions and classes."""
 
-from __future__ import print_function
-
 import os
 import sys
 import re
@@ -27,9 +25,6 @@
 from logging import getLogger
 from datetime import time, datetime, timedelta
 
-from six import string_types, text_type
-from six.moves import filter
-
 from pytz import utc
 
 from logilab import database as db, common as lgc
@@ -52,7 +47,7 @@
     env = os.environ.copy()
     for key, value in (extra_env or {}).items():
         env.setdefault(key, value)
-    if isinstance(cmd, string_types):
+    if isinstance(cmd, str):
         print(cmd)
         return subprocess.call(cmd, shell=True, env=env)
     else:
@@ -81,7 +76,7 @@
     else:
         execute = cursor_or_execute
     sqlstmts_as_string = False
-    if isinstance(sqlstmts, string_types):
+    if isinstance(sqlstmts, str):
         sqlstmts_as_string = True
         sqlstmts = sqlstmts.split(delimiter)
     if withpb:
@@ -475,7 +470,7 @@
                 for row, rowdesc in zip(rset, rset.description):
                     for cellindex, (value, vtype) in enumerate(zip(row, rowdesc)):
                         if vtype in ('TZDatetime', 'Date', 'Datetime') \
-                           and isinstance(value, text_type):
+                           and isinstance(value, str):
                             found_date = True
                             value = value.rsplit('.', 1)[0]
                             try:
@@ -484,7 +479,7 @@
                                 row[cellindex] = strptime(value, '%Y-%m-%d')
                             if vtype == 'TZDatetime':
                                 row[cellindex] = row[cellindex].replace(tzinfo=utc)
-                        if vtype == 'Time' and isinstance(value, text_type):
+                        if vtype == 'Time' and isinstance(value, str):
                             found_date = True
                             try:
                                 row[cellindex] = strptime(value, '%H:%M:%S')
@@ -517,7 +512,7 @@
                 self.values.add(value)
 
         def finalize(self):
-            return ', '.join(text_type(v) for v in self.values)
+            return ', '.join(str(v) for v in self.values)
 
     cnx.create_aggregate("GROUP_CONCAT", 1, group_concat)