summaryrefslogtreecommitdiff
path: root/glanceclient/common
diff options
context:
space:
mode:
authorCyril Roelandt <cyril@redhat.com>2022-09-13 16:15:13 +0200
committerCyril Roelandt <cyril@redhat.com>2022-11-14 11:49:33 +0100
commitfc8f9ac2edfb4daa0c48a650515de3e8eba18232 (patch)
tree112965eb23abb08879f182deb9b709c2f52c7bd2 /glanceclient/common
parenta3f13bdcb4108933fe6d99e9c4573ca74b52c5e5 (diff)
downloadpython-glanceclient-fc8f9ac2edfb4daa0c48a650515de3e8eba18232.tar.gz
Remove unicode-related Python2-only code
This commit: - removes the old "u" prefix from all strings - removes the unicode_key_value_to_string function Change-Id: I1da347e31e828fd2359f0935a4da47257116d4cb
Diffstat (limited to 'glanceclient/common')
-rw-r--r--glanceclient/common/utils.py23
1 files changed, 0 insertions, 23 deletions
diff --git a/glanceclient/common/utils.py b/glanceclient/common/utils.py
index c3f08de..598562a 100644
--- a/glanceclient/common/utils.py
+++ b/glanceclient/common/utils.py
@@ -269,34 +269,11 @@ def print_list(objs, fields, formatters=None, field_settings=None):
field_name = field.lower().replace(' ', '_')
data = getattr(o, field_name, None) or ''
row.append(data)
- count = 0
- # Converts unicode values in list to string
- for part in row:
- count = count + 1
- if isinstance(part, list):
- part = unicode_key_value_to_string(part)
- row[count - 1] = part
pt.add_row(row)
print(encodeutils.safe_decode(pt.get_string()))
-def _encode(src):
- """remove extra 'u' in PY2."""
- return src
-
-
-def unicode_key_value_to_string(src):
- """Recursively converts dictionary keys to strings."""
- if isinstance(src, dict):
- return dict((_encode(k),
- _encode(unicode_key_value_to_string(v)))
- for k, v in src.items())
- if isinstance(src, list):
- return [unicode_key_value_to_string(l) for l in src]
- return _encode(src)
-
-
def print_dict(d, max_column_width=80):
pt = prettytable.PrettyTable(['Property', 'Value'], caching=False)
pt.align = 'l'