Solve some py3 compatibilty issues
1. replaced dict.keys() with six.iterkeys(dict) 2. replaced map with six.moves.map Change-Id: I4b80e12a4686fd6f5857c2322de13b1245e72083
This commit is contained in:
parent
97ae902a8d
commit
28715147df
designateclient
@ -106,17 +106,17 @@ class ListCommand(Command, Lister):
|
|||||||
|
|
||||||
class GetCommand(Command, ShowOne):
|
class GetCommand(Command, ShowOne):
|
||||||
def post_execute(self, results):
|
def post_execute(self, results):
|
||||||
return results.keys(), results.values()
|
return list(six.iterkeys(results)), list(six.itervalues(results))
|
||||||
|
|
||||||
|
|
||||||
class CreateCommand(Command, ShowOne):
|
class CreateCommand(Command, ShowOne):
|
||||||
def post_execute(self, results):
|
def post_execute(self, results):
|
||||||
return results.keys(), results.values()
|
return list(six.iterkeys(results)), list(six.itervalues(results))
|
||||||
|
|
||||||
|
|
||||||
class UpdateCommand(Command, ShowOne):
|
class UpdateCommand(Command, ShowOne):
|
||||||
def post_execute(self, results):
|
def post_execute(self, results):
|
||||||
return results.keys(), results.values()
|
return list(six.iterkeys(results)), list(six.itervalues(results))
|
||||||
|
|
||||||
|
|
||||||
class DeleteCommand(Command, ShowOne):
|
class DeleteCommand(Command, ShowOne):
|
||||||
|
@ -124,6 +124,6 @@ def Client(version, *args, **kwargs): # noqa
|
|||||||
versions = get_versions()
|
versions = get_versions()
|
||||||
if version not in versions:
|
if version not in versions:
|
||||||
msg = 'Version %s is not supported, use one of (%s)' % (
|
msg = 'Version %s is not supported, use one of (%s)' % (
|
||||||
version, versions.keys())
|
version, list(six.iterkeys(versions)))
|
||||||
raise exceptions.UnsupportedVersion(msg)
|
raise exceptions.UnsupportedVersion(msg)
|
||||||
return versions[version](*args, **kwargs)
|
return versions[version](*args, **kwargs)
|
||||||
|
@ -23,6 +23,7 @@ from keystoneclient.auth.identity import generic
|
|||||||
from keystoneclient.auth import token_endpoint
|
from keystoneclient.auth import token_endpoint
|
||||||
from keystoneclient import session as ks_session
|
from keystoneclient import session as ks_session
|
||||||
import pkg_resources
|
import pkg_resources
|
||||||
|
import six
|
||||||
|
|
||||||
from designateclient import exceptions
|
from designateclient import exceptions
|
||||||
|
|
||||||
@ -94,7 +95,8 @@ def get_columns(data):
|
|||||||
def _seen(col):
|
def _seen(col):
|
||||||
columns.add(str(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)
|
return list(columns)
|
||||||
|
|
||||||
|
|
||||||
|
@ -20,6 +20,7 @@ import copy
|
|||||||
import logging
|
import logging
|
||||||
|
|
||||||
import jsonschema
|
import jsonschema
|
||||||
|
import six
|
||||||
|
|
||||||
LOG = logging.getLogger(__name__)
|
LOG = logging.getLogger(__name__)
|
||||||
|
|
||||||
@ -112,19 +113,19 @@ def model_factory(schema):
|
|||||||
dict.update(self, other)
|
dict.update(self, other)
|
||||||
|
|
||||||
def iteritems(self):
|
def iteritems(self):
|
||||||
return copy.deepcopy(dict(self)).iteritems()
|
return six.iteritems(copy.deepcopy(dict(self)))
|
||||||
|
|
||||||
def items(self):
|
def items(self):
|
||||||
return copy.deepcopy(dict(self)).items()
|
return list(six.iteritems(copy.deepcopy(dict(self))))
|
||||||
|
|
||||||
def itervalues(self):
|
def itervalues(self):
|
||||||
return copy.deepcopy(dict(self)).itervalues()
|
return six.itervalues(copy.deepcopy(dict(self)))
|
||||||
|
|
||||||
def keys(self):
|
def keys(self):
|
||||||
return copy.deepcopy(dict(self)).keys()
|
return list(six.iterkeys(copy.deepcopy(dict(self))))
|
||||||
|
|
||||||
def values(self):
|
def values(self):
|
||||||
return copy.deepcopy(dict(self)).values()
|
return list(six.itervalues(copy.deepcopy(dict(self))))
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def changes(self):
|
def changes(self):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user