35f0270688d2bd1e31e45ebbc1771f1ff940bff6,homeassistant/components/sun.py,,setup,#Any#Any#,100

Before Change


        logger.error("Latitude or longitude not set in Home Assistant config")
        return False

    try:
        sun = Sun(hass, str(hass.config.latitude), str(hass.config.longitude))
    except ValueError:
        // Raised when invalid latitude or longitude is given to Observer
        logger.exception("Invalid value for latitude or longitude")
        return False

    sun.point_in_time_listener(dt_util.utcnow())

    return True

After Change


    elif -90 > latitude < 90:
        errors.append("Latitude needs to be -90 .. 90")

    if longitude is None:
        errors.append("Longitude needs to be a decimal value")
    elif -180 > longitude < 180:
        errors.append("Longitude needs to be -180 .. 180")

    if errors:
        _LOGGER.error("Invalid configuration received: %s", ", ".join(errors))
        return False
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 5

Instances


Project Name: home-assistant/home-assistant
Commit Name: 35f0270688d2bd1e31e45ebbc1771f1ff940bff6
Time: 2015-07-16
Author: paulus@paulusschoutsen.nl
File Name: homeassistant/components/sun.py
Class Name:
Method Name: setup


Project Name: Microsoft/nni
Commit Name: 08af7771d1f1149f3da5a98bcdbf7e65abd409ba
Time: 2020-12-27
Author: Quanlu.Zhang@microsoft.com
File Name: nni/retiarii/strategies/tpe_strategy.py
Class Name: TPEStrategy
Method Name: run


Project Name: pantsbuild/pants
Commit Name: 937907d721b8e4e9628b6d13bb59423e4406a5f1
Time: 2015-04-20
Author: itay@twitter.com
File Name: src/python/pants/backend/python/tasks/pytest_run.py
Class Name: PytestRun
Method Name: _do_run_tests