def run(self,ctx,**k): event = self.params(ctx) if not len(event): raise SyntaxError(u'Usage: timeslot ‹name…›') m = Timeslot(self, SName(event)) if "interval" not in self.values: raise SyntaxError(u'Usage: timeslot ‹name…›: need to specify an interval') for p,v in self.values.items(): setattr(m,p,v) if not self.stopped: return m.up()
def __init__(self, name, group, code, ctx, faktor={}, slot=None, delta=None): self.ctx = ctx self.group = group self.code = code self.faktor = faktor self.last = None # timestamp self.delta = delta self.last_data = None # data values try: g = encodes[group] except KeyError: encodes[group] = g = {} try: c = g[code] except KeyError: g[code] = c = [] c.append(self) self._slot = slot if slot is not None: ts = Timeslot(self, name) p = en_procs[self.group] ts.interval = (p.interval + code * p.interval_mod, ) ts.duration = slot ts.maybe_up() super(en, self).__init__(*name)
def __init__(self,name,group,code,ctx, faktor={}, slot=None, delta=None): self.ctx = ctx self.group = group self.code = code self.faktor = faktor self.last = None # timestamp self.delta = delta self.last_data = None # data values try: g = encodes[group] except KeyError: encodes[group] = g = {} try: c = g[code] except KeyError: g[code] = c = [] c.append(self) self._slot = slot if slot is not None: ts = Timeslot(self,name) p = en_procs[self.group] ts.interval = (p.interval + code * p.interval_mod,) ts.duration = slot ts.maybe_up() super(en,self).__init__(*name)