From 1608677d403303ef21a14ff76f12870fcda22b02 Mon Sep 17 00:00:00 2001 From: Andrej Date: Tue, 10 Jun 2025 11:02:54 +0500 Subject: [PATCH] ifcopenshell.api.run to use explicit kwargs instead of unpacking --- src/bonsai/bonsai/bim/module/cost/operator.py | 6 +- .../bonsai/bim/module/group/operator.py | 2 +- .../bonsai/bim/module/material/operator.py | 11 ++-- src/bonsai/bonsai/bim/module/model/product.py | 3 +- src/bonsai/bonsai/bim/module/model/slab.py | 3 +- .../bim/module/pset_template/operator.py | 18 +++--- .../bonsai/bim/module/structural/operator.py | 16 ++--- src/bonsai/bonsai/core/structural.py | 20 +++---- src/ifc4d/ifc4d/common.py | 19 +++--- src/ifc4d/ifc4d/msp2ifc.py | 6 +- .../ifccityjson/cityjson2ifc/cityjson2ifc.py | 7 +-- .../api/aggregate/assign_object.py | 4 +- .../api/aggregate/unassign_object.py | 2 +- .../api/attribute/edit_attributes.py | 2 +- .../api/classification/add_reference.py | 2 +- .../api/classification/remove_reference.py | 2 +- .../api/constraint/assign_constraint.py | 2 +- .../api/constraint/unassign_constraint.py | 2 +- .../api/control/assign_control.py | 2 +- .../api/control/unassign_control.py | 2 +- .../api/document/unassign_document.py | 2 +- .../api/geometry/assign_representation.py | 2 +- .../api/geometry/edit_object_placement.py | 2 +- .../ifcopenshell/api/group/assign_group.py | 2 +- .../ifcopenshell/api/group/unassign_group.py | 2 +- .../api/library/unassign_reference.py | 2 +- .../api/material/assign_material.py | 2 +- .../api/material/unassign_material.py | 2 +- .../ifcopenshell/api/nest/assign_object.py | 4 +- .../ifcopenshell/api/nest/change_nest.py | 2 +- .../ifcopenshell/api/nest/unassign_object.py | 2 +- .../ifcopenshell/api/owner/assign_actor.py | 2 +- .../ifcopenshell/api/owner/unassign_actor.py | 2 +- .../api/project/assign_declaration.py | 4 +- .../api/project/unassign_declaration.py | 2 +- .../api/resource/assign_resource.py | 2 +- .../api/resource/unassign_resource.py | 2 +- .../api/sequence/add_work_schedule.py | 6 +- .../api/sequence/assign_process.py | 2 +- .../api/sequence/assign_product.py | 2 +- .../api/sequence/create_baseline.py | 2 +- .../api/sequence/duplicate_task.py | 2 +- .../api/spatial/assign_container.py | 4 +- .../api/spatial/dereference_structure.py | 2 +- .../api/system/assign_flow_control.py | 2 +- .../ifcopenshell/api/system/assign_port.py | 2 +- .../api/system/unassign_flow_control.py | 2 +- .../ifcopenshell/api/system/unassign_port.py | 2 +- .../ifcopenshell/api/type/assign_type.py | 4 +- .../ifcopenshell/api/type/unassign_type.py | 2 +- src/opencdeserver/api/app/repository/bcf.py | 2 +- .../api/app/repository/documents.py | 60 ++++++++----------- 52 files changed, 118 insertions(+), 147 deletions(-) diff --git a/src/bonsai/bonsai/bim/module/cost/operator.py b/src/bonsai/bonsai/bim/module/cost/operator.py index 3a273a0fe0..f1322cde7c 100644 --- a/src/bonsai/bonsai/bim/module/cost/operator.py +++ b/src/bonsai/bonsai/bim/module/cost/operator.py @@ -848,10 +848,8 @@ class ReorderCostItem(bpy.types.Operator, tool.Ifc.Operator): def _execute(self, context): ifcopenshell.api.nest.reorder_nesting( tool.Ifc.get(), - **{ - "item": tool.Ifc.get().by_id(self.cost_item), - "new_index": self.new_index, - }, + item=tool.Ifc.get().by_id(self.cost_item), + new_index=self.new_index, ) tool.Cost.load_cost_schedule_tree() diff --git a/src/bonsai/bonsai/bim/module/group/operator.py b/src/bonsai/bonsai/bim/module/group/operator.py index 80120da77d..76271253ec 100644 --- a/src/bonsai/bonsai/bim/module/group/operator.py +++ b/src/bonsai/bonsai/bim/module/group/operator.py @@ -140,7 +140,7 @@ class RemoveGroup(bpy.types.Operator, tool.Ifc.Operator): def _execute(self, context): self.file = tool.Ifc.get() - ifcopenshell.api.group.remove_group(self.file, **{"group": self.file.by_id(self.group)}) + ifcopenshell.api.group.remove_group(self.file, group=self.file.by_id(self.group)) bpy.ops.bim.load_groups() return {"FINISHED"} diff --git a/src/bonsai/bonsai/bim/module/material/operator.py b/src/bonsai/bonsai/bim/module/material/operator.py index 1f8626bd7c..04d972900d 100644 --- a/src/bonsai/bonsai/bim/module/material/operator.py +++ b/src/bonsai/bonsai/bim/module/material/operator.py @@ -122,11 +122,12 @@ class AssignParameterizedProfile(bpy.types.Operator, tool.Ifc.Operator): self.file = tool.Ifc.get() profile = ifcopenshell.api.profile.add_parameterized_profile( self.file, - **{"ifc_class": self.ifc_class}, + ifc_class=self.ifc_class, ) ifcopenshell.api.material.assign_profile( self.file, - **{"material_profile": self.file.by_id(self.material_profile), "profile": profile}, + material_profile=self.file.by_id(self.material_profile), + profile=profile, ) bpy.ops.bim.enable_editing_material_set_item(obj=obj.name, material_set_item=self.material_profile) @@ -471,10 +472,8 @@ class RemoveListItem(bpy.types.Operator, tool.Ifc.Operator): self.file = tool.Ifc.get() ifcopenshell.api.material.remove_list_item( self.file, - **{ - "material_list": self.file.by_id(self.list_item_set), - "material_index": self.list_item_index, - }, + material_list=self.file.by_id(self.list_item_set), + material_index=self.list_item_index, ) diff --git a/src/bonsai/bonsai/bim/module/model/product.py b/src/bonsai/bonsai/bim/module/model/product.py index 78e1f35cfb..0ccc4906b6 100644 --- a/src/bonsai/bonsai/bim/module/model/product.py +++ b/src/bonsai/bonsai/bim/module/model/product.py @@ -691,7 +691,8 @@ def generate_box(usecase_path: str, ifc_file: ifcopenshell.file, settings: dict[ ifcopenshell.api.geometry.assign_representation( ifc_file, should_run_listeners=False, - **{"product": product, "representation": new_box}, + product=product, + representation=new_box, ) diff --git a/src/bonsai/bonsai/bim/module/model/slab.py b/src/bonsai/bonsai/bim/module/model/slab.py index a93d4ea0a9..11a4ab1ef5 100644 --- a/src/bonsai/bonsai/bim/module/model/slab.py +++ b/src/bonsai/bonsai/bim/module/model/slab.py @@ -924,7 +924,8 @@ class DrawPolylineSlab(bpy.types.Operator, PolylineOperator, tool.Ifc.Operator): attributes = {"OffsetFromReferenceLine": offset, "DirectionSense": direction_sense} ifcopenshell.api.material.edit_layer_usage( model, - **{"usage": material_set_usage, "attributes": attributes}, + usage=material_set_usage, + attributes=attributes, ) DumbSlabPlaner().regenerate_from_occurence(element, material_set_usage) diff --git a/src/bonsai/bonsai/bim/module/pset_template/operator.py b/src/bonsai/bonsai/bim/module/pset_template/operator.py index 56d363b30c..0711376439 100644 --- a/src/bonsai/bonsai/bim/module/pset_template/operator.py +++ b/src/bonsai/bonsai/bim/module/pset_template/operator.py @@ -84,7 +84,7 @@ class RemovePsetTemplate(bpy.types.Operator, tool.PsetTemplate.PsetTemplateOpera bpy.ops.bim.disable_editing_pset_template() ifcopenshell.api.pset_template.remove_pset_template( self.template_file, - **{"pset_template": self.template_file.by_id(current_pset_template_id)}, + pset_template=self.template_file.by_id(current_pset_template_id), ) self.template_file.write(IfcStore.pset_template_path) bonsai.bim.handler.refresh_ui_data() @@ -170,14 +170,12 @@ class EditPsetTemplate(bpy.types.Operator, tool.PsetTemplate.PsetTemplateOperato props = tool.PsetTemplate.get_pset_template_props() ifcopenshell.api.pset_template.edit_pset_template( IfcStore.pset_template_file, - **{ - "pset_template": IfcStore.pset_template_file.by_id(props.active_pset_template_id), - "attributes": { - "Name": props.active_pset_template.name, - "Description": props.active_pset_template.description, - "TemplateType": props.active_pset_template.template_type, - "ApplicableEntity": props.active_pset_template.applicable_entity, - }, + pset_template=IfcStore.pset_template_file.by_id(props.active_pset_template_id), + attributes={ + "Name": props.active_pset_template.name, + "Description": props.active_pset_template.description, + "TemplateType": props.active_pset_template.template_type, + "ApplicableEntity": props.active_pset_template.applicable_entity, }, ) bpy.ops.bim.disable_editing_pset_template() @@ -250,7 +248,7 @@ class RemovePropTemplate(bpy.types.Operator, tool.PsetTemplate.PsetTemplateOpera def _execute(self, context): ifcopenshell.api.pset_template.remove_prop_template( IfcStore.pset_template_file, - **{"prop_template": IfcStore.pset_template_file.by_id(self.prop_template)}, + prop_template=IfcStore.pset_template_file.by_id(self.prop_template), ) IfcStore.pset_template_file.write(IfcStore.pset_template_path) bonsai.bim.handler.refresh_ui_data() diff --git a/src/bonsai/bonsai/bim/module/structural/operator.py b/src/bonsai/bonsai/bim/module/structural/operator.py index 88e953b02e..8b182d8042 100644 --- a/src/bonsai/bonsai/bim/module/structural/operator.py +++ b/src/bonsai/bonsai/bim/module/structural/operator.py @@ -137,7 +137,7 @@ class RemoveStructuralConnectionCondition(bpy.types.Operator, tool.Ifc.Operator) file = tool.Ifc.get() relation = file.by_id(self.connects_structural_member) connection = relation.RelatedStructuralConnection - ifcopenshell.api.structural.remove_structural_connection_condition(file, **{"relation": relation}) + ifcopenshell.api.structural.remove_structural_connection_condition(file, relation=relation) return {"FINISHED"} @@ -150,7 +150,7 @@ class AddStructuralBoundaryCondition(bpy.types.Operator, tool.Ifc.Operator): def _execute(self, context): file = tool.Ifc.get() connection = file.by_id(self.connection) - ifcopenshell.api.structural.add_structural_boundary_condition(file, **{"connection": connection}) + ifcopenshell.api.structural.add_structural_boundary_condition(file, connection=connection) return {"FINISHED"} @@ -163,7 +163,7 @@ class RemoveStructuralBoundaryCondition(bpy.types.Operator, tool.Ifc.Operator): def _execute(self, context): file = tool.Ifc.get() connection = file.by_id(self.connection) - ifcopenshell.api.structural.remove_structural_boundary_condition(file, **{"connection": connection}) + ifcopenshell.api.structural.remove_structural_boundary_condition(file, connection=connection) return {"FINISHED"} @@ -234,9 +234,7 @@ class EditStructuralBoundaryCondition(bpy.types.Operator, tool.Ifc.Operator): else: attributes[attribute.name] = {"value": attribute.float_value, "type": attribute.enum_value} - ifcopenshell.api.structural.edit_structural_boundary_condition( - file, **{"condition": condition, "attributes": attributes} - ) + ifcopenshell.api.structural.edit_structural_boundary_condition(file, condition=condition, attributes=attributes) bpy.ops.bim.disable_editing_structural_boundary_condition() return {"FINISHED"} @@ -538,10 +536,8 @@ class AssignStructuralLoadCase(bpy.types.Operator, tool.Ifc.Operator): self.file = tool.Ifc.get() ifcopenshell.api.aggregate.assign_object( self.file, - **{ - "relating_object": self.file.by_id(self.work_plan), - "products": [self.file.by_id(self.load_case)], - }, + relating_object=self.file.by_id(self.work_plan), + products=[self.file.by_id(self.load_case)], ) return {"FINISHED"} diff --git a/src/bonsai/bonsai/core/structural.py b/src/bonsai/bonsai/core/structural.py index 63ae292463..f9570a8d15 100644 --- a/src/bonsai/bonsai/core/structural.py +++ b/src/bonsai/bonsai/core/structural.py @@ -39,10 +39,8 @@ def assign_structural_analysis_model( ) -> None: ifc.run( "structural.assign_structural_analysis_model", - **{ - "products": products, - "structural_analysis_model": structural_analysis_model, - }, + products=products, + structural_analysis_model=structural_analysis_model, ) @@ -58,10 +56,8 @@ def edit_structural_analysis_model(ifc: tool.Ifc, structural: tool.Structural) - attributes = structural.get_structural_analysis_model_attributes() ifc.run( "structural.edit_structural_analysis_model", - **{ - "structural_analysis_model": structural.get_active_structural_analysis_model(), - "attributes": attributes, - }, + structural_analysis_model=structural.get_active_structural_analysis_model(), + attributes=attributes, ) structural.load_structural_analysis_models() structural.disable_editing_structural_analysis_model() @@ -91,7 +87,7 @@ def load_structural_analysis_models(structural: tool.Structural) -> None: def remove_structural_analysis_model(ifc: tool.Ifc, structural: tool.Structural, model: int) -> None: ifc.run( "structural.remove_structural_analysis_model", - **{"structural_analysis_model": ifc.get().by_id(model)}, + structural_analysis_model=ifc.get().by_id(model), ) structural.load_structural_analysis_models() @@ -103,8 +99,6 @@ def unassign_structural_analysis_model( ) -> None: ifc.run( "structural.unassign_structural_analysis_model", - **{ - "products": products, - "structural_analysis_model": structural_analysis_model, - }, + products=products, + structural_analysis_model=structural_analysis_model, ) diff --git a/src/ifc4d/ifc4d/common.py b/src/ifc4d/ifc4d/common.py index e54f350ed5..2bb117df9c 100644 --- a/src/ifc4d/ifc4d/common.py +++ b/src/ifc4d/ifc4d/common.py @@ -282,10 +282,8 @@ class ScheduleIfcGenerator: # Seems intermittently crashy - can we investigate for larger files? ifcopenshell.api.control.assign_control( self.file, - **{ - "relating_control": calendar["ifc"], - "related_object": activity["ifc"], - }, + relating_control=calendar["ifc"], + related_object=activity["ifc"], ) ifcopenshell.api.sequence.edit_task_time( self.file, @@ -339,20 +337,19 @@ class ScheduleIfcGenerator: if not parent.get("ifc"): parent["ifc"] = ifcopenshell.api.resource.add_resource( self.file, - **{"ifc_class": "IfcCrewResource", "name": parent["Name"]}, + ifc_class="IfcCrewResource", + name=parent["Name"], ) if parent: resource["ifc"] = ifcopenshell.api.resource.add_resource( self.file, - **{ - "parent_resource": parent["ifc"] if parent else None, - "ifc_class": "IfcCrewResource", - "name": resource["Name"], - }, + parent_resource=parent["ifc"] if parent else None, + ifc_class="IfcCrewResource", + name=resource["Name"], ) else: resource["ifc"] = ifcopenshell.api.resource.add_resource( - self.file, **{"ifc_class": "IfcCrewResource", "name": resource["Name"]} + self.file, ifc_class="IfcCrewResource", name=resource["Name"] ) def create_boilerplate_ifc(self) -> None: diff --git a/src/ifc4d/ifc4d/msp2ifc.py b/src/ifc4d/ifc4d/msp2ifc.py index f8443db588..7ebcb6558f 100644 --- a/src/ifc4d/ifc4d/msp2ifc.py +++ b/src/ifc4d/ifc4d/msp2ifc.py @@ -262,10 +262,8 @@ class MSP2Ifc: if calendar: ifcopenshell.api.control.assign_control( self.file, - **{ - "relating_control": calendar, - "related_object": task["ifc"], - }, + relating_control=calendar, + related_object=task["ifc"], ) ifcopenshell.api.sequence.edit_task( diff --git a/src/ifccityjson/ifccityjson/cityjson2ifc/cityjson2ifc.py b/src/ifccityjson/ifccityjson/cityjson2ifc/cityjson2ifc.py index 50b06e6aa9..441855baf4 100644 --- a/src/ifccityjson/ifccityjson/cityjson2ifc/cityjson2ifc.py +++ b/src/ifccityjson/ifccityjson/cityjson2ifc/cityjson2ifc.py @@ -174,13 +174,12 @@ class Cityjson2ifc: self.IFC_model = ifcopenshell.api.project.create_file() self.IFC_project = ifcopenshell.api.root.create_entity( self.IFC_model, - **{"ifc_class": "IfcProject", "name": self.properties.get("name_project", "My Project")}, + ifc_class="IfcProject", + name=self.properties.get("name_project", "My Project"), ) ifcopenshell.api.unit.assign_unit(self.IFC_model, length={"is_metric": True, "raw": "METERS"}) self.properties["owner_history"] = self.create_owner_history() - self.IFC_representation_context = ifcopenshell.api.context.add_context( - self.IFC_model, **{"context_type": "Model"} - ) + self.IFC_representation_context = ifcopenshell.api.context.add_context(self.IFC_model, context_type="Model") if not self.city_model.has_metadata() or "presentLoDs" not in self.city_model.j["metadata"]: self.city_model.update_metadata() diff --git a/src/ifcopenshell-python/ifcopenshell/api/aggregate/assign_object.py b/src/ifcopenshell-python/ifcopenshell/api/aggregate/assign_object.py index b03f003594..22d027b73b 100644 --- a/src/ifcopenshell-python/ifcopenshell/api/aggregate/assign_object.py +++ b/src/ifcopenshell-python/ifcopenshell/api/aggregate/assign_object.py @@ -123,7 +123,7 @@ def assign_object( related_objects = set(decomposes.RelatedObjects) - products_set if related_objects: decomposes.RelatedObjects = list(related_objects) - ifcopenshell.api.owner.update_owner_history(file, **{"element": decomposes}) + ifcopenshell.api.owner.update_owner_history(file, element=decomposes) else: history = decomposes.OwnerHistory file.remove(decomposes) @@ -133,7 +133,7 @@ def assign_object( # assign elements to a new aggregate if is_decomposed_by: is_decomposed_by.RelatedObjects = list(set(is_decomposed_by.RelatedObjects) | products_set) - ifcopenshell.api.owner.update_owner_history(file, **{"element": is_decomposed_by}) + ifcopenshell.api.owner.update_owner_history(file, element=is_decomposed_by) else: is_decomposed_by = file.create_entity( "IfcRelAggregates", diff --git a/src/ifcopenshell-python/ifcopenshell/api/aggregate/unassign_object.py b/src/ifcopenshell-python/ifcopenshell/api/aggregate/unassign_object.py index 2c0461fe38..37d2815dfb 100644 --- a/src/ifcopenshell-python/ifcopenshell/api/aggregate/unassign_object.py +++ b/src/ifcopenshell-python/ifcopenshell/api/aggregate/unassign_object.py @@ -69,7 +69,7 @@ def unassign_object(file: ifcopenshell.file, products: list[ifcopenshell.entity_ related_objects = set(rel.RelatedObjects) - products if related_objects: rel.RelatedObjects = list(related_objects) - ifcopenshell.api.owner.update_owner_history(file, **{"element": rel}) + ifcopenshell.api.owner.update_owner_history(file, element=rel) else: history = rel.OwnerHistory file.remove(rel) diff --git a/src/ifcopenshell-python/ifcopenshell/api/attribute/edit_attributes.py b/src/ifcopenshell-python/ifcopenshell/api/attribute/edit_attributes.py index 10273cb1fc..6199ddf3b7 100644 --- a/src/ifcopenshell-python/ifcopenshell/api/attribute/edit_attributes.py +++ b/src/ifcopenshell-python/ifcopenshell/api/attribute/edit_attributes.py @@ -86,4 +86,4 @@ def edit_attributes(file: ifcopenshell.file, product: ifcopenshell.entity_instan product.PredefinedType = "USERDEFINED" if hasattr(product, "OwnerHistory"): - ifcopenshell.api.owner.update_owner_history(file, **{"element": product}) + ifcopenshell.api.owner.update_owner_history(file, element=product) diff --git a/src/ifcopenshell-python/ifcopenshell/api/classification/add_reference.py b/src/ifcopenshell-python/ifcopenshell/api/classification/add_reference.py index 817d15b5cf..7f3d46bc96 100644 --- a/src/ifcopenshell-python/ifcopenshell/api/classification/add_reference.py +++ b/src/ifcopenshell-python/ifcopenshell/api/classification/add_reference.py @@ -231,7 +231,7 @@ class Usecase: if root_rel: related_objects = set(root_rel.RelatedObjects) | self.rooted_products root_rel.RelatedObjects = list(related_objects) - ifcopenshell.api.owner.update_owner_history(self.file, **{"element": root_rel}) + ifcopenshell.api.owner.update_owner_history(self.file, element=root_rel) else: self.file.create_entity( "IfcRelAssociatesClassification", diff --git a/src/ifcopenshell-python/ifcopenshell/api/classification/remove_reference.py b/src/ifcopenshell-python/ifcopenshell/api/classification/remove_reference.py index 55dfd11b08..fe4dd3b758 100644 --- a/src/ifcopenshell-python/ifcopenshell/api/classification/remove_reference.py +++ b/src/ifcopenshell-python/ifcopenshell/api/classification/remove_reference.py @@ -88,7 +88,7 @@ def remove_reference( related_objects = set(rel.RelatedObjects) - rooted_products if related_objects: rel.RelatedObjects = list(related_objects) - ifcopenshell.api.owner.update_owner_history(file, **{"element": rel}) + ifcopenshell.api.owner.update_owner_history(file, element=rel) else: history = rel.OwnerHistory file.remove(rel) diff --git a/src/ifcopenshell-python/ifcopenshell/api/constraint/assign_constraint.py b/src/ifcopenshell-python/ifcopenshell/api/constraint/assign_constraint.py index f4daad0abb..ac021840c7 100644 --- a/src/ifcopenshell-python/ifcopenshell/api/constraint/assign_constraint.py +++ b/src/ifcopenshell-python/ifcopenshell/api/constraint/assign_constraint.py @@ -70,7 +70,7 @@ class Usecase: if rel: related_objects = set(rel.RelatedObjects) | products_to_assign rel.RelatedObjects = list(related_objects) - ifcopenshell.api.owner.update_owner_history(self.file, **{"element": rel}) + ifcopenshell.api.owner.update_owner_history(self.file, element=rel) return rel return self.file.create_entity( diff --git a/src/ifcopenshell-python/ifcopenshell/api/constraint/unassign_constraint.py b/src/ifcopenshell-python/ifcopenshell/api/constraint/unassign_constraint.py index d9e84cc826..6fb1067c2a 100644 --- a/src/ifcopenshell-python/ifcopenshell/api/constraint/unassign_constraint.py +++ b/src/ifcopenshell-python/ifcopenshell/api/constraint/unassign_constraint.py @@ -63,7 +63,7 @@ class Usecase: related_objects -= products_set if related_objects: rel.RelatedObjects = list(related_objects) - ifcopenshell.api.owner.update_owner_history(self.file, **{"element": rel}) + ifcopenshell.api.owner.update_owner_history(self.file, element=rel) continue history = rel.OwnerHistory diff --git a/src/ifcopenshell-python/ifcopenshell/api/control/assign_control.py b/src/ifcopenshell-python/ifcopenshell/api/control/assign_control.py index 2a3ad405f2..c4768e5a01 100644 --- a/src/ifcopenshell-python/ifcopenshell/api/control/assign_control.py +++ b/src/ifcopenshell-python/ifcopenshell/api/control/assign_control.py @@ -84,7 +84,7 @@ def assign_control( related_objects = set(controls.RelatedObjects) related_objects.add(related_object) controls.RelatedObjects = list(related_objects) - ifcopenshell.api.owner.update_owner_history(file, **{"element": controls}) + ifcopenshell.api.owner.update_owner_history(file, element=controls) else: controls = file.create_entity( "IfcRelAssignsToControl", diff --git a/src/ifcopenshell-python/ifcopenshell/api/control/unassign_control.py b/src/ifcopenshell-python/ifcopenshell/api/control/unassign_control.py index 44cc4fad6e..a7ba9fb045 100644 --- a/src/ifcopenshell-python/ifcopenshell/api/control/unassign_control.py +++ b/src/ifcopenshell-python/ifcopenshell/api/control/unassign_control.py @@ -63,5 +63,5 @@ def unassign_control( related_objects = list(rel.RelatedObjects) related_objects.remove(related_object) rel.RelatedObjects = related_objects - ifcopenshell.api.owner.update_owner_history(file, **{"element": rel}) + ifcopenshell.api.owner.update_owner_history(file, element=rel) return rel diff --git a/src/ifcopenshell-python/ifcopenshell/api/document/unassign_document.py b/src/ifcopenshell-python/ifcopenshell/api/document/unassign_document.py index a81ae71973..0e9f2b2d96 100644 --- a/src/ifcopenshell-python/ifcopenshell/api/document/unassign_document.py +++ b/src/ifcopenshell-python/ifcopenshell/api/document/unassign_document.py @@ -68,7 +68,7 @@ def unassign_document( related_objects = set(rel.RelatedObjects) - products_set if related_objects: rel.RelatedObjects = list(related_objects) - ifcopenshell.api.owner.update_owner_history(file, **{"element": rel}) + ifcopenshell.api.owner.update_owner_history(file, element=rel) else: history = rel.OwnerHistory file.remove(rel) diff --git a/src/ifcopenshell-python/ifcopenshell/api/geometry/assign_representation.py b/src/ifcopenshell-python/ifcopenshell/api/geometry/assign_representation.py index d2dee0a86e..9159ac6acc 100644 --- a/src/ifcopenshell-python/ifcopenshell/api/geometry/assign_representation.py +++ b/src/ifcopenshell-python/ifcopenshell/api/geometry/assign_representation.py @@ -75,7 +75,7 @@ class Usecase: self.file, representation=self.settings["representation"] ) self.assign_product_representation(element, mapped_representation) - ifcopenshell.api.owner.update_owner_history(self.file, **{"element": self.settings["product"]}) + ifcopenshell.api.owner.update_owner_history(self.file, element=self.settings["product"]) def assign_product_representation( self, product: ifcopenshell.entity_instance, representation: ifcopenshell.entity_instance diff --git a/src/ifcopenshell-python/ifcopenshell/api/geometry/edit_object_placement.py b/src/ifcopenshell-python/ifcopenshell/api/geometry/edit_object_placement.py index 78e95c32c8..159127c03e 100644 --- a/src/ifcopenshell-python/ifcopenshell/api/geometry/edit_object_placement.py +++ b/src/ifcopenshell-python/ifcopenshell/api/geometry/edit_object_placement.py @@ -101,7 +101,7 @@ class Usecase: new_placement.PlacementRelTo = placement_rel_to self.settings["product"].ObjectPlacement = new_placement - ifcopenshell.api.owner.update_owner_history(self.file, **{"element": self.settings["product"]}) + ifcopenshell.api.owner.update_owner_history(self.file, element=self.settings["product"]) for settings in children_settings: self.settings = settings diff --git a/src/ifcopenshell-python/ifcopenshell/api/group/assign_group.py b/src/ifcopenshell-python/ifcopenshell/api/group/assign_group.py index 4a57f148eb..cb9cd95fea 100644 --- a/src/ifcopenshell-python/ifcopenshell/api/group/assign_group.py +++ b/src/ifcopenshell-python/ifcopenshell/api/group/assign_group.py @@ -63,5 +63,5 @@ def assign_group( if products_set.issubset(related_objects): return rel rel.RelatedObjects = list(related_objects | products_set) - ifcopenshell.api.owner.update_owner_history(file, **{"element": rel}) + ifcopenshell.api.owner.update_owner_history(file, element=rel) return rel diff --git a/src/ifcopenshell-python/ifcopenshell/api/group/unassign_group.py b/src/ifcopenshell-python/ifcopenshell/api/group/unassign_group.py index cac87106aa..a4f9d70566 100644 --- a/src/ifcopenshell-python/ifcopenshell/api/group/unassign_group.py +++ b/src/ifcopenshell-python/ifcopenshell/api/group/unassign_group.py @@ -54,7 +54,7 @@ def unassign_group( related_objects -= products_set if related_objects: rel.RelatedObjects = list(related_objects) - ifcopenshell.api.owner.update_owner_history(file, **{"element": rel}) + ifcopenshell.api.owner.update_owner_history(file, element=rel) else: history = rel.OwnerHistory file.remove(rel) diff --git a/src/ifcopenshell-python/ifcopenshell/api/library/unassign_reference.py b/src/ifcopenshell-python/ifcopenshell/api/library/unassign_reference.py index d92ed2fc1e..5dd40749b9 100644 --- a/src/ifcopenshell-python/ifcopenshell/api/library/unassign_reference.py +++ b/src/ifcopenshell-python/ifcopenshell/api/library/unassign_reference.py @@ -70,7 +70,7 @@ def unassign_reference( related_objects = set(rel.RelatedObjects) - products_set if related_objects: rel.RelatedObjects = list(related_objects) - ifcopenshell.api.owner.update_owner_history(file, **{"element": rel}) + ifcopenshell.api.owner.update_owner_history(file, element=rel) else: history = rel.OwnerHistory file.remove(rel) diff --git a/src/ifcopenshell-python/ifcopenshell/api/material/assign_material.py b/src/ifcopenshell-python/ifcopenshell/api/material/assign_material.py index 682dd4558d..0e37eef148 100644 --- a/src/ifcopenshell-python/ifcopenshell/api/material/assign_material.py +++ b/src/ifcopenshell-python/ifcopenshell/api/material/assign_material.py @@ -328,7 +328,7 @@ class Usecase: return self.create_material_association(material) previous_related_objects = set(rel.RelatedObjects) rel.RelatedObjects = list(previous_related_objects | self.products) - ifcopenshell.api.owner.update_owner_history(self.file, **{"element": rel}) + ifcopenshell.api.owner.update_owner_history(self.file, element=rel) return rel def create_material_association( diff --git a/src/ifcopenshell-python/ifcopenshell/api/material/unassign_material.py b/src/ifcopenshell-python/ifcopenshell/api/material/unassign_material.py index 455fc02bc4..51d11b3248 100644 --- a/src/ifcopenshell-python/ifcopenshell/api/material/unassign_material.py +++ b/src/ifcopenshell-python/ifcopenshell/api/material/unassign_material.py @@ -132,4 +132,4 @@ class Usecase: ifcopenshell.util.element.remove_deep2(self.file, history) continue rel.RelatedObjects = list(related_objects) - ifcopenshell.api.owner.update_owner_history(self.file, **{"element": rel}) + ifcopenshell.api.owner.update_owner_history(self.file, element=rel) diff --git a/src/ifcopenshell-python/ifcopenshell/api/nest/assign_object.py b/src/ifcopenshell-python/ifcopenshell/api/nest/assign_object.py index b1136d4048..21212bafe6 100644 --- a/src/ifcopenshell-python/ifcopenshell/api/nest/assign_object.py +++ b/src/ifcopenshell-python/ifcopenshell/api/nest/assign_object.py @@ -146,7 +146,7 @@ def assign_object( cur_related_objects = [o for o in nests.RelatedObjects if o not in related_objects_set] if cur_related_objects: nests.RelatedObjects = list(cur_related_objects) - ifcopenshell.api.owner.update_owner_history(file, **{"element": nests}) + ifcopenshell.api.owner.update_owner_history(file, element=nests) else: history = nests.OwnerHistory file.remove(nests) @@ -160,7 +160,7 @@ def assign_object( is_nested_by.RelatedObjects = cur_related_objects + [ o for o in related_objects if o not in cur_related_objects_set ] - ifcopenshell.api.owner.update_owner_history(file, **{"element": is_nested_by}) + ifcopenshell.api.owner.update_owner_history(file, element=is_nested_by) else: is_nested_by = file.create_entity( "IfcRelNests", diff --git a/src/ifcopenshell-python/ifcopenshell/api/nest/change_nest.py b/src/ifcopenshell-python/ifcopenshell/api/nest/change_nest.py index 6e47e330e5..946497a767 100644 --- a/src/ifcopenshell-python/ifcopenshell/api/nest/change_nest.py +++ b/src/ifcopenshell-python/ifcopenshell/api/nest/change_nest.py @@ -33,7 +33,7 @@ def change_nest( related_objects.remove(item) if related_objects: nests.RelatedObjects = related_objects - ifcopenshell.api.owner.update_owner_history(file, **{"element": nests}) + ifcopenshell.api.owner.update_owner_history(file, element=nests) else: history = nests.OwnerHistory file.remove(nests) diff --git a/src/ifcopenshell-python/ifcopenshell/api/nest/unassign_object.py b/src/ifcopenshell-python/ifcopenshell/api/nest/unassign_object.py index c266dfe291..6ed1cbaeb5 100644 --- a/src/ifcopenshell-python/ifcopenshell/api/nest/unassign_object.py +++ b/src/ifcopenshell-python/ifcopenshell/api/nest/unassign_object.py @@ -66,7 +66,7 @@ def unassign_object(file: ifcopenshell.file, related_objects: list[ifcopenshell. cur_related_objects = [o for o in rel.RelatedObjects if o not in related_objects_set] if cur_related_objects: rel.RelatedObjects = cur_related_objects - ifcopenshell.api.owner.update_owner_history(file, **{"element": rel}) + ifcopenshell.api.owner.update_owner_history(file, element=rel) else: history = rel.OwnerHistory file.remove(rel) diff --git a/src/ifcopenshell-python/ifcopenshell/api/owner/assign_actor.py b/src/ifcopenshell-python/ifcopenshell/api/owner/assign_actor.py index 7f2df90511..3056cf07bc 100644 --- a/src/ifcopenshell-python/ifcopenshell/api/owner/assign_actor.py +++ b/src/ifcopenshell-python/ifcopenshell/api/owner/assign_actor.py @@ -85,7 +85,7 @@ def assign_actor( related_objects = list(rel.RelatedObjects) related_objects.append(related_object) rel.RelatedObjects = related_objects - ifcopenshell.api.owner.update_owner_history(file, **{"element": rel}) + ifcopenshell.api.owner.update_owner_history(file, element=rel) else: rel = file.create_entity( "IfcRelAssignsToActor", diff --git a/src/ifcopenshell-python/ifcopenshell/api/owner/unassign_actor.py b/src/ifcopenshell-python/ifcopenshell/api/owner/unassign_actor.py index 98279c128d..1912fa0e08 100644 --- a/src/ifcopenshell-python/ifcopenshell/api/owner/unassign_actor.py +++ b/src/ifcopenshell-python/ifcopenshell/api/owner/unassign_actor.py @@ -64,4 +64,4 @@ def unassign_actor( related_objects = list(rel.RelatedObjects) related_objects.remove(related_object) rel.RelatedObjects = related_objects - ifcopenshell.api.owner.update_owner_history(file, **{"element": rel}) + ifcopenshell.api.owner.update_owner_history(file, element=rel) diff --git a/src/ifcopenshell-python/ifcopenshell/api/project/assign_declaration.py b/src/ifcopenshell-python/ifcopenshell/api/project/assign_declaration.py index 7333282746..f1d1a0744a 100644 --- a/src/ifcopenshell-python/ifcopenshell/api/project/assign_declaration.py +++ b/src/ifcopenshell-python/ifcopenshell/api/project/assign_declaration.py @@ -123,7 +123,7 @@ def assign_declaration( related_definitions = set(has_context.RelatedDefinitions) - set(objects_with_contexts) if related_definitions: has_context.RelatedDefinitions = list(related_definitions) - ifcopenshell.api.owner.update_owner_history(file, **{"element": has_context}) + ifcopenshell.api.owner.update_owner_history(file, element=has_context) else: history = has_context.OwnerHistory file.remove(has_context) @@ -133,7 +133,7 @@ def assign_declaration( declares = next(iter(all_declares), None) if declares: declares.RelatedDefinitions = list(set(declares.RelatedDefinitions) | set(objects_to_change)) - ifcopenshell.api.owner.update_owner_history(file, **{"element": declares}) + ifcopenshell.api.owner.update_owner_history(file, element=declares) else: declares = file.create_entity( "IfcRelDeclares", diff --git a/src/ifcopenshell-python/ifcopenshell/api/project/unassign_declaration.py b/src/ifcopenshell-python/ifcopenshell/api/project/unassign_declaration.py index 7d012b09af..62c2080207 100644 --- a/src/ifcopenshell-python/ifcopenshell/api/project/unassign_declaration.py +++ b/src/ifcopenshell-python/ifcopenshell/api/project/unassign_declaration.py @@ -67,7 +67,7 @@ def unassign_declaration( related_definitions = set(rel.RelatedDefinitions) - definitions if related_definitions: rel.RelatedDefinitions = list(related_definitions) - ifcopenshell.api.owner.update_owner_history(file, **{"element": rel}) + ifcopenshell.api.owner.update_owner_history(file, element=rel) else: history = rel.OwnerHistory file.remove(rel) diff --git a/src/ifcopenshell-python/ifcopenshell/api/resource/assign_resource.py b/src/ifcopenshell-python/ifcopenshell/api/resource/assign_resource.py index 618d10895a..8ba19a650d 100644 --- a/src/ifcopenshell-python/ifcopenshell/api/resource/assign_resource.py +++ b/src/ifcopenshell-python/ifcopenshell/api/resource/assign_resource.py @@ -92,7 +92,7 @@ def assign_resource( related_objects = list(resource_of.RelatedObjects) related_objects.append(related_object) resource_of.RelatedObjects = related_objects - ifcopenshell.api.owner.update_owner_history(file, **{"element": resource_of}) + ifcopenshell.api.owner.update_owner_history(file, element=resource_of) else: resource_of = file.create_entity( "IfcRelAssignsToResource", diff --git a/src/ifcopenshell-python/ifcopenshell/api/resource/unassign_resource.py b/src/ifcopenshell-python/ifcopenshell/api/resource/unassign_resource.py index dc0807754d..c3a1fd39cf 100644 --- a/src/ifcopenshell-python/ifcopenshell/api/resource/unassign_resource.py +++ b/src/ifcopenshell-python/ifcopenshell/api/resource/unassign_resource.py @@ -69,4 +69,4 @@ def unassign_resource( related_objects = list(rel.RelatedObjects) related_objects.remove(related_object) rel.RelatedObjects = related_objects - ifcopenshell.api.owner.update_owner_history(file, **{"element": rel}) + ifcopenshell.api.owner.update_owner_history(file, element=rel) diff --git a/src/ifcopenshell-python/ifcopenshell/api/sequence/add_work_schedule.py b/src/ifcopenshell-python/ifcopenshell/api/sequence/add_work_schedule.py index d81998021b..26f72d6201 100644 --- a/src/ifcopenshell-python/ifcopenshell/api/sequence/add_work_schedule.py +++ b/src/ifcopenshell-python/ifcopenshell/api/sequence/add_work_schedule.py @@ -100,10 +100,8 @@ def add_work_schedule( if work_plan: ifcopenshell.api.aggregate.assign_object( file, - **{ - "products": [work_schedule], - "relating_object": work_plan, - } + products=[work_schedule], + relating_object=work_plan, ) elif file.schema != "IFC2X3": # TODO: this is an ambiguity by buildingSMART diff --git a/src/ifcopenshell-python/ifcopenshell/api/sequence/assign_process.py b/src/ifcopenshell-python/ifcopenshell/api/sequence/assign_process.py index 238e9eedc2..302445483b 100644 --- a/src/ifcopenshell-python/ifcopenshell/api/sequence/assign_process.py +++ b/src/ifcopenshell-python/ifcopenshell/api/sequence/assign_process.py @@ -101,7 +101,7 @@ def assign_process( related_objects = list(operates_on.RelatedObjects) related_objects.append(related_object) operates_on.RelatedObjects = related_objects - ifcopenshell.api.owner.update_owner_history(file, **{"element": operates_on}) + ifcopenshell.api.owner.update_owner_history(file, element=operates_on) else: operates_on = file.create_entity( "IfcRelAssignsToProcess", diff --git a/src/ifcopenshell-python/ifcopenshell/api/sequence/assign_product.py b/src/ifcopenshell-python/ifcopenshell/api/sequence/assign_product.py index 8a657302b5..5f029f1c42 100644 --- a/src/ifcopenshell-python/ifcopenshell/api/sequence/assign_product.py +++ b/src/ifcopenshell-python/ifcopenshell/api/sequence/assign_product.py @@ -77,7 +77,7 @@ def assign_product( related_objects = list(referenced_by.RelatedObjects) related_objects.append(related_object) referenced_by.RelatedObjects = related_objects - ifcopenshell.api.owner.update_owner_history(file, **{"element": referenced_by}) + ifcopenshell.api.owner.update_owner_history(file, element=referenced_by) else: referenced_by = file.create_entity( "IfcRelAssignsToProduct", diff --git a/src/ifcopenshell-python/ifcopenshell/api/sequence/create_baseline.py b/src/ifcopenshell-python/ifcopenshell/api/sequence/create_baseline.py index ab1035bbab..8b9571aa4d 100644 --- a/src/ifcopenshell-python/ifcopenshell/api/sequence/create_baseline.py +++ b/src/ifcopenshell-python/ifcopenshell/api/sequence/create_baseline.py @@ -94,7 +94,7 @@ class Usecase: related_objects = list(referenced_by.RelatedObjects) related_objects.append(related_object) referenced_by.RelatedObjects = related_objects - ifcopenshell.api.owner.update_owner_history(self.file, **{"element": referenced_by}) + ifcopenshell.api.owner.update_owner_history(self.file, element=referenced_by) else: referenced_by = self.file.create_entity( "IfcRelDefinesByObject", diff --git a/src/ifcopenshell-python/ifcopenshell/api/sequence/duplicate_task.py b/src/ifcopenshell-python/ifcopenshell/api/sequence/duplicate_task.py index a70868b084..5c9c1a4c65 100644 --- a/src/ifcopenshell-python/ifcopenshell/api/sequence/duplicate_task.py +++ b/src/ifcopenshell-python/ifcopenshell/api/sequence/duplicate_task.py @@ -166,7 +166,7 @@ class Usecase: related_objects = list(referenced_by.RelatedObjects) related_objects.append(related_object) referenced_by.RelatedObjects = related_objects - ifcopenshell.api.owner.update_owner_history(self.file, **{"element": referenced_by}) + ifcopenshell.api.owner.update_owner_history(self.file, element=referenced_by) else: referenced_by = self.file.create_entity( "IfcRelDefinesByObject", diff --git a/src/ifcopenshell-python/ifcopenshell/api/spatial/assign_container.py b/src/ifcopenshell-python/ifcopenshell/api/spatial/assign_container.py index 244b5ae8f7..15f59905f6 100644 --- a/src/ifcopenshell-python/ifcopenshell/api/spatial/assign_container.py +++ b/src/ifcopenshell-python/ifcopenshell/api/spatial/assign_container.py @@ -139,7 +139,7 @@ def assign_container( related_elements = set(rel.RelatedElements) - products_set if related_elements: rel.RelatedElements = list(related_elements) - ifcopenshell.api.owner.update_owner_history(file, **{"element": rel}) + ifcopenshell.api.owner.update_owner_history(file, element=rel) else: history = rel.OwnerHistory file.remove(rel) @@ -149,7 +149,7 @@ def assign_container( # assign elements to a new container if structure_rel: structure_rel.RelatedElements = list(set(structure_rel.RelatedElements) | products_set) - ifcopenshell.api.owner.update_owner_history(file, **{"element": structure_rel}) + ifcopenshell.api.owner.update_owner_history(file, element=structure_rel) else: structure_rel = file.create_entity( "IfcRelContainedInSpatialStructure", diff --git a/src/ifcopenshell-python/ifcopenshell/api/spatial/dereference_structure.py b/src/ifcopenshell-python/ifcopenshell/api/spatial/dereference_structure.py index abd66e7fa8..a25780a273 100644 --- a/src/ifcopenshell-python/ifcopenshell/api/spatial/dereference_structure.py +++ b/src/ifcopenshell-python/ifcopenshell/api/spatial/dereference_structure.py @@ -74,7 +74,7 @@ def dereference_structure( related_elements = related_elements - products_set if related_elements: rel.RelatedElements = list(related_elements) - ifcopenshell.api.owner.update_owner_history(file, **{"element": rel}) + ifcopenshell.api.owner.update_owner_history(file, element=rel) else: history = rel.OwnerHistory file.remove(rel) diff --git a/src/ifcopenshell-python/ifcopenshell/api/system/assign_flow_control.py b/src/ifcopenshell-python/ifcopenshell/api/system/assign_flow_control.py index 011a510705..3b9273acf1 100644 --- a/src/ifcopenshell-python/ifcopenshell/api/system/assign_flow_control.py +++ b/src/ifcopenshell-python/ifcopenshell/api/system/assign_flow_control.py @@ -64,7 +64,7 @@ def assign_flow_control( related_flow_controls = set(assignment.RelatedControlElements) related_flow_controls.add(related_flow_control) assignment.RelatedControlElements = list(related_flow_controls) - ifcopenshell.api.owner.update_owner_history(file, **{"element": assignment}) + ifcopenshell.api.owner.update_owner_history(file, element=assignment) return assignment assignment = file.create_entity( diff --git a/src/ifcopenshell-python/ifcopenshell/api/system/assign_port.py b/src/ifcopenshell-python/ifcopenshell/api/system/assign_port.py index 75415fd98b..eee8780778 100644 --- a/src/ifcopenshell-python/ifcopenshell/api/system/assign_port.py +++ b/src/ifcopenshell-python/ifcopenshell/api/system/assign_port.py @@ -83,7 +83,7 @@ class Usecase: related_objects = set(rel.RelatedObjects) or set() related_objects.add(self.port) rel.RelatedObjects = list(related_objects) - ifcopenshell.api.owner.update_owner_history(self.file, **{"element": rel}) + ifcopenshell.api.owner.update_owner_history(self.file, element=rel) else: rel = self.file.create_entity( "IfcRelNests", diff --git a/src/ifcopenshell-python/ifcopenshell/api/system/unassign_flow_control.py b/src/ifcopenshell-python/ifcopenshell/api/system/unassign_flow_control.py index 69b9ddfc62..93b21c0047 100644 --- a/src/ifcopenshell-python/ifcopenshell/api/system/unassign_flow_control.py +++ b/src/ifcopenshell-python/ifcopenshell/api/system/unassign_flow_control.py @@ -64,4 +64,4 @@ def unassign_flow_control( related_flow_controls = list(assignment.RelatedControlElements) related_flow_controls.remove(related_flow_control) assignment.RelatedControlElements = related_flow_controls - ifcopenshell.api.owner.update_owner_history(file, **{"element": assignment}) + ifcopenshell.api.owner.update_owner_history(file, element=assignment) diff --git a/src/ifcopenshell-python/ifcopenshell/api/system/unassign_port.py b/src/ifcopenshell-python/ifcopenshell/api/system/unassign_port.py index 87b6c0fc16..5e0b829825 100644 --- a/src/ifcopenshell-python/ifcopenshell/api/system/unassign_port.py +++ b/src/ifcopenshell-python/ifcopenshell/api/system/unassign_port.py @@ -74,7 +74,7 @@ class Usecase: related_objects = set(rel.RelatedObjects) or set() related_objects.remove(port) rel.RelatedObjects = list(related_objects) - ifcopenshell.api.owner.update_owner_history(self.file, **{"element": rel}) + ifcopenshell.api.owner.update_owner_history(self.file, element=rel) def execute_ifc2x3(self) -> None: for rel in self.element.HasPorts or []: diff --git a/src/ifcopenshell-python/ifcopenshell/api/type/assign_type.py b/src/ifcopenshell-python/ifcopenshell/api/type/assign_type.py index 576a35459b..396e4ca12f 100644 --- a/src/ifcopenshell-python/ifcopenshell/api/type/assign_type.py +++ b/src/ifcopenshell-python/ifcopenshell/api/type/assign_type.py @@ -228,7 +228,7 @@ class Usecase: cur_related_objects = set(is_typed_by.RelatedObjects) - related_objects_set if cur_related_objects: is_typed_by.RelatedObjects = list(cur_related_objects) - ifcopenshell.api.owner.update_owner_history(self.file, **{"element": is_typed_by}) + ifcopenshell.api.owner.update_owner_history(self.file, element=is_typed_by) else: history = is_typed_by.OwnerHistory self.file.remove(is_typed_by) @@ -238,7 +238,7 @@ class Usecase: # assign objects to a new type if types: types.RelatedObjects = list(set(types.RelatedObjects) | related_objects_set) - ifcopenshell.api.owner.update_owner_history(self.file, **{"element": types}) + ifcopenshell.api.owner.update_owner_history(self.file, element=types) else: types = self.file.create_entity( "IfcRelDefinesByType", diff --git a/src/ifcopenshell-python/ifcopenshell/api/type/unassign_type.py b/src/ifcopenshell-python/ifcopenshell/api/type/unassign_type.py index 572327afb7..bd09018aa0 100644 --- a/src/ifcopenshell-python/ifcopenshell/api/type/unassign_type.py +++ b/src/ifcopenshell-python/ifcopenshell/api/type/unassign_type.py @@ -63,7 +63,7 @@ def unassign_type(file: ifcopenshell.file, related_objects: list[ifcopenshell.en related_objects_set = set(rel.RelatedObjects) - related_objects_set if related_objects_set: rel.RelatedObjects = list(related_objects_set) - ifcopenshell.api.owner.update_owner_history(file, **{"element": rel}) + ifcopenshell.api.owner.update_owner_history(file, element=rel) else: history = rel.OwnerHistory file.remove(rel) diff --git a/src/opencdeserver/api/app/repository/bcf.py b/src/opencdeserver/api/app/repository/bcf.py index 33975188c0..80f9d172a1 100644 --- a/src/opencdeserver/api/app/repository/bcf.py +++ b/src/opencdeserver/api/app/repository/bcf.py @@ -326,7 +326,7 @@ class BCFDB(MyDB): "reference": reference, } project_file_information = ProjectFileInformation( - **{"display_information": display_information_list, "file": file_get_json} + display_information=display_information_list, file=file_get_json ) project_file_informations.append(project_file_information) return project_file_informations diff --git a/src/opencdeserver/api/app/repository/documents.py b/src/opencdeserver/api/app/repository/documents.py index 1f5a15440e..e40454c51f 100644 --- a/src/opencdeserver/api/app/repository/documents.py +++ b/src/opencdeserver/api/app/repository/documents.py @@ -248,14 +248,12 @@ class DOCDB(MyDB): raise HTTPException(status_code=400, detail="Document node was not created.") session_init = DocumentUploadSessionInitialization( - **{ - "upload_ui_url": os.environ["KONTROLL_BASE_URL"] - + "documents/1.0/" - + "document-upload?upload_session=" - + session_uuid, - "expires_in": os.environ["SESSION_URL_VALIDITY_SECONDS"], - "max_size_in_bytes": os.environ["SESSION_MAX_FILE_SIZE_BYTES"], - } + upload_ui_url=os.environ["KONTROLL_BASE_URL"] + + "documents/1.0/" + + "document-upload?upload_session=" + + session_uuid, + expires_in=os.environ["SESSION_URL_VALIDITY_SECONDS"], + max_size_in_bytes=os.environ["SESSION_MAX_FILE_SIZE_BYTES"], ) return session_init @@ -407,15 +405,13 @@ class DOCDB(MyDB): upload_session_url = "?upload_session=" + upload_session upload_complete_url = base_url + "upload-completion" + upload_session_url upload_cancellation_url = base_url + "upload-cancellation" + upload_session_url - upload_completion = LinkData(**{"url": upload_complete_url}) - upload_cancellation = LinkData(**{"url": upload_cancellation_url}) + upload_completion = LinkData(url=upload_complete_url) + upload_cancellation = LinkData(url=upload_cancellation_url) document_to_upload_model = DocumentToUpload( - **{ - "session_file_id": document.session_file_id, - "upload_file_parts": list(), - "upload_completion": upload_completion, - "upload_cancellation": upload_cancellation, - } + session_file_id=document.session_file_id, + upload_file_parts=list(), + upload_completion=upload_completion, + upload_cancellation=upload_cancellation, ) def add_part_work(tx) -> UUID: @@ -461,14 +457,12 @@ class DOCDB(MyDB): upload_part_url = "upload-part/" + str(upload_part_uuid) additional_headers = {"values": [{"name": "Content-Length", "value": content_length}]} part_instruction = UploadFilePartInstruction( - **{ - "url": base_url + upload_part_url, - "http_method": "POST", - "additional_headers": additional_headers, - "include_authorization": True, - "content_range_start": content_range_start, - "content_range_end": content_range_end, - } + url=base_url + upload_part_url, + http_method="POST", + additional_headers=additional_headers, + include_authorization=True, + content_range_start=content_range_start, + content_range_end=content_range_end, ) with self.driver.session() as session: @@ -800,7 +794,7 @@ class DOCDB(MyDB): MERGE (ss)-[r5:SELECTED]->(d) """ - selected_documents_model = DocumentsMarkedAsSelected(**{"documents": list()}) + selected_documents_model = DocumentsMarkedAsSelected(documents=list()) for document in all_documents: result = tx.run(cypher, selection_session=str(selection_session), document_id=str(document)) @@ -823,13 +817,11 @@ class DOCDB(MyDB): os.environ["KONTROLL_BASE_URL"] + "documents/1.0/document/" + document_id + "/version/" + str(version_index) ) return DocumentVersionLinks( - **{ - "document_version": LinkData(**{"url": base}), - "document_version_metadata": LinkData(**{"url": base + "/metadata"}), - "document_version_download": LinkData(**{"url": base + "/download"}), - "document_versions": LinkData(**{"url": base + "/versions"}), - "document_details": LinkData(**{"url": base + "/details"}), - } + document_version=LinkData(url=base), + document_version_metadata=LinkData(url=base + "/metadata"), + document_version_download=LinkData(url=base + "/download"), + document_versions=LinkData(url=base + "/versions"), + document_details=LinkData(url=base + "/details"), ) def get_download_instructions(self, session_id: UUID, server_context: str, current_user: User) -> SelectedDocuments: @@ -847,7 +839,7 @@ class DOCDB(MyDB): document_model = self.document_node_to_model(document_node) document_list.append(document_model) - selected_documents = SelectedDocuments(**{"server_context": server_context, "documents": document_list}) + selected_documents = SelectedDocuments(server_context=server_context, documents=document_list) return selected_documents with self.driver.session() as session: @@ -975,7 +967,7 @@ class DOCDB(MyDB): "data_type": DataType.string, } entries.append(entry) - return DocumentMetadataEntries(**{"metadata": entries}) + return DocumentMetadataEntries(metadata=entries) with self.driver.session() as session: return session.execute_read(get_document_version_metadata_work)