2a1bd4c93a998d16516d82893401b346d66a95e9,imgaug/dtypes.py,,get_minimal_dtype,#Any#Any#,58

Before Change


                 for array in arrays]
    promoted_dt = np.promote_types(*input_dts)
    if increase_itemsize_factor > 1:
        promoted_dt_highres = "%s%d" % (promoted_dt.kind, promoted_dt.itemsize * increase_itemsize_factor)
        try:
            promoted_dt_highres = np.dtype(promoted_dt_highres)
            return promoted_dt_highres
        except TypeError:
            raise TypeError(
                ("Unable to create a numpy dtype matching the name "%s". "

After Change


    // dtypes and (3) list of 3+ dtypes. Note that promote_dtypes() always
    // expects exactly two dtypes.
    promoted_dt = input_dts[0]
    input_dts = input_dts[1:]
    while len(input_dts) >= 1:
        promoted_dt = np.promote_types(promoted_dt, input_dts[0])
        input_dts = input_dts[1:]

    if increase_itemsize_factor > 1:
        assert isinstance(promoted_dt, np.dtype), (
            "Expected numpy.dtype output from numpy.promote_dtypes, got type "
            "%s." % (type(promoted_dt),))
        return increase_itemsize_of_dtype(promoted_dt,
                                          increase_itemsize_factor)
    return promoted_dt


// TODO rename to: promote_arrays_to_minimal_dtype_
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 8

Instances


Project Name: aleju/imgaug
Commit Name: 2a1bd4c93a998d16516d82893401b346d66a95e9
Time: 2019-07-19
Author: kontakt@ajung.name
File Name: imgaug/dtypes.py
Class Name:
Method Name: get_minimal_dtype


Project Name: nicodv/kmodes
Commit Name: 60fe2731859d44ad2d94b6699682e077c221bd19
Time: 2016-06-16
Author: nico.devos@autogrid.com
File Name: kmodes/util/__init__.py
Class Name:
Method Name: get_unique_rows


Project Name: aleju/imgaug
Commit Name: 2a1bd4c93a998d16516d82893401b346d66a95e9
Time: 2019-07-19
Author: kontakt@ajung.name
File Name: imgaug/dtypes.py
Class Name:
Method Name: increase_array_resolutions_