MCPcopy Create free account
hub / github.com/NGSolve/ngsolve / runsource

Method runsource

python/__console.py:16–35  ·  view source on GitHub ↗
(self, source, filename="<input>", symbol="single")

Source from the content-addressed store, hash-verified

14class InteractiveMPIConsole(code.InteractiveConsole):
15# Function copied from /usr/lib/python3.4/code.py line 38
16 def runsource(self, source, filename="<input>", symbol="single"):
17 try:
18 compiled_code = self.compile(source, filename, symbol)
19 except (OverflowError, SyntaxError, ValueError):
20 # Case 1
21 self.showsyntaxerror(filename)
22 return False
23
24 if compiled_code is None:
25 # Case 2
26 return True
27
28 # Case 3 -- first send code to other mpi processes
29 ngmpi.SendCommand('ngs_py '+source)
30 # then run it on master
31 code.InteractiveConsole.runcode(self, compiled_code)
32
33 # Avoid the prompt to show up before other processes' output
34 self.Barrier()
35 return False
36
37 def interact(self):
38 import sys

Callers 2

interactMethod · 0.95
BarrierMethod · 0.80

Calls 1

BarrierMethod · 0.95

Tested by

no test coverage detected