e676433ece6bc034beb9eedaeb19fc5b786dc565,server/website/website/forms.py,SessionForm,save,#SessionForm#Any#,60

Before Change


        memory2 = self.cleaned_data["memory"]
        storage2 = self.cleaned_data["storage"]

        if hasattr(model, "hardware"):
            model.hardware.cpu = cpu2
            model.hardware.memory = memory2
            model.hardware.storage = storage2
            model.hardware.save()
        else:
            last_type = Hardware.objects.aggregate(Max("type"))["type__max"]
            if last_type is None:
                last_type = 0
            model.hardware = Hardware.objects.create(type=last_type + 1,
                                                     name="New Hardware",
                                                     cpu=cpu2,
                                                     memory=memory2,
                                                     storage=storage2,
                                                     storage_type="Default",
                                                     additional_specs="{}")

        if commit:
            model.save()

        return model

After Change


        cpu2 = self.cleaned_data["cpu"]
        memory2 = self.cleaned_data["memory"]
        storage2 = self.cleaned_data["storage"]
        storage_type2 = self.cleaned_data["storage_type"]

        hardware, _ = Hardware.objects.get_or_create(cpu=cpu2,
                                                     memory=memory2,
                                                     storage=storage2,
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 8

Instances


Project Name: cmu-db/ottertune
Commit Name: e676433ece6bc034beb9eedaeb19fc5b786dc565
Time: 2019-10-03
Author: dvanaken@cs.cmu.edu
File Name: server/website/website/forms.py
Class Name: SessionForm
Method Name: save


Project Name: automl/auto-sklearn
Commit Name: 64193d2328e0e17ace5a9be4e2bcdc97c1290138
Time: 2020-11-25
Author: 44504424+franchuterivera@users.noreply.github.com
File Name: autosklearn/data/validation.py
Class Name: InputValidator
Method Name: _check_and_encode_features


Project Name: elfi-dev/elfi
Commit Name: ed3a343d536daeb51eb0e39e630717c32c611766
Time: 2016-10-19
Author: henri.vuollekoski@helsinki.fi
File Name: abcpy/methods.py
Class Name: Rejection
Method Name: infer