Beispiel #1
0
  def checkPipeline(self, toolsPath, pipelinesPath, definedPath, pipeline):

    # First check to see if the pipeline is available in the user defined configuration files path (if defined).
    if pipeline in self.userConfigurationFiles: return definedPath + '/' + pipeline + '.json'

    # If the requested pipeline is valid, return the path to the configuration file.
    elif pipeline in self.pipelines: return pipelinesPath + '/' + pipeline + '.json'

    # If the requested pipeline is invalid, terminate.
    else:
      rankedPipelines = stringOperations.rankListByString(self.pipelines, pipeline)
      self.errors.invalidPipelineName(rankedPipelines, pipeline)
Beispiel #2
0
  def specificHelpCategory(self, providedCategory, path):
    self.writeSimpleLine('==========================', isIndent = False, noLeadingTabs = 0)
    self.writeSimpleLine('gkno help categories', isIndent = True, noLeadingTabs = 0)
    self.writeSimpleLine('==========================', isIndent = False, noLeadingTabs = 0)
    print(file = sys.stdout)

    # Check that the requested category is valid. If not, find the closest category to that written.
    category = providedCategory
    if providedCategory not in self.helpCategories:
      rankedList = so.rankListByString(self.helpCategories, category)
      category   = rankedList[0]

    # Open all the pipeline and determine the categories they fall into.
    categories, descriptions = self.findPipelinesInCategories(path)

    self.writeSimpleLine('Following is a list of pipelines in the category \'' + category + '\':', isIndent = False, noLeadingTabs = 0)
    print(file = sys.stdout)

    # If there are no pipelines in the category, write this out.
    try: pipelines = categories[category]
    except:
      self.writeSimpleLine('The requested category (' + category + ') does not contain any pipelines.', isIndent = True, noLeadingTabs = 0)
      print(file = sys.stdout)

    # Write out the pipelines that fall into the category.
    else:

      # Get all the pipelines and their descriptions.
      length = len(max(pipelines, key = len)) + 3
      for pipeline in sorted(pipelines):
        self.writeComplexLine([pipeline + ':', descriptions[pipeline]], [length, 0], noLeadingTabs = 1)
      print(file = sys.stdout)

    # If the entered category did not exactly match one of the supplied categories, provide
    # a warning that the provided list was based on the assumed most likely category.
    if providedCategory not in self.helpCategories: self.invalidCategory(providedCategory, category)