def _url(self): graph = getGraph() net = graph.value(showUri(), L9['networking']) ret = graph.value(net, self.service) if ret is None: raise ValueError("no url for %s %s" % (showUri(), L9['networking'])) return str(ret)
def configExprGlobals(): graph = showconfig.getGraph() ret = {} for chaseUri in graph.subjects(RDF.type, L9['Chase']): shortName = chaseUri.rsplit('/')[-1] chans = graph.value(chaseUri, L9['channels']) ret[shortName] = list(graph.items(chans)) print "%r is a chase" % shortName ret['chase'] = chase ret['stack'] = stack return ret
def configExprGlobals(): graph = showconfig.getGraph() ret = {} for chaseUri in graph.subjects(RDF.type, L9['Chase']): shortName = chaseUri.rsplit('/')[-1] chans = graph.value(chaseUri, L9['channels']) ret[shortName] = list(graph.items(chans)) print "%r is a chase" % shortName for f in registered: ret[f.__name__] = f ret['nsin'] = lambda x: (math.sin(x * (2 * math.pi)) + 1) / 2 ret['ncos'] = lambda x: (math.cos(x * (2 * math.pi)) + 1) / 2 def nsquare(t, on=.5): return (t % 1.0) < on ret['nsquare'] = nsquare _smooth_random_items = [random_mod.random() for x in range(100)] # suffix '2' to keep backcompat with the versions that magically knew time def smooth_random2(t, speed=1): """1 = new stuff each second, <1 is slower, fade-ier""" x = (t * speed) % len(_smooth_random_items) x1 = int(x) x2 = (int(x) + 1) % len(_smooth_random_items) y1 = _smooth_random_items[x1] y2 = _smooth_random_items[x2] return y1 + (y2 - y1) * ((x - x1)) def notch_random2(t, speed=1): """1 = new stuff each second, <1 is slower, notch-ier""" x = (t * speed) % len(_smooth_random_items) x1 = int(x) y1 = _smooth_random_items[x1] return y1 ret['noise2'] = smooth_random2 ret['notch2'] = notch_random2 return ret
def _url(self): graph = getGraph() net = graph.value(showUri(), L9['networking']) return str(graph.value(net, self.service))