

def __init__(self, code, type, value):
    self.code = value
    self.type = type
    if (self.type == 'Message'):
        if isinstance(value, django.core.exceptions.ValidationError):
            self.value = value.message_dict
            if [item[1][0] for item in self.value.items() if ('already exists' in item[1][0])]:
                self.code = self.DUPLICATE_ENTRY
        elif isinstance(value, list):
            self.value = value[0].message_dict
            self.value['message'] = str(value[1])
        else:
            self.value = {
                'message': str(value),
            }
    else:
        self.value = value

dataset/ETHPy150Open dgraziotin/dycapo/server/models/response.py Response.__init__/VarMisuse@20/22 `code`->`value`