summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--HACKING.rst2
-rw-r--r--integration/scripts/files/requirements/ubuntu-requirements.txt1
-rw-r--r--integration/tests/integration/int_tests.py1
-rw-r--r--lower-constraints.txt1
-rw-r--r--requirements.txt1
-rwxr-xr-xtools/trove-pylint.py4
-rw-r--r--tox.ini1
-rw-r--r--trove/cluster/models.py4
-rw-r--r--trove/common/crypto_utils.py5
-rw-r--r--trove/common/db/models.py3
-rw-r--r--trove/common/db/postgresql/models.py4
-rw-r--r--trove/common/extensions.py4
-rw-r--r--trove/common/server_group.py4
-rw-r--r--trove/common/strategies/strategy.py4
-rw-r--r--trove/common/stream_codecs.py16
-rw-r--r--trove/common/utils.py3
-rw-r--r--trove/configuration/service.py7
-rw-r--r--trove/extensions/common/service.py4
-rw-r--r--trove/guestagent/common/configuration.py4
-rw-r--r--trove/guestagent/common/guestagent_utils.py4
-rw-r--r--trove/guestagent/datastore/mysql_common/service.py4
-rw-r--r--trove/guestagent/module/drivers/module_driver.py4
-rw-r--r--trove/guestagent/pkg.py3
-rw-r--r--trove/guestagent/strategies/replication/base.py4
-rw-r--r--trove/guestagent/volume.py4
-rw-r--r--trove/hacking/checks.py12
-rw-r--r--trove/instance/models.py17
-rw-r--r--trove/module/models.py3
-rw-r--r--trove/network/base.py5
-rw-r--r--trove/quota/quota.py3
-rw-r--r--trove/tests/api/configurations.py45
-rw-r--r--trove/tests/api/datastores.py39
-rw-r--r--trove/tests/fakes/swift.py3
-rw-r--r--trove/tests/scenario/groups/test_group.py4
-rw-r--r--trove/tests/scenario/runners/cluster_runners.py13
-rw-r--r--trove/tests/scenario/runners/configuration_runners.py23
-rw-r--r--trove/tests/scenario/runners/module_runners.py3
-rw-r--r--trove/tests/scenario/runners/test_runners.py6
-rw-r--r--trove/tests/unittests/api/common/test_limits.py4
-rw-r--r--trove/tests/unittests/common/test_crypto_utils.py3
-rw-r--r--trove/tests/unittests/hacking/test_check.py8
-rw-r--r--trove/tests/util/check.py3
42 files changed, 106 insertions, 184 deletions
diff --git a/HACKING.rst b/HACKING.rst
index c5773879..13c1130e 100644
--- a/HACKING.rst
+++ b/HACKING.rst
@@ -2,6 +2,4 @@ Trove Library Specific Commandments
-------------------------------------
- [T103] Exception messages should be translated
-- [T104] Python 3 is not support basestring,replace basestring with
- six.string_types
- [T105] Validate no LOG translations
diff --git a/integration/scripts/files/requirements/ubuntu-requirements.txt b/integration/scripts/files/requirements/ubuntu-requirements.txt
index 038ccca7..a6347bdb 100644
--- a/integration/scripts/files/requirements/ubuntu-requirements.txt
+++ b/integration/scripts/files/requirements/ubuntu-requirements.txt
@@ -9,7 +9,6 @@ python-swiftclient>=2.2.0
python-cinderclient>=1.1.0
python-keystoneclient>=2.0.0,!=2.1.0 # Apache-2.0
kombu>=2.5.0
-six>=1.7.0
babel
python-heatclient>=0.2.9
passlib
diff --git a/integration/tests/integration/int_tests.py b/integration/tests/integration/int_tests.py
index 130ae514..27e1e791 100644
--- a/integration/tests/integration/int_tests.py
+++ b/integration/tests/integration/int_tests.py
@@ -41,7 +41,6 @@ be used.
import atexit
import gettext
import os
-import six
import sys
import proboscis
diff --git a/lower-constraints.txt b/lower-constraints.txt
index 6e846a2f..8b12f5ec 100644
--- a/lower-constraints.txt
+++ b/lower-constraints.txt
@@ -135,7 +135,6 @@ restructuredtext-lint==1.1.3
rfc3986==1.1.0
Routes==2.3.1
simplejson==3.13.2
-six==1.10.0
smmap2==2.0.3
snowballstemmer==1.2.1
Sphinx==1.6.2
diff --git a/requirements.txt b/requirements.txt
index 6579d13f..e58dd2a5 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -37,7 +37,6 @@ oslo.upgradecheck>=0.1.0 # Apache-2.0
oslo.utils>=3.33.0 # Apache-2.0
oslo.concurrency>=3.26.0 # Apache-2.0
PyMySQL>=0.7.6 # MIT License
-six>=1.10.0 # MIT
stevedore>=1.20.0 # Apache-2.0
oslo.messaging>=5.29.0 # Apache-2.0
osprofiler>=1.4.0 # Apache-2.0
diff --git a/tools/trove-pylint.py b/tools/trove-pylint.py
index 088203c2..f705051d 100755
--- a/tools/trove-pylint.py
+++ b/tools/trove-pylint.py
@@ -18,7 +18,6 @@ from collections import OrderedDict
import io
import os
import re
-import six
import sys
from pylint import lint
@@ -60,8 +59,7 @@ class Config(object):
sorted_config = OrderedDict()
for key in sorted(self.config.keys()):
value = self.get(key)
- if isinstance(value, list) and not isinstance(value,
- six.string_types):
+ if isinstance(value, list) and not isinstance(value,str):
sorted_config[key] = sorted(value)
else:
sorted_config[key] = value
diff --git a/tox.ini b/tox.ini
index a75f0d37..522b1bd6 100644
--- a/tox.ini
+++ b/tox.ini
@@ -67,7 +67,6 @@ import_exceptions = trove.common.i18n
[flake8:local-plugins]
extension =
# T103= checks:check_raised_localized_exceptions
- T104 = checks:check_no_basestring
T105 = checks:no_translate_logs
N335 = checks:assert_raises_regexp
paths = ./trove/hacking
diff --git a/trove/cluster/models.py b/trove/cluster/models.py
index 18f9c944..7c95b3fe 100644
--- a/trove/cluster/models.py
+++ b/trove/cluster/models.py
@@ -13,8 +13,6 @@
# License for the specific language governing permissions and limitations
# under the License.
-import six
-
from oslo_log import log as logging
from neutronclient.common import exceptions as neutron_exceptions
@@ -324,7 +322,7 @@ class Cluster(object):
node['availability_zone'])
if 'type' in node:
instance_type = node['type']
- if isinstance(instance_type, six.string_types):
+ if isinstance(instance_type, str):
instance_type = instance_type.split(',')
instance['instance_type'] = instance_type
instances.append(instance)
diff --git a/trove/common/crypto_utils.py b/trove/common/crypto_utils.py
index f8acd81e..657d8158 100644
--- a/trove/common/crypto_utils.py
+++ b/trove/common/crypto_utils.py
@@ -20,7 +20,6 @@ import hashlib
import os
from oslo_utils import encodeutils
import random
-import six
import string
from cryptography.hazmat.backends import default_backend
@@ -67,12 +66,12 @@ def decode_data(data):
# Pad the data string to an multiple of pad_size
def pad_for_encryption(data, pad_size=IV_BYTE_COUNT):
pad_count = pad_size - (len(data) % pad_size)
- return data + six.int2byte(pad_count) * pad_count
+ return data + bytes((pad_count,)) * pad_count
# Unpad the data string by stripping off excess characters
def unpad_after_decryption(data):
- return data[:len(data) - six.indexbytes(data, -1)]
+ return data[:len(data) - data[-1]]
def encrypt_data(data, key, iv_byte_count=IV_BYTE_COUNT):
diff --git a/trove/common/db/models.py b/trove/common/db/models.py
index 952d0a5c..1b5a1f1f 100644
--- a/trove/common/db/models.py
+++ b/trove/common/db/models.py
@@ -14,7 +14,6 @@
# under the License.
import abc
-import six
from trove.common import cfg
from trove.common.i18n import _
@@ -85,7 +84,7 @@ class DatastoreModelsBase(object):
:param desc: Description for exception message.
:raises: ValueError if not a string/unicode.
"""
- if not isinstance(value, six.string_types):
+ if not isinstance(value, str):
raise ValueError(_("%(desc)s is not a string. Type = %(t)s.")
% {'desc': desc, 't': type(value)})
diff --git a/trove/common/db/postgresql/models.py b/trove/common/db/postgresql/models.py
index bc0ba73a..8980b495 100644
--- a/trove/common/db/postgresql/models.py
+++ b/trove/common/db/postgresql/models.py
@@ -15,15 +15,13 @@
import re
-from six import u
-
from trove.common.db import models
class PostgreSQLSchema(models.DatastoreSchema):
"""Represents a PostgreSQL schema and its associated properties."""
- name_regex = re.compile(u(r'^[\u0001-\u007F\u0080-\uFFFF]+[^\s]$'))
+ name_regex = re.compile(str(r'^[\u0001-\u007F\u0080-\uFFFF]+[^\s]$'))
def __init__(self, name=None, collate=None, character_set=None,
deserializing=False):
diff --git a/trove/common/extensions.py b/trove/common/extensions.py
index fe8b96c4..463f17e6 100644
--- a/trove/common/extensions.py
+++ b/trove/common/extensions.py
@@ -19,7 +19,6 @@ from lxml import etree
from oslo_log import log as logging
from oslo_utils import encodeutils
import routes
-import six
import stevedore
import webob.dec
import webob.exc
@@ -34,8 +33,7 @@ DEFAULT_XMLNS = "http://docs.openstack.org/trove"
XMLNS_ATOM = "http://www.w3.org/2005/Atom"
-@six.add_metaclass(abc.ABCMeta)
-class ExtensionDescriptor(object):
+class ExtensionDescriptor(object, metaclass=abc.ABCMeta):
"""Base class that defines the contract for extensions.
Note that you don't have to derive from this class to have a valid
diff --git a/trove/common/server_group.py b/trove/common/server_group.py
index 01a393ac..4c0f1fa6 100644
--- a/trove/common/server_group.py
+++ b/trove/common/server_group.py
@@ -14,8 +14,6 @@
# under the License.
#
-import six
-
from oslo_log import log as logging
from trove.common.clients import create_nova_client
@@ -84,7 +82,7 @@ class ServerGroup(object):
scheduler_hint = None
if locality:
# Build the scheduler hint, but only if locality's a string
- if isinstance(locality, six.string_types):
+ if isinstance(locality, str):
server_group = cls.create(
context, locality, name_suffix)
scheduler_hint = cls.convert_to_hint(
diff --git a/trove/common/strategies/strategy.py b/trove/common/strategies/strategy.py
index c176601d..b2617634 100644
--- a/trove/common/strategies/strategy.py
+++ b/trove/common/strategies/strategy.py
@@ -17,7 +17,6 @@
import abc
from oslo_log import log as logging
-import six
from trove.common.i18n import _
from trove.common import utils
@@ -26,8 +25,7 @@ from trove.common import utils
LOG = logging.getLogger(__name__)
-@six.add_metaclass(abc.ABCMeta)
-class Strategy(object):
+class Strategy(object, metaclass=abc.ABCMeta):
__strategy_ns__ = None
diff --git a/trove/common/stream_codecs.py b/trove/common/stream_codecs.py
index 824273d5..ab5a60b7 100644
--- a/trove/common/stream_codecs.py
+++ b/trove/common/stream_codecs.py
@@ -21,7 +21,6 @@ import io
import re
import sys
-import six
import xmltodict
import yaml
@@ -74,7 +73,7 @@ class StringConverter(object):
# Return known mappings and quoted strings right away.
if value in self._object_mappings:
return self._object_mappings[value]
- elif (isinstance(value, six.string_types) and
+ elif (isinstance(value, str) and
re.match("^'(.*)'|\"(.*)\"$", value)):
return value
@@ -84,8 +83,7 @@ class StringConverter(object):
return value
-@six.add_metaclass(abc.ABCMeta)
-class StreamCodec(object):
+class StreamCodec(object, metaclass=abc.ABCMeta):
@abc.abstractmethod
def serialize(self, data):
@@ -202,7 +200,7 @@ class IniCodec(StreamCodec):
def serialize(self, dict_data):
parser = self._init_config_parser(dict_data)
- output = six.StringIO()
+ output = io.StringIO()
parser.write(output)
return output.getvalue()
@@ -217,8 +215,8 @@ class IniCodec(StreamCodec):
for s in parser.sections()}
def _pre_parse(self, stream):
- buf = six.StringIO()
- for line in six.StringIO(stream):
+ buf = io.StringIO()
+ for line in io.StringIO(stream):
# Ignore commented lines.
if not line.startswith(self._comment_markers):
# Strip leading and trailing whitespaces from each line.
@@ -297,7 +295,7 @@ class PropertiesCodec(StreamCodec):
self._unpack_singletons = unpack_singletons
def serialize(self, dict_data):
- output = six.StringIO()
+ output = io.StringIO()
writer = csv.writer(output, delimiter=self._delimiter,
quoting=self.QUOTING_MODE,
strict=self.STRICT_MODE,
@@ -309,7 +307,7 @@ class PropertiesCodec(StreamCodec):
return output.getvalue()
def deserialize(self, stream):
- reader = csv.reader(six.StringIO(stream),
+ reader = csv.reader(io.StringIO(stream),
delimiter=self._delimiter,
quoting=self.QUOTING_MODE,
strict=self.STRICT_MODE,
diff --git a/trove/common/utils.py b/trove/common/utils.py
index 874019bd..49823db5 100644
--- a/trove/common/utils.py
+++ b/trove/common/utils.py
@@ -30,7 +30,6 @@ from oslo_utils.encodeutils import safe_encode
from oslo_utils import importutils
from oslo_utils import strutils
from passlib import pwd
-import six
from trove.common import cfg
from trove.common import exception
@@ -333,7 +332,7 @@ def is_collection(item):
"""Return True is a given item is an iterable collection, but not a string.
"""
return (isinstance(item, collections.Iterable) and
- not isinstance(item, (bytes, six.text_type)))
+ not isinstance(item, (bytes, str)))
def format_output(message, format_len=79, truncate_len=None, replace_index=0):
diff --git a/trove/configuration/service.py b/trove/configuration/service.py
index 18ec05c3..7cd6576d 100644
--- a/trove/configuration/service.py
+++ b/trove/configuration/service.py
@@ -14,7 +14,6 @@
# under the License.
from oslo_log import log as logging
-import six
from trove.cluster import models as cluster_models
import trove.common.apischema as apischema
@@ -307,7 +306,7 @@ class ConfigurationsController(wsgi.Controller):
raise exception.UnprocessableEntity(message=msg)
# integer min/max checking
- if isinstance(v, six.integer_types) and not isinstance(v, bool):
+ if isinstance(v, int) and not isinstance(v, bool):
if rule.min_size is not None:
try:
min_value = int(rule.min_size)
@@ -345,9 +344,9 @@ class ConfigurationsController(wsgi.Controller):
if value_type == "boolean":
return bool
elif value_type == "string":
- return six.string_types
+ return str
elif value_type == "integer":
- return six.integer_types
+ return int
elif value_type == "float":
return float
else:
diff --git a/trove/extensions/common/service.py b/trove/extensions/common/service.py
index d645de4d..42465ad5 100644
--- a/trove/extensions/common/service.py
+++ b/trove/extensions/common/service.py
@@ -19,7 +19,6 @@ import abc
from oslo_config.cfg import NoSuchOptError
from oslo_log import log as logging
from oslo_utils import importutils
-import six
from trove.cluster import models as cluster_models
from trove.cluster.models import DBCluster
@@ -62,8 +61,7 @@ class ExtensionController(wsgi.Controller):
{'tenant': target.tenant_id})
-@six.add_metaclass(abc.ABCMeta)
-class BaseDatastoreRootController(ExtensionController):
+class BaseDatastoreRootController(ExtensionController, metaclass=abc.ABCMeta):
"""Base class that defines the contract for root controllers."""
@abc.abstractmethod
diff --git a/trove/guestagent/common/configuration.py b/trove/guestagent/common/configuration.py
index 58595eb1..9ea7d4e1 100644
--- a/trove/guestagent/common/configuration.py
+++ b/trove/guestagent/common/configuration.py
@@ -18,7 +18,6 @@ import os
import re
from oslo_log import log as logging
-import six
from trove.guestagent.common import guestagent_utils
from trove.guestagent.common import operating_system
@@ -224,8 +223,7 @@ class ConfigurationManager(object):
self._value_cache = self.parse_configuration()
-@six.add_metaclass(abc.ABCMeta)
-class ConfigurationOverrideStrategy(object):
+class ConfigurationOverrideStrategy(object, metaclass=abc.ABCMeta):
"""ConfigurationOverrideStrategy handles configuration files.
The strategy provides functionality to enumerate, apply and remove
configuration overrides.
diff --git a/trove/guestagent/common/guestagent_utils.py b/trove/guestagent/common/guestagent_utils.py
index bd0a631b..23d009bb 100644
--- a/trove/guestagent/common/guestagent_utils.py
+++ b/trove/guestagent/common/guestagent_utils.py
@@ -17,8 +17,6 @@ import collections
import os
import re
-import six
-
from trove.common import cfg
from trove.common import pagination
from trove.common import utils
@@ -112,7 +110,7 @@ def build_file_path(base_dir, base_name, *extensions):
def to_bytes(value):
"""Convert numbers with a byte suffix to bytes.
"""
- if isinstance(value, six.string_types):
+ if isinstance(value, str):
pattern = re.compile(r'^(\d+)([K,M,G]{1})$')
match = pattern.match(value)
if match:
diff --git a/trove/guestagent/datastore/mysql_common/service.py b/trove/guestagent/datastore/mysql_common/service.py
index 9f6e5d93..6e29ec7b 100644
--- a/trove/guestagent/datastore/mysql_common/service.py
+++ b/trove/guestagent/datastore/mysql_common/service.py
@@ -17,7 +17,6 @@ import re
from oslo_log import log as logging
from oslo_utils import encodeutils
-import six
import sqlalchemy
from sqlalchemy import exc
from sqlalchemy.sql.expression import text
@@ -93,8 +92,7 @@ class BaseMySqlAppStatus(service.BaseDbStatus):
return service_status.ServiceStatuses.UNKNOWN
-@six.add_metaclass(abc.ABCMeta)
-class BaseMySqlAdmin(object):
+class BaseMySqlAdmin(object, metaclass=abc.ABCMeta):
"""Handles administrative tasks on the MySQL database."""
def __init__(self, mysql_root_access, mysql_app):
diff --git a/trove/guestagent/module/drivers/module_driver.py b/trove/guestagent/module/drivers/module_driver.py
index ede44661..95a1fe1b 100644
--- a/trove/guestagent/module/drivers/module_driver.py
+++ b/trove/guestagent/module/drivers/module_driver.py
@@ -17,7 +17,6 @@
import abc
import functools
import re
-import six
from oslo_log import log as logging
@@ -27,8 +26,7 @@ from trove.common import exception
LOG = logging.getLogger(__name__)
-@six.add_metaclass(abc.ABCMeta)
-class ModuleDriver(object):
+class ModuleDriver(object, metaclass=abc.ABCMeta):
"""Base class that defines the contract for module drivers.
Note that you don't have to derive from this class to have a valid
diff --git a/trove/guestagent/pkg.py b/trove/guestagent/pkg.py
index 5dc00903..c9d010f6 100644
--- a/trove/guestagent/pkg.py
+++ b/trove/guestagent/pkg.py
@@ -24,7 +24,6 @@ from tempfile import NamedTemporaryFile
from oslo_log import log as logging
from oslo_utils import encodeutils
import pexpect
-import six
from trove.common import exception
from trove.common.exception import ProcessExecutionError
@@ -52,7 +51,7 @@ def getoutput(*cmd):
stderr=subprocess.STDOUT)
except OSError:
# ignore errors like program not found
- return six.text_type("")
+ return str("")
stdout = proc.communicate()[0]
return encodeutils.safe_decode(stdout)
diff --git a/trove/guestagent/strategies/replication/base.py b/trove/guestagent/strategies/replication/base.py
index 6e655925..5b7cbbae 100644
--- a/trove/guestagent/strategies/replication/base.py
+++ b/trove/guestagent/strategies/replication/base.py
@@ -16,12 +16,10 @@
import abc
-import six
from trove.common.strategies.strategy import Strategy
-@six.add_metaclass(abc.ABCMeta)
-class Replication(Strategy):
+class Replication(Strategy, metaclass=abc.ABCMeta):
"""Base class for Replication Strategy implementation."""
__strategy_type__ = 'replication'
diff --git a/trove/guestagent/volume.py b/trove/guestagent/volume.py
index eea86bc8..e0fd04fd 100644
--- a/trove/guestagent/volume.py
+++ b/trove/guestagent/volume.py
@@ -16,7 +16,6 @@
import abc
import os
import shlex
-import six
from tempfile import NamedTemporaryFile
import traceback
@@ -51,8 +50,7 @@ def log_and_raise(log_fmt, exc_fmt, fmt_content=None):
raise exception.GuestError(original_message=raise_msg)
-@six.add_metaclass(abc.ABCMeta)
-class FSBase(object):
+class FSBase(object, metaclass=abc.ABCMeta):
def __init__(self, fstype, format_options):
self.fstype = fstype
diff --git a/trove/hacking/checks.py b/trove/hacking/checks.py
index 851ddd66..a00a2814 100644
--- a/trove/hacking/checks.py
+++ b/trove/hacking/checks.py
@@ -59,18 +59,6 @@ def check_raised_localized_exceptions(logical_line, filename):
@core.flake8ext
-def check_no_basestring(logical_line):
- """T104 - Don't use basestring, use six.string_types instead
- basestring is not supported by py3, using six.string_types to ensure
- py3 and py2 compatibility
- """
- if re.search(r"\, basestring\)", logical_line):
- msg = ("T104: basestring is not Python3-compatible, use "
- "six.string_types instead.")
- yield(0, msg)
-
-
-@core.flake8ext
def no_translate_logs(physical_line, logical_line, filename):
"""T105 - Log messages shouldn't be translated from the
Pike release.
diff --git a/trove/instance/models.py b/trove/instance/models.py
index 089b0e13..cc392798 100644
--- a/trove/instance/models.py
+++ b/trove/instance/models.py
@@ -26,7 +26,6 @@ from oslo_config.cfg import NoSuchOptError
from oslo_log import log as logging
from oslo_utils import encodeutils
from oslo_utils import netutils
-import six
from sqlalchemy import func
from trove.backup.models import Backup
@@ -757,7 +756,7 @@ class BaseInstance(SimpleInstance):
except Exception as e:
LOG.warning("Failed to stop the database before attempting "
"to delete trove instance %s, error: %s", self.id,
- six.text_type(e))
+ str(e))
# Nova VM
if old_server:
@@ -766,7 +765,7 @@ class BaseInstance(SimpleInstance):
self.server.delete()
except Exception as e:
LOG.warning("Failed to delete compute server %s",
- self.server_id, six.text_type(e))
+ self.server_id, str(e))
# Neutron ports (floating IP)
try:
@@ -778,7 +777,7 @@ class BaseInstance(SimpleInstance):
neutron.delete_port(self.neutron_client, port["id"])
except Exception as e:
LOG.warning("Failed to delete ports for instance %s, "
- "error: %s", self.id, six.text_type(e))
+ "error: %s", self.id, str(e))
# Neutron security groups
try:
@@ -791,7 +790,7 @@ class BaseInstance(SimpleInstance):
self.neutron_client.delete_security_group(sg["id"])
except Exception as e:
LOG.warning("Failed to delete security groups for instance %s, "
- "error: %s", self.id, six.text_type(e))
+ "error: %s", self.id, str(e))
# DNS resources, e.g. Designate
try:
@@ -801,14 +800,14 @@ class BaseInstance(SimpleInstance):
dns_api.delete_instance_entry(instance_id=self.id)
except Exception as e:
LOG.warning("Failed to delete dns entry of instance %s, error: %s",
- self.id, six.text_type(e))
+ self.id, str(e))
# Nova server group
try:
srv_grp.ServerGroup.delete(self.context, self.server_group)
except Exception as e:
LOG.warning("Failed to delete server group for %s, error: %s",
- self.id, six.text_type(e))
+ self.id, str(e))
def server_is_finished():
try:
@@ -844,7 +843,7 @@ class BaseInstance(SimpleInstance):
volume.delete()
except Exception as e:
LOG.warning("Failed to delete volume for instance %s, error: %s",
- self.id, six.text_type(e))
+ self.id, str(e))
notification.TroveInstanceDelete(
instance=self,
@@ -1942,7 +1941,7 @@ class instance_encryption_key_cache(object):
return val
# We need string anyway
- if isinstance(val, six.binary_type):
+ if isinstance(val, bytes):
val = encodeutils.safe_decode(val)
if len(self._lru) == self._lru_cache_size:
diff --git a/trove/module/models.py b/trove/module/models.py
index c75f6fc6..5f9103da 100644
--- a/trove/module/models.py
+++ b/trove/module/models.py
@@ -17,7 +17,6 @@
"""Model classes that form the core of Module functionality."""
import hashlib
-import six
from sqlalchemy.sql.expression import or_
from oslo_log import log as logging
@@ -247,7 +246,7 @@ class Module(object):
@staticmethod
def process_contents(contents):
md5 = contents
- if isinstance(md5, six.text_type):
+ if isinstance(md5, str):
md5 = md5.encode('utf-8')
md5 = hashlib.md5(md5).hexdigest()
encrypted_contents = crypto_utils.encrypt_data(
diff --git a/trove/network/base.py b/trove/network/base.py
index 5e8ed63a..66ebebea 100644
--- a/trove/network/base.py
+++ b/trove/network/base.py
@@ -15,11 +15,8 @@
#
import abc
-import six
-
-@six.add_metaclass(abc.ABCMeta)
-class NetworkDriver(object):
+class NetworkDriver(object, metaclass=abc.ABCMeta):
"""Base Network Driver class to abstract the network driver used."""
@abc.abstractmethod
diff --git a/trove/quota/quota.py b/trove/quota/quota.py
index 8d8ebf2b..fd5aa766 100644
--- a/trove/quota/quota.py
+++ b/trove/quota/quota.py
@@ -18,7 +18,6 @@
from oslo_config import cfg
from oslo_log import log as logging
from oslo_utils import importutils
-import six
from trove.common import exception
from trove.quota.models import Quota
@@ -230,7 +229,7 @@ class QuotaEngine(object):
if not quota_driver_class:
quota_driver_class = CONF.quota_driver
- if isinstance(quota_driver_class, six.string_types):
+ if isinstance(quota_driver_class, str):
quota_driver_class = importutils.import_object(quota_driver_class,
self._resources)
self._driver = quota_driver_class
diff --git a/trove/tests/api/configurations.py b/trove/tests/api/configurations.py
index 92a61fa6..e01f13e0 100644
--- a/trove/tests/api/configurations.py
+++ b/trove/tests/api/configurations.py
@@ -30,7 +30,6 @@ from proboscis import before_class
from proboscis.decorators import time_out
from proboscis import SkipTest
from proboscis import test
-import six
from troveclient.compat import exceptions
from trove.common.utils import poll_until
@@ -230,12 +229,12 @@ class CreateConfigurations(ConfigurationsTestBase):
msg="Get Configuration parameter")
assert_equal(param_name, config_parameter_dict['name'])
with TypeCheck('ConfigurationParameter', param) as parameter:
- parameter.has_field('name', six.string_types)
+ parameter.has_field('name', str)
parameter.has_field('restart_required', bool)
- parameter.has_field('max', six.integer_types)
- parameter.has_field('min', six.integer_types)
- parameter.has_field('type', six.string_types)
- parameter.has_field('datastore_version_id', six.text_type)
+ parameter.has_field('max', int)
+ parameter.has_field('min', int)
+ parameter.has_field('type', str)
+ parameter.has_field('datastore_version_id', str)
@test
def test_configurations_create_invalid_values(self):
@@ -283,12 +282,12 @@ class CreateConfigurations(ConfigurationsTestBase):
resp, body = instance_info.dbaas.client.last_response
assert_equal(resp.status, 200)
with TypeCheck('Configuration', result) as configuration:
- configuration.has_field('name', six.string_types)
- configuration.has_field('description', six.string_types)
+ configuration.has_field('name', str)
+ configuration.has_field('description', str)
configuration.has_field('values', dict)
- configuration.has_field('datastore_name', six.string_types)
- configuration.has_field('datastore_version_id', six.text_type)
- configuration.has_field('datastore_version_name', six.string_types)
+ configuration.has_field('datastore_name', str)
+ configuration.has_field('datastore_version_id', str)
+ configuration.has_field('datastore_version_name', str)
global configuration_info
configuration_info = result
assert_equal(configuration_info.name, CONFIG_NAME)
@@ -367,12 +366,12 @@ class AfterConfigurationsCreation(ConfigurationsTestBase):
# check the result field types
with TypeCheck("configuration", result) as check:
- check.has_field("id", six.string_types)
- check.has_field("name", six.string_types)
- check.has_field("description", six.string_types)
+ check.has_field("id", str)
+ check.has_field("name", str)
+ check.has_field("description", str)
check.has_field("values", dict)
- check.has_field("created", six.string_types)
- check.has_field("updated", six.string_types)
+ check.has_field("created", str)
+ check.has_field("updated", str)
check.has_field("instance_count", int)
print(result.values)
@@ -402,7 +401,7 @@ class AfterConfigurationsCreation(ConfigurationsTestBase):
if param.type == 'integer':
check.has_element(item_key, int)
if param.type == 'string':
- check.has_element(item_key, six.string_types)
+ check.has_element(item_key, str)
if param.type == 'boolean':
check.has_element(item_key, bool)
@@ -433,12 +432,12 @@ class ListConfigurations(ConfigurationsTestBase):
result = instance_info.dbaas.configurations.list()
for conf in result:
with TypeCheck("Configuration", conf) as check:
- check.has_field('id', six.string_types)
- check.has_field('name', six.string_types)
- check.has_field('description', six.string_types)
- check.has_field('datastore_version_id', six.string_types)
- check.has_field('datastore_version_name', six.string_types)
- check.has_field('datastore_name', six.string_types)
+ check.has_field('id', str)
+ check.has_field('name', str)
+ check.has_field('description', str)
+ check.has_field('datastore_version_id', str)
+ check.has_field('datastore_version_name', str)
+ check.has_field('datastore_name', str)
exists = [config for config in result if
config.id == configuration_info.id]
diff --git a/trove/tests/api/datastores.py b/trove/tests/api/datastores.py
index fa54620b..af8197e5 100644
--- a/trove/tests/api/datastores.py
+++ b/trove/tests/api/datastores.py
@@ -19,7 +19,6 @@ from proboscis.asserts import assert_raises
from proboscis.asserts import assert_true
from proboscis import before_class
from proboscis import test
-import six
from troveclient.compat import exceptions
from trove import tests
@@ -48,8 +47,8 @@ class Datastores(object):
datastores = self.rd_client.datastores.list()
for datastore in datastores:
with TypeCheck('Datastore', datastore) as check:
- check.has_field("id", six.string_types)
- check.has_field("name", six.string_types)
+ check.has_field("id", str)
+ check.has_field("name", str)
check.has_field("links", list)
check.has_field("versions", list)
@@ -59,8 +58,8 @@ class Datastores(object):
datastore_by_name = self.rd_client.datastores.get(
test_config.dbaas_datastore)
with TypeCheck('Datastore', datastore_by_name) as check:
- check.has_field("id", six.string_types)
- check.has_field("name", six.string_types)
+ check.has_field("id", str)
+ check.has_field("name", str)
check.has_field("links", list)
assert_equal(datastore_by_name.name, test_config.dbaas_datastore)
@@ -68,8 +67,8 @@ class Datastores(object):
datastore_by_id = self.rd_client.datastores.get(
datastore_by_name.id)
with TypeCheck('Datastore', datastore_by_id) as check:
- check.has_field("id", six.string_types)
- check.has_field("name", six.string_types)
+ check.has_field("id", str)
+ check.has_field("name", str)
check.has_field("links", list)
check.has_field("versions", list)
assert_equal(datastore_by_id.id, datastore_by_name.id)
@@ -134,8 +133,8 @@ class DatastoreVersions(object):
self.datastore_active.name)
for version in versions:
with TypeCheck('DatastoreVersion', version) as check:
- check.has_field("id", six.string_types)
- check.has_field("name", six.string_types)
+ check.has_field("id", str)
+ check.has_field("name", str)
check.has_field("links", list)
@test
@@ -143,9 +142,9 @@ class DatastoreVersions(object):
version = self.rd_client.datastore_versions.get(
self.datastore_active.name, self.datastore_version_active.name)
with TypeCheck('DatastoreVersion', version) as check:
- check.has_field("id", six.string_types)
- check.has_field("name", six.string_types)
- check.has_field("datastore", six.string_types)
+ check.has_field("id", str)
+ check.has_field("name", str)
+ check.has_field("datastore", str)
check.has_field("links", list)
assert_equal(version.name, self.datastore_version_active.name)
@@ -154,9 +153,9 @@ class DatastoreVersions(object):
version = self.rd_client.datastore_versions.get_by_uuid(
self.datastore_version_active.id)
with TypeCheck('DatastoreVersion', version) as check:
- check.has_field("id", six.string_types)
- check.has_field("name", six.string_types)
- check.has_field("datastore", six.string_types)
+ check.has_field("id", str)
+ check.has_field("name", str)
+ check.has_field("datastore", str)
check.has_field("links", list)
assert_equal(version.name, self.datastore_version_active.name)
@@ -176,8 +175,8 @@ class DatastoreVersions(object):
self.datastore_active.id)
for version in versions:
with TypeCheck('DatastoreVersion', version) as check:
- check.has_field("id", six.string_types)
- check.has_field("name", six.string_types)
+ check.has_field("id", str)
+ check.has_field("name", str)
check.has_field("links", list)
@test
@@ -185,9 +184,9 @@ class DatastoreVersions(object):
version = self.rd_client.datastore_versions.get(
self.datastore_active.id, self.datastore_version_active.id)
with TypeCheck('DatastoreVersion', version) as check:
- check.has_field("id", six.string_types)
- check.has_field("name", six.string_types)
- check.has_field("datastore", six.string_types)
+ check.has_field("id", str)
+ check.has_field("name", str)
+ check.has_field("datastore", str)
check.has_field("links", list)
assert_equal(version.name, self.datastore_version_active.name)
diff --git a/trove/tests/fakes/swift.py b/trove/tests/fakes/swift.py
index 79ee401c..acc1a46b 100644
--- a/trove/tests/fakes/swift.py
+++ b/trove/tests/fakes/swift.py
@@ -24,7 +24,6 @@ import swiftclient.client as swift_client
import uuid
from oslo_log import log as logging
-import six
from swiftclient import client as swift
@@ -172,7 +171,7 @@ class FakeSwiftConnection(object):
# container is where the object segments are in and prefix is the
# common prefix for all segments.
self.manifest_name = name
- if isinstance(contents, six.text_type):
+ if isinstance(contents, str):
object_checksum.update(contents.encode('utf-8'))
else:
object_checksum.update(contents)
diff --git a/trove/tests/scenario/groups/test_group.py b/trove/tests/scenario/groups/test_group.py
index 007c7a18..8b3aa014 100644
--- a/trove/tests/scenario/groups/test_group.py
+++ b/trove/tests/scenario/groups/test_group.py
@@ -14,11 +14,9 @@
# under the License.
import abc
-import six
-@six.add_metaclass(abc.ABCMeta)
-class TestGroup(object):
+class TestGroup(object, metaclass=abc.ABCMeta):
def __init__(self, test_runner):
self._test_runner = test_runner
diff --git a/trove/tests/scenario/runners/cluster_runners.py b/trove/tests/scenario/runners/cluster_runners.py
index e46aa73e..e36f0664 100644
--- a/trove/tests/scenario/runners/cluster_runners.py
+++ b/trove/tests/scenario/runners/cluster_runners.py
@@ -17,7 +17,6 @@ import json
import os
from proboscis import SkipTest
-import six
import time as timer
from trove.common import exception
@@ -517,17 +516,17 @@ class ClusterRunner(TestRunner):
def _assert_cluster_values(self, cluster, expected_task_name,
check_locality=True):
with TypeCheck('Cluster', cluster) as check:
- check.has_field("id", six.string_types)
- check.has_field("name", six.string_types)
+ check.has_field("id", str)
+ check.has_field("name", str)
check.has_field("datastore", dict)
check.has_field("instances", list)
check.has_field("links", list)
- check.has_field("created", six.text_type)
- check.has_field("updated", six.text_type)
+ check.has_field("created", str)
+ check.has_field("updated", str)
if check_locality:
- check.has_field("locality", six.text_type)
+ check.has_field("locality", str)
if self.active_config_group_id:
- check.has_field("configuration", six.text_type)
+ check.has_field("configuration", str)
for instance in cluster.instances:
isinstance(instance, dict)
self.assert_is_not_none(instance['id'])
diff --git a/trove/tests/scenario/runners/configuration_runners.py b/trove/tests/scenario/runners/configuration_runners.py
index f76b47e7..11482a07 100644
--- a/trove/tests/scenario/runners/configuration_runners.py
+++ b/trove/tests/scenario/runners/configuration_runners.py
@@ -16,7 +16,6 @@
from datetime import datetime
import json
from proboscis import SkipTest
-import six
from trove.common.utils import generate_uuid
from trove.tests.scenario.runners.test_runners import TestRunner
@@ -140,12 +139,12 @@ class ConfigurationRunner(TestRunner):
self.assert_client_code(client, expected_http_code)
with TypeCheck('Configuration', result) as configuration:
- configuration.has_field('name', six.string_types)
- configuration.has_field('description', six.string_types)
+ configuration.has_field('name', str)
+ configuration.has_field('description', str)
configuration.has_field('values', dict)
- configuration.has_field('datastore_name', six.string_types)
- configuration.has_field('datastore_version_id', six.text_type)
- configuration.has_field('datastore_version_name', six.string_types)
+ configuration.has_field('datastore_name', str)
+ configuration.has_field('datastore_version_id', str)
+ configuration.has_field('datastore_version_name', str)
self.assert_equal(name, result.name)
self.assert_equal(description, result.description)
@@ -217,12 +216,12 @@ class ConfigurationRunner(TestRunner):
# check the result field types
with TypeCheck("configuration", result) as check:
- check.has_field("id", six.string_types)
- check.has_field("name", six.string_types)
- check.has_field("description", six.string_types)
+ check.has_field("id", str)
+ check.has_field("name", str)
+ check.has_field("description", str)
check.has_field("values", dict)
- check.has_field("created", six.string_types)
- check.has_field("updated", six.string_types)
+ check.has_field("created", str)
+ check.has_field("updated", str)
check.has_field("instance_count", int)
# check for valid timestamps
@@ -244,7 +243,7 @@ class ConfigurationRunner(TestRunner):
if param.type == 'integer':
check.has_element(item_key, int)
if param.type == 'string':
- check.has_element(item_key, six.string_types)
+ check.has_element(item_key, str)
if param.type == 'boolean':
check.has_element(item_key, bool)
diff --git a/trove/tests/scenario/runners/module_runners.py b/trove/tests/scenario/runners/module_runners.py
index 85ae47e7..35fc8326 100644
--- a/trove/tests/scenario/runners/module_runners.py
+++ b/trove/tests/scenario/runners/module_runners.py
@@ -17,7 +17,6 @@
import os
from proboscis import SkipTest
import re
-import six
import tempfile
import time
@@ -1341,7 +1340,7 @@ class ModuleRunner(TestRunner):
contents = fh.read()
expected = expected['contents']
- if isinstance(expected, six.string_types):
+ if isinstance(expected, str):
expected = expected.encode()
self.assert_equal(expected, contents,
diff --git a/trove/tests/scenario/runners/test_runners.py b/trove/tests/scenario/runners/test_runners.py
index 350eeaf1..b3607f8b 100644
--- a/trove/tests/scenario/runners/test_runners.py
+++ b/trove/tests/scenario/runners/test_runners.py
@@ -19,7 +19,6 @@ import json
import netaddr
import os
import proboscis
-import six
import sys
import time as timer
import types
@@ -284,13 +283,12 @@ class LogOnFail(type):
# Only report on the first error that occurs
mcs.reset_inst_ids()
- six.reraise(extype, exvalue, extb)
+ raise exvalue.with_traceback(extb)
return wrapper
-@six.add_metaclass(LogOnFail)
-class TestRunner(object):
+class TestRunner(object, metaclass=LogOnFail):
"""
Base class for all 'Runner' classes.
diff --git a/trove/tests/unittests/api/common/test_limits.py b/trove/tests/unittests/api/common/test_limits.py
index a6aee3fd..ed79639e 100644
--- a/trove/tests/unittests/api/common/test_limits.py
+++ b/trove/tests/unittests/api/common/test_limits.py
@@ -18,10 +18,10 @@ Tests dealing with HTTP rate-limiting.
"""
+import io
from http import client as http_client
from unittest.mock import Mock, MagicMock, patch
from oslo_serialization import jsonutils
-import six
import webob
from trove.common import limits
@@ -564,7 +564,7 @@ class FakeHttplibSocket(object):
def __init__(self, response_string):
"""Initialize new `FakeHttplibSocket`."""
- self._buffer = six.BytesIO(response_string)
+ self._buffer = io.BytesIO(response_string)
def makefile(self, _mode, *args):
"""Returns the socket's internal buffer."""
diff --git a/trove/tests/unittests/common/test_crypto_utils.py b/trove/tests/unittests/common/test_crypto_utils.py
index 2d54092f..28810ce4 100644
--- a/trove/tests/unittests/common/test_crypto_utils.py
+++ b/trove/tests/unittests/common/test_crypto_utils.py
@@ -17,7 +17,6 @@
import os
from unittest import mock
-import six
from trove.common import crypto_utils
from trove.tests.unittests import trove_testtools
@@ -39,7 +38,7 @@ class TestEncryptUtils(trove_testtools.TestCase):
for datum in data:
encoded_data = crypto_utils.encode_data(datum)
decoded_data = crypto_utils.decode_data(encoded_data)
- if isinstance(datum, six.text_type):
+ if isinstance(datum, str):
decoded_data = decoded_data.decode('utf-8')
self. assertEqual(datum, decoded_data,
"Encode/decode failed")
diff --git a/trove/tests/unittests/hacking/test_check.py b/trove/tests/unittests/hacking/test_check.py
index cfd8e68c..d09eabfc 100644
--- a/trove/tests/unittests/hacking/test_check.py
+++ b/trove/tests/unittests/hacking/test_check.py
@@ -76,14 +76,6 @@ class HackingTestCase(trove_testtools.TestCase):
self.assertLinePasses(f, "raise KeyError('Error text')",
'neutron_lib/tests/unit/mytest.py')
- def test_no_basestring(self):
- self.assertEqual(
- 1,
- len(list(tc.check_no_basestring("isinstance(x, basestring)"))))
- self.assertEqual(
- 0,
- len(list(tc.check_no_basestring("this basestring is good)"))))
-
# We are patching pycodestyle so that only the check under test is actually
# installed.
@mock.patch('pycodestyle._checks',
diff --git a/trove/tests/util/check.py b/trove/tests/util/check.py
index ef07b71c..a61323e3 100644
--- a/trove/tests/util/check.py
+++ b/trove/tests/util/check.py
@@ -23,7 +23,6 @@ from proboscis.asserts import assert_not_equal
from proboscis.asserts import assert_true
from proboscis.asserts import ASSERTION_ERROR
from proboscis.asserts import Check
-import six
def get_stack_trace_of_caller(level_up):
@@ -40,7 +39,7 @@ def get_stack_trace_of_caller(level_up):
def raise_blame_caller(level_up, ex):
"""Raises an exception, changing the stack trace to point to the caller."""
new_st = get_stack_trace_of_caller(level_up + 2)
- six.reraise(type(ex), ex, new_st)
+ raise ex.with_traceback(new_st)
class Checker(object):