138138NULL ``None``
139139integer `int`
140140real `float`
141- blob `six.binary_type` (aka ` bytes` in Python 3, ``str`` in Python 2)
142- text `six.text_type` (aka ` str` in Python 3, ``unicode`` in Python 2)
141+ blob `bytes`
142+ text `str`
143143datetime `datetime.datetime`
144144datetimeus `DatetimeUs`
145145============ ================================================================
239239 `Connection.cursor` is called, we call `Cursor.close` on any existing, open
240240 cursor for that connection.
241241"""
242- from __future__ import absolute_import , unicode_literals
243242
244243import functools
245244import itertools
246245import weakref
247246import datetime
248247import re
249- import six
250248
251249from . import cdb2
252250
298296 \s* # then skip over any whitespace
299297 (\w+) # and capture the first word
300298 """ ,
301- re .VERBOSE | re .DOTALL | ( 0 if six . PY2 else re .ASCII ) ,
299+ re .VERBOSE | re .DOTALL | re .ASCII ,
302300)
303301_VALID_SP_NAME = re .compile (r'^[A-Za-z0-9_.]+$' )
304302
305303
306304@functools .total_ordering
307- class _TypeObject ( object ) :
305+ class _TypeObject :
308306 def __init__ (self , * value_names ):
309307 self .value_names = value_names
310308 self .values = [cdb2 .TYPE [v ] for v in value_names ]
@@ -320,7 +318,7 @@ def __repr__(self):
320318
321319
322320def _binary (string ):
323- if isinstance (string , six . text_type ):
321+ if isinstance (string , str ):
324322 return string .encode ('utf-8' )
325323 return bytes (string )
326324
@@ -350,10 +348,7 @@ def _binary(string):
350348TimestampFromTicks = Timestamp .fromtimestamp
351349TimestampUsFromTicks = TimestampUs .fromtimestamp
352350
353- try :
354- UserException = StandardError # Python 2
355- except NameError :
356- UserException = Exception # Python 3
351+ UserException = Exception
357352
358353
359354class Error (UserException ):
@@ -526,8 +521,8 @@ def _raise_wrapped_exception(exc):
526521 code = exc .error_code
527522 msg = '%s (cdb2api rc %d)' % (exc .error_message , code )
528523 if "null constraint violation" in msg :
529- six . raise_from ( NonNullConstraintError (msg ), exc ) # DRQS 86013831
530- six . raise_from ( _EXCEPTION_BY_RC .get (code , OperationalError )(msg ), exc )
524+ raise NonNullConstraintError (msg ) from exc # DRQS 86013831
525+ raise _EXCEPTION_BY_RC .get (code , OperationalError )(msg ) from exc
531526
532527
533528def _sql_operation (sql ):
@@ -566,7 +561,7 @@ def connect(*args, **kwargs):
566561 return Connection (* args , ** kwargs )
567562
568563
569- class Connection ( object ) :
564+ class Connection :
570565 """Represents a connection to a Comdb2 database.
571566
572567 By default, the connection will be made to the cluster configured as the
@@ -774,7 +769,7 @@ def cursor(self):
774769 NotSupportedError = NotSupportedError
775770
776771
777- class Cursor ( object ) :
772+ class Cursor :
778773 """Class used to send requests through a database connection.
779774
780775 This class is not meant to be instantiated directly; it should always be
@@ -1028,10 +1023,10 @@ def _execute(self, operation, sql, parameters=None):
10281023 sql = sql % {name : "@" + name for name in parameters }
10291024 except KeyError as keyerr :
10301025 msg = "No value provided for parameter %s" % keyerr
1031- six . raise_from ( InterfaceError (msg ), keyerr )
1026+ raise InterfaceError (msg ) from keyerr
10321027 except Exception as exc :
10331028 msg = "Invalid Python format string for query"
1034- six . raise_from ( InterfaceError (msg ), exc )
1029+ raise InterfaceError (msg ) from exc
10351030
10361031 if _operation_ends_transaction (operation ):
10371032 self ._conn ._in_transaction = False # txn ends, even on failure
0 commit comments