diff options
author | Todd Gamblin <tgamblin@llnl.gov> | 2021-12-22 12:44:42 -0800 |
---|---|---|
committer | Greg Becker <becker33@llnl.gov> | 2022-01-12 06:14:18 -0800 |
commit | 396c37d82f1d05084a9d4ba3a08775ef160f4604 (patch) | |
tree | 7bb874d11b8e7780eeda511ac1e9ad5aad8ca560 /COPYRIGHT | |
parent | afb358313aacfb8bf63c8dc084eea17c7903b9f8 (diff) | |
download | spack-396c37d82f1d05084a9d4ba3a08775ef160f4604.tar.gz spack-396c37d82f1d05084a9d4ba3a08775ef160f4604.tar.bz2 spack-396c37d82f1d05084a9d4ba3a08775ef160f4604.tar.xz spack-396c37d82f1d05084a9d4ba3a08775ef160f4604.zip |
unparser: implement operator precedence algorithm for unparser
Backport operator precedence algorithm from here:
https://github.com/python/cpython/commit/397b96f6d7a89f778ebc0591e32216a8183fe667
This eliminates unnecessary parentheses from our unparsed output and makes Spack's unparser
consistent with the one in upstream Python 3.9+, with one exception.
Our parser normalizes argument order when `py_ver_consistent` is set, so that star arguments
in function calls come last. We have to do this because Python 2's AST doesn't have information
about their actual order.
If we ever support only Python 3.9 and higher, we can easily switch over to `ast.unparse`, as
the unparsing is consistent except for this detail (modulo future changes to `ast.unparse`)
Diffstat (limited to 'COPYRIGHT')
-rw-r--r-- | COPYRIGHT | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -42,6 +42,10 @@ PackageName: argparse PackageHomePage: https://pypi.python.org/pypi/argparse PackageLicenseDeclared: Python-2.0 +PackageName: astunparse +PackageHomePage: https://github.com/simonpercivall/astunparse +PackageLicenseDeclared: Python-2.0 + PackageName: attrs PackageHomePage: https://github.com/python-attrs/attrs PackageLicenseDeclared: MIT @@ -101,7 +105,3 @@ PackageLicenseDeclared: Apache-2.0 OR MIT PackageName: six PackageHomePage: https://pypi.python.org/pypi/six PackageLicenseDeclared: MIT - -PackageName: spack_astunparse -PackageHomePage: https://github.com/simonpercivall/astunparse -PackageLicenseDeclared: Python-2.0 |