Merge "Solve some py3 compatibilty issues"

This commit is contained in:
Jenkins 2015-07-27 13:48:07 +00:00 committed by Gerrit Code Review
commit c9d36d9d29
4 changed files with 13 additions and 10 deletions

View File

@ -106,17 +106,17 @@ class ListCommand(Command, Lister):
class GetCommand(Command, ShowOne):
def post_execute(self, results):
return results.keys(), results.values()
return list(six.iterkeys(results)), list(six.itervalues(results))
class CreateCommand(Command, ShowOne):
def post_execute(self, results):
return results.keys(), results.values()
return list(six.iterkeys(results)), list(six.itervalues(results))
class UpdateCommand(Command, ShowOne):
def post_execute(self, results):
return results.keys(), results.values()
return list(six.iterkeys(results)), list(six.itervalues(results))
class DeleteCommand(Command, ShowOne):

View File

@ -124,6 +124,6 @@ def Client(version, *args, **kwargs): # noqa
versions = get_versions()
if version not in versions:
msg = 'Version %s is not supported, use one of (%s)' % (
version, versions.keys())
version, list(six.iterkeys(versions)))
raise exceptions.UnsupportedVersion(msg)
return versions[version](*args, **kwargs)

View File

@ -23,6 +23,7 @@ from keystoneclient.auth.identity import generic
from keystoneclient.auth import token_endpoint
from keystoneclient import session as ks_session
import pkg_resources
import six
from designateclient import exceptions
@ -94,7 +95,8 @@ 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,
list(six.iterkeys(item))), data)
return list(columns)

View File

@ -20,6 +20,7 @@ import copy
import logging
import jsonschema
import six
LOG = logging.getLogger(__name__)
@ -112,19 +113,19 @@ def model_factory(schema):
dict.update(self, other)
def iteritems(self):
return copy.deepcopy(dict(self)).iteritems()
return six.iteritems(copy.deepcopy(dict(self)))
def items(self):
return copy.deepcopy(dict(self)).items()
return list(six.iteritems(copy.deepcopy(dict(self))))
def itervalues(self):
return copy.deepcopy(dict(self)).itervalues()
return six.itervalues(copy.deepcopy(dict(self)))
def keys(self):
return copy.deepcopy(dict(self)).keys()
return list(six.iterkeys(copy.deepcopy(dict(self))))
def values(self):
return copy.deepcopy(dict(self)).values()
return list(six.itervalues(copy.deepcopy(dict(self))))
@property
def changes(self):