Replace all ifcopenshell.api.run with ifcopenshell.api static functions.

This commit is contained in:
Dion Moult
2024-06-28 12:36:31 +10:00
parent b5d613989e
commit 07060fc769
432 changed files with 4633 additions and 4856 deletions
+4 -4
View File
@@ -18,14 +18,14 @@
import pytest
import ifcopenshell
import ifcopenshell.api
import ifcopenshell.api.project
import ifcopenshell.api.owner.settings
class IFC4X3:
@pytest.fixture(autouse=True)
def setup(self):
self.file: ifcopenshell.file = ifcopenshell.api.run("project.create_file", version="IFC4X3")
self.file: ifcopenshell.file = ifcopenshell.api.project.create_file(version="IFC4X3")
ifcopenshell.api.owner.settings.get_user = lambda ifc: (ifc.by_type("IfcPersonAndOrganization") or [None])[0]
ifcopenshell.api.owner.settings.get_application = lambda ifc: (ifc.by_type("IfcApplication") or [None])[0]
ifcopenshell.api.pre_listeners = {}
@@ -35,7 +35,7 @@ class IFC4X3:
class IFC4:
@pytest.fixture(autouse=True)
def setup(self):
self.file: ifcopenshell.file = ifcopenshell.api.run("project.create_file")
self.file: ifcopenshell.file = ifcopenshell.api.project.create_file()
ifcopenshell.api.owner.settings.get_user = lambda ifc: (ifc.by_type("IfcPersonAndOrganization") or [None])[0]
ifcopenshell.api.owner.settings.get_application = lambda ifc: (ifc.by_type("IfcApplication") or [None])[0]
ifcopenshell.api.pre_listeners = {}
@@ -45,7 +45,7 @@ class IFC4:
class IFC2X3:
@pytest.fixture(autouse=True)
def setup(self):
self.file: ifcopenshell.file = ifcopenshell.api.run("project.create_file", version="IFC2X3")
self.file: ifcopenshell.file = ifcopenshell.api.project.create_file(version="IFC2X3")
def get_user(ifc: ifcopenshell.file) -> ifcopenshell.entity_instance:
user = next(iter(ifc.by_type("IfcPersonAndOrganization")), None)