commit 20f4461283e7c0ac3cb5581ce392d3b15532b93920d9f353d729f60465d2897b Author: Dirk Mueller Date: Mon Oct 28 22:50:47 2024 +0000 - update to 0.7.7: * type hints * fix: Fix setuptools not finding the schema package - drop remove-old-python-support.patch (upstream) OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-schema?expand=0&rev=15 diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..9b03811 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,23 @@ +## Default LFS +*.7z filter=lfs diff=lfs merge=lfs -text +*.bsp filter=lfs diff=lfs merge=lfs -text +*.bz2 filter=lfs diff=lfs merge=lfs -text +*.gem filter=lfs diff=lfs merge=lfs -text +*.gz filter=lfs diff=lfs merge=lfs -text +*.jar filter=lfs diff=lfs merge=lfs -text +*.lz filter=lfs diff=lfs merge=lfs -text +*.lzma filter=lfs diff=lfs merge=lfs -text +*.obscpio filter=lfs diff=lfs merge=lfs -text +*.oxt filter=lfs diff=lfs merge=lfs -text +*.pdf filter=lfs diff=lfs merge=lfs -text +*.png filter=lfs diff=lfs merge=lfs -text +*.rpm filter=lfs diff=lfs merge=lfs -text +*.tbz filter=lfs diff=lfs merge=lfs -text +*.tbz2 filter=lfs diff=lfs merge=lfs -text +*.tgz filter=lfs diff=lfs merge=lfs -text +*.ttf filter=lfs diff=lfs merge=lfs -text +*.txz filter=lfs diff=lfs merge=lfs -text +*.whl filter=lfs diff=lfs merge=lfs -text +*.xz filter=lfs diff=lfs merge=lfs -text +*.zip filter=lfs diff=lfs merge=lfs -text +*.zst filter=lfs diff=lfs merge=lfs -text diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..57affb6 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.osc diff --git a/python-schema.changes b/python-schema.changes new file mode 100644 index 0000000..6ec6700 --- /dev/null +++ b/python-schema.changes @@ -0,0 +1,76 @@ +------------------------------------------------------------------- +Mon Oct 28 22:48:53 UTC 2024 - Dirk Müller + +- update to 0.7.7: + * type hints + * fix: Fix setuptools not finding the schema package +- drop remove-old-python-support.patch (upstream) + +------------------------------------------------------------------- +Thu Aug 11 05:40:14 UTC 2022 - Steve Kowalik + +- Drop patch python-schema-no-mock.patch: + * Replaced by the below path. +- Add patch remove-old-python-support.patch: + * Remove support for old Python versions as well mock and contextlib2. +- Clean up {Build,}Requires as a result. + +------------------------------------------------------------------- +Wed May 4 09:07:11 UTC 2022 - pgajdos@suse.com + +- version update to 0.7.5 + * Full subclass support for nested schemas. + * Don't double-format errors. fixes #240 (#247) [Leif Ryge] + * Fix "Unknown format code" in Python 3.8 (#245) [Denis Blanchette] + * JSON Schema: Allow using $ref when schema is not a dict (#244) [Denis Blanchette] + * JSON Schema: Set additionalProperties true when dict contains str as key (#243) [Denis Blanchette] +- do not require python-mock for build +- added patches + fix https://github.com/keleshev/schema/pull/273 + + python-schema-no-mock.patch + +------------------------------------------------------------------- +Thu Sep 10 12:17:04 UTC 2020 - Antonio Larrosa + +- Update to 0.7.3 + * JSON Schema: Support schemas where the root is not a dict. + * Do not drop previous errors within an Or criterion. + +- Update to 0.7.2 + * Set the contextlib dependency as a minimum, rather than fixed. + +------------------------------------------------------------------- +Thu Mar 26 12:29:02 UTC 2020 - Marketa Calabkova + +- update to 0.7.1 + * JSON Schema: Fix allOf and oneOf with only one condition + * JSON Schema: Fix using falsy values as default + * Add 3.7 to "schema is tested with..." list + * JSON schema now rendering using references + +------------------------------------------------------------------- +Tue Mar 26 16:29:04 UTC 2019 - pgajdos@suse.com + +- version update to 0.7.0 + * Add an is_valid method to the schema + * Fix typo in schema.py: vaidated->validated + * Fix callable check under PyPy2 + +------------------------------------------------------------------- +Tue Dec 4 12:54:17 UTC 2018 - Matej Cepl + +- Remove superfluous devel dependency for noarch package + +------------------------------------------------------------------- +Tue May 15 18:39:20 UTC 2018 - toddrme2178@gmail.com + +- Update to 0.6.7 + * Implement Const validator to keep data unchanged + * Implement Forbidden. + * added __hash__ and __eq__ based on sub-schema to Optional +- Use license tag + +------------------------------------------------------------------- +Fri Oct 20 16:18:26 UTC 2017 - toddrme2178@gmail.com + +- initial version diff --git a/python-schema.spec b/python-schema.spec new file mode 100644 index 0000000..01dd78b --- /dev/null +++ b/python-schema.spec @@ -0,0 +1,63 @@ +# +# spec file for package python-schema +# +# Copyright (c) 2024 SUSE LLC +# +# All modifications and additions to the file contributed by third parties +# remain the property of their copyright owners, unless otherwise agreed +# upon. The license for this file, and modifications and additions to the +# file, is the same license as for the pristine package itself (unless the +# license for the pristine package is not an Open Source License, in which +# case the license is the MIT License). An "Open Source License" is a +# license that conforms to the Open Source Definition (Version 1.9) +# published by the Open Source Initiative. + +# Please submit bugfixes or comments via https://bugs.opensuse.org/ +# + + +%{?!python_module:%define python_module() python-%{**} python3-%{**}} +Name: python-schema +Version: 0.7.7 +Release: 0 +Summary: Data validation library +License: MIT +URL: https://github.com/keleshev/schema +Source: https://files.pythonhosted.org/packages/source/s/schema/schema-%{version}.tar.gz +BuildRequires: %{python_module pip} +BuildRequires: %{python_module setuptools} +BuildRequires: %{python_module wheel} +BuildRequires: fdupes +BuildRequires: python-rpm-macros +# SECTION test requirements +BuildRequires: %{python_module pytest} +# /SECTION +BuildArch: noarch + +%python_subpackages + +%description +Schema is a library for validating Python data structures, such as those +obtained from config-files, forms, external services or command-line +parsing, converted from JSON/YAML (or something else) to Python data-types. + +%prep +%autosetup -p1 -n schema-%{version} + +%build +%python_build + +%install +%python_install +%python_expand %fdupes %{buildroot}%{$python_sitelib} + +%check +%pytest test_schema.py + +%files %{python_files} +%defattr(-,root,root,-) +%doc README.rst +%license LICENSE-MIT +%{python_sitelib}/* + +%changelog diff --git a/remove-old-python-support.patch b/remove-old-python-support.patch new file mode 100644 index 0000000..0e59b31 --- /dev/null +++ b/remove-old-python-support.patch @@ -0,0 +1,225 @@ +From 1d763dc281f5cc056ffa3f6ff9257f2650c76184 Mon Sep 17 00:00:00 2001 +From: Davide +Date: Thu, 30 Dec 2021 09:53:38 +0100 +Subject: [PATCH] Drop support for obsolete python versions + +--- + .travis.yml | 8 ++------ + MANIFEST.in | 2 +- + requirements.txt | 1 - + schema.py | 9 ++------- + setup.py | 8 +------- + test_schema.py | 21 +++++++-------------- + tox.ini | 5 +---- + 7 files changed, 14 insertions(+), 40 deletions(-) + delete mode 100644 requirements.txt + +diff --git a/.travis.yml b/.travis.yml +index fe44745..8397a51 100644 +--- a/.travis.yml ++++ b/.travis.yml +@@ -4,12 +4,6 @@ language: python + + jobs: + include: +- - env: TOXENV=py27 +- python: 2.7 +- - env: TOXENV=py34 +- python: 3.4 +- - env: TOXENV=py35 +- python: 3.5 + - env: TOXENV=py36 + python: 3.6 + - env: TOXENV=py37 +@@ -18,6 +12,8 @@ jobs: + python: 3.8 + - env: TOXENV=py39 + python: 3.9 ++ - env: TOXENV=py310 ++ python: '3.10' + - env: TOXENV=coverage + python: 3.8 + - env: TOXENV=checks +diff --git a/MANIFEST.in b/MANIFEST.in +index 1de575e..c983463 100644 +--- a/MANIFEST.in ++++ b/MANIFEST.in +@@ -1 +1 @@ +-include README.rst requirements.txt LICENSE-MIT *.py ++include README.rst LICENSE-MIT *.py +diff --git a/requirements.txt b/requirements.txt +deleted file mode 100644 +index 22f593a..0000000 +--- a/requirements.txt ++++ /dev/null +@@ -1 +0,0 @@ +-contextlib2>=0.5.5 +diff --git a/schema.py b/schema.py +index 37b0fb1..fc4c561 100644 +--- a/schema.py ++++ b/schema.py +@@ -4,12 +4,7 @@ + + import inspect + import re +- +-try: +- from contextlib import ExitStack +-except ImportError: +- from contextlib2 import ExitStack +- ++from contextlib import ExitStack + + __version__ = "0.7.5" + __all__ = [ +@@ -252,7 +247,7 @@ def validate(self, data, **kwargs): + raise SchemaError("%s(%r) raised %r" % (f, data, x), self._error.format(data) if self._error else None) + + +-COMPARABLE, CALLABLE, VALIDATOR, TYPE, DICT, ITERABLE = range(6) ++COMPARABLE, CALLABLE, VALIDATOR, TYPE, DICT, ITERABLE = list(range(6)) + + + def _priority(s): +diff --git a/setup.py b/setup.py +index 9b2802d..6202884 100644 +--- a/setup.py ++++ b/setup.py +@@ -25,20 +25,14 @@ + py_modules=["schema"], + long_description=codecs.open("README.rst", "r", "utf-8").read(), + long_description_content_type="text/x-rst", +- install_requires=open("requirements.txt", "r").read().split("\n"), + classifiers=[ + "Development Status :: 3 - Alpha", + "Topic :: Utilities", +- "Programming Language :: Python :: 2.6", +- "Programming Language :: Python :: 2.7", +- "Programming Language :: Python :: 3.2", +- "Programming Language :: Python :: 3.3", +- "Programming Language :: Python :: 3.4", +- "Programming Language :: Python :: 3.5", + "Programming Language :: Python :: 3.6", + "Programming Language :: Python :: 3.7", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", ++ "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: Implementation :: PyPy", + "License :: OSI Approved :: MIT License", + ], +diff --git a/test_schema.py b/test_schema.py +index 370298a..75ef098 100644 +--- a/test_schema.py ++++ b/test_schema.py +@@ -1,5 +1,3 @@ +-from __future__ import with_statement +- + import copy + import json + import os +@@ -9,8 +7,8 @@ + from collections import defaultdict, namedtuple + from functools import partial + from operator import methodcaller ++from unittest.mock import Mock + +-from mock import Mock + from pytest import mark, raises + + from schema import ( +@@ -31,11 +29,6 @@ + Use, + ) + +-if sys.version_info[0] == 3: +- basestring = str # Python 3 does not have basestring +- unicode = str # Python 3 does not have unicode +- +- + SE = raises(SchemaError) + + +@@ -150,7 +143,7 @@ def unique_list(_list): + return len(_list) == len(set(_list)) + + def dict_keys(key, _list): +- return list(map(lambda d: d[key], _list)) ++ return list([d[key] for d in _list]) + + schema = Schema(Const(And(Use(partial(dict_keys, "index")), unique_list))) + data = [{"index": 1, "value": "foo"}, {"index": 2, "value": "bar"}] +@@ -194,7 +187,7 @@ def test_regex(): + + # Validate that the pattern has a buffer interface + assert Regex(re.compile(r"foo")).validate("foo") == "foo" +- assert Regex(unicode("foo")).validate("foo") == "foo" ++ assert Regex(str("foo")).validate("foo") == "foo" + with raises(TypeError): + Regex(1).validate("bar") + with raises(TypeError): +@@ -353,7 +346,7 @@ def test_dict_optional_keys(): + assert Schema({"a": 1, Optional("b"): 2}).validate({"a": 1}) == {"a": 1} + assert Schema({"a": 1, Optional("b"): 2}).validate({"a": 1, "b": 2}) == {"a": 1, "b": 2} + # Make sure Optionals are favored over types: +- assert Schema({basestring: 1, Optional("b"): 2}).validate({"a": 1, "b": 2}) == {"a": 1, "b": 2} ++ assert Schema({str: 1, Optional("b"): 2}).validate({"a": 1, "b": 2}) == {"a": 1, "b": 2} + # Make sure Optionals hash based on their key: + assert len({Optional("a"): 1, Optional("a"): 1, Optional("b"): 2}) == 2 + +@@ -364,7 +357,7 @@ def test_dict_optional_defaults(): + + # Optionals take precedence over types. Here, the "a" is served by the + # Optional: +- assert Schema({Optional("a", default=1): 11, basestring: 22}).validate({"b": 22}) == {"a": 1, "b": 22} ++ assert Schema({Optional("a", default=1): 11, str: 22}).validate({"b": 22}) == {"a": 1, "b": 22} + + with raises(TypeError): + Optional(And(str, Use(int)), default=7) +@@ -529,7 +522,7 @@ def test_use_json(): + gist_schema = Schema( + And( + Use(json.loads), # first convert from JSON +- {Optional("description"): basestring, "public": bool, "files": {basestring: {"content": basestring}}}, ++ {Optional("description"): str, "public": bool, "files": {str: {"content": str}}}, + ) + ) + gist = """{"description": "the description for this gist", +@@ -667,7 +660,7 @@ def test_optional_key_convert_failed_randomly_while_with_another_optional_object + Optional("created_at"): _datetime_validator, + Optional("updated_at"): _datetime_validator, + Optional("birth"): _datetime_validator, +- Optional(basestring): object, ++ Optional(str): object, + } + ) + data = {"created_at": "2015-10-10 00:00:00"} +diff --git a/tox.ini b/tox.ini +index 74f2d71..c542ea7 100644 +--- a/tox.ini ++++ b/tox.ini +@@ -4,19 +4,17 @@ + # install tox" and then run "tox" from this directory. + + [tox] +-envlist = py26, py27, py32, py33, py34, py35, py36, py37, py38, py39, pypy3, coverage, checks ++envlist = py36, py37, py38, py39, py310, pypy3, coverage, checks + + [testenv] + commands = py.test + recreate = true + deps = pytest +- mock + + + [testenv:py38] + commands = py.test --doctest-glob=README.rst # test documentation + deps = pytest +- mock + + [testenv:checks] + basepython=python3 +@@ -31,4 +29,3 @@ commands = coverage erase + deps = pytest + pytest-cov + coverage +- mock diff --git a/schema-0.7.5.tar.gz b/schema-0.7.5.tar.gz new file mode 100644 index 0000000..2fef71f --- /dev/null +++ b/schema-0.7.5.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f06717112c61895cabc4707752b88716e8420a8819d71404501e114f91043197 +size 48173 diff --git a/schema-0.7.7.tar.gz b/schema-0.7.7.tar.gz new file mode 100644 index 0000000..1ca957c --- /dev/null +++ b/schema-0.7.7.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7da553abd2958a19dc2547c388cde53398b39196175a9be59ea1caf5ab0a1807 +size 44245