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
test_if_fires_on_entity_change_with_both_filters
(hass, calls)
Test for firing if both filters are a non match.
Test for firing if both filters are a non match.
async def test_if_fires_on_entity_change_with_both_filters(hass, calls): """Test for firing if both filters are a non match.""" assert await async_setup_component( hass, automation.DOMAIN, { automation.DOMAIN: { "trigger": { "platform": "st...
[ "async", "def", "test_if_fires_on_entity_change_with_both_filters", "(", "hass", ",", "calls", ")", ":", "assert", "await", "async_setup_component", "(", "hass", ",", "automation", ".", "DOMAIN", ",", "{", "automation", ".", "DOMAIN", ":", "{", "\"trigger\"", ":",...
[ 153, 0 ]
[ 174, 26 ]
python
en
['en', 'en', 'en']
True
test_if_not_fires_if_to_filter_not_match
(hass, calls)
Test for not firing if to filter is not a match.
Test for not firing if to filter is not a match.
async def test_if_not_fires_if_to_filter_not_match(hass, calls): """Test for not firing if to filter is not a match.""" assert await async_setup_component( hass, automation.DOMAIN, { automation.DOMAIN: { "trigger": { "platform": "state", ...
[ "async", "def", "test_if_not_fires_if_to_filter_not_match", "(", "hass", ",", "calls", ")", ":", "assert", "await", "async_setup_component", "(", "hass", ",", "automation", ".", "DOMAIN", ",", "{", "automation", ".", "DOMAIN", ":", "{", "\"trigger\"", ":", "{", ...
[ 177, 0 ]
[ 198, 26 ]
python
en
['en', 'en', 'en']
True
test_if_not_fires_if_from_filter_not_match
(hass, calls)
Test for not firing if from filter is not a match.
Test for not firing if from filter is not a match.
async def test_if_not_fires_if_from_filter_not_match(hass, calls): """Test for not firing if from filter is not a match.""" hass.states.async_set("test.entity", "bye") assert await async_setup_component( hass, automation.DOMAIN, { automation.DOMAIN: { "tr...
[ "async", "def", "test_if_not_fires_if_from_filter_not_match", "(", "hass", ",", "calls", ")", ":", "hass", ".", "states", ".", "async_set", "(", "\"test.entity\"", ",", "\"bye\"", ")", "assert", "await", "async_setup_component", "(", "hass", ",", "automation", "."...
[ 201, 0 ]
[ 224, 26 ]
python
en
['en', 'en', 'en']
True
test_if_not_fires_if_entity_not_match
(hass, calls)
Test for not firing if entity is not matching.
Test for not firing if entity is not matching.
async def test_if_not_fires_if_entity_not_match(hass, calls): """Test for not firing if entity is not matching.""" assert await async_setup_component( hass, automation.DOMAIN, { automation.DOMAIN: { "trigger": {"platform": "state", "entity_id": "test.another_e...
[ "async", "def", "test_if_not_fires_if_entity_not_match", "(", "hass", ",", "calls", ")", ":", "assert", "await", "async_setup_component", "(", "hass", ",", "automation", ".", "DOMAIN", ",", "{", "automation", ".", "DOMAIN", ":", "{", "\"trigger\"", ":", "{", "...
[ 227, 0 ]
[ 243, 26 ]
python
en
['en', 'en', 'en']
True
test_if_action
(hass, calls)
Test for to action.
Test for to action.
async def test_if_action(hass, calls): """Test for to action.""" entity_id = "domain.test_entity" test_state = "new_state" assert await async_setup_component( hass, automation.DOMAIN, { automation.DOMAIN: { "trigger": {"platform": "event", "event_type"...
[ "async", "def", "test_if_action", "(", "hass", ",", "calls", ")", ":", "entity_id", "=", "\"domain.test_entity\"", "test_state", "=", "\"new_state\"", "assert", "await", "async_setup_component", "(", "hass", ",", "automation", ".", "DOMAIN", ",", "{", "automation"...
[ 246, 0 ]
[ 275, 26 ]
python
en
['en', 'en', 'en']
True
test_if_fails_setup_if_to_boolean_value
(hass, calls)
Test for setup failure for boolean to.
Test for setup failure for boolean to.
async def test_if_fails_setup_if_to_boolean_value(hass, calls): """Test for setup failure for boolean to.""" with assert_setup_component(0, automation.DOMAIN): assert await async_setup_component( hass, automation.DOMAIN, { automation.DOMAIN: { ...
[ "async", "def", "test_if_fails_setup_if_to_boolean_value", "(", "hass", ",", "calls", ")", ":", "with", "assert_setup_component", "(", "0", ",", "automation", ".", "DOMAIN", ")", ":", "assert", "await", "async_setup_component", "(", "hass", ",", "automation", ".",...
[ 278, 0 ]
[ 294, 9 ]
python
en
['en', 'en', 'en']
True
test_if_fails_setup_if_from_boolean_value
(hass, calls)
Test for setup failure for boolean from.
Test for setup failure for boolean from.
async def test_if_fails_setup_if_from_boolean_value(hass, calls): """Test for setup failure for boolean from.""" with assert_setup_component(0, automation.DOMAIN): assert await async_setup_component( hass, automation.DOMAIN, { automation.DOMAIN: { ...
[ "async", "def", "test_if_fails_setup_if_from_boolean_value", "(", "hass", ",", "calls", ")", ":", "with", "assert_setup_component", "(", "0", ",", "automation", ".", "DOMAIN", ")", ":", "assert", "await", "async_setup_component", "(", "hass", ",", "automation", "....
[ 297, 0 ]
[ 313, 9 ]
python
en
['en', 'en', 'en']
True
test_if_fails_setup_bad_for
(hass, calls)
Test for setup failure for bad for.
Test for setup failure for bad for.
async def test_if_fails_setup_bad_for(hass, calls): """Test for setup failure for bad for.""" assert await async_setup_component( hass, automation.DOMAIN, { automation.DOMAIN: { "trigger": { "platform": "state", "entity_...
[ "async", "def", "test_if_fails_setup_bad_for", "(", "hass", ",", "calls", ")", ":", "assert", "await", "async_setup_component", "(", "hass", ",", "automation", ".", "DOMAIN", ",", "{", "automation", ".", "DOMAIN", ":", "{", "\"trigger\"", ":", "{", "\"platform...
[ 316, 0 ]
[ 337, 39 ]
python
en
['en', 'en', 'en']
True
test_if_not_fires_on_entity_change_with_for
(hass, calls)
Test for not firing on entity change with for.
Test for not firing on entity change with for.
async def test_if_not_fires_on_entity_change_with_for(hass, calls): """Test for not firing on entity change with for.""" assert await async_setup_component( hass, automation.DOMAIN, { automation.DOMAIN: { "trigger": { "platform": "state", ...
[ "async", "def", "test_if_not_fires_on_entity_change_with_for", "(", "hass", ",", "calls", ")", ":", "assert", "await", "async_setup_component", "(", "hass", ",", "automation", ".", "DOMAIN", ",", "{", "automation", ".", "DOMAIN", ":", "{", "\"trigger\"", ":", "{...
[ 340, 0 ]
[ 365, 26 ]
python
en
['en', 'en', 'en']
True
test_if_not_fires_on_entities_change_with_for_after_stop
(hass, calls)
Test for not firing on entity change with for after stop trigger.
Test for not firing on entity change with for after stop trigger.
async def test_if_not_fires_on_entities_change_with_for_after_stop(hass, calls): """Test for not firing on entity change with for after stop trigger.""" assert await async_setup_component( hass, automation.DOMAIN, { automation.DOMAIN: { "trigger": { ...
[ "async", "def", "test_if_not_fires_on_entities_change_with_for_after_stop", "(", "hass", ",", "calls", ")", ":", "assert", "await", "async_setup_component", "(", "hass", ",", "automation", ".", "DOMAIN", ",", "{", "automation", ".", "DOMAIN", ":", "{", "\"trigger\""...
[ 368, 0 ]
[ 409, 26 ]
python
en
['en', 'en', 'en']
True
test_if_fires_on_entity_change_with_for_attribute_change
(hass, calls)
Test for firing on entity change with for and attribute change.
Test for firing on entity change with for and attribute change.
async def test_if_fires_on_entity_change_with_for_attribute_change(hass, calls): """Test for firing on entity change with for and attribute change.""" assert await async_setup_component( hass, automation.DOMAIN, { automation.DOMAIN: { "trigger": { ...
[ "async", "def", "test_if_fires_on_entity_change_with_for_attribute_change", "(", "hass", ",", "calls", ")", ":", "assert", "await", "async_setup_component", "(", "hass", ",", "automation", ".", "DOMAIN", ",", "{", "automation", ".", "DOMAIN", ":", "{", "\"trigger\""...
[ 412, 0 ]
[ 446, 30 ]
python
en
['en', 'en', 'en']
True
test_if_fires_on_entity_change_with_for_multiple_force_update
(hass, calls)
Test for firing on entity change with for and force update.
Test for firing on entity change with for and force update.
async def test_if_fires_on_entity_change_with_for_multiple_force_update(hass, calls): """Test for firing on entity change with for and force update.""" assert await async_setup_component( hass, automation.DOMAIN, { automation.DOMAIN: { "trigger": { ...
[ "async", "def", "test_if_fires_on_entity_change_with_for_multiple_force_update", "(", "hass", ",", "calls", ")", ":", "assert", "await", "async_setup_component", "(", "hass", ",", "automation", ".", "DOMAIN", ",", "{", "automation", ".", "DOMAIN", ":", "{", "\"trigg...
[ 449, 0 ]
[ 482, 30 ]
python
en
['en', 'en', 'en']
True
test_if_fires_on_entity_change_with_for
(hass, calls)
Test for firing on entity change with for.
Test for firing on entity change with for.
async def test_if_fires_on_entity_change_with_for(hass, calls): """Test for firing on entity change with for.""" assert await async_setup_component( hass, automation.DOMAIN, { automation.DOMAIN: { "trigger": { "platform": "state", ...
[ "async", "def", "test_if_fires_on_entity_change_with_for", "(", "hass", ",", "calls", ")", ":", "assert", "await", "async_setup_component", "(", "hass", ",", "automation", ".", "DOMAIN", ",", "{", "automation", ".", "DOMAIN", ":", "{", "\"trigger\"", ":", "{", ...
[ 485, 0 ]
[ 508, 26 ]
python
en
['en', 'en', 'en']
True
test_if_fires_on_entity_change_with_for_without_to
(hass, calls)
Test for firing on entity change with for.
Test for firing on entity change with for.
async def test_if_fires_on_entity_change_with_for_without_to(hass, calls): """Test for firing on entity change with for.""" assert await async_setup_component( hass, automation.DOMAIN, { automation.DOMAIN: { "trigger": { "platform": "state"...
[ "async", "def", "test_if_fires_on_entity_change_with_for_without_to", "(", "hass", ",", "calls", ")", ":", "assert", "await", "async_setup_component", "(", "hass", ",", "automation", ".", "DOMAIN", ",", "{", "automation", ".", "DOMAIN", ":", "{", "\"trigger\"", ":...
[ 511, 0 ]
[ 545, 26 ]
python
en
['en', 'en', 'en']
True
test_if_does_not_fires_on_entity_change_with_for_without_to_2
(hass, calls)
Test for firing on entity change with for.
Test for firing on entity change with for.
async def test_if_does_not_fires_on_entity_change_with_for_without_to_2(hass, calls): """Test for firing on entity change with for.""" assert await async_setup_component( hass, automation.DOMAIN, { automation.DOMAIN: { "trigger": { "platfor...
[ "async", "def", "test_if_does_not_fires_on_entity_change_with_for_without_to_2", "(", "hass", ",", "calls", ")", ":", "assert", "await", "async_setup_component", "(", "hass", ",", "automation", ".", "DOMAIN", ",", "{", "automation", ".", "DOMAIN", ":", "{", "\"trigg...
[ 548, 0 ]
[ 578, 26 ]
python
en
['en', 'en', 'en']
True
test_if_fires_on_entity_creation_and_removal
(hass, calls)
Test for firing on entity creation and removal, with to/from constraints.
Test for firing on entity creation and removal, with to/from constraints.
async def test_if_fires_on_entity_creation_and_removal(hass, calls): """Test for firing on entity creation and removal, with to/from constraints.""" # set automations for multiple combinations to/from assert await async_setup_component( hass, automation.DOMAIN, { automati...
[ "async", "def", "test_if_fires_on_entity_creation_and_removal", "(", "hass", ",", "calls", ")", ":", "# set automations for multiple combinations to/from", "assert", "await", "async_setup_component", "(", "hass", ",", "automation", ".", "DOMAIN", ",", "{", "automation", "...
[ 581, 0 ]
[ 643, 53 ]
python
en
['en', 'en', 'en']
True
test_if_fires_on_for_condition
(hass, calls)
Test for firing if condition is on.
Test for firing if condition is on.
async def test_if_fires_on_for_condition(hass, calls): """Test for firing if condition is on.""" point1 = dt_util.utcnow() point2 = point1 + timedelta(seconds=10) with patch("homeassistant.core.dt_util.utcnow") as mock_utcnow: mock_utcnow.return_value = point1 hass.states.async_set("test...
[ "async", "def", "test_if_fires_on_for_condition", "(", "hass", ",", "calls", ")", ":", "point1", "=", "dt_util", ".", "utcnow", "(", ")", "point2", "=", "point1", "+", "timedelta", "(", "seconds", "=", "10", ")", "with", "patch", "(", "\"homeassistant.core.d...
[ 646, 0 ]
[ 680, 30 ]
python
en
['en', 'en', 'en']
True
test_if_fires_on_for_condition_attribute_change
(hass, calls)
Test for firing if condition is on with attribute change.
Test for firing if condition is on with attribute change.
async def test_if_fires_on_for_condition_attribute_change(hass, calls): """Test for firing if condition is on with attribute change.""" point1 = dt_util.utcnow() point2 = point1 + timedelta(seconds=4) point3 = point1 + timedelta(seconds=8) with patch("homeassistant.core.dt_util.utcnow") as mock_utcn...
[ "async", "def", "test_if_fires_on_for_condition_attribute_change", "(", "hass", ",", "calls", ")", ":", "point1", "=", "dt_util", ".", "utcnow", "(", ")", "point2", "=", "point1", "+", "timedelta", "(", "seconds", "=", "4", ")", "point3", "=", "point1", "+",...
[ 683, 0 ]
[ 727, 30 ]
python
en
['en', 'en', 'en']
True
test_if_fails_setup_for_without_time
(hass, calls)
Test for setup failure if no time is provided.
Test for setup failure if no time is provided.
async def test_if_fails_setup_for_without_time(hass, calls): """Test for setup failure if no time is provided.""" with assert_setup_component(0, automation.DOMAIN): assert await async_setup_component( hass, automation.DOMAIN, { automation.DOMAIN: { ...
[ "async", "def", "test_if_fails_setup_for_without_time", "(", "hass", ",", "calls", ")", ":", "with", "assert_setup_component", "(", "0", ",", "automation", ".", "DOMAIN", ")", ":", "assert", "await", "async_setup_component", "(", "hass", ",", "automation", ".", ...
[ 730, 0 ]
[ 748, 9 ]
python
en
['en', 'en', 'en']
True
test_if_fails_setup_for_without_entity
(hass, calls)
Test for setup failure if no entity is provided.
Test for setup failure if no entity is provided.
async def test_if_fails_setup_for_without_entity(hass, calls): """Test for setup failure if no entity is provided.""" with assert_setup_component(0, automation.DOMAIN): assert await async_setup_component( hass, automation.DOMAIN, { automation.DOMAIN: {...
[ "async", "def", "test_if_fails_setup_for_without_entity", "(", "hass", ",", "calls", ")", ":", "with", "assert_setup_component", "(", "0", ",", "automation", ".", "DOMAIN", ")", ":", "assert", "await", "async_setup_component", "(", "hass", ",", "automation", ".", ...
[ 751, 0 ]
[ 768, 9 ]
python
en
['en', 'en', 'en']
True
test_wait_template_with_trigger
(hass, calls)
Test using wait template with 'trigger.entity_id'.
Test using wait template with 'trigger.entity_id'.
async def test_wait_template_with_trigger(hass, calls): """Test using wait template with 'trigger.entity_id'.""" assert await async_setup_component( hass, automation.DOMAIN, { automation.DOMAIN: { "trigger": { "platform": "state", ...
[ "async", "def", "test_wait_template_with_trigger", "(", "hass", ",", "calls", ")", ":", "assert", "await", "async_setup_component", "(", "hass", ",", "automation", ".", "DOMAIN", ",", "{", "automation", ".", "DOMAIN", ":", "{", "\"trigger\"", ":", "{", "\"plat...
[ 771, 0 ]
[ 810, 73 ]
python
en
['en', 'en', 'en']
True
test_if_fires_on_entities_change_no_overlap
(hass, calls)
Test for firing on entities change with no overlap.
Test for firing on entities change with no overlap.
async def test_if_fires_on_entities_change_no_overlap(hass, calls): """Test for firing on entities change with no overlap.""" assert await async_setup_component( hass, automation.DOMAIN, { automation.DOMAIN: { "trigger": { "platform": "stat...
[ "async", "def", "test_if_fires_on_entities_change_no_overlap", "(", "hass", ",", "calls", ")", ":", "assert", "await", "async_setup_component", "(", "hass", ",", "automation", ".", "DOMAIN", ",", "{", "automation", ".", "DOMAIN", ":", "{", "\"trigger\"", ":", "{...
[ 813, 0 ]
[ 852, 55 ]
python
en
['en', 'en', 'en']
True
test_if_fires_on_entities_change_overlap
(hass, calls)
Test for firing on entities change with overlap.
Test for firing on entities change with overlap.
async def test_if_fires_on_entities_change_overlap(hass, calls): """Test for firing on entities change with overlap.""" assert await async_setup_component( hass, automation.DOMAIN, { automation.DOMAIN: { "trigger": { "platform": "state", ...
[ "async", "def", "test_if_fires_on_entities_change_overlap", "(", "hass", ",", "calls", ")", ":", "assert", "await", "async_setup_component", "(", "hass", ",", "automation", ".", "DOMAIN", ",", "{", "automation", ".", "DOMAIN", ":", "{", "\"trigger\"", ":", "{", ...
[ 855, 0 ]
[ 905, 55 ]
python
en
['en', 'en', 'en']
True
test_if_fires_on_change_with_for_template_1
(hass, calls)
Test for firing on change with for template.
Test for firing on change with for template.
async def test_if_fires_on_change_with_for_template_1(hass, calls): """Test for firing on change with for template.""" assert await async_setup_component( hass, automation.DOMAIN, { automation.DOMAIN: { "trigger": { "platform": "state", ...
[ "async", "def", "test_if_fires_on_change_with_for_template_1", "(", "hass", ",", "calls", ")", ":", "assert", "await", "async_setup_component", "(", "hass", ",", "automation", ".", "DOMAIN", ",", "{", "automation", ".", "DOMAIN", ":", "{", "\"trigger\"", ":", "{...
[ 908, 0 ]
[ 931, 26 ]
python
en
['en', 'en', 'en']
True
test_if_fires_on_change_with_for_template_2
(hass, calls)
Test for firing on change with for template.
Test for firing on change with for template.
async def test_if_fires_on_change_with_for_template_2(hass, calls): """Test for firing on change with for template.""" assert await async_setup_component( hass, automation.DOMAIN, { automation.DOMAIN: { "trigger": { "platform": "state", ...
[ "async", "def", "test_if_fires_on_change_with_for_template_2", "(", "hass", ",", "calls", ")", ":", "assert", "await", "async_setup_component", "(", "hass", ",", "automation", ".", "DOMAIN", ",", "{", "automation", ".", "DOMAIN", ":", "{", "\"trigger\"", ":", "{...
[ 934, 0 ]
[ 957, 26 ]
python
en
['en', 'en', 'en']
True
test_if_fires_on_change_with_for_template_3
(hass, calls)
Test for firing on change with for template.
Test for firing on change with for template.
async def test_if_fires_on_change_with_for_template_3(hass, calls): """Test for firing on change with for template.""" assert await async_setup_component( hass, automation.DOMAIN, { automation.DOMAIN: { "trigger": { "platform": "state", ...
[ "async", "def", "test_if_fires_on_change_with_for_template_3", "(", "hass", ",", "calls", ")", ":", "assert", "await", "async_setup_component", "(", "hass", ",", "automation", ".", "DOMAIN", ",", "{", "automation", ".", "DOMAIN", ":", "{", "\"trigger\"", ":", "{...
[ 960, 0 ]
[ 983, 26 ]
python
en
['en', 'en', 'en']
True
test_if_fires_on_change_from_with_for
(hass, calls)
Test for firing on change with from/for.
Test for firing on change with from/for.
async def test_if_fires_on_change_from_with_for(hass, calls): """Test for firing on change with from/for.""" assert await async_setup_component( hass, automation.DOMAIN, { automation.DOMAIN: { "trigger": { "platform": "state", ...
[ "async", "def", "test_if_fires_on_change_from_with_for", "(", "hass", ",", "calls", ")", ":", "assert", "await", "async_setup_component", "(", "hass", ",", "automation", ".", "DOMAIN", ",", "{", "automation", ".", "DOMAIN", ":", "{", "\"trigger\"", ":", "{", "...
[ 986, 0 ]
[ 1012, 26 ]
python
en
['en', 'en', 'en']
True
test_if_not_fires_on_change_from_with_for
(hass, calls)
Test for firing on change with from/for.
Test for firing on change with from/for.
async def test_if_not_fires_on_change_from_with_for(hass, calls): """Test for firing on change with from/for.""" assert await async_setup_component( hass, automation.DOMAIN, { automation.DOMAIN: { "trigger": { "platform": "state", ...
[ "async", "def", "test_if_not_fires_on_change_from_with_for", "(", "hass", ",", "calls", ")", ":", "assert", "await", "async_setup_component", "(", "hass", ",", "automation", ".", "DOMAIN", ",", "{", "automation", ".", "DOMAIN", ":", "{", "\"trigger\"", ":", "{",...
[ 1015, 0 ]
[ 1041, 26 ]
python
en
['en', 'en', 'en']
True
test_invalid_for_template_1
(hass, calls)
Test for invalid for template.
Test for invalid for template.
async def test_invalid_for_template_1(hass, calls): """Test for invalid for template.""" assert await async_setup_component( hass, automation.DOMAIN, { automation.DOMAIN: { "trigger": { "platform": "state", "entity_id": ...
[ "async", "def", "test_invalid_for_template_1", "(", "hass", ",", "calls", ")", ":", "assert", "await", "async_setup_component", "(", "hass", ",", "automation", ".", "DOMAIN", ",", "{", "automation", ".", "DOMAIN", ":", "{", "\"trigger\"", ":", "{", "\"platform...
[ 1044, 0 ]
[ 1065, 39 ]
python
en
['en', 'en', 'en']
True
test_if_fires_on_entities_change_overlap_for_template
(hass, calls)
Test for firing on entities change with overlap and for template.
Test for firing on entities change with overlap and for template.
async def test_if_fires_on_entities_change_overlap_for_template(hass, calls): """Test for firing on entities change with overlap and for template.""" assert await async_setup_component( hass, automation.DOMAIN, { automation.DOMAIN: { "trigger": { ...
[ "async", "def", "test_if_fires_on_entities_change_overlap_for_template", "(", "hass", ",", "calls", ")", ":", "assert", "await", "async_setup_component", "(", "hass", ",", "automation", ".", "DOMAIN", ",", "{", "automation", ".", "DOMAIN", ":", "{", "\"trigger\"", ...
[ 1068, 0 ]
[ 1125, 65 ]
python
en
['en', 'en', 'en']
True
test_attribute_if_fires_on_entity_change_with_both_filters
(hass, calls)
Test for firing if both filters are match attribute.
Test for firing if both filters are match attribute.
async def test_attribute_if_fires_on_entity_change_with_both_filters(hass, calls): """Test for firing if both filters are match attribute.""" hass.states.async_set("test.entity", "bla", {"name": "hello"}) assert await async_setup_component( hass, automation.DOMAIN, { aut...
[ "async", "def", "test_attribute_if_fires_on_entity_change_with_both_filters", "(", "hass", ",", "calls", ")", ":", "hass", ".", "states", ".", "async_set", "(", "\"test.entity\"", ",", "\"bla\"", ",", "{", "\"name\"", ":", "\"hello\"", "}", ")", "assert", "await",...
[ 1128, 0 ]
[ 1152, 26 ]
python
en
['en', 'en', 'en']
True
test_attribute_if_fires_on_entity_where_attr_stays_constant
(hass, calls)
Test for firing if attribute stays the same.
Test for firing if attribute stays the same.
async def test_attribute_if_fires_on_entity_where_attr_stays_constant(hass, calls): """Test for firing if attribute stays the same.""" hass.states.async_set("test.entity", "bla", {"name": "hello", "other": "old_value"}) assert await async_setup_component( hass, automation.DOMAIN, { ...
[ "async", "def", "test_attribute_if_fires_on_entity_where_attr_stays_constant", "(", "hass", ",", "calls", ")", ":", "hass", ".", "states", ".", "async_set", "(", "\"test.entity\"", ",", "\"bla\"", ",", "{", "\"name\"", ":", "\"hello\"", ",", "\"other\"", ":", "\"o...
[ 1155, 0 ]
[ 1188, 26 ]
python
en
['en', 'en', 'en']
True
test_attribute_if_not_fires_on_entities_change_with_for_after_stop
( hass, calls )
Test for not firing on entity change with for after stop trigger.
Test for not firing on entity change with for after stop trigger.
async def test_attribute_if_not_fires_on_entities_change_with_for_after_stop( hass, calls ): """Test for not firing on entity change with for after stop trigger.""" hass.states.async_set("test.entity", "bla", {"name": "hello"}) assert await async_setup_component( hass, automation.DOMAIN...
[ "async", "def", "test_attribute_if_not_fires_on_entities_change_with_for_after_stop", "(", "hass", ",", "calls", ")", ":", "hass", ".", "states", ".", "async_set", "(", "\"test.entity\"", ",", "\"bla\"", ",", "{", "\"name\"", ":", "\"hello\"", "}", ")", "assert", ...
[ 1191, 0 ]
[ 1241, 26 ]
python
en
['en', 'en', 'en']
True
test_attribute_if_fires_on_entity_change_with_both_filters_boolean
( hass, calls )
Test for firing if both filters are match attribute.
Test for firing if both filters are match attribute.
async def test_attribute_if_fires_on_entity_change_with_both_filters_boolean( hass, calls ): """Test for firing if both filters are match attribute.""" hass.states.async_set("test.entity", "bla", {"happening": False}) assert await async_setup_component( hass, automation.DOMAIN, ...
[ "async", "def", "test_attribute_if_fires_on_entity_change_with_both_filters_boolean", "(", "hass", ",", "calls", ")", ":", "hass", ".", "states", ".", "async_set", "(", "\"test.entity\"", ",", "\"bla\"", ",", "{", "\"happening\"", ":", "False", "}", ")", "assert", ...
[ 1244, 0 ]
[ 1270, 26 ]
python
en
['en', 'en', 'en']
True
async_setup_entry
(hass, config_entry, async_add_entities)
Set up a BleBox entry.
Set up a BleBox entry.
async def async_setup_entry(hass, config_entry, async_add_entities): """Set up a BleBox entry.""" create_blebox_entities( hass, config_entry, async_add_entities, BleBoxCoverEntity, "covers" )
[ "async", "def", "async_setup_entry", "(", "hass", ",", "config_entry", ",", "async_add_entities", ")", ":", "create_blebox_entities", "(", "hass", ",", "config_entry", ",", "async_add_entities", ",", "BleBoxCoverEntity", ",", "\"covers\"", ")" ]
[ 18, 0 ]
[ 23, 5 ]
python
en
['en', 'hu', 'en']
True
BleBoxCoverEntity.state
(self)
Return the equivalent HA cover state.
Return the equivalent HA cover state.
def state(self): """Return the equivalent HA cover state.""" return BLEBOX_TO_HASS_COVER_STATES[self._feature.state]
[ "def", "state", "(", "self", ")", ":", "return", "BLEBOX_TO_HASS_COVER_STATES", "[", "self", ".", "_feature", ".", "state", "]" ]
[ 30, 4 ]
[ 32, 63 ]
python
en
['en', 'en', 'en']
True
BleBoxCoverEntity.device_class
(self)
Return the device class.
Return the device class.
def device_class(self): """Return the device class.""" return BLEBOX_TO_HASS_DEVICE_CLASSES[self._feature.device_class]
[ "def", "device_class", "(", "self", ")", ":", "return", "BLEBOX_TO_HASS_DEVICE_CLASSES", "[", "self", ".", "_feature", ".", "device_class", "]" ]
[ 35, 4 ]
[ 37, 72 ]
python
en
['en', 'en', 'en']
True
BleBoxCoverEntity.supported_features
(self)
Return the supported cover features.
Return the supported cover features.
def supported_features(self): """Return the supported cover features.""" position = SUPPORT_SET_POSITION if self._feature.is_slider else 0 stop = SUPPORT_STOP if self._feature.has_stop else 0 return position | stop | SUPPORT_OPEN | SUPPORT_CLOSE
[ "def", "supported_features", "(", "self", ")", ":", "position", "=", "SUPPORT_SET_POSITION", "if", "self", ".", "_feature", ".", "is_slider", "else", "0", "stop", "=", "SUPPORT_STOP", "if", "self", ".", "_feature", ".", "has_stop", "else", "0", "return", "po...
[ 40, 4 ]
[ 45, 61 ]
python
en
['en', 'en', 'en']
True
BleBoxCoverEntity.current_cover_position
(self)
Return the current cover position.
Return the current cover position.
def current_cover_position(self): """Return the current cover position.""" position = self._feature.current if position == -1: # possible for shutterBox return None return None if position is None else 100 - position
[ "def", "current_cover_position", "(", "self", ")", ":", "position", "=", "self", ".", "_feature", ".", "current", "if", "position", "==", "-", "1", ":", "# possible for shutterBox", "return", "None", "return", "None", "if", "position", "is", "None", "else", ...
[ 48, 4 ]
[ 54, 59 ]
python
en
['en', 'en', 'en']
True
BleBoxCoverEntity.is_opening
(self)
Return whether cover is opening.
Return whether cover is opening.
def is_opening(self): """Return whether cover is opening.""" return self._is_state(STATE_OPENING)
[ "def", "is_opening", "(", "self", ")", ":", "return", "self", ".", "_is_state", "(", "STATE_OPENING", ")" ]
[ 57, 4 ]
[ 59, 44 ]
python
en
['en', 'en', 'en']
True
BleBoxCoverEntity.is_closing
(self)
Return whether cover is closing.
Return whether cover is closing.
def is_closing(self): """Return whether cover is closing.""" return self._is_state(STATE_CLOSING)
[ "def", "is_closing", "(", "self", ")", ":", "return", "self", ".", "_is_state", "(", "STATE_CLOSING", ")" ]
[ 62, 4 ]
[ 64, 44 ]
python
en
['en', 'en', 'en']
True
BleBoxCoverEntity.is_closed
(self)
Return whether cover is closed.
Return whether cover is closed.
def is_closed(self): """Return whether cover is closed.""" return self._is_state(STATE_CLOSED)
[ "def", "is_closed", "(", "self", ")", ":", "return", "self", ".", "_is_state", "(", "STATE_CLOSED", ")" ]
[ 67, 4 ]
[ 69, 43 ]
python
en
['en', 'en', 'en']
True
BleBoxCoverEntity.async_open_cover
(self, **kwargs)
Open the cover position.
Open the cover position.
async def async_open_cover(self, **kwargs): """Open the cover position.""" await self._feature.async_open()
[ "async", "def", "async_open_cover", "(", "self", ",", "*", "*", "kwargs", ")", ":", "await", "self", ".", "_feature", ".", "async_open", "(", ")" ]
[ 71, 4 ]
[ 73, 40 ]
python
en
['en', 'en', 'en']
True
BleBoxCoverEntity.async_close_cover
(self, **kwargs)
Close the cover position.
Close the cover position.
async def async_close_cover(self, **kwargs): """Close the cover position.""" await self._feature.async_close()
[ "async", "def", "async_close_cover", "(", "self", ",", "*", "*", "kwargs", ")", ":", "await", "self", ".", "_feature", ".", "async_close", "(", ")" ]
[ 75, 4 ]
[ 77, 41 ]
python
en
['en', 'en', 'en']
True
BleBoxCoverEntity.async_set_cover_position
(self, **kwargs)
Set the cover position.
Set the cover position.
async def async_set_cover_position(self, **kwargs): """Set the cover position.""" position = kwargs[ATTR_POSITION] await self._feature.async_set_position(100 - position)
[ "async", "def", "async_set_cover_position", "(", "self", ",", "*", "*", "kwargs", ")", ":", "position", "=", "kwargs", "[", "ATTR_POSITION", "]", "await", "self", ".", "_feature", ".", "async_set_position", "(", "100", "-", "position", ")" ]
[ 79, 4 ]
[ 83, 62 ]
python
en
['en', 'en', 'en']
True
BleBoxCoverEntity.async_stop_cover
(self, **kwargs)
Stop the cover.
Stop the cover.
async def async_stop_cover(self, **kwargs): """Stop the cover.""" await self._feature.async_stop()
[ "async", "def", "async_stop_cover", "(", "self", ",", "*", "*", "kwargs", ")", ":", "await", "self", ".", "_feature", ".", "async_stop", "(", ")" ]
[ 85, 4 ]
[ 87, 40 ]
python
en
['en', 'en', 'en']
True
fix_coordinates
(user_input)
Fix coordinates if they don't comply with the Netatmo API.
Fix coordinates if they don't comply with the Netatmo API.
def fix_coordinates(user_input): """Fix coordinates if they don't comply with the Netatmo API.""" # Ensure coordinates have acceptable length for the Netatmo API for coordinate in [CONF_LAT_NE, CONF_LAT_SW, CONF_LON_NE, CONF_LON_SW]: if len(str(user_input[coordinate]).split(".")[1]) < 7: ...
[ "def", "fix_coordinates", "(", "user_input", ")", ":", "# Ensure coordinates have acceptable length for the Netatmo API", "for", "coordinate", "in", "[", "CONF_LAT_NE", ",", "CONF_LAT_SW", ",", "CONF_LON_NE", ",", "CONF_LON_SW", "]", ":", "if", "len", "(", "str", "(",...
[ 191, 0 ]
[ 210, 21 ]
python
en
['en', 'en', 'en']
True
NetatmoFlowHandler.async_get_options_flow
(config_entry)
Get the options flow for this handler.
Get the options flow for this handler.
def async_get_options_flow(config_entry): """Get the options flow for this handler.""" return NetatmoOptionsFlowHandler(config_entry)
[ "def", "async_get_options_flow", "(", "config_entry", ")", ":", "return", "NetatmoOptionsFlowHandler", "(", "config_entry", ")" ]
[ 35, 4 ]
[ 37, 54 ]
python
en
['en', 'en', 'en']
True
NetatmoFlowHandler.logger
(self)
Return logger.
Return logger.
def logger(self) -> logging.Logger: """Return logger.""" return logging.getLogger(__name__)
[ "def", "logger", "(", "self", ")", "->", "logging", ".", "Logger", ":", "return", "logging", ".", "getLogger", "(", "__name__", ")" ]
[ 40, 4 ]
[ 42, 42 ]
python
en
['es', 'no', 'en']
False
NetatmoFlowHandler.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.""" scopes = [ "read_camera", "read_homecoach", "read_presence", "read_smokedetector", "read_station", "read_thermostat", ...
[ "def", "extra_authorize_data", "(", "self", ")", "->", "dict", ":", "scopes", "=", "[", "\"read_camera\"", ",", "\"read_homecoach\"", ",", "\"read_presence\"", ",", "\"read_smokedetector\"", ",", "\"read_station\"", ",", "\"read_thermostat\"", ",", "\"write_camera\"", ...
[ 45, 4 ]
[ 63, 42 ]
python
en
['en', 'en', 'en']
True
NetatmoFlowHandler.async_step_user
(self, user_input=None)
Handle a flow start.
Handle a flow start.
async def async_step_user(self, user_input=None): """Handle a flow start.""" await self.async_set_unique_id(DOMAIN) if self._async_current_entries(): return self.async_abort(reason="single_instance_allowed") return await super().async_step_user(user_input)
[ "async", "def", "async_step_user", "(", "self", ",", "user_input", "=", "None", ")", ":", "await", "self", ".", "async_set_unique_id", "(", "DOMAIN", ")", "if", "self", ".", "_async_current_entries", "(", ")", ":", "return", "self", ".", "async_abort", "(", ...
[ 65, 4 ]
[ 72, 56 ]
python
en
['en', 'lb', 'en']
True
NetatmoOptionsFlowHandler.__init__
(self, config_entry: config_entries.ConfigEntry)
Initialize Netatmo options flow.
Initialize Netatmo options flow.
def __init__(self, config_entry: config_entries.ConfigEntry): """Initialize Netatmo options flow.""" self.config_entry = config_entry self.options = dict(config_entry.options) self.options.setdefault(CONF_WEATHER_AREAS, {})
[ "def", "__init__", "(", "self", ",", "config_entry", ":", "config_entries", ".", "ConfigEntry", ")", ":", "self", ".", "config_entry", "=", "config_entry", "self", ".", "options", "=", "dict", "(", "config_entry", ".", "options", ")", "self", ".", "options",...
[ 78, 4 ]
[ 82, 55 ]
python
en
['en', 'pl', 'en']
True
NetatmoOptionsFlowHandler.async_step_init
(self, user_input=None)
Manage the Netatmo options.
Manage the Netatmo options.
async def async_step_init(self, user_input=None): """Manage the Netatmo options.""" return await self.async_step_public_weather_areas()
[ "async", "def", "async_step_init", "(", "self", ",", "user_input", "=", "None", ")", ":", "return", "await", "self", ".", "async_step_public_weather_areas", "(", ")" ]
[ 84, 4 ]
[ 86, 59 ]
python
en
['en', 'zu', 'en']
True
NetatmoOptionsFlowHandler.async_step_public_weather_areas
(self, user_input=None)
Manage configuration of Netatmo public weather areas.
Manage configuration of Netatmo public weather areas.
async def async_step_public_weather_areas(self, user_input=None): """Manage configuration of Netatmo public weather areas.""" errors = {} if user_input is not None: new_client = user_input.pop(CONF_NEW_AREA, None) areas = user_input.pop(CONF_WEATHER_AREAS, None) ...
[ "async", "def", "async_step_public_weather_areas", "(", "self", ",", "user_input", "=", "None", ")", ":", "errors", "=", "{", "}", "if", "user_input", "is", "not", "None", ":", "new_client", "=", "user_input", ".", "pop", "(", "CONF_NEW_AREA", ",", "None", ...
[ 88, 4 ]
[ 121, 9 ]
python
en
['en', 'zu', 'en']
True
NetatmoOptionsFlowHandler.async_step_public_weather
(self, user_input=None)
Manage configuration of Netatmo public weather sensors.
Manage configuration of Netatmo public weather sensors.
async def async_step_public_weather(self, user_input=None): """Manage configuration of Netatmo public weather sensors.""" if user_input is not None and CONF_NEW_AREA not in user_input: self.options[CONF_WEATHER_AREAS][ user_input[CONF_AREA_NAME] ] = fix_coordinate...
[ "async", "def", "async_step_public_weather", "(", "self", ",", "user_input", "=", "None", ")", ":", "if", "user_input", "is", "not", "None", "and", "CONF_NEW_AREA", "not", "in", "user_input", ":", "self", ".", "options", "[", "CONF_WEATHER_AREAS", "]", "[", ...
[ 123, 4 ]
[ 182, 86 ]
python
en
['en', 'zu', 'en']
True
NetatmoOptionsFlowHandler._create_options_entry
(self)
Update config entry options.
Update config entry options.
def _create_options_entry(self): """Update config entry options.""" return self.async_create_entry( title="Netatmo Public Weather", data=self.options )
[ "def", "_create_options_entry", "(", "self", ")", ":", "return", "self", ".", "async_create_entry", "(", "title", "=", "\"Netatmo Public Weather\"", ",", "data", "=", "self", ".", "options", ")" ]
[ 184, 4 ]
[ 188, 9 ]
python
en
['en', 'en', 'en']
True
async_setup_entry
(hass, config_entry, async_add_entities)
Set up Homekit alarm control panel.
Set up Homekit alarm control panel.
async def async_setup_entry(hass, config_entry, async_add_entities): """Set up Homekit alarm control panel.""" hkid = config_entry.data["AccessoryPairingID"] conn = hass.data[KNOWN_DEVICES][hkid] @callback def async_add_service(service): if service.short_type != ServicesTypes.SECURITY_SYSTE...
[ "async", "def", "async_setup_entry", "(", "hass", ",", "config_entry", ",", "async_add_entities", ")", ":", "hkid", "=", "config_entry", ".", "data", "[", "\"AccessoryPairingID\"", "]", "conn", "=", "hass", ".", "data", "[", "KNOWN_DEVICES", "]", "[", "hkid", ...
[ 40, 0 ]
[ 53, 40 ]
python
en
['en', 'su', 'en']
True
HomeKitAlarmControlPanelEntity.get_characteristic_types
(self)
Define the homekit characteristics the entity cares about.
Define the homekit characteristics the entity cares about.
def get_characteristic_types(self): """Define the homekit characteristics the entity cares about.""" return [ CharacteristicsTypes.SECURITY_SYSTEM_STATE_CURRENT, CharacteristicsTypes.SECURITY_SYSTEM_STATE_TARGET, CharacteristicsTypes.BATTERY_LEVEL, ]
[ "def", "get_characteristic_types", "(", "self", ")", ":", "return", "[", "CharacteristicsTypes", ".", "SECURITY_SYSTEM_STATE_CURRENT", ",", "CharacteristicsTypes", ".", "SECURITY_SYSTEM_STATE_TARGET", ",", "CharacteristicsTypes", ".", "BATTERY_LEVEL", ",", "]" ]
[ 59, 4 ]
[ 65, 9 ]
python
en
['en', 'en', 'en']
True
HomeKitAlarmControlPanelEntity.icon
(self)
Return icon.
Return icon.
def icon(self): """Return icon.""" return ICON
[ "def", "icon", "(", "self", ")", ":", "return", "ICON" ]
[ 68, 4 ]
[ 70, 19 ]
python
en
['en', 'la', 'en']
False
HomeKitAlarmControlPanelEntity.state
(self)
Return the state of the device.
Return the state of the device.
def state(self): """Return the state of the device.""" return CURRENT_STATE_MAP[ self.service.value(CharacteristicsTypes.SECURITY_SYSTEM_STATE_CURRENT) ]
[ "def", "state", "(", "self", ")", ":", "return", "CURRENT_STATE_MAP", "[", "self", ".", "service", ".", "value", "(", "CharacteristicsTypes", ".", "SECURITY_SYSTEM_STATE_CURRENT", ")", "]" ]
[ 73, 4 ]
[ 77, 9 ]
python
en
['en', 'en', 'en']
True
HomeKitAlarmControlPanelEntity.supported_features
(self)
Return the list of supported features.
Return the list of supported features.
def supported_features(self) -> int: """Return the list of supported features.""" return SUPPORT_ALARM_ARM_HOME | SUPPORT_ALARM_ARM_AWAY | SUPPORT_ALARM_ARM_NIGHT
[ "def", "supported_features", "(", "self", ")", "->", "int", ":", "return", "SUPPORT_ALARM_ARM_HOME", "|", "SUPPORT_ALARM_ARM_AWAY", "|", "SUPPORT_ALARM_ARM_NIGHT" ]
[ 80, 4 ]
[ 82, 88 ]
python
en
['en', 'en', 'en']
True
HomeKitAlarmControlPanelEntity.async_alarm_disarm
(self, code=None)
Send disarm command.
Send disarm command.
async def async_alarm_disarm(self, code=None): """Send disarm command.""" await self.set_alarm_state(STATE_ALARM_DISARMED, code)
[ "async", "def", "async_alarm_disarm", "(", "self", ",", "code", "=", "None", ")", ":", "await", "self", ".", "set_alarm_state", "(", "STATE_ALARM_DISARMED", ",", "code", ")" ]
[ 84, 4 ]
[ 86, 62 ]
python
en
['en', 'pt', 'en']
True
HomeKitAlarmControlPanelEntity.async_alarm_arm_away
(self, code=None)
Send arm command.
Send arm command.
async def async_alarm_arm_away(self, code=None): """Send arm command.""" await self.set_alarm_state(STATE_ALARM_ARMED_AWAY, code)
[ "async", "def", "async_alarm_arm_away", "(", "self", ",", "code", "=", "None", ")", ":", "await", "self", ".", "set_alarm_state", "(", "STATE_ALARM_ARMED_AWAY", ",", "code", ")" ]
[ 88, 4 ]
[ 90, 64 ]
python
en
['en', 'fr', 'en']
True
HomeKitAlarmControlPanelEntity.async_alarm_arm_home
(self, code=None)
Send stay command.
Send stay command.
async def async_alarm_arm_home(self, code=None): """Send stay command.""" await self.set_alarm_state(STATE_ALARM_ARMED_HOME, code)
[ "async", "def", "async_alarm_arm_home", "(", "self", ",", "code", "=", "None", ")", ":", "await", "self", ".", "set_alarm_state", "(", "STATE_ALARM_ARMED_HOME", ",", "code", ")" ]
[ 92, 4 ]
[ 94, 64 ]
python
en
['en', 'en', 'en']
True
HomeKitAlarmControlPanelEntity.async_alarm_arm_night
(self, code=None)
Send night command.
Send night command.
async def async_alarm_arm_night(self, code=None): """Send night command.""" await self.set_alarm_state(STATE_ALARM_ARMED_NIGHT, code)
[ "async", "def", "async_alarm_arm_night", "(", "self", ",", "code", "=", "None", ")", ":", "await", "self", ".", "set_alarm_state", "(", "STATE_ALARM_ARMED_NIGHT", ",", "code", ")" ]
[ 96, 4 ]
[ 98, 65 ]
python
en
['en', 'zh', 'en']
True
HomeKitAlarmControlPanelEntity.set_alarm_state
(self, state, code=None)
Send state command.
Send state command.
async def set_alarm_state(self, state, code=None): """Send state command.""" await self.async_put_characteristics( {CharacteristicsTypes.SECURITY_SYSTEM_STATE_TARGET: TARGET_STATE_MAP[state]} )
[ "async", "def", "set_alarm_state", "(", "self", ",", "state", ",", "code", "=", "None", ")", ":", "await", "self", ".", "async_put_characteristics", "(", "{", "CharacteristicsTypes", ".", "SECURITY_SYSTEM_STATE_TARGET", ":", "TARGET_STATE_MAP", "[", "state", "]", ...
[ 100, 4 ]
[ 104, 9 ]
python
en
['en', 'en', 'en']
True
HomeKitAlarmControlPanelEntity.device_state_attributes
(self)
Return the optional state attributes.
Return the optional state attributes.
def device_state_attributes(self): """Return the optional state attributes.""" battery_level = self.service.value(CharacteristicsTypes.BATTERY_LEVEL) if not battery_level: return {} return {ATTR_BATTERY_LEVEL: battery_level}
[ "def", "device_state_attributes", "(", "self", ")", ":", "battery_level", "=", "self", ".", "service", ".", "value", "(", "CharacteristicsTypes", ".", "BATTERY_LEVEL", ")", "if", "not", "battery_level", ":", "return", "{", "}", "return", "{", "ATTR_BATTERY_LEVEL...
[ 107, 4 ]
[ 113, 50 ]
python
en
['en', 'en', 'en']
True
async_setup_entry
(hass, entry, async_add_entities)
Set up the hunter douglas shades sensors.
Set up the hunter douglas shades sensors.
async def async_setup_entry(hass, entry, async_add_entities): """Set up the hunter douglas shades sensors.""" pv_data = hass.data[DOMAIN][entry.entry_id] shade_data = pv_data[PV_SHADE_DATA] pv_request = pv_data[PV_API] coordinator = pv_data[COORDINATOR] device_info = pv_data[DEVICE_INFO] e...
[ "async", "def", "async_setup_entry", "(", "hass", ",", "entry", ",", "async_add_entities", ")", ":", "pv_data", "=", "hass", ".", "data", "[", "DOMAIN", "]", "[", "entry", ".", "entry_id", "]", "shade_data", "=", "pv_data", "[", "PV_SHADE_DATA", "]", "pv_r...
[ 18, 0 ]
[ 38, 32 ]
python
en
['en', 'sq', 'en']
True
PowerViewShadeBatterySensor.unit_of_measurement
(self)
Return the unit of measurement.
Return the unit of measurement.
def unit_of_measurement(self): """Return the unit of measurement.""" return PERCENTAGE
[ "def", "unit_of_measurement", "(", "self", ")", ":", "return", "PERCENTAGE" ]
[ 45, 4 ]
[ 47, 25 ]
python
en
['en', 'la', 'en']
True
PowerViewShadeBatterySensor.name
(self)
Name of the shade battery.
Name of the shade battery.
def name(self): """Name of the shade battery.""" return f"{self._shade_name} Battery"
[ "def", "name", "(", "self", ")", ":", "return", "f\"{self._shade_name} Battery\"" ]
[ 50, 4 ]
[ 52, 44 ]
python
en
['en', 'en', 'en']
True
PowerViewShadeBatterySensor.device_class
(self)
Shade battery Class.
Shade battery Class.
def device_class(self): """Shade battery Class.""" return DEVICE_CLASS_BATTERY
[ "def", "device_class", "(", "self", ")", ":", "return", "DEVICE_CLASS_BATTERY" ]
[ 55, 4 ]
[ 57, 35 ]
python
en
['en', 'lb', 'en']
True
PowerViewShadeBatterySensor.unique_id
(self)
Shade battery Uniqueid.
Shade battery Uniqueid.
def unique_id(self): """Shade battery Uniqueid.""" return f"{self._unique_id}_charge"
[ "def", "unique_id", "(", "self", ")", ":", "return", "f\"{self._unique_id}_charge\"" ]
[ 60, 4 ]
[ 62, 42 ]
python
en
['fr', 'en', 'en']
True
PowerViewShadeBatterySensor.state
(self)
Get the current value in percentage.
Get the current value in percentage.
def state(self): """Get the current value in percentage.""" return round( self._shade.raw_data[SHADE_BATTERY_LEVEL] / SHADE_BATTERY_LEVEL_MAX * 100 )
[ "def", "state", "(", "self", ")", ":", "return", "round", "(", "self", ".", "_shade", ".", "raw_data", "[", "SHADE_BATTERY_LEVEL", "]", "/", "SHADE_BATTERY_LEVEL_MAX", "*", "100", ")" ]
[ 65, 4 ]
[ 69, 9 ]
python
en
['en', 'en', 'en']
True
PowerViewShadeBatterySensor.async_added_to_hass
(self)
When entity is added to hass.
When entity is added to hass.
async def async_added_to_hass(self): """When entity is added to hass.""" self.async_on_remove( self.coordinator.async_add_listener(self._async_update_shade_from_group) )
[ "async", "def", "async_added_to_hass", "(", "self", ")", ":", "self", ".", "async_on_remove", "(", "self", ".", "coordinator", ".", "async_add_listener", "(", "self", ".", "_async_update_shade_from_group", ")", ")" ]
[ 71, 4 ]
[ 75, 9 ]
python
en
['en', 'en', 'en']
True
PowerViewShadeBatterySensor._async_update_shade_from_group
(self)
Update with new data from the coordinator.
Update with new data from the coordinator.
def _async_update_shade_from_group(self): """Update with new data from the coordinator.""" self._shade.raw_data = self.coordinator.data[self._shade.id] self.async_write_ha_state()
[ "def", "_async_update_shade_from_group", "(", "self", ")", ":", "self", ".", "_shade", ".", "raw_data", "=", "self", ".", "coordinator", ".", "data", "[", "self", ".", "_shade", ".", "id", "]", "self", ".", "async_write_ha_state", "(", ")" ]
[ 78, 4 ]
[ 81, 35 ]
python
en
['en', 'en', 'en']
True
test_form
(hass)
Test we get the form.
Test we get the form.
async def test_form(hass): """Test we get the form.""" await setup.async_setup_component(hass, "persistent_notification", {}) result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": config_entries.SOURCE_USER} ) assert result["type"] == "form" assert result["errors...
[ "async", "def", "test_form", "(", "hass", ")", ":", "await", "setup", ".", "async_setup_component", "(", "hass", ",", "\"persistent_notification\"", ",", "{", "}", ")", "result", "=", "await", "hass", ".", "config_entries", ".", "flow", ".", "async_init", "(...
[ 12, 0 ]
[ 40, 48 ]
python
en
['en', 'en', 'en']
True
test_already_configured
(hass)
Test config flow when Omnilogic component is already setup.
Test config flow when Omnilogic component is already setup.
async def test_already_configured(hass): """Test config flow when Omnilogic component is already setup.""" MockConfigEntry(domain="omnilogic", data=DATA).add_to_hass(hass) await setup.async_setup_component(hass, "persistent_notification", {}) result = await hass.config_entries.flow.async_init( ...
[ "async", "def", "test_already_configured", "(", "hass", ")", ":", "MockConfigEntry", "(", "domain", "=", "\"omnilogic\"", ",", "data", "=", "DATA", ")", ".", "add_to_hass", "(", "hass", ")", "await", "setup", ".", "async_setup_component", "(", "hass", ",", "...
[ 43, 0 ]
[ 53, 56 ]
python
en
['en', 'en', 'en']
True
test_with_invalid_credentials
(hass)
Test with invalid credentials.
Test with invalid credentials.
async def test_with_invalid_credentials(hass): """Test with invalid credentials.""" await setup.async_setup_component(hass, "persistent_notification", {}) result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": config_entries.SOURCE_USER} ) with patch( "homea...
[ "async", "def", "test_with_invalid_credentials", "(", "hass", ")", ":", "await", "setup", ".", "async_setup_component", "(", "hass", ",", "\"persistent_notification\"", ",", "{", "}", ")", "result", "=", "await", "hass", ".", "config_entries", ".", "flow", ".", ...
[ 56, 0 ]
[ 75, 55 ]
python
en
['en', 'en', 'en']
True
test_form_cannot_connect
(hass)
Test if invalid response or no connection returned from Hayward.
Test if invalid response or no connection returned from Hayward.
async def test_form_cannot_connect(hass): """Test if invalid response or no connection returned from Hayward.""" await setup.async_setup_component(hass, "persistent_notification", {}) result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": config_entries.SOURCE_USER} ) ...
[ "async", "def", "test_form_cannot_connect", "(", "hass", ")", ":", "await", "setup", ".", "async_setup_component", "(", "hass", ",", "\"persistent_notification\"", ",", "{", "}", ")", "result", "=", "await", "hass", ".", "config_entries", ".", "flow", ".", "as...
[ 78, 0 ]
[ 97, 57 ]
python
en
['en', 'en', 'en']
True
test_with_unknown_error
(hass)
Test with unknown error response from Hayward.
Test with unknown error response from Hayward.
async def test_with_unknown_error(hass): """Test with unknown error response from Hayward.""" await setup.async_setup_component(hass, "persistent_notification", {}) result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": config_entries.SOURCE_USER} ) with patch( ...
[ "async", "def", "test_with_unknown_error", "(", "hass", ")", ":", "await", "setup", ".", "async_setup_component", "(", "hass", ",", "\"persistent_notification\"", ",", "{", "}", ")", "result", "=", "await", "hass", ".", "config_entries", ".", "flow", ".", "asy...
[ 100, 0 ]
[ 118, 50 ]
python
en
['en', 'en', 'en']
True
test_option_flow
(hass)
Test option flow.
Test option flow.
async def test_option_flow(hass): """Test option flow.""" entry = MockConfigEntry(domain=DOMAIN, data=DATA) entry.add_to_hass(hass) assert not entry.options with patch( "homeassistant.components.omnilogic.async_setup_entry", return_value=True ): result = await hass.config_entri...
[ "async", "def", "test_option_flow", "(", "hass", ")", ":", "entry", "=", "MockConfigEntry", "(", "domain", "=", "DOMAIN", ",", "data", "=", "DATA", ")", "entry", ".", "add_to_hass", "(", "hass", ")", "assert", "not", "entry", ".", "options", "with", "pat...
[ 121, 0 ]
[ 146, 50 ]
python
da
['nl', 'da', 'en']
False
async_setup_entry
( hass: HomeAssistantType, entry: ConfigEntry, async_add_entities )
Set up the sensors.
Set up the sensors.
async def async_setup_entry( hass: HomeAssistantType, entry: ConfigEntry, async_add_entities ) -> None: """Set up the sensors.""" if DATA_SDM not in entry.data: await async_setup_legacy_entry(hass, entry, async_add_entities) return await async_setup_sdm_entry(hass, entry, async_add_enti...
[ "async", "def", "async_setup_entry", "(", "hass", ":", "HomeAssistantType", ",", "entry", ":", "ConfigEntry", ",", "async_add_entities", ")", "->", "None", ":", "if", "DATA_SDM", "not", "in", "entry", ".", "data", ":", "await", "async_setup_legacy_entry", "(", ...
[ 10, 0 ]
[ 18, 64 ]
python
en
['en', 'bg', 'en']
True
test_async_track_states
(hass)
Test AsyncTrackStates context manager.
Test AsyncTrackStates context manager.
async def test_async_track_states(hass): """Test AsyncTrackStates context manager.""" point1 = dt_util.utcnow() point2 = point1 + timedelta(seconds=5) point3 = point2 + timedelta(seconds=5) with patch("homeassistant.core.dt_util.utcnow") as mock_utcnow: mock_utcnow.return_value = point2 ...
[ "async", "def", "test_async_track_states", "(", "hass", ")", ":", "point1", "=", "dt_util", ".", "utcnow", "(", ")", "point2", "=", "point1", "+", "timedelta", "(", "seconds", "=", "5", ")", "point3", "=", "point2", "+", "timedelta", "(", "seconds", "=",...
[ 27, 0 ]
[ 48, 80 ]
python
en
['en', 'en', 'en']
True
test_call_to_component
(hass)
Test calls to components state reproduction functions.
Test calls to components state reproduction functions.
async def test_call_to_component(hass): """Test calls to components state reproduction functions.""" with patch( "homeassistant.components.media_player.reproduce_state.async_reproduce_states" ) as media_player_fun: media_player_fun.return_value = asyncio.Future() media_player_fun.ret...
[ "async", "def", "test_call_to_component", "(", "hass", ")", ":", "with", "patch", "(", "\"homeassistant.components.media_player.reproduce_state.async_reproduce_states\"", ")", "as", "media_player_fun", ":", "media_player_fun", ".", "return_value", "=", "asyncio", ".", "Futu...
[ 51, 0 ]
[ 81, 13 ]
python
en
['en', 'en', 'en']
True
test_get_changed_since
(hass)
Test get_changed_since.
Test get_changed_since.
async def test_get_changed_since(hass): """Test get_changed_since.""" point1 = dt_util.utcnow() point2 = point1 + timedelta(seconds=5) point3 = point2 + timedelta(seconds=5) with patch("homeassistant.core.dt_util.utcnow", return_value=point1): hass.states.async_set("light.test", "on") ...
[ "async", "def", "test_get_changed_since", "(", "hass", ")", ":", "point1", "=", "dt_util", ".", "utcnow", "(", ")", "point2", "=", "point1", "+", "timedelta", "(", "seconds", "=", "5", ")", "point3", "=", "point2", "+", "timedelta", "(", "seconds", "=", ...
[ 84, 0 ]
[ 102, 88 ]
python
en
['nl', 'en', 'en']
False
test_reproduce_with_no_entity
(hass)
Test reproduce_state with no entity.
Test reproduce_state with no entity.
async def test_reproduce_with_no_entity(hass): """Test reproduce_state with no entity.""" calls = async_mock_service(hass, "light", SERVICE_TURN_ON) await state.async_reproduce_state(hass, ha.State("light.test", "on")) await hass.async_block_till_done() assert len(calls) == 0 assert hass.stat...
[ "async", "def", "test_reproduce_with_no_entity", "(", "hass", ")", ":", "calls", "=", "async_mock_service", "(", "hass", ",", "\"light\"", ",", "SERVICE_TURN_ON", ")", "await", "state", ".", "async_reproduce_state", "(", "hass", ",", "ha", ".", "State", "(", "...
[ 105, 0 ]
[ 114, 48 ]
python
en
['en', 'en', 'en']
True
test_reproduce_turn_on
(hass)
Test reproduce_state with SERVICE_TURN_ON.
Test reproduce_state with SERVICE_TURN_ON.
async def test_reproduce_turn_on(hass): """Test reproduce_state with SERVICE_TURN_ON.""" calls = async_mock_service(hass, "light", SERVICE_TURN_ON) hass.states.async_set("light.test", "off") await state.async_reproduce_state(hass, ha.State("light.test", "on")) await hass.async_block_till_done() ...
[ "async", "def", "test_reproduce_turn_on", "(", "hass", ")", ":", "calls", "=", "async_mock_service", "(", "hass", ",", "\"light\"", ",", "SERVICE_TURN_ON", ")", "hass", ".", "states", ".", "async_set", "(", "\"light.test\"", ",", "\"off\"", ")", "await", "stat...
[ 117, 0 ]
[ 131, 58 ]
python
en
['en', 'en', 'en']
True
test_reproduce_turn_off
(hass)
Test reproduce_state with SERVICE_TURN_OFF.
Test reproduce_state with SERVICE_TURN_OFF.
async def test_reproduce_turn_off(hass): """Test reproduce_state with SERVICE_TURN_OFF.""" calls = async_mock_service(hass, "light", SERVICE_TURN_OFF) hass.states.async_set("light.test", "on") await state.async_reproduce_state(hass, ha.State("light.test", "off")) await hass.async_block_till_done(...
[ "async", "def", "test_reproduce_turn_off", "(", "hass", ")", ":", "calls", "=", "async_mock_service", "(", "hass", ",", "\"light\"", ",", "SERVICE_TURN_OFF", ")", "hass", ".", "states", ".", "async_set", "(", "\"light.test\"", ",", "\"on\"", ")", "await", "sta...
[ 134, 0 ]
[ 148, 58 ]
python
en
['en', 'en', 'en']
True
test_reproduce_complex_data
(hass)
Test reproduce_state with complex service data.
Test reproduce_state with complex service data.
async def test_reproduce_complex_data(hass): """Test reproduce_state with complex service data.""" calls = async_mock_service(hass, "light", SERVICE_TURN_ON) hass.states.async_set("light.test", "off") complex_data = [255, 100, 100] await state.async_reproduce_state( hass, ha.State("light....
[ "async", "def", "test_reproduce_complex_data", "(", "hass", ")", ":", "calls", "=", "async_mock_service", "(", "hass", ",", "\"light\"", ",", "SERVICE_TURN_ON", ")", "hass", ".", "states", ".", "async_set", "(", "\"light.test\"", ",", "\"off\"", ")", "complex_da...
[ 151, 0 ]
[ 169, 58 ]
python
en
['en', 'en', 'en']
True
test_reproduce_bad_state
(hass)
Test reproduce_state with bad state.
Test reproduce_state with bad state.
async def test_reproduce_bad_state(hass): """Test reproduce_state with bad state.""" calls = async_mock_service(hass, "light", SERVICE_TURN_ON) hass.states.async_set("light.test", "off") await state.async_reproduce_state(hass, ha.State("light.test", "bad")) await hass.async_block_till_done() ...
[ "async", "def", "test_reproduce_bad_state", "(", "hass", ")", ":", "calls", "=", "async_mock_service", "(", "hass", ",", "\"light\"", ",", "SERVICE_TURN_ON", ")", "hass", ".", "states", ".", "async_set", "(", "\"light.test\"", ",", "\"off\"", ")", "await", "st...
[ 172, 0 ]
[ 183, 55 ]
python
en
['en', 'en', 'en']
True
test_as_number_states
(hass)
Test state_as_number with states.
Test state_as_number with states.
async def test_as_number_states(hass): """Test state_as_number with states.""" zero_states = ( STATE_OFF, STATE_CLOSED, STATE_UNLOCKED, STATE_BELOW_HORIZON, STATE_NOT_HOME, ) one_states = (STATE_ON, STATE_OPEN, STATE_LOCKED, STATE_ABOVE_HORIZON, STATE_HOME) fo...
[ "async", "def", "test_as_number_states", "(", "hass", ")", ":", "zero_states", "=", "(", "STATE_OFF", ",", "STATE_CLOSED", ",", "STATE_UNLOCKED", ",", "STATE_BELOW_HORIZON", ",", "STATE_NOT_HOME", ",", ")", "one_states", "=", "(", "STATE_ON", ",", "STATE_OPEN", ...
[ 186, 0 ]
[ 199, 78 ]
python
en
['en', 'en', 'en']
True
test_as_number_coercion
(hass)
Test state_as_number with number.
Test state_as_number with number.
async def test_as_number_coercion(hass): """Test state_as_number with number.""" for _state in ("0", "0.0", 0, 0.0): assert state.state_as_number(ha.State("domain.test", _state, {})) == 0.0 for _state in ("1", "1.0", 1, 1.0): assert state.state_as_number(ha.State("domain.test", _state, {})) ...
[ "async", "def", "test_as_number_coercion", "(", "hass", ")", ":", "for", "_state", "in", "(", "\"0\"", ",", "\"0.0\"", ",", "0", ",", "0.0", ")", ":", "assert", "state", ".", "state_as_number", "(", "ha", ".", "State", "(", "\"domain.test\"", ",", "_stat...
[ 202, 0 ]
[ 207, 80 ]
python
en
['en', 'en', 'en']
True
test_as_number_invalid_cases
(hass)
Test state_as_number with invalid cases.
Test state_as_number with invalid cases.
async def test_as_number_invalid_cases(hass): """Test state_as_number with invalid cases.""" for _state in ("", "foo", "foo.bar", None, False, True, object, object()): with pytest.raises(ValueError): state.state_as_number(ha.State("domain.test", _state, {}))
[ "async", "def", "test_as_number_invalid_cases", "(", "hass", ")", ":", "for", "_state", "in", "(", "\"\"", ",", "\"foo\"", ",", "\"foo.bar\"", ",", "None", ",", "False", ",", "True", ",", "object", ",", "object", "(", ")", ")", ":", "with", "pytest", "...
[ 210, 0 ]
[ 214, 70 ]
python
en
['en', 'en', 'en']
True
calc_allowed_references
(integration: Integration)
Return a set of allowed references.
Return a set of allowed references.
def calc_allowed_references(integration: Integration) -> Set[str]: """Return a set of allowed references.""" allowed_references = ( ALLOWED_USED_COMPONENTS | set(integration.manifest.get("dependencies", [])) | set(integration.manifest.get("after_dependencies", [])) ) # Discovery...
[ "def", "calc_allowed_references", "(", "integration", ":", "Integration", ")", "->", "Set", "[", "str", "]", ":", "allowed_references", "=", "(", "ALLOWED_USED_COMPONENTS", "|", "set", "(", "integration", ".", "manifest", ".", "get", "(", "\"dependencies\"", ","...
[ 156, 0 ]
[ 169, 29 ]
python
en
['en', 'en', 'en']
True
find_non_referenced_integrations
( integrations: Dict[str, Integration], integration: Integration, references: Dict[Path, Set[str]], )
Find intergrations that are not allowed to be referenced.
Find intergrations that are not allowed to be referenced.
def find_non_referenced_integrations( integrations: Dict[str, Integration], integration: Integration, references: Dict[Path, Set[str]], ): """Find intergrations that are not allowed to be referenced.""" allowed_references = calc_allowed_references(integration) referenced = set() for path, re...
[ "def", "find_non_referenced_integrations", "(", "integrations", ":", "Dict", "[", "str", ",", "Integration", "]", ",", "integration", ":", "Integration", ",", "references", ":", "Dict", "[", "Path", ",", "Set", "[", "str", "]", "]", ",", ")", ":", "allowed...
[ 172, 0 ]
[ 217, 21 ]
python
en
['en', 'en', 'en']
True
validate_dependencies
( integrations: Dict[str, Integration], integration: Integration )
Validate all dependencies.
Validate all dependencies.
def validate_dependencies( integrations: Dict[str, Integration], integration: Integration ): """Validate all dependencies.""" # Some integrations are allowed to have violations. if integration.domain in IGNORE_VIOLATIONS: return # Find usage of hass.components collector = ImportCollecto...
[ "def", "validate_dependencies", "(", "integrations", ":", "Dict", "[", "str", ",", "Integration", "]", ",", "integration", ":", "Integration", ")", ":", "# Some integrations are allowed to have violations.", "if", "integration", ".", "domain", "in", "IGNORE_VIOLATIONS",...
[ 220, 0 ]
[ 241, 9 ]
python
af
['ca', 'af', 'en']
False
validate
(integrations: Dict[str, Integration], config)
Handle dependencies for integrations.
Handle dependencies for integrations.
def validate(integrations: Dict[str, Integration], config): """Handle dependencies for integrations.""" # check for non-existing dependencies for integration in integrations.values(): if not integration.manifest: continue validate_dependencies(integrations, integration) ...
[ "def", "validate", "(", "integrations", ":", "Dict", "[", "str", ",", "Integration", "]", ",", "config", ")", ":", "# check for non-existing dependencies", "for", "integration", "in", "integrations", ".", "values", "(", ")", ":", "if", "not", "integration", "....
[ 244, 0 ]
[ 268, 17 ]
python
en
['fr', 'nl', 'en']
False
ImportCollector.__init__
(self, integration: Integration)
Initialize the import collector.
Initialize the import collector.
def __init__(self, integration: Integration): """Initialize the import collector.""" self.integration = integration self.referenced: Dict[Path, Set[str]] = {} # Current file or dir we're inspecting self._cur_fil_dir = None
[ "def", "__init__", "(", "self", ",", "integration", ":", "Integration", ")", ":", "self", ".", "integration", "=", "integration", "self", ".", "referenced", ":", "Dict", "[", "Path", ",", "Set", "[", "str", "]", "]", "=", "{", "}", "# Current file or dir...
[ 13, 4 ]
[ 19, 32 ]
python
en
['en', 'en', 'en']
True
ImportCollector.collect
(self)
Collect imports from a source file.
Collect imports from a source file.
def collect(self) -> None: """Collect imports from a source file.""" for fil in self.integration.path.glob("**/*.py"): if not fil.is_file(): continue self._cur_fil_dir = fil.relative_to(self.integration.path) self.referenced[self._cur_fil_dir] = set()...
[ "def", "collect", "(", "self", ")", "->", "None", ":", "for", "fil", "in", "self", ".", "integration", ".", "path", ".", "glob", "(", "\"**/*.py\"", ")", ":", "if", "not", "fil", ".", "is_file", "(", ")", ":", "continue", "self", ".", "_cur_fil_dir",...
[ 21, 4 ]
[ 30, 36 ]
python
en
['en', 'en', 'en']
True
ImportCollector._add_reference
(self, reference_domain: str)
Add a reference.
Add a reference.
def _add_reference(self, reference_domain: str): """Add a reference.""" self.referenced[self._cur_fil_dir].add(reference_domain)
[ "def", "_add_reference", "(", "self", ",", "reference_domain", ":", "str", ")", ":", "self", ".", "referenced", "[", "self", ".", "_cur_fil_dir", "]", ".", "add", "(", "reference_domain", ")" ]
[ 32, 4 ]
[ 34, 64 ]
python
en
['en', 'en', 'en']
True