six: query.py: unicode --> text_type
@@ -70,7 +70,7 @@ class EncodeOnlyUnicode(object):
self.__stream = stream
def write(self, arg):
- if isinstance(arg, unicode):
+ if isinstance(arg, text_type):
self.__stream.write(arg.encode("utf-8"))
else:
self.__stream.write(arg)
@@ -120,7 +120,7 @@ class ResultRow(tuple):
instance = super(ResultRow, cls).__new__(
cls, (values.get(v) for v in labels))
- instance.labels = dict((unicode(x[1]), x[0])
+ instance.labels = dict((text_type(x[1]), x[0])
for x in enumerate(labels))
return instance
@@ -135,8 +135,8 @@ class ResultRow(tuple):
except TypeError:
if name in self.labels:
return tuple.__getitem__(self, self.labels[name])
- if unicode(name) in self.labels: # passing in variable object
- return tuple.__getitem__(self, self.labels[unicode(name)])
+ if text_type(name) in self.labels: # passing in variable object
+ return tuple.__getitem__(self, self.labels[text_type(name)])
raise KeyError(name)
def asdict(self):
