MCPcopy Create free account
hub / github.com/IfcOpenShell/IfcOpenShell / to_file

Method to_file

src/ifctester/ifctester/reporter.py:729–810  ·  view source on GitHub ↗
(self, filepath: str)

Source from the content-addressed store, hash-verified

727 return name
728
729 def to_file(self, filepath: str) -> None:
730 from odf.opendocument import OpenDocumentSpreadsheet
731 from odf.style import Style, TableCellProperties
732 from odf.table import Table, TableCell, TableRow
733 from odf.text import P
734
735 self.doc = OpenDocumentSpreadsheet()
736
737 self.cell_formats = {}
738 for key, value in self.colours.items():
739 style = Style(name=key, family="table-cell")
740 style.addElement(TableCellProperties(backgroundcolor="#" + value))
741 self.doc.automaticstyles.addElement(style)
742 self.cell_formats[key] = style
743
744 table = Table(name=self.excel_safe_spreadsheet_name(self.results["title"]))
745 tr = TableRow()
746 for header in ["Specification", "Applicability", "Facet Type", "Data Name", "Value Requirements"]:
747 tc = TableCell(valuetype="string", stylename="h")
748 tc.addElement(P(text=header))
749 tr.addElement(tc)
750 table.addElement(tr)
751
752 rows = []
753 for specification in self.results["specifications"]:
754 applicability = ", ".join(specification["applicability"])
755 for requirement in specification["requirements"]:
756 rows.append(
757 [
758 specification["name"],
759 applicability,
760 requirement["facet_type"],
761 requirement["label"],
762 requirement["value"],
763 ]
764 )
765
766 for row in rows:
767 tr = TableRow()
768 c = 0
769 for col in row:
770 tc = TableCell(valuetype="string")
771 if col is None:
772 col = "NULL"
773 tc.addElement(P(text=col))
774 tr.addElement(tc)
775 c += 1
776 table.addElement(tr)
777 self.doc.spreadsheet.addElement(table)
778
779 while False:
780 for requirement in specification["requirements"]:
781 if requirement["status"]:
782 continue
783 for failure in requirement["failed_entities"]:
784 element = failure.get("element", None)
785 element_type = failure.get("element_type", None)
786 row = [

Callers

nothing calls this directly

Calls 8

StyleClass · 0.90
lowerMethod · 0.80
itemsMethod · 0.45
joinMethod · 0.45
appendMethod · 0.45
getMethod · 0.45
saveMethod · 0.45

Tested by

no test coverage detected