Remove Python 2 support

Python 2 has been deprecated. This patch removes all
traces of six, unicode strings and Python 2 tweaks.

Change-Id: Ia51ce13bcf1fa92f9c4d0617eb0ff434f2e15226
This commit is contained in:
anguoming 2022-08-13 14:05:05 +08:00
parent c68cb5e9da
commit e6c3ef90db
6 changed files with 21 additions and 27 deletions

View File

@ -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.
@ -154,8 +154,8 @@ htmlhelp_basename = 'saharasparkplugin-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-spark.tex', u'Sahara Spark Plugin Documentation',
u'Sahara team', 'manual'),
('index', 'doc-sahara-plugin-spark.tex', 'Sahara Spark Plugin Documentation',
'Sahara team', 'manual'),
]
# The name of an image file (relative to this directory) to place at the top of
@ -185,8 +185,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-spark', u'sahara-plugin-spark Documentation',
[u'Sahara team'], 1)
('index', 'sahara-plugin-spark', 'sahara-plugin-spark Documentation',
['Sahara team'], 1)
]
# If true, show URL addresses after external links.
@ -199,8 +199,8 @@ man_pages = [
# (source start file, target name, title, author,
# dir menu entry, description, category)
texinfo_documents = [
('index', 'sahara-plugin-spark', u'sahara-plugin-spark Documentation',
u'Sahara team', 'sahara-plugin-spark', 'One line description of project.',
('index', 'sahara-plugin-spark', 'sahara-plugin-spark Documentation',
'Sahara team', 'sahara-plugin-spark', 'One line description of project.',
'Miscellaneous'),
]

View File

@ -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 = 'SaharaSparkReleaseNotesdoc'
# author, documentclass [howto, manual, or own class]).
latex_documents = [
('index', 'SaharaSparkReleaseNotes.tex',
u'Sahara Spark Plugin Release Notes Documentation',
u'Sahara Developers', 'manual'),
'Sahara Spark 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', 'saharasparkreleasenotes',
u'Sahara Spark Plugin Release Notes Documentation',
[u'Sahara Developers'], 1)
'Sahara Spark 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', 'SaharaSparkReleaseNotes',
u'Sahara Spark Plugin Release Notes Documentation',
u'Sahara Developers', 'SaharaSparkReleaseNotes',
'Sahara Spark Plugin Release Notes Documentation',
'Sahara Developers', 'SaharaSparkReleaseNotes',
'One line description of project.',
'Miscellaneous'),
]

View File

@ -12,4 +12,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

View File

@ -15,7 +15,6 @@
from oslo_config import cfg
from oslo_log import log as logging
import six
from sahara.plugins import provisioning as p
from sahara.plugins import swift_helper as swift
@ -184,7 +183,7 @@ PRIORITY_1_CONFS += CLUSTER_WIDE_CONFS
def _initialise_configs():
configs = []
for service, config_lists in six.iteritems(XML_CONFS):
for service, config_lists in XML_CONFS.items():
for config_list in config_lists:
for config in config_list:
if config['name'] not in HIDDEN_CONFS:
@ -204,13 +203,13 @@ def _initialise_configs():
cfg.priority = 1
configs.append(cfg)
for service, config_items in six.iteritems(ENV_CONFS):
for name, param_format_str in six.iteritems(config_items):
for service, config_items in ENV_CONFS.items():
for name, param_format_str in config_items.items():
configs.append(p.Config(name, service, "node",
default_value=1024, priority=1,
config_type="int"))
for service, config_items in six.iteritems(SPARK_CONFS):
for service, config_items in SPARK_CONFS.items():
for item in config_items['OPTIONS']:
cfg = p.Config(name=item["name"],
description=item["description"],
@ -279,7 +278,7 @@ def generate_xml_configs(configs, storage_path, nn_hostname, hadoop_port):
if is_swift_enabled(configs):
swft_def = SWIFT_DEFAULTS
swift_configs = extract_name_values(swift.get_swift_configs())
for key, value in six.iteritems(swift_configs):
for key, value in swift_configs.items():
if key not in cfg:
cfg[key] = value

View File

@ -16,8 +16,6 @@
import os
import six
from sahara.plugins import edp
from sahara.plugins import exceptions as ex
from sahara.plugins import utils as plugin_utils
@ -37,7 +35,7 @@ class EdpEngine(edp.PluginsSparkJobEngine):
get_config_value_or_default("Spark", "Spark home", self.cluster),
"bin/spark-submit")
self.plugin_params["deploy-mode"] = "client"
port_str = six.text_type(
port_str = str(
plugin_utils.get_config_value_or_default(
"Spark", "Master port", self.cluster))
self.plugin_params["master"] = ('spark://%(host)s:' + port_str)

View File

@ -15,8 +15,6 @@
import os
import six
from sahara.plugins import context
from sahara.plugins import utils
from sahara_plugin_spark.i18n import _
@ -94,7 +92,7 @@ def parse_dfs_report(cmd_output):
res = []
datanode_info = {}
for i in six.moves.xrange(0, len(array)):
for i in range(0, len(array)):
if array[i]:
idx = str.find(array[i], ':')
name = array[i][0:idx]