Skip to content

Commit

Permalink
Merge branch 'compatibility_imorts_of_abstract_classes_#451'
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolaiarocci committed Oct 20, 2018
2 parents 43a882b + 3319d16 commit 0eb908a
Show file tree
Hide file tree
Showing 9 changed files with 48 additions and 10 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Expand Up @@ -6,6 +6,7 @@ python:
- 3.4
- 3.5
- 3.6
- 3.7-dev # FIXME when 3.7 is available
- pypy
- pypy3
install: travis_retry pip install tox-travis
Expand Down
3 changes: 3 additions & 0 deletions CHANGES.rst
Expand Up @@ -20,6 +20,7 @@ New
the next major release of Cerbers (`#385`_)
- The ``meta`` pseudo-rule can be used to store arbitrary application data
related to a field in a schema
- Python 3.7 officially supported (`#451`_)
- **Python 2.6 and 3.3 are no longer supported**

Fixed
Expand All @@ -31,6 +32,7 @@ Fixed

Improved
~~~~~~~~
- Suppress DeprecationWarning about collections.abc (`#451`_)
- Omit warning when no schema for ``meta`` rule constraint is available (`#425`_)
- Add ``.eggs`` to .gitignore file (`#420`_)
- Reformat code to match Black code-style (`#402`_)
Expand Down Expand Up @@ -59,6 +61,7 @@ Docs
- Add a few clarifications to the GitHub issue template
- Update README link; make it point to the new PyPI website

.. _`#451`: https://github.com/pyeve/cerberus/pull/451
.. _`#435`: https://github.com/pyeve/cerberus/pull/435
.. _`#429`: https://github.com/pyeve/cerberus/pull/429
.. _`#425`: https://github.com/pyeve/cerberus/pull/425
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Expand Up @@ -3,7 +3,7 @@ FROM funkyfuture/nest-of-serpents
ENTRYPOINT tox
WORKDIR /src

RUN pip3.6 install black flake8 pre-commit pytest tox PyYAML Sphinx \
RUN pip3.7 install black flake8 pre-commit pytest tox PyYAML Sphinx \
&& mkdir /home/tox \
&& mv /root/.cache /home/tox/

Expand Down
26 changes: 26 additions & 0 deletions cerberus/platform.py
Expand Up @@ -12,3 +12,29 @@
else:
_str_type = str
_int_types = (int,)


if PYTHON_VERSION < 3.3:
from collections import ( # noqa: F401
Callable,
Container,
Hashable,
Iterable,
Mapping,
MutableMapping,
Sequence,
Set,
Sized,
)
else:
from collections.abc import ( # noqa: F401
Callable,
Container,
Hashable,
Iterable,
Mapping,
MutableMapping,
Sequence,
Set,
Sized,
)
2 changes: 1 addition & 1 deletion cerberus/schema.py
@@ -1,6 +1,5 @@
from __future__ import absolute_import

from collections import Callable, Hashable, Mapping, MutableMapping, Sequence
from copy import copy
from warnings import warn

Expand All @@ -12,6 +11,7 @@
mapping_hash,
TypeDefinition,
)
from cerberus.platform import Callable, Hashable, Mapping, MutableMapping, Sequence


class _Abort(Exception):
Expand Down
4 changes: 2 additions & 2 deletions cerberus/utils.py
@@ -1,8 +1,8 @@
from __future__ import absolute_import

from collections import Mapping, namedtuple, Sequence, Set
from collections import namedtuple

from cerberus.platform import _int_types, _str_type
from cerberus.platform import _int_types, _str_type, Mapping, Sequence, Set


TypeDefinition = namedtuple('TypeDefinition', 'name,included_types,excluded_types')
Expand Down
13 changes: 10 additions & 3 deletions cerberus/validator.py
Expand Up @@ -11,14 +11,22 @@
from __future__ import absolute_import

from ast import literal_eval
from collections import Container, Hashable, Iterable, Mapping, Sequence, Sized
from copy import copy
from datetime import date, datetime
import re
from warnings import warn

from cerberus import errors
from cerberus.platform import _int_types, _str_type
from cerberus.platform import (
_int_types,
_str_type,
Container,
Hashable,
Iterable,
Mapping,
Sequence,
Sized,
)
from cerberus.schema import (
schema_registry,
rules_set_registry,
Expand All @@ -27,7 +35,6 @@
)
from cerberus.utils import drop_item_from_tuple, readonly_classproperty, TypeDefinition


toy_error_handler = errors.ToyErrorHandler()


Expand Down
1 change: 1 addition & 0 deletions setup.py
Expand Up @@ -46,6 +46,7 @@
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: Implementation :: CPython',
'Programming Language :: Python :: Implementation :: PyPy',
],
Expand Down
6 changes: 3 additions & 3 deletions tox.ini
@@ -1,5 +1,5 @@
[tox]
envlist=py27,py34,py35,py36,pypy,pypy3,doclinks,doctest,linting
envlist=py27,py34,py35,py36,py37,pypy,pypy3,doclinks,doctest,linting

[testenv]
deps=pytest
Expand All @@ -20,7 +20,6 @@ commands=make doctest

[testenv:linting]
skipsdist=True
basepython=python3.6
deps=pre-commit
commands=pre-commit run --config .linting-config.yaml --all-files

Expand All @@ -32,6 +31,7 @@ ignore=E203,W503
2.7 = py27
3.4 = py34
3.5 = py35
3.6 = py36,doclinks,doctest,linting
3.6 = py36
3.7 = py37,doclinks,doctest,linting
pypy = pypy
pypy3 = pypy3

0 comments on commit 0eb908a

Please sign in to comment.