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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
BlinkStickLight.turn_on | (self, **kwargs) | Turn the device on. | Turn the device on. | def turn_on(self, **kwargs):
"""Turn the device on."""
if ATTR_HS_COLOR in kwargs:
self._hs_color = kwargs[ATTR_HS_COLOR]
if ATTR_BRIGHTNESS in kwargs:
self._brightness = kwargs[ATTR_BRIGHTNESS]
else:
self._brightness = 255
rgb_color = color_u... | [
"def",
"turn_on",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"ATTR_HS_COLOR",
"in",
"kwargs",
":",
"self",
".",
"_hs_color",
"=",
"kwargs",
"[",
"ATTR_HS_COLOR",
"]",
"if",
"ATTR_BRIGHTNESS",
"in",
"kwargs",
":",
"self",
".",
"_brightness",
"=... | [
84,
4
] | [
96,
86
] | python | en | ['en', 'en', 'en'] | True |
BlinkStickLight.turn_off | (self, **kwargs) | Turn the device off. | Turn the device off. | def turn_off(self, **kwargs):
"""Turn the device off."""
self._stick.turn_off() | [
"def",
"turn_off",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"_stick",
".",
"turn_off",
"(",
")"
] | [
98,
4
] | [
100,
30
] | python | en | ['en', 'en', 'en'] | True |
async_setup_platform | (hass, config, async_add_entities, discovery_info=None) | Perform the setup for Fibaro scenes. | Perform the setup for Fibaro scenes. | async def async_setup_platform(hass, config, async_add_entities, discovery_info=None):
"""Perform the setup for Fibaro scenes."""
if discovery_info is None:
return
async_add_entities(
[FibaroScene(scene) for scene in hass.data[FIBARO_DEVICES]["scene"]], True
) | [
"async",
"def",
"async_setup_platform",
"(",
"hass",
",",
"config",
",",
"async_add_entities",
",",
"discovery_info",
"=",
"None",
")",
":",
"if",
"discovery_info",
"is",
"None",
":",
"return",
"async_add_entities",
"(",
"[",
"FibaroScene",
"(",
"scene",
")",
... | [
8,
0
] | [
15,
5
] | python | en | ['en', 'sr', 'en'] | True |
FibaroScene.activate | (self, **kwargs: Any) | Activate the scene. | Activate the scene. | def activate(self, **kwargs: Any) -> None:
"""Activate the scene."""
self.fibaro_device.start() | [
"def",
"activate",
"(",
"self",
",",
"*",
"*",
"kwargs",
":",
"Any",
")",
"->",
"None",
":",
"self",
".",
"fibaro_device",
".",
"start",
"(",
")"
] | [
21,
4
] | [
23,
34
] | python | en | ['en', 'it', 'en'] | True |
test_polling_only_updates_entities_it_should_poll | (hass) | Test the polling of only updated entities. | Test the polling of only updated entities. | async def test_polling_only_updates_entities_it_should_poll(hass):
"""Test the polling of only updated entities."""
component = EntityComponent(_LOGGER, DOMAIN, hass, timedelta(seconds=20))
no_poll_ent = MockEntity(should_poll=False)
no_poll_ent.async_update = Mock()
poll_ent = MockEntity(should_po... | [
"async",
"def",
"test_polling_only_updates_entities_it_should_poll",
"(",
"hass",
")",
":",
"component",
"=",
"EntityComponent",
"(",
"_LOGGER",
",",
"DOMAIN",
",",
"hass",
",",
"timedelta",
"(",
"seconds",
"=",
"20",
")",
")",
"no_poll_ent",
"=",
"MockEntity",
... | [
34,
0
] | [
52,
39
] | python | en | ['en', 'en', 'en'] | True |
test_polling_updates_entities_with_exception | (hass) | Test the updated entities that not break with an exception. | Test the updated entities that not break with an exception. | async def test_polling_updates_entities_with_exception(hass):
"""Test the updated entities that not break with an exception."""
component = EntityComponent(_LOGGER, DOMAIN, hass, timedelta(seconds=20))
update_ok = []
update_err = []
def update_mock():
"""Mock normal update."""
upda... | [
"async",
"def",
"test_polling_updates_entities_with_exception",
"(",
"hass",
")",
":",
"component",
"=",
"EntityComponent",
"(",
"_LOGGER",
",",
"DOMAIN",
",",
"hass",
",",
"timedelta",
"(",
"seconds",
"=",
"20",
")",
")",
"update_ok",
"=",
"[",
"]",
"update_e... | [
55,
0
] | [
89,
31
] | python | en | ['en', 'en', 'en'] | True |
test_update_state_adds_entities | (hass) | Test if updating poll entities cause an entity to be added works. | Test if updating poll entities cause an entity to be added works. | async def test_update_state_adds_entities(hass):
"""Test if updating poll entities cause an entity to be added works."""
component = EntityComponent(_LOGGER, DOMAIN, hass)
ent1 = MockEntity()
ent2 = MockEntity(should_poll=True)
await component.async_add_entities([ent2])
assert len(hass.states.... | [
"async",
"def",
"test_update_state_adds_entities",
"(",
"hass",
")",
":",
"component",
"=",
"EntityComponent",
"(",
"_LOGGER",
",",
"DOMAIN",
",",
"hass",
")",
"ent1",
"=",
"MockEntity",
"(",
")",
"ent2",
"=",
"MockEntity",
"(",
"should_poll",
"=",
"True",
"... | [
92,
0
] | [
106,
51
] | python | en | ['en', 'en', 'en'] | True |
test_update_state_adds_entities_with_update_before_add_true | (hass) | Test if call update before add to state machine. | Test if call update before add to state machine. | async def test_update_state_adds_entities_with_update_before_add_true(hass):
"""Test if call update before add to state machine."""
component = EntityComponent(_LOGGER, DOMAIN, hass)
ent = MockEntity()
ent.update = Mock(spec_set=True)
await component.async_add_entities([ent], True)
await hass.... | [
"async",
"def",
"test_update_state_adds_entities_with_update_before_add_true",
"(",
"hass",
")",
":",
"component",
"=",
"EntityComponent",
"(",
"_LOGGER",
",",
"DOMAIN",
",",
"hass",
")",
"ent",
"=",
"MockEntity",
"(",
")",
"ent",
".",
"update",
"=",
"Mock",
"("... | [
109,
0
] | [
120,
28
] | python | en | ['en', 'en', 'en'] | True |
test_update_state_adds_entities_with_update_before_add_false | (hass) | Test if not call update before add to state machine. | Test if not call update before add to state machine. | async def test_update_state_adds_entities_with_update_before_add_false(hass):
"""Test if not call update before add to state machine."""
component = EntityComponent(_LOGGER, DOMAIN, hass)
ent = MockEntity()
ent.update = Mock(spec_set=True)
await component.async_add_entities([ent], False)
await... | [
"async",
"def",
"test_update_state_adds_entities_with_update_before_add_false",
"(",
"hass",
")",
":",
"component",
"=",
"EntityComponent",
"(",
"_LOGGER",
",",
"DOMAIN",
",",
"hass",
")",
"ent",
"=",
"MockEntity",
"(",
")",
"ent",
".",
"update",
"=",
"Mock",
"(... | [
123,
0
] | [
134,
32
] | python | en | ['en', 'en', 'en'] | True |
test_set_scan_interval_via_platform | (mock_track, hass) | Test the setting of the scan interval via platform. | Test the setting of the scan interval via platform. | async def test_set_scan_interval_via_platform(mock_track, hass):
"""Test the setting of the scan interval via platform."""
def platform_setup(hass, config, add_entities, discovery_info=None):
"""Test the platform setup."""
add_entities([MockEntity(should_poll=True)])
platform = MockPlatfor... | [
"async",
"def",
"test_set_scan_interval_via_platform",
"(",
"mock_track",
",",
"hass",
")",
":",
"def",
"platform_setup",
"(",
"hass",
",",
"config",
",",
"add_entities",
",",
"discovery_info",
"=",
"None",
")",
":",
"\"\"\"Test the platform setup.\"\"\"",
"add_entiti... | [
138,
0
] | [
156,
62
] | python | en | ['en', 'en', 'en'] | True |
test_adding_entities_with_generator_and_thread_callback | (hass) | Test generator in add_entities that calls thread method.
We should make sure we resolve the generator to a list before passing
it into an async context.
| Test generator in add_entities that calls thread method. | async def test_adding_entities_with_generator_and_thread_callback(hass):
"""Test generator in add_entities that calls thread method.
We should make sure we resolve the generator to a list before passing
it into an async context.
"""
component = EntityComponent(_LOGGER, DOMAIN, hass)
def create... | [
"async",
"def",
"test_adding_entities_with_generator_and_thread_callback",
"(",
"hass",
")",
":",
"component",
"=",
"EntityComponent",
"(",
"_LOGGER",
",",
"DOMAIN",
",",
"hass",
")",
"def",
"create_entity",
"(",
"number",
")",
":",
"\"\"\"Create entity helper.\"\"\"",
... | [
159,
0
] | [
173,
74
] | python | en | ['en', 'cy', 'en'] | True |
test_platform_warn_slow_setup | (hass) | Warn we log when platform setup takes a long time. | Warn we log when platform setup takes a long time. | async def test_platform_warn_slow_setup(hass):
"""Warn we log when platform setup takes a long time."""
platform = MockPlatform()
mock_entity_platform(hass, "test_domain.platform", platform)
component = EntityComponent(_LOGGER, DOMAIN, hass)
with patch.object(hass.loop, "call_later") as mock_call... | [
"async",
"def",
"test_platform_warn_slow_setup",
"(",
"hass",
")",
":",
"platform",
"=",
"MockPlatform",
"(",
")",
"mock_entity_platform",
"(",
"hass",
",",
"\"test_domain.platform\"",
",",
"platform",
")",
"component",
"=",
"EntityComponent",
"(",
"_LOGGER",
",",
... | [
176,
0
] | [
196,
40
] | python | en | ['en', 'jv', 'en'] | True |
test_platform_error_slow_setup | (hass, caplog) | Don't block startup more than SLOW_SETUP_MAX_WAIT. | Don't block startup more than SLOW_SETUP_MAX_WAIT. | async def test_platform_error_slow_setup(hass, caplog):
"""Don't block startup more than SLOW_SETUP_MAX_WAIT."""
with patch.object(entity_platform, "SLOW_SETUP_MAX_WAIT", 0):
called = []
async def setup_platform(*args):
called.append(1)
await asyncio.sleep(1)
pl... | [
"async",
"def",
"test_platform_error_slow_setup",
"(",
"hass",
",",
"caplog",
")",
":",
"with",
"patch",
".",
"object",
"(",
"entity_platform",
",",
"\"SLOW_SETUP_MAX_WAIT\"",
",",
"0",
")",
":",
"called",
"=",
"[",
"]",
"async",
"def",
"setup_platform",
"(",
... | [
199,
0
] | [
215,
77
] | python | en | ['en', 'jv', 'en'] | True |
test_updated_state_used_for_entity_id | (hass) | Test that first update results used for entity ID generation. | Test that first update results used for entity ID generation. | async def test_updated_state_used_for_entity_id(hass):
"""Test that first update results used for entity ID generation."""
component = EntityComponent(_LOGGER, DOMAIN, hass)
class MockEntityNameFetcher(MockEntity):
"""Mock entity that fetches a friendly name."""
async def async_update(self... | [
"async",
"def",
"test_updated_state_used_for_entity_id",
"(",
"hass",
")",
":",
"component",
"=",
"EntityComponent",
"(",
"_LOGGER",
",",
"DOMAIN",
",",
"hass",
")",
"class",
"MockEntityNameFetcher",
"(",
"MockEntity",
")",
":",
"\"\"\"Mock entity that fetches a friendl... | [
218,
0
] | [
233,
53
] | python | en | ['en', 'en', 'en'] | True |
test_parallel_updates_async_platform | (hass) | Test async platform does not have parallel_updates limit by default. | Test async platform does not have parallel_updates limit by default. | async def test_parallel_updates_async_platform(hass):
"""Test async platform does not have parallel_updates limit by default."""
platform = MockPlatform()
mock_entity_platform(hass, "test_domain.platform", platform)
component = EntityComponent(_LOGGER, DOMAIN, hass)
component._platforms = {}
... | [
"async",
"def",
"test_parallel_updates_async_platform",
"(",
"hass",
")",
":",
"platform",
"=",
"MockPlatform",
"(",
")",
"mock_entity_platform",
"(",
"hass",
",",
"\"test_domain.platform\"",
",",
"platform",
")",
"component",
"=",
"EntityComponent",
"(",
"_LOGGER",
... | [
236,
0
] | [
259,
42
] | python | en | ['en', 'en', 'en'] | True |
test_parallel_updates_async_platform_with_constant | (hass) | Test async platform can set parallel_updates limit. | Test async platform can set parallel_updates limit. | async def test_parallel_updates_async_platform_with_constant(hass):
"""Test async platform can set parallel_updates limit."""
platform = MockPlatform()
platform.PARALLEL_UPDATES = 2
mock_entity_platform(hass, "test_domain.platform", platform)
component = EntityComponent(_LOGGER, DOMAIN, hass)
... | [
"async",
"def",
"test_parallel_updates_async_platform_with_constant",
"(",
"hass",
")",
":",
"platform",
"=",
"MockPlatform",
"(",
")",
"platform",
".",
"PARALLEL_UPDATES",
"=",
"2",
"mock_entity_platform",
"(",
"hass",
",",
"\"test_domain.platform\"",
",",
"platform",
... | [
262,
0
] | [
286,
46
] | python | fr | ['fr', 'fr', 'en'] | True |
test_parallel_updates_sync_platform | (hass) | Test sync platform parallel_updates default set to 1. | Test sync platform parallel_updates default set to 1. | async def test_parallel_updates_sync_platform(hass):
"""Test sync platform parallel_updates default set to 1."""
platform = MockPlatform()
mock_entity_platform(hass, "test_domain.platform", platform)
component = EntityComponent(_LOGGER, DOMAIN, hass)
component._platforms = {}
await component.... | [
"async",
"def",
"test_parallel_updates_sync_platform",
"(",
"hass",
")",
":",
"platform",
"=",
"MockPlatform",
"(",
")",
"mock_entity_platform",
"(",
"hass",
",",
"\"test_domain.platform\"",
",",
"platform",
")",
"component",
"=",
"EntityComponent",
"(",
"_LOGGER",
... | [
289,
0
] | [
312,
46
] | python | en | ['en', 'da', 'en'] | True |
test_parallel_updates_sync_platform_with_constant | (hass) | Test sync platform can set parallel_updates limit. | Test sync platform can set parallel_updates limit. | async def test_parallel_updates_sync_platform_with_constant(hass):
"""Test sync platform can set parallel_updates limit."""
platform = MockPlatform()
platform.PARALLEL_UPDATES = 2
mock_entity_platform(hass, "test_domain.platform", platform)
component = EntityComponent(_LOGGER, DOMAIN, hass)
co... | [
"async",
"def",
"test_parallel_updates_sync_platform_with_constant",
"(",
"hass",
")",
":",
"platform",
"=",
"MockPlatform",
"(",
")",
"platform",
".",
"PARALLEL_UPDATES",
"=",
"2",
"mock_entity_platform",
"(",
"hass",
",",
"\"test_domain.platform\"",
",",
"platform",
... | [
315,
0
] | [
339,
46
] | python | fr | ['fr', 'fr', 'en'] | True |
test_raise_error_on_update | (hass) | Test the add entity if they raise an error on update. | Test the add entity if they raise an error on update. | async def test_raise_error_on_update(hass):
"""Test the add entity if they raise an error on update."""
updates = []
component = EntityComponent(_LOGGER, DOMAIN, hass)
entity1 = MockEntity(name="test_1")
entity2 = MockEntity(name="test_2")
def _raise():
"""Raise an exception."""
... | [
"async",
"def",
"test_raise_error_on_update",
"(",
"hass",
")",
":",
"updates",
"=",
"[",
"]",
"component",
"=",
"EntityComponent",
"(",
"_LOGGER",
",",
"DOMAIN",
",",
"hass",
")",
"entity1",
"=",
"MockEntity",
"(",
"name",
"=",
"\"test_1\"",
")",
"entity2",... | [
342,
0
] | [
364,
39
] | python | en | ['en', 'en', 'en'] | True |
test_async_remove_with_platform | (hass) | Remove an entity from a platform. | Remove an entity from a platform. | async def test_async_remove_with_platform(hass):
"""Remove an entity from a platform."""
component = EntityComponent(_LOGGER, DOMAIN, hass)
entity1 = MockEntity(name="test_1")
await component.async_add_entities([entity1])
assert len(hass.states.async_entity_ids()) == 1
await entity1.async_remove... | [
"async",
"def",
"test_async_remove_with_platform",
"(",
"hass",
")",
":",
"component",
"=",
"EntityComponent",
"(",
"_LOGGER",
",",
"DOMAIN",
",",
"hass",
")",
"entity1",
"=",
"MockEntity",
"(",
"name",
"=",
"\"test_1\"",
")",
"await",
"component",
".",
"async... | [
367,
0
] | [
374,
51
] | python | en | ['en', 'en', 'en'] | True |
test_not_adding_duplicate_entities_with_unique_id | (hass, caplog) | Test for not adding duplicate entities. | Test for not adding duplicate entities. | async def test_not_adding_duplicate_entities_with_unique_id(hass, caplog):
"""Test for not adding duplicate entities."""
caplog.set_level(logging.ERROR)
component = EntityComponent(_LOGGER, DOMAIN, hass)
await component.async_add_entities(
[MockEntity(name="test1", unique_id="not_very_unique")]... | [
"async",
"def",
"test_not_adding_duplicate_entities_with_unique_id",
"(",
"hass",
",",
"caplog",
")",
":",
"caplog",
".",
"set_level",
"(",
"logging",
".",
"ERROR",
")",
"component",
"=",
"EntityComponent",
"(",
"_LOGGER",
",",
"DOMAIN",
",",
"hass",
")",
"await... | [
377,
0
] | [
404,
51
] | python | en | ['en', 'en', 'en'] | True |
test_using_prescribed_entity_id | (hass) | Test for using predefined entity ID. | Test for using predefined entity ID. | async def test_using_prescribed_entity_id(hass):
"""Test for using predefined entity ID."""
component = EntityComponent(_LOGGER, DOMAIN, hass)
await component.async_add_entities(
[MockEntity(name="bla", entity_id="hello.world")]
)
assert "hello.world" in hass.states.async_entity_ids() | [
"async",
"def",
"test_using_prescribed_entity_id",
"(",
"hass",
")",
":",
"component",
"=",
"EntityComponent",
"(",
"_LOGGER",
",",
"DOMAIN",
",",
"hass",
")",
"await",
"component",
".",
"async_add_entities",
"(",
"[",
"MockEntity",
"(",
"name",
"=",
"\"bla\"",
... | [
407,
0
] | [
413,
58
] | python | en | ['en', 'en', 'en'] | True |
test_using_prescribed_entity_id_with_unique_id | (hass) | Test for amending predefined entity ID because currently exists. | Test for amending predefined entity ID because currently exists. | async def test_using_prescribed_entity_id_with_unique_id(hass):
"""Test for amending predefined entity ID because currently exists."""
component = EntityComponent(_LOGGER, DOMAIN, hass)
await component.async_add_entities([MockEntity(entity_id="test_domain.world")])
await component.async_add_entities(
... | [
"async",
"def",
"test_using_prescribed_entity_id_with_unique_id",
"(",
"hass",
")",
":",
"component",
"=",
"EntityComponent",
"(",
"_LOGGER",
",",
"DOMAIN",
",",
"hass",
")",
"await",
"component",
".",
"async_add_entities",
"(",
"[",
"MockEntity",
"(",
"entity_id",
... | [
416,
0
] | [
425,
66
] | python | en | ['en', 'en', 'en'] | True |
test_using_prescribed_entity_id_which_is_registered | (hass) | Test not allowing predefined entity ID that already registered. | Test not allowing predefined entity ID that already registered. | async def test_using_prescribed_entity_id_which_is_registered(hass):
"""Test not allowing predefined entity ID that already registered."""
component = EntityComponent(_LOGGER, DOMAIN, hass)
registry = mock_registry(hass)
# Register test_domain.world
registry.async_get_or_create(DOMAIN, "test", "1234... | [
"async",
"def",
"test_using_prescribed_entity_id_which_is_registered",
"(",
"hass",
")",
":",
"component",
"=",
"EntityComponent",
"(",
"_LOGGER",
",",
"DOMAIN",
",",
"hass",
")",
"registry",
"=",
"mock_registry",
"(",
"hass",
")",
"# Register test_domain.world",
"reg... | [
428,
0
] | [
438,
66
] | python | en | ['en', 'en', 'en'] | True |
test_name_which_conflict_with_registered | (hass) | Test not generating conflicting entity ID based on name. | Test not generating conflicting entity ID based on name. | async def test_name_which_conflict_with_registered(hass):
"""Test not generating conflicting entity ID based on name."""
component = EntityComponent(_LOGGER, DOMAIN, hass)
registry = mock_registry(hass)
# Register test_domain.world
registry.async_get_or_create(DOMAIN, "test", "1234", suggested_obje... | [
"async",
"def",
"test_name_which_conflict_with_registered",
"(",
"hass",
")",
":",
"component",
"=",
"EntityComponent",
"(",
"_LOGGER",
",",
"DOMAIN",
",",
"hass",
")",
"registry",
"=",
"mock_registry",
"(",
"hass",
")",
"# Register test_domain.world",
"registry",
"... | [
441,
0
] | [
451,
66
] | python | en | ['en', 'en', 'en'] | True |
test_entity_with_name_and_entity_id_getting_registered | (hass) | Ensure that entity ID is used for registration. | Ensure that entity ID is used for registration. | async def test_entity_with_name_and_entity_id_getting_registered(hass):
"""Ensure that entity ID is used for registration."""
component = EntityComponent(_LOGGER, DOMAIN, hass)
await component.async_add_entities(
[MockEntity(unique_id="1234", name="bla", entity_id="test_domain.world")]
)
ass... | [
"async",
"def",
"test_entity_with_name_and_entity_id_getting_registered",
"(",
"hass",
")",
":",
"component",
"=",
"EntityComponent",
"(",
"_LOGGER",
",",
"DOMAIN",
",",
"hass",
")",
"await",
"component",
".",
"async_add_entities",
"(",
"[",
"MockEntity",
"(",
"uniq... | [
454,
0
] | [
460,
64
] | python | en | ['en', 'en', 'en'] | True |
test_overriding_name_from_registry | (hass) | Test that we can override a name via the Entity Registry. | Test that we can override a name via the Entity Registry. | async def test_overriding_name_from_registry(hass):
"""Test that we can override a name via the Entity Registry."""
component = EntityComponent(_LOGGER, DOMAIN, hass)
mock_registry(
hass,
{
"test_domain.world": entity_registry.RegistryEntry(
entity_id="test_domain... | [
"async",
"def",
"test_overriding_name_from_registry",
"(",
"hass",
")",
":",
"component",
"=",
"EntityComponent",
"(",
"_LOGGER",
",",
"DOMAIN",
",",
"hass",
")",
"mock_registry",
"(",
"hass",
",",
"{",
"\"test_domain.world\"",
":",
"entity_registry",
".",
"Regist... | [
463,
0
] | [
484,
37
] | python | en | ['en', 'en', 'en'] | True |
test_registry_respect_entity_namespace | (hass) | Test that the registry respects entity namespace. | Test that the registry respects entity namespace. | async def test_registry_respect_entity_namespace(hass):
"""Test that the registry respects entity namespace."""
mock_registry(hass)
platform = MockEntityPlatform(hass, entity_namespace="ns")
entity = MockEntity(unique_id="1234", name="Device Name")
await platform.async_add_entities([entity])
ass... | [
"async",
"def",
"test_registry_respect_entity_namespace",
"(",
"hass",
")",
":",
"mock_registry",
"(",
"hass",
")",
"platform",
"=",
"MockEntityPlatform",
"(",
"hass",
",",
"entity_namespace",
"=",
"\"ns\"",
")",
"entity",
"=",
"MockEntity",
"(",
"unique_id",
"=",... | [
487,
0
] | [
493,
59
] | python | en | ['en', 'en', 'en'] | True |
test_registry_respect_entity_disabled | (hass) | Test that the registry respects entity disabled. | Test that the registry respects entity disabled. | async def test_registry_respect_entity_disabled(hass):
"""Test that the registry respects entity disabled."""
mock_registry(
hass,
{
"test_domain.world": entity_registry.RegistryEntry(
entity_id="test_domain.world",
unique_id="1234",
# ... | [
"async",
"def",
"test_registry_respect_entity_disabled",
"(",
"hass",
")",
":",
"mock_registry",
"(",
"hass",
",",
"{",
"\"test_domain.world\"",
":",
"entity_registry",
".",
"RegistryEntry",
"(",
"entity_id",
"=",
"\"test_domain.world\"",
",",
"unique_id",
"=",
"\"123... | [
496,
0
] | [
514,
47
] | python | en | ['en', 'en', 'en'] | True |
test_entity_registry_updates_name | (hass) | Test that updates on the entity registry update platform entities. | Test that updates on the entity registry update platform entities. | async def test_entity_registry_updates_name(hass):
"""Test that updates on the entity registry update platform entities."""
registry = mock_registry(
hass,
{
"test_domain.world": entity_registry.RegistryEntry(
entity_id="test_domain.world",
unique_id="... | [
"async",
"def",
"test_entity_registry_updates_name",
"(",
"hass",
")",
":",
"registry",
"=",
"mock_registry",
"(",
"hass",
",",
"{",
"\"test_domain.world\"",
":",
"entity_registry",
".",
"RegistryEntry",
"(",
"entity_id",
"=",
"\"test_domain.world\"",
",",
"unique_id"... | [
517,
0
] | [
544,
39
] | python | en | ['en', 'en', 'en'] | True |
test_setup_entry | (hass) | Test we can setup an entry. | Test we can setup an entry. | async def test_setup_entry(hass):
"""Test we can setup an entry."""
registry = mock_registry(hass)
async def async_setup_entry(hass, config_entry, async_add_entities):
"""Mock setup entry method."""
async_add_entities([MockEntity(name="test1", unique_id="unique")])
return True
... | [
"async",
"def",
"test_setup_entry",
"(",
"hass",
")",
":",
"registry",
"=",
"mock_registry",
"(",
"hass",
")",
"async",
"def",
"async_setup_entry",
"(",
"hass",
",",
"config_entry",
",",
"async_add_entities",
")",
":",
"\"\"\"Mock setup entry method.\"\"\"",
"async_... | [
547,
0
] | [
568,
84
] | python | en | ['en', 'en', 'en'] | True |
test_setup_entry_platform_not_ready | (hass, caplog) | Test when an entry is not ready yet. | Test when an entry is not ready yet. | async def test_setup_entry_platform_not_ready(hass, caplog):
"""Test when an entry is not ready yet."""
async_setup_entry = Mock(side_effect=PlatformNotReady)
platform = MockPlatform(async_setup_entry=async_setup_entry)
config_entry = MockConfigEntry()
ent_platform = MockEntityPlatform(
hass... | [
"async",
"def",
"test_setup_entry_platform_not_ready",
"(",
"hass",
",",
"caplog",
")",
":",
"async_setup_entry",
"=",
"Mock",
"(",
"side_effect",
"=",
"PlatformNotReady",
")",
"platform",
"=",
"MockPlatform",
"(",
"async_setup_entry",
"=",
"async_setup_entry",
")",
... | [
571,
0
] | [
587,
47
] | python | en | ['en', 'en', 'en'] | True |
test_reset_cancels_retry_setup | (hass) | Test that resetting a platform will cancel scheduled a setup retry. | Test that resetting a platform will cancel scheduled a setup retry. | async def test_reset_cancels_retry_setup(hass):
"""Test that resetting a platform will cancel scheduled a setup retry."""
async_setup_entry = Mock(side_effect=PlatformNotReady)
platform = MockPlatform(async_setup_entry=async_setup_entry)
config_entry = MockConfigEntry()
ent_platform = MockEntityPlat... | [
"async",
"def",
"test_reset_cancels_retry_setup",
"(",
"hass",
")",
":",
"async_setup_entry",
"=",
"Mock",
"(",
"side_effect",
"=",
"PlatformNotReady",
")",
"platform",
"=",
"MockPlatform",
"(",
"async_setup_entry",
"=",
"async_setup_entry",
")",
"config_entry",
"=",
... | [
590,
0
] | [
609,
57
] | python | en | ['en', 'en', 'en'] | True |
test_not_fails_with_adding_empty_entities_ | (hass) | Test for not fails on empty entities list. | Test for not fails on empty entities list. | async def test_not_fails_with_adding_empty_entities_(hass):
"""Test for not fails on empty entities list."""
component = EntityComponent(_LOGGER, DOMAIN, hass)
await component.async_add_entities([])
assert len(hass.states.async_entity_ids()) == 0 | [
"async",
"def",
"test_not_fails_with_adding_empty_entities_",
"(",
"hass",
")",
":",
"component",
"=",
"EntityComponent",
"(",
"_LOGGER",
",",
"DOMAIN",
",",
"hass",
")",
"await",
"component",
".",
"async_add_entities",
"(",
"[",
"]",
")",
"assert",
"len",
"(",
... | [
612,
0
] | [
618,
51
] | python | en | ['en', 'en', 'en'] | True |
test_entity_registry_updates_entity_id | (hass) | Test that updates on the entity registry update platform entities. | Test that updates on the entity registry update platform entities. | async def test_entity_registry_updates_entity_id(hass):
"""Test that updates on the entity registry update platform entities."""
registry = mock_registry(
hass,
{
"test_domain.world": entity_registry.RegistryEntry(
entity_id="test_domain.world",
unique... | [
"async",
"def",
"test_entity_registry_updates_entity_id",
"(",
"hass",
")",
":",
"registry",
"=",
"mock_registry",
"(",
"hass",
",",
"{",
"\"test_domain.world\"",
":",
"entity_registry",
".",
"RegistryEntry",
"(",
"entity_id",
"=",
"\"test_domain.world\"",
",",
"uniqu... | [
621,
0
] | [
650,
60
] | python | en | ['en', 'en', 'en'] | True |
test_entity_registry_updates_invalid_entity_id | (hass) | Test that we can't update to an invalid entity id. | Test that we can't update to an invalid entity id. | async def test_entity_registry_updates_invalid_entity_id(hass):
"""Test that we can't update to an invalid entity id."""
registry = mock_registry(
hass,
{
"test_domain.world": entity_registry.RegistryEntry(
entity_id="test_domain.world",
unique_id="123... | [
"async",
"def",
"test_entity_registry_updates_invalid_entity_id",
"(",
"hass",
")",
":",
"registry",
"=",
"mock_registry",
"(",
"hass",
",",
"{",
"\"test_domain.world\"",
":",
"entity_registry",
".",
"RegistryEntry",
"(",
"entity_id",
"=",
"\"test_domain.world\"",
",",
... | [
653,
0
] | [
700,
55
] | python | en | ['en', 'en', 'en'] | True |
test_device_info_called | (hass) | Test device info is forwarded correctly. | Test device info is forwarded correctly. | async def test_device_info_called(hass):
"""Test device info is forwarded correctly."""
registry = await hass.helpers.device_registry.async_get_registry()
via = registry.async_get_or_create(
config_entry_id="123",
connections=set(),
identifiers={("hue", "via-id")},
manufactur... | [
"async",
"def",
"test_device_info_called",
"(",
"hass",
")",
":",
"registry",
"=",
"await",
"hass",
".",
"helpers",
".",
"device_registry",
".",
"async_get_registry",
"(",
")",
"via",
"=",
"registry",
".",
"async_get_or_create",
"(",
"config_entry_id",
"=",
"\"1... | [
703,
0
] | [
758,
41
] | python | en | ['en', 'en', 'en'] | True |
test_device_info_not_overrides | (hass) | Test device info is forwarded correctly. | Test device info is forwarded correctly. | async def test_device_info_not_overrides(hass):
"""Test device info is forwarded correctly."""
registry = await hass.helpers.device_registry.async_get_registry()
device = registry.async_get_or_create(
config_entry_id="bla",
connections={("mac", "abcd")},
manufacturer="test-manufactur... | [
"async",
"def",
"test_device_info_not_overrides",
"(",
"hass",
")",
":",
"registry",
"=",
"await",
"hass",
".",
"helpers",
".",
"device_registry",
".",
"async_get_registry",
"(",
")",
"device",
"=",
"registry",
".",
"async_get_or_create",
"(",
"config_entry_id",
"... | [
761,
0
] | [
804,
40
] | python | en | ['en', 'en', 'en'] | True |
test_entity_disabled_by_integration | (hass) | Test entity disabled by integration. | Test entity disabled by integration. | async def test_entity_disabled_by_integration(hass):
"""Test entity disabled by integration."""
component = EntityComponent(_LOGGER, DOMAIN, hass, timedelta(seconds=20))
entity_default = MockEntity(unique_id="default")
entity_disabled = MockEntity(
unique_id="disabled", entity_registry_enabled_... | [
"async",
"def",
"test_entity_disabled_by_integration",
"(",
"hass",
")",
":",
"component",
"=",
"EntityComponent",
"(",
"_LOGGER",
",",
"DOMAIN",
",",
"hass",
",",
"timedelta",
"(",
"seconds",
"=",
"20",
")",
")",
"entity_default",
"=",
"MockEntity",
"(",
"uni... | [
807,
0
] | [
828,
54
] | python | en | ['en', 'en', 'en'] | True |
test_entity_info_added_to_entity_registry | (hass) | Test entity info is written to entity registry. | Test entity info is written to entity registry. | async def test_entity_info_added_to_entity_registry(hass):
"""Test entity info is written to entity registry."""
component = EntityComponent(_LOGGER, DOMAIN, hass, timedelta(seconds=20))
entity_default = MockEntity(
unique_id="default",
capability_attributes={"max": 100},
supported_... | [
"async",
"def",
"test_entity_info_added_to_entity_registry",
"(",
"hass",
")",
":",
"component",
"=",
"EntityComponent",
"(",
"_LOGGER",
",",
"DOMAIN",
",",
"hass",
",",
"timedelta",
"(",
"seconds",
"=",
"20",
")",
")",
"entity_default",
"=",
"MockEntity",
"(",
... | [
831,
0
] | [
852,
58
] | python | en | ['en', 'fy', 'en'] | True |
test_override_restored_entities | (hass) | Test that we allow overriding restored entities. | Test that we allow overriding restored entities. | async def test_override_restored_entities(hass):
"""Test that we allow overriding restored entities."""
registry = mock_registry(hass)
registry.async_get_or_create(
"test_domain", "test_domain", "1234", suggested_object_id="world"
)
hass.states.async_set("test_domain.world", "unavailable", ... | [
"async",
"def",
"test_override_restored_entities",
"(",
"hass",
")",
":",
"registry",
"=",
"mock_registry",
"(",
"hass",
")",
"registry",
".",
"async_get_or_create",
"(",
"\"test_domain\"",
",",
"\"test_domain\"",
",",
"\"1234\"",
",",
"suggested_object_id",
"=",
"\... | [
855,
0
] | [
871,
30
] | python | en | ['en', 'en', 'en'] | True |
test_platform_with_no_setup | (hass, caplog) | Test setting up a platform that does not support setup. | Test setting up a platform that does not support setup. | async def test_platform_with_no_setup(hass, caplog):
"""Test setting up a platform that does not support setup."""
entity_platform = MockEntityPlatform(
hass, domain="mock-integration", platform_name="mock-platform", platform=None
)
await entity_platform.async_setup(None)
assert (
... | [
"async",
"def",
"test_platform_with_no_setup",
"(",
"hass",
",",
"caplog",
")",
":",
"entity_platform",
"=",
"MockEntityPlatform",
"(",
"hass",
",",
"domain",
"=",
"\"mock-integration\"",
",",
"platform_name",
"=",
"\"mock-platform\"",
",",
"platform",
"=",
"None",
... | [
874,
0
] | [
885,
5
] | python | en | ['en', 'en', 'en'] | True |
test_platforms_sharing_services | (hass) | Test platforms share services. | Test platforms share services. | async def test_platforms_sharing_services(hass):
"""Test platforms share services."""
entity_platform1 = MockEntityPlatform(
hass, domain="mock_integration", platform_name="mock_platform", platform=None
)
entity1 = MockEntity(entity_id="mock_integration.entity_1")
await entity_platform1.asyn... | [
"async",
"def",
"test_platforms_sharing_services",
"(",
"hass",
")",
":",
"entity_platform1",
"=",
"MockEntityPlatform",
"(",
"hass",
",",
"domain",
"=",
"\"mock_integration\"",
",",
"platform_name",
"=",
"\"mock_platform\"",
",",
"platform",
"=",
"None",
")",
"enti... | [
888,
0
] | [
928,
30
] | python | en | ['en', 'da', 'en'] | True |
test_invalid_entity_id | (hass) | Test specifying an invalid entity id. | Test specifying an invalid entity id. | async def test_invalid_entity_id(hass):
"""Test specifying an invalid entity id."""
platform = MockEntityPlatform(hass)
entity = MockEntity(entity_id="invalid_entity_id")
with pytest.raises(HomeAssistantError):
await platform.async_add_entities([entity])
assert entity.hass is None
assert... | [
"async",
"def",
"test_invalid_entity_id",
"(",
"hass",
")",
":",
"platform",
"=",
"MockEntityPlatform",
"(",
"hass",
")",
"entity",
"=",
"MockEntity",
"(",
"entity_id",
"=",
"\"invalid_entity_id\"",
")",
"with",
"pytest",
".",
"raises",
"(",
"HomeAssistantError",
... | [
931,
0
] | [
938,
34
] | python | en | ['en', 'en', 'en'] | True |
test_setup_entry_with_entities_that_block_forever | (hass, caplog) | Test we cancel adding entities when we reach the timeout. | Test we cancel adding entities when we reach the timeout. | async def test_setup_entry_with_entities_that_block_forever(hass, caplog):
"""Test we cancel adding entities when we reach the timeout."""
registry = mock_registry(hass)
async def async_setup_entry(hass, config_entry, async_add_entities):
"""Mock setup entry method."""
async_add_entities([M... | [
"async",
"def",
"test_setup_entry_with_entities_that_block_forever",
"(",
"hass",
",",
"caplog",
")",
":",
"registry",
"=",
"mock_registry",
"(",
"hass",
")",
"async",
"def",
"async_setup_entry",
"(",
"hass",
",",
"config_entry",
",",
"async_add_entities",
")",
":",... | [
949,
0
] | [
976,
32
] | python | en | ['en', 'en', 'en'] | True |
test_two_platforms_add_same_entity | (hass) | Test two platforms in the same domain adding an entity with the same name. | Test two platforms in the same domain adding an entity with the same name. | async def test_two_platforms_add_same_entity(hass):
"""Test two platforms in the same domain adding an entity with the same name."""
entity_platform1 = MockEntityPlatform(
hass, domain="mock_integration", platform_name="mock_platform", platform=None
)
entity1 = SlowEntity(name="entity_1")
e... | [
"async",
"def",
"test_two_platforms_add_same_entity",
"(",
"hass",
")",
":",
"entity_platform1",
"=",
"MockEntityPlatform",
"(",
"hass",
",",
"domain",
"=",
"\"mock_integration\"",
",",
"platform_name",
"=",
"\"mock_platform\"",
",",
"platform",
"=",
"None",
")",
"e... | [
979,
0
] | [
1013,
30
] | python | en | ['en', 'en', 'en'] | True |
MockBlockingEntity.async_added_to_hass | (self) | Block for a long time. | Block for a long time. | async def async_added_to_hass(self):
"""Block for a long time."""
await asyncio.sleep(1000) | [
"async",
"def",
"async_added_to_hass",
"(",
"self",
")",
":",
"await",
"asyncio",
".",
"sleep",
"(",
"1000",
")"
] | [
944,
4
] | [
946,
33
] | python | en | ['en', 'en', 'en'] | True |
SlowEntity.async_added_to_hass | (self) | Make sure control is returned to the event loop on add. | Make sure control is returned to the event loop on add. | async def async_added_to_hass(self):
"""Make sure control is returned to the event loop on add."""
await asyncio.sleep(0.1)
await super().async_added_to_hass() | [
"async",
"def",
"async_added_to_hass",
"(",
"self",
")",
":",
"await",
"asyncio",
".",
"sleep",
"(",
"0.1",
")",
"await",
"super",
"(",
")",
".",
"async_added_to_hass",
"(",
")"
] | [
1019,
4
] | [
1022,
43
] | python | en | ['en', 'en', 'en'] | True |
TestTTSYandexPlatform.setup_method | (self) | Set up things to be run when tests are started. | Set up things to be run when tests are started. | def setup_method(self):
"""Set up things to be run when tests are started."""
self.hass = get_test_home_assistant()
self._base_url = "https://tts.voicetech.yandex.net/generate?"
asyncio.run_coroutine_threadsafe(
async_process_ha_core_config(
self.hass, {"inte... | [
"def",
"setup_method",
"(",
"self",
")",
":",
"self",
".",
"hass",
"=",
"get_test_home_assistant",
"(",
")",
"self",
".",
"_base_url",
"=",
"\"https://tts.voicetech.yandex.net/generate?\"",
"asyncio",
".",
"run_coroutine_threadsafe",
"(",
"async_process_ha_core_config",
... | [
23,
4
] | [
33,
9
] | python | en | ['en', 'en', 'en'] | True |
TestTTSYandexPlatform.teardown_method | (self) | Stop everything that was started. | Stop everything that was started. | def teardown_method(self):
"""Stop everything that was started."""
default_tts = self.hass.config.path(tts.DEFAULT_CACHE_DIR)
if os.path.isdir(default_tts):
shutil.rmtree(default_tts)
self.hass.stop() | [
"def",
"teardown_method",
"(",
"self",
")",
":",
"default_tts",
"=",
"self",
".",
"hass",
".",
"config",
".",
"path",
"(",
"tts",
".",
"DEFAULT_CACHE_DIR",
")",
"if",
"os",
".",
"path",
".",
"isdir",
"(",
"default_tts",
")",
":",
"shutil",
".",
"rmtree... | [
35,
4
] | [
41,
24
] | python | en | ['en', 'en', 'en'] | True |
TestTTSYandexPlatform.test_setup_component | (self) | Test setup component. | Test setup component. | def test_setup_component(self):
"""Test setup component."""
config = {tts.DOMAIN: {"platform": "yandextts", "api_key": "1234567xx"}}
with assert_setup_component(1, tts.DOMAIN):
setup_component(self.hass, tts.DOMAIN, config) | [
"def",
"test_setup_component",
"(",
"self",
")",
":",
"config",
"=",
"{",
"tts",
".",
"DOMAIN",
":",
"{",
"\"platform\"",
":",
"\"yandextts\"",
",",
"\"api_key\"",
":",
"\"1234567xx\"",
"}",
"}",
"with",
"assert_setup_component",
"(",
"1",
",",
"tts",
".",
... | [
43,
4
] | [
48,
58
] | python | en | ['en', 'da', 'en'] | True |
TestTTSYandexPlatform.test_setup_component_without_api_key | (self) | Test setup component without api key. | Test setup component without api key. | def test_setup_component_without_api_key(self):
"""Test setup component without api key."""
config = {tts.DOMAIN: {"platform": "yandextts"}}
with assert_setup_component(0, tts.DOMAIN):
setup_component(self.hass, tts.DOMAIN, config) | [
"def",
"test_setup_component_without_api_key",
"(",
"self",
")",
":",
"config",
"=",
"{",
"tts",
".",
"DOMAIN",
":",
"{",
"\"platform\"",
":",
"\"yandextts\"",
"}",
"}",
"with",
"assert_setup_component",
"(",
"0",
",",
"tts",
".",
"DOMAIN",
")",
":",
"setup_... | [
50,
4
] | [
55,
58
] | python | en | ['en', 'haw', 'en'] | True |
TestTTSYandexPlatform.test_service_say | (self, aioclient_mock) | Test service call say. | Test service call say. | def test_service_say(self, aioclient_mock):
"""Test service call say."""
calls = mock_service(self.hass, DOMAIN_MP, SERVICE_PLAY_MEDIA)
url_param = {
"text": "HomeAssistant",
"lang": "en-US",
"key": "1234567xx",
"speaker": "zahar",
"fo... | [
"def",
"test_service_say",
"(",
"self",
",",
"aioclient_mock",
")",
":",
"calls",
"=",
"mock_service",
"(",
"self",
".",
"hass",
",",
"DOMAIN_MP",
",",
"SERVICE_PLAY_MEDIA",
")",
"url_param",
"=",
"{",
"\"text\"",
":",
"\"HomeAssistant\"",
",",
"\"lang\"",
":"... | [
57,
4
] | [
87,
30
] | python | en | ['en', 'en', 'en'] | True |
TestTTSYandexPlatform.test_service_say_russian_config | (self, aioclient_mock) | Test service call say. | Test service call say. | def test_service_say_russian_config(self, aioclient_mock):
"""Test service call say."""
calls = mock_service(self.hass, DOMAIN_MP, SERVICE_PLAY_MEDIA)
url_param = {
"text": "HomeAssistant",
"lang": "ru-RU",
"key": "1234567xx",
"speaker": "zahar",
... | [
"def",
"test_service_say_russian_config",
"(",
"self",
",",
"aioclient_mock",
")",
":",
"calls",
"=",
"mock_service",
"(",
"self",
".",
"hass",
",",
"DOMAIN_MP",
",",
"SERVICE_PLAY_MEDIA",
")",
"url_param",
"=",
"{",
"\"text\"",
":",
"\"HomeAssistant\"",
",",
"\... | [
89,
4
] | [
125,
30
] | python | en | ['en', 'en', 'en'] | True |
TestTTSYandexPlatform.test_service_say_russian_service | (self, aioclient_mock) | Test service call say. | Test service call say. | def test_service_say_russian_service(self, aioclient_mock):
"""Test service call say."""
calls = mock_service(self.hass, DOMAIN_MP, SERVICE_PLAY_MEDIA)
url_param = {
"text": "HomeAssistant",
"lang": "ru-RU",
"key": "1234567xx",
"speaker": "zahar",... | [
"def",
"test_service_say_russian_service",
"(",
"self",
",",
"aioclient_mock",
")",
":",
"calls",
"=",
"mock_service",
"(",
"self",
".",
"hass",
",",
"DOMAIN_MP",
",",
"SERVICE_PLAY_MEDIA",
")",
"url_param",
"=",
"{",
"\"text\"",
":",
"\"HomeAssistant\"",
",",
"... | [
127,
4
] | [
161,
30
] | python | en | ['en', 'en', 'en'] | True |
TestTTSYandexPlatform.test_service_say_timeout | (self, aioclient_mock) | Test service call say. | Test service call say. | def test_service_say_timeout(self, aioclient_mock):
"""Test service call say."""
calls = mock_service(self.hass, DOMAIN_MP, SERVICE_PLAY_MEDIA)
url_param = {
"text": "HomeAssistant",
"lang": "en-US",
"key": "1234567xx",
"speaker": "zahar",
... | [
"def",
"test_service_say_timeout",
"(",
"self",
",",
"aioclient_mock",
")",
":",
"calls",
"=",
"mock_service",
"(",
"self",
".",
"hass",
",",
"DOMAIN_MP",
",",
"SERVICE_PLAY_MEDIA",
")",
"url_param",
"=",
"{",
"\"text\"",
":",
"\"HomeAssistant\"",
",",
"\"lang\"... | [
163,
4
] | [
193,
50
] | python | en | ['en', 'en', 'en'] | True |
TestTTSYandexPlatform.test_service_say_http_error | (self, aioclient_mock) | Test service call say. | Test service call say. | def test_service_say_http_error(self, aioclient_mock):
"""Test service call say."""
calls = mock_service(self.hass, DOMAIN_MP, SERVICE_PLAY_MEDIA)
url_param = {
"text": "HomeAssistant",
"lang": "en-US",
"key": "1234567xx",
"speaker": "zahar",
... | [
"def",
"test_service_say_http_error",
"(",
"self",
",",
"aioclient_mock",
")",
":",
"calls",
"=",
"mock_service",
"(",
"self",
".",
"hass",
",",
"DOMAIN_MP",
",",
"SERVICE_PLAY_MEDIA",
")",
"url_param",
"=",
"{",
"\"text\"",
":",
"\"HomeAssistant\"",
",",
"\"lan... | [
195,
4
] | [
224,
30
] | python | en | ['en', 'en', 'en'] | True |
TestTTSYandexPlatform.test_service_say_specified_speaker | (self, aioclient_mock) | Test service call say. | Test service call say. | def test_service_say_specified_speaker(self, aioclient_mock):
"""Test service call say."""
calls = mock_service(self.hass, DOMAIN_MP, SERVICE_PLAY_MEDIA)
url_param = {
"text": "HomeAssistant",
"lang": "en-US",
"key": "1234567xx",
"speaker": "alyss... | [
"def",
"test_service_say_specified_speaker",
"(",
"self",
",",
"aioclient_mock",
")",
":",
"calls",
"=",
"mock_service",
"(",
"self",
".",
"hass",
",",
"DOMAIN_MP",
",",
"SERVICE_PLAY_MEDIA",
")",
"url_param",
"=",
"{",
"\"text\"",
":",
"\"HomeAssistant\"",
",",
... | [
226,
4
] | [
262,
30
] | python | en | ['en', 'en', 'en'] | True |
TestTTSYandexPlatform.test_service_say_specified_emotion | (self, aioclient_mock) | Test service call say. | Test service call say. | def test_service_say_specified_emotion(self, aioclient_mock):
"""Test service call say."""
calls = mock_service(self.hass, DOMAIN_MP, SERVICE_PLAY_MEDIA)
url_param = {
"text": "HomeAssistant",
"lang": "en-US",
"key": "1234567xx",
"speaker": "zahar... | [
"def",
"test_service_say_specified_emotion",
"(",
"self",
",",
"aioclient_mock",
")",
":",
"calls",
"=",
"mock_service",
"(",
"self",
".",
"hass",
",",
"DOMAIN_MP",
",",
"SERVICE_PLAY_MEDIA",
")",
"url_param",
"=",
"{",
"\"text\"",
":",
"\"HomeAssistant\"",
",",
... | [
264,
4
] | [
300,
30
] | python | en | ['en', 'en', 'en'] | True |
TestTTSYandexPlatform.test_service_say_specified_low_speed | (self, aioclient_mock) | Test service call say. | Test service call say. | def test_service_say_specified_low_speed(self, aioclient_mock):
"""Test service call say."""
calls = mock_service(self.hass, DOMAIN_MP, SERVICE_PLAY_MEDIA)
url_param = {
"text": "HomeAssistant",
"lang": "en-US",
"key": "1234567xx",
"speaker": "zah... | [
"def",
"test_service_say_specified_low_speed",
"(",
"self",
",",
"aioclient_mock",
")",
":",
"calls",
"=",
"mock_service",
"(",
"self",
".",
"hass",
",",
"DOMAIN_MP",
",",
"SERVICE_PLAY_MEDIA",
")",
"url_param",
"=",
"{",
"\"text\"",
":",
"\"HomeAssistant\"",
",",... | [
302,
4
] | [
334,
30
] | python | en | ['en', 'en', 'en'] | True |
TestTTSYandexPlatform.test_service_say_specified_speed | (self, aioclient_mock) | Test service call say. | Test service call say. | def test_service_say_specified_speed(self, aioclient_mock):
"""Test service call say."""
calls = mock_service(self.hass, DOMAIN_MP, SERVICE_PLAY_MEDIA)
url_param = {
"text": "HomeAssistant",
"lang": "en-US",
"key": "1234567xx",
"speaker": "zahar",... | [
"def",
"test_service_say_specified_speed",
"(",
"self",
",",
"aioclient_mock",
")",
":",
"calls",
"=",
"mock_service",
"(",
"self",
".",
"hass",
",",
"DOMAIN_MP",
",",
"SERVICE_PLAY_MEDIA",
")",
"url_param",
"=",
"{",
"\"text\"",
":",
"\"HomeAssistant\"",
",",
"... | [
336,
4
] | [
368,
30
] | python | en | ['en', 'en', 'en'] | True |
TestTTSYandexPlatform.test_service_say_specified_options | (self, aioclient_mock) | Test service call say with options. | Test service call say with options. | def test_service_say_specified_options(self, aioclient_mock):
"""Test service call say with options."""
calls = mock_service(self.hass, DOMAIN_MP, SERVICE_PLAY_MEDIA)
url_param = {
"text": "HomeAssistant",
"lang": "en-US",
"key": "1234567xx",
"spe... | [
"def",
"test_service_say_specified_options",
"(",
"self",
",",
"aioclient_mock",
")",
":",
"calls",
"=",
"mock_service",
"(",
"self",
".",
"hass",
",",
"DOMAIN_MP",
",",
"SERVICE_PLAY_MEDIA",
")",
"url_param",
"=",
"{",
"\"text\"",
":",
"\"HomeAssistant\"",
",",
... | [
370,
4
] | [
403,
30
] | python | en | ['en', 'en', 'en'] | True |
parse_args | () | Parse CL args and return an argparse.Namespace. | Parse CL args and return an argparse.Namespace. | def parse_args():
"""Parse CL args and return an argparse.Namespace."""
parser = argparse.ArgumentParser(
description='Create the cloudwatch agent config file'
)
parser.add_argument('--config',
help='Path to JSON file describing logs that should be monitored',
... | [
"def",
"parse_args",
"(",
")",
":",
"parser",
"=",
"argparse",
".",
"ArgumentParser",
"(",
"description",
"=",
"'Create the cloudwatch agent config file'",
")",
"parser",
".",
"add_argument",
"(",
"'--config'",
",",
"help",
"=",
"'Path to JSON file describing logs that ... | [
17,
0
] | [
41,
30
] | python | en | ['en', 'en', 'en'] | True |
gethostname | () | Return hostname of this instance. | Return hostname of this instance. | def gethostname():
"""Return hostname of this instance."""
return socket.gethostname().split('.')[0] | [
"def",
"gethostname",
"(",
")",
":",
"return",
"socket",
".",
"gethostname",
"(",
")",
".",
"split",
"(",
"'.'",
")",
"[",
"0",
"]"
] | [
44,
0
] | [
46,
45
] | python | en | ['en', 'no', 'en'] | True |
write_config | (config) | Write config to AWS_CLOUDWATCH_CFG_PATH. | Write config to AWS_CLOUDWATCH_CFG_PATH. | def write_config(config):
"""Write config to AWS_CLOUDWATCH_CFG_PATH."""
with open(AWS_CLOUDWATCH_CFG_PATH, 'w+') as output_config_file:
json.dump(config, output_config_file, indent=4) | [
"def",
"write_config",
"(",
"config",
")",
":",
"with",
"open",
"(",
"AWS_CLOUDWATCH_CFG_PATH",
",",
"'w+'",
")",
"as",
"output_config_file",
":",
"json",
".",
"dump",
"(",
"config",
",",
"output_config_file",
",",
"indent",
"=",
"4",
")"
] | [
49,
0
] | [
52,
55
] | python | en | ['en', 'en', 'en'] | True |
add_log_group_name_params | (log_group_name, configs) | Add a "log_group_name": log_group_name to every config. | Add a "log_group_name": log_group_name to every config. | def add_log_group_name_params(log_group_name, configs):
"""Add a "log_group_name": log_group_name to every config."""
for config in configs:
config.update({'log_group_name': log_group_name})
return configs | [
"def",
"add_log_group_name_params",
"(",
"log_group_name",
",",
"configs",
")",
":",
"for",
"config",
"in",
"configs",
":",
"config",
".",
"update",
"(",
"{",
"'log_group_name'",
":",
"log_group_name",
"}",
")",
"return",
"configs"
] | [
55,
0
] | [
59,
18
] | python | en | ['en', 'en', 'en'] | True |
add_instance_log_stream_prefixes | (configs) | Prefix all log_stream_name fields with instance identifiers. | Prefix all log_stream_name fields with instance identifiers. | def add_instance_log_stream_prefixes(configs):
"""Prefix all log_stream_name fields with instance identifiers."""
for config in configs:
config['log_stream_name'] = '{host}.{{instance_id}}.{log_stream_name}'.format(
host=gethostname(),
log_stream_name=config['log_stream_name']
... | [
"def",
"add_instance_log_stream_prefixes",
"(",
"configs",
")",
":",
"for",
"config",
"in",
"configs",
":",
"config",
"[",
"'log_stream_name'",
"]",
"=",
"'{host}.{{instance_id}}.{log_stream_name}'",
".",
"format",
"(",
"host",
"=",
"gethostname",
"(",
")",
",",
"... | [
62,
0
] | [
69,
18
] | python | en | ['en', 'pl', 'en'] | True |
read_data | (config_path) | Read in log configuration data from config_path. | Read in log configuration data from config_path. | def read_data(config_path):
"""Read in log configuration data from config_path."""
with open(config_path) as infile:
return json.load(infile) | [
"def",
"read_data",
"(",
"config_path",
")",
":",
"with",
"open",
"(",
"config_path",
")",
"as",
"infile",
":",
"return",
"json",
".",
"load",
"(",
"infile",
")"
] | [
72,
0
] | [
75,
32
] | python | en | ['en', 'en', 'en'] | True |
select_configs_for_scheduler | (configs, scheduler) | Filter out from configs those entries whose 'schedulers' list does not contain scheduler. | Filter out from configs those entries whose 'schedulers' list does not contain scheduler. | def select_configs_for_scheduler(configs, scheduler):
"""Filter out from configs those entries whose 'schedulers' list does not contain scheduler."""
return [config for config in configs if scheduler in config['schedulers']] | [
"def",
"select_configs_for_scheduler",
"(",
"configs",
",",
"scheduler",
")",
":",
"return",
"[",
"config",
"for",
"config",
"in",
"configs",
"if",
"scheduler",
"in",
"config",
"[",
"'schedulers'",
"]",
"]"
] | [
78,
0
] | [
80,
78
] | python | en | ['en', 'en', 'en'] | True |
select_configs_for_node_role | (configs, node_role) | Filter out from configs those entries whose 'node_roles' list does not contain node_role. | Filter out from configs those entries whose 'node_roles' list does not contain node_role. | def select_configs_for_node_role(configs, node_role):
"""Filter out from configs those entries whose 'node_roles' list does not contain node_role."""
return [config for config in configs if node_role in config['node_roles']] | [
"def",
"select_configs_for_node_role",
"(",
"configs",
",",
"node_role",
")",
":",
"return",
"[",
"config",
"for",
"config",
"in",
"configs",
"if",
"node_role",
"in",
"config",
"[",
"'node_roles'",
"]",
"]"
] | [
83,
0
] | [
85,
78
] | python | en | ['en', 'en', 'en'] | True |
select_configs_for_platform | (configs, platform) | Filter out from configs those entries whose 'platforms' list does not contain platform. | Filter out from configs those entries whose 'platforms' list does not contain platform. | def select_configs_for_platform(configs, platform):
"""Filter out from configs those entries whose 'platforms' list does not contain platform."""
return [config for config in configs if platform in config['platforms']] | [
"def",
"select_configs_for_platform",
"(",
"configs",
",",
"platform",
")",
":",
"return",
"[",
"config",
"for",
"config",
"in",
"configs",
"if",
"platform",
"in",
"config",
"[",
"'platforms'",
"]",
"]"
] | [
88,
0
] | [
90,
76
] | python | en | ['en', 'en', 'en'] | True |
get_node_info | () | Return the information encoded in the JSON file at /etc/chef/dna.json. | Return the information encoded in the JSON file at /etc/chef/dna.json. | def get_node_info():
"""Return the information encoded in the JSON file at /etc/chef/dna.json."""
node_info = {}
dna_path = "/etc/chef/dna.json"
if os.path.isfile(dna_path):
with open(dna_path) as node_info_file:
node_info = json.load(node_info_file).get("cluster")
return node_in... | [
"def",
"get_node_info",
"(",
")",
":",
"node_info",
"=",
"{",
"}",
"dna_path",
"=",
"\"/etc/chef/dna.json\"",
"if",
"os",
".",
"path",
".",
"isfile",
"(",
"dna_path",
")",
":",
"with",
"open",
"(",
"dna_path",
")",
"as",
"node_info_file",
":",
"node_info",... | [
93,
0
] | [
100,
20
] | python | en | ['en', 'en', 'en'] | True |
select_configs_for_feature | (configs) | Filter out from configs those entries whose 'feature_conditions' list contains an unsatisfied entry. | Filter out from configs those entries whose 'feature_conditions' list contains an unsatisfied entry. | def select_configs_for_feature(configs):
"""Filter out from configs those entries whose 'feature_conditions' list contains an unsatisfied entry."""
selected_configs = []
node_info = get_node_info()
for config in configs:
conditions = config.get("feature_conditions", [])
for condition in ... | [
"def",
"select_configs_for_feature",
"(",
"configs",
")",
":",
"selected_configs",
"=",
"[",
"]",
"node_info",
"=",
"get_node_info",
"(",
")",
"for",
"config",
"in",
"configs",
":",
"conditions",
"=",
"config",
".",
"get",
"(",
"\"feature_conditions\"",
",",
"... | [
103,
0
] | [
115,
27
] | python | en | ['en', 'en', 'en'] | True |
select_logs | (configs, args) | Select the appropriate set of log configs. | Select the appropriate set of log configs. | def select_logs(configs, args):
"""Select the appropriate set of log configs."""
selected_configs = select_configs_for_scheduler(configs, args.scheduler)
selected_configs = select_configs_for_node_role(selected_configs, args.node_role)
selected_configs = select_configs_for_platform(selected_configs, arg... | [
"def",
"select_logs",
"(",
"configs",
",",
"args",
")",
":",
"selected_configs",
"=",
"select_configs_for_scheduler",
"(",
"configs",
",",
"args",
".",
"scheduler",
")",
"selected_configs",
"=",
"select_configs_for_node_role",
"(",
"selected_configs",
",",
"args",
"... | [
118,
0
] | [
124,
27
] | python | en | ['en', 'en', 'en'] | True |
add_timestamps | (configs, timestamps_dict) | For each config, set its timestamp_format field based on its timestamp_format_key field. | For each config, set its timestamp_format field based on its timestamp_format_key field. | def add_timestamps(configs, timestamps_dict):
"""For each config, set its timestamp_format field based on its timestamp_format_key field."""
for config in configs:
config['timestamp_format'] = timestamps_dict[config['timestamp_format_key']]
return configs | [
"def",
"add_timestamps",
"(",
"configs",
",",
"timestamps_dict",
")",
":",
"for",
"config",
"in",
"configs",
":",
"config",
"[",
"'timestamp_format'",
"]",
"=",
"timestamps_dict",
"[",
"config",
"[",
"'timestamp_format_key'",
"]",
"]",
"return",
"configs"
] | [
127,
0
] | [
131,
18
] | python | en | ['en', 'en', 'en'] | True |
filter_output_fields | (configs) | Remove fields that are not required by CloudWatch agent config file. | Remove fields that are not required by CloudWatch agent config file. | def filter_output_fields(configs):
"""Remove fields that are not required by CloudWatch agent config file."""
desired_keys = ['log_stream_name', 'file_path', 'timestamp_format', 'log_group_name']
return [{desired_key: config[desired_key] for desired_key in desired_keys} for config in configs] | [
"def",
"filter_output_fields",
"(",
"configs",
")",
":",
"desired_keys",
"=",
"[",
"'log_stream_name'",
",",
"'file_path'",
",",
"'timestamp_format'",
",",
"'log_group_name'",
"]",
"return",
"[",
"{",
"desired_key",
":",
"config",
"[",
"desired_key",
"]",
"for",
... | [
134,
0
] | [
137,
101
] | python | en | ['en', 'en', 'en'] | True |
create_config | (log_configs) | Return a dict representing the structure of the output JSON. | Return a dict representing the structure of the output JSON. | def create_config(log_configs):
"""Return a dict representing the structure of the output JSON."""
return {
"logs": {
"logs_collected": {
"files": {
"collect_list": log_configs
}
},
"log_stream_name": "{host}.{{insta... | [
"def",
"create_config",
"(",
"log_configs",
")",
":",
"return",
"{",
"\"logs\"",
":",
"{",
"\"logs_collected\"",
":",
"{",
"\"files\"",
":",
"{",
"\"collect_list\"",
":",
"log_configs",
"}",
"}",
",",
"\"log_stream_name\"",
":",
"\"{host}.{{instance_id}}.default-log... | [
140,
0
] | [
151,
5
] | python | en | ['en', 'en', 'en'] | True |
main | () | Create cloudwatch agent config file. | Create cloudwatch agent config file. | def main():
"""Create cloudwatch agent config file."""
args = parse_args()
config_data = read_data(args.config)
log_configs = select_logs(config_data['log_configs'], args)
log_configs = add_timestamps(log_configs, config_data['timestamp_formats'])
log_configs = add_log_group_name_params(args.log... | [
"def",
"main",
"(",
")",
":",
"args",
"=",
"parse_args",
"(",
")",
"config_data",
"=",
"read_data",
"(",
"args",
".",
"config",
")",
"log_configs",
"=",
"select_logs",
"(",
"config_data",
"[",
"'log_configs'",
"]",
",",
"args",
")",
"log_configs",
"=",
"... | [
154,
0
] | [
163,
44
] | python | en | ['en', 'en', 'en'] | True |
async_setup_entry | (hass, config_entry, async_add_entities) | Set up the platform from config_entry. | Set up the platform from config_entry. | async def async_setup_entry(hass, config_entry, async_add_entities):
"""Set up the platform from config_entry."""
name = config_entry.data.get(CONF_NAME) or DOMAIN
async_add_entities([IPSensor(name)], True) | [
"async",
"def",
"async_setup_entry",
"(",
"hass",
",",
"config_entry",
",",
"async_add_entities",
")",
":",
"name",
"=",
"config_entry",
".",
"data",
".",
"get",
"(",
"CONF_NAME",
")",
"or",
"DOMAIN",
"async_add_entities",
"(",
"[",
"IPSensor",
"(",
"name",
... | [
9,
0
] | [
12,
46
] | python | en | ['en', 'en', 'en'] | True |
IPSensor.__init__ | (self, name) | Initialize the sensor. | Initialize the sensor. | def __init__(self, name):
"""Initialize the sensor."""
self._state = None
self._name = name | [
"def",
"__init__",
"(",
"self",
",",
"name",
")",
":",
"self",
".",
"_state",
"=",
"None",
"self",
".",
"_name",
"=",
"name"
] | [
18,
4
] | [
21,
25
] | python | en | ['en', 'en', 'en'] | True |
IPSensor.name | (self) | Return the name of the sensor. | Return the name of the sensor. | def name(self):
"""Return the name of the sensor."""
return self._name | [
"def",
"name",
"(",
"self",
")",
":",
"return",
"self",
".",
"_name"
] | [
24,
4
] | [
26,
25
] | python | en | ['en', 'mi', 'en'] | True |
IPSensor.unique_id | (self) | Return the unique id of the sensor. | Return the unique id of the sensor. | def unique_id(self):
"""Return the unique id of the sensor."""
return SENSOR | [
"def",
"unique_id",
"(",
"self",
")",
":",
"return",
"SENSOR"
] | [
29,
4
] | [
31,
21
] | python | en | ['en', 'la', 'en'] | True |
IPSensor.state | (self) | Return the state of the sensor. | Return the state of the sensor. | def state(self):
"""Return the state of the sensor."""
return self._state | [
"def",
"state",
"(",
"self",
")",
":",
"return",
"self",
".",
"_state"
] | [
34,
4
] | [
36,
26
] | python | en | ['en', 'en', 'en'] | True |
IPSensor.icon | (self) | Return the icon of the sensor. | Return the icon of the sensor. | def icon(self):
"""Return the icon of the sensor."""
return "mdi:ip" | [
"def",
"icon",
"(",
"self",
")",
":",
"return",
"\"mdi:ip\""
] | [
39,
4
] | [
41,
23
] | python | en | ['en', 'en', 'en'] | True |
IPSensor.update | (self) | Fetch new state data for the sensor. | Fetch new state data for the sensor. | def update(self):
"""Fetch new state data for the sensor."""
self._state = get_local_ip() | [
"def",
"update",
"(",
"self",
")",
":",
"self",
".",
"_state",
"=",
"get_local_ip",
"(",
")"
] | [
43,
4
] | [
45,
36
] | python | en | ['en', 'en', 'en'] | True |
test_ecobee_date_with_valid_input | () | Test that the date function returns the expected result. | Test that the date function returns the expected result. | async def test_ecobee_date_with_valid_input():
"""Test that the date function returns the expected result."""
test_input = "2019-09-27"
assert ecobee_date(test_input) == test_input | [
"async",
"def",
"test_ecobee_date_with_valid_input",
"(",
")",
":",
"test_input",
"=",
"\"2019-09-27\"",
"assert",
"ecobee_date",
"(",
"test_input",
")",
"==",
"test_input"
] | [
7,
0
] | [
11,
48
] | python | en | ['en', 'en', 'en'] | True |
test_ecobee_date_with_invalid_input | () | Test that the date function raises the expected exception. | Test that the date function raises the expected exception. | async def test_ecobee_date_with_invalid_input():
"""Test that the date function raises the expected exception."""
test_input = "20190927"
with pytest.raises(vol.Invalid):
ecobee_date(test_input) | [
"async",
"def",
"test_ecobee_date_with_invalid_input",
"(",
")",
":",
"test_input",
"=",
"\"20190927\"",
"with",
"pytest",
".",
"raises",
"(",
"vol",
".",
"Invalid",
")",
":",
"ecobee_date",
"(",
"test_input",
")"
] | [
14,
0
] | [
19,
31
] | python | en | ['en', 'en', 'en'] | True |
test_ecobee_time_with_valid_input | () | Test that the time function returns the expected result. | Test that the time function returns the expected result. | async def test_ecobee_time_with_valid_input():
"""Test that the time function returns the expected result."""
test_input = "20:55:15"
assert ecobee_time(test_input) == test_input | [
"async",
"def",
"test_ecobee_time_with_valid_input",
"(",
")",
":",
"test_input",
"=",
"\"20:55:15\"",
"assert",
"ecobee_time",
"(",
"test_input",
")",
"==",
"test_input"
] | [
22,
0
] | [
26,
48
] | python | en | ['en', 'en', 'en'] | True |
test_ecobee_time_with_invalid_input | () | Test that the time function raises the expected exception. | Test that the time function raises the expected exception. | async def test_ecobee_time_with_invalid_input():
"""Test that the time function raises the expected exception."""
test_input = "20:55"
with pytest.raises(vol.Invalid):
ecobee_time(test_input) | [
"async",
"def",
"test_ecobee_time_with_invalid_input",
"(",
")",
":",
"test_input",
"=",
"\"20:55\"",
"with",
"pytest",
".",
"raises",
"(",
"vol",
".",
"Invalid",
")",
":",
"ecobee_time",
"(",
"test_input",
")"
] | [
29,
0
] | [
34,
31
] | python | en | ['en', 'en', 'en'] | True |
OneWireBaseEntity.__init__ | (
self,
name,
device_file,
entity_type: str,
entity_name: str = None,
device_info=None,
default_disabled: bool = False,
) | Initialize the entity. | Initialize the entity. | def __init__(
self,
name,
device_file,
entity_type: str,
entity_name: str = None,
device_info=None,
default_disabled: bool = False,
):
"""Initialize the entity."""
self._name = f"{name} {entity_name or entity_type.capitalize()}"
self._d... | [
"def",
"__init__",
"(",
"self",
",",
"name",
",",
"device_file",
",",
"entity_type",
":",
"str",
",",
"entity_name",
":",
"str",
"=",
"None",
",",
"device_info",
"=",
"None",
",",
"default_disabled",
":",
"bool",
"=",
"False",
",",
")",
":",
"self",
".... | [
22,
4
] | [
40,
49
] | python | en | ['en', 'en', 'en'] | True |
OneWireBaseEntity.name | (self) | Return the name of the entity. | Return the name of the entity. | def name(self) -> Optional[str]:
"""Return the name of the entity."""
return self._name | [
"def",
"name",
"(",
"self",
")",
"->",
"Optional",
"[",
"str",
"]",
":",
"return",
"self",
".",
"_name"
] | [
43,
4
] | [
45,
25
] | python | en | ['en', 'en', 'en'] | True |
OneWireBaseEntity.device_class | (self) | Return the class of this device. | Return the class of this device. | def device_class(self) -> Optional[str]:
"""Return the class of this device."""
return self._device_class | [
"def",
"device_class",
"(",
"self",
")",
"->",
"Optional",
"[",
"str",
"]",
":",
"return",
"self",
".",
"_device_class"
] | [
48,
4
] | [
50,
33
] | python | en | ['en', 'en', 'en'] | True |
OneWireBaseEntity.unit_of_measurement | (self) | Return the unit the value is expressed in. | Return the unit the value is expressed in. | def unit_of_measurement(self) -> Optional[str]:
"""Return the unit the value is expressed in."""
return self._unit_of_measurement | [
"def",
"unit_of_measurement",
"(",
"self",
")",
"->",
"Optional",
"[",
"str",
"]",
":",
"return",
"self",
".",
"_unit_of_measurement"
] | [
53,
4
] | [
55,
40
] | python | en | ['en', 'en', 'en'] | True |
OneWireBaseEntity.device_state_attributes | (self) | Return the state attributes of the entity. | Return the state attributes of the entity. | def device_state_attributes(self) -> Optional[Dict[str, Any]]:
"""Return the state attributes of the entity."""
return {"device_file": self._device_file, "raw_value": self._value_raw} | [
"def",
"device_state_attributes",
"(",
"self",
")",
"->",
"Optional",
"[",
"Dict",
"[",
"str",
",",
"Any",
"]",
"]",
":",
"return",
"{",
"\"device_file\"",
":",
"self",
".",
"_device_file",
",",
"\"raw_value\"",
":",
"self",
".",
"_value_raw",
"}"
] | [
58,
4
] | [
60,
79
] | python | en | ['en', 'en', 'en'] | True |
OneWireBaseEntity.unique_id | (self) | Return a unique ID. | Return a unique ID. | def unique_id(self) -> Optional[str]:
"""Return a unique ID."""
return self._device_file | [
"def",
"unique_id",
"(",
"self",
")",
"->",
"Optional",
"[",
"str",
"]",
":",
"return",
"self",
".",
"_device_file"
] | [
63,
4
] | [
65,
32
] | python | ca | ['fr', 'ca', 'en'] | False |
OneWireBaseEntity.device_info | (self) | Return device specific attributes. | Return device specific attributes. | def device_info(self) -> Optional[Dict[str, Any]]:
"""Return device specific attributes."""
return self._device_info | [
"def",
"device_info",
"(",
"self",
")",
"->",
"Optional",
"[",
"Dict",
"[",
"str",
",",
"Any",
"]",
"]",
":",
"return",
"self",
".",
"_device_info"
] | [
68,
4
] | [
70,
32
] | python | en | ['fr', 'it', 'en'] | False |
OneWireBaseEntity.entity_registry_enabled_default | (self) | Return if the entity should be enabled when first added to the entity registry. | Return if the entity should be enabled when first added to the entity registry. | def entity_registry_enabled_default(self) -> bool:
"""Return if the entity should be enabled when first added to the entity registry."""
return not self._default_disabled | [
"def",
"entity_registry_enabled_default",
"(",
"self",
")",
"->",
"bool",
":",
"return",
"not",
"self",
".",
"_default_disabled"
] | [
73,
4
] | [
75,
41
] | python | en | ['en', 'en', 'en'] | True |
OneWireProxyEntity.__init__ | (
self,
name: str,
device_file: str,
entity_type: str,
entity_name: str,
device_info: Dict[str, Any],
default_disabled: bool,
owproxy: protocol._Proxy,
) | Initialize the sensor. | Initialize the sensor. | def __init__(
self,
name: str,
device_file: str,
entity_type: str,
entity_name: str,
device_info: Dict[str, Any],
default_disabled: bool,
owproxy: protocol._Proxy,
):
"""Initialize the sensor."""
super().__init__(
name, devi... | [
"def",
"__init__",
"(",
"self",
",",
"name",
":",
"str",
",",
"device_file",
":",
"str",
",",
"entity_type",
":",
"str",
",",
"entity_name",
":",
"str",
",",
"device_info",
":",
"Dict",
"[",
"str",
",",
"Any",
"]",
",",
"default_disabled",
":",
"bool",... | [
81,
4
] | [
95,
31
] | python | en | ['en', 'en', 'en'] | True |
OneWireProxyEntity._read_value_ownet | (self) | Read a value from the owserver. | Read a value from the owserver. | def _read_value_ownet(self):
"""Read a value from the owserver."""
return self._owproxy.read(self._device_file).decode().lstrip() | [
"def",
"_read_value_ownet",
"(",
"self",
")",
":",
"return",
"self",
".",
"_owproxy",
".",
"read",
"(",
"self",
".",
"_device_file",
")",
".",
"decode",
"(",
")",
".",
"lstrip",
"(",
")"
] | [
97,
4
] | [
99,
70
] | python | en | ['en', 'en', 'en'] | True |
OneWireProxyEntity._write_value_ownet | (self, value: bytes) | Write a value to the owserver. | Write a value to the owserver. | def _write_value_ownet(self, value: bytes):
"""Write a value to the owserver."""
return self._owproxy.write(self._device_file, value) | [
"def",
"_write_value_ownet",
"(",
"self",
",",
"value",
":",
"bytes",
")",
":",
"return",
"self",
".",
"_owproxy",
".",
"write",
"(",
"self",
".",
"_device_file",
",",
"value",
")"
] | [
101,
4
] | [
103,
60
] | python | en | ['en', 'en', 'en'] | True |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.