Package SmootLight :: Package behaviors :: Module TimedDie
[hide private]
[frames] | no frames]

Source Code for Module SmootLight.behaviors.TimedDie

 1  from operationscore.Behavior import * 
2 -class Timeout(Behavior):
3 """Timeout is a behavior designed to be used in recursive hooks to stop responses after a certain 4 amount of time. It is the Time-version of RecursiveDecay. Specify: 5 <TimeOut> -- the time in ms that the response will run. 6 """ 7
8 - def processResponse(self, sensorInputs, recur):
9 ret = [] 10 for data in sensorInputs: 11 if not 'StartTime' in data: 12 data['StartTime'] = timeops.time() 13 if timeops.time()-data['StartTime'] < self['Timeout']: 14 ret.append(data) 15 return (ret, [])
16