Stop using six library

Since we've dropped support for Python 2.7, it's time to look at
the bright future that Python 3.x will bring and stop forcing
compatibility with older versions.
This patch removes the six library from requirements, not
looking back.

Change-Id: Iff319bfedc2c20c139419bb625aa5de83de93538
This commit is contained in:
Riccardo Pittau 2019-12-02 17:48:54 +01:00
parent adca510cf5
commit 26b7ff6063
8 changed files with 16 additions and 21 deletions

View File

@ -44,7 +44,6 @@ reno==2.5.0
requests==2.14.2
requestsexceptions==1.2.0
restructuredtext-lint==1.1.1
six==1.10.0
snowballstemmer==1.2.1
Sphinx==1.6.2
sphinxcontrib-websupport==1.0.1

View File

@ -3,7 +3,6 @@
# process, which may cause wedges in the gate later.
pbr!=2.1.0,>=2.0.0 # Apache-2.0
six>=1.10.0 # MIT
libvirt-python!=4.1.0,>=3.7.0 # LGPLv2+
pyghmi>=1.0.22 # Apache-2.0
cliff!=2.9.0,>=2.8.0 # Apache-2.0

View File

@ -10,10 +10,9 @@
# License for the specific language governing permissions and limitations
# under the License.
import configparser
import os
from six.moves import configparser
from virtualbmc import utils
__all__ = ['get_config']

View File

@ -10,14 +10,12 @@
# License for the specific language governing permissions and limitations
# under the License.
import configparser
import errno
import multiprocessing
import os
import shutil
import six
from six.moves import configparser
from virtualbmc import config as vbmc_config
from virtualbmc import exception
from virtualbmc import log
@ -78,7 +76,7 @@ class VirtualBMCManager(object):
for option, value in options.items():
if value is not None:
config.set(DEFAULT_SECTION, option, six.text_type(value))
config.set(DEFAULT_SECTION, option, str(value))
config_path = os.path.join(
self.config_dir, options['domain_name'], 'config'
@ -251,7 +249,7 @@ class VirtualBMCManager(object):
self._store_config(domain_name=domain_name,
username=username,
password=password,
port=six.text_type(port),
port=str(port),
address=address,
libvirt_uri=libvirt_uri,
libvirt_sasl_username=libvirt_sasl_username,

View File

@ -13,9 +13,9 @@
# License for the specific language governing permissions and limitations
# under the License.
import io
import json
import mock
import six
import sys
import zmq
@ -42,7 +42,7 @@ class VBMCTestCase(base.TestCase):
mock_zmq_poller = mock_zmq_poller.return_value
mock_zmq_poller.poll.return_value = {}
with mock.patch.object(sys, 'stderr', six.StringIO()) as output:
with mock.patch.object(sys, 'stderr', io.StringIO()) as output:
rc = vbmc.main(['--no-daemon',
'add', '--username', 'ironic', 'bar'])
@ -68,7 +68,7 @@ class VBMCTestCase(base.TestCase):
mock_zmq_socket: zmq.POLLIN
}
with mock.patch.object(sys, 'stdout', six.StringIO()) as output:
with mock.patch.object(sys, 'stdout', io.StringIO()) as output:
rc = vbmc.main(['add', '--username', 'ironic', 'bar'])
query = json.loads(mock_zmq_socket.send.call_args[0][0].decode())
@ -109,7 +109,7 @@ class VBMCTestCase(base.TestCase):
mock_zmq_socket: zmq.POLLIN
}
with mock.patch.object(sys, 'stdout', six.StringIO()) as output:
with mock.patch.object(sys, 'stdout', io.StringIO()) as output:
rc = vbmc.main(['delete', 'foo', 'bar'])
@ -144,7 +144,7 @@ class VBMCTestCase(base.TestCase):
mock_zmq_socket: zmq.POLLIN
}
with mock.patch.object(sys, 'stdout', six.StringIO()) as output:
with mock.patch.object(sys, 'stdout', io.StringIO()) as output:
rc = vbmc.main(['start', 'foo', 'bar'])
@ -179,7 +179,7 @@ class VBMCTestCase(base.TestCase):
mock_zmq_socket: zmq.POLLIN
}
with mock.patch.object(sys, 'stdout', six.StringIO()) as output:
with mock.patch.object(sys, 'stdout', io.StringIO()) as output:
rc = vbmc.main(['stop', 'foo', 'bar'])
@ -222,7 +222,7 @@ class VBMCTestCase(base.TestCase):
mock_zmq_socket: zmq.POLLIN
}
with mock.patch.object(sys, 'stdout', six.StringIO()) as output:
with mock.patch.object(sys, 'stdout', io.StringIO()) as output:
rc = vbmc.main(['list'])
@ -269,7 +269,7 @@ class VBMCTestCase(base.TestCase):
mock_zmq_socket: zmq.POLLIN
}
with mock.patch.object(sys, 'stdout', six.StringIO()) as output:
with mock.patch.object(sys, 'stdout', io.StringIO()) as output:
rc = vbmc.main(['show', 'domain0'])

View File

@ -13,10 +13,10 @@
# License for the specific language governing permissions and limitations
# under the License.
import builtins
import os
import mock
from six.moves import builtins
from virtualbmc.cmd import vbmcd
from virtualbmc import control

View File

@ -13,10 +13,10 @@
# License for the specific language governing permissions and limitations
# under the License.
import configparser
import os
import mock
from six.moves import configparser
from virtualbmc import config
from virtualbmc.tests.unit import base

View File

@ -13,6 +13,8 @@
# License for the specific language governing permissions and limitations
# under the License.
import builtins
import configparser
import copy
import errno
import multiprocessing
@ -20,8 +22,6 @@ import os
import shutil
import mock
from six.moves import builtins
from six.moves import configparser
from virtualbmc import exception
from virtualbmc import manager