<86>Apr 21 01:00:03 userdel[20762]: delete user 'rooter' <86>Apr 21 01:00:03 groupadd[20779]: group added to /etc/group: name=rooter, GID=597 <86>Apr 21 01:00:03 groupadd[20779]: group added to /etc/gshadow: name=rooter <86>Apr 21 01:00:03 groupadd[20779]: new group: name=rooter, GID=597 <86>Apr 21 01:00:03 useradd[20792]: new user: name=rooter, UID=597, GID=597, home=/root, shell=/bin/bash <86>Apr 21 01:00:03 userdel[20808]: delete user 'builder' <86>Apr 21 01:00:03 userdel[20808]: removed group 'builder' owned by 'builder' <86>Apr 21 01:00:03 userdel[20808]: removed shadow group 'builder' owned by 'builder' <86>Apr 21 01:00:03 groupadd[20823]: group added to /etc/group: name=builder, GID=598 <86>Apr 21 01:00:03 groupadd[20823]: group added to /etc/gshadow: name=builder <86>Apr 21 01:00:03 groupadd[20823]: new group: name=builder, GID=598 <86>Apr 21 01:00:03 useradd[20833]: new user: name=builder, UID=598, GID=598, home=/usr/src, shell=/bin/bash <13>Apr 21 01:00:06 rpmi: libexpat-2.2.4-alt0.M80P.1 1503871120 installed <13>Apr 21 01:00:06 rpmi: libgdbm-1.8.3-alt10 1454943313 installed <13>Apr 21 01:00:06 rpmi: libtinfo-devel-5.9-alt8 1456756459 installed <13>Apr 21 01:00:06 rpmi: libncurses-devel-5.9-alt8 1456756459 installed <13>Apr 21 01:00:06 rpmi: python-modules-curses-2.7.11-alt6.M80P.1 1527682470 installed <13>Apr 21 01:00:06 rpmi: libverto-0.2.6-alt1_6 1455633234 installed <13>Apr 21 01:00:06 rpmi: libkeyutils-1.5.10-alt0.M80P.2 p8+216694.100.6.1 1547827915 installed <13>Apr 21 01:00:06 rpmi: libcom_err-1.42.13-alt2 1449075846 installed <13>Apr 21 01:00:06 rpmi: ca-certificates-2016.02.25-alt1 1462368370 installed <13>Apr 21 01:00:07 rpmi: libcrypto10-1.0.2n-alt0.M80P.1 1512766129 installed <13>Apr 21 01:00:07 rpmi: libssl10-1.0.2n-alt0.M80P.1 1512766129 installed <86>Apr 21 01:00:07 groupadd[28014]: group added to /etc/group: name=_keytab, GID=499 <86>Apr 21 01:00:07 groupadd[28014]: group added to /etc/gshadow: name=_keytab <86>Apr 21 01:00:07 groupadd[28014]: new group: name=_keytab, GID=499 <13>Apr 21 01:00:07 rpmi: libkrb5-1.14.6-alt1.M80P.1 1525355673 installed <13>Apr 21 01:00:07 rpmi: python3-base-3.5.4-alt2.M80P.1 1527753911 installed <13>Apr 21 01:00:07 rpmi: python-modules-compiler-2.7.11-alt6.M80P.1 1527682470 installed <13>Apr 21 01:00:08 rpmi: python3-module-py-1.4.34-alt0.M80P.1 1503506764 installed <13>Apr 21 01:00:08 rpmi: python-modules-email-2.7.11-alt6.M80P.1 1527682470 installed <13>Apr 21 01:00:08 rpmi: python3-3.5.4-alt2.M80P.1 1527753911 installed <13>Apr 21 01:00:08 rpmi: rpm-build-python3-0.1.10.10-alt1.M80P.1 1530521451 installed <13>Apr 21 01:00:08 rpmi: python-modules-unittest-2.7.11-alt6.M80P.1 1527682470 installed <13>Apr 21 01:00:08 rpmi: python3-module-pytest-3.2.1-alt0.M80P.1 1503499784 installed <13>Apr 21 01:00:08 rpmi: python3-module-setuptools-1:18.5-alt0.M80P.1 1497527461 installed <13>Apr 21 01:00:08 rpmi: python-modules-2.7.11-alt6.M80P.1 1527682470 installed <13>Apr 21 01:00:08 rpmi: python-modules-ctypes-2.7.11-alt6.M80P.1 1527682470 installed <13>Apr 21 01:00:08 rpmi: python-modules-encodings-2.7.11-alt6.M80P.1 1527682470 installed <13>Apr 21 01:00:08 rpmi: python-modules-multiprocessing-2.7.11-alt6.M80P.1 1527682470 installed <13>Apr 21 01:00:08 rpmi: python-modules-logging-2.7.11-alt6.M80P.1 1527682470 installed <13>Apr 21 01:00:08 rpmi: python-tools-2to3-2.7.11-alt6.M80P.1 1527682470 installed <13>Apr 21 01:00:08 rpmi: python-modules-xml-2.7.11-alt6.M80P.1 1527682470 installed <13>Apr 21 01:00:08 rpmi: python-modules-hotshot-2.7.11-alt6.M80P.1 1527682470 installed <13>Apr 21 01:00:08 rpmi: python-modules-bsddb-2.7.11-alt6.M80P.1 1527682470 installed <13>Apr 21 01:00:08 rpmi: python-2.7.11-alt6.M80P.1 1527682470 installed <13>Apr 21 01:00:08 rpmi: python-dev-2.7.11-alt6.M80P.1 1527682470 installed <13>Apr 21 01:00:08 rpmi: python-module-py-1.4.34-alt0.M80P.1 1503506764 installed <13>Apr 21 01:00:08 rpmi: python-modules-json-2.7.11-alt6.M80P.1 1527682470 installed <13>Apr 21 01:00:08 rpmi: python-module-pytest-3.2.1-alt0.M80P.1 1503499784 installed <13>Apr 21 01:00:08 rpmi: python-module-setuptools-1:18.5-alt0.M80P.1 1497527461 installed Installing python-module-ply-3.8-alt0.M80P.1.src.rpm Building target platforms: x86_64 Building for target x86_64 Executing(%prep): /bin/sh -e /usr/src/tmp/rpm-tmp.34194 + umask 022 + /bin/mkdir -p /usr/src/RPM/BUILD + cd /usr/src/RPM/BUILD + cd /usr/src/RPM/BUILD + rm -rf ply-3.8 + echo 'Source #0 (ply-3.8.tar.bz2):' Source #0 (ply-3.8.tar.bz2): + /bin/bzip2 -dc /usr/src/RPM/SOURCES/ply-3.8.tar.bz2 + /bin/tar -xf - + cd ply-3.8 + /bin/chmod -c -Rf u+rwX,go-w . + rm -rf ../python3 + cp -a . ../python3 + exit 0 Executing(%build): /bin/sh -e /usr/src/tmp/rpm-tmp.34194 + umask 022 + /bin/mkdir -p /usr/src/RPM/BUILD + cd /usr/src/RPM/BUILD + cd ply-3.8 + CFLAGS='-pipe -Wall -g -O2' + export CFLAGS + CXXFLAGS='-pipe -Wall -g -O2' + export CXXFLAGS + FFLAGS='-pipe -Wall -g -O2' + export FFLAGS + /usr/bin/python setup.py build running build running build_py creating build creating build/lib creating build/lib/ply copying ply/ygen.py -> build/lib/ply copying ply/yacc.py -> build/lib/ply copying ply/lex.py -> build/lib/ply copying ply/ctokens.py -> build/lib/ply copying ply/cpp.py -> build/lib/ply copying ply/__init__.py -> build/lib/ply + pushd ../python3 ~/RPM/BUILD/python3 ~/RPM/BUILD/ply-3.8 + find -type f -name '*.py' -exec 2to3 -w -n '{}' + RefactoringTool: Skipping optional fixer: buffer RefactoringTool: Skipping optional fixer: idioms RefactoringTool: Skipping optional fixer: set_literal RefactoringTool: Skipping optional fixer: ws_comma RefactoringTool: Refactored ./test/yacc_uprec2.py RefactoringTool: Refactored ./test/yacc_uprec.py RefactoringTool: Refactored ./test/yacc_unused_rule.py RefactoringTool: Refactored ./test/yacc_unused.py RefactoringTool: Refactored ./test/yacc_unicode_literals.py RefactoringTool: Refactored ./test/yacc_term1.py RefactoringTool: Refactored ./test/yacc_sr.py --- ./test/yacc_uprec2.py (original) +++ ./test/yacc_uprec2.py (refactored) @@ -21,7 +21,7 @@ def p_statement_expr(t): 'statement : expression' - print(t[1]) + print((t[1])) def p_expression_binop(t): '''expression : expression PLUS expression @@ -50,11 +50,11 @@ try: t[0] = names[t[1]] except LookupError: - print("Undefined name '%s'" % t[1]) + print(("Undefined name '%s'" % t[1])) t[0] = 0 def p_error(t): - print("Syntax error at '%s'" % t.value) + print(("Syntax error at '%s'" % t.value)) yacc.yacc() --- ./test/yacc_uprec.py (original) +++ ./test/yacc_uprec.py (refactored) @@ -21,7 +21,7 @@ def p_statement_expr(t): 'statement : expression' - print(t[1]) + print((t[1])) def p_expression_binop(t): '''expression : expression PLUS expression @@ -50,11 +50,11 @@ try: t[0] = names[t[1]] except LookupError: - print("Undefined name '%s'" % t[1]) + print(("Undefined name '%s'" % t[1])) t[0] = 0 def p_error(t): - print("Syntax error at '%s'" % t.value) + print(("Syntax error at '%s'" % t.value)) yacc.yacc() --- ./test/yacc_unused_rule.py (original) +++ ./test/yacc_unused_rule.py (refactored) @@ -26,7 +26,7 @@ def p_statement_expr(t): 'statement : expression' - print(t[1]) + print((t[1])) def p_expression_binop(t): '''expression : expression PLUS expression @@ -55,7 +55,7 @@ try: t[0] = names[t[1]] except LookupError: - print("Undefined name '%s'" % t[1]) + print(("Undefined name '%s'" % t[1])) t[0] = 0 def p_integer(t): @@ -63,7 +63,7 @@ t[0] = t[1] def p_error(t): - print("Syntax error at '%s'" % t.value) + print(("Syntax error at '%s'" % t.value)) yacc.yacc() --- ./test/yacc_unused.py (original) +++ ./test/yacc_unused.py (refactored) @@ -26,7 +26,7 @@ def p_statement_expr(t): 'statement : expression' - print(t[1]) + print((t[1])) def p_expression_binop(t): '''expression : expression PLUS expression @@ -55,7 +55,7 @@ try: t[0] = names[t[1]] except LookupError: - print("Undefined name '%s'" % t[1]) + print(("Undefined name '%s'" % t[1])) t[0] = 0 def p_expr_list(t): @@ -68,7 +68,7 @@ def p_error(t): - print("Syntax error at '%s'" % t.value) + print(("Syntax error at '%s'" % t.value)) yacc.yacc() --- ./test/yacc_unicode_literals.py (original) +++ ./test/yacc_unicode_literals.py (refactored) @@ -3,7 +3,7 @@ # # Test for unicode literals on Python 2.x # ----------------------------------------------------------------------------- -from __future__ import unicode_literals + import sys @@ -28,7 +28,7 @@ def p_statement_expr(t): 'statement : expression' - print(t[1]) + print((t[1])) def p_expression_binop(t): '''expression : expression PLUS expression @@ -57,11 +57,11 @@ try: t[0] = names[t[1]] except LookupError: - print("Undefined name '%s'" % t[1]) + print(("Undefined name '%s'" % t[1])) t[0] = 0 def p_error(t): - print("Syntax error at '%s'" % t.value) + print(("Syntax error at '%s'" % t.value)) yacc.yacc() --- ./test/yacc_term1.py (original) +++ ./test/yacc_term1.py (refactored) @@ -26,7 +26,7 @@ def p_statement_expr(t): 'statement : expression' - print(t[1]) + print((t[1])) def p_expression_binop(t): '''expression : expression PLUS expression @@ -55,11 +55,11 @@ try: t[0] = names[t[1]] except LookupError: - print("Undefined name '%s'" % t[1]) + print(("Undefined name '%s'" % t[1])) t[0] = 0 def p_error(t): - print("Syntax error at '%s'" % t.value) + print(("Syntax error at '%s'" % t.value)) yacc.yacc() --- ./test/yacc_sr.py (original) +++ ./test/yacc_sr.py (refactored) @@ -21,7 +21,7 @@ def p_statement_expr(t): 'statement : expression' - print(t[1]) + print((t[1])) def p_expression_binop(t): '''expression : expression PLUS exprRefactoringTool: Refactored ./test/yacc_simple.py RefactoringTool: No changes to ./test/yacc_rr_unused.py RefactoringTool: Refactored ./test/yacc_rr.py RefactoringTool: Refactored ./test/yacc_prec1.py RefactoringTool: Refactored ./test/yacc_notok.py RefactoringTool: Refactored ./test/yacc_notfunc.py RefactoringTool: Refactored ./test/yacc_nop.py RefactoringTool: Refactored ./test/yacc_noerror.py ession @@ -50,11 +50,11 @@ try: t[0] = names[t[1]] except LookupError: - print("Undefined name '%s'" % t[1]) + print(("Undefined name '%s'" % t[1])) t[0] = 0 def p_error(t): - print("Syntax error at '%s'" % t.value) + print(("Syntax error at '%s'" % t.value)) yacc.yacc() --- ./test/yacc_simple.py (original) +++ ./test/yacc_simple.py (refactored) @@ -26,7 +26,7 @@ def p_statement_expr(t): 'statement : expression' - print(t[1]) + print((t[1])) def p_expression_binop(t): '''expression : expression PLUS expression @@ -55,11 +55,11 @@ try: t[0] = names[t[1]] except LookupError: - print("Undefined name '%s'" % t[1]) + print(("Undefined name '%s'" % t[1])) t[0] = 0 def p_error(t): - print("Syntax error at '%s'" % t.value) + print(("Syntax error at '%s'" % t.value)) yacc.yacc() --- ./test/yacc_rr.py (original) +++ ./test/yacc_rr.py (refactored) @@ -30,7 +30,7 @@ def p_statement_expr(t): 'statement : expression' - print(t[1]) + print((t[1])) def p_expression_binop(t): '''expression : expression PLUS expression @@ -59,11 +59,11 @@ try: t[0] = names[t[1]] except LookupError: - print("Undefined name '%s'" % t[1]) + print(("Undefined name '%s'" % t[1])) t[0] = 0 def p_error(t): - print("Syntax error at '%s'" % t.value) + print(("Syntax error at '%s'" % t.value)) yacc.yacc() --- ./test/yacc_prec1.py (original) +++ ./test/yacc_prec1.py (refactored) @@ -26,7 +26,7 @@ def p_statement_expr(t): 'statement : expression' - print(t[1]) + print((t[1])) def p_expression_binop(t): '''expression : expression PLUS expression @@ -55,11 +55,11 @@ try: t[0] = names[t[1]] except LookupError: - print("Undefined name '%s'" % t[1]) + print(("Undefined name '%s'" % t[1])) t[0] = 0 def p_error(t): - print("Syntax error at '%s'" % t.value) + print(("Syntax error at '%s'" % t.value)) yacc.yacc() --- ./test/yacc_notok.py (original) +++ ./test/yacc_notok.py (refactored) @@ -25,7 +25,7 @@ def p_statement_expr(t): 'statement : expression' - print(t[1]) + print((t[1])) def p_expression_binop(t): '''expression : expression PLUS expression @@ -54,11 +54,11 @@ try: t[0] = names[t[1]] except LookupError: - print("Undefined name '%s'" % t[1]) + print(("Undefined name '%s'" % t[1])) t[0] = 0 def p_error(t): - print("Syntax error at '%s'" % t.value) + print(("Syntax error at '%s'" % t.value)) yacc.yacc() --- ./test/yacc_notfunc.py (original) +++ ./test/yacc_notfunc.py (refactored) @@ -24,7 +24,7 @@ def p_statement_expr(t): 'statement : expression' - print(t[1]) + print((t[1])) def p_expression_binop(t): '''expression : expression PLUS expression @@ -53,11 +53,11 @@ try: t[0] = names[t[1]] except LookupError: - print("Undefined name '%s'" % t[1]) + print(("Undefined name '%s'" % t[1])) t[0] = 0 def p_error(t): - print("Syntax error at '%s'" % t.value) + print(("Syntax error at '%s'" % t.value)) yacc.yacc() --- ./test/yacc_nop.py (original) +++ ./test/yacc_nop.py (refactored) @@ -26,7 +26,7 @@ def statement_expr(t): 'statement : expression' - print(t[1]) + print((t[1])) def p_expression_binop(t): '''expression : expression PLUS expression @@ -55,11 +55,11 @@ try: t[0] = names[t[1]] except LookupError: - print("Undefined name '%s'" % t[1]) + print(("Undefined name '%s'" % t[1])) t[0] = 0 def p_error(t): - print("Syntax error at '%s'" % t.value) + print(("Syntax error at '%s'" % t.value)) yacc.yacc() --- ./test/yacc_noerror.py (original) +++ ./test/yacc_noerror.py (refactored) @@ -26,7 +26,7 @@ def p_statement_expr(t): 'statement : expression' - print(t[1]) + print((t[1])) def p_expression_binop(t): '''expression : expression PLUS expressRefactoringTool: Refactored ./test/yacc_nodoc.py RefactoringTool: Refactored ./test/yacc_nested.py RefactoringTool: Refactored ./test/yacc_missing1.py RefactoringTool: Refactored ./test/yacc_misplaced.py RefactoringTool: Refactored ./test/yacc_literal.py RefactoringTool: Refactored ./test/yacc_inf.py RefactoringTool: Refactored ./test/yacc_error7.py RefactoringTool: Refactored ./test/yacc_error6.py ion @@ -55,7 +55,7 @@ try: t[0] = names[t[1]] except LookupError: - print("Undefined name '%s'" % t[1]) + print(("Undefined name '%s'" % t[1])) t[0] = 0 --- ./test/yacc_nodoc.py (original) +++ ./test/yacc_nodoc.py (refactored) @@ -25,7 +25,7 @@ names[t[1]] = t[3] def p_statement_expr(t): - print(t[1]) + print((t[1])) def p_expression_binop(t): '''expression : expression PLUS expression @@ -54,11 +54,11 @@ try: t[0] = names[t[1]] except LookupError: - print("Undefined name '%s'" % t[1]) + print(("Undefined name '%s'" % t[1])) t[0] = 0 def p_error(t): - print("Syntax error at '%s'" % t.value) + print(("Syntax error at '%s'" % t.value)) yacc.yacc() --- ./test/yacc_nested.py (original) +++ ./test/yacc_nested.py (refactored) @@ -24,7 +24,7 @@ def p_nest(t): '''nest : B''' - print(t[-1]) + print((t[-1])) the_parser = yacc.yacc(debug = False, write_tables = False) --- ./test/yacc_missing1.py (original) +++ ./test/yacc_missing1.py (refactored) @@ -26,7 +26,7 @@ def p_statement_expr(t): 'statement : expression' - print(t[1]) + print((t[1])) def p_expression_binop(t): '''expression : expression PLUS expression @@ -55,11 +55,11 @@ try: t[0] = names[t[1]] except LookupError: - print("Undefined name '%s'" % t[1]) + print(("Undefined name '%s'" % t[1])) t[0] = 0 def p_error(t): - print("Syntax error at '%s'" % t.value) + print(("Syntax error at '%s'" % t.value)) yacc.yacc() --- ./test/yacc_misplaced.py (original) +++ ./test/yacc_misplaced.py (refactored) @@ -26,7 +26,7 @@ def p_statement_expr(t): 'statement : expression' - print(t[1]) + print((t[1])) def p_expression_binop(t): ''' | expression PLUS expression @@ -55,11 +55,11 @@ try: t[0] = names[t[1]] except LookupError: - print("Undefined name '%s'" % t[1]) + print(("Undefined name '%s'" % t[1])) t[0] = 0 def p_error(t): - print("Syntax error at '%s'" % t.value) + print(("Syntax error at '%s'" % t.value)) yacc.yacc() --- ./test/yacc_literal.py (original) +++ ./test/yacc_literal.py (refactored) @@ -26,7 +26,7 @@ def p_statement_expr(t): 'statement : expression' - print(t[1]) + print((t[1])) def p_expression_binop(t): '''expression : expression '+' expression @@ -56,11 +56,11 @@ try: t[0] = names[t[1]] except LookupError: - print("Undefined name '%s'" % t[1]) + print(("Undefined name '%s'" % t[1])) t[0] = 0 def p_error(t): - print("Syntax error at '%s'" % t.value) + print(("Syntax error at '%s'" % t.value)) yacc.yacc() --- ./test/yacc_inf.py (original) +++ ./test/yacc_inf.py (refactored) @@ -26,7 +26,7 @@ def p_statement_expr(t): 'statement : expression' - print(t[1]) + print((t[1])) def p_expression_binop(t): '''expression : expression PLUS expression @@ -47,7 +47,7 @@ t[0] = t[2] def p_error(t): - print("Syntax error at '%s'" % t.value) + print(("Syntax error at '%s'" % t.value)) yacc.yacc() --- ./test/yacc_error7.py (original) +++ ./test/yacc_error7.py (refactored) @@ -27,11 +27,11 @@ def p_statement_assign(p): 'statement : LPAREN NAME EQUALS expression RPAREN' - print("%s=%s" % (p[2],p[4])) + print(("%s=%s" % (p[2],p[4]))) def p_statement_expr(t): 'statement : LPAREN expression RPAREN' - print(t[1]) + print((t[1])) def p_expression_binop(t): '''expression : expression PLUS expression @@ -53,7 +53,7 @@ def p_error(p): if p: - print("Line %d: Syntax error at '%s'" % (p.lineno, p.value)) + print(("Line %d: Syntax error at '%s'" % (p.lineno, p.value))) # Scan ahead looking for a name token while True: tok = yacc.token() --- ./test/yacc_error6.py (original) +++ ./test/yacc_error6.py (refactored) @@ -27,11 +27,11 @@ def p_statement_assign(p): 'statement : LPAREN NAME EQUALS expression RRefactoringTool: Refactored ./test/yacc_error5.py RefactoringTool: Refactored ./test/yacc_error4.py RefactoringTool: Refactored ./test/yacc_error3.py RefactoringTool: Refactored ./test/yacc_error2.py RefactoringTool: Refactored ./test/yacc_error1.py PAREN' - print("%s=%s" % (p[2],p[4])) + print(("%s=%s" % (p[2],p[4]))) def p_statement_expr(t): 'statement : LPAREN expression RPAREN' - print(t[1]) + print((t[1])) def p_expression_binop(t): '''expression : expression PLUS expression @@ -53,7 +53,7 @@ def p_error(p): if p: - print("Line %d: Syntax error at '%s'" % (p.lineno, p.value)) + print(("Line %d: Syntax error at '%s'" % (p.lineno, p.value))) # Scan ahead looking for a name token while True: tok = parser.token() --- ./test/yacc_error5.py (original) +++ ./test/yacc_error5.py (refactored) @@ -28,11 +28,11 @@ 'statement : NAME EQUALS error' line_start, line_end = t.linespan(3) pos_start, pos_end = t.lexspan(3) - print("Assignment Error at %d:%d to %d:%d" % (line_start,pos_start,line_end,pos_end)) + print(("Assignment Error at %d:%d to %d:%d" % (line_start,pos_start,line_end,pos_end))) def p_statement_expr(t): 'statement : expression' - print(t[1]) + print((t[1])) def p_expression_binop(t): '''expression : expression PLUS expression @@ -52,14 +52,14 @@ 'expression : LPAREN expression RPAREN' line_start, line_end = t.linespan(2) pos_start, pos_end = t.lexspan(2) - print("Group at %d:%d to %d:%d" % (line_start,pos_start, line_end, pos_end)) + print(("Group at %d:%d to %d:%d" % (line_start,pos_start, line_end, pos_end))) t[0] = t[2] def p_expression_group_error(t): 'expression : LPAREN error RPAREN' line_start, line_end = t.linespan(2) pos_start, pos_end = t.lexspan(2) - print("Syntax error at %d:%d to %d:%d" % (line_start,pos_start, line_end, pos_end)) + print(("Syntax error at %d:%d to %d:%d" % (line_start,pos_start, line_end, pos_end))) t[0] = 0 def p_expression_number(t): @@ -71,11 +71,11 @@ try: t[0] = names[t[1]] except LookupError: - print("Undefined name '%s'" % t[1]) + print(("Undefined name '%s'" % t[1])) t[0] = 0 def p_error(t): - print("Syntax error at '%s'" % t.value) + print(("Syntax error at '%s'" % t.value)) parser = yacc.yacc() import calclex --- ./test/yacc_error4.py (original) +++ ./test/yacc_error4.py (refactored) @@ -26,7 +26,7 @@ def p_statement_expr(t): 'statement : expression' - print(t[1]) + print((t[1])) def p_expression_binop(t): '''expression : expression PLUS expression @@ -55,7 +55,7 @@ try: t[0] = names[t[1]] except LookupError: - print("Undefined name '%s'" % t[1]) + print(("Undefined name '%s'" % t[1])) t[0] = 0 def p_error_handler(t): --- ./test/yacc_error3.py (original) +++ ./test/yacc_error3.py (refactored) @@ -26,7 +26,7 @@ def p_statement_expr(t): 'statement : expression' - print(t[1]) + print((t[1])) def p_expression_binop(t): '''expression : expression PLUS expression @@ -55,7 +55,7 @@ try: t[0] = names[t[1]] except LookupError: - print("Undefined name '%s'" % t[1]) + print(("Undefined name '%s'" % t[1])) t[0] = 0 p_error = "blah" --- ./test/yacc_error2.py (original) +++ ./test/yacc_error2.py (refactored) @@ -26,7 +26,7 @@ def p_statement_expr(t): 'statement : expression' - print(t[1]) + print((t[1])) def p_expression_binop(t): '''expression : expression PLUS expression @@ -55,11 +55,11 @@ try: t[0] = names[t[1]] except LookupError: - print("Undefined name '%s'" % t[1]) + print(("Undefined name '%s'" % t[1])) t[0] = 0 def p_error(): - print("Syntax error at '%s'" % t.value) + print(("Syntax error at '%s'" % t.value)) yacc.yacc() --- ./test/yacc_error1.py (original) +++ ./test/yacc_error1.py (refactored) @@ -26,7 +26,7 @@ def p_statement_expr(t): 'statement : expression' - print(t[1]) + print((t[1])) def p_expression_binop(t): '''expression : expression PLUS expression @@ -55,11 +55,11 @@ try: t[0] = names[t[1]] except LookupError: - print("Undefined naRefactoringTool: Refactored ./test/yacc_dup.py RefactoringTool: Refactored ./test/yacc_badtok.py RefactoringTool: Refactored ./test/yacc_badrule.py RefactoringTool: Refactored ./test/yacc_badprec3.py RefactoringTool: Refactored ./test/yacc_badprec2.py RefactoringTool: Refactored ./test/yacc_badprec.py RefactoringTool: Refactored ./test/yacc_badid.py me '%s'" % t[1]) + print(("Undefined name '%s'" % t[1])) t[0] = 0 def p_error(t,s): - print("Syntax error at '%s'" % t.value) + print(("Syntax error at '%s'" % t.value)) yacc.yacc() --- ./test/yacc_dup.py (original) +++ ./test/yacc_dup.py (refactored) @@ -26,7 +26,7 @@ def p_statement(t): 'statement : expression' - print(t[1]) + print((t[1])) def p_expression_binop(t): '''expression : expression PLUS expression @@ -55,11 +55,11 @@ try: t[0] = names[t[1]] except LookupError: - print("Undefined name '%s'" % t[1]) + print(("Undefined name '%s'" % t[1])) t[0] = 0 def p_error(t): - print("Syntax error at '%s'" % t.value) + print(("Syntax error at '%s'" % t.value)) yacc.yacc() --- ./test/yacc_badtok.py (original) +++ ./test/yacc_badtok.py (refactored) @@ -26,7 +26,7 @@ def p_statement_expr(t): 'statement : expression' - print(t[1]) + print((t[1])) def p_expression_binop(t): '''expression : expression PLUS expression @@ -55,11 +55,11 @@ try: t[0] = names[t[1]] except LookupError: - print("Undefined name '%s'" % t[1]) + print(("Undefined name '%s'" % t[1])) t[0] = 0 def p_error(t): - print("Syntax error at '%s'" % t.value) + print(("Syntax error at '%s'" % t.value)) yacc.yacc() --- ./test/yacc_badrule.py (original) +++ ./test/yacc_badrule.py (refactored) @@ -26,7 +26,7 @@ def p_statement_expr(t): 'statement' - print(t[1]) + print((t[1])) def p_expression_binop(t): '''expression : expression PLUS expression @@ -55,11 +55,11 @@ try: t[0] = names[t[1]] except LookupError: - print("Undefined name '%s'" % t[1]) + print(("Undefined name '%s'" % t[1])) t[0] = 0 def p_error(t): - print("Syntax error at '%s'" % t.value) + print(("Syntax error at '%s'" % t.value)) yacc.yacc() --- ./test/yacc_badprec3.py (original) +++ ./test/yacc_badprec3.py (refactored) @@ -26,7 +26,7 @@ def p_statement_expr(t): 'statement : expression' - print(t[1]) + print((t[1])) def p_expression_binop(t): '''expression : expression PLUS expression @@ -55,11 +55,11 @@ try: t[0] = names[t[1]] except LookupError: - print("Undefined name '%s'" % t[1]) + print(("Undefined name '%s'" % t[1])) t[0] = 0 def p_error(t): - print("Syntax error at '%s'" % t.value) + print(("Syntax error at '%s'" % t.value)) yacc.yacc() --- ./test/yacc_badprec2.py (original) +++ ./test/yacc_badprec2.py (refactored) @@ -26,7 +26,7 @@ def p_statement_expr(t): 'statement : expression' - print(t[1]) + print((t[1])) def p_expression_binop(t): '''expression : expression PLUS expression @@ -55,11 +55,11 @@ try: t[0] = names[t[1]] except LookupError: - print("Undefined name '%s'" % t[1]) + print(("Undefined name '%s'" % t[1])) t[0] = 0 def p_error(t): - print("Syntax error at '%s'" % t.value) + print(("Syntax error at '%s'" % t.value)) yacc.yacc() --- ./test/yacc_badprec.py (original) +++ ./test/yacc_badprec.py (refactored) @@ -22,7 +22,7 @@ def p_statement_expr(t): 'statement : expression' - print(t[1]) + print((t[1])) def p_expression_binop(t): '''expression : expression PLUS expression @@ -51,11 +51,11 @@ try: t[0] = names[t[1]] except LookupError: - print("Undefined name '%s'" % t[1]) + print(("Undefined name '%s'" % t[1])) t[0] = 0 def p_error(t): - print("Syntax error at '%s'" % t.value) + print(("Syntax error at '%s'" % t.value)) yacc.yacc() --- ./test/yacc_badid.py (original) +++ ./test/yacc_badid.py (refactored) @@ -26,7 +26,7 @@ def p_statement_expr(t): 'statement : expression' - print(t[1]) + print((t[1])) def p_statement_expr2(t): 'statement : bad&rule' @@ -64,7 +64,7 @@ try: t[0] = names[t[1]] except LookupError: - print("Undefined name '%s'" % t[1]) + RefactoringTool: Refactored ./test/yacc_badargs.py RefactoringTool: Refactored ./test/testyacc.py print(("Undefined name '%s'" % t[1])) t[0] = 0 def p_error(t): --- ./test/yacc_badargs.py (original) +++ ./test/yacc_badargs.py (refactored) @@ -26,7 +26,7 @@ def p_statement_expr(): 'statement : expression' - print(t[1]) + print((t[1])) def p_expression_binop(t): '''expression : expression PLUS expression @@ -55,11 +55,11 @@ try: t[0] = names[t[1]] except LookupError: - print("Undefined name '%s'" % t[1]) + print(("Undefined name '%s'" % t[1])) t[0] = 0 def p_error(t): - print("Syntax error at '%s'" % t.value) + print(("Syntax error at '%s'" % t.value)) yacc.yacc() --- ./test/testyacc.py (original) +++ ./test/testyacc.py (refactored) @@ -2,7 +2,7 @@ import unittest try: - import StringIO + import io except ImportError: import io as StringIO @@ -79,8 +79,8 @@ # Tests related to errors and warnings when building parsers class YaccErrorWarningTests(unittest.TestCase): def setUp(self): - sys.stderr = StringIO.StringIO() - sys.stdout = StringIO.StringIO() + sys.stderr = io.StringIO() + sys.stdout = io.StringIO() try: os.remove("parsetab.py") pymodule_out_remove("parsetab.pyc") @@ -97,14 +97,14 @@ def test_yacc_badargs(self): self.assertRaises(ply.yacc.YaccError,run_import,"yacc_badargs") result = sys.stderr.getvalue() - self.assert_(check_expected(result, + self.assertTrue(check_expected(result, "yacc_badargs.py:23: Rule 'p_statement_assign' has too many arguments\n" "yacc_badargs.py:27: Rule 'p_statement_expr' requires an argument\n" )) def test_yacc_badid(self): self.assertRaises(ply.yacc.YaccError,run_import,"yacc_badid") result = sys.stderr.getvalue() - self.assert_(check_expected(result, + self.assertTrue(check_expected(result, "yacc_badid.py:32: Illegal name 'bad&rule' in rule 'statement'\n" "yacc_badid.py:36: Illegal rule name 'bad&rule'\n" )) @@ -114,20 +114,20 @@ run_import("yacc_badprec") except ply.yacc.YaccError: result = sys.stderr.getvalue() - self.assert_(check_expected(result, + self.assertTrue(check_expected(result, "precedence must be a list or tuple\n" )) def test_yacc_badprec2(self): self.assertRaises(ply.yacc.YaccError,run_import,"yacc_badprec2") result = sys.stderr.getvalue() - self.assert_(check_expected(result, + self.assertTrue(check_expected(result, "Bad precedence table\n" )) def test_yacc_badprec3(self): run_import("yacc_badprec3") result = sys.stderr.getvalue() - self.assert_(check_expected(result, + self.assertTrue(check_expected(result, "Precedence already specified for terminal 'MINUS'\n" "Generating LALR tables\n" @@ -136,7 +136,7 @@ def test_yacc_badrule(self): self.assertRaises(ply.yacc.YaccError,run_import,"yacc_badrule") result = sys.stderr.getvalue() - self.assert_(check_expected(result, + self.assertTrue(check_expected(result, "yacc_badrule.py:24: Syntax error. Expected ':'\n" "yacc_badrule.py:28: Syntax error in rule 'statement'\n" "yacc_badrule.py:33: Syntax error. Expected ':'\n" @@ -148,13 +148,13 @@ run_import("yacc_badtok") except ply.yacc.YaccError: result = sys.stderr.getvalue() - self.assert_(check_expected(result, + self.assertTrue(check_expected(result, "tokens must be a list or tuple\n")) def test_yacc_dup(self): run_import("yacc_dup") result = sys.stderr.getvalue() - self.assert_(check_expected(result, + self.assertTrue(check_expected(result, "yacc_dup.py:27: Function p_statement redefined. Previously defined on line 23\n" "Token 'EQUALS' defined, but not used\n" "There is 1 unused token\n" @@ -166,7 +166,7 @@ run_import("yacc_error1") except ply.yacc.YaccError: result = sys.stderr.getvalue() - self.assert_(check_expected(result, + self.assertTrue(check_expected(result, "yacc_error1.py:61: p_error() requires 1 argument\n")) def test_yacc_error2(self): @@ -174,7 +174,7 @@ run_import("yacc_error2") except ply.yacc.YaccError: result = sys.stderr.getvalue() - self.assert_(check_expected(result, + self.assertTrue(check_expected(result, "yacc_error2.py:61: p_error() requires 1 argument\n")) def test_yacc_error3(self): @@ -183,13 +183,13 @@ except ply.yacc.YaccError: e = sys.exc_info()[1] result = sys.stderr.getvalue() - self.assert_(check_expected(result, + self.assertTrue(check_expected(result, "'p_error' defined, but is not a function or method\n")) def test_yacc_error4(self): self.assertRaises(ply.yacc.YaccError,run_import,"yacc_error4") result = sys.stderr.getvalue() - self.assert_(check_expected(result, + self.assertTrue(check_expected(result, "yacc_error4.py:62: Illegal rule name 'error'. Already defined as a token\n" )) @@ -197,7 +197,7 @@ def test_yacc_error5(self): run_import("yacc_error5") result = sys.stdout.getvalue() - self.assert_(check_expected(result, + self.assertTrue(check_expected(result, "Group at 3:10 to 3:12\n" "Undefined name 'a'\n" "Syntax error at 'b'\n" @@ -209,7 +209,7 @@ def test_yacc_error6(self): run_import("yacc_error6") result = sys.stdout.getvalue() - self.assert_(check_expected(result, + self.assertTrue(check_expected(result, "a=7\n" "Line 3: Syntax error at '*'\n" "c=21\n" @@ -218,7 +218,7 @@ def test_yacc_error7(self): run_import("yacc_error7") result = sys.stdout.getvalue() - self.assert_(check_expected(result, + self.assertTrue(check_expected(result, "a=7\n" "Line 3: Syntax error at '*'\n" "c=21\n" @@ -227,7 +227,7 @@ def test_yacc_inf(self): self.assertRaises(ply.yacc.YaccError,run_import,"yacc_inf") result = sys.stderr.getvalue() - self.assert_(check_expected(result, + self.assertTrue(check_expected(result, "Token 'NUMBER' defined, but not used\n" "There is 1 unused token\n" "Infinite recursion detected for symbol 'statement'\n" @@ -236,27 +236,27 @@ def test_yacc_literal(self): self.assertRaises(ply.yacc.YaccError,run_import,"yacc_literal") result = sys.stderr.getvalue() - self.assert_(check_expected(result, + self.assertTrue(check_expected(result, "yacc_literal.py:36: Literal token '**' in rule 'expression' may only be a single character\n" )) def test_yacc_misplaced(self): self.assertRaises(ply.yacc.YaccError,run_import,"yacc_misplaced") result = sys.stderr.getvalue() - self.assert_(check_expected(result, + self.assertTrue(check_expected(result, "yacc_misplaced.py:32: Misplaced '|'\n" )) def test_yacc_missing1(self): self.assertRaises(ply.yacc.YaccError,run_import,"yacc_missing1") result = sys.stderr.getvalue() - self.assert_(check_expected(result, + self.assertTrue(check_expected(result, "yacc_missing1.py:24: Symbol 'location' used, but not defined as a token or a rule\n" )) def test_yacc_nested(self): run_import("yacc_nested") result = sys.stdout.getvalue() - self.assert_(check_expected(result, + self.assertTrue(check_expected(result, "A\n" "A\n" "A\n", @@ -265,7 +265,7 @@ def test_yacc_nodoc(self): run_import("yacc_nodoc") result = sys.stderr.getvalue() - self.assert_(check_expected(result, + self.assertTrue(check_expected(result, "yacc_nodoc.py:27: No documentation string specified in function 'p_statement_expr' (ignored)\n" "Generating LALR tables\n" )) @@ -273,7 +273,7 @@ def test_yacc_noerror(self): run_import("yacc_noerror") result = sys.stderr.getvalue() - self.assert_(check_expected(result, + self.assertTrue(check_expected(result, "no p_error() function is defined\n" "Generating LALR tables\n" )) @@ -281,7 +281,7 @@ def test_yacc_nop(self): run_import("yacc_nop") result = sys.stderr.getvalue() - self.assert_(check_expected(result, + self.assertTrue(check_expected(result, "yacc_nop.py:27: Possible grammar rule 'statement_expr' defined without p_ prefix\n" "Generating LALR tables\n" )) @@ -289,7 +289,7 @@ def test_yacc_notfunc(self): run_import("yacc_notfunc") result = sys.stderr.getvalue() - self.assert_(check_expected(result, + self.assertTrue(check_expected(result, "'p_statement_assign' not defined as a function\n" "Token 'EQUALS' defined, but not used\n" "There is 1 unused token\n" @@ -300,13 +300,13 @@ run_import("yacc_notok") except ply.yacc.YaccError: result = sys.stderr.getvalue() - self.assert_(check_expected(result, + self.assertTrue(check_expected(result, "No token list is defined\n")) def test_yacc_rr(self): run_import("yacc_rr") result = sys.stderr.getvalue() - self.assert_(check_expected(result, + self.assertTrue(check_expected(result, "Generating LALR tables\n" "1 reduce/reduce conflict\n" "reduce/reduce conflict in state 15 resolved using rule (statement -> NAME EQUALS NUMBER)\n" @@ -317,7 +317,7 @@ def test_yacc_rr_unused(self): run_import("yacc_rr_unused") result = sys.stderr.getvalue() - self.assert_(check_expected(result, + self.assertTrue(check_expected(result, "no p_error() function is defined\n" "Generating LALR tables\n" "3 reduce/reduce conflicts\n" @@ -333,14 +3RefactoringTool: Refactored ./test/testlex.py 33,14 @@ def test_yacc_simple(self): run_import("yacc_simple") result = sys.stderr.getvalue() - self.assert_(check_expected(result, + self.assertTrue(check_expected(result, "Generating LALR tables\n" )) def test_yacc_sr(self): run_import("yacc_sr") result = sys.stderr.getvalue() - self.assert_(check_expected(result, + self.assertTrue(check_expected(result, "Generating LALR tables\n" "20 shift/reduce conflicts\n" )) @@ -348,21 +348,21 @@ def test_yacc_term1(self): self.assertRaises(ply.yacc.YaccError,run_import,"yacc_term1") result = sys.stderr.getvalue() - self.assert_(check_expected(result, + self.assertTrue(check_expected(result, "yacc_term1.py:24: Illegal rule name 'NUMBER'. Already defined as a token\n" )) def test_yacc_unicode_literals(self): run_import("yacc_unicode_literals") result = sys.stderr.getvalue() - self.assert_(check_expected(result, + self.assertTrue(check_expected(result, "Generating LALR tables\n" )) def test_yacc_unused(self): self.assertRaises(ply.yacc.YaccError,run_import,"yacc_unused") result = sys.stderr.getvalue() - self.assert_(check_expected(result, + self.assertTrue(check_expected(result, "yacc_unused.py:62: Symbol 'COMMA' used, but not defined as a token or a rule\n" "Symbol 'COMMA' is unreachable\n" "Symbol 'exprlist' is unreachable\n" @@ -370,7 +370,7 @@ def test_yacc_unused_rule(self): run_import("yacc_unused_rule") result = sys.stderr.getvalue() - self.assert_(check_expected(result, + self.assertTrue(check_expected(result, "yacc_unused_rule.py:62: Rule 'integer' defined, but not used\n" "There is 1 unused rule\n" "Symbol 'integer' is unreachable\n" @@ -380,21 +380,21 @@ def test_yacc_uprec(self): self.assertRaises(ply.yacc.YaccError,run_import,"yacc_uprec") result = sys.stderr.getvalue() - self.assert_(check_expected(result, + self.assertTrue(check_expected(result, "yacc_uprec.py:37: Nothing known about the precedence of 'UMINUS'\n" )) def test_yacc_uprec2(self): self.assertRaises(ply.yacc.YaccError,run_import,"yacc_uprec2") result = sys.stderr.getvalue() - self.assert_(check_expected(result, + self.assertTrue(check_expected(result, "yacc_uprec2.py:37: Syntax error. Nothing follows %prec\n" )) def test_yacc_prec1(self): self.assertRaises(ply.yacc.YaccError,run_import,"yacc_prec1") result = sys.stderr.getvalue() - self.assert_(check_expected(result, + self.assertTrue(check_expected(result, "Precedence rule 'left' defined for unknown symbol '+'\n" "Precedence rule 'left' defined for unknown symbol '*'\n" "Precedence rule 'left' defined for unknown symbol '-'\n" --- ./test/testlex.py (original) +++ ./test/testlex.py (refactored) @@ -2,7 +2,7 @@ import unittest try: - import StringIO + import io except ImportError: import io as StringIO @@ -86,8 +86,8 @@ # Tests related to errors and warnings when building lexers class LexErrorWarningTests(unittest.TestCase): def setUp(self): - sys.stderr = StringIO.StringIO() - sys.stdout = StringIO.StringIO() + sys.stderr = io.StringIO() + sys.stdout = io.StringIO() if sys.hexversion >= 0x3020000: warnings.filterwarnings('ignore',category=ResourceWarning) @@ -97,68 +97,68 @@ def test_lex_doc1(self): self.assertRaises(SyntaxError,run_import,"lex_doc1") result = sys.stderr.getvalue() - self.assert_(check_expected(result, + self.assertTrue(check_expected(result, "lex_doc1.py:18: No regular expression defined for rule 't_NUMBER'\n")) def test_lex_dup1(self): self.assertRaises(SyntaxError,run_import,"lex_dup1") result = sys.stderr.getvalue() - self.assert_(check_expected(result, + self.assertTrue(check_expected(result, "lex_dup1.py:20: Rule t_NUMBER redefined. Previously defined on line 18\n" )) def test_lex_dup2(self): self.assertRaises(SyntaxError,run_import,"lex_dup2") result = sys.stderr.getvalue() - self.assert_(check_expected(result, + self.assertTrue(check_expected(result, "lex_dup2.py:22: Rule t_NUMBER redefined. Previously defined on line 18\n" )) def test_lex_dup3(self): self.assertRaises(SyntaxError,run_import,"lex_dup3") result = sys.stderr.getvalue() - self.assert_(check_expected(result, + self.assertTrue(check_expected(result, "lex_dup3.py:20: Rule t_NUMBER redefined. Previously defined on line 18\n" )) def test_lex_empty(self): self.assertRaises(SyntaxError,run_import,"lex_empty") result = sys.stderr.getvalue() - self.assert_(check_expected(result, + self.assertTrue(check_expected(result, "No rules of the form t_rulename are defined\n" "No rules defined for state 'INITIAL'\n")) def test_lex_error1(self): run_import("lex_error1") result = sys.stderr.getvalue() - self.assert_(check_expected(result, + self.assertTrue(check_expected(result, "No t_error rule is defined\n")) def test_lex_error2(self): self.assertRaises(SyntaxError,run_import,"lex_error2") result = sys.stderr.getvalue() - self.assert_(check_expected(result, + self.assertTrue(check_expected(result, "Rule 't_error' must be defined as a function\n") ) def test_lex_error3(self): self.assertRaises(SyntaxError,run_import,"lex_error3") result = sys.stderr.getvalue() - self.assert_(check_expected(result, + self.assertTrue(check_expected(result, "lex_error3.py:20: Rule 't_error' requires an argument\n")) def test_lex_error4(self): self.assertRaises(SyntaxError,run_import,"lex_error4") result = sys.stderr.getvalue() - self.assert_(check_expected(result, + self.assertTrue(check_expected(result, "lex_error4.py:20: Rule 't_error' has too many arguments\n")) def test_lex_ignore(self): self.assertRaises(SyntaxError,run_import,"lex_ignore") result = sys.stderr.getvalue() - self.assert_(check_expected(result, + self.assertTrue(check_expected(result, "lex_ignore.py:20: Rule 't_ignore' must be defined as a string\n")) def test_lex_ignore2(self): run_import("lex_ignore2") result = sys.stderr.getvalue() - self.assert_(check_expected(result, + self.assertTrue(check_expected(result, "t_ignore contains a literal backslash '\\'\n")) @@ -169,14 +169,14 @@ msg = "Invalid regular expression for rule 't_NUMBER'. unbalanced parenthesis\n" else: msg = "Invalid regular expression for rule 't_NUMBER'. missing ), unterminated subpattern at position 0" - self.assert_(check_expected(result, + self.assertTrue(check_expected(result, msg, contains=True)) def test_lex_re2(self): self.assertRaises(SyntaxError,run_import,"lex_re2") result = sys.stderr.getvalue() - self.assert_(check_expected(result, + self.assertTrue(check_expected(result, "Regular expression for rule 't_PLUS' matches empty string\n")) def test_lex_re3(self): @@ -192,78 +192,78 @@ else: msg = ("Invalid regular expression for rule 't_POUND'. missing ), unterminated subpattern at position 0\n" "ERROR: Make sure '#' in rule 't_POUND' is escaped with '\#'") - self.assert_(check_expected(result, + self.assertTrue(check_expected(result, msg, contains=True), result) def test_lex_rule1(self): self.assertRaises(SyntaxError,run_import,"lex_rule1") result = sys.stderr.getvalue() - self.assert_(check_expected(result, + self.assertTrue(check_expected(result, "t_NUMBER not defined as a function or string\n")) def test_lex_rule2(self): self.assertRaises(SyntaxError,run_import,"lex_rule2") result = sys.stderr.getvalue() - self.assert_(check_expected(result, + self.assertTrue(check_expected(result, "lex_rule2.py:18: Rule 't_NUMBER' requires an argument\n")) def test_lex_rule3(self): self.assertRaises(SyntaxError,run_import,"lex_rule3") result = sys.stderr.getvalue() - self.assert_(check_expected(result, + self.assertTrue(check_expected(result, "lex_rule3.py:18: Rule 't_NUMBER' has too many arguments\n")) def test_lex_state1(self): self.assertRaises(SyntaxError,run_import,"lex_state1") result = sys.stderr.getvalue() - self.assert_(check_expected(result, + self.assertTrue(check_expected(result, "states must be defined as a tuple or list\n")) def test_lex_state2(self): self.assertRaises(SyntaxError,run_import,"lex_state2") result = sys.stderr.getvalue() - self.assert_(check_expected(result, + self.assertTrue(check_expected(result, "Invalid state specifier 'comment'. Must be a tuple (statename,'exclusive|inclusive')\n" "Invalid state specifier 'example'. Must be a tuple (statename,'exclusive|inclusive')\n")) def test_lex_state3(self): self.assertRaises(SyntaxError,run_import,"lex_state3") result = sys.stderr.getvalue() - self.assert_(check_expected(result, + self.assertTrue(check_expected(result, "State name 1 must be a string\n" "No rules defined for state 'example'\n")) def test_lex_state4(self): self.assertRaises(SyntaxError,run_import,"lex_state4") result = sys.stderr.getvalue() - self.assert_(check_expected(result, + self.assertTrue(check_expected(result, "State type for state comment must be 'inclusive' or 'exclusive'\n")) def test_lex_state5(self): self.assertRaises(SyntaxError,run_import,"lex_state5") result = sys.stderr.getvalue() - self.assert_(check_expected(result, + self.assertTrue(check_expected(result, "State 'comment' already defined\n")) def test_lex_state_noerror(self): run_import("lex_state_noerror") result = sys.stderr.getvalue() - self.assert_(check_expected(result, + self.assertTrue(check_expected(result, "No error rule is defined for exclusive state 'comment'\n")) def test_lex_state_norule(self): self.assertRaises(SyntaxError,run_import,"lex_state_norule") result = sys.stderr.getvalue() - self.assert_(check_expected(result, + self.assertTrue(check_expected(result, "No rules defined for state 'example'\n")) def test_lex_token1(self): self.assertRaises(SyntaxError,run_import,"lex_token1") result = sys.stderr.getvalue() - self.assert_(check_expected(result, + self.assertTrue(check_expected(result, "No token list is defined\n" "Rule 't_NUMBER' defined for an unspecified token NUMBER\n" "Rule 't_PLUS' defined for an unspecified token PLUS\n" @@ -273,7 +273,7 @@ def test_lex_token2(self): self.assertRaises(SyntaxError,run_import,"lex_token2") result = sys.stderr.getvalue() - self.assert_(check_expected(result, + self.assertTrue(check_expected(result, "tokens must be a list or tuple\n" "Rule 't_NUMBER' defined for an unspecified token NUMBER\n" "Rule 't_PLUS' defined for an unspecified token PLUS\n" @@ -283,14 +283,14 @@ def test_lex_token3(self): self.assertRaises(SyntaxError,run_import,"lex_token3") result = sys.stderr.getvalue() - self.assert_(check_expected(result, + self.assertTrue(check_expected(result, "Rule 't_MINUS' defined for an unspecified token MINUS\n")) def test_lex_token4(self): self.assertRaises(SyntaxError,run_import,"lex_token4") result = sys.stderr.getvalue() - self.assert_(check_expected(result, + self.assertTrue(check_expected(result, "Bad token name '-'\n")) @@ -299,25 +299,25 @@ run_import("lex_token5") except ply.lex.LexError: e = sys.exc_info()[1] - self.assert_(check_expected(str(e),"lex_token5.py:19: Rule 't_NUMBER' returned an unknown token type 'NUM'")) + self.assertTrue(check_expected(str(e),"lex_token5.py:19: Rule 't_NUMBER' returned an unknown token type 'NUM'")) def test_lex_token_dup(self): run_import("lex_token_dup") result = sys.stderr.getvalue() - self.assert_(check_expected(result, + self.assertTrue(check_expected(result, "Token 'MINUS' multiply defined\n")) def test_lex_literal1(self): self.assertRaises(SyntaxError,run_import,"lex_literal1") result = sys.stderr.getvalue() - self.assert_(check_expected(result, + self.assertTrue(check_expected(result, "Invalid literal '**'. Must be a single character\n")) def test_lex_literal2(self): self.assertRaises(SyntaxError,run_import,"lex_literal2") result = sys.stderr.getvalue() - self.assert_(check_expected(result, + self.assertTrue(check_expected(result, "Invalid literals specification. literals must be a sequence of characters\n")) import os @@ -327,8 +327,8 @@ # Tests related to various build options associated with lexers class LexBuildOptionTests(unittest.TestCase): def setUp(self): - sys.stderr = StringIO.StringIO() - sys.stdout = StringIO.StringIO() + sys.stderr = io.StringIO() + sys.stdout = io.StringIO() def tearDown(self): sys.stderr = sys.__stderr__ sys.stdout = sys.__stdout__ @@ -340,7 +340,7 @@ def test_lex_module(self): run_import("lex_module") result = sys.stdout.getvalue() - self.assert_(check_expected(result, + self.assertTrue(check_expected(result, "(NUMBER,3,1,0)\n" "(PLUS,'+',1,1)\n" "(NUMBER,4,1,2)\n")) @@ -348,7 +348,7 @@ def test_lex_object(self): run_import("lex_object") result = sys.stdout.getvalue() - self.assert_(check_expected(result, + self.assertTrue(check_expected(result, "(NUMBER,3,1,0)\n" "(PLUS,'+',1,1)\n" "(NUMBER,4,1,2)\n")) @@ -356,7 +356,7 @@ def test_lex_closure(self): run_import("lex_closure") result = sys.stdout.getvalue() - self.assert_(check_expected(result, + self.assertTrue(check_expected(result, "(NUMBER,3,1,0)\n" "(PLUS,'+',1,1)\n" "(NUMBER,4,1,2)\n")) @@ -377,34 +377,34 @@ run_import("lex_optimize") result = sys.stdout.getvalue() - self.assert_(check_expected(result, - "(NUMBER,3,1,0)\n" - "(PLUS,'+',1,1)\n" - "(NUMBER,4,1,2)\n")) - self.assert_(os.path.exists("lextab.py")) + self.assertTrue(check_expected(result, + "(NUMBER,3,1,0)\n" + "(PLUS,'+',1,1)\n" + "(NUMBER,4,1,2)\n")) + self.assertTrue(os.path.exists("lextab.py")) p = subprocess.Popen([sys.executable,'-O','lex_optimize.py'], stdout=subprocess.PIPE) result = p.stdout.read() - self.assert_(check_expected(result, - "(NUMBER,3,1,0)\n" - "(PLUS,'+',1,1)\n" - "(NUMBER,4,1,2)\n")) - if test_pyo: - self.assert_(pymodule_out_exists("lextab.pyo", 1)) + self.assertTrue(check_expected(result, + "(NUMBER,3,1,0)\n" + "(PLUS,'+',1,1)\n" + "(NUMBER,4,1,2)\n")) + if test_pyo: + self.assertTrue(pymodule_out_exists("lextab.pyo", 1)) pymodule_out_remove("lextab.pyo", 1) p = subprocess.Popen([sys.executable,'-OO','lex_optimize.py'], stdout=subprocess.PIPE) result = p.stdout.read() - self.assert_(check_expected(result, - "(NUMBER,3,1,0)\n" - "(PLUS,'+',1,1)\n" - "(NUMBER,4,1,2)\n")) - - if test_pyo: - self.assert_(pymodule_out_exists("lextab.pyo", 2)) + self.assertTrue(check_expected(result, + "(NUMBER,3,1,0)\n" + "(PLUS,'+',1,1)\n" + "(NUMBER,4,1,2)\n")) + + if test_pyo: + self.assertTrue(pymodule_out_exists("lextab.pyo", 2)) try: os.remove("lextab.py") except OSError: @@ -433,31 +433,31 @@ pass run_import("lex_optimize2") result = sys.stdout.getvalue() - self.assert_(check_expected(result, - "(NUMBER,3,1,0)\n" - "(PLUS,'+',1,1)\n" - "(NUMBER,4,1,2)\n")) - self.assert_(os.path.exists("opt2tab.py")) + self.assertTrue(check_expected(result, + "(NUMBER,3,1,0)\n" + "(PLUS,'+',1,1)\n" + "(NUMBER,4,1,2)\n")) + self.assertTrue(os.path.exists("opt2tab.py")) p = subprocess.Popen([sys.executable,'-O','lex_optimize2.py'], stdout=subprocess.PIPE) result = p.stdout.read() - self.assert_(check_expected(result, - "(NUMBER,3,1,0)\n" - "(PLUS,'+',1,1)\n" - "(NUMBER,4,1,2)\n")) - if test_pyo: - self.assert_(pymodule_out_exists("opt2tab.pyo", 1)) + self.assertTrue(check_expected(result, + "(NUMBER,3,1,0)\n" + "(PLUS,'+',1,1)\n" + "(NUMBER,4,1,2)\n")) + if test_pyo: + self.assertTrue(pymodule_out_exists("opt2tab.pyo", 1)) pymodule_out_remove("opt2tab.pyo", 1) p = subprocess.Popen([sys.executable,'-OO','lex_optimize2.py'], stdout=subprocess.PIPE) result = p.stdout.read() - self.assert_(check_expected(result, - "(NUMBER,3,1,0)\n" - "(PLUS,'+',1,1)\n" - "(NUMBER,4,1,2)\n")) - if test_pyo: - self.assert_(pymodule_out_exists("opt2tab.pyo", 2)) + self.assertTrue(check_expected(result, + "(NUMBER,3,1,0)\n" + "(PLUS,'+',1,1)\n" + "(NUMBER,4,1,2)\n")) + if test_pyo: + self.assertTrue(pymodule_out_exists("opt2tab.pyo", 2)) try: os.remove("opt2tab.py") except OSError: @@ -483,32 +483,32 @@ open("lexdir/sub/__init__.py","w").write("") run_import("lex_optimize3") result = sys.stdout.getvalue() - self.assert_(check_expected(result, - "(NUMBER,3,1,0)\n" - "(PLUS,'+',1,1)\n" - "(NUMBER,4,1,2)\n")) - self.assert_(os.path.exists("lexdir/sub/calctab.py")) + self.assertTrue(check_expected(result, + "(NUMBER,3,1,0)\n" + "(PLUS,'+',1,1)\n" + "(NUMBER,4,1,2)\n")) + self.assertTrue(os.path.exists("lexdir/sub/calctab.py")) p = subprocess.Popen([sys.executable,'-O','lex_optimize3.py'], stdout=subprocess.PIPE) result = p.stdout.read() - self.assert_(check_expected(result, - "(NUMBER,3,1,0)\n" - "(PLUS,'+',1,1)\n" - "(NUMBER,4,1,2)\n")) - if test_pyo: - self.assert_(pymodule_out_exists("lexdir/sub/calctab.pyo", 1)) + self.assertTrue(check_expected(result, + "(NUMBER,3,1,0)\n" + "(PLUS,'+',1,1)\n" + "(NUMBER,4,1,2)\n")) + if test_pyo: + self.assertTrue(pymodule_out_exists("lexdir/sub/calctab.pyo", 1)) pymodule_out_remove("lexdir/sub/calctab.pyo", 1) p = subprocess.Popen([sys.executable,'-OO','lex_optimize3.py'], stdout=subprocess.PIPE) result = p.stdout.read() - self.assert_(check_expected(result, - "(NUMBER,3,1,0)\n" - "(PLUS,'+',1,1)\n" - "(NUMBER,4,1,2)\n")) - if test_pyo: - self.assert_(pymodule_out_exists("lexdir/sub/calctab.pyo", 2)) + self.assertTrue(check_expected(result, + "(NUMBER,3,1,0)\n" + "(PLUS,'+',1,1)\n" + "(NUMBER,4,1,2)\n")) + if test_pyo: + self.assertTrue(pymodule_out_exists("lexdir/sub/calctab.pyo", 2)) try: shutil.rmtree("lexdir") except OSError: @@ -529,33 +529,33 @@ pass run_import("lex_opt_alias") result = sys.stdout.getvalue() - self.assert_(check_expected(result, + self.assertTrue(check_expected(result, "(NUMBER,3,1,0)\n" "(+,'+',1,1)\n" "(NUMBER,4,1,2)\n")) - self.assert_(os.path.exists("aliastab.py")) + self.assertTrue(os.path.exists("aliastab.py")) p = subprocess.Popen([sys.executable,'-O','lex_opt_alias.py'], stdout=subprocess.PIPE) result = p.stdout.read() - self.assert_(check_expected(result, + self.assertTrue(check_expected(result, "(NUMBER,3,1,0)\n" "(+,'+',1,1)\n" "(NUMBER,4,1,2)\n")) if test_pyo: - self.assert_(pymodule_out_exists("aliastab.pyo", 1)) + self.assertTrue(pymodule_out_exists("aliastab.pyo", 1)) pymodule_out_remove("aliastab.pyo", 1) p = subprocess.Popen([sys.executable,'-OO','lex_opt_alias.py'], stdout=subprocess.PIPE) result = p.stdout.read() - self.assert_(check_expected(result, + self.assertTrue(check_expected(result, "(NUMBER,3,1,0)\n" "(+,'+',1,1)\n" "(NUMBER,4,1,2)\n")) if test_pyo: - self.assert_(pymodule_out_exists("aliastab.pyo", 2)) + self.assertTrue(pymodule_out_exists("aliastab.pyo", 2)) try: os.remove("aliastab.py") except OSError: @@ -584,7 +584,7 @@ pass run_import("lex_many_tokens") result = sys.stdout.getvalue() - self.assert_(check_expected(result, + self.assertTrue(check_expected(result, "(TOK34,'TOK34:',1,0)\n" "(TOK143,'TOK143:',1,7)\n" "(TOK269,'TOK269:',1,15)\n" @@ -594,13 +594,13 @@ "(TOK999,'TOK999:',1,47)\n" )) - self.assert_(os.path.exists("manytab.py")) + self.assertTrue(os.path.exists("manytab.py")) if implementation() == 'CPython': p = subprocess.Popen([sys.executable,'-O','lex_many_tokens.py'], stdout=subprocess.PIPE) result = p.stdout.read() - self.assert_(check_expected(result, + self.assertTrue(check_expected(result, "(TOK34,'TOK34:',1,0)\n" "(TOK143,'TOK143:',1,7)\n" "(TOK269,'TOK269:',1,15)\n" @@ -610,7 +610,7 @@ "(TOK999,'TOK999:',1,47)\n" )) - self.assert_(pymodule_out_exists("manytab.pyo", 1)) + self.assertTrue(pymodule_out_exists("manytab.pyo", 1)) pymodule_out_remove("manytab.pyo", 1) try: os.remove("manytab.py") @@ -628,8 +628,8 @@ # Tests related to run-time behavior of lexers class LexRunTests(unittest.TestCase): def setUp(self): - sys.stderr = StringIO.StringIO() - sys.stdout = StringIO.StringIO() + sys.stderr = io.StringIO() + sys.stdout = io.StringIO() def tearDown(self): sys.stderr = sys.__stderr__ sys.stdout = sys.__stdout__ @@ -637,7 +637,7 @@ def test_lex_hedit(self): run_import("lex_hedit") result = sys.stdout.getvalue() - self.assert_(check_expected(result, + self.assertTrue(check_expected(result, "(H_EDIT_DESCRIPTOR,'abc',1,0)\n" "(H_EDIT_DESCRIPTOR,'abcdefghij',1,6)\n" "(H_EDIT_DESCRIPTOR,'xy',1,20)\n")) @@ -645,7 +645,7 @@ def test_lex_state_try(self): run_import("lex_state_try") result = sys.stdout.getvalue() - self.assert_(check_expected(result, + self.assertTrue(check_expeRefactoringTool: No changes to ./test/pkg_test6/parsing/statement.py RefactoringTool: Refactored ./test/pkg_test6/parsing/parsetab.py RefactoringTool: No changes to ./test/pkg_test6/parsing/lextab.py RefactoringTool: Refactored ./test/pkg_test6/parsing/expression.py RefactoringTool: Refactored ./test/pkg_test6/parsing/calcparse.py RefactoringTool: Refactored ./test/pkg_test6/parsing/calclex.py RefactoringTool: No changes to ./test/pkg_test6/__init__.py RefactoringTool: Refactored ./test/pkg_test5/parsing/parsetab.py RefactoringTool: No changes to ./test/pkg_test5/parsing/lextab.py RefactoringTool: Refactored ./test/pkg_test5/parsing/calcparse.py cted(result, "(NUMBER,'3',1,0)\n" "(PLUS,'+',1,2)\n" "(NUMBER,'4',1,4)\n" --- ./test/pkg_test6/parsing/parsetab.py (original) +++ ./test/pkg_test6/parsing/parsetab.py (refactored) @@ -10,7 +10,7 @@ _lr_action_items = {'RPAREN':([1,5,6,11,12,13,14,15,16,],[-9,-10,12,-7,-8,-1,-4,-2,-3,]),'DIVIDE':([1,3,5,6,11,12,13,14,15,16,],[-9,8,-10,8,-7,-8,8,-4,8,-3,]),'NUMBER':([0,2,4,7,8,9,10,],[1,1,1,1,1,1,1,]),'TIMES':([1,3,5,6,11,12,13,14,15,16,],[-9,10,-10,10,-7,-8,10,-4,10,-3,]),'PLUS':([1,3,5,6,11,12,13,14,15,16,],[-9,7,-10,7,-7,-8,-1,-4,-2,-3,]),'LPAREN':([0,2,4,7,8,9,10,],[2,2,2,2,2,2,2,]),'$end':([1,3,5,11,12,13,14,15,16,],[-9,0,-10,-7,-8,-1,-4,-2,-3,]),'MINUS':([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,],[4,-9,4,9,4,-10,9,4,4,4,4,-7,-8,-1,-4,-2,-3,]),'NAME':([0,2,4,7,8,9,10,],[5,5,5,5,5,5,5,]),} _lr_action = {} -for _k, _v in _lr_action_items.items(): +for _k, _v in list(_lr_action_items.items()): for _x,_y in zip(_v[0],_v[1]): if not _x in _lr_action: _lr_action[_x] = {} _lr_action[_x][_k] = _y @@ -19,7 +19,7 @@ _lr_goto_items = {'expression':([0,2,4,7,8,9,10,],[3,6,11,13,14,15,16,]),} _lr_goto = {} -for _k, _v in _lr_goto_items.items(): +for _k, _v in list(_lr_goto_items.items()): for _x, _y in zip(_v[0], _v[1]): if not _x in _lr_goto: _lr_goto[_x] = {} _lr_goto[_x][_k] = _y --- ./test/pkg_test6/parsing/expression.py (original) +++ ./test/pkg_test6/parsing/expression.py (refactored) @@ -27,5 +27,5 @@ try: t[0] = names[t[1]] except LookupError: - print("Undefined name '%s'" % t[1]) + print(("Undefined name '%s'" % t[1])) t[0] = 0 --- ./test/pkg_test6/parsing/calcparse.py (original) +++ ./test/pkg_test6/parsing/calcparse.py (refactored) @@ -22,7 +22,7 @@ from .expression import * def p_error(t): - print("Syntax error at '%s'" % t.value) + print(("Syntax error at '%s'" % t.value)) import os.path parser = yacc.yacc(outputdir=os.path.dirname(__file__)) --- ./test/pkg_test6/parsing/calclex.py (original) +++ ./test/pkg_test6/parsing/calclex.py (refactored) @@ -26,7 +26,7 @@ try: t.value = int(t.value) except ValueError: - print("Integer value too large %s" % t.value) + print(("Integer value too large %s" % t.value)) t.value = 0 return t @@ -37,7 +37,7 @@ t.lexer.lineno += t.value.count("\n") def t_error(t): - print("Illegal character '%s'" % t.value[0]) + print(("Illegal character '%s'" % t.value[0])) t.lexer.skip(1) # Build the lexer --- ./test/pkg_test5/parsing/parsetab.py (original) +++ ./test/pkg_test5/parsing/parsetab.py (refactored) @@ -10,7 +10,7 @@ _lr_action_items = {'$end':([1,2,3,5,9,14,15,16,17,18,19,20,],[-10,-9,0,-2,-10,-7,-1,-8,-3,-6,-4,-5,]),'RPAREN':([2,8,9,14,16,17,18,19,20,],[-9,16,-10,-7,-8,-3,-6,-4,-5,]),'DIVIDE':([1,2,5,8,9,14,15,16,17,18,19,20,],[-10,-9,11,11,-10,-7,11,-8,11,-6,11,-5,]),'EQUALS':([1,],[7,]),'NUMBER':([0,4,6,7,10,11,12,13,],[2,2,2,2,2,2,2,2,]),'PLUS':([1,2,5,8,9,14,15,16,17,18,19,20,],[-10,-9,10,10,-10,-7,10,-8,-3,-6,-4,-5,]),'LPAREN':([0,4,6,7,10,11,12,13,],[4,4,4,4,4,4,4,4,]),'TIMES':([1,2,5,8,9,14,15,16,17,18,19,20,],[-10,-9,13,13,-10,-7,13,-8,13,-6,13,-5,]),'MINUS':([0,1,2,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,],[6,-10,-9,6,12,6,6,12,-10,6,6,6,6,-7,12,-8,-3,-6,-4,-5,]),'NAME':([0,4,6,7,10,11,12,13,],[1,9,9,9,9,9,9,9,]),} _lr_action = {} -for _k, _v in _lr_action_items.items(): +for _k, _v in list(_lr_action_items.items()): for _x,_y in zip(_v[0],_v[1]): if not _x in _lr_action: _lr_action[_x] = {} _lr_action[_x][_k] = _y @@ -19,7 +19,7 @@ _lr_goto_items = {'expression':([0,4,6,7,10,11,12,13,],[5,8,14,15,17,18,19,20,]),'statement':([0,],[3,]),} _lr_goto = {} -for _k, _v in _lr_goto_items.items(): +for _k, _v in list(_lr_goto_items.items()): for _x, _y in zip(_v[0], _v[1]): if not _x in _lr_goto: _lr_goto[_x] = {} _lr_goto[_x][_k] = _y --- ./test/pRefactoringTool: Refactored ./test/pkg_test5/parsing/calclex.py RefactoringTool: No changes to ./test/pkg_test5/__init__.py RefactoringTool: Refactored ./test/pkg_test4/parsing/calcparse.py RefactoringTool: Refactored ./test/pkg_test4/parsing/calclex.py RefactoringTool: No changes to ./test/pkg_test4/__init__.py RefactoringTool: Refactored ./test/pkg_test3/parsing/calcparse.py RefactoringTool: Refactored ./test/pkg_test3/parsing/calclex.py RefactoringTool: Refactored ./test/pkg_test3/generated/parsetab.py kg_test5/parsing/calcparse.py (original) +++ ./test/pkg_test5/parsing/calcparse.py (refactored) @@ -52,11 +52,11 @@ try: t[0] = names[t[1]] except LookupError: - print("Undefined name '%s'" % t[1]) + print(("Undefined name '%s'" % t[1])) t[0] = 0 def p_error(t): - print("Syntax error at '%s'" % t.value) + print(("Syntax error at '%s'" % t.value)) import os.path parser = yacc.yacc(outputdir=os.path.dirname(__file__)) --- ./test/pkg_test5/parsing/calclex.py (original) +++ ./test/pkg_test5/parsing/calclex.py (refactored) @@ -26,7 +26,7 @@ try: t.value = int(t.value) except ValueError: - print("Integer value too large %s" % t.value) + print(("Integer value too large %s" % t.value)) t.value = 0 return t @@ -37,7 +37,7 @@ t.lexer.lineno += t.value.count("\n") def t_error(t): - print("Illegal character '%s'" % t.value[0]) + print(("Illegal character '%s'" % t.value[0])) t.lexer.skip(1) # Build the lexer --- ./test/pkg_test4/parsing/calcparse.py (original) +++ ./test/pkg_test4/parsing/calcparse.py (refactored) @@ -52,11 +52,11 @@ try: t[0] = names[t[1]] except LookupError: - print("Undefined name '%s'" % t[1]) + print(("Undefined name '%s'" % t[1])) t[0] = 0 def p_error(t): - print("Syntax error at '%s'" % t.value) + print(("Syntax error at '%s'" % t.value)) parser = yacc.yacc() --- ./test/pkg_test4/parsing/calclex.py (original) +++ ./test/pkg_test4/parsing/calclex.py (refactored) @@ -26,7 +26,7 @@ try: t.value = int(t.value) except ValueError: - print("Integer value too large %s" % t.value) + print(("Integer value too large %s" % t.value)) t.value = 0 return t @@ -37,7 +37,7 @@ t.lexer.lineno += t.value.count("\n") def t_error(t): - print("Illegal character '%s'" % t.value[0]) + print(("Illegal character '%s'" % t.value[0])) t.lexer.skip(1) # Build the lexer --- ./test/pkg_test3/parsing/calcparse.py (original) +++ ./test/pkg_test3/parsing/calcparse.py (refactored) @@ -52,11 +52,11 @@ try: t[0] = names[t[1]] except LookupError: - print("Undefined name '%s'" % t[1]) + print(("Undefined name '%s'" % t[1])) t[0] = 0 def p_error(t): - print("Syntax error at '%s'" % t.value) + print(("Syntax error at '%s'" % t.value)) parser = yacc.yacc(tabmodule='pkg_test3.generated.parsetab') --- ./test/pkg_test3/parsing/calclex.py (original) +++ ./test/pkg_test3/parsing/calclex.py (refactored) @@ -26,7 +26,7 @@ try: t.value = int(t.value) except ValueError: - print("Integer value too large %s" % t.value) + print(("Integer value too large %s" % t.value)) t.value = 0 return t @@ -37,7 +37,7 @@ t.lexer.lineno += t.value.count("\n") def t_error(t): - print("Illegal character '%s'" % t.value[0]) + print(("Illegal character '%s'" % t.value[0])) t.lexer.skip(1) # Build the lexer --- ./test/pkg_test3/generated/parsetab.py (original) +++ ./test/pkg_test3/generated/parsetab.py (refactored) @@ -10,7 +10,7 @@ _lr_action_items = {'$end':([1,2,3,5,9,14,15,16,17,18,19,20,],[-10,-9,0,-2,-10,-7,-1,-8,-3,-6,-4,-5,]),'RPAREN':([2,8,9,14,16,17,18,19,20,],[-9,16,-10,-7,-8,-3,-6,-4,-5,]),'DIVIDE':([1,2,5,8,9,14,15,16,17,18,19,20,],[-10,-9,11,11,-10,-7,11,-8,11,-6,11,-5,]),'EQUALS':([1,],[7,]),'NUMBER':([0,4,6,7,10,11,12,13,],[2,2,2,2,2,2,2,2,]),'PLUS':([1,2,5,8,9,14,15,16,17,18,19,20,],[-10,-9,10,10,-10,-7,10,-8,-3,-6,-4,-5,]),'LPAREN':([0,4,6,7,10,11,12,13,],[4,4,4,4,4,4,4,4,]),'TIMES':([1,2,5,8,9,14,15,16,17,18,19,20,],[-10,-9,13,13,-10,-7,13,-8,13,-6,13,-5,]),'MINUS':([0,1,2,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,],[6,-10,-9,6,12,6,6,12,-10,6,6,6,6,-7,12,-8,-3,-6,-4,-5,]),'NAME':([0,4,6,7,10,11,12,13,],[1,9,9,9,9,9,9,9,]),} _lr_action = {} -for _k, _v in _lr_action_items.items(): +for _k, _v in list(_lr_action_items.items()): for _x,_y in zip(_v[0],_v[1]):RefactoringTool: No changes to ./test/pkg_test3/generated/lextab.py RefactoringTool: No changes to ./test/pkg_test3/__init__.py RefactoringTool: Refactored ./test/pkg_test2/parsing/calcparsetab.py RefactoringTool: Refactored ./test/pkg_test2/parsing/calcparse.py RefactoringTool: No changes to ./test/pkg_test2/parsing/calclextab.py RefactoringTool: Refactored ./test/pkg_test2/parsing/calclex.py RefactoringTool: No changes to ./test/pkg_test2/__init__.py RefactoringTool: Refactored ./test/pkg_test1/parsing/parsetab.py if not _x in _lr_action: _lr_action[_x] = {} _lr_action[_x][_k] = _y @@ -19,7 +19,7 @@ _lr_goto_items = {'expression':([0,4,6,7,10,11,12,13,],[5,8,14,15,17,18,19,20,]),'statement':([0,],[3,]),} _lr_goto = {} -for _k, _v in _lr_goto_items.items(): +for _k, _v in list(_lr_goto_items.items()): for _x, _y in zip(_v[0], _v[1]): if not _x in _lr_goto: _lr_goto[_x] = {} _lr_goto[_x][_k] = _y --- ./test/pkg_test2/parsing/calcparsetab.py (original) +++ ./test/pkg_test2/parsing/calcparsetab.py (refactored) @@ -10,7 +10,7 @@ _lr_action_items = {'$end':([1,2,3,5,9,14,15,16,17,18,19,20,],[-10,-9,0,-2,-10,-7,-1,-8,-3,-6,-4,-5,]),'RPAREN':([2,8,9,14,16,17,18,19,20,],[-9,16,-10,-7,-8,-3,-6,-4,-5,]),'DIVIDE':([1,2,5,8,9,14,15,16,17,18,19,20,],[-10,-9,11,11,-10,-7,11,-8,11,-6,11,-5,]),'EQUALS':([1,],[7,]),'NUMBER':([0,4,6,7,10,11,12,13,],[2,2,2,2,2,2,2,2,]),'PLUS':([1,2,5,8,9,14,15,16,17,18,19,20,],[-10,-9,10,10,-10,-7,10,-8,-3,-6,-4,-5,]),'LPAREN':([0,4,6,7,10,11,12,13,],[4,4,4,4,4,4,4,4,]),'TIMES':([1,2,5,8,9,14,15,16,17,18,19,20,],[-10,-9,13,13,-10,-7,13,-8,13,-6,13,-5,]),'MINUS':([0,1,2,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,],[6,-10,-9,6,12,6,6,12,-10,6,6,6,6,-7,12,-8,-3,-6,-4,-5,]),'NAME':([0,4,6,7,10,11,12,13,],[1,9,9,9,9,9,9,9,]),} _lr_action = {} -for _k, _v in _lr_action_items.items(): +for _k, _v in list(_lr_action_items.items()): for _x,_y in zip(_v[0],_v[1]): if not _x in _lr_action: _lr_action[_x] = {} _lr_action[_x][_k] = _y @@ -19,7 +19,7 @@ _lr_goto_items = {'expression':([0,4,6,7,10,11,12,13,],[5,8,14,15,17,18,19,20,]),'statement':([0,],[3,]),} _lr_goto = {} -for _k, _v in _lr_goto_items.items(): +for _k, _v in list(_lr_goto_items.items()): for _x, _y in zip(_v[0], _v[1]): if not _x in _lr_goto: _lr_goto[_x] = {} _lr_goto[_x][_k] = _y --- ./test/pkg_test2/parsing/calcparse.py (original) +++ ./test/pkg_test2/parsing/calcparse.py (refactored) @@ -52,11 +52,11 @@ try: t[0] = names[t[1]] except LookupError: - print("Undefined name '%s'" % t[1]) + print(("Undefined name '%s'" % t[1])) t[0] = 0 def p_error(t): - print("Syntax error at '%s'" % t.value) + print(("Syntax error at '%s'" % t.value)) parser = yacc.yacc(tabmodule='calcparsetab') --- ./test/pkg_test2/parsing/calclex.py (original) +++ ./test/pkg_test2/parsing/calclex.py (refactored) @@ -26,7 +26,7 @@ try: t.value = int(t.value) except ValueError: - print("Integer value too large %s" % t.value) + print(("Integer value too large %s" % t.value)) t.value = 0 return t @@ -37,7 +37,7 @@ t.lexer.lineno += t.value.count("\n") def t_error(t): - print("Illegal character '%s'" % t.value[0]) + print(("Illegal character '%s'" % t.value[0])) t.lexer.skip(1) # Build the lexer --- ./test/pkg_test1/parsing/parsetab.py (original) +++ ./test/pkg_test1/parsing/parsetab.py (refactored) @@ -10,7 +10,7 @@ _lr_action_items = {'$end':([1,2,3,5,9,14,15,16,17,18,19,20,],[-10,-9,0,-2,-10,-7,-1,-8,-3,-6,-4,-5,]),'RPAREN':([2,8,9,14,16,17,18,19,20,],[-9,16,-10,-7,-8,-3,-6,-4,-5,]),'DIVIDE':([1,2,5,8,9,14,15,16,17,18,19,20,],[-10,-9,11,11,-10,-7,11,-8,11,-6,11,-5,]),'EQUALS':([1,],[7,]),'NUMBER':([0,4,6,7,10,11,12,13,],[2,2,2,2,2,2,2,2,]),'PLUS':([1,2,5,8,9,14,15,16,17,18,19,20,],[-10,-9,10,10,-10,-7,10,-8,-3,-6,-4,-5,]),'LPAREN':([0,4,6,7,10,11,12,13,],[4,4,4,4,4,4,4,4,]),'TIMES':([1,2,5,8,9,14,15,16,17,18,19,20,],[-10,-9,13,13,-10,-7,13,-8,13,-6,13,-5,]),'MINUS':([0,1,2,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,],[6,-10,-9,6,12,6,6,12,-10,6,6,6,6,-7,12,-8,-3,-6,-4,-5,]),'NAME':([0,4,6,7,10,11,12,13,],[1,9,9,9,9,9,9,9,]),} _lr_action = {} -for _k, _v in _lr_action_items.items(): +for _k, _v in list(_lr_action_items.items()): for _x,_y in zip(_v[0],_v[1]): if not _x in _lr_action: _lr_action[_x] = {} _lr_action[_x][_k] = _y @@ -19,7 +19,7 @@ _lr_goto_items = {'expression':([0,4,6,7,10,11,12,13,],[5,8,14,15,17,18,19,20,]),'statement':([0,],[3,]),} RefactoringTool: No changes to ./test/pkg_test1/parsing/lextab.py RefactoringTool: Refactored ./test/pkg_test1/parsing/calcparse.py RefactoringTool: Refactored ./test/pkg_test1/parsing/calclex.py RefactoringTool: No changes to ./test/pkg_test1/__init__.py RefactoringTool: No changes to ./test/lex_token_dup.py RefactoringTool: No changes to ./test/lex_token5.py RefactoringTool: No changes to ./test/lex_token4.py RefactoringTool: No changes to ./test/lex_token3.py RefactoringTool: No changes to ./test/lex_token2.py RefactoringTool: No changes to ./test/lex_token1.py RefactoringTool: Refactored ./test/lex_state_try.py RefactoringTool: Refactored ./test/lex_state_norule.py RefactoringTool: Refactored ./test/lex_state_noerror.py RefactoringTool: Refactored ./test/lex_state5.py RefactoringTool: Refactored ./test/lex_state4.py RefactoringTool: Refactored ./test/lex_state3.py RefactoringTool: Refactored ./test/lex_state2.py RefactoringTool: Refactored ./test/lex_state1.py RefactoringTool: No changes to ./test/lex_rule3.py RefactoringTool: No changes to ./test/lex_rule2.py RefactoringTool: No changes to ./test/lex_rule1.py RefactoringTool: No changes to ./test/lex_re3.py RefactoringTool: No changes to ./test/lex_re2.py RefactoringTool: No changes to ./test/lex_re1.py RefactoringTool: Refactored ./test/lex_optimize3.py RefactoringTool: Refactored ./test/lex_optimize2.py _lr_goto = {} -for _k, _v in _lr_goto_items.items(): +for _k, _v in list(_lr_goto_items.items()): for _x, _y in zip(_v[0], _v[1]): if not _x in _lr_goto: _lr_goto[_x] = {} _lr_goto[_x][_k] = _y --- ./test/pkg_test1/parsing/calcparse.py (original) +++ ./test/pkg_test1/parsing/calcparse.py (refactored) @@ -52,11 +52,11 @@ try: t[0] = names[t[1]] except LookupError: - print("Undefined name '%s'" % t[1]) + print(("Undefined name '%s'" % t[1])) t[0] = 0 def p_error(t): - print("Syntax error at '%s'" % t.value) + print(("Syntax error at '%s'" % t.value)) parser = yacc.yacc() --- ./test/pkg_test1/parsing/calclex.py (original) +++ ./test/pkg_test1/parsing/calclex.py (refactored) @@ -26,7 +26,7 @@ try: t.value = int(t.value) except ValueError: - print("Integer value too large %s" % t.value) + print(("Integer value too large %s" % t.value)) t.value = 0 return t @@ -37,7 +37,7 @@ t.lexer.lineno += t.value.count("\n") def t_error(t): - print("Illegal character '%s'" % t.value[0]) + print(("Illegal character '%s'" % t.value[0])) t.lexer.skip(1) # Build the lexer --- ./test/lex_state_try.py (original) +++ ./test/lex_state_try.py (refactored) @@ -29,7 +29,7 @@ def t_comment_body_part(t): r'(.|\n)*\*/' - print("comment body %s" % t) + print(("comment body %s" % t)) t.lexer.begin('INITIAL') def t_error(t): --- ./test/lex_state_norule.py (original) +++ ./test/lex_state_norule.py (refactored) @@ -28,7 +28,7 @@ def t_comment_body_part(t): r'(.|\n)*\*/' - print("comment body %s" % t) + print(("comment body %s" % t)) t.lexer.begin('INITIAL') def t_error(t): --- ./test/lex_state_noerror.py (original) +++ ./test/lex_state_noerror.py (refactored) @@ -27,7 +27,7 @@ def t_comment_body_part(t): r'(.|\n)*\*/' - print("comment body %s" % t) + print(("comment body %s" % t)) t.lexer.begin('INITIAL') def t_error(t): --- ./test/lex_state5.py (original) +++ ./test/lex_state5.py (refactored) @@ -28,7 +28,7 @@ def t_comment_body_part(t): r'(.|\n)*\*/' - print("comment body %s" % t) + print(("comment body %s" % t)) t.lexer.begin('INITIAL') def t_error(t): --- ./test/lex_state4.py (original) +++ ./test/lex_state4.py (refactored) @@ -28,7 +28,7 @@ def t_comment_body_part(t): r'(.|\n)*\*/' - print("comment body %s" % t) + print(("comment body %s" % t)) t.lexer.begin('INITIAL') def t_error(t): --- ./test/lex_state3.py (original) +++ ./test/lex_state3.py (refactored) @@ -29,7 +29,7 @@ def t_comment_body_part(t): r'(.|\n)*\*/' - print("comment body %s" % t) + print(("comment body %s" % t)) t.lexer.begin('INITIAL') def t_error(t): --- ./test/lex_state2.py (original) +++ ./test/lex_state2.py (refactored) @@ -27,7 +27,7 @@ def t_comment_body_part(t): r'(.|\n)*\*/' - print("comment body %s" % t) + print(("comment body %s" % t)) t.lexer.begin('INITIAL') def t_error(t): --- ./test/lex_state1.py (original) +++ ./test/lex_state1.py (refactored) @@ -27,7 +27,7 @@ def t_comment_body_part(t): r'(.|\n)*\*/' - print("comment body %s" % t) + print(("comment body %s" % t)) t.lexer.begin('INITIAL') def t_error(t): --- ./test/lex_optimize3.py (original) +++ ./test/lex_optimize3.py (refactored) @@ -30,7 +30,7 @@ try: t.value = int(t.value) except ValueError: - print("Integer value too large %s" % t.value) + print(("Integer value too large %s" % t.value)) t.value = 0 return t @@ -41,7 +41,7 @@ t.lineno += t.value.count("\n") def t_error(t): - print("Illegal character '%s'" % t.value[0]) + print(("Illegal character '%s'" % t.value[0])) t.lexer.skip(1) # Build the lexer --- ./test/lex_optimize2.py (original) +++ ./test/lex_optimize2.py (refactored) @@ -28,7 +28,7 @@ try: t.value = int(t.value) except ValueError: - print("Integer value too large %s" % t.valRefactoringTool: Refactored ./test/lex_optimize.py RefactoringTool: Refactored ./test/lex_opt_alias.py RefactoringTool: Refactored ./test/lex_object.py RefactoringTool: Refactored ./test/lex_module_import.py RefactoringTool: No changes to ./test/lex_module.py RefactoringTool: No changes to ./test/lex_many_tokens.py RefactoringTool: No changes to ./test/lex_literal3.py RefactoringTool: No changes to ./test/lex_literal2.py RefactoringTool: No changes to ./test/lex_literal1.py RefactoringTool: No changes to ./test/lex_ignore2.py RefactoringTool: No changes to ./test/lex_ignore.py RefactoringTool: Refactored ./test/lex_hedit.py RefactoringTool: No changes to ./test/lex_error4.py RefactoringTool: No changes to ./test/lex_error3.py RefactoringTool: No changes to ./test/lex_error2.py RefactoringTool: No changes to ./test/lex_error1.py RefactoringTool: No changes to ./test/lex_empty.py RefactoringTool: No changes to ./test/lex_dup3.py RefactoringTool: No changes to ./test/lex_dup2.py RefactoringTool: No changes to ./test/lex_dup1.py RefactoringTool: No changes to ./test/lex_doc1.py RefactoringTool: Refactored ./test/lex_closure.py RefactoringTool: Refactored ./test/calclex.py RefactoringTool: No changes to ./setup.py RefactoringTool: No changes to ./ply/ygen.py RefactoringTool: Refactored ./ply/yacc.py ue) + print(("Integer value too large %s" % t.value)) t.value = 0 return t @@ -39,7 +39,7 @@ t.lineno += t.value.count("\n") def t_error(t): - print("Illegal character '%s'" % t.value[0]) + print(("Illegal character '%s'" % t.value[0])) t.lexer.skip(1) # Build the lexer --- ./test/lex_optimize.py (original) +++ ./test/lex_optimize.py (refactored) @@ -28,7 +28,7 @@ try: t.value = int(t.value) except ValueError: - print("Integer value too large %s" % t.value) + print(("Integer value too large %s" % t.value)) t.value = 0 return t @@ -39,7 +39,7 @@ t.lineno += t.value.count("\n") def t_error(t): - print("Illegal character '%s'" % t.value[0]) + print(("Illegal character '%s'" % t.value[0])) t.lexer.skip(1) # Build the lexer --- ./test/lex_opt_alias.py (original) +++ ./test/lex_opt_alias.py (refactored) @@ -29,7 +29,7 @@ try: t.value = int(t.value) except ValueError: - print("Integer value too large %s" % t.value) + print(("Integer value too large %s" % t.value)) t.value = 0 return t @@ -43,7 +43,7 @@ t.lexer.lineno += t.value.count("\n") def t_error(t): - print("Illegal character '%s'" % t.value[0]) + print(("Illegal character '%s'" % t.value[0])) t.lexer.skip(1) t_spam_error = t_error --- ./test/lex_object.py (original) +++ ./test/lex_object.py (refactored) @@ -29,7 +29,7 @@ try: t.value = int(t.value) except ValueError: - print("Integer value too large %s" % t.value) + print(("Integer value too large %s" % t.value)) t.value = 0 return t @@ -40,7 +40,7 @@ t.lineno += t.value.count("\n") def t_error(self,t): - print("Illegal character '%s'" % t.value[0]) + print(("Illegal character '%s'" % t.value[0])) t.lexer.skip(1) --- ./test/lex_module_import.py (original) +++ ./test/lex_module_import.py (refactored) @@ -26,7 +26,7 @@ try: t.value = int(t.value) except ValueError: - print("Integer value too large %s" % t.value) + print(("Integer value too large %s" % t.value)) t.value = 0 return t @@ -37,6 +37,6 @@ t.lineno += t.value.count("\n") def t_error(t): - print("Illegal character '%s'" % t.value[0]) + print(("Illegal character '%s'" % t.value[0])) t.lexer.skip(1) --- ./test/lex_hedit.py (original) +++ ./test/lex_hedit.py (refactored) @@ -36,7 +36,7 @@ return t def t_error(t): - print("Illegal character '%s'" % t.value[0]) + print(("Illegal character '%s'" % t.value[0])) t.lexer.skip(1) # Build the lexer --- ./test/lex_closure.py (original) +++ ./test/lex_closure.py (refactored) @@ -30,7 +30,7 @@ try: t.value = int(t.value) except ValueError: - print("Integer value too large %s" % t.value) + print(("Integer value too large %s" % t.value)) t.value = 0 return t @@ -41,7 +41,7 @@ t.lineno += t.value.count("\n") def t_error(t): - print("Illegal character '%s'" % t.value[0]) + print(("Illegal character '%s'" % t.value[0])) t.lexer.skip(1) # Build the lexer --- ./test/calclex.py (original) +++ ./test/calclex.py (refactored) @@ -28,7 +28,7 @@ try: t.value = int(t.value) except ValueError: - print("Integer value too large %s" % t.value) + print(("Integer value too large %s" % t.value)) t.value = 0 return t @@ -39,7 +39,7 @@ t.lexer.lineno += t.value.count("\n") def t_error(t): - print("Illegal character '%s'" % t.value[0]) + print(("Illegal character '%s'" % t.value[0])) t.lexer.skip(1) # Build the lexer --- ./ply/yacc.py (original) +++ ./ply/yacc.py (refactored) @@ -94,7 +94,7 @@ # String type-checking compatibility if sys.version_info[0] < 3: - string_types = basestring + string_types = str else: string_types = str @@ -312,7 +312,7 @@ # See: http://www.gnu.org/software/bison/manual/html_node/Default-Reductions.html#Default-Reductions def set_defaulted_states(self): self.defaulted_states = {} - for state, actions in self.action.items(): + for state, actions in list(self.action.items()): rules = list(actions.values()) if len(rules) == 1 and rules[0] < 0: self.defaulted_states[state] = rules[0] @@ -1329,7 +1329,7 @@ def __len__(self): return len(self.prod) - def __nonzero__(self): + def __bool__(self): return 1 def __getitem__(self, index): @@ -1669,7 +1669,7 @@ # Then propagate termination until no change: while True: some_change = False - for (n, pl) in self.Prodnames.items(): + for (n, pl) in list(self.Prodnames.items()): # Nonterminal n terminates iff any of its productions terminates. for p in pl: # Production p terminates iff all of its rhs symbols terminate. @@ -1697,7 +1697,7 @@ break infinite = [] - for (s, term) in terminates.items(): + for (s, term) in list(terminates.items()): if not term: if s not in self.Prodnames and s not in self.Terminals and s != 'error': # s is used-but-not-defined, and we've already warned of that, @@ -1734,7 +1734,7 @@ # ----------------------------------------------------------------------------- def unused_terminals(self): unused_tok = [] - for s, v in self.Terminals.items(): + for s, v in list(self.Terminals.items()): if s != 'error' and not v: unused_tok.append(s) @@ -1749,7 +1749,7 @@ def unused_rules(self): unused_prod = [] - for s, v in self.Nonterminals.items(): + for s, v in list(self.Nonterminals.items()): if not v: p = self.Prodnames[s][0] unused_prod.append(p) @@ -1979,7 +1979,7 @@ def read_pickle(self, filename): try: - import cPickle as pickle + import pickle as pickle except ImportError: import pickle @@ -2471,7 +2471,7 @@ # ----------------------------------------------------------------------------- def add_lookaheads(self, lookbacks, followset): - for trans, lb in lookbacks.items(): + for trans, lb in list(lookbacks.items()): # Loop over productions in lookback for state, p in lb: if state not in p.lookaheads: @@ -2721,8 +2721,8 @@ if smaller: items = {} - for s, nd in self.lr_action.items(): - for name, v in nd.items(): + for s, nd in list(self.lr_action.items()): + for name, v in list(nd.items()): i = items.get(name) if not i: i = ([], []) @@ -2731,7 +2731,7 @@ i[1].append(v) f.write('\n_lr_action_items = {') - for k, v in items.items(): + for k, v in list(items.items()): f.write('%r:([' % k) for i in v[0]: f.write('%r,' % i) @@ -2753,7 +2753,7 @@ else: f.write('\n_lr_action = { ') - for k, v in self.lr_action.items(): + for k, v in list(self.lr_action.items()): f.write('(%r,%r):%r,' % (k[0], k[1], v)) f.write('}\n') @@ -2761,8 +2761,8 @@ # Factor out names to try and make smaller items = {} - for s, nd in self.lr_goto.items(): - for name, v in nd.items(): + for s, nd in list(self.lr_goto.items()): + RefactoringTool: Refactored ./ply/lex.py for name, v in list(nd.items()): i = items.get(name) if not i: i = ([], []) @@ -2771,7 +2771,7 @@ i[1].append(v) f.write('\n_lr_goto_items = {') - for k, v in items.items(): + for k, v in list(items.items()): f.write('%r:([' % k) for i in v[0]: f.write('%r,' % i) @@ -2792,7 +2792,7 @@ ''') else: f.write('\n_lr_goto = { ') - for k, v in self.lr_goto.items(): + for k, v in list(self.lr_goto.items()): f.write('(%r,%r):%r,' % (k[0], k[1], v)) f.write('}\n') @@ -2819,7 +2819,7 @@ def pickle_table(self, filename, signature=''): try: - import cPickle as pickle + import pickle as pickle except ImportError: import pickle with open(filename, 'wb') as outf: @@ -3103,7 +3103,7 @@ # Get all p_functions from the grammar def get_pfunctions(self): p_functions = [] - for name, item in self.pdict.items(): + for name, item in list(self.pdict.items()): if not name.startswith('p_') or name == 'p_error': continue if isinstance(item, (types.FunctionType, types.MethodType)): @@ -3162,7 +3162,7 @@ # Secondary validation step that looks for p_ definitions that are not functions # or functions that look like they might be grammar rules. - for n, v in self.pdict.items(): + for n, v in list(self.pdict.items()): if n.startswith('p_') and isinstance(v, (types.FunctionType, types.MethodType)): continue if n.startswith('t_'): --- ./ply/lex.py (original) +++ ./ply/lex.py (refactored) @@ -44,7 +44,7 @@ # This tuple contains known string types try: # Python 2.6 - StringTypes = (types.StringType, types.UnicodeType) + StringTypes = (bytes, str) except AttributeError: # Python 3.0 StringTypes = (str, bytes) @@ -150,7 +150,7 @@ if object: newtab = {} - for key, ritem in self.lexstatere.items(): + for key, ritem in list(self.lexstatere.items()): newre = [] for cre, findex in ritem: newfindex = [] @@ -163,7 +163,7 @@ newtab[key] = newre c.lexstatere = newtab c.lexstateerrorf = {} - for key, ef in self.lexstateerrorf.items(): + for key, ef in list(self.lexstateerrorf.items()): c.lexstateerrorf[key] = getattr(object, ef.__name__) c.lexmodule = object return c @@ -186,7 +186,7 @@ # Rewrite the lexstatere table, replacing function objects with function names tabre = {} - for statename, lre in self.lexstatere.items(): + for statename, lre in list(self.lexstatere.items()): titem = [] for (pat, func), retext, renames in zip(lre, self.lexstateretext[statename], self.lexstaterenames[statename]): titem.append((retext, _funcs_to_names(func, renames))) @@ -196,12 +196,12 @@ tf.write('_lexstateignore = %s\n' % repr(self.lexstateignore)) taberr = {} - for statename, ef in self.lexstateerrorf.items(): + for statename, ef in list(self.lexstateerrorf.items()): taberr[statename] = ef.__name__ if ef else None tf.write('_lexstateerrorf = %s\n' % repr(taberr)) tabeof = {} - for statename, ef in self.lexstateeoff.items(): + for statename, ef in list(self.lexstateeoff.items()): tabeof[statename] = ef.__name__ if ef else None tf.write('_lexstateeoff = %s\n' % repr(tabeof)) @@ -226,7 +226,7 @@ self.lexstateignore = lextab._lexstateignore self.lexstateRefactoringTool: No changes to ./ply/ctokens.py RefactoringTool: Refactored ./ply/cpp.py re = {} self.lexstateretext = {} - for statename, lre in lextab._lexstatere.items(): + for statename, lre in list(lextab._lexstatere.items()): titem = [] txtitem = [] for pat, func_name in lre: @@ -236,11 +236,11 @@ self.lexstateretext[statename] = txtitem self.lexstateerrorf = {} - for statename, ef in lextab._lexstateerrorf.items(): + for statename, ef in list(lextab._lexstateerrorf.items()): self.lexstateerrorf[statename] = fdict[ef] self.lexstateeoff = {} - for statename, ef in lextab._lexstateeoff.items(): + for statename, ef in list(lextab._lexstateeoff.items()): self.lexstateeoff[statename] = fdict[ef] self.begin('INITIAL') @@ -415,7 +415,7 @@ def __iter__(self): return self - def next(self): + def __next__(self): t = self.token() if t is None: raise StopIteration @@ -501,7 +501,7 @@ lexindexfunc = [None] * (max(lexre.groupindex.values()) + 1) lexindexnames = lexindexfunc[:] - for f, i in lexre.groupindex.items(): + for f, i in list(lexre.groupindex.items()): handle = ldict.get(f, None) if type(handle) in (types.FunctionType, types.MethodType): lexindexfunc[i] = (handle, toknames[f]) @@ -718,11 +718,11 @@ self.error = True # Sort the functions by line number - for f in self.funcsym.values(): + for f in list(self.funcsym.values()): f.sort(key=lambda x: x[1].__code__.co_firstlineno) # Sort the strings by regular expression length - for s in self.strsym.values(): + for s in list(self.strsym.values()): s.sort(key=lambda x: len(x[1]), reverse=True) # Validate all of the t_rules collected @@ -975,7 +975,7 @@ debuglog.info("lex: state '%s' : regex[%d] = '%s'", state, i, text) # For inclusive states, we need to add the regular expressions from the INITIAL state - for state, stype in stateinfo.items(): + for state, stype in list(stateinfo.items()): if state != 'INITIAL' and stype == 'inclusive': lexobj.lexstatere[state].extend(lexobj.lexstatere['INITIAL']) lexobj.lexstateretext[state].extend(lexobj.lexstateretext['INITIAL']) @@ -1001,7 +1001,7 @@ lexobj.lexeoff = linfo.eoff.get('INITIAL', None) # Check state information for ignore and error rules - for s, stype in stateinfo.items(): + for s, stype in list(stateinfo.items()): if stype == 'exclusive': if s not in linfo.errorf: errorlog.warning("No error rule is defined for exclusive state '%s'", s) --- ./ply/cpp.py (original) +++ ./ply/cpp.py (refactored) @@ -7,7 +7,7 @@ # # This module implements an ANSI-C style lexical preprocessor for PLY. # ----------------------------------------------------------------------------- -from __future__ import generators + # ----------------------------------------------------------------------------- # Default preprocessor lexer definitions. These tokens are enough to get @@ -185,7 +185,7 @@ # ---------------------------------------------------------------------- def error(self,file,line,msg): - print("%s:%d %s" % (file,line,msg)) + print(("%s:%d %s" % (file,line,msg))) # ---------------------------------------------------------------------- # lexprobe() @@ -248,7 +248,7 @@ self.lexer.input(c) tok = self.lexer.token() if not tok or tok.value != c: - print("Unable to lex '%s' required for preprocessor" % c) + print(("Unable to lex '%s' required for preprocessor" % c)) # ---------------------------------------------------------------------- # add_path() @@ -271,7 +271,7 @@ def group_lines(self,input): lex = self.lexer.clone() lines = [x.rstrip() for x in input.splitlines()] - fRefactoringTool: No changes to ./ply/__init__.py RefactoringTool: Refactored ./example/yply/yply.py RefactoringTool: Refactored ./example/yply/yparse.py RefactoringTool: Refactored ./example/yply/ylex.py or i in xrange(len(lines)): + for i in range(len(lines)): j = i+1 while lines[i].endswith('\\') and (j < len(lines)): lines[i] = lines[i][:-1]+lines[j] @@ -590,7 +590,7 @@ expr = expr.replace("!"," not ") try: result = eval(expr) - except StandardError: + except Exception: self.error(self.source,tokens[0].lineno,"Couldn't evaluate expression") result = 0 return result @@ -772,7 +772,7 @@ except IOError: pass else: - print("Couldn't find '%s'" % filename) + print(("Couldn't find '%s'" % filename)) # ---------------------------------------------------------------------- # define() @@ -781,7 +781,7 @@ # ---------------------------------------------------------------------- def define(self,tokens): - if isinstance(tokens,(str,unicode)): + if isinstance(tokens,str): tokens = self.tokenize(tokens) linetok = tokens @@ -894,7 +894,7 @@ while True: tok = p.token() if not tok: break - print(p.source, tok) + print((p.source, tok)) --- ./example/yply/yply.py (original) +++ ./example/yply/yply.py (refactored) @@ -29,14 +29,14 @@ from ply import * if len(sys.argv) == 1: - print "usage : yply.py [-nocode] inputfile" + print("usage : yply.py [-nocode] inputfile") raise SystemExit if len(sys.argv) == 3: if sys.argv[1] == '-nocode': yparse.emit_code = 0 else: - print "Unknown option '%s'" % sys.argv[1] + print("Unknown option '%s'" % sys.argv[1]) raise SystemExit filename = sys.argv[2] else: @@ -44,10 +44,10 @@ yacc.parse(open(filename).read()) -print """ +print(""" if __name__ == '__main__': from ply import * yacc.yacc() -""" +""") --- ./example/yply/yparse.py (original) +++ ./example/yply/yparse.py (refactored) @@ -20,17 +20,17 @@ '''defsection : definitions SECTION | SECTION''' p.lexer.lastsection = 1 - print "tokens = ", repr(tokenlist) - print - print "precedence = ", repr(preclist) - print - print "# -------------- RULES ----------------" - print + print("tokens = ", repr(tokenlist)) + print() + print("precedence = ", repr(preclist)) + print() + print("# -------------- RULES ----------------") + print() def p_rulesection(p): '''rulesection : rules SECTION''' - print "# -------------- RULES END ----------------" + print("# -------------- RULES END ----------------") print_code(p[2],0) def p_definitions(p): @@ -43,7 +43,7 @@ def p_definition_start(p): '''definition : START ID''' - print "start = '%s'" % p[2] + print("start = '%s'" % p[2]) def p_definition_token(p): '''definition : toktype opttype idlist optsemi ''' @@ -121,7 +121,7 @@ rulecount = 1 for r in rule[1]: # r contains one of the rule possibilities - print "def p_%s_%d(p):" % (rulename,rulecount) + print("def p_%s_%d(p):" % (rulename,rulecount)) prod = [] prodcode = "" for i in range(len(r)): @@ -138,17 +138,17 @@ embed_count += 1 else: prod.append(item) - print " '''%s : %s'''" % (rulename, " ".join(prod)) + print(" '''%s : %s'''" % (rulename, " ".join(prod))) # Emit code print_code(prodcode,4) - print + print() rulecount += 1 for e,code in embedded: - print "def p_%s(p):" % e - print " '''%s : '''" % e + print("def p_%s(p):" % e) + print(" '''%s : '''" % e) print_code(code,4) - print + print() def p_rule(p): '''rule : ID ':' rulelist ';' ''' @@ -213,5 +213,5 @@ if not emit_code: return codelines = code.splitlines() for c in codelines: - print "%s# %s" % (" "*indent,c) - + print("%s# %s" % (" "*indent,c)) + ---RefactoringTool: Refactored ./example/unicalc/calc.py RefactoringTool: Refactored ./example/optcalc/calc.py RefactoringTool: Refactored ./example/newclasscalc/calc.py ./example/yply/ylex.py (original) +++ ./example/yply/ylex.py (refactored) @@ -95,8 +95,8 @@ raise RuntimeError def t_error(t): - print "%d: Illegal character '%s'" % (t.lexer.lineno, t.value[0]) - print t.value + print("%d: Illegal character '%s'" % (t.lexer.lineno, t.value[0])) + print(t.value) t.lexer.skip(1) lex.lex() --- ./example/unicalc/calc.py (original) +++ ./example/unicalc/calc.py (refactored) @@ -18,32 +18,32 @@ # Tokens -t_PLUS = ur'\+' -t_MINUS = ur'-' -t_TIMES = ur'\*' -t_DIVIDE = ur'/' -t_EQUALS = ur'=' -t_LPAREN = ur'\(' -t_RPAREN = ur'\)' -t_NAME = ur'[a-zA-Z_][a-zA-Z0-9_]*' +t_PLUS = r'\+' +t_MINUS = r'-' +t_TIMES = r'\*' +t_DIVIDE = r'/' +t_EQUALS = r'=' +t_LPAREN = r'\(' +t_RPAREN = r'\)' +t_NAME = r'[a-zA-Z_][a-zA-Z0-9_]*' def t_NUMBER(t): - ur'\d+' + r'\d+' try: t.value = int(t.value) except ValueError: - print "Integer value too large", t.value + print("Integer value too large", t.value) t.value = 0 return t -t_ignore = u" \t" +t_ignore = " \t" def t_newline(t): - ur'\n+' + r'\n+' t.lexer.lineno += t.value.count("\n") def t_error(t): - print "Illegal character '%s'" % t.value[0] + print("Illegal character '%s'" % t.value[0]) t.lexer.skip(1) # Build the lexer @@ -67,17 +67,17 @@ def p_statement_expr(p): 'statement : expression' - print p[1] + print(p[1]) def p_expression_binop(p): '''expression : expression PLUS expression | expression MINUS expression | expression TIMES expression | expression DIVIDE expression''' - if p[2] == u'+' : p[0] = p[1] + p[3] - elif p[2] == u'-': p[0] = p[1] - p[3] - elif p[2] == u'*': p[0] = p[1] * p[3] - elif p[2] == u'/': p[0] = p[1] / p[3] + if p[2] == '+' : p[0] = p[1] + p[3] + elif p[2] == '-': p[0] = p[1] - p[3] + elif p[2] == '*': p[0] = p[1] * p[3] + elif p[2] == '/': p[0] = p[1] / p[3] def p_expression_uminus(p): 'expression : MINUS expression %prec UMINUS' @@ -96,22 +96,22 @@ try: p[0] = names[p[1]] except LookupError: - print "Undefined name '%s'" % p[1] + print("Undefined name '%s'" % p[1]) p[0] = 0 def p_error(p): if p: - print "Syntax error at '%s'" % p.value + print("Syntax error at '%s'" % p.value) else: - print "Syntax error at EOF" + print("Syntax error at EOF") import ply.yacc as yacc yacc.yacc() while 1: try: - s = raw_input('calc > ') + s = input('calc > ') except EOFError: break if not s: continue - yacc.parse(unicode(s)) + yacc.parse(str(s)) --- ./example/optcalc/calc.py (original) +++ ./example/optcalc/calc.py (refactored) @@ -33,7 +33,7 @@ try: t.value = int(t.value) except ValueError: - print("Integer value too large %s" % t.value) + print(("Integer value too large %s" % t.value)) t.value = 0 return t @@ -44,7 +44,7 @@ t.lexer.lineno += t.value.count("\n") def t_error(t): - print("Illegal character '%s'" % t.value[0]) + print(("Illegal character '%s'" % t.value[0])) t.lexer.skip(1) # Build the lexer @@ -68,7 +68,7 @@ def p_statement_expr(t): 'statement : expression' - print(t[1]) + print((t[1])) def p_expression_binop(t): '''expression : expression PLUS expression @@ -98,12 +98,12 @@ try: t[0] = names[t[1]] except LookupError: - print("Undefined name '%s'" % t[1]) + print(("Undefined name '%s'" % t[1])) t[0] = 0 def p_error(t): if t: - print("Syntax error at '%s'" % t.value) + print(("Syntax error at '%s'" % t.value)) else: print("Syntax error at EOF") @@ -112,7 +112,7 @@ while 1: try: - s = raw_input('calc > ') + s = input('calc > ') except EOFError: break yacc.parse(s) --- ./example/newclasscalc/calc.py (original) +++ ./exampleRefactoringTool: Refactored ./example/hedit/hedit.py RefactoringTool: Refactored ./example/closurecalc/calc.py RefactoringTool: Refactored ./example/classcalc/calc.py /newclasscalc/calc.py (refactored) @@ -50,7 +50,7 @@ def run(self): while 1: try: - s = raw_input('calc > ') + s = input('calc > ') except EOFError: break if not s: continue @@ -82,7 +82,7 @@ try: t.value = int(t.value) except ValueError: - print("Integer value too large %s" % t.value) + print(("Integer value too large %s" % t.value)) t.value = 0 #print "parsed number %s" % repr(t.value) return t @@ -94,7 +94,7 @@ t.lexer.lineno += t.value.count("\n") def t_error(self, t): - print("Illegal character '%s'" % t.value[0]) + print(("Illegal character '%s'" % t.value[0])) t.lexer.skip(1) # Parsing rules @@ -112,7 +112,7 @@ def p_statement_expr(self, p): 'statement : expression' - print(p[1]) + print((p[1])) def p_expression_binop(self, p): """ @@ -146,12 +146,12 @@ try: p[0] = self.names[p[1]] except LookupError: - print("Undefined name '%s'" % p[1]) + print(("Undefined name '%s'" % p[1])) p[0] = 0 def p_error(self, p): if p: - print("Syntax error at '%s'" % p.value) + print(("Syntax error at '%s'" % p.value)) else: print("Syntax error at EOF") --- ./example/hedit/hedit.py (original) +++ ./example/hedit/hedit.py (refactored) @@ -37,7 +37,7 @@ return t def t_error(t): - print("Illegal character '%s'" % t.value[0]) + print(("Illegal character '%s'" % t.value[0])) t.lexer.skip(1) # Build the lexer --- ./example/closurecalc/calc.py (original) +++ ./example/closurecalc/calc.py (refactored) @@ -44,7 +44,7 @@ t.lexer.lineno += t.value.count("\n") def t_error(t): - print("Illegal character '%s'" % t.value[0]) + print(("Illegal character '%s'" % t.value[0])) t.lexer.skip(1) # Build the lexer @@ -94,12 +94,12 @@ try: p[0] = variables[p[1]] except LookupError: - print("Undefined name '%s'" % p[1]) + print(("Undefined name '%s'" % p[1])) p[0] = 0 def p_error(p): if p: - print("Syntax error at '%s'" % p.value) + print(("Syntax error at '%s'" % p.value)) else: print("Syntax error at EOF") @@ -120,7 +120,7 @@ while True: try: - s = raw_input("calc > ") + s = input("calc > ") except EOFError: break r = calc(s) --- ./example/classcalc/calc.py (original) +++ ./example/classcalc/calc.py (refactored) @@ -47,7 +47,7 @@ def run(self): while 1: try: - s = raw_input('calc > ') + s = input('calc > ') except EOFError: break if not s: continue @@ -79,7 +79,7 @@ try: t.value = int(t.value) except ValueError: - print("Integer value too large %s" % t.value) + print(("Integer value too large %s" % t.value)) t.value = 0 #print "parsed number %s" % repr(t.value) return t @@ -91,7 +91,7 @@ t.lexer.lineno += t.value.count("\n") def t_error(self, t): - print("Illegal character '%s'" % t.value[0]) + print(("Illegal character '%s'" % t.value[0])) t.lexer.skip(1) # Parsing rules @@ -109,7 +109,7 @@ def p_statement_expr(self, p): 'statement : expression' - print(p[1]) + print((p[1])) def p_expression_binop(self, p): """ @@ -143,12 +143,12 @@ try: p[0] = self.names[p[1]] except LookupError: - print("Undefined name '%s'" % p[1]) + print(("Undefined name '%s'" % p[1])) p[0] = 0 def p_error(self, p): if p: - print("SRefactoringTool: Refactored ./example/calceof/calc.py RefactoringTool: Refactored ./example/calcdebug/calc.py RefactoringTool: Refactored ./example/calc/calc.py RefactoringTool: No changes to ./example/ansic/cparse.py RefactoringTool: Refactored ./example/ansic/clex.py RefactoringTool: Refactored ./example/GardenSnake/GardenSnake.py yntax error at '%s'" % p.value) + print(("Syntax error at '%s'" % p.value)) else: print("Syntax error at EOF") --- ./example/calceof/calc.py (original) +++ ./example/calceof/calc.py (refactored) @@ -33,7 +33,7 @@ t.lexer.lineno += t.value.count("\n") def t_eof(t): - more = raw_input('... ') + more = input('... ') if more: t.lexer.input(more + '\n') return t.lexer.token() @@ -41,7 +41,7 @@ return None def t_error(t): - print("Illegal character '%s'" % t.value[0]) + print(("Illegal character '%s'" % t.value[0])) t.lexer.skip(1) # Build the lexer @@ -65,7 +65,7 @@ def p_statement_expr(p): 'statement : expression' - print(p[1]) + print((p[1])) def p_expression_binop(p): '''expression : expression '+' expression @@ -94,12 +94,12 @@ try: p[0] = names[p[1]] except LookupError: - print("Undefined name '%s'" % p[1]) + print(("Undefined name '%s'" % p[1])) p[0] = 0 def p_error(p): if p: - print("Syntax error at '%s'" % p.value) + print(("Syntax error at '%s'" % p.value)) else: print("Syntax error at EOF") @@ -108,7 +108,7 @@ while 1: try: - s = raw_input('calc > ') + s = input('calc > ') except EOFError: break if not s: continue --- ./example/calcdebug/calc.py (original) +++ ./example/calcdebug/calc.py (refactored) @@ -33,7 +33,7 @@ t.lexer.lineno += t.value.count("\n") def t_error(t): - print("Illegal character '%s'" % t.value[0]) + print(("Illegal character '%s'" % t.value[0])) t.lexer.skip(1) # Build the lexer @@ -57,7 +57,7 @@ def p_statement_expr(p): 'statement : expression' - print(p[1]) + print((p[1])) def p_expression_binop(p): '''expression : expression '+' expression @@ -86,12 +86,12 @@ try: p[0] = names[p[1]] except LookupError: - print("Undefined name '%s'" % p[1]) + print(("Undefined name '%s'" % p[1])) p[0] = 0 def p_error(p): if p: - print("Syntax error at '%s'" % p.value) + print(("Syntax error at '%s'" % p.value)) else: print("Syntax error at EOF") @@ -106,7 +106,7 @@ while 1: try: - s = raw_input('calc > ') + s = input('calc > ') except EOFError: break if not s: continue --- ./example/calc/calc.py (original) +++ ./example/calc/calc.py (refactored) @@ -33,7 +33,7 @@ t.lexer.lineno += t.value.count("\n") def t_error(t): - print("Illegal character '%s'" % t.value[0]) + print(("Illegal character '%s'" % t.value[0])) t.lexer.skip(1) # Build the lexer @@ -57,7 +57,7 @@ def p_statement_expr(p): 'statement : expression' - print(p[1]) + print((p[1])) def p_expression_binop(p): '''expression : expression '+' expression @@ -86,12 +86,12 @@ try: p[0] = names[p[1]] except LookupError: - print("Undefined name '%s'" % p[1]) + print(("Undefined name '%s'" % p[1])) p[0] = 0 def p_error(p): if p: - print("Syntax error at '%s'" % p.value) + print(("Syntax error at '%s'" % p.value)) else: print("Syntax error at EOF") @@ -100,7 +100,7 @@ while 1: try: - s = raw_input('calc > ') + s = input('calc > ') except EOFError: break if not s: continue --- ./example/ansic/clex.py (original) +++ ./example/ansic/clex.py (refactored) @@ -151,7 +151,7 @@ t.lexer.lineno += 1 def t_error(t): - print("Illegal character %s" % repr(t.value[0])) + print(("Illegal character %s" % repr(t.value[0]))) t.lexer.skip(1) lexer = lex.lex() --- ./example/GardenSnake/GardenSnake.py (original) +++ ./example/GardenSnake/GardenSnake.py (refactored) @@ -146,7 +146,7 @@ def t_error(t): raise SyntaxError("Unknown symbol %r" % (t.value[0],)) - print "Skipping", repr(t.value[0]) + print("Skipping", repr(t.value[0])) t.lexer.skip(1) ## I impleRefactoringTool: Refactored ./example/BASIC/basparse.py RefactoringTool: Refactored ./example/BASIC/basinterp.py mented INDENT / DEDENT generation as a post-processing filter @@ -320,10 +320,10 @@ def input(self, s, add_endmarker=True): self.lexer.paren_count = 0 self.lexer.input(s) - self.token_stream = filter(self.lexer, add_endmarker) + self.token_stream = list(filter(self.lexer, add_endmarker)) def token(self): try: - return self.token_stream.next() + return next(self.token_stream) except StopIteration: return None @@ -366,7 +366,7 @@ | file_input stmt | NEWLINE | stmt""" - if isinstance(p[len(p)-1], basestring): + if isinstance(p[len(p)-1], str): if len(p) == 3: p[0] = p[1] else: @@ -492,11 +492,14 @@ # factor: ('+'|'-'|'~') factor | power # comp_op: '<'|'>'|'=='|'>='|'<='|'<>'|'!='|'in'|'not' 'in'|'is'|'is' 'not' -def make_lt_compare((left, right)): +def make_lt_compare(xxx_todo_changeme): + (left, right) = xxx_todo_changeme return ast.Compare(left, [('<', right),]) -def make_gt_compare((left, right)): +def make_gt_compare(xxx_todo_changeme1): + (left, right) = xxx_todo_changeme1 return ast.Compare(left, [('>', right),]) -def make_eq_compare((left, right)): +def make_eq_compare(xxx_todo_changeme2): + (left, right) = xxx_todo_changeme2 return ast.Compare(left, [('==', right),]) @@ -699,11 +702,11 @@ # Set up the GardenSnake run-time environment def print_(*args): - print "-->", " ".join(map(str,args)) + print("-->", " ".join(map(str,args))) globals()["print"] = print_ compiled_code = compile(code) -exec compiled_code in globals() -print "Done" +exec(compiled_code, globals()) +print("Done") --- ./example/BASIC/basparse.py (original) +++ ./example/BASIC/basparse.py (refactored) @@ -44,7 +44,7 @@ def p_statement(p): '''statement : INTEGER command NEWLINE''' if isinstance(p[2],str): - print("%s %s %s" % (p[2],"AT LINE", p[1])) + print(("%s %s %s" % (p[2],"AT LINE", p[1]))) p[0] = None p.parser.error = 1 else: @@ -68,7 +68,7 @@ def p_statement_bad(p): '''statement : INTEGER error NEWLINE''' - print("MALFORMED STATEMENT AT LINE %s" % p[1]) + print(("MALFORMED STATEMENT AT LINE %s" % p[1])) p[0] = None p.parser.error = 1 --- ./example/BASIC/basinterp.py (original) +++ ./example/BASIC/basinterp.py (refactored) @@ -61,7 +61,7 @@ self.loopend[pc] = i break else: - print("FOR WITHOUT NEXT AT LINE %s" % self.stat[pc]) + print(("FOR WITHOUT NEXT AT LINE %s" % self.stat[pc])) self.error = 1 # Evaluate an expression @@ -83,7 +83,7 @@ if var in self.vars: return self.vars[var] else: - print("UNDEFINED VARIABLE %s AT LINE %s" % (var, self.stat[self.pc])) + print(("UNDEFINED VARIABLE %s AT LINE %s" % (var, self.stat[self.pc]))) raise RuntimeError # May be a list lookup or a function evaluation if dim1 and not dim2: @@ -95,7 +95,7 @@ if var in self.lists: dim1val = self.eval(dim1) if dim1val < 1 or dim1val > len(self.lists[var]): - print("LIST INDEX OUT OF BOUNDS AT LINE %s" % self.stat[self.pc]) + print(("LIST INDEX OUT OF BOUNDS AT LINE %s" % self.stat[self.pc])) raise RuntimeError return self.lists[var][dim1val-1] if dim1 and dim2: @@ -103,10 +103,10 @@ dim1val = self.eval(dim1) dim2val = self.eval(dim2) if dim1val < 1 or dim1val > len(self.tables[var]) or dim2val < 1 or dim2val > len(self.tables[var][0]): - print("TABLE INDEX OUT OUT BOUNDS AT LINE %s" % self.stat[self.pc]) + print(("TABLE INDEX OUT OUT BOUNDS AT LINE %s" % self.stat[self.pc])) raise RuntimeError return self.tables[var][dim1val-1][dim2val-1] - print("UNDEFINED VARIABLE %s AT LINE %s" % (var, self.stat[self.pc])) + print(("UNDEFINED VARIABLE %s AT LINE %s" % (var, self.stat[self.pc]))) raise RuntimeError # Evaluate a relational expression @@ -150,7 +150,7 @@ self.lists[var] = [0]*10 if dim1val > len(self.lists[var]): - print ("DIMENSION TOO LARGE AT LINE %s" % self.stat[self.pc]) + print(("DIMENSION TOO LARGE AT LINE %s" % self.stat[self.pc])) raise RuntimeError self.lists[var][dim1val-1] = self.eval(value) elif dim1 and dim2: @@ -163,14 +163,14 @@ self.tables[var] = v # Variable already exists if dim1val > len(self.tables[var]) or dim2val > len(self.tables[var][0]): - print("DIMENSION TOO LARGE AT LINE %s" % self.stat[self.pc]) + print(("DIMENSION TOO LARGE AT LINE %s" % self.stat[self.pc])) raise RuntimeError self.tables[var][dim1val-1][dim2val-1] = self.eval(value) # Change the current line number def goto(self,linenum): if not linenum in self.prog: - print("UNDEFINED LINE NUMBER %d AT LINE %d" % (linenum, self.stat[self.pc])) + print(("UNDEFINED LINE NUMBER %d AT LINE %d" % (linenum, self.stat[self.pc]))) raise RuntimeError self.pc = self.stat.index(linenum) @@ -285,7 +285,7 @@ elif op == 'NEXT': if not self.loops: - print("NEXT WITHOUT FOR AT LINE %s" % line) + print(("NEXT WITHOUT FOR AT LINE %s" % line)) return nextvar = instr[1] @@ -293,13 +293,13 @@ loopinst = self.prog[self.stat[self.pc]] forvar = loopinst[1] if nextvar != forvar: - print("NEXT DOESN'T MATCH FOR AT LINE %s" % line) + print(("NEXT DOESN'T MATCH FOR AT LINE %s" % line)) return continue elif op == 'GOSUB': newline = instr[1] if self.gosub: - print("ALREADY IN A SUBROUTINE AT LINE %s" % line) + print(("ALREADY IN A SUBROUTINE AT LINE %s" % line)) return self.gosub = self.stat[self.pc] self.goto(newline) @@ -307,7 +307,7 @@ elif op == 'RETURN': if not self.gosub: - print("RETURN WITHOUT A GOSUB AT LINE %s" % line) + print(("RETURN WITHOUT A GOSUB AT LINE %s" % line)) return self.goto(self.gosub) self.gosub = None @@ -365,10 +365,10 @@ instr = self.prog[line] op = instr[0] if op in ['END','STOP','RETURN']: - print("%s %s" % (line, op)) + print(("%s %s" % (line, op))) continue elif op == 'REM': - print("%s %s" % (line, instr[1])) + print(("%s %s" % (line, instr[1]))) elif op == 'PRINT': _out = "%s %s " % (line, op) first = 1 @@ -381,7 +381,7 @@ if instr[2]: _out += instr[2] print(_out) elif op == 'LET': - print("%s LET %s = %s" % (line,self.var_str(instr[1]),self.expr_str(instr[2]))) + print(("%s LET %s = %s" % (line,self.var_str(instr[1]),self.expr_str(instr[2])))) elif op == 'READ': _out = "%s READ " % line RefactoringTool: Refactored ./example/BASIC/basiclog.py RefactoringTool: Refactored ./example/BASIC/basiclex.py RefactoringTool: Refactored ./example/BASIC/basic.py RefactoringTool: Refactored ./doc/makedoc.py RefactoringTool: Files that were modified: RefactoringTool: ./test/yacc_uprec2.py RefactoringTool: ./test/yacc_uprec.py RefactoringTool: ./test/yacc_unused_rule.py RefactoringTool: ./test/yacc_unused.py RefactoringTool: ./test/yacc_unicode_literals.py RefactoringTool: ./test/yacc_term1.py RefactoringTool: ./test/yacc_sr.py RefactoringTool: ./test/yacc_simple.py RefactoringTool: ./test/yacc_rr_unused.py RefactoringTool: ./test/yacc_rr.py RefactoringTool: ./test/yacc_prec1.py RefactoringTool: ./test/yacc_notok.py RefactoringTool: ./test/yacc_notfunc.py RefactoringTool: ./test/yacc_nop.py RefactoringTool: ./test/yacc_noerror.py RefactoringTool: ./test/yacc_nodoc.py RefactoringTool: ./test/yacc_nested.py RefactoringTool: ./test/yacc_missing1.py RefactoringTool: ./test/yacc_misplaced.py RefactoringTool: ./test/yacc_literal.py RefactoringTool: ./test/yacc_inf.py RefactoringTool: ./test/yacc_error7.py RefactoringTool: ./test/yacc_error6.py RefactoringTool: ./test/yacc_error5.py RefactoringTool: ./test/yacc_error4.py RefactoringTool: ./test/yacc_error3.py RefactoringTool: ./test/yacc_error2.py RefactoringTool: ./test/yacc_error1.py RefactoringTool: ./test/yacc_dup.py RefactoringTool: ./test/yacc_badtok.py RefactoringTool: ./test/yacc_badrule.py RefactoringTool: ./test/yacc_badprec3.py RefactoringTool: ./test/yacc_badprec2.py RefactoringTool: ./test/yacc_badprec.py RefactoringTool: ./test/yacc_badid.py RefactoringTool: ./test/yacc_badargs.py RefactoringTool: ./test/testyacc.py RefactoringTool: ./test/testlex.py RefactoringTool: ./test/pkg_test6/parsing/statement.py RefactoringTool: ./test/pkg_test6/parsing/parsetab.py RefactoringTool: ./test/pkg_test6/parsing/lextab.py RefactoringTool: ./test/pkg_test6/parsing/expression.py RefactoringTool: ./test/pkg_test6/parsing/calcparse.py RefactoringTool: ./test/pkg_test6/parsing/calclex.py RefactoringTool: ./test/pkg_test6/__init__.py RefactoringTool: ./test/pkg_test5/parsing/parsetab.py RefactoringTool: ./test/pkg_test5/parsing/lextab.py RefactoringTool: ./test/pkg_test5/parsing/calcparse.py RefactoringTool: ./test/pkg_test5/parsing/calclex.py RefactoringTool: ./test/pkg_test5/__init__.py RefactoringTool: ./test/pkg_test4/parsing/calcparse.py RefactoringTool: ./test/pkg_test4/parsing/calclex.py RefactoringTool: ./test/pkg_test4/__init__.py RefactoringTool: ./test/pkg_test3/parsing/calcparse.py RefactoringTool: ./test/pkg_test3/parsing/calclex.py RefactoringTool: ./test/pkg_test3/generated/parsetab.py RefactoringTool: ./test/pkg_test3/generated/lextab.py RefactoringTool: ./test/pkg_test3/__init__.py RefactoringTool: ./test/pkg_test2/parsing/calcparsetab.py RefactoringTool: ./test/pkg_test2/parsing/calcparse.py RefactoringTool: ./test/pkg_test2/parsing/calclextab.py RefactoringTool: ./test/pkg_test2/parsing/calclex.py RefactoringTool: ./test/pkg_test2/__init__.py RefactoringTool: ./test/pkg_test1/parsing/parsetab.py RefactoringTool: ./test/pkg_test1/parsing/lextab.py RefactoringTool: ./test/pkg_test1/parsing/calcparse.py RefactoringTool: ./test/pkg_test1/parsing/calclex.py RefactoringTool: ./test/pkg_test1/__init__.py RefactoringTool: ./test/lex_token_dup.py RefactoringTool: ./test/lex_token5.py RefactoringTool: ./test/lex_token4.py RefactoringTool: ./test/lex_token3.py RefactoringTool: ./test/lex_token2.py RefactoringTool: ./test/lex_token1.py RefactoringTool: ./test/lex_state_try.py RefactoringTool: ./test/lex_state_norule.py RefactoringTool: ./test/lex_state_noerror.py RefactoringTool: ./test/lex_state5.py RefactoringTool: ./test/lex_state4.py RefactoringTool: ./test/lex_state3.py RefactoringTool: ./test/lex_state2.py RefactoringTool: ./test/lex_state1.py RefactoringTool: ./test/lex_rule3.py RefactoringTool: ./test/lex_rule2.py RefactoringTool: ./test/lex_rule1.py RefactoringTool: ./test/lex_re3.py RefactoringTool: ./test/lex_re2.py RefactoringTool: ./test/lex_re1.py RefactoringTool: ./test/lex_optimize3.py RefactoringTool: ./test/lex_optimize2.py RefactoringTool: ./test/lex_optimize.py RefactoringTool: ./test/lex_opt_alias.py RefactoringTool: ./test/lex_object.py RefactoringTool: ./test/lex_module_import.py RefactoringTool: ./test/lex_module.py RefactoringTool: ./test/lex_many_tokens.py RefactoringTool: ./test/lex_literal3.py RefactoringTool: ./test/lex_literal2.py RefactoringTool: ./test/lex_literal1.py RefactoringTool: ./test/lex_ignore2.py RefactoringTool: ./test/lex_ignore.py RefactoringTool: ./test/lex_hedit.py RefactoringTool: ./test/lex_error4.py RefactoringTool: ./test/lex_error3.py RefactoringTool: ./test/lex_error2.py RefactoringTool: ./test/lex_error1.py RefactoringTool: ./test/lex_empty.py RefactoringTool: ./test/lex_dup3.py RefactoringTool: ./test/lex_dup2.py RefactoringTool: ./test/lex_dup1.py RefactoringTool: ./test/lex_doc1.py RefactoringTool: ./test/lex_closure.py RefactoringTool: ./test/calclex.py RefactoringTool: ./setup.py RefactoringTool: ./ply/ygen.py RefactoringTool: ./ply/yacc.py RefactoringTool: ./ply/lex.py RefactoringTool: ./ply/ctokens.py RefactoringTool: ./ply/cpp.py RefactoringTool: ./ply/__init__.py RefactoringTool: ./example/yply/yply.py RefactoringTool: ./example/yply/yparse.py RefactoringTool: ./example/yply/ylex.py RefactoringTool: ./example/unicalc/calc.py RefactoringTool: ./example/optcalc/calc.py RefactoringTool: ./example/newclasscalc/calc.py RefactoringTool: ./example/hedit/hedit.py RefactoringTool: ./example/closurecalc/calc.py RefactoringTool: ./example/classcalc/calc.py RefactoringTool: ./example/calceof/calc.py RefactoringTool: ./example/calcdebug/calc.py RefactoringTool: ./example/calc/calc.py RefactoringTool: ./example/ansic/cparse.py RefactoringTool: ./example/ansic/clex.py RefactoringTool: ./example/GardenSnake/GardenSnake.py RefactoringTool: ./example/BASIC/basparse.py RefactoringTool: ./example/BASIC/basinterp.py RefactoringTool: ./example/BASIC/basiclog.py RefactoringTool: ./example/BASIC/basiclex.py RefactoringTool: ./example/BASIC/basic.py RefactoringTool: ./doc/makedoc.py first = 1 @@ -391,17 +391,17 @@ first = 0 print(_out) elif op == 'IF': - print("%s IF %s THEN %d" % (line,self.relexpr_str(instr[1]),instr[2])) + print(("%s IF %s THEN %d" % (line,self.relexpr_str(instr[1]),instr[2]))) elif op == 'GOTO' or op == 'GOSUB': - print("%s %s %s" % (line, op, instr[1])) + print(("%s %s %s" % (line, op, instr[1]))) elif op == 'FOR': _out = "%s FOR %s = %s TO %s" % (line,instr[1],self.expr_str(instr[2]),self.expr_str(instr[3])) if instr[4]: _out += " STEP %s" % (self.expr_str(instr[4])) print(_out) elif op == 'NEXT': - print("%s NEXT %s" % (line, instr[1])) + print(("%s NEXT %s" % (line, instr[1]))) elif op == 'FUNC': - print("%s DEF %s(%s) = %s" % (line,instr[1],instr[2],self.expr_str(instr[3]))) + print(("%s DEF %s(%s) = %s" % (line,instr[1],instr[2],self.expr_str(instr[3])))) elif op == 'DIM': _out = "%s DIM " % line first = 1 @@ -429,7 +429,7 @@ # Insert statements def add_statements(self,prog): - for line,stat in prog.items(): + for line,stat in list(prog.items()): self.prog[line] = stat # Delete a statement --- ./example/BASIC/basiclog.py (original) +++ ./example/BASIC/basiclog.py (refactored) @@ -44,7 +44,7 @@ while 1: try: - line = raw_input("[BASIC] ") + line = input("[BASIC] ") except EOFError: raise SystemExit if not line: continue --- ./example/BASIC/basiclex.py (original) +++ ./example/BASIC/basiclex.py (refactored) @@ -51,7 +51,7 @@ return t def t_error(t): - print("Illegal character %s" % t.value[0]) + print(("Illegal character %s" % t.value[0])) t.lexer.skip(1) lex.lex(debug=0) --- ./example/BASIC/basic.py (original) +++ ./example/BASIC/basic.py (refactored) @@ -36,7 +36,7 @@ while 1: try: - line = raw_input("[BASIC] ") + line = input("[BASIC] ") except EOFError: raise SystemExit if not line: continue --- ./doc/makedoc.py (original) +++ ./doc/makedoc.py (refactored) @@ -43,7 +43,7 @@ ############################################################################### if len(sys.argv) != 2: - print "usage: makedoc.py filename" + print("usage: makedoc.py filename") sys.exit(1) filename = sys.argv[1] + CFLAGS='-pipe -Wall -g -O2' + export CFLAGS + CXXFLAGS='-pipe -Wall -g -O2' + export CXXFLAGS + FFLAGS='-pipe -Wall -g -O2' + export FFLAGS + python3 setup.py build running build running build_py creating build creating build/lib creating build/lib/ply copying ply/ygen.py -> build/lib/ply copying ply/yacc.py -> build/lib/ply copying ply/lex.py -> build/lib/ply copying ply/ctokens.py -> build/lib/ply copying ply/cpp.py -> build/lib/ply copying ply/__init__.py -> build/lib/ply + popd ~/RPM/BUILD/ply-3.8 + exit 0 Executing(%install): /bin/sh -e /usr/src/tmp/rpm-tmp.53409 + umask 022 + /bin/mkdir -p /usr/src/RPM/BUILD + cd /usr/src/RPM/BUILD + /bin/chmod -Rf u+rwX -- /usr/src/tmp/python-module-ply-buildroot + : + /bin/rm -rf -- /usr/src/tmp/python-module-ply-buildroot + cd ply-3.8 + /usr/bin/python setup.py install --skip-build --root=/usr/src/tmp/python-module-ply-buildroot --force running install running install_lib creating /usr/src/tmp/python-module-ply-buildroot creating /usr/src/tmp/python-module-ply-buildroot/usr creating /usr/src/tmp/python-module-ply-buildroot/usr/lib creating /usr/src/tmp/python-module-ply-buildroot/usr/lib/python2.7 creating /usr/src/tmp/python-module-ply-buildroot/usr/lib/python2.7/site-packages creating /usr/src/tmp/python-module-ply-buildroot/usr/lib/python2.7/site-packages/ply copying build/lib/ply/__init__.py -> /usr/src/tmp/python-module-ply-buildroot/usr/lib/python2.7/site-packages/ply copying build/lib/ply/cpp.py -> /usr/src/tmp/python-module-ply-buildroot/usr/lib/python2.7/site-packages/ply copying build/lib/ply/ctokens.py -> /usr/src/tmp/python-module-ply-buildroot/usr/lib/python2.7/site-packages/ply copying build/lib/ply/lex.py -> /usr/src/tmp/python-module-ply-buildroot/usr/lib/python2.7/site-packages/ply copying build/lib/ply/yacc.py -> /usr/src/tmp/python-module-ply-buildroot/usr/lib/python2.7/site-packages/ply copying build/lib/ply/ygen.py -> /usr/src/tmp/python-module-ply-buildroot/usr/lib/python2.7/site-packages/ply byte-compiling /usr/src/tmp/python-module-ply-buildroot/usr/lib/python2.7/site-packages/ply/__init__.py to __init__.pyc byte-compiling /usr/src/tmp/python-module-ply-buildroot/usr/lib/python2.7/site-packages/ply/cpp.py to cpp.pyc byte-compiling /usr/src/tmp/python-module-ply-buildroot/usr/lib/python2.7/site-packages/ply/ctokens.py to ctokens.pyc byte-compiling /usr/src/tmp/python-module-ply-buildroot/usr/lib/python2.7/site-packages/ply/lex.py to lex.pyc byte-compiling /usr/src/tmp/python-module-ply-buildroot/usr/lib/python2.7/site-packages/ply/yacc.py to yacc.pyc byte-compiling /usr/src/tmp/python-module-ply-buildroot/usr/lib/python2.7/site-packages/ply/ygen.py to ygen.pyc running install_egg_info running egg_info writing ply.egg-info/PKG-INFO writing top-level names to ply.egg-info/top_level.txt writing dependency_links to ply.egg-info/dependency_links.txt reading manifest file 'ply.egg-info/SOURCES.txt' reading manifest template 'MANIFEST.in' warning: no previously-included files matching '*.pyc' found anywhere in distribution writing manifest file 'ply.egg-info/SOURCES.txt' Copying ply.egg-info to /usr/src/tmp/python-module-ply-buildroot/usr/lib/python2.7/site-packages/ply-3.8-py2.7.egg-info running install_scripts + pushd ../python3 ~/RPM/BUILD/python3 ~/RPM/BUILD/ply-3.8 + python3 setup.py install --skip-build --root=/usr/src/tmp/python-module-ply-buildroot --force running install running install_lib creating /usr/src/tmp/python-module-ply-buildroot/usr/lib/python3 creating /usr/src/tmp/python-module-ply-buildroot/usr/lib/python3/site-packages creating /usr/src/tmp/python-module-ply-buildroot/usr/lib/python3/site-packages/ply copying build/lib/ply/__init__.py -> /usr/src/tmp/python-module-ply-buildroot/usr/lib/python3/site-packages/ply copying build/lib/ply/cpp.py -> /usr/src/tmp/python-module-ply-buildroot/usr/lib/python3/site-packages/ply copying build/lib/ply/ctokens.py -> /usr/src/tmp/python-module-ply-buildroot/usr/lib/python3/site-packages/ply copying build/lib/ply/lex.py -> /usr/src/tmp/python-module-ply-buildroot/usr/lib/python3/site-packages/ply copying build/lib/ply/yacc.py -> /usr/src/tmp/python-module-ply-buildroot/usr/lib/python3/site-packages/ply copying build/lib/ply/ygen.py -> /usr/src/tmp/python-module-ply-buildroot/usr/lib/python3/site-packages/ply byte-compiling /usr/src/tmp/python-module-ply-buildroot/usr/lib/python3/site-packages/ply/__init__.py to __init__.cpython-35.pyc byte-compiling /usr/src/tmp/python-module-ply-buildroot/usr/lib/python3/site-packages/ply/cpp.py to cpp.cpython-35.pyc byte-compiling /usr/src/tmp/python-module-ply-buildroot/usr/lib/python3/site-packages/ply/ctokens.py to ctokens.cpython-35.pyc byte-compiling /usr/src/tmp/python-module-ply-buildroot/usr/lib/python3/site-packages/ply/lex.py to lex.cpython-35.pyc byte-compiling /usr/src/tmp/python-module-ply-buildroot/usr/lib/python3/site-packages/ply/yacc.py to yacc.cpython-35.pyc byte-compiling /usr/src/tmp/python-module-ply-buildroot/usr/lib/python3/site-packages/ply/ygen.py to ygen.cpython-35.pyc running install_egg_info running egg_info writing top-level names to ply.egg-info/top_level.txt writing dependency_links to ply.egg-info/dependency_links.txt writing ply.egg-info/PKG-INFO reading manifest file 'ply.egg-info/SOURCES.txt' reading manifest template 'MANIFEST.in' warning: no previously-included files matching '*.pyc' found anywhere in distribution writing manifest file 'ply.egg-info/SOURCES.txt' Copying ply.egg-info to /usr/src/tmp/python-module-ply-buildroot/usr/lib/python3/site-packages/ply-3.8-py3.5.egg-info running install_scripts + popd ~/RPM/BUILD/ply-3.8 + /usr/lib/rpm/find-lang python-module-ply + /usr/lib/rpm/brp-alt Cleaning files in /usr/src/tmp/python-module-ply-buildroot (auto) Verifying and fixing files in /usr/src/tmp/python-module-ply-buildroot (binconfig,pkgconfig,libtool,desktop) Compressing files in /usr/src/tmp/python-module-ply-buildroot (auto) Adjusting library links in /usr/src/tmp/python-module-ply-buildroot ./usr/lib: Verifying ELF objects in /usr/src/tmp/python-module-ply-buildroot (arch=normal,fhs=normal,lfs=relaxed,lint=relaxed,rpath=normal,stack=normal,textrel=normal,unresolved=normal) Bytecompiling python modules in /usr/src/tmp/python-module-ply-buildroot using /usr/bin/python unlink /usr/src/tmp/python-module-ply-buildroot/usr/lib/python2.7/site-packages/ply/__init__.pyc unlink /usr/src/tmp/python-module-ply-buildroot/usr/lib/python2.7/site-packages/ply/cpp.pyc unlink /usr/src/tmp/python-module-ply-buildroot/usr/lib/python2.7/site-packages/ply/ctokens.pyc unlink /usr/src/tmp/python-module-ply-buildroot/usr/lib/python2.7/site-packages/ply/lex.pyc unlink /usr/src/tmp/python-module-ply-buildroot/usr/lib/python2.7/site-packages/ply/yacc.pyc unlink /usr/src/tmp/python-module-ply-buildroot/usr/lib/python2.7/site-packages/ply/ygen.pyc compile /usr/src/tmp/python-module-ply-buildroot/usr/lib/python2.7/site-packages/ply/__init__.py compile /usr/src/tmp/python-module-ply-buildroot/usr/lib/python2.7/site-packages/ply/cpp.py compile /usr/src/tmp/python-module-ply-buildroot/usr/lib/python2.7/site-packages/ply/ctokens.py compile /usr/src/tmp/python-module-ply-buildroot/usr/lib/python2.7/site-packages/ply/lex.py compile /usr/src/tmp/python-module-ply-buildroot/usr/lib/python2.7/site-packages/ply/yacc.py compile /usr/src/tmp/python-module-ply-buildroot/usr/lib/python2.7/site-packages/ply/ygen.py Bytecompiling python modules with optimization in /usr/src/tmp/python-module-ply-buildroot using /usr/bin/python -O compile /usr/src/tmp/python-module-ply-buildroot/usr/lib/python2.7/site-packages/ply/__init__.py compile /usr/src/tmp/python-module-ply-buildroot/usr/lib/python2.7/site-packages/ply/cpp.py compile /usr/src/tmp/python-module-ply-buildroot/usr/lib/python2.7/site-packages/ply/ctokens.py compile /usr/src/tmp/python-module-ply-buildroot/usr/lib/python2.7/site-packages/ply/lex.py compile /usr/src/tmp/python-module-ply-buildroot/usr/lib/python2.7/site-packages/ply/yacc.py compile /usr/src/tmp/python-module-ply-buildroot/usr/lib/python2.7/site-packages/ply/ygen.py Bytecompiling python3 modules in /usr/src/tmp/python-module-ply-buildroot using python3 unlink /usr/src/tmp/python-module-ply-buildroot/usr/lib/python3/site-packages/ply/__pycache__/__init__.cpython-35.pyc unlink /usr/src/tmp/python-module-ply-buildroot/usr/lib/python3/site-packages/ply/__pycache__/cpp.cpython-35.pyc unlink /usr/src/tmp/python-module-ply-buildroot/usr/lib/python3/site-packages/ply/__pycache__/ctokens.cpython-35.pyc unlink /usr/src/tmp/python-module-ply-buildroot/usr/lib/python3/site-packages/ply/__pycache__/lex.cpython-35.pyc unlink /usr/src/tmp/python-module-ply-buildroot/usr/lib/python3/site-packages/ply/__pycache__/yacc.cpython-35.pyc unlink /usr/src/tmp/python-module-ply-buildroot/usr/lib/python3/site-packages/ply/__pycache__/ygen.cpython-35.pyc compile /usr/src/tmp/python-module-ply-buildroot/usr/lib/python3/site-packages/ply/__init__.py compile /usr/src/tmp/python-module-ply-buildroot/usr/lib/python3/site-packages/ply/cpp.py compile /usr/src/tmp/python-module-ply-buildroot/usr/lib/python3/site-packages/ply/ctokens.py compile /usr/src/tmp/python-module-ply-buildroot/usr/lib/python3/site-packages/ply/lex.py compile /usr/src/tmp/python-module-ply-buildroot/usr/lib/python3/site-packages/ply/yacc.py compile /usr/src/tmp/python-module-ply-buildroot/usr/lib/python3/site-packages/ply/ygen.py Bytecompiling python3 modules with optimization in /usr/src/tmp/python-module-ply-buildroot using python3 -O compile /usr/src/tmp/python-module-ply-buildroot/usr/lib/python3/site-packages/ply/__init__.py compile /usr/src/tmp/python-module-ply-buildroot/usr/lib/python3/site-packages/ply/cpp.py compile /usr/src/tmp/python-module-ply-buildroot/usr/lib/python3/site-packages/ply/ctokens.py compile /usr/src/tmp/python-module-ply-buildroot/usr/lib/python3/site-packages/ply/lex.py compile /usr/src/tmp/python-module-ply-buildroot/usr/lib/python3/site-packages/ply/yacc.py compile /usr/src/tmp/python-module-ply-buildroot/usr/lib/python3/site-packages/ply/ygen.py Bytecompiling python3 modules with optimization-2 in /usr/src/tmp/python-module-ply-buildroot using python3 -OO compile /usr/src/tmp/python-module-ply-buildroot/usr/lib/python3/site-packages/ply/__init__.py compile /usr/src/tmp/python-module-ply-buildroot/usr/lib/python3/site-packages/ply/cpp.py compile /usr/src/tmp/python-module-ply-buildroot/usr/lib/python3/site-packages/ply/ctokens.py compile /usr/src/tmp/python-module-ply-buildroot/usr/lib/python3/site-packages/ply/lex.py compile /usr/src/tmp/python-module-ply-buildroot/usr/lib/python3/site-packages/ply/yacc.py compile /usr/src/tmp/python-module-ply-buildroot/usr/lib/python3/site-packages/ply/ygen.py Hardlinking identical .pyc and .opt-?.pyc files './usr/lib/python3/site-packages/ply/__pycache__/ygen.cpython-35.opt-1.pyc' => './usr/lib/python3/site-packages/ply/__pycache__/ygen.cpython-35.pyc' './usr/lib/python3/site-packages/ply/__pycache__/ygen.cpython-35.opt-2.pyc' => './usr/lib/python3/site-packages/ply/__pycache__/ygen.cpython-35.opt-1.pyc' './usr/lib/python3/site-packages/ply/__pycache__/yacc.cpython-35.opt-2.pyc' => './usr/lib/python3/site-packages/ply/__pycache__/yacc.cpython-35.opt-1.pyc' './usr/lib/python3/site-packages/ply/__pycache__/lex.cpython-35.opt-1.pyc' => './usr/lib/python3/site-packages/ply/__pycache__/lex.cpython-35.pyc' './usr/lib/python3/site-packages/ply/__pycache__/lex.cpython-35.opt-2.pyc' => './usr/lib/python3/site-packages/ply/__pycache__/lex.cpython-35.opt-1.pyc' './usr/lib/python3/site-packages/ply/__pycache__/ctokens.cpython-35.opt-1.pyc' => './usr/lib/python3/site-packages/ply/__pycache__/ctokens.cpython-35.pyc' './usr/lib/python3/site-packages/ply/__pycache__/cpp.cpython-35.opt-1.pyc' => './usr/lib/python3/site-packages/ply/__pycache__/cpp.cpython-35.pyc' './usr/lib/python3/site-packages/ply/__pycache__/__init__.cpython-35.opt-1.pyc' => './usr/lib/python3/site-packages/ply/__pycache__/__init__.cpython-35.pyc' './usr/lib/python3/site-packages/ply/__pycache__/__init__.cpython-35.opt-2.pyc' => './usr/lib/python3/site-packages/ply/__pycache__/__init__.cpython-35.opt-1.pyc' Hardlinking identical .pyc and .pyo files './usr/lib/python2.7/site-packages/ply/ygen.pyo' => './usr/lib/python2.7/site-packages/ply/ygen.pyc' './usr/lib/python2.7/site-packages/ply/lex.pyo' => './usr/lib/python2.7/site-packages/ply/lex.pyc' './usr/lib/python2.7/site-packages/ply/ctokens.pyo' => './usr/lib/python2.7/site-packages/ply/ctokens.pyc' './usr/lib/python2.7/site-packages/ply/cpp.pyo' => './usr/lib/python2.7/site-packages/ply/cpp.pyc' './usr/lib/python2.7/site-packages/ply/__init__.pyo' => './usr/lib/python2.7/site-packages/ply/__init__.pyc' Processing files: python-module-ply-3.8-alt0.M80P.1 Executing(%doc): /bin/sh -e /usr/src/tmp/rpm-tmp.13670 + umask 022 + /bin/mkdir -p /usr/src/RPM/BUILD + cd /usr/src/RPM/BUILD + cd ply-3.8 + DOCDIR=/usr/src/tmp/python-module-ply-buildroot/usr/share/doc/python-module-ply-3.8 + export DOCDIR + rm -rf /usr/src/tmp/python-module-ply-buildroot/usr/share/doc/python-module-ply-3.8 + /bin/mkdir -p /usr/src/tmp/python-module-ply-buildroot/usr/share/doc/python-module-ply-3.8 + cp -prL CHANGES doc/internal.html doc/ply.html example/ /usr/src/tmp/python-module-ply-buildroot/usr/share/doc/python-module-ply-3.8 + chmod -R go-w /usr/src/tmp/python-module-ply-buildroot/usr/share/doc/python-module-ply-3.8 + chmod -R a+rX /usr/src/tmp/python-module-ply-buildroot/usr/share/doc/python-module-ply-3.8 + exit 0 Finding Provides (using /usr/lib/rpm/find-provides) Executing: /bin/sh -e /usr/src/tmp/rpm-tmp.Ie0YpQ find-provides: running scripts (alternatives,debuginfo,lib,pam,perl,pkgconfig,python,python3,shell) Finding Requires (using /usr/lib/rpm/find-requires) Executing: /bin/sh -e /usr/src/tmp/rpm-tmp.YTI52L find-requires: running scripts (cpp,debuginfo,files,lib,pam,perl,pkgconfig,pkgconfiglib,python,python3,rpmlib,shebang,shell,static,symlinks) /usr/lib/rpm/python.req.py: /usr/src/tmp/python-module-ply-buildroot/usr/lib/python2.7/site-packages/ply/cpp.py: line=884 IGNORE (for REQ=slight and deep=8) module=ply /usr/lib/rpm/python.req.py: /usr/src/tmp/python-module-ply-buildroot/usr/lib/python2.7/site-packages/ply/cpp.py: line=888 IGNORE (for REQ=slight and deep=8) module=sys python.req: /usr/src/tmp/python-module-ply-buildroot/usr/lib/python2.7/site-packages/ply/lex.py: skipping sys python.req: /usr/src/tmp/python-module-ply-buildroot/usr/lib/python2.7/site-packages/ply/yacc.py: skipping sys /usr/lib/rpm/python.req.py: /usr/src/tmp/python-module-ply-buildroot/usr/lib/python2.7/site-packages/ply/yacc.py: line=365 possible relative import from ., UNIMPLEMENTED /usr/lib/rpm/python.req.py: /usr/src/tmp/python-module-ply-buildroot/usr/lib/python2.7/site-packages/ply/yacc.py: line=703 possible relative import from ., UNIMPLEMENTED /usr/lib/rpm/python.req.py: /usr/src/tmp/python-module-ply-buildroot/usr/lib/python2.7/site-packages/ply/yacc.py: line=1003 possible relative import from ., UNIMPLEMENTED /usr/lib/rpm/python.req.py: /usr/src/tmp/python-module-ply-buildroot/usr/lib/python2.7/site-packages/ply/yacc.py: line=1982 IGNORE (for REQ=slight and deep=15) module=cPickle /usr/lib/rpm/python.req.py: /usr/src/tmp/python-module-ply-buildroot/usr/lib/python2.7/site-packages/ply/yacc.py: line=1984 IGNORE (for REQ=slight and deep=15) module=pickle /usr/lib/rpm/python.req.py: /usr/src/tmp/python-module-ply-buildroot/usr/lib/python2.7/site-packages/ply/yacc.py: line=2822 IGNORE (for REQ=slight and deep=15) module=cPickle /usr/lib/rpm/python.req.py: /usr/src/tmp/python-module-ply-buildroot/usr/lib/python2.7/site-packages/ply/yacc.py: line=2824 IGNORE (for REQ=slight and deep=15) module=pickle /usr/lib/rpm/python.req.py: /usr/src/tmp/python-module-ply-buildroot/usr/lib/python2.7/site-packages/ply/yacc.py: line=2944 IGNORE (for REQ=slight and deep=15) module=hashlib /usr/lib/rpm/python.req.py: /usr/src/tmp/python-module-ply-buildroot/usr/lib/python2.7/site-packages/ply/yacc.py: line=2946 IGNORE (for REQ=slight and deep=15) module=md5 Provides: python2.7(ply), python2.7(ply.cpp), python2.7(ply.ctokens), python2.7(ply.lex), python2.7(ply.yacc), python2.7(ply.ygen) Requires: /usr/lib/python2.7/site-packages, python-modules, python2.7(inspect) Processing files: python3-module-ply-3.8-alt0.M80P.1 Executing(%doc): /bin/sh -e /usr/src/tmp/rpm-tmp.34401 + umask 022 + /bin/mkdir -p /usr/src/RPM/BUILD + cd /usr/src/RPM/BUILD + cd ply-3.8 + DOCDIR=/usr/src/tmp/python-module-ply-buildroot/usr/share/doc/python3-module-ply-3.8 + export DOCDIR + rm -rf /usr/src/tmp/python-module-ply-buildroot/usr/share/doc/python3-module-ply-3.8 + /bin/mkdir -p /usr/src/tmp/python-module-ply-buildroot/usr/share/doc/python3-module-ply-3.8 + cp -prL CHANGES doc/internal.html doc/ply.html /usr/src/tmp/python-module-ply-buildroot/usr/share/doc/python3-module-ply-3.8 + chmod -R go-w /usr/src/tmp/python-module-ply-buildroot/usr/share/doc/python3-module-ply-3.8 + chmod -R a+rX /usr/src/tmp/python-module-ply-buildroot/usr/share/doc/python3-module-ply-3.8 + exit 0 Finding Provides (using /usr/lib/rpm/find-provides) Executing: /bin/sh -e /usr/src/tmp/rpm-tmp.6iFkbL find-provides: running scripts (alternatives,debuginfo,lib,pam,perl,pkgconfig,python,python3,shell) Finding Requires (using /usr/lib/rpm/find-requires) Executing: /bin/sh -e /usr/src/tmp/rpm-tmp.xrY1hN find-requires: running scripts (cpp,debuginfo,files,lib,pam,perl,pkgconfig,pkgconfiglib,python,python3,rpmlib,shebang,shell,static,symlinks) python3.req: /usr/src/tmp/python-module-ply-buildroot/usr/lib/python3/site-packages/ply/cpp.py: skipping time /usr/lib/rpm/python3.req.py: /usr/src/tmp/python-module-ply-buildroot/usr/lib/python3/site-packages/ply/cpp.py: line=884 IGNORE (for REQ=slight and deep=8) module=ply /usr/lib/rpm/python3.req.py: /usr/src/tmp/python-module-ply-buildroot/usr/lib/python3/site-packages/ply/cpp.py: line=888 IGNORE (for REQ=slight and deep=8) module=sys python3.req: /usr/src/tmp/python-module-ply-buildroot/usr/lib/python3/site-packages/ply/lex.py: skipping sys python3.req: /usr/src/tmp/python-module-ply-buildroot/usr/lib/python3/site-packages/ply/yacc.py: skipping sys /usr/lib/rpm/python3.req.py: /usr/src/tmp/python-module-ply-buildroot/usr/lib/python3/site-packages/ply/yacc.py: line=365 possible relative import from ., UNIMPLEMENTED /usr/lib/rpm/python3.req.py: /usr/src/tmp/python-module-ply-buildroot/usr/lib/python3/site-packages/ply/yacc.py: line=703 possible relative import from ., UNIMPLEMENTED /usr/lib/rpm/python3.req.py: /usr/src/tmp/python-module-ply-buildroot/usr/lib/python3/site-packages/ply/yacc.py: line=1003 possible relative import from ., UNIMPLEMENTED /usr/lib/rpm/python3.req.py: /usr/src/tmp/python-module-ply-buildroot/usr/lib/python3/site-packages/ply/yacc.py: line=1982 IGNORE (for REQ=slight and deep=15) module=pickle /usr/lib/rpm/python3.req.py: /usr/src/tmp/python-module-ply-buildroot/usr/lib/python3/site-packages/ply/yacc.py: line=1984 IGNORE (for REQ=slight and deep=15) module=pickle /usr/lib/rpm/python3.req.py: /usr/src/tmp/python-module-ply-buildroot/usr/lib/python3/site-packages/ply/yacc.py: line=2822 IGNORE (for REQ=slight and deep=15) module=pickle /usr/lib/rpm/python3.req.py: /usr/src/tmp/python-module-ply-buildroot/usr/lib/python3/site-packages/ply/yacc.py: line=2824 IGNORE (for REQ=slight and deep=15) module=pickle /usr/lib/rpm/python3.req.py: /usr/src/tmp/python-module-ply-buildroot/usr/lib/python3/site-packages/ply/yacc.py: line=2944 IGNORE (for REQ=slight and deep=15) module=hashlib /usr/lib/rpm/python3.req.py: /usr/src/tmp/python-module-ply-buildroot/usr/lib/python3/site-packages/ply/yacc.py: line=2946 IGNORE (for REQ=slight and deep=15) module=md5 Provides: python3(ply), python3(ply.cpp), python3(ply.ctokens), python3(ply.lex), python3(ply.yacc), python3(ply.ygen), python3.3(ply), python3.3(ply.cpp), python3.3(ply.ctokens), python3.3(ply.lex), python3.3(ply.yacc), python3.3(ply.ygen) Requires: /usr/lib/python3/site-packages, python3(base64) < 0, python3(copy) < 0, python3(inspect) < 0, python3(os) < 0, python3(re) < 0, python3(shutil) < 0, python3(types) < 0, python3(warnings) < 0 Wrote: /usr/src/RPM/RPMS/noarch/python-module-ply-3.8-alt0.M80P.1.noarch.rpm Wrote: /usr/src/RPM/RPMS/noarch/python3-module-ply-3.8-alt0.M80P.1.noarch.rpm 23.21user 1.40system 0:27.24elapsed 90%CPU (0avgtext+0avgdata 66460maxresident)k 0inputs+0outputs (0major+242559minor)pagefaults 0swaps 29.19user 6.01system 0:37.36elapsed 94%CPU (0avgtext+0avgdata 121988maxresident)k 0inputs+0outputs (0major+485571minor)pagefaults 0swaps --- python3-module-ply-3.8-alt0.M80P.1.noarch.rpm.repo 2016-10-25 09:07:54.000000000 +0000 +++ python3-module-ply-3.8-alt0.M80P.1.noarch.rpm.hasher 2019-04-21 01:00:38.188112135 +0000 @@ -10,2 +10,3 @@ /usr/lib/python3/site-packages/ply/__pycache__/__init__.cpython-35.opt-2.pyc 100644 +/usr/lib/python3/site-packages/ply/__pycache__/__init__.cpython-35.pyc 100644 /usr/lib/python3/site-packages/ply/__pycache__/cpp.cpython-35.opt-1.pyc 100644 @@ -35,10 +36,10 @@ Requires: /usr/lib/python3/site-packages -Requires: python3(base64) -Requires: python3(copy) -Requires: python3(inspect) -Requires: python3(os) -Requires: python3(re) -Requires: python3(shutil) -Requires: python3(types) -Requires: python3(warnings) +Requires: python3(base64) < 0 +Requires: python3(copy) < 0 +Requires: python3(inspect) < 0 +Requires: python3(os) < 0 +Requires: python3(re) < 0 +Requires: python3(shutil) < 0 +Requires: python3(types) < 0 +Requires: python3(warnings) < 0 Requires: rpmlib(PayloadIsLzma)