Remove the six library

This commit removes the six library from the repo, as
the only supported Python version is 3.9.

Test Plan:
PASS: Success on tox command.

Story: 2011149
Task: 50395

Change-Id: I44942ba91791c3ea541c7642107b48e8b2b2d457
Signed-off-by: Hugo Brito <hugo.brito@windriver.com>
This commit is contained in:
Hugo Brito 2024-06-20 14:00:15 -03:00
parent b5cbd9480c
commit 5774a62cb4
9 changed files with 36 additions and 23 deletions

22
.git-blame-ignore-revs Normal file
View File

@ -0,0 +1,22 @@
# git hyper-blame master ignore list.
#
# This file contains a list of git hashes of revisions to be ignored by git
# hyper-blame. These revisions are considered "unimportant" in that they are
# unlikely to be what you are interested in when blaming.
#
# Instructions:
# - Only large (generally automated) reformatting or renaming commits should be
# added to this list. Do not put things here just because you feel they are
# trivial or unimportant. If in doubt, do not put it on this list.
# - Precede each revision with a comment containing the first line of its log.
# For bulk work over many commits, place all commits in a block with a single
# comment at the top describing the work done in those commits.
# - Only put full 40-character hashes on this list (not short hashes or any
# other revision reference).
# - Append to the bottom of the file (revisions should be in chronological order
# from oldest to newest).
# - Because you must use a hash, you need to append to this list in a follow-up
# commit to the actual reformatting commit that you are trying to ignore.
# Format all Python files with Black formatter
b5cbd9480cef12fee05ae6cf68aaae5aaa931969

View File

@ -92,7 +92,7 @@ ignore-mixin-members=yes
# List of module names for which member attributes should not be checked
# (useful for modules/projects where namespaces are manipulated during runtime
# and thus existing member attributes cannot be deduced by static analysis
ignored-modules=distutils,eventlet.green.subprocess,six,six.moves
ignored-modules=distutils,eventlet.green.subprocess
# List of classes names for which member attributes should not be checked
# (useful for classes with attributes dynamically set).
@ -224,4 +224,4 @@ valid-classmethod-first-arg=cls
[EXCEPTIONS]
# Exceptions that will emit a warning when being caught. Defaults to
# "Exception"
overgeneral-exceptions=Exception
overgeneral-exceptions=builtins.Exception

View File

@ -14,8 +14,6 @@
# limitations under the License.
#
import six
from dcmanagerclient.api.v1 import client as client_v1
@ -39,7 +37,7 @@ def client(
session=None,
**kwargs
):
if dcmanager_url and not isinstance(dcmanager_url, six.string_types):
if dcmanager_url and not isinstance(dcmanager_url, str):
raise RuntimeError("DC Manager url should be a string.")
return client_v1.Client(

View File

@ -18,7 +18,6 @@
import keystoneauth1.identity.generic as auth_plugin
import osprofiler.profiler
import six
from keystoneauth1 import session as ks_session
from dcmanagerclient.api import httpclient
@ -74,7 +73,7 @@ class Client:
**kwargs,
):
"""DC Manager communicates with Keystone to fetch necessary values."""
if dcmanager_url and not isinstance(dcmanager_url, six.string_types):
if dcmanager_url and not isinstance(dcmanager_url, str):
raise RuntimeError("DC Manager url should be a string.")
if auth_url or session:

View File

@ -18,12 +18,10 @@
import abc
import six
from osc_lib.command import command
@six.add_metaclass(abc.ABCMeta)
class DCManagerLister(command.Lister):
class DCManagerLister(command.Lister, metaclass=abc.ABCMeta):
@abc.abstractmethod
def _get_format_function(self):
raise NotImplementedError
@ -52,8 +50,7 @@ class DCManagerLister(command.Lister):
return f()
@six.add_metaclass(abc.ABCMeta)
class DCManagerShowOne(command.ShowOne):
class DCManagerShowOne(command.ShowOne, metaclass=abc.ABCMeta):
@abc.abstractmethod
def _get_format_function(self):
raise NotImplementedError
@ -83,8 +80,7 @@ class DCManagerShowOne(command.ShowOne):
return f()
@six.add_metaclass(abc.ABCMeta)
class DCManagerShow(DCManagerLister, DCManagerShowOne):
class DCManagerShow(DCManagerLister, DCManagerShowOne, metaclass=abc.ABCMeta):
@abc.abstractmethod
def should_list(self, parsed_args):
"""Uses Lister behaviour if True, ShowOne otherwise."""

View File

@ -18,7 +18,6 @@ import base64
import os
from osc_lib.command import command
import six
from dcmanagerclient import exceptions
from dcmanagerclient import utils
@ -907,7 +906,7 @@ class RedeploySubcloud(base.DCManagerShowOne):
"WARNING: This will redeploy the subcloud. "
"All applications and data on the subcloud will be lost."
)
confirm = six.moves.input('Please type "redeploy" to confirm: ').strip().lower()
confirm = input('Please type "redeploy" to confirm: ').strip().lower()
if confirm == "redeploy":
try:
return subcloud_manager.redeploy_subcloud(

View File

@ -15,10 +15,10 @@
# limitations under the License.
#
import io
import os
import sys
import six
import testtools
from dcmanagerclient import shell
@ -31,8 +31,8 @@ class BaseShellTests(testtools.TestCase):
_old_env, os.environ = os.environ, clean_env.copy()
try:
sys.stdout = six.moves.cStringIO()
sys.stderr = six.moves.cStringIO()
sys.stdout = io.StringIO()
sys.stderr = io.StringIO()
_shell = shell.DCManagerShell()
_shell.run(argstr.split())
except SystemExit:

View File

@ -387,7 +387,7 @@ class TestCLISubcloudManagerV1(base.BaseCommandTest):
self.assertEqual(base.SUBCLOUD_FIELD_RESULT_LIST_WITH_PEERID, actual_call[1])
@mock.patch("getpass.getpass", return_value="testpassword")
@mock.patch("six.moves.input", return_value="redeploy")
@mock.patch.object(subcloud_cmd, "input", return_value="redeploy")
def test_redeploy_subcloud(self, _mock_input, _mock_getpass):
self.client.subcloud_manager.redeploy_subcloud.return_value = [
self.subcloud_resource
@ -421,7 +421,7 @@ class TestCLISubcloudManagerV1(base.BaseCommandTest):
self.assertEqual(base.SUBCLOUD_FIELD_RESULT_LIST_WITH_PEERID, actual_call[1])
@mock.patch("getpass.getpass", return_value="testpassword")
@mock.patch("six.moves.input", return_value="redeploy")
@mock.patch.object(subcloud_cmd, "input", return_value="redeploy")
def test_redeploy_subcloud_no_parameters(self, _mock_input, _mock_getpass):
self.client.subcloud_manager.redeploy_subcloud.return_value = [
self.subcloud_resource
@ -430,7 +430,7 @@ class TestCLISubcloudManagerV1(base.BaseCommandTest):
self.assertEqual(base.SUBCLOUD_FIELD_RESULT_LIST_WITH_PEERID, actual_call[1])
@mock.patch("getpass.getpass", return_value="testpassword")
@mock.patch("six.moves.input", return_value="redeploy")
@mock.patch.object(subcloud_cmd, "input", return_value="redeploy")
def test_redeploy_bootstrap_files_does_not_exists(self, _mock_input, _mock_getpass):
self.client.subcloud_manager.redeploy_subcloud.return_value = [
self.subcloud_resource

View File

@ -11,4 +11,3 @@ python-keystoneclient>=3.8.0 # Apache-2.0
PyYAML>=3.10.0 # MIT
requests!=2.12.2,!=2.13.0,>=2.10.0 # Apache-2.0
requests-toolbelt # Apache-2.0
six>=1.9.0 # MIT