You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
PurpleDome/pydantic_test.py

30 lines
660 B
Python

#!/usr/bin/env python3
import argparse
import yaml
from app.config_verifier import MainConfig
def load(filename):
with open(filename) as fh:
data = yaml.safe_load(fh)
return MainConfig(**data)
def create_parser():
""" Creates the parser for the command line arguments"""
parser = argparse.ArgumentParser("Parse a config file and verifies it")
parser.add_argument('--filename', default="experiment_ng.yaml")
return parser
if __name__ == "__main__":
arguments = create_parser().parse_args()
r = load(arguments.filename)
print(r)
print(r.caldera.apikey)
# print(r.blarg)
print(dir(r.__dict__))