Find a file in the index by `name` and an optional `version`.
 If found, returns a `Pathname` where the file can be retrieved.
165596
def find(name, version = nil)
      name     = Pathname.new(name)
      stem     = name.basename
      version  = version && version.strip != '' ? version.strip : nil
      ext      = '.js'
      possible_paths = if version
        [
          /#{stem}-#{version}\/#{name}#{ext}$/,
         /#{name}-#{version}#{ext}$/
        ]
      else
        [
          /#{name}#{ext}/,
          /#{name}-[\d\w\.\-]+#{ext}/
        ]
      end
      final = false
      each_file_in_index(ext) do |filename|
        possible_paths.each do |p|
          if File.file?(filename) && p.match(filename)
            final = Pathname.new(filename).expand_path
            block_given? ? yield(final) : break
          end
        end
        break if final && !block_given?
      end
      final
    end
571413
def lookup(self, name, version=None):
        """"""
        versions = self.get(name)
        if not versions:
            return None
        if version:
            return versions[version]
        return versions[max(versions)]
870272
def get_file(self, filename, dir='static'):
        
        if os.path.exists(filename):
            return filename
        dirs = self.apps
        if dir:
            fname = os.path.join(dir, filename)
        else:
            fname = filename
        for d in reversed(dirs):
            path = pkg.resource_filename(d, fname)
            if os.path.exists(path):
                return path
        return None
31816
def load_name(self, name):
        
        locator = self._make_locator()

        path = locator.find_name(name, self.search_dirs)

        return self.read(path)
365755
def _find_file(self, path, silent=False):
        
        for filename in DEFAULT_FILENAMES:
            full_path = os.path.join(path, filename) if path else filename
            if os.path.exists(full_path):
                return full_path

        # Return default filename if silent
        if silent:
            return os.path.join(path, DEFAULT_FILENAME)

        raise ReadmeNotFoundError(path)
19498
def get_filename(self, index):
        """"""
        if index:
            path = self.fsmodel.filePath(self.proxymodel.mapToSource(index))
            return osp.normpath(to_text_string(path))
189896
def find(self, path=None, name=None):
        
        if path is None and name is None:
            # TODO: Correct error type
            raise ValueError("Path or name is required.")
            # Entries are sorted by version number, so the last will be the most recent
        # TODO: Reduce redundancy with RAFArchive
        if path:
            return self.entries_full[path.lower()][-1]
        else:
            return self.entries_name[name.lower()][-1][-1]
175236
def _find_path(self, search_dirs, file_name):
        
        for dir_path in search_dirs:
            file_path = os.path.join(dir_path, file_name)
            if os.path.exists(file_path):
                return file_path

        return None
897201
def get(self, filename):
        
        pathname = os.path.join(self.config.binary_cache, filename)
        if os.path.isfile(pathname):
            logger.debug("Distribution archive exists in local cache (%s).", pathname)
            return pathname
        else:
            logger.debug("Distribution archive doesn't exist in local cache (%s).", pathname)
            return None
593164
def get_network_by_name_version(self, name: str, version: str) -> Optional[Network]:
        """"""
        name_version_filter = and_(Network.name == name, Network.version == version)
        network = self.session.query(Network).filter(name_version_filter).one_or_none()
        return network
1337036
def find_version(*file_paths):
    
    file_path = os.path.join(*file_paths)
    with open(file_path, 'r') as version_file:
        line = version_file.readline()
        while line:
            if line.startswith('__version__'):
                version_match = re.search(
                    r"^__version__ = ['\"]([^'\"]*)['\"]",
                    line,
                    re.M
                )
                if version_match:
                    return version_match.group(1)
            line = version_file.readline()
    raise RuntimeError('Unable to find version string.')
485744
function findCoverageFile (source, filename) {
  for (var i = 0; i < source.length; i++) {
    var file = source[i]
    if (file.filename === filename) {
      return file
    }
  }
  return null
}
341280
def find_version(file_path):
    

    with io.open(
            os.path.join(
                os.path.dirname(__file__),
                os.path.normpath(file_path)),
            encoding="utf8") as fp:
        content = fp.read()

    version_match = re.search(r"^__version__ = ['\"]([^'\"]*)['\"]",
                              content, re.M)
    if version_match:
        return version_match.group(1)
    raise RuntimeError("Unable to find version string.")
640757
def find_version_by_regex(file_source):  # type: (str)->Optional[str]
    
    if not file_source:
        return None
    version_match = re.search(r"^version=['\"]([^'\"]*)['\"]", file_source, re.M)
    if version_match:
        return version_match.group(1)
    return None
67306
def find_file(name)
      @load_path.each do |dir|
        file_path = File.join(dir, "#{name}.rb")
        return file_path if File.exist? file_path
      end
      raise("Module #{name} not found")
    end
224042
def _find_by_name(tree_data, name, is_dir, start_at):
    """"""
    try:
        item = tree_data[start_at]
        if item and item[2] == name and S_ISDIR(item[1]) == is_dir:
            tree_data[start_at] = None
            return item
    except IndexError:
        pass
    # END exception handling
    for index, item in enumerate(tree_data):
        if item and item[2] == name and S_ISDIR(item[1]) == is_dir:
            tree_data[index] = None
            return item
        # END if item matches
    # END for each item
    return None
853017
def _get_path(self, name):
        
        path = self.option("path")
        if path is None:
            path = self._get_seeders_path()

        return os.path.join(path, "%s.py" % name)