def get_or_instantiate_db_state(working_dir):
    """
    Get a read-only handle to the DB.
    Instantiate it first if it doesn't exist.

    DO NOT CALL WHILE INDEXING

    Returns the handle on success
    Raises on error
    """

    # instantiates
    new_db = BlockstackDB.borrow_readwrite_instance(working_dir, -1)
    BlockstackDB.release_readwrite_instance(new_db, -1)

    return get_db_state(working_dir)
def get_or_instantiate_db_state ( working_dir ) : new_db = BlockstackDB . borrow_readwrite_instance ( working_dir , - 1 ) BlockstackDB . release_readwrite_instance ( new_db , - 1 ) return get_db_state ( working_dir )
Get a read-only handle to the DB.
    Instantiate it first if it doesn't exist.

    DO NOT CALL WHILE INDEXING

    Returns the handle on success
    Raises on error