An interpreter can process chunks of EmPy code.
Methods
|
|
|
|
__del__
|
__del__ ( self )
|
|
__init__
|
__init__ (
self,
output=None,
argv=None,
prefix=DEFAULT_PREFIX,
pseudo=None,
options=None,
globals=None,
hooks=None,
)
|
|
assign
|
assign (
self,
name,
value,
locals=None,
)
Do a potentially complex (including tuple unpacking) assignment.
|
|
atomic
|
atomic (
self,
name,
value,
locals=None,
)
Do an atomic assignment.
|
|
binary
|
binary (
self,
file,
name='<binary>',
chunkSize=0,
locals=None,
)
Parse the entire contents of a file-like object, in chunks.
|
|
clause
|
clause (
self,
catch,
locals=None,
)
Given the string representation of an except clause, turn it into
a 2-tuple consisting of the class name, and either a variable name
or None.
|
|
clear
|
clear ( self )
Clear out the globals dictionary with a brand new one.
|
|
close
|
close ( self )
|
|
context
|
context ( self )
|
|
defined
|
defined (
self,
name,
locals=None,
)
Return a Boolean indicating whether or not the name is
defined either in the locals or the globals.
|
|
deregister
|
deregister ( self, hook )
Remove an already registered hook.
|
|
escape
|
escape (
self,
data,
more='',
)
Escape a string so that nonprintable characters are replaced
with compatible EmPy expansions.
|
|
evaluate
|
evaluate (
self,
expression,
locals=None,
)
Evaluate an expression.
|
|
execute
|
execute (
self,
statements,
locals=None,
)
Execute a statement.
|
|
expand
|
expand (
self,
data,
locals=None,
)
Do an explicit expansion on a subordinate stream.
|
|
fail
|
fail (
self,
error,
fatal=False,
)
Handle an actual error that occurred.
|
|
file
|
file (
self,
file,
name='<file>',
locals=None,
)
Parse the entire contents of a file-like object, line by line.
|
|
finalize
|
finalize ( self )
Execute any remaining final routines.
|
|
fix
|
fix ( self )
Reset the globals, stamping in the pseudomodule.
|
|
flush
|
flush ( self )
|
|
handle
|
handle ( self, meta )
Handle a MetaError.
|
|
import_
|
import_ (
self,
name,
locals=None,
)
Do an import.
|
|
include
|
include (
self,
fileOrFilename,
locals=None,
)
Do an include pass on a file or filename.
|
|
installProxy
|
installProxy ( self )
Install a proxy if necessary.
|
|
interact
|
interact ( self )
Perform interaction.
|
|
invoke
|
invoke (
self,
_name,
**keywords,
)
Invoke the hook(s) associated with the hook name, should they
exist.
|
|
literal
|
literal ( self, text )
Process a string literal.
|
|
meta
|
meta ( self, exc=None )
Construct a MetaError for the interpreter's current state.
|
|
multi
|
multi (
self,
names,
values,
locals=None,
)
Do a (potentially recursive) assignment.
Exceptions
|
|
TypeError, "unpack non-sequence"
ValueError, "unpack tuple of wrong size"
|
|
|
ok
|
ok ( self )
Is the interpreter still active?
|
|
parse
|
parse (
self,
scanner,
locals=None,
)
Parse and run as much from this scanner as possible.
|
|
pop
|
pop ( self )
|
|
push
|
push ( self )
|
|
quote
|
quote ( self, data )
Quote the given string so that if it were expanded it would
evaluate to the original.
|
|
register
|
register (
self,
hook,
prepend=False,
)
Register the provided hook.
|
|
reset
|
reset ( self )
|
|
restore
|
restore ( self, destructive=True )
Restore the topmost historic globals.
|
|
safe
|
safe (
self,
scanner,
final=False,
locals=None,
)
Do a protected parse. Catch transient parse errors; if
final is true, then make a final pass with a terminator,
otherwise ignore the transient parse error (more data is
pending).
|
|
save
|
save ( self, deep=True )
|
|
serialize
|
serialize (
self,
expression,
locals=None,
)
Do an expansion, involving evaluating an expression, then
converting it to a string and writing that string to the
output if the evaluation is not None.
|
|
shutdown
|
shutdown ( self )
Declare this interpreting session over; close the stream file
object. This method is idempotent.
|
|
significate
|
significate (
self,
key,
value=None,
locals=None,
)
Declare a significator.
|
|
single
|
single (
self,
source,
locals=None,
)
Execute an expression or statement, just as if it were
entered into the Python interactive interpreter.
|
|
stream
|
stream ( self )
|
|
string
|
string (
self,
data,
name='<string>',
locals=None,
)
Parse a string.
|
|
tokenize
|
tokenize ( self, name )
Take an lvalue string and return a name or a (possibly recursive)
list of names.
Exceptions
|
|
ParseError, "unexpected assignment token: '%s'" % garbage
|
|
|
unfix
|
unfix ( self )
Remove the pseudomodule (if present) from the globals.
|
|
update
|
update ( self, other )
Update the current globals dictionary with another dictionary.
|
|
wrap
|
wrap (
self,
callable,
args,
)
Wrap around an application of a callable and handle errors.
Return whether no error occurred.
|
|
write
|
write ( self, data )
|
|
writelines
|
writelines ( self, stuff )
|
|