You've already forked python-uncompyle6
mirror of
https://github.com/rocky/python-uncompyle6.git
synced 2025-08-04 01:09:52 +08:00
DRY redundant custom rule checking code
This commit is contained in:
@@ -17,7 +17,7 @@ that a later phase can tern into a sequence of ASCII text.
|
||||
|
||||
from __future__ import print_function
|
||||
|
||||
from uncompyle6.parser import PythonParser, PythonParserSingle, nop_func
|
||||
from uncompyle6.parser import PythonParser, PythonParserSingle
|
||||
from uncompyle6.parsers.astnode import AST
|
||||
from spark_parser import DEFAULT_DEBUG as PARSER_DEFAULT_DEBUG
|
||||
from uncompyle6 import PYTHON3
|
||||
@@ -32,17 +32,6 @@ class Python3Parser(PythonParser):
|
||||
super(Python3Parser, self).__init__(AST, 'stmts', debug=debug_parser)
|
||||
self.new_rules = set()
|
||||
|
||||
def add_unique_rule(self, rule, opname, count, customize):
|
||||
"""Add rule to grammar, but only if it hasn't been added previously
|
||||
"""
|
||||
if rule not in self.new_rules:
|
||||
# print("XXX ", rule) # debug
|
||||
self.new_rules.add(rule)
|
||||
self.addRule(rule, nop_func)
|
||||
customize[opname] = count
|
||||
pass
|
||||
return
|
||||
|
||||
def p_list_comprehension3(self, args):
|
||||
"""
|
||||
# Python3 scanner adds LOAD_LISTCOMP. Python3 does list comprehension like
|
||||
|
Reference in New Issue
Block a user