<commit_before>"""
homeassistant.components.binary.nest
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Support for Nest Thermostat Binary Sensors.

For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/sensor.nest/
"""
import logging
import socket
import homeassistant.components.nest as nest

from homeassistant.components.sensor.nest import NestSensor


BINARY_TYPES = ['fan',
                'hvac_ac_state',
                'hvac_aux_heater_state',
                'hvac_heat_x2_state',
                'hvac_heat_x3_state',
                'hvac_alt_heat_state',
                'hvac_alt_heat_x2_state',
                'hvac_emer_heat_state',
                'online']


def setup_platform(hass, config, add_devices, discovery_info=None):
    "Setup nest binary sensors from config file"

    logger = logging.getLogger(__name__)
    try:
        for structure in nest.NEST.structures:
            for device in structure.devices:
                for variable in config['monitored_conditions']:
                    if variable in BINARY_TYPES:
                        add_devices([NestBinarySensor(structure,
                                                      device,
                                                      variable)])
                    else:
                        logger.error('Nest sensor type: "%s" does not exist',
                                     variable)
    except socket.error:
        logger.error(
            "Connection error logging into the nest web service."
        )


class NestBinarySensor(NestSensor):
    """ Represents a Nst Binary sensor. """

    @property
    def is_on(self):
        "Returns is the binary sensor is on or off"

        return bool(getattr(self.device, self.variable))<commit_msg>multiple inheritance for nest binary sensor<commit_after>"""
homeassistant.components.binary.nest
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Support for Nest Thermostat Binary Sensors.

For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/sensor.nest/
"""
import logging
import socket
import homeassistant.components.nest as nest

from homeassistant.components.sensor.nest import NestSensor
from homeassistant.components.binary_sensor import BinarySensorDevice


BINARY_TYPES = ['fan',
                'hvac_ac_state',
                'hvac_aux_heater_state',
                'hvac_heat_x2_state',
                'hvac_heat_x3_state',
                'hvac_alt_heat_state',
                'hvac_alt_heat_x2_state',
                'hvac_emer_heat_state',
                'online']


def setup_platform(hass, config, add_devices, discovery_info=None):
    "Setup nest binary sensors from config file"

    logger = logging.getLogger(__name__)
    try:
        for structure in nest.NEST.structures:
            for device in structure.devices:
                for variable in config['monitored_conditions']:
                    if variable in BINARY_TYPES:
                        add_devices([NestBinarySensor(structure,
                                                      device,
                                                      variable)])
                    else:
                        logger.error('Nest sensor type: "%s" does not exist',
                                     variable)
    except socket.error:
        logger.error(
            "Connection error logging into the nest web service."
        )


class NestBinarySensor(NestSensor, BinarySensorDevice):
    """ Represents a Nst Binary sensor. """

    @property
    def is_on(self):
        "Returns is the binary sensor is on or off"

        return bool(getattr(self.device, self.variable))
{'fraction_non_alphanumeric': 0.09331550802139038, 'fraction_numerical': 0.0016042780748663102, 'mean_word_length': 1.924941360437842, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 10, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3425639', 'n_tokens_mistral': 998, 'n_tokens_neox': 916, 'n_words': 247}