if a user only wants to process one or more specific files, instead of a full sosreport
160175
def _clean_files_only(self, files):
        '''  '''
        try:
            if not (os.path.exists(self.origin_path)):
                self.logger.info("Creating Origin Path - %s" % self.origin_path)
                os.makedirs(self.origin_path) # create the origin_path directory
            if not (os.path.exists(self.dir_path)):
                self.logger.info("Creating Directory Path - %s" % self.dir_path)
                os.makedirs(self.dir_path)    # create the dir_path directory
            self._add_extra_files(files)

        except OSError as e: # pragma: no cover
            if e.errno == errno.EEXIST:
                pass
            else:   # pragma: no cover
                self.logger.exception(e)
                raise e

        except Exception as e:    # pragma: no cover
            self.logger.exception(e)
            raise Exception("CleanFilesOnlyError: unable to process")
20391
def _receive(self, root, directory, dirs, files, include, exclude):
        """"""

        self._received += 1

        if not self.symlinks:
            where = root + os.path.sep + directory + os.path.sep
            files = [
                file_name for file_name in files
                if not os.path.islink(where + file_name)
            ]

        include = FileSetState("Include", directory, include, None
                               if include else self.include)
        exclude = FileSetState("Exclude", directory, exclude, None
                               if exclude else self.exclude)

        if exclude.matches_all_files_all_subdirs():
            # Exclude everything and do no traverse any subdirectories
            del dirs[0:]
            matched = set()
        else:
            if include.no_possible_matches_in_subdirs():
                # Do no traverse any subdirectories
                del dirs[0:]
            matched = include.match(set(files))
            matched -= exclude.match(matched)

        return matched, include, exclude
1118912
function filter_and_recursion_processing(file) {
    const filePath = path.join(...basePath, ...directoryPath, file);

    if (path.extname(file) === extension) {
      // partial file is found, passing through filter, process it later
      return file;
    } else if (fs.statSync(filePath).isDirectory()) {
      // directory found, do recursion and get processed partials back
      partials = partials.concat(
        getPartials({
          basePath,
          directoryPath: [...directoryPath, file],
          extension,
          encoding,
          getNameFunc
        })
      );
    }

    return false;
  }
1196629
def check_files(self, paths=None):
        """"""
        if paths is None:
            paths = self.paths
        report = self.options.report
        runner = self.runner
        report.start()
        try:
            for path in paths:
                if os.path.isdir(path):
                    self.input_dir(path)
                elif not self.excluded(path):
                    runner(path)
        except KeyboardInterrupt:
            print('... stopped')
        report.stop()
        return report
289725
function listFiles(root, options) {
    options = _.defaults(options || {}, {
        ignoreFiles: [],
        ignoreRules: []
    });

    var d = Q.defer();

    // Our list of files
    var files = [];

    var ig = Ignore({
        path: root,
        ignoreFiles: options.ignoreFiles
    });

    // Add extra rules to ignore common folders
    ig.addIgnoreRules(options.ignoreRules, '__custom_stuff');

    // Push each file to our list
    ig.on('child', function (c) {
        files.push(
            c.path.substr(c.root.path.length + 1) + (c.props.Directory === true ? '/' : '')
        );
    });

    ig.on('end', function() {
        // Normalize paths on Windows
        if(process.platform === 'win32') {
            return d.resolve(files.map(function(file) {
                return file.replace(/\\/g, '/');
            }));
        }

        // Simply return paths otherwise
        return d.resolve(files);
    });

    ig.on('error', d.reject);

    return d.promise;
}
446813
def Filter(self):
    """"""
    if not self.desc:
      self.short_desc = ''
      return

    for i in range(len(self.desc)):   # replace full path with name
      if self.desc[i].find(self.executable) >= 0:
        self.desc[i] = self.desc[i].replace(self.executable, self.name)

    self.short_desc = self.desc[0]
    word_list = self.short_desc.split(' ')
    all_names = [ self.name, self.short_name, ]
    # Since the short_desc is always listed right after the name,
    #  trim it from the short_desc
    while word_list and (word_list[0] in all_names
                         or word_list[0].lower() in all_names):
      del word_list[0]
      self.short_desc = ''              # signal need to reconstruct
    if not self.short_desc and word_list:
      self.short_desc = ' '.join(word_list)
1238025
function (files, latestMigrationFile) {
        if (direction === 'do') {
            return files
                .sort()
                .filter(function () {
                var _mustBeApplied = (latestMigrationFile === null);
                return function (name) {
                    if (latestMigrationFile === name) {
                        _mustBeApplied = !_mustBeApplied;
                        return false;
                    }
                    return _mustBeApplied;
                };
            }()
            );
        } else {
            return files.sort().reverse().filter(function (name) {
                return latestMigrationFile === name;
            });
        }
    }
211035
function filterRepresented(modules, files, options) {
    return _.filter(modules, function(module) {
      return !_.some(files, function(file) {
        // Look for the module name somewhere in the source path
        return (
          path
            .join(sep, options.srcPrefix, file.src.replace(rmain, '$1'), sep)
            .indexOf(sep + module + sep) > -1
        )
      })
    })
  }
77345
def exclude_file_options(parser)
      parser.on("-e", "--exclude file1,...", Array,
                "List of file names to exclude") do |files_list|
        options[:excluded_files] = []
        files_list.each do |short_file|
          options[:excluded_files] << File.expand_path(short_file)
        end
      end
    end
142660
private void processFileSet(FileSet fileSet, RuleSet ruleSet, ExecutorService pool) {
        DirectoryScanner dirScanner = fileSet.getDirectoryScanner(project);
        File baseDir = fileSet.getDir(project);
        String[] includedFiles = dirScanner.getIncludedFiles();

        if (includedFiles == null || includedFiles.length == 0) {
            LOG.info("No matching files found for FileSet with basedir [" + baseDir + "]");
            return;
        }

        for (String filePath : includedFiles) {
            Runnable task = buildTask(baseDir, filePath, ruleSet);
            pool.submit(task);
        }
    }
364865
function isFileProcessable(filepath) {
    if (options.fileFilterRegex.length === 0) {
      return true;
    }

    return options.fileFilterRegex.some((regex) => filepath.match(regex) !== null);
  }
1357072
def _CheckParserCanProcessFileEntry(self, parser, file_entry):
    
    for filter_object in parser.FILTERS:
      if filter_object.Match(file_entry):
        return True

    return False
1334824
def _handle_files(self, data):
        """"""

        initial = data.get("set", False)
        files = data["files"]
        for f in files:
            try:
                fobj = File(
                    self.room,
                    self.conn,
                    f[0],
                    f[1],
                    type=f[2],
                    size=f[3],
                    expire_time=int(f[4]) / 1000,
                    uploader=f[6].get("nick") or f[6].get("user"),
                )
                self.room.filedict = fobj.fid, fobj
                if not initial:
                    self.conn.enqueue_data("file", fobj)
            except Exception:
                import pprint

                LOGGER.exception("bad file")
                pprint.pprint(f)
        if initial:
            self.conn.enqueue_data("initial_files", self.room.files)
429817
def clean(ctx, dry_run=False):
    """"""
    # -- VARIATION-POINT 1: Allow user to override in configuration-file
    directories = ctx.clean.directories
    files = ctx.clean.files

    # -- VARIATION-POINT 2: Allow user to add more files/dirs to be removed.
    extra_directories = ctx.clean.extra_directories or []
    extra_files = ctx.clean.extra_files or []
    if extra_directories:
        directories.extend(extra_directories)
    if extra_files:
        files.extend(extra_files)

    # -- PERFORM CLEANUP:
    execute_cleanup_tasks(ctx, cleanup_tasks, dry_run=dry_run)
    cleanup_dirs(directories, dry_run=dry_run)
    cleanup_files(files, dry_run=dry_run)
1022490
def process_file(self, path, dryrun):
        
        # if dryrun just return file path
        if dryrun:
            return path

        # remove and return file
        if self.__force or raw_input("Remove file '%s'? [y/N]" % path).lower() == "y":
            os.remove(path)
            return path
286736
function(files, next) {
        var fromFile = files[0],
          toFile = files[1];

        differ(id, fromFile, toFile, next);
      }
15516
def filter_exclusions file_paths
      file_paths.reject do |path|
        exclude_file_patterns.any? { |pattern| File.fnmatch("#{pattern}", path) || File.fnmatch("**/#{pattern}", path) }
      end
    end