pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/devel/py-pyparsing update to pyparsing-2.1.8



details:   https://anonhg.NetBSD.org/pkgsrc/rev/7908027c0cd2
branches:  trunk
changeset: 351214:7908027c0cd2
user:      richard <richard%pkgsrc.org@localhost>
date:      Wed Aug 17 12:33:50 2016 +0000

description:
update to pyparsing-2.1.8

==========
Change Log
==========

Version 2.1.8 -
------------------------------
- Fixed issue in the optimization to _trim_arity, when the full
  stacktrace is retrieved to determine if a TypeError is raised in
  pyparsing or in the caller's parse action. Code was traversing
  the full stacktrace, and potentially encountering UnicodeDecodeError.

- Fixed bug in ParserElement.inlineLiteralsUsing, causing infinite
  loop with Suppress.

- Fixed bug in Each, when merging named results from multiple
  expressions in a ZeroOrMore or OneOrMore. Also fixed bug when
  ZeroOrMore expressions were erroneously treated as required
  expressions in an Each expression.

- Added a few more inline doc examples.

- Improved use of runTests in several example scripts.


Version 2.1.7 -
------------------------------
- Fixed regression reported by Andrea Censi (surfaced in PyContracts
  tests) when using ParseSyntaxExceptions (raised when using operator '-')
  with packrat parsing.

- Minor fix to oneOf, to accept all iterables, not just space-delimited
  strings and lists. (If you have a list or set of strings, it is
  not necessary to concat them using ' '.join to pass them to oneOf,
  oneOf will accept the list or set or generator directly.)


Version 2.1.6 -
------------------------------
- *Major packrat upgrade*, inspired by patch provided by Tal Einat -
  many, many, thanks to Tal for working on this! Tal's tests show
  faster parsing performance (2X in some tests), *and* memory reduction
  from 3GB down to ~100MB! Requires no changes to existing code using
  packratting. (Uses OrderedDict, available in Python 2.7 and later.
  For Python 2.6 users, will attempt to import from ordereddict
  backport. If not present, will implement pure-Python Fifo dict.)

- Minor API change - to better distinguish between the flexible
  numeric types defined in pyparsing_common, I've changed "numeric"
  (which parsed numbers of different types and returned int for ints,
  float for floats, etc.) and "number" (which parsed numbers of int
  or float type, and returned all floats) to "number" and "fnumber"
  respectively. I hope the "f" prefix of "fnumber" will be a better
  indicator of its internal conversion of parsed values to floats,
  while the generic "number" is similar to the flexible number syntax
  in other languages. Also fixed a bug in pyparsing_common.numeric
  (now renamed to pyparsing_common.number), integers were parsed and
  returned as floats instead of being retained as ints.

- Fixed bug in upcaseTokens and downcaseTokens introduced in 2.1.5,
  when the parse action was used in conjunction with results names.
  Reported by Steven Arcangeli from the dql project, thanks for your
  patience, Steven!

- Major change to docs! After seeing some comments on reddit about
  general issue with docs of Python modules, and thinking that I'm a
  little overdue in doing some doc tuneup on pyparsing, I decided to
  following the suggestions of the redditor and add more inline examples
  to the pyparsing reference documentation. I hope this addition
  will clarify some of the more common questions people have, especially
  when first starting with pyparsing/Python.

- Deprecated ParseResults.asXML. I've never been too happy with this
  method, and it usually forces some unnatural code in the parsers in
  order to get decent tag names. The amount of guesswork that asXML
  has to do to try to match names with values should have been a red
  flag from day one. If you are using asXML, you will need to implement
  your own ParseResults->XML serialization. Or consider migrating to
  a more current format such as JSON (which is very easy to do:
  results_as_json = json.dumps(parse_result.asDict()) Hopefully, when
  I remove this code in a future version, I'll also be able to simplify
  some of the craziness in ParseResults, which IIRC was only there to try
  to make asXML work.

- Updated traceParseAction parse action decorator to show the repr
  of the input and output tokens, instead of the str format, since
  str has been simplified to just show the token list content.

  (The change to ParseResults.__str__ occurred in pyparsing 2.0.4, but
  it seems that didn't make it into the release notes - sorry! Too
  many users, especially beginners, were confused by the
  "([token_list], {names_dict})" str format for ParseResults, thinking
  they were getting a tuple containing a list and a dict. The full form
  can be seen if using repr().)

  For tracing tokens in and out of parse actions, the more complete
  repr form provides important information when debugging parse actions.


Verison 2.1.5 - June, 2016
------------------------------
- Added ParserElement.split() generator method, similar to re.split().
  Includes optional arguments maxsplit (to limit the number of splits),
  and includeSeparators (to include the separating matched text in the
  returned output, default=False).

- Added a new parse action construction helper tokenMap, which will
  apply a function and optional arguments to each element in a
  ParseResults. So this parse action:

      def lowercase_all(tokens):
          return [str(t).lower() for t in tokens]
      OneOrMore(Word(alphas)).setParseAction(lowercase_all)

  can now be written:

      OneOrMore(Word(alphas)).setParseAction(tokenMap(str.lower))

  Also simplifies writing conversion parse actions like:

      integer = Word(nums).setParseAction(lambda t: int(t[0]))

  to just:

      integer = Word(nums).setParseAction(tokenMap(int))

  If additional arguments are necessary, they can be included in the
  call to tokenMap, as in:

      hex_integer = Word(hexnums).setParseAction(tokenMap(int, 16))

- Added more expressions to pyparsing_common:
  . IPv4 and IPv6 addresses (including long, short, and mixed forms
    of IPv6)
  . MAC address
  . ISO8601 date and date time strings (with named fields for year, month, etc.)
  . UUID (xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx)
  . hex integer (returned as int)
  . fraction (integer '/' integer, returned as float)
  . mixed integer (integer '-' fraction, or just fraction, returned as float)
  . stripHTMLTags (parse action to remove tags from HTML source)
  . parse action helpers convertToDate and convertToDatetime to do custom parse
    time conversions of parsed ISO8601 strings

- runTests now returns a two-tuple: success if all tests succeed,
  and an output list of each test and its output lines.

- Added failureTests argument (default=False) to runTests, so that
  tests can be run that are expected failures, and runTests' success
  value will return True only if all tests *fail* as expected. Also,
  parseAll now defaults to True.

- New example numerics.py, shows samples of parsing integer and real
  numbers using locale-dependent formats:

    4.294.967.295,000
    4 294 967 295,000
    4,294,967,295.000


Version 2.1.4 - May, 2016
------------------------------
- Split out the '==' behavior in ParserElement, now implemented
  as the ParserElement.matches() method. Using '==' for string test
  purposes will be removed in a future release.

- Expanded capabilities of runTests(). Will now accept embedded
  comments (default is Python style, leading '#' character, but
  customizable). Comments will be emitted along with the tests and
  test output. Useful during test development, to create a test string
  consisting only of test case description comments separated by
  blank lines, and then fill in the test cases. Will also highlight
  ParseFatalExceptions with "(FATAL)".

- Added a 'pyparsing_common' class containing common/helpful little
  expressions such as integer, float, identifier, etc. I used this
  class as a sort of embedded namespace, to contain these helpers
  without further adding to pyparsing's namespace bloat.

- Minor enhancement to traceParseAction decorator, to retain the
  parse action's name for the trace output.

- Added optional 'fatal' keyword arg to addCondition, to indicate that
  a condition failure should halt parsing immediately.


Version 2.1.3 - May, 2016
------------------------------
- _trim_arity fix in 2.1.2 was very version-dependent on Py 3.5.0.
  Now works for Python 2.x, 3.3, 3.4, 3.5.0, and 3.5.1 (and hopefully
  beyond).


Version 2.1.2 - May, 2016
------------------------------
- Fixed bug in _trim_arity when pyparsing code is included in a
  PyInstaller, reported by maluwa.

- Fixed catastrophic regex backtracking in implementation of the
  quoted string expressions (dblQuotedString, sglQuotedString, and
  quotedString). Reported on the pyparsing wiki by webpentest,
  good catch! (Also tuned up some other expressions susceptible to the
  same backtracking problem, such as cStyleComment, cppStyleComment,
  etc.)


Version 2.1.1 - March, 2016
---------------------------
- Added support for assigning to ParseResults using slices.

- Fixed bug in ParseResults.toDict(), in which dict values were always
  converted to dicts, even if they were just unkeyed lists of tokens.
  Reported on SO by Gerald Thibault, thanks Gerald!

- Fixed bug in SkipTo when using failOn, reported by robyschek, thanks!

- Fixed bug in Each introduced in 2.1.0, reported by AND patch and
  unit test submitted by robyschek, well done!

- Removed use of functools.partial in replaceWith, as this creates
  an ambiguous signature for the generated parse action, which fails in
  PyPy. Reported by Evan Hubinger, thanks Evan!

- Added default behavior to QuotedString to convert embedded '\t', '\n',
  etc. characters to their whitespace counterparts. Found during Q&A
  exchange on SO with Maxim.

diffstat:

 devel/py-pyparsing/Makefile |   4 ++--
 devel/py-pyparsing/distinfo |  10 +++++-----
 2 files changed, 7 insertions(+), 7 deletions(-)

diffs (27 lines):

diff -r a5236a2d7d9e -r 7908027c0cd2 devel/py-pyparsing/Makefile
--- a/devel/py-pyparsing/Makefile       Wed Aug 17 09:47:47 2016 +0000
+++ b/devel/py-pyparsing/Makefile       Wed Aug 17 12:33:50 2016 +0000
@@ -1,6 +1,6 @@
-# $NetBSD: Makefile,v 1.6 2016/06/01 12:30:45 wiz Exp $
+# $NetBSD: Makefile,v 1.7 2016/08/17 12:33:50 richard Exp $
 
-DISTNAME=      pyparsing-2.1.0
+DISTNAME=      pyparsing-2.1.8
 PKGNAME=       ${PYPKGPREFIX}-${DISTNAME}
 CATEGORIES=    devel python
 MASTER_SITES=  ${MASTER_SITE_SOURCEFORGE:=pyparsing/pyparsing/${DISTNAME}/}
diff -r a5236a2d7d9e -r 7908027c0cd2 devel/py-pyparsing/distinfo
--- a/devel/py-pyparsing/distinfo       Wed Aug 17 09:47:47 2016 +0000
+++ b/devel/py-pyparsing/distinfo       Wed Aug 17 12:33:50 2016 +0000
@@ -1,6 +1,6 @@
-$NetBSD: distinfo,v 1.5 2016/02/16 13:41:15 leot Exp $
+$NetBSD: distinfo,v 1.6 2016/08/17 12:33:50 richard Exp $
 
-SHA1 (pyparsing-2.1.0.tar.gz) = bad71a5374860893962ae61262b7edc3b9b32c05
-RMD160 (pyparsing-2.1.0.tar.gz) = c0726405187f62521fec61ae5850d1565f67c010
-SHA512 (pyparsing-2.1.0.tar.gz) = 16493a4ee56ee55d70fb9784c2d275779e49125eeb9f41da15106b4123e44c9e35c1449c5106d2849140f9729f26f268238f52f279f26ae594ea0d31ed2fb09e
-Size (pyparsing-2.1.0.tar.gz) = 1144460 bytes
+SHA1 (pyparsing-2.1.8.tar.gz) = 484c1a73eadbc323b0c9429cef86cae432c38ad3
+RMD160 (pyparsing-2.1.8.tar.gz) = 3bad579f4cb89ce0228fd8ec26717024263f5495
+SHA512 (pyparsing-2.1.8.tar.gz) = 0fb98d3704f9725926b20d72f770a6188a1be6f9856c371afd25d496519b794ba0026e4f9dbeeed6e5188edb99134d8909b595fca5536b1914c5e5832ebabdb2
+Size (pyparsing-2.1.8.tar.gz) = 1222883 bytes



Home | Main Index | Thread Index | Old Index