Hello community, here is the log from the commit of package python-cfgv for openSUSE:Factory checked in at 2020-03-31 17:17:35 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-cfgv (Old) and /work/SRC/openSUSE:Factory/.python-cfgv.new.3160 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-cfgv" Tue Mar 31 17:17:35 2020 rev:4 rq:790114 version:3.1.0 Changes: -------- --- /work/SRC/openSUSE:Factory/python-cfgv/python-cfgv.changes 2019-07-26 17:35:20.108065297 +0200 +++ /work/SRC/openSUSE:Factory/.python-cfgv.new.3160/python-cfgv.changes 2020-03-31 17:17:41.023720512 +0200 @@ -1,0 +2,6 @@ +Mon Mar 30 13:55:49 UTC 2020 - Marketa Calabkova <mcalabk...@suse.com> + +- update to version 3.1.0 + * cfgv: python3.6+ + +------------------------------------------------------------------- Old: ---- cfgv-2.0.1.tar.gz New: ---- cfgv-3.1.0.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-cfgv.spec ++++++ --- /var/tmp/diff_new_pack.7908GC/_old 2020-03-31 17:17:42.067721175 +0200 +++ /var/tmp/diff_new_pack.7908GC/_new 2020-03-31 17:17:42.071721177 +0200 @@ -1,7 +1,7 @@ # # spec file for package python-cfgv # -# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2020 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -17,8 +17,9 @@ %{?!python_module:%define python_module() python-%{**} python3-%{**}} +%define skip_python2 1 Name: python-cfgv -Version: 2.0.1 +Version: 3.1.0 Release: 0 Summary: Configuration validator producing human readable error messages License: MIT @@ -28,12 +29,9 @@ BuildRequires: %{python_module setuptools} BuildRequires: fdupes BuildRequires: python-rpm-macros -Requires: python-six BuildArch: noarch # SECTION test requirements -BuildRequires: %{python_module mock} -BuildRequires: %{python_module pytest-runner} -BuildRequires: %{python_module six} +BuildRequires: %{python_module pytest} # /SECTION %python_subpackages @@ -51,7 +49,7 @@ %python_expand %fdupes %{buildroot}%{$python_sitelib} %check -%python_exec setup.py pytest +%pytest %files %{python_files} %doc README.md ++++++ cfgv-2.0.1.tar.gz -> cfgv-3.1.0.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cfgv-2.0.1/.pre-commit-config.yaml new/cfgv-3.1.0/.pre-commit-config.yaml --- old/cfgv-2.0.1/.pre-commit-config.yaml 2019-07-21 16:23:55.000000000 +0200 +++ new/cfgv-3.1.0/.pre-commit-config.yaml 2020-02-25 00:53:07.000000000 +0100 @@ -1,6 +1,6 @@ repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v2.1.0 + rev: v2.5.0 hooks: - id: trailing-whitespace - id: end-of-file-fixer @@ -10,18 +10,29 @@ - id: name-tests-test - id: requirements-txt-fixer - repo: https://gitlab.com/pycqa/flake8 - rev: 3.7.7 + rev: 3.7.9 hooks: - id: flake8 - repo: https://github.com/pre-commit/mirrors-autopep8 - rev: v1.4.3 + rev: v1.5 hooks: - id: autopep8 - repo: https://github.com/asottile/reorder_python_imports - rev: v1.4.0 + rev: v1.9.0 hooks: - id: reorder-python-imports + args: [--py3-plus] +- repo: https://github.com/asottile/pyupgrade + rev: v1.26.2 + hooks: + - id: pyupgrade + args: [--py36-plus] - repo: https://github.com/asottile/add-trailing-comma - rev: v1.0.0 + rev: v1.5.0 hooks: - id: add-trailing-comma + args: [--py36-plus] +- repo: https://github.com/asottile/setup-cfg-fmt + rev: v1.6.0 + hooks: + - id: setup-cfg-fmt diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cfgv-2.0.1/azure-pipelines.yml new/cfgv-3.1.0/azure-pipelines.yml --- old/cfgv-2.0.1/azure-pipelines.yml 2019-07-21 16:23:55.000000000 +0200 +++ new/cfgv-3.1.0/azure-pipelines.yml 2020-02-25 00:53:07.000000000 +0100 @@ -10,11 +10,11 @@ type: github endpoint: github name: asottile/azure-pipeline-templates - ref: refs/tags/v0.0.16 + ref: refs/tags/v1.0.1 jobs: - template: job--pre-commit.yml@asottile - template: job--python-tox.yml@asottile parameters: - toxenvs: [pypy, pypy3, py27, py36, py37] + toxenvs: [pypy3, py36, py37, py38] os: linux diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cfgv-2.0.1/cfgv.py new/cfgv-3.1.0/cfgv.py --- old/cfgv-2.0.1/cfgv.py 2019-07-21 16:23:55.000000000 +0200 +++ new/cfgv-3.1.0/cfgv.py 2020-02-25 00:53:07.000000000 +0100 @@ -1,19 +1,13 @@ -from __future__ import absolute_import -from __future__ import unicode_literals - import collections import contextlib -import io import os.path import re import sys -import six - class ValidationError(ValueError): def __init__(self, error_msg, ctx=None): - super(ValidationError, self).__init__(error_msg) + super().__init__(error_msg) self.error_msg = error_msg self.ctx = ctx @@ -21,9 +15,9 @@ out = '\n' err = self while err.ctx is not None: - out += '==> {}\n'.format(err.ctx) + out += f'==> {err.ctx}\n' err = err.error_msg - out += '=====> {}'.format(err.error_msg) + out += f'=====> {err.error_msg}' return out @@ -37,7 +31,7 @@ yield except ValidationError as e: _, _, tb = sys.exc_info() - six.reraise(ValidationError, ValidationError(e, ctx=msg), tb) + raise ValidationError(e, ctx=msg).with_traceback(tb) @contextlib.contextmanager @@ -46,7 +40,7 @@ yield except ValidationError as e: _, _, tb = sys.exc_info() - six.reraise(tp, tp(e), tb) + raise tp(e).with_traceback(tb) def _dct_noop(self, dct): @@ -56,7 +50,7 @@ def _check_optional(self, dct): if self.key not in dct: return - with validate_context('At key: {}'.format(self.key)): + with validate_context(f'At key: {self.key}'): self.check_fn(dct[self.key]) @@ -71,7 +65,7 @@ def _require_key(self, dct): if self.key not in dct: - raise ValidationError('Missing required key: {}'.format(self.key)) + raise ValidationError(f'Missing required key: {self.key}') def _check_required(self, dct): @@ -117,15 +111,10 @@ if hasattr(self.condition_value, 'describe_opposite'): explanation = self.condition_value.describe_opposite() else: - explanation = 'is not {!r}'.format(self.condition_value) + explanation = f'is not {self.condition_value!r}' raise ValidationError( - 'Expected {key} to be absent when {cond_key} {explanation}, ' - 'found {key}: {val!r}'.format( - key=self.key, - val=dct[self.key], - cond_key=self.condition_key, - explanation=explanation, - ), + f'Expected {self.key} to be absent when {self.condition_key} ' + f'{explanation}, found {self.key}: {dct[self.key]!r}', ) return _check_conditional @@ -153,12 +142,11 @@ def _no_additional_keys_check(self, dct): extra = sorted(set(dct) - set(self.keys)) if extra: + extra_s = ', '.join(str(x) for x in extra) + keys_s = ', '.join(str(x) for x in self.keys) raise ValidationError( - 'Additional keys found: {}. ' - 'Only these keys are allowed: {}'.format( - ', '.join(str(x) for x in extra), - ', '.join(str(x) for x in self.keys), - ), + f'Additional keys found: {extra_s}. ' + f'Only these keys are allowed: {keys_s}', ) @@ -238,21 +226,19 @@ __slots__ = () def __new__(cls, object_name, id_key, *items): - return super(Map, cls).__new__(cls, object_name, id_key, items) + return super().__new__(cls, object_name, id_key, items) def check(self, v): if not isinstance(v, dict): raise ValidationError( - 'Expected a {} map but got a {}'.format( - self.object_name, type(v).__name__, - ), + f'Expected a {self.object_name} map but got a ' + f'{type(v).__name__}', ) if self.id_key is None: - context = 'At {}()'.format(self.object_name) + context = f'At {self.object_name}()' else: - context = 'At {}({}={!r})'.format( - self.object_name, self.id_key, v.get(self.id_key, MISSING), - ) + key_v_s = v.get(self.id_key, MISSING) + context = f'At {self.object_name}({self.id_key}={key_v_s!r})' with validate_context(context): for item in self.items: item.check(v) @@ -274,13 +260,13 @@ __slots__ = () def __new__(cls, of, allow_empty=True): - return super(Array, cls).__new__(cls, of=of, allow_empty=allow_empty) + return super().__new__(cls, of=of, allow_empty=allow_empty) def check(self, v): check_array(check_any)(v) if not self.allow_empty and not v: raise ValidationError( - "Expected at least 1 '{}'".format(self.of.object_name), + f"Expected at least 1 '{self.of.object_name}'", ) for val in v: validate(val, self.of) @@ -296,7 +282,7 @@ __slots__ = () def describe_opposite(self): - return 'is {!r}'.format(self.val) + return f'is {self.val!r}' def __eq__(self, other): return other is not MISSING and other != self.val @@ -306,10 +292,10 @@ __slots__ = () def __new__(cls, *values): - return super(NotIn, cls).__new__(cls, values=values) + return super().__new__(cls, values=values) def describe_opposite(self): - return 'is any of {!r}'.format(self.values) + return f'is any of {self.values!r}' def __eq__(self, other): return other is not MISSING and other not in self.values @@ -319,10 +305,10 @@ __slots__ = () def __new__(cls, *values): - return super(In, cls).__new__(cls, values=values) + return super().__new__(cls, values=values) def describe_opposite(self): - return 'is not any of {!r}'.format(self.values) + return f'is not any of {self.values!r}' def __eq__(self, other): return other is not MISSING and other in self.values @@ -335,28 +321,26 @@ def check_type(tp, typename=None): def check_type_fn(v): if not isinstance(v, tp): + typename_s = typename or tp.__name__ raise ValidationError( - 'Expected {} got {}'.format( - typename or tp.__name__, type(v).__name__, - ), + f'Expected {typename_s} got {type(v).__name__}', ) return check_type_fn check_bool = check_type(bool) -check_bytes = check_type(bytes, typename='bytes') +check_bytes = check_type(bytes) check_int = check_type(int) -check_string = check_type(six.string_types, typename='string') -check_text = check_type(six.text_type, typename='text') +check_string = check_type(str, typename='string') +check_text = check_type(str, typename='text') def check_one_of(possible): def check_one_of_fn(v): if v not in possible: + possible_s = ', '.join(str(x) for x in sorted(possible)) raise ValidationError( - 'Expected one of {} but got: {!r}'.format( - ', '.join(str(x) for x in sorted(possible)), v, - ), + f'Expected one of {possible_s} but got: {v!r}', ) return check_one_of_fn @@ -365,18 +349,18 @@ try: re.compile(v) except re.error: - raise ValidationError('{!r} is not a valid python regex'.format(v)) + raise ValidationError(f'{v!r} is not a valid python regex') def check_array(inner_check): def check_array_fn(v): if not isinstance(v, (list, tuple)): raise ValidationError( - 'Expected array but got {!r}'.format(type(v).__name__), + f'Expected array but got {type(v).__name__!r}', ) for i, val in enumerate(v): - with validate_context('At index {}'.format(i)): + with validate_context(f'At index {i}'): inner_check(val) return check_array_fn @@ -409,12 +393,12 @@ ): with reraise_as(exc_tp): if not os.path.exists(filename): - raise ValidationError('{} does not exist'.format(filename)) + raise ValidationError(f'{filename} does not exist') - with io.open(filename, encoding='utf-8') as f: + with open(filename, encoding='utf-8') as f: contents = f.read() - with validate_context('File {}'.format(filename)): + with validate_context(f'File {filename}'): try: data = load_strategy(contents) except Exception as e: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cfgv-2.0.1/requirements-dev.txt new/cfgv-3.1.0/requirements-dev.txt --- old/cfgv-2.0.1/requirements-dev.txt 2019-07-21 16:23:55.000000000 +0200 +++ new/cfgv-3.1.0/requirements-dev.txt 2020-02-25 00:53:07.000000000 +0100 @@ -1,5 +1,3 @@ coverage -flake8 -mock pre-commit pytest diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cfgv-2.0.1/setup.cfg new/cfgv-3.1.0/setup.cfg --- old/cfgv-2.0.1/setup.cfg 2019-07-21 16:23:55.000000000 +0200 +++ new/cfgv-3.1.0/setup.cfg 2020-02-25 00:53:07.000000000 +0100 @@ -1,6 +1,6 @@ [metadata] name = cfgv -version = 2.0.1 +version = 3.1.0 description = Validate configuration and produce human readable error messages. long_description = file: README.md long_description_content_type = text/markdown @@ -11,20 +11,17 @@ license_file = LICENSE classifiers = License :: OSI Approved :: MIT License - Programming Language :: Python :: 2 - Programming Language :: Python :: 2.7 Programming Language :: Python :: 3 - Programming Language :: Python :: 3.4 - Programming Language :: Python :: 3.5 + Programming Language :: Python :: 3 :: Only Programming Language :: Python :: 3.6 Programming Language :: Python :: 3.7 + Programming Language :: Python :: 3.8 Programming Language :: Python :: Implementation :: CPython Programming Language :: Python :: Implementation :: PyPy [options] py_modules = cfgv -install_requires = six -python_requires = >=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.* +python_requires = >=3.6.1 [bdist_wheel] universal = True diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cfgv-2.0.1/tests/cfgv_test.py new/cfgv-3.1.0/tests/cfgv_test.py --- old/cfgv-2.0.1/tests/cfgv_test.py 2019-07-21 16:23:55.000000000 +0200 +++ new/cfgv-3.1.0/tests/cfgv_test.py 2020-02-25 00:53:07.000000000 +0100 @@ -1,9 +1,6 @@ -from __future__ import absolute_import -from __future__ import unicode_literals - import json +from unittest import mock -import mock import pytest from cfgv import apply_defaults @@ -79,7 +76,7 @@ def test_check_regex(): with pytest.raises(ValidationError) as excinfo: - check_regex(str('(')) + check_regex('(') assert excinfo.value.error_msg == "'(' is not a valid python regex" @@ -106,13 +103,13 @@ check(True) assert excinfo.value.error_msg == 'Expected str got bool' with pytest.raises(ValidationError) as excinfo: - check(str('(')) + check('(') assert excinfo.value.error_msg == "'(' is not a valid python regex" def test_check_and_ok(): check = check_and(check_type(str), check_regex) - check(str('^$')) + check('^$') @pytest.mark.parametrize( @@ -541,7 +538,7 @@ with pytest.raises(Error) as excinfo: load_from_filename(f.strpath, map_required, json.loads, Error) # ANY is json's error message - expected = ('File {}'.format(f.strpath), mock.ANY) + expected = (f'File {f.strpath}', mock.ANY) _assert_exception_trace(excinfo.value.args[0], expected) @@ -551,7 +548,7 @@ with pytest.raises(Error) as excinfo: load_from_filename(f.strpath, map_required, json.loads, Error) expected = ( - 'File {}'.format(f.strpath), + f'File {f.strpath}', 'At foo(key=MISSING)', 'Missing required key: key', ) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cfgv-2.0.1/tox.ini new/cfgv-3.1.0/tox.ini --- old/cfgv-2.0.1/tox.ini 2019-07-21 16:23:55.000000000 +0200 +++ new/cfgv-3.1.0/tox.ini 2020-02-25 00:53:07.000000000 +0100 @@ -1,5 +1,5 @@ [tox] -envlist = py27,py36,py37,pypy,pypy3,pre-commit +envlist = py36,py37,pypy3,pre-commit [testenv] deps = -rrequirements-dev.txt