def send_token(self): token = self.token self.token = None self.eos = True return ActionResult(production=(token,))
def new_request(self, url, params, header): url = url.encode('ascii', 'ignore') self.request = self['http'].get(url, params, header) return ActionResult()
def handle_body(self): body = self['http'].body(self.request) self.reset_request() return ActionResult(production=(body, ))
def dummy_action(self, input): return ActionResult(tokens_consumed=1, tokens_produced=1, production=(input, ))
def start_timer(self, token): self.setup() return ActionResult(production=(token, ))
def write(self, data): self.file.write_line(data) return ActionResult(tokens_consumed=1, tokens_produced=0, production=())
def answer(self): result = self.result self.counter = 0 self.result = 0 return ActionResult(production=([result, self.type],))
def eof(self): self.calvinsys.io.file.close(self.file) self.file = None return ActionResult(production=(EOSToken(), self.status_OK))
def flush(self, input): return ActionResult(production=(input, ))
def file_not_found(self): self.file_not_found = False # Only report once return ActionResult(production=(EOSToken(), self.status_ERR))
def readline(self): line = self.file.read_line() return ActionResult(production=(line, ))
def exception_handler(self, action, args, context): return ActionResult(production=(ExceptionToken(), ))
def sum(self, input): self.sum = self.sum + input return ActionResult(tokens_consumed=1, tokens_produced=1, production=(self.sum, ))
def send_eos(self): self.eos = False return ActionResult(production=(EOSToken(),))
def wrap_action(self, input): return ActionResult(tokens_consumed=1, tokens_produced=1, production=(self.wrapper.wrap(input), ))
def clear(self): self.timer.ack() return ActionResult()
def exception_handler(self, action, args, exceptions): self.calvinsys.io.file.close(self.file) self.file = None return ActionResult(tokens_consumed=1, tokens_produced=0, production=())
def render_image(self, image): if not image is None: self.image.show_image(image, self.width, self.height) return ActionResult(production=())
def divide(self, temperatures): self.result = (( self.result * self.counter ) + temperatures[0] )/ (self.counter + 1) self.counter += 1 self.type = temperatures[1] return ActionResult(production=(['ignore','train'],))
def exception_handler(self, action, args, context): return ActionResult(production=(self.default, ))
def empty(self, trigger): return ActionResult()
def load(self, string): try: res = self['json'].loads(string) except: res = self.default return ActionResult(production=(res, ))
def verbose_action(self, input): return ActionResult(tokens_consumed=1, tokens_produced=1, production=("(" + str(input) + ")", ))
def start_timer(self): self.start() result = self.rand_generator(self.low, self.high) return ActionResult(production=([result, self.type],))
def passthrough(self, token): self.timer.ack() return ActionResult(production=(token, ))
def action(self, sample, tok): if sample is True: self.held = copy(tok) return ActionResult(production=(self.held, ))
def handle_headers(self): self.received_headers = True status = self['http'].status(self.request) headers = self['http'].headers(self.request) return ActionResult(production=(status, headers))
def post_update(self, status): self['twitter'].post_update(status) return ActionResult()
def handle_empty_body(self): self.reset_request() return ActionResult()
def incoming(self, token): self.token = token return ActionResult()