passed an iterable list of file_paths, loop through all of them and
    generate a dictionary containing all the context
355921
def retrieve_data(file_paths):

    
    data_dict = {}
    for file_path in file_paths:
        with open(file_path) as fh:
            try:
                content = yaml.load(fh.read())
            except yaml.YAMLError as e:
                raise MiuraException(
                    "Unable to parse yaml at {0}: \n {1}".format(
                        file_path,
                        str(e)
                    ))
            if not isinstance(content, dict):
                raise MiuraException(
                    "{0} is does not translate to a dictionary!".format(file_path)
                )
            data_dict.update(content)
    return data_dict
1127455
function list(context, err, items, paths) {
    if (err) return fail(context, err);
    
    var long = context.options["l"];
    
    if (typeof long === "undefined") long = (context.command.slice(-3) === "dir");
    
    items.forEach(function (item) {
        if (item.filename == "." || item.filename == "..") return;
        
        if (paths) {
            shell.write(item.path);
        } else if (long) {
            shell.write(item.longname);
        } else {
            shell.write(item.filename);
        }
    });
    
    context.end();
}
391928
function _getContextsFromPath(path) {
  const allContexts = {
    add: [],
    remove: [],
  }
  _each(_pathContexts, pathContext => {
    let contextAdded = false
    const contexts = pathContext.contexts
    const regexes = pathContext.regexes
    const paths = pathContext.paths

    _each(regexes, regex => {
      regex.lastIndex = 0
      const matches = regex.exec(path)
      if (matches && matches.length > 0) {
        const contextsToAdd = []
        _each(contexts, context => {
          const replacedContext = context.replace(
            _contextRegex,
            (match, group) => {
              return matches[group]
            },
          )
          contextsToAdd.push(replacedContext)
        })
        allContexts.add = allContexts.add.concat(contextsToAdd)
        contextAdded = true
      }
      return !contextAdded
    })

    if (!contextAdded) {
      _each(paths, pathToTry => {
        if (path === pathToTry) {
          allContexts.add = allContexts.add.concat(contexts)
          contextAdded = true
        }
        return !contextAdded
      })
      if (!contextAdded) {
        allContexts.remove = allContexts.remove.concat(contexts)
      }
    }
  })
  return allContexts
}
484854
def get_file_list(self, lstPaths, lstXtn, lstExcluded, VERBOSE = False):
        
        if VERBOSE:
            print("Generating list of Files...")
            print("Paths = ", lstPaths)
            print("Xtns  = ", lstXtn)
            print("exclude = ", lstExcluded)
        numFiles = 0
        self.filelist = []
        self.fl_metadata = []
        for rootPath in lstPaths:
            if VERBOSE:
                print(rootPath)
            for root, dirs, files in os.walk(rootPath):
                if VERBOSE:
                    print(dirs)
                for basename in files:
                    for xtn in lstXtn:
                        if fnmatch.fnmatch(basename, xtn):
                            filename = os.path.join(root, basename)
                            includeThisFile = "Y"
                            if len(lstExcluded) > 0:
                                for exclude in lstExcluded:
                                    if filename.find(exclude) != -1:
                                        includeThisFile = "N"
                            if includeThisFile == "Y":
                                numFiles = numFiles + 1
                                self.filelist.append(filename)
                                self.add_file_metadata(filename)    # not sure why there is a 2nd list, but there is.

        if VERBOSE:
            print("Found ", numFiles, " files")
        return self.filelist
1210781
def to_path_globs(self, relpath, conjunction):
    """"""
    return PathGlobs(
      include=tuple(os.path.join(relpath, glob) for glob in self._file_globs),
      exclude=tuple(os.path.join(relpath, exclude) for exclude in self._excluded_file_globs),
      conjunction=conjunction)
474166
def pathNames(self) -> [str]:
        

        return [f.pathName for f in list(self._files.values())]
1084116
def file_tree(start_path):
    
    nested_dirs = {}
    root_dir = start_path.rstrip(os.sep)
    start = root_dir.rfind(os.sep) + 1
    for path, dirs, files in os.walk(root_dir):
        folders = path[start:].split(os.sep)
        subdir = dict.fromkeys(files)
        parent = reduce(dict.get, folders[:-1], nested_dirs)
        parent[folders[-1]] = subdir
    return nested_dirs
820593
def files(
            self):
        
        relatedFilesResultsList = []
        relatedFilesResultsList[:] = [dict(l)
                                      for l in self.relatedFilesResultsList]
        return relatedFilesResultsList
550031
def gen_template_files(path):
    "  "

    path = path.rstrip(op.sep)
    for root, _, files in walk(path):
        for f in filter(lambda x: not x in (TPLNAME, CFGNAME), files):
            yield op.relpath(op.join(root, f), path)
517977
def _GetFilePaths(self, path, pathtype, kb):
    """"""

    environ_vars = artifact_utils.GetWindowsEnvironmentVariablesMap(kb)
    path_guesses = path_detection_windows.DetectExecutablePaths([path],
                                                                environ_vars)

    if not path_guesses:
      # TODO(user): yield a ParserAnomaly object
      return []

    return [
        rdf_paths.PathSpec(path=path, pathtype=pathtype)
        for path in path_guesses
    ]
787304
def gen_files(path, prefix="_"):
    "  "

    if op.isdir(path):
        for name in listdir(path):
            fpath = op.join(path, name)
            if is_parsed_file(fpath):
                yield op.abspath(fpath)

    elif is_parsed_file(path):
        yield op.abspath(path)
143668
def GetAllFiles(self):
    
    for filepath in self._files:
      yield filepath

    for dirpath in self._dirs:
      for filepath in ArtifactRegistrySources._GetDirYamlFiles(dirpath):
        if filepath in self._files:
          continue
        yield filepath
1253991
def CopyToDict(self):
    
    path_spec_dict = {}
    for attribute_name, attribute_value in iter(self.__dict__.items()):
      if attribute_value is None:
        continue

      if attribute_name == 'parent':
        attribute_value = attribute_value.CopyToDict()

      path_spec_dict[attribute_name] = attribute_value

    return path_spec_dict
1150838
def iterate_presentation_files(path=None, excludes=None, includes=None):
    """"""

    # Defaults
    if includes is None:
        includes = []
    if excludes is None:
        excludes = []

    # Transform glob patterns to regular expressions
    includes_pattern = r'|'.join([fnmatch.translate(x) for x in includes]) or r'$.'
    excludes_pattern = r'|'.join([fnmatch.translate(x) for x in excludes]) or r'$.'
    includes_re = re.compile(includes_pattern)
    excludes_re = re.compile(excludes_pattern)

    def included(root, name):
        """Returns True if the specified file is a presentation file."""
        full_path = os.path.join(root, name)
        # Explicitly included files takes priority
        if includes_re.match(full_path):
            return True
        # Ignore special and excluded files
        return (not specials_re.match(name)
            and not excludes_re.match(full_path))

    # Get a filtered list of paths to be built
    for root, dirs, files in os.walk(path):
        dirs[:] = [d for d in dirs if included(root, d)]
        files = [f for f in files if included(root, f)]
        for f in files:
            yield os.path.relpath(os.path.join(root, f), path)
886170
def find_all_files(glob):
    
    for finder in finders.get_finders():
        for path, storage in finder.list([]):
            if fnmatch.fnmatchcase(os.path.join(getattr(storage, 'prefix', '')
                                                or '', path),
                                   glob):
                yield path, storage
312378
def parse_and_load_contexts(contexts, schema=None, werr=False):
    
    ctx = dict()
    diff = None

    if contexts:
        for ctx_path, ctx_type in concat(parse_filespec(c) for c in contexts):
            try:
                diff = load_context(ctx_path, ctx_type, scm=schema)
                if diff is not None:
                    merge(ctx, diff)
            except (IOError, OSError, AttributeError):
                if werr:
                    raise
    return ctx
1260645
def iterate_flattened(d):
    
    for key in sorted(d.keys()):
        value = d[key]
        if isinstance(value, dict) and value:
            for k, v in iterate_flattened(d[key]):
                yield join_paths(key, k), v
        else:
            yield key, value