Looks up database of a given type and path in the registry. Returns
null if there is none.
185157
public static synchronized Database lookupDatabaseObject(String type,
            String path) {

        // A VoltDB extension to work around ENG-6044
        /* disabled 14 lines ...
        Object  key = path;
        HashMap databaseMap;

        if (type == DatabaseURL.S_FILE) {
            databaseMap = fileDatabaseMap;
            key         = filePathToKey(path);
        } else if (type == DatabaseURL.S_RES) {
            databaseMap = resDatabaseMap;
        } else if (type == DatabaseURL.S_MEM) {
            databaseMap = memDatabaseMap;
        } else {
            throw (Error.runtimeError(
                ErrorCode.U_S0500, "DatabaseManager.lookupDatabaseObject()"));
        }
           ... disabled 14 lines */

        assert (type == DatabaseURL.S_MEM);
        java.util.HashMap<String, Database> databaseMap = memDatabaseMap;
        String key = path;
        // End of VoltDB extension

        return (Database) databaseMap.get(key);
    }
1216096
@Nullable
    public <T> T get(ResultSet rs, @Nullable Path<?> path, int i, Class<T> clazz) throws SQLException {
        return getType(path, clazz).getValue(rs, i);
    }
369095
def IsRegistryStatEntry(self, original_result):
    """"""
    return (original_result.pathspec.pathtype ==
            rdf_paths.PathSpec.PathType.REGISTRY)
901620
public static @CheckForNull <T> T lookup(Class<T> type) {
        Jenkins j = Jenkins.getInstanceOrNull();
        return j != null ? j.lookup.get(type) : null;
    }
306842
def database_path(cls, project, instance, database):
        """"""
        return google.api_core.path_template.expand(
            "projects/{project}/instances/{instance}/databases/{database}",
            project=project,
            instance=instance,
            database=database,
        )
568038
def bsfile(self, path):
        """"""
        from sqlalchemy.orm.exc import NoResultFound
        from ambry.orm.exc import NotFoundError

        try:

            f =  object_session(self)\
                .query(File)\
                .filter(File.d_vid == self.vid)\
                .filter(File.major_type == File.MAJOR_TYPE.BUILDSOURCE)\
                .filter(File.path == path)\
                .one()

            return f

        except NoResultFound:
            raise NotFoundError("Failed to find file for path '{}' ".format(path))
114054
def dbType(self, typ):
        
        return self.TypeMap.get(typ, self.TypeMap.get('Default'))
604531
function fetchRegistryInfo (registryUrl, presetName) {
  const api = `${registryUrl}/${presetName}`

  debug(`fetch: ${api}`)

  return fetch(api, { method: 'GET', timeout: 3000 })
    .then(res => res.json())
    .then(data => {
      const lastVersion = data['dist-tags'].latest
      return data.versions[lastVersion]
    })
    .catch(error => {
      debug('fetch error: %o', error)
      return null
    })
}
201466
def type(self, mpath):
        
        try:
            return self.stat(mpath)["type"]
        except errors.MantaResourceNotFoundError:
            return None
        except errors.MantaAPIError:
            _, ex, _ = sys.exc_info()
            if ex.code in ('ResourceNotFound', 'DirectoryDoesNotExist'):
                return None
            else:
                raise
278258
def _load(root):
    """"""
    types = _load_types(root)
    enums = _load_enums(root)
    commands = _load_commands(root)
    features = _load_features(root)
    extensions = _load_extensions(root)
    return Registry(None, types, enums, commands, features, extensions)
991499
def RegistryKeyFromClient(args):
  
  for path in _GetExpandedPaths(args):
    pathspec = rdf_paths.PathSpec(
        path=path, pathtype=rdf_paths.PathSpec.PathType.REGISTRY)
    with vfs.VFSOpen(pathspec) as file_obj:
      yield file_obj.Stat()
66435
public RegistryEntry getEntry(String searchType) {
		for (Map.Entry<Class, RegistryEntry> entry : resources.entrySet()) {
			String type = getResourceType(entry.getKey());
			if (type == null) {
				return null;
			}
			if (type.equals(searchType)) {
				return entry.getValue();
			}
		}
		return null;
	}
1003977
def get(self, key, no_cache=False):
        
        section, name = self.parse_lookup(key)
        preference = self.registry.get(
            section=section, name=name, fallback=False)
        if no_cache or not preferences_settings.ENABLE_CACHE:
            return self.get_db_pref(section=section, name=name).value

        try:
            return self.from_cache(section, name)
        except CachedValueNotFound:
            pass

        db_pref = self.get_db_pref(section=section, name=name)
        self.to_cache(db_pref)
        return db_pref.value
195573
function getDatabase(index, opts) {
  var db;
  if(!this._databases[index]) {
    db = new Database(this, opts);
    this._databases[index] = db;
  }
  return this._databases[index];
}
1303643
def get_database(obj, **params):
    """"""
    if isinstance(obj, string_types):
        return connect(obj, **params)
    return obj
210858
function getDBTypeFromDBValue(db) {
    if (constants.SQL_DB_OPTIONS.map(db => db.value).includes(db)) {
        return 'sql';
    }
    return db;
}
898380
async function getPkgReleases({ lookupName, registryUrls }) {
  const versions = [];
  const dependency = getDependencyParts(lookupName);
  if (!is.nonEmptyArray(registryUrls)) {
    logger.error(`No repositories defined for ${dependency.display}`);
    return null;
  }
  const repositories = registryUrls.map(repository =>
    repository.replace(/\/?$/, '/')
  );
  logger.debug(
    `Found ${repositories.length} repositories for ${dependency.display}`
  );
  const repoForVersions = {};
  for (let i = 0; i < repositories.length; i += 1) {
    const repoUrl = repositories[i];
    logger.debug(
      `Looking up ${dependency.display} in repository #${i} - ${repoUrl}`
    );
    const mavenMetadata = await downloadMavenXml(
      dependency,
      repoUrl,
      'maven-metadata.xml'
    );
    if (mavenMetadata) {
      const newVersions = extractVersions(mavenMetadata).filter(
        version => !versions.includes(version)
      );
      const latestVersion = getLatestVersion(newVersions);
      if (latestVersion) {
        repoForVersions[latestVersion] = repoUrl;
      }
      versions.push(...newVersions);
      logger.debug(`Found ${newVersions.length} new versions for ${dependency.display} in repository ${repoUrl}`); // prettier-ignore
    }
  }

  if (versions.length === 0) {
    logger.info(`No versions found for ${dependency.display} in ${repositories.length} repositories`); // prettier-ignore
    return null;
  }
  logger.debug(`Found ${versions.length} versions for ${dependency.display}`);
  const latestVersion = getLatestVersion(versions);
  const repoUrl = repoForVersions[latestVersion];
  const dependencyInfo = await getDependencyInfo(
    dependency,
    repoUrl,
    latestVersion
  );

  return {
    ...dependency,
    ...dependencyInfo,
    releases: versions.map(v => ({ version: v })),
  };
}