Merge "Remove six usage"

This commit is contained in:
Zuul 2020-01-15 10:51:03 +00:00 committed by Gerrit Code Review
commit 2497c48632
14 changed files with 19 additions and 34 deletions

View File

@ -23,7 +23,6 @@ from django.conf import settings
from horizon import exceptions
import logging
from openstack_dashboard.api import base
import six
from manilaclient import client as manila_client
@ -116,8 +115,8 @@ def share_delete(request, share_id, share_group_id=None):
def share_update(request, share_id, name, description, is_public=''):
share_data = {'display_name': name, 'display_description': description}
if not isinstance(is_public, six.string_types):
is_public = six.text_type(is_public)
if not isinstance(is_public, str):
is_public = str(is_public)
if is_public and is_public.lower() != 'none':
share_data['is_public'] = is_public
return manilaclient(request).shares.update(share_id, **share_data)

View File

@ -16,7 +16,6 @@
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import ungettext_lazy
from horizon import tables
import six
from manila_ui.api import manila
@ -94,7 +93,7 @@ class ShareGroupTypesTable(tables.DataTable):
return share_group_type.name
def get_object_id(self, share_group_type):
return six.text_type(share_group_type.id)
return str(share_group_type.id)
class Meta(object):
name = "share_group_types"

View File

@ -17,7 +17,6 @@ from django.urls import reverse
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import ungettext_lazy
from horizon import tables
import six
from manila_ui.api import manila
@ -108,10 +107,10 @@ class ShareGroupsTable(tables.DataTable):
link=get_share_server_link)
def get_object_display(self, share_group):
return six.text_type(share_group.id)
return str(share_group.id)
def get_object_id(self, share_group):
return six.text_type(share_group.id)
return str(share_group.id)
class Meta(object):
name = "share_groups"

View File

@ -13,7 +13,6 @@
from django.urls import reverse
from django.utils.translation import ugettext_lazy as _
from horizon import tables
import six
class ShareInstancesTable(tables.DataTable):
@ -87,7 +86,7 @@ class ShareInstancesTable(tables.DataTable):
link=get_share_link)
def get_object_display(self, share_instance):
return six.text_type(share_instance.id)
return str(share_instance.id)
def get_object_id(self, share_instance):
return six.text_type(share_instance.id)
return str(share_instance.id)

View File

@ -12,7 +12,6 @@
from django.utils.translation import ugettext_lazy as _
from horizon import tables
import six
import manila_ui.dashboards.project.share_networks.tables as sn_tables
@ -32,10 +31,10 @@ class ShareNetworksTable(tables.DataTable):
"segmentation_id", verbose_name=_("Segmentation Id"))
def get_object_display(self, share_network):
return share_network.name or six.text_type(share_network.id)
return share_network.name or str(share_network.id)
def get_object_id(self, share_network):
return six.text_type(share_network.id)
return str(share_network.id)
class Meta(object):
name = "share_networks"

View File

@ -16,7 +16,6 @@ from django.utils.translation import pgettext_lazy
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import ungettext_lazy
from horizon import tables
import six
from manila_ui.api import manila
@ -99,10 +98,10 @@ class ShareServersTable(tables.DataTable):
display_choices=STATUS_DISPLAY_CHOICES)
def get_object_display(self, share_server):
return six.text_type(share_server.id)
return str(share_server.id)
def get_object_id(self, share_server):
return six.text_type(share_server.id)
return str(share_server.id)
class Meta(object):
name = "share_servers"

View File

@ -13,7 +13,6 @@
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import ungettext_lazy
from horizon import tables
import six
from manila_ui.api import manila
@ -94,7 +93,7 @@ class ShareTypesTable(tables.DataTable):
return share_type.name
def get_object_id(self, share_type):
return six.text_type(share_type.id)
return str(share_type.id)
class Meta(object):
name = "share_types"

View File

@ -21,7 +21,6 @@ from horizon import exceptions
from horizon import forms
from horizon import messages
from oslo_utils import strutils
import six
from manila_ui.api import manila
from manila_ui.dashboards import utils
@ -251,7 +250,7 @@ class ManageShare(forms.SelfHandlingForm):
driver_options_error_msg = _(
"Got improper value for field 'driver_options'. "
"Expected only pairs of key=value.")
if driver_options and isinstance(driver_options, six.string_types):
if driver_options and isinstance(driver_options, str):
try:
set_dict, unset_list = utils.parse_str_meta(driver_options)
if unset_list:

View File

@ -20,7 +20,6 @@ from horizon import exceptions
from horizon import forms
from horizon import messages
from horizon.utils import memoized
import six
from manila_ui.api import manila
@ -197,7 +196,7 @@ class CreateShareGroupForm(forms.SelfHandlingForm):
if share_group_type:
cleaned_data["share_types"] = cleaned_data.get(
self.st_field_name_prefix + share_group_type)
if isinstance(cleaned_data["share_types"], six.string_types):
if isinstance(cleaned_data["share_types"], str):
cleaned_data["share_types"] = [cleaned_data["share_types"]]
else:
self.errors.pop("sgt", None)

View File

@ -17,7 +17,6 @@ from django.urls import reverse
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import ungettext_lazy
from horizon import tables
import six
from manila_ui.api import manila
import manila_ui.dashboards.project.share_group_snapshots.tables as sgs_tables
@ -139,10 +138,10 @@ class ShareGroupsTable(tables.DataTable):
link=get_source_share_group_snapshot_link)
def get_object_display(self, share_group):
return six.text_type(share_group.id)
return str(share_group.id)
def get_object_id(self, share_group):
return six.text_type(share_group.id)
return str(share_group.id)
class Meta(object):
name = "share_groups"

View File

@ -21,7 +21,6 @@ from horizon import exceptions
from horizon import forms
from horizon import messages
from horizon.utils.memoized import memoized
import six
from manila_ui.api import manila
from manila_ui.dashboards import utils
@ -78,8 +77,7 @@ class CreateForm(forms.SelfHandlingForm):
dhss = extra_specs.get('driver_handles_share_servers')
# NOTE(vponomaryov): Set and tie share-network field only for
# share types with enabled handling of share servers.
if (isinstance(dhss, six.string_types) and
dhss.lower() in ['true', '1']):
if (isinstance(dhss, str) and dhss.lower() in ['true', '1']):
sn_choices = (
[('', '')] +
[(sn.id, sn.name or sn.id) for sn in share_networks])

View File

@ -18,7 +18,6 @@ from django.urls import reverse
from django.utils.translation import pgettext_lazy
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import ungettext_lazy
import six
from horizon import messages
from horizon import tables
@ -176,7 +175,7 @@ class ReplicasTable(tables.DataTable):
return obj.id
def get_object_id(self, obj):
return six.text_type(obj.id)
return str(obj.id)
class Meta(object):
name = "replicas"

View File

@ -18,7 +18,6 @@ from django.urls import reverse
from horizon import messages as horizon_messages
import mock
from openstack_dashboard.api import neutron
import six
from manila_ui.api import manila as api_manila
from manila_ui.dashboards.project.shares import forms
@ -290,7 +289,7 @@ class ShareViewTests(test.APITestCase):
self.assertRedirectsNoFollow(res, INDEX_URL)
api_manila.share_update.assert_called_once_with(
mock.ANY, self.share, formData['name'], formData['description'],
is_public=six.text_type(formData['is_public']))
is_public=str(formData['is_public']))
api_manila.share_get.assert_has_calls(
[mock.call(mock.ANY, self.share.id) for i in (1, 2)])

View File

@ -10,6 +10,5 @@ iso8601>=0.1.11 # MIT
oslo.utils>=3.33.0 # Apache-2.0
python-keystoneclient>=3.8.0 # Apache-2.0
python-manilaclient>=1.16.0 # Apache-2.0
six>=1.10.0 # MIT
horizon>=17.1.0 # Apache-2.0