1d615ea6c3a5f9b3ae6481b827919f04f23c09ce,homeassistant/components/mysensors.py,,setup,#Any#Any#,152

Before Change



        return gateway

    gateways = hass.data.get(MYSENSORS_GATEWAYS)
    if gateways is not None:
        _LOGGER.error(
            "%s already exists in %s, will not setup %s component",
            MYSENSORS_GATEWAYS, hass.data, DOMAIN)
        return False

    // Setup all devices from config
    gateways = []
    conf_gateways = config[DOMAIN][CONF_GATEWAYS]

    for index, gway in enumerate(conf_gateways):
        device = gway[CONF_DEVICE]
        persistence_file = gway.get(
            CONF_PERSISTENCE_FILE,
            hass.config.path("mysensors{}.pickle".format(index + 1)))
        baud_rate = gway.get(CONF_BAUD_RATE)
        tcp_port = gway.get(CONF_TCP_PORT)
        in_prefix = gway.get(CONF_TOPIC_IN_PREFIX)
        out_prefix = gway.get(CONF_TOPIC_OUT_PREFIX)
        ready_gateway = setup_gateway(
            device, persistence_file, baud_rate, tcp_port, in_prefix,
            out_prefix)
        if ready_gateway is not None:
            gateways.append(ready_gateway)

    if not gateways:
        _LOGGER.error(
            "No devices could be setup as gateways, check your configuration")
        return False

    hass.data[MYSENSORS_GATEWAYS] = gateways

    for component in ["sensor", "switch", "light", "binary_sensor", "climate",
                      "cover"]:
        discovery.load_platform(hass, component, DOMAIN, {}, config)

    discovery.load_platform(
        hass, "device_tracker", DOMAIN, {}, config)

    discovery.load_platform(

After Change


            device, persistence_file, baud_rate, tcp_port, in_prefix,
            out_prefix)
        if ready_gateway is not None:
            gateways[id(ready_gateway)] = ready_gateway

    if not gateways:
        _LOGGER.error(
            "No devices could be setup as gateways, check your configuration")
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 6

Instances


Project Name: home-assistant/home-assistant
Commit Name: 1d615ea6c3a5f9b3ae6481b827919f04f23c09ce
Time: 2017-08-25
Author: marhje52@kth.se
File Name: homeassistant/components/mysensors.py
Class Name:
Method Name: setup


Project Name: home-assistant/home-assistant
Commit Name: 8775c54d29a4adcc11a55c4a37db7da54eccc6e7
Time: 2017-08-25
Author: marhje52@kth.se
File Name: homeassistant/components/mysensors.py
Class Name:
Method Name: setup


Project Name: albu/albumentations
Commit Name: 9942689f9846c59006c80718ee8db38e02ee2104
Time: 2019-09-27
Author: al.buslaev@gmail.com
File Name: albumentations/core/transforms_interface.py
Class Name: BasicTransform
Method Name: __call__