Merge "Remove six"

This commit is contained in:
Zuul 2021-07-27 14:21:45 +00:00 committed by Gerrit Code Review
commit fd2a00f9b9
37 changed files with 95 additions and 177 deletions

View File

@ -72,7 +72,6 @@ requests==2.14.2
requestsexceptions==1.2.0
rfc3986==0.3.1
simplejson==3.5.1
six==1.10.0
snowballstemmer==1.2.1
stestr==1.0.0
stevedore==1.20.0

View File

@ -27,7 +27,6 @@ import abc
import copy
from oslo_utils import strutils
import six
from manilaclient.common._i18n import _
from manilaclient.common.apiclient import exceptions
@ -210,8 +209,7 @@ class BaseManager(HookableMixin):
return self.client.delete(url)
@six.add_metaclass(abc.ABCMeta)
class ManagerWithFind(BaseManager):
class ManagerWithFind(BaseManager, metaclass=abc.ABCMeta):
"""Manager with additional `find()`/`findall()` methods."""
@abc.abstractmethod

View File

@ -36,8 +36,6 @@ Exception definitions.
import inspect
import sys
import six
from manilaclient.common._i18n import _
@ -460,8 +458,7 @@ def from_response(response, method, url):
if isinstance(error, dict):
kwargs["message"] = (error.get("message") or
error.get("faultstring"))
kwargs["details"] = (error.get("details") or
six.text_type(body))
kwargs["details"] = error.get("details") or str(body)
elif content_type.startswith("text/"):
kwargs["details"] = response.text

View File

@ -13,7 +13,6 @@
from oslo_utils import encodeutils
from oslo_utils import uuidutils
import six
from manilaclient.common._i18n import _
from manilaclient.common.apiclient import exceptions
@ -39,9 +38,6 @@ def find_resource(manager, name_or_id, **find_args):
# now try to get entity as uuid
try:
if six.PY2:
tmp_id = encodeutils.safe_encode(name_or_id)
else:
tmp_id = encodeutils.safe_decode(name_or_id)
if uuidutils.is_uuid_like(tmp_id):

View File

@ -25,8 +25,6 @@ import textwrap
from oslo_utils import encodeutils
from oslo_utils import strutils
import prettytable
import six
from six import moves
from manilaclient.common._i18n import _
@ -178,10 +176,7 @@ def print_list(objs, fields, formatters=None, sortby_index=0,
row.append(data)
pt.add_row(row)
if six.PY3:
print(encodeutils.safe_encode(pt.get_string(**kwargs)).decode())
else:
print(encodeutils.safe_encode(pt.get_string(**kwargs)))
def print_dict(dct, dict_property="Property", wrap=0):
@ -196,12 +191,12 @@ def print_dict(dct, dict_property="Property", wrap=0):
for k, v in dct.items():
# convert dict to str to check length
if isinstance(v, dict):
v = six.text_type(v)
v = str(v)
if wrap > 0:
v = textwrap.fill(six.text_type(v), wrap)
v = textwrap.fill(str(v), wrap)
# if value has a newline, add in multiple rows
# e.g. fault with stacktrace
if v and isinstance(v, six.string_types) and r'\n' in v:
if v and isinstance(v, str) and r'\n' in v:
lines = v.strip().split(r'\n')
col1 = k
for line in lines:
@ -210,10 +205,7 @@ def print_dict(dct, dict_property="Property", wrap=0):
else:
pt.add_row([k, v])
if six.PY3:
print(encodeutils.safe_encode(pt.get_string()).decode())
else:
print(encodeutils.safe_encode(pt.get_string()))
def get_password(max_password_prompts=3):
@ -223,7 +215,7 @@ def get_password(max_password_prompts=3):
if hasattr(sys.stdin, "isatty") and sys.stdin.isatty():
# Check for Ctrl-D
try:
for __ in moves.range(max_password_prompts):
for __ in range(max_password_prompts):
pw1 = getpass.getpass("OS Password: ")
if verify:
pw2 = getpass.getpass("Please verify: ")

View File

@ -25,7 +25,6 @@ from oslo_utils import importutils
from oslo_utils import strutils
import re
import requests
import six
from manilaclient import exceptions
@ -166,7 +165,7 @@ class HTTPClient(object):
if attempts > self.retries:
raise
self._logger.debug("Request error: %s", six.text_type(e))
self._logger.debug("Request error: %s", str(e))
self._logger.debug(
"Failed attempt(%(current)s of %(total)s), "

View File

@ -11,7 +11,6 @@
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
import six
from oslo_utils import strutils
@ -73,9 +72,10 @@ def extract_extra_specs(extra_specs, specs_to_add):
if strutils.is_valid_boolstr(value):
extra_specs[key] = value.capitalize()
else:
msg = ("Argument '%s' is of boolean "
msg = (
"Argument '%s' is of boolean "
"type and has invalid value: %s"
% (key, six.text_type(value)))
% (key, str(value)))
raise exceptions.CommandError(msg)
else:
extra_specs[key] = value

View File

@ -11,7 +11,6 @@
# under the License.
import logging
import six
from osc_lib.command import command
from osc_lib import exceptions
@ -152,7 +151,7 @@ class CreateShareType(command.ShowOne):
strict=True))
except ValueError as e:
msg = ("Argument spec_driver_handles_share_servers "
"argument is not valid: %s" % six.text_type(e))
"argument is not valid: %s" % str(e))
raise exceptions.CommandError(msg)
if parsed_args.description:

View File

@ -27,15 +27,12 @@ import os
import pkgutil
import sys
from oslo_utils import encodeutils
from oslo_utils import importutils
import six
from manilaclient import api_versions
from manilaclient import client
from manilaclient.common import cliutils
from manilaclient.common import constants
from manilaclient import exceptions as exc
import manilaclient.extension
from manilaclient.v2 import shell as shell_v2
@ -69,7 +66,7 @@ class AllowOnlyOneAliasAtATimeAction(argparse.Action):
self.calls[self.dest] = set()
local_values = sorted(values) if isinstance(values, list) else values
self.calls[self.dest].add(six.text_type(local_values))
self.calls[self.dest].add(str(local_values))
if len(self.calls[self.dest]) == 1:
setattr(namespace, self.dest, local_values)
@ -539,7 +536,7 @@ class OpenStackManilaShell(object):
api_version = api_versions.get_api_version(
options.os_share_api_version)
major_version_string = six.text_type(api_version.ver_major)
major_version_string = str(api_version.ver_major)
os_service_type = args.service_type
if not os_service_type:
os_service_type = constants.SERVICE_TYPES[major_version_string]
@ -734,17 +731,13 @@ class OpenStackHelpFormatter(argparse.HelpFormatter):
def main():
try:
if sys.version_info >= (3, 0):
OpenStackManilaShell().main(sys.argv[1:])
else:
OpenStackManilaShell().main(
map(encodeutils.safe_decode, sys.argv[1:]))
except KeyboardInterrupt:
print("... terminating manila client", file=sys.stderr)
sys.exit(130)
except Exception as e:
logger.debug(e, exc_info=1)
print("ERROR: %s" % six.text_type(e), file=sys.stderr)
print("ERROR: %s" % str(e), file=sys.stderr)
sys.exit(1)

View File

@ -18,7 +18,6 @@ import re
import time
from oslo_utils import strutils
import six
from tempest.lib.cli import base
from tempest.lib.cli import output_parser
from tempest.lib.common.utils import data_utils
@ -48,7 +47,7 @@ def not_found_wrapper(f):
except tempest_lib_exc.CommandFailed as e:
for regexp in (r'No (\w+) with a name or ID',
r'not(.*){0,5}found'):
if re.search(regexp, six.text_type(e.stderr)):
if re.search(regexp, str(e.stderr)):
# Raise appropriate 'NotFound' error
raise tempest_lib_exc.NotFound()
raise
@ -62,7 +61,7 @@ def forbidden_wrapper(f):
try:
return f(self, *args, **kwargs)
except tempest_lib_exc.CommandFailed as e:
if re.search('HTTP 403', six.text_type(e.stderr)):
if re.search('HTTP 403', str(e.stderr)):
# Raise appropriate 'Forbidden' error.
raise tempest_lib_exc.Forbidden()
raise
@ -201,10 +200,10 @@ class ManilaCLIClient(base.CLIClient):
if name is None:
name = data_utils.rand_name('manilaclient_functional_test')
dhss = driver_handles_share_servers
if not isinstance(dhss, six.string_types):
dhss = six.text_type(dhss)
if not isinstance(is_public, six.string_types):
is_public = six.text_type(is_public)
if not isinstance(dhss, str):
dhss = str(dhss)
if not isinstance(is_public, str):
is_public = str(is_public)
cmd = ('type-create %(name)s %(dhss)s --is-public %(is_public)s ') % {
'name': name, 'dhss': dhss, 'is_public': is_public}
@ -213,34 +212,31 @@ class ManilaCLIClient(base.CLIClient):
cmd += " --description " + description
if snapshot_support is not None:
if not isinstance(snapshot_support, six.string_types):
snapshot_support = six.text_type(snapshot_support)
if not isinstance(snapshot_support, str):
snapshot_support = str(snapshot_support)
cmd += " --snapshot-support " + snapshot_support
if create_share_from_snapshot is not None:
if not isinstance(create_share_from_snapshot, six.string_types):
create_share_from_snapshot = six.text_type(
create_share_from_snapshot)
if not isinstance(create_share_from_snapshot, str):
create_share_from_snapshot = str(create_share_from_snapshot)
cmd += (" --create-share-from-snapshot-support " +
create_share_from_snapshot)
if revert_to_snapshot is not None:
if not isinstance(revert_to_snapshot, six.string_types):
revert_to_snapshot = six.text_type(
revert_to_snapshot)
if not isinstance(revert_to_snapshot, str):
revert_to_snapshot = str(revert_to_snapshot)
cmd += (" --revert-to-snapshot-support " + revert_to_snapshot)
if mount_snapshot is not None:
if not isinstance(mount_snapshot, six.string_types):
mount_snapshot = six.text_type(
mount_snapshot)
if not isinstance(mount_snapshot, str):
mount_snapshot = str(mount_snapshot)
cmd += (" --mount-snapshot-support " + mount_snapshot)
if extra_specs is not None:
extra_spec_str = ''
for k, v in extra_specs.items():
if not isinstance(v, six.string_types):
extra_specs[k] = six.text_type(v)
if not isinstance(v, str):
extra_specs[k] = str(v)
extra_spec_str += "{}='{}' ".format(k, v)
cmd += " --extra_specs " + extra_spec_str
@ -267,8 +263,8 @@ class ManilaCLIClient(base.CLIClient):
'share_type_id': share_type_id}
if is_public is not None:
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)
cmd += " --is_public " + is_public
if description:
@ -551,7 +547,7 @@ class ManilaCLIClient(base.CLIClient):
@staticmethod
def _stranslate_to_cli_optional_param(param):
if len(param) < 1 or not isinstance(param, six.string_types):
if len(param) < 1 or not isinstance(param, str):
raise exceptions.InvalidData(
'Provided wrong parameter for translation.')
while not param[0:2] == '--':
@ -1002,7 +998,7 @@ class ManilaCLIClient(base.CLIClient):
'dest': dest_host,
'share_id': share['id'],
'timeout': self.build_timeout,
'status': six.text_type(statuses),
'status': str(statuses),
})
raise tempest_lib_exc.TimeoutException(message)
return share
@ -1762,7 +1758,7 @@ class ManilaCLIClient(base.CLIClient):
'dest': dest_host,
'share_server_id': server['id'],
'timeout': self.build_timeout,
'status': six.text_type(statuses),
'status': str(statuses),
})
raise tempest_lib_exc.TimeoutException(message)

View File

@ -10,7 +10,6 @@
# License for the specific language governing permissions and limitations
# under the License.
import six
import time
from tempest.lib.cli import base
@ -48,7 +47,7 @@ class OSCClientTestBase(base.ClientTestBase):
obj = {}
items = self.parser.listing(output)
for item in items:
obj[item['Field']] = six.text_type(item['Value'])
obj[item['Field']] = str(item['Value'])
return obj
def _wait_for_object_status(self, object_name, object_id, status,

View File

@ -14,7 +14,6 @@
# under the License.
import ast
import six
from tempest.lib.cli import output_parser
import testtools
@ -42,7 +41,7 @@ def multi_line_row_table(output_lines, group_by_column_index=0):
def is_embedded_table(parsed_rows):
def is_table_border(t):
return six.text_type(t).startswith('+')
return str(t).startswith('+')
return (isinstance(parsed_rows, list)
and len(parsed_rows) > 3
@ -126,8 +125,8 @@ def choose_matching_backend(share, pools, share_type):
# convert extra-specs in provided type to dict format
pair = [x.strip() for x in share_type['required_extra_specs'].split(':')]
if len(pair) == 2:
value = (True if six.text_type(pair[1]).lower() == 'true'
else False if six.text_type(pair[1]).lower() == 'false'
value = (True if str(pair[1]).lower() == 'true'
else False if str(pair[1]).lower() == 'false'
else pair[1])
extra_specs[pair[0]] = value

View File

@ -15,7 +15,6 @@
from unittest import mock
import ddt
import six
import manilaclient
from manilaclient import api_versions
@ -131,7 +130,7 @@ class APIVersionTestCase(utils.TestCase):
def test_representation(self, version):
version_major, version_minor = version.split('.')
api_version = api_versions.APIVersion(version)
self.assertEqual(six.text_type(api_version),
self.assertEqual(str(api_version),
("API Version Major: %s, Minor: %s" %
(version_major, version_minor)))
self.assertEqual(repr(api_version), "<APIVersion: %s>" % version)

View File

@ -10,13 +10,13 @@
# License for the specific language governing permissions and limitations
# under the License.
import io
import re
import sys
from unittest import mock
import ddt
import fixtures
from six import moves
from tempest.lib.cli import output_parser
from testtools import matchers
@ -55,7 +55,7 @@ class OpenstackManilaShellTest(utils.TestCase):
def shell(self, argstr):
orig = sys.stdout
try:
sys.stdout = moves.StringIO()
sys.stdout = io.StringIO()
_shell = shell.OpenStackManilaShell()
_shell._discover_client = self.shell_discover_client
_shell.main(argstr.split())
@ -384,7 +384,7 @@ class AllowOnlyOneAliasAtATimeActionTest(utils.TestCase):
def shell(self, argstr):
orig = sys.stdout
try:
sys.stdout = moves.StringIO()
sys.stdout = io.StringIO()
_shell = CustomOpenStackManilaShell()
_shell._discover_client = self.shell_discover_client
_shell.main(argstr.split())

View File

@ -10,7 +10,6 @@
# License for the specific language governing permissions and limitations
# under the License.
import six
import testtools
from manilaclient import utils
@ -20,10 +19,6 @@ class TestCommonUtils(testtools.TestCase):
def test_unicode_key_value_to_string(self):
src = {u'key': u'\u70fd\u7231\u5a77'}
expected = {'key': '\xe7\x83\xbd\xe7\x88\xb1\xe5\xa9\xb7'}
if six.PY2:
self.assertEqual(expected, utils.unicode_key_value_to_string(src))
else:
# u'xxxx' in PY3 is str, we will not get extra 'u' from cli
# output in PY3
self.assertEqual(src, utils.unicode_key_value_to_string(src))

View File

@ -13,8 +13,6 @@
# License for the specific language governing permissions and limitations
# under the License.
import six
from manilaclient.tests.unit import utils
@ -25,7 +23,7 @@ class LimitsV1Test(utils.TestCase):
from manilaclient.v1 import limits
except Exception as e:
msg = ("module 'manilaclient.v1.limits' cannot be imported "
"with error: %s") % six.text_type(e)
"with error: %s") % str(e)
assert False, msg
for cls in ('Limits', 'RateLimit', 'AbsoluteLimit', 'LimitsManager'):
msg = "Module 'limits' has no '%s' attr." % cls

View File

@ -13,8 +13,6 @@
# License for the specific language governing permissions and limitations
# under the License.
import six
from manilaclient.tests.unit import utils
@ -25,7 +23,7 @@ class QuotaClassesV1Test(utils.TestCase):
from manilaclient.v1 import quota_classes
except Exception as e:
msg = ("module 'manilaclient.v1.quota_classes' cannot be imported "
"with error: %s") % six.text_type(e)
"with error: %s") % str(e)
assert False, msg
for cls in ('QuotaClassSet', 'QuotaClassSetManager'):
msg = "Module 'quota_classes' has no '%s' attr." % cls

View File

@ -13,8 +13,6 @@
# License for the specific language governing permissions and limitations
# under the License.
import six
from manilaclient.tests.unit import utils
@ -25,7 +23,7 @@ class QuotasV1Test(utils.TestCase):
from manilaclient.v1 import quotas
except Exception as e:
msg = ("module 'manilaclient.v1.quotas' cannot be imported "
"with error: %s") % six.text_type(e)
"with error: %s") % str(e)
assert False, msg
for cls in ('QuotaSet', 'QuotaSetManager'):
msg = "Module 'quotas' has no '%s' attr." % cls

View File

@ -13,8 +13,6 @@
# License for the specific language governing permissions and limitations
# under the License.
import six
from manilaclient.tests.unit import utils
@ -25,7 +23,7 @@ class SchedulerStatsV1Test(utils.TestCase):
from manilaclient.v1 import scheduler_stats
except Exception as e:
msg = ("module 'manilaclient.v1.scheduler_stats' cannot be "
"imported with error: %s") % six.text_type(e)
"imported with error: %s") % str(e)
assert False, msg
for cls in ('Pool', 'PoolManager'):
msg = "Module 'scheduler_stats' has no '%s' attr." % cls

View File

@ -13,8 +13,6 @@
# License for the specific language governing permissions and limitations
# under the License.
import six
from manilaclient.tests.unit import utils
@ -25,7 +23,7 @@ class SecurityServicesV1Test(utils.TestCase):
from manilaclient.v1 import security_services
except Exception as e:
msg = ("module 'manilaclient.v1.security_services' cannot be "
"imported with error: %s") % six.text_type(e)
"imported with error: %s") % str(e)
assert False, msg
for cls in ('SecurityService', 'SecurityServiceManager'):
msg = "Module 'security_services' has no '%s' attr." % cls

View File

@ -13,8 +13,6 @@
# License for the specific language governing permissions and limitations
# under the License.
import six
from manilaclient.tests.unit import utils
@ -25,7 +23,7 @@ class ServicesV1Test(utils.TestCase):
from manilaclient.v1 import services
except Exception as e:
msg = ("module 'manilaclient.v1.services' cannot be imported "
"with error: %s") % six.text_type(e)
"with error: %s") % str(e)
assert False, msg
for cls in ('Service', 'ServiceManager'):
msg = "Module 'services' has no '%s' attr." % cls

View File

@ -13,8 +13,6 @@
# License for the specific language governing permissions and limitations
# under the License.
import six
from manilaclient.tests.unit import utils
@ -25,7 +23,7 @@ class ShareNetworksV1Test(utils.TestCase):
from manilaclient.v1 import share_networks
except Exception as e:
msg = ("module 'manilaclient.v1.share_networks' cannot be "
"imported with error: %s") % six.text_type(e)
"imported with error: %s") % str(e)
assert False, msg
for cls in ('ShareNetwork', 'ShareNetworkManager'):
msg = "Module 'share_networks' has no '%s' attr." % cls

View File

@ -13,8 +13,6 @@
# License for the specific language governing permissions and limitations
# under the License.
import six
from manilaclient.tests.unit import utils
@ -25,7 +23,7 @@ class ShareServersV1Test(utils.TestCase):
from manilaclient.v1 import share_servers
except Exception as e:
msg = ("module 'manilaclient.v1.share_servers' cannot be imported "
"with error: %s") % six.text_type(e)
"with error: %s") % str(e)
assert False, msg
for cls in ('ShareServer', 'ShareServerManager'):
msg = "Module 'share_servers' has no '%s' attr." % cls

View File

@ -13,8 +13,6 @@
# License for the specific language governing permissions and limitations
# under the License.
import six
from manilaclient.tests.unit import utils
@ -25,7 +23,7 @@ class ShareSnapshotsV1Test(utils.TestCase):
from manilaclient.v1 import share_snapshots
except Exception as e:
msg = ("module 'manilaclient.v1.share_snapshots' cannot be "
"imported with error: %s") % six.text_type(e)
"imported with error: %s") % str(e)
assert False, msg
for cls in ('ShareSnapshot', 'ShareSnapshotManager'):
msg = "Module 'share_snapshots' has no '%s' attr." % cls

View File

@ -13,8 +13,6 @@
# License for the specific language governing permissions and limitations
# under the License.
import six
from manilaclient.tests.unit import utils
@ -25,7 +23,7 @@ class ShareTypeAccessV1Test(utils.TestCase):
from manilaclient.v1 import share_type_access
except Exception as e:
msg = ("module 'manilaclient.v1.share_type_access' cannot be "
"imported with error: %s") % six.text_type(e)
"imported with error: %s") % str(e)
assert False, msg
for cls in ('ShareTypeAccess', 'ShareTypeAccessManager'):
msg = "Module 'share_type_access' has no '%s' attr." % cls

View File

@ -13,8 +13,6 @@
# License for the specific language governing permissions and limitations
# under the License.
import six
from manilaclient.tests.unit import utils
@ -25,7 +23,7 @@ class ShareTypesV1Test(utils.TestCase):
from manilaclient.v1 import share_types
except Exception as e:
msg = ("module 'manilaclient.v1.share_types' cannot be imported "
"with error: %s") % six.text_type(e)
"with error: %s") % str(e)
assert False, msg
for cls in ('ShareType', 'ShareTypeManager'):
msg = "Module 'share_types' has no '%s' attr." % cls

View File

@ -13,8 +13,6 @@
# License for the specific language governing permissions and limitations
# under the License.
import six
from manilaclient.tests.unit import utils
@ -25,7 +23,7 @@ class SharesV1Test(utils.TestCase):
from manilaclient.v1 import shares
except Exception as e:
msg = ("module 'manilaclient.v1.shares' cannot be imported "
"with error: %s") % six.text_type(e)
"with error: %s") % str(e)
assert False, msg
for cls in ('Share', 'ShareManager'):
msg = "Module 'shares' has no '%s' attr." % cls

View File

@ -16,7 +16,6 @@
from unittest import mock
import ddt
import six
from manilaclient.tests.unit import utils
from manilaclient.tests.unit.v2 import fakes as fake
@ -33,7 +32,7 @@ class MessageTest(utils.TestCase):
self.fake_kwargs = {'key': 'value'}
def test_repr(self):
result = six.text_type(self.message)
result = str(self.message)
self.assertEqual('<Message: fake_id>', result)

View File

@ -16,7 +16,6 @@
from unittest import mock
import ddt
import six
import manilaclient
from manilaclient import exceptions
@ -35,7 +34,7 @@ class ShareGroupSnapshotTest(utils.TestCase):
self.fake_kwargs = {'key': 'value'}
def test_repr(self):
result = six.text_type(self.share_group_snapshot)
result = str(self.share_group_snapshot)
self.assertEqual('<Share Group Snapshot: fake_id>', result)

View File

@ -16,7 +16,6 @@
from unittest import mock
import ddt
import six
import manilaclient
from manilaclient import exceptions
@ -37,7 +36,7 @@ class ShareGroupTypeAccessTest(utils.TestCase):
self.manager, fake_group_type_access_info, loaded=True)
def test_repr(self):
result = six.text_type(self.share_group_type_access)
result = str(self.share_group_type_access)
self.assertEqual(
'<Share Group Type Access: %s>' % fake.ShareGroupTypeAccess.id,

View File

@ -16,7 +16,6 @@
from unittest import mock
import ddt
import six
import manilaclient
from manilaclient import exceptions
@ -43,7 +42,7 @@ class ShareGroupTypeTest(utils.TestCase):
self.manager, self.fake_share_group_type_info, loaded=True)
def test_repr(self):
result = six.text_type(self.share_group_type)
result = str(self.share_group_type)
self.assertEqual(
'<Share Group Type: %s>' % fake.ShareGroupType.name, result)

View File

@ -16,7 +16,6 @@
from unittest import mock
import ddt
import six
import manilaclient
from manilaclient import exceptions
@ -36,7 +35,7 @@ class ShareGroupTest(utils.TestCase):
self.fake_kwargs = {'key': 'value'}
def test_repr(self):
result = six.text_type(self.share_group)
result = str(self.share_group)
self.assertEqual('<Share Group: fake_id>', result)

View File

@ -21,7 +21,6 @@ from unittest import mock
import ddt
import fixtures
from oslo_utils import strutils
import six
from manilaclient import api_versions
from manilaclient import client
@ -606,7 +605,7 @@ class ShellTest(test_utils.TestCase):
}
self.run_command(
'type-create test-type-3 false --is-public %s' %
six.text_type(public))
str(public))
self.assert_called('POST', '/types', body=expected)
def test_type_access_list(self):
@ -3050,7 +3049,7 @@ class ShellTest(test_utils.TestCase):
self.run_command(
'share-group-type-create test-group-type-1 '
'type1,type2 --is-public %s --group-specs '
'spec1=value1' % six.text_type(public))
'spec1=value1' % str(public))
self.assert_called_anytime('POST', '/share-group-types', body=expected)
@ -3404,7 +3403,7 @@ class ShellTest(test_utils.TestCase):
@ddt.data('migration_error', 'migration_success', None)
def test_reset_task_state(self, param):
command = ' '.join(('reset-task-state --state', six.text_type(param),
command = ' '.join(('reset-task-state --state', str(param),
'1234'))
self.run_command(command)
expected = {'reset_task_state': {'task_state': param}}
@ -3712,7 +3711,7 @@ class ShellTest(test_utils.TestCase):
@ddt.data('migration_error', 'migration_success', None)
def test_share_server_reset_task_state(self, param):
command = ' '.join(('share-server-reset-task-state --state',
six.text_type(param),
str(param),
'1234'))
self.run_command(command)
expected = {'reset_task_state': {'task_state': param}}

View File

@ -12,8 +12,6 @@
from urllib import parse
import six
class HookableMixin(object):
"""Mixin so classes can register and run hooks."""
@ -46,19 +44,11 @@ def safe_issubclass(*args):
def get_function_name(func):
if six.PY2:
if hasattr(func, "im_class"):
return "%s.%s" % (func.im_class, func.__name__)
else:
return "%s.%s" % (func.__module__, func.__name__)
else:
return "%s.%s" % (func.__module__, func.__qualname__)
def _encode(src):
"""remove extra 'u' in PY2."""
if six.PY2 and isinstance(src, six.text_type):
return src.encode('utf-8')
return src

View File

@ -18,7 +18,6 @@ import collections
import ipaddress
from oslo_utils import uuidutils
import re
import six
import string
from manilaclient import api_versions
@ -507,11 +506,11 @@ class ShareManager(base.ManagerWithFind):
if access_type == 'ip':
try:
if enable_ipv6:
ipaddress.ip_network(six.text_type(access))
ipaddress.ip_network(str(access))
else:
ipaddress.IPv4Network(six.text_type(access))
ipaddress.IPv4Network(str(access))
except ValueError as error:
raise exceptions.CommandError(six.text_type(error))
raise exceptions.CommandError(str(error))
elif access_type == 'user':
self._validate_username(access)
elif access_type == 'cert':

View File

@ -21,7 +21,6 @@ import sys
import time
from oslo_utils import strutils
import six
from manilaclient import api_versions
from manilaclient.common.apiclient import utils as apiclient_utils
@ -2062,27 +2061,27 @@ def do_snapshot_access_list(cs, args):
@cliutils.arg(
'--name',
metavar='<name>',
type=six.text_type,
type=str,
default=None,
help='Filter results by name.')
@cliutils.arg(
'--description',
metavar='<description>',
type=six.text_type,
type=str,
default=None,
help='Filter results by description. '
'Available only for microversion >= 2.36.')
@cliutils.arg(
'--name~',
metavar='<name~>',
type=six.text_type,
type=str,
default=None,
help='Filter results matching a share name pattern. '
'Available only for microversion >= 2.36.')
@cliutils.arg(
'--description~',
metavar='<description~>',
type=six.text_type,
type=str,
default=None,
help='Filter results matching a share description pattern. '
'Available only for microversion >= 2.36.')
@ -2532,13 +2531,13 @@ def do_share_instance_export_location_show(cs, args):
@cliutils.arg(
'--name',
metavar='<name>',
type=six.text_type,
type=str,
default=None,
help='Filter results by name.')
@cliutils.arg(
'--description',
metavar='<description>',
type=six.text_type,
type=str,
default=None,
help='Filter results by description. '
'Available only for microversion >= 2.36.')
@ -2606,14 +2605,14 @@ def do_share_instance_export_location_show(cs, args):
@cliutils.arg(
'--name~',
metavar='<name~>',
type=six.text_type,
type=str,
default=None,
help='Filter results matching a share snapshot name pattern. '
'Available only for microversion >= 2.36.')
@cliutils.arg(
'--description~',
metavar='<description~>',
type=six.text_type,
type=str,
default=None,
help='Filter results matching a share snapshot description pattern. '
'Available only for microversion >= 2.36.')
@ -3429,13 +3428,13 @@ def do_share_network_list(cs, args):
@cliutils.arg(
'--name',
metavar='<name>',
type=six.text_type,
type=str,
default=None,
help='Filter results by name.')
@cliutils.arg(
'--description',
metavar='<description>',
type=six.text_type,
type=str,
default=None,
help='Filter results by description. '
'Available only for microversion >= 2.36.')
@ -3527,14 +3526,14 @@ def do_share_network_list(cs, args):
@cliutils.arg(
'--name~',
metavar='<name~>',
type=six.text_type,
type=str,
default=None,
help='Filter results matching a share network name pattern. '
'Available only for microversion >= 2.36.')
@cliutils.arg(
'--description~',
metavar='<description~>',
type=six.text_type,
type=str,
default=None,
help='Filter results matching a share network description pattern. '
'Available only for microversion >= 2.36.')
@ -4791,7 +4790,7 @@ def do_type_create(cs, args):
args.spec_driver_handles_share_servers, strict=True))
except ValueError as e:
msg = ("Argument spec_driver_handles_share_servers "
"argument is not valid: %s" % six.text_type(e))
"argument is not valid: %s" % str(e))
raise exceptions.CommandError(msg)
kwargs['extra_specs'] = _extract_extra_specs(args)
@ -4834,7 +4833,7 @@ def do_type_create(cs, args):
kwargs['extra_specs'][key], strict=True))
except ValueError as e:
msg = ("Argument '%s' is of boolean "
"type and has invalid value: %s" % (key, six.text_type(e)))
"type and has invalid value: %s" % (key, str(e)))
raise exceptions.CommandError(msg)
stype = cs.share_types.create(**kwargs)
@ -4882,7 +4881,7 @@ def do_type_update(cs, args):
strict=True)
except ValueError as e:
raise exceptions.CommandError("The value of 'is_public' is"
" invalid: %s", six.text_type(e))
" invalid: %s", str(e))
kwargs['description'] = description
stype = _find_share_type(cs, args.id)
@ -5332,13 +5331,13 @@ def do_share_group_create(cs, args):
@cliutils.arg(
'--name',
metavar='<name>',
type=six.text_type,
type=str,
default=None,
help='Filter results by name.')
@cliutils.arg(
'--description',
metavar='<description>',
type=six.text_type,
type=str,
default=None,
help='Filter results by description. '
'Available only for microversion >= 2.36.')
@ -5428,14 +5427,14 @@ def do_share_group_create(cs, args):
@cliutils.arg(
'--name~',
metavar='<name~>',
type=six.text_type,
type=str,
default=None,
help='Filter results matching a share group name pattern. '
'Available only for microversion >= 2.36.')
@cliutils.arg(
'--description~',
metavar='<description~>',
type=six.text_type,
type=str,
default=None,
help='Filter results matching a share group description pattern. '
'Available only for microversion >= 2.36.')

View File

@ -13,7 +13,6 @@ PrettyTable>=0.7.1 # BSD
requests>=2.14.2 # Apache-2.0
simplejson>=3.5.1 # MIT
Babel!=2.4.0,>=2.3.4 # BSD
six>=1.10.0 # MIT
osc-lib>=1.10.0 # Apache-2.0
python-keystoneclient>=3.8.0 # Apache-2.0
debtcollector>=1.2.0 # Apache-2.0