Skip to content

Commit cb259c3

Browse files
meldraprogval
authored andcommitted
Further refactoring to address multiple issues:
- There are multiple Identifier properties with different parents. These are now addressed independently. - A property with a change between versions for both type and description were not correctly limiting the versions. I believe this is correctly happening now.
1 parent 0eb4764 commit cb259c3

1 file changed

Lines changed: 9 additions & 3 deletions

File tree

scripts/properties_to_json.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@
5858
import csv
5959
import json
6060
import pathlib
61+
import re
6162

6263
DIR = pathlib.Path(__file__).parent.parent
6364
CSV_PATH = DIR / "data/properties_description/"
@@ -94,15 +95,20 @@
9495
# values from newer versions of properties_description.json take precedence
9596
# over new ones.
9697
# update the versions for these here and break to avoid duplicate rows
97-
if item["Property"] == existing_item["Property"]:
98-
if item["Type"] != existing_item["Type"]:
98+
if item["Property"] == existing_item["Property"] and item["Parent Type"] == existing_item["Parent Type"]:
99+
if re.sub("\\W", "", item["Type"]).lower() != re.sub("\\W", "", existing_item["Type"]).lower():
100+
item["versions"] = [version]
101+
json_items.append(item)
102+
elif item["Type"] == existing_item["Type"]:
99103
item["Type"] = existing_item["Type"]
100104
if version not in existing_item["versions"]:
101105
existing_item["versions"].append(version)
102-
if item["Description"] != existing_item["Description"]:
106+
107+
if item["Description"] != existing_item["Description"] and item["Type"] == existing_item["Type"]:
103108
item["Description"] = existing_item["Description"]
104109
if version not in existing_item["versions"]:
105110
existing_item["versions"].append(version)
111+
106112
break
107113

108114
else:

0 commit comments

Comments
 (0)