Hello community, here is the log from the commit of package python-jsonpath-rw-ext for openSUSE:Factory checked in at 2018-03-02 21:13:13 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-jsonpath-rw-ext (Old) and /work/SRC/openSUSE:Factory/.python-jsonpath-rw-ext.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-jsonpath-rw-ext" Fri Mar 2 21:13:13 2018 rev:2 rq:582032 version:1.1.3 Changes: -------- --- /work/SRC/openSUSE:Factory/python-jsonpath-rw-ext/python-jsonpath-rw-ext.changes 2017-08-04 11:58:36.518160716 +0200 +++ /work/SRC/openSUSE:Factory/.python-jsonpath-rw-ext.new/python-jsonpath-rw-ext.changes 2018-03-02 21:13:33.532947656 +0100 @@ -1,0 +2,7 @@ +Fri Mar 2 17:29:51 UTC 2018 - tbecht...@suse.com + +- update to 1.1.3: + * Added convenience shortcut functions + * travis: move to python version 3.5/3.6 + +------------------------------------------------------------------- Old: ---- jsonpath-rw-ext-1.1.2.tar.gz New: ---- jsonpath-rw-ext-1.1.3.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-jsonpath-rw-ext.spec ++++++ --- /var/tmp/diff_new_pack.VfvYdZ/_old 2018-03-02 21:13:34.376917308 +0100 +++ /var/tmp/diff_new_pack.VfvYdZ/_new 2018-03-02 21:13:34.380917163 +0100 @@ -1,7 +1,7 @@ # # spec file for package python-jsonpath-rw-ext # -# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2018 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 @@ -18,7 +18,7 @@ %{?!python_module:%define python_module() python-%{**} python3-%{**}} Name: python-jsonpath-rw-ext -Version: 1.1.2 +Version: 1.1.3 Release: 0 Summary: Extensions for JSONPath RW License: Apache-2.0 ++++++ jsonpath-rw-ext-1.1.2.tar.gz -> jsonpath-rw-ext-1.1.3.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/jsonpath-rw-ext-1.1.2/.travis.yml new/jsonpath-rw-ext-1.1.3/.travis.yml --- old/jsonpath-rw-ext-1.1.2/.travis.yml 2015-08-18 17:27:37.000000000 +0200 +++ new/jsonpath-rw-ext-1.1.3/.travis.yml 2017-10-19 16:07:58.000000000 +0200 @@ -1,12 +1,12 @@ sudo: false language: python install: - - pip install tox + - pip install tox script: - tox env: - TOXENV=py27 - - TOXENV=py33 - - TOXENV=py34 + - TOXENV=py35 + - TOXENV=py36 - TOXENV=pep8 - TOXENV=docs diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/jsonpath-rw-ext-1.1.2/AUTHORS new/jsonpath-rw-ext-1.1.3/AUTHORS --- old/jsonpath-rw-ext-1.1.2/AUTHORS 2017-06-20 12:15:41.000000000 +0200 +++ new/jsonpath-rw-ext-1.1.3/AUTHORS 2017-10-19 16:12:27.000000000 +0200 @@ -1,6 +1,7 @@ Chris Dent <cd...@anticdent.org> Dirk Mueller <d...@dmllr.de> Ernesto Ocampo <ernesto.oca...@genomicsengland.co.uk> +Ernesto Ocampo <ocampoerne...@gmail.com> Julien Danjou <jul...@danjou.info> Mehdi ABAAKOUK <sil...@sileht.net> Mehdi Abaakouk <sil...@sileht.net> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/jsonpath-rw-ext-1.1.2/ChangeLog new/jsonpath-rw-ext-1.1.3/ChangeLog --- old/jsonpath-rw-ext-1.1.2/ChangeLog 2017-06-20 12:15:41.000000000 +0200 +++ new/jsonpath-rw-ext-1.1.3/ChangeLog 2017-10-19 16:12:27.000000000 +0200 @@ -1,6 +1,12 @@ CHANGES ======= +1.1.3 +----- + +* Added convenience shortcut functions +* travis: move to python version 3.5/3.6 + 1.1.2 ----- diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/jsonpath-rw-ext-1.1.2/PKG-INFO new/jsonpath-rw-ext-1.1.3/PKG-INFO --- old/jsonpath-rw-ext-1.1.2/PKG-INFO 2017-06-20 12:15:43.000000000 +0200 +++ new/jsonpath-rw-ext-1.1.3/PKG-INFO 2017-10-19 16:12:28.000000000 +0200 @@ -1,6 +1,6 @@ Metadata-Version: 1.1 Name: jsonpath-rw-ext -Version: 1.1.2 +Version: 1.1.3 Summary: Extensions for JSONPath RW Home-page: https://github.com/sileht/python-jsonpath-rw-ext Author: Mehdi Abaakouk @@ -60,7 +60,16 @@ parser.ExtentedJsonPathParser().parse("$.foo").find(...) - The jsonpath classes are not part of the public API, because the name/structure + Shortcut functions for getting only the matched values:: + + import jsonpath_rw_ext as jp + print jp.match('$.cow[*]', {'cow': ['foo', 'bar'], 'fish': 'foobar'}) + # prints ['foo', 'bar'] + + print jp.match1('$.cow[*]', {'cow': ['foo', 'bar'], 'fish': 'foobar'}) + # prints 'foo' + + The jsonpath classes are not part of the public API, because the name/structure can change when they will be implemented upstream. Only the syntax *shouldn't* change. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/jsonpath-rw-ext-1.1.2/README.rst new/jsonpath-rw-ext-1.1.3/README.rst --- old/jsonpath-rw-ext-1.1.2/README.rst 2017-02-25 20:53:27.000000000 +0100 +++ new/jsonpath-rw-ext-1.1.3/README.rst 2017-10-19 16:10:30.000000000 +0200 @@ -52,7 +52,16 @@ parser.ExtentedJsonPathParser().parse("$.foo").find(...) -The jsonpath classes are not part of the public API, because the name/structure +Shortcut functions for getting only the matched values:: + + import jsonpath_rw_ext as jp + print jp.match('$.cow[*]', {'cow': ['foo', 'bar'], 'fish': 'foobar'}) + # prints ['foo', 'bar'] + + print jp.match1('$.cow[*]', {'cow': ['foo', 'bar'], 'fish': 'foobar'}) + # prints 'foo' + +The jsonpath classes are not part of the public API, because the name/structure can change when they will be implemented upstream. Only the syntax *shouldn't* change. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/jsonpath-rw-ext-1.1.2/jsonpath_rw_ext/__init__.py new/jsonpath-rw-ext-1.1.3/jsonpath_rw_ext/__init__.py --- old/jsonpath-rw-ext-1.1.2/jsonpath_rw_ext/__init__.py 2015-08-21 11:02:36.000000000 +0200 +++ new/jsonpath-rw-ext-1.1.3/jsonpath_rw_ext/__init__.py 2017-10-19 16:10:30.000000000 +0200 @@ -17,4 +17,4 @@ __version__ = pbr.version.VersionInfo( 'jsonpath_rw_ext').version_string() -from .parser import parse # noqa +from .parser import parse, match, match1 # noqa diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/jsonpath-rw-ext-1.1.2/jsonpath_rw_ext/parser.py new/jsonpath-rw-ext-1.1.3/jsonpath_rw_ext/parser.py --- old/jsonpath-rw-ext-1.1.2/jsonpath_rw_ext/parser.py 2017-02-25 20:53:32.000000000 +0100 +++ new/jsonpath-rw-ext-1.1.3/jsonpath_rw_ext/parser.py 2017-10-19 16:10:30.000000000 +0200 @@ -177,3 +177,14 @@ def parse(path, debug=False): return ExtentedJsonPathParser(debug=debug).parse(path) + + +def match(pattern, data, **parse_kwargs): + """Returns all matched values of pattern in data""" + return [m.value for m in parse(pattern, **parse_kwargs).find(data)] + + +def match1(pattern, data, **parse_kwargs): + """Returns first matched value of pattern in data or None if no matches""" + matches = match(pattern, data, **parse_kwargs) + return matches[0] if matches else None diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/jsonpath-rw-ext-1.1.2/jsonpath_rw_ext/tests/test_jsonpath_rw_ext.py new/jsonpath-rw-ext-1.1.3/jsonpath_rw_ext/tests/test_jsonpath_rw_ext.py --- old/jsonpath-rw-ext-1.1.2/jsonpath_rw_ext/tests/test_jsonpath_rw_ext.py 2017-02-25 20:53:32.000000000 +0100 +++ new/jsonpath-rw-ext-1.1.3/jsonpath_rw_ext/tests/test_jsonpath_rw_ext.py 2017-10-19 16:10:30.000000000 +0200 @@ -342,6 +342,19 @@ else: self.assertEqual(self.target, result[0].value) + def test_shortcut_functions(self): + jsonpath.auto_id_field = None + parse_result = parser.parse(self.string, debug=True).find(self.data) + match_result = parser.match(self.string, self.data, debug=True) + match1_result = parser.match1(self.string, self.data, debug=True) + + self.assertEqual(match_result, [r.value for r in parse_result]) + if match_result: + self.assertEqual(match_result[0], match1_result) + else: + self.assertIsNone(match1_result) + + # NOTE(sileht): copy of tests/test_jsonpath.py # to ensure we didn't break jsonpath_rw diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/jsonpath-rw-ext-1.1.2/jsonpath_rw_ext.egg-info/PKG-INFO new/jsonpath-rw-ext-1.1.3/jsonpath_rw_ext.egg-info/PKG-INFO --- old/jsonpath-rw-ext-1.1.2/jsonpath_rw_ext.egg-info/PKG-INFO 2017-06-20 12:15:41.000000000 +0200 +++ new/jsonpath-rw-ext-1.1.3/jsonpath_rw_ext.egg-info/PKG-INFO 2017-10-19 16:12:27.000000000 +0200 @@ -1,6 +1,6 @@ Metadata-Version: 1.1 Name: jsonpath-rw-ext -Version: 1.1.2 +Version: 1.1.3 Summary: Extensions for JSONPath RW Home-page: https://github.com/sileht/python-jsonpath-rw-ext Author: Mehdi Abaakouk @@ -60,7 +60,16 @@ parser.ExtentedJsonPathParser().parse("$.foo").find(...) - The jsonpath classes are not part of the public API, because the name/structure + Shortcut functions for getting only the matched values:: + + import jsonpath_rw_ext as jp + print jp.match('$.cow[*]', {'cow': ['foo', 'bar'], 'fish': 'foobar'}) + # prints ['foo', 'bar'] + + print jp.match1('$.cow[*]', {'cow': ['foo', 'bar'], 'fish': 'foobar'}) + # prints 'foo' + + The jsonpath classes are not part of the public API, because the name/structure can change when they will be implemented upstream. Only the syntax *shouldn't* change. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/jsonpath-rw-ext-1.1.2/jsonpath_rw_ext.egg-info/pbr.json new/jsonpath-rw-ext-1.1.3/jsonpath_rw_ext.egg-info/pbr.json --- old/jsonpath-rw-ext-1.1.2/jsonpath_rw_ext.egg-info/pbr.json 2017-06-20 12:15:41.000000000 +0200 +++ new/jsonpath-rw-ext-1.1.3/jsonpath_rw_ext.egg-info/pbr.json 2017-10-19 16:12:27.000000000 +0200 @@ -1 +1 @@ -{"is_release": true, "git_version": "942761a"} \ No newline at end of file +{"is_release": true, "git_version": "7f4d5f9"} \ No newline at end of file