Remove all usage of six library

Convert all code to not require six library and instead
use python 3.x logic.

Change-Id: I21f625ee26ced8639610285c505a24b4559a9b24
This commit is contained in:
jacky06 2020-05-10 23:16:31 +08:00
parent 5863c2bdf6
commit 40af460e7b
7 changed files with 12 additions and 20 deletions

View File

@ -23,7 +23,6 @@ Exception definitions.
import inspect
import sys
import six
from congressclient.i18n import _
@ -411,7 +410,7 @@ class HttpVersionNotSupported(HttpServerError):
# _code_map contains all the classes that have http_status attribute.
_code_map = dict(
(getattr(obj, 'http_status', None), obj)
for name, obj in six.iteritems(vars(sys.modules[__name__]))
for name, obj in vars(sys.modules[__name__]).items()
if inspect.isclass(obj) and getattr(obj, 'http_status', False)
)

View File

@ -19,7 +19,6 @@ from cliff import lister
from cliff import show
from oslo_log import log as logging
from oslo_serialization import jsonutils
import six
from congressclient.common import parseractions
from congressclient.common import utils
@ -99,7 +98,7 @@ class ShowDatasourceStatus(show.ShowOne):
client = self.app.client_manager.congressclient
datasource_id = parsed_args.datasource_name
data = client.list_datasource_status(datasource_id)
return zip(*sorted(six.iteritems(data)))
return zip(*sorted(data.items()))
class ShowDatasourceActions(lister.Lister):
@ -262,7 +261,7 @@ class ShowDatasourceTable(show.ShowOne):
client = self.app.client_manager.congressclient
data = client.show_datasource_table(parsed_args.datasource_name,
parsed_args.table_id)
return zip(*sorted(six.iteritems(data)))
return zip(*sorted(data.items()))
class CreateDatasource(show.ShowOne):
@ -305,7 +304,7 @@ class CreateDatasource(show.ShowOne):
if parsed_args.description:
body['description'] = parsed_args.description
results = client.create_datasource(body)
return zip(*sorted(six.iteritems(results)))
return zip(*sorted(results.items()))
class DeleteDatasource(command.Command):

View File

@ -17,7 +17,6 @@
from cliff import lister
from cliff import show
from oslo_log import log as logging
import six
from congressclient.common import utils
@ -68,7 +67,7 @@ class ShowDriverConfig(show.ShowOne):
parsed_args.driver)
# remove table schema info from displaying
del data['tables']
return zip(*sorted(six.iteritems(data)))
return zip(*sorted(data.items()))
columns = ['id']
formatters = {'DriverTables': utils.format_list}
return (columns,

View File

@ -22,7 +22,6 @@ from cliff import show
from keystoneauth1 import exceptions
from oslo_log import log as logging
from oslo_serialization import jsonutils
import six
import yaml
from congressclient.common import utils
@ -90,7 +89,7 @@ class CreatePolicyRule(show.ShowOne):
if parsed_args.comment:
body['comment'] = parsed_args.comment
data = client.create_policy_rule(parsed_args.policy_name, body)
return zip(*sorted(six.iteritems(data)))
return zip(*sorted(data.items()))
class DeletePolicyRule(command.Command):
@ -304,7 +303,7 @@ class CreatePolicy(show.ShowOne):
'abbreviation': parsed_args.abbreviation,
'kind': parsed_args.kind}
data = client.create_policy(body)
return zip(*sorted(six.iteritems(data)))
return zip(*sorted(data.items()))
class CreatePolicyFromFile(show.ShowOne):
@ -345,7 +344,7 @@ class CreatePolicyFromFile(show.ShowOne):
return "\n".join(rule_str_list)
data['rules'] = rule_dict_to_string(data['rules'])
return zip(*sorted(six.iteritems(data)))
return zip(*sorted(data.items()))
class DeletePolicy(command.Command):
@ -439,7 +438,7 @@ class ShowPolicyRule(show.ShowOne):
rule_id = utils.get_resource_id_from_name(
parsed_args.rule_id, results)
data = client.show_policy_rule(parsed_args.policy_name, rule_id)
return zip(*sorted(six.iteritems(data)))
return zip(*sorted(data.items()))
class ShowPolicyTable(show.ShowOne):
@ -468,7 +467,7 @@ class ShowPolicyTable(show.ShowOne):
client = self.app.client_manager.congressclient
data = client.show_policy_table(parsed_args.policy_name,
parsed_args.table_id)
return zip(*sorted(six.iteritems(data)))
return zip(*sorted(data.items()))
class ShowPolicy(show.ShowOne):
@ -495,4 +494,4 @@ class ShowPolicy(show.ShowOne):
policy_id = utils.get_resource_id_from_name(
parsed_args.policy_name, results)
data = client.show_policy(policy_id)
return zip(*sorted(six.iteritems(data)))
return zip(*sorted(data.items()))

View File

@ -15,8 +15,6 @@
import sys
import six
AUTH_TOKEN = "foobar"
AUTH_URL = "http://0.0.0.0"
@ -71,7 +69,7 @@ class FakeResource(object):
self._loaded = loaded
def _add_details(self, info):
for (k, v) in six.iteritems(info):
for (k, v) in info.items():
setattr(self, k, v)
def __repr__(self):

View File

@ -48,7 +48,6 @@ pytz==2018.3
PyYAML==3.12
requests==2.18.4
rfc3986==1.1.0
six==1.10.0
snowballstemmer==1.2.1
Sphinx==1.8.0
sphinxcontrib-websupport==1.0.1

View File

@ -8,4 +8,3 @@ keystoneauth1>=3.4.0 # Apache-2.0
oslo.i18n>=3.15.3 # Apache-2.0
oslo.log>=3.36.0 # Apache-2.0
oslo.serialization!=2.19.1,>=2.18.0 # Apache-2.0
six>=1.10.0 # MIT