Hello community,
here is the log from the commit of package python-voluptuous for
openSUSE:Factory checked in at 2019-09-02 12:44:50
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-voluptuous (Old)
and /work/SRC/openSUSE:Factory/.python-voluptuous.new.7948 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-voluptuous"
Mon Sep 2 12:44:50 2019 rev:6 rq:726268 version:0.11.7
Changes:
--------
--- /work/SRC/openSUSE:Factory/python-voluptuous/python-voluptuous.changes
2018-08-10 09:48:54.714186232 +0200
+++
/work/SRC/openSUSE:Factory/.python-voluptuous.new.7948/python-voluptuous.changes
2019-09-02 12:44:52.421752398 +0200
@@ -1,0 +2,13 @@
+Mon Aug 26 11:41:09 UTC 2019 - Antonio Larrosa <[email protected]>
+
+- Update to 0.11.7:
+ * #378: Allow extend() of a Schema to return a subclass of a Schema as well.
+ * #364: Accept description for Inclusive instances.
+ * #373: Accept msg for Maybe instances.
+ * #382: Added support for default values in Inclusive instances.
+ * #371: Fixed DeprecationWarning related to collections.Mapping.
+ * #377: Preserve Unicode strings when passed to utility functions
+ (e.g., Lower(), Upper()).
+ * #380: Fixed regression with Any and required flag.
+
+-------------------------------------------------------------------
Old:
----
voluptuous-0.11.5.tar.gz
New:
----
voluptuous-0.11.7.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ python-voluptuous.spec ++++++
--- /var/tmp/diff_new_pack.PPxkiX/_old 2019-09-02 12:44:52.849752321 +0200
+++ /var/tmp/diff_new_pack.PPxkiX/_new 2019-09-02 12:44:52.849752321 +0200
@@ -1,7 +1,7 @@
#
# spec file for package python-voluptuous
#
-# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany.
+# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@@ -12,13 +12,13 @@
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
-# Please submit bugfixes or comments via http://bugs.opensuse.org/
+# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
Name: python-voluptuous
-Version: 0.11.5
+Version: 0.11.7
Release: 0
Summary: A Python data validation library
License: BSD-3-Clause
++++++ voluptuous-0.11.5.tar.gz -> voluptuous-0.11.7.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/voluptuous-0.11.5/CHANGELOG.md
new/voluptuous-0.11.7/CHANGELOG.md
--- old/voluptuous-0.11.5/CHANGELOG.md 2018-02-15 10:11:22.000000000 +0100
+++ new/voluptuous-0.11.7/CHANGELOG.md 2019-08-13 04:17:50.000000000 +0200
@@ -1,6 +1,49 @@
# Changelog
-## [0.11.0]
+## [0.11.7]
+
+**Changes**
+
+- [#378](https://github.com/alecthomas/voluptuous/pull/378): Allow `extend()`
of a `Schema` to return a subclass of a `Schema` as well.
+
+**New**:
+
+- [#364](https://github.com/alecthomas/voluptuous/pull/364): Accept
`description` for `Inclusive` instances.
+- [#373](https://github.com/alecthomas/voluptuous/pull/373): Accept `msg` for
`Maybe` instances.
+- [#382](https://github.com/alecthomas/voluptuous/pull/382): Added support for
default values in `Inclusive` instances.
+
+**Fixes**:
+
+- [#371](https://github.com/alecthomas/voluptuous/pull/371): Fixed
`DeprecationWarning` related to `collections.Mapping`.
+- [#377](https://github.com/alecthomas/voluptuous/pull/377): Preserve Unicode
strings when passed to utility functions (e.g., `Lower()`, `Upper()`).
+- [#380](https://github.com/alecthomas/voluptuous/pull/380): Fixed regression
with `Any` and `required` flag.
+
+## [0.11.5]
+
+- Fixed issue with opening README file in `setup.py`.
+
+## [0.11.4]
+
+- Removed use of `pypandoc` as Markdown is now supported by `setup()`.
+
+## [0.11.3] and [0.11.2]
+
+**Changes**:
+
+- [#349](https://github.com/alecthomas/voluptuous/pull/349): Support Python
3.7.
+- [#343](https://github.com/alecthomas/voluptuous/pull/343): Drop support for
Python 3.3.
+
+**New**:
+
+- [#342](https://github.com/alecthomas/voluptuous/pull/342): Add support for
sets and frozensets.
+
+**Fixes**:
+
+- [#332](https://github.com/alecthomas/voluptuous/pull/332): Fix Python 3.x
compatibility for setup.py when `pypandoc` is installed.
+- [#348](https://github.com/alecthomas/voluptuous/pull/348): Include path in
`AnyInvalid` errors.
+- [#351](https://github.com/alecthomas/voluptuous/pull/351): Fix `Date`
behaviour when a custom format is specified.
+
+## [0.11.1] and [0.11.0]
**Changes**:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/voluptuous-0.11.5/PKG-INFO
new/voluptuous-0.11.7/PKG-INFO
--- old/voluptuous-0.11.5/PKG-INFO 2018-08-01 05:15:06.000000000 +0200
+++ new/voluptuous-0.11.7/PKG-INFO 2019-08-13 04:18:18.000000000 +0200
@@ -1,6 +1,6 @@
Metadata-Version: 2.1
Name: voluptuous
-Version: 0.11.5
+Version: 0.11.7
Summary: # Voluptuous is a Python data validation library
Home-page: https://github.com/alecthomas/voluptuous
Author: Alec Thomas
@@ -9,8 +9,8 @@
Download-URL: https://pypi.python.org/pypi/voluptuous
Description: # Voluptuous is a Python data validation library
- [](https://travis-ci.org/alecthomas/voluptuous)
- [](https://coveralls.io/github/alecthomas/voluptuous?branch=master)
[](https://gitter.im/alecthomas/Lobby)
+ [](https://travis-ci.org/alecthomas/voluptuous)
+ [](https://coveralls.io/github/alecthomas/voluptuous?branch=master)
[](https://gitter.im/alecthomas/Lobby)
Voluptuous, *despite* the name, is a Python data validation library. It
is primarily intended for validating data coming into Python as JSON,
@@ -198,9 +198,9 @@
```
- ### URL's
+ ### URLs
- URL's in the schema are matched by using `urlparse` library.
+ URLs in the schema are matched by using `urlparse` library.
```pycon
>>> from voluptuous import Url
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/voluptuous-0.11.5/README.md
new/voluptuous-0.11.7/README.md
--- old/voluptuous-0.11.5/README.md 2018-07-27 10:45:00.000000000 +0200
+++ new/voluptuous-0.11.7/README.md 2019-08-13 04:10:58.000000000 +0200
@@ -1,7 +1,7 @@
# Voluptuous is a Python data validation library
-[](https://travis-ci.org/alecthomas/voluptuous)
-[](https://coveralls.io/github/alecthomas/voluptuous?branch=master)
[](https://gitter.im/alecthomas/Lobby)
+[](https://travis-ci.org/alecthomas/voluptuous)
+[](https://coveralls.io/github/alecthomas/voluptuous?branch=master)
[](https://gitter.im/alecthomas/Lobby)
Voluptuous, *despite* the name, is a Python data validation library. It
is primarily intended for validating data coming into Python as JSON,
@@ -189,9 +189,9 @@
```
-### URL's
+### URLs
-URL's in the schema are matched by using `urlparse` library.
+URLs in the schema are matched by using `urlparse` library.
```pycon
>>> from voluptuous import Url
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/voluptuous-0.11.5/voluptuous/__init__.py
new/voluptuous-0.11.7/voluptuous/__init__.py
--- old/voluptuous-0.11.5/voluptuous/__init__.py 2018-08-01
05:14:15.000000000 +0200
+++ new/voluptuous-0.11.7/voluptuous/__init__.py 2019-08-13
04:17:30.000000000 +0200
@@ -5,5 +5,5 @@
from voluptuous.util import *
from voluptuous.error import *
-__version__ = '0.11.5'
+__version__ = '0.11.7'
__author__ = 'alecthomas'
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/voluptuous-0.11.5/voluptuous/schema_builder.py
new/voluptuous-0.11.7/voluptuous/schema_builder.py
--- old/voluptuous-0.11.5/voluptuous/schema_builder.py 2018-07-27
10:45:01.000000000 +0200
+++ new/voluptuous-0.11.7/voluptuous/schema_builder.py 2019-08-13
04:10:58.000000000 +0200
@@ -22,6 +22,11 @@
def iteritems(d):
return d.iteritems()
+if sys.version_info >= (3, 3):
+ _Mapping = collections.abc.Mapping
+else:
+ _Mapping = collections.Mapping
+
"""Schema validation for Python data structures.
Given eg. a nested data structure like this:
@@ -280,7 +285,7 @@
return schema.__voluptuous_compile__(self)
if isinstance(schema, Object):
return self._compile_object(schema)
- if isinstance(schema, collections.Mapping):
+ if isinstance(schema, _Mapping):
return self._compile_dict(schema)
elif isinstance(schema, list):
return self._compile_list(schema)
@@ -771,9 +776,10 @@
result[key] = value
# recompile and send old object
+ result_cls = type(self)
result_required = (required if required is not None else self.required)
result_extra = (extra if extra is not None else self.extra)
- return Schema(result, required=result_required, extra=result_extra)
+ return result_cls(result, required=result_required, extra=result_extra)
def _compile_scalar(schema):
@@ -1121,8 +1127,11 @@
True
"""
- def __init__(self, schema, group_of_inclusion, msg=None):
- super(Inclusive, self).__init__(schema, msg=msg)
+ def __init__(self, schema, group_of_inclusion,
+ msg=None, description=None, default=UNDEFINED):
+ super(Inclusive, self).__init__(schema, msg=msg,
+ default=default,
+ description=description)
self.group_of_inclusion = group_of_inclusion
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/voluptuous-0.11.5/voluptuous/tests/tests.py
new/voluptuous-0.11.7/voluptuous/tests/tests.py
--- old/voluptuous-0.11.5/voluptuous/tests/tests.py 2018-07-27
10:45:01.000000000 +0200
+++ new/voluptuous-0.11.7/voluptuous/tests/tests.py 2019-08-13
04:10:58.000000000 +0200
@@ -6,14 +6,14 @@
from nose.tools import assert_equal, assert_false, assert_raises, assert_true
from voluptuous import (
- Schema, Required, Exclusive, Optional, Extra, Invalid, In, Remove, Literal,
- Url, MultipleInvalid, LiteralInvalid, TypeInvalid, NotIn, Match, Email,
+ Schema, Required, Exclusive, Inclusive, Optional, Extra, Invalid, In,
Remove,
+ Literal, Url, MultipleInvalid, LiteralInvalid, TypeInvalid, NotIn, Match,
Email,
Replace, Range, Coerce, All, Any, Length, FqdnUrl, ALLOW_EXTRA,
PREVENT_EXTRA,
validate, ExactSequence, Equal, Unordered, Number, Maybe, Datetime, Date,
Contains, Marker, IsDir, IsFile, PathExists, SomeOf, TooManyValid, Self,
raises)
from voluptuous.humanize import humanize_error
-from voluptuous.util import u
+from voluptuous.util import u, Capitalize, Lower, Strip, Title, Upper
def test_exact_sequence():
@@ -372,6 +372,7 @@
assert extended.schema == {'a': int, 'b': str}
assert extended.required == base.required
assert extended.extra == base.extra
+ assert isinstance(extended, Schema)
def test_schema_extend_overrides():
@@ -411,6 +412,20 @@
assert_equal(extended.schema, {'a': {'b': str, 'c': float, 'e': int}, 'd':
str})
+def test_schema_extend_handles_schema_subclass():
+ """Verify that Schema.extend handles a subclass of Schema"""
+ class S(Schema):
+ pass
+
+ base = S({Required('a'): int})
+ extension = {Optional('b'): str}
+ extended = base.extend(extension)
+
+ expected_schema = {Required('a'): int, Optional('b'): str}
+ assert extended.schema == expected_schema
+ assert isinstance(extended, S)
+
+
def test_equality():
assert_equal(Schema('foo'), Schema('foo'))
@@ -624,6 +639,12 @@
assert_raises(Invalid, s, {'foo': 'bar'})
+def test_maybe_accepts_msg():
+ s = Schema(Maybe(int, msg='int or None expected'))
+ with raises(MultipleInvalid, 'int or None expected'):
+ assert s([])
+
+
def test_empty_list_as_exact():
s = Schema([])
assert_raises(Invalid, s, [1])
@@ -1035,6 +1056,9 @@
exclusive = Exclusive('alpha', 'angles', description='Hello')
assert exclusive.description == 'Hello'
+ inclusive = Inclusive('alpha', 'angles', description='Hello')
+ assert inclusive.description == 'Hello'
+
required = Required('key', description='Hello')
assert required.description == 'Hello'
@@ -1263,3 +1287,122 @@
assert_equal(str(e), "invalid value in frozenset")
else:
assert False, "Did not raise Invalid"
+
+
+def test_lower_util_handles_various_inputs():
+ assert Lower(3) == "3"
+ assert Lower(u"3") == u"3"
+ assert Lower(b'\xe2\x98\x83'.decode("UTF-8")) ==
b'\xe2\x98\x83'.decode("UTF-8")
+ assert Lower(u"A") == u"a"
+
+
+def test_upper_util_handles_various_inputs():
+ assert Upper(3) == "3"
+ assert Upper(u"3") == u"3"
+ assert Upper(b'\xe2\x98\x83'.decode("UTF-8")) ==
b'\xe2\x98\x83'.decode("UTF-8")
+ assert Upper(u"a") == u"A"
+
+
+def test_capitalize_util_handles_various_inputs():
+ assert Capitalize(3) == "3"
+ assert Capitalize(u"3") == u"3"
+ assert Capitalize(b'\xe2\x98\x83'.decode("UTF-8")) ==
b'\xe2\x98\x83'.decode("UTF-8")
+ assert Capitalize(u"aaa aaa") == u"Aaa aaa"
+
+
+def test_title_util_handles_various_inputs():
+ assert Title(3) == "3"
+ assert Title(u"3") == u"3"
+ assert Title(b'\xe2\x98\x83'.decode("UTF-8")) ==
b'\xe2\x98\x83'.decode("UTF-8")
+ assert Title(u"aaa aaa") == u"Aaa Aaa"
+
+
+def test_strip_util_handles_various_inputs():
+ assert Strip(3) == "3"
+ assert Strip(u"3") == u"3"
+ assert Strip(b'\xe2\x98\x83'.decode("UTF-8")) ==
b'\xe2\x98\x83'.decode("UTF-8")
+ assert Strip(u" aaa ") == u"aaa"
+
+
+def test_any_required():
+ schema = Schema(Any({'a': int}, {'b': str}, required=True))
+
+ try:
+ schema({})
+ except MultipleInvalid as e:
+ assert_equal(str(e),
+ "required key not provided @ data['a']")
+ else:
+ assert False, "Did not raise Invalid for MultipleInvalid"
+
+
+def test_any_required_with_subschema():
+ schema = Schema(Any({'a': Any(float, int)},
+ {'b': int},
+ {'c': {'aa': int}},
+ required=True))
+
+ try:
+ schema({})
+ except MultipleInvalid as e:
+ assert_equal(str(e),
+ "required key not provided @ data['a']")
+ else:
+ assert False, "Did not raise Invalid for MultipleInvalid"
+
+def test_inclusive():
+ schema = Schema({
+ Inclusive('x', 'stuff'): int,
+ Inclusive('y', 'stuff'): int,
+ })
+
+ r = schema({})
+ assert_equal(r, {})
+
+ r = schema({'x':1, 'y':2})
+ assert_equal(r, {'x':1, 'y':2})
+
+ try:
+ r = schema({'x':1})
+ except MultipleInvalid as e:
+ assert_equal(str(e),
+ "some but not all values in the same group of inclusion
'stuff' @ data[<stuff>]")
+ else:
+ assert False, "Did not raise Invalid for incomplete Inclusive group"
+
+def test_inclusive_defaults():
+ schema = Schema({
+ Inclusive('x', 'stuff', default=3): int,
+ Inclusive('y', 'stuff', default=4): int,
+ })
+
+ r = schema({})
+ assert_equal(r, {'x':3, 'y':4})
+
+ try:
+ r = schema({'x':1})
+ except MultipleInvalid as e:
+ assert_equal(str(e),
+ "some but not all values in the same group of inclusion
'stuff' @ data[<stuff>]")
+ else:
+ assert False, "Did not raise Invalid for incomplete Inclusive group
with defaults"
+
+def test_exclusive():
+ schema = Schema({
+ Exclusive('x', 'stuff'): int,
+ Exclusive('y', 'stuff'): int,
+ })
+
+ r = schema({})
+ assert_equal(r, {})
+
+ r = schema({'x':1})
+ assert_equal(r, {'x':1})
+
+ try:
+ r = schema({'x':1, 'y': 2})
+ except MultipleInvalid as e:
+ assert_equal(str(e),
+ "two or more values in the same group of exclusion
'stuff' @ data[<stuff>]")
+ else:
+ assert False, "Did not raise Invalid for multiple values in Exclusive
group"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/voluptuous-0.11.5/voluptuous/util.py
new/voluptuous-0.11.7/voluptuous/util.py
--- old/voluptuous-0.11.5/voluptuous/util.py 2018-02-15 10:09:42.000000000
+0100
+++ new/voluptuous-0.11.7/voluptuous/util.py 2019-08-13 04:10:58.000000000
+0200
@@ -7,6 +7,14 @@
__author__ = 'tusharmakkar08'
+def _fix_str(v):
+ if sys.version_info[0] == 2 and isinstance(v, unicode):
+ s = v
+ else:
+ s = str(v)
+ return s
+
+
def Lower(v):
"""Transform a string to lower case.
@@ -14,7 +22,7 @@
>>> s('HI')
'hi'
"""
- return str(v).lower()
+ return _fix_str(v).lower()
def Upper(v):
@@ -24,7 +32,7 @@
>>> s('hi')
'HI'
"""
- return str(v).upper()
+ return _fix_str(v).upper()
def Capitalize(v):
@@ -34,7 +42,7 @@
>>> s('hello world')
'Hello world'
"""
- return str(v).capitalize()
+ return _fix_str(v).capitalize()
def Title(v):
@@ -44,7 +52,7 @@
>>> s('hello world')
'Hello World'
"""
- return str(v).title()
+ return _fix_str(v).title()
def Strip(v):
@@ -54,7 +62,7 @@
>>> s(' hello world ')
'hello world'
"""
- return str(v).strip()
+ return _fix_str(v).strip()
class DefaultTo(object):
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/voluptuous-0.11.5/voluptuous/validators.py
new/voluptuous-0.11.7/voluptuous/validators.py
--- old/voluptuous-0.11.5/voluptuous/validators.py 2018-07-27
10:45:01.000000000 +0200
+++ new/voluptuous-0.11.7/voluptuous/validators.py 2019-08-13
04:10:58.000000000 +0200
@@ -192,12 +192,13 @@
def __init__(self, *validators, **kwargs):
self.validators = validators
self.msg = kwargs.pop('msg', None)
+ self.required = kwargs.pop('required', False)
def __voluptuous_compile__(self, schema):
- self._compiled = [
- schema._compile(v)
- for v in self.validators
- ]
+ self._compiled = []
+ for v in self.validators:
+ schema.required = self.required
+ self._compiled.append(schema._compile(v))
return self._run
def _run(self, path, value):
@@ -487,7 +488,7 @@
raise PathInvalid("Not a Path")
-def Maybe(validator):
+def Maybe(validator, msg=None):
"""Validate that the object matches given validator or is None.
:raises Invalid: if the value does not match the given validator and is not
@@ -500,7 +501,7 @@
... s("string")
"""
- return Any(None, validator)
+ return Any(None, validator, msg=msg)
class Range(object):
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/voluptuous-0.11.5/voluptuous.egg-info/PKG-INFO
new/voluptuous-0.11.7/voluptuous.egg-info/PKG-INFO
--- old/voluptuous-0.11.5/voluptuous.egg-info/PKG-INFO 2018-08-01
05:15:06.000000000 +0200
+++ new/voluptuous-0.11.7/voluptuous.egg-info/PKG-INFO 2019-08-13
04:18:17.000000000 +0200
@@ -1,6 +1,6 @@
Metadata-Version: 2.1
Name: voluptuous
-Version: 0.11.5
+Version: 0.11.7
Summary: # Voluptuous is a Python data validation library
Home-page: https://github.com/alecthomas/voluptuous
Author: Alec Thomas
@@ -9,8 +9,8 @@
Download-URL: https://pypi.python.org/pypi/voluptuous
Description: # Voluptuous is a Python data validation library
- [](https://travis-ci.org/alecthomas/voluptuous)
- [](https://coveralls.io/github/alecthomas/voluptuous?branch=master)
[](https://gitter.im/alecthomas/Lobby)
+ [](https://travis-ci.org/alecthomas/voluptuous)
+ [](https://coveralls.io/github/alecthomas/voluptuous?branch=master)
[](https://gitter.im/alecthomas/Lobby)
Voluptuous, *despite* the name, is a Python data validation library. It
is primarily intended for validating data coming into Python as JSON,
@@ -198,9 +198,9 @@
```
- ### URL's
+ ### URLs
- URL's in the schema are matched by using `urlparse` library.
+ URLs in the schema are matched by using `urlparse` library.
```pycon
>>> from voluptuous import Url