Created
April 1, 2019 07:29
-
-
Save briandeheus/55a9141a767889e210c9a7279aee5a4c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import yaml | |
| import argparse | |
| parser = argparse.ArgumentParser() | |
| parser.add_argument('--config', type=str, default='settings.yaml') | |
| args = parser.parse_args() | |
| __settings = yaml.safe_load(open(args.config, 'r')) | |
| def get(name, default=None): | |
| keys = name.split('.') | |
| val = __settings | |
| for key in keys: | |
| val = val.get(key) | |
| if val is None: | |
| return default | |
| return val |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment