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
ElkThermostat.min_temp
(self)
Return the minimum temperature supported.
Return the minimum temperature supported.
def min_temp(self): """Return the minimum temperature supported.""" return 1
[ "def", "min_temp", "(", "self", ")", ":", "return", "1" ]
[ 116, 4 ]
[ 118, 16 ]
python
en
['en', 'la', 'en']
True
ElkThermostat.max_temp
(self)
Return the maximum temperature supported.
Return the maximum temperature supported.
def max_temp(self): """Return the maximum temperature supported.""" return 99
[ "def", "max_temp", "(", "self", ")", ":", "return", "99" ]
[ 121, 4 ]
[ 123, 17 ]
python
en
['en', 'la', 'en']
True
ElkThermostat.fan_mode
(self)
Return the fan setting.
Return the fan setting.
def fan_mode(self): """Return the fan setting.""" if self._element.fan == ThermostatFan.AUTO.value: return HVAC_MODE_AUTO if self._element.fan == ThermostatFan.ON.value: return STATE_ON return None
[ "def", "fan_mode", "(", "self", ")", ":", "if", "self", ".", "_element", ".", "fan", "==", "ThermostatFan", ".", "AUTO", ".", "value", ":", "return", "HVAC_MODE_AUTO", "if", "self", ".", "_element", ".", "fan", "==", "ThermostatFan", ".", "ON", ".", "v...
[ 126, 4 ]
[ 132, 19 ]
python
en
['en', 'fy', 'en']
True
ElkThermostat.async_set_hvac_mode
(self, hvac_mode)
Set thermostat operation mode.
Set thermostat operation mode.
async def async_set_hvac_mode(self, hvac_mode): """Set thermostat operation mode.""" settings = { HVAC_MODE_OFF: (ThermostatMode.OFF.value, ThermostatFan.AUTO.value), HVAC_MODE_HEAT: (ThermostatMode.HEAT.value, None), HVAC_MODE_COOL: (ThermostatMode.COOL.value, None),...
[ "async", "def", "async_set_hvac_mode", "(", "self", ",", "hvac_mode", ")", ":", "settings", "=", "{", "HVAC_MODE_OFF", ":", "(", "ThermostatMode", ".", "OFF", ".", "value", ",", "ThermostatFan", ".", "AUTO", ".", "value", ")", ",", "HVAC_MODE_HEAT", ":", "...
[ 140, 4 ]
[ 149, 69 ]
python
en
['en', 'cs', 'en']
True
ElkThermostat.async_turn_aux_heat_on
(self)
Turn auxiliary heater on.
Turn auxiliary heater on.
async def async_turn_aux_heat_on(self): """Turn auxiliary heater on.""" self._elk_set(ThermostatMode.EMERGENCY_HEAT.value, None)
[ "async", "def", "async_turn_aux_heat_on", "(", "self", ")", ":", "self", ".", "_elk_set", "(", "ThermostatMode", ".", "EMERGENCY_HEAT", ".", "value", ",", "None", ")" ]
[ 151, 4 ]
[ 153, 64 ]
python
en
['fr', 'fi', 'en']
False
ElkThermostat.async_turn_aux_heat_off
(self)
Turn auxiliary heater off.
Turn auxiliary heater off.
async def async_turn_aux_heat_off(self): """Turn auxiliary heater off.""" self._elk_set(ThermostatMode.HEAT.value, None)
[ "async", "def", "async_turn_aux_heat_off", "(", "self", ")", ":", "self", ".", "_elk_set", "(", "ThermostatMode", ".", "HEAT", ".", "value", ",", "None", ")" ]
[ 155, 4 ]
[ 157, 54 ]
python
en
['en', 'en', 'en']
True
ElkThermostat.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 [HVAC_MODE_AUTO, STATE_ON]
[ "def", "fan_modes", "(", "self", ")", ":", "return", "[", "HVAC_MODE_AUTO", ",", "STATE_ON", "]" ]
[ 160, 4 ]
[ 162, 41 ]
python
en
['en', 'en', 'en']
True
ElkThermostat.async_set_fan_mode
(self, fan_mode)
Set new target fan mode.
Set new target fan mode.
async def async_set_fan_mode(self, fan_mode): """Set new target fan mode.""" if fan_mode == HVAC_MODE_AUTO: self._elk_set(None, ThermostatFan.AUTO.value) elif fan_mode == STATE_ON: self._elk_set(None, ThermostatFan.ON.value)
[ "async", "def", "async_set_fan_mode", "(", "self", ",", "fan_mode", ")", ":", "if", "fan_mode", "==", "HVAC_MODE_AUTO", ":", "self", ".", "_elk_set", "(", "None", ",", "ThermostatFan", ".", "AUTO", ".", "value", ")", "elif", "fan_mode", "==", "STATE_ON", "...
[ 164, 4 ]
[ 169, 55 ]
python
en
['sv', 'fy', 'en']
False
ElkThermostat.async_set_temperature
(self, **kwargs)
Set new target temperature.
Set new target temperature.
async def async_set_temperature(self, **kwargs): """Set new target temperature.""" low_temp = kwargs.get(ATTR_TARGET_TEMP_LOW) high_temp = kwargs.get(ATTR_TARGET_TEMP_HIGH) if low_temp is not None: self._element.set(ThermostatSetting.HEAT_SETPOINT.value, round(low_temp)) ...
[ "async", "def", "async_set_temperature", "(", "self", ",", "*", "*", "kwargs", ")", ":", "low_temp", "=", "kwargs", ".", "get", "(", "ATTR_TARGET_TEMP_LOW", ")", "high_temp", "=", "kwargs", ".", "get", "(", "ATTR_TARGET_TEMP_HIGH", ")", "if", "low_temp", "is...
[ 171, 4 ]
[ 178, 86 ]
python
en
['en', 'ca', 'en']
True
AbsCoreModel.step
(self, loss)
Use the loss to back-propagate gradients and apply them to the underlying parameters.
Use the loss to back-propagate gradients and apply them to the underlying parameters.
def step(self, loss): """Use the loss to back-propagate gradients and apply them to the underlying parameters.""" if self.optimizer is None: raise MissingOptimizer("No optimizer registered to the model") if isinstance(self.optimizer, dict): for optimizer in self.optimizer...
[ "def", "step", "(", "self", ",", "loss", ")", ":", "if", "self", ".", "optimizer", "is", "None", ":", "raise", "MissingOptimizer", "(", "\"No optimizer registered to the model\"", ")", "if", "isinstance", "(", "self", ".", "optimizer", ",", "dict", ")", ":",...
[ 76, 4 ]
[ 94, 33 ]
python
en
['en', 'en', 'en']
True
SimpleMultiHeadModel.forward
(self, inputs, task_name: Union[str, List[str]] = None, training: bool = True)
Feedforward computations for the given head(s). Args: inputs: Inputs to the model. task_name (str): The name of the task for which the network output is required. If the model contains only one task module, the task_name is ignored and the output of that module will be r...
Feedforward computations for the given head(s).
def forward(self, inputs, task_name: Union[str, List[str]] = None, training: bool = True): """Feedforward computations for the given head(s). Args: inputs: Inputs to the model. task_name (str): The name of the task for which the network output is required. If the model contains ...
[ "def", "forward", "(", "self", ",", "inputs", ",", "task_name", ":", "Union", "[", "str", ",", "List", "[", "str", "]", "]", "=", "None", ",", "training", ":", "bool", "=", "True", ")", ":", "self", ".", "train", "(", "mode", "=", "training", ")"...
[ 174, 4 ]
[ 196, 51 ]
python
en
['en', 'en', 'en']
True
git_log
(folder_path: str)
Log commit info.
Log commit info.
def git_log(folder_path: str): """ Log commit info. """ repo = git.Repo(search_parent_directories=True) repo_infos = { "repo_id": str(repo), "repo_sha": str(repo.head.object.hexsha), "repo_branch": str(repo.active_branch), } with open(os.path.join(folder_path, "git_l...
[ "def", "git_log", "(", "folder_path", ":", "str", ")", ":", "repo", "=", "git", ".", "Repo", "(", "search_parent_directories", "=", "True", ")", "repo_infos", "=", "{", "\"repo_id\"", ":", "str", "(", "repo", ")", ",", "\"repo_sha\"", ":", "str", "(", ...
[ 35, 0 ]
[ 47, 42 ]
python
en
['en', 'error', 'th']
False
init_gpu_params
(params)
Handle single and multi-GPU / multi-node.
Handle single and multi-GPU / multi-node.
def init_gpu_params(params): """ Handle single and multi-GPU / multi-node. """ if params.n_gpu <= 0: params.local_rank = 0 params.master_port = -1 params.is_master = True params.multi_gpu = False return assert torch.cuda.is_available() logger.info("Initi...
[ "def", "init_gpu_params", "(", "params", ")", ":", "if", "params", ".", "n_gpu", "<=", "0", ":", "params", ".", "local_rank", "=", "0", "params", ".", "master_port", "=", "-", "1", "params", ".", "is_master", "=", "True", "params", ".", "multi_gpu", "=...
[ 50, 0 ]
[ 122, 9 ]
python
en
['en', 'error', 'th']
False
set_seed
(args)
Set the random seed.
Set the random seed.
def set_seed(args): """ Set the random seed. """ np.random.seed(args.seed) torch.manual_seed(args.seed) if args.n_gpu > 0: torch.cuda.manual_seed_all(args.seed)
[ "def", "set_seed", "(", "args", ")", ":", "np", ".", "random", ".", "seed", "(", "args", ".", "seed", ")", "torch", ".", "manual_seed", "(", "args", ".", "seed", ")", "if", "args", ".", "n_gpu", ">", "0", ":", "torch", ".", "cuda", ".", "manual_s...
[ 125, 0 ]
[ 132, 45 ]
python
en
['en', 'error', 'th']
False
mock_nacl_imported
()
Mock a successful import.
Mock a successful import.
def mock_nacl_imported(): """Mock a successful import.""" with patch("homeassistant.components.owntracks.helper.nacl"): yield
[ "def", "mock_nacl_imported", "(", ")", ":", "with", "patch", "(", "\"homeassistant.components.owntracks.helper.nacl\"", ")", ":", "yield" ]
[ 9, 0 ]
[ 12, 13 ]
python
en
['en', 'ro', 'en']
True
mock_nacl_not_imported
()
Mock non successful import.
Mock non successful import.
def mock_nacl_not_imported(): """Mock non successful import.""" with patch("homeassistant.components.owntracks.helper.nacl", new=None): yield
[ "def", "mock_nacl_not_imported", "(", ")", ":", "with", "patch", "(", "\"homeassistant.components.owntracks.helper.nacl\"", ",", "new", "=", "None", ")", ":", "yield" ]
[ 16, 0 ]
[ 19, 13 ]
python
it
['it', 'it', 'en']
True
test_supports_encryption
(nacl_imported)
Test if env supports encryption.
Test if env supports encryption.
def test_supports_encryption(nacl_imported): """Test if env supports encryption.""" assert helper.supports_encryption()
[ "def", "test_supports_encryption", "(", "nacl_imported", ")", ":", "assert", "helper", ".", "supports_encryption", "(", ")" ]
[ 22, 0 ]
[ 24, 39 ]
python
en
['fr', 'en', 'en']
True
test_supports_encryption_failed
(nacl_not_imported)
Test if env does not support encryption.
Test if env does not support encryption.
def test_supports_encryption_failed(nacl_not_imported): """Test if env does not support encryption.""" assert not helper.supports_encryption()
[ "def", "test_supports_encryption_failed", "(", "nacl_not_imported", ")", ":", "assert", "not", "helper", ".", "supports_encryption", "(", ")" ]
[ 27, 0 ]
[ 29, 43 ]
python
en
['en', 'en', 'en']
True
validate_input
(data)
Validate the user input allows us to connect. Data has the keys from DATA_SCHEMA with values provided by the user.
Validate the user input allows us to connect.
async def validate_input(data): """Validate the user input allows us to connect. Data has the keys from DATA_SCHEMA with values provided by the user. """ harmony = await get_harmony_client_if_available(data[CONF_HOST]) if not harmony: raise CannotConnect return { CONF_NAME: fin...
[ "async", "def", "validate_input", "(", "data", ")", ":", "harmony", "=", "await", "get_harmony_client_if_available", "(", "data", "[", "CONF_HOST", "]", ")", "if", "not", "harmony", ":", "raise", "CannotConnect", "return", "{", "CONF_NAME", ":", "find_best_name_...
[ 30, 0 ]
[ 43, 5 ]
python
en
['en', 'en', 'en']
True
ConfigFlow.__init__
(self)
Initialize the Harmony config flow.
Initialize the Harmony config flow.
def __init__(self): """Initialize the Harmony config flow.""" self.harmony_config = {}
[ "def", "__init__", "(", "self", ")", ":", "self", ".", "harmony_config", "=", "{", "}" ]
[ 52, 4 ]
[ 54, 32 ]
python
en
['en', 'en', 'en']
True
ConfigFlow.async_step_user
(self, user_input=None)
Handle the initial step.
Handle the initial step.
async def async_step_user(self, user_input=None): """Handle the initial step.""" errors = {} if user_input is not None: try: validated = await validate_input(user_input) except CannotConnect: errors["base"] = "cannot_connect" e...
[ "async", "def", "async_step_user", "(", "self", ",", "user_input", "=", "None", ")", ":", "errors", "=", "{", "}", "if", "user_input", "is", "not", "None", ":", "try", ":", "validated", "=", "await", "validate_input", "(", "user_input", ")", "except", "C...
[ 56, 4 ]
[ 79, 9 ]
python
en
['en', 'en', 'en']
True
ConfigFlow.async_step_ssdp
(self, discovery_info)
Handle a discovered Harmony device.
Handle a discovered Harmony device.
async def async_step_ssdp(self, discovery_info): """Handle a discovered Harmony device.""" _LOGGER.debug("SSDP discovery_info: %s", discovery_info) parsed_url = urlparse(discovery_info[ssdp.ATTR_SSDP_LOCATION]) friendly_name = discovery_info[ssdp.ATTR_UPNP_FRIENDLY_NAME] if sel...
[ "async", "def", "async_step_ssdp", "(", "self", ",", "discovery_info", ")", ":", "_LOGGER", ".", "debug", "(", "\"SSDP discovery_info: %s\"", ",", "discovery_info", ")", "parsed_url", "=", "urlparse", "(", "discovery_info", "[", "ssdp", ".", "ATTR_SSDP_LOCATION", ...
[ 81, 4 ]
[ 109, 43 ]
python
en
['en', 'en', 'en']
True
ConfigFlow.async_step_link
(self, user_input=None)
Attempt to link with the Harmony.
Attempt to link with the Harmony.
async def async_step_link(self, user_input=None): """Attempt to link with the Harmony.""" errors = {} if user_input is not None: # Everything was validated in async_step_ssdp # all we do now is create. return await self._async_create_entry_from_valid_input( ...
[ "async", "def", "async_step_link", "(", "self", ",", "user_input", "=", "None", ")", ":", "errors", "=", "{", "}", "if", "user_input", "is", "not", "None", ":", "# Everything was validated in async_step_ssdp", "# all we do now is create.", "return", "await", "self",...
[ 111, 4 ]
[ 129, 9 ]
python
en
['en', 'en', 'en']
True
ConfigFlow.async_step_import
(self, validated_input)
Handle import.
Handle import.
async def async_step_import(self, validated_input): """Handle import.""" await self.async_set_unique_id( validated_input[UNIQUE_ID], raise_on_progress=False ) self._abort_if_unique_id_configured() # Everything was validated in remote async_setup_platform # al...
[ "async", "def", "async_step_import", "(", "self", ",", "validated_input", ")", ":", "await", "self", ".", "async_set_unique_id", "(", "validated_input", "[", "UNIQUE_ID", "]", ",", "raise_on_progress", "=", "False", ")", "self", ".", "_abort_if_unique_id_configured"...
[ 131, 4 ]
[ 142, 9 ]
python
en
['en', 'ja', 'en']
False
ConfigFlow.async_get_options_flow
(config_entry)
Get the options flow for this handler.
Get the options flow for this handler.
def async_get_options_flow(config_entry): """Get the options flow for this handler.""" return OptionsFlowHandler(config_entry)
[ "def", "async_get_options_flow", "(", "config_entry", ")", ":", "return", "OptionsFlowHandler", "(", "config_entry", ")" ]
[ 146, 4 ]
[ 148, 47 ]
python
en
['en', 'en', 'en']
True
ConfigFlow._async_create_entry_from_valid_input
(self, validated, user_input)
Single path to create the config entry from validated input.
Single path to create the config entry from validated input.
async def _async_create_entry_from_valid_input(self, validated, user_input): """Single path to create the config entry from validated input.""" data = { CONF_NAME: validated[CONF_NAME], CONF_HOST: validated[CONF_HOST], } # Options from yaml are preserved, we will...
[ "async", "def", "_async_create_entry_from_valid_input", "(", "self", ",", "validated", ",", "user_input", ")", ":", "data", "=", "{", "CONF_NAME", ":", "validated", "[", "CONF_NAME", "]", ",", "CONF_HOST", ":", "validated", "[", "CONF_HOST", "]", ",", "}", "...
[ 150, 4 ]
[ 161, 77 ]
python
en
['en', 'en', 'en']
True
ConfigFlow._host_already_configured
(self, host)
See if we already have a harmony entry matching the host.
See if we already have a harmony entry matching the host.
def _host_already_configured(self, host): """See if we already have a harmony entry matching the host.""" for entry in self._async_current_entries(): if CONF_HOST not in entry.data: continue if entry.data[CONF_HOST] == host: return True re...
[ "def", "_host_already_configured", "(", "self", ",", "host", ")", ":", "for", "entry", "in", "self", ".", "_async_current_entries", "(", ")", ":", "if", "CONF_HOST", "not", "in", "entry", ".", "data", ":", "continue", "if", "entry", ".", "data", "[", "CO...
[ 163, 4 ]
[ 171, 20 ]
python
en
['en', 'en', 'en']
True
OptionsFlowHandler.__init__
(self, config_entry: config_entries.ConfigEntry)
Initialize options flow.
Initialize options flow.
def __init__(self, config_entry: config_entries.ConfigEntry): """Initialize options flow.""" self.config_entry = config_entry
[ "def", "__init__", "(", "self", ",", "config_entry", ":", "config_entries", ".", "ConfigEntry", ")", ":", "self", ".", "config_entry", "=", "config_entry" ]
[ 186, 4 ]
[ 188, 40 ]
python
en
['en', 'en', 'en']
True
OptionsFlowHandler.async_step_init
(self, user_input=None)
Handle options flow.
Handle options flow.
async def async_step_init(self, user_input=None): """Handle options flow.""" if user_input is not None: return self.async_create_entry(title="", data=user_input) remote = self.hass.data[DOMAIN][self.config_entry.entry_id] data_schema = vol.Schema( { ...
[ "async", "def", "async_step_init", "(", "self", ",", "user_input", "=", "None", ")", ":", "if", "user_input", "is", "not", "None", ":", "return", "self", ".", "async_create_entry", "(", "title", "=", "\"\"", ",", "data", "=", "user_input", ")", "remote", ...
[ 190, 4 ]
[ 213, 76 ]
python
en
['en', 'nl', 'en']
True
test_manually_configured_platform
(hass)
Test that we do not set up an access point.
Test that we do not set up an access point.
async def test_manually_configured_platform(hass): """Test that we do not set up an access point.""" assert await async_setup_component( hass, CLIMATE_DOMAIN, {CLIMATE_DOMAIN: {"platform": HMIPC_DOMAIN}} ) assert not hass.data.get(HMIPC_DOMAIN)
[ "async", "def", "test_manually_configured_platform", "(", "hass", ")", ":", "assert", "await", "async_setup_component", "(", "hass", ",", "CLIMATE_DOMAIN", ",", "{", "CLIMATE_DOMAIN", ":", "{", "\"platform\"", ":", "HMIPC_DOMAIN", "}", "}", ")", "assert", "not", ...
[ 33, 0 ]
[ 38, 42 ]
python
en
['en', 'en', 'en']
True
test_hmip_heating_group_heat
(hass, default_mock_hap_factory)
Test HomematicipHeatingGroup.
Test HomematicipHeatingGroup.
async def test_hmip_heating_group_heat(hass, default_mock_hap_factory): """Test HomematicipHeatingGroup.""" entity_id = "climate.badezimmer" entity_name = "Badezimmer" device_model = None mock_hap = await default_mock_hap_factory.async_get_mock_hap( test_devices=["Wandthermostat", "Heizkörpe...
[ "async", "def", "test_hmip_heating_group_heat", "(", "hass", ",", "default_mock_hap_factory", ")", ":", "entity_id", "=", "\"climate.badezimmer\"", "entity_name", "=", "\"Badezimmer\"", "device_model", "=", "None", "mock_hap", "=", "await", "default_mock_hap_factory", "."...
[ 41, 0 ]
[ 231, 69 ]
python
en
['es', 'en', 'en']
False
test_hmip_heating_group_cool
(hass, default_mock_hap_factory)
Test HomematicipHeatingGroup.
Test HomematicipHeatingGroup.
async def test_hmip_heating_group_cool(hass, default_mock_hap_factory): """Test HomematicipHeatingGroup.""" entity_id = "climate.badezimmer" entity_name = "Badezimmer" device_model = None mock_hap = await default_mock_hap_factory.async_get_mock_hap( test_groups=[entity_name] ) ha_st...
[ "async", "def", "test_hmip_heating_group_cool", "(", "hass", ",", "default_mock_hap_factory", ")", ":", "entity_id", "=", "\"climate.badezimmer\"", "entity_name", "=", "\"Badezimmer\"", "device_model", "=", "None", "mock_hap", "=", "await", "default_mock_hap_factory", "."...
[ 234, 0 ]
[ 351, 48 ]
python
en
['es', 'en', 'en']
False
test_hmip_heating_group_heat_with_switch
(hass, default_mock_hap_factory)
Test HomematicipHeatingGroup.
Test HomematicipHeatingGroup.
async def test_hmip_heating_group_heat_with_switch(hass, default_mock_hap_factory): """Test HomematicipHeatingGroup.""" entity_id = "climate.schlafzimmer" entity_name = "Schlafzimmer" device_model = None mock_hap = await default_mock_hap_factory.async_get_mock_hap( test_devices=["Wandthermos...
[ "async", "def", "test_hmip_heating_group_heat_with_switch", "(", "hass", ",", "default_mock_hap_factory", ")", ":", "entity_id", "=", "\"climate.schlafzimmer\"", "entity_name", "=", "\"Schlafzimmer\"", "device_model", "=", "None", "mock_hap", "=", "await", "default_mock_hap...
[ 354, 0 ]
[ 375, 80 ]
python
en
['es', 'en', 'en']
False
test_hmip_heating_group_heat_with_radiator
(hass, default_mock_hap_factory)
Test HomematicipHeatingGroup.
Test HomematicipHeatingGroup.
async def test_hmip_heating_group_heat_with_radiator(hass, default_mock_hap_factory): """Test HomematicipHeatingGroup.""" entity_id = "climate.vorzimmer" entity_name = "Vorzimmer" device_model = None mock_hap = await default_mock_hap_factory.async_get_mock_hap( test_devices=["Heizkörpertherm...
[ "async", "def", "test_hmip_heating_group_heat_with_radiator", "(", "hass", ",", "default_mock_hap_factory", ")", ":", "entity_id", "=", "\"climate.vorzimmer\"", "entity_name", "=", "\"Vorzimmer\"", "device_model", "=", "None", "mock_hap", "=", "await", "default_mock_hap_fac...
[ 378, 0 ]
[ 398, 80 ]
python
en
['es', 'en', 'en']
False
test_hmip_climate_services
(hass, mock_hap_with_service)
Test HomematicipHeatingGroup.
Test HomematicipHeatingGroup.
async def test_hmip_climate_services(hass, mock_hap_with_service): """Test HomematicipHeatingGroup.""" home = mock_hap_with_service.home await hass.services.async_call( "homematicip_cloud", "activate_eco_mode_with_duration", {"duration": 60, "accesspoint_id": HAPID}, blocki...
[ "async", "def", "test_hmip_climate_services", "(", "hass", ",", "mock_hap_with_service", ")", ":", "home", "=", "mock_hap_with_service", ".", "home", "await", "hass", ".", "services", ".", "async_call", "(", "\"homematicip_cloud\"", ",", "\"activate_eco_mode_with_durati...
[ 401, 0 ]
[ 510, 49 ]
python
en
['es', 'en', 'en']
False
test_hmip_heating_group_services
(hass, default_mock_hap_factory)
Test HomematicipHeatingGroup services.
Test HomematicipHeatingGroup services.
async def test_hmip_heating_group_services(hass, default_mock_hap_factory): """Test HomematicipHeatingGroup services.""" entity_id = "climate.badezimmer" entity_name = "Badezimmer" device_model = None mock_hap = await default_mock_hap_factory.async_get_mock_hap( test_groups=[entity_name] ...
[ "async", "def", "test_hmip_heating_group_services", "(", "hass", ",", "default_mock_hap_factory", ")", ":", "entity_id", "=", "\"climate.badezimmer\"", "entity_name", "=", "\"Badezimmer\"", "device_model", "=", "None", "mock_hap", "=", "await", "default_mock_hap_factory", ...
[ 513, 0 ]
[ 549, 5 ]
python
en
['es', 'en', 'en']
True
entity_type_for_device_id
(device_id)
Return entity class for protocol of a given device_id. Async friendly.
Return entity class for protocol of a given device_id.
def entity_type_for_device_id(device_id): """Return entity class for protocol of a given device_id. Async friendly. """ entity_type_mapping = { # KlikAanKlikUit support both dimmers and on/off switches on the same # protocol "newkaku": TYPE_HYBRID } protocol = device_id....
[ "def", "entity_type_for_device_id", "(", "device_id", ")", ":", "entity_type_mapping", "=", "{", "# KlikAanKlikUit support both dimmers and on/off switches on the same", "# protocol", "\"newkaku\"", ":", "TYPE_HYBRID", "}", "protocol", "=", "device_id", ".", "split", "(", "...
[ 73, 0 ]
[ 84, 44 ]
python
en
['en', 'en', 'en']
True
entity_class_for_type
(entity_type)
Translate entity type to entity class. Async friendly.
Translate entity type to entity class.
def entity_class_for_type(entity_type): """Translate entity type to entity class. Async friendly. """ entity_device_mapping = { # sends only 'dim' commands not compatible with on/off switches TYPE_DIMMABLE: DimmableRflinkLight, # sends only 'on/off' commands not advices with dim...
[ "def", "entity_class_for_type", "(", "entity_type", ")", ":", "entity_device_mapping", "=", "{", "# sends only 'dim' commands not compatible with on/off switches", "TYPE_DIMMABLE", ":", "DimmableRflinkLight", ",", "# sends only 'on/off' commands not advices with dimmers and signal", "#...
[ 87, 0 ]
[ 106, 62 ]
python
en
['en', 'en', 'en']
True
devices_from_config
(domain_config)
Parse configuration and add Rflink light devices.
Parse configuration and add Rflink light devices.
def devices_from_config(domain_config): """Parse configuration and add Rflink light devices.""" devices = [] for device_id, config in domain_config[CONF_DEVICES].items(): # Determine which kind of entity to create if CONF_TYPE in config: # Remove type from config to not pass it a...
[ "def", "devices_from_config", "(", "domain_config", ")", ":", "devices", "=", "[", "]", "for", "device_id", ",", "config", "in", "domain_config", "[", "CONF_DEVICES", "]", ".", "items", "(", ")", ":", "# Determine which kind of entity to create", "if", "CONF_TYPE"...
[ 109, 0 ]
[ 139, 18 ]
python
en
['en', 'en', 'en']
True
async_setup_platform
(hass, config, async_add_entities, discovery_info=None)
Set up the Rflink light platform.
Set up the Rflink light platform.
async def async_setup_platform(hass, config, async_add_entities, discovery_info=None): """Set up the Rflink light platform.""" async_add_entities(devices_from_config(config)) async def add_new_device(event): """Check if device is known, otherwise add to list of known devices.""" device_id =...
[ "async", "def", "async_setup_platform", "(", "hass", ",", "config", ",", "async_add_entities", ",", "discovery_info", "=", "None", ")", ":", "async_add_entities", "(", "devices_from_config", "(", "config", ")", ")", "async", "def", "add_new_device", "(", "event", ...
[ 142, 0 ]
[ 158, 75 ]
python
en
['en', 'da', 'en']
True
DimmableRflinkLight.async_added_to_hass
(self)
Restore RFLink light brightness attribute.
Restore RFLink light brightness attribute.
async def async_added_to_hass(self): """Restore RFLink light brightness attribute.""" await super().async_added_to_hass() old_state = await self.async_get_last_state() if ( old_state is not None and old_state.attributes.get(ATTR_BRIGHTNESS) is not None ):...
[ "async", "def", "async_added_to_hass", "(", "self", ")", ":", "await", "super", "(", ")", ".", "async_added_to_hass", "(", ")", "old_state", "=", "await", "self", ".", "async_get_last_state", "(", ")", "if", "(", "old_state", "is", "not", "None", "and", "o...
[ 170, 4 ]
[ 180, 73 ]
python
en
['en', 'sv', 'en']
True
DimmableRflinkLight.async_turn_on
(self, **kwargs)
Turn the device on.
Turn the device on.
async def async_turn_on(self, **kwargs): """Turn the device on.""" if ATTR_BRIGHTNESS in kwargs: # rflink only support 16 brightness levels self._brightness = int(kwargs[ATTR_BRIGHTNESS] / 17) * 17 # Turn on light at the requested dim level await self._async_hand...
[ "async", "def", "async_turn_on", "(", "self", ",", "*", "*", "kwargs", ")", ":", "if", "ATTR_BRIGHTNESS", "in", "kwargs", ":", "# rflink only support 16 brightness levels", "self", ".", "_brightness", "=", "int", "(", "kwargs", "[", "ATTR_BRIGHTNESS", "]", "/", ...
[ 182, 4 ]
[ 189, 65 ]
python
en
['en', 'en', 'en']
True
DimmableRflinkLight.brightness
(self)
Return the brightness of this light between 0..255.
Return the brightness of this light between 0..255.
def brightness(self): """Return the brightness of this light between 0..255.""" return self._brightness
[ "def", "brightness", "(", "self", ")", ":", "return", "self", ".", "_brightness" ]
[ 192, 4 ]
[ 194, 31 ]
python
en
['en', 'en', 'en']
True
DimmableRflinkLight.device_state_attributes
(self)
Return the device state attributes.
Return the device state attributes.
def device_state_attributes(self): """Return the device state attributes.""" if self._brightness is None: return {} return {ATTR_BRIGHTNESS: self._brightness}
[ "def", "device_state_attributes", "(", "self", ")", ":", "if", "self", ".", "_brightness", "is", "None", ":", "return", "{", "}", "return", "{", "ATTR_BRIGHTNESS", ":", "self", ".", "_brightness", "}" ]
[ 197, 4 ]
[ 201, 50 ]
python
en
['en', 'en', 'en']
True
DimmableRflinkLight.supported_features
(self)
Flag supported features.
Flag supported features.
def supported_features(self): """Flag supported features.""" return SUPPORT_BRIGHTNESS
[ "def", "supported_features", "(", "self", ")", ":", "return", "SUPPORT_BRIGHTNESS" ]
[ 204, 4 ]
[ 206, 33 ]
python
en
['da', 'en', 'en']
True
HybridRflinkLight.async_added_to_hass
(self)
Restore RFLink light brightness attribute.
Restore RFLink light brightness attribute.
async def async_added_to_hass(self): """Restore RFLink light brightness attribute.""" await super().async_added_to_hass() old_state = await self.async_get_last_state() if ( old_state is not None and old_state.attributes.get(ATTR_BRIGHTNESS) is not None ):...
[ "async", "def", "async_added_to_hass", "(", "self", ")", ":", "await", "super", "(", ")", ".", "async_added_to_hass", "(", ")", "old_state", "=", "await", "self", ".", "async_get_last_state", "(", ")", "if", "(", "old_state", "is", "not", "None", "and", "o...
[ 226, 4 ]
[ 236, 73 ]
python
en
['en', 'sv', 'en']
True
HybridRflinkLight.async_turn_on
(self, **kwargs)
Turn the device on and set dim level.
Turn the device on and set dim level.
async def async_turn_on(self, **kwargs): """Turn the device on and set dim level.""" if ATTR_BRIGHTNESS in kwargs: # rflink only support 16 brightness levels self._brightness = int(kwargs[ATTR_BRIGHTNESS] / 17) * 17 # if receiver supports dimming this will turn on the li...
[ "async", "def", "async_turn_on", "(", "self", ",", "*", "*", "kwargs", ")", ":", "if", "ATTR_BRIGHTNESS", "in", "kwargs", ":", "# rflink only support 16 brightness levels", "self", ".", "_brightness", "=", "int", "(", "kwargs", "[", "ATTR_BRIGHTNESS", "]", "/", ...
[ 238, 4 ]
[ 251, 55 ]
python
en
['en', 'en', 'en']
True
HybridRflinkLight.brightness
(self)
Return the brightness of this light between 0..255.
Return the brightness of this light between 0..255.
def brightness(self): """Return the brightness of this light between 0..255.""" return self._brightness
[ "def", "brightness", "(", "self", ")", ":", "return", "self", ".", "_brightness" ]
[ 254, 4 ]
[ 256, 31 ]
python
en
['en', 'en', 'en']
True
HybridRflinkLight.device_state_attributes
(self)
Return the device state attributes.
Return the device state attributes.
def device_state_attributes(self): """Return the device state attributes.""" if self._brightness is None: return {} return {ATTR_BRIGHTNESS: self._brightness}
[ "def", "device_state_attributes", "(", "self", ")", ":", "if", "self", ".", "_brightness", "is", "None", ":", "return", "{", "}", "return", "{", "ATTR_BRIGHTNESS", ":", "self", ".", "_brightness", "}" ]
[ 259, 4 ]
[ 263, 50 ]
python
en
['en', 'en', 'en']
True
HybridRflinkLight.supported_features
(self)
Flag supported features.
Flag supported features.
def supported_features(self): """Flag supported features.""" return SUPPORT_BRIGHTNESS
[ "def", "supported_features", "(", "self", ")", ":", "return", "SUPPORT_BRIGHTNESS" ]
[ 266, 4 ]
[ 268, 33 ]
python
en
['da', 'en', 'en']
True
ToggleRflinkLight._handle_event
(self, event)
Adjust state if Rflink picks up a remote command for this device.
Adjust state if Rflink picks up a remote command for this device.
def _handle_event(self, event): """Adjust state if Rflink picks up a remote command for this device.""" self.cancel_queued_send_commands() command = event["command"] if command == "on": # if the state is unknown or false, it gets set as true # if the state is tru...
[ "def", "_handle_event", "(", "self", ",", "event", ")", ":", "self", ".", "cancel_queued_send_commands", "(", ")", "command", "=", "event", "[", "\"command\"", "]", "if", "command", "==", "\"on\"", ":", "# if the state is unknown or false, it gets set as true", "# i...
[ 280, 4 ]
[ 288, 54 ]
python
en
['en', 'en', 'en']
True
ToggleRflinkLight.async_turn_on
(self, **kwargs)
Turn the device on.
Turn the device on.
async def async_turn_on(self, **kwargs): """Turn the device on.""" await self._async_handle_command("toggle")
[ "async", "def", "async_turn_on", "(", "self", ",", "*", "*", "kwargs", ")", ":", "await", "self", ".", "_async_handle_command", "(", "\"toggle\"", ")" ]
[ 290, 4 ]
[ 292, 50 ]
python
en
['en', 'en', 'en']
True
ToggleRflinkLight.async_turn_off
(self, **kwargs)
Turn the device off.
Turn the device off.
async def async_turn_off(self, **kwargs): """Turn the device off.""" await self._async_handle_command("toggle")
[ "async", "def", "async_turn_off", "(", "self", ",", "*", "*", "kwargs", ")", ":", "await", "self", ".", "_async_handle_command", "(", "\"toggle\"", ")" ]
[ 294, 4 ]
[ 296, 50 ]
python
en
['en', 'en', 'en']
True
async_setup
(hass, config)
Set up 1-Wire integrations.
Set up 1-Wire integrations.
async def async_setup(hass, config): """Set up 1-Wire integrations.""" return True
[ "async", "def", "async_setup", "(", "hass", ",", "config", ")", ":", "return", "True" ]
[ 11, 0 ]
[ 13, 15 ]
python
en
['en', 'en', 'en']
True
async_setup_entry
(hass: HomeAssistantType, config_entry: ConfigEntry)
Set up a 1-Wire proxy for a config entry.
Set up a 1-Wire proxy for a config entry.
async def async_setup_entry(hass: HomeAssistantType, config_entry: ConfigEntry): """Set up a 1-Wire proxy for a config entry.""" hass.data.setdefault(DOMAIN, {}) onewirehub = OneWireHub(hass) try: await onewirehub.initialize(config_entry) except CannotConnect as exc: raise ConfigEnt...
[ "async", "def", "async_setup_entry", "(", "hass", ":", "HomeAssistantType", ",", "config_entry", ":", "ConfigEntry", ")", ":", "hass", ".", "data", ".", "setdefault", "(", "DOMAIN", ",", "{", "}", ")", "onewirehub", "=", "OneWireHub", "(", "hass", ")", "tr...
[ 16, 0 ]
[ 32, 15 ]
python
en
['en', 'en', 'en']
True
async_unload_entry
(hass: HomeAssistantType, config_entry: ConfigEntry)
Unload a config entry.
Unload a config entry.
async def async_unload_entry(hass: HomeAssistantType, config_entry: ConfigEntry): """Unload a config entry.""" unload_ok = all( await asyncio.gather( *[ hass.config_entries.async_forward_entry_unload(config_entry, component) for component in SUPPORTED_PLATFORM...
[ "async", "def", "async_unload_entry", "(", "hass", ":", "HomeAssistantType", ",", "config_entry", ":", "ConfigEntry", ")", ":", "unload_ok", "=", "all", "(", "await", "asyncio", ".", "gather", "(", "*", "[", "hass", ".", "config_entries", ".", "async_forward_e...
[ 35, 0 ]
[ 47, 20 ]
python
en
['en', 'es', 'en']
True
setup_namecheapdns
(hass, aioclient_mock)
Fixture that sets up NamecheapDNS.
Fixture that sets up NamecheapDNS.
def setup_namecheapdns(hass, aioclient_mock): """Fixture that sets up NamecheapDNS.""" aioclient_mock.get( namecheapdns.UPDATE_URL, params={"host": HOST, "domain": DOMAIN, "password": PASSWORD}, text="<interface-response><ErrCount>0</ErrCount></interface-response>", ) hass.loop....
[ "def", "setup_namecheapdns", "(", "hass", ",", "aioclient_mock", ")", ":", "aioclient_mock", ".", "get", "(", "namecheapdns", ".", "UPDATE_URL", ",", "params", "=", "{", "\"host\"", ":", "HOST", ",", "\"domain\"", ":", "DOMAIN", ",", "\"password\"", ":", "PA...
[ 17, 0 ]
[ 31, 5 ]
python
en
['en', 'en', 'en']
True
test_setup
(hass, aioclient_mock)
Test setup works if update passes.
Test setup works if update passes.
async def test_setup(hass, aioclient_mock): """Test setup works if update passes.""" aioclient_mock.get( namecheapdns.UPDATE_URL, params={"host": HOST, "domain": DOMAIN, "password": PASSWORD}, text="<interface-response><ErrCount>0</ErrCount></interface-response>", ) result = awa...
[ "async", "def", "test_setup", "(", "hass", ",", "aioclient_mock", ")", ":", "aioclient_mock", ".", "get", "(", "namecheapdns", ".", "UPDATE_URL", ",", "params", "=", "{", "\"host\"", ":", "HOST", ",", "\"domain\"", ":", "DOMAIN", ",", "\"password\"", ":", ...
[ 34, 0 ]
[ 52, 41 ]
python
en
['en', 'en', 'en']
True
test_setup_fails_if_update_fails
(hass, aioclient_mock)
Test setup fails if first update fails.
Test setup fails if first update fails.
async def test_setup_fails_if_update_fails(hass, aioclient_mock): """Test setup fails if first update fails.""" aioclient_mock.get( namecheapdns.UPDATE_URL, params={"host": HOST, "domain": DOMAIN, "password": PASSWORD}, text="<interface-response><ErrCount>1</ErrCount></interface-response...
[ "async", "def", "test_setup_fails_if_update_fails", "(", "hass", ",", "aioclient_mock", ")", ":", "aioclient_mock", ".", "get", "(", "namecheapdns", ".", "UPDATE_URL", ",", "params", "=", "{", "\"host\"", ":", "HOST", ",", "\"domain\"", ":", "DOMAIN", ",", "\"...
[ 55, 0 ]
[ 69, 41 ]
python
en
['ms', 'lb', 'en']
False
async_register
( hass: HomeAssistant, register: system_health.SystemHealthRegistration )
Register system health callbacks.
Register system health callbacks.
def async_register( hass: HomeAssistant, register: system_health.SystemHealthRegistration ) -> None: """Register system health callbacks.""" register.async_register_info(system_health_info, "/config/cloud")
[ "def", "async_register", "(", "hass", ":", "HomeAssistant", ",", "register", ":", "system_health", ".", "SystemHealthRegistration", ")", "->", "None", ":", "register", ".", "async_register_info", "(", "system_health_info", ",", "\"/config/cloud\"", ")" ]
[ 12, 0 ]
[ 16, 69 ]
python
en
['en', 'sv', 'en']
True
system_health_info
(hass)
Get info for the info page.
Get info for the info page.
async def system_health_info(hass): """Get info for the info page.""" cloud: Cloud = hass.data[DOMAIN] client: CloudClient = cloud.client data = { "logged_in": cloud.is_logged_in, } if cloud.is_logged_in: data["subscription_expiration"] = cloud.expiration_date data["rel...
[ "async", "def", "system_health_info", "(", "hass", ")", ":", "cloud", ":", "Cloud", "=", "hass", ".", "data", "[", "DOMAIN", "]", "client", ":", "CloudClient", "=", "cloud", ".", "client", "data", "=", "{", "\"logged_in\"", ":", "cloud", ".", "is_logged_...
[ 19, 0 ]
[ 47, 15 ]
python
en
['en', 'en', 'en']
True
TestTTSVoiceRSSPlatform.setup_method
(self)
Set up things to be run when tests are started.
Set up things to be run when tests are started.
def setup_method(self): """Set up things to be run when tests are started.""" self.hass = get_test_home_assistant() asyncio.run_coroutine_threadsafe( async_process_ha_core_config( self.hass, {"internal_url": "http://example.local:8123"} ), sel...
[ "def", "setup_method", "(", "self", ")", ":", "self", ".", "hass", "=", "get_test_home_assistant", "(", ")", "asyncio", ".", "run_coroutine_threadsafe", "(", "async_process_ha_core_config", "(", "self", ".", "hass", ",", "{", "\"internal_url\"", ":", "\"http://exa...
[ 21, 4 ]
[ 39, 9 ]
python
en
['en', 'en', 'en']
True
TestTTSVoiceRSSPlatform.teardown_method
(self)
Stop everything that was started.
Stop everything that was started.
def teardown_method(self): """Stop everything that was started.""" default_tts = self.hass.config.path(tts.DEFAULT_CACHE_DIR) if os.path.isdir(default_tts): shutil.rmtree(default_tts) self.hass.stop()
[ "def", "teardown_method", "(", "self", ")", ":", "default_tts", "=", "self", ".", "hass", ".", "config", ".", "path", "(", "tts", ".", "DEFAULT_CACHE_DIR", ")", "if", "os", ".", "path", ".", "isdir", "(", "default_tts", ")", ":", "shutil", ".", "rmtree...
[ 41, 4 ]
[ 47, 24 ]
python
en
['en', 'en', 'en']
True
TestTTSVoiceRSSPlatform.test_setup_component
(self)
Test setup component.
Test setup component.
def test_setup_component(self): """Test setup component.""" config = {tts.DOMAIN: {"platform": "voicerss", "api_key": "1234567xx"}} with assert_setup_component(1, tts.DOMAIN): setup_component(self.hass, tts.DOMAIN, config)
[ "def", "test_setup_component", "(", "self", ")", ":", "config", "=", "{", "tts", ".", "DOMAIN", ":", "{", "\"platform\"", ":", "\"voicerss\"", ",", "\"api_key\"", ":", "\"1234567xx\"", "}", "}", "with", "assert_setup_component", "(", "1", ",", "tts", ".", ...
[ 49, 4 ]
[ 54, 58 ]
python
en
['en', 'da', 'en']
True
TestTTSVoiceRSSPlatform.test_setup_component_without_api_key
(self)
Test setup component without api key.
Test setup component without api key.
def test_setup_component_without_api_key(self): """Test setup component without api key.""" config = {tts.DOMAIN: {"platform": "voicerss"}} with assert_setup_component(0, tts.DOMAIN): setup_component(self.hass, tts.DOMAIN, config)
[ "def", "test_setup_component_without_api_key", "(", "self", ")", ":", "config", "=", "{", "tts", ".", "DOMAIN", ":", "{", "\"platform\"", ":", "\"voicerss\"", "}", "}", "with", "assert_setup_component", "(", "0", ",", "tts", ".", "DOMAIN", ")", ":", "setup_c...
[ 56, 4 ]
[ 61, 58 ]
python
en
['en', 'haw', 'en']
True
TestTTSVoiceRSSPlatform.test_service_say
(self, aioclient_mock)
Test service call say.
Test service call say.
def test_service_say(self, aioclient_mock): """Test service call say.""" calls = mock_service(self.hass, DOMAIN_MP, SERVICE_PLAY_MEDIA) aioclient_mock.post(self.url, data=self.form_data, status=200, content=b"test") config = {tts.DOMAIN: {"platform": "voicerss", "api_key": "1234567xx"}...
[ "def", "test_service_say", "(", "self", ",", "aioclient_mock", ")", ":", "calls", "=", "mock_service", "(", "self", ".", "hass", ",", "DOMAIN_MP", ",", "SERVICE_PLAY_MEDIA", ")", "aioclient_mock", ".", "post", "(", "self", ".", "url", ",", "data", "=", "se...
[ 63, 4 ]
[ 87, 70 ]
python
en
['en', 'en', 'en']
True
TestTTSVoiceRSSPlatform.test_service_say_german_config
(self, aioclient_mock)
Test service call say with german code in the config.
Test service call say with german code in the config.
def test_service_say_german_config(self, aioclient_mock): """Test service call say with german code in the config.""" calls = mock_service(self.hass, DOMAIN_MP, SERVICE_PLAY_MEDIA) self.form_data["hl"] = "de-de" aioclient_mock.post(self.url, data=self.form_data, status=200, content=b"te...
[ "def", "test_service_say_german_config", "(", "self", ",", "aioclient_mock", ")", ":", "calls", "=", "mock_service", "(", "self", ".", "hass", ",", "DOMAIN_MP", ",", "SERVICE_PLAY_MEDIA", ")", "self", ".", "form_data", "[", "\"hl\"", "]", "=", "\"de-de\"", "ai...
[ 89, 4 ]
[ 119, 64 ]
python
en
['en', 'en', 'en']
True
TestTTSVoiceRSSPlatform.test_service_say_german_service
(self, aioclient_mock)
Test service call say with german code in the service.
Test service call say with german code in the service.
def test_service_say_german_service(self, aioclient_mock): """Test service call say with german code in the service.""" calls = mock_service(self.hass, DOMAIN_MP, SERVICE_PLAY_MEDIA) self.form_data["hl"] = "de-de" aioclient_mock.post(self.url, data=self.form_data, status=200, content=b"...
[ "def", "test_service_say_german_service", "(", "self", ",", "aioclient_mock", ")", ":", "calls", "=", "mock_service", "(", "self", ".", "hass", ",", "DOMAIN_MP", ",", "SERVICE_PLAY_MEDIA", ")", "self", ".", "form_data", "[", "\"hl\"", "]", "=", "\"de-de\"", "a...
[ 121, 4 ]
[ 146, 64 ]
python
en
['en', 'en', 'en']
True
TestTTSVoiceRSSPlatform.test_service_say_error
(self, aioclient_mock)
Test service call say with http response 400.
Test service call say with http response 400.
def test_service_say_error(self, aioclient_mock): """Test service call say with http response 400.""" calls = mock_service(self.hass, DOMAIN_MP, SERVICE_PLAY_MEDIA) aioclient_mock.post(self.url, data=self.form_data, status=400, content=b"test") config = {tts.DOMAIN: {"platform": "voice...
[ "def", "test_service_say_error", "(", "self", ",", "aioclient_mock", ")", ":", "calls", "=", "mock_service", "(", "self", ".", "hass", ",", "DOMAIN_MP", ",", "SERVICE_PLAY_MEDIA", ")", "aioclient_mock", ".", "post", "(", "self", ".", "url", ",", "data", "=",...
[ 148, 4 ]
[ 171, 64 ]
python
en
['en', 'en', 'en']
True
TestTTSVoiceRSSPlatform.test_service_say_timeout
(self, aioclient_mock)
Test service call say with http timeout.
Test service call say with http timeout.
def test_service_say_timeout(self, aioclient_mock): """Test service call say with http timeout.""" calls = mock_service(self.hass, DOMAIN_MP, SERVICE_PLAY_MEDIA) aioclient_mock.post(self.url, data=self.form_data, exc=asyncio.TimeoutError()) config = {tts.DOMAIN: {"platform": "voicerss"...
[ "def", "test_service_say_timeout", "(", "self", ",", "aioclient_mock", ")", ":", "calls", "=", "mock_service", "(", "self", ".", "hass", ",", "DOMAIN_MP", ",", "SERVICE_PLAY_MEDIA", ")", "aioclient_mock", ".", "post", "(", "self", ".", "url", ",", "data", "=...
[ 173, 4 ]
[ 196, 64 ]
python
en
['en', 'en', 'en']
True
TestTTSVoiceRSSPlatform.test_service_say_error_msg
(self, aioclient_mock)
Test service call say with http error api message.
Test service call say with http error api message.
def test_service_say_error_msg(self, aioclient_mock): """Test service call say with http error api message.""" calls = mock_service(self.hass, DOMAIN_MP, SERVICE_PLAY_MEDIA) aioclient_mock.post( self.url, data=self.form_data, status=200, content=b...
[ "def", "test_service_say_error_msg", "(", "self", ",", "aioclient_mock", ")", ":", "calls", "=", "mock_service", "(", "self", ".", "hass", ",", "DOMAIN_MP", ",", "SERVICE_PLAY_MEDIA", ")", "aioclient_mock", ".", "post", "(", "self", ".", "url", ",", "data", ...
[ 198, 4 ]
[ 226, 64 ]
python
en
['en', 'en', 'en']
True
data_packet
(value)
Decode a data packet given for a Broadlink remote.
Decode a data packet given for a Broadlink remote.
def data_packet(value): """Decode a data packet given for a Broadlink remote.""" value = cv.string(value) extra = len(value) % 4 if extra > 0: value = value + ("=" * (4 - extra)) return b64decode(value)
[ "def", "data_packet", "(", "value", ")", ":", "value", "=", "cv", ".", "string", "(", "value", ")", "extra", "=", "len", "(", "value", ")", "%", "4", "if", "extra", ">", "0", ":", "value", "=", "value", "+", "(", "\"=\"", "*", "(", "4", "-", ...
[ 10, 0 ]
[ 16, 27 ]
python
en
['br', 'en', 'en']
True
mac_address
(mac)
Validate and convert a MAC address to bytes.
Validate and convert a MAC address to bytes.
def mac_address(mac): """Validate and convert a MAC address to bytes.""" mac = cv.string(mac) if len(mac) == 17: mac = "".join(mac[i : i + 2] for i in range(0, 17, 3)) elif len(mac) == 14: mac = "".join(mac[i : i + 4] for i in range(0, 14, 5)) elif len(mac) != 12: raise Value...
[ "def", "mac_address", "(", "mac", ")", ":", "mac", "=", "cv", ".", "string", "(", "mac", ")", "if", "len", "(", "mac", ")", "==", "17", ":", "mac", "=", "\"\"", ".", "join", "(", "mac", "[", "i", ":", "i", "+", "2", "]", "for", "i", "in", ...
[ 19, 0 ]
[ 28, 29 ]
python
en
['en', 'en', 'en']
True
format_mac
(mac)
Format a MAC address.
Format a MAC address.
def format_mac(mac): """Format a MAC address.""" return ":".join([format(octet, "02x") for octet in mac])
[ "def", "format_mac", "(", "mac", ")", ":", "return", "\":\"", ".", "join", "(", "[", "format", "(", "octet", ",", "\"02x\"", ")", "for", "octet", "in", "mac", "]", ")" ]
[ 31, 0 ]
[ 33, 60 ]
python
en
['en', 'mt', 'en']
True
import_device
(hass, host)
Create a config flow for a device.
Create a config flow for a device.
def import_device(hass, host): """Create a config flow for a device.""" configured_hosts = { entry.data.get(CONF_HOST) for entry in hass.config_entries.async_entries(DOMAIN) } if host not in configured_hosts: task = hass.config_entries.flow.async_init( DOMAIN, co...
[ "def", "import_device", "(", "hass", ",", "host", ")", ":", "configured_hosts", "=", "{", "entry", ".", "data", ".", "get", "(", "CONF_HOST", ")", "for", "entry", "in", "hass", ".", "config_entries", ".", "async_entries", "(", "DOMAIN", ")", "}", "if", ...
[ 36, 0 ]
[ 48, 36 ]
python
en
['en', 'en', 'en']
True
surepetcare
(hass)
Mock the SurePetcare for easier testing.
Mock the SurePetcare for easier testing.
def surepetcare(hass): """Mock the SurePetcare for easier testing.""" with patch("homeassistant.components.surepetcare.SurePetcare") as mock_surepetcare: instance = mock_surepetcare.return_value = SurePetcare( "test-username", "test-password", hass.loop, a...
[ "def", "surepetcare", "(", "hass", ")", ":", "with", "patch", "(", "\"homeassistant.components.surepetcare.SurePetcare\"", ")", "as", "mock_surepetcare", ":", "instance", "=", "mock_surepetcare", ".", "return_value", "=", "SurePetcare", "(", "\"test-username\"", ",", ...
[ 10, 0 ]
[ 22, 30 ]
python
en
['en', 'en', 'en']
True
ceiling_fan
(name: str)
Create a ceiling fan (that has built-in light) with given name.
Create a ceiling fan (that has built-in light) with given name.
def ceiling_fan(name: str): """Create a ceiling fan (that has built-in light) with given name.""" return { "name": name, "type": DeviceType.CEILING_FAN, "actions": [Action.TURN_LIGHT_ON, Action.TURN_LIGHT_OFF], }
[ "def", "ceiling_fan", "(", "name", ":", "str", ")", ":", "return", "{", "\"name\"", ":", "name", ",", "\"type\"", ":", "DeviceType", ".", "CEILING_FAN", ",", "\"actions\"", ":", "[", "Action", ".", "TURN_LIGHT_ON", ",", "Action", ".", "TURN_LIGHT_OFF", "]"...
[ 31, 0 ]
[ 37, 5 ]
python
en
['en', 'en', 'en']
True
dimmable_ceiling_fan
(name: str)
Create a ceiling fan (that has built-in light) with given name.
Create a ceiling fan (that has built-in light) with given name.
def dimmable_ceiling_fan(name: str): """Create a ceiling fan (that has built-in light) with given name.""" return { "name": name, "type": DeviceType.CEILING_FAN, "actions": [Action.TURN_LIGHT_ON, Action.TURN_LIGHT_OFF, Action.SET_BRIGHTNESS], }
[ "def", "dimmable_ceiling_fan", "(", "name", ":", "str", ")", ":", "return", "{", "\"name\"", ":", "name", ",", "\"type\"", ":", "DeviceType", ".", "CEILING_FAN", ",", "\"actions\"", ":", "[", "Action", ".", "TURN_LIGHT_ON", ",", "Action", ".", "TURN_LIGHT_OF...
[ 40, 0 ]
[ 46, 5 ]
python
en
['en', 'en', 'en']
True
fireplace
(name: str)
Create a fireplace with given name.
Create a fireplace with given name.
def fireplace(name: str): """Create a fireplace with given name.""" return { "name": name, "type": DeviceType.FIREPLACE, "actions": [Action.TURN_ON, Action.TURN_OFF], }
[ "def", "fireplace", "(", "name", ":", "str", ")", ":", "return", "{", "\"name\"", ":", "name", ",", "\"type\"", ":", "DeviceType", ".", "FIREPLACE", ",", "\"actions\"", ":", "[", "Action", ".", "TURN_ON", ",", "Action", ".", "TURN_OFF", "]", ",", "}" ]
[ 49, 0 ]
[ 55, 5 ]
python
en
['en', 'en', 'en']
True
fireplace_with_light
(name: str)
Create a fireplace with given name.
Create a fireplace with given name.
def fireplace_with_light(name: str): """Create a fireplace with given name.""" return { "name": name, "type": DeviceType.FIREPLACE, "actions": [ Action.TURN_ON, Action.TURN_OFF, Action.TURN_LIGHT_ON, Action.TURN_LIGHT_OFF, ], }
[ "def", "fireplace_with_light", "(", "name", ":", "str", ")", ":", "return", "{", "\"name\"", ":", "name", ",", "\"type\"", ":", "DeviceType", ".", "FIREPLACE", ",", "\"actions\"", ":", "[", "Action", ".", "TURN_ON", ",", "Action", ".", "TURN_OFF", ",", "...
[ 58, 0 ]
[ 69, 5 ]
python
en
['en', 'en', 'en']
True
test_fan_entity_registry
(hass: core.HomeAssistant)
Tests that fan with light devices are registered in the entity registry.
Tests that fan with light devices are registered in the entity registry.
async def test_fan_entity_registry(hass: core.HomeAssistant): """Tests that fan with light devices are registered in the entity registry.""" await setup_platform( hass, LIGHT_DOMAIN, ceiling_fan("fan-name"), bond_version={"bondid": "test-hub-id"}, bond_device_id="test-dev...
[ "async", "def", "test_fan_entity_registry", "(", "hass", ":", "core", ".", "HomeAssistant", ")", ":", "await", "setup_platform", "(", "hass", ",", "LIGHT_DOMAIN", ",", "ceiling_fan", "(", "\"fan-name\"", ")", ",", "bond_version", "=", "{", "\"bondid\"", ":", "...
[ 72, 0 ]
[ 84, 59 ]
python
en
['en', 'en', 'en']
True
test_fireplace_entity_registry
(hass: core.HomeAssistant)
Tests that flame fireplace devices are registered in the entity registry.
Tests that flame fireplace devices are registered in the entity registry.
async def test_fireplace_entity_registry(hass: core.HomeAssistant): """Tests that flame fireplace devices are registered in the entity registry.""" await setup_platform( hass, LIGHT_DOMAIN, fireplace("fireplace-name"), bond_version={"bondid": "test-hub-id"}, bond_device_i...
[ "async", "def", "test_fireplace_entity_registry", "(", "hass", ":", "core", ".", "HomeAssistant", ")", ":", "await", "setup_platform", "(", "hass", ",", "LIGHT_DOMAIN", ",", "fireplace", "(", "\"fireplace-name\"", ")", ",", "bond_version", "=", "{", "\"bondid\"", ...
[ 87, 0 ]
[ 99, 59 ]
python
en
['en', 'en', 'en']
True
test_fireplace_with_light_entity_registry
(hass: core.HomeAssistant)
Tests that flame+light devices are registered in the entity registry.
Tests that flame+light devices are registered in the entity registry.
async def test_fireplace_with_light_entity_registry(hass: core.HomeAssistant): """Tests that flame+light devices are registered in the entity registry.""" await setup_platform( hass, LIGHT_DOMAIN, fireplace_with_light("fireplace-name"), bond_version={"bondid": "test-hub-id"}, ...
[ "async", "def", "test_fireplace_with_light_entity_registry", "(", "hass", ":", "core", ".", "HomeAssistant", ")", ":", "await", "setup_platform", "(", "hass", ",", "LIGHT_DOMAIN", ",", "fireplace_with_light", "(", "\"fireplace-name\"", ")", ",", "bond_version", "=", ...
[ 102, 0 ]
[ 116, 71 ]
python
en
['en', 'en', 'en']
True
test_sbb_trust_state
(hass: core.HomeAssistant)
Assumed state should be False if device is a Smart by Bond.
Assumed state should be False if device is a Smart by Bond.
async def test_sbb_trust_state(hass: core.HomeAssistant): """Assumed state should be False if device is a Smart by Bond.""" version = { "model": "MR123A", "bondid": "test-bond-id", } await setup_platform( hass, LIGHT_DOMAIN, ceiling_fan("name-1"), bond_version=version ) ...
[ "async", "def", "test_sbb_trust_state", "(", "hass", ":", "core", ".", "HomeAssistant", ")", ":", "version", "=", "{", "\"model\"", ":", "\"MR123A\"", ",", "\"bondid\"", ":", "\"test-bond-id\"", ",", "}", "await", "setup_platform", "(", "hass", ",", "LIGHT_DOM...
[ 119, 0 ]
[ 130, 64 ]
python
en
['en', 'en', 'en']
True
test_trust_state_not_specified
(hass: core.HomeAssistant)
Assumed state should be True if Trust State is not specified.
Assumed state should be True if Trust State is not specified.
async def test_trust_state_not_specified(hass: core.HomeAssistant): """Assumed state should be True if Trust State is not specified.""" await setup_platform(hass, LIGHT_DOMAIN, ceiling_fan("name-1")) device = hass.states.get("light.name_1") assert device.attributes.get(ATTR_ASSUMED_STATE) is True
[ "async", "def", "test_trust_state_not_specified", "(", "hass", ":", "core", ".", "HomeAssistant", ")", ":", "await", "setup_platform", "(", "hass", ",", "LIGHT_DOMAIN", ",", "ceiling_fan", "(", "\"name-1\"", ")", ")", "device", "=", "hass", ".", "states", ".",...
[ 133, 0 ]
[ 138, 60 ]
python
en
['en', 'en', 'en']
True
test_trust_state
(hass: core.HomeAssistant)
Assumed state should be True if Trust State is False.
Assumed state should be True if Trust State is False.
async def test_trust_state(hass: core.HomeAssistant): """Assumed state should be True if Trust State is False.""" await setup_platform( hass, LIGHT_DOMAIN, ceiling_fan("name-1"), props={"trust_state": False} ) device = hass.states.get("light.name_1") assert device.attributes.get(ATTR_ASSUME...
[ "async", "def", "test_trust_state", "(", "hass", ":", "core", ".", "HomeAssistant", ")", ":", "await", "setup_platform", "(", "hass", ",", "LIGHT_DOMAIN", ",", "ceiling_fan", "(", "\"name-1\"", ")", ",", "props", "=", "{", "\"trust_state\"", ":", "False", "}...
[ 141, 0 ]
[ 148, 60 ]
python
en
['en', 'en', 'en']
True
test_no_trust_state
(hass: core.HomeAssistant)
Assumed state should be False if Trust State is True.
Assumed state should be False if Trust State is True.
async def test_no_trust_state(hass: core.HomeAssistant): """Assumed state should be False if Trust State is True.""" await setup_platform( hass, LIGHT_DOMAIN, ceiling_fan("name-1"), props={"trust_state": True} ) device = hass.states.get("light.name_1") assert device.attributes.get(ATTR_ASSUM...
[ "async", "def", "test_no_trust_state", "(", "hass", ":", "core", ".", "HomeAssistant", ")", ":", "await", "setup_platform", "(", "hass", ",", "LIGHT_DOMAIN", ",", "ceiling_fan", "(", "\"name-1\"", ")", ",", "props", "=", "{", "\"trust_state\"", ":", "True", ...
[ 151, 0 ]
[ 157, 64 ]
python
en
['en', 'en', 'en']
True
test_turn_on_light
(hass: core.HomeAssistant)
Tests that turn on command delegates to API.
Tests that turn on command delegates to API.
async def test_turn_on_light(hass: core.HomeAssistant): """Tests that turn on command delegates to API.""" await setup_platform( hass, LIGHT_DOMAIN, ceiling_fan("name-1"), bond_device_id="test-device-id" ) with patch_bond_action() as mock_turn_light_on, patch_bond_device_state(): await ...
[ "async", "def", "test_turn_on_light", "(", "hass", ":", "core", ".", "HomeAssistant", ")", ":", "await", "setup_platform", "(", "hass", ",", "LIGHT_DOMAIN", ",", "ceiling_fan", "(", "\"name-1\"", ")", ",", "bond_device_id", "=", "\"test-device-id\"", ")", "with"...
[ 160, 0 ]
[ 175, 88 ]
python
en
['en', 'en', 'en']
True
test_turn_off_light
(hass: core.HomeAssistant)
Tests that turn off command delegates to API.
Tests that turn off command delegates to API.
async def test_turn_off_light(hass: core.HomeAssistant): """Tests that turn off command delegates to API.""" await setup_platform( hass, LIGHT_DOMAIN, ceiling_fan("name-1"), bond_device_id="test-device-id" ) with patch_bond_action() as mock_turn_light_off, patch_bond_device_state(): awa...
[ "async", "def", "test_turn_off_light", "(", "hass", ":", "core", ".", "HomeAssistant", ")", ":", "await", "setup_platform", "(", "hass", ",", "LIGHT_DOMAIN", ",", "ceiling_fan", "(", "\"name-1\"", ")", ",", "bond_device_id", "=", "\"test-device-id\"", ")", "with...
[ 178, 0 ]
[ 195, 5 ]
python
en
['en', 'en', 'en']
True
test_brightness_support
(hass: core.HomeAssistant)
Tests that a dimmable light should support the brightness feature.
Tests that a dimmable light should support the brightness feature.
async def test_brightness_support(hass: core.HomeAssistant): """Tests that a dimmable light should support the brightness feature.""" await setup_platform( hass, LIGHT_DOMAIN, dimmable_ceiling_fan("name-1"), bond_device_id="test-device-id", ) state = hass.states.get("lig...
[ "async", "def", "test_brightness_support", "(", "hass", ":", "core", ".", "HomeAssistant", ")", ":", "await", "setup_platform", "(", "hass", ",", "LIGHT_DOMAIN", ",", "dimmable_ceiling_fan", "(", "\"name-1\"", ")", ",", "bond_device_id", "=", "\"test-device-id\"", ...
[ 198, 0 ]
[ 208, 73 ]
python
en
['en', 'en', 'en']
True
test_brightness_not_supported
(hass: core.HomeAssistant)
Tests that a non-dimmable light should not support the brightness feature.
Tests that a non-dimmable light should not support the brightness feature.
async def test_brightness_not_supported(hass: core.HomeAssistant): """Tests that a non-dimmable light should not support the brightness feature.""" await setup_platform( hass, LIGHT_DOMAIN, ceiling_fan("name-1"), bond_device_id="test-device-id", ) state = hass.states.get...
[ "async", "def", "test_brightness_not_supported", "(", "hass", ":", "core", ".", "HomeAssistant", ")", ":", "await", "setup_platform", "(", "hass", ",", "LIGHT_DOMAIN", ",", "ceiling_fan", "(", "\"name-1\"", ")", ",", "bond_device_id", "=", "\"test-device-id\"", ",...
[ 211, 0 ]
[ 221, 77 ]
python
en
['en', 'en', 'en']
True
test_turn_on_light_with_brightness
(hass: core.HomeAssistant)
Tests that turn on command, on a dimmable light, delegates to API and parses brightness.
Tests that turn on command, on a dimmable light, delegates to API and parses brightness.
async def test_turn_on_light_with_brightness(hass: core.HomeAssistant): """Tests that turn on command, on a dimmable light, delegates to API and parses brightness.""" await setup_platform( hass, LIGHT_DOMAIN, dimmable_ceiling_fan("name-1"), bond_device_id="test-device-id", ) ...
[ "async", "def", "test_turn_on_light_with_brightness", "(", "hass", ":", "core", ".", "HomeAssistant", ")", ":", "await", "setup_platform", "(", "hass", ",", "LIGHT_DOMAIN", ",", "dimmable_ceiling_fan", "(", "\"name-1\"", ")", ",", "bond_device_id", "=", "\"test-devi...
[ 224, 0 ]
[ 244, 5 ]
python
en
['en', 'en', 'en']
True
test_update_reports_light_is_on
(hass: core.HomeAssistant)
Tests that update command sets correct state when Bond API reports the light is on.
Tests that update command sets correct state when Bond API reports the light is on.
async def test_update_reports_light_is_on(hass: core.HomeAssistant): """Tests that update command sets correct state when Bond API reports the light is on.""" await setup_platform(hass, LIGHT_DOMAIN, ceiling_fan("name-1")) with patch_bond_device_state(return_value={"light": 1}): async_fire_time_cha...
[ "async", "def", "test_update_reports_light_is_on", "(", "hass", ":", "core", ".", "HomeAssistant", ")", ":", "await", "setup_platform", "(", "hass", ",", "LIGHT_DOMAIN", ",", "ceiling_fan", "(", "\"name-1\"", ")", ")", "with", "patch_bond_device_state", "(", "retu...
[ 247, 0 ]
[ 255, 56 ]
python
en
['en', 'en', 'en']
True
test_update_reports_light_is_off
(hass: core.HomeAssistant)
Tests that update command sets correct state when Bond API reports the light is off.
Tests that update command sets correct state when Bond API reports the light is off.
async def test_update_reports_light_is_off(hass: core.HomeAssistant): """Tests that update command sets correct state when Bond API reports the light is off.""" await setup_platform(hass, LIGHT_DOMAIN, ceiling_fan("name-1")) with patch_bond_device_state(return_value={"light": 0}): async_fire_time_c...
[ "async", "def", "test_update_reports_light_is_off", "(", "hass", ":", "core", ".", "HomeAssistant", ")", ":", "await", "setup_platform", "(", "hass", ",", "LIGHT_DOMAIN", ",", "ceiling_fan", "(", "\"name-1\"", ")", ")", "with", "patch_bond_device_state", "(", "ret...
[ 258, 0 ]
[ 266, 57 ]
python
en
['en', 'en', 'en']
True
test_turn_on_fireplace_with_brightness
(hass: core.HomeAssistant)
Tests that turn on command delegates to set flame API.
Tests that turn on command delegates to set flame API.
async def test_turn_on_fireplace_with_brightness(hass: core.HomeAssistant): """Tests that turn on command delegates to set flame API.""" await setup_platform( hass, LIGHT_DOMAIN, fireplace("name-1"), bond_device_id="test-device-id" ) with patch_bond_action() as mock_set_flame, patch_bond_device...
[ "async", "def", "test_turn_on_fireplace_with_brightness", "(", "hass", ":", "core", ".", "HomeAssistant", ")", ":", "await", "setup_platform", "(", "hass", ",", "LIGHT_DOMAIN", ",", "fireplace", "(", "\"name-1\"", ")", ",", "bond_device_id", "=", "\"test-device-id\"...
[ 269, 0 ]
[ 284, 82 ]
python
en
['en', 'en', 'en']
True
test_turn_on_fireplace_without_brightness
(hass: core.HomeAssistant)
Tests that turn on command delegates to turn on API.
Tests that turn on command delegates to turn on API.
async def test_turn_on_fireplace_without_brightness(hass: core.HomeAssistant): """Tests that turn on command delegates to turn on API.""" await setup_platform( hass, LIGHT_DOMAIN, fireplace("name-1"), bond_device_id="test-device-id" ) with patch_bond_action() as mock_turn_on, patch_bond_device_...
[ "async", "def", "test_turn_on_fireplace_without_brightness", "(", "hass", ":", "core", ".", "HomeAssistant", ")", ":", "await", "setup_platform", "(", "hass", ",", "LIGHT_DOMAIN", ",", "fireplace", "(", "\"name-1\"", ")", ",", "bond_device_id", "=", "\"test-device-i...
[ 287, 0 ]
[ 302, 76 ]
python
en
['en', 'en', 'en']
True
test_turn_off_fireplace
(hass: core.HomeAssistant)
Tests that turn off command delegates to API.
Tests that turn off command delegates to API.
async def test_turn_off_fireplace(hass: core.HomeAssistant): """Tests that turn off command delegates to API.""" await setup_platform( hass, LIGHT_DOMAIN, fireplace("name-1"), bond_device_id="test-device-id" ) with patch_bond_action() as mock_turn_off, patch_bond_device_state(): await h...
[ "async", "def", "test_turn_off_fireplace", "(", "hass", ":", "core", ".", "HomeAssistant", ")", ":", "await", "setup_platform", "(", "hass", ",", "LIGHT_DOMAIN", ",", "fireplace", "(", "\"name-1\"", ")", ",", "bond_device_id", "=", "\"test-device-id\"", ")", "wi...
[ 305, 0 ]
[ 320, 78 ]
python
en
['en', 'en', 'en']
True
test_flame_converted_to_brightness
(hass: core.HomeAssistant)
Tests that reported flame level (0..100) converted to HA brightness (0...255).
Tests that reported flame level (0..100) converted to HA brightness (0...255).
async def test_flame_converted_to_brightness(hass: core.HomeAssistant): """Tests that reported flame level (0..100) converted to HA brightness (0...255).""" await setup_platform(hass, LIGHT_DOMAIN, fireplace("name-1")) with patch_bond_device_state(return_value={"power": 1, "flame": 50}): async_fire...
[ "async", "def", "test_flame_converted_to_brightness", "(", "hass", ":", "core", ".", "HomeAssistant", ")", ":", "await", "setup_platform", "(", "hass", ",", "LIGHT_DOMAIN", ",", "fireplace", "(", "\"name-1\"", ")", ")", "with", "patch_bond_device_state", "(", "ret...
[ 323, 0 ]
[ 331, 77 ]
python
en
['en', 'en', 'en']
True
test_light_available
(hass: core.HomeAssistant)
Tests that available state is updated based on API errors.
Tests that available state is updated based on API errors.
async def test_light_available(hass: core.HomeAssistant): """Tests that available state is updated based on API errors.""" await help_test_entity_available( hass, LIGHT_DOMAIN, ceiling_fan("name-1"), "light.name_1" )
[ "async", "def", "test_light_available", "(", "hass", ":", "core", ".", "HomeAssistant", ")", ":", "await", "help_test_entity_available", "(", "hass", ",", "LIGHT_DOMAIN", ",", "ceiling_fan", "(", "\"name-1\"", ")", ",", "\"light.name_1\"", ")" ]
[ 334, 0 ]
[ 338, 5 ]
python
en
['en', 'en', 'en']
True
test_parse_brightness
(hass: core.HomeAssistant)
Tests that reported brightness level (0..100) converted to HA brightness (0...255).
Tests that reported brightness level (0..100) converted to HA brightness (0...255).
async def test_parse_brightness(hass: core.HomeAssistant): """Tests that reported brightness level (0..100) converted to HA brightness (0...255).""" await setup_platform(hass, LIGHT_DOMAIN, dimmable_ceiling_fan("name-1")) with patch_bond_device_state(return_value={"light": 1, "brightness": 50}): as...
[ "async", "def", "test_parse_brightness", "(", "hass", ":", "core", ".", "HomeAssistant", ")", ":", "await", "setup_platform", "(", "hass", ",", "LIGHT_DOMAIN", ",", "dimmable_ceiling_fan", "(", "\"name-1\"", ")", ")", "with", "patch_bond_device_state", "(", "retur...
[ 341, 0 ]
[ 349, 77 ]
python
en
['en', 'en', 'en']
True