Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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()
def unit_database_well_length():
database = CreateUnitDatabaseWellLength()
units.UnitDatabase.PushSingleton(database)
yield database
units.UnitDatabase.PopSingleton()
def unit_database_len_time():
database = CreateUnitDatabaseLenTime()
units.UnitDatabase.PushSingleton(database)
yield database
units.UnitDatabase.PopSingleton()
def unit_database_posc_len_no_category():
database = CreateUnitDatabasePoscLen(fill_categories=False)
units.UnitDatabase.PushSingleton(database)
yield database
units.UnitDatabase.PopSingleton()
def unit_database_start_units():
database = CreateUnitDatabaseStartUnits()
units.UnitDatabase.PushSingleton(database)
yield database
units.UnitDatabase.PopSingleton()
def unit_database_custom_conversion():
database = CreateUnitDatabaseCustomConversion()
units.UnitDatabase.PushSingleton(database)
yield database
units.UnitDatabase.PopSingleton()
def unit_database_len_pressure():
database = CreateUnitDatabaseLenPressure()
units.UnitDatabase.PushSingleton(database)
yield database
units.UnitDatabase.PopSingleton()
def unit_database_len_temp():
database = CreateUnitDatabaseLenTemp()
units.UnitDatabase.PushSingleton(database)
yield database
units.UnitDatabase.PopSingleton()
def unit_database_empty():
database = units.UnitDatabase()
units.UnitDatabase.PushSingleton(database)
yield database
units.UnitDatabase.PopSingleton()