77459eae73350adba1060e752ec04df0f898ab89,imagekit/fields.py,,_post_save_handler,#,263

Before Change


    for spec_file in spec_files:
        name = spec_file.attname
        imgfield = spec_file._imgfield
        if imgfield:
            newfile = imgfield.storage.open(imgfield.name)
            img = Image.open(newfile)
            img, format = spec_file.field.process(img, spec_file)
            if format != "JPEG":
                imgfile = img_to_fobj(img, format)
            else:
                imgfile = img_to_fobj(img, format,
                                      quality=int(spec_file.field.quality),
                                      optimize=True)
            content = ContentFile(imgfile.read())
            newfile.close()
            name = str(imgfield)
            imgfield.storage.delete(name)
            imgfield.storage.save(name, content)
            if not created:
                spec_file._delete()
                spec_file._create()


def _post_delete_handler(sender, instance=None, **kwargs):
    assert instance._get_pk_val() is not None, "%s object can"t be deleted because its %s attribute is set to None." % (instance._meta.object_name, instance._meta.pk.attname)
    spec_files = get_spec_files(instance)
    for spec_file in spec_files:

After Change


    for spec_file in spec_files:
        if not created:
            spec_file._delete()
        if spec_file.field.pre_cache:
            spec_file._create()


def _post_delete_handler(sender, instance=None, **kwargs):
    assert instance._get_pk_val() is not None, "%s object can"t be deleted because its %s attribute is set to None." % (instance._meta.object_name, instance._meta.pk.attname)
    spec_files = get_spec_files(instance)
    for spec_file in spec_files:
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 5

Instances


Project Name: matthewwithanm/django-imagekit
Commit Name: 77459eae73350adba1060e752ec04df0f898ab89
Time: 2011-09-22
Author: lettertwo@gmail.com
File Name: imagekit/fields.py
Class Name:
Method Name: _post_save_handler


Project Name: scikit-image/scikit-image
Commit Name: f8d9a6c144ef84bad2478a4ba4eedb1c559274e0
Time: 2020-11-11
Author: rfezzani@gmail.com
File Name: skimage/_shared/coord.py
Class Name:
Method Name: ensure_spacing


Project Name: ntucllab/libact
Commit Name: e81142f0869321cd8792e13bfc4f6fb85d9f1efc
Time: 2015-12-22
Author: yangarbiter@gmail.com
File Name: libact/query_strategies/uncertainty_sampling.py
Class Name: UncertaintySampling
Method Name: make_query