Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

"Money is the root of all money." -- the moving finger


devel / comp.lang.python.announce / [Python-announce] pyparsing 3.1.0 released

SubjectAuthor
o [Python-announce] pyparsing 3.1.0 releasedPaul McGuire

1
[Python-announce] pyparsing 3.1.0 released

<cc58f14a-fc6b-4c72-94de-3aca43e8b61cn@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=10028&group=comp.lang.python.announce#10028

  copy link   Newsgroups: comp.lang.python.announce
Path: i2pn2.org!i2pn.org!news.swapon.de!fu-berlin.de!uni-berlin.de!not-for-mail
From: ptm...@austin.rr.com (Paul McGuire)
Newsgroups: comp.lang.python.announce
Subject: [Python-announce] pyparsing 3.1.0 released
Date: Sun, 18 Jun 2023 15:57:35 -0700 (PDT)
Lines: 232
Approved: python-announce-list@python.org
Message-ID: <cc58f14a-fc6b-4c72-94de-3aca43e8b61cn@googlegroups.com>
Reply-To: python-list@python.org
Mime-Version: 1.0
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Trace: news.uni-berlin.de 27xtvSAby4aeX6Zt4Xio7w3lAt1zD4S1avtxwxjnGkSA==
X-Orig-Path: postnews.google.com!google-groups.googlegroups.com!not-for-mail
Authentication-Results: mail.python.org; dkim=none reason="no signature";
dkim-adsp=none (unprotected policy); dkim-atps=neutral
X-Spam-Status: OK 0.000
X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'generated': 0.03;
'argument': 0.04; '3.6': 0.05; 'run.': 0.05; 'variable': 0.05;
'2023': 0.07; 'class.': 0.07; 'debug': 0.07; 'debugging': 0.07;
'matches': 0.07; 'string': 0.07; 'python.': 0.08; 'ast': 0.09;
'deeper': 0.09; 'example.': 0.09; 'expression': 0.09; 'parse':
0.09; 'prs': 0.09; 'pushed': 0.09; 'set.': 0.09; 'skip:` 10':
0.09; 'skip:` 20': 0.09; 'tags': 0.09; 'text.': 0.09;
'subject:Python': 0.12; '"\\n"': 0.16; '#477': 0.16; "'/'": 0.16;
'antony': 0.16; 'arguments': 0.16; 'backslash': 0.16; 'beta':
0.16; 'brum': 0.16; 'builtin': 0.16; 'cases,': 0.16; 'confusion':
0.16; 'constructor': 0.16; 'corrected': 0.16; 'demonstrates':
0.16; 'devin': 0.16; 'diagram': 0.16; 'discontinue': 0.16; 'doc':
0.16; 'elijah': 0.16; 'examples.': 0.16; 'executable': 0.16;
'expressions': 0.16; 'false.': 0.16; 'fixes': 0.16; 'flag': 0.16;
'generates': 0.16; 'given,': 0.16; 'nodes': 0.16; 'parsing': 0.16;
'received:mod-relay.zaccari.net': 0.16; 'received:zaccari.net':
0.16; 'removed.': 0.16; 'scanning': 0.16; 'shallow': 0.16;
'syntax,': 0.16; 'to:addr:comp-lang-python-announce': 0.16;
'to:addr:moderators.isc.org': 0.16; 'unicode': 0.16; 'work:':
0.16; 'writable': 0.16; 'wrote:': 0.16; 'python': 0.16; 'api':
0.17; 'values': 0.17; 'applications': 0.17; 'instead': 0.17;
'addresses': 0.19; 'bug': 0.19; 'name.': 0.19; 'url': 0.19;
'issue': 0.21; 'language': 0.21; 'subject:] ': 0.21; 'input':
0.21; 'written': 0.22; "i've": 0.22; 'creates': 0.22; 'exception':
0.22; 'first,': 0.22; 'version': 0.23; 'code': 0.23; 'skip:p 30':
0.23; 'thanks!': 0.24; '(and': 0.25; 'skip:- 10': 0.25;
'discussion': 0.25; 'examples': 0.25; 'brought': 0.26; 'classes':
0.26; 'interface': 0.26; 'normally': 0.26; 'function': 0.27;
'old': 0.27; 'done': 0.28; 'fact': 0.28; 'output': 0.28; 'error':
0.29; 'header:User-Agent:1': 0.30; 'deep': 0.31; 'default': 0.31;
'raise': 0.31; 'saved': 0.31; 'skip:w 20': 0.69; 'older': 0.70;
'raised': 0.70; 'resulting': 0.70; 'you.': 0.71; 'ignore': 0.71;
'attention': 0.71; 'note:': 0.71; 'performance': 0.71; 'addition':
0.71; 'longer': 0.71; 'future': 0.72; 'late': 0.73; 'name,': 0.75;
'released': 0.75; 'features': 0.75; 'favor': 0.76; 'implemented':
0.76; 'mit': 0.76; 'requested': 0.76; 'skip:k 20': 0.78; 'field':
0.78; 'html': 0.80; 'names,': 0.81; 'returned': 0.81; 'left':
0.83; '"")': 0.84; '(such': 0.84; '-----------': 0.84; 'cited':
0.84; 'handled': 0.84; 'indicates': 0.84; 'invalid.': 0.84;
'job,': 0.84; 'joyce': 0.84; 'license,': 0.84; 'peaceful': 0.84;
'strings': 0.84; 'property': 0.88; 'formerly': 0.91; 'grammar':
0.91; 'validated': 0.91; 'google.': 0.95
Delivered-To: comp-lang-python-announce@moderators.isc.org
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20221208; t=1687129389; x=1689721389;
h=content-transfer-encoding:to:injection-date:from:subject:message-id
:mime-version:user-agent:nntp-posting-host:injection-info:date
:newsgroups:path:x-gm-message-state:from:to:cc:subject:date
:message-id:reply-to;
bh=fKl/62sotyYJEZ0V0QGKx4lazwokwlzztAK1sqqZL6o=;
b=KjgVRBVdVWQJBJUk5xWeYxCIhkZx5O1LPG+ocenFCENE8W1uTbCzzFe30ViZ8/+jm9
jefUKaJ/SYL95rDignYGaDOm8fmFNyIMhjv23Z3y71hvt9PGDWi7tDiyhLlhC/rJtFSm
hUIUGLLZEeXd/IEJWQXurpCbN7sDVSAnRQUsgT8F15vUzqp79NmgxtjiprTT/B+PDViB
z/I1C6BkYeueBKjIUYFiEikGaenUFxO2Fly4WJ7FhvL1Wv1QVE5Ib80uOInbScDu+QBk
RJd6z9a9LG2x6SDAWZ2XpuwNk1bXWU+jGh+Bb/vOq8pEuJlNSTTM/OLfliXLkQvyHwNe
u7yw==
X-Gm-Message-State: AC+VfDwM/flWAnmquPnKG0v0MoFsFWn+usSB8Owb5BzHOqD2U427IuXv
oq+uom4ziLYzAysbHlXUtDqyLfzn9ZULCNtXnhk=
X-Google-Smtp-Source: ACHHUZ6/ZVt6zwmDNGe2IAjV4nTtCrOotZhJQpeGtvX832g6Rg3s4spQizoXfC5M4IX5kF0gyy21zNAOIV9qg3156YM5vz5vZ9U4
X-Received: by 2002:a05:620a:2450:b0:75f:216:4b8b with SMTP id h16-20020a05620a245000b0075f02164b8bmr3308440qkn.3.1687129055874;
Sun, 18 Jun 2023 15:57:35 -0700 (PDT)
X-Received: by 2002:a4a:bc83:0:b0:558:b20b:ad13 with SMTP id
m3-20020a4abc83000000b00558b20bad13mr1473331oop.1.1687129055449; Sun, 18 Jun
2023 15:57:35 -0700 (PDT)
Injection-Info: google-groups.googlegroups.com; posting-host=66.25.26.144; posting-account=-Jy_dgkAAAC51hSGV4Rus-CacVPnrFK8
User-Agent: G2/1.0
Injection-Date: Sun, 18 Jun 2023 22:57:35 +0000
X-MailFrom: news@google.com
X-Mailman-Rule-Hits: emergency
X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved
Message-ID-Hash: 6IJFU3WYJTGZGELM2UZMDCQQXHGRKHVV
X-Message-ID-Hash: 6IJFU3WYJTGZGELM2UZMDCQQXHGRKHVV
X-Mailman-Approved-At: Sun, 18 Jun 2023 20:48:07 -0400
X-Mailman-Version: 3.3.9b1
Precedence: list
List-Id: Announcement-only list for the Python programming language <python-announce-list.python.org>
Archived-At: <https://mail.python.org/archives/list/python-announce-list@python.org/message/6IJFU3WYJTGZGELM2UZMDCQQXHGRKHVV/>
List-Archive: <https://mail.python.org/archives/list/python-announce-list@python.org/>
List-Help: <mailto:python-announce-list-request@python.org?subject=help>
List-Owner: <mailto:python-announce-list-owner@python.org>
List-Post: <mailto:python-announce-list@python.org>
List-Subscribe: <mailto:python-announce-list-join@python.org>
List-Unsubscribe: <mailto:python-announce-list-leave@python.org>
 by: Paul McGuire - Sun, 18 Jun 2023 22:57 UTC

After several alpha and beta releases, I've finally pushed out version 3.1.0 of pyparsing. Here are the highlights:

NOTE: In the future release 3.2.0, use of many of the pre-PEP8 methods (such as `ParserElement.parseString`) will start to raise `DeprecationWarnings`.. 3.2.0 should get released some time later in 2023. I currently plan to completely drop the pre-PEP8 methods in pyparsing 4.0, though we won't see that release until at least late 2023 if not 2024. So there is plenty of time to convert existing parsers to the new function names before the old functions are completely removed. (Big help from Devin J. Pohly in structuring the code to enable this peaceful transition.)

Version 3.2.0 will also discontinue support for Python versions 3.6 and 3.7..

Version 3.1.0 - June, 2023
--------------------------

API CHANGES
-----------

- A slight change has been implemented when unquoting a quoted string parsed using the `QuotedString` class. Formerly, when unquoting and processing whitespace markers such as \t and \n, these substitutions would occur first, and then any additional '\' escaping would be done on the resulting string.. This would parse "\\n" as "\<newline>". Now escapes and whitespace markers are all processed in a single pass working left to right, so the quoted string "\\n" would get unquoted to "\n" (a backslash followed by "n"). Fixes issue #474 raised by jakeanq, thanks!

- Reworked `delimited_list` function into the new `DelimitedList` class. `DelimitedList` has the same constructor interface as `delimited_list`, and in this release, `delimited_list` changes from a function to a synonym for `DelimitedList`. `delimited_list` and the older `delimitedList` method will be deprecated in a future release, in favor of `DelimitedList`.

- `ParserElement.validate()` is deprecated. It predates the support for left-recursive parsers, and was prone to false positives (warning that a grammar was invalid when it was in fact valid). It will be removed in a future pyparsing release. In its place, developers should use debugging and analytical tools, such as `ParserElement.set_debug()` and `ParserElement.create_diagram()`. (Raised in Issue #444, thanks Andrea Micheli!)

NEW FEATURES AND ENHANCEMENTS
-----------------------------

- `Optional(expr)` may now be written as `expr | ""`

This will make this code:

"{" + Optional(Literal("A") | Literal("a")) + "}"

writable as:

"{" + (Literal("A") | Literal("a") | "") + "}"

Some related changes implemented as part of this work:
- `Literal("")` now internally generates an `Empty()` (and no longer raises an exception)
- `Empty` is now a subclass of `Literal`

Suggested by Antony Lee (issue #412), PR (#413) by Devin J. Pohly.

- Added new class method `ParserElement.using_each`, to simplify code that creates a sequence of `Literals`, `Keywords`, or other `ParserElement` subclasses.

For instance, to define suppressible punctuation, you would previously write:

LPAR, RPAR, LBRACE, RBRACE, SEMI = map(Suppress, "(){};")

You can now write:

LPAR, RPAR, LBRACE, RBRACE, SEMI = Suppress.using_each("(){};")

`using_each` will also accept optional keyword args, which it will pass through to the class initializer. Here is an expression for single-letter variable names that might be used in an algebraic expression:

algebra_var = MatchFirst(
Char.using_each(string.ascii_lowercase, as_keyword=True)
)

- Added new builtin `python_quoted_string`, which will match any form of single-line or multiline quoted strings defined in Python. (Inspired by discussion with Andreas Schörgenhumer in Issue #421.)

- Extended `expr[]` notation for repetition of `expr` to accept a slice, where the slice's stop value indicates a `stop_on` expression:

test = "BEGIN aaa bbb ccc END"
BEGIN, END = Keyword.using_each("BEGIN END".split())
body_word = Word(alphas)

expr = BEGIN + Group(body_word[...:END]) + END
# equivalent to
# expr = BEGIN + Group(ZeroOrMore(body_word, stop_on=END)) + END

print(expr.parse_string(test))

Prints:

['BEGIN', ['aaa', 'bbb', 'ccc'], 'END']

- Added named field "url" to `pyparsing.common.url`, returning the entire parsed URL string.

- Added bool `embed` argument to `ParserElement.create_diagram()`. When passed as True, the resulting diagram will omit the `<DOCTYPE>`, `<HEAD>`, and `<BODY>` tags so that it can be embedded in other HTML source. (Useful when embedding a call to `create_diagram()` in a PyScript HTML page.)

- Added `recurse` argument to `ParserElement.set_debug` to set the debug flag on an expression and all of its sub-expressions. Requested by multimeric in Issue #399.

- Added '·' (Unicode MIDDLE DOT) to the set of Latin1.identbodychars.

- `ParseResults` now has a new method `deepcopy()`, in addition to the current `copy()` method. `copy()` only makes a shallow copy - any contained `ParseResults` are copied as references - changes in the copy will be seen as changes in the original. In many cases, a shallow copy is sufficient, but some applications require a deep copy. `deepcopy()` makes a deeper copy: any contained `ParseResults` or other mappings or containers are built with copies from the original, and do not get changed if the original is later changed. Addresses issue #463, reported by Bryn Pickering.

- Added new class property `identifier` to all Unicode set classes in `pyparsing.unicode`, using the class's values for `cls.identchars` and `cls.identbodychars`. Now Unicode-aware parsers that formerly wrote:

ppu = pyparsing.unicode
ident = Word(ppu.Greek.identchars, ppu.Greek.identbodychars)

can now write:

ident = ppu.Greek.identifier
# or
# ident = ppu.????????.identifier

- Error messages from `MatchFirst` and `Or` expressions will try to give more details if one of the alternatives matches better than the others, but still fails. Question raised in Issue #464 by msdemlei, thanks!

BUG FIXES AND GENERAL CHANGES
-----------------------------

- Added support for Python 3.12.

- Updated `ci.yml` permissions to limit default access to source - submitted by Joyce Brum of Google. Thanks so much!

- Updated `create_diagram()` code to be compatible with `railroad-diagrams` package version 3.0. Fixes Issue #477 (railroad diagrams generated with black bars), reported by Sam Morley-Short.

- Fixed bug in `NotAny`, where parse actions on the negated expr were not being run. This could cause `NotAny` to incorrectly fail if the expr would normally match, but would fail to match if a condition used as a parse action returned False. Fixes Issue #482, raised by byaka, thank you!

- Fixed `create_diagram()` to accept keyword args, to be passed through to the `template.render()` method to generate the output HTML (PR submitted by Aussie Schnore, good catch!)

- Fixed bug in `python_quoted_string` regex.

- Fixed bug when parse actions returned an empty string for an expression that had a results name, that the results name was not saved. That is:

expr = Literal("X").add_parse_action(lambda tokens: "")("value")
result = expr.parse_string("X")
print(result["value"])

would raise a `KeyError`. Now empty strings will be saved with the associated results name. Raised in Issue #470 by Nicco Kunzmann, thank you.

- Fixed bug in `SkipTo` where ignore expressions were not properly handled while scanning for the target expression. Issue #475, reported by elkniwt, thanks (this bug has been there for a looooong time!).

- Fixed bug in `Word` when `max=2`. Also added performance enhancement when specifying `exact` argument. Reported in issue #409 by panda-34, nice catch!

- `Word` arguments are now validated if `min` and `max` are both given, that `min` <= `max`; raises `ValueError` if values are invalid.

- Fixed bug in srange, when parsing escaped '/' and '\' inside a range set.

- Fixed exception messages for some `ParserElements` with custom names, which instead showed their contained expression names.

- Fixed bug in pyparsing.common.url, when input URL is not alone on an input line. Fixes Issue #459, reported by David Kennedy.

- Multiple added and corrected type annotations. With much help from Stephen Rosen, thanks!

- Some documentation and error message clarifications on pyparsing's keyword logic, cited by Basil Peace.

- General docstring cleanup for Sphinx doc generation, PRs submitted by Devin J. Pohly. A dirty job, but someone has to do it - much appreciated!

EXAMPLE UPDATES
---------------

- Added `tag_emitter.py` to examples. This example demonstrates how to insert tags into your parsed results that are not part of the original parsed text.

- Added `bf.py` Brainf*ck parser/executor example. Illustrates using a pyparsing grammar to parse language syntax, and attach executable AST nodes to the parsed results.

- `invRegex.py` example renamed to `inv_regex.py` and updated to PEP-8 variable and method naming. PR submitted by Ross J. Duff, thanks!

- Removed examples `sparser.py` and `pymicko.py`, since each included its own GPL license in the header. Since this conflicts with pyparsing's MIT license, they were removed from the distribution to avoid confusion among those making use of them in their own projects.


Click here to read the complete article

devel / comp.lang.python.announce / [Python-announce] pyparsing 3.1.0 released

1
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor