mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-10 17:58:20 +00:00
typing
This commit is contained in:
@@ -282,9 +282,10 @@ def get_cost_values(cost_item: ifcopenshell.entity_instance) -> list[dict[str, s
|
||||
|
||||
|
||||
def get_cost_schedule_types(file: ifcopenshell.file) -> list[dict[str, str]]:
|
||||
schema: ifcopenshell_wrapper.schema_definition = ifcopenshell_wrapper.schema_by_name(file.schema_identifier)
|
||||
schema = ifcopenshell_wrapper.schema_by_name(file.schema_identifier)
|
||||
results = []
|
||||
declaration = schema.declaration_by_name("IfcCostSchedule")
|
||||
declaration = schema.declaration_by_name("IfcCostSchedule").as_entity()
|
||||
assert declaration
|
||||
version = file.schema_identifier
|
||||
for attribute in declaration.attributes():
|
||||
if attribute.name() == "PredefinedType":
|
||||
|
||||
@@ -136,8 +136,8 @@ def get_subtypes(
|
||||
[<entity IfcFlowSegment>, <entity IfcCableCarrierSegment>, ..., <entity IfcPipeSegment>]
|
||||
"""
|
||||
|
||||
def get_classes(decl):
|
||||
results = []
|
||||
def get_classes(decl: ifcopenshell_wrapper.entity) -> list[ifcopenshell_wrapper.entity]:
|
||||
results: list[ifcopenshell_wrapper.entity] = []
|
||||
if not decl.is_abstract():
|
||||
results.append(decl)
|
||||
for subtype in decl.subtypes():
|
||||
@@ -172,7 +172,7 @@ def reassign_class(
|
||||
if not ifc_file:
|
||||
ifc_file = element.file
|
||||
|
||||
schema: ifcopenshell_wrapper.schema_definition = ifcopenshell_wrapper.schema_by_name(ifc_file.schema_identifier)
|
||||
schema = ifcopenshell_wrapper.schema_by_name(ifc_file.schema_identifier)
|
||||
try:
|
||||
declaration = schema.declaration_by_name(new_class)
|
||||
except RuntimeError:
|
||||
|
||||
@@ -815,12 +815,13 @@ def iter_element_and_attributes_per_type(ifc_file: ifcopenshell.file, attr_type_
|
||||
None,
|
||||
None,
|
||||
]:
|
||||
schema: ifcopenshell_wrapper.schema_definition = ifcopenshell_wrapper.schema_by_name(ifc_file.schema_identifier)
|
||||
schema = ifcopenshell_wrapper.schema_by_name(ifc_file.schema_identifier)
|
||||
|
||||
for element in ifc_file:
|
||||
entity = schema.declaration_by_name(element.is_a())
|
||||
entity = schema.declaration_by_name(element.is_a()).as_entity()
|
||||
assert entity
|
||||
attrs = entity.all_attributes()
|
||||
attrs_derived: tuple[bool, ...] = entity.derived()
|
||||
attrs_derived = entity.derived()
|
||||
for attr, val, is_derived in zip(attrs, list(element), attrs_derived):
|
||||
if is_derived:
|
||||
continue
|
||||
|
||||
Reference in New Issue
Block a user