nodes: 0, module; 1, function_definition; 2, function_name:expand_filename_pattern; 3, parameters; 4, block; 5, identifier:self; 6, identifier:pattern; 7, identifier:base_dir; 8, default_parameter; 9, expression_statement; 10, comment:# replace vars like ${benchmark_path},; 11, comment:# with converting to list and back, we can use the function 'substitute_vars()'; 12, expression_statement; 13, assert_statement; 14, expression_statement; 15, if_statement; 16, expression_statement; 17, comment:# sort alphabetical,; 18, expression_statement; 19, if_statement; 20, return_statement; 21, identifier:sourcefile; 22, None; 23, comment:"""
          The function expand_filename_pattern expands a filename pattern to a sorted list
          of filenames. The pattern can contain variables and wildcards.
          If base_dir is given and pattern is not absolute, base_dir and pattern are joined.
          """; 24, assignment; 25, comparison_operator:len(expandedPattern) == 1; 26, assignment; 27, comparison_operator:expandedPattern != pattern; 28, block; 29, assignment; 30, call; 31, not_operator; 32, block; 33, identifier:fileList; 34, identifier:expandedPattern; 35, call; 36, call; 37, integer:1; 38, identifier:expandedPattern; 39, subscript; 40, identifier:expandedPattern; 41, identifier:pattern; 42, expression_statement; 43, identifier:fileList; 44, call; 45, attribute; 46, argument_list; 47, identifier:fileList; 48, expression_statement; 49, identifier:substitute_vars; 50, argument_list; 51, identifier:len; 52, argument_list; 53, identifier:expandedPattern; 54, integer:0; 55, call; 56, attribute; 57, argument_list; 58, identifier:fileList; 59, identifier:sort; 60, call; 61, list; 62, identifier:self; 63, identifier:sourcefile; 64, identifier:expandedPattern; 65, attribute; 66, argument_list; 67, identifier:util; 68, identifier:expand_filename_pattern; 69, identifier:expandedPattern; 70, identifier:base_dir; 71, attribute; 72, argument_list; 73, identifier:pattern; 74, identifier:logging; 75, identifier:debug; 76, string:"Expanded variables in expression %r to %r."; 77, identifier:pattern; 78, identifier:expandedPattern; 79, identifier:logging; 80, identifier:warning; 81, string:"No files found matching %r."; 82, identifier:pattern
code: def expand_filename_pattern(self, pattern, base_dir, sourcefile=None):
          """
          The function expand_filename_pattern expands a filename pattern to a sorted list
          of filenames. The pattern can contain variables and wildcards.
          If base_dir is given and pattern is not absolute, base_dir and pattern are joined.
          """
  
          # replace vars like ${benchmark_path},
          # with converting to list and back, we can use the function 'substitute_vars()'
          expandedPattern = substitute_vars([pattern], self, sourcefile)
          assert len(expandedPattern) == 1
          expandedPattern = expandedPattern[0]
  
          if expandedPattern != pattern:
              logging.debug("Expanded variables in expression %r to %r.",
                            pattern, expandedPattern)
  
          fileList = util.expand_filename_pattern(expandedPattern, base_dir)
  
          # sort alphabetical,
          fileList.sort()
  
          if not fileList:
              logging.warning("No files found matching %r.", pattern)
  
          return fileList