Accept a glob which to match the of a key and return the key's location
975323
def name_match(self, match, full=False):
        '''
        
        '''
        if full:
            matches = self.all_keys()
        else:
            matches = self.list_keys()
        ret = {}
        if ',' in match and isinstance(match, six.string_types):
            match = match.split(',')
        for status, keys in six.iteritems(matches):
            for key in salt.utils.data.sorted_ignorecase(keys):
                if isinstance(match, list):
                    for match_item in match:
                        if fnmatch.fnmatch(key, match_item):
                            if status not in ret:
                                ret[status] = []
                            ret[status].append(key)
                else:
                    if fnmatch.fnmatch(key, match):
                        if status not in ret:
                            ret[status] = []
                        ret[status].append(key)
        return ret
449320
def get(self, key) -> str:
        
        # TODO: get is creating files when a key is given which is more than
        # the store size
        chunk_no, offset = self._get_key_location(key)
        with self._openChunk(chunk_no) as chunk:
            return chunk.get(str(offset))
603699
def get(cls, key, default=None, separator='.', global_=False):
        
        # first check environnment variables
        # if we're not in global scope
        if not global_:
            ret = os.environ.get(key.upper().replace('.', '_'))
            if ret is not None:
                return ret

        # then check in local and global configuration unless global_=True
        scopes = ['global'] if global_ else ['local', 'global']
        for scope in scopes:
            ret = cls._get(scope, key, default, separator)
            if ret is not None and ret != default:
                return ret

        if ret is None or ret == default:
            return default
180748
def key_str(self, match):
        '''
        
        '''
        ret = {}
        for status, keys in six.iteritems(self.name_match(match)):
            ret[status] = {}
            for key in salt.utils.data.sorted_ignorecase(keys):
                path = os.path.join(self.opts['pki_dir'], status, key)
                with salt.utils.files.fopen(path, 'r') as fp_:
                    ret[status][key] = \
                        salt.utils.stringutils.to_unicode(fp_.read())
        return ret
1291253
def _complete_string(key, haystack):
    

    if len(key) == 0:
        return haystack

    match = []
    for straw in haystack:
        if string.find(straw, key) == 0:
            match.append(straw)
    return match
768053
def keys(self, globpat = None):
        

        if globpat is None:
            files = self.root.rglob('*')
        else:
            files = self.root.glob(globpat)
        return [self._normalized(p) for p in files if p.is_file()]
1097951
private static void match_glob(GlobData mdata, Context cx,
                                   Scriptable scope, int count,
                                   RegExpImpl reImpl)
    {
        if (mdata.arrayobj == null) {
            mdata.arrayobj = cx.newArray(scope, 0);
        }
        SubString matchsub = reImpl.lastMatch;
        String matchstr = matchsub.toString();
        mdata.arrayobj.put(count, mdata.arrayobj, matchstr);
    }
259880
function Pattern(glob, options, isNegated) {
  utils.defineProp(this, 'cache', new Map());
  this.negated = !!isNegated;
  this.options = options || {};
  this.parse(glob);
  return this;
}
347707
def contains_glob(path_to_directory, pattern, wanted=None):
    """"""
    if not path_to_directory:
        return False
    needed = make_needed(pattern, path_to_directory, wanted)
    for name in _names_in_directory(path_to_directory):
        if needed(name):
            return True
    return False
918381
def glob(self):
		
		matches = []
		for root, dirnames, filenames in os.walk(self.path):
			if not self.recursive:
				while len(dirnames) > 0:
					dirnames.pop()
			for include in self.include:
				for filename in fnmatch.filter(filenames, include):
					matches.append(os.path.join(root, filename))
		return matches
461124
def get(ctx, key):
    ''''''
    file = ctx.obj['FILE']
    stored_value = get_key(file, key)
    if stored_value:
        click.echo('%s=%s' % (key, stored_value))
    else:
        exit(1)
1374998
def map_over_glob(fn, path, pattern):
    """"""
    return [fn(x) for x in glob.glob(os.path.join(path, pattern))]
754391
function globMatch(match, file) {
    var directiveType = match[1];
    var globPattern = match[2]; // relative file

    // require all files under a directory
    if (directiveType.indexOf('_tree') !== -1) {
      globPattern = globPattern.concat('/**/*');
      directiveType = directiveType.replace('_tree', '');
    }

    // require only first level files in a directory
    if (directiveType.indexOf('_directory') !== -1) {
      globPattern = globPattern.concat('/*');
      directiveType = directiveType.replace('_directory', '');
    }

    // Only require and include directives are allowed
    if (directiveType !== 'require' && directiveType !== 'include') {
      return [];
    }

    // Add file extension to glob pattern if not already set
    var jsExt = '.js';
    if (globPattern.substr(globPattern.length-jsExt.length).indexOf(jsExt) !== 0) {
      globPattern += jsExt;
    } 

    // Append the current dir to include so we can match the glob against the file list
    var relativeDir = getRelativeDir(file);
    globPattern = relativeDir+globPattern;

    var possibleIncludes = [];
    _.each(_.keys(allFiles), function(fileName) {
      // Only process files in the current directory. ../ will not work.
      if (fileName.indexOf(relativeDir) !== 0) {
        return;
      }

      possibleIncludes.push(fileName);
    });
    
    return minimatch.match(possibleIncludes, globPattern);
  }
313920
function getSourceFilesFromGlob(globPattern, ignoreGlobs) {
    return new Promise((fulfil, reject) => {
        glob(globPattern, { ignore: ignoreGlobs }, (err, files) => {
            if (err) {
                reject(err);
            } else {
                fulfil(files);
            }
        });
    });
}
220668
function globFile (file) {
    return stat(file).then(({ err, stats }) => {
      if (err) throw err
      if (stats.isDirectory()) {
        // TODO what if file is already slash-terminated?
        switch (file) {
          case './':
            return globPromise('./*.js')
          case 'bin':
            return globPromise('bin/*')
          default:
            return globPromise(`${file}/**/*.js`)
        }
      } else {
        return Promise.resolve(file)
      }
    })
  }
47018
def super_glob(pattern):
    ''
    pieces = pattern.split('/')
    if '**' in pieces:
        prefix = '/'.join(pieces[:pieces.index('**')])
        postfix = '/'.join(pieces[pieces.index('**') + 1:])
        roots = [dirname
                 for dirname, dirnames, filenames in os.walk(prefix)]
        patterns = [root + '/' + postfix for root in roots]
    else:
        patterns = ['/'.join(pieces)]
    return chain.from_iterable(glob(pattern) for pattern in patterns)
1210781
def to_path_globs(self, relpath, conjunction):
    """"""
    return PathGlobs(
      include=tuple(os.path.join(relpath, glob) for glob in self._file_globs),
      exclude=tuple(os.path.join(relpath, exclude) for exclude in self._excluded_file_globs),
      conjunction=conjunction)