How to use envyaml - 2 common examples

To help you get started, we’ve selected a few envyaml 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 DocNow / diffengine / test_diffengine.py View on Github external
from diffengine.exceptions.sendgrid import (
    SendgridConfigNotFoundError,
    AlreadyEmailedError,
    SendgridArchiveUrlNotFoundError,
)
from diffengine.exceptions.twitter import (
    TwitterConfigNotFoundError,
    TokenNotFoundError,
    AlreadyTweetedError,
    TwitterAchiveUrlNotFoundError,
    UpdateStatusError,
)

test_home = "test"
test_env_file = ".env"
test_config = EnvYAML(
    "config-test.yaml",
    env_file=test_env_file if os.path.isfile(test_env_file) else None,
)

if os.path.isdir(test_home):
    shutil.rmtree(test_home)


def test_version():
    assert setup.version in UA


def test_fingerprint():
    assert _fingerprint("foo bar") == "foobar"
    assert _fingerprint("foo bar\nbaz") == "foobarbaz"
    assert _fingerprint("foo<br>bar") == "foobar"
github DocNow / diffengine / diffengine / __init__.py View on Github external
def load_config(prompt=True):
    global config
    config_file = os.path.join(home, "config.yaml")
    env_file = home_path(".env")
    if os.path.isfile(config_file):
        config = EnvYAML(
            config_file, env_file=env_file if os.path.isfile(env_file) else None
        )
    else:
        if not os.path.isdir(home):
            os.makedirs(home)
        if prompt:
            config = get_initial_config()
        yaml.dump(config, open(config_file, "w"), default_flow_style=False)
    return config

envyaml

Simple YAML configuration file parser with easy access for structured data

MIT
Latest version published 3 years ago

Package Health Score

61 / 100
Full package analysis

Popular envyaml functions

Similar packages