def _createListItem(s, l, t): value, attrs = t[0] if type(value) == dict: g = Config.Group(attrs) g.update(value) return g elif type(value) == list: l = Config.List(attrs) l += value return [l] else: return Config.Item(value, attrs)
def _createGroupItem(s, l, t): try: name, attrs, value = t[0] except ValueError: # An empty list is eaten by pyparsing name, attrs, value = t[0][0], t[0][1], [] if type(value) == dict: g = Config.Group(attrs) g.update(value) return name, g elif type(value) == list: l = Config.List(attrs) l += value return name, l else: return name, Config.Item(value, attrs)