コード例 #1
0
ファイル: timeslot.py プロジェクト: ZigmundRat/moat
	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()
コード例 #2
0
ファイル: fs20en.py プロジェクト: ZigmundRat/moat
    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)
コード例 #3
0
ファイル: fs20en.py プロジェクト: M-o-a-T/moat
	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)