Python import fixes: import from wrapper now which inherits from mixins

This commit is contained in:
Thomas Krijnen
2026-04-21 21:59:02 +02:00
parent 18363c0d19
commit 89c66f62bf
3 changed files with 4 additions and 7 deletions
@@ -91,9 +91,8 @@ except Exception:
# `_file`, `_stream` is used only for annotations inside this file, # `_file`, `_stream` is used only for annotations inside this file,
# see https://github.com/microsoft/pyright/discussions/9065. # see https://github.com/microsoft/pyright/discussions/9065.
from . import guid from . import guid
from .entity_instance import entity_instance from .ifcopenshell_wrapper import entity_instance, file
from .file import file, rocksdb_lazy_instance from .file import rocksdb_lazy_instance
from .file import file as _file
from .sql import sqlite, sqlite_entity from .sql import sqlite, sqlite_entity
# explicitly specify available imported symbols # explicitly specify available imported symbols
+1 -2
View File
@@ -35,7 +35,6 @@ import ifcopenshell
from ifcopenshell.util.mvd_info import LARK_AVAILABLE, MvdInfo from ifcopenshell.util.mvd_info import LARK_AVAILABLE, MvdInfo
from . import ifcopenshell_wrapper from . import ifcopenshell_wrapper
from .entity_instance import entity_instance
if TYPE_CHECKING: if TYPE_CHECKING:
import ifcopenshell.util.schema import ifcopenshell.util.schema
@@ -702,7 +701,7 @@ class file_mixin:
else: else:
raise AttributeError 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): if isinstance(key, numbers.Integral):
return self.by_id(key) return self.by_id(key)
elif isinstance(key, (str, bytes)): elif isinstance(key, (str, bytes)):
+1 -2
View File
@@ -31,8 +31,7 @@ import ifcopenshell.util.attribute
import ifcopenshell.util.schema import ifcopenshell.util.schema
from . import ifcopenshell_wrapper from . import ifcopenshell_wrapper
from .entity_instance import entity_instance from . import file, entity_instance
from .file import file
if TYPE_CHECKING: if TYPE_CHECKING:
import sqlite3 import sqlite3