def _createCompleteFunction(cls): def complete_function(self, text, line, begidx, endidx): key = extractFullArgument(line, endidx) return autoCompleteListWithSeparator(key, self.fetchSupportedKeys()) complete_function = assertConfigLoaded(complete_function) return complete_function
def __createCompleteFunction(cls): def complete_function(self, text, line, begidx, endidx): key = extractFullArgument(line, endidx) return autoCompleteListWithSeparator(key, self.fetchSupportedKeys()) complete_function = assertConfigLoaded(complete_function) return complete_function
def __createDoFunction(cls, plot_function, name): def do_function(self, line): keys = matchItems(line, self.fetchSupportedKeys()) if len(keys) == 0: self.lastCommandFailed("Must have at least one %s key" % name) return False for key in keys: pdg = self.plotDataGatherer() plot_function(self.shellContext(), pdg, key) return assertConfigLoaded(do_function)
def _createDoFunction(cls, plot_function, name): def do_function(self, line): keys = matchItems(line, self.fetchSupportedKeys()) if len(keys) == 0: self.lastCommandFailed("Must have at least one %s key" % name) return False for key in keys: pdg = self.plotDataGatherer() plot_function(self.shellContext(), pdg, key) return assertConfigLoaded(do_function)
def _createDoPrintFunction(cls, name): def do_function(self, line): keys = matchItems(line, self.fetchSupportedKeys()) if len(keys) == 0: self.lastCommandFailed("Must have at least one %s key" % name) return False case_name = self.shellContext().ert().getEnkfFsManager().getCurrentFileSystem().getCaseName() for key in keys: pdg = self.plotDataGatherer() if pdg.canGatherDataForKey(key): data = pdg.gatherData(self.shellContext().ert(), case_name, key) print(data) else: self.lastCommandFailed("Unable to print data for key: %s" % key) return assertConfigLoaded(do_function)
def __createDoPrintFunction(cls, name): def do_function(self, line): keys = matchItems(line, self.fetchSupportedKeys()) if len(keys) == 0: self.lastCommandFailed("Must have at least one %s key" % name) return False case_name = self.shellContext().ert().getEnkfFsManager( ).getCurrentFileSystem().getCaseName() for key in keys: pdg = self.plotDataGatherer() if pdg.canGatherDataForKey(key): data = pdg.gatherData(self.shellContext().ert(), case_name, key) print(data) else: self.lastCommandFailed("Unable to print data for key: %s" % key) return assertConfigLoaded(do_function)