Remove six
Remove six Replace the following items with Python 3 style code. - six.text_type - six.moves.urllib - six.PY3 Change-Id: I8d2357e51d570e9e0513326248878fd0133144bb Story: 2008305 Task: 41203
This commit is contained in:
parent
a2e06fcfb9
commit
c1ae54b120
@ -103,7 +103,6 @@ Routes==2.3.1
|
||||
selenium==2.50.1
|
||||
semantic-version==2.3.1
|
||||
simplejson==3.5.1
|
||||
six==1.10.0
|
||||
snowballstemmer==1.2.1
|
||||
statsd==3.2.1
|
||||
stevedore==1.20.0
|
||||
|
@ -21,7 +21,6 @@ from django.urls import reverse
|
||||
from django.urls import reverse_lazy
|
||||
from django.utils.translation import ugettext as _ # noqa
|
||||
from django.views.generic import TemplateView
|
||||
import six
|
||||
|
||||
from horizon import exceptions
|
||||
from horizon import forms
|
||||
@ -157,7 +156,7 @@ class AlarmDetailView(TemplateView):
|
||||
except exc.HttpError:
|
||||
msg = _("Notification %s has already been deleted.") % id
|
||||
notifications.append({"id": id,
|
||||
"name": six.text_type(msg),
|
||||
"name": str(msg),
|
||||
"type": "",
|
||||
"address": ""})
|
||||
|
||||
|
@ -19,7 +19,6 @@ from django import forms as django_forms
|
||||
from django.template.loader import get_template
|
||||
from django.utils import html
|
||||
from django.utils.translation import ugettext_lazy as _ # noqa
|
||||
import six
|
||||
|
||||
from horizon import exceptions
|
||||
from horizon import forms
|
||||
@ -117,7 +116,7 @@ class NotificationCreateWidget(forms.Select):
|
||||
output = '<table id="notification_table" ' + \
|
||||
'class="table table-condensed">'
|
||||
output += '<thead><tr><th>%s</th></tr></thead>' % \
|
||||
six.text_type(_("Name"))
|
||||
str(_("Name"))
|
||||
if value:
|
||||
idx = 1
|
||||
for notification in value:
|
||||
@ -144,7 +143,7 @@ class NotificationCreateWidget(forms.Select):
|
||||
output += '<td><a href="" id="remove_notif_button">X</a></td>'
|
||||
output += '</td></tr>'
|
||||
output += '</table>'
|
||||
label = six.text_type(_("+ Add more"))
|
||||
label = str(_("+ Add more"))
|
||||
output += '<a href="" id="add_notification_button">%s</a>' % (label)
|
||||
return html.format_html(output)
|
||||
|
||||
@ -222,10 +221,10 @@ class BaseAlarmForm(forms.SelfHandlingForm):
|
||||
if notification_choices:
|
||||
if len(notification_choices) > 1:
|
||||
notification_choices.insert(
|
||||
0, ("", six.text_type(_("Select Notification"))))
|
||||
0, ("", str(_("Select Notification"))))
|
||||
else:
|
||||
notification_choices.insert(
|
||||
0, ("", six.text_type(_("No notifications available."))))
|
||||
0, ("", str(_("No notifications available."))))
|
||||
|
||||
self.fields['notifications'].choices = notification_choices
|
||||
|
||||
|
@ -27,7 +27,6 @@ from django.utils.dateparse import parse_datetime
|
||||
from django.utils.translation import ugettext as _ # noqa
|
||||
from django.utils.translation import ugettext_lazy
|
||||
from django.views.generic import View
|
||||
import six
|
||||
|
||||
from horizon import exceptions
|
||||
from horizon import forms
|
||||
@ -103,12 +102,12 @@ def generate_status(request):
|
||||
service_alarms = alarms_by_service.setdefault(service, [])
|
||||
service_alarms.append(a)
|
||||
for row in SERVICES:
|
||||
row['name'] = six.text_type(row['name'])
|
||||
row['name'] = str(row['name'])
|
||||
for service in row['services']:
|
||||
service_alarms = alarms_by_service.get(service['name'], [])
|
||||
service['class'] = get_status(service_alarms)
|
||||
service['icon'] = get_icon(service['class'])
|
||||
service['display'] = six.text_type(service['display'])
|
||||
service['display'] = str(service['display'])
|
||||
return SERVICES
|
||||
|
||||
|
||||
|
@ -49,7 +49,7 @@ class KibanaProxyViewTest(helpers.TestCase):
|
||||
|
||||
def test_get_relative_url_with_unicode(self):
|
||||
"""Tests if it properly converts multibyte characters."""
|
||||
from six.moves.urllib import parse as urlparse
|
||||
from urllib import parse as urlparse
|
||||
|
||||
self.view.request = self.request_factory.get(
|
||||
'/', data={'a': 1, 'b': 2}
|
||||
|
@ -29,8 +29,7 @@ from django.views.generic import TemplateView
|
||||
from horizon import exceptions
|
||||
from openstack_auth import utils as auth_utils
|
||||
from openstack_dashboard import policy
|
||||
import six
|
||||
from six.moves import urllib
|
||||
import urllib
|
||||
|
||||
from monitoring.alarms import tables as alarm_tables
|
||||
from monitoring import api
|
||||
@ -166,8 +165,7 @@ def show_by_dimension(data, dim_name):
|
||||
for metric in data['metrics']:
|
||||
if 'dimensions' in metric:
|
||||
if dim_name in metric['dimensions']:
|
||||
dimension = metric['dimensions'][dim_name] if six.PY3 \
|
||||
else metric['dimensions'][dim_name].encode('utf-8')
|
||||
dimension = metric['dimensions'][dim_name]
|
||||
dimensions.append(dimension)
|
||||
|
||||
return dimensions
|
||||
@ -199,7 +197,7 @@ def generate_status(request):
|
||||
service_alarms.append(a)
|
||||
monitoring_services = copy.deepcopy(get_monitoring_services(request))
|
||||
for row in monitoring_services:
|
||||
row['name'] = six.text_type(row['name'])
|
||||
row['name'] = str(row['name'])
|
||||
if 'groupBy' in row:
|
||||
alarms_by_group = {}
|
||||
for a in alarms:
|
||||
@ -228,7 +226,7 @@ def generate_status(request):
|
||||
service_alarms = alarms_by_service.get(service['name'], [])
|
||||
service['class'] = get_status(service_alarms)
|
||||
service['icon'] = get_icon(service['class'])
|
||||
service['display'] = six.text_type(service['display'])
|
||||
service['display'] = str(service['display'])
|
||||
return monitoring_services
|
||||
|
||||
|
||||
|
@ -4,4 +4,3 @@
|
||||
oslo.log>=3.36.0 # Apache-2.0
|
||||
python-monascaclient>=1.8.0 # Apache-2.0
|
||||
horizon>=17.1.0 # Apache-2.0
|
||||
six>=1.10.0 # MIT
|
||||
|
Loading…
x
Reference in New Issue
Block a user