Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use print() as a function #178

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,5 @@ parsetab.py
dist/
build/
runtime/
.gitconfig
.idea/
6 changes: 3 additions & 3 deletions smop/Makefile
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# for py3: make PYTHON=python3 CYTHON="cython -3" V=3
# for py2: make PYTHON=python CYTHON="cython" V=2.7

OCTAVE = /home/lei/octave-4.0.2
SCRIPTS = $(OCTAVE)/scripts/specfun

CYTHON = cython
PYTHON = python
CYTHON = cython -3
PYTHON = python3
XFILES = -x inputParser.m,dblquad.m,triplequad.m

COVERAGE = python3 -m coverage
Expand Down
2 changes: 1 addition & 1 deletion smop/callgraph.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,6 @@ def callgraph(G, stmt_list):
#nx.write_dot(G,"G.dot")
#for u in G.nodes():
# if G.out_degree(u) == 0:
# print u
# print(u)
if __name__ == '__main__':
main()
2 changes: 1 addition & 1 deletion smop/libsmop.py
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,7 @@ def deal(a,**kwargs):
return tuple([ai for ai in a.flat])

def disp(*args):
print (args)
print(args)

def eig(a):
u,v = np.linalg.eig(a)
Expand Down
8 changes: 4 additions & 4 deletions smop/parse.py
Original file line number Diff line number Diff line change
Expand Up @@ -664,7 +664,7 @@ def p_persistent_stmt(p):
# else:
# assert p[2].__class__ in (node.let,node.ident), p[2].__class__
# p[0] = p[2]
# #print p[2]
# #print(p[2])


@exceptions
Expand Down Expand Up @@ -739,7 +739,7 @@ def p_stmt(p):
"""
# END_STMT is intentionally left out
p[0] = p[1]
# print p[0]
# print(p[0])


@exceptions
Expand Down Expand Up @@ -830,7 +830,7 @@ def p_error(p):
if p is None:
raise_exception(SyntaxError, "Unexpected EOF", new_lexer)
if p.type == "COMMENT":
# print "Discarded comment", p.value
# print("Discarded comment", p.value)
parser.errok()
return
raise_exception(SyntaxError,
Expand Down Expand Up @@ -869,5 +869,5 @@ def parse(buf):
#
# if "2" in options.debug:
# for i,pi in enumerate(p):
# print i,pi.__class__.__name__,str(pi)[:50]
# print(i,pi.__class__.__name__,str(pi)[:50])

6 changes: 3 additions & 3 deletions smop/resolve.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,19 +51,19 @@ def resolve(t, symtab=None, fp=None, func_name=None):
G = as_networkx(t)
for n in G.nodes():
print(n.__class__.__name__)
u = G.node[n]["ident"]
u = G.nodes[n]["ident"]
if u.props:
pass
elif G.out_edges(n) and G.in_edges(n):
u.props = "U" # upd
#print u.name, u.lineno, u.column
#print(u.name, u.lineno, u.column)
elif G.in_edges(n):
u.props = "D" # def
elif G.out_edges(n):
u.props = "R" # ref
else:
u.props = "F" # ???
G.node[n]["label"] = "%s\\n%s" % (n, u.props)
G.nodes[n]["label"] = "%s\\n%s" % (n, u.props)
return G

def do_resolve(t,symtab):
Expand Down
2 changes: 1 addition & 1 deletion smop/rewrite.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ def let_statement(u):
# for nodename in component:
# G.node[nodename]["ident"].props += "S" # sparse
# #S = G.subgraph(nbunch)
# #print S.edges()
# #print(S.edges())
# return G


Expand Down
4 changes: 2 additions & 2 deletions smop/test_lexer.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ def test040(self):
def test042(self):
"backslash-newline continues a line"
s = "foo \\\n bar ... hello\n bzz"
#print 43,`s`
#print '#', s.count('\n')
#print(43,`s`)
#print('#', s.count('\n'))
self.lexer.input(s)
# line continuation
t = [tok.type for tok in self.lexer]
Expand Down
4 changes: 2 additions & 2 deletions smop/test_matlabarray.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def test030(self):
a[a.shape[0]+1,1:3] = 123
a[a.shape[0]+1,1:3] = 123
a[a.shape[0]+1,1:3] = 123
#print a.shape
#print(a.shape)
self.assertTrue(isequal (a, [[123,123,123],
[123,123,123],
[123,123,123]]))
Expand Down Expand Up @@ -164,7 +164,7 @@ def test100(self):
def test110(self):
a = zeros (4,4,dtype=int)
a[2:3,2:3] = 1
#print a
#print(a)
self.assertTrue(isequal (a,[[0,0,0,0],
[0,1,1,0],
[0,1,1,0],
Expand Down
2 changes: 1 addition & 1 deletion smop/test_primes.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
import liboctave
print liboctave.primes(10000)
print(liboctave.primes(10000))