Skip to content

Commit 23e7f0c

Browse files
committed
Remove more python2 compat code
Remove code still adjusting for Python 2 behavior based on version checks. Change-Id: I29576a824278611d80991dce2501f14f1b262c76
1 parent cea1f67 commit 23e7f0c

2 files changed

Lines changed: 2 additions & 15 deletions

File tree

cinderclient/shell.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
from keystoneauth1.identity import v3 as v3_auth
3030
from keystoneauth1 import loading
3131
from keystoneauth1 import session
32-
from oslo_utils import encodeutils
3332
from oslo_utils import importutils
3433
import requests
3534
from urllib import parse as urlparse
@@ -1015,11 +1014,7 @@ def start_section(self, heading):
10151014

10161015
def main():
10171016
try:
1018-
if sys.version_info >= (3, 0):
1019-
OpenStackCinderShell().main(sys.argv[1:])
1020-
else:
1021-
OpenStackCinderShell().main([encodeutils.safe_decode(item)
1022-
for item in sys.argv[1:]])
1017+
OpenStackCinderShell().main(sys.argv[1:])
10231018
except KeyboardInterrupt:
10241019
print("... terminating cinder client", file=sys.stderr)
10251020
sys.exit(130)

cinderclient/utils.py

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,13 @@
1515

1616
import collections
1717
import os
18-
import sys
1918
from urllib import parse
2019
import uuid
2120

2221
import prettytable
2322
import stevedore
2423

2524
from cinderclient import exceptions
26-
from oslo_utils import encodeutils
2725

2826

2927
def arg(*args, **kwargs):
@@ -109,10 +107,7 @@ def isunauthenticated(f):
109107

110108

111109
def _print(pt, order):
112-
if sys.version_info >= (3, 0):
113-
print(pt.get_string(sortby=order))
114-
else:
115-
print(encodeutils.safe_encode(pt.get_string(sortby=order)))
110+
print(pt.get_string(sortby=order))
116111

117112

118113
def print_list(objs, fields, exclude_unavailable=False, formatters=None,
@@ -258,9 +253,6 @@ def find_resource(manager, name_or_id, **kwargs):
258253
except (ValueError, exceptions.NotFound):
259254
pass
260255

261-
if sys.version_info <= (3, 0):
262-
name_or_id = encodeutils.safe_decode(name_or_id)
263-
264256
try:
265257
try:
266258
resource = getattr(manager, 'resource_class', None)

0 commit comments

Comments
 (0)