Remove usage of six

Remove six-library, replace the following items with Python 3 style
code:
- six.moves
- six.iteritems

Remove six-library in requirement.txt

Change-Id: Ic45dff7406937c9ee6d7bd2286107bcd33e5a16d
This commit is contained in:
songwenping 2021-02-22 17:10:57 +08:00 committed by Martin Kopec
parent e662307b81
commit d1f79f4bd6
8 changed files with 16 additions and 16 deletions

View File

@ -13,7 +13,6 @@ oslo.log>=3.36.0 # Apache-2.0
stestr>=1.0.0 # Apache-2.0
oslo.serialization!=2.19.1,>=2.18.0 # Apache-2.0
oslo.utils>=4.7.0 # Apache-2.0
six>=1.10.0 # MIT
fixtures>=3.0.0 # Apache-2.0/BSD
PyYAML>=3.12 # MIT
python-subunit>=1.0.0 # Apache-2.0/BSD

View File

@ -13,8 +13,9 @@
# License for the specific language governing permissions and limitations
# under the License.
from urllib import parse as urllib
from oslo_serialization import jsonutils as json
from six.moves.urllib import parse as urllib
from tempest.lib.common import rest_client
from tempest.lib.services.compute import base_compute_client

View File

@ -13,8 +13,9 @@
# License for the specific language governing permissions and limitations under
# the License.
from urllib import parse as urllib
from oslo_serialization import jsonutils as json
from six.moves.urllib import parse as urllib
from tempest.lib.common import rest_client

View File

@ -13,8 +13,9 @@
# License for the specific language governing permissions and limitations under
# the License.
from urllib import parse as urllib
from oslo_serialization import jsonutils as json
from six.moves.urllib import parse as urllib
from tempest.lib.common import rest_client

View File

@ -13,8 +13,9 @@
# License for the specific language governing permissions and limitations under
# the License.
from urllib import parse as urllib
from oslo_serialization import jsonutils as json
from six.moves.urllib import parse as urllib
from tempest.lib.common import rest_client

View File

@ -13,8 +13,9 @@
# License for the specific language governing permissions and limitations under
# the License.
from urllib import parse as urllib
from oslo_serialization import jsonutils as json
from six.moves.urllib import parse as urllib
from tempest.lib.common import rest_client

View File

@ -144,8 +144,7 @@ class TestPreProvisionedCredentials(base.TestCase):
# Emulate the lock existing on the filesystem
self.useFixture(fixtures.MockPatch(
'os.path.isfile', return_value=True))
with mock.patch('six.moves.builtins.open', mock.mock_open(),
create=True):
with mock.patch('builtins.open', mock.mock_open(), create=True):
test_account_class = (
preprov_creds.PreProvisionedCredentialProvider(
**self.fixed_params))
@ -157,8 +156,7 @@ class TestPreProvisionedCredentials(base.TestCase):
# Emulate the lock not existing on the filesystem
self.useFixture(fixtures.MockPatch(
'os.path.isfile', return_value=False))
with mock.patch('six.moves.builtins.open', mock.mock_open(),
create=True):
with mock.patch('builtins.open', mock.mock_open(), create=True):
test_account_class = (
preprov_creds.PreProvisionedCredentialProvider(
**self.fixed_params))
@ -177,7 +175,7 @@ class TestPreProvisionedCredentials(base.TestCase):
'os.path.isfile', return_value=False))
test_account_class = preprov_creds.PreProvisionedCredentialProvider(
**self.fixed_params)
with mock.patch('six.moves.builtins.open', mock.mock_open(),
with mock.patch('builtins.open', mock.mock_open(),
create=True) as open_mock:
test_account_class._get_free_hash(hash_list)
lock_path = os.path.join(self.fixed_params['accounts_lock_dir'],
@ -196,8 +194,7 @@ class TestPreProvisionedCredentials(base.TestCase):
'os.path.isfile', return_value=True))
test_account_class = preprov_creds.PreProvisionedCredentialProvider(
**self.fixed_params)
with mock.patch('six.moves.builtins.open', mock.mock_open(),
create=True):
with mock.patch('builtins.open', mock.mock_open(), create=True):
self.assertRaises(lib_exc.InvalidCredentials,
test_account_class._get_free_hash, hash_list)
@ -217,7 +214,7 @@ class TestPreProvisionedCredentials(base.TestCase):
return True
self.patchobject(os.path, 'isfile', _fake_is_file)
with mock.patch('six.moves.builtins.open', mock.mock_open(),
with mock.patch('builtins.open', mock.mock_open(),
create=True) as open_mock:
test_account_class._get_free_hash(hash_list)
lock_path = os.path.join(self.fixed_params['accounts_lock_dir'],

View File

@ -23,7 +23,6 @@ import re
import sys
import urllib.request as urlreq
import six
import yaml
# DEVSTACK_GATE_GRENADE is either unset if grenade is not running
@ -137,7 +136,7 @@ def main(opts):
with open(ALLOW_LIST_FILE) as stream:
loaded = yaml.safe_load(stream)
if loaded:
for (name, l) in six.iteritems(loaded):
for (name, l) in loaded.values():
for w in l:
assert 'module' in w, 'no module in %s' % name
assert 'message' in w, 'no message in %s' % name