Remove Python 2 support
Python 2 has been deprecated. This patch removes all traces of six, unicode strings and Python 2 tweaks. Change-Id: Id3736eeaf7cc270123d27efb61c2217c1828b4ddchanges/31/853031/1 8.0.0
parent
3708548d0b
commit
ddbce89c8b
|
@ -36,7 +36,7 @@ source_suffix = '.rst'
|
|||
master_doc = 'index'
|
||||
|
||||
# General information about the project.
|
||||
copyright = u'2015, Sahara team'
|
||||
copyright = '2015, Sahara team'
|
||||
|
||||
# The language for content autogenerated by Sphinx. Refer to documentation
|
||||
# for a list of supported languages.
|
||||
|
@ -155,8 +155,8 @@ htmlhelp_basename = 'saharamaprplugin-testsdoc'
|
|||
# Grouping the document tree into LaTeX files. List of tuples
|
||||
# (source start file, target name, title, author, documentclass [howto/manual]).
|
||||
latex_documents = [
|
||||
('index', 'doc-sahara-plugin-mapr.tex', u'Sahara MapR Plugin Documentation',
|
||||
u'Sahara team', 'manual'),
|
||||
('index', 'doc-sahara-plugin-mapr.tex', 'Sahara MapR Plugin Documentation',
|
||||
'Sahara team', 'manual'),
|
||||
]
|
||||
|
||||
# The name of an image file (relative to this directory) to place at the top of
|
||||
|
@ -186,8 +186,8 @@ smartquotes_excludes = {'builders': ['latex']}
|
|||
# One entry per manual page. List of tuples
|
||||
# (source start file, name, description, authors, manual section).
|
||||
man_pages = [
|
||||
('index', 'sahara-plugin-mapr', u'sahara-plugin-mapr Documentation',
|
||||
[u'Sahara team'], 1)
|
||||
('index', 'sahara-plugin-mapr', 'sahara-plugin-mapr Documentation',
|
||||
['Sahara team'], 1)
|
||||
]
|
||||
|
||||
# If true, show URL addresses after external links.
|
||||
|
@ -200,8 +200,8 @@ man_pages = [
|
|||
# (source start file, target name, title, author,
|
||||
# dir menu entry, description, category)
|
||||
texinfo_documents = [
|
||||
('index', 'sahara-plugin-mapr', u'sahara-plugin-mapr Documentation',
|
||||
u'Sahara team', 'sahara-plugin-mapr', 'One line description of project.',
|
||||
('index', 'sahara-plugin-mapr', 'sahara-plugin-mapr Documentation',
|
||||
'Sahara team', 'sahara-plugin-mapr', 'One line description of project.',
|
||||
'Miscellaneous'),
|
||||
]
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ source_suffix = '.rst'
|
|||
master_doc = 'index'
|
||||
|
||||
# General information about the project.
|
||||
copyright = u'2015, Sahara Developers'
|
||||
copyright = '2015, Sahara Developers'
|
||||
|
||||
# Release do not need a version number in the title, they
|
||||
# cover multiple versions.
|
||||
|
@ -142,8 +142,8 @@ htmlhelp_basename = 'SaharaMapRReleaseNotesdoc'
|
|||
# author, documentclass [howto, manual, or own class]).
|
||||
latex_documents = [
|
||||
('index', 'SaharaMapRReleaseNotes.tex',
|
||||
u'Sahara MapR Plugin Release Notes Documentation',
|
||||
u'Sahara Developers', 'manual'),
|
||||
'Sahara MapR Plugin Release Notes Documentation',
|
||||
'Sahara Developers', 'manual'),
|
||||
]
|
||||
|
||||
# The name of an image file (relative to this directory) to place at the top of
|
||||
|
@ -173,8 +173,8 @@ latex_documents = [
|
|||
# (source start file, name, description, authors, manual section).
|
||||
man_pages = [
|
||||
('index', 'saharamaprreleasenotes',
|
||||
u'Sahara MapR Plugin Release Notes Documentation',
|
||||
[u'Sahara Developers'], 1)
|
||||
'Sahara MapR Plugin Release Notes Documentation',
|
||||
['Sahara Developers'], 1)
|
||||
]
|
||||
|
||||
# If true, show URL addresses after external links.
|
||||
|
@ -188,8 +188,8 @@ man_pages = [
|
|||
# dir menu entry, description, category)
|
||||
texinfo_documents = [
|
||||
('index', 'SaharaMapRReleaseNotes',
|
||||
u'Sahara MapR Plugin Release Notes Documentation',
|
||||
u'Sahara Developers', 'SaharaMapRReleaseNotes',
|
||||
'Sahara MapR Plugin Release Notes Documentation',
|
||||
'Sahara Developers', 'SaharaMapRReleaseNotes',
|
||||
'One line description of project.',
|
||||
'Miscellaneous'),
|
||||
]
|
||||
|
|
|
@ -16,4 +16,3 @@ oslo.serialization!=2.19.1,>=2.18.0 # Apache-2.0
|
|||
oslo.utils>=3.33.0 # Apache-2.0
|
||||
requests>=2.14.2 # Apache-2.0
|
||||
sahara>=10.0.0.0b1
|
||||
six>=1.10.0 # MIT
|
||||
|
|
|
@ -15,11 +15,8 @@
|
|||
|
||||
import abc
|
||||
|
||||
import six
|
||||
|
||||
|
||||
@six.add_metaclass(abc.ABCMeta)
|
||||
class AbstractClusterContext(object):
|
||||
class AbstractClusterContext(object, metaclass=abc.ABCMeta):
|
||||
@abc.abstractproperty
|
||||
def mapr_home(self):
|
||||
return
|
||||
|
|
|
@ -15,11 +15,8 @@
|
|||
|
||||
import abc
|
||||
|
||||
import six
|
||||
|
||||
|
||||
@six.add_metaclass(abc.ABCMeta)
|
||||
class AbstractValidator(object):
|
||||
class AbstractValidator(object, metaclass=abc.ABCMeta):
|
||||
@abc.abstractmethod
|
||||
def validate(self, cluster_context):
|
||||
pass
|
||||
|
|
|
@ -15,11 +15,8 @@
|
|||
|
||||
import abc
|
||||
|
||||
import six
|
||||
|
||||
|
||||
@six.add_metaclass(abc.ABCMeta)
|
||||
class AbstractConfigurer(object):
|
||||
class AbstractConfigurer(object, metaclass=abc.ABCMeta):
|
||||
@abc.abstractmethod
|
||||
def configure(self, cluster_context, instances=None):
|
||||
pass
|
||||
|
|
|
@ -14,11 +14,8 @@
|
|||
|
||||
import abc
|
||||
|
||||
import six
|
||||
|
||||
|
||||
@six.add_metaclass(abc.ABCMeta)
|
||||
class AbstractHealthChecker(object):
|
||||
class AbstractHealthChecker(object, metaclass=abc.ABCMeta):
|
||||
@abc.abstractmethod
|
||||
def get_checks(self, cluster_context, instances=None):
|
||||
pass
|
||||
|
|
|
@ -15,11 +15,8 @@
|
|||
|
||||
import abc
|
||||
|
||||
import six
|
||||
|
||||
|
||||
@six.add_metaclass(abc.ABCMeta)
|
||||
class AbstractNodeManager(object):
|
||||
class AbstractNodeManager(object, metaclass=abc.ABCMeta):
|
||||
@abc.abstractmethod
|
||||
def start(self, cluster_context, instances=None):
|
||||
pass
|
||||
|
|
|
@ -15,11 +15,8 @@
|
|||
|
||||
import abc
|
||||
|
||||
import six
|
||||
|
||||
|
||||
@six.add_metaclass(abc.ABCMeta)
|
||||
class AbstractVersionHandler(object):
|
||||
class AbstractVersionHandler(object, metaclass=abc.ABCMeta):
|
||||
@abc.abstractmethod
|
||||
def get_node_processes(self):
|
||||
return
|
||||
|
|
|
@ -16,7 +16,6 @@
|
|||
import abc
|
||||
|
||||
from oslo_log import log as logging
|
||||
import six
|
||||
|
||||
from sahara.plugins import conductor
|
||||
from sahara.plugins import context
|
||||
|
@ -57,8 +56,7 @@ SERVICE_INSTALL_PRIORITY = [
|
|||
]
|
||||
|
||||
|
||||
@six.add_metaclass(abc.ABCMeta)
|
||||
class BaseConfigurer(ac.AbstractConfigurer):
|
||||
class BaseConfigurer(ac.AbstractConfigurer, metaclass=abc.ABCMeta):
|
||||
def configure(self, cluster_context, instances=None):
|
||||
instances = instances or cluster_context.get_instances()
|
||||
self._configure_ssh_connection(cluster_context, instances)
|
||||
|
@ -168,7 +166,7 @@ class BaseConfigurer(ac.AbstractConfigurer):
|
|||
LOG.debug("Configuring cluster topology")
|
||||
|
||||
topology_map = cluster_context.topology_map
|
||||
topology_map = ("%s %s" % item for item in six.iteritems(topology_map))
|
||||
topology_map = ("%s %s" % item for item in topology_map.items())
|
||||
topology_map = "\n".join(topology_map) + "\n"
|
||||
|
||||
data_path = "%s/topology.data" % cluster_context.mapr_home
|
||||
|
@ -390,7 +388,7 @@ class BaseConfigurer(ac.AbstractConfigurer):
|
|||
|
||||
def _restart_services(self, cluster_context):
|
||||
restart = cluster_context.should_be_restarted
|
||||
for service, instances in six.iteritems(restart):
|
||||
for service, instances in restart.items():
|
||||
service.restart(util.unique_list(instances))
|
||||
|
||||
def _post_configure_sh(self, cluster_context, instances):
|
||||
|
|
|
@ -18,15 +18,13 @@ import os
|
|||
import re
|
||||
|
||||
import jinja2 as j2
|
||||
import six
|
||||
|
||||
import sahara.plugins.exceptions as e
|
||||
import sahara.plugins.utils as utils
|
||||
from sahara_plugin_mapr.i18n import _
|
||||
|
||||
|
||||
@six.add_metaclass(abc.ABCMeta)
|
||||
class FileAttr(object):
|
||||
class FileAttr(object, metaclass=abc.ABCMeta):
|
||||
def __init__(self, path, data, mode, owner):
|
||||
self.path = path
|
||||
self.data = data
|
||||
|
@ -34,8 +32,7 @@ class FileAttr(object):
|
|||
self.owner = owner
|
||||
|
||||
|
||||
@six.add_metaclass(abc.ABCMeta)
|
||||
class BaseConfigurationFile(object):
|
||||
class BaseConfigurationFile(object, metaclass=abc.ABCMeta):
|
||||
def __init__(self, file_name):
|
||||
self.f_name = file_name
|
||||
self._config_dict = dict()
|
||||
|
@ -66,14 +63,14 @@ class BaseConfigurationFile(object):
|
|||
self.parse(content)
|
||||
|
||||
def load_properties(self, config_dict):
|
||||
for k, v in six.iteritems(config_dict):
|
||||
for k, v in config_dict.items():
|
||||
self.add_property(k, v)
|
||||
|
||||
def add_property(self, name, value):
|
||||
self._config_dict[name] = value
|
||||
|
||||
def add_properties(self, properties):
|
||||
for prop in six.iteritems(properties):
|
||||
for prop in properties.items():
|
||||
self.add_property(*prop)
|
||||
|
||||
def _get_config_value(self, name):
|
||||
|
@ -127,7 +124,7 @@ class PropertiesFile(BaseConfigurationFile):
|
|||
|
||||
def render(self):
|
||||
lines = ['%s%s%s' % (k, self.separator, v) for k, v in
|
||||
six.iteritems(self._config_dict)]
|
||||
self._config_dict.items()]
|
||||
return "\n".join(lines) + '\n'
|
||||
|
||||
|
||||
|
@ -176,7 +173,7 @@ class EnvironmentConfig(BaseConfigurationFile):
|
|||
string = string.decode("utf-8")
|
||||
except AttributeError:
|
||||
pass
|
||||
string = six.text_type(string).strip()
|
||||
string = str(string).strip()
|
||||
string = string.replace("\"", "")
|
||||
return string
|
||||
|
||||
|
@ -191,5 +188,5 @@ class EnvironmentConfig(BaseConfigurationFile):
|
|||
del self._config_dict[name]
|
||||
else:
|
||||
result.append(line)
|
||||
extra_ops = [self._tmpl % i for i in six.iteritems(self._config_dict)]
|
||||
extra_ops = [self._tmpl % i for i in self._config_dict.items()]
|
||||
return '\n'.join(result + extra_ops) + '\n'
|
||||
|
|
|
@ -15,7 +15,6 @@
|
|||
|
||||
from oslo_log import log as logging
|
||||
from oslo_serialization import jsonutils as json
|
||||
import six
|
||||
|
||||
import sahara.plugins.exceptions as ex
|
||||
import sahara.plugins.provisioning as p
|
||||
|
@ -33,8 +32,7 @@ SERVICE_UI = 'Web UI'
|
|||
_INSTALL_PACKAGES_TIMEOUT = 3600
|
||||
|
||||
|
||||
@six.add_metaclass(g.Singleton)
|
||||
class Service(object):
|
||||
class Service(object, metaclass=g.Singleton):
|
||||
def __init__(self):
|
||||
self._name = None
|
||||
self._ui_name = None
|
||||
|
|
|
@ -16,7 +16,6 @@
|
|||
import collections as c
|
||||
|
||||
from oslo_log import log as logging
|
||||
import six
|
||||
|
||||
import sahara.plugins.utils as u
|
||||
import sahara_plugin_mapr.plugins.mapr.domain.configuration_file as cf
|
||||
|
@ -186,7 +185,7 @@ class MySQL(s.Service):
|
|||
script.parse(u.get_file_text(
|
||||
'plugins/mapr/services/mysql/resources/%s' % template,
|
||||
'sahara_plugin_mapr'))
|
||||
for k, v in six.iteritems(kwargs):
|
||||
for k, v in kwargs.items():
|
||||
script.add_property(k, v)
|
||||
return script
|
||||
|
||||
|
|
|
@ -13,8 +13,6 @@
|
|||
# under the License.
|
||||
|
||||
|
||||
import six
|
||||
|
||||
from sahara_plugin_mapr.i18n import _
|
||||
|
||||
|
||||
|
@ -24,7 +22,7 @@ def get_node_process_name(node_process):
|
|||
|
||||
if isinstance(node_process, np.NodeProcess):
|
||||
return node_process.ui_name
|
||||
if isinstance(node_process, six.string_types):
|
||||
if isinstance(node_process, str):
|
||||
return node_process
|
||||
|
||||
raise TypeError(_("Invalid argument type %s") % type(node_process))
|
||||
|
|
|
@ -12,8 +12,6 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import six
|
||||
|
||||
from sahara.plugins import provisioning as p
|
||||
from sahara.plugins import testutils as tu
|
||||
import sahara_plugin_mapr.plugins.mapr.abstract.cluster_context as a_context
|
||||
|
@ -78,8 +76,8 @@ class TestHandler(b.SaharaTestCase):
|
|||
np_dict = self.handler.get_node_processes()
|
||||
self.assertIsNotNone(np_dict)
|
||||
self.assertIsInstance(np_dict, dict)
|
||||
for k, v in six.iteritems(np_dict):
|
||||
self.assertIsInstance(k, six.string_types)
|
||||
for k, v in np_dict.items():
|
||||
self.assertIsInstance(k, str)
|
||||
self.assertIsInstance(v, list)
|
||||
self.assertNotEqual(0, len(v))
|
||||
|
||||
|
@ -100,8 +98,8 @@ class TestHandler(b.SaharaTestCase):
|
|||
def test_get_configs_dict(self):
|
||||
configs_dict = self.handler.get_configs_dict()
|
||||
self.assertIsInstance(configs_dict, dict)
|
||||
for k, v in six.iteritems(configs_dict):
|
||||
self.assertIsInstance(k, six.string_types)
|
||||
for k, v in configs_dict.items():
|
||||
self.assertIsInstance(k, str)
|
||||
self.assertIsInstance(v, dict)
|
||||
|
||||
def test_get_open_ports(self):
|
||||
|
|
Loading…
Reference in New Issue