Beispiel #1
0
 def func(self):
     caller = self.caller
     if caller.ndb.batch_batchmode == "batch_code":
         BATCHCODE.parse_file(caller.ndb.batch_pythonpath)
     else:
         BATCHCMD.parse_file(caller.ndb.batch_pythonpath)
     caller.ndb.batch_stackptr = 0
     caller.msg(format_code("File reloaded. Restarting from top."))
     show_curr(caller)
Beispiel #2
0
 def func(self):
     caller = self.caller
     if caller.ndb.batch_batchmode == "batch_code":
         BATCHCODE.parse_file(caller.ndb.batch_pythonpath)
     else:
         BATCHCMD.parse_file(caller.ndb.batch_pythonpath)
     caller.ndb.batch_stackptr = 0
     caller.msg(format_code("File reloaded. Restarting from top."))
     show_curr(caller)
Beispiel #3
0
 def func(self):
     caller = self.caller
     if caller.ndb.batch_batchmode == "batch_code":
         new_data = BATCHCODE.parse_file(caller.ndb.batch_pythonpath)
     else:
         new_data = BATCHCMD.parse_file(caller.ndb.batch_pythonpath)
     caller.ndb.batch_stack = new_data
     caller.msg(format_code("File reloaded. Staying on same command."))
     show_curr(caller)
Beispiel #4
0
 def func(self):
     caller = self.caller
     if caller.ndb.batch_batchmode == "batch_code":
         new_data = BATCHCODE.parse_file(caller.ndb.batch_pythonpath)
     else:
         new_data = BATCHCMD.parse_file(caller.ndb.batch_pythonpath)
     caller.ndb.batch_stack = new_data
     caller.msg(format_code("File reloaded. Staying on same command."))
     show_curr(caller)
Beispiel #5
0
def batch_code_exec(caller):
    """
    Helper function for executing a single batch-code entry
    """
    ptr = caller.ndb.batch_stackptr
    stack = caller.ndb.batch_stack
    debug = caller.ndb.batch_debug
    codedict = stack[ptr]

    caller.msg(format_header(caller, codedict["code"]))
    err = BATCHCODE.code_exec(codedict, extra_environ={"caller": caller}, debug=debug)
    if err:
        caller.msg(format_code(err))
        return False
    return True
Beispiel #6
0
def batch_code_exec(caller):
    """
    Helper function for executing a single batch-code entry
    """
    ptr = caller.ndb.batch_stackptr
    stack = caller.ndb.batch_stack
    debug = caller.ndb.batch_debug
    code = stack[ptr]

    caller.msg(format_header(caller, code))
    err = BATCHCODE.code_exec(code,
                              extra_environ={"caller": caller},
                              debug=debug)
    if err:
        caller.msg(format_code(err))
        return False
    return True
Beispiel #7
0
    def func(self):
        "Starts the processor."

        caller = self.caller

        args = self.args
        if not args:
            caller.msg("Usage: @batchcode[/interactive/debug] <path.to.file>")
            return
        python_path = self.args

        #parse indata file
        try:
            codes = BATCHCODE.parse_file(python_path)
        except UnicodeDecodeError, err:
            lnum = err.linenum
            caller.msg(_UTF8_ERROR % (python_path, lnum))
            return
Beispiel #8
0
    def func(self):
        "Starts the processor."

        caller = self.caller

        args = self.args
        if not args:
            caller.msg("Usage: @batchcode[/interactive/debug] <path.to.file>")
            return
        python_path = self.args
        debug = 'debug' in self.switches

        #parse indata file
        try:
            codes = BATCHCODE.parse_file(python_path, debug=debug)
        except UnicodeDecodeError, err:
            caller.msg(_UTF8_ERROR % (python_path, err))
            return