mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-20 04:04:00 +00:00
20fe48bd6a
* Add a way to validate the IFC file in BIMTester * Fix an issue in Report where only the first error was shown * Fix the usage of Schema in BIMTester * Add Aggreation steps to BIMTester
19 lines
537 B
Python
19 lines
537 B
Python
from collections import defaultdict
|
|
|
|
|
|
class TableModel:
|
|
"""This class represents a table of data"""
|
|
|
|
def __init__(self, key_name=None, value_name=None):
|
|
self.rows = defaultdict(list)
|
|
self.key_name = key_name
|
|
self.value_name = value_name
|
|
|
|
def add_row(self, related, relating):
|
|
self.rows[related].append(relating)
|
|
|
|
def get_count(self):
|
|
return len(self.rows)
|
|
|
|
def get_count_distinct_values(self):
|
|
return len(set(item for sublist in self.rows.values() for item in sublist)) |