02b6ae5b0a45a4ac3a8644360a652bb0515b337d,nilearn/image/image.py,,new_img_like,#,668

Before Change


    // Hand-written loading code to avoid too much memory consumption
    orig_ref_niimg = ref_niimg
    if (not isinstance(ref_niimg, str)
            and not hasattr(ref_niimg, "get_data")
            and not hasattr(ref_niimg, "get_fdata")
            and hasattr(ref_niimg, "__iter__")):
        ref_niimg = ref_niimg[0]
    if not ((hasattr(ref_niimg, "get_data")

After Change


    // Hand-written loading code to avoid too much memory consumption
    orig_ref_niimg = ref_niimg
    is_str = isinstance(ref_niimg, str)
    has_get_data = hasattr(ref_niimg, "get_data")
    has_get_fdata = hasattr(ref_niimg, "get_fdata")
    has_iter = hasattr(ref_niimg, "__iter__")
    has_affine = hasattr(ref_niimg, "affine")
    if has_iter and not any([is_str, has_get_data, has_get_fdata]):
        ref_niimg = ref_niimg[0]
        is_str = isinstance(ref_niimg, str)
        has_get_data = hasattr(ref_niimg, "get_data")
        has_get_fdata = hasattr(ref_niimg, "get_fdata")
        has_iter = hasattr(ref_niimg, "__iter__")
        has_affine = hasattr(ref_niimg, "affine")
    if not ((has_get_data or has_get_fdata) and has_affine):
        if is_str:
            ref_niimg = nibabel.load(ref_niimg)
        else:
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 4

Non-data size: 4

Instances


Project Name: nilearn/nilearn
Commit Name: 02b6ae5b0a45a4ac3a8644360a652bb0515b337d
Time: 2020-05-20
Author: z.baratz@gmail.com
File Name: nilearn/image/image.py
Class Name:
Method Name: new_img_like


Project Name: explosion/thinc
Commit Name: 863f813b7bf43f60a2490ba6986e1d289bd6b90e
Time: 2019-12-26
Author: honnibal+gh@gmail.com
File Name: thinc/neural/util.py
Class Name:
Method Name: get_width


Project Name: rasbt/mlxtend
Commit Name: 1ca3059b98f8af0816488c1ac64f86506054ba68
Time: 2019-02-13
Author: 36783730+tetrar124@users.noreply.github.com
File Name: mlxtend/feature_selection/column_selector.py
Class Name: ColumnSelector
Method Name: transform


Project Name: explosion/thinc
Commit Name: 21f49ea15d6645fef2fb2a804ffc97dbb3debbe5
Time: 2019-12-28
Author: honnibal+gh@gmail.com
File Name: thinc/neural/util.py
Class Name:
Method Name: get_width