Remove code related to Python versions before 3.5
This commit removes any occurrence of the library six. Six is used to aid in writing code that is compatible with both Python 2 and Python 3. Craton no longer supports the use of Python 2.x, and so six is no longer required. The minimum version of Python supported is 3.5, the classifiers are updated accordingly in setup.cfg. The docs have been updated to specify 3.5 as the minimum version. Tox no longer attempts to test against Python 3.4. This change also removes .travis.yml because it is left over from from before the project was moved to the OpenStack project namespace and is no longer required. Closes-bug: #1630003 Change-Id: I63cba2b6f21a507c0ff02edbef24b663af400c12
This commit is contained in:
parent
22bb66714c
commit
97b8775301
16
.travis.yml
16
.travis.yml
|
@ -1,16 +0,0 @@
|
||||||
sudo: false
|
|
||||||
language: python
|
|
||||||
|
|
||||||
matrix:
|
|
||||||
include:
|
|
||||||
- python: 2.7
|
|
||||||
env: TOXENV=py27
|
|
||||||
- python: 3.4
|
|
||||||
env: TOXENV=py34
|
|
||||||
- python: 3.5
|
|
||||||
env: TOXENV=py35
|
|
||||||
- env: TOXENV=pep8
|
|
||||||
|
|
||||||
install: pip install tox-travis
|
|
||||||
|
|
||||||
script: tox
|
|
|
@ -10,7 +10,6 @@ from flask_restful import abort
|
||||||
from flask_restful.utils import unpack
|
from flask_restful.utils import unpack
|
||||||
from jsonschema import Draft4Validator
|
from jsonschema import Draft4Validator
|
||||||
from oslo_log import log
|
from oslo_log import log
|
||||||
import six
|
|
||||||
|
|
||||||
from craton.api.v1.schemas import filters
|
from craton.api.v1.schemas import filters
|
||||||
from craton.api.v1.schemas import scopes
|
from craton.api.v1.schemas import scopes
|
||||||
|
@ -93,7 +92,7 @@ def normalize(schema, data, required_defaults=None):
|
||||||
for key in data.keys():
|
for key in data.keys():
|
||||||
result[key] = _normalize(_schema, data.get(key))
|
result[key] = _normalize(_schema, data.get(key))
|
||||||
|
|
||||||
for key, _schema in six.iteritems(schema.get('properties', {})):
|
for key, _schema in schema.get('properties', {}).items():
|
||||||
# set default
|
# set default
|
||||||
type_ = _schema.get('type', 'object')
|
type_ = _schema.get('type', 'object')
|
||||||
if ('default' not in _schema and
|
if ('default' not in _schema and
|
||||||
|
@ -182,7 +181,7 @@ class FlaskValidatorAdaptor(object):
|
||||||
if isinstance(obj, (dict, list)) and not isinstance(obj, MultiDict):
|
if isinstance(obj, (dict, list)) and not isinstance(obj, MultiDict):
|
||||||
return obj
|
return obj
|
||||||
if isinstance(obj, Headers):
|
if isinstance(obj, Headers):
|
||||||
obj = MultiDict(six.iteritems(obj))
|
obj = MultiDict(obj)
|
||||||
result = dict()
|
result = dict()
|
||||||
|
|
||||||
convert_funs = {
|
convert_funs = {
|
||||||
|
@ -198,7 +197,7 @@ class FlaskValidatorAdaptor(object):
|
||||||
func = convert_funs.get(type_, lambda v: v[0])
|
func = convert_funs.get(type_, lambda v: v[0])
|
||||||
return [func([i]) for i in v]
|
return [func([i]) for i in v]
|
||||||
|
|
||||||
for k, values in six.iterlists(obj):
|
for k, values in obj.lists():
|
||||||
prop = self.validator.schema['properties'].get(k, {})
|
prop = self.validator.schema['properties'].get(k, {})
|
||||||
type_ = prop.get('type')
|
type_ = prop.get('type')
|
||||||
fun = convert_funs.get(type_, lambda v: v[0])
|
fun = convert_funs.get(type_, lambda v: v[0])
|
||||||
|
@ -230,7 +229,7 @@ def request_validate(view):
|
||||||
if method == 'HEAD':
|
if method == 'HEAD':
|
||||||
method = 'GET'
|
method = 'GET'
|
||||||
locations = validators.get((endpoint, method), {})
|
locations = validators.get((endpoint, method), {})
|
||||||
for location, schema in six.iteritems(locations):
|
for location, schema in locations.items():
|
||||||
value = getattr(request, location, MultiDict())
|
value = getattr(request, location, MultiDict())
|
||||||
validator = FlaskValidatorAdaptor(schema)
|
validator = FlaskValidatorAdaptor(schema)
|
||||||
result, errors = validator.validate(value)
|
result, errors = validator.validate(value)
|
||||||
|
|
|
@ -1,10 +1,7 @@
|
||||||
import abc
|
import abc
|
||||||
|
|
||||||
import six
|
|
||||||
|
|
||||||
|
class WorkflowFactory(object, metaclass=abc.ABCMeta):
|
||||||
@six.add_metaclass(abc.ABCMeta)
|
|
||||||
class WorkflowFactory(object):
|
|
||||||
|
|
||||||
@abc.abstractmethod
|
@abc.abstractmethod
|
||||||
def workflow(self):
|
def workflow(self):
|
||||||
|
|
|
@ -22,7 +22,7 @@ Installing Environment from packages: Ubuntu
|
||||||
|
|
||||||
# git clone https://github.com/openstack/craton.git
|
# git clone https://github.com/openstack/craton.git
|
||||||
|
|
||||||
.. note:: Make sure to use Python3, as this is only a Python3 project.
|
.. note:: This is a Python3 project only, the minimum support version is Python 3.5.
|
||||||
|
|
||||||
* Install the prerequisite packages::
|
* Install the prerequisite packages::
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
decorator>=3.4.0 # BSD
|
decorator>=3.4.0 # BSD
|
||||||
Flask!=0.11,<1.0,>=0.10 # BSD
|
Flask!=0.11,<1.0,>=0.10 # BSD
|
||||||
flask_restful
|
flask_restful
|
||||||
ipaddress>=1.0.7;python_version<'3.3' # PSF
|
|
||||||
jsonschema>=2.0.0,<3.0.0,!=2.5.0 # MIT
|
jsonschema>=2.0.0,<3.0.0,!=2.5.0 # MIT
|
||||||
kazoo>=2.2 # Apache-2.0
|
kazoo>=2.2 # Apache-2.0
|
||||||
keystonemiddleware>=4.2.0,!=4.5.0 # Apache-2.0
|
keystonemiddleware>=4.2.0,!=4.5.0 # Apache-2.0
|
||||||
|
@ -20,7 +19,6 @@ oslo.utils>=3.5.0 # Apache-2.0
|
||||||
PasteDeploy>=1.5.0 # MIT
|
PasteDeploy>=1.5.0 # MIT
|
||||||
Paste # MIT
|
Paste # MIT
|
||||||
pbr>=1.6
|
pbr>=1.6
|
||||||
six>=1.9.0 # MIT
|
|
||||||
SQLAlchemy>=1.0.10,<1.1.0 # MIT
|
SQLAlchemy>=1.0.10,<1.1.0 # MIT
|
||||||
sqlalchemy-utils # BSD License
|
sqlalchemy-utils # BSD License
|
||||||
stevedore>=1.5.0 # Apache-2.0
|
stevedore>=1.5.0 # Apache-2.0
|
||||||
|
|
|
@ -15,7 +15,6 @@ classifier =
|
||||||
Programming Language :: Python
|
Programming Language :: Python
|
||||||
Programming Language :: Python :: 3
|
Programming Language :: Python :: 3
|
||||||
Programming Language :: Python :: 3 :: Only
|
Programming Language :: Python :: 3 :: Only
|
||||||
Programming Language :: Python :: 3.4
|
|
||||||
Programming Language :: Python :: 3.5
|
Programming Language :: Python :: 3.5
|
||||||
|
|
||||||
[files]
|
[files]
|
||||||
|
|
Loading…
Reference in New Issue