From 26b412cff6ad4ba51ff3d93d9850e7dd5ba2f590 Mon Sep 17 00:00:00 2001 From: Andrej730 Date: Mon, 3 Aug 2026 13:18:15 +0500 Subject: [PATCH] Fix uses of `ifcopenshell.file` --- src/ifcopenshell-python/ifcopenshell/__init__.py | 2 +- src/ifcopenshell-python/ifcopenshell/stream.py | 2 +- src/ifcopenshell-python/test/api/alignment/test_create.py | 4 ++-- .../test/api/alignment/test_create_as_offset_curve.py | 4 ++-- .../test/api/alignment/test_create_as_polyline.py | 4 ++-- .../test/api/alignment/test_create_layout_segment.py | 6 +++--- .../test/api/alignment/test_create_no_geometry.py | 4 ++-- .../test/api/alignment/test_create_representation.py | 2 +- .../test/api/alignment/test_get_alignment.py | 4 ++-- .../test/api/cogo/test_add_survey_point.py | 4 ++-- .../test/api/cogo/test_assign_survey_point.py | 4 ++-- .../test/api/cogo/test_edit_survey_point.py | 4 ++-- src/ifcopenshell-python/test/util/test_alignment.py | 8 ++++---- 13 files changed, 26 insertions(+), 26 deletions(-) diff --git a/src/ifcopenshell-python/ifcopenshell/__init__.py b/src/ifcopenshell-python/ifcopenshell/__init__.py index 9a87d167f1..9aec42551b 100644 --- a/src/ifcopenshell-python/ifcopenshell/__init__.py +++ b/src/ifcopenshell-python/ifcopenshell/__init__.py @@ -462,7 +462,7 @@ def create_entity(type: str, schema: str = "IFC4", *args: Any, **kwargs: Any) -> if fi := _global_ifc_models.get(schema.lower()): pass else: - fi = _global_ifc_models[schema.lower()] = file(schema=schema) + fi = _global_ifc_models[schema.lower()] = file(schema_identifier=schema) return fi.create_entity(type, *args, **kwargs) diff --git a/src/ifcopenshell-python/ifcopenshell/stream.py b/src/ifcopenshell-python/ifcopenshell/stream.py index b12a9a2248..f39029b1ac 100644 --- a/src/ifcopenshell-python/ifcopenshell/stream.py +++ b/src/ifcopenshell-python/ifcopenshell/stream.py @@ -187,7 +187,7 @@ try: exclude.update([st.name().upper() for st in ifcopenshell.util.schema.get_subtypes(declaration)]) # For creating C++ instances so that some of the calls here work - self.shadow_file = ifcopenshell.file(schema_identifier=self.ifc_schema) + self.shadow_file = ifcopenshell.file(schema=self.schema) # But we only create them once per type because we basically only need access to 'semi-static' such as get_attribute_category() self.instance_map = {} diff --git a/src/ifcopenshell-python/test/api/alignment/test_create.py b/src/ifcopenshell-python/test/api/alignment/test_create.py index c3c9ab0f41..e4350342e0 100644 --- a/src/ifcopenshell-python/test/api/alignment/test_create.py +++ b/src/ifcopenshell-python/test/api/alignment/test_create.py @@ -24,7 +24,7 @@ import ifcopenshell.api.context import ifcopenshell.api.unit try: - ifcopenshell.file(schema="IFC4X3_ADD2") + ifcopenshell.file(schema="IFC4") IFC4X3_AVAILABLE = True except RuntimeError: IFC4X3_AVAILABLE = False @@ -32,7 +32,7 @@ except RuntimeError: @pytest.mark.skipif(not IFC4X3_AVAILABLE, reason="IFC4X3 not available") def test_create(): - file = ifcopenshell.file(schema="IFC4X3_ADD2") + file = ifcopenshell.file(schema="IFC4X3") project = file.createIfcProject(GlobalId=ifcopenshell.guid.new(), Name="Test") length = ifcopenshell.api.unit.add_si_unit(file, unit_type="LENGTHUNIT") ifcopenshell.api.unit.assign_unit(file, units=[length]) diff --git a/src/ifcopenshell-python/test/api/alignment/test_create_as_offset_curve.py b/src/ifcopenshell-python/test/api/alignment/test_create_as_offset_curve.py index bda225d52c..f93321ac73 100644 --- a/src/ifcopenshell-python/test/api/alignment/test_create_as_offset_curve.py +++ b/src/ifcopenshell-python/test/api/alignment/test_create_as_offset_curve.py @@ -26,7 +26,7 @@ import ifcopenshell.util import ifcopenshell.util.unit try: - ifcopenshell.file(schema="IFC4X3_ADD2") + ifcopenshell.file(schema="IFC4X3") IFC4X3_AVAILABLE = True except RuntimeError: IFC4X3_AVAILABLE = False @@ -34,7 +34,7 @@ except RuntimeError: @pytest.mark.skipif(not IFC4X3_AVAILABLE, reason="IFC4X3 not available") def test_create_as_offset_curve(): - file = ifcopenshell.file(schema="IFC4X3_ADD2") + file = ifcopenshell.file(schema="IFC4X3") project = file.createIfcProject(GlobalId=ifcopenshell.guid.new(), Name="OCBD Test Alignment") length = ifcopenshell.api.unit.add_si_unit(file, unit_type="LENGTHUNIT") ifcopenshell.api.unit.assign_unit(file, units=[length]) diff --git a/src/ifcopenshell-python/test/api/alignment/test_create_as_polyline.py b/src/ifcopenshell-python/test/api/alignment/test_create_as_polyline.py index 4dc6668a23..350da9ad45 100644 --- a/src/ifcopenshell-python/test/api/alignment/test_create_as_polyline.py +++ b/src/ifcopenshell-python/test/api/alignment/test_create_as_polyline.py @@ -23,7 +23,7 @@ import ifcopenshell.api.alignment import ifcopenshell.api.unit try: - ifcopenshell.file(schema="IFC4X3_ADD2") + ifcopenshell.file(schema="IFC4X3") IFC4X3_AVAILABLE = True except RuntimeError: IFC4X3_AVAILABLE = False @@ -31,7 +31,7 @@ except RuntimeError: @pytest.mark.skipif(not IFC4X3_AVAILABLE, reason="IFC4X3 not available") def test_create_as_polyline(): - file = ifcopenshell.file(schema="IFC4X3_ADD2") + file = ifcopenshell.file(schema="IFC4X3") project = file.createIfcProject(GlobalId=ifcopenshell.guid.new(), Name="Test") length = ifcopenshell.api.unit.add_si_unit(file, unit_type="LENGTHUNIT") ifcopenshell.api.unit.assign_unit(file, units=[length]) diff --git a/src/ifcopenshell-python/test/api/alignment/test_create_layout_segment.py b/src/ifcopenshell-python/test/api/alignment/test_create_layout_segment.py index cdfcf6bfe1..058804ddc8 100644 --- a/src/ifcopenshell-python/test/api/alignment/test_create_layout_segment.py +++ b/src/ifcopenshell-python/test/api/alignment/test_create_layout_segment.py @@ -25,14 +25,14 @@ import ifcopenshell.api.context import ifcopenshell.api.unit try: - ifcopenshell.file(schema="IFC4X3_ADD2") + ifcopenshell.file(schema="IFC4X3") IFC4X3_AVAILABLE = True except RuntimeError: IFC4X3_AVAILABLE = False def _test_horizontal() -> ifcopenshell.file: - file = ifcopenshell.file(schema="IFC4X3_ADD2") + file = ifcopenshell.file(schema="IFC4X3") project = file.createIfcProject(GlobalId=ifcopenshell.guid.new(), Name="Test") length = ifcopenshell.api.unit.add_si_unit(file, unit_type="LENGTHUNIT") ifcopenshell.api.unit.assign_unit(file, units=[length]) @@ -131,7 +131,7 @@ def _test_horizontal() -> ifcopenshell.file: def _test_horizontal_vertical(): - file = ifcopenshell.file(schema="IFC4X3_ADD2") + file = ifcopenshell.file(schema="IFC4X3") project = file.createIfcProject(GlobalId=ifcopenshell.guid.new(), Name="Test") length = ifcopenshell.api.unit.add_si_unit(file, unit_type="LENGTHUNIT") ifcopenshell.api.unit.assign_unit(file, units=[length]) diff --git a/src/ifcopenshell-python/test/api/alignment/test_create_no_geometry.py b/src/ifcopenshell-python/test/api/alignment/test_create_no_geometry.py index 9d4aee5988..41bd0fb820 100644 --- a/src/ifcopenshell-python/test/api/alignment/test_create_no_geometry.py +++ b/src/ifcopenshell-python/test/api/alignment/test_create_no_geometry.py @@ -23,7 +23,7 @@ import ifcopenshell.api.alignment import ifcopenshell.api.unit try: - ifcopenshell.file(schema="IFC4X3_ADD2") + ifcopenshell.file(schema="IFC4X3") IFC4X3_AVAILABLE = True except RuntimeError: IFC4X3_AVAILABLE = False @@ -31,7 +31,7 @@ except RuntimeError: @pytest.mark.skipif(not IFC4X3_AVAILABLE, reason="IFC4X3 not available") def test_create_no_geometry(): - file = ifcopenshell.file(schema="IFC4X3_ADD2") + file = ifcopenshell.file(schema="IFC4X3") project = file.createIfcProject(GlobalId=ifcopenshell.guid.new(), Name="Test") length = ifcopenshell.api.unit.add_si_unit(file, unit_type="LENGTHUNIT") ifcopenshell.api.unit.assign_unit(file, units=[length]) diff --git a/src/ifcopenshell-python/test/api/alignment/test_create_representation.py b/src/ifcopenshell-python/test/api/alignment/test_create_representation.py index 0fd0b2dc41..663d4500ac 100644 --- a/src/ifcopenshell-python/test/api/alignment/test_create_representation.py +++ b/src/ifcopenshell-python/test/api/alignment/test_create_representation.py @@ -56,7 +56,7 @@ def test_create_representation(): (12799.99998062693, 89.99999997234107, 0.9999875002340269, -0.004999937569813611), ] - file = ifcopenshell.file(schema="IFC4X3_ADD2") + file = ifcopenshell.file(schema="IFC4X3") file.header.file_description.description = ["ViewDefinition [Alignment-basedView]"] project = file.createIfcProject(GlobalId=ifcopenshell.guid.new(), Name="FHWA Alignment") diff --git a/src/ifcopenshell-python/test/api/alignment/test_get_alignment.py b/src/ifcopenshell-python/test/api/alignment/test_get_alignment.py index ff2263fb86..dcb2d0fcb2 100644 --- a/src/ifcopenshell-python/test/api/alignment/test_get_alignment.py +++ b/src/ifcopenshell-python/test/api/alignment/test_get_alignment.py @@ -24,7 +24,7 @@ import ifcopenshell.api.context import ifcopenshell.api.unit try: - ifcopenshell.file(schema="IFC4X3_ADD2") + ifcopenshell.file(schema="IFC4X3") IFC4X3_AVAILABLE = True except RuntimeError: IFC4X3_AVAILABLE = False @@ -32,7 +32,7 @@ except RuntimeError: @pytest.mark.skipif(not IFC4X3_AVAILABLE, reason="IFC4X3 not available") def test_get_alignment(): - file = ifcopenshell.file(schema="IFC4X3_ADD2") + file = ifcopenshell.file(schema="IFC4X3") project = file.createIfcProject(GlobalId=ifcopenshell.guid.new(), Name="Test") length = ifcopenshell.api.unit.add_si_unit(file, unit_type="LENGTHUNIT") ifcopenshell.api.unit.assign_unit(file, units=[length]) diff --git a/src/ifcopenshell-python/test/api/cogo/test_add_survey_point.py b/src/ifcopenshell-python/test/api/cogo/test_add_survey_point.py index dbc65199f2..248435f852 100644 --- a/src/ifcopenshell-python/test/api/cogo/test_add_survey_point.py +++ b/src/ifcopenshell-python/test/api/cogo/test_add_survey_point.py @@ -23,7 +23,7 @@ import ifcopenshell.api.cogo import ifcopenshell.api.context try: - ifcopenshell.file(schema="IFC4X3_ADD2") + ifcopenshell.file(schema="IFC4X3") IFC4X3_AVAILABLE = True except RuntimeError: IFC4X3_AVAILABLE = False @@ -31,7 +31,7 @@ except RuntimeError: @pytest.mark.skipif(not IFC4X3_AVAILABLE, reason="IFC4X3 not available") def test_add_survey_point(): - file = ifcopenshell.file(schema="IFC4X3_ADD2") + file = ifcopenshell.file(schema="IFC4X3") project = file.createIfcProject(Name="Test") site = file.createIfcSite(GlobalId=ifcopenshell.guid.new(), Name="MySite") ifcopenshell.api.aggregate.assign_object(file, relating_object=project, products=[site]) diff --git a/src/ifcopenshell-python/test/api/cogo/test_assign_survey_point.py b/src/ifcopenshell-python/test/api/cogo/test_assign_survey_point.py index da86d2ea1a..d61a80f3f8 100644 --- a/src/ifcopenshell-python/test/api/cogo/test_assign_survey_point.py +++ b/src/ifcopenshell-python/test/api/cogo/test_assign_survey_point.py @@ -23,7 +23,7 @@ import ifcopenshell.api.cogo import ifcopenshell.api.context try: - ifcopenshell.file(schema="IFC4X3_ADD2") + ifcopenshell.file(schema="IFC4X3") IFC4X3_AVAILABLE = True except RuntimeError: IFC4X3_AVAILABLE = False @@ -31,7 +31,7 @@ except RuntimeError: @pytest.mark.skipif(not IFC4X3_AVAILABLE, reason="IFC4X3 not available") def test_assign_survey_point(): - file = ifcopenshell.file(schema="IFC4X3_ADD2") + file = ifcopenshell.file(schema="IFC4X3") project = file.createIfcProject(Name="Test") site = file.createIfcSite(GlobalId=ifcopenshell.guid.new(), Name="MySite") ifcopenshell.api.aggregate.assign_object(file, relating_object=project, products=[site]) diff --git a/src/ifcopenshell-python/test/api/cogo/test_edit_survey_point.py b/src/ifcopenshell-python/test/api/cogo/test_edit_survey_point.py index f641ae0246..e4528840d1 100644 --- a/src/ifcopenshell-python/test/api/cogo/test_edit_survey_point.py +++ b/src/ifcopenshell-python/test/api/cogo/test_edit_survey_point.py @@ -23,7 +23,7 @@ import ifcopenshell.api.cogo import ifcopenshell.api.context try: - ifcopenshell.file(schema="IFC4X3_ADD2") + ifcopenshell.file(schema="IFC4X3") IFC4X3_AVAILABLE = True except RuntimeError: IFC4X3_AVAILABLE = False @@ -31,7 +31,7 @@ except RuntimeError: @pytest.mark.skipif(not IFC4X3_AVAILABLE, reason="IFC4X3 not available") def test_edit_survey_point(): - file = ifcopenshell.file(schema="IFC4X3_ADD2") + file = ifcopenshell.file(schema="IFC4X3") project = file.createIfcProject(Name="Test") site = file.createIfcSite(GlobalId=ifcopenshell.guid.new(), Name="MySite") ifcopenshell.api.aggregate.assign_object(file, relating_object=project, products=[site]) diff --git a/src/ifcopenshell-python/test/util/test_alignment.py b/src/ifcopenshell-python/test/util/test_alignment.py index f23a85743c..8014fd6123 100644 --- a/src/ifcopenshell-python/test/util/test_alignment.py +++ b/src/ifcopenshell-python/test/util/test_alignment.py @@ -23,14 +23,14 @@ import ifcopenshell.api.unit import ifcopenshell.util.alignment as sta try: - ifcopenshell.file(schema="IFC4X3_ADD2") + ifcopenshell.file(schema="IFC4X3") IFC4X3_AVAILABLE = True except RuntimeError: IFC4X3_AVAILABLE = False def _test_si_stations(): - file = ifcopenshell.file(schema="IFC4X3_ADD2") + file = ifcopenshell.file(schema="IFC4X3") project = file.createIfcProject(GlobalId=ifcopenshell.guid.new(), Name="Test") length = ifcopenshell.api.unit.add_si_unit(file, unit_type="LENGTHUNIT") # meter ifcopenshell.api.unit.assign_unit(file, units=[length]) @@ -52,7 +52,7 @@ def _test_si_stations(): def _test_si_stations_millimeter(): - file = ifcopenshell.file(schema="IFC4X3_ADD2") + file = ifcopenshell.file(schema="IFC4X3") project = file.createIfcProject(GlobalId=ifcopenshell.guid.new(), Name="Test") ifcopenshell.api.unit.assign_unit(file) @@ -64,7 +64,7 @@ def _test_si_stations_millimeter(): def _test_us_stations(): - file = ifcopenshell.file(schema="IFC4X3_ADD2") + file = ifcopenshell.file(schema="IFC4X3") project = file.createIfcProject(GlobalId=ifcopenshell.guid.new(), Name="Test") length = ifcopenshell.api.unit.add_conversion_based_unit(file, name="foot") ifcopenshell.api.unit.assign_unit(file, units=[length])