Create a {FileFinder}.

 @param config [SCSSLint::Config]
 Find all files that match given the specified options.

 @param patterns [Array<String>] a list of file paths and glob patterns
509632
def find(patterns)
      if patterns.empty?
        raise SCSSLint::Exceptions::NoFilesError,
              'No files, paths, or patterns were specified'
      end

      matched_files = extract_files_from(patterns)
      if matched_files.empty?
        raise SCSSLint::Exceptions::NoFilesError,
              "No SCSS files matched by the patterns: #{patterns.join(' ')}"
      end

      matched_files.reject { |file| @config.excluded_file?(file) }
    end
1367987
function globWithPromsie(pattern) {
  return new Promise((resolve, reject) => {
    glob(pattern, function(err, files) {
      if (err) {
        reject(err);
      }

      if (files.length === 0) {
        console.warn('pattern "' + pattern + '" does not match any file');
      }

      resolve(files);
    });
  });
}
1298578
def glob_wildcards(pattern: str, files: Optional[List[str]] = None
                  ) -> Dict[str, Union[List[Any], List[str]]]:
    
    pattern = os.path.normpath(pattern)
    if sys.platform == 'win32':
        # we perform path matching with / slash only
        pattern = pattern.replace('\\', '/')
    first_wildcard = re.search("{[^{]", pattern)
    dirname = os.path.dirname(pattern[:first_wildcard.start()]
                             ) if first_wildcard else os.path.dirname(pattern)
    if not dirname:
        dirname = "."

    names = [match.group('name') for match in SOS_WILDCARD.finditer(pattern)]
    res = {x: [] for x in names}
    pattern = re.compile(regex(pattern))

    if files is None:
        files = ((os.path.join(dirpath, f) if dirpath != "." else f)
                 for dirpath, dirnames, filenames in os.walk(dirname)
                 for f in chain(filenames, dirnames))

    for f in files:
        # we perform path matching with only / slash
        match = re.match(pattern, str(f).replace('\\', '/'))
        if match:
            for name, value in match.groupdict().items():
                res[name].append(value)
    return res
1241481
public Map<Path,List<LineMatches>> find(String search) throws IOException {
        count = 0;
        Pattern pattern = Pattern.compile(search);
        Map<Path,List<LineMatches>> fileMatches = new LinkedHashMap<>();
        Files.walkFileTree(root,
            EnumSet.of(FileVisitOption.FOLLOW_LINKS), Integer.MAX_VALUE, new SimpleFileVisitor<Path>() {
                public FileVisitResult visitFile(Path path, BasicFileAttributes attrs) throws IOException {
                    for (PathMatcher matcher : matchers) {
                        if (matcher.matches(path)) {
                            List<LineMatches> lineMatches = search(path, pattern);
                            if (lineMatches != null)
                                fileMatches.put(root.relativize(path), lineMatches);
                        }
                    }
                    return count == 0 || count < limit ? FileVisitResult.CONTINUE : FileVisitResult.TERMINATE;
                }
            }
        );

        return fileMatches;
    }
1139300
function load(method, config) {
  return function(patterns, options) {
    var opts = mergeOptions(this, config, options);
    var loader = createLoader(opts, this[method]);
    return loader.apply(this, arguments);
  };
}
58268
function (pattern, options) {
    options = options || {};
    this.pattern = new Pattern(pattern, options);
    this.recurse = this.shouldRecurse(this.pattern, options);

    // if middleware are registered, use the glob, otherwise regex
    var glob = this.fns.length
      ? this.pattern.glob
      : this.pattern.regex;

    this.defaults(glob, options);
    this.include(glob, options);
    return this;
  }
454664
public function findFiles(string $pattern, int $flags = 0): FileCollection
    {
        $files = glob($this->path.'/'.$pattern, $flags);
        foreach ($files as $index => $file) {
            if (is_file($file)) {
                $files[$index] = new File($file);
            } else {
                unset($files[$index]);
            }
        }

        return new FileCollection($files);
    }
260030
function createPatternVariations(pattern) {
    var lastCharIdx = pattern.length - 1,
        patternVariations = [pattern, '!' + pattern];

    if (pattern[lastCharIdx] === '/') {
        var unslashed = pattern.substring(0, lastCharIdx);

        patternVariations.push(unslashed);
        patternVariations.push('!' + unslashed);
    }

    return patternVariations;
}
1337712
function findConfigFiles (dir) {
  let result = []

  if (typeof dir !== 'string' || !fs.existsSync(dir)) {
    return result
  }

  const fileList = fs.readdirSync(dir)

  debug(`${dir} file list: %o`, fileList)

  result = linterConfigFile
    .filter(fileName => fileList.includes(fileName))
    .map(fileName => path.join(dir, fileName))

  debug('config file: %o', result)

  return result
}
364331
private String[] fillNonPatternSet(Set set, String[] patterns) {
        ArrayList al = new ArrayList(patterns.length);
        for (int i = 0; i < patterns.length; i++) {
            if (!SelectorUtils.hasWildcards(patterns[i])) {
                set.add(isCaseSensitive() ? patterns[i]
                    : patterns[i].toUpperCase());
            } else {
                al.add(patterns[i]);
            }
        }
        return set.size() == 0 ? patterns
            : (String[]) al.toArray(new String[al.size()]);
    }
635832
public Config find(String morphlineId, Config config, String nameForErrorMsg) {
    List<? extends Config> morphlineConfigs = config.getConfigList("morphlines");
    if (morphlineConfigs.size() == 0) {
      throw new MorphlineCompilationException(
          "Morphline file must contain at least one morphline: " + nameForErrorMsg, null);
    }
    if (morphlineId != null) {
      morphlineId = morphlineId.trim();
    }
    if (morphlineId != null && morphlineId.length() == 0) {
      morphlineId = null;
    }
    Config morphlineConfig = null;
    if (morphlineId == null) {
      morphlineConfig = morphlineConfigs.get(0);
      Preconditions.checkNotNull(morphlineConfig);
    } else {
      for (Config candidate : morphlineConfigs) {
        if (morphlineId.equals(new Configs().getString(candidate, "id", null))) {
          morphlineConfig = candidate;
          break;
        }
      }
      if (morphlineConfig == null) {
        throw new MorphlineCompilationException(
            "Morphline id '" + morphlineId + "' not found in morphline file: " + nameForErrorMsg, null);
      }
    }
    return morphlineConfig; 
  }
920614
def pattern_with_glob_pattern(*pattern, **options)
      options[:uri_decode]    ||= false
      pattern                   = Mustermann.new(*pattern.flatten, **options)
      @glob_patterns          ||= {}
      @glob_patterns[pattern] ||= GlobPattern.generate(pattern)
      [pattern, @glob_patterns[pattern]]
    end
589873
public static Pattern createFilePattern(String filePattern) {
      filePattern = StringUtils.isNullOrBlank(filePattern) ? "\\*" : filePattern;
      filePattern = filePattern.replaceAll("\\.", "\\.");
      filePattern = filePattern.replaceAll("\\*", ".*");
      return Pattern.compile("^" + filePattern + "$");
   }
803956
function getFiles(res, pattern, options) {
  var files = res.split(/\r?\n/).filter(Boolean);
  if (files.length === 1 && files[0] === pattern) {
    files = [];
  } else if (options.realpath === true || options.follow === true) {
    files = toAbsolute(files, options);
  }
  if (files.length === 0) {
    if (options.nullglob === true) {
      return [pattern];
    }
    if (options.failglob === true) {
      return new Error('no matches:' + pattern);
    }
  }

  return files.filter(function(filepath) {
    return filepath !== '.' && filepath !== '..';
  });
}
73379
function discover(pattern, callback) {
    glob(pattern, function (err, filepaths) {
      if (err) callback(err);
      callback(null, filepaths);
    });
  }
157770
public static File[] listFiles(final File target, final List<Pattern> patterns, final boolean include) {
        if (patterns == null || patterns.isEmpty())
            return target.listFiles();

        return target.listFiles(new FilenameFilter() {

            @Override
            public boolean accept(File dir, String name) {
                for (Pattern pattern : patterns) {
                    Matcher matcher = pattern.matcher(name);
                    if (matcher.matches())
                        return include;
                }
                return !include;
            }

        });

    }
71732
def glob(*args):
    
    if len(args) is 1 and isinstance(args[0], list):
        args = args[0]
    matches = []
    for pattern in args:
        for item in glob2.glob(pattern):
            if not os.path.isdir(item):
                matches.append(item)
    return matches