1c140de0dcdc446f54f10055b51767efadf25663,homeassistant/components/sensor/sabnzbd.py,,setup_platform,#Any#Any#Any#Any#,31

Before Change


    api_key = config.get("api_key")
    base_url = config.get("base_url")
    name = config.get("name", "SABnzbd")
    if not base_url:
        _LOGGER.error("Missing config variable base_url")
        return False
    if not api_key:
        _LOGGER.error("Missing config variable api_key")
        return False

    sab_api = SabnzbdApi(base_url, api_key)

    try:
        sab_api.check_available()
    except SabnzbdApiException:
        _LOGGER.exception("Connection to SABnzbd API failed.")
        return False

    // pylint: disable=global-statement
    global _THROTTLED_REFRESH
    _THROTTLED_REFRESH = Throttle(timedelta(seconds=1))(sab_api.refresh_queue)

    dev = []
    for variable in config["monitored_variables"]:
        if variable["type"] not in SENSOR_TYPES:
            _LOGGER.error("Sensor type: "%s" does not exist", variable["type"])
        else:
            dev.append(SabnzbdSensor(variable["type"], sab_api, name))

    add_devices(dev)

After Change


    name = config.get(CONF_NAME)
    api_key = config.get(CONF_API_KEY)
    monitored_types = config.get(CONF_MONITORED_VARIABLES)
    base_url = "http://{}:{}/".format(host, port)

    sab_api = SabnzbdApi(base_url, api_key)

    try:
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 6

Instances


Project Name: home-assistant/home-assistant
Commit Name: 1c140de0dcdc446f54f10055b51767efadf25663
Time: 2016-08-16
Author: mail@fabian-affolter.ch
File Name: homeassistant/components/sensor/sabnzbd.py
Class Name:
Method Name: setup_platform


Project Name: home-assistant/home-assistant
Commit Name: a43ea81d8e31130853480b3656143746b65c6a03
Time: 2016-08-23
Author: mail@fabian-affolter.ch
File Name: homeassistant/components/logentries.py
Class Name:
Method Name: setup


Project Name: home-assistant/home-assistant
Commit Name: 6f27d58188ce908ea6f04e0f9cd7887c1201b614
Time: 2016-08-23
Author: mail@fabian-affolter.ch
File Name: homeassistant/components/splunk.py
Class Name:
Method Name: setup