From 396c37d82f1d05084a9d4ba3a08775ef160f4604 Mon Sep 17 00:00:00 2001 From: Todd Gamblin Date: Wed, 22 Dec 2021 12:44:42 -0800 Subject: 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`) --- COPYRIGHT | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'COPYRIGHT') diff --git a/COPYRIGHT b/COPYRIGHT index df7d47499a..6931a6ce31 100644 --- a/COPYRIGHT +++ b/COPYRIGHT @@ -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 -- cgit v1.2.3-60-g2f50