From 65f9a745a344bc6269ab0f31f7727aaa1e90b92d Mon Sep 17 00:00:00 2001 From: Andrej730 Date: Mon, 23 Sep 2024 19:33:16 +0500 Subject: [PATCH] black . --- src/bonsai/bonsai/bim/module/root/prop.py | 4 +++- src/ifc5d/ifc5d/ifc2json.py | 3 ++- .../ifcopenshell/util/classification.py | 7 +++++-- src/ifcopenshell-python/ifcopenshell/util/element.py | 7 ++++--- 4 files changed, 14 insertions(+), 7 deletions(-) diff --git a/src/bonsai/bonsai/bim/module/root/prop.py b/src/bonsai/bonsai/bim/module/root/prop.py index 9c49ae0f75..1fa48af61c 100644 --- a/src/bonsai/bonsai/bim/module/root/prop.py +++ b/src/bonsai/bonsai/bim/module/root/prop.py @@ -121,7 +121,9 @@ class BIMRootProperties(PropertyGroup): ifc_class: EnumProperty(items=get_ifc_classes, name="Class", update=refresh_predefined_types) ifc_predefined_type: EnumProperty(items=get_ifc_predefined_types, name="Predefined Type", default=None) ifc_userdefined_type: StringProperty(name="Userdefined Type") - representation_template: bpy.props.EnumProperty(items=get_representation_template, name="Representation Template", default=0) + representation_template: bpy.props.EnumProperty( + items=get_representation_template, name="Representation Template", default=0 + ) relating_class_object: PointerProperty( type=bpy.types.Object, name="Copy Class", diff --git a/src/ifc5d/ifc5d/ifc2json.py b/src/ifc5d/ifc5d/ifc2json.py index 0f51187223..f0bf63159d 100644 --- a/src/ifc5d/ifc5d/ifc2json.py +++ b/src/ifc5d/ifc5d/ifc2json.py @@ -8,6 +8,7 @@ from ifcopenshell.util.classification import get_references CostItem = dict[str, Any] + class ifc5D2json: def __init__(self): self.json: str = None @@ -72,7 +73,7 @@ class ifc5D2json: del data["ReferencedSource"] results.append(data) return results - + def check_if_cost_item_is_sum(self, cost_item: ifcopenshell.entity_instance) -> bool: cost_values = [] if cost_item.is_a("IfcCostItem"): diff --git a/src/ifcopenshell-python/ifcopenshell/util/classification.py b/src/ifcopenshell-python/ifcopenshell/util/classification.py index 5d2f98809d..5d095a4052 100644 --- a/src/ifcopenshell-python/ifcopenshell/util/classification.py +++ b/src/ifcopenshell-python/ifcopenshell/util/classification.py @@ -66,6 +66,7 @@ def get_inherited_references(reference: Optional[ifcopenshell.entity_instance]) reference = reference.ReferencedSource return results + def get_classification_data(file: ifcopenshell.file) -> Optional[tuple[list[dict], str]]: if not file or not file.by_type("IfcClassification"): return [], "" @@ -77,8 +78,10 @@ def get_classification_data(file: ifcopenshell.file) -> Optional[tuple[list[dict del data["ReferencedSource"] data["referenced_source"] = reference.ReferencedSource.id() if reference.ReferencedSource else None data["has_references"] = bool(reference.HasReferences) - data["references"] = [process_references(ref) for ref in reference.HasReferences] if reference.HasReferences else [] + data["references"] = ( + [process_references(ref) for ref in reference.HasReferences] if reference.HasReferences else [] + ) return data classification_data = [process_references(reference) for reference in classification.HasReferences] - return classification_data, classification_name \ No newline at end of file + return classification_data, classification_name diff --git a/src/ifcopenshell-python/ifcopenshell/util/element.py b/src/ifcopenshell-python/ifcopenshell/util/element.py index 0a4fe923e3..3859b21810 100644 --- a/src/ifcopenshell-python/ifcopenshell/util/element.py +++ b/src/ifcopenshell-python/ifcopenshell/util/element.py @@ -1631,10 +1631,11 @@ def copy_deep( new[i] = attribute return new + def has_property(product: ifcopenshell.entity_instance, property_name: str) -> bool: """ Check if a product has a property with a given name. - + :param product: The IFC product :type product: ifcopenshell.entity_instance :param property_name: The property name @@ -1645,11 +1646,11 @@ def has_property(product: ifcopenshell.entity_instance, property_name: str) -> b Example: .. code:: python - + product = file.by_type("IfcWall")[0] has_property = ifcopenshell.util.element.has_property(product, "NetArea") """ if not property_name: return True qtos = get_psets(product, qtos_only=True) - return any(property_name in quantities.keys() for quantities in qtos.values()) \ No newline at end of file + return any(property_name in quantities.keys() for quantities in qtos.values())