75 corrs_old = old[
"corrections"]
76 names_vers_old = { (c[
"name"], c[
"version"])
for c
in corrs_old }
77 names_old = { nv[0]
for nv
in names_vers_old }
78 corrs_new = new[
"corrections"]
79 names_vers_new = { (c[
"name"], c[
"version"])
for c
in corrs_new }
82 report.corrs_removed = names_vers_old - names_vers_new
84 for corr
in corrs_new:
86 vers = corr[
"version"]
89 if name
not in names_old:
90 report.corr_added.append(correctionlib.schemav2.Correction.parse_obj(corr))
94 corrs_old_same_name = [ c
for c
in corrs_old
if c[
"name"] == name ]
97 old_same_version = next((c
for c
in corrs_old_same_name
if c[
"version"] == vers),
None)
102 report.corr_version_error.add((name, vers))
106 old_max_version = max(corrs_old_same_name, key=
lambda c: c[
"version"])
107 if old_max_version[
"version"] > vers:
108 report.corr_version_error.add((name, vers))
110 report.corr_updated.append(
111 (correctionlib.schemav2.Correction.parse_obj(old_max_version),
112 correctionlib.schemav2.Correction.parse_obj(corr)))