Load all pattern from all the files in folders
189288
def _load_patterns(self, folders, pattern_dict=None):
        """"""
        if pattern_dict is None:
            pattern_dict = {}
        for folder in folders:
            for file in os.listdir(folder):
                if regex.match('^[\w-]+$', file):
                    self._load_pattern_file(os.path.join(folder, file), pattern_dict)
        return pattern_dict
1326853
def add_patterns(self, dir_name, pattern_lines):
        
        for pattern_line in pattern_lines:
            self.pattern_list.add_filename_pattern(dir_name, pattern_line)
658184
def find(self, pattern):
        
        output = []

        def _find(dir):
            if re.match(pattern, dir._filename.split("/")[-1]):
                output.append(dir)
            if dir.is_directory():
                for c in dir.children:
                    _find(c)
        _find(self)
        return output
927748
private static List<File> findFilesInDirectory(File directory,
			Pattern pattern, boolean scanRecursive) {
		List<File> files = new ArrayList<File>();
		String[] filesInDirectory = directory.list();
		if (filesInDirectory == null) {
			return files;
		}
		for (String fileToCheck : filesInDirectory) {
			File file = new File(directory, fileToCheck);
			if (file.isFile()) {
				if (pattern.matcher(fileToCheck).matches()) {
					files.add(file);
				}
			} else if (file.isDirectory()) {
				if (scanRecursive) {
					files.addAll(findFilesInDirectory(file, pattern,
							scanRecursive));
				}
			}
		}
		return files;
	}
67568
def _compile(self, file_pattern, folder_exclude_pattern):
        """"""

        if not isinstance(file_pattern, _wcparse.WcRegexp):
            file_pattern = self._compile_wildcard(file_pattern, self.file_pathname)

        if not isinstance(folder_exclude_pattern, _wcparse.WcRegexp):

            folder_exclude_pattern = self._compile_wildcard(folder_exclude_pattern, self.dir_pathname)

        return file_pattern, folder_exclude_pattern
342010
function loadUses() {
          var globs = Array.prototype.slice.call(arguments, 0);
          var path = require('path');
          utils.forEach(globs, function(patt) {
            var files = glob.sync(patt, {});
            utils.forEach(files, function(file) {
              require(path.join(process.cwd(), file));
            });
          });

          return moduleInstance;
        }
755330
def get_paths(patterns, start_dirs=None, max_depth=1):
    """"""
    # Shortcut: if there is only one pattern, make sure we process just that.
    if len(patterns) == 1 and not start_dirs:
        pattern = patterns[0]
        directory = os.path.dirname(pattern)
        if directory:
            patterns = [os.path.basename(pattern)]
            start_dirs = directory
            max_depth = 1

    if not start_dirs or start_dirs == '.':
        start_dirs = os.getcwd()
    for start_dir in start_dirs.split(','):
        for root, dirs, files in os.walk(start_dir):  # pylint: disable=W0612
            if max_depth is not None:
                relpath = os.path.relpath(root, start=start_dir)
                depth = len(relpath.split(os.sep))
                if depth > max_depth:
                    continue
            names = []
            for pattern in patterns:
                names += fnmatch.filter(files, pattern)
            for name in names:
                path = os.path.join(root, name)
                yield path
820098
def load_files(self, cursor, target, files, options):
        ""
        for fname in files:
            self.load_file(cursor, target, fname, options)
592424
function loadTasks(dir) {
    /**
     * Resolve any relative paths
     *
     * @type    {String}
     */
    dir = require('path').resolve(dir);

    /**
     * Interal collection of modules loaded
     *
     * @type    {Object}
     */
    var modules = {};

    /**
     * Get a list of items in a directory. This is synchronous since we're
     * only doing this once on application load
     *
     * @type    {Array}
     */
    var list = require('fs').readdirSync(dir);

    /**
     * Setup the Regex to filter out *.js files but exclude files with
     * multiple `.` in them
     *
     * @type    {RegExp}
     */
    var jsFileTest = /^\w+\.js$/i;

    // Cycle through each item in the directory
    list.forEach(function(module) {
      //Check to see if with have a match and if we split it apartment
      if (jsFileTest.test(module)) {
        // If we find a match try to load and save it. Otherwise log an error
        try {
          modules[module] = require(dir + '/' + module);
        } catch (err) {
          console.error('Unable to load ' + dir + '/' + module, err);
        }
      }
    });

    return modules;
  }
635379
def load_directory(self, top_path, followlinks):
        
        for dir_name, child_dirs, child_files in os.walk(top_path, followlinks=followlinks):
            for child_filename in child_files:
                if child_filename == DDS_IGNORE_FILENAME:
                    pattern_lines = self._read_non_empty_lines(dir_name, child_filename)
                    self.add_patterns(dir_name, pattern_lines)
1242150
def findall(self, string, *args, **kwargs):
        """"""

        return self._pattern.findall(string, *args, **kwargs)
342800
def expand_pattern(pattern: str) -> List[str]:
    ''''''
    ofiles = []
    sz = None
    res = glob_wildcards(pattern, [])
    sz = None
    wildcard = [{}]
    for key in res.keys():
        if key not in env.sos_dict:
            raise ValueError(f'Undefined variable {key} in pattern {pattern}')
        if not isinstance(env.sos_dict[key], str) and isinstance(
                env.sos_dict[key], collections.Sequence):
            if sz is None:
                sz = len(env.sos_dict[key])
                wildcard = [copy.deepcopy(wildcard[0]) for x in range(sz)]
            elif sz != len(env.sos_dict[key]):
                raise ValueError(
                    f'Variables in output pattern should have the same length (other={sz}, len({key})={len(env.sos_dict[key])})'
                )
            for idx, value in enumerate(env.sos_dict[key]):
                wildcard[idx][key] = value
        else:
            for v in wildcard:
                v[key] = env.sos_dict[key]
    #
    for card in wildcard:
        ofiles.append(
            apply_wildcards(
                pattern,
                card,
                fill_missing=False,
                fail_dynamic=False,
                dynamic_fill=None,
                keep_dynamic=False))
    return ofiles
465246
def _scanDataFiles(self, dataDir, patterns):
        
        numDataFiles = 0
        for pattern in patterns:
            scanPath = os.path.join(dataDir, pattern)
            for filename in glob.glob(scanPath):
                self._addDataFile(filename)
                numDataFiles += 1
        if numDataFiles == 0:
            raise exceptions.EmptyDirException(dataDir, patterns)
1120733
def loadInputPatterns(self, filename, cols = None, everyNrows = 1,
                          delim = ' ', checkEven = 1):
        
        self.loadInputPatternsFromFile(filename, cols, everyNrows,
                                       delim, checkEven)
927811
def _load_files(self):
        '''
        
        '''
        files = {}
        for fn_ in self.opts['src']:
            if os.path.isfile(fn_):
                files.update(self._file_dict(fn_))
            elif os.path.isdir(fn_):
                salt.utils.stringutils.print_cli(
                    fn_ + ' is a directory, only files are supported '
                    'in non-chunked mode. Use "--chunked" command '
                    'line argument.')
                sys.exit(1)
        return files
543357
def dump(file_name, pattern):
    
    db = XonoticDB.load_path(file_name)
    items = sorted(db.filter(pattern), key=lambda x: natural_sort_key(x[0]))
    for k, v in items:
        click.echo('%s: %s' % (k, v))
615614
protected function getFilesByPattern($pattern)
    {
        $iterator = Injector::inst()->create('GreenFinder')
            ->in($this->getPath())
            ->name($pattern);
        $files = [];

        foreach ($iterator as $file) {
            $files[] = $this->getRelativePath() . '/' . $file->getRelativePathname();
        }

        return $files;
    }