def __initialize(self): for path in self.__flow_path: if not os.path.exists(path): raise Exception("Flow path not found: {}".format(path)) files = None if os.path.isdir(path): files = [flow_file for flow_file in glob.iglob(os.path.join(path, "*.flow"))] elif os.path.isfile(path): files = [path] if files is None: continue for flow_file in files: try: reader = FlowReader(flow_file) name, library, version = reader.read_meta() if name is None: continue uri = self.compose_uri(name, library, version) self.__flow_files[uri] = (flow_file, name, library, version) except: continue
def load_from_file(self, path): reader = FlowReader(path) name, library, version = reader.read_meta() uri = self.compose_uri(name, library, version) if uri in self.__flow_cache: return self.__flow_cache[uri] flow = reader.read() self.__flow_cache[flow] = flow return flow
def load_from_file(self, path): reader = FlowReader(path) name, library, version = reader.read_meta() uri = self.compose_uri(name, library, version) #FIXME case.py modifies model objects so we cannot cache them #if uri in self.__flow_cache: # return self.__flow_cache[uri] flow = reader.read() self.__flow_cache[uri] = flow return flow