check-whitespace: normalize json files

This commit is contained in:
Andrej730
2026-09-14 11:39:30 +05:00
parent 0c12d2334b
commit 3e88479277
26 changed files with 38 additions and 25 deletions
+1
View File
@@ -297,6 +297,7 @@ PATTERNS = (
"*/CMakeLists.txt", "*/CMakeLists.txt",
"*.yml", "*.yml",
"*.yaml", "*.yaml",
"*.json",
"*.ts", "*.ts",
"*.js", "*.js",
"*.bat", "*.bat",
@@ -19,4 +19,3 @@
} }
] ]
} }
@@ -81,6 +81,7 @@ def generate_ifc4_entity_map(filepath, schema_name, manual_corrections={}):
schema_version = schema_name.lower().strip("ifc") schema_version = schema_name.lower().strip("ifc")
with open(f"src/ifcopenshell-python/ifcopenshell/util/entity_to_type_map_{schema_version}.json", "w") as f: with open(f"src/ifcopenshell-python/ifcopenshell/util/entity_to_type_map_{schema_version}.json", "w") as f:
json.dump(entity_to_type_map, f, indent=4, sort_keys=True) json.dump(entity_to_type_map, f, indent=4, sort_keys=True)
f.write("\n")
return entity_to_type_map return entity_to_type_map
@@ -126,6 +127,7 @@ def generate_ifc2x3_entity_map():
with open("src/ifcopenshell-python/ifcopenshell/util/entity_to_type_map_2x3.json", "w") as f: with open("src/ifcopenshell-python/ifcopenshell/util/entity_to_type_map_2x3.json", "w") as f:
json.dump(entity_to_type_map, f, indent=4, sort_keys=True) json.dump(entity_to_type_map, f, indent=4, sort_keys=True)
f.write("\n")
return entity_to_type_map return entity_to_type_map
@@ -298,6 +298,7 @@ class DocExtractor:
with open(BASE_MODULE_PATH / "schema/ifc2x3_property_sets_site_domains.json", "w", encoding="utf-8") as fo: with open(BASE_MODULE_PATH / "schema/ifc2x3_property_sets_site_domains.json", "w", encoding="utf-8") as fo:
print(f"{len(property_sets_domains)} property sets domains were parsed from the website") print(f"{len(property_sets_domains)} property sets domains were parsed from the website")
json.dump(property_sets_domains, fo, sort_keys=True, indent=4) json.dump(property_sets_domains, fo, sort_keys=True, indent=4)
fo.write("\n")
def setup_ifc2x3_reference_lookup(self): def setup_ifc2x3_reference_lookup(self):
# setup references look up tables to convert property hrefs to actual data paths # setup references look up tables to convert property hrefs to actual data paths
@@ -414,6 +415,7 @@ class DocExtractor:
with open(BASE_MODULE_PATH / "schema/ifc2x3_entities.json", "w", encoding="utf-8") as fo: with open(BASE_MODULE_PATH / "schema/ifc2x3_entities.json", "w", encoding="utf-8") as fo:
print(f"{len(entities_dict)} entities parsed") print(f"{len(entities_dict)} entities parsed")
json.dump(entities_dict, fo, sort_keys=True, indent=4) json.dump(entities_dict, fo, sort_keys=True, indent=4)
fo.write("\n")
def extract_ifc2x3_property_sets(self): def extract_ifc2x3_property_sets(self):
property_sets_dict = dict() property_sets_dict = dict()
@@ -534,6 +536,7 @@ class DocExtractor:
with open(BASE_MODULE_PATH / "schema/ifc2x3_properties.json", "w", encoding="utf-8") as fo: with open(BASE_MODULE_PATH / "schema/ifc2x3_properties.json", "w", encoding="utf-8") as fo:
print(f"{len(property_sets_dict)} property sets parsed") print(f"{len(property_sets_dict)} property sets parsed")
json.dump(property_sets_dict, fo, sort_keys=True, indent=4) json.dump(property_sets_dict, fo, sort_keys=True, indent=4)
fo.write("\n")
def extract_ifc2x3_types(self): def extract_ifc2x3_types(self):
types_dict = dict() types_dict = dict()
@@ -573,6 +576,7 @@ class DocExtractor:
with open(BASE_MODULE_PATH / "schema/ifc2x3_types.json", "w", encoding="utf-8") as fo: with open(BASE_MODULE_PATH / "schema/ifc2x3_types.json", "w", encoding="utf-8") as fo:
print(f"{len(types_dict)} ifc types parsed") print(f"{len(types_dict)} ifc types parsed")
json.dump(types_dict, fo, sort_keys=True, indent=4) json.dump(types_dict, fo, sort_keys=True, indent=4)
fo.write("\n")
def extract_ifc4(self): def extract_ifc4(self):
print("Parsing data for Ifc4.0.2.1") print("Parsing data for Ifc4.0.2.1")
@@ -623,6 +627,7 @@ class DocExtractor:
with open(BASE_MODULE_PATH / "schema/ifc4_property_sets_site_domains.json", "w", encoding="utf-8") as fo: with open(BASE_MODULE_PATH / "schema/ifc4_property_sets_site_domains.json", "w", encoding="utf-8") as fo:
print(f"{len(property_sets_domains)} property sets domains were parsed from the website") print(f"{len(property_sets_domains)} property sets domains were parsed from the website")
json.dump(property_sets_domains, fo, sort_keys=True, indent=4) json.dump(property_sets_domains, fo, sort_keys=True, indent=4)
fo.write("\n")
def setup_ifc4_reference_lookup(self): def setup_ifc4_reference_lookup(self):
references_paths_lookup = dict() references_paths_lookup = dict()
@@ -735,6 +740,7 @@ class DocExtractor:
with open(BASE_MODULE_PATH / "schema/ifc4_entities.json", "w", encoding="utf-8") as fo: with open(BASE_MODULE_PATH / "schema/ifc4_entities.json", "w", encoding="utf-8") as fo:
print(f"{len(entities_dict)} entities parsed") print(f"{len(entities_dict)} entities parsed")
json.dump(entities_dict, fo, sort_keys=True, indent=4) json.dump(entities_dict, fo, sort_keys=True, indent=4)
fo.write("\n")
def extract_ifc4_property_sets(self): def extract_ifc4_property_sets(self):
# function parses both property and quantity sets # function parses both property and quantity sets
@@ -872,6 +878,7 @@ class DocExtractor:
with open(BASE_MODULE_PATH / "schema/ifc4_properties.json", "w", encoding="utf-8") as fo: with open(BASE_MODULE_PATH / "schema/ifc4_properties.json", "w", encoding="utf-8") as fo:
print(f"{len(property_sets_dict)} property sets parsed") print(f"{len(property_sets_dict)} property sets parsed")
json.dump(property_sets_dict, fo, sort_keys=True, indent=4) json.dump(property_sets_dict, fo, sort_keys=True, indent=4)
fo.write("\n")
def extract_ifc4_types(self): def extract_ifc4_types(self):
types_dict = dict() types_dict = dict()
@@ -912,6 +919,7 @@ class DocExtractor:
with open(BASE_MODULE_PATH / "schema/ifc4_types.json", "w", encoding="utf-8") as fo: with open(BASE_MODULE_PATH / "schema/ifc4_types.json", "w", encoding="utf-8") as fo:
print(f"{len(types_dict)} ifc types parsed") print(f"{len(types_dict)} ifc types parsed")
json.dump(types_dict, fo, sort_keys=True, indent=4) json.dump(types_dict, fo, sort_keys=True, indent=4)
fo.write("\n")
def extract_ifc4x3(self): def extract_ifc4x3(self):
print("Parsing data for Ifc4.3.0.1") print("Parsing data for Ifc4.3.0.1")
@@ -1029,11 +1037,13 @@ class DocExtractor:
with open(BASE_MODULE_PATH / "schema/ifc4x3_entities.json", "w", encoding="utf-8") as fo: with open(BASE_MODULE_PATH / "schema/ifc4x3_entities.json", "w", encoding="utf-8") as fo:
print(f"{len(entities_dict)} entities parsed") print(f"{len(entities_dict)} entities parsed")
json.dump(entities_dict, fo, sort_keys=True, indent=4) json.dump(entities_dict, fo, sort_keys=True, indent=4)
fo.write("\n")
# export entities data # export entities data
with open(BASE_MODULE_PATH / "schema/ifc4x3_types.json", "w", encoding="utf-8") as fo: with open(BASE_MODULE_PATH / "schema/ifc4x3_types.json", "w", encoding="utf-8") as fo:
print(f"{len(types_dict)} ifc types parsed") print(f"{len(types_dict)} ifc types parsed")
json.dump(types_dict, fo, sort_keys=True, indent=4) json.dump(types_dict, fo, sort_keys=True, indent=4)
fo.write("\n")
def extract_ifc4x3_property_sets(self): def extract_ifc4x3_property_sets(self):
pset_data_zip = IFC4x3_HTML_LOCATION / "IFC/RELEASE/IFC4x3/HTML/annex-a-psd.zip" pset_data_zip = IFC4x3_HTML_LOCATION / "IFC/RELEASE/IFC4x3/HTML/annex-a-psd.zip"
@@ -1078,6 +1088,7 @@ class DocExtractor:
with open(BASE_MODULE_PATH / "schema/ifc4x3_properties.json", "w", encoding="utf-8") as fo: with open(BASE_MODULE_PATH / "schema/ifc4x3_properties.json", "w", encoding="utf-8") as fo:
print(f"{len(property_sets_dict)} property sets parsed") print(f"{len(property_sets_dict)} property sets parsed")
json.dump(property_sets_dict, fo, sort_keys=True, indent=4) json.dump(property_sets_dict, fo, sort_keys=True, indent=4)
fo.write("\n")
shutil.rmtree(pset_data_location) shutil.rmtree(pset_data_location)