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
generate
(template: str, info: Info)
Generate a template.
Generate a template.
def generate(template: str, info: Info) -> None: """Generate a template.""" print(f"Scaffolding {template} for the {info.domain} integration...") _ensure_tests_dir_exists(info) _generate(TEMPLATE_DIR / template / "integration", info.integration_dir, info) _generate(TEMPLATE_DIR / template / "tests",...
[ "def", "generate", "(", "template", ":", "str", ",", "info", ":", "Info", ")", "->", "None", ":", "print", "(", "f\"Scaffolding {template} for the {info.domain} integration...\"", ")", "_ensure_tests_dir_exists", "(", "info", ")", "_generate", "(", "TEMPLATE_DIR", "...
[ 10, 0 ]
[ 17, 11 ]
python
en
['en', 'co', 'en']
True
_generate
(src_dir, target_dir, info: Info)
Generate an integration.
Generate an integration.
def _generate(src_dir, target_dir, info: Info) -> None: """Generate an integration.""" replaces = {"NEW_DOMAIN": info.domain, "NEW_NAME": info.name} if not target_dir.exists(): target_dir.mkdir() for source_file in src_dir.glob("**/*"): content = source_file.read_text() for to...
[ "def", "_generate", "(", "src_dir", ",", "target_dir", ",", "info", ":", "Info", ")", "->", "None", ":", "replaces", "=", "{", "\"NEW_DOMAIN\"", ":", "info", ".", "domain", ",", "\"NEW_NAME\"", ":", "info", ".", "name", "}", "if", "not", "target_dir", ...
[ 20, 0 ]
[ 49, 39 ]
python
en
['en', 'lb', 'it']
False
_ensure_tests_dir_exists
(info: Info)
Ensure a test dir exists.
Ensure a test dir exists.
def _ensure_tests_dir_exists(info: Info) -> None: """Ensure a test dir exists.""" if info.tests_dir.exists(): return info.tests_dir.mkdir() print(f"Writing {info.tests_dir / '__init__.py'}") (info.tests_dir / "__init__.py").write_text( f'"""Tests for the {info.name} integration."""\...
[ "def", "_ensure_tests_dir_exists", "(", "info", ":", "Info", ")", "->", "None", ":", "if", "info", ".", "tests_dir", ".", "exists", "(", ")", ":", "return", "info", ".", "tests_dir", ".", "mkdir", "(", ")", "print", "(", "f\"Writing {info.tests_dir / '__init...
[ 52, 0 ]
[ 61, 5 ]
python
ca
['ca', 'fr', 'en']
False
_append
(path: Path, text)
Append some text to a path.
Append some text to a path.
def _append(path: Path, text): """Append some text to a path.""" path.write_text(path.read_text() + text)
[ "def", "_append", "(", "path", ":", "Path", ",", "text", ")", ":", "path", ".", "write_text", "(", "path", ".", "read_text", "(", ")", "+", "text", ")" ]
[ 64, 0 ]
[ 66, 44 ]
python
en
['en', 'en', 'en']
True
_custom_tasks
(template, info)
Handle custom tasks for templates.
Handle custom tasks for templates.
def _custom_tasks(template, info) -> None: """Handle custom tasks for templates.""" if template == "integration": changes = {"codeowners": [info.codeowner]} if info.requirement: changes["requirements"] = [info.requirement] info.update_manifest(**changes) elif template ...
[ "def", "_custom_tasks", "(", "template", ",", "info", ")", "->", "None", ":", "if", "template", "==", "\"integration\"", ":", "changes", "=", "{", "\"codeowners\"", ":", "[", "info", ".", "codeowner", "]", "}", "if", "info", ".", "requirement", ":", "cha...
[ 69, 0 ]
[ 173, 9 ]
python
en
['en', 'ga', 'en']
True
test_setup_params
(hass, mqtt_mock)
Test the initial parameters.
Test the initial parameters.
async def test_setup_params(hass, mqtt_mock): """Test the initial parameters.""" assert await async_setup_component(hass, CLIMATE_DOMAIN, DEFAULT_CONFIG) await hass.async_block_till_done() state = hass.states.get(ENTITY_CLIMATE) assert state.attributes.get("temperature") == 21 assert state.attr...
[ "async", "def", "test_setup_params", "(", "hass", ",", "mqtt_mock", ")", ":", "assert", "await", "async_setup_component", "(", "hass", ",", "CLIMATE_DOMAIN", ",", "DEFAULT_CONFIG", ")", "await", "hass", ".", "async_block_till_done", "(", ")", "state", "=", "hass...
[ 74, 0 ]
[ 85, 63 ]
python
en
['en', 'en', 'en']
True
test_supported_features
(hass, mqtt_mock)
Test the supported_features.
Test the supported_features.
async def test_supported_features(hass, mqtt_mock): """Test the supported_features.""" assert await async_setup_component(hass, CLIMATE_DOMAIN, DEFAULT_CONFIG) await hass.async_block_till_done() state = hass.states.get(ENTITY_CLIMATE) support = ( SUPPORT_TARGET_TEMPERATURE | SUPPORT...
[ "async", "def", "test_supported_features", "(", "hass", ",", "mqtt_mock", ")", ":", "assert", "await", "async_setup_component", "(", "hass", ",", "CLIMATE_DOMAIN", ",", "DEFAULT_CONFIG", ")", "await", "hass", ".", "async_block_till_done", "(", ")", "state", "=", ...
[ 88, 0 ]
[ 103, 64 ]
python
en
['en', 'en', 'en']
True
test_get_hvac_modes
(hass, mqtt_mock)
Test that the operation list returns the correct modes.
Test that the operation list returns the correct modes.
async def test_get_hvac_modes(hass, mqtt_mock): """Test that the operation list returns the correct modes.""" assert await async_setup_component(hass, CLIMATE_DOMAIN, DEFAULT_CONFIG) await hass.async_block_till_done() state = hass.states.get(ENTITY_CLIMATE) modes = state.attributes.get("hvac_modes"...
[ "async", "def", "test_get_hvac_modes", "(", "hass", ",", "mqtt_mock", ")", ":", "assert", "await", "async_setup_component", "(", "hass", ",", "CLIMATE_DOMAIN", ",", "DEFAULT_CONFIG", ")", "await", "hass", ".", "async_block_till_done", "(", ")", "state", "=", "ha...
[ 106, 0 ]
[ 120, 14 ]
python
en
['en', 'en', 'en']
True
test_set_operation_bad_attr_and_state
(hass, mqtt_mock, caplog)
Test setting operation mode without required attribute. Also check the state.
Test setting operation mode without required attribute.
async def test_set_operation_bad_attr_and_state(hass, mqtt_mock, caplog): """Test setting operation mode without required attribute. Also check the state. """ assert await async_setup_component(hass, CLIMATE_DOMAIN, DEFAULT_CONFIG) await hass.async_block_till_done() state = hass.states.get(ENT...
[ "async", "def", "test_set_operation_bad_attr_and_state", "(", "hass", ",", "mqtt_mock", ",", "caplog", ")", ":", "assert", "await", "async_setup_component", "(", "hass", ",", "CLIMATE_DOMAIN", ",", "DEFAULT_CONFIG", ")", "await", "hass", ".", "async_block_till_done", ...
[ 123, 0 ]
[ 139, 31 ]
python
en
['en', 'en', 'en']
True
test_set_operation
(hass, mqtt_mock)
Test setting of new operation mode.
Test setting of new operation mode.
async def test_set_operation(hass, mqtt_mock): """Test setting of new operation mode.""" assert await async_setup_component(hass, CLIMATE_DOMAIN, DEFAULT_CONFIG) await hass.async_block_till_done() state = hass.states.get(ENTITY_CLIMATE) assert state.state == "off" await common.async_set_hvac_mo...
[ "async", "def", "test_set_operation", "(", "hass", ",", "mqtt_mock", ")", ":", "assert", "await", "async_setup_component", "(", "hass", ",", "CLIMATE_DOMAIN", ",", "DEFAULT_CONFIG", ")", "await", "hass", ".", "async_block_till_done", "(", ")", "state", "=", "has...
[ 142, 0 ]
[ 153, 83 ]
python
en
['en', 'en', 'en']
True
test_set_operation_pessimistic
(hass, mqtt_mock)
Test setting operation mode in pessimistic mode.
Test setting operation mode in pessimistic mode.
async def test_set_operation_pessimistic(hass, mqtt_mock): """Test setting operation mode in pessimistic mode.""" config = copy.deepcopy(DEFAULT_CONFIG) config["climate"]["mode_state_topic"] = "mode-state" assert await async_setup_component(hass, CLIMATE_DOMAIN, config) await hass.async_block_till_d...
[ "async", "def", "test_set_operation_pessimistic", "(", "hass", ",", "mqtt_mock", ")", ":", "config", "=", "copy", ".", "deepcopy", "(", "DEFAULT_CONFIG", ")", "config", "[", "\"climate\"", "]", "[", "\"mode_state_topic\"", "]", "=", "\"mode-state\"", "assert", "...
[ 156, 0 ]
[ 176, 32 ]
python
en
['en', 'en', 'en']
True
test_set_operation_with_power_command
(hass, mqtt_mock)
Test setting of new operation mode with power command enabled.
Test setting of new operation mode with power command enabled.
async def test_set_operation_with_power_command(hass, mqtt_mock): """Test setting of new operation mode with power command enabled.""" config = copy.deepcopy(DEFAULT_CONFIG) config["climate"]["power_command_topic"] = "power-command" assert await async_setup_component(hass, CLIMATE_DOMAIN, config) aw...
[ "async", "def", "test_set_operation_with_power_command", "(", "hass", ",", "mqtt_mock", ")", ":", "config", "=", "copy", ".", "deepcopy", "(", "DEFAULT_CONFIG", ")", "config", "[", "\"climate\"", "]", "[", "\"power_command_topic\"", "]", "=", "\"power-command\"", ...
[ 179, 0 ]
[ 202, 40 ]
python
en
['en', 'en', 'en']
True
test_set_fan_mode_bad_attr
(hass, mqtt_mock, caplog)
Test setting fan mode without required attribute.
Test setting fan mode without required attribute.
async def test_set_fan_mode_bad_attr(hass, mqtt_mock, caplog): """Test setting fan mode without required attribute.""" assert await async_setup_component(hass, CLIMATE_DOMAIN, DEFAULT_CONFIG) await hass.async_block_till_done() state = hass.states.get(ENTITY_CLIMATE) assert state.attributes.get("fan...
[ "async", "def", "test_set_fan_mode_bad_attr", "(", "hass", ",", "mqtt_mock", ",", "caplog", ")", ":", "assert", "await", "async_setup_component", "(", "hass", ",", "CLIMATE_DOMAIN", ",", "DEFAULT_CONFIG", ")", "await", "hass", ".", "async_block_till_done", "(", ")...
[ 205, 0 ]
[ 218, 52 ]
python
en
['en', 'en', 'en']
True
test_set_fan_mode_pessimistic
(hass, mqtt_mock)
Test setting of new fan mode in pessimistic mode.
Test setting of new fan mode in pessimistic mode.
async def test_set_fan_mode_pessimistic(hass, mqtt_mock): """Test setting of new fan mode in pessimistic mode.""" config = copy.deepcopy(DEFAULT_CONFIG) config["climate"]["fan_mode_state_topic"] = "fan-state" assert await async_setup_component(hass, CLIMATE_DOMAIN, config) await hass.async_block_til...
[ "async", "def", "test_set_fan_mode_pessimistic", "(", "hass", ",", "mqtt_mock", ")", ":", "config", "=", "copy", ".", "deepcopy", "(", "DEFAULT_CONFIG", ")", "config", "[", "\"climate\"", "]", "[", "\"fan_mode_state_topic\"", "]", "=", "\"fan-state\"", "assert", ...
[ 221, 0 ]
[ 241, 53 ]
python
en
['en', 'en', 'en']
True
test_set_fan_mode
(hass, mqtt_mock)
Test setting of new fan mode.
Test setting of new fan mode.
async def test_set_fan_mode(hass, mqtt_mock): """Test setting of new fan mode.""" assert await async_setup_component(hass, CLIMATE_DOMAIN, DEFAULT_CONFIG) await hass.async_block_till_done() state = hass.states.get(ENTITY_CLIMATE) assert state.attributes.get("fan_mode") == "low" await common.asy...
[ "async", "def", "test_set_fan_mode", "(", "hass", ",", "mqtt_mock", ")", ":", "assert", "await", "async_setup_component", "(", "hass", ",", "CLIMATE_DOMAIN", ",", "DEFAULT_CONFIG", ")", "await", "hass", ".", "async_block_till_done", "(", ")", "state", "=", "hass...
[ 244, 0 ]
[ 254, 53 ]
python
en
['en', 'fy', 'en']
True
test_set_swing_mode_bad_attr
(hass, mqtt_mock, caplog)
Test setting swing mode without required attribute.
Test setting swing mode without required attribute.
async def test_set_swing_mode_bad_attr(hass, mqtt_mock, caplog): """Test setting swing mode without required attribute.""" assert await async_setup_component(hass, CLIMATE_DOMAIN, DEFAULT_CONFIG) await hass.async_block_till_done() state = hass.states.get(ENTITY_CLIMATE) assert state.attributes.get(...
[ "async", "def", "test_set_swing_mode_bad_attr", "(", "hass", ",", "mqtt_mock", ",", "caplog", ")", ":", "assert", "await", "async_setup_component", "(", "hass", ",", "CLIMATE_DOMAIN", ",", "DEFAULT_CONFIG", ")", "await", "hass", ".", "async_block_till_done", "(", ...
[ 257, 0 ]
[ 270, 54 ]
python
en
['en', 'en', 'en']
True
test_set_swing_pessimistic
(hass, mqtt_mock)
Test setting swing mode in pessimistic mode.
Test setting swing mode in pessimistic mode.
async def test_set_swing_pessimistic(hass, mqtt_mock): """Test setting swing mode in pessimistic mode.""" config = copy.deepcopy(DEFAULT_CONFIG) config["climate"]["swing_mode_state_topic"] = "swing-state" assert await async_setup_component(hass, CLIMATE_DOMAIN, config) await hass.async_block_till_do...
[ "async", "def", "test_set_swing_pessimistic", "(", "hass", ",", "mqtt_mock", ")", ":", "config", "=", "copy", ".", "deepcopy", "(", "DEFAULT_CONFIG", ")", "config", "[", "\"climate\"", "]", "[", "\"swing_mode_state_topic\"", "]", "=", "\"swing-state\"", "assert", ...
[ 273, 0 ]
[ 293, 53 ]
python
en
['en', 'en', 'it']
True
test_set_swing
(hass, mqtt_mock)
Test setting of new swing mode.
Test setting of new swing mode.
async def test_set_swing(hass, mqtt_mock): """Test setting of new swing mode.""" assert await async_setup_component(hass, CLIMATE_DOMAIN, DEFAULT_CONFIG) await hass.async_block_till_done() state = hass.states.get(ENTITY_CLIMATE) assert state.attributes.get("swing_mode") == "off" await common.as...
[ "async", "def", "test_set_swing", "(", "hass", ",", "mqtt_mock", ")", ":", "assert", "await", "async_setup_component", "(", "hass", ",", "CLIMATE_DOMAIN", ",", "DEFAULT_CONFIG", ")", "await", "hass", ".", "async_block_till_done", "(", ")", "state", "=", "hass", ...
[ 296, 0 ]
[ 306, 53 ]
python
en
['en', 'en', 'en']
True
test_set_target_temperature
(hass, mqtt_mock)
Test setting the target temperature.
Test setting the target temperature.
async def test_set_target_temperature(hass, mqtt_mock): """Test setting the target temperature.""" assert await async_setup_component(hass, CLIMATE_DOMAIN, DEFAULT_CONFIG) await hass.async_block_till_done() state = hass.states.get(ENTITY_CLIMATE) assert state.attributes.get("temperature") == 21 ...
[ "async", "def", "test_set_target_temperature", "(", "hass", ",", "mqtt_mock", ")", ":", "assert", "await", "async_setup_component", "(", "hass", ",", "CLIMATE_DOMAIN", ",", "DEFAULT_CONFIG", ")", "await", "hass", ".", "async_block_till_done", "(", ")", "state", "=...
[ 309, 0 ]
[ 342, 40 ]
python
en
['en', 'en', 'en']
True
test_set_target_temperature_pessimistic
(hass, mqtt_mock)
Test setting the target temperature.
Test setting the target temperature.
async def test_set_target_temperature_pessimistic(hass, mqtt_mock): """Test setting the target temperature.""" config = copy.deepcopy(DEFAULT_CONFIG) config["climate"]["temperature_state_topic"] = "temperature-state" assert await async_setup_component(hass, CLIMATE_DOMAIN, config) await hass.async_b...
[ "async", "def", "test_set_target_temperature_pessimistic", "(", "hass", ",", "mqtt_mock", ")", ":", "config", "=", "copy", ".", "deepcopy", "(", "DEFAULT_CONFIG", ")", "config", "[", "\"climate\"", "]", "[", "\"temperature_state_topic\"", "]", "=", "\"temperature-st...
[ 345, 0 ]
[ 365, 54 ]
python
en
['en', 'en', 'en']
True
test_set_target_temperature_low_high
(hass, mqtt_mock)
Test setting the low/high target temperature.
Test setting the low/high target temperature.
async def test_set_target_temperature_low_high(hass, mqtt_mock): """Test setting the low/high target temperature.""" assert await async_setup_component(hass, CLIMATE_DOMAIN, DEFAULT_CONFIG) await hass.async_block_till_done() await common.async_set_temperature( hass, target_temp_low=20, target_t...
[ "async", "def", "test_set_target_temperature_low_high", "(", "hass", ",", "mqtt_mock", ")", ":", "assert", "await", "async_setup_component", "(", "hass", ",", "CLIMATE_DOMAIN", ",", "DEFAULT_CONFIG", ")", "await", "hass", ".", "async_block_till_done", "(", ")", "awa...
[ 368, 0 ]
[ 380, 87 ]
python
en
['en', 'en', 'en']
True
test_set_target_temperature_low_highpessimistic
(hass, mqtt_mock)
Test setting the low/high target temperature.
Test setting the low/high target temperature.
async def test_set_target_temperature_low_highpessimistic(hass, mqtt_mock): """Test setting the low/high target temperature.""" config = copy.deepcopy(DEFAULT_CONFIG) config["climate"]["temperature_low_state_topic"] = "temperature-low-state" config["climate"]["temperature_high_state_topic"] = "temperatu...
[ "async", "def", "test_set_target_temperature_low_highpessimistic", "(", "hass", ",", "mqtt_mock", ")", ":", "config", "=", "copy", ".", "deepcopy", "(", "DEFAULT_CONFIG", ")", "config", "[", "\"climate\"", "]", "[", "\"temperature_low_state_topic\"", "]", "=", "\"te...
[ 383, 0 ]
[ 417, 59 ]
python
en
['en', 'en', 'en']
True
test_receive_mqtt_temperature
(hass, mqtt_mock)
Test getting the current temperature via MQTT.
Test getting the current temperature via MQTT.
async def test_receive_mqtt_temperature(hass, mqtt_mock): """Test getting the current temperature via MQTT.""" config = copy.deepcopy(DEFAULT_CONFIG) config["climate"]["current_temperature_topic"] = "current_temperature" assert await async_setup_component(hass, CLIMATE_DOMAIN, config) await hass.asy...
[ "async", "def", "test_receive_mqtt_temperature", "(", "hass", ",", "mqtt_mock", ")", ":", "config", "=", "copy", ".", "deepcopy", "(", "DEFAULT_CONFIG", ")", "config", "[", "\"climate\"", "]", "[", "\"current_temperature_topic\"", "]", "=", "\"current_temperature\""...
[ 420, 0 ]
[ 429, 60 ]
python
en
['en', 'co', 'en']
True
test_set_away_mode_pessimistic
(hass, mqtt_mock)
Test setting of the away mode.
Test setting of the away mode.
async def test_set_away_mode_pessimistic(hass, mqtt_mock): """Test setting of the away mode.""" config = copy.deepcopy(DEFAULT_CONFIG) config["climate"]["away_mode_state_topic"] = "away-state" assert await async_setup_component(hass, CLIMATE_DOMAIN, config) await hass.async_block_till_done() st...
[ "async", "def", "test_set_away_mode_pessimistic", "(", "hass", ",", "mqtt_mock", ")", ":", "config", "=", "copy", ".", "deepcopy", "(", "DEFAULT_CONFIG", ")", "config", "[", "\"climate\"", "]", "[", "\"away_mode_state_topic\"", "]", "=", "\"away-state\"", "assert"...
[ 432, 0 ]
[ 456, 56 ]
python
en
['en', 'en', 'en']
True
test_set_away_mode
(hass, mqtt_mock)
Test setting of the away mode.
Test setting of the away mode.
async def test_set_away_mode(hass, mqtt_mock): """Test setting of the away mode.""" config = copy.deepcopy(DEFAULT_CONFIG) config["climate"]["payload_on"] = "AN" config["climate"]["payload_off"] = "AUS" assert await async_setup_component(hass, CLIMATE_DOMAIN, config) await hass.async_block_till...
[ "async", "def", "test_set_away_mode", "(", "hass", ",", "mqtt_mock", ")", ":", "config", "=", "copy", ".", "deepcopy", "(", "DEFAULT_CONFIG", ")", "config", "[", "\"climate\"", "]", "[", "\"payload_on\"", "]", "=", "\"AN\"", "config", "[", "\"climate\"", "]"...
[ 459, 0 ]
[ 489, 56 ]
python
en
['en', 'en', 'en']
True
test_set_hvac_action
(hass, mqtt_mock)
Test setting of the HVAC action.
Test setting of the HVAC action.
async def test_set_hvac_action(hass, mqtt_mock): """Test setting of the HVAC action.""" config = copy.deepcopy(DEFAULT_CONFIG) config["climate"]["action_topic"] = "action" assert await async_setup_component(hass, CLIMATE_DOMAIN, config) await hass.async_block_till_done() state = hass.states.get...
[ "async", "def", "test_set_hvac_action", "(", "hass", ",", "mqtt_mock", ")", ":", "config", "=", "copy", ".", "deepcopy", "(", "DEFAULT_CONFIG", ")", "config", "[", "\"climate\"", "]", "[", "\"action_topic\"", "]", "=", "\"action\"", "assert", "await", "async_s...
[ 492, 0 ]
[ 504, 56 ]
python
en
['en', 'en', 'en']
True
test_set_hold_pessimistic
(hass, mqtt_mock)
Test setting the hold mode in pessimistic mode.
Test setting the hold mode in pessimistic mode.
async def test_set_hold_pessimistic(hass, mqtt_mock): """Test setting the hold mode in pessimistic mode.""" config = copy.deepcopy(DEFAULT_CONFIG) config["climate"]["hold_state_topic"] = "hold-state" assert await async_setup_component(hass, CLIMATE_DOMAIN, config) await hass.async_block_till_done() ...
[ "async", "def", "test_set_hold_pessimistic", "(", "hass", ",", "mqtt_mock", ")", ":", "config", "=", "copy", ".", "deepcopy", "(", "DEFAULT_CONFIG", ")", "config", "[", "\"climate\"", "]", "[", "\"hold_state_topic\"", "]", "=", "\"hold-state\"", "assert", "await...
[ 507, 0 ]
[ 527, 56 ]
python
en
['en', 'en', 'en']
True
test_set_hold
(hass, mqtt_mock)
Test setting the hold mode.
Test setting the hold mode.
async def test_set_hold(hass, mqtt_mock): """Test setting the hold mode.""" assert await async_setup_component(hass, CLIMATE_DOMAIN, DEFAULT_CONFIG) await hass.async_block_till_done() state = hass.states.get(ENTITY_CLIMATE) assert state.attributes.get("preset_mode") == "none" await common.async...
[ "async", "def", "test_set_hold", "(", "hass", ",", "mqtt_mock", ")", ":", "assert", "await", "async_setup_component", "(", "hass", ",", "CLIMATE_DOMAIN", ",", "DEFAULT_CONFIG", ")", "await", "hass", ".", "async_block_till_done", "(", ")", "state", "=", "hass", ...
[ 530, 0 ]
[ 552, 56 ]
python
en
['en', 'en', 'en']
True
test_set_preset_mode_twice
(hass, mqtt_mock)
Test setting of the same mode twice only publishes once.
Test setting of the same mode twice only publishes once.
async def test_set_preset_mode_twice(hass, mqtt_mock): """Test setting of the same mode twice only publishes once.""" assert await async_setup_component(hass, CLIMATE_DOMAIN, DEFAULT_CONFIG) await hass.async_block_till_done() state = hass.states.get(ENTITY_CLIMATE) assert state.attributes.get("pres...
[ "async", "def", "test_set_preset_mode_twice", "(", "hass", ",", "mqtt_mock", ")", ":", "assert", "await", "async_setup_component", "(", "hass", ",", "CLIMATE_DOMAIN", ",", "DEFAULT_CONFIG", ")", "await", "hass", ".", "async_block_till_done", "(", ")", "state", "="...
[ 555, 0 ]
[ 569, 47 ]
python
en
['en', 'en', 'en']
True
test_set_aux_pessimistic
(hass, mqtt_mock)
Test setting of the aux heating in pessimistic mode.
Test setting of the aux heating in pessimistic mode.
async def test_set_aux_pessimistic(hass, mqtt_mock): """Test setting of the aux heating in pessimistic mode.""" config = copy.deepcopy(DEFAULT_CONFIG) config["climate"]["aux_state_topic"] = "aux-state" assert await async_setup_component(hass, CLIMATE_DOMAIN, config) await hass.async_block_till_done(...
[ "async", "def", "test_set_aux_pessimistic", "(", "hass", ",", "mqtt_mock", ")", ":", "config", "=", "copy", ".", "deepcopy", "(", "DEFAULT_CONFIG", ")", "config", "[", "\"climate\"", "]", "[", "\"aux_state_topic\"", "]", "=", "\"aux-state\"", "assert", "await", ...
[ 572, 0 ]
[ 596, 52 ]
python
en
['en', 'en', 'en']
True
test_set_aux
(hass, mqtt_mock)
Test setting of the aux heating.
Test setting of the aux heating.
async def test_set_aux(hass, mqtt_mock): """Test setting of the aux heating.""" assert await async_setup_component(hass, CLIMATE_DOMAIN, DEFAULT_CONFIG) await hass.async_block_till_done() state = hass.states.get(ENTITY_CLIMATE) assert state.attributes.get("aux_heat") == "off" await common.async...
[ "async", "def", "test_set_aux", "(", "hass", ",", "mqtt_mock", ")", ":", "assert", "await", "async_setup_component", "(", "hass", ",", "CLIMATE_DOMAIN", ",", "DEFAULT_CONFIG", ")", "await", "hass", ".", "async_block_till_done", "(", ")", "state", "=", "hass", ...
[ 599, 0 ]
[ 615, 52 ]
python
en
['en', 'en', 'en']
True
test_availability_when_connection_lost
(hass, mqtt_mock)
Test availability after MQTT disconnection.
Test availability after MQTT disconnection.
async def test_availability_when_connection_lost(hass, mqtt_mock): """Test availability after MQTT disconnection.""" await help_test_availability_when_connection_lost( hass, mqtt_mock, CLIMATE_DOMAIN, DEFAULT_CONFIG )
[ "async", "def", "test_availability_when_connection_lost", "(", "hass", ",", "mqtt_mock", ")", ":", "await", "help_test_availability_when_connection_lost", "(", "hass", ",", "mqtt_mock", ",", "CLIMATE_DOMAIN", ",", "DEFAULT_CONFIG", ")" ]
[ 618, 0 ]
[ 622, 5 ]
python
en
['en', 'en', 'en']
True
test_availability_without_topic
(hass, mqtt_mock)
Test availability without defined availability topic.
Test availability without defined availability topic.
async def test_availability_without_topic(hass, mqtt_mock): """Test availability without defined availability topic.""" await help_test_availability_without_topic( hass, mqtt_mock, CLIMATE_DOMAIN, DEFAULT_CONFIG )
[ "async", "def", "test_availability_without_topic", "(", "hass", ",", "mqtt_mock", ")", ":", "await", "help_test_availability_without_topic", "(", "hass", ",", "mqtt_mock", ",", "CLIMATE_DOMAIN", ",", "DEFAULT_CONFIG", ")" ]
[ 625, 0 ]
[ 629, 5 ]
python
en
['en', 'en', 'en']
True
test_default_availability_payload
(hass, mqtt_mock)
Test availability by default payload with defined topic.
Test availability by default payload with defined topic.
async def test_default_availability_payload(hass, mqtt_mock): """Test availability by default payload with defined topic.""" await help_test_default_availability_payload( hass, mqtt_mock, CLIMATE_DOMAIN, DEFAULT_CONFIG )
[ "async", "def", "test_default_availability_payload", "(", "hass", ",", "mqtt_mock", ")", ":", "await", "help_test_default_availability_payload", "(", "hass", ",", "mqtt_mock", ",", "CLIMATE_DOMAIN", ",", "DEFAULT_CONFIG", ")" ]
[ 632, 0 ]
[ 636, 5 ]
python
en
['en', 'en', 'en']
True
test_custom_availability_payload
(hass, mqtt_mock)
Test availability by custom payload with defined topic.
Test availability by custom payload with defined topic.
async def test_custom_availability_payload(hass, mqtt_mock): """Test availability by custom payload with defined topic.""" await help_test_custom_availability_payload( hass, mqtt_mock, CLIMATE_DOMAIN, DEFAULT_CONFIG )
[ "async", "def", "test_custom_availability_payload", "(", "hass", ",", "mqtt_mock", ")", ":", "await", "help_test_custom_availability_payload", "(", "hass", ",", "mqtt_mock", ",", "CLIMATE_DOMAIN", ",", "DEFAULT_CONFIG", ")" ]
[ 639, 0 ]
[ 643, 5 ]
python
en
['en', 'en', 'en']
True
test_set_target_temperature_low_high_with_templates
(hass, mqtt_mock, caplog)
Test setting of temperature high/low templates.
Test setting of temperature high/low templates.
async def test_set_target_temperature_low_high_with_templates(hass, mqtt_mock, caplog): """Test setting of temperature high/low templates.""" config = copy.deepcopy(DEFAULT_CONFIG) config["climate"]["temperature_low_state_topic"] = "temperature-state" config["climate"]["temperature_high_state_topic"] = ...
[ "async", "def", "test_set_target_temperature_low_high_with_templates", "(", "hass", ",", "mqtt_mock", ",", "caplog", ")", ":", "config", "=", "copy", ".", "deepcopy", "(", "DEFAULT_CONFIG", ")", "config", "[", "\"climate\"", "]", "[", "\"temperature_low_state_topic\""...
[ 646, 0 ]
[ 677, 59 ]
python
en
['en', 'en', 'en']
True
test_set_with_templates
(hass, mqtt_mock, caplog)
Test setting of new fan mode in pessimistic mode.
Test setting of new fan mode in pessimistic mode.
async def test_set_with_templates(hass, mqtt_mock, caplog): """Test setting of new fan mode in pessimistic mode.""" config = copy.deepcopy(DEFAULT_CONFIG) # By default, just unquote the JSON-strings config["climate"]["value_template"] = "{{ value_json }}" config["climate"]["action_template"] = "{{ v...
[ "async", "def", "test_set_with_templates", "(", "hass", ",", "mqtt_mock", ",", "caplog", ")", ":", "config", "=", "copy", ".", "deepcopy", "(", "DEFAULT_CONFIG", ")", "# By default, just unquote the JSON-strings", "config", "[", "\"climate\"", "]", "[", "\"value_tem...
[ 680, 0 ]
[ 781, 56 ]
python
en
['en', 'en', 'en']
True
test_min_temp_custom
(hass, mqtt_mock)
Test a custom min temp.
Test a custom min temp.
async def test_min_temp_custom(hass, mqtt_mock): """Test a custom min temp.""" config = copy.deepcopy(DEFAULT_CONFIG) config["climate"]["min_temp"] = 26 assert await async_setup_component(hass, CLIMATE_DOMAIN, config) await hass.async_block_till_done() state = hass.states.get(ENTITY_CLIMATE) ...
[ "async", "def", "test_min_temp_custom", "(", "hass", ",", "mqtt_mock", ")", ":", "config", "=", "copy", ".", "deepcopy", "(", "DEFAULT_CONFIG", ")", "config", "[", "\"climate\"", "]", "[", "\"min_temp\"", "]", "=", "26", "assert", "await", "async_setup_compone...
[ 784, 0 ]
[ 796, 49 ]
python
en
['en', 'ga', 'en']
True
test_max_temp_custom
(hass, mqtt_mock)
Test a custom max temp.
Test a custom max temp.
async def test_max_temp_custom(hass, mqtt_mock): """Test a custom max temp.""" config = copy.deepcopy(DEFAULT_CONFIG) config["climate"]["max_temp"] = 60 assert await async_setup_component(hass, CLIMATE_DOMAIN, config) await hass.async_block_till_done() state = hass.states.get(ENTITY_CLIMATE) ...
[ "async", "def", "test_max_temp_custom", "(", "hass", ",", "mqtt_mock", ")", ":", "config", "=", "copy", ".", "deepcopy", "(", "DEFAULT_CONFIG", ")", "config", "[", "\"climate\"", "]", "[", "\"max_temp\"", "]", "=", "60", "assert", "await", "async_setup_compone...
[ 799, 0 ]
[ 811, 25 ]
python
en
['en', 'gd', 'en']
True
test_temp_step_custom
(hass, mqtt_mock)
Test a custom temp step.
Test a custom temp step.
async def test_temp_step_custom(hass, mqtt_mock): """Test a custom temp step.""" config = copy.deepcopy(DEFAULT_CONFIG) config["climate"]["temp_step"] = 0.01 assert await async_setup_component(hass, CLIMATE_DOMAIN, config) await hass.async_block_till_done() state = hass.states.get(ENTITY_CLIMA...
[ "async", "def", "test_temp_step_custom", "(", "hass", ",", "mqtt_mock", ")", ":", "config", "=", "copy", ".", "deepcopy", "(", "DEFAULT_CONFIG", ")", "config", "[", "\"climate\"", "]", "[", "\"temp_step\"", "]", "=", "0.01", "assert", "await", "async_setup_com...
[ 814, 0 ]
[ 826, 28 ]
python
en
['it', 'ga', 'en']
False
test_temperature_unit
(hass, mqtt_mock)
Test that setting temperature unit converts temperature values.
Test that setting temperature unit converts temperature values.
async def test_temperature_unit(hass, mqtt_mock): """Test that setting temperature unit converts temperature values.""" config = copy.deepcopy(DEFAULT_CONFIG) config["climate"]["temperature_unit"] = "F" config["climate"]["current_temperature_topic"] = "current_temperature" assert await async_setup_...
[ "async", "def", "test_temperature_unit", "(", "hass", ",", "mqtt_mock", ")", ":", "config", "=", "copy", ".", "deepcopy", "(", "DEFAULT_CONFIG", ")", "config", "[", "\"climate\"", "]", "[", "\"temperature_unit\"", "]", "=", "\"F\"", "config", "[", "\"climate\"...
[ 829, 0 ]
[ 841, 60 ]
python
en
['en', 'la', 'en']
True
test_setting_attribute_via_mqtt_json_message
(hass, mqtt_mock)
Test the setting of attribute via MQTT with JSON payload.
Test the setting of attribute via MQTT with JSON payload.
async def test_setting_attribute_via_mqtt_json_message(hass, mqtt_mock): """Test the setting of attribute via MQTT with JSON payload.""" await help_test_setting_attribute_via_mqtt_json_message( hass, mqtt_mock, CLIMATE_DOMAIN, DEFAULT_CONFIG )
[ "async", "def", "test_setting_attribute_via_mqtt_json_message", "(", "hass", ",", "mqtt_mock", ")", ":", "await", "help_test_setting_attribute_via_mqtt_json_message", "(", "hass", ",", "mqtt_mock", ",", "CLIMATE_DOMAIN", ",", "DEFAULT_CONFIG", ")" ]
[ 844, 0 ]
[ 848, 5 ]
python
en
['en', 'en', 'en']
True
test_setting_attribute_with_template
(hass, mqtt_mock)
Test the setting of attribute via MQTT with JSON payload.
Test the setting of attribute via MQTT with JSON payload.
async def test_setting_attribute_with_template(hass, mqtt_mock): """Test the setting of attribute via MQTT with JSON payload.""" await help_test_setting_attribute_with_template( hass, mqtt_mock, CLIMATE_DOMAIN, DEFAULT_CONFIG )
[ "async", "def", "test_setting_attribute_with_template", "(", "hass", ",", "mqtt_mock", ")", ":", "await", "help_test_setting_attribute_with_template", "(", "hass", ",", "mqtt_mock", ",", "CLIMATE_DOMAIN", ",", "DEFAULT_CONFIG", ")" ]
[ 851, 0 ]
[ 855, 5 ]
python
en
['en', 'en', 'en']
True
test_update_with_json_attrs_not_dict
(hass, mqtt_mock, caplog)
Test attributes get extracted from a JSON result.
Test attributes get extracted from a JSON result.
async def test_update_with_json_attrs_not_dict(hass, mqtt_mock, caplog): """Test attributes get extracted from a JSON result.""" await help_test_update_with_json_attrs_not_dict( hass, mqtt_mock, caplog, CLIMATE_DOMAIN, DEFAULT_CONFIG )
[ "async", "def", "test_update_with_json_attrs_not_dict", "(", "hass", ",", "mqtt_mock", ",", "caplog", ")", ":", "await", "help_test_update_with_json_attrs_not_dict", "(", "hass", ",", "mqtt_mock", ",", "caplog", ",", "CLIMATE_DOMAIN", ",", "DEFAULT_CONFIG", ")" ]
[ 858, 0 ]
[ 862, 5 ]
python
en
['en', 'en', 'en']
True
test_update_with_json_attrs_bad_JSON
(hass, mqtt_mock, caplog)
Test attributes get extracted from a JSON result.
Test attributes get extracted from a JSON result.
async def test_update_with_json_attrs_bad_JSON(hass, mqtt_mock, caplog): """Test attributes get extracted from a JSON result.""" await help_test_update_with_json_attrs_bad_JSON( hass, mqtt_mock, caplog, CLIMATE_DOMAIN, DEFAULT_CONFIG )
[ "async", "def", "test_update_with_json_attrs_bad_JSON", "(", "hass", ",", "mqtt_mock", ",", "caplog", ")", ":", "await", "help_test_update_with_json_attrs_bad_JSON", "(", "hass", ",", "mqtt_mock", ",", "caplog", ",", "CLIMATE_DOMAIN", ",", "DEFAULT_CONFIG", ")" ]
[ 865, 0 ]
[ 869, 5 ]
python
en
['en', 'en', 'en']
True
test_discovery_update_attr
(hass, mqtt_mock, caplog)
Test update of discovered MQTTAttributes.
Test update of discovered MQTTAttributes.
async def test_discovery_update_attr(hass, mqtt_mock, caplog): """Test update of discovered MQTTAttributes.""" await help_test_discovery_update_attr( hass, mqtt_mock, caplog, CLIMATE_DOMAIN, DEFAULT_CONFIG )
[ "async", "def", "test_discovery_update_attr", "(", "hass", ",", "mqtt_mock", ",", "caplog", ")", ":", "await", "help_test_discovery_update_attr", "(", "hass", ",", "mqtt_mock", ",", "caplog", ",", "CLIMATE_DOMAIN", ",", "DEFAULT_CONFIG", ")" ]
[ 872, 0 ]
[ 876, 5 ]
python
en
['en', 'en', 'en']
True
test_unique_id
(hass, mqtt_mock)
Test unique id option only creates one climate per unique_id.
Test unique id option only creates one climate per unique_id.
async def test_unique_id(hass, mqtt_mock): """Test unique id option only creates one climate per unique_id.""" config = { CLIMATE_DOMAIN: [ { "platform": "mqtt", "name": "Test 1", "power_state_topic": "test-topic", "power_comman...
[ "async", "def", "test_unique_id", "(", "hass", ",", "mqtt_mock", ")", ":", "config", "=", "{", "CLIMATE_DOMAIN", ":", "[", "{", "\"platform\"", ":", "\"mqtt\"", ",", "\"name\"", ":", "\"Test 1\"", ",", "\"power_state_topic\"", ":", "\"test-topic\"", ",", "\"po...
[ 879, 0 ]
[ 899, 70 ]
python
en
['en', 'fr', 'en']
True
test_discovery_removal_climate
(hass, mqtt_mock, caplog)
Test removal of discovered climate.
Test removal of discovered climate.
async def test_discovery_removal_climate(hass, mqtt_mock, caplog): """Test removal of discovered climate.""" data = json.dumps(DEFAULT_CONFIG[CLIMATE_DOMAIN]) await help_test_discovery_removal(hass, mqtt_mock, caplog, CLIMATE_DOMAIN, data)
[ "async", "def", "test_discovery_removal_climate", "(", "hass", ",", "mqtt_mock", ",", "caplog", ")", ":", "data", "=", "json", ".", "dumps", "(", "DEFAULT_CONFIG", "[", "CLIMATE_DOMAIN", "]", ")", "await", "help_test_discovery_removal", "(", "hass", ",", "mqtt_m...
[ 902, 0 ]
[ 905, 84 ]
python
en
['en', 'en', 'en']
True
test_discovery_update_climate
(hass, mqtt_mock, caplog)
Test update of discovered climate.
Test update of discovered climate.
async def test_discovery_update_climate(hass, mqtt_mock, caplog): """Test update of discovered climate.""" data1 = '{ "name": "Beer" }' data2 = '{ "name": "Milk" }' await help_test_discovery_update( hass, mqtt_mock, caplog, CLIMATE_DOMAIN, data1, data2 )
[ "async", "def", "test_discovery_update_climate", "(", "hass", ",", "mqtt_mock", ",", "caplog", ")", ":", "data1", "=", "'{ \"name\": \"Beer\" }'", "data2", "=", "'{ \"name\": \"Milk\" }'", "await", "help_test_discovery_update", "(", "hass", ",", "mqtt_mock", ",", "cap...
[ 908, 0 ]
[ 914, 5 ]
python
en
['en', 'en', 'en']
True
test_discovery_update_unchanged_climate
(hass, mqtt_mock, caplog)
Test update of discovered climate.
Test update of discovered climate.
async def test_discovery_update_unchanged_climate(hass, mqtt_mock, caplog): """Test update of discovered climate.""" data1 = '{ "name": "Beer" }' with patch( "homeassistant.components.mqtt.climate.MqttClimate.discovery_update" ) as discovery_update: await help_test_discovery_update_uncha...
[ "async", "def", "test_discovery_update_unchanged_climate", "(", "hass", ",", "mqtt_mock", ",", "caplog", ")", ":", "data1", "=", "'{ \"name\": \"Beer\" }'", "with", "patch", "(", "\"homeassistant.components.mqtt.climate.MqttClimate.discovery_update\"", ")", "as", "discovery_u...
[ 917, 0 ]
[ 925, 9 ]
python
en
['en', 'en', 'en']
True
test_discovery_broken
(hass, mqtt_mock, caplog)
Test handling of bad discovery message.
Test handling of bad discovery message.
async def test_discovery_broken(hass, mqtt_mock, caplog): """Test handling of bad discovery message.""" data1 = '{ "name": "Beer", "power_command_topic": "test_topic#" }' data2 = '{ "name": "Milk", "power_command_topic": "test_topic" }' await help_test_discovery_broken( hass, mqtt_mock, caplog, ...
[ "async", "def", "test_discovery_broken", "(", "hass", ",", "mqtt_mock", ",", "caplog", ")", ":", "data1", "=", "'{ \"name\": \"Beer\", \"power_command_topic\": \"test_topic#\" }'", "data2", "=", "'{ \"name\": \"Milk\", \"power_command_topic\": \"test_topic\" }'", "await", "help_t...
[ 929, 0 ]
[ 935, 5 ]
python
en
['en', 'en', 'en']
True
test_entity_device_info_with_connection
(hass, mqtt_mock)
Test MQTT climate device registry integration.
Test MQTT climate device registry integration.
async def test_entity_device_info_with_connection(hass, mqtt_mock): """Test MQTT climate device registry integration.""" await help_test_entity_device_info_with_connection( hass, mqtt_mock, CLIMATE_DOMAIN, DEFAULT_CONFIG )
[ "async", "def", "test_entity_device_info_with_connection", "(", "hass", ",", "mqtt_mock", ")", ":", "await", "help_test_entity_device_info_with_connection", "(", "hass", ",", "mqtt_mock", ",", "CLIMATE_DOMAIN", ",", "DEFAULT_CONFIG", ")" ]
[ 938, 0 ]
[ 942, 5 ]
python
da
['it', 'da', 'en']
False
test_entity_device_info_with_identifier
(hass, mqtt_mock)
Test MQTT climate device registry integration.
Test MQTT climate device registry integration.
async def test_entity_device_info_with_identifier(hass, mqtt_mock): """Test MQTT climate device registry integration.""" await help_test_entity_device_info_with_identifier( hass, mqtt_mock, CLIMATE_DOMAIN, DEFAULT_CONFIG )
[ "async", "def", "test_entity_device_info_with_identifier", "(", "hass", ",", "mqtt_mock", ")", ":", "await", "help_test_entity_device_info_with_identifier", "(", "hass", ",", "mqtt_mock", ",", "CLIMATE_DOMAIN", ",", "DEFAULT_CONFIG", ")" ]
[ 945, 0 ]
[ 949, 5 ]
python
da
['it', 'da', 'en']
False
test_entity_device_info_update
(hass, mqtt_mock)
Test device registry update.
Test device registry update.
async def test_entity_device_info_update(hass, mqtt_mock): """Test device registry update.""" await help_test_entity_device_info_update( hass, mqtt_mock, CLIMATE_DOMAIN, DEFAULT_CONFIG )
[ "async", "def", "test_entity_device_info_update", "(", "hass", ",", "mqtt_mock", ")", ":", "await", "help_test_entity_device_info_update", "(", "hass", ",", "mqtt_mock", ",", "CLIMATE_DOMAIN", ",", "DEFAULT_CONFIG", ")" ]
[ 952, 0 ]
[ 956, 5 ]
python
en
['fr', 'fy', 'en']
False
test_entity_device_info_remove
(hass, mqtt_mock)
Test device registry remove.
Test device registry remove.
async def test_entity_device_info_remove(hass, mqtt_mock): """Test device registry remove.""" await help_test_entity_device_info_remove( hass, mqtt_mock, CLIMATE_DOMAIN, DEFAULT_CONFIG )
[ "async", "def", "test_entity_device_info_remove", "(", "hass", ",", "mqtt_mock", ")", ":", "await", "help_test_entity_device_info_remove", "(", "hass", ",", "mqtt_mock", ",", "CLIMATE_DOMAIN", ",", "DEFAULT_CONFIG", ")" ]
[ 959, 0 ]
[ 963, 5 ]
python
en
['fr', 'en', 'en']
True
test_entity_id_update_subscriptions
(hass, mqtt_mock)
Test MQTT subscriptions are managed when entity_id is updated.
Test MQTT subscriptions are managed when entity_id is updated.
async def test_entity_id_update_subscriptions(hass, mqtt_mock): """Test MQTT subscriptions are managed when entity_id is updated.""" config = { CLIMATE_DOMAIN: { "platform": "mqtt", "name": "test", "mode_state_topic": "test-topic", "availability_topic": "a...
[ "async", "def", "test_entity_id_update_subscriptions", "(", "hass", ",", "mqtt_mock", ")", ":", "config", "=", "{", "CLIMATE_DOMAIN", ":", "{", "\"platform\"", ":", "\"mqtt\"", ",", "\"name\"", ":", "\"test\"", ",", "\"mode_state_topic\"", ":", "\"test-topic\"", "...
[ 966, 0 ]
[ 978, 5 ]
python
en
['en', 'en', 'en']
True
test_entity_id_update_discovery_update
(hass, mqtt_mock)
Test MQTT discovery update when entity_id is updated.
Test MQTT discovery update when entity_id is updated.
async def test_entity_id_update_discovery_update(hass, mqtt_mock): """Test MQTT discovery update when entity_id is updated.""" await help_test_entity_id_update_discovery_update( hass, mqtt_mock, CLIMATE_DOMAIN, DEFAULT_CONFIG )
[ "async", "def", "test_entity_id_update_discovery_update", "(", "hass", ",", "mqtt_mock", ")", ":", "await", "help_test_entity_id_update_discovery_update", "(", "hass", ",", "mqtt_mock", ",", "CLIMATE_DOMAIN", ",", "DEFAULT_CONFIG", ")" ]
[ 981, 0 ]
[ 985, 5 ]
python
en
['en', 'en', 'en']
True
test_entity_debug_info_message
(hass, mqtt_mock)
Test MQTT debug info.
Test MQTT debug info.
async def test_entity_debug_info_message(hass, mqtt_mock): """Test MQTT debug info.""" config = { CLIMATE_DOMAIN: { "platform": "mqtt", "name": "test", "mode_state_topic": "test-topic", } } await help_test_entity_debug_info_message( hass, mqtt_...
[ "async", "def", "test_entity_debug_info_message", "(", "hass", ",", "mqtt_mock", ")", ":", "config", "=", "{", "CLIMATE_DOMAIN", ":", "{", "\"platform\"", ":", "\"mqtt\"", ",", "\"name\"", ":", "\"test\"", ",", "\"mode_state_topic\"", ":", "\"test-topic\"", ",", ...
[ 988, 0 ]
[ 999, 5 ]
python
es
['es', 'mt', 'it']
False
test_precision_default
(hass, mqtt_mock)
Test that setting precision to tenths works as intended.
Test that setting precision to tenths works as intended.
async def test_precision_default(hass, mqtt_mock): """Test that setting precision to tenths works as intended.""" assert await async_setup_component(hass, CLIMATE_DOMAIN, DEFAULT_CONFIG) await hass.async_block_till_done() await common.async_set_temperature( hass, temperature=23.67, entity_id=EN...
[ "async", "def", "test_precision_default", "(", "hass", ",", "mqtt_mock", ")", ":", "assert", "await", "async_setup_component", "(", "hass", ",", "CLIMATE_DOMAIN", ",", "DEFAULT_CONFIG", ")", "await", "hass", ".", "async_block_till_done", "(", ")", "await", "common...
[ 1002, 0 ]
[ 1012, 40 ]
python
en
['en', 'en', 'en']
True
test_precision_halves
(hass, mqtt_mock)
Test that setting precision to halves works as intended.
Test that setting precision to halves works as intended.
async def test_precision_halves(hass, mqtt_mock): """Test that setting precision to halves works as intended.""" config = copy.deepcopy(DEFAULT_CONFIG) config["climate"]["precision"] = 0.5 assert await async_setup_component(hass, CLIMATE_DOMAIN, config) await hass.async_block_till_done() await ...
[ "async", "def", "test_precision_halves", "(", "hass", ",", "mqtt_mock", ")", ":", "config", "=", "copy", ".", "deepcopy", "(", "DEFAULT_CONFIG", ")", "config", "[", "\"climate\"", "]", "[", "\"precision\"", "]", "=", "0.5", "assert", "await", "async_setup_comp...
[ 1015, 0 ]
[ 1027, 40 ]
python
en
['en', 'en', 'en']
True
test_precision_whole
(hass, mqtt_mock)
Test that setting precision to whole works as intended.
Test that setting precision to whole works as intended.
async def test_precision_whole(hass, mqtt_mock): """Test that setting precision to whole works as intended.""" config = copy.deepcopy(DEFAULT_CONFIG) config["climate"]["precision"] = 1.0 assert await async_setup_component(hass, CLIMATE_DOMAIN, config) await hass.async_block_till_done() await co...
[ "async", "def", "test_precision_whole", "(", "hass", ",", "mqtt_mock", ")", ":", "config", "=", "copy", ".", "deepcopy", "(", "DEFAULT_CONFIG", ")", "config", "[", "\"climate\"", "]", "[", "\"precision\"", "]", "=", "1.0", "assert", "await", "async_setup_compo...
[ 1030, 0 ]
[ 1042, 40 ]
python
en
['en', 'en', 'en']
True
async_register_implementation
( hass: HomeAssistant, domain: str, implementation: AbstractOAuth2Implementation )
Register an OAuth2 flow implementation for an integration.
Register an OAuth2 flow implementation for an integration.
def async_register_implementation( hass: HomeAssistant, domain: str, implementation: AbstractOAuth2Implementation ) -> None: """Register an OAuth2 flow implementation for an integration.""" if isinstance(implementation, LocalOAuth2Implementation) and not hass.data.get( DATA_VIEW_REGISTERED, False ...
[ "def", "async_register_implementation", "(", "hass", ":", "HomeAssistant", ",", "domain", ":", "str", ",", "implementation", ":", "AbstractOAuth2Implementation", ")", "->", "None", ":", "if", "isinstance", "(", "implementation", ",", "LocalOAuth2Implementation", ")", ...
[ 320, 0 ]
[ 331, 82 ]
python
en
['en', 'en', 'en']
True
async_get_implementations
( hass: HomeAssistant, domain: str )
Return OAuth2 implementations for specified domain.
Return OAuth2 implementations for specified domain.
async def async_get_implementations( hass: HomeAssistant, domain: str ) -> Dict[str, AbstractOAuth2Implementation]: """Return OAuth2 implementations for specified domain.""" registered = cast( Dict[str, AbstractOAuth2Implementation], hass.data.setdefault(DATA_IMPLEMENTATIONS, {}).get(domain,...
[ "async", "def", "async_get_implementations", "(", "hass", ":", "HomeAssistant", ",", "domain", ":", "str", ")", "->", "Dict", "[", "str", ",", "AbstractOAuth2Implementation", "]", ":", "registered", "=", "cast", "(", "Dict", "[", "str", ",", "AbstractOAuth2Imp...
[ 334, 0 ]
[ 353, 21 ]
python
en
['en', 'en', 'en']
True
async_get_config_entry_implementation
( hass: HomeAssistant, config_entry: config_entries.ConfigEntry )
Return the implementation for this config entry.
Return the implementation for this config entry.
async def async_get_config_entry_implementation( hass: HomeAssistant, config_entry: config_entries.ConfigEntry ) -> AbstractOAuth2Implementation: """Return the implementation for this config entry.""" implementations = await async_get_implementations(hass, config_entry.domain) implementation = implement...
[ "async", "def", "async_get_config_entry_implementation", "(", "hass", ":", "HomeAssistant", ",", "config_entry", ":", "config_entries", ".", "ConfigEntry", ")", "->", "AbstractOAuth2Implementation", ":", "implementations", "=", "await", "async_get_implementations", "(", "...
[ 356, 0 ]
[ 366, 25 ]
python
en
['en', 'en', 'en']
True
async_add_implementation_provider
( hass: HomeAssistant, provider_domain: str, async_provide_implementation: Callable[ [HomeAssistant, str], Awaitable[Optional[AbstractOAuth2Implementation]] ], )
Add an implementation provider. If no implementation found, return None.
Add an implementation provider.
def async_add_implementation_provider( hass: HomeAssistant, provider_domain: str, async_provide_implementation: Callable[ [HomeAssistant, str], Awaitable[Optional[AbstractOAuth2Implementation]] ], ) -> None: """Add an implementation provider. If no implementation found, return None. ...
[ "def", "async_add_implementation_provider", "(", "hass", ":", "HomeAssistant", ",", "provider_domain", ":", "str", ",", "async_provide_implementation", ":", "Callable", "[", "[", "HomeAssistant", ",", "str", "]", ",", "Awaitable", "[", "Optional", "[", "AbstractOAut...
[ 370, 0 ]
[ 383, 36 ]
python
en
['en', 'en', 'en']
True
async_oauth2_request
( hass: HomeAssistant, token: dict, method: str, url: str, **kwargs: Any )
Make an OAuth2 authenticated request. This method will not refresh tokens. Use OAuth2 session for that.
Make an OAuth2 authenticated request.
async def async_oauth2_request( hass: HomeAssistant, token: dict, method: str, url: str, **kwargs: Any ) -> client.ClientResponse: """Make an OAuth2 authenticated request. This method will not refresh tokens. Use OAuth2 session for that. """ session = async_get_clientsession(hass) return await...
[ "async", "def", "async_oauth2_request", "(", "hass", ":", "HomeAssistant", ",", "token", ":", "dict", ",", "method", ":", "str", ",", "url", ":", "str", ",", "*", "*", "kwargs", ":", "Any", ")", "->", "client", ".", "ClientResponse", ":", "session", "=...
[ 465, 0 ]
[ 482, 5 ]
python
en
['en', 'en', 'en']
True
_encode_jwt
(hass: HomeAssistant, data: dict)
JWT encode data.
JWT encode data.
def _encode_jwt(hass: HomeAssistant, data: dict) -> str: """JWT encode data.""" secret = hass.data.get(DATA_JWT_SECRET) if secret is None: secret = hass.data[DATA_JWT_SECRET] = secrets.token_hex() return jwt.encode(data, secret, algorithm="HS256").decode()
[ "def", "_encode_jwt", "(", "hass", ":", "HomeAssistant", ",", "data", ":", "dict", ")", "->", "str", ":", "secret", "=", "hass", ".", "data", ".", "get", "(", "DATA_JWT_SECRET", ")", "if", "secret", "is", "None", ":", "secret", "=", "hass", ".", "dat...
[ 486, 0 ]
[ 493, 63 ]
python
fr
['fr', 'id', 'nl']
False
_decode_jwt
(hass: HomeAssistant, encoded: str)
JWT encode data.
JWT encode data.
def _decode_jwt(hass: HomeAssistant, encoded: str) -> Optional[dict]: """JWT encode data.""" secret = cast(str, hass.data.get(DATA_JWT_SECRET)) try: return jwt.decode(encoded, secret, algorithms=["HS256"]) except jwt.InvalidTokenError: return None
[ "def", "_decode_jwt", "(", "hass", ":", "HomeAssistant", ",", "encoded", ":", "str", ")", "->", "Optional", "[", "dict", "]", ":", "secret", "=", "cast", "(", "str", ",", "hass", ".", "data", ".", "get", "(", "DATA_JWT_SECRET", ")", ")", "try", ":", ...
[ 497, 0 ]
[ 504, 19 ]
python
fr
['fr', 'id', 'nl']
False
AbstractOAuth2Implementation.name
(self)
Name of the implementation.
Name of the implementation.
def name(self) -> str: """Name of the implementation."""
[ "def", "name", "(", "self", ")", "->", "str", ":" ]
[ 43, 4 ]
[ 44, 41 ]
python
en
['en', 'en', 'en']
True
AbstractOAuth2Implementation.domain
(self)
Domain that is providing the implementation.
Domain that is providing the implementation.
def domain(self) -> str: """Domain that is providing the implementation."""
[ "def", "domain", "(", "self", ")", "->", "str", ":" ]
[ 48, 4 ]
[ 49, 58 ]
python
en
['en', 'en', 'en']
True
AbstractOAuth2Implementation.async_generate_authorize_url
(self, flow_id: str)
Generate a url for the user to authorize. This step is called when a config flow is initialized. It should redirect the user to the vendor website where they can authorize Home Assistant. The implementation is responsible to get notified when the user is authorized and pass this to the...
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. This step is called when a config flow is initialized. It should redirect the user to the vendor website where they can authorize Home Assistant. The implementation is respon...
[ "async", "def", "async_generate_authorize_url", "(", "self", ",", "flow_id", ":", "str", ")", "->", "str", ":" ]
[ 52, 4 ]
[ 69, 11 ]
python
en
['en', 'en', 'en']
True
AbstractOAuth2Implementation.async_resolve_external_data
(self, external_data: Any)
Resolve external data to tokens. Turn the data that the implementation passed to the config flow as external step data into tokens. These tokens will be stored as 'token' in the config entry data.
Resolve external data to tokens.
async def async_resolve_external_data(self, external_data: Any) -> dict: """Resolve external data to tokens. Turn the data that the implementation passed to the config flow as external step data into tokens. These tokens will be stored as 'token' in the config entry data. """
[ "async", "def", "async_resolve_external_data", "(", "self", ",", "external_data", ":", "Any", ")", "->", "dict", ":" ]
[ 72, 4 ]
[ 78, 11 ]
python
en
['en', 'en', 'en']
True
AbstractOAuth2Implementation.async_refresh_token
(self, token: dict)
Refresh a token and update expires info.
Refresh a token and update expires info.
async def async_refresh_token(self, token: dict) -> dict: """Refresh a token and update expires info.""" new_token = await self._async_refresh_token(token) # Force int for non-compliant oauth2 providers new_token["expires_in"] = int(new_token["expires_in"]) new_token["expires_at"...
[ "async", "def", "async_refresh_token", "(", "self", ",", "token", ":", "dict", ")", "->", "dict", ":", "new_token", "=", "await", "self", ".", "_async_refresh_token", "(", "token", ")", "# Force int for non-compliant oauth2 providers", "new_token", "[", "\"expires_i...
[ 80, 4 ]
[ 86, 24 ]
python
en
['en', 'en', 'en']
True
AbstractOAuth2Implementation._async_refresh_token
(self, token: dict)
Refresh a token.
Refresh a token.
async def _async_refresh_token(self, token: dict) -> dict: """Refresh a token."""
[ "async", "def", "_async_refresh_token", "(", "self", ",", "token", ":", "dict", ")", "->", "dict", ":" ]
[ 89, 4 ]
[ 90, 30 ]
python
en
['en', 'gl', 'en']
True
LocalOAuth2Implementation.__init__
( self, hass: HomeAssistant, domain: str, client_id: str, client_secret: str, authorize_url: str, token_url: str, )
Initialize local auth implementation.
Initialize local auth implementation.
def __init__( self, hass: HomeAssistant, domain: str, client_id: str, client_secret: str, authorize_url: str, token_url: str, ): """Initialize local auth implementation.""" self.hass = hass self._domain = domain self.client_id =...
[ "def", "__init__", "(", "self", ",", "hass", ":", "HomeAssistant", ",", "domain", ":", "str", ",", "client_id", ":", "str", ",", "client_secret", ":", "str", ",", "authorize_url", ":", "str", ",", "token_url", ":", "str", ",", ")", ":", "self", ".", ...
[ 96, 4 ]
[ 111, 34 ]
python
en
['en', 'en', 'en']
True
LocalOAuth2Implementation.name
(self)
Name of the implementation.
Name of the implementation.
def name(self) -> str: """Name of the implementation.""" return "Configuration.yaml"
[ "def", "name", "(", "self", ")", "->", "str", ":", "return", "\"Configuration.yaml\"" ]
[ 114, 4 ]
[ 116, 35 ]
python
en
['en', 'en', 'en']
True
LocalOAuth2Implementation.domain
(self)
Domain providing the implementation.
Domain providing the implementation.
def domain(self) -> str: """Domain providing the implementation.""" return self._domain
[ "def", "domain", "(", "self", ")", "->", "str", ":", "return", "self", ".", "_domain" ]
[ 119, 4 ]
[ 121, 27 ]
python
en
['en', 'en', 'en']
True
LocalOAuth2Implementation.redirect_uri
(self)
Return the redirect uri.
Return the redirect uri.
def redirect_uri(self) -> str: """Return the redirect uri.""" return f"{get_url(self.hass, require_current_request=True)}{AUTH_CALLBACK_PATH}"
[ "def", "redirect_uri", "(", "self", ")", "->", "str", ":", "return", "f\"{get_url(self.hass, require_current_request=True)}{AUTH_CALLBACK_PATH}\"" ]
[ 124, 4 ]
[ 126, 88 ]
python
en
['en', 'hr', 'en']
True
LocalOAuth2Implementation.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: """Extra data that needs to be appended to the authorize url.""" return {}
[ "def", "extra_authorize_data", "(", "self", ")", "->", "dict", ":", "return", "{", "}" ]
[ 129, 4 ]
[ 131, 17 ]
python
en
['en', 'en', 'en']
True
LocalOAuth2Implementation.async_generate_authorize_url
(self, flow_id: str)
Generate a url for the user to authorize.
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.""" return str( URL(self.authorize_url) .with_query( { "response_type": "code", "client_id": self.client_id, ...
[ "async", "def", "async_generate_authorize_url", "(", "self", ",", "flow_id", ":", "str", ")", "->", "str", ":", "return", "str", "(", "URL", "(", "self", ".", "authorize_url", ")", ".", "with_query", "(", "{", "\"response_type\"", ":", "\"code\"", ",", "\"...
[ 133, 4 ]
[ 146, 9 ]
python
en
['en', 'en', 'en']
True
LocalOAuth2Implementation.async_resolve_external_data
(self, external_data: Any)
Resolve the authorization code to tokens.
Resolve the authorization code to tokens.
async def async_resolve_external_data(self, external_data: Any) -> dict: """Resolve the authorization code to tokens.""" return await self._token_request( { "grant_type": "authorization_code", "code": external_data, "redirect_uri": self.redirec...
[ "async", "def", "async_resolve_external_data", "(", "self", ",", "external_data", ":", "Any", ")", "->", "dict", ":", "return", "await", "self", ".", "_token_request", "(", "{", "\"grant_type\"", ":", "\"authorization_code\"", ",", "\"code\"", ":", "external_data"...
[ 148, 4 ]
[ 156, 9 ]
python
en
['en', 'en', 'en']
True
LocalOAuth2Implementation._async_refresh_token
(self, token: dict)
Refresh tokens.
Refresh tokens.
async def _async_refresh_token(self, token: dict) -> dict: """Refresh tokens.""" new_token = await self._token_request( { "grant_type": "refresh_token", "client_id": self.client_id, "refresh_token": token["refresh_token"], } ...
[ "async", "def", "_async_refresh_token", "(", "self", ",", "token", ":", "dict", ")", "->", "dict", ":", "new_token", "=", "await", "self", ".", "_token_request", "(", "{", "\"grant_type\"", ":", "\"refresh_token\"", ",", "\"client_id\"", ":", "self", ".", "c...
[ 158, 4 ]
[ 167, 37 ]
python
en
['en', 'en', 'en']
False
LocalOAuth2Implementation._token_request
(self, data: dict)
Make a token request.
Make a token request.
async def _token_request(self, data: dict) -> dict: """Make a token request.""" session = async_get_clientsession(self.hass) data["client_id"] = self.client_id if self.client_secret is not None: data["client_secret"] = self.client_secret resp = await session.post(s...
[ "async", "def", "_token_request", "(", "self", ",", "data", ":", "dict", ")", "->", "dict", ":", "session", "=", "async_get_clientsession", "(", "self", ".", "hass", ")", "data", "[", "\"client_id\"", "]", "=", "self", ".", "client_id", "if", "self", "."...
[ 169, 4 ]
[ 180, 44 ]
python
en
['en', 'de', 'en']
True
AbstractOAuth2FlowHandler.__init__
(self)
Instantiate config flow.
Instantiate config flow.
def __init__(self) -> None: """Instantiate config flow.""" if self.DOMAIN == "": raise TypeError( f"Can't instantiate class {self.__class__.__name__} without DOMAIN being set" ) self.external_data: Any = None self.flow_impl: AbstractOAuth2Implemen...
[ "def", "__init__", "(", "self", ")", "->", "None", ":", "if", "self", ".", "DOMAIN", "==", "\"\"", ":", "raise", "TypeError", "(", "f\"Can't instantiate class {self.__class__.__name__} without DOMAIN being set\"", ")", "self", ".", "external_data", ":", "Any", "=", ...
[ 191, 4 ]
[ 199, 59 ]
python
en
['en', 'nl', 'en']
True
AbstractOAuth2FlowHandler.logger
(self)
Return logger.
Return logger.
def logger(self) -> logging.Logger: """Return logger."""
[ "def", "logger", "(", "self", ")", "->", "logging", ".", "Logger", ":" ]
[ 203, 4 ]
[ 204, 28 ]
python
en
['es', 'no', 'en']
False
AbstractOAuth2FlowHandler.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: """Extra data that needs to be appended to the authorize url.""" return {}
[ "def", "extra_authorize_data", "(", "self", ")", "->", "dict", ":", "return", "{", "}" ]
[ 207, 4 ]
[ 209, 17 ]
python
en
['en', 'en', 'en']
True
AbstractOAuth2FlowHandler.async_step_pick_implementation
( self, user_input: Optional[dict] = None )
Handle a flow start.
Handle a flow start.
async def async_step_pick_implementation( self, user_input: Optional[dict] = None ) -> dict: """Handle a flow start.""" assert self.hass implementations = await async_get_implementations(self.hass, self.DOMAIN) if user_input is not None: self.flow_impl = implemen...
[ "async", "def", "async_step_pick_implementation", "(", "self", ",", "user_input", ":", "Optional", "[", "dict", "]", "=", "None", ")", "->", "dict", ":", "assert", "self", ".", "hass", "implementations", "=", "await", "async_get_implementations", "(", "self", ...
[ 211, 4 ]
[ 239, 9 ]
python
en
['en', 'lb', 'en']
True
AbstractOAuth2FlowHandler.async_step_auth
( self, user_input: Optional[Dict[str, Any]] = None )
Create an entry for auth.
Create an entry for auth.
async def async_step_auth( self, user_input: Optional[Dict[str, Any]] = None ) -> Dict[str, Any]: """Create an entry for auth.""" # Flow has been triggered by external data if user_input: self.external_data = user_input return self.async_external_step_done(nex...
[ "async", "def", "async_step_auth", "(", "self", ",", "user_input", ":", "Optional", "[", "Dict", "[", "str", ",", "Any", "]", "]", "=", "None", ")", "->", "Dict", "[", "str", ",", "Any", "]", ":", "# Flow has been triggered by external data", "if", "user_i...
[ 241, 4 ]
[ 265, 64 ]
python
en
['en', 'en', 'en']
True
AbstractOAuth2FlowHandler.async_step_creation
( self, user_input: Optional[Dict[str, Any]] = None )
Create config entry from external data.
Create config entry from external data.
async def async_step_creation( self, user_input: Optional[Dict[str, Any]] = None ) -> Dict[str, Any]: """Create config entry from external data.""" token = await self.flow_impl.async_resolve_external_data(self.external_data) # Force int for non-compliant oauth2 providers try:...
[ "async", "def", "async_step_creation", "(", "self", ",", "user_input", ":", "Optional", "[", "Dict", "[", "str", ",", "Any", "]", "]", "=", "None", ")", "->", "Dict", "[", "str", ",", "Any", "]", ":", "token", "=", "await", "self", ".", "flow_impl", ...
[ 267, 4 ]
[ 284, 9 ]
python
en
['en', 'en', 'en']
True
AbstractOAuth2FlowHandler.async_oauth_create_entry
(self, data: dict)
Create an entry for the flow. Ok to override if you want to fetch extra info or even add another step.
Create an entry for the flow.
async def async_oauth_create_entry(self, data: dict) -> dict: """Create an entry for the flow. Ok to override if you want to fetch extra info or even add another step. """ return self.async_create_entry(title=self.flow_impl.name, data=data)
[ "async", "def", "async_oauth_create_entry", "(", "self", ",", "data", ":", "dict", ")", "->", "dict", ":", "return", "self", ".", "async_create_entry", "(", "title", "=", "self", ".", "flow_impl", ".", "name", ",", "data", "=", "data", ")" ]
[ 286, 4 ]
[ 291, 76 ]
python
en
['en', 'en', 'en']
True
AbstractOAuth2FlowHandler.async_step_discovery
( self, discovery_info: Dict[str, Any] )
Handle a flow initialized by discovery.
Handle a flow initialized by discovery.
async def async_step_discovery( self, discovery_info: Dict[str, Any] ) -> Dict[str, Any]: """Handle a flow initialized by discovery.""" await self.async_set_unique_id(self.DOMAIN) assert self.hass is not None if self.hass.config_entries.async_entries(self.DOMAIN): ...
[ "async", "def", "async_step_discovery", "(", "self", ",", "discovery_info", ":", "Dict", "[", "str", ",", "Any", "]", ")", "->", "Dict", "[", "str", ",", "Any", "]", ":", "await", "self", ".", "async_set_unique_id", "(", "self", ".", "DOMAIN", ")", "as...
[ 293, 4 ]
[ 303, 58 ]
python
en
['en', 'en', 'en']
True
AbstractOAuth2FlowHandler.async_register_implementation
( cls, hass: HomeAssistant, local_impl: LocalOAuth2Implementation )
Register a local implementation.
Register a local implementation.
def async_register_implementation( cls, hass: HomeAssistant, local_impl: LocalOAuth2Implementation ) -> None: """Register a local implementation.""" async_register_implementation(hass, cls.DOMAIN, local_impl)
[ "def", "async_register_implementation", "(", "cls", ",", "hass", ":", "HomeAssistant", ",", "local_impl", ":", "LocalOAuth2Implementation", ")", "->", "None", ":", "async_register_implementation", "(", "hass", ",", "cls", ".", "DOMAIN", ",", "local_impl", ")" ]
[ 312, 4 ]
[ 316, 67 ]
python
en
['en', 'en', 'en']
True
OAuth2AuthorizeCallbackView.get
(self, request: web.Request)
Receive authorization code.
Receive authorization code.
async def get(self, request: web.Request) -> web.Response: """Receive authorization code.""" if "code" not in request.query or "state" not in request.query: return web.Response( text=f"Missing code or state parameter in {request.url}" ) hass = request.app...
[ "async", "def", "get", "(", "self", ",", "request", ":", "web", ".", "Request", ")", "->", "web", ".", "Response", ":", "if", "\"code\"", "not", "in", "request", ".", "query", "or", "\"state\"", "not", "in", "request", ".", "query", ":", "return", "w...
[ 393, 4 ]
[ 414, 9 ]
python
de
['de', 'sr', 'en']
False
OAuth2Session.__init__
( self, hass: HomeAssistant, config_entry: config_entries.ConfigEntry, implementation: AbstractOAuth2Implementation, )
Initialize an OAuth2 session.
Initialize an OAuth2 session.
def __init__( self, hass: HomeAssistant, config_entry: config_entries.ConfigEntry, implementation: AbstractOAuth2Implementation, ): """Initialize an OAuth2 session.""" self.hass = hass self.config_entry = config_entry self.implementation = implementati...
[ "def", "__init__", "(", "self", ",", "hass", ":", "HomeAssistant", ",", "config_entry", ":", "config_entries", ".", "ConfigEntry", ",", "implementation", ":", "AbstractOAuth2Implementation", ",", ")", ":", "self", ".", "hass", "=", "hass", "self", ".", "config...
[ 420, 4 ]
[ 429, 44 ]
python
en
['en', 'en', 'en']
True
OAuth2Session.token
(self)
Return the token.
Return the token.
def token(self) -> dict: """Return the token.""" return cast(dict, self.config_entry.data["token"])
[ "def", "token", "(", "self", ")", "->", "dict", ":", "return", "cast", "(", "dict", ",", "self", ".", "config_entry", ".", "data", "[", "\"token\"", "]", ")" ]
[ 432, 4 ]
[ 434, 58 ]
python
en
['en', 'no', 'en']
True
OAuth2Session.valid_token
(self)
Return if token is still valid.
Return if token is still valid.
def valid_token(self) -> bool: """Return if token is still valid.""" return ( cast(float, self.token["expires_at"]) > time.time() + CLOCK_OUT_OF_SYNC_MAX_SEC )
[ "def", "valid_token", "(", "self", ")", "->", "bool", ":", "return", "(", "cast", "(", "float", ",", "self", ".", "token", "[", "\"expires_at\"", "]", ")", ">", "time", ".", "time", "(", ")", "+", "CLOCK_OUT_OF_SYNC_MAX_SEC", ")" ]
[ 437, 4 ]
[ 442, 9 ]
python
en
['en', 'sv', 'en']
True
OAuth2Session.async_ensure_token_valid
(self)
Ensure that the current token is valid.
Ensure that the current token is valid.
async def async_ensure_token_valid(self) -> None: """Ensure that the current token is valid.""" if self.valid_token: return new_token = await self.implementation.async_refresh_token(self.token) self.hass.config_entries.async_update_entry( self.config_entry, data...
[ "async", "def", "async_ensure_token_valid", "(", "self", ")", "->", "None", ":", "if", "self", ".", "valid_token", ":", "return", "new_token", "=", "await", "self", ".", "implementation", ".", "async_refresh_token", "(", "self", ".", "token", ")", "self", "....
[ 444, 4 ]
[ 453, 9 ]
python
en
['en', 'en', 'en']
True
OAuth2Session.async_request
( self, method: str, url: str, **kwargs: Any )
Make a request.
Make a request.
async def async_request( self, method: str, url: str, **kwargs: Any ) -> client.ClientResponse: """Make a request.""" await self.async_ensure_token_valid() return await async_oauth2_request( self.hass, self.config_entry.data["token"], method, url, **kwargs )
[ "async", "def", "async_request", "(", "self", ",", "method", ":", "str", ",", "url", ":", "str", ",", "*", "*", "kwargs", ":", "Any", ")", "->", "client", ".", "ClientResponse", ":", "await", "self", ".", "async_ensure_token_valid", "(", ")", "return", ...
[ 455, 4 ]
[ 462, 9 ]
python
en
['en', 'co', 'en']
True
WLEDFlowHandler.async_step_user
( self, user_input: Optional[ConfigType] = None )
Handle a flow initiated by the user.
Handle a flow initiated by the user.
async def async_step_user( self, user_input: Optional[ConfigType] = None ) -> Dict[str, Any]: """Handle a flow initiated by the user.""" return await self._handle_config_flow(user_input)
[ "async", "def", "async_step_user", "(", "self", ",", "user_input", ":", "Optional", "[", "ConfigType", "]", "=", "None", ")", "->", "Dict", "[", "str", ",", "Any", "]", ":", "return", "await", "self", ".", "_handle_config_flow", "(", "user_input", ")" ]
[ 24, 4 ]
[ 28, 57 ]
python
en
['en', 'en', 'en']
True
WLEDFlowHandler.async_step_zeroconf
( self, user_input: Optional[ConfigType] = None )
Handle zeroconf discovery.
Handle zeroconf discovery.
async def async_step_zeroconf( self, user_input: Optional[ConfigType] = None ) -> Dict[str, Any]: """Handle zeroconf discovery.""" if user_input is None: return self.async_abort(reason="cannot_connect") # Hostname is format: wled-livingroom.local. host = user_inp...
[ "async", "def", "async_step_zeroconf", "(", "self", ",", "user_input", ":", "Optional", "[", "ConfigType", "]", "=", "None", ")", "->", "Dict", "[", "str", ",", "Any", "]", ":", "if", "user_input", "is", "None", ":", "return", "self", ".", "async_abort",...
[ 30, 4 ]
[ 52, 63 ]
python
de
['de', 'sr', 'en']
False