find all matching data files in search_path
        returns array of tuples (codec_object, filename)
491080
def find_datafile(self, name, search_path=None):
        
        if not search_path:
            search_path = self.define_dir

        return codec.find_datafile(name, search_path)
710053
def find(self, path, all=False):
        
        matches = []
        for elem in chain(settings.STYLESHEETS.values(), settings.JAVASCRIPT.values()):
            if normpath(elem['output_filename']) == normpath(path):
                match = safe_join(settings.PIPELINE_ROOT, path)
                if not all:
                    return match
                matches.append(match)
        return matches
1308699
function (options, patterns) {
				// Return all matching filepaths.
				var matches = processPatterns(patterns, function (pattern) {
					// Find all matching files for this pattern.
					return glob.sync(pattern, options);
				});

				// Filter result set?
				if (options.filter) {
					matches = matches.filter(function (filepath) {
						filepath = path.join(options.cwd || '', filepath);

						try {
							if (typeof options.filter === 'function') {
								return options.filter(filepath);
							} else {
								// If the file is of the right type and exists, this should work.
								return fs.statSync(filepath)[options.filter]();
							}
						} catch (e) {
							// Otherwise, it's probably not the right type.
							return false;
						}
					});
				}

				return matches;
			}
824715
def load_datafile(self, name, search_path=None, **kwargs):
        
        if not search_path:
            search_path = self.define_dir

        self.debug_msg('loading datafile %s from %s' % (name, str(search_path)))
        return codec.load_datafile(name, search_path, **kwargs)
342686
def matchingfiles(self, projectpath):
        """"""
        results = []

        if projectpath[-1] == '/':
            inputpath = projectpath + 'input/'
        else:
            inputpath = projectpath + '/input/'

        for linkf,realf in clam.common.util.globsymlinks(inputpath + '/.*.INPUTTEMPLATE.' + self.id + '.*'):
            seqnr = int(linkf.split('.')[-1])
            results.append( (seqnr, realf[len(inputpath):], self) )
        results = sorted(results)
        if self.unique and len(results) != 1:
            return []
        else:
            return results
1134388
def _findSwiplDar():
    

    # If the exec is in path
    (path, swiHome) = _findSwiplFromExec()
    if path is not None:
        return (path, swiHome)

    # If it is not, use  find_library
    path = _findSwiplPathFromFindLib()
    if path is not None:
        return (path, swiHome)

    # Last guess, searching for the file
    paths = ['.', './lib', '/usr/lib/', '/usr/local/lib', '/opt/local/lib']
    names = ['libswipl.dylib', 'libpl.dylib']

    for name in names:
        for path in paths:
            path = os.path.join(path, name)
            if os.path.exists(path):
                return (path, None)

    return (None, None)
1081824
def find_file(path_dir, search_str, file_ext):
    ''''''
    import os

    file_path = None

    for file_name in os.listdir(path_dir):
        if (search_str in file_name) and (file_name.endswith(file_ext)):
            file_path = os.path.join(path_dir, file_name)
            break

    if file_path == None:
        raise SystemError('No file found containing string: '
                          '{}.'.format(search_str))

    return file_path
272405
def find_files():
    
    _dir = os.getcwd()
    _files = os.listdir()
    # Look for a jsonld file
    for _file in _files:
        if _file.endswith(".jsonld"):
            return os.getcwd()
    # No jsonld file found, try to chdir into "bag" (LiPD v1.3)
    if "bag" in _files:
        os.chdir("bag")
        _dir = find_files()
    # No "bag" dir. Try chdir into whatever dataset name dir we find (< LiPD v1.2)
    else:
        for _file in _files:
            if os.path.isdir(_file):
                os.chdir(_file)
                _dir = find_files()
    return _dir
826758
def matches_glob_list(path, glob_list):
    
    for glob in glob_list:
        try:
            if PurePath(path).match(glob):
                return True
        except TypeError:
            pass
    return False
194399
public function find_all() {
        $this->ensure_path_exists();
        $files = glob($this->glob_keys_pattern(), GLOB_MARK | GLOB_NOSORT);
        $return = array();
        if ($files === false) {
            return $return;
        }
        foreach ($files as $file) {
            $return[] = substr(basename($file), 0, -6);
        }
        return $return;
    }
942514
def files(self, query, **kwargs):
        
        self.url = 'https://slack.com/api/search.files'
        return super(Search, self).search_from_url(query, **kwargs)
192750
def _find_glob_matches(in_files, metadata):
    
    reg_files = copy.deepcopy(in_files)
    glob_files = []
    for glob_search in [x for x in metadata.keys() if "*" in x]:
        cur = []
        for fname in in_files:
            if fnmatch.fnmatch(fname, "*/%s" % glob_search):
                cur.append(fname)
                reg_files.remove(fname)
        assert cur, "Did not find file matches for %s" % glob_search
        glob_files.append(cur)
    return reg_files, glob_files
1189041
def _search(mapping, filename):
    """"""
    result = mapping.get(filename)
    if result is not None:
        return result
    name, ext = os.path.splitext(filename)
    result = mapping.get(ext)
    if result is not None:
        for pattern, result2 in result:
            if fnmatch(filename, pattern):
                return result2
    return None
436596
def _get_file_by_value(cls, value):
        
        # Ignore any FileResource with no DataObject. This is a typical state
        # for a deleted file that has not yet been cleaned up.
        queryset = FileResource.objects.exclude(data_object__isnull=True)
        matches = FileResource.filter_by_name_or_id_or_tag_or_hash(
            value, queryset=queryset)
        if matches.count() == 0:
            raise ValidationError(
                'No file found that matches value "%s"' % value)
        elif matches.count() > 1:
            match_id_list = ['%s@%s' % (match.filename, match.get_uuid())
                             for match in matches]
            match_id_string = ('", "'.join(match_id_list))
            raise ValidationError(
                'Multiple files were found matching value "%s": "%s". '\
                'Use a more precise identifier to select just one file.' % (
                    value, match_id_string))
        return matches.first().data_object
347238
def search_filename(self, searchterm):
        
        return self.__search(type_attribute=self.__mispfilenametypes(), value=searchterm)
457917
def data_find_all(data, path, dyn_cls=False):
    
    path_parts = path.split("/")
    try:
        sub_elms = tuple(
            el
            for el in data
            if isinstance(el, (tuple, list)) and el[0] == path_parts[0]
        )
    except IndexError:
        return None
    if len(path_parts) > 1:
        ret = []
        for sub_elm in sub_elms:
            for x in data_find_all(sub_elm, "/".join(path_parts[1:])):
                ret.append(x)
        ret = tuple(ret)
    else:
        ret = sub_elms
    if ret and dyn_cls:
        cls = generate_element_class(ret[0])
        return tuple(cls(data=tuple_) for tuple_ in ret)
    return ret
586661
def _find_input_files(var, out):
    
    if isinstance(var, (list, tuple)):
        for x in var:
            out = _find_input_files(x, out)
    elif isinstance(var, dict):
        if var.get("class") == "File":
            out.append(var["path"])
            out = _find_input_files(var.get("secondaryFiles", []), out)
        for key, val in var.items():
            out = _find_input_files(val, out)
    return out