diff options
author | Wouter Bolsterlee <uws@xs4all.nl> | 2016-03-20 22:17:41 +0100 |
---|---|---|
committer | Wouter Bolsterlee <wouter@bolsterl.ee> | 2016-07-27 19:08:46 +0200 |
commit | f5652822120041bfdde642a55f564f94a5d147fc (patch) | |
tree | 701ec8c1c337b92ccfc32d1926e8ce9423121aed | |
parent | 75356bf802c6a7e6b9eb46078447c81d260916e7 (diff) | |
download | happybase-f5652822120041bfdde642a55f564f94a5d147fc.tar.gz |
Use six.iteritems()
-rw-r--r-- | happybase/batch.py | 9 | ||||
-rw-r--r-- | happybase/connection.py | 4 | ||||
-rw-r--r-- | happybase/table.py | 4 |
3 files changed, 12 insertions, 5 deletions
diff --git a/happybase/batch.py b/happybase/batch.py index a8162e9..ded9964 100644 --- a/happybase/batch.py +++ b/happybase/batch.py @@ -6,6 +6,8 @@ from collections import defaultdict import logging from numbers import Integral +import six + from .Hbase_thrift import BatchMutation, Mutation logger = logging.getLogger(__name__) @@ -45,7 +47,10 @@ class Batch(object): def send(self): """Send the batch to the server.""" - bms = [BatchMutation(row, m) for row, m in self._mutations.iteritems()] + bms = [ + BatchMutation(row, m) + for row, m in six.iteritems(self._mutations) + ] if not bms: return @@ -80,7 +85,7 @@ class Batch(object): column=column, value=value, writeToWAL=wal) - for column, value in data.iteritems()) + for column, value in six.iteritems(data)) self._mutation_count += len(data) if self._batch_size and self._mutation_count >= self._batch_size: diff --git a/happybase/connection.py b/happybase/connection.py index 32b6659..208c599 100644 --- a/happybase/connection.py +++ b/happybase/connection.py @@ -290,12 +290,12 @@ class Connection(object): % name) column_descriptors = [] - for cf_name, options in families.iteritems(): + for cf_name, options in six.iteritems(families): if options is None: options = dict() kwargs = dict() - for option_name, value in options.iteritems(): + for option_name, value in six.iteritems(options): kwargs[pep8_to_camel_case(option_name)] = value if not cf_name.endswith(':'): diff --git a/happybase/table.py b/happybase/table.py index 87be2f6..c0f2752 100644 --- a/happybase/table.py +++ b/happybase/table.py @@ -7,6 +7,8 @@ from numbers import Integral from operator import attrgetter from struct import Struct +from six import iteritems + from .Hbase_thrift import TScan from .util import thrift_type_to_dict, str_increment, OrderedDict @@ -22,7 +24,7 @@ pack_i64 = Struct('>q').pack def make_row(cell_map, include_timestamp): """Make a row dict for a cell mapping like ttypes.TRowResult.columns.""" cellfn = include_timestamp and make_cell_timestamp or make_cell - return dict((cn, cellfn(cell)) for cn, cell in cell_map.iteritems()) + return dict((cn, cellfn(cell)) for cn, cell in iteritems(cell_map)) def make_ordered_row(sorted_columns, include_timestamp): |