Use six.moves.map/zip in place of map/zip

Partially-Implements: blueprint designate-py3

Change-Id: I86772816d9d2d9419e330fccfc32ecdc993d305c
This commit is contained in:
Pradeep Kumar Singh 2015-06-30 06:41:14 +05:30
parent 77783cb377
commit fc74c3a10b
5 changed files with 10 additions and 5 deletions

View File

@ -16,6 +16,7 @@
import copy
import threading
import six
from oslo_config import cfg
from oslo_db import options
from oslo_log import log as logging
@ -122,7 +123,7 @@ class PowerDNSBackend(base.Backend):
def _parse_master(master):
return '%s:%d' % (master.host, master.port)
masters = map(_parse_master, self.masters)
masters = six.moves.map(_parse_master, self.masters)
domain_values = {
'designate_id': domain['id'],

View File

@ -301,7 +301,7 @@ class SQLAlchemy(object):
ids = inner_rproxy.fetchall()
# formatted_ids = [id[0] for id in ids]
formatted_ids = map(operator.itemgetter(0), ids)
formatted_ids = six.moves.map(operator.itemgetter(0), ids)
query = select(
[

View File

@ -17,6 +17,7 @@
# under the License.
import logging
import six
import sqlalchemy
from sqlalchemy import exc as sqlalchemy_exc
from sqlalchemy import select
@ -100,7 +101,8 @@ def sort_query(query, table, sort_keys, sort_dir=None, sort_dirs=None):
assert(len(sort_dirs) == len(sort_keys))
for current_sort_key, current_sort_dir in zip(sort_keys, sort_dirs):
for current_sort_key, current_sort_dir in \
six.moves.zip(sort_keys, sort_dirs):
try:
sort_dir_func = {
'asc': sqlalchemy.asc,

View File

@ -13,6 +13,7 @@
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
import six
from mock import patch
import oslo_messaging as messaging
from oslo_log import log as logging
@ -263,7 +264,8 @@ class ApiV2RecordSetsTest(ApiV2TestCase):
correct_results = [2, 1, 1]
for get_url, correct_result in zip(get_urls, correct_results):
for get_url, correct_result in \
six.moves.zip(get_urls, correct_results):
response = self.client.get(get_url)

View File

@ -213,7 +213,7 @@ def get_columns(data):
def _seen(col):
columns.add(str(col))
map(lambda item: map(_seen, item.keys()), data)
six.moves.map(lambda item: six.moves.map(_seen, item.keys()), data)
return list(columns)