Remove six
Remove all six usage. Change-Id: Ib2f0f6cf3b7f5d9ec20440fb81b09c1c083c67b0 Story: 2008305 Task: 41295
This commit is contained in:
parent
ecf73d92c8
commit
3b91b33784
@ -56,7 +56,6 @@ requests==2.14.2
|
||||
requestsexceptions==1.2.0
|
||||
rfc3986==0.3.1
|
||||
simplejson==3.8.1
|
||||
six==1.10.0
|
||||
smmap==0.9.0
|
||||
sphinx==1.6.2
|
||||
SQLAlchemy==1.0.10
|
||||
|
@ -19,7 +19,6 @@ from keystoneauth1 import exceptions as kaexception
|
||||
from keystoneauth1 import loading as kaloading
|
||||
from oslo_config import cfg
|
||||
from oslo_log import log
|
||||
import six
|
||||
|
||||
from monasca_notification.common.repositories import exceptions
|
||||
from monasca_notification.notification import Notification
|
||||
@ -161,8 +160,8 @@ def get_auth_token():
|
||||
auth_token = session.get_token()
|
||||
return auth_token
|
||||
except (kaexception.Unauthorized, kaexception.DiscoveryFailure) as e:
|
||||
LOG.exception(error_message.format(six.text_type(e)))
|
||||
LOG.exception(error_message.format(str(e)))
|
||||
raise
|
||||
except Exception as e:
|
||||
LOG.exception(error_message.format(six.text_type(e)))
|
||||
LOG.exception(error_message.format(str(e)))
|
||||
raise
|
||||
|
@ -15,11 +15,9 @@
|
||||
# limitations under the License.
|
||||
|
||||
import abc
|
||||
import six
|
||||
|
||||
|
||||
@six.add_metaclass(abc.ABCMeta)
|
||||
class AbstractNotifier(object):
|
||||
class AbstractNotifier(object, metaclass=abc.ABCMeta):
|
||||
|
||||
def __init__(self):
|
||||
pass
|
||||
|
@ -17,7 +17,6 @@
|
||||
import email.header
|
||||
import email.mime.text
|
||||
import email.utils
|
||||
import six
|
||||
import smtplib
|
||||
import time
|
||||
|
||||
@ -259,7 +258,7 @@ class EmailNotifier(abstract_notifier.AbstractNotifier):
|
||||
metric_query = "?metric=%s" % metric['name']
|
||||
|
||||
dimensions = metric['dimensions']
|
||||
for key, value in six.iteritems(dimensions):
|
||||
for key, value in dimensions.items():
|
||||
metric_query += "&dim_%s=%s" % (key, value)
|
||||
|
||||
# Show the graph within a range of ten minutes before and after the alarm occurred.
|
||||
|
@ -16,10 +16,10 @@
|
||||
|
||||
import requests
|
||||
import simplejson as json
|
||||
import urllib
|
||||
|
||||
from debtcollector import removals
|
||||
from oslo_config import cfg
|
||||
from six.moves import urllib
|
||||
|
||||
from monasca_notification.plugins import abstract_notifier
|
||||
|
||||
|
@ -19,7 +19,7 @@ from jinja2 import Template
|
||||
import jira
|
||||
from oslo_config import cfg
|
||||
import simplejson as json
|
||||
from six.moves import urllib
|
||||
import urllib
|
||||
import yaml
|
||||
|
||||
from monasca_notification.plugins.abstract_notifier import AbstractNotifier
|
||||
|
@ -15,13 +15,13 @@
|
||||
# limitations under the License.
|
||||
|
||||
import os
|
||||
import urllib
|
||||
|
||||
from debtcollector import removals
|
||||
import jinja2
|
||||
from oslo_config import cfg
|
||||
import requests
|
||||
import simplejson as json
|
||||
from six.moves import urllib
|
||||
|
||||
from monasca_notification.plugins import abstract_notifier
|
||||
|
||||
|
@ -18,7 +18,6 @@ import time
|
||||
from oslo_config import cfg
|
||||
from oslo_log import log as logging
|
||||
import simplejson as json
|
||||
import six
|
||||
|
||||
from monasca_notification.common.repositories import exceptions as exc
|
||||
from monasca_notification.common.utils import get_db_repo
|
||||
@ -57,7 +56,7 @@ class AlarmProcessor(object):
|
||||
]
|
||||
# check if alarm_data is <class 'bytes'>
|
||||
# if yes convert it to standard string
|
||||
if isinstance(alarm_data, six.binary_type):
|
||||
if isinstance(alarm_data, bytes):
|
||||
alarm_data = alarm_data.decode("utf-8")
|
||||
json_alarm = json.loads(alarm_data)
|
||||
alarm = json_alarm['alarm-transitioned']
|
||||
|
@ -7,7 +7,6 @@ keystoneauth1>=3.4.0 # Apache-2.0
|
||||
monasca-statsd>=1.4.0 # Apache-2.0
|
||||
requests>=2.14.2 # Apache-2.0
|
||||
PyYAML>=3.13 # MIT
|
||||
six>=1.10.0 # MIT
|
||||
monasca-common>=2.16.0 # Apache-2.0
|
||||
oslo.config>=5.2.0 # Apache-2.0
|
||||
oslo.log>=3.36.0 # Apache-2.0
|
||||
|
@ -22,20 +22,15 @@ import smtplib
|
||||
import socket
|
||||
import time
|
||||
from unittest import mock
|
||||
|
||||
import six
|
||||
from urllib import parse
|
||||
from urllib.parse import urlparse
|
||||
|
||||
from monasca_notification.notification import Notification
|
||||
from monasca_notification.plugins import email_notifier
|
||||
from tests import base
|
||||
|
||||
if six.PY2:
|
||||
import urlparse
|
||||
else:
|
||||
from urllib import parse
|
||||
from urllib.parse import urlparse
|
||||
|
||||
UNICODE_CHAR = six.unichr(2344)
|
||||
UNICODE_CHAR = chr(2344)
|
||||
UNICODE_CHAR_ENCODED = UNICODE_CHAR.encode("utf-8")
|
||||
|
||||
|
||||
@ -498,24 +493,16 @@ class TestEmail(base.PluginTestCase):
|
||||
return alarm_ms, expected_from_ms, expected_to_ms
|
||||
|
||||
def _assert_equal_urls(self, expected_url, result_url):
|
||||
if six.PY2:
|
||||
expected_parsed = urlparse.urlparse(expected_url)
|
||||
result_parsed = urlparse.urlparse(result_url)
|
||||
else:
|
||||
expected_parsed = urlparse(expected_url)
|
||||
result_parsed = urlparse(result_url)
|
||||
expected_parsed = urlparse(expected_url)
|
||||
result_parsed = urlparse(result_url)
|
||||
|
||||
self.assertEqual(expected_parsed.netloc, result_parsed.netloc)
|
||||
self.assertEqual(expected_parsed.path, result_parsed.path)
|
||||
|
||||
if six.PY2:
|
||||
expected_parsed_query = urlparse.parse_qs(expected_parsed.query)
|
||||
result_parsed_query = urlparse.parse_qs(result_parsed.query)
|
||||
else:
|
||||
expected_parsed_query = parse.parse_qs(expected_parsed.query)
|
||||
result_parsed_query = parse.parse_qs(result_parsed.query)
|
||||
expected_parsed_query = parse.parse_qs(expected_parsed.query)
|
||||
result_parsed_query = parse.parse_qs(result_parsed.query)
|
||||
|
||||
self.assertEqual(len(expected_parsed_query), len(result_parsed_query))
|
||||
|
||||
for key in six.iterkeys(result_parsed_query):
|
||||
for key in result_parsed_query.keys():
|
||||
self.assertEqual(expected_parsed_query[key], result_parsed_query[key])
|
||||
|
@ -14,17 +14,11 @@
|
||||
import json
|
||||
from unittest import mock
|
||||
|
||||
import six
|
||||
|
||||
from monasca_notification import notification as m_notification
|
||||
from monasca_notification.plugins import hipchat_notifier
|
||||
import queue
|
||||
from tests import base
|
||||
|
||||
if six.PY2:
|
||||
import Queue as queue
|
||||
else:
|
||||
import queue
|
||||
|
||||
|
||||
def alarm(metrics):
|
||||
return {"tenantId": "0",
|
||||
|
@ -12,17 +12,11 @@
|
||||
|
||||
from unittest import mock
|
||||
|
||||
import six
|
||||
|
||||
from monasca_notification import notification as m_notification
|
||||
from monasca_notification.plugins import jira_notifier
|
||||
import queue
|
||||
from tests import base
|
||||
|
||||
if six.PY2:
|
||||
import Queue as queue
|
||||
else:
|
||||
import queue
|
||||
|
||||
|
||||
def alarm():
|
||||
return {'tenantId': '0',
|
||||
|
@ -19,17 +19,11 @@ import requests
|
||||
import time
|
||||
from unittest import mock
|
||||
|
||||
import six
|
||||
|
||||
from monasca_notification import notification as m_notification
|
||||
from monasca_notification.plugins import pagerduty_notifier
|
||||
import queue
|
||||
from tests import base
|
||||
|
||||
if six.PY2:
|
||||
import Queue as queue
|
||||
else:
|
||||
import queue
|
||||
|
||||
|
||||
def alarm(metrics):
|
||||
return {"tenantId": "0",
|
||||
|
@ -14,17 +14,11 @@
|
||||
import json
|
||||
from unittest import mock
|
||||
|
||||
import six
|
||||
|
||||
from monasca_notification import notification as m_notification
|
||||
from monasca_notification.plugins import slack_notifier
|
||||
import queue
|
||||
from tests import base
|
||||
|
||||
if six.PY2:
|
||||
import Queue as queue
|
||||
else:
|
||||
import queue
|
||||
|
||||
|
||||
def alarm(metrics):
|
||||
return {'tenantId': '0',
|
||||
|
@ -18,17 +18,12 @@ import requests
|
||||
from unittest import mock
|
||||
|
||||
import simplejson as json
|
||||
import six
|
||||
|
||||
from monasca_notification import notification as m_notification
|
||||
from monasca_notification.plugins import webhook_notifier
|
||||
import queue
|
||||
from tests import base
|
||||
|
||||
if six.PY2:
|
||||
import Queue as queue
|
||||
else:
|
||||
import queue
|
||||
|
||||
|
||||
def alarm(metrics):
|
||||
return {"tenantId": "0",
|
||||
|
Loading…
Reference in New Issue
Block a user