Script 'mail_helper' called by obssrc
Hello community,
here is the log from the commit of package python-fastjsonschema for
openSUSE:Factory checked in at 2022-10-16 16:09:14
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-fastjsonschema (Old)
and /work/SRC/openSUSE:Factory/.python-fastjsonschema.new.2275 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-fastjsonschema"
Sun Oct 16 16:09:14 2022 rev:2 rq:1008418 version:2.16.2
Changes:
--------
---
/work/SRC/openSUSE:Factory/python-fastjsonschema/python-fastjsonschema.changes
2022-07-19 17:19:12.708354635 +0200
+++
/work/SRC/openSUSE:Factory/.python-fastjsonschema.new.2275/python-fastjsonschema.changes
2022-10-16 16:09:19.302769608 +0200
@@ -1,0 +2,13 @@
+Thu Oct 6 14:32:39 UTC 2022 - Dirk M??ller <[email protected]>
+
+- update to 2.16.2:
+ * Use temporary dir in tests for compiled code
+ * Add comments to Python versions in Github workflow
+ * Add conditional test that uses $ref
+ * Add conditional tests just to make sure the baseline works
+ * Recursively expand all $ref strings in schemas
+ * Add test case capturing the desired behaviour
+ * Expand $ref when assiging the definition field in JsonSchemaValueExce
+ * Add an assertion before removing 'data' from variable name
+
+-------------------------------------------------------------------
Old:
----
fastjsonschema-2.15.3.tar.gz
New:
----
fastjsonschema-2.16.2.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ python-fastjsonschema.spec ++++++
--- /var/tmp/diff_new_pack.UQ9IUv/_old 2022-10-16 16:09:19.890770986 +0200
+++ /var/tmp/diff_new_pack.UQ9IUv/_new 2022-10-16 16:09:19.894770996 +0200
@@ -18,7 +18,7 @@
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
Name: python-fastjsonschema
-Version: 2.15.3
+Version: 2.16.2
Release: 0
Summary: Fastest Python implementation of JSON schema
License: BSD-3-Clause
++++++ fastjsonschema-2.15.3.tar.gz -> fastjsonschema-2.16.2.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/fastjsonschema-2.15.3/PKG-INFO
new/fastjsonschema-2.16.2/PKG-INFO
--- old/fastjsonschema-2.15.3/PKG-INFO 2022-01-09 09:44:21.000000000 +0100
+++ new/fastjsonschema-2.16.2/PKG-INFO 2022-09-19 18:49:54.000000000 +0200
@@ -1,10 +1,10 @@
Metadata-Version: 2.1
Name: fastjsonschema
-Version: 2.15.3
+Version: 2.16.2
Summary: Fastest Python implementation of JSON schema
-Home-page: https://github.com/seznam/python-fastjsonschema
+Home-page: https://github.com/horejsek/python-fastjsonschema
Author: Michal Horejsek
-Author-email: [email protected]
+Author-email: [email protected]
License: BSD
Description: ===========================
Fast JSON schema for Python
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/fastjsonschema-2.15.3/fastjsonschema/draft04.py
new/fastjsonschema-2.16.2/fastjsonschema/draft04.py
--- old/fastjsonschema-2.15.3/fastjsonschema/draft04.py 2021-12-12
15:33:41.000000000 +0100
+++ new/fastjsonschema-2.16.2/fastjsonschema/draft04.py 2022-07-17
09:49:40.000000000 +0200
@@ -158,7 +158,7 @@
self.l('except JsonSchemaValueException: pass')
with self.l('if not {variable}_any_of_count{count}:', count=count,
optimize=False):
- self.exc('{name} must be valid by one of anyOf definition',
rule='anyOf')
+ self.exc('{name} cannot be validated by any definition',
rule='anyOf')
def generate_one_of(self):
"""
@@ -188,7 +188,8 @@
self.l('except JsonSchemaValueException: pass')
with self.l('if {variable}_one_of_count{count} != 1:', count=count):
- self.exc('{name} must be valid exactly by one of oneOf
definition', rule='oneOf')
+ dynamic = '" (" + str({variable}_one_of_count{}) + " matches
found)"'
+ self.exc('{name} must be valid exactly by one definition', count,
append_to_msg=dynamic, rule='oneOf')
def generate_not(self):
"""
@@ -210,13 +211,13 @@
return
elif not not_definition:
with self.l('if {}:', self._variable):
- self.exc('{name} must not be valid by not definition',
rule='not')
+ self.exc('{name} must NOT match a disallowed definition',
rule='not')
else:
with self.l('try:', optimize=False):
self.generate_func_code_block(not_definition, self._variable,
self._variable_name)
self.l('except JsonSchemaValueException: pass')
with self.l('else:'):
- self.exc('{name} must not be valid by not definition',
rule='not')
+ self.exc('{name} must NOT match a disallowed definition',
rule='not')
def generate_min_length(self):
with self.l('if isinstance({variable}, str):'):
@@ -353,6 +354,10 @@
>>> timeit.timeit("np.unique(x).size == len(x)",
"x=range(100)+range(100); import numpy as np", number=100000)
2.1439831256866455
"""
+ unique_definition = self._definition['uniqueItems']
+ if not unique_definition:
+ return
+
self.create_variable_is_list()
with self.l('if {variable}_is_list:'):
self.l(
@@ -413,19 +418,23 @@
self.exc('{name} must contain only specified
items', rule='items')
else:
with self.l('for {variable}_x, {variable}_item in
enumerate({variable}[{0}:], {0}):', len(items_definition)):
- self.generate_func_code_block(
+ count = self.generate_func_code_block(
self._definition['additionalItems'],
'{}_item'.format(self._variable),
'{}[{{{}_x}}]'.format(self._variable_name,
self._variable),
)
+ if count == 0:
+ self.l('pass')
else:
if items_definition:
with self.l('for {variable}_x, {variable}_item in
enumerate({variable}):'):
- self.generate_func_code_block(
+ count = self.generate_func_code_block(
items_definition,
'{}_item'.format(self._variable),
'{}[{{{}_x}}]'.format(self._variable_name,
self._variable),
)
+ if count == 0:
+ self.l('pass')
def generate_min_properties(self):
self.create_variable_is_dict()
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/fastjsonschema-2.15.3/fastjsonschema/exceptions.py
new/fastjsonschema-2.16.2/fastjsonschema/exceptions.py
--- old/fastjsonschema-2.15.3/fastjsonschema/exceptions.py 2021-02-01
18:30:22.000000000 +0100
+++ new/fastjsonschema-2.16.2/fastjsonschema/exceptions.py 2022-02-26
10:43:31.000000000 +0100
@@ -16,8 +16,8 @@
* ``message`` containing human-readable information what is wrong (e.g.
``data.property[index] must be smaller than or equal to 42``),
* invalid ``value`` (e.g. ``60``),
- * ``name`` of a path in the data structure (e.g. ``data.propery[index]``),
- * ``path`` as an array in the data structure (e.g. ``['data', 'propery',
'index']``),
+ * ``name`` of a path in the data structure (e.g.
``data.property[index]``),
+ * ``path`` as an array in the data structure (e.g. ``['data', 'property',
'index']``),
* the whole ``definition`` which the ``value`` has to fulfil (e.g.
``{'type': 'number', 'maximum': 42}``),
* ``rule`` which the ``value`` is breaking (e.g. ``maximum``)
* and ``rule_definition`` (e.g. ``42``).
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/fastjsonschema-2.15.3/fastjsonschema/generator.py
new/fastjsonschema-2.16.2/fastjsonschema/generator.py
--- old/fastjsonschema-2.15.3/fastjsonschema/generator.py 2022-01-09
09:39:24.000000000 +0100
+++ new/fastjsonschema-2.16.2/fastjsonschema/generator.py 2022-07-17
09:30:32.000000000 +0200
@@ -136,13 +136,15 @@
self._validation_functions_done.add(uri)
self.l('')
with self._resolver.resolving(uri) as definition:
- with self.l('def {}(data, custom_formats={{}}):', name):
+ with self.l('def {}(data, custom_formats={{}},
name_prefix=None):', name):
self.generate_func_code_block(definition, 'data', 'data',
clear_variables=True)
self.l('return data')
def generate_func_code_block(self, definition, variable, variable_name,
clear_variables=False):
"""
Creates validation rules for current definition.
+
+ Returns the number of validation rules generated as code.
"""
backup = self._definition, self._variable, self._variable_name
self._definition, self._variable, self._variable_name = definition,
variable, variable_name
@@ -150,25 +152,31 @@
backup_variables = self._variables
self._variables = set()
- self._generate_func_code_block(definition)
+ count = self._generate_func_code_block(definition)
self._definition, self._variable, self._variable_name = backup
if clear_variables:
self._variables = backup_variables
+ return count
+
def _generate_func_code_block(self, definition):
if not isinstance(definition, dict):
raise JsonSchemaDefinitionException("definition must be an object")
if '$ref' in definition:
# needed because ref overrides any sibling keywords
- self.generate_ref()
+ return self.generate_ref()
else:
- self.run_generate_functions(definition)
+ return self.run_generate_functions(definition)
def run_generate_functions(self, definition):
+ """Returns the number of generate functions that were executed."""
+ count = 0
for key, func in self._json_keywords_to_function.items():
if key in definition:
func()
+ count += 1
+ return count
def generate_ref(self):
"""
@@ -190,7 +198,10 @@
if uri not in self._validation_functions_done:
self._needed_validation_functions[uri] = name
# call validation function
- self.l('{}({variable}, custom_formats)', name)
+ assert self._variable_name.startswith("data")
+ path = self._variable_name[4:]
+ name_arg = '(name_prefix or "data") + "{}"'.format(path)
+ self.l('{}({variable}, custom_formats, {name_arg})', name,
name_arg=name_arg)
# pylint: disable=invalid-name
@@ -216,8 +227,12 @@
spaces = ' ' * self.INDENT * self._indent
name = self._variable_name
- if name and '{' in name:
- name = '"+"{}".format(**locals())+"'.format(self._variable_name)
+ if name:
+ # Add name_prefix to the name when it is being outputted.
+ assert name.startswith('data')
+ name = '" + (name_prefix or "data") + "' + name[4:]
+ if '{' in name:
+ name = name + '".format(**locals()) + "'
context = dict(
self._definition or {},
@@ -240,13 +255,27 @@
"""
return str(string).replace('"', '\\"')
- def exc(self, msg, *args, rule=None):
+ def exc(self, msg, *args, append_to_msg=None, rule=None):
"""
Short-cut for creating raising exception in the code.
"""
- msg = 'raise JsonSchemaValueException("'+msg+'", value={variable},
name="{name}", definition={definition}, rule={rule})'
- definition_rule = self.e(self._definition.get(rule) if
isinstance(self._definition, dict) else None)
- self.l(msg, *args, definition=repr(self._definition), rule=repr(rule),
definition_rule=definition_rule)
+ arg = '"'+msg+'"'
+ if append_to_msg:
+ arg += ' + (' + append_to_msg + ')'
+ msg = 'raise JsonSchemaValueException('+arg+', value={variable},
name="{name}", definition={definition}, rule={rule})'
+ definition = self._expand_refs(self._definition)
+ definition_rule = self.e(definition.get(rule) if
isinstance(definition, dict) else None)
+ self.l(msg, *args, definition=repr(definition), rule=repr(rule),
definition_rule=definition_rule)
+
+ def _expand_refs(self, definition):
+ if isinstance(definition, list):
+ return [self._expand_refs(v) for v in definition]
+ if not isinstance(definition, dict):
+ return definition
+ if "$ref" in definition and isinstance(definition["$ref"], str):
+ with self._resolver.resolving(definition["$ref"]) as schema:
+ return schema
+ return {k: self._expand_refs(v) for k, v in definition.items()}
def create_variable_with_length(self):
"""
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/fastjsonschema-2.15.3/fastjsonschema/version.py
new/fastjsonschema-2.16.2/fastjsonschema/version.py
--- old/fastjsonschema-2.15.3/fastjsonschema/version.py 2022-01-09
09:43:41.000000000 +0100
+++ new/fastjsonschema-2.16.2/fastjsonschema/version.py 2022-08-10
18:06:55.000000000 +0200
@@ -1 +1 @@
-VERSION = '2.15.3'
+VERSION = '2.16.2'
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/fastjsonschema-2.15.3/fastjsonschema.egg-info/PKG-INFO
new/fastjsonschema-2.16.2/fastjsonschema.egg-info/PKG-INFO
--- old/fastjsonschema-2.15.3/fastjsonschema.egg-info/PKG-INFO 2022-01-09
09:44:20.000000000 +0100
+++ new/fastjsonschema-2.16.2/fastjsonschema.egg-info/PKG-INFO 2022-09-19
18:49:53.000000000 +0200
@@ -1,10 +1,10 @@
Metadata-Version: 2.1
Name: fastjsonschema
-Version: 2.15.3
+Version: 2.16.2
Summary: Fastest Python implementation of JSON schema
-Home-page: https://github.com/seznam/python-fastjsonschema
+Home-page: https://github.com/horejsek/python-fastjsonschema
Author: Michal Horejsek
-Author-email: [email protected]
+Author-email: [email protected]
License: BSD
Description: ===========================
Fast JSON schema for Python
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/fastjsonschema-2.15.3/setup.py
new/fastjsonschema-2.16.2/setup.py
--- old/fastjsonschema-2.15.3/setup.py 2019-09-25 22:26:44.000000000 +0200
+++ new/fastjsonschema-2.16.2/setup.py 2022-07-17 09:38:08.000000000 +0200
@@ -33,9 +33,9 @@
],
},
- url='https://github.com/seznam/python-fastjsonschema',
+ url='https://github.com/horejsek/python-fastjsonschema',
author='Michal Horejsek',
- author_email='[email protected]',
+ author_email='[email protected]',
description='Fastest Python implementation of JSON schema',
long_description=LONG_DESCRIPTION,
license='BSD',