for i, item in enumerate(metadata):
colname = item[0]
+ # Py3K
+ # Py2K
if self.dialect.description_encoding:
colname = colname.decode(self.dialect.description_encoding)
+ # end Py2K
if '.' in colname:
# sqlite will in some circumstances prepend table name to colnames, so strip
def value(self, column):
"""Return a scalar result corresponding to the given column expression."""
try:
+ # Py3K
+ #return self.values(column).__next__()[0]
+ # Py2K
return self.values(column).next()[0]
+ # end Py2K
except StopIteration:
return None
import __builtin__
-__all__ = '_function_named', 'callable', 'py3k', 'jython', 'to_list'
+__all__ = '_function_named', 'callable', 'py3k', 'jython', 'to_list', 'cmp'
py3k = getattr(sys, 'py3kwarning', False) or sys.version_info >= (3, 0)
if py3k:
def callable(fn):
return hasattr(fn, '__call__')
+ def cmp(a, b):
+ return (a > b) - (a < b)
+
else:
callable = __builtin__.callable
-
+ cmp = __builtin__.cmp
+
if sys.platform.startswith('java'):
def gc_collect(*args):
gc.collect()
import traceback
import os
import types
-from testlib.compat import callable
+from testlib.compat import callable, cmp
##############################################################################
# Exported classes and functions