* +files+ An Array of file paths
 Returns an Array of SH1 digests for each of the given files
180634
def digest_sha1(*files)
      files.flatten.collect { |file| 
        File.exists?(file) ? Digest::SHA1.hexdigest(File.read(file)) : nil
      }
    end
1068865
def each_file(&bl)
      unpack do |dir|
        Pathname.new(dir).find do |path|
          next if path.to_s == dir.to_s
          pathstr = path.to_s.gsub("#{dir}/", '')
          bl.call pathstr unless pathstr.blank?
        end
      end
    end
912132
private Path[] getMapFiles(FileSystem fs, boolean isLocal)
  throws IOException {
    List<Path> fileList = new ArrayList<Path>();
    if (isLocal) {
      // for local jobs
      for(int i = 0; i < numMaps; ++i) {
        fileList.add(mapOutputFile.getInputFile(i, getTaskID()));
      }
    } else {
      // for non local jobs
      for (FileStatus filestatus : mapOutputFilesOnDisk) {
        fileList.add(filestatus.getPath());
      }
    }
    return fileList.toArray(new Path[0]);
  }
393039
def get_hash_of_files(root_path, directories=None):
    """"""
    if not directories:
        directories = [{'path': './'}]

    files_to_hash = []
    for i in directories:
        ignorer = get_ignorer(os.path.join(root_path, i['path']),
                              i.get('exclusions'))

        with change_dir(root_path):
            for root, dirs, files in os.walk(i['path'], topdown=True):
                if (root != './') and ignorer.is_ignored(root, True):
                    dirs[:] = []
                    files[:] = []
                else:
                    for filename in files:
                        filepath = os.path.join(root, filename)
                        if not ignorer.is_ignored(filepath):
                            files_to_hash.append(
                                filepath[2:] if filepath.startswith('./') else filepath  # noqa
                            )

    return calculate_hash_of_files(files_to_hash, root_path)
717201
function recurseSrcDirectories (grunt, fileData, options) {
    let promises = [];

    // Ignore everything except directories and Javascript files.
    // Store function in array for recursive-readdir module.
    let ignoreCallback = [(file, stats) => !(stats.isDirectory() || path.extname(file) === '.js')];

    for (let i = 0, max = fileData.src.length; i < max; i++) {
        promises.push(readDir(fileData.src[i], ignoreCallback).then((value) => value, (err) => err));
    }

    Promise.all(promises)
        .then((values) => {
            streamMatches(grunt, fileData, options, values, values.flat());
        }, throwAsyncError);
}
886536
def hashify_files(files: list) -> dict:
    """"""
    return {filepath.replace('\\', '/'): hash_tree(filepath)
            for filepath in listify(files)}
1195841
function flatten(files) {
        var ret = [];
        for (var i=0; i < files.length; i++) {
            ret.push(files[i].dst);
        }
        return ret;
    }
865916
def paths(arrs)
      arrs.inject([[]]) do |paths, arr|
        arr.map {|e| paths.map {|path| path + [e]}}.flatten(1)
      end
    end
1046061
function (targetFilePath) {
    var splitPaths = targetFilePath.split('/');
    var targetFilename = splitPaths.pop();
    var targetPath = splitPaths.join('/');
    targetPath = targetPath + '/';
    return [targetPath, targetFilename];
  }
1288326
def parse_files(files, options = {}, &block) # :yields: request
      files.each { |file| parse_file(file, options, &block) }
    end
473528
function globs(sourcePath, ignore, commands, done) {
  var expression = /\$g\[(.+?)\]/g;
  var result = [];
  each(commands, function(command, next) {
    var map = {};
    var match;
    var matches = [];
    while ((match = expression.exec(command))) matches.push(match);
    each(matches, function(patternMatch, next) {
      find(patternMatch[1], sourcePath, ignore, function(err, relativePaths) {
        if (err) return next(err);
        map[patternMatch[1]] = relativePaths;
        next();
      });
    }, function(err) {
      if (err) return next(err);
      result.push(command.replace(expression, function(match, matchKey) {
        return map[matchKey].join(' ');
      }));
      next();
    });
  }, function(err) {
    if (err) return done(err);
    done(undefined, result);
  });
}
9011
function (data) {
                if (data.result && $.isArray(data.result.files)) {
                    return data.result.files;
                }
                return [];
            }
471825
def iterfiles(self, pattern=None, abspath=False):
        
        if pattern is not None:
            globster = Globster([pattern])
        for root, dirs, files in self.walk():
            for f in files:
                if pattern is None or (pattern is not None and globster.match(f)):
                    if abspath:
                        yield os.path.join(root, f)
                    else:
                        yield self.relpath(os.path.join(root, f))
329168
def _fetchFilesFromFolder(self, target, recursive):
        '''
            
        '''
        directory_items = os.walk(target)

        # If recursive is false, fetch only the first tuple
        if not recursive:
            directory_items = [next(directory_items)]

        targets = []
        for dir_name, folders, files in directory_items:
            for f in files:
                targets.append(os.path.join(dir_name, f))

        return targets
591706
function files(path, ...matchers) {
	if ( matchers.length ) {
		return listFiles(path.replace(/\\/g, '/'), matchers);
	}

	let rs = [];
	if( isDirectoryExists(path) ) {
		let ls = fs.readdirSync(path);
		ls.forEach((file, index) => rs.push(path + "/" + file));
	}
	return rs;
}
689546
def list_files(dirname='.', digest=True):
    
    skipdirs = ['__pycache__', '.git', '.svn', 'htmlcov', 'dist', 'build',
                '.idea', 'tasks', 'static', 'media', 'data', 'migrations',
                '.doctrees', '_static', 'node_modules', 'external',
                'jobs', 'tryout', 'tmp', '_coverage',
               ]
    skipexts = ['.pyc', '~', '.svg', '.txt', '.TTF', '.tmp', '.errmail',
                '.email', '.bat', '.dll', '.exe', '.Dll', '.jpg', '.gif',
                '.png', '.ico', '.db', '.md5']
    dirname = str(dirname)
    skipfiles = read_skipfile(dirname)

    def clean_dirs(directories):
        """Remove directories that should be skipped.
        """
        for d in directories:
            if d.endswith('.egg-info'):
                directories.remove(d)
        for d in skipdirs:
            if d in directories:
                directories.remove(d)

    def keep_file(filename, filepath):
        """Returns False if the file should be skipped.
        """
        if filename.startswith('.'):
            return False
        if filepath in skipfiles:
            return False
        for ext in skipexts:
            if filename.endswith(ext):
                return False
        return True

    for root, dirs, files in os.walk(os.path.abspath(dirname)):
        clean_dirs(dirs)
        for fname in files:
            relpth = os.path.relpath(
                os.path.join(root, fname),
                dirname
            ).replace('\\', '/')

            parts = Path(relpth).parts()
            if not keep_file(fname, relpth) or \
                    any(p.startswith('.') for p in parts):
                continue

            pth = os.path.join(dirname, relpth)
            if digest:
                yield md5(open(pth, 'rb').read()).hexdigest(), relpth
            else:
                yield relpth
364737
def digest(dirname, glob=None):
    
    md5 = hashlib.md5()
    if glob is None:
        fnames = [fname for _, fname in list_files(Path(dirname))]
        for fname in sorted(fnames):
            fname = os.path.join(dirname, fname)
            md5.update(open(fname, 'rb').read())
    else:
        fnames = Path(dirname).glob(glob)
        for fname in sorted(fnames):
            md5.update(fname.open('rb').read())
    return md5.hexdigest()