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

Class Node

src/ifcopenshell-python/ifcopenshell/express/nodes.py:27–51  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

25
26
27class Node:
28 def __init__(self, s, loc, tokens, rule=None):
29 self.rule = rule or (type(self).__name__)
30 self.tokens = tokens.asDict()
31 self.flat = sum([getattr(t, "flat", [t]) for t in tokens.asList()], [])
32 if rule is None:
33 self.init()
34
35 def __repr__(self):
36 return "%s(%s)" % (self.rule, ",".join("%s:%s" % i for i in self.tokens.items()))
37
38 def __getattr__(self, k):
39 return self.tokens.get(k)
40
41 def __getstate__(self):
42 return self.__dict__
43
44 def __setstate__(self, d):
45 self.__dict__.update(d)
46
47 def init(self):
48 pass
49
50 def any(self):
51 return next(iter(self.tokens.values()))
52
53
54class ListNode:

Callers 1

parseFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected