mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-10 17:58:20 +00:00
Run black, and add black to a "qa" target to make it a standardised process.
This commit is contained in:
@@ -4,13 +4,13 @@ def get_primitive_type(attribute_or_data_type):
|
||||
else:
|
||||
data_type = str(attribute_or_data_type)
|
||||
if data_type.find("<type") == 0:
|
||||
return get_primitive_type(data_type[data_type[1:].find("<")+1:])
|
||||
return get_primitive_type(data_type[data_type[1:].find("<") + 1 :])
|
||||
elif data_type.find("<list") == 0:
|
||||
return ("list", get_primitive_type(data_type[data_type[1:].find("<")+1:]))
|
||||
return ("list", get_primitive_type(data_type[data_type[1:].find("<") + 1 :]))
|
||||
elif data_type.find("<set") == 0:
|
||||
return ("set", get_primitive_type(data_type[data_type[1:].find("<")+1:]))
|
||||
return ("set", get_primitive_type(data_type[data_type[1:].find("<") + 1 :]))
|
||||
elif data_type.find("<select") == 0:
|
||||
select_definition = data_type[data_type.find("(")+1:data_type.find(")")].split("|")
|
||||
select_definition = data_type[data_type.find("(") + 1 : data_type.find(")")].split("|")
|
||||
select_types = [get_primitive_type(d.strip()) for d in select_definition]
|
||||
return ("select", tuple(select_types))
|
||||
elif "<entity" in data_type:
|
||||
|
||||
@@ -48,11 +48,13 @@ def serialise_applied_value(applied_value):
|
||||
def unserialise_cost_value(formula, cost_value):
|
||||
unserialiser = CostValueUnserialiser()
|
||||
result = unserialiser.parse(formula)
|
||||
|
||||
def map_element_to_result(element, result):
|
||||
result["ifc"] = element
|
||||
for i, component in enumerate(result.get("Components", [])):
|
||||
if element.Components and i < len(element.Components):
|
||||
map_element_to_result(element.Components[i], result["Components"][i])
|
||||
|
||||
map_element_to_result(cost_value, result)
|
||||
return result
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import numpy as np
|
||||
|
||||
|
||||
def a2p(o, z, x):
|
||||
y = np.cross(z, x)
|
||||
r = np.eye(4)
|
||||
|
||||
@@ -26,6 +26,7 @@ def get_subtypes(entity):
|
||||
for subtype in declaration.subtypes():
|
||||
results.extend(get_classes(subtype))
|
||||
return results
|
||||
|
||||
return get_classes(entity)
|
||||
|
||||
|
||||
@@ -47,7 +48,6 @@ def reassign_class(ifc_file, element, new_class):
|
||||
return new_element
|
||||
|
||||
|
||||
|
||||
class Migrator:
|
||||
def __init__(self):
|
||||
self.migrated_ids = {}
|
||||
@@ -213,7 +213,7 @@ class Migrator:
|
||||
"TheOrganization": new_file.create_entity(
|
||||
"IfcOrganization", **{"Name": "IfcOpenShell Migrator"}
|
||||
),
|
||||
}
|
||||
},
|
||||
),
|
||||
"OwningApplication": new_file.create_entity(
|
||||
"IfcApplication",
|
||||
@@ -224,10 +224,10 @@ class Migrator:
|
||||
"Version": "Works for me",
|
||||
"ApplicationFullName": "IfcOpenShell Migrator",
|
||||
"ApplicationIdentifier": "IfcOpenShell Migrator",
|
||||
}
|
||||
},
|
||||
),
|
||||
"ChangeAction": "NOCHANGE",
|
||||
"CreationDate": int(time.time()),
|
||||
}
|
||||
},
|
||||
)
|
||||
return self.default_entities[attribute.name()]
|
||||
|
||||
@@ -114,7 +114,7 @@ si_type_names = {
|
||||
"PRESSUREUNIT": "PASCAL",
|
||||
"RADIOACTIVITYUNIT": "BECQUEREL",
|
||||
"SOLIDANGLEUNIT": "STERADIAN",
|
||||
"THERMODYNAMICTEMPERATUREUNIT": "KELVIN", # Or, DEGREE_CELSIUS, but this is a quirk of IFC
|
||||
"THERMODYNAMICTEMPERATUREUNIT": "KELVIN", # Or, DEGREE_CELSIUS, but this is a quirk of IFC
|
||||
"TIMEUNIT": "SECOND",
|
||||
"VOLUMEUNIT": "CUBIC_METRE",
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user