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:
git-harry 2016-11-01 11:40:16 +00:00
parent 22bb66714c
commit 97b8775301
7 changed files with 7 additions and 30 deletions

View File

@ -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

View File

@ -10,7 +10,6 @@ from flask_restful import abort
from flask_restful.utils import unpack
from jsonschema import Draft4Validator
from oslo_log import log
import six
from craton.api.v1.schemas import filters
from craton.api.v1.schemas import scopes
@ -93,7 +92,7 @@ def normalize(schema, data, required_defaults=None):
for key in data.keys():
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
type_ = _schema.get('type', 'object')
if ('default' not in _schema and
@ -182,7 +181,7 @@ class FlaskValidatorAdaptor(object):
if isinstance(obj, (dict, list)) and not isinstance(obj, MultiDict):
return obj
if isinstance(obj, Headers):
obj = MultiDict(six.iteritems(obj))
obj = MultiDict(obj)
result = dict()
convert_funs = {
@ -198,7 +197,7 @@ class FlaskValidatorAdaptor(object):
func = convert_funs.get(type_, lambda v: v[0])
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, {})
type_ = prop.get('type')
fun = convert_funs.get(type_, lambda v: v[0])
@ -230,7 +229,7 @@ def request_validate(view):
if method == 'HEAD':
method = 'GET'
locations = validators.get((endpoint, method), {})
for location, schema in six.iteritems(locations):
for location, schema in locations.items():
value = getattr(request, location, MultiDict())
validator = FlaskValidatorAdaptor(schema)
result, errors = validator.validate(value)

View File

@ -1,10 +1,7 @@
import abc
import six
@six.add_metaclass(abc.ABCMeta)
class WorkflowFactory(object):
class WorkflowFactory(object, metaclass=abc.ABCMeta):
@abc.abstractmethod
def workflow(self):

View File

@ -22,7 +22,7 @@ Installing Environment from packages: Ubuntu
# 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::

View File

@ -5,7 +5,6 @@
decorator>=3.4.0 # BSD
Flask!=0.11,<1.0,>=0.10 # BSD
flask_restful
ipaddress>=1.0.7;python_version<'3.3' # PSF
jsonschema>=2.0.0,<3.0.0,!=2.5.0 # MIT
kazoo>=2.2 # 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
Paste # MIT
pbr>=1.6
six>=1.9.0 # MIT
SQLAlchemy>=1.0.10,<1.1.0 # MIT
sqlalchemy-utils # BSD License
stevedore>=1.5.0 # Apache-2.0

View File

@ -15,7 +15,6 @@ classifier =
Programming Language :: Python
Programming Language :: Python :: 3
Programming Language :: Python :: 3 :: Only
Programming Language :: Python :: 3.4
Programming Language :: Python :: 3.5
[files]

View File

@ -1,6 +1,6 @@
[tox]
minversion = 2.0
envlist = py34,py35,pep8
envlist = py35,pep8
skipsdist = True
[testenv]