mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-19 06:39:13 +00:00
code formatting
This commit is contained in:
@@ -55,7 +55,6 @@ class facet(metaclass=meta_facet):
|
|||||||
try:
|
try:
|
||||||
v = self.node.getElementsByTagName(k)[0]
|
v = self.node.getElementsByTagName(k)[0]
|
||||||
elems = [n for n in v.childNodes if n.nodeType == n.ELEMENT_NODE]
|
elems = [n for n in v.childNodes if n.nodeType == n.ELEMENT_NODE]
|
||||||
|
|
||||||
if elems:
|
if elems:
|
||||||
return restriction(elems[0])
|
return restriction(elems[0])
|
||||||
else:
|
else:
|
||||||
@@ -91,7 +90,7 @@ class entity(facet):
|
|||||||
else:
|
else:
|
||||||
self.message = "an entity name '%(name)s'"
|
self.message = "an entity name '%(name)s'"
|
||||||
return facet_evaluation(inst.is_a(self.name), self.message % {"name": inst.is_a()})
|
return facet_evaluation(inst.is_a(self.name), self.message % {"name": inst.is_a()})
|
||||||
|
|
||||||
|
|
||||||
class classification(facet):
|
class classification(facet):
|
||||||
"""
|
"""
|
||||||
@@ -221,10 +220,8 @@ class restriction:
|
|||||||
self.type = "length"
|
self.type = "length"
|
||||||
elif n.nodeType == n.ELEMENT_NODE and n.tagName.endswith("pattern"):
|
elif n.nodeType == n.ELEMENT_NODE and n.tagName.endswith("pattern"):
|
||||||
self.options.append(n.getAttribute("value"))
|
self.options.append(n.getAttribute("value"))
|
||||||
self.type = "pattern"
|
self.type = "pattern"
|
||||||
|
|
||||||
# "Given an instance with %(applicability)s\nWe expect %(requirements)s" % self.__dict__
|
|
||||||
|
|
||||||
def __eq__(self, other):
|
def __eq__(self, other):
|
||||||
return other in self.options
|
return other in self.options
|
||||||
|
|
||||||
@@ -253,7 +250,7 @@ class specification:
|
|||||||
return [cls(n) for cls, n in zip(classes, children)]
|
return [cls(n) for cls, n in zip(classes, children)]
|
||||||
|
|
||||||
phrases = [n for n in node.childNodes if n.nodeType == n.ELEMENT_NODE]
|
phrases = [n for n in node.childNodes if n.nodeType == n.ELEMENT_NODE]
|
||||||
|
|
||||||
len(phrases) == 2 or error("expected two child nodes for <specification>")
|
len(phrases) == 2 or error("expected two child nodes for <specification>")
|
||||||
phrases[0].tagName == "applicability" or error("expected <applicability>")
|
phrases[0].tagName == "applicability" or error("expected <applicability>")
|
||||||
phrases[1].tagName == "requirements" or error("expected <requirements>")
|
phrases[1].tagName == "requirements" or error("expected <requirements>")
|
||||||
@@ -290,8 +287,8 @@ class ids:
|
|||||||
def validate(self, ifc_file, logger):
|
def validate(self, ifc_file, logger):
|
||||||
for spec in self.specifications:
|
for spec in self.specifications:
|
||||||
for elem in ifc_file.by_type("IfcObject"):
|
for elem in ifc_file.by_type("IfcObject"):
|
||||||
spec(elem, logger)
|
spec(elem, logger)
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
import sys, os
|
import sys, os
|
||||||
import logging
|
import logging
|
||||||
|
|||||||
Reference in New Issue
Block a user