Main: Get all data frames that match the given expression
    :return dict: Filenames and data frames (filtered)
769249
def get_filtered_dfs(lib, expr):
    
    logger_dataframes.info("enter get_filtered_dfs")

    dfs = {}
    tt = None

    # Process all lipds files or one lipds file?
    specific_files = _check_expr_filename(expr)

    # Determine the table type wanted
    if "chron" in expr:
        tt = "chron"
    elif "paleo" in expr:
        tt = "paleo"

    # Get all filenames of target type.
    if tt:

        if specific_files:
            # The user has specified a single LiPD file to get data frames from.
            for file in specific_files:
                if file in lib:
                    lo_meta = lib[file].get_metadata()
                    lo_dfs = lib[file].get_dfs()

                    # Only start a search if this lipds file has data frames available. Otherwise, pointless.
                    if lo_dfs:
                        # Get list of all matching filenames
                        filenames = _match_dfs_expr(lo_meta, expr, tt)
                        # Update our output data frames dictionary
                        dfs.update(_match_filenames_w_dfs(filenames, lo_dfs))
                else:
                    print("Unable to find LiPD file in Library: {}".format(file))

        # Process all LiPD files in the library. A file has not been specified in the expression.
        else:
            # Loop once on each lipds object in the library
            for ln, lo in lib.items():
                # Get the
                lo_meta = lo.get_metadata()
                lo_dfs = lo.get_dfs()

                # Only start a search if this lipds file has data frames available. Otherwise, pointless.
                if lo_dfs:
                    # Get list of all matching filenames
                    filenames = _match_dfs_expr(lo_meta, expr, tt)
                    # Update our output data frames dictionary
                    dfs.update(_match_filenames_w_dfs(filenames, lo_dfs))

    logger_dataframes.info("exit get_filtered_dfs")
    return dfs
104472
def filterable expressions: {}, columns: {}, only: false
			_filterable false, expressions: expressions, columns: columns, only: only
		end
35582
def find_files(root, pattern):
    
    results = []
    for base, dirs, files in os.walk(root):
        matched = fnmatch.filter(files, pattern)
        results.extend(os.path.join(base, f) for f in matched)
    return results
259987
def query(self, name, reshape=RESHAPE_DEFAULT, filt=None, idval=None, idxlower=True):
        '''
        
        '''
        gdx_handle = self.gdx_handle
        ret, symNr = gdxcc.gdxFindSymbol(gdx_handle, name)
        assert ret, "Symbol '%s' not found in GDX '%s'" % (name, self.internal_filename)
        sinfo = self.get_sid_info(symNr)
        dim = sinfo['dim']
        symType = sinfo['stype']
        ret, nrRecs = gdxcc.gdxDataReadStrStart(gdx_handle, symNr)
        assert ret, get_last_error('gdxDataReadStrStart', gdx_handle)
        if idval is None:
            if symType == gdxcc.GMS_DT_EQU:
                idval = gdxcc.GMS_VAL_MARGINAL
            else:
                idval = gdxcc.GMS_VAL_LEVEL
        ifilt = None
        vtable = [None]*(nrRecs)
        rcounter = 0
        rowtype = None
        if filt != None:
            if isinstance(filt,list):
                filt = '^({0})$'.format('|'.join([re.escape(x) for x in filt]))
            if isinstance(filt, str):
                filt_func = re.compile(filt, re.IGNORECASE).match
            else:
                filt_func = filt
        for i in range(nrRecs):
            vrow = [None]*(dim+1)
            ret, elements, values, afdim = gdxcc.gdxDataReadStr(gdx_handle)
            assert ret, get_last_error('gdxDataReadStr', gdx_handle)
            if (filt != None):
                match_filt = False
                for e in elements:
                    m = filt_func(e)
                    if m != None:
                        match_filt = True
                        break
                if not match_filt:
                    continue
            d = -1
            for d in range(dim):
                try:
                    vrow[d] = int(elements[d])
                except:
                    vrow[d] = elements[d].lower() if idxlower else elements[d]
            vrow[d+1] = values[idval]
            vtable[rcounter] = vrow
            rcounter += 1
        gdxcc.gdxDataReadDone(gdx_handle)
        cols = ['s%d' % x for x in range(dim)]+['val',]
        df = pd.DataFrame(vtable[:rcounter],columns=cols)
        logger.debug("%d / %d records read from <%s>" % (rcounter, nrRecs, self.internal_filename))
        if symType == gdxcc.GMS_DT_SET:
            reshape = RESHAPE_SERIES
        df = dfreshape(df, reshape)
        if symType == gdxcc.GMS_DT_SET:
            df = df.index
        self.data = df
        return df
762613
def filter(self, names):
        
        names = list_strings(names)

        fnames = []
        for f in names:
            for pat in self.pats:
                if fnmatch.fnmatch(f, pat):
                    fnames.append(f)

        return fnames
1291998
function getNumMatches(fileList, queryExpr) {
    var i,
        matches = 0;
    for (i = 0; i < fileList.length; i++) {
        var temp = countNumMatches(getFileContentsForFile(fileList[i]), queryExpr);
        if (temp) {
            numFiles++;
            matches += temp;
        }
        if (matches > MAX_TOTAL_RESULTS) {
            exceedsMaximum = true;
            break;
        }
    }
    return matches;
}
668776
def regex_findall(regex, fname):
    ''''''
    try:
        with fileobj(fname) as f:
            return re.findall(regex, f.read(), re.MULTILINE)
    except AttributeError:
        return []
449060
def datagetter(cls):
        
        with open('myfile', 'rt') as f:
            rows = [r for r in csv.reader(f)]
        dothing = lambda _: [i for i, v in enumerate(_)]
        rows = [dothing(_) for _ in rows]
        raise NotImplementedError('You need to implement this yourlself!')
        return rows
611353
def process(self):
        
        # Short cut
        if self._all_expressions_evaluated():
            if self.drop:
                # Drop extra columns. They do not correspond to
                # any expressions.
                columns = [expr.column for expr in self.expressions]
                self.data = self.data.loc[:, columns]
            return self.data

        # group_by
        # evaluate expressions
        # combine columns
        # concat evalutated group data and clean up index and group
        gdfs = self._get_group_dataframes()
        egdfs = self._evaluate_expressions(gdfs)
        edata = self._concat(egdfs)
        return edata
911638
def parse_filename(filename):
    

    _patterns = patterns.get_expressions()
    result = {}

    for cmatcher in _patterns:
        match = cmatcher.match(filename)
        if match:
            namedgroups = match.groupdict().keys()

            result['pattern'] = cmatcher.pattern
            result['series_name'] = match.group('seriesname')
            result['season_number'] = _get_season_no(match, namedgroups)
            result['episode_numbers'] = _get_episodes(match, namedgroups)
            break
    else:
        result = None

    return result
63918
def all_query(expression):
    """"""
    def _all(index, expression=expression):
        """Return store key for documents that satisfy expression."""
        ev = expression() if callable(expression) else expression
        try:
            iter(ev)
        except TypeError:
            raise AttributeError('$all argument must be an iterable!')

        hashed_ev = [index.get_hash_for(v) for v in ev]
        store_keys = set()

        if len(hashed_ev) == 0:
            return []
        store_keys = set(index.get_keys_for(hashed_ev[0]))
        for value in hashed_ev[1:]:
            store_keys &= set(index.get_keys_for(value))
        return list(store_keys)

    return _all
138895
def find_matches(self, content, file_to_handle):
        
        # look for all match groups in the content
        groups = [match.groupdict() for match in
                  self.match_expression.finditer(content)]
        # filter out content not in the matchgroup
        matches = [group['matchgroup'] for group in groups
                   if group.get('matchgroup')]

        logger.info('Found %s matches in %s', len(matches), file_to_handle)
        # We only need the unique strings found as we'll be replacing each
        # of them. No need to replace the ones already replaced.
        return list(set(matches))
835946
def matching_files(self):
        
        matching = []
        matcher = self.file_path_regex
        pieces = self.file_path_regex.pattern.split(sep)
        partial_matchers = list(map(re.compile, (
            sep.join(pieces[:i + 1]) for i in range(len(pieces)))))

        for root, dirs, files in walk(self.top_dir, topdown=True):
            for i in reversed(range(len(dirs))):
                dirname = relpath(join(root, dirs[i]), self.top_dir)
                dirlevel = dirname.count(sep)
                if not partial_matchers[dirlevel].match(dirname):
                    del dirs[i]

            for filename in files:
                if matcher.match(filename):
                    matching.append(abspath(join(root, filename)))

        return matching
624551
def _all_files_matching_ext(start, ext):
    """"""
    md_files = []
    for root, _, files in os.walk(start):
        md_files += fnfilter([os.path.join(root, f) for f in files],
                             "*." + ext)

    return md_files
1055386
def get_file_named(self, fldr, xtn):
        
        res = []       # list of Sample objects
        for root, _, files in os.walk(fldr):
            for basename in files:
                if fnmatch.fnmatch(basename, xtn):
                    filename = os.path.join(root, basename)
                    res.append(filename)

        if len(res) > 0:   
            return res[0]
        else:
            return None
103337
def get_all_datasets(self):
        
        success = True

        for dataset in tqdm(self.datasets):
            individual_success = self.get_dataset(dataset)
            if not individual_success:
                success = False

        return success
509149
def tbfuncs(frames):
  ''
  return ['%s:%s:%s'%(os.path.split(f.f_code.co_filename)[-1],f.f_code.co_name,f.f_lineno) for f in frames]