sql: remove debug prints

This commit is contained in:
Andrej730
2026-09-02 14:51:48 +05:00
parent 6b62723aae
commit 2b0ebcee32
+1 -15
View File
@@ -144,8 +144,6 @@ class sqlite(file):
self.ifc_class_inverses = {} self.ifc_class_inverses = {}
for declaration in self.ifc_schema.entities(): for declaration in self.ifc_schema.entities():
# print('Dealing with declaration', declaration.name())
self.ifc_class_subtypes[declaration.name()] = ifcopenshell.util.schema.get_subtypes(declaration) self.ifc_class_subtypes[declaration.name()] = ifcopenshell.util.schema.get_subtypes(declaration)
self.ifc_class_attributes[declaration.name()] = {a.name(): a for a in declaration.all_attributes()} self.ifc_class_attributes[declaration.name()] = {a.name(): a for a in declaration.all_attributes()}
self.ifc_class_inverse_attributes[declaration.name()] = { self.ifc_class_inverse_attributes[declaration.name()] = {
@@ -166,7 +164,6 @@ class sqlite(file):
self.ifc_class_inverses[subtype.name()][declaration.name()].append(attribute.name()) self.ifc_class_inverses[subtype.name()][declaration.name()].append(attribute.name())
elif self.is_entity_list(attribute): elif self.is_entity_list(attribute):
# print('is an entity list', attribute.name())
entity_list.append(attribute.name()) entity_list.append(attribute.name())
for entity_name in re.findall("<entity (.*?)>", str(attribute)): for entity_name in re.findall("<entity (.*?)>", str(attribute)):
@@ -258,7 +255,6 @@ class sqlite(file):
results.append(result) results.append(result)
if max_levels is None or max_levels: if max_levels is None or max_levels:
queue.append(result) queue.append(result)
# print('traverse results', results)
return results return results
def get_inverse( def get_inverse(
@@ -351,9 +347,7 @@ class sqlite_entity:
wrapped_data: ifcopenshell.entity_instance wrapped_data: ifcopenshell.entity_instance
def __init__(self, id: int, ifc_class: str, file: sqlite = None): def __init__(self, id: int, ifc_class: str, file: sqlite = None):
if not ifc_class: assert ifc_class, (id, ifc_class, file)
print(id, ifc_class, file)
assert False
s = sqlite_wrapper(id, ifc_class, file) s = sqlite_wrapper(id, ifc_class, file)
object.__setattr__(self, "wrapped_data", file._create_entity(ifc_class)) object.__setattr__(self, "wrapped_data", file._create_entity(ifc_class))
object.__setattr__(self, "sqlite_wrapper", s) object.__setattr__(self, "sqlite_wrapper", s)
@@ -383,9 +377,6 @@ class sqlite_entity:
self.sqlite_wrapper.attribute_cache = {} self.sqlite_wrapper.attribute_cache = {}
def __getattr__(self, name: str) -> Any: def __getattr__(self, name: str) -> Any:
# print("*" * 100)
# print("GETATTR", self.sqlite_wrapper.id, self.sqlite_wrapper.ifc_class, name)
INVALID, FORWARD, INVERSE, DERIVED = range(4) INVALID, FORWARD, INVERSE, DERIVED = range(4)
attr_cat = self.wrapped_data.get_attribute_category(name) attr_cat = self.wrapped_data.get_attribute_category(name)
if attr_cat == DERIVED: if attr_cat == DERIVED:
@@ -394,13 +385,8 @@ class sqlite_entity:
return None return None
if attr_cat == FORWARD: if attr_cat == FORWARD:
if self.sqlite_wrapper.attribute_cache: if self.sqlite_wrapper.attribute_cache:
# print(self.sqlite_wrapper.ifc_class)
# print(self.sqlite_wrapper.attribute_cache)
return self.sqlite_wrapper.attribute_cache[name] return self.sqlite_wrapper.attribute_cache[name]
# print('first time for', self.sqlite_wrapper.ifc_class)
# print("IT IS A FORWARD")
query = f"SELECT * FROM {self.sqlite_wrapper.ifc_class} WHERE `ifc_id` = {self.sqlite_wrapper.id} LIMIT 1" query = f"SELECT * FROM {self.sqlite_wrapper.ifc_class} WHERE `ifc_id` = {self.sqlite_wrapper.id} LIMIT 1"
self.sqlite_wrapper.file.cursor.execute(query) self.sqlite_wrapper.file.cursor.execute(query)
row = self.sqlite_wrapper.file.cursor.fetchone() row = self.sqlite_wrapper.file.cursor.fetchone()