Vega strike Python Modules doc
0.5.1
Documentation of the " Modules " folder of Vega strike
|
Public Member Functions | |
def | __init__ |
def | runsource |
def | runcode |
def | showsyntaxerror |
def | showtraceback |
def | write |
Data Fields | |
locals | |
compile | |
Base class for InteractiveConsole. This class deals with parsing and interpreter state (the user's namespace); it doesn't deal with input buffering or prompting or input file naming (the filename is always passed in explicitly).
def runcode | ( | self, | |
code | |||
) |
Execute a code object. When an exception occurs, self.showtraceback() is called to display a traceback. All exceptions are caught except SystemExit, which is reraised. A note about KeyboardInterrupt: this exception may occur elsewhere in this code, and may not always be caught. The caller should be prepared to deal with it.
Definition at line 90 of file code.py.
References InteractiveInterpreter.locals, InteractiveInterpreter.showtraceback(), and code.softspace().
def runsource | ( | self, | |
source, | |||
filename = "<input>" , |
|||
symbol = "single" |
|||
) |
Compile and run some source in the interpreter. Arguments are as for compile_command(). One several things can happen: 1) The input is incorrect; compile_command() raised an exception (SyntaxError or OverflowError). A syntax traceback will be printed by calling the showsyntaxerror() method. 2) The input is incomplete, and more input is required; compile_command() returned None. Nothing happens. 3) The input is complete; compile_command() returned a code object. The code is executed by calling self.runcode() (which also handles run-time exceptions, except for SystemExit). The return value is 1 in case 2, 0 in the other cases (unless an exception is raised). The return value can be used to decide whether to use sys.ps1 or sys.ps2 to prompt the next line.
Definition at line 51 of file code.py.
References InteractiveInterpreter.compile, InteractiveInterpreter.runcode(), and InteractiveInterpreter.showsyntaxerror().
def showsyntaxerror | ( | self, | |
filename = None |
|||
) |
Display the syntax error that just occurred. This doesn't display a stack trace because there isn't one. If a filename is given, it is stuffed in the exception instead of what was there before (because Python's parser always uses "<string>" when reading from a string). The output is written by self.write(), below.
Definition at line 112 of file code.py.
References traceback.format_exception_only(), Pickler.write, openrsrc.write(), _Hqxcoderengine.write(), _Rlecoderengine.write(), InteractiveInterpreter.write(), BinHex.write(), Marshaller.write, and file_wrapper.write.
def showtraceback | ( | self) |
Display the exception that just occurred. We remove the first stack item because it is our own code. The output is written by self.write(), below.
Definition at line 146 of file code.py.
References traceback.extract_tb(), traceback.format_exception_only(), traceback.format_list(), Pickler.write, openrsrc.write(), _Hqxcoderengine.write(), _Rlecoderengine.write(), InteractiveInterpreter.write(), BinHex.write(), Marshaller.write, and file_wrapper.write.
def write | ( | self, | |
data | |||
) |
Write a string. The base implementation writes to sys.stderr; a subclass may replace this with a different implementation.