Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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"
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