Replace six by python3 code style
As we have already dropped python2 support, usage of six module is redundant. The patch also edits the classifiers in setup.cfg which comply with the wallaby cycle goals. Change-Id: I2b0e4050e489ddfc7cbabe4165d5499ba6788422
This commit is contained in:
parent
a1f2375875
commit
052de8653b
@ -23,7 +23,6 @@ from beaker.middleware import SessionMiddleware
|
||||
from oslo_config import cfg
|
||||
from oslo_log import log
|
||||
import pecan
|
||||
import six
|
||||
import webob
|
||||
|
||||
from refstack.api import exceptions as api_exc
|
||||
@ -159,7 +158,7 @@ class JSONErrorHook(pecan.hooks.PecanHook):
|
||||
|
||||
body = {'title': title or exc.args[0], 'code': status_code}
|
||||
if self.debug:
|
||||
body['detail'] = six.text_type(exc)
|
||||
body['detail'] = str(exc)
|
||||
return webob.Response(
|
||||
body=json.dumps(body),
|
||||
status=status_code,
|
||||
|
@ -18,7 +18,7 @@
|
||||
from oslo_config import cfg
|
||||
import pecan
|
||||
from pecan import rest
|
||||
from six.moves.urllib import parse
|
||||
from urllib import parse
|
||||
|
||||
from refstack.api import constants as const
|
||||
from refstack.api import utils as api_utils
|
||||
|
@ -22,7 +22,6 @@ from oslo_db.exception import DBReferenceError
|
||||
from oslo_log import log
|
||||
import pecan
|
||||
from pecan.secure import secure
|
||||
import six
|
||||
|
||||
from refstack.api import constants as const
|
||||
from refstack.api.controllers import validation
|
||||
@ -222,7 +221,7 @@ class ProductsController(validation.BaseRestControllerWithValidation):
|
||||
if product['product_type'] == const.DISTRO
|
||||
else const.CLOUD)
|
||||
if product['type'] == const.SOFTWARE:
|
||||
product['product_ref_id'] = six.text_type(uuid.uuid4())
|
||||
product['product_ref_id'] = str(uuid.uuid4())
|
||||
vendor_id = product.pop('organization_id', None)
|
||||
if not vendor_id:
|
||||
# find or create default vendor for new product
|
||||
|
@ -21,7 +21,7 @@ from oslo_log import log
|
||||
import pecan
|
||||
from pecan import rest
|
||||
|
||||
from six.moves.urllib import parse
|
||||
from urllib import parse
|
||||
|
||||
from refstack import db
|
||||
from refstack.api import constants as const
|
||||
|
@ -16,7 +16,6 @@
|
||||
|
||||
import base64
|
||||
import json
|
||||
import six
|
||||
|
||||
from oslo_config import cfg
|
||||
from oslo_db.exception import DBReferenceError
|
||||
@ -55,7 +54,7 @@ class UsersController(rest.RestController):
|
||||
return None
|
||||
|
||||
org_users = db.get_organization_users(vendor_id)
|
||||
return [x for x in six.itervalues(org_users)]
|
||||
return [x for x in org_users.values()]
|
||||
|
||||
@secure(api_utils.is_authenticated)
|
||||
@pecan.expose('json')
|
||||
|
@ -31,7 +31,7 @@ import pecan
|
||||
import pecan.rest
|
||||
import jwt
|
||||
|
||||
from six.moves.urllib import parse
|
||||
from urllib import parse
|
||||
|
||||
from refstack import db
|
||||
from refstack.api import constants as const
|
||||
|
@ -16,7 +16,6 @@
|
||||
"""Validators module."""
|
||||
|
||||
import binascii
|
||||
import six
|
||||
import uuid
|
||||
|
||||
import json
|
||||
@ -79,7 +78,7 @@ class BaseValidator(object):
|
||||
"""Check that all values are not empty."""
|
||||
for key in keys:
|
||||
value = body[key]
|
||||
if isinstance(value, six.string_types):
|
||||
if isinstance(value, str):
|
||||
value = value.strip()
|
||||
if not value:
|
||||
raise api_exc.ValidationError(key + ' should not be empty')
|
||||
|
@ -19,7 +19,6 @@
|
||||
import uuid
|
||||
|
||||
from oslo_db.sqlalchemy import models
|
||||
import six
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy import orm
|
||||
from sqlalchemy.ext.declarative import declarative_base
|
||||
@ -151,7 +150,7 @@ class PubKey(BASE, RefStackBase): # pragma: no cover
|
||||
__tablename__ = 'pubkeys'
|
||||
|
||||
id = sa.Column(sa.String(36), primary_key=True,
|
||||
default=lambda: six.text_type(uuid.uuid4()))
|
||||
default=lambda: str(uuid.uuid4()))
|
||||
openid = sa.Column(sa.String(128), sa.ForeignKey('user.openid'),
|
||||
nullable=False, unique=True, index=True)
|
||||
format = sa.Column(sa.String(24), nullable=False)
|
||||
@ -171,7 +170,7 @@ class Group(BASE, RefStackBase): # pragma: no cover
|
||||
__tablename__ = 'group'
|
||||
|
||||
id = sa.Column(sa.String(36), primary_key=True,
|
||||
default=lambda: six.text_type(uuid.uuid4()))
|
||||
default=lambda: str(uuid.uuid4()))
|
||||
name = sa.Column(sa.String(80), nullable=False)
|
||||
description = sa.Column(sa.Text())
|
||||
|
||||
@ -205,7 +204,7 @@ class Organization(BASE, RefStackBase): # pragma: no cover
|
||||
__tablename__ = 'organization'
|
||||
|
||||
id = sa.Column(sa.String(36), primary_key=True,
|
||||
default=lambda: six.text_type(uuid.uuid4()))
|
||||
default=lambda: str(uuid.uuid4()))
|
||||
type = sa.Column(sa.Integer, nullable=False)
|
||||
name = sa.Column(sa.String(80), nullable=False)
|
||||
description = sa.Column(sa.Text())
|
||||
@ -228,7 +227,7 @@ class Product(BASE, RefStackBase): # pragma: no cover
|
||||
__tablename__ = 'product'
|
||||
|
||||
id = sa.Column(sa.String(36), primary_key=True,
|
||||
default=lambda: six.text_type(uuid.uuid4()))
|
||||
default=lambda: str(uuid.uuid4()))
|
||||
name = sa.Column(sa.String(80), nullable=False)
|
||||
description = sa.Column(sa.Text())
|
||||
organization_id = sa.Column(sa.String(36),
|
||||
@ -256,7 +255,7 @@ class ProductVersion(BASE, RefStackBase):
|
||||
)
|
||||
|
||||
id = sa.Column(sa.String(36), primary_key=True,
|
||||
default=lambda: six.text_type(uuid.uuid4()))
|
||||
default=lambda: str(uuid.uuid4()))
|
||||
product_id = sa.Column(sa.String(36), sa.ForeignKey('product.id'),
|
||||
index=True, nullable=False, unique=False)
|
||||
version = sa.Column(sa.String(length=36), nullable=True)
|
||||
|
@ -17,7 +17,6 @@ import uuid
|
||||
|
||||
import mock
|
||||
from oslo_config import fixture as config_fixture
|
||||
import six
|
||||
import webtest.app
|
||||
|
||||
from refstack.api import constants as api_const
|
||||
@ -207,7 +206,7 @@ class TestResultsEndpoint(api.FunctionalTest):
|
||||
"""Test get request with nonexistent uuid."""
|
||||
self.assertRaises(webtest.app.AppError,
|
||||
self.get_json,
|
||||
self.URL + six.text_type(uuid.uuid4()))
|
||||
self.URL + str(uuid.uuid4()))
|
||||
|
||||
def test_get_one_schema(self):
|
||||
"""Test get request for getting JSON schema."""
|
||||
@ -230,7 +229,7 @@ class TestResultsEndpoint(api.FunctionalTest):
|
||||
responses = []
|
||||
for i in range(3):
|
||||
fake_results = {
|
||||
'cpid': six.text_type(i),
|
||||
'cpid': str(i),
|
||||
'duration_seconds': i,
|
||||
'results': [
|
||||
{'name': 'tempest.foo.bar'},
|
||||
|
@ -19,7 +19,7 @@ import json
|
||||
|
||||
import mock
|
||||
from oslo_config import fixture as config_fixture
|
||||
from six.moves.urllib import parse
|
||||
from urllib import parse
|
||||
import webob.exc
|
||||
|
||||
from refstack.api import constants as const
|
||||
|
@ -22,7 +22,7 @@ from oslo_utils import timeutils
|
||||
from oslotest import base
|
||||
from pecan import rest
|
||||
import jwt
|
||||
from six.moves.urllib import parse
|
||||
from urllib import parse
|
||||
from webob import exc
|
||||
|
||||
from refstack.api import constants as const
|
||||
|
@ -17,7 +17,6 @@
|
||||
|
||||
import base64
|
||||
import hashlib
|
||||
import six
|
||||
import mock
|
||||
from oslo_config import fixture as config_fixture
|
||||
from oslotest import base
|
||||
@ -191,7 +190,7 @@ class DBBackendTestCase(base.BaseTestCase):
|
||||
test.save.assert_called_once_with(session)
|
||||
session.begin.assert_called_once_with()
|
||||
|
||||
self.assertEqual(test_id, six.text_type(_id))
|
||||
self.assertEqual(test_id, str(_id))
|
||||
self.assertEqual(test.cpid, fake_tests_result['cpid'])
|
||||
self.assertEqual(test.duration_seconds,
|
||||
fake_tests_result['duration_seconds'])
|
||||
@ -362,8 +361,8 @@ class DBBackendTestCase(base.BaseTestCase):
|
||||
def test_apply_filters_for_query_unsigned(self, mock_meta,
|
||||
mock_test):
|
||||
query = mock.Mock()
|
||||
mock_test.created_at = six.text_type()
|
||||
mock_meta.test_id = six.text_type()
|
||||
mock_test.created_at = str()
|
||||
mock_meta.test_id = str()
|
||||
|
||||
filters = {
|
||||
api_const.START_DATE: 'fake1',
|
||||
@ -413,8 +412,8 @@ class DBBackendTestCase(base.BaseTestCase):
|
||||
def test_apply_filters_for_query_signed(self, mock_meta,
|
||||
mock_test):
|
||||
query = mock.Mock()
|
||||
mock_test.created_at = six.text_type()
|
||||
mock_meta.test_id = six.text_type()
|
||||
mock_test.created_at = str()
|
||||
mock_meta.test_id = str()
|
||||
mock_meta.meta_key = 'user'
|
||||
mock_meta.value = 'test-openid'
|
||||
|
||||
|
@ -6,6 +6,7 @@ description-file =
|
||||
author = OpenStack
|
||||
author-email = openstack-discuss@lists.openstack.org
|
||||
home-page = https://refstack.openstack.org
|
||||
python_requires = >=3.6
|
||||
classifier =
|
||||
Environment :: OpenStack
|
||||
Intended Audience :: Developers
|
||||
@ -15,6 +16,10 @@ classifier =
|
||||
Programming Language :: Python
|
||||
Programming Language :: Python :: 3
|
||||
Programming Language :: Python :: 3.6
|
||||
Programming Language :: Python :: 3.7
|
||||
Programming Language :: Python :: 3.8
|
||||
Programming Language :: Python :: 3 :: Only
|
||||
Programming Language :: Python :: Implementation :: CPython
|
||||
|
||||
[files]
|
||||
packages =
|
||||
|
Loading…
Reference in New Issue
Block a user