# This is used by Environment to populate its env
# Due to circular dependencies it cannot reference other parts of bldr
import toml

def default(dotbldr_path: str) -> dict:
    dep = {
        'config': toml.load(f"{dotbldr_path}/dependency.toml"),
        'lock': toml.load(f"{dotbldr_path}/dependency.lock.toml")
    }
    return dep

def save_lock(dotbldr_path: str, lock_env: dict):
    with open(f"{dotbldr_path}/dependency.lock.toml", 'w') as toml_file:
        return toml.dump(lock_env, toml_file)

def save_config(dotbldr_path: str, config_env: dict):
    with open(f"{dotbldr_path}/dependency.toml", 'w') as toml_file:
        return toml.dump(config_env, toml_file)
[((7, 18, 7, 62), 'toml.load', 'toml.load', ({(7, 28, 7, 61): 'f"""{dotbldr_path}/dependency.toml"""'}, {}), "(f'{dotbldr_path}/dependency.toml')", False, 'import toml\n'), ((8, 16, 8, 65), 'toml.load', 'toml.load', ({(8, 26, 8, 64): 'f"""{dotbldr_path}/dependency.lock.toml"""'}, {}), "(f'{dotbldr_path}/dependency.lock.toml')", False, 'import toml\n'), ((14, 15, 14, 45), 'toml.dump', 'toml.dump', ({(14, 25, 14, 33): 'lock_env', (14, 35, 14, 44): 'toml_file'}, {}), '(lock_env, toml_file)', False, 'import toml\n'), ((18, 15, 18, 47), 'toml.dump', 'toml.dump', ({(18, 25, 18, 35): 'config_env', (18, 37, 18, 46): 'toml_file'}, {}), '(config_env, toml_file)', False, 'import toml\n')]