parameters: (uri: str = "")
return_statement: return _db
docstring: Returns the database connection
  
      uri: a string representing the URI of the database. See _getDBType for
          details. If no URI is given we use the default
          (mongodb://localhost:27017) or the value in the GEM5ART_DB environment
          variable.
  
      If the connection has not been established, this will create a new
      connection. If the connection has been established, this will replace the
      connection if the uri input is non-empy.
docstring_summary: Returns the database connection
docstring_tokens: Returns the database connection
function: def getDBConnection(uri: str = "") -> ArtifactDB:
      """Returns the database connection
  
      uri: a string representing the URI of the database. See _getDBType for
          details. If no URI is given we use the default
          (mongodb://localhost:27017) or the value in the GEM5ART_DB environment
          variable.
  
      If the connection has not been established, this will create a new
      connection. If the connection has been established, this will replace the
      connection if the uri input is non-empy.
      """
      global _db
  
      # mypy bug: https://github.com/python/mypy/issues/5423
      if _db is not None and not uri:  # type: ignore[unreachable]
          # If we have already established a connection, use that
          return _db  # type: ignore[unreachable]
  
      if not uri:
          uri = os.environ.get("GEM5ART_DB", _default_uri)
  
      typ = _getDBType(uri)
      _db = typ(uri)
  
      return _db
function_tokens: def getDBConnection ( uri : str = "" ) -> ArtifactDB : global _db # mypy bug: https://github.com/python/mypy/issues/5423 if _db is not None and not uri : # type: ignore[unreachable] # If we have already established a connection, use that return _db # type: ignore[unreachable] if not uri : uri = os . environ . get ( "GEM5ART_DB" , _default_uri ) typ = _getDBType ( uri ) _db = typ ( uri ) return _db