Remove six

This library no longer supports python 2 thus usage of six is no longer
needed.

Change-Id: Idb5403b4ce049b4a739489c7bd42fbf694c894dd
This commit is contained in:
Takashi Kajinami 2024-01-28 16:59:28 +09:00
parent a3445ded36
commit 33bcb8b04f
21 changed files with 60 additions and 82 deletions

View File

@ -1,7 +1,3 @@
# The order of packages is significant, because pip processes them in the order
# of appearance. Changing the order has an impact on the overall integration
# process, which may cause wedges in the gate later.
cliff!=2.9.0,>=2.11.0 # Apache-2.0 cliff!=2.9.0,>=2.11.0 # Apache-2.0
osc-lib>=1.10.0 # Apache-2.0 osc-lib>=1.10.0 # Apache-2.0
oslo.i18n>=3.20.0 # Apache-2.0 oslo.i18n>=3.20.0 # Apache-2.0
@ -9,5 +5,4 @@ oslo.serialization!=2.19.1,>=2.18.0 # Apache-2.0
oslo.utils>=3.36.0 # Apache-2.0 oslo.utils>=3.36.0 # Apache-2.0
pbr!=2.1.0,>=3.1.1 # Apache-2.0 pbr!=2.1.0,>=3.1.1 # Apache-2.0
keystoneauth1>=3.4.0 # Apache-2.0 keystoneauth1>=3.4.0 # Apache-2.0
six>=1.11.0 # MIT
PyYAML>=3.13 # MIT PyYAML>=3.13 # MIT

View File

@ -1,7 +1,3 @@
# The order of packages is significant, because pip processes them in the order
# of appearance. Changing the order has an impact on the overall integration
# process, which may cause wedges in the gate later.
coverage!=4.4,>=4.0 # Apache-2.0 coverage!=4.4,>=4.0 # Apache-2.0
fixtures>=3.0.0 # Apache-2.0/BSD fixtures>=3.0.0 # Apache-2.0/BSD
hacking>=3.0.1,<3.1.0 # Apache-2.0 hacking>=3.0.1,<3.1.0 # Apache-2.0

View File

@ -39,10 +39,9 @@ Base utilities to build API operation managers and objects on top of.
import abc import abc
import copy import copy
from urllib import parse
from oslo_utils import strutils from oslo_utils import strutils
import six
from six.moves.urllib import parse
from watcherclient._i18n import _ from watcherclient._i18n import _
from watcherclient.common.apiclient import exceptions from watcherclient.common.apiclient import exceptions
@ -224,8 +223,7 @@ class BaseManager(HookableMixin):
return self.client.delete(url) return self.client.delete(url)
@six.add_metaclass(abc.ABCMeta) class ManagerWithFind(BaseManager, metaclass=abc.ABCMeta):
class ManagerWithFind(BaseManager):
"""Manager with additional `find()`/`findall()` methods.""" """Manager with additional `find()`/`findall()` methods."""
@abc.abstractmethod @abc.abstractmethod

View File

@ -36,8 +36,6 @@ Exception definitions.
import inspect import inspect
import sys import sys
import six
from watcherclient._i18n import _ from watcherclient._i18n import _
@ -457,7 +455,7 @@ def from_response(response, method, url):
kwargs["message"] = (error.get("message") or kwargs["message"] = (error.get("message") or
error.get("faultstring")) error.get("faultstring"))
kwargs["details"] = (error.get("details") or kwargs["details"] = (error.get("details") or
six.text_type(body)) str(body))
elif content_type.startswith("text/"): elif content_type.startswith("text/"):
kwargs["details"] = response.text kwargs["details"] = response.text

View File

@ -19,8 +19,7 @@ Base utilities to build API operation managers and objects on top of.
""" """
import copy import copy
from urllib import parse as urlparse
import six.moves.urllib.parse as urlparse
from watcherclient.common.apiclient import base from watcherclient.common.apiclient import base

View File

@ -18,7 +18,6 @@ import logging
from cliff import command from cliff import command
from cliff import lister from cliff import lister
from cliff import show from cliff import show
import six
class CommandMeta(abc.ABCMeta): class CommandMeta(abc.ABCMeta):
@ -30,8 +29,7 @@ class CommandMeta(abc.ABCMeta):
return super(CommandMeta, mcs).__new__(mcs, name, bases, cls_dict) return super(CommandMeta, mcs).__new__(mcs, name, bases, cls_dict)
@six.add_metaclass(CommandMeta) class Command(command.Command, metaclass=CommandMeta):
class Command(command.Command):
def run(self, parsed_args): def run(self, parsed_args):
self.log.debug('run(%s)', parsed_args) self.log.debug('run(%s)', parsed_args)

View File

@ -17,21 +17,21 @@ import copy
from distutils import version from distutils import version
import functools import functools
import hashlib import hashlib
import http.client
import io
import logging import logging
import os import os
import socket import socket
import ssl import ssl
import textwrap import textwrap
import time import time
from urllib import parse as urlparse
from keystoneauth1 import adapter from keystoneauth1 import adapter
from keystoneauth1 import exceptions as kexceptions from keystoneauth1 import exceptions as kexceptions
from oslo_serialization import jsonutils from oslo_serialization import jsonutils
from oslo_utils import strutils from oslo_utils import strutils
import requests import requests
import six
from six.moves import http_client
import six.moves.urllib.parse as urlparse
from watcherclient._i18n import _ from watcherclient._i18n import _
from watcherclient.common import api_versioning from watcherclient.common import api_versioning
@ -247,7 +247,7 @@ class HTTPClient(VersionNegotiationMixin):
if not self.session.verify: if not self.session.verify:
curl.append('-k') curl.append('-k')
elif isinstance(self.session.verify, six.string_types): elif isinstance(self.session.verify, str):
curl.append('--cacert %s' % self.session.verify) curl.append('--cacert %s' % self.session.verify)
if self.session.cert: if self.session.cert:
@ -325,7 +325,7 @@ class HTTPClient(VersionNegotiationMixin):
# to servers that did not support microversions. Details here: # to servers that did not support microversions. Details here:
# http://specs.openstack.org/openstack/watcher-specs/specs/kilo/api-microversions.html#use-case-3b-new-client-communicating-with-a-old-watcher-user-specified # noqa # http://specs.openstack.org/openstack/watcher-specs/specs/kilo/api-microversions.html#use-case-3b-new-client-communicating-with-a-old-watcher-user-specified # noqa
if resp.status_code == http_client.NOT_ACCEPTABLE: if resp.status_code == http.client.NOT_ACCEPTABLE:
negotiated_ver = self.negotiate_version(self.session, resp) negotiated_ver = self.negotiate_version(self.session, resp)
kwargs['headers']['OpenStack-API-Version'] = ( kwargs['headers']['OpenStack-API-Version'] = (
' '.join(['infra-optim', negotiated_ver])) ' '.join(['infra-optim', negotiated_ver]))
@ -357,21 +357,21 @@ class HTTPClient(VersionNegotiationMixin):
] ]
body_str = ''.join(body_list) body_str = ''.join(body_list)
self.log_http_response(resp, body_str) self.log_http_response(resp, body_str)
body_iter = six.StringIO(body_str) body_iter = io.StringIO(body_str)
else: else:
self.log_http_response(resp) self.log_http_response(resp)
if resp.status_code >= http_client.BAD_REQUEST: if resp.status_code >= http.client.BAD_REQUEST:
error_json = _extract_error_json(body_str) error_json = _extract_error_json(body_str)
raise exceptions.from_response( raise exceptions.from_response(
resp, error_json.get('faultstring'), resp, error_json.get('faultstring'),
error_json.get('debuginfo'), method, url) error_json.get('debuginfo'), method, url)
elif resp.status_code in (http_client.MOVED_PERMANENTLY, elif resp.status_code in (http.client.MOVED_PERMANENTLY,
http_client.FOUND, http.client.FOUND,
http_client.USE_PROXY): http.client.USE_PROXY):
# Redirected. Reissue the request to the new location. # Redirected. Reissue the request to the new location.
return self._http_request(resp['location'], method, **kwargs) return self._http_request(resp['location'], method, **kwargs)
elif resp.status_code == http_client.MULTIPLE_CHOICES: elif resp.status_code == http.client.MULTIPLE_CHOICES:
raise exceptions.from_response(resp, method=method, url=url) raise exceptions.from_response(resp, method=method, url=url)
return resp, body_iter return resp, body_iter
@ -387,8 +387,8 @@ class HTTPClient(VersionNegotiationMixin):
resp, body_iter = self._http_request(url, method, **kwargs) resp, body_iter = self._http_request(url, method, **kwargs)
content_type = resp.headers.get('Content-Type') content_type = resp.headers.get('Content-Type')
if (resp.status_code in (http_client.NO_CONTENT, if (resp.status_code in (http.client.NO_CONTENT,
http_client.RESET_CONTENT) or http.client.RESET_CONTENT) or
content_type is None): content_type is None):
return resp, list() return resp, list()
@ -410,7 +410,7 @@ class HTTPClient(VersionNegotiationMixin):
return self._http_request(url, method, **kwargs) return self._http_request(url, method, **kwargs)
class VerifiedHTTPSConnection(six.moves.http_client.HTTPSConnection): class VerifiedHTTPSConnection(http.client.HTTPSConnection):
"""httplib-compatible connection using client-side SSL authentication """httplib-compatible connection using client-side SSL authentication
:see http://code.activestate.com/recipes/ :see http://code.activestate.com/recipes/
@ -419,9 +419,8 @@ class VerifiedHTTPSConnection(six.moves.http_client.HTTPSConnection):
def __init__(self, host, port, key_file=None, cert_file=None, def __init__(self, host, port, key_file=None, cert_file=None,
ca_file=None, timeout=None, insecure=False): ca_file=None, timeout=None, insecure=False):
six.moves.http_client.HTTPSConnection.__init__(self, host, port, super(VerifiedHTTPSConnection, self).__init__(
key_file=key_file, self, host, port, key_file=key_file, cert_file=cert_file)
cert_file=cert_file)
self.key_file = key_file self.key_file = key_file
self.cert_file = cert_file self.cert_file = cert_file
if ca_file is not None: if ca_file is not None:
@ -503,7 +502,7 @@ class SessionClient(VersionNegotiationMixin, adapter.LegacyJsonAdapter):
def _http_request(self, url, method, **kwargs): def _http_request(self, url, method, **kwargs):
kwargs.setdefault('user_agent', USER_AGENT) kwargs.setdefault('user_agent', USER_AGENT)
kwargs.setdefault('auth', self.auth) kwargs.setdefault('auth', self.auth)
if isinstance(self.endpoint_override, six.string_types): if isinstance(self.endpoint_override, str):
kwargs.setdefault( kwargs.setdefault(
'endpoint_override', 'endpoint_override',
_trim_endpoint_api_version(self.endpoint_override) _trim_endpoint_api_version(self.endpoint_override)
@ -527,22 +526,22 @@ class SessionClient(VersionNegotiationMixin, adapter.LegacyJsonAdapter):
resp = self.session.request(url, method, resp = self.session.request(url, method,
raise_exc=False, **kwargs) raise_exc=False, **kwargs)
if resp.status_code == http_client.NOT_ACCEPTABLE: if resp.status_code == http.client.NOT_ACCEPTABLE:
negotiated_ver = self.negotiate_version(self.session, resp) negotiated_ver = self.negotiate_version(self.session, resp)
kwargs['headers']['OpenStack-API-Version'] = ( kwargs['headers']['OpenStack-API-Version'] = (
' '.join(['infra-optim', negotiated_ver])) ' '.join(['infra-optim', negotiated_ver]))
return self._http_request(url, method, **kwargs) return self._http_request(url, method, **kwargs)
if resp.status_code >= http_client.BAD_REQUEST: if resp.status_code >= http.client.BAD_REQUEST:
error_json = _extract_error_json(resp.content) error_json = _extract_error_json(resp.content)
raise exceptions.from_response( raise exceptions.from_response(
resp, error_json.get('faultstring'), resp, error_json.get('faultstring'),
error_json.get('debuginfo'), method, url) error_json.get('debuginfo'), method, url)
elif resp.status_code in (http_client.MOVED_PERMANENTLY, elif resp.status_code in (http.client.MOVED_PERMANENTLY,
http_client.FOUND, http_client.USE_PROXY): http.client.FOUND, http.client.USE_PROXY):
# Redirected. Reissue the request to the new location. # Redirected. Reissue the request to the new location.
location = resp.headers.get('location') location = resp.headers.get('location')
resp = self._http_request(location, method, **kwargs) resp = self._http_request(location, method, **kwargs)
elif resp.status_code == http_client.MULTIPLE_CHOICES: elif resp.status_code == http.client.MULTIPLE_CHOICES:
raise exceptions.from_response(resp, method=method, url=url) raise exceptions.from_response(resp, method=method, url=url)
return resp return resp
@ -558,7 +557,7 @@ class SessionClient(VersionNegotiationMixin, adapter.LegacyJsonAdapter):
body = resp.content body = resp.content
content_type = resp.headers.get('content-type', None) content_type = resp.headers.get('content-type', None)
status = resp.status_code status = resp.status_code
if (status in (http_client.NO_CONTENT, http_client.RESET_CONTENT) or if (status in (http.client.NO_CONTENT, http.client.RESET_CONTENT) or
content_type is None): content_type is None):
return resp, list() return resp, list()
if 'application/json' in content_type: if 'application/json' in content_type:

View File

@ -14,12 +14,12 @@
# under the License. # under the License.
import copy import copy
import io
import os import os
from unittest import mock from unittest import mock
import fixtures import fixtures
from oslo_utils import strutils from oslo_utils import strutils
import six
import testtools import testtools
@ -51,7 +51,7 @@ class FakeAPI(object):
def raw_request(self, *args, **kwargs): def raw_request(self, *args, **kwargs):
response = self._request(*args, **kwargs) response = self._request(*args, **kwargs)
body_iter = iter(six.StringIO(response[1])) body_iter = iter(io.StringIO(response[1]))
return FakeResponse(response[0]), body_iter return FakeResponse(response[0]), body_iter
def json_request(self, *args, **kwargs): def json_request(self, *args, **kwargs):

View File

@ -14,10 +14,10 @@
# limitations under the License. # limitations under the License.
import datetime import datetime
import io
from unittest import mock from unittest import mock
from oslo_utils.uuidutils import generate_uuid from oslo_utils.uuidutils import generate_uuid
import six
from watcherclient import exceptions from watcherclient import exceptions
from watcherclient import shell from watcherclient import shell
@ -104,7 +104,7 @@ class ActionPlanShellTest(base.CommandTestCase):
self.m_audit_template_mgr_cls.return_value = self.m_audit_template_mgr self.m_audit_template_mgr_cls.return_value = self.m_audit_template_mgr
self.m_action_plan_mgr_cls.return_value = self.m_action_plan_mgr self.m_action_plan_mgr_cls.return_value = self.m_action_plan_mgr
self.stdout = six.StringIO() self.stdout = io.StringIO()
self.cmd = shell.WatcherShell(stdout=self.stdout) self.cmd = shell.WatcherShell(stdout=self.stdout)
def test_do_action_plan_list(self): def test_do_action_plan_list(self):

View File

@ -14,10 +14,9 @@
# under the License. # under the License.
import datetime import datetime
import io
from unittest import mock from unittest import mock
import six
from watcherclient import exceptions from watcherclient import exceptions
from watcherclient import shell from watcherclient import shell
from watcherclient.tests.unit.v1 import base from watcherclient.tests.unit.v1 import base
@ -96,7 +95,7 @@ class ActionShellTest(base.CommandTestCase):
self.m_action_mgr_cls.return_value = self.m_action_mgr self.m_action_mgr_cls.return_value = self.m_action_mgr
self.m_action_plan_mgr_cls.return_value = self.m_action_plan_mgr self.m_action_plan_mgr_cls.return_value = self.m_action_plan_mgr
self.stdout = six.StringIO() self.stdout = io.StringIO()
self.cmd = shell.WatcherShell(stdout=self.stdout) self.cmd = shell.WatcherShell(stdout=self.stdout)
def test_do_action_list(self): def test_do_action_list(self):

View File

@ -14,10 +14,9 @@
# under the License. # under the License.
import datetime import datetime
import io
from unittest import mock from unittest import mock
import six
from watcherclient import shell from watcherclient import shell
from watcherclient.tests.unit.v1 import base from watcherclient.tests.unit.v1 import base
from watcherclient import v1 as resource from watcherclient import v1 as resource
@ -164,7 +163,7 @@ class AuditShellTest(base.CommandTestCase):
self.m_audit_template_mgr_cls.return_value = self.m_audit_template_mgr self.m_audit_template_mgr_cls.return_value = self.m_audit_template_mgr
# stdout mock # stdout mock
self.stdout = six.StringIO() self.stdout = io.StringIO()
self.cmd = shell.WatcherShell(stdout=self.stdout) self.cmd = shell.WatcherShell(stdout=self.stdout)
def test_do_audit_list(self): def test_do_audit_list(self):

View File

@ -14,8 +14,8 @@
# under the License. # under the License.
import copy import copy
from urllib import parse as urlparse
from six.moves.urllib import parse as urlparse
from testtools import matchers from testtools import matchers
from watcherclient.tests.unit import utils from watcherclient.tests.unit import utils

View File

@ -14,10 +14,9 @@
# under the License. # under the License.
import datetime import datetime
import io
from unittest import mock from unittest import mock
import six
from watcherclient import shell from watcherclient import shell
from watcherclient.tests.unit.v1 import base from watcherclient.tests.unit.v1 import base
from watcherclient import v1 as resource from watcherclient import v1 as resource
@ -108,7 +107,7 @@ class AuditTemplateShellTest(base.CommandTestCase):
self.m_audit_template_mgr_cls.return_value = self.m_audit_template_mgr self.m_audit_template_mgr_cls.return_value = self.m_audit_template_mgr
# stdout mock # stdout mock
self.stdout = six.StringIO() self.stdout = io.StringIO()
self.cmd = shell.WatcherShell(stdout=self.stdout) self.cmd = shell.WatcherShell(stdout=self.stdout)
def test_do_audit_template_list(self): def test_do_audit_template_list(self):

View File

@ -13,10 +13,9 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
import io
from unittest import mock from unittest import mock
import six
from watcherclient import shell from watcherclient import shell
from watcherclient.tests.unit.v1 import base from watcherclient.tests.unit.v1 import base
from watcherclient import v1 as resource from watcherclient import v1 as resource
@ -92,7 +91,7 @@ class DataModelShellTest(base.CommandTestCase):
self.m_data_model_mgr_cls.return_value = self.m_data_model_mgr self.m_data_model_mgr_cls.return_value = self.m_data_model_mgr
self.stdout = six.StringIO() self.stdout = io.StringIO()
self.cmd = shell.WatcherShell(stdout=self.stdout) self.cmd = shell.WatcherShell(stdout=self.stdout)
def test_do_data_model_list(self): def test_do_data_model_list(self):

View File

@ -14,10 +14,9 @@
# limitations under the License. # limitations under the License.
import datetime import datetime
import io
from unittest import mock from unittest import mock
import six
from watcherclient import shell from watcherclient import shell
from watcherclient.tests.unit.v1 import base from watcherclient.tests.unit.v1 import base
from watcherclient import v1 as resource from watcherclient import v1 as resource
@ -73,7 +72,7 @@ class GoalShellTest(base.CommandTestCase):
self.m_goal_mgr = mock.Mock() self.m_goal_mgr = mock.Mock()
self.m_goal_mgr_cls.return_value = self.m_goal_mgr self.m_goal_mgr_cls.return_value = self.m_goal_mgr
self.stdout = six.StringIO() self.stdout = io.StringIO()
self.cmd = shell.WatcherShell(stdout=self.stdout) self.cmd = shell.WatcherShell(stdout=self.stdout)
def test_do_goal_list(self): def test_do_goal_list(self):

View File

@ -14,10 +14,9 @@
# limitations under the License. # limitations under the License.
import datetime import datetime
import io
from unittest import mock from unittest import mock
import six
from watcherclient import shell from watcherclient import shell
from watcherclient.tests.unit.v1 import base from watcherclient.tests.unit.v1 import base
from watcherclient import v1 as resource from watcherclient import v1 as resource
@ -63,7 +62,7 @@ class ScoringEngineShellTest(base.CommandTestCase):
self.m_se_mgr = mock.Mock() self.m_se_mgr = mock.Mock()
self.m_se_mgr_cls.return_value = self.m_se_mgr self.m_se_mgr_cls.return_value = self.m_se_mgr
self.stdout = six.StringIO() self.stdout = io.StringIO()
self.cmd = shell.WatcherShell(stdout=self.stdout) self.cmd = shell.WatcherShell(stdout=self.stdout)
def test_do_scoringengine_list(self): def test_do_scoringengine_list(self):

View File

@ -14,10 +14,9 @@
# limitations under the License. # limitations under the License.
import datetime import datetime
import io
from unittest import mock from unittest import mock
import six
from watcherclient import shell from watcherclient import shell
from watcherclient.tests.unit.v1 import base from watcherclient.tests.unit.v1 import base
from watcherclient import v1 as resource from watcherclient import v1 as resource
@ -62,7 +61,7 @@ class ServiceShellTest(base.CommandTestCase):
self.m_service_mgr = mock.Mock() self.m_service_mgr = mock.Mock()
self.m_service_mgr_cls.return_value = self.m_service_mgr self.m_service_mgr_cls.return_value = self.m_service_mgr
self.stdout = six.StringIO() self.stdout = io.StringIO()
self.cmd = shell.WatcherShell(stdout=self.stdout) self.cmd = shell.WatcherShell(stdout=self.stdout)
def test_do_service_list(self): def test_do_service_list(self):

View File

@ -14,10 +14,10 @@
# limitations under the License. # limitations under the License.
import datetime import datetime
import io
from unittest import mock from unittest import mock
from oslo_serialization import jsonutils from oslo_serialization import jsonutils
import six
from watcherclient import shell from watcherclient import shell
from watcherclient.tests.unit.v1 import base from watcherclient.tests.unit.v1 import base
@ -69,7 +69,7 @@ class StrategyShellTest(base.CommandTestCase):
self.m_strategy_mgr = mock.Mock() self.m_strategy_mgr = mock.Mock()
self.m_strategy_mgr_cls.return_value = self.m_strategy_mgr self.m_strategy_mgr_cls.return_value = self.m_strategy_mgr
self.stdout = six.StringIO() self.stdout = io.StringIO()
self.cmd = shell.WatcherShell(stdout=self.stdout) self.cmd = shell.WatcherShell(stdout=self.stdout)
def test_do_strategy_list(self): def test_do_strategy_list(self):

View File

@ -13,10 +13,11 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
import io
from cliff.formatters import yaml_format from cliff.formatters import yaml_format
from osc_lib import utils from osc_lib import utils
from oslo_utils import uuidutils from oslo_utils import uuidutils
import six
from watcherclient._i18n import _ from watcherclient._i18n import _
from watcherclient.common import command from watcherclient.common import command
@ -51,7 +52,7 @@ class ShowActionPlan(command.ShowOne):
return parser return parser
def _format_indicators(self, action_plan, parsed_args): def _format_indicators(self, action_plan, parsed_args):
out = six.StringIO() out = io.StringIO()
efficacy_indicators = action_plan.efficacy_indicators efficacy_indicators = action_plan.efficacy_indicators
fields = ['name', 'description', 'value', 'unit'] fields = ['name', 'description', 'value', 'unit']
yaml_format.YAMLFormatter().emit_list( yaml_format.YAMLFormatter().emit_list(
@ -66,7 +67,7 @@ class ShowActionPlan(command.ShowOne):
def _format_global_efficacy(self, global_efficacy, parsed_args): def _format_global_efficacy(self, global_efficacy, parsed_args):
formatted_global_efficacy = format_global_efficacy(global_efficacy) formatted_global_efficacy = format_global_efficacy(global_efficacy)
out = six.StringIO() out = io.StringIO()
yaml_format.YAMLFormatter().emit_one( yaml_format.YAMLFormatter().emit_one(
column_names=list(resource.capitalize() column_names=list(resource.capitalize()
for resource in formatted_global_efficacy), for resource in formatted_global_efficacy),
@ -143,7 +144,7 @@ class ListActionPlan(command.Lister):
return parser return parser
def _format_indicators(self, action_plan, parsed_args): def _format_indicators(self, action_plan, parsed_args):
out = six.StringIO() out = io.StringIO()
efficacy_indicators = action_plan.efficacy_indicators efficacy_indicators = action_plan.efficacy_indicators
fields = ['name', 'value', 'unit'] fields = ['name', 'value', 'unit']
yaml_format.YAMLFormatter().emit_list( yaml_format.YAMLFormatter().emit_list(
@ -158,7 +159,7 @@ class ListActionPlan(command.Lister):
def _format_global_efficacy(self, global_efficacy, parsed_args): def _format_global_efficacy(self, global_efficacy, parsed_args):
formatted_global_efficacy = format_global_efficacy(global_efficacy) formatted_global_efficacy = format_global_efficacy(global_efficacy)
out = six.StringIO() out = io.StringIO()
yaml_format.YAMLFormatter().emit_one( yaml_format.YAMLFormatter().emit_one(
column_names=list(resource.capitalize() column_names=list(resource.capitalize()
for resource in formatted_global_efficacy), for resource in formatted_global_efficacy),

View File

@ -14,8 +14,9 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
import io
from osc_lib import utils from osc_lib import utils
import six
from watcherclient._i18n import _ from watcherclient._i18n import _
from watcherclient.common import command from watcherclient.common import command
@ -37,7 +38,7 @@ class ShowGoal(command.ShowOne):
return parser return parser
def _format_indicator_spec_table(self, spec, parsed_args): def _format_indicator_spec_table(self, spec, parsed_args):
out = six.StringIO() out = io.StringIO()
self.formatter.emit_one( self.formatter.emit_one(
column_names=list(field.capitalize() for field in spec.keys()), column_names=list(field.capitalize() for field in spec.keys()),
data=utils.get_dict_properties(spec, spec.keys()), data=utils.get_dict_properties(spec, spec.keys()),
@ -107,7 +108,7 @@ class ListGoal(command.Lister):
return parser return parser
def _format_indicator_spec_table(self, goal, parsed_args): def _format_indicator_spec_table(self, goal, parsed_args):
out = six.StringIO() out = io.StringIO()
efficacy_specification = goal.efficacy_specification efficacy_specification = goal.efficacy_specification
fields = ['name', 'unit'] fields = ['name', 'unit']
self.formatter.emit_list( self.formatter.emit_list(

View File

@ -13,7 +13,7 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
import six.moves.urllib.parse as parse from urllib import parse
from watcherclient.common import base from watcherclient.common import base
from watcherclient.common import utils from watcherclient.common import utils