fcdfebefd9d452952d16669c1257292865d7405b,homeassistant/components/sensor/wunderground.py,WUndergroundSensor,device_state_attributes,#WUndergroundSensor#,175

Before Change


        if not self.rest.alerts or self._condition != "alerts":
            return attrs

        multiple_alerts = len(self.rest.alerts) > 1
        for data in self.rest.alerts:
            for alert in ALERTS_ATTRS:
                if data[alert]:
                    if multiple_alerts:
                        dkey = alert.capitalize() + "_" + data["type"]
                    else:
                        dkey = alert.capitalize()
                    attrs[dkey] = data[alert]
        return attrs

    @property

After Change


    def device_state_attributes(self):
        Return the state attributes.
        attrs = self._cfg_expand("device_state_attributes", {})
        for (attr, callback) in attrs.items():
            try:
                attrs[attr] = callback(self.rest)
            except TypeError:
                attrs[attr] = callback

        attrs[ATTR_ATTRIBUTION] = CONF_ATTRIBUTION
        attrs[ATTR_FRIENDLY_NAME] = self._cfg_expand("friendly_name")
        return attrs
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 9

Instances


Project Name: home-assistant/home-assistant
Commit Name: fcdfebefd9d452952d16669c1257292865d7405b
Time: 2017-05-07
Author: pezinek@gmail.com
File Name: homeassistant/components/sensor/wunderground.py
Class Name: WUndergroundSensor
Method Name: device_state_attributes


Project Name: home-assistant/home-assistant
Commit Name: 7a70496b116569c0581927ed30a5c884dc379c42
Time: 2017-05-06
Author: pezinek@gmail.com
File Name: homeassistant/components/sensor/wunderground.py
Class Name: WUndergroundSensor
Method Name: device_state_attributes


Project Name: home-assistant/home-assistant
Commit Name: fcdfebefd9d452952d16669c1257292865d7405b
Time: 2017-05-07
Author: pezinek@gmail.com
File Name: homeassistant/components/sensor/wunderground.py
Class Name: WUndergroundSensor
Method Name: device_state_attributes


Project Name: deepchem/deepchem
Commit Name: f4bc57459e575c7111f50a2744c8054d3d43f0d5
Time: 2020-07-02
Author: bharath@Bharaths-MBP.zyxel.com
File Name: deepchem/hyper/gaussian_process.py
Class Name: GaussianProcessHyperparamOpt
Method Name: hyperparam_search