How to use the barril.units.UnitDatabase.PopSingleton function in barril

To help you get started, we’ve selected a few barril examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ESSS / barril / src / barril / curve / _tests / test_curve.py View on Github external
unit_database.AddUnitBase("time", "seconds", "s")
    unit_database.AddUnit("time", "minutes", "min", "%f * 60.0", " %f * 60.0")
    unit_database.AddUnit("time", "hours", "h", "%f * 3600.0", " %f * 3600.0")
    unit_database.AddUnit("time", "days", "d", "%f * 86400.0", " %f * 86400.0")

    unit_database.AddCategory(
        category="length", quantity_type="length", valid_units=["cm", "m", "km"]
    )
    unit_database.AddCategory(
        category="time", quantity_type="time", valid_units=["s", "min", "h", "d"]
    )

    UnitDatabase.PushSingleton(unit_database)
    yield unit_database

    UnitDatabase.PopSingleton()
github ESSS / barril / src / barril / fixtures.py View on Github external
def unit_database_well_length():
    database = CreateUnitDatabaseWellLength()
    units.UnitDatabase.PushSingleton(database)

    yield database

    units.UnitDatabase.PopSingleton()
github ESSS / barril / src / barril / fixtures.py View on Github external
def unit_database_len_time():
    database = CreateUnitDatabaseLenTime()
    units.UnitDatabase.PushSingleton(database)

    yield database

    units.UnitDatabase.PopSingleton()
github ESSS / barril / src / barril / fixtures.py View on Github external
def unit_database_posc_len_no_category():
    database = CreateUnitDatabasePoscLen(fill_categories=False)
    units.UnitDatabase.PushSingleton(database)

    yield database

    units.UnitDatabase.PopSingleton()
github ESSS / barril / src / barril / fixtures.py View on Github external
def unit_database_start_units():
    database = CreateUnitDatabaseStartUnits()
    units.UnitDatabase.PushSingleton(database)

    yield database

    units.UnitDatabase.PopSingleton()
github ESSS / barril / src / barril / fixtures.py View on Github external
def unit_database_custom_conversion():
    database = CreateUnitDatabaseCustomConversion()
    units.UnitDatabase.PushSingleton(database)

    yield database

    units.UnitDatabase.PopSingleton()
github ESSS / barril / src / barril / fixtures.py View on Github external
def unit_database_len_pressure():
    database = CreateUnitDatabaseLenPressure()
    units.UnitDatabase.PushSingleton(database)

    yield database

    units.UnitDatabase.PopSingleton()
github ESSS / barril / src / barril / fixtures.py View on Github external
def unit_database_len_temp():
    database = CreateUnitDatabaseLenTemp()
    units.UnitDatabase.PushSingleton(database)

    yield database

    units.UnitDatabase.PopSingleton()
github ESSS / barril / src / barril / fixtures.py View on Github external
def unit_database_empty():
    database = units.UnitDatabase()
    units.UnitDatabase.PushSingleton(database)

    yield database

    units.UnitDatabase.PopSingleton()