Merge "Remove six"
This commit is contained in:
commit
11cb88c2cd
@ -56,9 +56,6 @@ Here is an example showing how you can write a plugin called ``NewStrategy``:
|
||||
# filepath: thirdparty/new.py
|
||||
# import path: thirdparty.new
|
||||
import abc
|
||||
|
||||
import six
|
||||
|
||||
from watcher._i18n import _
|
||||
from watcher.decision_engine.strategy.strategies import base
|
||||
|
||||
|
@ -19,8 +19,6 @@ Service mechanism provides ability to monitor Watcher services state.
|
||||
"""
|
||||
|
||||
import datetime
|
||||
import six
|
||||
|
||||
from oslo_config import cfg
|
||||
from oslo_log import log
|
||||
from oslo_utils import timeutils
|
||||
@ -70,7 +68,7 @@ class Service(base.APIBase):
|
||||
service = objects.Service.get(pecan.request.context, id)
|
||||
last_heartbeat = (service.last_seen_up or service.updated_at or
|
||||
service.created_at)
|
||||
if isinstance(last_heartbeat, six.string_types):
|
||||
if isinstance(last_heartbeat, str):
|
||||
# NOTE(russellb) If this service came in over rpc via
|
||||
# conductor, then the timestamp will be a string and needs to be
|
||||
# converted back to a datetime.
|
||||
|
@ -15,7 +15,6 @@
|
||||
|
||||
from oslo_serialization import jsonutils
|
||||
from oslo_utils import strutils
|
||||
import six
|
||||
import wsme
|
||||
from wsme import types as wtypes
|
||||
|
||||
@ -132,7 +131,7 @@ class JsonType(wtypes.UserType):
|
||||
|
||||
def __str__(self):
|
||||
# These are the json serializable native types
|
||||
return ' | '.join(map(str, (wtypes.text, six.integer_types, float,
|
||||
return ' | '.join(map(str, (wtypes.text, int, float,
|
||||
BooleanType, list, dict, None)))
|
||||
|
||||
@staticmethod
|
||||
|
@ -18,7 +18,6 @@ SQLAlchemy models for watcher service
|
||||
|
||||
from oslo_db.sqlalchemy import models
|
||||
from oslo_serialization import jsonutils
|
||||
import six.moves.urllib.parse as urlparse
|
||||
from sqlalchemy import Boolean
|
||||
from sqlalchemy import Column
|
||||
from sqlalchemy import DateTime
|
||||
@ -33,7 +32,7 @@ from sqlalchemy import String
|
||||
from sqlalchemy import Text
|
||||
from sqlalchemy.types import TypeDecorator, TEXT
|
||||
from sqlalchemy import UniqueConstraint
|
||||
|
||||
import urllib.parse as urlparse
|
||||
from watcher import conf
|
||||
|
||||
CONF = conf.CONF
|
||||
|
@ -18,8 +18,6 @@
|
||||
#
|
||||
|
||||
from oslo_log import log
|
||||
import six
|
||||
|
||||
from watcher._i18n import _
|
||||
from watcher.common import exception
|
||||
from watcher.decision_engine.model import element
|
||||
@ -103,7 +101,7 @@ class HostMaintenance(base.HostMaintenanceBaseStrategy):
|
||||
|
||||
def get_instance_state_str(self, instance):
|
||||
"""Get instance state in string format"""
|
||||
if isinstance(instance.state, six.string_types):
|
||||
if isinstance(instance.state, str):
|
||||
return instance.state
|
||||
elif isinstance(instance.state, element.InstanceState):
|
||||
return instance.state.value
|
||||
@ -116,7 +114,7 @@ class HostMaintenance(base.HostMaintenanceBaseStrategy):
|
||||
|
||||
def get_node_status_str(self, node):
|
||||
"""Get node status in string format"""
|
||||
if isinstance(node.status, six.string_types):
|
||||
if isinstance(node.status, str):
|
||||
return node.status
|
||||
elif isinstance(node.status, element.ServiceState):
|
||||
return node.status.value
|
||||
|
@ -14,14 +14,11 @@
|
||||
|
||||
"""Tests for the Pecan API hooks."""
|
||||
|
||||
from unittest import mock
|
||||
|
||||
from http import client as http_client
|
||||
from oslo_config import cfg
|
||||
import oslo_messaging as messaging
|
||||
from oslo_serialization import jsonutils
|
||||
import six
|
||||
from six.moves import http_client
|
||||
|
||||
from unittest import mock
|
||||
from watcher.api.controllers import root
|
||||
from watcher.api import hooks
|
||||
from watcher.common import context
|
||||
@ -144,7 +141,7 @@ class TestNoExceptionTracebackHook(base.FunctionalTest):
|
||||
# we don't care about this garbage.
|
||||
expected_msg = ("Remote error: %s %s"
|
||||
% (test_exc_type, self.MSG_WITHOUT_TRACE) +
|
||||
("\n[u'" if six.PY2 else "\n['"))
|
||||
"\n['")
|
||||
actual_msg = jsonutils.loads(
|
||||
response.json['error_message'])['faultstring']
|
||||
self.assertEqual(expected_msg, actual_msg)
|
||||
|
Loading…
Reference in New Issue
Block a user