diff options
author | Yassine Lamgarchal <yassine.lamgarchal@enovance.com> | 2014-01-10 11:13:21 +0100 |
---|---|---|
committer | Yassine Lamgarchal <yassine.lamgarchal@enovance.com> | 2014-01-13 12:15:15 +0100 |
commit | 02b00b6226436b0049e226e86210ed1c1cad53c6 (patch) | |
tree | 6edd827b5a3f12d607b6b736565e51870d0933a6 /glanceclient/common/utils.py | |
parent | 47de9cfd89bc711a49c6cd1e7a6665bb66c14d4a (diff) | |
download | python-glanceclient-02b00b6226436b0049e226e86210ed1c1cad53c6.tar.gz |
Python 3: use six.iteritems and six.string_types
six.iteritems() replaces dictionary.iteritems() on Python 2 and
dictionary.items() on Python 3.
six.string_types replaces basestring() in Python 2 and str
in Python 3.
Change-Id: Ia18510d167df35caec83626718010228e2140bc0
Diffstat (limited to 'glanceclient/common/utils.py')
-rw-r--r-- | glanceclient/common/utils.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/glanceclient/common/utils.py b/glanceclient/common/utils.py index 0120572..4aec25d 100644 --- a/glanceclient/common/utils.py +++ b/glanceclient/common/utils.py @@ -20,6 +20,8 @@ import os import sys import uuid +import six + if os.name == 'nt': import msvcrt else: @@ -63,7 +65,7 @@ def schema_args(schema_getter, omit=[]): kwargs)) else: properties = schema.get('properties', {}) - for name, property in properties.iteritems(): + for name, property in six.iteritems(properties): if name in omit: continue param = '--' + name.replace('_', '-') @@ -123,7 +125,7 @@ def print_dict(d, max_column_width=80): pt = prettytable.PrettyTable(['Property', 'Value'], caching=False) pt.align = 'l' pt.max_width = max_column_width - [pt.add_row(list(r)) for r in d.iteritems()] + [pt.add_row(list(r)) for r in six.iteritems(d)] print(strutils.safe_encode(pt.get_string(sortby='Property'))) |