pypi pyparsing 3.2.0b2
pyparsing 3.2.0b2

8 hours ago
  • Added type annotations to remainder of pyparsing package, and added mypy run to tox.ini, so that type annotations are now run as part of pyparsing's CI. Addresses Issue #373, raised by Iwan Aucamp, thanks!

  • Exception message format can now be customized, by overriding ParseBaseException.format_message:

    def custom_exception_message(exc) -> str:
        found_phrase = f", found {exc.found}" if exc.found else ""
        return f"{exc.lineno}:{exc.column} {exc.msg}{found_phrase}"
    
    ParseBaseException.formatted_message = custom_exception_message
    

    (PR #571 submitted by Odysseyas Krystalakos, nice work!)

  • POSSIBLE BREAKING CHANGE: Fixed bug in transform_string() where whitespace in the input string was not properly preserved in the output string.

    If your code uses transform_string, this bugfix may require changes in your code.

  • Fixed railroad diagrams that get generated with a parser containing a Regex element defined using a verbose pattern - the pattern gets flattened and comments removed before creating the corresponding diagram element.

  • Defined a more performant regular expression used internally by common_html_entity.

  • Regex instances can now be created using a callable that takes no arguments and just returns a string or a compiled regular expression, so that creating complex regular expression patterns can be deferred until they are actually used for the first time in the parser.

  • Added optional flatten Boolean argument to ParseResults.as_list(), to return the parsed values in a flattened list.

Don't miss a new pyparsing release

NewReleases is sending notifications on new releases.