Drop six support
This update is to drop all of six support to move Closes-bug: #1900389 Change-Id: Ia6c61751203e98d432344dc9a52fe65bdb062af0 Signed-off-by: Yasufumi Ogawa <yasufum.o@gmail.com>
This commit is contained in:
@@ -48,7 +48,6 @@ requests-mock==1.2.0
|
|||||||
requestsexceptions==1.2.0
|
requestsexceptions==1.2.0
|
||||||
rfc3986==0.3.1
|
rfc3986==0.3.1
|
||||||
simplejson==3.5.1
|
simplejson==3.5.1
|
||||||
six==1.10.0
|
|
||||||
stestr==2.0.0
|
stestr==2.0.0
|
||||||
stevedore==1.20.0
|
stevedore==1.20.0
|
||||||
testtools==2.2.0
|
testtools==2.2.0
|
||||||
|
|||||||
@@ -8,7 +8,6 @@ netaddr>=0.7.18 # BSD
|
|||||||
requests>=2.14.2 # Apache-2.0
|
requests>=2.14.2 # Apache-2.0
|
||||||
python-keystoneclient>=3.8.0 # Apache-2.0
|
python-keystoneclient>=3.8.0 # Apache-2.0
|
||||||
simplejson>=3.5.1 # MIT
|
simplejson>=3.5.1 # MIT
|
||||||
six>=1.10.0 # MIT
|
|
||||||
stevedore>=1.20.0 # Apache-2.0
|
stevedore>=1.20.0 # Apache-2.0
|
||||||
Babel!=2.4.0,>=2.3.4 # BSD
|
Babel!=2.4.0,>=2.3.4 # BSD
|
||||||
oslo.i18n>=3.15.3 # Apache-2.0
|
oslo.i18n>=3.15.3 # Apache-2.0
|
||||||
|
|||||||
@@ -28,7 +28,6 @@ ATOM_LINK_NOTATION = "{%s}link" % ATOM_NAMESPACE
|
|||||||
|
|
||||||
TYPE_BOOL = "bool"
|
TYPE_BOOL = "bool"
|
||||||
TYPE_INT = "int"
|
TYPE_INT = "int"
|
||||||
TYPE_LONG = "long"
|
|
||||||
TYPE_FLOAT = "float"
|
TYPE_FLOAT = "float"
|
||||||
TYPE_LIST = "list"
|
TYPE_LIST = "list"
|
||||||
TYPE_DICT = "dict"
|
TYPE_DICT = "dict"
|
||||||
|
|||||||
@@ -18,7 +18,6 @@ from xml.etree import ElementTree as etree
|
|||||||
from xml.parsers import expat
|
from xml.parsers import expat
|
||||||
|
|
||||||
from oslo_serialization import jsonutils
|
from oslo_serialization import jsonutils
|
||||||
import six
|
|
||||||
|
|
||||||
from tackerclient.common import constants
|
from tackerclient.common import constants
|
||||||
from tackerclient.common import exceptions as exception
|
from tackerclient.common import exceptions as exception
|
||||||
@@ -26,9 +25,6 @@ from tackerclient.i18n import _
|
|||||||
|
|
||||||
LOG = logging.getLogger(__name__)
|
LOG = logging.getLogger(__name__)
|
||||||
|
|
||||||
if six.PY3:
|
|
||||||
long = int
|
|
||||||
|
|
||||||
|
|
||||||
class ActionDispatcher(object):
|
class ActionDispatcher(object):
|
||||||
"""Maps method name to local methods through action name."""
|
"""Maps method name to local methods through action name."""
|
||||||
@@ -58,7 +54,7 @@ class JSONDictSerializer(DictSerializer):
|
|||||||
|
|
||||||
def default(self, data):
|
def default(self, data):
|
||||||
def sanitizer(obj):
|
def sanitizer(obj):
|
||||||
return six.text_type(obj)
|
return str(obj)
|
||||||
return jsonutils.dumps(data, default=sanitizer)
|
return jsonutils.dumps(data, default=sanitizer)
|
||||||
|
|
||||||
|
|
||||||
@@ -93,7 +89,7 @@ class XMLDictSerializer(DictSerializer):
|
|||||||
root_key = constants.VIRTUAL_ROOT_KEY
|
root_key = constants.VIRTUAL_ROOT_KEY
|
||||||
root_value = None
|
root_value = None
|
||||||
else:
|
else:
|
||||||
link_keys = [k for k in six.iterkeys(data) or []
|
link_keys = [k for k in data.keys() or []
|
||||||
if k.endswith('_links')]
|
if k.endswith('_links')]
|
||||||
if link_keys:
|
if link_keys:
|
||||||
links = data.pop(link_keys[0], None)
|
links = data.pop(link_keys[0], None)
|
||||||
@@ -183,10 +179,6 @@ class XMLDictSerializer(DictSerializer):
|
|||||||
result.set(
|
result.set(
|
||||||
constants.TYPE_ATTR,
|
constants.TYPE_ATTR,
|
||||||
constants.TYPE_INT)
|
constants.TYPE_INT)
|
||||||
elif isinstance(data, long):
|
|
||||||
result.set(
|
|
||||||
constants.TYPE_ATTR,
|
|
||||||
constants.TYPE_LONG)
|
|
||||||
elif isinstance(data, float):
|
elif isinstance(data, float):
|
||||||
result.set(
|
result.set(
|
||||||
constants.TYPE_ATTR,
|
constants.TYPE_ATTR,
|
||||||
@@ -194,7 +186,7 @@ class XMLDictSerializer(DictSerializer):
|
|||||||
LOG.debug("Data %(data)s type is %(type)s",
|
LOG.debug("Data %(data)s type is %(type)s",
|
||||||
{'data': data,
|
{'data': data,
|
||||||
'type': type(data)})
|
'type': type(data)})
|
||||||
result.text = six.text_type(data)
|
result.text = str(data)
|
||||||
return result
|
return result
|
||||||
|
|
||||||
def _create_link_nodes(self, xml_doc, links):
|
def _create_link_nodes(self, xml_doc, links):
|
||||||
@@ -323,8 +315,6 @@ class XMLDeserializer(TextDeserializer):
|
|||||||
lambda x: x.lower() == 'true',
|
lambda x: x.lower() == 'true',
|
||||||
constants.TYPE_INT:
|
constants.TYPE_INT:
|
||||||
lambda x: int(x),
|
lambda x: int(x),
|
||||||
constants.TYPE_LONG:
|
|
||||||
lambda x: long(x),
|
|
||||||
constants.TYPE_FLOAT:
|
constants.TYPE_FLOAT:
|
||||||
lambda x: float(x)}
|
lambda x: float(x)}
|
||||||
if attrType and attrType in converters:
|
if attrType and attrType in converters:
|
||||||
|
|||||||
@@ -24,7 +24,6 @@ import os
|
|||||||
from oslo_log import versionutils
|
from oslo_log import versionutils
|
||||||
from oslo_utils import encodeutils
|
from oslo_utils import encodeutils
|
||||||
from oslo_utils import importutils
|
from oslo_utils import importutils
|
||||||
import six
|
|
||||||
|
|
||||||
from tackerclient.common import exceptions
|
from tackerclient.common import exceptions
|
||||||
from tackerclient.i18n import _
|
from tackerclient.i18n import _
|
||||||
@@ -141,7 +140,7 @@ def http_log_resp(_logger, resp, body):
|
|||||||
|
|
||||||
|
|
||||||
def _safe_encode_without_obj(data):
|
def _safe_encode_without_obj(data):
|
||||||
if isinstance(data, six.string_types):
|
if isinstance(data, str):
|
||||||
return encodeutils.safe_encode(data)
|
return encodeutils.safe_encode(data)
|
||||||
return data
|
return data
|
||||||
|
|
||||||
|
|||||||
@@ -25,6 +25,10 @@ import itertools
|
|||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
from urllib import parse as urlparse
|
||||||
|
|
||||||
|
from cliff import app
|
||||||
|
from cliff import commandmanager
|
||||||
|
|
||||||
from keystoneclient.auth.identity import v2 as v2_auth
|
from keystoneclient.auth.identity import v2 as v2_auth
|
||||||
from keystoneclient.auth.identity import v3 as v3_auth
|
from keystoneclient.auth.identity import v3 as v3_auth
|
||||||
@@ -33,11 +37,6 @@ from keystoneclient import exceptions as ks_exc
|
|||||||
from keystoneclient import session
|
from keystoneclient import session
|
||||||
from oslo_utils import encodeutils
|
from oslo_utils import encodeutils
|
||||||
|
|
||||||
from urllib import parse as urlparse
|
|
||||||
|
|
||||||
from cliff import app
|
|
||||||
from cliff import commandmanager
|
|
||||||
|
|
||||||
from tackerclient.common import clientmanager
|
from tackerclient.common import clientmanager
|
||||||
from tackerclient.common import command as openstack_command
|
from tackerclient.common import command as openstack_command
|
||||||
from tackerclient.common import exceptions as exc
|
from tackerclient.common import exceptions as exc
|
||||||
|
|||||||
@@ -23,7 +23,6 @@ from cliff.formatters import table
|
|||||||
from cliff import lister
|
from cliff import lister
|
||||||
from cliff import show
|
from cliff import show
|
||||||
from oslo_serialization import jsonutils
|
from oslo_serialization import jsonutils
|
||||||
import six
|
|
||||||
|
|
||||||
from tackerclient.common._i18n import _
|
from tackerclient.common._i18n import _
|
||||||
from tackerclient.common import command
|
from tackerclient.common import command
|
||||||
@@ -354,8 +353,7 @@ class TackerCommandMeta(abc.ABCMeta):
|
|||||||
name, bases, cls_dict)
|
name, bases, cls_dict)
|
||||||
|
|
||||||
|
|
||||||
@six.add_metaclass(TackerCommandMeta)
|
class TackerCommand(command.OpenStackCommand, metaclass=TackerCommandMeta):
|
||||||
class TackerCommand(command.OpenStackCommand):
|
|
||||||
|
|
||||||
api = 'nfv-orchestration'
|
api = 'nfv-orchestration'
|
||||||
values_specs = []
|
values_specs = []
|
||||||
|
|||||||
@@ -13,6 +13,7 @@
|
|||||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
from urllib import parse as urlparse
|
from urllib import parse as urlparse
|
||||||
|
|
||||||
from tackerclient.common import exceptions
|
from tackerclient.common import exceptions
|
||||||
|
|||||||
@@ -20,7 +20,6 @@ from unittest import mock
|
|||||||
|
|
||||||
import ddt
|
import ddt
|
||||||
from oslo_utils.fixture import uuidsentinel
|
from oslo_utils.fixture import uuidsentinel
|
||||||
import six
|
|
||||||
|
|
||||||
from tackerclient.common import exceptions
|
from tackerclient.common import exceptions
|
||||||
from tackerclient.osc import utils as tacker_osc_utils
|
from tackerclient.osc import utils as tacker_osc_utils
|
||||||
@@ -448,7 +447,7 @@ class TestTerminateVnfLcm(TestVnfLcm):
|
|||||||
"delete vnf instance %(id)s"
|
"delete vnf instance %(id)s"
|
||||||
% {'timeout': 15, 'id': vnf_instance['id']})
|
% {'timeout': 15, 'id': vnf_instance['id']})
|
||||||
|
|
||||||
self.assertIn(expected_message, six.text_type(result))
|
self.assertIn(expected_message, str(result))
|
||||||
self.assertNotCalled(mock_delete)
|
self.assertNotCalled(mock_delete)
|
||||||
|
|
||||||
def test_terminate_no_options(self):
|
def test_terminate_no_options(self):
|
||||||
|
|||||||
@@ -14,15 +14,13 @@
|
|||||||
# under the License.
|
# under the License.
|
||||||
#
|
#
|
||||||
|
|
||||||
from unittest import mock
|
|
||||||
import urllib
|
|
||||||
|
|
||||||
import contextlib
|
import contextlib
|
||||||
import fixtures
|
import fixtures
|
||||||
import six
|
import io
|
||||||
import sys
|
import sys
|
||||||
import testtools
|
import testtools
|
||||||
|
from unittest import mock
|
||||||
|
import urllib
|
||||||
from urllib import parse as urlparse
|
from urllib import parse as urlparse
|
||||||
|
|
||||||
from tackerclient.common import constants
|
from tackerclient.common import constants
|
||||||
@@ -41,7 +39,7 @@ ENDURL = 'localurl'
|
|||||||
|
|
||||||
@contextlib.contextmanager
|
@contextlib.contextmanager
|
||||||
def capture_std_streams():
|
def capture_std_streams():
|
||||||
fake_stdout, fake_stderr = six.StringIO(), six.StringIO()
|
fake_stdout, fake_stderr = io.StringIO(), io.StringIO()
|
||||||
stdout, stderr = sys.stdout, sys.stderr
|
stdout, stderr = sys.stdout, sys.stderr
|
||||||
try:
|
try:
|
||||||
sys.stdout, sys.stderr = fake_stdout, fake_stderr
|
sys.stdout, sys.stderr = fake_stdout, fake_stderr
|
||||||
@@ -318,7 +316,7 @@ class CLITestV10Base(testtools.TestCase):
|
|||||||
args.append("--tag")
|
args.append("--tag")
|
||||||
for tag in tags:
|
for tag in tags:
|
||||||
args.append(tag)
|
args.append(tag)
|
||||||
if isinstance(tag, six.string_types):
|
if isinstance(tag, str):
|
||||||
tag = urllib.quote(tag.encode('utf-8'))
|
tag = urllib.quote(tag.encode('utf-8'))
|
||||||
if query:
|
if query:
|
||||||
query += "&tag=" + tag
|
query += "&tag=" + tag
|
||||||
@@ -415,7 +413,7 @@ class CLITestV10Base(testtools.TestCase):
|
|||||||
args.append("--tag")
|
args.append("--tag")
|
||||||
for tag in tags:
|
for tag in tags:
|
||||||
args.append(tag)
|
args.append(tag)
|
||||||
if isinstance(tag, six.string_types):
|
if isinstance(tag, str):
|
||||||
tag = urllib.quote(tag.encode('utf-8'))
|
tag = urllib.quote(tag.encode('utf-8'))
|
||||||
if query:
|
if query:
|
||||||
query += "&tag=" + tag
|
query += "&tag=" + tag
|
||||||
|
|||||||
@@ -14,18 +14,17 @@
|
|||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
import argparse
|
import argparse
|
||||||
|
import fixtures
|
||||||
|
import io
|
||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
from unittest import mock
|
|
||||||
|
|
||||||
import six
|
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
import fixtures
|
|
||||||
from keystoneclient import session
|
|
||||||
import testtools
|
import testtools
|
||||||
from testtools import matchers
|
from testtools import matchers
|
||||||
|
from unittest import mock
|
||||||
|
|
||||||
|
from keystoneclient import session
|
||||||
|
|
||||||
from tackerclient.common import clientmanager
|
from tackerclient.common import clientmanager
|
||||||
from tackerclient import shell as openstack_shell
|
from tackerclient import shell as openstack_shell
|
||||||
@@ -63,8 +62,8 @@ class ShellTest(testtools.TestCase):
|
|||||||
clean_env = {}
|
clean_env = {}
|
||||||
_old_env, os.environ = os.environ, clean_env.copy()
|
_old_env, os.environ = os.environ, clean_env.copy()
|
||||||
try:
|
try:
|
||||||
sys.stdout = six.StringIO()
|
sys.stdout = io.StringIO()
|
||||||
sys.stderr = six.StringIO()
|
sys.stderr = io.StringIO()
|
||||||
_shell = openstack_shell.TackerShell(DEFAULT_API_VERSION)
|
_shell = openstack_shell.TackerShell(DEFAULT_API_VERSION)
|
||||||
_shell.run(argstr.split())
|
_shell.run(argstr.split())
|
||||||
except SystemExit:
|
except SystemExit:
|
||||||
|
|||||||
@@ -19,7 +19,6 @@ import logging
|
|||||||
import time
|
import time
|
||||||
|
|
||||||
import requests
|
import requests
|
||||||
|
|
||||||
from urllib import parse as urlparse
|
from urllib import parse as urlparse
|
||||||
|
|
||||||
from tackerclient import client
|
from tackerclient import client
|
||||||
|
|||||||
Reference in New Issue
Block a user