2c76358bcdbd01b199c04893370c3b06e867cca9,descarteslabs/workflows/types/array/array_.py,Array,_promote,#Any#Any#,141

Before Change


    @classmethod
    def _promote(cls, obj):
        try:
            return super(Array, cls)._promote(obj)
        except TypeError:
            // `_promote` contract expectes ProxyTypeError, not TypeError
            raise ProxyTypeError("Cannot promote {} to {}".format(obj, cls))

After Change



        if isinstance(obj, cls):
            return obj
        if isinstance(obj, (Int, Float, Bool)):
            return cls(obj)

        try:
            return obj.cast(cls)
        except Exception:
            if not isinstance(obj, np.ndarray):
                obj = np.asarray(obj)
            numpy_promoter = (
                MaskedArray.from_numpy if isinstance(obj, np.ma.MaskedArray) else Array
            )
            try:
                return numpy_promoter(obj)
            except Exception:
                raise ProxyTypeError("Cannot promote {} to {}".format(obj, cls))

    @property
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 4

Instances


Project Name: descarteslabs/descarteslabs-python
Commit Name: 2c76358bcdbd01b199c04893370c3b06e867cca9
Time: 2020-03-30
Author: 51922948+sdelany2@users.noreply.github.com
File Name: descarteslabs/workflows/types/array/array_.py
Class Name: Array
Method Name: _promote


Project Name: descarteslabs/descarteslabs-python
Commit Name: b17e18b4224450aeb24e61d5545016dfe3f1b81a
Time: 2021-01-05
Author: gabe@descarteslabs.com
File Name: descarteslabs/workflows/execution/arguments.py
Class Name:
Method Name: promote_arguments


Project Name: descarteslabs/descarteslabs-python
Commit Name: 2c76358bcdbd01b199c04893370c3b06e867cca9
Time: 2020-03-30
Author: 51922948+sdelany2@users.noreply.github.com
File Name: descarteslabs/workflows/types/array/masked_array.py
Class Name:
Method Name: _promote_fill_value