Skip to content

Commit e790688

Browse files
committed
Refactor IDS into IfcTester with less magic and less code
* String building code all deleted and replaced with more maintainable code * Obscure features like metaclasses deleted * Regular constructors used instead of factory create and parse methods * Use Python class naming convention * Use polymorphism more (e.g. asdict, init) for facet classes * No more boolean any/and as users may want to test everything and not fail early * Error state is stored instead of streamed to logger so it can be tested and more flexible formatting
1 parent 1586c85 commit e790688

8 files changed

Lines changed: 3011 additions & 0 deletions

File tree

src/ifctester/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# ifctester
2+
3+
Author, test, and see reports from IDS audits on the command line, as a webapp, or as a library.

src/ifctester/ifctester/__init__.py

Whitespace-only changes.
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
#!/usr/bin/env python3
2+
3+
# IfcTester - IDS based model auditing
4+
# Copyright (C) 2022 Dion Moult <dion@thinkmoult.com>
5+
#
6+
# This file is part of IfcTester.
7+
#
8+
# IfcTester is free software: you can redistribute it and/or modify
9+
# it under the terms of the GNU Lesser General Public License as published by
10+
# the Free Software Foundation, either version 3 of the License, or
11+
# (at your option) any later version.
12+
#
13+
# IfcTester is distributed in the hope that it will be useful,
14+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
15+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16+
# GNU Lesser General Public License for more details.
17+
#
18+
# You should have received a copy of the GNU Lesser General Public License
19+
# along with IfcTester. If not, see <http://www.gnu.org/licenses/>.
20+
21+
import time
22+
import argparse
23+
24+
from . import ids
25+
from . import reporter
26+
import ifcopenshell
27+
28+
parser = argparse.ArgumentParser(description="Uses an IDS to audit an IFC")
29+
parser.add_argument("ids", type=str, help="Path to an IDS")
30+
parser.add_argument("ifc", type=str, help="Path to an IFC")
31+
parser.add_argument(
32+
"-r", "--reporter", type=str, help="The reporting method to view audit results", default="Console"
33+
)
34+
args = parser.parse_args()
35+
36+
start = time.time()
37+
specs = ids.open(args.ids)
38+
ifc = ifcopenshell.open(args.ifc)
39+
print("Finished loading:", time.time() - start)
40+
start = time.time()
41+
specs.validate(ifc)
42+
print("Finished validating:", time.time() - start)
43+
start = time.time()
44+
reporter.Console(specs).report()

0 commit comments

Comments
 (0)