Esempio n. 1
0
 def send_token(self):
     token = self.token
     self.token = None
     self.eos = True
     return ActionResult(production=(token,))
Esempio n. 2
0
 def new_request(self, url, params, header):
     url = url.encode('ascii', 'ignore')
     self.request = self['http'].get(url, params, header)
     return ActionResult()
Esempio n. 3
0
 def handle_body(self):
     body = self['http'].body(self.request)
     self.reset_request()
     return ActionResult(production=(body, ))
Esempio n. 4
0
 def dummy_action(self, input):
     return ActionResult(tokens_consumed=1,
                         tokens_produced=1,
                         production=(input, ))
Esempio n. 5
0
 def start_timer(self, token):
     self.setup()
     return ActionResult(production=(token, ))
Esempio n. 6
0
 def write(self, data):
     self.file.write_line(data)
     return ActionResult(tokens_consumed=1, tokens_produced=0, production=())
Esempio n. 7
0
 def answer(self):
     result = self.result
     self.counter = 0
     self.result = 0
     return ActionResult(production=([result, self.type],))
Esempio n. 8
0
 def eof(self):
     self.calvinsys.io.file.close(self.file)
     self.file = None
     return ActionResult(production=(EOSToken(), self.status_OK))
Esempio n. 9
0
 def flush(self, input):
     return ActionResult(production=(input, ))
Esempio n. 10
0
 def file_not_found(self):
     self.file_not_found = False  # Only report once
     return ActionResult(production=(EOSToken(), self.status_ERR))
Esempio n. 11
0
 def readline(self):
     line = self.file.read_line()
     return ActionResult(production=(line, ))
Esempio n. 12
0
 def exception_handler(self, action, args, context):
     return ActionResult(production=(ExceptionToken(), ))
Esempio n. 13
0
 def sum(self, input):
     self.sum = self.sum + input
     return ActionResult(tokens_consumed=1,
                         tokens_produced=1,
                         production=(self.sum, ))
Esempio n. 14
0
 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), ))
Esempio n. 16
0
 def clear(self):
     self.timer.ack()
     return ActionResult()
Esempio n. 17
0
    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=())
Esempio n. 18
0
 def render_image(self, image):
     if not image is None:
         self.image.show_image(image, self.width, self.height)
     return ActionResult(production=())
Esempio n. 19
0
 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'],))
Esempio n. 20
0
 def exception_handler(self, action, args, context):
     return ActionResult(production=(self.default, ))
Esempio n. 21
0
 def empty(self, trigger):
     return ActionResult()
Esempio n. 22
0
 def load(self, string):
     try:
         res = self['json'].loads(string)
     except:
         res = self.default
     return ActionResult(production=(res, ))
Esempio n. 23
0
 def verbose_action(self, input):
     return ActionResult(tokens_consumed=1,
                         tokens_produced=1,
                         production=("(" + str(input) + ")", ))
Esempio n. 24
0
 def start_timer(self):
     self.start()
     result = self.rand_generator(self.low, self.high)
     return ActionResult(production=([result, self.type],))
Esempio n. 25
0
 def passthrough(self, token):
     self.timer.ack()
     return ActionResult(production=(token, ))
Esempio n. 26
0
 def action(self, sample, tok):
     if sample is True:
         self.held = copy(tok)
     return ActionResult(production=(self.held, ))
Esempio n. 27
0
 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))
Esempio n. 28
0
 def post_update(self, status):
     self['twitter'].post_update(status)
     return ActionResult()
Esempio n. 29
0
 def handle_empty_body(self):
     self.reset_request()
     return ActionResult()
Esempio n. 30
0
 def incoming(self, token):
     self.token = token
     return ActionResult()