7a979e9f720fb03af107bb89ad94247d76e150df,homeassistant/components/alarm_control_panel/egardia.py,EgardiaAlarm,lookupstatusfromcode,#EgardiaAlarm#Any#,157

Before Change


    def lookupstatusfromcode(self, statuscode):
        Look at the rs_codes and returns the status from the code.
        status = "UNKNOWN"
        if self._rs_codes is not None:
            statuscode = str(statuscode).strip()
            for i in self._rs_codes:
                val = str(self._rs_codes[i]).strip()
                if "," in val:
                    splitted = val.split(",")
                    for code in splitted:
                        code = str(code).strip()
                        if statuscode == code:
                            status = i.upper()
                            break
                elif statuscode == val:
                    status = i.upper()
                    break
        return status

    def parsestatus(self, status):
        Parse the status.

After Change


    def lookupstatusfromcode(self, statuscode):
        Look at the rs_codes and returns the status from the code.
        status = next((
            status_group.upper() for status_group, codes
            in self._rs_codes.items() for code in codes
            if statuscode == code), "UNKNOWN")
        return status
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 8

Instances


Project Name: home-assistant/home-assistant
Commit Name: 7a979e9f720fb03af107bb89ad94247d76e150df
Time: 2018-03-02
Author: jeroen_ter_heerdt@hotmail.com
File Name: homeassistant/components/alarm_control_panel/egardia.py
Class Name: EgardiaAlarm
Method Name: lookupstatusfromcode


Project Name: pantsbuild/pants
Commit Name: 9f236fd5795b60f8f75d77e20189dbeabc123814
Time: 2013-04-04
Author: benjy@foursquare.com
File Name: src/python/twitter/pants/tasks/java_compile.py
Class Name: JavaCompile
Method Name: execute_single_compilation


Project Name: pantsbuild/pants
Commit Name: 699600d95b2b30291b26b8051cc379c0452e8c25
Time: 2013-04-09
Author: markcc@foursquare.com
File Name: src/python/twitter/pants/tasks/java_compile.py
Class Name: JavaCompile
Method Name: execute_single_compilation