Merge "Remove six and python 2.7 full support"

This commit is contained in:
Zuul 2020-04-22 16:47:39 +00:00 committed by Gerrit Code Review
commit 4f316beff7
10 changed files with 13 additions and 23 deletions

View File

@ -17,7 +17,6 @@
import distutils
from oslo_log import log as logging
import six
from heat.common import exception
from heat.common.i18n import _
@ -340,7 +339,7 @@ class DockerContainer(resource.Resource):
def _parse_networkinfo_ports(self, networkinfo):
tcp = []
udp = []
for port, info in six.iteritems(networkinfo['Ports']):
for port, info in networkinfo['Ports'].items():
p = port.split('/')
if not info or len(p) != 2 or 'HostPort' not in info[0]:
continue

View File

@ -15,7 +15,6 @@
# under the License.
import mock
import six
from heat.common import exception
from heat.common.i18n import _
@ -126,7 +125,7 @@ class DockerContainerTest(common.HeatTestCase):
exc = self.assertRaises(exception.ResourceInError,
docker_res.check_create_complete,
'foo')
self.assertIn("Container startup failed", six.text_type(exc))
self.assertIn("Container startup failed", str(exc))
def test_start_with_bindings_and_links(self):
t = template_format.parse(template)
@ -331,7 +330,7 @@ class DockerContainerTest(common.HeatTestCase):
args = dict(arg=arg, min_version=min_version)
expected = _('"%(arg)s" is not supported for API version '
'< "%(min_version)s"') % args
self.assertEqual(expected, six.text_type(msg))
self.assertEqual(expected, str(msg))
def test_start_with_read_only_for_low_api_version(self):
self.arg_for_low_api_version('read_only', True, '1.16')

View File

@ -19,7 +19,6 @@ import pydoc
from docutils import core
from docutils import nodes
from docutils.parsers import rst
import six
from heat.common.i18n import _
from heat.engine import attributes
@ -433,7 +432,7 @@ def _filter_resources(prefix=None, path=None, statuses=None):
else:
filtered_resources[name] = [cls]
return sorted(six.iteritems(filtered_resources))
return sorted(filtered_resources.items())
def _load_all_resources():

View File

@ -17,7 +17,6 @@
"""Heat API exception subclasses - maps API response errors to AWS Errors."""
from oslo_utils import reflection
import six
import webob.exc
from heat.common.i18n import _
@ -322,7 +321,7 @@ def map_remote_error(ex):
ex_type = ex_type[:-len('_Remote')]
safe = getattr(ex, 'safe', False)
detail = six.text_type(ex) if safe else None
detail = str(ex) if safe else None
if ex_type in inval_param_errors:
return HeatInvalidParameterValueError(detail=detail)

View File

@ -24,7 +24,6 @@ import traceback
from oslo_config import cfg
from oslo_utils import reflection
import six
import webob
from heat.common import exception
@ -127,7 +126,7 @@ class FaultWrapper(wsgi.Middleware):
if is_remote:
ex_type = ex_type[:-len('_Remote')]
full_message = six.text_type(ex)
full_message = str(ex)
if '\n' in full_message and is_remote:
message, msg_trace = full_message.split('\n', 1)
elif traceback_marker in full_message:

View File

@ -12,7 +12,6 @@
# under the License.
import routes
import six
from heat.api.openstack.v1 import actions
from heat.api.openstack.v1 import build_info
@ -51,7 +50,7 @@ class API(wsgi.Router):
for r in routes:
url = path_prefix + r['url']
methods = r['method']
if isinstance(methods, six.string_types):
if isinstance(methods, str):
methods = [methods]
methods_str = ','.join(methods)
mapper.connect(r['name'], url, controller=controller,

View File

@ -11,7 +11,6 @@
# License for the specific language governing permissions and limitations
# under the License.
import six
from webob import exc
from heat.api.openstack.v1 import util
@ -57,7 +56,7 @@ class ActionController(object):
if len(body) > 1:
raise exc.HTTPBadRequest(_("Multiple actions specified"))
ac = next(six.iterkeys(body))
ac = next(iter(body.keys()))
if ac not in self.ACTIONS:
raise exc.HTTPBadRequest(_("Invalid action %s specified") % ac)

View File

@ -13,7 +13,6 @@
import itertools
import six
from webob import exc
from heat.api.openstack.v1 import util
@ -133,7 +132,7 @@ class EventController(object):
params[key] = param_utils.extract_int(
key, params[key], allow_zero=True)
except ValueError as e:
raise exc.HTTPBadRequest(six.text_type(e))
raise exc.HTTPBadRequest(str(e))
if resource_name is None:
if not filter_params:

View File

@ -13,7 +13,6 @@
import itertools
import six
from webob import exc
from heat.api.openstack.v1 import util
@ -89,7 +88,7 @@ class ResourceController(object):
try:
return extractor(key, req.params[key])
except ValueError as e:
raise exc.HTTPBadRequest(six.text_type(e))
raise exc.HTTPBadRequest(str(e))
else:
return default
@ -111,7 +110,7 @@ class ResourceController(object):
rpc_api.PARAM_WITH_DETAIL]))
if invalid_keys:
raise exc.HTTPBadRequest(_('Invalid filter parameters %s') %
six.text_type(list(invalid_keys)))
str(list(invalid_keys)))
nested_depth = self._extract_to_param(req,
rpc_api.PARAM_NESTED_DEPTH,
@ -186,7 +185,7 @@ class ResourceController(object):
RES_UPDATE_MARK_UNHEALTHY,
body[RES_UPDATE_MARK_UNHEALTHY])
except ValueError as e:
raise exc.HTTPBadRequest(six.text_type(e))
raise exc.HTTPBadRequest(str(e))
data[RES_UPDATE_STATUS_REASON] = body.get(RES_UPDATE_STATUS_REASON, "")
self.rpc_client.resource_mark_unhealthy(req.context,

View File

@ -11,7 +11,6 @@
# License for the specific language governing permissions and limitations
# under the License.
import six
from webob import exc
from heat.api.openstack.v1 import util
@ -42,7 +41,7 @@ class SoftwareConfigController(object):
try:
return param_utils.extract_bool(name, value)
except ValueError as e:
raise exc.HTTPBadRequest(six.text_type(e))
raise exc.HTTPBadRequest(str(e))
def _index(self, req, use_admin_cnxt=False):
whitelist = {