INNER CODE UNIT · Python

read_file

usnistgov/OSCAL · src/utils/oscal-content-validator.py:23

def read_file(filename, ftype):
    with io.open(filename, 'r', encoding="utf-8") as f:
        if ftype == "json":
            filedata = json.load(f)
        if ftype == "yaml":
            yaml = YAML()
            filedata = yaml.load(f)
        else:
            filedata = f.read()
    return filedata, ftype


def parse_args():
    parser = argparse.ArgumentParser()
    parser.add_argument("-s", "--oscal-schema", default=False, required=True,
                        action="store", dest="oscal_schema",
                        help="An OSCAL schema file.")
    parser.add_argument("-f", "--oscal-file", default=False, required=True,

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…