Run black, and add black to a "qa" target to make it a standardised process.

This commit is contained in:
Dion Moult
2021-09-09 21:27:23 +10:00
parent 95903c965d
commit 865c0f4895
305 changed files with 1968 additions and 1143 deletions
@@ -14,12 +14,15 @@ class Usecase:
def execute(self):
if not self.settings["structural_analysis_model"].IsGroupedBy:
return self.file.create_entity("IfcRelAssignsToGroup", **{
"GlobalId": ifcopenshell.guid.new(),
"OwnerHistory": ifcopenshell.api.run("owner.create_owner_history", self.file),
"RelatedObjects": [self.settings["product"]],
"RelatingGroup": self.settings["structural_analysis_model"]
})
return self.file.create_entity(
"IfcRelAssignsToGroup",
**{
"GlobalId": ifcopenshell.guid.new(),
"OwnerHistory": ifcopenshell.api.run("owner.create_owner_history", self.file),
"RelatedObjects": [self.settings["product"]],
"RelatingGroup": self.settings["structural_analysis_model"],
}
)
rel = self.settings["structural_analysis_model"].IsGroupedBy[0]
related_objects = set(rel.RelatedObjects) or set()
related_objects.add(self.settings["product"])
@@ -155,7 +155,9 @@ class Data:
if connection.is_a("IfcStructuralCurveConnection"):
data["Axis"] = data["Axis"].id() if data["Axis"] is not None else None
if connection.is_a("IfcStructuralPointConnection"):
data["ConditionCoordinateSystem"] = data["ConditionCoordinateSystem"].id() if data["ConditionCoordinateSystem"] is not None else None
data["ConditionCoordinateSystem"] = (
data["ConditionCoordinateSystem"].id() if data["ConditionCoordinateSystem"] is not None else None
)
data["ConnectsStructuralMembers"] = []
@@ -238,7 +240,7 @@ class Data:
data["Representation"] = data["Representation"].id() if data["Representation"] is not None else None
if member.is_a("IfcStructuralCurveMember"):
data["Axis"] = data["Axis"].id() if data["Axis"] is not None else None
data["ConnectsStructuralActivities"] = []
data["ConnectedBy"] = []
@@ -249,6 +251,5 @@ class Data:
for rel in member.ConnectedBy or []:
cls.load_connects_structural_member(rel)
data["ConnectedBy"].append(rel.id())
cls.members[member.id()] = data
@@ -1,10 +1,7 @@
class Usecase:
def __init__(self, file, **settings):
self.file = file
self.settings = {
"structural_analysis_model": None,
"attributes": {}
}
self.settings = {"structural_analysis_model": None, "attributes": {}}
for key, value in settings.items():
self.settings[key] = value
@@ -1,10 +1,7 @@
class Usecase:
def __init__(self, file, **settings):
self.file = file
self.settings = {
"condition": None,
"attributes": {}
}
self.settings = {"condition": None, "attributes": {}}
for key, value in settings.items():
self.settings[key] = value
@@ -11,7 +11,7 @@ class Usecase:
ccs = self.file.createIfcAxis2Placement3D(point, None, None)
self.settings["structural_item"].ConditionCoordinateSystem = ccs
print(ccs)
ccs = self.settings["structural_item"].ConditionCoordinateSystem
print("use case")
print(ccs)
@@ -20,4 +20,4 @@ class Usecase:
ccs.Axis = self.file.createIfcDirection(self.settings["axis"])
if ccs.RefDirection and len(self.file.get_inverse(ccs.RefDirection)) == 1:
self.file.remove(ccs.RefDirection)
ccs.RefDirection = self.file.createIfcDirection(self.settings["ref_direction"])
ccs.RefDirection = self.file.createIfcDirection(self.settings["ref_direction"])
@@ -1,10 +1,7 @@
class Usecase:
def __init__(self, file, **settings):
self.file = file
self.settings = {
"structural_load": None,
"attributes": {}
}
self.settings = {"structural_load": None, "attributes": {}}
for key, value in settings.items():
self.settings[key] = value
@@ -16,4 +16,3 @@ class Usecase:
**{"connection": self.settings["relation"].RelatedStructuralConnection}
)
self.file.remove(self.settings["relation"])