Author: Brian Kearns <[email protected]>
Branch:
Changeset: r70998:f57d8ad3b852
Date: 2014-04-26 01:24 -0400
http://bitbucket.org/pypy/pypy/changeset/f57d8ad3b852/
Log: pep8
diff --git a/pypy/interpreter/main.py b/pypy/interpreter/main.py
--- a/pypy/interpreter/main.py
+++ b/pypy/interpreter/main.py
@@ -15,10 +15,11 @@
space.setitem(w_modules, w_main, mainmodule)
return mainmodule
+
def compilecode(space, source, filename, cmd='exec'):
w = space.wrap
- w_code = space.builtin.call('compile',
- w(source), w(filename), w(cmd), w(0), w(0))
+ w_code = space.builtin.call(
+ 'compile', w(source), w(filename), w(cmd), w(0), w(0))
pycode = space.interp_w(eval.Code, w_code)
return pycode
@@ -28,7 +29,7 @@
cmd = 'eval'
else:
cmd = 'exec'
-
+
try:
if space is None:
from pypy.objspace.std import StdObjSpace
@@ -55,18 +56,22 @@
operationerr.record_interpreter_traceback()
raise
+
def run_string(source, filename=None, space=None):
_run_eval_string(source, filename, space, False)
+
def eval_string(source, filename=None, space=None):
return _run_eval_string(source, filename, space, True)
+
def run_file(filename, space=None):
- if __name__=='__main__':
+ if __name__ == '__main__':
print "Running %r with %r" % (filename, space)
istring = open(filename).read()
run_string(istring, filename, space)
+
def run_module(module_name, args, space=None):
"""Implements PEP 338 'Executing modules as scripts', overwriting
sys.argv[1:] using `args` and executing the module `module_name`.
@@ -89,7 +94,6 @@
return space.call_function(w_run_module, w(module_name), space.w_None,
w('__main__'), space.w_True)
-# ____________________________________________________________
def run_toplevel(space, f, verbose=False):
"""Calls f() and handle all OperationErrors.
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit