From 89c66f62bfa31d5c4c5de392291221a81ae9d916 Mon Sep 17 00:00:00 2001 From: Thomas Krijnen Date: Tue, 21 Apr 2026 21:59:02 +0200 Subject: [PATCH] Python import fixes: import from wrapper now which inherits from mixins --- src/ifcopenshell-python/ifcopenshell/__init__.py | 5 ++--- src/ifcopenshell-python/ifcopenshell/file.py | 3 +-- src/ifcopenshell-python/ifcopenshell/sql.py | 3 +-- 3 files changed, 4 insertions(+), 7 deletions(-) diff --git a/src/ifcopenshell-python/ifcopenshell/__init__.py b/src/ifcopenshell-python/ifcopenshell/__init__.py index 5be7062403..f3e03b633f 100644 --- a/src/ifcopenshell-python/ifcopenshell/__init__.py +++ b/src/ifcopenshell-python/ifcopenshell/__init__.py @@ -91,9 +91,8 @@ except Exception: # `_file`, `_stream` is used only for annotations inside this file, # see https://github.com/microsoft/pyright/discussions/9065. from . import guid -from .entity_instance import entity_instance -from .file import file, rocksdb_lazy_instance -from .file import file as _file +from .ifcopenshell_wrapper import entity_instance, file +from .file import rocksdb_lazy_instance from .sql import sqlite, sqlite_entity # explicitly specify available imported symbols diff --git a/src/ifcopenshell-python/ifcopenshell/file.py b/src/ifcopenshell-python/ifcopenshell/file.py index 14fde68dd4..76123035f6 100644 --- a/src/ifcopenshell-python/ifcopenshell/file.py +++ b/src/ifcopenshell-python/ifcopenshell/file.py @@ -35,7 +35,6 @@ import ifcopenshell from ifcopenshell.util.mvd_info import LARK_AVAILABLE, MvdInfo from . import ifcopenshell_wrapper -from .entity_instance import entity_instance if TYPE_CHECKING: import ifcopenshell.util.schema @@ -702,7 +701,7 @@ class file_mixin: else: raise AttributeError - def __getitem__(self, key: Union[numbers.Integral, str, bytes]) -> entity_instance: + def __getitem__(self, key: Union[numbers.Integral, str, bytes]) -> ifcopenshell.entity_instance: if isinstance(key, numbers.Integral): return self.by_id(key) elif isinstance(key, (str, bytes)): diff --git a/src/ifcopenshell-python/ifcopenshell/sql.py b/src/ifcopenshell-python/ifcopenshell/sql.py index de7a50c320..8bfe4d4743 100644 --- a/src/ifcopenshell-python/ifcopenshell/sql.py +++ b/src/ifcopenshell-python/ifcopenshell/sql.py @@ -31,8 +31,7 @@ import ifcopenshell.util.attribute import ifcopenshell.util.schema from . import ifcopenshell_wrapper -from .entity_instance import entity_instance -from .file import file +from . import file, entity_instance if TYPE_CHECKING: import sqlite3