src/orion/core/utils/singleton.py
def update_singletons(values=None):
    """Replace singletons by given values and return previous singleton objects"""
    if values is None:
        values = {}

    # Avoiding circular import problems when importing this module.
    from orion.core.io.database import Database
    from orion.core.io.database.ephemeraldb import EphemeralDB
    from orion.core.io.database.mongodb import MongoDB
    from orion.core.io.database.pickleddb import PickledDB
    from orion.storage.base import Storage
    from orion.storage.legacy import Legacy
    from orion.storage.track import Track

    singletons = (Storage, Legacy, Database, MongoDB, PickledDB, EphemeralDB, Track)

    updated_singletons = {}
    for singleton in singletons:
        updated_singletons[singleton] = singleton.instance
        singleton.instance = values.get(singleton, None)

    return updated_singletons
Replace singletons by given values and return previous singleton objects
Replace singletons by given values and return previous singleton objects
Replace singletons by given values and return previous singleton objects
def update_singletons(values=None):
    if values is None:
        values = {}
    from orion.core.io.database import Database
    from orion.core.io.database.ephemeraldb import EphemeralDB
    from orion.core.io.database.mongodb import MongoDB
    from orion.core.io.database.pickleddb import PickledDB
    from orion.storage.base import Storage
    from orion.storage.legacy import Legacy
    from orion.storage.track import Track
    singletons = (Storage, Legacy, Database, MongoDB, PickledDB, EphemeralDB, Track)
    updated_singletons = {}
    for singleton in singletons:
        updated_singletons[singleton] = singleton.instance
        singleton.instance = values.get(singleton, None)
    return updated_singletons
def update_singletons ( values = None ) : if values is None : values = { } from orion . core . io . database import Database from orion . core . io . database . ephemeraldb import EphemeralDB from orion . core . io . database . mongodb import MongoDB from orion . core . io . database . pickleddb import PickledDB from orion . storage . base import Storage from orion . storage . legacy import Legacy from orion . storage . track import Track singletons = ( Storage , Legacy , Database , MongoDB , PickledDB , EphemeralDB , Track ) updated_singletons = { } for singleton in singletons : updated_singletons [ singleton ] = singleton . instance singleton . instance = values . get ( singleton , None ) return updated_singletons
Replace singletons by given values and return previous singleton objects
Replace singletons by given values and return previous singleton objects
"""Replace singletons by given values and return previous singleton objects""" # Avoiding circular import problems when importing this module.
values