def __init__(self, data, separator=','):
    self._value = data
    self.set_count = len(self._value)
    item_values = {}
    modules = []
    total_ip_set = set()
    verbose_ip_list = []
    verbose_ip_module_list = []
    for item in data:
        set_name = item['bk_set_name']
        for (key, val) in item.items():
            if (key == '__module'):
                module_ips = flatten([mod['value'] for mod in val])
                total_ip_set.update(module_ips)
                verbose_ip_list += module_ips
                verbose_ip_module_list += flatten([(['{}>{}'.format(set_name, mod['key'])] * len(mod['value'])) for mod in val])
                item_module = {mod['key']: separator.join(mod['value']) for mod in val}
                modules.append(item_module)
            else:
                item_values.setdefault(key, []).append(val)
    for (attr, attr_val) in item_values.items():
        setattr(self, attr, attr_val)
        flat_val = separator.join(map(str, attr_val))
        setattr(self, 'flat__{}'.format(attr), flat_val)
    setattr(self, '_module', modules)
    setattr(self, 'flat__ip_list', separator.join(list(total_ip_set)))
    setattr(self, 'flat__verbose_ip_list', separator.join(verbose_ip_list))
    setattr(self, 'flat__verbose_ip_module_list', separator.join(verbose_ip_module_list))
    self._pipeline_var_str_value = 'Allocate {} sets with names: {}'.format(self.set_count, separator.join(item_values['bk_set_name']))
def __init__(self, data, separator=','):
    self._value = data
    self.set_count = len(self._value)
    item_values = {}
    modules = []
    total_ip_set = set()
    verbose_ip_list = []
    verbose_ip_module_list = []
    for item in data:
        set_name = item['bk_set_name']
        for (key, val) in item.items():
            if (key == '__module'):
                module_ips = flatten([mod['value'] for mod in val])
                total_ip_set.update(module_ips)
                verbose_ip_list += module_ips
                verbose_ip_module_list += flatten([(['{}>{}'.format(set_name, mod['key'])] * len(mod['value'])) for mod in val])
                item_module = {mod['key']: separator.join(mod['value']) for mod in val}
                modules.append(item_module)
            else:
                item_values.setdefault(key, []).append(val)
    for (attr, attr_val) in item_values.items():
        setattr(self, attr, attr_val)
        flat_val = separator.join(map(str, attr_val))
        setattr(self, 'flat__{}'.format(attr), flat_val)
    setattr(self, '_module', modules)
    setattr(self, 'flat__ip_list', separator.join(list(total_ip_set)))
    setattr(self, 'flat__verbose_ip_list', separator.join(verbose_ip_list))
    setattr(self, 'flat__verbose_ip_module_list', separator.join(verbose_ip_module_list))
    self._pipeline_var_str_value = 'Allocate {} sets with names: {}'.format(self.set_count, separator.join(item_values['bk_set_name']))