9 DATAFORMATS_CHANGED = 40
13 """Check policies on dictionary definitions. Return True if checks are fine.""" 18 """Check policies on dictionary updates. Return True if checks are fine.""" 23 with open(args.baseline)
as f:
24 baseline = json.load(f)
26 if args.pr
is not None:
27 with open(args.pr)
as f:
33 return POLICY_VIOLATION
35 print(
"Changes in persistable data formats")
36 return DATAFORMATS_CHANGED
38 return POLICY_VIOLATION
41 return POLICY_VIOLATION
45 if __name__ ==
"__main__":
46 parser = argparse.ArgumentParser(description=f
"Check dictionary policies of the JSON output of edmDumpClassVersion. If one JSON document is given (--baseline; e.g. in IBs), only the dictionary definition policy checks are done. If two JSON documents are given (--baseline and --pr; e.g. in PR tests), the dictionary definition policy checks are done on the --pr document, and, in addition, if any persistable data formats are changed, additional checks are done to ensure the dictionary update is done properly. Exits with {NO_CHANGES} if there are no changes to persistent data formats. Exits with {DATAFORMATS_CHANGED} if persistent data formats are changed, and the update complies with data format policies. Exits with {POLICY_VIOLATION} if some data format policy is violated. Other exit codes (e.g. 1, 2) denote some failure in the script itself.")
48 parser.add_argument(
"--baseline", required=
True, type=str, help=
"JSON file for baseline")
49 parser.add_argument(
"--pr", type=str, help=
"JSON file for baseline+PR")
50 parser.add_argument(
"--transientDataFormatPackage", action=
"store_true", help=
"The JSON files are for a package that can have only transient data formats")
52 args = parser.parse_args()
def updatePolicyChecks(reference, update)
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
def policyChecks(document)