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
MqttClimate._setup_from_config
(self, config)
(Re)Setup the entity.
(Re)Setup the entity.
def _setup_from_config(self, config): """(Re)Setup the entity.""" self._topic = {key: config.get(key) for key in TOPIC_KEYS} # set to None in non-optimistic mode self._target_temp = ( self._current_fan_mode ) = self._current_operation = self._current_swing_mode = Non...
[ "def", "_setup_from_config", "(", "self", ",", "config", ")", ":", "self", ".", "_topic", "=", "{", "key", ":", "config", ".", "get", "(", "key", ")", "for", "key", "in", "TOPIC_KEYS", "}", "# set to None in non-optimistic mode", "self", ".", "_target_temp",...
[ 334, 4 ]
[ 386, 51 ]
python
en
['en', 'haw', 'en']
True
MqttClimate._subscribe_topics
(self)
(Re)Subscribe to topics.
(Re)Subscribe to topics.
async def _subscribe_topics(self): # noqa: C901 """(Re)Subscribe to topics.""" topics = {} qos = self._config[CONF_QOS] def add_subscription(topics, topic, msg_callback): if self._topic[topic] is not None: topics[topic] = { "topic": self....
[ "async", "def", "_subscribe_topics", "(", "self", ")", ":", "# noqa: C901", "topics", "=", "{", "}", "qos", "=", "self", ".", "_config", "[", "CONF_QOS", "]", "def", "add_subscription", "(", "topics", ",", "topic", ",", "msg_callback", ")", ":", "if", "s...
[ 388, 4 ]
[ 575, 9 ]
python
en
['en', 'en', 'en']
True
MqttClimate.temperature_unit
(self)
Return the unit of measurement.
Return the unit of measurement.
def temperature_unit(self): """Return the unit of measurement.""" if self._config.get(CONF_TEMPERATURE_UNIT): return self._config.get(CONF_TEMPERATURE_UNIT) return self.hass.config.units.temperature_unit
[ "def", "temperature_unit", "(", "self", ")", ":", "if", "self", ".", "_config", ".", "get", "(", "CONF_TEMPERATURE_UNIT", ")", ":", "return", "self", ".", "_config", ".", "get", "(", "CONF_TEMPERATURE_UNIT", ")", "return", "self", ".", "hass", ".", "config...
[ 578, 4 ]
[ 582, 54 ]
python
en
['en', 'la', 'en']
True
MqttClimate.current_temperature
(self)
Return the current temperature.
Return the current temperature.
def current_temperature(self): """Return the current temperature.""" return self._current_temp
[ "def", "current_temperature", "(", "self", ")", ":", "return", "self", ".", "_current_temp" ]
[ 585, 4 ]
[ 587, 33 ]
python
en
['en', 'la', 'en']
True
MqttClimate.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._target_temp
[ "def", "target_temperature", "(", "self", ")", ":", "return", "self", ".", "_target_temp" ]
[ 590, 4 ]
[ 592, 32 ]
python
en
['en', 'en', 'en']
True
MqttClimate.target_temperature_low
(self)
Return the low target temperature we try to reach.
Return the low target temperature we try to reach.
def target_temperature_low(self): """Return the low target temperature we try to reach.""" return self._target_temp_low
[ "def", "target_temperature_low", "(", "self", ")", ":", "return", "self", ".", "_target_temp_low" ]
[ 595, 4 ]
[ 597, 36 ]
python
en
['en', 'en', 'en']
True
MqttClimate.target_temperature_high
(self)
Return the high target temperature we try to reach.
Return the high target temperature we try to reach.
def target_temperature_high(self): """Return the high target temperature we try to reach.""" return self._target_temp_high
[ "def", "target_temperature_high", "(", "self", ")", ":", "return", "self", ".", "_target_temp_high" ]
[ 600, 4 ]
[ 602, 37 ]
python
en
['en', 'en', 'en']
True
MqttClimate.hvac_action
(self)
Return the current running hvac operation if supported.
Return the current running hvac operation if supported.
def hvac_action(self): """Return the current running hvac operation if supported.""" return self._action
[ "def", "hvac_action", "(", "self", ")", ":", "return", "self", ".", "_action" ]
[ 605, 4 ]
[ 607, 27 ]
python
en
['en', 'en', 'en']
True
MqttClimate.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.""" return self._current_operation
[ "def", "hvac_mode", "(", "self", ")", ":", "return", "self", ".", "_current_operation" ]
[ 610, 4 ]
[ 612, 38 ]
python
en
['nl', 'en', 'en']
True
MqttClimate.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._config[CONF_MODE_LIST]
[ "def", "hvac_modes", "(", "self", ")", ":", "return", "self", ".", "_config", "[", "CONF_MODE_LIST", "]" ]
[ 615, 4 ]
[ 617, 43 ]
python
en
['en', 'en', 'en']
True
MqttClimate.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._config[CONF_TEMP_STEP]
[ "def", "target_temperature_step", "(", "self", ")", ":", "return", "self", ".", "_config", "[", "CONF_TEMP_STEP", "]" ]
[ 620, 4 ]
[ 622, 43 ]
python
en
['en', 'en', 'en']
True
MqttClimate.preset_mode
(self)
Return preset mode.
Return preset mode.
def preset_mode(self): """Return preset mode.""" if self._hold: return self._hold if self._away: return PRESET_AWAY return PRESET_NONE
[ "def", "preset_mode", "(", "self", ")", ":", "if", "self", ".", "_hold", ":", "return", "self", ".", "_hold", "if", "self", ".", "_away", ":", "return", "PRESET_AWAY", "return", "PRESET_NONE" ]
[ 625, 4 ]
[ 631, 26 ]
python
de
['de', 'no', 'en']
False
MqttClimate.preset_modes
(self)
Return preset modes.
Return preset modes.
def preset_modes(self): """Return preset modes.""" presets = [] if (self._topic[CONF_AWAY_MODE_STATE_TOPIC] is not None) or ( self._topic[CONF_AWAY_MODE_COMMAND_TOPIC] is not None ): presets.append(PRESET_AWAY) presets.extend(self._config[CONF_HOLD_LIST]...
[ "def", "preset_modes", "(", "self", ")", ":", "presets", "=", "[", "]", "if", "(", "self", ".", "_topic", "[", "CONF_AWAY_MODE_STATE_TOPIC", "]", "is", "not", "None", ")", "or", "(", "self", ".", "_topic", "[", "CONF_AWAY_MODE_COMMAND_TOPIC", "]", "is", ...
[ 634, 4 ]
[ 648, 22 ]
python
en
['en', 'be', 'en']
True
MqttClimate.is_aux_heat
(self)
Return true if away mode is on.
Return true if away mode is on.
def is_aux_heat(self): """Return true if away mode is on.""" return self._aux
[ "def", "is_aux_heat", "(", "self", ")", ":", "return", "self", ".", "_aux" ]
[ 651, 4 ]
[ 653, 24 ]
python
en
['en', 'fy', 'en']
True
MqttClimate.fan_mode
(self)
Return the fan setting.
Return the fan setting.
def fan_mode(self): """Return the fan setting.""" return self._current_fan_mode
[ "def", "fan_mode", "(", "self", ")", ":", "return", "self", ".", "_current_fan_mode" ]
[ 656, 4 ]
[ 658, 37 ]
python
en
['en', 'fy', 'en']
True
MqttClimate.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._config[CONF_FAN_MODE_LIST]
[ "def", "fan_modes", "(", "self", ")", ":", "return", "self", ".", "_config", "[", "CONF_FAN_MODE_LIST", "]" ]
[ 661, 4 ]
[ 663, 47 ]
python
en
['en', 'en', 'en']
True
MqttClimate.async_set_temperature
(self, **kwargs)
Set new target temperatures.
Set new target temperatures.
async def async_set_temperature(self, **kwargs): """Set new target temperatures.""" if kwargs.get(ATTR_HVAC_MODE) is not None: operation_mode = kwargs.get(ATTR_HVAC_MODE) await self.async_set_hvac_mode(operation_mode) self._set_temperature( kwargs.get(ATTR_TE...
[ "async", "def", "async_set_temperature", "(", "self", ",", "*", "*", "kwargs", ")", ":", "if", "kwargs", ".", "get", "(", "ATTR_HVAC_MODE", ")", "is", "not", "None", ":", "operation_mode", "=", "kwargs", ".", "get", "(", "ATTR_HVAC_MODE", ")", "await", "...
[ 688, 4 ]
[ 719, 35 ]
python
en
['en', 'ca', 'en']
True
MqttClimate.async_set_swing_mode
(self, swing_mode)
Set new swing mode.
Set new swing mode.
async def async_set_swing_mode(self, swing_mode): """Set new swing mode.""" if self._config[CONF_SEND_IF_OFF] or self._current_operation != HVAC_MODE_OFF: payload = self._command_templates[CONF_SWING_MODE_COMMAND_TEMPLATE]( swing_mode ) self._publish(C...
[ "async", "def", "async_set_swing_mode", "(", "self", ",", "swing_mode", ")", ":", "if", "self", ".", "_config", "[", "CONF_SEND_IF_OFF", "]", "or", "self", ".", "_current_operation", "!=", "HVAC_MODE_OFF", ":", "payload", "=", "self", ".", "_command_templates", ...
[ 721, 4 ]
[ 731, 39 ]
python
en
['en', 'no', 'en']
True
MqttClimate.async_set_fan_mode
(self, fan_mode)
Set new target temperature.
Set new target temperature.
async def async_set_fan_mode(self, fan_mode): """Set new target temperature.""" if self._config[CONF_SEND_IF_OFF] or self._current_operation != HVAC_MODE_OFF: payload = self._command_templates[CONF_FAN_MODE_COMMAND_TEMPLATE](fan_mode) self._publish(CONF_FAN_MODE_COMMAND_TOPIC, pa...
[ "async", "def", "async_set_fan_mode", "(", "self", ",", "fan_mode", ")", ":", "if", "self", ".", "_config", "[", "CONF_SEND_IF_OFF", "]", "or", "self", ".", "_current_operation", "!=", "HVAC_MODE_OFF", ":", "payload", "=", "self", ".", "_command_templates", "[...
[ 733, 4 ]
[ 741, 39 ]
python
en
['en', 'ca', 'en']
True
MqttClimate.async_set_hvac_mode
(self, hvac_mode)
Set new operation mode.
Set new operation mode.
async def async_set_hvac_mode(self, hvac_mode) -> None: """Set new operation mode.""" if self._current_operation == HVAC_MODE_OFF and hvac_mode != HVAC_MODE_OFF: self._publish(CONF_POWER_COMMAND_TOPIC, self._config[CONF_PAYLOAD_ON]) elif self._current_operation != HVAC_MODE_OFF and h...
[ "async", "def", "async_set_hvac_mode", "(", "self", ",", "hvac_mode", ")", "->", "None", ":", "if", "self", ".", "_current_operation", "==", "HVAC_MODE_OFF", "and", "hvac_mode", "!=", "HVAC_MODE_OFF", ":", "self", ".", "_publish", "(", "CONF_POWER_COMMAND_TOPIC", ...
[ 743, 4 ]
[ 755, 39 ]
python
en
['en', 'ny', 'en']
True
MqttClimate.swing_mode
(self)
Return the swing setting.
Return the swing setting.
def swing_mode(self): """Return the swing setting.""" return self._current_swing_mode
[ "def", "swing_mode", "(", "self", ")", ":", "return", "self", ".", "_current_swing_mode" ]
[ 758, 4 ]
[ 760, 39 ]
python
en
['en', 'ig', 'en']
True
MqttClimate.swing_modes
(self)
List of available swing modes.
List of available swing modes.
def swing_modes(self): """List of available swing modes.""" return self._config[CONF_SWING_MODE_LIST]
[ "def", "swing_modes", "(", "self", ")", ":", "return", "self", ".", "_config", "[", "CONF_SWING_MODE_LIST", "]" ]
[ 763, 4 ]
[ 765, 49 ]
python
en
['en', 'en', 'en']
True
MqttClimate.async_set_preset_mode
(self, preset_mode)
Set a preset mode.
Set a preset mode.
async def async_set_preset_mode(self, preset_mode): """Set a preset mode.""" if preset_mode == self.preset_mode: return # Track if we should optimistic update the state optimistic_update = False if self._away: optimistic_update = optimistic_update or sel...
[ "async", "def", "async_set_preset_mode", "(", "self", ",", "preset_mode", ")", ":", "if", "preset_mode", "==", "self", ".", "preset_mode", ":", "return", "# Track if we should optimistic update the state", "optimistic_update", "=", "False", "if", "self", ".", "_away",...
[ 767, 4 ]
[ 788, 39 ]
python
en
['en', 'pt', 'it']
False
MqttClimate._set_away_mode
(self, state)
Set away mode. Returns if we should optimistically write the state.
Set away mode.
def _set_away_mode(self, state): """Set away mode. Returns if we should optimistically write the state. """ self._publish( CONF_AWAY_MODE_COMMAND_TOPIC, self._config[CONF_PAYLOAD_ON] if state else self._config[CONF_PAYLOAD_OFF], ) if self._topic[...
[ "def", "_set_away_mode", "(", "self", ",", "state", ")", ":", "self", ".", "_publish", "(", "CONF_AWAY_MODE_COMMAND_TOPIC", ",", "self", ".", "_config", "[", "CONF_PAYLOAD_ON", "]", "if", "state", "else", "self", ".", "_config", "[", "CONF_PAYLOAD_OFF", "]", ...
[ 790, 4 ]
[ 804, 19 ]
python
en
['en', 'su', 'en']
True
MqttClimate._set_hold_mode
(self, hold_mode)
Set hold mode. Returns if we should optimistically write the state.
Set hold mode.
def _set_hold_mode(self, hold_mode): """Set hold mode. Returns if we should optimistically write the state. """ payload = self._command_templates[CONF_HOLD_COMMAND_TEMPLATE]( hold_mode or "off" ) self._publish(CONF_HOLD_COMMAND_TOPIC, payload) if sel...
[ "def", "_set_hold_mode", "(", "self", ",", "hold_mode", ")", ":", "payload", "=", "self", ".", "_command_templates", "[", "CONF_HOLD_COMMAND_TEMPLATE", "]", "(", "hold_mode", "or", "\"off\"", ")", "self", ".", "_publish", "(", "CONF_HOLD_COMMAND_TOPIC", ",", "pa...
[ 806, 4 ]
[ 820, 19 ]
python
da
['da', 'zu', 'en']
False
MqttClimate.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._set_aux_heat(True)
[ "async", "def", "async_turn_aux_heat_on", "(", "self", ")", ":", "self", ".", "_set_aux_heat", "(", "True", ")" ]
[ 832, 4 ]
[ 834, 32 ]
python
en
['fr', 'fi', 'en']
False
MqttClimate.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._set_aux_heat(False)
[ "async", "def", "async_turn_aux_heat_off", "(", "self", ")", ":", "self", ".", "_set_aux_heat", "(", "False", ")" ]
[ 836, 4 ]
[ 838, 33 ]
python
en
['en', 'en', 'en']
True
MqttClimate.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.""" support = 0 if (self._topic[CONF_TEMP_STATE_TOPIC] is not None) or ( self._topic[CONF_TEMP_COMMAND_TOPIC] is not None ): support |= SUPPORT_TARGET_TEMPERATURE if (self._topic[CONF...
[ "def", "supported_features", "(", "self", ")", ":", "support", "=", "0", "if", "(", "self", ".", "_topic", "[", "CONF_TEMP_STATE_TOPIC", "]", "is", "not", "None", ")", "or", "(", "self", ".", "_topic", "[", "CONF_TEMP_COMMAND_TOPIC", "]", "is", "not", "N...
[ 841, 4 ]
[ 883, 22 ]
python
en
['en', 'en', 'en']
True
MqttClimate.min_temp
(self)
Return the minimum temperature.
Return the minimum temperature.
def min_temp(self): """Return the minimum temperature.""" return self._config[CONF_TEMP_MIN]
[ "def", "min_temp", "(", "self", ")", ":", "return", "self", ".", "_config", "[", "CONF_TEMP_MIN", "]" ]
[ 886, 4 ]
[ 888, 42 ]
python
en
['en', 'la', 'en']
True
MqttClimate.max_temp
(self)
Return the maximum temperature.
Return the maximum temperature.
def max_temp(self): """Return the maximum temperature.""" return self._config[CONF_TEMP_MAX]
[ "def", "max_temp", "(", "self", ")", ":", "return", "self", ".", "_config", "[", "CONF_TEMP_MAX", "]" ]
[ 891, 4 ]
[ 893, 42 ]
python
en
['en', 'la', 'en']
True
MqttClimate.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._config.get(CONF_PRECISION) is not None: return self._config.get(CONF_PRECISION) return super().precision
[ "def", "precision", "(", "self", ")", ":", "if", "self", ".", "_config", ".", "get", "(", "CONF_PRECISION", ")", "is", "not", "None", ":", "return", "self", ".", "_config", ".", "get", "(", "CONF_PRECISION", ")", "return", "super", "(", ")", ".", "pr...
[ 896, 4 ]
[ 900, 32 ]
python
en
['en', 'en', 'en']
True
build_scripts.copy_scripts
(self)
r"""Copy each script listed in 'self.scripts'; if it's marked as a Python script in the Unix way (first line matches 'first_line_re', ie. starts with "\#!" and contains "python"), then adjust the first line to refer to the current Python interpreter as we copy.
r"""Copy each script listed in 'self.scripts'; if it's marked as a Python script in the Unix way (first line matches 'first_line_re', ie. starts with "\#!" and contains "python"), then adjust the first line to refer to the current Python interpreter as we copy.
def copy_scripts(self): r"""Copy each script listed in 'self.scripts'; if it's marked as a Python script in the Unix way (first line matches 'first_line_re', ie. starts with "\#!" and contains "python"), then adjust the first line to refer to the current Python interpreter as we copy. ...
[ "def", "copy_scripts", "(", "self", ")", ":", "self", ".", "mkpath", "(", "self", ".", "build_dir", ")", "outfiles", "=", "[", "]", "updated_files", "=", "[", "]", "for", "script", "in", "self", ".", "scripts", ":", "adjust", "=", "False", "script", ...
[ 52, 4 ]
[ 151, 38 ]
python
en
['en', 'en', 'en']
True
PiHoleFlowHandler.__init__
(self)
Initialize the config flow.
Initialize the config flow.
def __init__(self) -> None: """Initialize the config flow.""" self._config: dict = {}
[ "def", "__init__", "(", "self", ")", "->", "None", ":", "self", ".", "_config", ":", "dict", "=", "{", "}" ]
[ 40, 4 ]
[ 42, 31 ]
python
en
['en', 'en', 'en']
True
PiHoleFlowHandler.async_step_user
( self, user_input: dict[str, Any] | None = None )
Handle a flow initiated by the user.
Handle a flow initiated by the user.
async def async_step_user( self, user_input: dict[str, Any] | None = None ) -> FlowResult: """Handle a flow initiated by the user.""" return await self.async_step_init(user_input)
[ "async", "def", "async_step_user", "(", "self", ",", "user_input", ":", "dict", "[", "str", ",", "Any", "]", "|", "None", "=", "None", ")", "->", "FlowResult", ":", "return", "await", "self", ".", "async_step_init", "(", "user_input", ")" ]
[ 44, 4 ]
[ 48, 53 ]
python
en
['en', 'en', 'en']
True
PiHoleFlowHandler.async_step_import
( self, user_input: dict[str, Any] | None = None )
Handle a flow initiated by import.
Handle a flow initiated by import.
async def async_step_import( self, user_input: dict[str, Any] | None = None ) -> FlowResult: """Handle a flow initiated by import.""" return await self.async_step_init(user_input, is_import=True)
[ "async", "def", "async_step_import", "(", "self", ",", "user_input", ":", "dict", "[", "str", ",", "Any", "]", "|", "None", "=", "None", ")", "->", "FlowResult", ":", "return", "await", "self", ".", "async_step_init", "(", "user_input", ",", "is_import", ...
[ 50, 4 ]
[ 54, 69 ]
python
en
['en', 'en', 'en']
True
PiHoleFlowHandler.async_step_init
( self, user_input: dict[str, Any] | None, is_import: bool = False )
Handle init step of a flow.
Handle init step of a flow.
async def async_step_init( self, user_input: dict[str, Any] | None, is_import: bool = False ) -> FlowResult: """Handle init step of a flow.""" errors = {} if user_input is not None: host = ( user_input[CONF_HOST] if is_import ...
[ "async", "def", "async_step_init", "(", "self", ",", "user_input", ":", "dict", "[", "str", ",", "Any", "]", "|", "None", ",", "is_import", ":", "bool", "=", "False", ")", "->", "FlowResult", ":", "errors", "=", "{", "}", "if", "user_input", "is", "n...
[ 56, 4 ]
[ 141, 9 ]
python
en
['en', 'en', 'en']
True
PiHoleFlowHandler.async_step_api_key
( self, user_input: dict[str, Any] | None = None )
Handle step to setup API key.
Handle step to setup API key.
async def async_step_api_key( self, user_input: dict[str, Any] | None = None ) -> FlowResult: """Handle step to setup API key.""" if user_input is not None: return self.async_create_entry( title=self._config[CONF_NAME], data={ *...
[ "async", "def", "async_step_api_key", "(", "self", ",", "user_input", ":", "dict", "[", "str", ",", "Any", "]", "|", "None", "=", "None", ")", "->", "FlowResult", ":", "if", "user_input", "is", "not", "None", ":", "return", "self", ".", "async_create_ent...
[ 143, 4 ]
[ 159, 9 ]
python
en
['en', 'haw', 'en']
True
test_setup_component
( hass: HomeAssistant, vizio_connect: pytest.fixture, vizio_update: pytest.fixture, )
Test component setup.
Test component setup.
async def test_setup_component( hass: HomeAssistant, vizio_connect: pytest.fixture, vizio_update: pytest.fixture, ) -> None: """Test component setup.""" assert await async_setup_component( hass, DOMAIN, {DOMAIN: MOCK_USER_VALID_TV_CONFIG} ) await hass.async_block_till_done() asse...
[ "async", "def", "test_setup_component", "(", "hass", ":", "HomeAssistant", ",", "vizio_connect", ":", "pytest", ".", "fixture", ",", "vizio_update", ":", "pytest", ".", "fixture", ",", ")", "->", "None", ":", "assert", "await", "async_setup_component", "(", "h...
[ 17, 0 ]
[ 27, 60 ]
python
en
['en', 'da', 'en']
True
test_tv_load_and_unload
( hass: HomeAssistant, vizio_connect: pytest.fixture, vizio_update: pytest.fixture, )
Test loading and unloading TV entry.
Test loading and unloading TV entry.
async def test_tv_load_and_unload( hass: HomeAssistant, vizio_connect: pytest.fixture, vizio_update: pytest.fixture, ) -> None: """Test loading and unloading TV entry.""" config_entry = MockConfigEntry( domain=DOMAIN, data=MOCK_USER_VALID_TV_CONFIG, unique_id=UNIQUE_ID ) config_entry...
[ "async", "def", "test_tv_load_and_unload", "(", "hass", ":", "HomeAssistant", ",", "vizio_connect", ":", "pytest", ".", "fixture", ",", "vizio_update", ":", "pytest", ".", "fixture", ",", ")", "->", "None", ":", "config_entry", "=", "MockConfigEntry", "(", "do...
[ 30, 0 ]
[ 51, 34 ]
python
en
['en', 'en', 'en']
True
test_speaker_load_and_unload
( hass: HomeAssistant, vizio_connect: pytest.fixture, vizio_update: pytest.fixture, )
Test loading and unloading speaker entry.
Test loading and unloading speaker entry.
async def test_speaker_load_and_unload( hass: HomeAssistant, vizio_connect: pytest.fixture, vizio_update: pytest.fixture, ) -> None: """Test loading and unloading speaker entry.""" config_entry = MockConfigEntry( domain=DOMAIN, data=MOCK_SPEAKER_CONFIG, unique_id=UNIQUE_ID ) config_e...
[ "async", "def", "test_speaker_load_and_unload", "(", "hass", ":", "HomeAssistant", ",", "vizio_connect", ":", "pytest", ".", "fixture", ",", "vizio_update", ":", "pytest", ".", "fixture", ",", ")", "->", "None", ":", "config_entry", "=", "MockConfigEntry", "(", ...
[ 54, 0 ]
[ 75, 34 ]
python
en
['en', 'no', 'en']
True
test_coordinator_update_failure
( hass: HomeAssistant, vizio_connect: pytest.fixture, vizio_bypass_update: pytest.fixture, vizio_data_coordinator_update_failure: pytest.fixture, caplog: pytest.LogCaptureFixture, )
Test coordinator update failure after 10 days.
Test coordinator update failure after 10 days.
async def test_coordinator_update_failure( hass: HomeAssistant, vizio_connect: pytest.fixture, vizio_bypass_update: pytest.fixture, vizio_data_coordinator_update_failure: pytest.fixture, caplog: pytest.LogCaptureFixture, ) -> None: """Test coordinator update failure after 10 days.""" now = d...
[ "async", "def", "test_coordinator_update_failure", "(", "hass", ":", "HomeAssistant", ",", "vizio_connect", ":", "pytest", ".", "fixture", ",", "vizio_bypass_update", ":", "pytest", ".", "fixture", ",", "vizio_data_coordinator_update_failure", ":", "pytest", ".", "fix...
[ 78, 0 ]
[ 103, 83 ]
python
en
['en', 'lb', 'en']
True
test_same_targets
(hass: HomeAssistant)
Test not changing the targets in a notify service.
Test not changing the targets in a notify service.
async def test_same_targets(hass: HomeAssistant): """Test not changing the targets in a notify service.""" test = NotificationService(hass) await test.async_setup(hass, "notify", "test") await test.async_register_services() await hass.async_block_till_done() assert hasattr(test, "registered_tar...
[ "async", "def", "test_same_targets", "(", "hass", ":", "HomeAssistant", ")", ":", "test", "=", "NotificationService", "(", "hass", ")", "await", "test", ".", "async_setup", "(", "hass", ",", "\"notify\"", ",", "\"test\"", ")", "await", "test", ".", "async_re...
[ 5, 0 ]
[ 17, 64 ]
python
en
['en', 'en', 'en']
True
test_change_targets
(hass: HomeAssistant)
Test changing the targets in a notify service.
Test changing the targets in a notify service.
async def test_change_targets(hass: HomeAssistant): """Test changing the targets in a notify service.""" test = NotificationService(hass) await test.async_setup(hass, "notify", "test") await test.async_register_services() await hass.async_block_till_done() assert hasattr(test, "registered_targe...
[ "async", "def", "test_change_targets", "(", "hass", ":", "HomeAssistant", ")", ":", "test", "=", "NotificationService", "(", "hass", ")", "await", "test", ".", "async_setup", "(", "hass", ",", "\"notify\"", ",", "\"test\"", ")", "await", "test", ".", "async_...
[ 20, 0 ]
[ 34, 51 ]
python
en
['en', 'en', 'en']
True
test_add_targets
(hass: HomeAssistant)
Test adding the targets in a notify service.
Test adding the targets in a notify service.
async def test_add_targets(hass: HomeAssistant): """Test adding the targets in a notify service.""" test = NotificationService(hass) await test.async_setup(hass, "notify", "test") await test.async_register_services() await hass.async_block_till_done() assert hasattr(test, "registered_targets") ...
[ "async", "def", "test_add_targets", "(", "hass", ":", "HomeAssistant", ")", ":", "test", "=", "NotificationService", "(", "hass", ")", "await", "test", ".", "async_setup", "(", "hass", ",", "\"notify\"", ",", "\"test\"", ")", "await", "test", ".", "async_reg...
[ 37, 0 ]
[ 51, 77 ]
python
en
['en', 'en', 'en']
True
test_remove_targets
(hass: HomeAssistant)
Test removing targets from the targets in a notify service.
Test removing targets from the targets in a notify service.
async def test_remove_targets(hass: HomeAssistant): """Test removing targets from the targets in a notify service.""" test = NotificationService(hass) await test.async_setup(hass, "notify", "test") await test.async_register_services() await hass.async_block_till_done() assert hasattr(test, "reg...
[ "async", "def", "test_remove_targets", "(", "hass", ":", "HomeAssistant", ")", ":", "test", "=", "NotificationService", "(", "hass", ")", "await", "test", ".", "async_setup", "(", "hass", ",", "\"notify\"", ",", "\"test\"", ")", "await", "test", ".", "async_...
[ 54, 0 ]
[ 68, 51 ]
python
en
['en', 'en', 'en']
True
NotificationService.__init__
(self, hass)
Initialize the service.
Initialize the service.
def __init__(self, hass): """Initialize the service.""" self.hass = hass self.target_list = {"a": 1, "b": 2}
[ "def", "__init__", "(", "self", ",", "hass", ")", ":", "self", ".", "hass", "=", "hass", "self", ".", "target_list", "=", "{", "\"a\"", ":", "1", ",", "\"b\"", ":", "2", "}" ]
[ 74, 4 ]
[ 77, 43 ]
python
en
['en', 'en', 'en']
True
NotificationService.targets
(self)
Return a dictionary of devices.
Return a dictionary of devices.
def targets(self): """Return a dictionary of devices.""" return self.target_list
[ "def", "targets", "(", "self", ")", ":", "return", "self", ".", "target_list" ]
[ 80, 4 ]
[ 82, 31 ]
python
en
['en', 'en', 'en']
True
async_get_pin_from_discovery_hostname
(hostname: str)
Get the device's 4-digit PIN from its zeroconf-discovered hostname.
Get the device's 4-digit PIN from its zeroconf-discovered hostname.
def async_get_pin_from_discovery_hostname(hostname: str) -> str: """Get the device's 4-digit PIN from its zeroconf-discovered hostname.""" return hostname.split(".")[0].split("-")[1]
[ "def", "async_get_pin_from_discovery_hostname", "(", "hostname", ":", "str", ")", "->", "str", ":", "return", "hostname", ".", "split", "(", "\".\"", ")", "[", "0", "]", ".", "split", "(", "\"-\"", ")", "[", "1", "]" ]
[ 31, 0 ]
[ 33, 47 ]
python
en
['en', 'en', 'en']
True
async_get_pin_from_uid
(uid: str)
Get the device's 4-digit PIN from its UID.
Get the device's 4-digit PIN from its UID.
def async_get_pin_from_uid(uid: str) -> str: """Get the device's 4-digit PIN from its UID.""" return uid[-4:]
[ "def", "async_get_pin_from_uid", "(", "uid", ":", "str", ")", "->", "str", ":", "return", "uid", "[", "-", "4", ":", "]" ]
[ 37, 0 ]
[ 39, 19 ]
python
en
['en', 'en', 'en']
True
validate_input
(hass: HomeAssistant, data: dict[str, Any])
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(hass: HomeAssistant, data: dict[str, Any]) -> dict[str, Any]: """Validate the user input allows us to connect. Data has the keys from DATA_SCHEMA with values provided by the user. """ async with Client(data[CONF_IP_ADDRESS]) as client: ping_data = await client.system.pi...
[ "async", "def", "validate_input", "(", "hass", ":", "HomeAssistant", ",", "data", ":", "dict", "[", "str", ",", "Any", "]", ")", "->", "dict", "[", "str", ",", "Any", "]", ":", "async", "with", "Client", "(", "data", "[", "CONF_IP_ADDRESS", "]", ")",...
[ 42, 0 ]
[ 52, 5 ]
python
en
['en', 'en', 'en']
True
ConfigFlow.__init__
(self)
Initialize.
Initialize.
def __init__(self) -> None: """Initialize.""" self.discovery_info: dict[str, Any] = {}
[ "def", "__init__", "(", "self", ")", "->", "None", ":", "self", ".", "discovery_info", ":", "dict", "[", "str", ",", "Any", "]", "=", "{", "}" ]
[ 60, 4 ]
[ 62, 48 ]
python
en
['en', 'en', 'it']
False
ConfigFlow._async_set_unique_id
(self, pin: str)
Set the config entry's unique ID (based on the device's 4-digit PIN).
Set the config entry's unique ID (based on the device's 4-digit PIN).
async def _async_set_unique_id(self, pin: str) -> None: """Set the config entry's unique ID (based on the device's 4-digit PIN).""" await self.async_set_unique_id(UNIQUE_ID.format(pin)) if self.discovery_info: self._abort_if_unique_id_configured( updates={CONF_IP_ADDR...
[ "async", "def", "_async_set_unique_id", "(", "self", ",", "pin", ":", "str", ")", "->", "None", ":", "await", "self", ".", "async_set_unique_id", "(", "UNIQUE_ID", ".", "format", "(", "pin", ")", ")", "if", "self", ".", "discovery_info", ":", "self", "."...
[ 64, 4 ]
[ 72, 49 ]
python
en
['en', 'en', 'en']
True
ConfigFlow.async_step_user
( self, user_input: dict[str, Any] | None = None )
Handle configuration via the UI.
Handle configuration via the UI.
async def async_step_user( self, user_input: dict[str, Any] | None = None ) -> FlowResult: """Handle configuration via the UI.""" if user_input is None: return self.async_show_form( step_id="user", data_schema=DATA_SCHEMA, errors={} ) try: ...
[ "async", "def", "async_step_user", "(", "self", ",", "user_input", ":", "dict", "[", "str", ",", "Any", "]", "|", "None", "=", "None", ")", "->", "FlowResult", ":", "if", "user_input", "is", "None", ":", "return", "self", ".", "async_show_form", "(", "...
[ 74, 4 ]
[ 98, 9 ]
python
en
['en', 'haw', 'en']
True
ConfigFlow.async_step_dhcp
(self, discovery_info: DiscoveryInfoType)
Handle the configuration via dhcp.
Handle the configuration via dhcp.
async def async_step_dhcp(self, discovery_info: DiscoveryInfoType) -> FlowResult: """Handle the configuration via dhcp.""" self.discovery_info = { CONF_IP_ADDRESS: discovery_info[IP_ADDRESS], CONF_PORT: DEFAULT_PORT, } return await self._async_handle_discovery()
[ "async", "def", "async_step_dhcp", "(", "self", ",", "discovery_info", ":", "DiscoveryInfoType", ")", "->", "FlowResult", ":", "self", ".", "discovery_info", "=", "{", "CONF_IP_ADDRESS", ":", "discovery_info", "[", "IP_ADDRESS", "]", ",", "CONF_PORT", ":", "DEFA...
[ 100, 4 ]
[ 106, 51 ]
python
en
['en', 'en', 'en']
True
ConfigFlow.async_step_zeroconf
( self, discovery_info: DiscoveryInfoType )
Handle the configuration via zeroconf.
Handle the configuration via zeroconf.
async def async_step_zeroconf( self, discovery_info: DiscoveryInfoType ) -> FlowResult: """Handle the configuration via zeroconf.""" self.discovery_info = { CONF_IP_ADDRESS: discovery_info["host"], CONF_PORT: discovery_info["port"], } pin = async_get_p...
[ "async", "def", "async_step_zeroconf", "(", "self", ",", "discovery_info", ":", "DiscoveryInfoType", ")", "->", "FlowResult", ":", "self", ".", "discovery_info", "=", "{", "CONF_IP_ADDRESS", ":", "discovery_info", "[", "\"host\"", "]", ",", "CONF_PORT", ":", "di...
[ 108, 4 ]
[ 118, 51 ]
python
en
['en', 'es', 'en']
True
ConfigFlow._async_handle_discovery
(self)
Handle any discovery.
Handle any discovery.
async def _async_handle_discovery(self) -> FlowResult: """Handle any discovery.""" self.context[CONF_IP_ADDRESS] = self.discovery_info[CONF_IP_ADDRESS] if any( self.context[CONF_IP_ADDRESS] == flow["context"][CONF_IP_ADDRESS] for flow in self._async_in_progress() ...
[ "async", "def", "_async_handle_discovery", "(", "self", ")", "->", "FlowResult", ":", "self", ".", "context", "[", "CONF_IP_ADDRESS", "]", "=", "self", ".", "discovery_info", "[", "CONF_IP_ADDRESS", "]", "if", "any", "(", "self", ".", "context", "[", "CONF_I...
[ 120, 4 ]
[ 129, 56 ]
python
en
['en', 'en', 'en']
True
ConfigFlow.async_step_discovery_confirm
( self, user_input: dict[str, Any] | None = None )
Finish the configuration via any discovery.
Finish the configuration via any discovery.
async def async_step_discovery_confirm( self, user_input: dict[str, Any] | None = None ) -> FlowResult: """Finish the configuration via any discovery.""" if user_input is None: self._set_confirm_only() return self.async_show_form(step_id="discovery_confirm") r...
[ "async", "def", "async_step_discovery_confirm", "(", "self", ",", "user_input", ":", "dict", "[", "str", ",", "Any", "]", "|", "None", "=", "None", ")", "->", "FlowResult", ":", "if", "user_input", "is", "None", ":", "self", ".", "_set_confirm_only", "(", ...
[ 131, 4 ]
[ 138, 62 ]
python
en
['en', 'mg', 'en']
True
setup_platform
(hass, config, add_entities, discovery_info=None)
Set up an EnOcean sensor device.
Set up an EnOcean sensor device.
def setup_platform(hass, config, add_entities, discovery_info=None): """Set up an EnOcean sensor device.""" dev_id = config[CONF_ID] dev_name = config[CONF_NAME] sensor_type = config[CONF_DEVICE_CLASS] entities: list[EnOceanSensor] = [] if sensor_type == SENSOR_TYPE_TEMPERATURE: temp_mi...
[ "def", "setup_platform", "(", "hass", ",", "config", ",", "add_entities", ",", "discovery_info", "=", "None", ")", ":", "dev_id", "=", "config", "[", "CONF_ID", "]", "dev_name", "=", "config", "[", "CONF_NAME", "]", "sensor_type", "=", "config", "[", "CONF...
[ 84, 0 ]
[ 118, 30 ]
python
en
['en', 'su', 'en']
True
EnOceanSensor.__init__
(self, dev_id, dev_name, description: SensorEntityDescription)
Initialize the EnOcean sensor device.
Initialize the EnOcean sensor device.
def __init__(self, dev_id, dev_name, description: SensorEntityDescription): """Initialize the EnOcean sensor device.""" super().__init__(dev_id, dev_name) self.entity_description = description self._attr_name = f"{description.name} {dev_name}"
[ "def", "__init__", "(", "self", ",", "dev_id", ",", "dev_name", ",", "description", ":", "SensorEntityDescription", ")", ":", "super", "(", ")", ".", "__init__", "(", "dev_id", ",", "dev_name", ")", "self", ".", "entity_description", "=", "description", "sel...
[ 124, 4 ]
[ 128, 58 ]
python
en
['en', 'fr', 'en']
True
EnOceanSensor.async_added_to_hass
(self)
Call when entity about to be added to hass.
Call when entity about to be added to hass.
async def async_added_to_hass(self): """Call when entity about to be added to hass.""" # If not None, we got an initial value. await super().async_added_to_hass() if self._attr_native_value is not None: return state = await self.async_get_last_state() if stat...
[ "async", "def", "async_added_to_hass", "(", "self", ")", ":", "# If not None, we got an initial value.", "await", "super", "(", ")", ".", "async_added_to_hass", "(", ")", "if", "self", ".", "_attr_native_value", "is", "not", "None", ":", "return", "state", "=", ...
[ 130, 4 ]
[ 139, 49 ]
python
en
['en', 'en', 'en']
True
EnOceanSensor.value_changed
(self, packet)
Update the internal state of the sensor.
Update the internal state of the sensor.
def value_changed(self, packet): """Update the internal state of the sensor."""
[ "def", "value_changed", "(", "self", ",", "packet", ")", ":" ]
[ 141, 4 ]
[ 142, 54 ]
python
en
['en', 'en', 'en']
True
EnOceanPowerSensor.value_changed
(self, packet)
Update the internal state of the sensor.
Update the internal state of the sensor.
def value_changed(self, packet): """Update the internal state of the sensor.""" if packet.rorg != 0xA5: return packet.parse_eep(0x12, 0x01) if packet.parsed["DT"]["raw_value"] == 1: # this packet reports the current value raw_val = packet.parsed["MR"][...
[ "def", "value_changed", "(", "self", ",", "packet", ")", ":", "if", "packet", ".", "rorg", "!=", "0xA5", ":", "return", "packet", ".", "parse_eep", "(", "0x12", ",", "0x01", ")", "if", "packet", ".", "parsed", "[", "\"DT\"", "]", "[", "\"raw_value\"", ...
[ 152, 4 ]
[ 162, 43 ]
python
en
['en', 'en', 'en']
True
EnOceanTemperatureSensor.__init__
( self, dev_id, dev_name, description: SensorEntityDescription, *, scale_min, scale_max, range_from, range_to, )
Initialize the EnOcean temperature sensor device.
Initialize the EnOcean temperature sensor device.
def __init__( self, dev_id, dev_name, description: SensorEntityDescription, *, scale_min, scale_max, range_from, range_to, ): """Initialize the EnOcean temperature sensor device.""" super().__init__(dev_id, dev_name, description...
[ "def", "__init__", "(", "self", ",", "dev_id", ",", "dev_name", ",", "description", ":", "SensorEntityDescription", ",", "*", ",", "scale_min", ",", "scale_max", ",", "range_from", ",", "range_to", ",", ")", ":", "super", "(", ")", ".", "__init__", "(", ...
[ 183, 4 ]
[ 199, 32 ]
python
en
['en', 'ro', 'en']
True
EnOceanTemperatureSensor.value_changed
(self, packet)
Update the internal state of the sensor.
Update the internal state of the sensor.
def value_changed(self, packet): """Update the internal state of the sensor.""" if packet.data[0] != 0xA5: return temp_scale = self._scale_max - self._scale_min temp_range = self.range_to - self.range_from raw_val = packet.data[3] temperature = temp_scale / te...
[ "def", "value_changed", "(", "self", ",", "packet", ")", ":", "if", "packet", ".", "data", "[", "0", "]", "!=", "0xA5", ":", "return", "temp_scale", "=", "self", ".", "_scale_max", "-", "self", ".", "_scale_min", "temp_range", "=", "self", ".", "range_...
[ 201, 4 ]
[ 211, 39 ]
python
en
['en', 'en', 'en']
True
EnOceanHumiditySensor.value_changed
(self, packet)
Update the internal state of the sensor.
Update the internal state of the sensor.
def value_changed(self, packet): """Update the internal state of the sensor.""" if packet.rorg != 0xA5: return humidity = packet.data[2] * 100 / 250 self._attr_native_value = round(humidity, 1) self.schedule_update_ha_state()
[ "def", "value_changed", "(", "self", ",", "packet", ")", ":", "if", "packet", ".", "rorg", "!=", "0xA5", ":", "return", "humidity", "=", "packet", ".", "data", "[", "2", "]", "*", "100", "/", "250", "self", ".", "_attr_native_value", "=", "round", "(...
[ 223, 4 ]
[ 229, 39 ]
python
en
['en', 'en', 'en']
True
EnOceanWindowHandle.value_changed
(self, packet)
Update the internal state of the sensor.
Update the internal state of the sensor.
def value_changed(self, packet): """Update the internal state of the sensor.""" action = (packet.data[1] & 0x70) >> 4 if action == 0x07: self._attr_native_value = STATE_CLOSED if action in (0x04, 0x06): self._attr_native_value = STATE_OPEN if action == 0...
[ "def", "value_changed", "(", "self", ",", "packet", ")", ":", "action", "=", "(", "packet", ".", "data", "[", "1", "]", "&", "0x70", ")", ">>", "4", "if", "action", "==", "0x07", ":", "self", ".", "_attr_native_value", "=", "STATE_CLOSED", "if", "act...
[ 239, 4 ]
[ 251, 39 ]
python
en
['en', 'en', 'en']
True
test_binary_sensors
(hass, surepetcare)
Test the generation of unique ids.
Test the generation of unique ids.
async def test_binary_sensors(hass, surepetcare) -> None: """Test the generation of unique ids.""" assert await async_setup_component(hass, DOMAIN, MOCK_CONFIG) await hass.async_block_till_done() entity_registry = er.async_get(hass) state_entity_ids = hass.states.async_entity_ids() for entity_...
[ "async", "def", "test_binary_sensors", "(", "hass", ",", "surepetcare", ")", "->", "None", ":", "assert", "await", "async_setup_component", "(", "hass", ",", "DOMAIN", ",", "MOCK_CONFIG", ")", "await", "hass", ".", "async_block_till_done", "(", ")", "entity_regi...
[ 17, 0 ]
[ 31, 44 ]
python
en
['en', 'fr', 'en']
True
TestPolynomial.test_poly_int_overflow
(self)
Regression test for gh-5096.
Regression test for gh-5096.
def test_poly_int_overflow(self): """ Regression test for gh-5096. """ v = np.arange(1, 21) assert_almost_equal(np.poly(v), np.poly(np.diag(v)))
[ "def", "test_poly_int_overflow", "(", "self", ")", ":", "v", "=", "np", ".", "arange", "(", "1", ",", "21", ")", "assert_almost_equal", "(", "np", ".", "poly", "(", "v", ")", ",", "np", ".", "poly", "(", "np", ".", "diag", "(", "v", ")", ")", "...
[ 222, 4 ]
[ 227, 60 ]
python
en
['en', 'error', 'th']
False
TestPolynomial.test_poly_coeffs_mutable
(self)
Coefficients should be modifiable
Coefficients should be modifiable
def test_poly_coeffs_mutable(self): """ Coefficients should be modifiable """ p = np.poly1d([1, 2, 3]) p.coeffs += 1 assert_equal(p.coeffs, [2, 3, 4]) p.coeffs[2] += 10 assert_equal(p.coeffs, [2, 3, 14]) # this never used to be allowed - let's not add features ...
[ "def", "test_poly_coeffs_mutable", "(", "self", ")", ":", "p", "=", "np", ".", "poly1d", "(", "[", "1", ",", "2", ",", "3", "]", ")", "p", ".", "coeffs", "+=", "1", "assert_equal", "(", "p", ".", "coeffs", ",", "[", "2", ",", "3", ",", "4", "...
[ 246, 4 ]
[ 258, 72 ]
python
en
['en', 'en', 'en']
True
test_sensor
(hass, aioclient_mock)
Test states of the sensor.
Test states of the sensor.
async def test_sensor(hass, aioclient_mock): """Test states of the sensor.""" await init_integration(hass, aioclient_mock) registry = er.async_get(hass) state = hass.states.get("sensor.home_caqi") assert state assert state.state == "23" assert state.attributes.get(ATTR_ATTRIBUTION) == ATTRI...
[ "async", "def", "test_sensor", "(", "hass", ",", "aioclient_mock", ")", ":", "await", "init_integration", "(", "hass", ",", "aioclient_mock", ")", "registry", "=", "er", ".", "async_get", "(", "hass", ")", "state", "=", "hass", ".", "states", ".", "get", ...
[ 33, 0 ]
[ 128, 51 ]
python
en
['en', 'en', 'en']
True
test_availability
(hass, aioclient_mock)
Ensure that we mark the entities unavailable correctly when service is offline.
Ensure that we mark the entities unavailable correctly when service is offline.
async def test_availability(hass, aioclient_mock): """Ensure that we mark the entities unavailable correctly when service is offline.""" await init_integration(hass, aioclient_mock) state = hass.states.get("sensor.home_humidity") assert state assert state.state != STATE_UNAVAILABLE assert state...
[ "async", "def", "test_availability", "(", "hass", ",", "aioclient_mock", ")", ":", "await", "init_integration", "(", "hass", ",", "aioclient_mock", ")", "state", "=", "hass", ".", "states", ".", "get", "(", "\"sensor.home_humidity\"", ")", "assert", "state", "...
[ 131, 0 ]
[ 159, 32 ]
python
en
['en', 'en', 'en']
True
test_manual_update_entity
(hass, aioclient_mock)
Test manual update entity via service homeasasistant/update_entity.
Test manual update entity via service homeasasistant/update_entity.
async def test_manual_update_entity(hass, aioclient_mock): """Test manual update entity via service homeasasistant/update_entity.""" await init_integration(hass, aioclient_mock) call_count = aioclient_mock.call_count await async_setup_component(hass, "homeassistant", {}) await hass.services.async_c...
[ "async", "def", "test_manual_update_entity", "(", "hass", ",", "aioclient_mock", ")", ":", "await", "init_integration", "(", "hass", ",", "aioclient_mock", ")", "call_count", "=", "aioclient_mock", ".", "call_count", "await", "async_setup_component", "(", "hass", ",...
[ 162, 0 ]
[ 175, 54 ]
python
en
['en', 'en', 'en']
True
ConfigEntryAuth.__init__
( self, hass: core.HomeAssistant, config_entry: config_entries.ConfigEntry, implementation: config_entry_oauth2_flow.AbstractOAuth2Implementation, )
Initialize Neato Botvac Auth.
Initialize Neato Botvac Auth.
def __init__( self, hass: core.HomeAssistant, config_entry: config_entries.ConfigEntry, implementation: config_entry_oauth2_flow.AbstractOAuth2Implementation, ) -> None: """Initialize Neato Botvac Auth.""" self.hass = hass self.session = config_entry_oauth2_fl...
[ "def", "__init__", "(", "self", ",", "hass", ":", "core", ".", "HomeAssistant", ",", "config_entry", ":", "config_entries", ".", "ConfigEntry", ",", "implementation", ":", "config_entry_oauth2_flow", ".", "AbstractOAuth2Implementation", ",", ")", "->", "None", ":"...
[ 15, 4 ]
[ 26, 69 ]
python
it
['it', 'it', 'it']
True
ConfigEntryAuth.refresh_tokens
(self)
Refresh and return new Neato Botvac tokens using Home Assistant OAuth2 session.
Refresh and return new Neato Botvac tokens using Home Assistant OAuth2 session.
def refresh_tokens(self) -> str: """Refresh and return new Neato Botvac tokens using Home Assistant OAuth2 session.""" run_coroutine_threadsafe( self.session.async_ensure_token_valid(), self.hass.loop ).result() return self.session.token["access_token"]
[ "def", "refresh_tokens", "(", "self", ")", "->", "str", ":", "run_coroutine_threadsafe", "(", "self", ".", "session", ".", "async_ensure_token_valid", "(", ")", ",", "self", ".", "hass", ".", "loop", ")", ".", "result", "(", ")", "return", "self", ".", "...
[ 28, 4 ]
[ 34, 49 ]
python
en
['en', 'en', 'en']
True
NeatoImplementation.extra_authorize_data
(self)
Extra data that needs to be appended to the authorize url.
Extra data that needs to be appended to the authorize url.
def extra_authorize_data(self) -> dict[str, Any]: """Extra data that needs to be appended to the authorize url.""" return {"client_secret": self.client_secret}
[ "def", "extra_authorize_data", "(", "self", ")", "->", "dict", "[", "str", ",", "Any", "]", ":", "return", "{", "\"client_secret\"", ":", "self", ".", "client_secret", "}" ]
[ 44, 4 ]
[ 46, 52 ]
python
en
['en', 'en', 'en']
True
NeatoImplementation.async_generate_authorize_url
(self, flow_id: str)
Generate a url for the user to authorize. We must make sure that the plus signs are not encoded.
Generate a url for the user to authorize.
async def async_generate_authorize_url(self, flow_id: str) -> str: """Generate a url for the user to authorize. We must make sure that the plus signs are not encoded. """ url = await super().async_generate_authorize_url(flow_id) return f"{url}&scope=public_profile+control_robots...
[ "async", "def", "async_generate_authorize_url", "(", "self", ",", "flow_id", ":", "str", ")", "->", "str", ":", "url", "=", "await", "super", "(", ")", ".", "async_generate_authorize_url", "(", "flow_id", ")", "return", "f\"{url}&scope=public_profile+control_robots+...
[ 48, 4 ]
[ 54, 64 ]
python
en
['en', 'en', 'en']
True
setup_demo_humidifier
(hass)
Initialize setup demo humidifier.
Initialize setup demo humidifier.
async def setup_demo_humidifier(hass): """Initialize setup demo humidifier.""" assert await async_setup_component( hass, DOMAIN, {"humidifier": {"platform": "demo"}} ) await hass.async_block_till_done()
[ "async", "def", "setup_demo_humidifier", "(", "hass", ")", ":", "assert", "await", "async_setup_component", "(", "hass", ",", "DOMAIN", ",", "{", "\"humidifier\"", ":", "{", "\"platform\"", ":", "\"demo\"", "}", "}", ")", "await", "hass", ".", "async_block_til...
[ 32, 0 ]
[ 37, 38 ]
python
en
['en', 'zh-Latn', 'en']
True
test_setup_params
(hass)
Test the initial parameters.
Test the initial parameters.
def test_setup_params(hass): """Test the initial parameters.""" state = hass.states.get(ENTITY_DEHUMIDIFIER) assert state.state == STATE_ON assert state.attributes.get(ATTR_HUMIDITY) == 54
[ "def", "test_setup_params", "(", "hass", ")", ":", "state", "=", "hass", ".", "states", ".", "get", "(", "ENTITY_DEHUMIDIFIER", ")", "assert", "state", ".", "state", "==", "STATE_ON", "assert", "state", ".", "attributes", ".", "get", "(", "ATTR_HUMIDITY", ...
[ 40, 0 ]
[ 44, 52 ]
python
en
['en', 'en', 'en']
True
test_default_setup_params
(hass)
Test the setup with default parameters.
Test the setup with default parameters.
def test_default_setup_params(hass): """Test the setup with default parameters.""" state = hass.states.get(ENTITY_DEHUMIDIFIER) assert state.attributes.get(ATTR_MIN_HUMIDITY) == 0 assert state.attributes.get(ATTR_MAX_HUMIDITY) == 100
[ "def", "test_default_setup_params", "(", "hass", ")", ":", "state", "=", "hass", ".", "states", ".", "get", "(", "ENTITY_DEHUMIDIFIER", ")", "assert", "state", ".", "attributes", ".", "get", "(", "ATTR_MIN_HUMIDITY", ")", "==", "0", "assert", "state", ".", ...
[ 47, 0 ]
[ 51, 57 ]
python
en
['en', 'en', 'en']
True
test_set_target_humidity_bad_attr
(hass)
Test setting the target humidity without required attribute.
Test setting the target humidity without required attribute.
async def test_set_target_humidity_bad_attr(hass): """Test setting the target humidity without required attribute.""" state = hass.states.get(ENTITY_DEHUMIDIFIER) assert state.attributes.get(ATTR_HUMIDITY) == 54 with pytest.raises(vol.Invalid): await hass.services.async_call( DOMAIN...
[ "async", "def", "test_set_target_humidity_bad_attr", "(", "hass", ")", ":", "state", "=", "hass", ".", "states", ".", "get", "(", "ENTITY_DEHUMIDIFIER", ")", "assert", "state", ".", "attributes", ".", "get", "(", "ATTR_HUMIDITY", ")", "==", "54", "with", "py...
[ 54, 0 ]
[ 69, 52 ]
python
en
['en', 'en', 'en']
True
test_set_target_humidity
(hass)
Test the setting of the target humidity.
Test the setting of the target humidity.
async def test_set_target_humidity(hass): """Test the setting of the target humidity.""" state = hass.states.get(ENTITY_DEHUMIDIFIER) assert state.attributes.get(ATTR_HUMIDITY) == 54 await hass.services.async_call( DOMAIN, SERVICE_SET_HUMIDITY, {ATTR_HUMIDITY: 64, ATTR_ENTITY_ID...
[ "async", "def", "test_set_target_humidity", "(", "hass", ")", ":", "state", "=", "hass", ".", "states", ".", "get", "(", "ENTITY_DEHUMIDIFIER", ")", "assert", "state", ".", "attributes", ".", "get", "(", "ATTR_HUMIDITY", ")", "==", "54", "await", "hass", "...
[ 72, 0 ]
[ 86, 52 ]
python
en
['en', 'en', 'en']
True
test_set_hold_mode_away
(hass)
Test setting the hold mode away.
Test setting the hold mode away.
async def test_set_hold_mode_away(hass): """Test setting the hold mode away.""" await hass.services.async_call( DOMAIN, SERVICE_SET_MODE, {ATTR_MODE: MODE_AWAY, ATTR_ENTITY_ID: ENTITY_HYGROSTAT}, blocking=True, ) await hass.async_block_till_done() state = hass.states...
[ "async", "def", "test_set_hold_mode_away", "(", "hass", ")", ":", "await", "hass", ".", "services", ".", "async_call", "(", "DOMAIN", ",", "SERVICE_SET_MODE", ",", "{", "ATTR_MODE", ":", "MODE_AWAY", ",", "ATTR_ENTITY_ID", ":", "ENTITY_HYGROSTAT", "}", ",", "b...
[ 89, 0 ]
[ 100, 55 ]
python
en
['en', 'en', 'en']
True
test_set_hold_mode_eco
(hass)
Test setting the hold mode eco.
Test setting the hold mode eco.
async def test_set_hold_mode_eco(hass): """Test setting the hold mode eco.""" await hass.services.async_call( DOMAIN, SERVICE_SET_MODE, {ATTR_MODE: MODE_ECO, ATTR_ENTITY_ID: ENTITY_HYGROSTAT}, blocking=True, ) await hass.async_block_till_done() state = hass.states.ge...
[ "async", "def", "test_set_hold_mode_eco", "(", "hass", ")", ":", "await", "hass", ".", "services", ".", "async_call", "(", "DOMAIN", ",", "SERVICE_SET_MODE", ",", "{", "ATTR_MODE", ":", "MODE_ECO", ",", "ATTR_ENTITY_ID", ":", "ENTITY_HYGROSTAT", "}", ",", "blo...
[ 103, 0 ]
[ 114, 54 ]
python
en
['en', 'en', 'en']
True
test_turn_on
(hass)
Test turn on device.
Test turn on device.
async def test_turn_on(hass): """Test turn on device.""" await hass.services.async_call( DOMAIN, SERVICE_TURN_OFF, {ATTR_ENTITY_ID: ENTITY_DEHUMIDIFIER}, blocking=True ) state = hass.states.get(ENTITY_DEHUMIDIFIER) assert state.state == STATE_OFF await hass.services.async_call( ...
[ "async", "def", "test_turn_on", "(", "hass", ")", ":", "await", "hass", ".", "services", ".", "async_call", "(", "DOMAIN", ",", "SERVICE_TURN_OFF", ",", "{", "ATTR_ENTITY_ID", ":", "ENTITY_DEHUMIDIFIER", "}", ",", "blocking", "=", "True", ")", "state", "=", ...
[ 117, 0 ]
[ 129, 34 ]
python
en
['fr', 'en', 'en']
True
test_turn_off
(hass)
Test turn off device.
Test turn off device.
async def test_turn_off(hass): """Test turn off device.""" await hass.services.async_call( DOMAIN, SERVICE_TURN_ON, {ATTR_ENTITY_ID: ENTITY_DEHUMIDIFIER}, blocking=True ) state = hass.states.get(ENTITY_DEHUMIDIFIER) assert state.state == STATE_ON await hass.services.async_call( ...
[ "async", "def", "test_turn_off", "(", "hass", ")", ":", "await", "hass", ".", "services", ".", "async_call", "(", "DOMAIN", ",", "SERVICE_TURN_ON", ",", "{", "ATTR_ENTITY_ID", ":", "ENTITY_DEHUMIDIFIER", "}", ",", "blocking", "=", "True", ")", "state", "=", ...
[ 132, 0 ]
[ 144, 35 ]
python
en
['en', 'en', 'en']
True
test_toggle
(hass)
Test toggle device.
Test toggle device.
async def test_toggle(hass): """Test toggle device.""" await hass.services.async_call( DOMAIN, SERVICE_TURN_ON, {ATTR_ENTITY_ID: ENTITY_DEHUMIDIFIER}, blocking=True ) state = hass.states.get(ENTITY_DEHUMIDIFIER) assert state.state == STATE_ON await hass.services.async_call( DOMA...
[ "async", "def", "test_toggle", "(", "hass", ")", ":", "await", "hass", ".", "services", ".", "async_call", "(", "DOMAIN", ",", "SERVICE_TURN_ON", ",", "{", "ATTR_ENTITY_ID", ":", "ENTITY_DEHUMIDIFIER", "}", ",", "blocking", "=", "True", ")", "state", "=", ...
[ 147, 0 ]
[ 165, 34 ]
python
en
['fr', 'en', 'en']
True
webhook_id_from_device_id
(hass, device_id: str)
Get webhook ID from device ID.
Get webhook ID from device ID.
def webhook_id_from_device_id(hass, device_id: str) -> str | None: """Get webhook ID from device ID.""" if DOMAIN not in hass.data: return None for cur_webhook_id, cur_device in hass.data[DOMAIN][DATA_DEVICES].items(): if cur_device.id == device_id: return cur_webhook_id re...
[ "def", "webhook_id_from_device_id", "(", "hass", ",", "device_id", ":", "str", ")", "->", "str", "|", "None", ":", "if", "DOMAIN", "not", "in", "hass", ".", "data", ":", "return", "None", "for", "cur_webhook_id", ",", "cur_device", "in", "hass", ".", "da...
[ 22, 0 ]
[ 31, 15 ]
python
en
['en', 'en', 'en']
True
supports_push
(hass, webhook_id: str)
Return if push notifications is supported.
Return if push notifications is supported.
def supports_push(hass, webhook_id: str) -> bool: """Return if push notifications is supported.""" config_entry = hass.data[DOMAIN][DATA_CONFIG_ENTRIES][webhook_id] app_data = config_entry.data[ATTR_APP_DATA] return ATTR_PUSH_TOKEN in app_data and ATTR_PUSH_URL in app_data
[ "def", "supports_push", "(", "hass", ",", "webhook_id", ":", "str", ")", "->", "bool", ":", "config_entry", "=", "hass", ".", "data", "[", "DOMAIN", "]", "[", "DATA_CONFIG_ENTRIES", "]", "[", "webhook_id", "]", "app_data", "=", "config_entry", ".", "data",...
[ 35, 0 ]
[ 39, 68 ]
python
en
['en', 'en', 'en']
True
get_notify_service
(hass, webhook_id: str)
Return the notify service for this webhook ID.
Return the notify service for this webhook ID.
def get_notify_service(hass, webhook_id: str) -> str | None: """Return the notify service for this webhook ID.""" notify_service: MobileAppNotificationService = hass.data[DOMAIN][DATA_NOTIFY] for target_service, target_webhook_id in notify_service.registered_targets.items(): if target_webhook_id ==...
[ "def", "get_notify_service", "(", "hass", ",", "webhook_id", ":", "str", ")", "->", "str", "|", "None", ":", "notify_service", ":", "MobileAppNotificationService", "=", "hass", ".", "data", "[", "DOMAIN", "]", "[", "DATA_NOTIFY", "]", "for", "target_service", ...
[ 43, 0 ]
[ 51, 15 ]
python
en
['en', 'en', 'en']
True
test_qr_mode_full_future_warning
()
Check mode='full' FutureWarning. In numpy 1.8 the mode options 'full' and 'economic' in linalg.qr were deprecated. The release date will probably be sometime in the summer of 2013.
Check mode='full' FutureWarning.
def test_qr_mode_full_future_warning(): """Check mode='full' FutureWarning. In numpy 1.8 the mode options 'full' and 'economic' in linalg.qr were deprecated. The release date will probably be sometime in the summer of 2013. """ a = np.eye(2) assert_warns(DeprecationWarning, np.linalg.qr, a...
[ "def", "test_qr_mode_full_future_warning", "(", ")", ":", "a", "=", "np", ".", "eye", "(", "2", ")", "assert_warns", "(", "DeprecationWarning", ",", "np", ".", "linalg", ".", "qr", ",", "a", ",", "mode", "=", "'full'", ")", "assert_warns", "(", "Deprecat...
[ 7, 0 ]
[ 19, 63 ]
python
en
['en', 'jv', 'en']
True
test_version_source
(hass, source, target_source, name)
Test the Version sensor with different sources.
Test the Version sensor with different sources.
async def test_version_source(hass, source, target_source, name): """Test the Version sensor with different sources.""" config = { "sensor": {"platform": "version", "source": source, "image": "qemux86-64"} } with patch("homeassistant.components.version.sensor.HaVersion.get_version"), patch( ...
[ "async", "def", "test_version_source", "(", "hass", ",", "source", ",", "target_source", ",", "name", ")", ":", "config", "=", "{", "\"sensor\"", ":", "{", "\"platform\"", ":", "\"version\"", ",", "\"source\"", ":", "source", ",", "\"image\"", ":", "\"qemux8...
[ 31, 0 ]
[ 47, 38 ]
python
en
['en', 'en', 'en']
True
test_version_fetch_exception
(hass, caplog)
Test fetch exception thrown during updates.
Test fetch exception thrown during updates.
async def test_version_fetch_exception(hass, caplog): """Test fetch exception thrown during updates.""" config = {"sensor": {"platform": "version"}} with patch( "homeassistant.components.version.sensor.HaVersion.get_version", side_effect=pyhaversionexceptions.HaVersionFetchException( ...
[ "async", "def", "test_version_fetch_exception", "(", "hass", ",", "caplog", ")", ":", "config", "=", "{", "\"sensor\"", ":", "{", "\"platform\"", ":", "\"version\"", "}", "}", "with", "patch", "(", "\"homeassistant.components.version.sensor.HaVersion.get_version\"", "...
[ 50, 0 ]
[ 61, 64 ]
python
en
['en', 'en', 'en']
True
test_version_parse_exception
(hass, caplog)
Test parse exception thrown during updates.
Test parse exception thrown during updates.
async def test_version_parse_exception(hass, caplog): """Test parse exception thrown during updates.""" config = {"sensor": {"platform": "version"}} with patch( "homeassistant.components.version.sensor.HaVersion.get_version", side_effect=pyhaversionexceptions.HaVersionParseException, ): ...
[ "async", "def", "test_version_parse_exception", "(", "hass", ",", "caplog", ")", ":", "config", "=", "{", "\"sensor\"", ":", "{", "\"platform\"", ":", "\"version\"", "}", "}", "with", "patch", "(", "\"homeassistant.components.version.sensor.HaVersion.get_version\"", "...
[ 64, 0 ]
[ 73, 87 ]
python
en
['en', 'de', 'en']
True
test_update
(hass)
Test updates.
Test updates.
async def test_update(hass): """Test updates.""" config = {"sensor": {"platform": "version"}} with patch("homeassistant.components.version.sensor.HaVersion.get_version"), patch( "homeassistant.components.version.sensor.HaVersion.version", MOCK_VERSION ): assert await async_setup_compone...
[ "async", "def", "test_update", "(", "hass", ")", ":", "config", "=", "{", "\"sensor\"", ":", "{", "\"platform\"", ":", "\"version\"", "}", "}", "with", "patch", "(", "\"homeassistant.components.version.sensor.HaVersion.get_version\"", ")", ",", "patch", "(", "\"ho...
[ 76, 0 ]
[ 99, 32 ]
python
en
['en', 'de', 'en']
False
test_image_name_container
(hass)
Test the Version sensor with image name for container.
Test the Version sensor with image name for container.
async def test_image_name_container(hass): """Test the Version sensor with image name for container.""" config = { "sensor": {"platform": "version", "source": "docker", "image": "qemux86-64"} } with patch("homeassistant.components.version.sensor.HaVersion") as haversion: assert await as...
[ "async", "def", "test_image_name_container", "(", "hass", ")", ":", "config", "=", "{", "\"sensor\"", ":", "{", "\"platform\"", ":", "\"version\"", ",", "\"source\"", ":", "\"docker\"", ",", "\"image\"", ":", "\"qemux86-64\"", "}", "}", "with", "patch", "(", ...
[ 102, 0 ]
[ 114, 61 ]
python
en
['en', 'en', 'en']
True
test_image_name_supervisor
(hass)
Test the Version sensor with image name for supervisor.
Test the Version sensor with image name for supervisor.
async def test_image_name_supervisor(hass): """Test the Version sensor with image name for supervisor.""" config = { "sensor": {"platform": "version", "source": "hassio", "image": "qemux86-64"} } with patch("homeassistant.components.version.sensor.HaVersion") as haversion: assert await ...
[ "async", "def", "test_image_name_supervisor", "(", "hass", ")", ":", "config", "=", "{", "\"sensor\"", ":", "{", "\"platform\"", ":", "\"version\"", ",", "\"source\"", ":", "\"hassio\"", ",", "\"image\"", ":", "\"qemux86-64\"", "}", "}", "with", "patch", "(", ...
[ 117, 0 ]
[ 129, 47 ]
python
en
['en', 'en', 'en']
True
create_motion_sensor_service
(accessory)
Define motion characteristics as per page 225 of HAP spec.
Define motion characteristics as per page 225 of HAP spec.
def create_motion_sensor_service(accessory): """Define motion characteristics as per page 225 of HAP spec.""" service = accessory.add_service(ServicesTypes.MOTION_SENSOR) cur_state = service.add_char(CharacteristicsTypes.MOTION_DETECTED) cur_state.value = 0
[ "def", "create_motion_sensor_service", "(", "accessory", ")", ":", "service", "=", "accessory", ".", "add_service", "(", "ServicesTypes", ".", "MOTION_SENSOR", ")", "cur_state", "=", "service", ".", "add_char", "(", "CharacteristicsTypes", ".", "MOTION_DETECTED", ")...
[ 12, 0 ]
[ 16, 23 ]
python
en
['en', 'en', 'en']
True
test_unload_on_stop
(hass, utcnow)
Test async_unload is called on stop.
Test async_unload is called on stop.
async def test_unload_on_stop(hass, utcnow): """Test async_unload is called on stop.""" await setup_test_component(hass, create_motion_sensor_service) with patch( "homeassistant.components.homekit_controller.HKDevice.async_unload" ) as async_unlock_mock: hass.bus.async_fire(EVENT_HOMEASS...
[ "async", "def", "test_unload_on_stop", "(", "hass", ",", "utcnow", ")", ":", "await", "setup_test_component", "(", "hass", ",", "create_motion_sensor_service", ")", "with", "patch", "(", "\"homeassistant.components.homekit_controller.HKDevice.async_unload\"", ")", "as", "...
[ 19, 0 ]
[ 28, 35 ]
python
en
['en', 'en', 'en']
True
async_setup_platform
(hass, config, async_add_entities, discovery_info=None)
Set up the departure sensor.
Set up the departure sensor.
async def async_setup_platform(hass, config, async_add_entities, discovery_info=None): """Set up the departure sensor.""" httpsession = async_get_clientsession(hass) train_api = TrafikverketTrain(httpsession, config[CONF_API_KEY]) sensors = [] station_cache = {} for train in config[CONF_TRAINS]:...
[ "async", "def", "async_setup_platform", "(", "hass", ",", "config", ",", "async_add_entities", ",", "discovery_info", "=", "None", ")", ":", "httpsession", "=", "async_get_clientsession", "(", "hass", ")", "train_api", "=", "TrafikverketTrain", "(", "httpsession", ...
[ 56, 0 ]
[ 93, 55 ]
python
en
['en', 'da', 'en']
True
next_weekday
(fromdate, weekday)
Return the date of the next time a specific weekday happen.
Return the date of the next time a specific weekday happen.
def next_weekday(fromdate, weekday): """Return the date of the next time a specific weekday happen.""" days_ahead = weekday - fromdate.weekday() if days_ahead <= 0: days_ahead += 7 return fromdate + timedelta(days_ahead)
[ "def", "next_weekday", "(", "fromdate", ",", "weekday", ")", ":", "days_ahead", "=", "weekday", "-", "fromdate", ".", "weekday", "(", ")", "if", "days_ahead", "<=", "0", ":", "days_ahead", "+=", "7", "return", "fromdate", "+", "timedelta", "(", "days_ahead...
[ 96, 0 ]
[ 101, 43 ]
python
en
['en', 'en', 'en']
True