def _resourcesAsPython(self, resources): """ mapping of the local names for uris in the code to high-level objects (Submaster, Curve) """ out = {} subs = prof.logTime(Submaster.get_global_submasters)(self.graph) for localVar, uri in resources.items(): for rdfClass in self.graph.objects(uri, RDF.type): if rdfClass == L9['Curve']: cr = CurveResource(self.graph, uri) # this is slow- pool these curves somewhere, maybe just with curveset prof.logTime(cr.loadCurve)() out[localVar] = cr.curve break elif rdfClass == L9['Submaster']: out[localVar] = subs.get_sub_by_uri(uri) break else: out[localVar] = CouldNotConvert(uri) break else: out[localVar] = CouldNotConvert(uri) return out
def prepare(self): log.info("prepare effect %s", self.uri) # maybe there can be multiple lines of code as multiple # objects here, and we sort them by dependencies codeStrs = list(self.graph.objects(self.uri, L9['code'])) if not codeStrs: raise ValueError("effect %s has no code" % self.uri) self.codes = [CodeLine(self.graph, s) for s in codeStrs] self.sortCodes() #reload(Effects) self.otherFuncs = prof.logTime(Effects.configExprGlobals)()