mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-24 05:17:58 +00:00
sql, stream - define wrapped_data to provide more clear errors
This commit is contained in:
@@ -51,7 +51,6 @@ class sqlite(file):
|
|||||||
if not Path(filepath).exists():
|
if not Path(filepath).exists():
|
||||||
raise FileNotFoundError(f"File doesn't exist: {filepath}")
|
raise FileNotFoundError(f"File doesn't exist: {filepath}")
|
||||||
|
|
||||||
self.wrapped_data = None
|
|
||||||
self.history_size = 64
|
self.history_size = 64
|
||||||
self.history = []
|
self.history = []
|
||||||
self.future = []
|
self.future = []
|
||||||
@@ -270,6 +269,12 @@ class sqlite(file):
|
|||||||
# Override to avoid clean up data unrelated to sqlite file.
|
# Override to avoid clean up data unrelated to sqlite file.
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
def wrapped_data(self) -> NoReturn:
|
||||||
|
class_name = str(type(self))
|
||||||
|
raise Exception(
|
||||||
|
f"No `wrapped_data` for {class_name}. `ifcopenshell.{class_name}` is probably confused with `ifcopenshell.file`."
|
||||||
|
)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def schema(self) -> ifcopenshell.util.schema.IFC_SCHEMA:
|
def schema(self) -> ifcopenshell.util.schema.IFC_SCHEMA:
|
||||||
return self._schema
|
return self._schema
|
||||||
|
|||||||
@@ -88,7 +88,6 @@ try:
|
|||||||
|
|
||||||
class stream(file):
|
class stream(file):
|
||||||
def __init__(self, filepath: str):
|
def __init__(self, filepath: str):
|
||||||
self.wrapped_data = None
|
|
||||||
self.history_size = 64
|
self.history_size = 64
|
||||||
self.history = []
|
self.history = []
|
||||||
self.future = []
|
self.future = []
|
||||||
@@ -288,6 +287,12 @@ try:
|
|||||||
# Override to avoid clean up unrelated to stream file.
|
# Override to avoid clean up unrelated to stream file.
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
def wrapped_data(self) -> NoReturn:
|
||||||
|
class_name = str(type(self))
|
||||||
|
raise Exception(
|
||||||
|
f"No `wrapped_data` for {class_name}. `ifcopenshell.{class_name}` is probably confused with `ifcopenshell.file`."
|
||||||
|
)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def schema(self) -> ifcopenshell.util.schema.IFC_SCHEMA:
|
def schema(self) -> ifcopenshell.util.schema.IFC_SCHEMA:
|
||||||
return self._schema
|
return self._schema
|
||||||
|
|||||||
Reference in New Issue
Block a user