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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
vizio_hostname_check | () | Mock vizio hostname resolution. | Mock vizio hostname resolution. | def vizio_hostname_check():
"""Mock vizio hostname resolution."""
with patch(
"homeassistant.components.vizio.config_flow.socket.gethostbyname",
return_value=ZEROCONF_HOST,
):
yield | [
"def",
"vizio_hostname_check",
"(",
")",
":",
"with",
"patch",
"(",
"\"homeassistant.components.vizio.config_flow.socket.gethostbyname\"",
",",
"return_value",
"=",
"ZEROCONF_HOST",
",",
")",
":",
"yield"
] | [
215,
0
] | [
221,
13
] | python | it | ['it', 'eo', 'it'] | True |
MockInput.__init__ | (self, name) | Initialize mock Vizio device input. | Initialize mock Vizio device input. | def __init__(self, name):
"""Initialize mock Vizio device input."""
self.meta_name = name
self.name = name | [
"def",
"__init__",
"(",
"self",
",",
"name",
")",
":",
"self",
".",
"meta_name",
"=",
"name",
"self",
".",
"name",
"=",
"name"
] | [
30,
4
] | [
33,
24
] | python | it | ['it', 'pl', 'it'] | True |
calls | (hass) | Track calls to a mock service. | Track calls to a mock service. | def calls(hass):
"""Track calls to a mock service."""
return async_mock_service(hass, "test", "automation") | [
"def",
"calls",
"(",
"hass",
")",
":",
"return",
"async_mock_service",
"(",
"hass",
",",
"\"test\"",
",",
"\"automation\"",
")"
] | [
25,
0
] | [
27,
57
] | python | en | ['en', 'en', 'en'] | True |
setup_comp | (hass) | Initialize components. | Initialize components. | def setup_comp(hass):
"""Initialize components."""
mock_component(hass, "group") | [
"def",
"setup_comp",
"(",
"hass",
")",
":",
"mock_component",
"(",
"hass",
",",
"\"group\"",
")"
] | [
31,
0
] | [
33,
33
] | python | en | ['de', 'en', 'en'] | False |
test_if_not_fires_on_entity_removal | (hass, calls) | Test the firing with removed entity. | Test the firing with removed entity. | async def test_if_not_fires_on_entity_removal(hass, calls):
"""Test the firing with removed entity."""
hass.states.async_set("test.entity", 11)
assert await async_setup_component(
hass,
automation.DOMAIN,
{
automation.DOMAIN: {
"trigger": {
... | [
"async",
"def",
"test_if_not_fires_on_entity_removal",
"(",
"hass",
",",
"calls",
")",
":",
"hass",
".",
"states",
".",
"async_set",
"(",
"\"test.entity\"",
",",
"11",
")",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"automation",
".",
"DOMAIN"... | [
36,
0
] | [
58,
26
] | python | en | ['en', 'en', 'en'] | True |
test_if_fires_on_entity_change_below | (hass, calls) | Test the firing with changed entity. | Test the firing with changed entity. | async def test_if_fires_on_entity_change_below(hass, calls):
"""Test the firing with changed entity."""
context = Context()
assert await async_setup_component(
hass,
automation.DOMAIN,
{
automation.DOMAIN: {
"trigger": {
"platform": "nu... | [
"async",
"def",
"test_if_fires_on_entity_change_below",
"(",
"hass",
",",
"calls",
")",
":",
"context",
"=",
"Context",
"(",
")",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"automation",
".",
"DOMAIN",
",",
"{",
"automation",
".",
"DOMAIN",
... | [
61,
0
] | [
95,
26
] | python | en | ['en', 'en', 'en'] | True |
test_if_fires_on_entity_change_over_to_below | (hass, calls) | Test the firing with changed entity. | Test the firing with changed entity. | async def test_if_fires_on_entity_change_over_to_below(hass, calls):
"""Test the firing with changed entity."""
hass.states.async_set("test.entity", 11)
await hass.async_block_till_done()
assert await async_setup_component(
hass,
automation.DOMAIN,
{
automation.DOMAI... | [
"async",
"def",
"test_if_fires_on_entity_change_over_to_below",
"(",
"hass",
",",
"calls",
")",
":",
"hass",
".",
"states",
".",
"async_set",
"(",
"\"test.entity\"",
",",
"11",
")",
"await",
"hass",
".",
"async_block_till_done",
"(",
")",
"assert",
"await",
"asy... | [
98,
0
] | [
121,
26
] | python | en | ['en', 'en', 'en'] | True |
test_if_fires_on_entities_change_over_to_below | (hass, calls) | Test the firing with changed entities. | Test the firing with changed entities. | async def test_if_fires_on_entities_change_over_to_below(hass, calls):
"""Test the firing with changed entities."""
hass.states.async_set("test.entity_1", 11)
hass.states.async_set("test.entity_2", 11)
await hass.async_block_till_done()
assert await async_setup_component(
hass,
auto... | [
"async",
"def",
"test_if_fires_on_entities_change_over_to_below",
"(",
"hass",
",",
"calls",
")",
":",
"hass",
".",
"states",
".",
"async_set",
"(",
"\"test.entity_1\"",
",",
"11",
")",
"hass",
".",
"states",
".",
"async_set",
"(",
"\"test.entity_2\"",
",",
"11"... | [
124,
0
] | [
151,
26
] | python | en | ['en', 'en', 'en'] | True |
test_if_not_fires_on_entity_change_below_to_below | (hass, calls) | Test the firing with changed entity. | Test the firing with changed entity. | async def test_if_not_fires_on_entity_change_below_to_below(hass, calls):
"""Test the firing with changed entity."""
context = Context()
hass.states.async_set("test.entity", 11)
await hass.async_block_till_done()
assert await async_setup_component(
hass,
automation.DOMAIN,
{... | [
"async",
"def",
"test_if_not_fires_on_entity_change_below_to_below",
"(",
"hass",
",",
"calls",
")",
":",
"context",
"=",
"Context",
"(",
")",
"hass",
".",
"states",
".",
"async_set",
"(",
"\"test.entity\"",
",",
"11",
")",
"await",
"hass",
".",
"async_block_til... | [
154,
0
] | [
189,
26
] | python | en | ['en', 'en', 'en'] | True |
test_if_not_below_fires_on_entity_change_to_equal | (hass, calls) | Test the firing with changed entity. | Test the firing with changed entity. | async def test_if_not_below_fires_on_entity_change_to_equal(hass, calls):
"""Test the firing with changed entity."""
hass.states.async_set("test.entity", 11)
await hass.async_block_till_done()
assert await async_setup_component(
hass,
automation.DOMAIN,
{
automation.... | [
"async",
"def",
"test_if_not_below_fires_on_entity_change_to_equal",
"(",
"hass",
",",
"calls",
")",
":",
"hass",
".",
"states",
".",
"async_set",
"(",
"\"test.entity\"",
",",
"11",
")",
"await",
"hass",
".",
"async_block_till_done",
"(",
")",
"assert",
"await",
... | [
192,
0
] | [
215,
26
] | python | en | ['en', 'en', 'en'] | True |
test_if_fires_on_initial_entity_below | (hass, calls) | Test the firing when starting with a match. | Test the firing when starting with a match. | async def test_if_fires_on_initial_entity_below(hass, calls):
"""Test the firing when starting with a match."""
hass.states.async_set("test.entity", 9)
await hass.async_block_till_done()
assert await async_setup_component(
hass,
automation.DOMAIN,
{
automation.DOMAIN... | [
"async",
"def",
"test_if_fires_on_initial_entity_below",
"(",
"hass",
",",
"calls",
")",
":",
"hass",
".",
"states",
".",
"async_set",
"(",
"\"test.entity\"",
",",
"9",
")",
"await",
"hass",
".",
"async_block_till_done",
"(",
")",
"assert",
"await",
"async_setup... | [
218,
0
] | [
241,
26
] | python | en | ['en', 'en', 'en'] | True |
test_if_fires_on_initial_entity_above | (hass, calls) | Test the firing when starting with a match. | Test the firing when starting with a match. | async def test_if_fires_on_initial_entity_above(hass, calls):
"""Test the firing when starting with a match."""
hass.states.async_set("test.entity", 11)
await hass.async_block_till_done()
assert await async_setup_component(
hass,
automation.DOMAIN,
{
automation.DOMAI... | [
"async",
"def",
"test_if_fires_on_initial_entity_above",
"(",
"hass",
",",
"calls",
")",
":",
"hass",
".",
"states",
".",
"async_set",
"(",
"\"test.entity\"",
",",
"11",
")",
"await",
"hass",
".",
"async_block_till_done",
"(",
")",
"assert",
"await",
"async_setu... | [
244,
0
] | [
267,
26
] | python | en | ['en', 'en', 'en'] | True |
test_if_fires_on_entity_change_above | (hass, calls) | Test the firing with changed entity. | Test the firing with changed entity. | async def test_if_fires_on_entity_change_above(hass, calls):
"""Test the firing with changed entity."""
assert await async_setup_component(
hass,
automation.DOMAIN,
{
automation.DOMAIN: {
"trigger": {
"platform": "numeric_state",
... | [
"async",
"def",
"test_if_fires_on_entity_change_above",
"(",
"hass",
",",
"calls",
")",
":",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"automation",
".",
"DOMAIN",
",",
"{",
"automation",
".",
"DOMAIN",
":",
"{",
"\"trigger\"",
":",
"{",
"\... | [
270,
0
] | [
289,
26
] | python | en | ['en', 'en', 'en'] | True |
test_if_fires_on_entity_change_below_to_above | (hass, calls) | Test the firing with changed entity. | Test the firing with changed entity. | async def test_if_fires_on_entity_change_below_to_above(hass, calls):
"""Test the firing with changed entity."""
# set initial state
hass.states.async_set("test.entity", 9)
await hass.async_block_till_done()
assert await async_setup_component(
hass,
automation.DOMAIN,
{
... | [
"async",
"def",
"test_if_fires_on_entity_change_below_to_above",
"(",
"hass",
",",
"calls",
")",
":",
"# set initial state",
"hass",
".",
"states",
".",
"async_set",
"(",
"\"test.entity\"",
",",
"9",
")",
"await",
"hass",
".",
"async_block_till_done",
"(",
")",
"a... | [
292,
0
] | [
316,
26
] | python | en | ['en', 'en', 'en'] | True |
test_if_not_fires_on_entity_change_above_to_above | (hass, calls) | Test the firing with changed entity. | Test the firing with changed entity. | async def test_if_not_fires_on_entity_change_above_to_above(hass, calls):
"""Test the firing with changed entity."""
# set initial state
hass.states.async_set("test.entity", 9)
await hass.async_block_till_done()
assert await async_setup_component(
hass,
automation.DOMAIN,
{
... | [
"async",
"def",
"test_if_not_fires_on_entity_change_above_to_above",
"(",
"hass",
",",
"calls",
")",
":",
"# set initial state",
"hass",
".",
"states",
".",
"async_set",
"(",
"\"test.entity\"",
",",
"9",
")",
"await",
"hass",
".",
"async_block_till_done",
"(",
")",
... | [
319,
0
] | [
348,
26
] | python | en | ['en', 'en', 'en'] | True |
test_if_not_above_fires_on_entity_change_to_equal | (hass, calls) | Test the firing with changed entity. | Test the firing with changed entity. | async def test_if_not_above_fires_on_entity_change_to_equal(hass, calls):
"""Test the firing with changed entity."""
# set initial state
hass.states.async_set("test.entity", 9)
await hass.async_block_till_done()
assert await async_setup_component(
hass,
automation.DOMAIN,
{
... | [
"async",
"def",
"test_if_not_above_fires_on_entity_change_to_equal",
"(",
"hass",
",",
"calls",
")",
":",
"# set initial state",
"hass",
".",
"states",
".",
"async_set",
"(",
"\"test.entity\"",
",",
"9",
")",
"await",
"hass",
".",
"async_block_till_done",
"(",
")",
... | [
351,
0
] | [
375,
26
] | python | en | ['en', 'en', 'en'] | True |
test_if_fires_on_entity_change_below_range | (hass, calls) | Test the firing with changed entity. | Test the firing with changed entity. | async def test_if_fires_on_entity_change_below_range(hass, calls):
"""Test the firing with changed entity."""
assert await async_setup_component(
hass,
automation.DOMAIN,
{
automation.DOMAIN: {
"trigger": {
"platform": "numeric_state",
... | [
"async",
"def",
"test_if_fires_on_entity_change_below_range",
"(",
"hass",
",",
"calls",
")",
":",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"automation",
".",
"DOMAIN",
",",
"{",
"automation",
".",
"DOMAIN",
":",
"{",
"\"trigger\"",
":",
"{"... | [
378,
0
] | [
398,
26
] | python | en | ['en', 'en', 'en'] | True |
test_if_fires_on_entity_change_below_above_range | (hass, calls) | Test the firing with changed entity. | Test the firing with changed entity. | async def test_if_fires_on_entity_change_below_above_range(hass, calls):
"""Test the firing with changed entity."""
assert await async_setup_component(
hass,
automation.DOMAIN,
{
automation.DOMAIN: {
"trigger": {
"platform": "numeric_state"... | [
"async",
"def",
"test_if_fires_on_entity_change_below_above_range",
"(",
"hass",
",",
"calls",
")",
":",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"automation",
".",
"DOMAIN",
",",
"{",
"automation",
".",
"DOMAIN",
":",
"{",
"\"trigger\"",
":",... | [
401,
0
] | [
421,
26
] | python | en | ['en', 'en', 'en'] | True |
test_if_fires_on_entity_change_over_to_below_range | (hass, calls) | Test the firing with changed entity. | Test the firing with changed entity. | async def test_if_fires_on_entity_change_over_to_below_range(hass, calls):
"""Test the firing with changed entity."""
hass.states.async_set("test.entity", 11)
await hass.async_block_till_done()
assert await async_setup_component(
hass,
automation.DOMAIN,
{
automation... | [
"async",
"def",
"test_if_fires_on_entity_change_over_to_below_range",
"(",
"hass",
",",
"calls",
")",
":",
"hass",
".",
"states",
".",
"async_set",
"(",
"\"test.entity\"",
",",
"11",
")",
"await",
"hass",
".",
"async_block_till_done",
"(",
")",
"assert",
"await",
... | [
424,
0
] | [
448,
26
] | python | en | ['en', 'en', 'en'] | True |
test_if_fires_on_entity_change_over_to_below_above_range | (hass, calls) | Test the firing with changed entity. | Test the firing with changed entity. | async def test_if_fires_on_entity_change_over_to_below_above_range(hass, calls):
"""Test the firing with changed entity."""
hass.states.async_set("test.entity", 11)
await hass.async_block_till_done()
assert await async_setup_component(
hass,
automation.DOMAIN,
{
auto... | [
"async",
"def",
"test_if_fires_on_entity_change_over_to_below_above_range",
"(",
"hass",
",",
"calls",
")",
":",
"hass",
".",
"states",
".",
"async_set",
"(",
"\"test.entity\"",
",",
"11",
")",
"await",
"hass",
".",
"async_block_till_done",
"(",
")",
"assert",
"aw... | [
451,
0
] | [
475,
26
] | python | en | ['en', 'en', 'en'] | True |
test_if_not_fires_if_entity_not_match | (hass, calls) | Test if not fired with non matching entity. | Test if not fired with non matching entity. | async def test_if_not_fires_if_entity_not_match(hass, calls):
"""Test if not fired with non matching entity."""
assert await async_setup_component(
hass,
automation.DOMAIN,
{
automation.DOMAIN: {
"trigger": {
"platform": "numeric_state",
... | [
"async",
"def",
"test_if_not_fires_if_entity_not_match",
"(",
"hass",
",",
"calls",
")",
":",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"automation",
".",
"DOMAIN",
",",
"{",
"automation",
".",
"DOMAIN",
":",
"{",
"\"trigger\"",
":",
"{",
"... | [
478,
0
] | [
497,
26
] | python | en | ['en', 'en', 'en'] | True |
test_if_fires_on_entity_change_below_with_attribute | (hass, calls) | Test attributes change. | Test attributes change. | async def test_if_fires_on_entity_change_below_with_attribute(hass, calls):
"""Test attributes change."""
assert await async_setup_component(
hass,
automation.DOMAIN,
{
automation.DOMAIN: {
"trigger": {
"platform": "numeric_state",
... | [
"async",
"def",
"test_if_fires_on_entity_change_below_with_attribute",
"(",
"hass",
",",
"calls",
")",
":",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"automation",
".",
"DOMAIN",
",",
"{",
"automation",
".",
"DOMAIN",
":",
"{",
"\"trigger\"",
"... | [
500,
0
] | [
519,
26
] | python | en | ['en', 'de', 'en'] | True |
test_if_not_fires_on_entity_change_not_below_with_attribute | (hass, calls) | Test attributes. | Test attributes. | async def test_if_not_fires_on_entity_change_not_below_with_attribute(hass, calls):
"""Test attributes."""
assert await async_setup_component(
hass,
automation.DOMAIN,
{
automation.DOMAIN: {
"trigger": {
"platform": "numeric_state",
... | [
"async",
"def",
"test_if_not_fires_on_entity_change_not_below_with_attribute",
"(",
"hass",
",",
"calls",
")",
":",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"automation",
".",
"DOMAIN",
",",
"{",
"automation",
".",
"DOMAIN",
":",
"{",
"\"trigger... | [
522,
0
] | [
541,
26
] | python | en | ['en', 'la', 'en'] | False |
test_if_fires_on_attribute_change_with_attribute_below | (hass, calls) | Test attributes change. | Test attributes change. | async def test_if_fires_on_attribute_change_with_attribute_below(hass, calls):
"""Test attributes change."""
assert await async_setup_component(
hass,
automation.DOMAIN,
{
automation.DOMAIN: {
"trigger": {
"platform": "numeric_state",
... | [
"async",
"def",
"test_if_fires_on_attribute_change_with_attribute_below",
"(",
"hass",
",",
"calls",
")",
":",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"automation",
".",
"DOMAIN",
",",
"{",
"automation",
".",
"DOMAIN",
":",
"{",
"\"trigger\"",
... | [
544,
0
] | [
564,
26
] | python | en | ['en', 'de', 'en'] | True |
test_if_not_fires_on_attribute_change_with_attribute_not_below | (hass, calls) | Test attributes change. | Test attributes change. | async def test_if_not_fires_on_attribute_change_with_attribute_not_below(hass, calls):
"""Test attributes change."""
assert await async_setup_component(
hass,
automation.DOMAIN,
{
automation.DOMAIN: {
"trigger": {
"platform": "numeric_state... | [
"async",
"def",
"test_if_not_fires_on_attribute_change_with_attribute_not_below",
"(",
"hass",
",",
"calls",
")",
":",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"automation",
".",
"DOMAIN",
",",
"{",
"automation",
".",
"DOMAIN",
":",
"{",
"\"trig... | [
567,
0
] | [
587,
26
] | python | en | ['en', 'de', 'en'] | True |
test_if_not_fires_on_entity_change_with_attribute_below | (hass, calls) | Test attributes change. | Test attributes change. | async def test_if_not_fires_on_entity_change_with_attribute_below(hass, calls):
"""Test attributes change."""
assert await async_setup_component(
hass,
automation.DOMAIN,
{
automation.DOMAIN: {
"trigger": {
"platform": "numeric_state",
... | [
"async",
"def",
"test_if_not_fires_on_entity_change_with_attribute_below",
"(",
"hass",
",",
"calls",
")",
":",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"automation",
".",
"DOMAIN",
",",
"{",
"automation",
".",
"DOMAIN",
":",
"{",
"\"trigger\"",... | [
590,
0
] | [
610,
26
] | python | en | ['en', 'de', 'en'] | True |
test_if_not_fires_on_entity_change_with_not_attribute_below | (hass, calls) | Test attributes change. | Test attributes change. | async def test_if_not_fires_on_entity_change_with_not_attribute_below(hass, calls):
"""Test attributes change."""
assert await async_setup_component(
hass,
automation.DOMAIN,
{
automation.DOMAIN: {
"trigger": {
"platform": "numeric_state",
... | [
"async",
"def",
"test_if_not_fires_on_entity_change_with_not_attribute_below",
"(",
"hass",
",",
"calls",
")",
":",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"automation",
".",
"DOMAIN",
",",
"{",
"automation",
".",
"DOMAIN",
":",
"{",
"\"trigger... | [
613,
0
] | [
633,
26
] | python | en | ['en', 'de', 'en'] | True |
test_fires_on_attr_change_with_attribute_below_and_multiple_attr | (hass, calls) | Test attributes change. | Test attributes change. | async def test_fires_on_attr_change_with_attribute_below_and_multiple_attr(hass, calls):
"""Test attributes change."""
assert await async_setup_component(
hass,
automation.DOMAIN,
{
automation.DOMAIN: {
"trigger": {
"platform": "numeric_sta... | [
"async",
"def",
"test_fires_on_attr_change_with_attribute_below_and_multiple_attr",
"(",
"hass",
",",
"calls",
")",
":",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"automation",
".",
"DOMAIN",
",",
"{",
"automation",
".",
"DOMAIN",
":",
"{",
"\"tr... | [
636,
0
] | [
658,
26
] | python | en | ['en', 'de', 'en'] | True |
test_template_list | (hass, calls) | Test template list. | Test template list. | async def test_template_list(hass, calls):
"""Test template list."""
assert await async_setup_component(
hass,
automation.DOMAIN,
{
automation.DOMAIN: {
"trigger": {
"platform": "numeric_state",
"entity_id": "test.entity... | [
"async",
"def",
"test_template_list",
"(",
"hass",
",",
"calls",
")",
":",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"automation",
".",
"DOMAIN",
",",
"{",
"automation",
".",
"DOMAIN",
":",
"{",
"\"trigger\"",
":",
"{",
"\"platform\"",
":... | [
661,
0
] | [
681,
26
] | python | en | ['it', 'lb', 'en'] | False |
test_template_string | (hass, calls) | Test template string. | Test template string. | async def test_template_string(hass, calls):
"""Test template string."""
assert await async_setup_component(
hass,
automation.DOMAIN,
{
automation.DOMAIN: {
"trigger": {
"platform": "numeric_state",
"entity_id": "test.en... | [
"async",
"def",
"test_template_string",
"(",
"hass",
",",
"calls",
")",
":",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"automation",
".",
"DOMAIN",
",",
"{",
"automation",
".",
"DOMAIN",
":",
"{",
"\"trigger\"",
":",
"{",
"\"platform\"",
... | [
684,
0
] | [
724,
5
] | python | en | ['en', 'en', 'en'] | True |
test_not_fires_on_attr_change_with_attr_not_below_multiple_attr | (hass, calls) | Test if not fired changed attributes. | Test if not fired changed attributes. | async def test_not_fires_on_attr_change_with_attr_not_below_multiple_attr(hass, calls):
"""Test if not fired changed attributes."""
assert await async_setup_component(
hass,
automation.DOMAIN,
{
automation.DOMAIN: {
"trigger": {
"platform":... | [
"async",
"def",
"test_not_fires_on_attr_change_with_attr_not_below_multiple_attr",
"(",
"hass",
",",
"calls",
")",
":",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"automation",
".",
"DOMAIN",
",",
"{",
"automation",
".",
"DOMAIN",
":",
"{",
"\"tri... | [
727,
0
] | [
749,
26
] | python | en | ['en', 'en', 'en'] | True |
test_if_action | (hass, calls) | Test if action. | Test if action. | async def test_if_action(hass, calls):
"""Test if action."""
entity_id = "domain.test_entity"
assert await async_setup_component(
hass,
automation.DOMAIN,
{
automation.DOMAIN: {
"trigger": {"platform": "event", "event_type": "test_event"},
... | [
"async",
"def",
"test_if_action",
"(",
"hass",
",",
"calls",
")",
":",
"entity_id",
"=",
"\"domain.test_entity\"",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"automation",
".",
"DOMAIN",
",",
"{",
"automation",
".",
"DOMAIN",
":",
"{",
"\"tr... | [
752,
0
] | [
788,
26
] | 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": "numeric_state",
... | [
"async",
"def",
"test_if_fails_setup_bad_for",
"(",
"hass",
",",
"calls",
")",
":",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"automation",
".",
"DOMAIN",
",",
"{",
"automation",
".",
"DOMAIN",
":",
"{",
"\"trigger\"",
":",
"{",
"\"platform... | [
791,
0
] | [
813,
39
] | python | en | ['en', 'en', 'en'] | True |
test_if_fails_setup_for_without_above_below | (hass, calls) | Test for setup failures for missing above or below. | Test for setup failures for missing above or below. | async def test_if_fails_setup_for_without_above_below(hass, calls):
"""Test for setup failures for missing above or below."""
with assert_setup_component(0, automation.DOMAIN):
assert await async_setup_component(
hass,
automation.DOMAIN,
{
automation.D... | [
"async",
"def",
"test_if_fails_setup_for_without_above_below",
"(",
"hass",
",",
"calls",
")",
":",
"with",
"assert_setup_component",
"(",
"0",
",",
"automation",
".",
"DOMAIN",
")",
":",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"automation",
... | [
816,
0
] | [
832,
9
] | 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": "numeric_s... | [
"async",
"def",
"test_if_not_fires_on_entity_change_with_for",
"(",
"hass",
",",
"calls",
")",
":",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"automation",
".",
"DOMAIN",
",",
"{",
"automation",
".",
"DOMAIN",
":",
"{",
"\"trigger\"",
":",
"{... | [
835,
0
] | [
860,
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 entities change with for after stop. | Test for not firing on entities change with for after stop. | async def test_if_not_fires_on_entities_change_with_for_after_stop(hass, calls):
"""Test for not firing on entities change with for after stop."""
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\""... | [
863,
0
] | [
903,
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\""... | [
906,
0
] | [
938,
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": "numeric_state",
... | [
"async",
"def",
"test_if_fires_on_entity_change_with_for",
"(",
"hass",
",",
"calls",
")",
":",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"automation",
".",
"DOMAIN",
",",
"{",
"automation",
".",
"DOMAIN",
":",
"{",
"\"trigger\"",
":",
"{",
... | [
941,
0
] | [
964,
26
] | 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": "numeric_state",
... | [
"async",
"def",
"test_wait_template_with_trigger",
"(",
"hass",
",",
"calls",
")",
":",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"automation",
".",
"DOMAIN",
",",
"{",
"automation",
".",
"DOMAIN",
":",
"{",
"\"trigger\"",
":",
"{",
"\"plat... | [
967,
0
] | [
1001,
70
] | 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": "nume... | [
"async",
"def",
"test_if_fires_on_entities_change_no_overlap",
"(",
"hass",
",",
"calls",
")",
":",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"automation",
".",
"DOMAIN",
",",
"{",
"automation",
".",
"DOMAIN",
":",
"{",
"\"trigger\"",
":",
"{... | [
1004,
0
] | [
1044,
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": "numeric_st... | [
"async",
"def",
"test_if_fires_on_entities_change_overlap",
"(",
"hass",
",",
"calls",
")",
":",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"automation",
".",
"DOMAIN",
",",
"{",
"automation",
".",
"DOMAIN",
":",
"{",
"\"trigger\"",
":",
"{",
... | [
1047,
0
] | [
1098,
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": "numeric_st... | [
"async",
"def",
"test_if_fires_on_change_with_for_template_1",
"(",
"hass",
",",
"calls",
")",
":",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"automation",
".",
"DOMAIN",
",",
"{",
"automation",
".",
"DOMAIN",
":",
"{",
"\"trigger\"",
":",
"{... | [
1101,
0
] | [
1125,
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": "numeric_st... | [
"async",
"def",
"test_if_fires_on_change_with_for_template_2",
"(",
"hass",
",",
"calls",
")",
":",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"automation",
".",
"DOMAIN",
",",
"{",
"automation",
".",
"DOMAIN",
":",
"{",
"\"trigger\"",
":",
"{... | [
1128,
0
] | [
1152,
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": "numeric_st... | [
"async",
"def",
"test_if_fires_on_change_with_for_template_3",
"(",
"hass",
",",
"calls",
")",
":",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"automation",
".",
"DOMAIN",
",",
"{",
"automation",
".",
"DOMAIN",
":",
"{",
"\"trigger\"",
":",
"{... | [
1155,
0
] | [
1179,
26
] | python | en | ['en', 'en', 'en'] | True |
test_invalid_for_template | (hass, calls) | Test for invalid for template. | Test for invalid for template. | async def test_invalid_for_template(hass, calls):
"""Test for invalid for template."""
assert await async_setup_component(
hass,
automation.DOMAIN,
{
automation.DOMAIN: {
"trigger": {
"platform": "numeric_state",
"entity... | [
"async",
"def",
"test_invalid_for_template",
"(",
"hass",
",",
"calls",
")",
":",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"automation",
".",
"DOMAIN",
",",
"{",
"automation",
".",
"DOMAIN",
":",
"{",
"\"trigger\"",
":",
"{",
"\"platform\"... | [
1182,
0
] | [
1204,
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\"",
... | [
1207,
0
] | [
1265,
65
] | python | en | ['en', 'en', 'en'] | True |
test_below_above | () | Test above cannot be above below. | Test above cannot be above below. | def test_below_above():
"""Test above cannot be above below."""
with pytest.raises(vol.Invalid):
numeric_state_trigger.TRIGGER_SCHEMA(
{"platform": "numeric_state", "above": 1200, "below": 1000}
) | [
"def",
"test_below_above",
"(",
")",
":",
"with",
"pytest",
".",
"raises",
"(",
"vol",
".",
"Invalid",
")",
":",
"numeric_state_trigger",
".",
"TRIGGER_SCHEMA",
"(",
"{",
"\"platform\"",
":",
"\"numeric_state\"",
",",
"\"above\"",
":",
"1200",
",",
"\"below\""... | [
1268,
0
] | [
1273,
9
] | 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", {"test-measurement": 1})
assert await async_setup_component(
hass,
automation.DOMAIN,
{
... | [
"async",
"def",
"test_attribute_if_fires_on_entity_change_with_both_filters",
"(",
"hass",
",",
"calls",
")",
":",
"hass",
".",
"states",
".",
"async_set",
"(",
"\"test.entity\"",
",",
"\"bla\"",
",",
"{",
"\"test-measurement\"",
":",
"1",
"}",
")",
"assert",
"awa... | [
1276,
0
] | [
1299,
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", {"test-measurement": 1})
assert await async_setup_component(
hass,
automation.... | [
"async",
"def",
"test_attribute_if_not_fires_on_entities_change_with_for_after_stop",
"(",
"hass",
",",
"calls",
")",
":",
"hass",
".",
"states",
".",
"async_set",
"(",
"\"test.entity\"",
",",
"\"bla\"",
",",
"{",
"\"test-measurement\"",
":",
"1",
"}",
")",
"assert"... | [
1302,
0
] | [
1331,
26
] | python | en | ['en', 'en', 'en'] | True |
async_setup | (hass: HomeAssistant, config: Config) | Set up configured AccuWeather. | Set up configured AccuWeather. | async def async_setup(hass: HomeAssistant, config: Config) -> bool:
"""Set up configured AccuWeather."""
hass.data.setdefault(DOMAIN, {})
return True | [
"async",
"def",
"async_setup",
"(",
"hass",
":",
"HomeAssistant",
",",
"config",
":",
"Config",
")",
"->",
"bool",
":",
"hass",
".",
"data",
".",
"setdefault",
"(",
"DOMAIN",
",",
"{",
"}",
")",
"return",
"True"
] | [
28,
0
] | [
31,
15
] | python | en | ['en', 'nl', 'en'] | True |
async_setup_entry | (hass, config_entry) | Set up AccuWeather as config entry. | Set up AccuWeather as config entry. | async def async_setup_entry(hass, config_entry) -> bool:
"""Set up AccuWeather as config entry."""
api_key = config_entry.data[CONF_API_KEY]
location_key = config_entry.unique_id
forecast = config_entry.options.get(CONF_FORECAST, False)
_LOGGER.debug("Using location_key: %s, get forecast: %s", loca... | [
"async",
"def",
"async_setup_entry",
"(",
"hass",
",",
"config_entry",
")",
"->",
"bool",
":",
"api_key",
"=",
"config_entry",
".",
"data",
"[",
"CONF_API_KEY",
"]",
"location_key",
"=",
"config_entry",
".",
"unique_id",
"forecast",
"=",
"config_entry",
".",
"... | [
34,
0
] | [
64,
15
] | python | en | ['en', 'en', 'en'] | True |
async_unload_entry | (hass, config_entry) | Unload a config entry. | Unload a config entry. | async def async_unload_entry(hass, config_entry):
"""Unload a config entry."""
unload_ok = all(
await asyncio.gather(
*[
hass.config_entries.async_forward_entry_unload(config_entry, component)
for component in PLATFORMS
]
)
)
hass.... | [
"async",
"def",
"async_unload_entry",
"(",
"hass",
",",
"config_entry",
")",
":",
"unload_ok",
"=",
"all",
"(",
"await",
"asyncio",
".",
"gather",
"(",
"*",
"[",
"hass",
".",
"config_entries",
".",
"async_forward_entry_unload",
"(",
"config_entry",
",",
"compo... | [
67,
0
] | [
83,
20
] | python | en | ['en', 'es', 'en'] | True |
update_listener | (hass, config_entry) | Update listener. | Update listener. | async def update_listener(hass, config_entry):
"""Update listener."""
await hass.config_entries.async_reload(config_entry.entry_id) | [
"async",
"def",
"update_listener",
"(",
"hass",
",",
"config_entry",
")",
":",
"await",
"hass",
".",
"config_entries",
".",
"async_reload",
"(",
"config_entry",
".",
"entry_id",
")"
] | [
86,
0
] | [
88,
65
] | python | de | ['it', 'de', 'en'] | False |
AccuWeatherDataUpdateCoordinator.__init__ | (self, hass, session, api_key, location_key, forecast: bool) | Initialize. | Initialize. | def __init__(self, hass, session, api_key, location_key, forecast: bool):
"""Initialize."""
self.location_key = location_key
self.forecast = forecast
self.is_metric = hass.config.units.is_metric
self.accuweather = AccuWeather(api_key, session, location_key=self.location_key)
... | [
"def",
"__init__",
"(",
"self",
",",
"hass",
",",
"session",
",",
"api_key",
",",
"location_key",
",",
"forecast",
":",
"bool",
")",
":",
"self",
".",
"location_key",
"=",
"location_key",
"self",
".",
"forecast",
"=",
"forecast",
"self",
".",
"is_metric",
... | [
94,
4
] | [
111,
85
] | python | en | ['en', 'en', 'it'] | False |
AccuWeatherDataUpdateCoordinator._async_update_data | (self) | Update data via library. | Update data via library. | async def _async_update_data(self):
"""Update data via library."""
try:
async with timeout(10):
current = await self.accuweather.async_get_current_conditions()
forecast = (
await self.accuweather.async_get_forecast(metric=self.is_metric)
... | [
"async",
"def",
"_async_update_data",
"(",
"self",
")",
":",
"try",
":",
"async",
"with",
"timeout",
"(",
"10",
")",
":",
"current",
"=",
"await",
"self",
".",
"accuweather",
".",
"async_get_current_conditions",
"(",
")",
"forecast",
"=",
"(",
"await",
"se... | [
113,
4
] | [
131,
55
] | python | en | ['fr', 'en', 'en'] | True |
SpiderConfigFlow.__init__ | (self) | Initialize the Spider flow. | Initialize the Spider flow. | def __init__(self):
"""Initialize the Spider flow."""
self.data = {
CONF_USERNAME: "",
CONF_PASSWORD: "",
CONF_SCAN_INTERVAL: DEFAULT_SCAN_INTERVAL,
} | [
"def",
"__init__",
"(",
"self",
")",
":",
"self",
".",
"data",
"=",
"{",
"CONF_USERNAME",
":",
"\"\"",
",",
"CONF_PASSWORD",
":",
"\"\"",
",",
"CONF_SCAN_INTERVAL",
":",
"DEFAULT_SCAN_INTERVAL",
",",
"}"
] | [
28,
4
] | [
34,
9
] | python | en | ['en', 'en', 'en'] | True |
SpiderConfigFlow._try_connect | (self) | Try to connect and check auth. | Try to connect and check auth. | def _try_connect(self):
"""Try to connect and check auth."""
try:
SpiderApi(
self.data[CONF_USERNAME],
self.data[CONF_PASSWORD],
self.data[CONF_SCAN_INTERVAL],
)
except SpiderApiException:
return RESULT_CONN_ERRO... | [
"def",
"_try_connect",
"(",
"self",
")",
":",
"try",
":",
"SpiderApi",
"(",
"self",
".",
"data",
"[",
"CONF_USERNAME",
"]",
",",
"self",
".",
"data",
"[",
"CONF_PASSWORD",
"]",
",",
"self",
".",
"data",
"[",
"CONF_SCAN_INTERVAL",
"]",
",",
")",
"except... | [
36,
4
] | [
49,
29
] | python | en | ['en', 'en', 'en'] | True |
SpiderConfigFlow.async_step_user | (self, user_input=None) | Handle a flow initiated by the user. | Handle a flow initiated by the user. | async def async_step_user(self, user_input=None):
"""Handle a flow initiated by the user."""
if self._async_current_entries():
return self.async_abort(reason="single_instance_allowed")
errors = {}
if user_input is not None:
self.data[CONF_USERNAME] = user_input["... | [
"async",
"def",
"async_step_user",
"(",
"self",
",",
"user_input",
"=",
"None",
")",
":",
"if",
"self",
".",
"_async_current_entries",
"(",
")",
":",
"return",
"self",
".",
"async_abort",
"(",
"reason",
"=",
"\"single_instance_allowed\"",
")",
"errors",
"=",
... | [
51,
4
] | [
79,
9
] | python | en | ['en', 'en', 'en'] | True |
SpiderConfigFlow.async_step_import | (self, import_data) | Import spider config from configuration.yaml. | Import spider config from configuration.yaml. | async def async_step_import(self, import_data):
"""Import spider config from configuration.yaml."""
return await self.async_step_user(import_data) | [
"async",
"def",
"async_step_import",
"(",
"self",
",",
"import_data",
")",
":",
"return",
"await",
"self",
".",
"async_step_user",
"(",
"import_data",
")"
] | [
81,
4
] | [
83,
54
] | python | en | ['en', 'en', 'en'] | True |
async_setup_platform | (hass, config, async_add_entities, discovery_info=None) | Set up a single GEM temperature sensor. | Set up a single GEM temperature sensor. | async def async_setup_platform(hass, config, async_add_entities, discovery_info=None):
"""Set up a single GEM temperature sensor."""
if not discovery_info:
return
entities = []
for sensor in discovery_info:
sensor_type = sensor[CONF_SENSOR_TYPE]
if sensor_type == SENSOR_TYPE_CUR... | [
"async",
"def",
"async_setup_platform",
"(",
"hass",
",",
"config",
",",
"async_add_entities",
",",
"discovery_info",
"=",
"None",
")",
":",
"if",
"not",
"discovery_info",
":",
"return",
"entities",
"=",
"[",
"]",
"for",
"sensor",
"in",
"discovery_info",
":",
... | [
38,
0
] | [
84,
32
] | python | en | ['en', 'ca', 'en'] | True |
GEMSensor.__init__ | (self, monitor_serial_number, name, sensor_type, number) | Construct the entity. | Construct the entity. | def __init__(self, monitor_serial_number, name, sensor_type, number):
"""Construct the entity."""
self._monitor_serial_number = monitor_serial_number
self._name = name
self._sensor = None
self._sensor_type = sensor_type
self._number = number | [
"def",
"__init__",
"(",
"self",
",",
"monitor_serial_number",
",",
"name",
",",
"sensor_type",
",",
"number",
")",
":",
"self",
".",
"_monitor_serial_number",
"=",
"monitor_serial_number",
"self",
".",
"_name",
"=",
"name",
"self",
".",
"_sensor",
"=",
"None",... | [
90,
4
] | [
96,
29
] | python | en | ['en', 'en', 'en'] | True |
GEMSensor.should_poll | (self) | GEM pushes changes, so this returns False. | GEM pushes changes, so this returns False. | def should_poll(self):
"""GEM pushes changes, so this returns False."""
return False | [
"def",
"should_poll",
"(",
"self",
")",
":",
"return",
"False"
] | [
99,
4
] | [
101,
20
] | python | en | ['en', 'fr', 'en'] | True |
GEMSensor.unique_id | (self) | Return a unique ID for this sensor. | Return a unique ID for this sensor. | def unique_id(self):
"""Return a unique ID for this sensor."""
return f"{self._monitor_serial_number}-{self._sensor_type}-{self._number}" | [
"def",
"unique_id",
"(",
"self",
")",
":",
"return",
"f\"{self._monitor_serial_number}-{self._sensor_type}-{self._number}\""
] | [
104,
4
] | [
106,
82
] | python | en | ['en', 'ca', 'en'] | True |
GEMSensor.name | (self) | Return the name of the channel. | Return the name of the channel. | def name(self):
"""Return the name of the channel."""
return self._name | [
"def",
"name",
"(",
"self",
")",
":",
"return",
"self",
".",
"_name"
] | [
109,
4
] | [
111,
25
] | python | en | ['en', 'en', 'en'] | True |
GEMSensor.async_added_to_hass | (self) | Wait for and connect to the sensor. | Wait for and connect to the sensor. | async def async_added_to_hass(self):
"""Wait for and connect to the sensor."""
monitors = self.hass.data[DATA_GREENEYE_MONITOR]
if not self._try_connect_to_monitor(monitors):
monitors.add_listener(self._on_new_monitor) | [
"async",
"def",
"async_added_to_hass",
"(",
"self",
")",
":",
"monitors",
"=",
"self",
".",
"hass",
".",
"data",
"[",
"DATA_GREENEYE_MONITOR",
"]",
"if",
"not",
"self",
".",
"_try_connect_to_monitor",
"(",
"monitors",
")",
":",
"monitors",
".",
"add_listener",... | [
113,
4
] | [
118,
55
] | python | en | ['en', 'en', 'en'] | True |
GEMSensor.async_will_remove_from_hass | (self) | Remove listener from the sensor. | Remove listener from the sensor. | async def async_will_remove_from_hass(self):
"""Remove listener from the sensor."""
if self._sensor:
self._sensor.remove_listener(self.async_write_ha_state)
else:
monitors = self.hass.data[DATA_GREENEYE_MONITOR]
monitors.remove_listener(self._on_new_monitor) | [
"async",
"def",
"async_will_remove_from_hass",
"(",
"self",
")",
":",
"if",
"self",
".",
"_sensor",
":",
"self",
".",
"_sensor",
".",
"remove_listener",
"(",
"self",
".",
"async_write_ha_state",
")",
"else",
":",
"monitors",
"=",
"self",
".",
"hass",
".",
... | [
125,
4
] | [
131,
58
] | python | en | ['en', 'no', 'en'] | True |
CurrentSensor.__init__ | (self, monitor_serial_number, number, name, net_metering) | Construct the entity. | Construct the entity. | def __init__(self, monitor_serial_number, number, name, net_metering):
"""Construct the entity."""
super().__init__(monitor_serial_number, name, "current", number)
self._net_metering = net_metering | [
"def",
"__init__",
"(",
"self",
",",
"monitor_serial_number",
",",
"number",
",",
"name",
",",
"net_metering",
")",
":",
"super",
"(",
")",
".",
"__init__",
"(",
"monitor_serial_number",
",",
"name",
",",
"\"current\"",
",",
"number",
")",
"self",
".",
"_n... | [
150,
4
] | [
153,
41
] | python | en | ['en', 'en', 'en'] | True |
CurrentSensor.icon | (self) | Return the icon that should represent this sensor in the UI. | Return the icon that should represent this sensor in the UI. | def icon(self):
"""Return the icon that should represent this sensor in the UI."""
return CURRENT_SENSOR_ICON | [
"def",
"icon",
"(",
"self",
")",
":",
"return",
"CURRENT_SENSOR_ICON"
] | [
159,
4
] | [
161,
34
] | python | en | ['en', 'en', 'en'] | True |
CurrentSensor.unit_of_measurement | (self) | Return the unit of measurement used by this sensor. | Return the unit of measurement used by this sensor. | def unit_of_measurement(self):
"""Return the unit of measurement used by this sensor."""
return UNIT_WATTS | [
"def",
"unit_of_measurement",
"(",
"self",
")",
":",
"return",
"UNIT_WATTS"
] | [
164,
4
] | [
166,
25
] | python | en | ['en', 'en', 'en'] | True |
CurrentSensor.state | (self) | Return the current number of watts being used by the channel. | Return the current number of watts being used by the channel. | def state(self):
"""Return the current number of watts being used by the channel."""
if not self._sensor:
return None
return self._sensor.watts | [
"def",
"state",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"_sensor",
":",
"return",
"None",
"return",
"self",
".",
"_sensor",
".",
"watts"
] | [
169,
4
] | [
174,
33
] | python | en | ['en', 'en', 'en'] | True |
CurrentSensor.device_state_attributes | (self) | Return total wattseconds in the state dictionary. | Return total wattseconds in the state dictionary. | def device_state_attributes(self):
"""Return total wattseconds in the state dictionary."""
if not self._sensor:
return None
if self._net_metering:
watt_seconds = self._sensor.polarized_watt_seconds
else:
watt_seconds = self._sensor.absolute_watt_secon... | [
"def",
"device_state_attributes",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"_sensor",
":",
"return",
"None",
"if",
"self",
".",
"_net_metering",
":",
"watt_seconds",
"=",
"self",
".",
"_sensor",
".",
"polarized_watt_seconds",
"else",
":",
"watt_seconds... | [
177,
4
] | [
187,
48
] | python | en | ['en', 'en', 'en'] | True |
PulseCounter.__init__ | (
self,
monitor_serial_number,
number,
name,
counted_quantity,
time_unit,
counted_quantity_per_pulse,
) | Construct the entity. | Construct the entity. | def __init__(
self,
monitor_serial_number,
number,
name,
counted_quantity,
time_unit,
counted_quantity_per_pulse,
):
"""Construct the entity."""
super().__init__(monitor_serial_number, name, "pulse", number)
self._counted_quantity = cou... | [
"def",
"__init__",
"(",
"self",
",",
"monitor_serial_number",
",",
"number",
",",
"name",
",",
"counted_quantity",
",",
"time_unit",
",",
"counted_quantity_per_pulse",
",",
")",
":",
"super",
"(",
")",
".",
"__init__",
"(",
"monitor_serial_number",
",",
"name",
... | [
193,
4
] | [
206,
35
] | python | en | ['en', 'en', 'en'] | True |
PulseCounter.icon | (self) | Return the icon that should represent this sensor in the UI. | Return the icon that should represent this sensor in the UI. | def icon(self):
"""Return the icon that should represent this sensor in the UI."""
return COUNTER_ICON | [
"def",
"icon",
"(",
"self",
")",
":",
"return",
"COUNTER_ICON"
] | [
212,
4
] | [
214,
27
] | python | en | ['en', 'en', 'en'] | True |
PulseCounter.state | (self) | Return the current rate of change for the given pulse counter. | Return the current rate of change for the given pulse counter. | def state(self):
"""Return the current rate of change for the given pulse counter."""
if not self._sensor or self._sensor.pulses_per_second is None:
return None
return (
self._sensor.pulses_per_second
* self._counted_quantity_per_pulse
* self._sec... | [
"def",
"state",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"_sensor",
"or",
"self",
".",
"_sensor",
".",
"pulses_per_second",
"is",
"None",
":",
"return",
"None",
"return",
"(",
"self",
".",
"_sensor",
".",
"pulses_per_second",
"*",
"self",
".",
... | [
217,
4
] | [
226,
9
] | python | en | ['en', 'en', 'en'] | True |
PulseCounter._seconds_per_time_unit | (self) | Return the number of seconds in the given display time unit. | Return the number of seconds in the given display time unit. | def _seconds_per_time_unit(self):
"""Return the number of seconds in the given display time unit."""
if self._time_unit == TIME_SECONDS:
return 1
if self._time_unit == TIME_MINUTES:
return 60
if self._time_unit == TIME_HOURS:
return 3600 | [
"def",
"_seconds_per_time_unit",
"(",
"self",
")",
":",
"if",
"self",
".",
"_time_unit",
"==",
"TIME_SECONDS",
":",
"return",
"1",
"if",
"self",
".",
"_time_unit",
"==",
"TIME_MINUTES",
":",
"return",
"60",
"if",
"self",
".",
"_time_unit",
"==",
"TIME_HOURS"... | [
229,
4
] | [
236,
23
] | python | en | ['en', 'en', 'en'] | True |
PulseCounter.unit_of_measurement | (self) | Return the unit of measurement for this pulse counter. | Return the unit of measurement for this pulse counter. | def unit_of_measurement(self):
"""Return the unit of measurement for this pulse counter."""
return f"{self._counted_quantity}/{self._time_unit}" | [
"def",
"unit_of_measurement",
"(",
"self",
")",
":",
"return",
"f\"{self._counted_quantity}/{self._time_unit}\""
] | [
239,
4
] | [
241,
60
] | python | en | ['en', 'en', 'en'] | True |
PulseCounter.device_state_attributes | (self) | Return total pulses in the data dictionary. | Return total pulses in the data dictionary. | def device_state_attributes(self):
"""Return total pulses in the data dictionary."""
if not self._sensor:
return None
return {DATA_PULSES: self._sensor.pulses} | [
"def",
"device_state_attributes",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"_sensor",
":",
"return",
"None",
"return",
"{",
"DATA_PULSES",
":",
"self",
".",
"_sensor",
".",
"pulses",
"}"
] | [
244,
4
] | [
249,
49
] | python | en | ['en', 'en', 'en'] | True |
TemperatureSensor.__init__ | (self, monitor_serial_number, number, name, unit) | Construct the entity. | Construct the entity. | def __init__(self, monitor_serial_number, number, name, unit):
"""Construct the entity."""
super().__init__(monitor_serial_number, name, "temp", number)
self._unit = unit | [
"def",
"__init__",
"(",
"self",
",",
"monitor_serial_number",
",",
"number",
",",
"name",
",",
"unit",
")",
":",
"super",
"(",
")",
".",
"__init__",
"(",
"monitor_serial_number",
",",
"name",
",",
"\"temp\"",
",",
"number",
")",
"self",
".",
"_unit",
"="... | [
255,
4
] | [
258,
25
] | python | en | ['en', 'en', 'en'] | True |
TemperatureSensor.icon | (self) | Return the icon that should represent this sensor in the UI. | Return the icon that should represent this sensor in the UI. | def icon(self):
"""Return the icon that should represent this sensor in the UI."""
return TEMPERATURE_ICON | [
"def",
"icon",
"(",
"self",
")",
":",
"return",
"TEMPERATURE_ICON"
] | [
264,
4
] | [
266,
31
] | python | en | ['en', 'en', 'en'] | True |
TemperatureSensor.state | (self) | Return the current temperature being reported by this sensor. | Return the current temperature being reported by this sensor. | def state(self):
"""Return the current temperature being reported by this sensor."""
if not self._sensor:
return None
return self._sensor.temperature | [
"def",
"state",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"_sensor",
":",
"return",
"None",
"return",
"self",
".",
"_sensor",
".",
"temperature"
] | [
269,
4
] | [
274,
39
] | python | en | ['en', 'en', 'en'] | True |
TemperatureSensor.unit_of_measurement | (self) | Return the unit of measurement for this sensor (user specified). | Return the unit of measurement for this sensor (user specified). | def unit_of_measurement(self):
"""Return the unit of measurement for this sensor (user specified)."""
return self._unit | [
"def",
"unit_of_measurement",
"(",
"self",
")",
":",
"return",
"self",
".",
"_unit"
] | [
277,
4
] | [
279,
25
] | python | en | ['en', 'en', 'en'] | True |
VoltageSensor.__init__ | (self, monitor_serial_number, number, name) | Construct the entity. | Construct the entity. | def __init__(self, monitor_serial_number, number, name):
"""Construct the entity."""
super().__init__(monitor_serial_number, name, "volts", number) | [
"def",
"__init__",
"(",
"self",
",",
"monitor_serial_number",
",",
"number",
",",
"name",
")",
":",
"super",
"(",
")",
".",
"__init__",
"(",
"monitor_serial_number",
",",
"name",
",",
"\"volts\"",
",",
"number",
")"
] | [
285,
4
] | [
287,
70
] | python | en | ['en', 'en', 'en'] | True |
VoltageSensor._get_sensor | (self, monitor) | Wire the updates to the monitor itself, since there is no voltage element in the API. | Wire the updates to the monitor itself, since there is no voltage element in the API. | def _get_sensor(self, monitor):
"""Wire the updates to the monitor itself, since there is no voltage element in the API."""
return monitor | [
"def",
"_get_sensor",
"(",
"self",
",",
"monitor",
")",
":",
"return",
"monitor"
] | [
289,
4
] | [
291,
22
] | python | en | ['en', 'en', 'en'] | True |
VoltageSensor.icon | (self) | Return the icon that should represent this sensor in the UI. | Return the icon that should represent this sensor in the UI. | def icon(self):
"""Return the icon that should represent this sensor in the UI."""
return VOLTAGE_ICON | [
"def",
"icon",
"(",
"self",
")",
":",
"return",
"VOLTAGE_ICON"
] | [
294,
4
] | [
296,
27
] | python | en | ['en', 'en', 'en'] | True |
VoltageSensor.state | (self) | Return the current voltage being reported by this sensor. | Return the current voltage being reported by this sensor. | def state(self):
"""Return the current voltage being reported by this sensor."""
if not self._sensor:
return None
return self._sensor.voltage | [
"def",
"state",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"_sensor",
":",
"return",
"None",
"return",
"self",
".",
"_sensor",
".",
"voltage"
] | [
299,
4
] | [
304,
35
] | python | en | ['en', 'en', 'en'] | True |
VoltageSensor.unit_of_measurement | (self) | Return the unit of measurement for this sensor. | Return the unit of measurement for this sensor. | def unit_of_measurement(self):
"""Return the unit of measurement for this sensor."""
return VOLT | [
"def",
"unit_of_measurement",
"(",
"self",
")",
":",
"return",
"VOLT"
] | [
307,
4
] | [
309,
19
] | python | en | ['en', 'en', 'en'] | True |
graph_dumps | (graph) |
Dump the graph.
|
Dump the graph.
| def graph_dumps(graph):
'''
Dump the graph.
'''
return json.dumps(graph, default=lambda obj: obj.__dict__) | [
"def",
"graph_dumps",
"(",
"graph",
")",
":",
"return",
"json",
".",
"dumps",
"(",
"graph",
",",
"default",
"=",
"lambda",
"obj",
":",
"obj",
".",
"__dict__",
")"
] | [
96,
0
] | [
100,
62
] | python | en | ['en', 'error', 'th'] | False |
graph_loads | (graph_json) |
Load graph
|
Load graph
| def graph_loads(graph_json):
'''
Load graph
'''
layers = []
for layer in graph_json['layers']:
layer_info = Layer(layer['type'], layer['input'], layer['output'], layer['size'])
layer_info.is_delete = layer['is_delete']
layers.append(layer_info)
graph = Graph(graph_json['m... | [
"def",
"graph_loads",
"(",
"graph_json",
")",
":",
"layers",
"=",
"[",
"]",
"for",
"layer",
"in",
"graph_json",
"[",
"'layers'",
"]",
":",
"layer_info",
"=",
"Layer",
"(",
"layer",
"[",
"'type'",
"]",
",",
"layer",
"[",
"'input'",
"]",
",",
"layer",
... | [
102,
0
] | [
113,
16
] | python | en | ['en', 'error', 'th'] | False |
Layer.set_size | (self, graph_id, size) |
Set size.
|
Set size.
| def set_size(self, graph_id, size):
'''
Set size.
'''
if self.graph_type == LayerType.attention.value:
if self.input[0] == graph_id:
self.size = size
if self.graph_type == LayerType.rnn.value:
self.size = size
if self.graph_type == ... | [
"def",
"set_size",
"(",
"self",
",",
"graph_id",
",",
"size",
")",
":",
"if",
"self",
".",
"graph_type",
"==",
"LayerType",
".",
"attention",
".",
"value",
":",
"if",
"self",
".",
"input",
"[",
"0",
"]",
"==",
"graph_id",
":",
"self",
".",
"size",
... | [
68,
4
] | [
82,
19
] | python | en | ['en', 'error', 'th'] | False |
Layer.clear_size | (self) |
Clear size
|
Clear size
| def clear_size(self):
'''
Clear size
'''
if self.graph_type == LayerType.attention.value or \
LayerType.rnn.value or LayerType.self_attention.value:
self.size = None | [
"def",
"clear_size",
"(",
"self",
")",
":",
"if",
"self",
".",
"graph_type",
"==",
"LayerType",
".",
"attention",
".",
"value",
"or",
"LayerType",
".",
"rnn",
".",
"value",
"or",
"LayerType",
".",
"self_attention",
".",
"value",
":",
"self",
".",
"size",... | [
84,
4
] | [
90,
28
] | python | en | ['en', 'error', 'th'] | False |
Graph.is_topology | (self, layers=None) |
valid the topology
|
valid the topology
| def is_topology(self, layers=None):
'''
valid the topology
'''
if layers is None:
layers = self.layers
layers_nodle = []
result = []
for i, layer in enumerate(layers):
if layer.is_delete is False:
layers_nodle.append(i)
... | [
"def",
"is_topology",
"(",
"self",
",",
"layers",
"=",
"None",
")",
":",
"if",
"layers",
"is",
"None",
":",
"layers",
"=",
"self",
".",
"layers",
"layers_nodle",
"=",
"[",
"]",
"result",
"=",
"[",
"]",
"for",
"i",
",",
"layer",
"in",
"enumerate",
"... | [
132,
4
] | [
167,
21
] | python | en | ['en', 'error', 'th'] | False |
Graph.layer_num | (self, layers=None) |
Reutn number of layer.
|
Reutn number of layer.
| def layer_num(self, layers=None):
'''
Reutn number of layer.
'''
if layers is None:
layers = self.layers
layer_num = 0
for layer in layers:
if layer.is_delete is False and layer.graph_type != LayerType.input.value\
and layer.graph_t... | [
"def",
"layer_num",
"(",
"self",
",",
"layers",
"=",
"None",
")",
":",
"if",
"layers",
"is",
"None",
":",
"layers",
"=",
"self",
".",
"layers",
"layer_num",
"=",
"0",
"for",
"layer",
"in",
"layers",
":",
"if",
"layer",
".",
"is_delete",
"is",
"False"... | [
169,
4
] | [
180,
24
] | python | en | ['en', 'error', 'th'] | False |
Graph.is_legal | (self, layers=None) |
Judge whether is legal for layers
|
Judge whether is legal for layers
| def is_legal(self, layers=None):
'''
Judge whether is legal for layers
'''
if layers is None:
layers = self.layers
for layer in layers:
if layer.is_delete is False:
if len(layer.input) != layer.input_size:
return False
... | [
"def",
"is_legal",
"(",
"self",
",",
"layers",
"=",
"None",
")",
":",
"if",
"layers",
"is",
"None",
":",
"layers",
"=",
"self",
".",
"layers",
"for",
"layer",
"in",
"layers",
":",
"if",
"layer",
".",
"is_delete",
"is",
"False",
":",
"if",
"len",
"(... | [
182,
4
] | [
204,
19
] | python | en | ['en', 'error', 'th'] | False |
Graph.mutation | (self, only_add=False) |
Mutation for a graph
|
Mutation for a graph
| def mutation(self, only_add=False):
'''
Mutation for a graph
'''
types = []
if self.layer_num() < self.max_layer_num:
types.append(0)
types.append(1)
if self.layer_num() > 5 and only_add is False:
types.append(2)
types.appen... | [
"def",
"mutation",
"(",
"self",
",",
"only_add",
"=",
"False",
")",
":",
"types",
"=",
"[",
"]",
"if",
"self",
".",
"layer_num",
"(",
")",
"<",
"self",
".",
"max_layer_num",
":",
"types",
".",
"append",
"(",
"0",
")",
"types",
".",
"append",
"(",
... | [
206,
4
] | [
279,
28
] | python | en | ['en', 'error', 'th'] | False |
test_sensors | (hass) | Test states of the sensors. | Test states of the sensors. | async def test_sensors(hass):
"""Test states of the sensors."""
test_time = datetime(2019, 11, 11, 9, 10, 32, tzinfo=UTC)
with patch(
"homeassistant.components.brother.sensor.utcnow", return_value=test_time
):
await init_integration(hass)
registry = await hass.helpers.entity_registr... | [
"async",
"def",
"test_sensors",
"(",
"hass",
")",
":",
"test_time",
"=",
"datetime",
"(",
"2019",
",",
"11",
",",
"11",
",",
"9",
",",
"10",
",",
"32",
",",
"tzinfo",
"=",
"UTC",
")",
"with",
"patch",
"(",
"\"homeassistant.components.brother.sensor.utcnow\... | [
25,
0
] | [
223,
49
] | python | en | ['en', 'en', 'en'] | True |
test_availability | (hass) | Ensure that we mark the entities unavailable correctly when device is offline. | Ensure that we mark the entities unavailable correctly when device is offline. | async def test_availability(hass):
"""Ensure that we mark the entities unavailable correctly when device is offline."""
await init_integration(hass)
state = hass.states.get("sensor.hl_l2340dw_status")
assert state
assert state.state != STATE_UNAVAILABLE
assert state.state == "waiting"
futu... | [
"async",
"def",
"test_availability",
"(",
"hass",
")",
":",
"await",
"init_integration",
"(",
"hass",
")",
"state",
"=",
"hass",
".",
"states",
".",
"get",
"(",
"\"sensor.hl_l2340dw_status\"",
")",
"assert",
"state",
"assert",
"state",
".",
"state",
"!=",
"S... | [
226,
0
] | [
255,
39
] | python | en | ['en', 'en', 'en'] | True |
test_manual_update_entity | (hass) | Test manual update entity via service homeasasistant/update_entity. | Test manual update entity via service homeasasistant/update_entity. | async def test_manual_update_entity(hass):
"""Test manual update entity via service homeasasistant/update_entity."""
await init_integration(hass)
await async_setup_component(hass, "homeassistant", {})
with patch("homeassistant.components.brother.Brother.async_update") as mock_update:
await hass... | [
"async",
"def",
"test_manual_update_entity",
"(",
"hass",
")",
":",
"await",
"init_integration",
"(",
"hass",
")",
"await",
"async_setup_component",
"(",
"hass",
",",
"\"homeassistant\"",
",",
"{",
"}",
")",
"with",
"patch",
"(",
"\"homeassistant.components.brother.... | [
258,
0
] | [
271,
47
] | python | en | ['en', 'en', 'en'] | True |
is_pt_tf_cross_test | (test_case) |
Decorator marking a test as a test that control interactions between PyTorch and TensorFlow.
PT+TF tests are skipped by default and we can run only them by setting RUN_PT_TF_CROSS_TESTS environment variable
to a truthy value and selecting the is_pt_tf_cross_test pytest mark.
|
Decorator marking a test as a test that control interactions between PyTorch and TensorFlow. | def is_pt_tf_cross_test(test_case):
"""
Decorator marking a test as a test that control interactions between PyTorch and TensorFlow.
PT+TF tests are skipped by default and we can run only them by setting RUN_PT_TF_CROSS_TESTS environment variable
to a truthy value and selecting the is_pt_tf_cross_test ... | [
"def",
"is_pt_tf_cross_test",
"(",
"test_case",
")",
":",
"if",
"not",
"_run_pt_tf_cross_tests",
"or",
"not",
"is_torch_available",
"(",
")",
"or",
"not",
"is_tf_available",
"(",
")",
":",
"return",
"unittest",
".",
"skip",
"(",
"\"test is PT+TF test\"",
")",
"(... | [
90,
0
] | [
106,
63
] | python | en | ['en', 'error', 'th'] | False |
is_pt_flax_cross_test | (test_case) |
Decorator marking a test as a test that control interactions between PyTorch and Flax
PT+FLAX tests are skipped by default and we can run only them by setting RUN_PT_FLAX_CROSS_TESTS environment
variable to a truthy value and selecting the is_pt_flax_cross_test pytest mark.
|
Decorator marking a test as a test that control interactions between PyTorch and Flax | def is_pt_flax_cross_test(test_case):
"""
Decorator marking a test as a test that control interactions between PyTorch and Flax
PT+FLAX tests are skipped by default and we can run only them by setting RUN_PT_FLAX_CROSS_TESTS environment
variable to a truthy value and selecting the is_pt_flax_cross_test... | [
"def",
"is_pt_flax_cross_test",
"(",
"test_case",
")",
":",
"if",
"not",
"_run_pt_flax_cross_tests",
"or",
"not",
"is_torch_available",
"(",
")",
"or",
"not",
"is_flax_available",
"(",
")",
":",
"return",
"unittest",
".",
"skip",
"(",
"\"test is PT+FLAX test\"",
"... | [
109,
0
] | [
125,
65
] | python | en | ['en', 'error', 'th'] | False |
is_pipeline_test | (test_case) |
Decorator marking a test as a pipeline test.
Pipeline tests are skipped by default and we can run only them by setting RUN_PIPELINE_TESTS environment variable
to a truthy value and selecting the is_pipeline_test pytest mark.
|
Decorator marking a test as a pipeline test. | def is_pipeline_test(test_case):
"""
Decorator marking a test as a pipeline test.
Pipeline tests are skipped by default and we can run only them by setting RUN_PIPELINE_TESTS environment variable
to a truthy value and selecting the is_pipeline_test pytest mark.
"""
if not _run_pipeline_tests:
... | [
"def",
"is_pipeline_test",
"(",
"test_case",
")",
":",
"if",
"not",
"_run_pipeline_tests",
":",
"return",
"unittest",
".",
"skip",
"(",
"\"test is pipeline test\"",
")",
"(",
"test_case",
")",
"else",
":",
"try",
":",
"import",
"pytest",
"# We don't need a hard de... | [
128,
0
] | [
144,
60
] | python | en | ['en', 'error', 'th'] | False |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.