def __init__(self, id, parent=None, inherits=False, exits=False, line_number=None, **resources): Scope.__init__(self, parent, line_number, **resources) self.id = id self.inherits = inherits self.exits = exits self.line_number = line_number for id, section in self.all('section'): section.parent = self self.children[id.lower()] = section for id, rule in self.all('rule'): action, target = rule.section_action if isinstance(target, Section): self.add('section', target) target.parent = self if target.id is not None: self.children[target.id.lower()] = target
def __eq__(self, rhs): return (isinstance(rhs, Section) and compare_nullable_icase(self.id, rhs.id) and self.inherits == rhs.inherits and self.exits == rhs.exits and Scope.__eq__(self, rhs))