X Tutup
Skip to content

Commit 40badef

Browse files
committed
Use external spark now.
1 parent d9ef5ff commit 40badef

File tree

9 files changed

+23
-11
lines changed

9 files changed

+23
-11
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
/.cache
44
/.eggs
55
/.python-version
6+
/.tox
7+
/README
68
/__pkginfo__.pyc
79
/dist
810
/how-to-make-a-release.txt

README.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ This uses setup.py, so it follows the standard Python routine:
4848

4949
::
5050

51+
pip install -r requirements.txt
5152
python setup.py install # may need sudo
5253
# or if you have pyenv:
5354
python setup.py develop

requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
spark_parser >= 1.0.1

uncompyle6/parser.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@
33
# Copyright (c) 2000-2002 by hartmut Goebel <h.goebel@crazy-compilers.com>
44
# Copyright (c) 1999 John Aycock
55
"""
6-
Common spark parser routines Python.
6+
Common uncompyle parser routines.
77
"""
88

99
from __future__ import print_function
1010

1111
import sys
1212

1313
from uncompyle6.code import iscode
14-
from uncompyle6.parsers.spark import GenericASTBuilder, DEFAULT_DEBUG as PARSER_DEFAULT_DEBUG
14+
from spark import GenericASTBuilder, DEFAULT_DEBUG as PARSER_DEFAULT_DEBUG
1515

1616
class ParserError(Exception):
1717
def __init__(self, token, offset):
@@ -239,7 +239,7 @@ def python_parser(version, co, out=sys.stdout, showasm=False,
239239

240240
if __name__ == '__main__':
241241
def parse_test(co):
242-
from uncompyl6 import PYTHON_VERSION
242+
from uncompyle6 import PYTHON_VERSION
243243
ast = python_parser(PYTHON_VERSION, co, showasm=True)
244244
print(ast)
245245
return

uncompyle6/parsers/astnode.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010

1111

1212
class AST(UserList):
13-
def __init__(self, type, kids=[]):
14-
self.type = intern(type)
13+
def __init__(self, kind, kids=[]):
14+
self.type = intern(kind)
1515
UserList.__init__(self, kids)
1616

1717
def isNone(self):

uncompyle6/parsers/parse2.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,16 @@
1919

2020
from uncompyle6.parser import PythonParser, nop_func
2121
from uncompyle6.parsers.astnode import AST
22-
from uncompyle6.parsers.spark import GenericASTBuilder, DEFAULT_DEBUG as PARSER_DEFAULT_DEBUG
22+
from spark import GenericASTBuilder, DEFAULT_DEBUG as PARSER_DEFAULT_DEBUG
23+
from uncompyle6 import PYTHON3
2324

2425
class Python2Parser(PythonParser):
2526

2627
def __init__(self, debug_parser=PARSER_DEFAULT_DEBUG):
27-
GenericASTBuilder.__init__(self, AST, 'stmts', debug=debug_parser)
28+
if PYTHON3:
29+
super().__init__(AST, 'stmts', debug=debug_parser)
30+
else:
31+
super(Python2Parser, self).__init__(AST, 'stmts', debug=debug_parser)
2832
self.customized = {}
2933

3034
def p_list_comprehension(self, args):

uncompyle6/parsers/parse3.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,17 @@
1919

2020
from uncompyle6.parser import PythonParser, nop_func
2121
from uncompyle6.parsers.astnode import AST
22-
from uncompyle6.parsers.spark import GenericASTBuilder, DEFAULT_DEBUG as PARSER_DEFAULT_DEBUG
22+
from spark import GenericASTBuilder, DEFAULT_DEBUG as PARSER_DEFAULT_DEBUG
23+
from uncompyle6 import PYTHON3
2324

2425
class Python3Parser(PythonParser):
2526

2627
def __init__(self, debug_parser=PARSER_DEFAULT_DEBUG):
2728
self.added_rules = set()
28-
GenericASTBuilder.__init__(self, AST, 'stmts', debug=debug_parser)
29+
if PYTHON3:
30+
super().__init__(AST, 'stmts', debug=debug_parser)
31+
else:
32+
super(Python3Parser, self).__init__(AST, 'stmts', debug=debug_parser)
2933
self.new_rules = set()
3034

3135
def add_unique_rule(self, rule, opname, count, customize):

uncompyle6/semantics/fragments.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
from StringIO import StringIO
4747

4848

49-
from uncompyle6.parsers.spark import GenericASTTraversal, GenericASTTraversalPruningException, \
49+
from spark import GenericASTTraversal, GenericASTTraversalPruningException, \
5050
DEFAULT_DEBUG as PARSER_DEFAULT_DEBUG
5151

5252
from types import CodeType

uncompyle6/semantics/pysource.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@
7070
from uncompyle6.code import iscode
7171
from uncompyle6.parser import get_python_parser
7272
from uncompyle6.parsers.astnode import AST
73-
from uncompyle6.parsers.spark import GenericASTTraversal, DEFAULT_DEBUG as PARSER_DEFAULT_DEBUG
73+
from spark import GenericASTTraversal, DEFAULT_DEBUG as PARSER_DEFAULT_DEBUG
7474
from uncompyle6.scanner import Code, get_scanner
7575
from uncompyle6.scanners.tok import Token, NoneToken
7676
import uncompyle6.parser as python_parser

0 commit comments

Comments
 (0)
X Tutup