Hello community, here is the log from the commit of package python-parse for openSUSE:Leap:15.2 checked in at 2020-03-13 10:58:43 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Leap:15.2/python-parse (Old) and /work/SRC/openSUSE:Leap:15.2/.python-parse.new.3160 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-parse" Fri Mar 13 10:58:43 2020 rev:6 rq:784031 version:1.15.0 Changes: -------- --- /work/SRC/openSUSE:Leap:15.2/python-parse/python-parse.changes 2020-03-09 18:09:51.225066551 +0100 +++ /work/SRC/openSUSE:Leap:15.2/.python-parse.new.3160/python-parse.changes 2020-03-13 11:01:13.792599582 +0100 @@ -1,0 +2,8 @@ +Wed Mar 11 15:18:17 UTC 2020 - Marketa Calabkova <[email protected]> + +- update to 1.15.0 + * Several bugs with parsing hex, bin and oct numbers. + * Handle fortran formatted float number, Bug fix & test case. + * Handle comparison of FixedTzOffset with other types of object + +------------------------------------------------------------------- Old: ---- parse-1.12.1.tar.gz New: ---- parse-1.15.0.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-parse.spec ++++++ --- /var/tmp/diff_new_pack.Z44LmM/_old 2020-03-13 11:01:14.184599862 +0100 +++ /var/tmp/diff_new_pack.Z44LmM/_new 2020-03-13 11:01:14.184599862 +0100 @@ -1,7 +1,7 @@ # # spec file for package python-parse # -# 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 @@ -18,7 +18,7 @@ %{?!python_module:%define python_module() python-%{**} python3-%{**}} Name: python-parse -Version: 1.12.1 +Version: 1.15.0 Release: 0 Summary: Python module for parsing strings using a "format" syntax License: MIT ++++++ parse-1.12.1.tar.gz -> parse-1.15.0.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/parse-1.12.1/LICENSE new/parse-1.15.0/LICENSE --- old/parse-1.12.1/LICENSE 1970-01-01 01:00:00.000000000 +0100 +++ new/parse-1.15.0/LICENSE 2019-01-23 03:01:28.000000000 +0100 @@ -0,0 +1,19 @@ +Copyright (c) 2012-2019 Richard Jones <[email protected]> + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/parse-1.12.1/MANIFEST.in new/parse-1.15.0/MANIFEST.in --- old/parse-1.12.1/MANIFEST.in 2018-05-27 01:11:29.000000000 +0200 +++ new/parse-1.15.0/MANIFEST.in 2019-10-31 07:49:45.000000000 +0100 @@ -1,2 +1,2 @@ -include README.rst +include README.rst LICENSE include *.py diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/parse-1.12.1/PKG-INFO new/parse-1.15.0/PKG-INFO --- old/parse-1.12.1/PKG-INFO 2019-08-18 09:34:16.000000000 +0200 +++ new/parse-1.15.0/PKG-INFO 2020-02-29 22:54:43.000000000 +0100 @@ -1,6 +1,6 @@ Metadata-Version: 1.1 Name: parse -Version: 1.12.1 +Version: 1.15.0 Summary: parse() is the opposite of format() Home-page: https://github.com/r1chardj0n3s/parse Author: Richard Jones @@ -29,7 +29,7 @@ Or find all the occurrences of some pattern in a string: - >>> ''.join(r.fixed[0] for r in findall(">{}<", "<p>the <b>bold</b> text</p>")) + >>> ''.join(r[0] for r in findall(">{}<", "<p>the <b>bold</b> text</p>")) 'the bold text' If you're going to use the same pattern to match lots of strings you can @@ -137,7 +137,8 @@ In addition some regular expression character group types "D", "w", "W", "s" and "S" are also available. - The "e" and "g" types are case-insensitive so there is not need for - the "E" or "G" types. + the "E" or "G" types. The "e" type handles Fortran formatted numbers (no + leading 0 before the decimal point). ===== =========================================== ======== Type Characters Matched Output @@ -353,6 +354,12 @@ **Version history (in brief)**: + - 1.15.0 Several fixes for parsing non-base 10 numbers (thanks @vladikcomper) + - 1.14.0 More broad acceptance of Fortran number format (thanks @purpleskyfall) + - 1.13.1 Project metadata correction. + - 1.13.0 Handle Fortran formatted numbers with no leading 0 before decimal + point (thanks @purpleskyfall). + Handle comparison of FixedTzOffset with other types of object. - 1.12.1 Actually use the `case_sensitive` arg in compile (thanks @jacquev6) - 1.12.0 Do not assume closing brace when an opening one is found (thanks @mattsep) - 1.11.1 Revert having unicode char in docstring, it breaks Bamboo builds(?!) @@ -426,10 +433,11 @@ Platform: UNKNOWN Classifier: Environment :: Web Environment Classifier: Intended Audience :: Developers -Classifier: Programming Language :: Python :: 2.7 Classifier: Programming Language :: Python :: 3.4 Classifier: Programming Language :: Python :: 3.5 Classifier: Programming Language :: Python :: 3.6 +Classifier: Programming Language :: Python :: 3.7 +Classifier: Programming Language :: Python :: 3.8 Classifier: Topic :: Software Development :: Code Generators Classifier: Topic :: Software Development :: Libraries :: Python Modules Classifier: License :: OSI Approved :: BSD License diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/parse-1.12.1/README.rst new/parse-1.15.0/README.rst --- old/parse-1.12.1/README.rst 2019-08-18 09:34:16.000000000 +0200 +++ new/parse-1.15.0/README.rst 2020-02-29 22:54:42.000000000 +0100 @@ -21,7 +21,7 @@ Or find all the occurrences of some pattern in a string: ->>> ''.join(r.fixed[0] for r in findall(">{}<", "<p>the <b>bold</b> text</p>")) +>>> ''.join(r[0] for r in findall(">{}<", "<p>the <b>bold</b> text</p>")) 'the bold text' If you're going to use the same pattern to match lots of strings you can @@ -129,7 +129,8 @@ In addition some regular expression character group types "D", "w", "W", "s" and "S" are also available. - The "e" and "g" types are case-insensitive so there is not need for - the "E" or "G" types. + the "E" or "G" types. The "e" type handles Fortran formatted numbers (no + leading 0 before the decimal point). ===== =========================================== ======== Type Characters Matched Output @@ -345,6 +346,12 @@ **Version history (in brief)**: +- 1.15.0 Several fixes for parsing non-base 10 numbers (thanks @vladikcomper) +- 1.14.0 More broad acceptance of Fortran number format (thanks @purpleskyfall) +- 1.13.1 Project metadata correction. +- 1.13.0 Handle Fortran formatted numbers with no leading 0 before decimal + point (thanks @purpleskyfall). + Handle comparison of FixedTzOffset with other types of object. - 1.12.1 Actually use the `case_sensitive` arg in compile (thanks @jacquev6) - 1.12.0 Do not assume closing brace when an opening one is found (thanks @mattsep) - 1.11.1 Revert having unicode char in docstring, it breaks Bamboo builds(?!) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/parse-1.12.1/parse.egg-info/PKG-INFO new/parse-1.15.0/parse.egg-info/PKG-INFO --- old/parse-1.12.1/parse.egg-info/PKG-INFO 2019-08-18 09:34:16.000000000 +0200 +++ new/parse-1.15.0/parse.egg-info/PKG-INFO 2020-02-29 22:54:42.000000000 +0100 @@ -1,6 +1,6 @@ Metadata-Version: 1.1 Name: parse -Version: 1.12.1 +Version: 1.15.0 Summary: parse() is the opposite of format() Home-page: https://github.com/r1chardj0n3s/parse Author: Richard Jones @@ -29,7 +29,7 @@ Or find all the occurrences of some pattern in a string: - >>> ''.join(r.fixed[0] for r in findall(">{}<", "<p>the <b>bold</b> text</p>")) + >>> ''.join(r[0] for r in findall(">{}<", "<p>the <b>bold</b> text</p>")) 'the bold text' If you're going to use the same pattern to match lots of strings you can @@ -137,7 +137,8 @@ In addition some regular expression character group types "D", "w", "W", "s" and "S" are also available. - The "e" and "g" types are case-insensitive so there is not need for - the "E" or "G" types. + the "E" or "G" types. The "e" type handles Fortran formatted numbers (no + leading 0 before the decimal point). ===== =========================================== ======== Type Characters Matched Output @@ -353,6 +354,12 @@ **Version history (in brief)**: + - 1.15.0 Several fixes for parsing non-base 10 numbers (thanks @vladikcomper) + - 1.14.0 More broad acceptance of Fortran number format (thanks @purpleskyfall) + - 1.13.1 Project metadata correction. + - 1.13.0 Handle Fortran formatted numbers with no leading 0 before decimal + point (thanks @purpleskyfall). + Handle comparison of FixedTzOffset with other types of object. - 1.12.1 Actually use the `case_sensitive` arg in compile (thanks @jacquev6) - 1.12.0 Do not assume closing brace when an opening one is found (thanks @mattsep) - 1.11.1 Revert having unicode char in docstring, it breaks Bamboo builds(?!) @@ -426,10 +433,11 @@ Platform: UNKNOWN Classifier: Environment :: Web Environment Classifier: Intended Audience :: Developers -Classifier: Programming Language :: Python :: 2.7 Classifier: Programming Language :: Python :: 3.4 Classifier: Programming Language :: Python :: 3.5 Classifier: Programming Language :: Python :: 3.6 +Classifier: Programming Language :: Python :: 3.7 +Classifier: Programming Language :: Python :: 3.8 Classifier: Topic :: Software Development :: Code Generators Classifier: Topic :: Software Development :: Libraries :: Python Modules Classifier: License :: OSI Approved :: BSD License diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/parse-1.12.1/parse.egg-info/SOURCES.txt new/parse-1.15.0/parse.egg-info/SOURCES.txt --- old/parse-1.12.1/parse.egg-info/SOURCES.txt 2019-08-18 09:34:16.000000000 +0200 +++ new/parse-1.15.0/parse.egg-info/SOURCES.txt 2020-02-29 22:54:43.000000000 +0100 @@ -1,3 +1,4 @@ +LICENSE MANIFEST.in README.rst parse.py diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/parse-1.12.1/parse.py new/parse-1.15.0/parse.py --- old/parse-1.12.1/parse.py 2019-08-18 09:32:59.000000000 +0200 +++ new/parse-1.15.0/parse.py 2020-02-29 22:36:33.000000000 +0100 @@ -21,7 +21,7 @@ Or find all the occurrences of some pattern in a string: ->>> ''.join(r.fixed[0] for r in findall(">{}<", "<p>the <b>bold</b> text</p>")) +>>> ''.join(r[0] for r in findall(">{}<", "<p>the <b>bold</b> text</p>")) 'the bold text' If you're going to use the same pattern to match lots of strings you can @@ -129,7 +129,8 @@ In addition some regular expression character group types "D", "w", "W", "s" and "S" are also available. - The "e" and "g" types are case-insensitive so there is not need for - the "E" or "G" types. + the "E" or "G" types. The "e" type handles Fortran formatted numbers (no + leading 0 before the decimal point). ===== =========================================== ======== Type Characters Matched Output @@ -345,6 +346,12 @@ **Version history (in brief)**: +- 1.15.0 Several fixes for parsing non-base 10 numbers (thanks @vladikcomper) +- 1.14.0 More broad acceptance of Fortran number format (thanks @purpleskyfall) +- 1.13.1 Project metadata correction. +- 1.13.0 Handle Fortran formatted numbers with no leading 0 before decimal + point (thanks @purpleskyfall). + Handle comparison of FixedTzOffset with other types of object. - 1.12.1 Actually use the `case_sensitive` arg in compile (thanks @jacquev6) - 1.12.0 Do not assume closing brace when an opening one is found (thanks @mattsep) - 1.11.1 Revert having unicode char in docstring, it breaks Bamboo builds(?!) @@ -417,7 +424,7 @@ ''' from __future__ import absolute_import -__version__ = '1.12.1' +__version__ = '1.15.0' # yes, I now have two problems import re @@ -461,15 +468,16 @@ return decorator -def int_convert(base): +def int_convert(base=None): '''Convert a string to an integer. The string may start with a sign. - It may be of a base other than 10. + It may be of a base other than 2, 8, 10 or 16. - If may start with a base indicator, 0#nnnn, which we assume should - override the specified base. + If base isn't specified, it will be detected automatically based + on a string format. When string starts with a base indicator, 0#nnnn, + it overrides the default base of 10. It may also have other non-numeric characters that we can ignore. ''' @@ -478,19 +486,28 @@ def f(string, match, base=base): if string[0] == '-': sign = -1 + number_start = 1 + elif string[0] == '+': + sign = 1 + number_start = 1 else: sign = 1 + number_start = 0 - if string[0] == '0' and len(string) > 2: - if string[1] in 'bB': - base = 2 - elif string[1] in 'oO': - base = 8 - elif string[1] in 'xX': - base = 16 - else: - # just go with the base specifed - pass + # If base wasn't specified, detect it automatically + if base is None: + + # Assume decimal number, unless different base is detected + base = 10 + + # For number formats starting with 0b, 0o, 0x, use corresponding base ... + if string[number_start] == '0' and len(string) - number_start > 2: + if string[number_start+1] in 'bB': + base = 2 + elif string[number_start+1] in 'oO': + base = 8 + elif string[number_start+1] in 'xX': + base = 16 chars = CHARS[:base] string = re.sub('[^%s]' % chars, '', string.lower()) @@ -525,6 +542,8 @@ return self.ZERO def __eq__(self, other): + if not isinstance(other, FixedTzOffset): + return False return self._name == other._name and self._offset == other._offset @@ -959,7 +978,7 @@ # figure type conversions, if any type = format['type'] - is_numeric = type and type in 'n%fegdobh' + is_numeric = type and type in 'n%fegdobx' if type in self._extra_types: type_converter = self._extra_types[type] s = getattr(type_converter, 'pattern', r'.+?') @@ -992,13 +1011,13 @@ self._group_index += 1 self._type_conversions[group] = percentage elif type == 'f': - s = r'\d+\.\d+' + s = r'\d*\.\d+' self._type_conversions[group] = lambda s, m: float(s) elif type == 'F': - s = r'\d+\.\d+' + s = r'\d*\.\d+' self._type_conversions[group] = lambda s, m: Decimal(s) elif type == 'e': - s = r'\d+\.\d+[eE][-+]?\d+|nan|NAN|[-+]?inf|[-+]?INF' + s = r'\d*\.\d+[eE][-+]?\d+|nan|NAN|[-+]?inf|[-+]?INF' self._type_conversions[group] = lambda s, m: float(s) elif type == 'g': s = r'\d+(\.\d+)?([eE][-+]?\d+)?|nan|NAN|[-+]?inf|[-+]?INF' @@ -1009,8 +1028,8 @@ width = r'{1,%s}' % int(format['width']) else: width = '+' - s = r'\d{w}|0[xX][0-9a-fA-F]{w}|0[bB][01]{w}|0[oO][0-7]{w}'.format(w=width) - self._type_conversions[group] = int_convert(10) + s = r'\d{w}|[-+ ]?0[xX][0-9a-fA-F]{w}|[-+ ]?0[bB][01]{w}|[-+ ]?0[oO][0-7]{w}'.format(w=width) + self._type_conversions[group] = int_convert() # do not specify numeber base, determine it automatically elif type == 'ti': s = r'(\d{4}-\d\d-\d\d)((\s+|T)%s)?(Z|\s*[-+]\d\d:?\d\d)?' % \ TIME_PAT @@ -1314,7 +1333,7 @@ return Parser(format, extra_types=extra_types, case_sensitive=case_sensitive) -# Copyright (c) 2012-2019 Richard Jones <[email protected]> +# Copyright (c) 2012-2020 Richard Jones <[email protected]> # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/parse-1.12.1/setup.py new/parse-1.15.0/setup.py --- old/parse-1.12.1/setup.py 2019-01-23 03:01:28.000000000 +0100 +++ new/parse-1.15.0/setup.py 2019-12-22 22:55:03.000000000 +0100 @@ -22,10 +22,11 @@ classifiers = [ 'Environment :: Web Environment', 'Intended Audience :: Developers', - 'Programming Language :: Python :: 2.7', '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', 'Topic :: Software Development :: Code Generators', 'Topic :: Software Development :: Libraries :: Python Modules', 'License :: OSI Approved :: BSD License', diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/parse-1.12.1/test_parse.py new/parse-1.15.0/test_parse.py --- old/parse-1.12.1/test_parse.py 2019-04-07 03:12:25.000000000 +0200 +++ new/parse-1.15.0/test_parse.py 2020-02-29 22:34:31.000000000 +0100 @@ -208,12 +208,11 @@ self.assertEqual(r.fixed, (3.1415926, )) r = parse.parse('Pi/10 = {:8.5f}', 'Pi/10 = 0.31415') self.assertEqual(r.fixed, (0.31415, )) - - def test_precision_fail(self): - # floats must have a leading zero - # IS THIS CORRECT? - r = parse.parse('Pi/10 = {:8.5f}', 'Pi/10 = .31415') - self.assertEqual(r, None) + # float may have not leading zero + r = parse.parse('Pi/10 = {:8.5f}', 'Pi/10 = .31415') + self.assertEqual(r.fixed, (0.31415, )) + r = parse.parse('Pi/10 = {:8.5f}', 'Pi/10 = -.31415') + self.assertEqual(r.fixed, (-0.31415, )) def test_custom_type(self): # use a custom type @@ -361,9 +360,12 @@ y('a {:f} b', 'a 12.0 b', 12.0) y('a {:f} b', 'a -12.1 b', -12.1) y('a {:f} b', 'a +12.1 b', 12.1) + y('a {:f} b', 'a .121 b', 0.121) + y('a {:f} b', 'a -.121 b', -0.121) n('a {:f} b', 'a 12 b', None) y('a {:e} b', 'a 1.0e10 b', 1.0e10) + y('a {:e} b', 'a .0e10 b', 0.0e10) y('a {:e} b', 'a 1.0E10 b', 1.0e10) y('a {:e} b', 'a 1.10000e10 b', 1.1e10) y('a {:e} b', 'a 1.0e-10 b', 1.0e-10) @@ -401,11 +403,26 @@ y('a {:x=5d} b', 'a xxx12 b', 12) y('a {:x=5d} b', 'a -xxx12 b', -12) - def test_hex_looks_like_binary_issue65(self): - r = parse.parse('a {:x} b', 'a 0B b') - self.assertEqual(r[0], 11) - r = parse.parse('a {:x} b', 'a 0B1 b') - self.assertEqual(r[0], 1) + # Test that hex numbers that ambiguously start with 0b / 0B are parsed correctly + # See issue #65 (https://github.com/r1chardj0n3s/parse/issues/65) + y('a {:x} b', 'a 0B b', 0xB) + y('a {:x} b', 'a 0B1 b', 0xB1) + y('a {:x} b', 'a 0b b', 0xB) + y('a {:x} b', 'a 0b1 b', 0xB1) + + # Test that number signs are understood correctly + y('a {:d} b', 'a -0o10 b', -8) + y('a {:d} b', 'a -0b1010 b', -10) + y('a {:d} b', 'a -0x1010 b', -0x1010) + y('a {:o} b', 'a -10 b', -8) + y('a {:b} b', 'a -1010 b', -10) + y('a {:x} b', 'a -1010 b', -0x1010) + y('a {:d} b', 'a +0o10 b', 8) + y('a {:d} b', 'a +0b1010 b', 10) + y('a {:d} b', 'a +0x1010 b', 0x1010) + y('a {:o} b', 'a +10 b', 8) + y('a {:b} b', 'a +1010 b', 10) + y('a {:x} b', 'a +1010 b', 0x1010) def test_two_datetimes(self): r = parse.parse('a {:ti} {:ti} b', 'a 1997-07-16 2012-08-01 b') @@ -717,6 +734,11 @@ class TestBugs(unittest.TestCase): + def test_tz_compare_to_None(self): + utc = parse.FixedTzOffset(0, 'UTC') + self.assertNotEqual(utc, None) + self.assertNotEqual(utc, 'spam') + def test_named_date_issue7(self): r = parse.parse('on {date:ti}', 'on 2012-09-17') self.assertEqual(r['date'], datetime(2012, 9, 17, 0, 0, 0))
