diff options
author | Eric Harney <eharney@redhat.com> | 2021-03-08 09:02:30 -0500 |
---|---|---|
committer | Eric Harney <eharney@redhat.com> | 2021-03-08 09:06:14 -0500 |
commit | 23e7f0cb3434f32f56ac82678b6814ba95fa0855 (patch) | |
tree | 65eee68768b64c5fe6d0a1cffb376252eac2555c | |
parent | cea1f674ae1ce545c0cac209b423ac9d626f0c68 (diff) | |
download | python-cinderclient-23e7f0cb3434f32f56ac82678b6814ba95fa0855.tar.gz |
Remove more python2 compat code
Remove code still adjusting for Python 2
behavior based on version checks.
Change-Id: I29576a824278611d80991dce2501f14f1b262c76
-rw-r--r-- | cinderclient/shell.py | 7 | ||||
-rw-r--r-- | cinderclient/utils.py | 10 |
2 files changed, 2 insertions, 15 deletions
diff --git a/cinderclient/shell.py b/cinderclient/shell.py index 9e9cfb1..f0825d5 100644 --- a/cinderclient/shell.py +++ b/cinderclient/shell.py @@ -29,7 +29,6 @@ from keystoneauth1.identity import v2 as v2_auth from keystoneauth1.identity import v3 as v3_auth from keystoneauth1 import loading from keystoneauth1 import session -from oslo_utils import encodeutils from oslo_utils import importutils import requests from urllib import parse as urlparse @@ -1015,11 +1014,7 @@ class OpenStackHelpFormatter(argparse.HelpFormatter): def main(): try: - if sys.version_info >= (3, 0): - OpenStackCinderShell().main(sys.argv[1:]) - else: - OpenStackCinderShell().main([encodeutils.safe_decode(item) - for item in sys.argv[1:]]) + OpenStackCinderShell().main(sys.argv[1:]) except KeyboardInterrupt: print("... terminating cinder client", file=sys.stderr) sys.exit(130) diff --git a/cinderclient/utils.py b/cinderclient/utils.py index 8919fc6..99acc03 100644 --- a/cinderclient/utils.py +++ b/cinderclient/utils.py @@ -15,7 +15,6 @@ import collections import os -import sys from urllib import parse import uuid @@ -23,7 +22,6 @@ import prettytable import stevedore from cinderclient import exceptions -from oslo_utils import encodeutils def arg(*args, **kwargs): @@ -109,10 +107,7 @@ def isunauthenticated(f): def _print(pt, order): - if sys.version_info >= (3, 0): - print(pt.get_string(sortby=order)) - else: - print(encodeutils.safe_encode(pt.get_string(sortby=order))) + print(pt.get_string(sortby=order)) def print_list(objs, fields, exclude_unavailable=False, formatters=None, @@ -258,9 +253,6 @@ def find_resource(manager, name_or_id, **kwargs): except (ValueError, exceptions.NotFound): pass - if sys.version_info <= (3, 0): - name_or_id = encodeutils.safe_decode(name_or_id) - try: try: resource = getattr(manager, 'resource_class', None) |