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

Source Code for Module SmootLight.behaviors.Timeout

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