Remove usage of six

With python3.x, classes can use 'metaclass=' instead of
'six.add_metaclass', 'six.iteritems' and 'six.iterkeys' can
be replaced by 'items' and 'keys', 'six.moves.urllib.parse'
can be replaced by 'urllib.parse', 'six.StringIO' and
'six.moves.cStringIO' can be replaced by 'io.StringIO',
'six.text_type' and 'six.string_type' are just 'str'.

Change-Id: I84848c0bf8ab3c36dd821141191e2725e4e3b58b
This commit is contained in:
songwenping
2020-10-06 14:26:27 +08:00
committed by root
parent 098a3fe2de
commit c2df9215e1
15 changed files with 30 additions and 51 deletions

@ -16,13 +16,11 @@
"""Command-line interface to the OpenStack APIs"""
import locale
import sys
from osc_lib.api import auth
from osc_lib.command import commandmanager
from osc_lib import shell
import six
import openstackclient
from openstackclient.common import clientmanager
@ -143,12 +141,6 @@ class OpenStackShell(shell.OpenStackShell):
def main(argv=None):
if argv is None:
argv = sys.argv[1:]
if six.PY2:
# Emulate Py3, decode argv into Unicode based on locale so that
# commands always see arguments as text instead of binary data
encoding = locale.getpreferredencoding()
if encoding:
argv = map(lambda arg: arg.decode(encoding), argv)
return OpenStackShell().run(argv)