From 9d150e070782d96929eeae760ba1ed0d2b2d353e Mon Sep 17 00:00:00 2001 From: rocky Date: Fri, 12 Jul 2024 12:09:51 -0400 Subject: [PATCH] Update copyright --- uncompyle6/parsers/parse27.py | 2 +- uncompyle6/parsers/parse31.py | 2 +- uncompyle6/parsers/parse32.py | 4 ++-- uncompyle6/parsers/parse34.py | 28 ++++++++++++++++++---------- 4 files changed, 22 insertions(+), 14 deletions(-) diff --git a/uncompyle6/parsers/parse27.py b/uncompyle6/parsers/parse27.py index 79921399..5dc359e7 100644 --- a/uncompyle6/parsers/parse27.py +++ b/uncompyle6/parsers/parse27.py @@ -1,4 +1,4 @@ -# Copyright (c) 2016-2020, 2023 Rocky Bernstein +# Copyright (c) 2016-2020, 2023-2024 Rocky Bernstein # Copyright (c) 2005 by Dan Pascu # Copyright (c) 2000-2002 by hartmut Goebel diff --git a/uncompyle6/parsers/parse31.py b/uncompyle6/parsers/parse31.py index 18587bb2..94516372 100644 --- a/uncompyle6/parsers/parse31.py +++ b/uncompyle6/parsers/parse31.py @@ -1,4 +1,4 @@ -# Copyright (c) 2016-2017, 2022 Rocky Bernstein +# Copyright (c) 2016-2017, 2022, 2024 Rocky Bernstein """ spark grammar differences over Python 3.2 for Python 3.1. """ diff --git a/uncompyle6/parsers/parse32.py b/uncompyle6/parsers/parse32.py index 923aca73..2e94e729 100644 --- a/uncompyle6/parsers/parse32.py +++ b/uncompyle6/parsers/parse32.py @@ -1,4 +1,4 @@ -# Copyright (c) 2016-2017, 2022 Rocky Bernstein +# Copyright (c) 2016-2017, 2022-2024 Rocky Bernstein """ spark grammar differences over Python 3 for Python 3.2. """ @@ -84,7 +84,7 @@ class Python32Parser(Python3Parser): for i, token in enumerate(tokens): opname = token.kind if opname.startswith("MAKE_FUNCTION_A"): - args_pos, args_kw, annotate_args = token.attr + args_pos, _, annotate_args = token.attr # Check that there are 2 annotated params? rule = ( "mkfunc_annotate ::= %s%sannotate_tuple " diff --git a/uncompyle6/parsers/parse34.py b/uncompyle6/parsers/parse34.py index 39b04082..caae5e2e 100644 --- a/uncompyle6/parsers/parse34.py +++ b/uncompyle6/parsers/parse34.py @@ -1,4 +1,4 @@ -# Copyright (c) 2017-2018 Rocky Bernstein +# Copyright (c) 2017-2018, 2022-2024 Rocky Bernstein # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -21,7 +21,6 @@ from uncompyle6.parsers.parse33 import Python33Parser class Python34Parser(Python33Parser): - def p_misc34(self, args): """ expr ::= LOAD_ASSERT @@ -57,36 +56,45 @@ class Python34Parser(Python33Parser): """ def customize_grammar_rules(self, tokens, customize): - self.remove_rules(""" + self.remove_rules( + """ yield_from ::= expr expr YIELD_FROM # 3.4.2 has this. 3.4.4 may now # while1stmt ::= SETUP_LOOP l_stmts COME_FROM JUMP_BACK COME_FROM_LOOP - """) + """ + ) super(Python34Parser, self).customize_grammar_rules(tokens, customize) return + class Python34ParserSingle(Python34Parser, PythonParserSingle): pass -if __name__ == '__main__': +if __name__ == "__main__": # Check grammar p = Python34Parser() p.check_grammar() from xdis.version_info import IS_PYPY, PYTHON_VERSION_TRIPLE + if PYTHON_VERSION_TRIPLE[:2] == (3, 4): lhs, rhs, tokens, right_recursive, dup_rhs = p.check_sets() from uncompyle6.scanner import get_scanner + s = get_scanner(PYTHON_VERSION_TRIPLE, IS_PYPY) - opcode_set = set(s.opc.opname).union(set( - """JUMP_BACK CONTINUE RETURN_END_IF COME_FROM + opcode_set = set(s.opc.opname).union( + set( + """JUMP_BACK CONTINUE RETURN_END_IF COME_FROM LOAD_GENEXPR LOAD_ASSERT LOAD_SETCOMP LOAD_DICTCOMP LOAD_CLASSNAME LAMBDA_MARKER RETURN_LAST - """.split())) + """.split() + ) + ) remain_tokens = set(tokens) - opcode_set import re - remain_tokens = set([re.sub(r'_\d+$', '', t) for t in remain_tokens]) - remain_tokens = set([re.sub('_CONT$', '', t) for t in remain_tokens]) + + remain_tokens = set([re.sub(r"_\d+$", "", t) for t in remain_tokens]) + remain_tokens = set([re.sub("_CONT$", "", t) for t in remain_tokens]) remain_tokens = set(remain_tokens) - opcode_set print(remain_tokens) # print(sorted(p.rule2name.items()))