Search is not available for this dataset
identifier
stringlengths
1
155
parameters
stringlengths
2
6.09k
docstring
stringlengths
11
63.4k
docstring_summary
stringlengths
0
63.4k
function
stringlengths
29
99.8k
function_tokens
list
start_point
list
end_point
list
language
stringclasses
1 value
docstring_language
stringlengths
2
7
docstring_language_predictions
stringlengths
18
23
is_langid_reliable
stringclasses
2 values
is_on
(hass: HomeAssistantType, entity_id: str)
Return the state if any or a specified device is home.
Return the state if any or a specified device is home.
def is_on(hass: HomeAssistantType, entity_id: str): """Return the state if any or a specified device is home.""" return hass.states.is_state(entity_id, STATE_HOME)
[ "def", "is_on", "(", "hass", ":", "HomeAssistantType", ",", "entity_id", ":", "str", ")", ":", "return", "hass", ".", "states", ".", "is_state", "(", "entity_id", ",", "STATE_HOME", ")" ]
[ 89, 0 ]
[ 91, 54 ]
python
en
['en', 'en', 'en']
True
see
( hass: HomeAssistantType, mac: str = None, dev_id: str = None, host_name: str = None, location_name: str = None, gps: GPSType = None, gps_accuracy=None, battery: int = None, attributes: dict = None, )
Call service to notify you see device.
Call service to notify you see device.
def see( hass: HomeAssistantType, mac: str = None, dev_id: str = None, host_name: str = None, location_name: str = None, gps: GPSType = None, gps_accuracy=None, battery: int = None, attributes: dict = None, ): """Call service to notify you see device.""" data = { key:...
[ "def", "see", "(", "hass", ":", "HomeAssistantType", ",", "mac", ":", "str", "=", "None", ",", "dev_id", ":", "str", "=", "None", ",", "host_name", ":", "str", "=", "None", ",", "location_name", ":", "str", "=", "None", ",", "gps", ":", "GPSType", ...
[ 94, 0 ]
[ 121, 49 ]
python
en
['en', 'en', 'en']
True
async_setup
(hass: HomeAssistantType, config: ConfigType)
Set up the device tracker.
Set up the device tracker.
async def async_setup(hass: HomeAssistantType, config: ConfigType): """Set up the device tracker.""" tracker = await legacy.get_tracker(hass, config) legacy_platforms = await setup.async_extract_config(hass, config) setup_tasks = [ legacy_platform.async_setup_legacy(hass, tracker) for ...
[ "async", "def", "async_setup", "(", "hass", ":", "HomeAssistantType", ",", "config", ":", "ConfigType", ")", ":", "tracker", "=", "await", "legacy", ".", "get_tracker", "(", "hass", ",", "config", ")", "legacy_platforms", "=", "await", "setup", ".", "async_e...
[ 124, 0 ]
[ 168, 15 ]
python
en
['en', 'en', 'en']
True
async_setup_platform
(hass, config, async_add_entities, discovery_info=None)
Set up the Volvo On Call lock.
Set up the Volvo On Call lock.
async def async_setup_platform(hass, config, async_add_entities, discovery_info=None): """Set up the Volvo On Call lock.""" if discovery_info is None: return async_add_entities([VolvoLock(hass.data[DATA_KEY], *discovery_info)])
[ "async", "def", "async_setup_platform", "(", "hass", ",", "config", ",", "async_add_entities", ",", "discovery_info", "=", "None", ")", ":", "if", "discovery_info", "is", "None", ":", "return", "async_add_entities", "(", "[", "VolvoLock", "(", "hass", ".", "da...
[ 6, 0 ]
[ 11, 73 ]
python
en
['en', 'en', 'en']
True
VolvoLock.is_locked
(self)
Return true if lock is locked.
Return true if lock is locked.
def is_locked(self): """Return true if lock is locked.""" return self.instrument.is_locked
[ "def", "is_locked", "(", "self", ")", ":", "return", "self", ".", "instrument", ".", "is_locked" ]
[ 18, 4 ]
[ 20, 40 ]
python
en
['en', 'mt', 'en']
True
VolvoLock.async_lock
(self, **kwargs)
Lock the car.
Lock the car.
async def async_lock(self, **kwargs): """Lock the car.""" await self.instrument.lock()
[ "async", "def", "async_lock", "(", "self", ",", "*", "*", "kwargs", ")", ":", "await", "self", ".", "instrument", ".", "lock", "(", ")" ]
[ 22, 4 ]
[ 24, 36 ]
python
en
['en', 'ms', 'en']
True
VolvoLock.async_unlock
(self, **kwargs)
Unlock the car.
Unlock the car.
async def async_unlock(self, **kwargs): """Unlock the car.""" await self.instrument.unlock()
[ "async", "def", "async_unlock", "(", "self", ",", "*", "*", "kwargs", ")", ":", "await", "self", ".", "instrument", ".", "unlock", "(", ")" ]
[ 26, 4 ]
[ 28, 38 ]
python
en
['en', 'ms', 'en']
True
async_setup_entry
(hass, config_entry, async_add_entities)
Set up tuya sensors dynamically through tuya discovery.
Set up tuya sensors dynamically through tuya discovery.
async def async_setup_entry(hass, config_entry, async_add_entities): """Set up tuya sensors dynamically through tuya discovery.""" platform = config_entry.data[CONF_PLATFORM] async def async_discover_sensor(dev_ids): """Discover and add a discovered tuya sensor.""" if not dev_ids: ...
[ "async", "def", "async_setup_entry", "(", "hass", ",", "config_entry", ",", "async_add_entities", ")", ":", "platform", "=", "config_entry", ".", "data", "[", "CONF_PLATFORM", "]", "async", "def", "async_discover_sensor", "(", "dev_ids", ")", ":", "\"\"\"Discover ...
[ 63, 0 ]
[ 85, 44 ]
python
en
['en', 'zu', 'en']
True
_setup_entities
(hass, dev_ids, platform)
Set up Tuya Climate device.
Set up Tuya Climate device.
def _setup_entities(hass, dev_ids, platform): """Set up Tuya Climate device.""" tuya = hass.data[DOMAIN][TUYA_DATA] entities = [] for dev_id in dev_ids: device = tuya.get_device_by_id(dev_id) if device is None: continue entities.append(TuyaClimateEntity(device, platfo...
[ "def", "_setup_entities", "(", "hass", ",", "dev_ids", ",", "platform", ")", ":", "tuya", "=", "hass", ".", "data", "[", "DOMAIN", "]", "[", "TUYA_DATA", "]", "entities", "=", "[", "]", "for", "dev_id", "in", "dev_ids", ":", "device", "=", "tuya", "....
[ 88, 0 ]
[ 97, 19 ]
python
en
['es', 'zu', 'en']
False
TuyaClimateEntity.__init__
(self, tuya, platform)
Init climate device.
Init climate device.
def __init__(self, tuya, platform): """Init climate device.""" super().__init__(tuya, platform) self.entity_id = ENTITY_ID_FORMAT.format(tuya.object_id()) self.operations = [HVAC_MODE_OFF] self._has_operation = False self._def_hvac_mode = HVAC_MODE_AUTO self._min_...
[ "def", "__init__", "(", "self", ",", "tuya", ",", "platform", ")", ":", "super", "(", ")", ".", "__init__", "(", "tuya", ",", "platform", ")", "self", ".", "entity_id", "=", "ENTITY_ID_FORMAT", ".", "format", "(", "tuya", ".", "object_id", "(", ")", ...
[ 103, 4 ]
[ 111, 29 ]
python
en
['fr', 'en', 'en']
True
TuyaClimateEntity._process_config
(self)
Set device config parameter.
Set device config parameter.
def _process_config(self): """Set device config parameter.""" config = self._get_device_config() if not config: return unit = config.get(CONF_UNIT_OF_MEASUREMENT) if unit: self._tuya.set_unit("FAHRENHEIT" if unit == TEMP_FAHRENHEIT else "CELSIUS") ...
[ "def", "_process_config", "(", "self", ")", ":", "config", "=", "self", ".", "_get_device_config", "(", ")", "if", "not", "config", ":", "return", "unit", "=", "config", ".", "get", "(", "CONF_UNIT_OF_MEASUREMENT", ")", "if", "unit", ":", "self", ".", "_...
[ 114, 4 ]
[ 130, 37 ]
python
en
['nl', 'pt', 'en']
False
TuyaClimateEntity.async_added_to_hass
(self)
Create operation list when add to hass.
Create operation list when add to hass.
async def async_added_to_hass(self): """Create operation list when add to hass.""" await super().async_added_to_hass() self._process_config() self.async_on_remove( async_dispatcher_connect( self.hass, SIGNAL_CONFIG_ENTITY, self._process_config ) ...
[ "async", "def", "async_added_to_hass", "(", "self", ")", ":", "await", "super", "(", ")", ".", "async_added_to_hass", "(", ")", "self", ".", "_process_config", "(", ")", "self", ".", "async_on_remove", "(", "async_dispatcher_connect", "(", "self", ".", "hass",...
[ 132, 4 ]
[ 154, 38 ]
python
en
['en', 'en', 'en']
True
TuyaClimateEntity.precision
(self)
Return the precision of the system.
Return the precision of the system.
def precision(self): """Return the precision of the system.""" if self._tuya.has_decimal(): return PRECISION_TENTHS return PRECISION_WHOLE
[ "def", "precision", "(", "self", ")", ":", "if", "self", ".", "_tuya", ".", "has_decimal", "(", ")", ":", "return", "PRECISION_TENTHS", "return", "PRECISION_WHOLE" ]
[ 157, 4 ]
[ 161, 30 ]
python
en
['en', 'en', 'en']
True
TuyaClimateEntity.temperature_unit
(self)
Return the unit of measurement used by the platform.
Return the unit of measurement used by the platform.
def temperature_unit(self): """Return the unit of measurement used by the platform.""" unit = self._tuya.temperature_unit() if unit == "FAHRENHEIT": return TEMP_FAHRENHEIT return TEMP_CELSIUS
[ "def", "temperature_unit", "(", "self", ")", ":", "unit", "=", "self", ".", "_tuya", ".", "temperature_unit", "(", ")", "if", "unit", "==", "\"FAHRENHEIT\"", ":", "return", "TEMP_FAHRENHEIT", "return", "TEMP_CELSIUS" ]
[ 164, 4 ]
[ 169, 27 ]
python
en
['en', 'en', 'en']
True
TuyaClimateEntity.hvac_mode
(self)
Return current operation ie. heat, cool, idle.
Return current operation ie. heat, cool, idle.
def hvac_mode(self): """Return current operation ie. heat, cool, idle.""" if not self._tuya.state(): return HVAC_MODE_OFF if not self._has_operation: return self._def_hvac_mode mode = self._tuya.current_operation() if mode is None: return Non...
[ "def", "hvac_mode", "(", "self", ")", ":", "if", "not", "self", ".", "_tuya", ".", "state", "(", ")", ":", "return", "HVAC_MODE_OFF", "if", "not", "self", ".", "_has_operation", ":", "return", "self", ".", "_def_hvac_mode", "mode", "=", "self", ".", "_...
[ 172, 4 ]
[ 183, 41 ]
python
en
['nl', 'en', 'en']
True
TuyaClimateEntity.hvac_modes
(self)
Return the list of available operation modes.
Return the list of available operation modes.
def hvac_modes(self): """Return the list of available operation modes.""" return self.operations
[ "def", "hvac_modes", "(", "self", ")", ":", "return", "self", ".", "operations" ]
[ 186, 4 ]
[ 188, 30 ]
python
en
['en', 'en', 'en']
True
TuyaClimateEntity.current_temperature
(self)
Return the current temperature.
Return the current temperature.
def current_temperature(self): """Return the current temperature.""" return self._tuya.current_temperature()
[ "def", "current_temperature", "(", "self", ")", ":", "return", "self", ".", "_tuya", ".", "current_temperature", "(", ")" ]
[ 191, 4 ]
[ 193, 47 ]
python
en
['en', 'la', 'en']
True
TuyaClimateEntity.target_temperature
(self)
Return the temperature we try to reach.
Return the temperature we try to reach.
def target_temperature(self): """Return the temperature we try to reach.""" return self._tuya.target_temperature()
[ "def", "target_temperature", "(", "self", ")", ":", "return", "self", ".", "_tuya", ".", "target_temperature", "(", ")" ]
[ 196, 4 ]
[ 198, 46 ]
python
en
['en', 'en', 'en']
True
TuyaClimateEntity.target_temperature_step
(self)
Return the supported step of target temperature.
Return the supported step of target temperature.
def target_temperature_step(self): """Return the supported step of target temperature.""" return self._tuya.target_temperature_step()
[ "def", "target_temperature_step", "(", "self", ")", ":", "return", "self", ".", "_tuya", ".", "target_temperature_step", "(", ")" ]
[ 201, 4 ]
[ 203, 51 ]
python
en
['en', 'en', 'en']
True
TuyaClimateEntity.fan_mode
(self)
Return the fan setting.
Return the fan setting.
def fan_mode(self): """Return the fan setting.""" return self._tuya.current_fan_mode()
[ "def", "fan_mode", "(", "self", ")", ":", "return", "self", ".", "_tuya", ".", "current_fan_mode", "(", ")" ]
[ 206, 4 ]
[ 208, 44 ]
python
en
['en', 'fy', 'en']
True
TuyaClimateEntity.fan_modes
(self)
Return the list of available fan modes.
Return the list of available fan modes.
def fan_modes(self): """Return the list of available fan modes.""" return self._tuya.fan_list()
[ "def", "fan_modes", "(", "self", ")", ":", "return", "self", ".", "_tuya", ".", "fan_list", "(", ")" ]
[ 211, 4 ]
[ 213, 36 ]
python
en
['en', 'en', 'en']
True
TuyaClimateEntity.set_temperature
(self, **kwargs)
Set new target temperature.
Set new target temperature.
def set_temperature(self, **kwargs): """Set new target temperature.""" if ATTR_TEMPERATURE in kwargs: self._tuya.set_temperature(kwargs[ATTR_TEMPERATURE])
[ "def", "set_temperature", "(", "self", ",", "*", "*", "kwargs", ")", ":", "if", "ATTR_TEMPERATURE", "in", "kwargs", ":", "self", ".", "_tuya", ".", "set_temperature", "(", "kwargs", "[", "ATTR_TEMPERATURE", "]", ")" ]
[ 215, 4 ]
[ 218, 64 ]
python
en
['en', 'ca', 'en']
True
TuyaClimateEntity.set_fan_mode
(self, fan_mode)
Set new target fan mode.
Set new target fan mode.
def set_fan_mode(self, fan_mode): """Set new target fan mode.""" self._tuya.set_fan_mode(fan_mode)
[ "def", "set_fan_mode", "(", "self", ",", "fan_mode", ")", ":", "self", ".", "_tuya", ".", "set_fan_mode", "(", "fan_mode", ")" ]
[ 220, 4 ]
[ 222, 41 ]
python
en
['sv', 'fy', 'en']
False
TuyaClimateEntity.set_hvac_mode
(self, hvac_mode)
Set new target operation mode.
Set new target operation mode.
def set_hvac_mode(self, hvac_mode): """Set new target operation mode.""" if hvac_mode == HVAC_MODE_OFF: self._tuya.turn_off() return if not self._tuya.state(): self._tuya.turn_on() if self._has_operation: self._tuya.set_operation_mode(HA_...
[ "def", "set_hvac_mode", "(", "self", ",", "hvac_mode", ")", ":", "if", "hvac_mode", "==", "HVAC_MODE_OFF", ":", "self", ".", "_tuya", ".", "turn_off", "(", ")", "return", "if", "not", "self", ".", "_tuya", ".", "state", "(", ")", ":", "self", ".", "_...
[ 224, 4 ]
[ 234, 74 ]
python
en
['nl', 'en', 'en']
True
TuyaClimateEntity.supported_features
(self)
Return the list of supported features.
Return the list of supported features.
def supported_features(self): """Return the list of supported features.""" supports = 0 if self._tuya.support_target_temperature(): supports = supports | SUPPORT_TARGET_TEMPERATURE if self._tuya.support_wind_speed(): supports = supports | SUPPORT_FAN_MODE ...
[ "def", "supported_features", "(", "self", ")", ":", "supports", "=", "0", "if", "self", ".", "_tuya", ".", "support_target_temperature", "(", ")", ":", "supports", "=", "supports", "|", "SUPPORT_TARGET_TEMPERATURE", "if", "self", ".", "_tuya", ".", "support_wi...
[ 237, 4 ]
[ 244, 23 ]
python
en
['en', 'en', 'en']
True
TuyaClimateEntity.min_temp
(self)
Return the minimum temperature.
Return the minimum temperature.
def min_temp(self): """Return the minimum temperature.""" min_temp = ( self._min_temp if self._min_temp is not None else self._tuya.min_temp() ) if min_temp is not None: return min_temp return super().min_temp
[ "def", "min_temp", "(", "self", ")", ":", "min_temp", "=", "(", "self", ".", "_min_temp", "if", "self", ".", "_min_temp", "is", "not", "None", "else", "self", ".", "_tuya", ".", "min_temp", "(", ")", ")", "if", "min_temp", "is", "not", "None", ":", ...
[ 247, 4 ]
[ 254, 31 ]
python
en
['en', 'la', 'en']
True
TuyaClimateEntity.max_temp
(self)
Return the maximum temperature.
Return the maximum temperature.
def max_temp(self): """Return the maximum temperature.""" max_temp = ( self._max_temp if self._max_temp is not None else self._tuya.max_temp() ) if max_temp is not None: return max_temp return super().max_temp
[ "def", "max_temp", "(", "self", ")", ":", "max_temp", "=", "(", "self", ".", "_max_temp", "if", "self", ".", "_max_temp", "is", "not", "None", "else", "self", ".", "_tuya", ".", "max_temp", "(", ")", ")", "if", "max_temp", "is", "not", "None", ":", ...
[ 257, 4 ]
[ 264, 31 ]
python
en
['en', 'la', 'en']
True
create_knx_device
( platform: SupportedPlatforms, knx_module: XKNX, config: ConfigType, )
Return the requested XKNX device.
Return the requested XKNX device.
def create_knx_device( platform: SupportedPlatforms, knx_module: XKNX, config: ConfigType, ) -> XknxDevice: """Return the requested XKNX device.""" if platform is SupportedPlatforms.light: return _create_light(knx_module, config) if platform is SupportedPlatforms.cover: return _...
[ "def", "create_knx_device", "(", "platform", ":", "SupportedPlatforms", ",", "knx_module", ":", "XKNX", ",", "config", ":", "ConfigType", ",", ")", "->", "XknxDevice", ":", "if", "platform", "is", "SupportedPlatforms", ".", "light", ":", "return", "_create_light...
[ 32, 0 ]
[ 63, 50 ]
python
en
['en', 'en', 'en']
True
_create_cover
(knx_module: XKNX, config: ConfigType)
Return a KNX Cover device to be used within XKNX.
Return a KNX Cover device to be used within XKNX.
def _create_cover(knx_module: XKNX, config: ConfigType) -> XknxCover: """Return a KNX Cover device to be used within XKNX.""" return XknxCover( knx_module, name=config[CONF_NAME], group_address_long=config.get(CoverSchema.CONF_MOVE_LONG_ADDRESS), group_address_short=config.get(Co...
[ "def", "_create_cover", "(", "knx_module", ":", "XKNX", ",", "config", ":", "ConfigType", ")", "->", "XknxCover", ":", "return", "XknxCover", "(", "knx_module", ",", "name", "=", "config", "[", "CONF_NAME", "]", ",", "group_address_long", "=", "config", ".",...
[ 66, 0 ]
[ 84, 5 ]
python
en
['en', 'en', 'en']
True
_create_light
(knx_module: XKNX, config: ConfigType)
Return a KNX Light device to be used within XKNX.
Return a KNX Light device to be used within XKNX.
def _create_light(knx_module: XKNX, config: ConfigType) -> XknxLight: """Return a KNX Light device to be used within XKNX.""" group_address_tunable_white = None group_address_tunable_white_state = None group_address_color_temp = None group_address_color_temp_state = None if config[LightSchema.CO...
[ "def", "_create_light", "(", "knx_module", ":", "XKNX", ",", "config", ":", "ConfigType", ")", "->", "XknxLight", ":", "group_address_tunable_white", "=", "None", "group_address_tunable_white_state", "=", "None", "group_address_color_temp", "=", "None", "group_address_c...
[ 87, 0 ]
[ 123, 5 ]
python
en
['en', 'en', 'en']
True
_create_climate
(knx_module: XKNX, config: ConfigType)
Return a KNX Climate device to be used within XKNX.
Return a KNX Climate device to be used within XKNX.
def _create_climate(knx_module: XKNX, config: ConfigType) -> XknxClimate: """Return a KNX Climate device to be used within XKNX.""" climate_mode = XknxClimateMode( knx_module, name=f"{config[CONF_NAME]} Mode", group_address_operation_mode=config.get( ClimateSchema.CONF_OPERAT...
[ "def", "_create_climate", "(", "knx_module", ":", "XKNX", ",", "config", ":", "ConfigType", ")", "->", "XknxClimate", ":", "climate_mode", "=", "XknxClimateMode", "(", "knx_module", ",", "name", "=", "f\"{config[CONF_NAME]} Mode\"", ",", "group_address_operation_mode"...
[ 126, 0 ]
[ 195, 5 ]
python
en
['en', 'en', 'en']
True
_create_switch
(knx_module: XKNX, config: ConfigType)
Return a KNX switch to be used within XKNX.
Return a KNX switch to be used within XKNX.
def _create_switch(knx_module: XKNX, config: ConfigType) -> XknxSwitch: """Return a KNX switch to be used within XKNX.""" return XknxSwitch( knx_module, name=config[CONF_NAME], group_address=config[CONF_ADDRESS], group_address_state=config.get(SwitchSchema.CONF_STATE_ADDRESS), ...
[ "def", "_create_switch", "(", "knx_module", ":", "XKNX", ",", "config", ":", "ConfigType", ")", "->", "XknxSwitch", ":", "return", "XknxSwitch", "(", "knx_module", ",", "name", "=", "config", "[", "CONF_NAME", "]", ",", "group_address", "=", "config", "[", ...
[ 198, 0 ]
[ 206, 5 ]
python
en
['en', 'en', 'en']
True
_create_sensor
(knx_module: XKNX, config: ConfigType)
Return a KNX sensor to be used within XKNX.
Return a KNX sensor to be used within XKNX.
def _create_sensor(knx_module: XKNX, config: ConfigType) -> XknxSensor: """Return a KNX sensor to be used within XKNX.""" return XknxSensor( knx_module, name=config[CONF_NAME], group_address_state=config[SensorSchema.CONF_STATE_ADDRESS], sync_state=config[SensorSchema.CONF_SYNC_S...
[ "def", "_create_sensor", "(", "knx_module", ":", "XKNX", ",", "config", ":", "ConfigType", ")", "->", "XknxSensor", ":", "return", "XknxSensor", "(", "knx_module", ",", "name", "=", "config", "[", "CONF_NAME", "]", ",", "group_address_state", "=", "config", ...
[ 209, 0 ]
[ 218, 5 ]
python
en
['en', 'en', 'en']
True
_create_notify
(knx_module: XKNX, config: ConfigType)
Return a KNX notification to be used within XKNX.
Return a KNX notification to be used within XKNX.
def _create_notify(knx_module: XKNX, config: ConfigType) -> XknxNotification: """Return a KNX notification to be used within XKNX.""" return XknxNotification( knx_module, name=config[CONF_NAME], group_address=config[CONF_ADDRESS], )
[ "def", "_create_notify", "(", "knx_module", ":", "XKNX", ",", "config", ":", "ConfigType", ")", "->", "XknxNotification", ":", "return", "XknxNotification", "(", "knx_module", ",", "name", "=", "config", "[", "CONF_NAME", "]", ",", "group_address", "=", "confi...
[ 221, 0 ]
[ 227, 5 ]
python
en
['en', 'en', 'en']
True
_create_scene
(knx_module: XKNX, config: ConfigType)
Return a KNX scene to be used within XKNX.
Return a KNX scene to be used within XKNX.
def _create_scene(knx_module: XKNX, config: ConfigType) -> XknxScene: """Return a KNX scene to be used within XKNX.""" return XknxScene( knx_module, name=config[CONF_NAME], group_address=config[CONF_ADDRESS], scene_number=config[SceneSchema.CONF_SCENE_NUMBER], )
[ "def", "_create_scene", "(", "knx_module", ":", "XKNX", ",", "config", ":", "ConfigType", ")", "->", "XknxScene", ":", "return", "XknxScene", "(", "knx_module", ",", "name", "=", "config", "[", "CONF_NAME", "]", ",", "group_address", "=", "config", "[", "C...
[ 230, 0 ]
[ 237, 5 ]
python
en
['en', 'en', 'en']
True
_create_binary_sensor
(knx_module: XKNX, config: ConfigType)
Return a KNX binary sensor to be used within XKNX.
Return a KNX binary sensor to be used within XKNX.
def _create_binary_sensor(knx_module: XKNX, config: ConfigType) -> XknxBinarySensor: """Return a KNX binary sensor to be used within XKNX.""" device_name = config[CONF_NAME] return XknxBinarySensor( knx_module, name=device_name, group_address_state=config[BinarySensorSchema.CONF_STA...
[ "def", "_create_binary_sensor", "(", "knx_module", ":", "XKNX", ",", "config", ":", "ConfigType", ")", "->", "XknxBinarySensor", ":", "device_name", "=", "config", "[", "CONF_NAME", "]", "return", "XknxBinarySensor", "(", "knx_module", ",", "name", "=", "device_...
[ 240, 0 ]
[ 254, 5 ]
python
en
['en', 'en', 'en']
True
_create_weather
(knx_module: XKNX, config: ConfigType)
Return a KNX weather device to be used within XKNX.
Return a KNX weather device to be used within XKNX.
def _create_weather(knx_module: XKNX, config: ConfigType) -> XknxWeather: """Return a KNX weather device to be used within XKNX.""" return XknxWeather( knx_module, name=config[CONF_NAME], sync_state=config[WeatherSchema.CONF_SYNC_STATE], expose_sensors=config[WeatherSchema.CONF_K...
[ "def", "_create_weather", "(", "knx_module", ":", "XKNX", ",", "config", ":", "ConfigType", ")", "->", "XknxWeather", ":", "return", "XknxWeather", "(", "knx_module", ",", "name", "=", "config", "[", "CONF_NAME", "]", ",", "sync_state", "=", "config", "[", ...
[ 257, 0 ]
[ 288, 5 ]
python
en
['en', 'en', 'en']
True
test_extract_frame_integration
(caplog)
Test extracting the current frame from integration context.
Test extracting the current frame from integration context.
async def test_extract_frame_integration(caplog): """Test extracting the current frame from integration context.""" correct_frame = Mock( filename="/home/paulus/homeassistant/components/hue/light.py", lineno="23", line="self.light.is_on", ) with patch( "homeassistant.help...
[ "async", "def", "test_extract_frame_integration", "(", "caplog", ")", ":", "correct_frame", "=", "Mock", "(", "filename", "=", "\"/home/paulus/homeassistant/components/hue/light.py\"", ",", "lineno", "=", "\"23\"", ",", "line", "=", "\"self.light.is_on\"", ",", ")", "...
[ 8, 0 ]
[ 35, 39 ]
python
en
['en', 'en', 'en']
True
test_extract_frame_integration_with_excluded_intergration
(caplog)
Test extracting the current frame from integration context.
Test extracting the current frame from integration context.
async def test_extract_frame_integration_with_excluded_intergration(caplog): """Test extracting the current frame from integration context.""" correct_frame = Mock( filename="/home/dev/homeassistant/components/mdns/light.py", lineno="23", line="self.light.is_on", ) with patch( ...
[ "async", "def", "test_extract_frame_integration_with_excluded_intergration", "(", "caplog", ")", ":", "correct_frame", "=", "Mock", "(", "filename", "=", "\"/home/dev/homeassistant/components/mdns/light.py\"", ",", "lineno", "=", "\"23\"", ",", "line", "=", "\"self.light.is...
[ 38, 0 ]
[ 72, 39 ]
python
en
['en', 'en', 'en']
True
test_extract_frame_no_integration
(caplog)
Test extracting the current frame without integration context.
Test extracting the current frame without integration context.
async def test_extract_frame_no_integration(caplog): """Test extracting the current frame without integration context.""" with patch( "homeassistant.helpers.frame.extract_stack", return_value=[ Mock( filename="/home/paulus/homeassistant/core.py", linen...
[ "async", "def", "test_extract_frame_no_integration", "(", "caplog", ")", ":", "with", "patch", "(", "\"homeassistant.helpers.frame.extract_stack\"", ",", "return_value", "=", "[", "Mock", "(", "filename", "=", "\"/home/paulus/homeassistant/core.py\"", ",", "lineno", "=", ...
[ 75, 0 ]
[ 92, 37 ]
python
en
['en', 'en', 'en']
True
manifest_from_legacy_module
(domain: str, module: ModuleType)
Generate a manifest from a legacy module.
Generate a manifest from a legacy module.
def manifest_from_legacy_module(domain: str, module: ModuleType) -> Dict: """Generate a manifest from a legacy module.""" return { "domain": domain, "name": domain, "documentation": None, "requirements": getattr(module, "REQUIREMENTS", []), "dependencies": getattr(module,...
[ "def", "manifest_from_legacy_module", "(", "domain", ":", "str", ",", "module", ":", "ModuleType", ")", "->", "Dict", ":", "return", "{", "\"domain\"", ":", "domain", ",", "\"name\"", ":", "domain", ",", "\"documentation\"", ":", "None", ",", "\"requirements\"...
[ 55, 0 ]
[ 64, 5 ]
python
en
['en', 'en', 'en']
True
_async_get_custom_components
( hass: "HomeAssistant", )
Return list of custom integrations.
Return list of custom integrations.
async def _async_get_custom_components( hass: "HomeAssistant", ) -> Dict[str, "Integration"]: """Return list of custom integrations.""" if hass.config.safe_mode: return {} try: import custom_components # pylint: disable=import-outside-toplevel except ImportError: return {} ...
[ "async", "def", "_async_get_custom_components", "(", "hass", ":", "\"HomeAssistant\"", ",", ")", "->", "Dict", "[", "str", ",", "\"Integration\"", "]", ":", "if", "hass", ".", "config", ".", "safe_mode", ":", "return", "{", "}", "try", ":", "import", "cust...
[ 67, 0 ]
[ 105, 5 ]
python
en
['en', 'et', 'en']
True
async_get_custom_components
( hass: "HomeAssistant", )
Return cached list of custom integrations.
Return cached list of custom integrations.
async def async_get_custom_components( hass: "HomeAssistant", ) -> Dict[str, "Integration"]: """Return cached list of custom integrations.""" reg_or_evt = hass.data.get(DATA_CUSTOM_COMPONENTS) if reg_or_evt is None: evt = hass.data[DATA_CUSTOM_COMPONENTS] = asyncio.Event() reg = await ...
[ "async", "def", "async_get_custom_components", "(", "hass", ":", "\"HomeAssistant\"", ",", ")", "->", "Dict", "[", "str", ",", "\"Integration\"", "]", ":", "reg_or_evt", "=", "hass", ".", "data", ".", "get", "(", "DATA_CUSTOM_COMPONENTS", ")", "if", "reg_or_ev...
[ 108, 0 ]
[ 127, 53 ]
python
en
['en', 'en', 'en']
True
async_get_config_flows
(hass: "HomeAssistant")
Return cached list of config flows.
Return cached list of config flows.
async def async_get_config_flows(hass: "HomeAssistant") -> Set[str]: """Return cached list of config flows.""" # pylint: disable=import-outside-toplevel from homeassistant.generated.config_flows import FLOWS flows: Set[str] = set() flows.update(FLOWS) integrations = await async_get_custom_comp...
[ "async", "def", "async_get_config_flows", "(", "hass", ":", "\"HomeAssistant\"", ")", "->", "Set", "[", "str", "]", ":", "# pylint: disable=import-outside-toplevel", "from", "homeassistant", ".", "generated", ".", "config_flows", "import", "FLOWS", "flows", ":", "Se...
[ 130, 0 ]
[ 147, 16 ]
python
en
['en', 'en', 'en']
True
async_get_zeroconf
(hass: "HomeAssistant")
Return cached list of zeroconf types.
Return cached list of zeroconf types.
async def async_get_zeroconf(hass: "HomeAssistant") -> Dict[str, List[Dict[str, str]]]: """Return cached list of zeroconf types.""" zeroconf: Dict[str, List[Dict[str, str]]] = ZEROCONF.copy() integrations = await async_get_custom_components(hass) for integration in integrations.values(): if not...
[ "async", "def", "async_get_zeroconf", "(", "hass", ":", "\"HomeAssistant\"", ")", "->", "Dict", "[", "str", ",", "List", "[", "Dict", "[", "str", ",", "str", "]", "]", "]", ":", "zeroconf", ":", "Dict", "[", "str", ",", "List", "[", "Dict", "[", "s...
[ 150, 0 ]
[ 170, 19 ]
python
en
['en', 'en', 'en']
True
async_get_homekit
(hass: "HomeAssistant")
Return cached list of homekit models.
Return cached list of homekit models.
async def async_get_homekit(hass: "HomeAssistant") -> Dict[str, str]: """Return cached list of homekit models.""" homekit: Dict[str, str] = HOMEKIT.copy() integrations = await async_get_custom_components(hass) for integration in integrations.values(): if ( not integration.homekit ...
[ "async", "def", "async_get_homekit", "(", "hass", ":", "\"HomeAssistant\"", ")", "->", "Dict", "[", "str", ",", "str", "]", ":", "homekit", ":", "Dict", "[", "str", ",", "str", "]", "=", "HOMEKIT", ".", "copy", "(", ")", "integrations", "=", "await", ...
[ 173, 0 ]
[ 189, 18 ]
python
en
['en', 'en', 'en']
True
async_get_ssdp
(hass: "HomeAssistant")
Return cached list of ssdp mappings.
Return cached list of ssdp mappings.
async def async_get_ssdp(hass: "HomeAssistant") -> Dict[str, List]: """Return cached list of ssdp mappings.""" ssdp: Dict[str, List] = SSDP.copy() integrations = await async_get_custom_components(hass) for integration in integrations.values(): if not integration.ssdp: continue ...
[ "async", "def", "async_get_ssdp", "(", "hass", ":", "\"HomeAssistant\"", ")", "->", "Dict", "[", "str", ",", "List", "]", ":", "ssdp", ":", "Dict", "[", "str", ",", "List", "]", "=", "SSDP", ".", "copy", "(", ")", "integrations", "=", "await", "async...
[ 192, 0 ]
[ 204, 15 ]
python
en
['en', 'en', 'en']
True
async_get_mqtt
(hass: "HomeAssistant")
Return cached list of MQTT mappings.
Return cached list of MQTT mappings.
async def async_get_mqtt(hass: "HomeAssistant") -> Dict[str, List]: """Return cached list of MQTT mappings.""" mqtt: Dict[str, List] = MQTT.copy() integrations = await async_get_custom_components(hass) for integration in integrations.values(): if not integration.mqtt: continue ...
[ "async", "def", "async_get_mqtt", "(", "hass", ":", "\"HomeAssistant\"", ")", "->", "Dict", "[", "str", ",", "List", "]", ":", "mqtt", ":", "Dict", "[", "str", ",", "List", "]", "=", "MQTT", ".", "copy", "(", ")", "integrations", "=", "await", "async...
[ 207, 0 ]
[ 219, 15 ]
python
en
['en', 'en', 'en']
True
async_get_integration
(hass: "HomeAssistant", domain: str)
Get an integration.
Get an integration.
async def async_get_integration(hass: "HomeAssistant", domain: str) -> Integration: """Get an integration.""" cache = hass.data.get(DATA_INTEGRATIONS) if cache is None: if not _async_mount_config_dir(hass): raise IntegrationNotFound(domain) cache = hass.data[DATA_INTEGRATIONS] = ...
[ "async", "def", "async_get_integration", "(", "hass", ":", "\"HomeAssistant\"", ",", "domain", ":", "str", ")", "->", "Integration", ":", "cache", "=", "hass", ".", "data", ".", "get", "(", "DATA_INTEGRATIONS", ")", "if", "cache", "is", "None", ":", "if", ...
[ 435, 0 ]
[ 492, 22 ]
python
en
['en', 'lb', 'en']
True
_load_file
( hass: "HomeAssistant", comp_or_platform: str, base_paths: List[str] )
Try to load specified file. Looks in config dir first, then built-in components. Only returns it if also found to be valid. Async friendly.
Try to load specified file.
def _load_file( hass: "HomeAssistant", comp_or_platform: str, base_paths: List[str] ) -> Optional[ModuleType]: """Try to load specified file. Looks in config dir first, then built-in components. Only returns it if also found to be valid. Async friendly. """ try: return hass.data[DAT...
[ "def", "_load_file", "(", "hass", ":", "\"HomeAssistant\"", ",", "comp_or_platform", ":", "str", ",", "base_paths", ":", "List", "[", "str", "]", ")", "->", "Optional", "[", "ModuleType", "]", ":", "try", ":", "return", "hass", ".", "data", "[", "DATA_CO...
[ 518, 0 ]
[ 577, 15 ]
python
en
['en', 'en', 'en']
True
bind_hass
(func: CALLABLE_T)
Decorate function to indicate that first argument is hass.
Decorate function to indicate that first argument is hass.
def bind_hass(func: CALLABLE_T) -> CALLABLE_T: """Decorate function to indicate that first argument is hass.""" setattr(func, "__bind_hass", True) return func
[ "def", "bind_hass", "(", "func", ":", "CALLABLE_T", ")", "->", "CALLABLE_T", ":", "setattr", "(", "func", ",", "\"__bind_hass\"", ",", "True", ")", "return", "func" ]
[ 640, 0 ]
[ 643, 15 ]
python
en
['en', 'en', 'en']
True
_async_component_dependencies
( hass: "HomeAssistant", start_domain: str, integration: Integration, loaded: Set[str], loading: Set[str], )
Recursive function to get component dependencies. Async friendly.
Recursive function to get component dependencies.
async def _async_component_dependencies( hass: "HomeAssistant", start_domain: str, integration: Integration, loaded: Set[str], loading: Set[str], ) -> Set[str]: """Recursive function to get component dependencies. Async friendly. """ domain = integration.domain loading.add(domai...
[ "async", "def", "_async_component_dependencies", "(", "hass", ":", "\"HomeAssistant\"", ",", "start_domain", ":", "str", ",", "integration", ":", "Integration", ",", "loaded", ":", "Set", "[", "str", "]", ",", "loading", ":", "Set", "[", "str", "]", ",", "...
[ 646, 0 ]
[ 686, 17 ]
python
en
['en', 'nl', 'en']
True
_async_mount_config_dir
(hass: "HomeAssistant")
Mount config dir in order to load custom_component. Async friendly but not a coroutine.
Mount config dir in order to load custom_component.
def _async_mount_config_dir(hass: "HomeAssistant") -> bool: """Mount config dir in order to load custom_component. Async friendly but not a coroutine. """ if hass.config.config_dir is None: _LOGGER.error("Can't load integrations - configuration directory is not set") return False if...
[ "def", "_async_mount_config_dir", "(", "hass", ":", "\"HomeAssistant\"", ")", "->", "bool", ":", "if", "hass", ".", "config", ".", "config_dir", "is", "None", ":", "_LOGGER", ".", "error", "(", "\"Can't load integrations - configuration directory is not set\"", ")", ...
[ 689, 0 ]
[ 699, 15 ]
python
en
['en', 'en', 'en']
True
_lookup_path
(hass: "HomeAssistant")
Return the lookup paths for legacy lookups.
Return the lookup paths for legacy lookups.
def _lookup_path(hass: "HomeAssistant") -> List[str]: """Return the lookup paths for legacy lookups.""" if hass.config.safe_mode: return [PACKAGE_BUILTIN] return [PACKAGE_CUSTOM_COMPONENTS, PACKAGE_BUILTIN]
[ "def", "_lookup_path", "(", "hass", ":", "\"HomeAssistant\"", ")", "->", "List", "[", "str", "]", ":", "if", "hass", ".", "config", ".", "safe_mode", ":", "return", "[", "PACKAGE_BUILTIN", "]", "return", "[", "PACKAGE_CUSTOM_COMPONENTS", ",", "PACKAGE_BUILTIN"...
[ 702, 0 ]
[ 706, 55 ]
python
en
['en', 'en', 'en']
True
Integration.resolve_from_root
( cls, hass: "HomeAssistant", root_module: ModuleType, domain: str )
Resolve an integration from a root module.
Resolve an integration from a root module.
def resolve_from_root( cls, hass: "HomeAssistant", root_module: ModuleType, domain: str ) -> "Optional[Integration]": """Resolve an integration from a root module.""" for base in root_module.__path__: # type: ignore manifest_path = pathlib.Path(base) / domain / "manifest.json" ...
[ "def", "resolve_from_root", "(", "cls", ",", "hass", ":", "\"HomeAssistant\"", ",", "root_module", ":", "ModuleType", ",", "domain", ":", "str", ")", "->", "\"Optional[Integration]\"", ":", "for", "base", "in", "root_module", ".", "__path__", ":", "# type: ignor...
[ 226, 4 ]
[ 248, 19 ]
python
en
['en', 'en', 'en']
True
Integration.resolve_legacy
( cls, hass: "HomeAssistant", domain: str )
Resolve legacy component. Will create a stub manifest.
Resolve legacy component.
def resolve_legacy( cls, hass: "HomeAssistant", domain: str ) -> "Optional[Integration]": """Resolve legacy component. Will create a stub manifest. """ comp = _load_file(hass, domain, _lookup_path(hass)) if comp is None: return None return cls( ...
[ "def", "resolve_legacy", "(", "cls", ",", "hass", ":", "\"HomeAssistant\"", ",", "domain", ":", "str", ")", "->", "\"Optional[Integration]\"", ":", "comp", "=", "_load_file", "(", "hass", ",", "domain", ",", "_lookup_path", "(", "hass", ")", ")", "if", "co...
[ 251, 4 ]
[ 268, 9 ]
python
en
['en', 'en', 'en']
True
Integration.__init__
( self, hass: "HomeAssistant", pkg_path: str, file_path: pathlib.Path, manifest: Dict[str, Any], )
Initialize an integration.
Initialize an integration.
def __init__( self, hass: "HomeAssistant", pkg_path: str, file_path: pathlib.Path, manifest: Dict[str, Any], ): """Initialize an integration.""" self.hass = hass self.pkg_path = pkg_path self.file_path = file_path self.manifest = manife...
[ "def", "__init__", "(", "self", ",", "hass", ":", "\"HomeAssistant\"", ",", "pkg_path", ":", "str", ",", "file_path", ":", "pathlib", ".", "Path", ",", "manifest", ":", "Dict", "[", "str", ",", "Any", "]", ",", ")", ":", "self", ".", "hass", "=", "...
[ 270, 4 ]
[ 291, 64 ]
python
en
['en', 'en', 'nl']
True
Integration.name
(self)
Return name.
Return name.
def name(self) -> str: """Return name.""" return cast(str, self.manifest["name"])
[ "def", "name", "(", "self", ")", "->", "str", ":", "return", "cast", "(", "str", ",", "self", ".", "manifest", "[", "\"name\"", "]", ")" ]
[ 294, 4 ]
[ 296, 47 ]
python
en
['en', 'ig', 'en']
False
Integration.disabled
(self)
Return reason integration is disabled.
Return reason integration is disabled.
def disabled(self) -> Optional[str]: """Return reason integration is disabled.""" return cast(Optional[str], self.manifest.get("disabled"))
[ "def", "disabled", "(", "self", ")", "->", "Optional", "[", "str", "]", ":", "return", "cast", "(", "Optional", "[", "str", "]", ",", "self", ".", "manifest", ".", "get", "(", "\"disabled\"", ")", ")" ]
[ 299, 4 ]
[ 301, 65 ]
python
en
['en', 'en', 'en']
True
Integration.domain
(self)
Return domain.
Return domain.
def domain(self) -> str: """Return domain.""" return cast(str, self.manifest["domain"])
[ "def", "domain", "(", "self", ")", "->", "str", ":", "return", "cast", "(", "str", ",", "self", ".", "manifest", "[", "\"domain\"", "]", ")" ]
[ 304, 4 ]
[ 306, 49 ]
python
de
['de', 'hi-Latn', 'en']
False
Integration.dependencies
(self)
Return dependencies.
Return dependencies.
def dependencies(self) -> List[str]: """Return dependencies.""" return cast(List[str], self.manifest.get("dependencies", []))
[ "def", "dependencies", "(", "self", ")", "->", "List", "[", "str", "]", ":", "return", "cast", "(", "List", "[", "str", "]", ",", "self", ".", "manifest", ".", "get", "(", "\"dependencies\"", ",", "[", "]", ")", ")" ]
[ 309, 4 ]
[ 311, 69 ]
python
af
['es', 'af', 'en']
False
Integration.after_dependencies
(self)
Return after_dependencies.
Return after_dependencies.
def after_dependencies(self) -> List[str]: """Return after_dependencies.""" return cast(List[str], self.manifest.get("after_dependencies", []))
[ "def", "after_dependencies", "(", "self", ")", "->", "List", "[", "str", "]", ":", "return", "cast", "(", "List", "[", "str", "]", ",", "self", ".", "manifest", ".", "get", "(", "\"after_dependencies\"", ",", "[", "]", ")", ")" ]
[ 314, 4 ]
[ 316, 75 ]
python
da
['da', 'nl', 'en']
False
Integration.requirements
(self)
Return requirements.
Return requirements.
def requirements(self) -> List[str]: """Return requirements.""" return cast(List[str], self.manifest.get("requirements", []))
[ "def", "requirements", "(", "self", ")", "->", "List", "[", "str", "]", ":", "return", "cast", "(", "List", "[", "str", "]", ",", "self", ".", "manifest", ".", "get", "(", "\"requirements\"", ",", "[", "]", ")", ")" ]
[ 319, 4 ]
[ 321, 69 ]
python
en
['en', 'en', 'en']
False
Integration.config_flow
(self)
Return config_flow.
Return config_flow.
def config_flow(self) -> bool: """Return config_flow.""" return cast(bool, self.manifest.get("config_flow", False))
[ "def", "config_flow", "(", "self", ")", "->", "bool", ":", "return", "cast", "(", "bool", ",", "self", ".", "manifest", ".", "get", "(", "\"config_flow\"", ",", "False", ")", ")" ]
[ 324, 4 ]
[ 326, 66 ]
python
en
['en', 'da', 'en']
False
Integration.documentation
(self)
Return documentation.
Return documentation.
def documentation(self) -> Optional[str]: """Return documentation.""" return cast(str, self.manifest.get("documentation"))
[ "def", "documentation", "(", "self", ")", "->", "Optional", "[", "str", "]", ":", "return", "cast", "(", "str", ",", "self", ".", "manifest", ".", "get", "(", "\"documentation\"", ")", ")" ]
[ 329, 4 ]
[ 331, 60 ]
python
cy
['de', 'cy', 'en']
False
Integration.issue_tracker
(self)
Return issue tracker link.
Return issue tracker link.
def issue_tracker(self) -> Optional[str]: """Return issue tracker link.""" return cast(str, self.manifest.get("issue_tracker"))
[ "def", "issue_tracker", "(", "self", ")", "->", "Optional", "[", "str", "]", ":", "return", "cast", "(", "str", ",", "self", ".", "manifest", ".", "get", "(", "\"issue_tracker\"", ")", ")" ]
[ 334, 4 ]
[ 336, 60 ]
python
en
['en', 'en', 'en']
True
Integration.quality_scale
(self)
Return Integration Quality Scale.
Return Integration Quality Scale.
def quality_scale(self) -> Optional[str]: """Return Integration Quality Scale.""" return cast(str, self.manifest.get("quality_scale"))
[ "def", "quality_scale", "(", "self", ")", "->", "Optional", "[", "str", "]", ":", "return", "cast", "(", "str", ",", "self", ".", "manifest", ".", "get", "(", "\"quality_scale\"", ")", ")" ]
[ 339, 4 ]
[ 341, 60 ]
python
en
['en', 'en', 'en']
True
Integration.mqtt
(self)
Return Integration MQTT entries.
Return Integration MQTT entries.
def mqtt(self) -> Optional[list]: """Return Integration MQTT entries.""" return cast(List[dict], self.manifest.get("mqtt"))
[ "def", "mqtt", "(", "self", ")", "->", "Optional", "[", "list", "]", ":", "return", "cast", "(", "List", "[", "dict", "]", ",", "self", ".", "manifest", ".", "get", "(", "\"mqtt\"", ")", ")" ]
[ 344, 4 ]
[ 346, 58 ]
python
en
['en', 'sv', 'en']
True
Integration.ssdp
(self)
Return Integration SSDP entries.
Return Integration SSDP entries.
def ssdp(self) -> Optional[list]: """Return Integration SSDP entries.""" return cast(List[dict], self.manifest.get("ssdp"))
[ "def", "ssdp", "(", "self", ")", "->", "Optional", "[", "list", "]", ":", "return", "cast", "(", "List", "[", "dict", "]", ",", "self", ".", "manifest", ".", "get", "(", "\"ssdp\"", ")", ")" ]
[ 349, 4 ]
[ 351, 58 ]
python
en
['en', 'sv', 'en']
True
Integration.zeroconf
(self)
Return Integration zeroconf entries.
Return Integration zeroconf entries.
def zeroconf(self) -> Optional[list]: """Return Integration zeroconf entries.""" return cast(List[str], self.manifest.get("zeroconf"))
[ "def", "zeroconf", "(", "self", ")", "->", "Optional", "[", "list", "]", ":", "return", "cast", "(", "List", "[", "str", "]", ",", "self", ".", "manifest", ".", "get", "(", "\"zeroconf\"", ")", ")" ]
[ 354, 4 ]
[ 356, 61 ]
python
de
['eu', 'de', 'en']
False
Integration.homekit
(self)
Return Integration homekit entries.
Return Integration homekit entries.
def homekit(self) -> Optional[dict]: """Return Integration homekit entries.""" return cast(Dict[str, List], self.manifest.get("homekit"))
[ "def", "homekit", "(", "self", ")", "->", "Optional", "[", "dict", "]", ":", "return", "cast", "(", "Dict", "[", "str", ",", "List", "]", ",", "self", ".", "manifest", ".", "get", "(", "\"homekit\"", ")", ")" ]
[ 359, 4 ]
[ 361, 66 ]
python
en
['nl', 'et', 'en']
False
Integration.is_built_in
(self)
Test if package is a built-in integration.
Test if package is a built-in integration.
def is_built_in(self) -> bool: """Test if package is a built-in integration.""" return self.pkg_path.startswith(PACKAGE_BUILTIN)
[ "def", "is_built_in", "(", "self", ")", "->", "bool", ":", "return", "self", ".", "pkg_path", ".", "startswith", "(", "PACKAGE_BUILTIN", ")" ]
[ 364, 4 ]
[ 366, 56 ]
python
en
['en', 'en', 'en']
True
Integration.all_dependencies
(self)
Return all dependencies including sub-dependencies.
Return all dependencies including sub-dependencies.
def all_dependencies(self) -> Set[str]: """Return all dependencies including sub-dependencies.""" if self._all_dependencies is None: raise RuntimeError("Dependencies not resolved!") return self._all_dependencies
[ "def", "all_dependencies", "(", "self", ")", "->", "Set", "[", "str", "]", ":", "if", "self", ".", "_all_dependencies", "is", "None", ":", "raise", "RuntimeError", "(", "\"Dependencies not resolved!\"", ")", "return", "self", ".", "_all_dependencies" ]
[ 369, 4 ]
[ 374, 37 ]
python
ca
['ca', 'ca', 'en']
True
Integration.all_dependencies_resolved
(self)
Return if all dependencies have been resolved.
Return if all dependencies have been resolved.
def all_dependencies_resolved(self) -> bool: """Return if all dependencies have been resolved.""" return self._all_dependencies_resolved is not None
[ "def", "all_dependencies_resolved", "(", "self", ")", "->", "bool", ":", "return", "self", ".", "_all_dependencies_resolved", "is", "not", "None" ]
[ 377, 4 ]
[ 379, 58 ]
python
en
['en', 'en', 'en']
True
Integration.resolve_dependencies
(self)
Resolve all dependencies.
Resolve all dependencies.
async def resolve_dependencies(self) -> bool: """Resolve all dependencies.""" if self._all_dependencies_resolved is not None: return self._all_dependencies_resolved try: dependencies = await _async_component_dependencies( self.hass, self.domain, self, set...
[ "async", "def", "resolve_dependencies", "(", "self", ")", "->", "bool", ":", "if", "self", ".", "_all_dependencies_resolved", "is", "not", "None", ":", "return", "self", ".", "_all_dependencies_resolved", "try", ":", "dependencies", "=", "await", "_async_component...
[ 381, 4 ]
[ 409, 46 ]
python
af
['ca', 'af', 'en']
False
Integration.get_component
(self)
Return the component.
Return the component.
def get_component(self) -> ModuleType: """Return the component.""" cache = self.hass.data.setdefault(DATA_COMPONENTS, {}) if self.domain not in cache: cache[self.domain] = importlib.import_module(self.pkg_path) return cache[self.domain]
[ "def", "get_component", "(", "self", ")", "->", "ModuleType", ":", "cache", "=", "self", ".", "hass", ".", "data", ".", "setdefault", "(", "DATA_COMPONENTS", ",", "{", "}", ")", "if", "self", ".", "domain", "not", "in", "cache", ":", "cache", "[", "s...
[ 411, 4 ]
[ 416, 33 ]
python
en
['en', 'en', 'en']
True
Integration.get_platform
(self, platform_name: str)
Return a platform for an integration.
Return a platform for an integration.
def get_platform(self, platform_name: str) -> ModuleType: """Return a platform for an integration.""" cache = self.hass.data.setdefault(DATA_COMPONENTS, {}) full_name = f"{self.domain}.{platform_name}" if full_name not in cache: cache[full_name] = self._import_platform(platfo...
[ "def", "get_platform", "(", "self", ",", "platform_name", ":", "str", ")", "->", "ModuleType", ":", "cache", "=", "self", ".", "hass", ".", "data", ".", "setdefault", "(", "DATA_COMPONENTS", ",", "{", "}", ")", "full_name", "=", "f\"{self.domain}.{platform_n...
[ 418, 4 ]
[ 424, 31 ]
python
en
['en', 'da', 'en']
True
Integration._import_platform
(self, platform_name: str)
Import the platform.
Import the platform.
def _import_platform(self, platform_name: str) -> ModuleType: """Import the platform.""" return importlib.import_module(f"{self.pkg_path}.{platform_name}")
[ "def", "_import_platform", "(", "self", ",", "platform_name", ":", "str", ")", "->", "ModuleType", ":", "return", "importlib", ".", "import_module", "(", "f\"{self.pkg_path}.{platform_name}\"", ")" ]
[ 426, 4 ]
[ 428, 74 ]
python
en
['en', 'da', 'en']
True
Integration.__repr__
(self)
Text representation of class.
Text representation of class.
def __repr__(self) -> str: """Text representation of class.""" return f"<Integration {self.domain}: {self.pkg_path}>"
[ "def", "__repr__", "(", "self", ")", "->", "str", ":", "return", "f\"<Integration {self.domain}: {self.pkg_path}>\"" ]
[ 430, 4 ]
[ 432, 62 ]
python
en
['en', 'en', 'en']
True
IntegrationNotFound.__init__
(self, domain: str)
Initialize a component not found error.
Initialize a component not found error.
def __init__(self, domain: str) -> None: """Initialize a component not found error.""" super().__init__(f"Integration '{domain}' not found.") self.domain = domain
[ "def", "__init__", "(", "self", ",", "domain", ":", "str", ")", "->", "None", ":", "super", "(", ")", ".", "__init__", "(", "f\"Integration '{domain}' not found.\"", ")", "self", ".", "domain", "=", "domain" ]
[ 502, 4 ]
[ 505, 28 ]
python
en
['en', 'en', 'en']
True
CircularDependency.__init__
(self, from_domain: str, to_domain: str)
Initialize circular dependency error.
Initialize circular dependency error.
def __init__(self, from_domain: str, to_domain: str) -> None: """Initialize circular dependency error.""" super().__init__(f"Circular dependency detected: {from_domain} -> {to_domain}.") self.from_domain = from_domain self.to_domain = to_domain
[ "def", "__init__", "(", "self", ",", "from_domain", ":", "str", ",", "to_domain", ":", "str", ")", "->", "None", ":", "super", "(", ")", ".", "__init__", "(", "f\"Circular dependency detected: {from_domain} -> {to_domain}.\"", ")", "self", ".", "from_domain", "=...
[ 511, 4 ]
[ 515, 34 ]
python
da
['da', 'nl', 'en']
False
ModuleWrapper.__init__
(self, hass: "HomeAssistant", module: ModuleType)
Initialize the module wrapper.
Initialize the module wrapper.
def __init__(self, hass: "HomeAssistant", module: ModuleType) -> None: """Initialize the module wrapper.""" self._hass = hass self._module = module
[ "def", "__init__", "(", "self", ",", "hass", ":", "\"HomeAssistant\"", ",", "module", ":", "ModuleType", ")", "->", "None", ":", "self", ".", "_hass", "=", "hass", "self", ".", "_module", "=", "module" ]
[ 583, 4 ]
[ 586, 29 ]
python
en
['en', 'en', 'en']
True
ModuleWrapper.__getattr__
(self, attr: str)
Fetch an attribute.
Fetch an attribute.
def __getattr__(self, attr: str) -> Any: """Fetch an attribute.""" value = getattr(self._module, attr) if hasattr(value, "__bind_hass"): value = ft.partial(value, self._hass) setattr(self, attr, value) return value
[ "def", "__getattr__", "(", "self", ",", "attr", ":", "str", ")", "->", "Any", ":", "value", "=", "getattr", "(", "self", ".", "_module", ",", "attr", ")", "if", "hasattr", "(", "value", ",", "\"__bind_hass\"", ")", ":", "value", "=", "ft", ".", "pa...
[ 588, 4 ]
[ 596, 20 ]
python
en
['en', 'co', 'en']
True
Components.__init__
(self, hass: "HomeAssistant")
Initialize the Components class.
Initialize the Components class.
def __init__(self, hass: "HomeAssistant") -> None: """Initialize the Components class.""" self._hass = hass
[ "def", "__init__", "(", "self", ",", "hass", ":", "\"HomeAssistant\"", ")", "->", "None", ":", "self", ".", "_hass", "=", "hass" ]
[ 602, 4 ]
[ 604, 25 ]
python
en
['en', 'en', 'en']
True
Components.__getattr__
(self, comp_name: str)
Fetch a component.
Fetch a component.
def __getattr__(self, comp_name: str) -> ModuleWrapper: """Fetch a component.""" # Test integration cache integration = self._hass.data.get(DATA_INTEGRATIONS, {}).get(comp_name) if isinstance(integration, Integration): component: Optional[ModuleType] = integration.get_compon...
[ "def", "__getattr__", "(", "self", ",", "comp_name", ":", "str", ")", "->", "ModuleWrapper", ":", "# Test integration cache", "integration", "=", "self", ".", "_hass", ".", "data", ".", "get", "(", "DATA_INTEGRATIONS", ",", "{", "}", ")", ".", "get", "(", ...
[ 606, 4 ]
[ 622, 22 ]
python
en
['en', 'en', 'en']
True
Helpers.__init__
(self, hass: "HomeAssistant")
Initialize the Helpers class.
Initialize the Helpers class.
def __init__(self, hass: "HomeAssistant") -> None: """Initialize the Helpers class.""" self._hass = hass
[ "def", "__init__", "(", "self", ",", "hass", ":", "\"HomeAssistant\"", ")", "->", "None", ":", "self", ".", "_hass", "=", "hass" ]
[ 628, 4 ]
[ 630, 25 ]
python
en
['en', 'en', 'en']
True
Helpers.__getattr__
(self, helper_name: str)
Fetch a helper.
Fetch a helper.
def __getattr__(self, helper_name: str) -> ModuleWrapper: """Fetch a helper.""" helper = importlib.import_module(f"homeassistant.helpers.{helper_name}") wrapped = ModuleWrapper(self._hass, helper) setattr(self, helper_name, wrapped) return wrapped
[ "def", "__getattr__", "(", "self", ",", "helper_name", ":", "str", ")", "->", "ModuleWrapper", ":", "helper", "=", "importlib", ".", "import_module", "(", "f\"homeassistant.helpers.{helper_name}\"", ")", "wrapped", "=", "ModuleWrapper", "(", "self", ".", "_hass", ...
[ 632, 4 ]
[ 637, 22 ]
python
en
['en', 'co', 'en']
True
normalize_answer
(str_input)
Lower text and remove punctuation, articles and extra whitespace.
Lower text and remove punctuation, articles and extra whitespace.
def normalize_answer(str_input): """Lower text and remove punctuation, articles and extra whitespace.""" def remove_articles(text): ''' Remove "a|an|the" ''' return re.sub(r'\b(a|an|the)\b', ' ', text) def white_space_fix(text): ''' Remove unnessary whitespac...
[ "def", "normalize_answer", "(", "str_input", ")", ":", "def", "remove_articles", "(", "text", ")", ":", "'''\n Remove \"a|an|the\"\n '''", "return", "re", ".", "sub", "(", "r'\\b(a|an|the)\\b'", ",", "' '", ",", "text", ")", "def", "white_space_fix", ...
[ 34, 0 ]
[ 61, 74 ]
python
en
['en', 'en', 'en']
True
f1_score
(prediction, ground_truth)
Calculate the f1 score.
Calculate the f1 score.
def f1_score(prediction, ground_truth): ''' Calculate the f1 score. ''' prediction_tokens = normalize_answer(prediction).split() ground_truth_tokens = normalize_answer(ground_truth).split() common = Counter(prediction_tokens) & Counter(ground_truth_tokens) num_same = sum(common.values()) ...
[ "def", "f1_score", "(", "prediction", ",", "ground_truth", ")", ":", "prediction_tokens", "=", "normalize_answer", "(", "prediction", ")", ".", "split", "(", ")", "ground_truth_tokens", "=", "normalize_answer", "(", "ground_truth", ")", ".", "split", "(", ")", ...
[ 64, 0 ]
[ 82, 20 ]
python
en
['en', 'error', 'th']
False
exact_match_score
(prediction, ground_truth)
Calculate the match score with prediction and ground truth.
Calculate the match score with prediction and ground truth.
def exact_match_score(prediction, ground_truth): ''' Calculate the match score with prediction and ground truth. ''' return normalize_answer(prediction) == normalize_answer(ground_truth)
[ "def", "exact_match_score", "(", "prediction", ",", "ground_truth", ")", ":", "return", "normalize_answer", "(", "prediction", ")", "==", "normalize_answer", "(", "ground_truth", ")" ]
[ 85, 0 ]
[ 89, 73 ]
python
en
['en', 'error', 'th']
False
metric_max_over_ground_truths
(metric_fn, prediction, ground_truths)
Metric max over the ground truths.
Metric max over the ground truths.
def metric_max_over_ground_truths(metric_fn, prediction, ground_truths): ''' Metric max over the ground truths. ''' scores_for_ground_truths = [] for ground_truth in ground_truths: score = metric_fn(prediction, ground_truth) scores_for_ground_truths.append(score) return max(score...
[ "def", "metric_max_over_ground_truths", "(", "metric_fn", ",", "prediction", ",", "ground_truths", ")", ":", "scores_for_ground_truths", "=", "[", "]", "for", "ground_truth", "in", "ground_truths", ":", "score", "=", "metric_fn", "(", "prediction", ",", "ground_trut...
[ 92, 0 ]
[ 100, 40 ]
python
en
['en', 'error', 'th']
False
_evaluate
(dataset, predictions)
Evaluate function.
Evaluate function.
def _evaluate(dataset, predictions): ''' Evaluate function. ''' f1_result = exact_match = total = 0 count = 0 for article in dataset: for paragraph in article['paragraphs']: for qa_pair in paragraph['qas']: total += 1 if qa_pair['id'] not in pr...
[ "def", "_evaluate", "(", "dataset", ",", "predictions", ")", ":", "f1_result", "=", "exact_match", "=", "total", "=", "0", "count", "=", "0", "for", "article", "in", "dataset", ":", "for", "paragraph", "in", "article", "[", "'paragraphs'", "]", ":", "for...
[ 103, 0 ]
[ 127, 56 ]
python
en
['en', 'error', 'th']
False
evaluate
(data_file, pred_file)
Evaluate.
Evaluate.
def evaluate(data_file, pred_file): ''' Evaluate. ''' expected_version = '1.1' with open(data_file) as dataset_file: dataset_json = json.load(dataset_file) if dataset_json['version'] != expected_version: print('Evaluation expects v-' + expected_version + ...
[ "def", "evaluate", "(", "data_file", ",", "pred_file", ")", ":", "expected_version", "=", "'1.1'", "with", "open", "(", "data_file", ")", "as", "dataset_file", ":", "dataset_json", "=", "json", ".", "load", "(", "dataset_file", ")", "if", "dataset_json", "["...
[ 130, 0 ]
[ 147, 32 ]
python
en
['en', 'error', 'th']
False
evaluate_with_predictions
(data_file, predictions)
Evalutate with predictions/
Evalutate with predictions/
def evaluate_with_predictions(data_file, predictions): ''' Evalutate with predictions/ ''' expected_version = '1.1' with open(data_file) as dataset_file: dataset_json = json.load(dataset_file) if dataset_json['version'] != expected_version: print('Evaluation expects v-' +...
[ "def", "evaluate_with_predictions", "(", "data_file", ",", "predictions", ")", ":", "expected_version", "=", "'1.1'", "with", "open", "(", "data_file", ")", "as", "dataset_file", ":", "dataset_json", "=", "json", ".", "load", "(", "dataset_file", ")", "if", "d...
[ 150, 0 ]
[ 163, 32 ]
python
en
['en', 'error', 'th']
False
rewrite_legacy
(config)
Rewrite legacy configuration to new format.
Rewrite legacy configuration to new format.
def rewrite_legacy(config): """Rewrite legacy configuration to new format.""" bridges = config.get(CONF_BRIDGES, [config]) new_bridges = [] for bridge_conf in bridges: groups = [] if "groups" in bridge_conf: groups = bridge_conf["groups"] else: _LOGGER.war...
[ "def", "rewrite_legacy", "(", "config", ")", ":", "bridges", "=", "config", ".", "get", "(", "CONF_BRIDGES", ",", "[", "config", "]", ")", "new_bridges", "=", "[", "]", "for", "bridge_conf", "in", "bridges", ":", "groups", "=", "[", "]", "if", "\"group...
[ 112, 0 ]
[ 142, 35 ]
python
en
['en', 'en', 'en']
True
setup_platform
(hass, config, add_entities, discovery_info=None)
Set up the LimitlessLED lights.
Set up the LimitlessLED lights.
def setup_platform(hass, config, add_entities, discovery_info=None): """Set up the LimitlessLED lights.""" # Two legacy configuration formats are supported to maintain backwards # compatibility. config = rewrite_legacy(config) # Use the expanded configuration format. lights = [] for bridge...
[ "def", "setup_platform", "(", "hass", ",", "config", ",", "add_entities", ",", "discovery_info", "=", "None", ")", ":", "# Two legacy configuration formats are supported to maintain backwards", "# compatibility.", "config", "=", "rewrite_legacy", "(", "config", ")", "# Us...
[ 145, 0 ]
[ 167, 24 ]
python
en
['en', 'da', 'en']
True
state
(new_state)
State decorator. Specify True (turn on) or False (turn off).
State decorator.
def state(new_state): """State decorator. Specify True (turn on) or False (turn off). """ def decorator(function): """Set up the decorator function.""" def wrapper(self, **kwargs): """Wrap a group state change.""" pipeline = Pipeline() transition_t...
[ "def", "state", "(", "new_state", ")", ":", "def", "decorator", "(", "function", ")", ":", "\"\"\"Set up the decorator function.\"\"\"", "def", "wrapper", "(", "self", ",", "*", "*", "kwargs", ")", ":", "\"\"\"Wrap a group state change.\"\"\"", "pipeline", "=", "P...
[ 170, 0 ]
[ 199, 20 ]
python
en
['fr', 'hr', 'en']
False
LimitlessLEDGroup.__init__
(self, group, config)
Initialize a group.
Initialize a group.
def __init__(self, group, config): """Initialize a group.""" if isinstance(group, WhiteGroup): self._supported = SUPPORT_LIMITLESSLED_WHITE self._effect_list = [EFFECT_NIGHT] elif isinstance(group, DimmerGroup): self._supported = SUPPORT_LIMITLESSLED_DIMMER ...
[ "def", "__init__", "(", "self", ",", "group", ",", "config", ")", ":", "if", "isinstance", "(", "group", ",", "WhiteGroup", ")", ":", "self", ".", "_supported", "=", "SUPPORT_LIMITLESSLED_WHITE", "self", ".", "_effect_list", "=", "[", "EFFECT_NIGHT", "]", ...
[ 205, 4 ]
[ 227, 27 ]
python
en
['en', 'en', 'en']
True
LimitlessLEDGroup.async_added_to_hass
(self)
Handle entity about to be added to hass event.
Handle entity about to be added to hass event.
async def async_added_to_hass(self): """Handle entity about to be added to hass event.""" await super().async_added_to_hass() last_state = await self.async_get_last_state() if last_state: self._is_on = last_state.state == STATE_ON self._brightness = last_state.att...
[ "async", "def", "async_added_to_hass", "(", "self", ")", ":", "await", "super", "(", ")", ".", "async_added_to_hass", "(", ")", "last_state", "=", "await", "self", ".", "async_get_last_state", "(", ")", "if", "last_state", ":", "self", ".", "_is_on", "=", ...
[ 229, 4 ]
[ 237, 63 ]
python
en
['en', 'en', 'en']
True
LimitlessLEDGroup.should_poll
(self)
No polling needed.
No polling needed.
def should_poll(self): """No polling needed.""" return False
[ "def", "should_poll", "(", "self", ")", ":", "return", "False" ]
[ 240, 4 ]
[ 242, 20 ]
python
en
['en', 'en', 'en']
True