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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
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\"",
")"
] | [
26,
0
] | [
28,
57
] | python | en | ['en', 'en', 'en'] | True |
setup_comp | (hass) | Initialize components. | Initialize components. | def setup_comp(hass):
"""Initialize components."""
mock_component(hass, "group")
hass.config.set_time_zone(hass.config.time_zone)
hass.loop.run_until_complete(
async_setup_component(hass, sun.DOMAIN, {sun.DOMAIN: {sun.CONF_ELEVATION: 0}})
) | [
"def",
"setup_comp",
"(",
"hass",
")",
":",
"mock_component",
"(",
"hass",
",",
"\"group\"",
")",
"hass",
".",
"config",
".",
"set_time_zone",
"(",
"hass",
".",
"config",
".",
"time_zone",
")",
"hass",
".",
"loop",
".",
"run_until_complete",
"(",
"async_se... | [
32,
0
] | [
38,
5
] | python | en | ['de', 'en', 'en'] | False |
test_sunset_trigger | (hass, calls, legacy_patchable_time) | Test the sunset trigger. | Test the sunset trigger. | async def test_sunset_trigger(hass, calls, legacy_patchable_time):
"""Test the sunset trigger."""
now = datetime(2015, 9, 15, 23, tzinfo=dt_util.UTC)
trigger_time = datetime(2015, 9, 16, 2, tzinfo=dt_util.UTC)
with patch("homeassistant.util.dt.utcnow", return_value=now):
await async_setup_compo... | [
"async",
"def",
"test_sunset_trigger",
"(",
"hass",
",",
"calls",
",",
"legacy_patchable_time",
")",
":",
"now",
"=",
"datetime",
"(",
"2015",
",",
"9",
",",
"15",
",",
"23",
",",
"tzinfo",
"=",
"dt_util",
".",
"UTC",
")",
"trigger_time",
"=",
"datetime"... | [
46,
0
] | [
88,
35
] | python | en | ['en', 'en', 'en'] | True |
test_sunrise_trigger | (hass, calls, legacy_patchable_time) | Test the sunrise trigger. | Test the sunrise trigger. | async def test_sunrise_trigger(hass, calls, legacy_patchable_time):
"""Test the sunrise trigger."""
now = datetime(2015, 9, 13, 23, tzinfo=dt_util.UTC)
trigger_time = datetime(2015, 9, 16, 14, tzinfo=dt_util.UTC)
with patch("homeassistant.util.dt.utcnow", return_value=now):
await async_setup_co... | [
"async",
"def",
"test_sunrise_trigger",
"(",
"hass",
",",
"calls",
",",
"legacy_patchable_time",
")",
":",
"now",
"=",
"datetime",
"(",
"2015",
",",
"9",
",",
"13",
",",
"23",
",",
"tzinfo",
"=",
"dt_util",
".",
"UTC",
")",
"trigger_time",
"=",
"datetime... | [
91,
0
] | [
110,
26
] | python | en | ['en', 'no', 'en'] | True |
test_sunset_trigger_with_offset | (hass, calls, legacy_patchable_time) | Test the sunset trigger with offset. | Test the sunset trigger with offset. | async def test_sunset_trigger_with_offset(hass, calls, legacy_patchable_time):
"""Test the sunset trigger with offset."""
now = datetime(2015, 9, 15, 23, tzinfo=dt_util.UTC)
trigger_time = datetime(2015, 9, 16, 2, 30, tzinfo=dt_util.UTC)
with patch("homeassistant.util.dt.utcnow", return_value=now):
... | [
"async",
"def",
"test_sunset_trigger_with_offset",
"(",
"hass",
",",
"calls",
",",
"legacy_patchable_time",
")",
":",
"now",
"=",
"datetime",
"(",
"2015",
",",
"9",
",",
"15",
",",
"23",
",",
"tzinfo",
"=",
"dt_util",
".",
"UTC",
")",
"trigger_time",
"=",
... | [
113,
0
] | [
143,
60
] | python | en | ['en', 'en', 'en'] | True |
test_sunrise_trigger_with_offset | (hass, calls, legacy_patchable_time) | Test the sunrise trigger with offset. | Test the sunrise trigger with offset. | async def test_sunrise_trigger_with_offset(hass, calls, legacy_patchable_time):
"""Test the sunrise trigger with offset."""
now = datetime(2015, 9, 13, 23, tzinfo=dt_util.UTC)
trigger_time = datetime(2015, 9, 16, 13, 30, tzinfo=dt_util.UTC)
with patch("homeassistant.util.dt.utcnow", return_value=now):
... | [
"async",
"def",
"test_sunrise_trigger_with_offset",
"(",
"hass",
",",
"calls",
",",
"legacy_patchable_time",
")",
":",
"now",
"=",
"datetime",
"(",
"2015",
",",
"9",
",",
"13",
",",
"23",
",",
"tzinfo",
"=",
"dt_util",
".",
"UTC",
")",
"trigger_time",
"=",... | [
146,
0
] | [
169,
26
] | python | en | ['en', 'en', 'en'] | True |
filter_log_records | (caplog: LogCaptureFixture) | Filter all unrelated log records. | Filter all unrelated log records. | def filter_log_records(caplog: LogCaptureFixture) -> list[logging.LogRecord]:
"""Filter all unrelated log records."""
return [
rec for rec in caplog.records if rec.name.endswith(f"{DOMAIN}.{notify.DOMAIN}")
] | [
"def",
"filter_log_records",
"(",
"caplog",
":",
"LogCaptureFixture",
")",
"->",
"list",
"[",
"logging",
".",
"LogRecord",
"]",
":",
"return",
"[",
"rec",
"for",
"rec",
"in",
"caplog",
".",
"records",
"if",
"rec",
".",
"name",
".",
"endswith",
"(",
"f\"{... | [
42,
0
] | [
46,
5
] | python | en | ['en', 'en', 'en'] | True |
test_setup | (hass: HomeAssistant, caplog: LogCaptureFixture) | Test setup slack notify. | Test setup slack notify. | async def test_setup(hass: HomeAssistant, caplog: LogCaptureFixture):
"""Test setup slack notify."""
config = DEFAULT_CONFIG
with patch(
MODULE_PATH + ".aiohttp_client",
**{"async_get_clientsession.return_value": (session := Mock())},
), patch(
MODULE_PATH + ".WebClient",
... | [
"async",
"def",
"test_setup",
"(",
"hass",
":",
"HomeAssistant",
",",
"caplog",
":",
"LogCaptureFixture",
")",
":",
"config",
"=",
"DEFAULT_CONFIG",
"with",
"patch",
"(",
"MODULE_PATH",
"+",
"\".aiohttp_client\"",
",",
"*",
"*",
"{",
"\"async_get_clientsession.ret... | [
49,
0
] | [
67,
50
] | python | en | ['en', 'cs', 'en'] | True |
test_setup_clientError | (hass: HomeAssistant, caplog: LogCaptureFixture) | Test setup slack notify with aiohttp.ClientError exception. | Test setup slack notify with aiohttp.ClientError exception. | async def test_setup_clientError(hass: HomeAssistant, caplog: LogCaptureFixture):
"""Test setup slack notify with aiohttp.ClientError exception."""
config = copy.deepcopy(DEFAULT_CONFIG)
config[notify.DOMAIN][0].update({CONF_USERNAME: "user", CONF_ICON: "icon"})
with patch(
MODULE_PATH + ".aioh... | [
"async",
"def",
"test_setup_clientError",
"(",
"hass",
":",
"HomeAssistant",
",",
"caplog",
":",
"LogCaptureFixture",
")",
":",
"config",
"=",
"copy",
".",
"deepcopy",
"(",
"DEFAULT_CONFIG",
")",
"config",
"[",
"notify",
".",
"DOMAIN",
"]",
"[",
"0",
"]",
... | [
70,
0
] | [
88,
65
] | python | en | ['en', 'fr', 'en'] | True |
test_setup_slackApiError | (hass: HomeAssistant, caplog: LogCaptureFixture) | Test setup slack notify with SlackApiError exception. | Test setup slack notify with SlackApiError exception. | async def test_setup_slackApiError(hass: HomeAssistant, caplog: LogCaptureFixture):
"""Test setup slack notify with SlackApiError exception."""
config = DEFAULT_CONFIG
with patch(
MODULE_PATH + ".aiohttp_client",
**{"async_get_clientsession.return_value": Mock()},
), patch(MODULE_PATH +... | [
"async",
"def",
"test_setup_slackApiError",
"(",
"hass",
":",
"HomeAssistant",
",",
"caplog",
":",
"LogCaptureFixture",
")",
":",
"config",
"=",
"DEFAULT_CONFIG",
"with",
"patch",
"(",
"MODULE_PATH",
"+",
"\".aiohttp_client\"",
",",
"*",
"*",
"{",
"\"async_get_cli... | [
91,
0
] | [
108,
59
] | python | en | ['en', 'fr', 'en'] | True |
test_message_includes_default_emoji | () | Tests that default icon is used when no message icon is given. | Tests that default icon is used when no message icon is given. | async def test_message_includes_default_emoji():
"""Tests that default icon is used when no message icon is given."""
mock_client = Mock()
mock_client.chat_postMessage = AsyncMock()
expected_icon = ":robot_face:"
service = SlackNotificationService(None, mock_client, "_", "_", expected_icon)
awa... | [
"async",
"def",
"test_message_includes_default_emoji",
"(",
")",
":",
"mock_client",
"=",
"Mock",
"(",
")",
"mock_client",
".",
"chat_postMessage",
"=",
"AsyncMock",
"(",
")",
"expected_icon",
"=",
"\":robot_face:\"",
"service",
"=",
"SlackNotificationService",
"(",
... | [
111,
0
] | [
123,
48
] | python | en | ['en', 'en', 'en'] | True |
test_message_emoji_overrides_default | () | Tests that overriding the default icon emoji when sending a message works. | Tests that overriding the default icon emoji when sending a message works. | async def test_message_emoji_overrides_default():
"""Tests that overriding the default icon emoji when sending a message works."""
mock_client = Mock()
mock_client.chat_postMessage = AsyncMock()
service = SlackNotificationService(None, mock_client, "_", "_", "default_icon")
expected_icon = ":new:"
... | [
"async",
"def",
"test_message_emoji_overrides_default",
"(",
")",
":",
"mock_client",
"=",
"Mock",
"(",
")",
"mock_client",
".",
"chat_postMessage",
"=",
"AsyncMock",
"(",
")",
"service",
"=",
"SlackNotificationService",
"(",
"None",
",",
"mock_client",
",",
"\"_\... | [
126,
0
] | [
138,
48
] | python | en | ['en', 'en', 'en'] | True |
test_message_includes_default_icon_url | () | Tests that overriding the default icon url when sending a message works. | Tests that overriding the default icon url when sending a message works. | async def test_message_includes_default_icon_url():
"""Tests that overriding the default icon url when sending a message works."""
mock_client = Mock()
mock_client.chat_postMessage = AsyncMock()
expected_icon = "https://example.com/hass.png"
service = SlackNotificationService(None, mock_client, "_",... | [
"async",
"def",
"test_message_includes_default_icon_url",
"(",
")",
":",
"mock_client",
"=",
"Mock",
"(",
")",
"mock_client",
".",
"chat_postMessage",
"=",
"AsyncMock",
"(",
")",
"expected_icon",
"=",
"\"https://example.com/hass.png\"",
"service",
"=",
"SlackNotificatio... | [
141,
0
] | [
153,
46
] | python | en | ['en', 'en', 'en'] | True |
test_message_icon_url_overrides_default | () | Tests that overriding the default icon url when sending a message works. | Tests that overriding the default icon url when sending a message works. | async def test_message_icon_url_overrides_default():
"""Tests that overriding the default icon url when sending a message works."""
mock_client = Mock()
mock_client.chat_postMessage = AsyncMock()
service = SlackNotificationService(None, mock_client, "_", "_", "default_icon")
expected_icon = "https:... | [
"async",
"def",
"test_message_icon_url_overrides_default",
"(",
")",
":",
"mock_client",
"=",
"Mock",
"(",
")",
"mock_client",
".",
"chat_postMessage",
"=",
"AsyncMock",
"(",
")",
"service",
"=",
"SlackNotificationService",
"(",
"None",
",",
"mock_client",
",",
"\... | [
156,
0
] | [
168,
46
] | python | en | ['en', 'en', 'en'] | True |
get_multipath_v4_ll | (context) |
.. warning::
Deprecated parser, please use :class:`MultipathDevices` instead.
|
.. warning::
Deprecated parser, please use :class:`MultipathDevices` instead.
| def get_multipath_v4_ll(context):
"""
.. warning::
Deprecated parser, please use :class:`MultipathDevices` instead.
"""
deprecated(get_multipath_v4_ll, "Use the `MultipathDevices` class instead.")
return MultipathDevices(context).devices | [
"def",
"get_multipath_v4_ll",
"(",
"context",
")",
":",
"deprecated",
"(",
"get_multipath_v4_ll",
",",
"\"Use the `MultipathDevices` class instead.\"",
")",
"return",
"MultipathDevices",
"(",
"context",
")",
".",
"devices"
] | [
279,
0
] | [
285,
44
] | python | en | ['en', 'error', 'th'] | False |
get_integration_frame | (
exclude_integrations: set | None = None,
) | Return the frame, integration and integration path of the current stack frame. | Return the frame, integration and integration path of the current stack frame. | def get_integration_frame(
exclude_integrations: set | None = None,
) -> tuple[FrameSummary, str, str]:
"""Return the frame, integration and integration path of the current stack frame."""
found_frame = None
if not exclude_integrations:
exclude_integrations = set()
for frame in reversed(ext... | [
"def",
"get_integration_frame",
"(",
"exclude_integrations",
":",
"set",
"|",
"None",
"=",
"None",
",",
")",
"->",
"tuple",
"[",
"FrameSummary",
",",
"str",
",",
"str",
"]",
":",
"found_frame",
"=",
"None",
"if",
"not",
"exclude_integrations",
":",
"exclude_... | [
16,
0
] | [
44,
41
] | python | en | ['en', 'en', 'en'] | True |
report | (what: str) | Report incorrect usage.
Async friendly.
| Report incorrect usage. | def report(what: str) -> None:
"""Report incorrect usage.
Async friendly.
"""
try:
integration_frame = get_integration_frame()
except MissingIntegrationFrame as err:
# Did not source from an integration? Hard error.
raise RuntimeError(
f"Detected code that {what}... | [
"def",
"report",
"(",
"what",
":",
"str",
")",
"->",
"None",
":",
"try",
":",
"integration_frame",
"=",
"get_integration_frame",
"(",
")",
"except",
"MissingIntegrationFrame",
"as",
"err",
":",
"# Did not source from an integration? Hard error.",
"raise",
"RuntimeErro... | [
51,
0
] | [
64,
47
] | python | en | ['en', 'en', 'en'] | True |
report_integration | (
what: str, integration_frame: tuple[FrameSummary, str, str]
) | Report incorrect usage in an integration.
Async friendly.
| Report incorrect usage in an integration. | def report_integration(
what: str, integration_frame: tuple[FrameSummary, str, str]
) -> None:
"""Report incorrect usage in an integration.
Async friendly.
"""
found_frame, integration, path = integration_frame
index = found_frame.filename.index(path)
if path == "custom_components/":
... | [
"def",
"report_integration",
"(",
"what",
":",
"str",
",",
"integration_frame",
":",
"tuple",
"[",
"FrameSummary",
",",
"str",
",",
"str",
"]",
")",
"->",
"None",
":",
"found_frame",
",",
"integration",
",",
"path",
"=",
"integration_frame",
"index",
"=",
... | [
67,
0
] | [
91,
5
] | python | en | ['en', 'en', 'en'] | True |
warn_use | (func: CALLABLE_T, what: str) | Mock a function to warn when it was about to be used. | Mock a function to warn when it was about to be used. | def warn_use(func: CALLABLE_T, what: str) -> CALLABLE_T:
"""Mock a function to warn when it was about to be used."""
if asyncio.iscoroutinefunction(func):
@functools.wraps(func)
async def report_use(*args: Any, **kwargs: Any) -> None:
report(what)
else:
@functools.wrap... | [
"def",
"warn_use",
"(",
"func",
":",
"CALLABLE_T",
",",
"what",
":",
"str",
")",
"->",
"CALLABLE_T",
":",
"if",
"asyncio",
".",
"iscoroutinefunction",
"(",
"func",
")",
":",
"@",
"functools",
".",
"wraps",
"(",
"func",
")",
"async",
"def",
"report_use",
... | [
94,
0
] | [
108,
39
] | python | en | ['en', 'en', 'en'] | True |
ExpressionClient.get_biomaterials | (self, provider_id="", biomaterial_id="", organism_id="", biomaterial_name="", analysis_id="") |
List biomaterials in the database
:type organism_id: int
:param organism_id: Limit query to the selected organism
:type biomaterial_id: int
:param biomaterial_id: Limit query to the selected biomaterial id
:type provider_id: int
:param provider_id: Limit query... |
List biomaterials in the database | def get_biomaterials(self, provider_id="", biomaterial_id="", organism_id="", biomaterial_name="", analysis_id=""):
"""
List biomaterials in the database
:type organism_id: int
:param organism_id: Limit query to the selected organism
:type biomaterial_id: int
:param bio... | [
"def",
"get_biomaterials",
"(",
"self",
",",
"provider_id",
"=",
"\"\"",
",",
"biomaterial_id",
"=",
"\"\"",
",",
"organism_id",
"=",
"\"\"",
",",
"biomaterial_name",
"=",
"\"\"",
",",
"analysis_id",
"=",
"\"\"",
")",
":",
"if",
"analysis_id",
":",
"res",
... | [
26,
4
] | [
78,
19
] | python | en | ['en', 'error', 'th'] | False |
ExpressionClient.add_biomaterial | (self, biomaterial_name, organism_id,
description="", biomaterial_provider="", biosample_accession="", sra_accession="",
bioproject_accession="", attributes={}) |
Add a new biomaterial to the database
:type biomaterial_name: str
:param biomaterial_name: Biomaterial name
:type organism_id: int
:param organism_id: The id of the associated organism
:type description: str
:param description: Description of the biomaterial
... |
Add a new biomaterial to the database | def add_biomaterial(self, biomaterial_name, organism_id,
description="", biomaterial_provider="", biosample_accession="", sra_accession="",
bioproject_accession="", attributes={}):
"""
Add a new biomaterial to the database
:type biomaterial_name: ... | [
"def",
"add_biomaterial",
"(",
"self",
",",
"biomaterial_name",
",",
"organism_id",
",",
"description",
"=",
"\"\"",
",",
"biomaterial_provider",
"=",
"\"\"",
",",
"biosample_accession",
"=",
"\"\"",
",",
"sra_accession",
"=",
"\"\"",
",",
"bioproject_accession",
... | [
80,
4
] | [
153,
70
] | python | en | ['en', 'error', 'th'] | False |
ExpressionClient.add_expression | (self, organism_id, analysis_id, file_path, separator="\t", unit=None, query_type="mRNA", match_on_name=False, re_name=None, skip_missing=False) |
Add an expression matrix file to the database
:type organism_id: int
:param organism_id: The id of the associated organism
:type analysis_id: int
:param analysis_id: The id of the associated analysis
:type file_path: str
:param file_path: File path
:t... |
Add an expression matrix file to the database | def add_expression(self, organism_id, analysis_id, file_path, separator="\t", unit=None, query_type="mRNA", match_on_name=False, re_name=None, skip_missing=False):
"""
Add an expression matrix file to the database
:type organism_id: int
:param organism_id: The id of the associated organ... | [
"def",
"add_expression",
"(",
"self",
",",
"organism_id",
",",
"analysis_id",
",",
"file_path",
",",
"separator",
"=",
"\"\\t\"",
",",
"unit",
"=",
"None",
",",
"query_type",
"=",
"\"mRNA\"",
",",
"match_on_name",
"=",
"False",
",",
"re_name",
"=",
"None",
... | [
155,
4
] | [
216,
49
] | python | en | ['en', 'error', 'th'] | False |
ExpressionClient.delete_biomaterials | (self, names=None, ids=None, organism_id="", analysis_id="") |
Will delete biomaterials based on selector. Only one selector will be used.
:type names: str
:param names: JSON list of biomaterial names to delete.
:type ids: str
:param ids: JSON list of biomaterial ids to delete.
:type organism_id: int
:param organism_id: D... |
Will delete biomaterials based on selector. Only one selector will be used. | def delete_biomaterials(self, names=None, ids=None, organism_id="", analysis_id=""):
"""
Will delete biomaterials based on selector. Only one selector will be used.
:type names: str
:param names: JSON list of biomaterial names to delete.
:type ids: str
:param ids: JSON ... | [
"def",
"delete_biomaterials",
"(",
"self",
",",
"names",
"=",
"None",
",",
"ids",
"=",
"None",
",",
"organism_id",
"=",
"\"\"",
",",
"analysis_id",
"=",
"\"\"",
")",
":",
"if",
"not",
"(",
"names",
"or",
"ids",
"or",
"organism_id",
"or",
"analysis_id",
... | [
218,
4
] | [
280,
49
] | python | en | ['en', 'error', 'th'] | False |
ExpressionClient.delete_all_biomaterials | (self, confirm=False) |
Delete all biomaterials
:type confirm: bool
:param confirm: Confirm that you really do want to delete ALL of the biomaterials.
:rtype: None
:return: None
|
Delete all biomaterials | def delete_all_biomaterials(self, confirm=False):
"""
Delete all biomaterials
:type confirm: bool
:param confirm: Confirm that you really do want to delete ALL of the biomaterials.
:rtype: None
:return: None
"""
if confirm:
res = self.sessio... | [
"def",
"delete_all_biomaterials",
"(",
"self",
",",
"confirm",
"=",
"False",
")",
":",
"if",
"confirm",
":",
"res",
"=",
"self",
".",
"session",
".",
"query",
"(",
"self",
".",
"model",
".",
"biomaterial",
")",
".",
"delete",
"(",
"synchronize_session",
... | [
282,
4
] | [
298,
64
] | python | en | ['en', 'error', 'th'] | False |
ExpressionClient._setup | () |
if not hasattr(self.model, 'biomaterial'):
biomaterial_table = Table(
'biomaterial', self.metadata,
Column(biomaterial_id, Integer, primary_key=True),
Column(),
Column(),
Column(),
Column(),
... |
if not hasattr(self.model, 'biomaterial'):
biomaterial_table = Table(
'biomaterial', self.metadata,
Column(biomaterial_id, Integer, primary_key=True),
Column(),
Column(),
Column(),
Column(),
... | def _setup():
"""
if not hasattr(self.model, 'biomaterial'):
biomaterial_table = Table(
'biomaterial', self.metadata,
Column(biomaterial_id, Integer, primary_key=True),
Column(),
Column(),
Column(),
... | [
"def",
"_setup",
"(",
")",
":",
"return",
"None"
] | [
695,
4
] | [
708,
19
] | python | en | ['en', 'error', 'th'] | False |
async_setup_entry | (
hass: HomeAssistant,
entry: ConfigEntry,
async_add_entities: AddEntitiesCallback,
) | Set up the ISY994 sensor platform. | Set up the ISY994 sensor platform. | async def async_setup_entry(
hass: HomeAssistant,
entry: ConfigEntry,
async_add_entities: AddEntitiesCallback,
) -> bool:
"""Set up the ISY994 sensor platform."""
hass_isy_data = hass.data[ISY994_DOMAIN][entry.entry_id]
devices = []
for node in hass_isy_data[ISY994_NODES][SENSOR]:
_... | [
"async",
"def",
"async_setup_entry",
"(",
"hass",
":",
"HomeAssistant",
",",
"entry",
":",
"ConfigEntry",
",",
"async_add_entities",
":",
"AddEntitiesCallback",
",",
")",
"->",
"bool",
":",
"hass_isy_data",
"=",
"hass",
".",
"data",
"[",
"ISY994_DOMAIN",
"]",
... | [
26,
0
] | [
43,
31
] | python | en | ['en', 'ru', 'en'] | True |
ISYSensorEntity.raw_unit_of_measurement | (self) | Get the raw unit of measurement for the ISY994 sensor device. | Get the raw unit of measurement for the ISY994 sensor device. | def raw_unit_of_measurement(self) -> dict | str:
"""Get the raw unit of measurement for the ISY994 sensor device."""
uom = self._node.uom
# Backwards compatibility for ISYv4 Firmware:
if isinstance(uom, list):
return UOM_FRIENDLY_NAME.get(uom[0], uom[0])
# Special c... | [
"def",
"raw_unit_of_measurement",
"(",
"self",
")",
"->",
"dict",
"|",
"str",
":",
"uom",
"=",
"self",
".",
"_node",
".",
"uom",
"# Backwards compatibility for ISYv4 Firmware:",
"if",
"isinstance",
"(",
"uom",
",",
"list",
")",
":",
"return",
"UOM_FRIENDLY_NAME"... | [
50,
4
] | [
66,
41
] | python | en | ['en', 'en', 'en'] | True |
ISYSensorEntity.native_value | (self) | Get the state of the ISY994 sensor device. | Get the state of the ISY994 sensor device. | def native_value(self) -> str:
"""Get the state of the ISY994 sensor device."""
value = self._node.status
if value == ISY_VALUE_UNKNOWN:
return None
# Get the translated ISY Unit of Measurement
uom = self.raw_unit_of_measurement
# Check if this is a known in... | [
"def",
"native_value",
"(",
"self",
")",
"->",
"str",
":",
"value",
"=",
"self",
".",
"_node",
".",
"status",
"if",
"value",
"==",
"ISY_VALUE_UNKNOWN",
":",
"return",
"None",
"# Get the translated ISY Unit of Measurement",
"uom",
"=",
"self",
".",
"raw_unit_of_m... | [
69,
4
] | [
96,
20
] | python | en | ['en', 'en', 'en'] | True |
ISYSensorEntity.native_unit_of_measurement | (self) | Get the Home Assistant unit of measurement for the device. | Get the Home Assistant unit of measurement for the device. | def native_unit_of_measurement(self) -> str:
"""Get the Home Assistant unit of measurement for the device."""
raw_units = self.raw_unit_of_measurement
# Check if this is a known index pair UOM
if isinstance(raw_units, dict) or raw_units in (UOM_ON_OFF, UOM_INDEX):
return None... | [
"def",
"native_unit_of_measurement",
"(",
"self",
")",
"->",
"str",
":",
"raw_units",
"=",
"self",
".",
"raw_unit_of_measurement",
"# Check if this is a known index pair UOM",
"if",
"isinstance",
"(",
"raw_units",
",",
"dict",
")",
"or",
"raw_units",
"in",
"(",
"UOM... | [
99,
4
] | [
107,
24
] | python | en | ['en', 'en', 'en'] | True |
ISYSensorVariableEntity.__init__ | (self, vname: str, vobj: object) | Initialize the ISY994 binary sensor program. | Initialize the ISY994 binary sensor program. | def __init__(self, vname: str, vobj: object) -> None:
"""Initialize the ISY994 binary sensor program."""
super().__init__(vobj)
self._name = vname | [
"def",
"__init__",
"(",
"self",
",",
"vname",
":",
"str",
",",
"vobj",
":",
"object",
")",
"->",
"None",
":",
"super",
"(",
")",
".",
"__init__",
"(",
"vobj",
")",
"self",
".",
"_name",
"=",
"vname"
] | [
113,
4
] | [
116,
26
] | python | en | ['en', 'pl', 'en'] | True |
ISYSensorVariableEntity.native_value | (self) | Return the state of the variable. | Return the state of the variable. | def native_value(self):
"""Return the state of the variable."""
return convert_isy_value_to_hass(self._node.status, "", self._node.prec) | [
"def",
"native_value",
"(",
"self",
")",
":",
"return",
"convert_isy_value_to_hass",
"(",
"self",
".",
"_node",
".",
"status",
",",
"\"\"",
",",
"self",
".",
"_node",
".",
"prec",
")"
] | [
119,
4
] | [
121,
80
] | python | en | ['en', 'en', 'en'] | True |
ISYSensorVariableEntity.extra_state_attributes | (self) | Get the state attributes for the device. | Get the state attributes for the device. | def extra_state_attributes(self) -> dict:
"""Get the state attributes for the device."""
return {
"init_value": convert_isy_value_to_hass(
self._node.init, "", self._node.prec
),
"last_edited": self._node.last_edited,
} | [
"def",
"extra_state_attributes",
"(",
"self",
")",
"->",
"dict",
":",
"return",
"{",
"\"init_value\"",
":",
"convert_isy_value_to_hass",
"(",
"self",
".",
"_node",
".",
"init",
",",
"\"\"",
",",
"self",
".",
"_node",
".",
"prec",
")",
",",
"\"last_edited\"",... | [
124,
4
] | [
131,
9
] | python | en | ['en', 'en', 'en'] | True |
ISYSensorVariableEntity.icon | (self) | Return the icon. | Return the icon. | def icon(self):
"""Return the icon."""
return "mdi:counter" | [
"def",
"icon",
"(",
"self",
")",
":",
"return",
"\"mdi:counter\""
] | [
134,
4
] | [
136,
28
] | python | en | ['en', 'sr', 'en'] | True |
ConfigEntrySmappeeApi.__init__ | (
self,
hass: core.HomeAssistant,
config_entry: config_entries.ConfigEntry,
implementation: config_entry_oauth2_flow.AbstractOAuth2Implementation,
) | Initialize Smappee Auth. | Initialize Smappee Auth. | def __init__(
self,
hass: core.HomeAssistant,
config_entry: config_entries.ConfigEntry,
implementation: config_entry_oauth2_flow.AbstractOAuth2Implementation,
) -> None:
"""Initialize Smappee Auth."""
self.hass = hass
self.config_entry = config_entry
s... | [
"def",
"__init__",
"(",
"self",
",",
"hass",
":",
"core",
".",
"HomeAssistant",
",",
"config_entry",
":",
"config_entries",
".",
"ConfigEntry",
",",
"implementation",
":",
"config_entry_oauth2_flow",
".",
"AbstractOAuth2Implementation",
",",
")",
"->",
"None",
":"... | [
15,
4
] | [
38,
9
] | python | en | ['en', 'en', 'it'] | True |
ConfigEntrySmappeeApi.refresh_tokens | (self) | Refresh and return new Smappee tokens using Home Assistant OAuth2 session. | Refresh and return new Smappee tokens using Home Assistant OAuth2 session. | def refresh_tokens(self) -> dict:
"""Refresh and return new Smappee tokens using Home Assistant OAuth2 session."""
run_coroutine_threadsafe(
self.session.async_ensure_token_valid(), self.hass.loop
).result()
return self.session.token | [
"def",
"refresh_tokens",
"(",
"self",
")",
"->",
"dict",
":",
"run_coroutine_threadsafe",
"(",
"self",
".",
"session",
".",
"async_ensure_token_valid",
"(",
")",
",",
"self",
".",
"hass",
".",
"loop",
")",
".",
"result",
"(",
")",
"return",
"self",
".",
... | [
40,
4
] | [
46,
33
] | python | en | ['en', 'en', 'en'] | True |
async_register | (
hass: HomeAssistant, register: system_health.SystemHealthRegistration
) | Register system health callbacks. | Register system health callbacks. | def async_register(
hass: HomeAssistant, register: system_health.SystemHealthRegistration
) -> None:
"""Register system health callbacks."""
register.async_register_info(system_health_info) | [
"def",
"async_register",
"(",
"hass",
":",
"HomeAssistant",
",",
"register",
":",
"system_health",
".",
"SystemHealthRegistration",
")",
"->",
"None",
":",
"register",
".",
"async_register_info",
"(",
"system_health_info",
")"
] | [
7,
0
] | [
11,
52
] | python | en | ['en', 'sv', 'en'] | True |
system_health_info | (hass) | Get info for the info page. | Get info for the info page. | async def system_health_info(hass):
"""Get info for the info page."""
info = await system_info.async_get_system_info(hass)
return {
"version": f"core-{info.get('version')}",
"installation_type": info.get("installation_type"),
"dev": info.get("dev"),
"hassio": info.get("hassi... | [
"async",
"def",
"system_health_info",
"(",
"hass",
")",
":",
"info",
"=",
"await",
"system_info",
".",
"async_get_system_info",
"(",
"hass",
")",
"return",
"{",
"\"version\"",
":",
"f\"core-{info.get('version')}\"",
",",
"\"installation_type\"",
":",
"info",
".",
... | [
14,
0
] | [
31,
5
] | python | en | ['en', 'en', 'en'] | True |
find_box | (
mp4_bytes: bytes, target_type: bytes, box_start: int = 0
) | Find location of first box (or sub_box if box_start provided) of given type. | Find location of first box (or sub_box if box_start provided) of given type. | def find_box(
mp4_bytes: bytes, target_type: bytes, box_start: int = 0
) -> Generator[int, None, None]:
"""Find location of first box (or sub_box if box_start provided) of given type."""
if box_start == 0:
index = 0
box_end = len(mp4_bytes)
else:
box_end = box_start + int.from_by... | [
"def",
"find_box",
"(",
"mp4_bytes",
":",
"bytes",
",",
"target_type",
":",
"bytes",
",",
"box_start",
":",
"int",
"=",
"0",
")",
"->",
"Generator",
"[",
"int",
",",
"None",
",",
"None",
"]",
":",
"if",
"box_start",
"==",
"0",
":",
"index",
"=",
"0... | [
6,
0
] | [
24,
65
] | python | en | ['en', 'en', 'en'] | True |
get_codec_string | (mp4_bytes: bytes) | Get RFC 6381 codec string. | Get RFC 6381 codec string. | def get_codec_string(mp4_bytes: bytes) -> str:
"""Get RFC 6381 codec string."""
codecs = []
# Find moov
moov_location = next(find_box(mp4_bytes, b"moov"))
# Find tracks
for trak_location in find_box(mp4_bytes, b"trak", moov_location):
# Drill down to media info
mdia_location = ... | [
"def",
"get_codec_string",
"(",
"mp4_bytes",
":",
"bytes",
")",
"->",
"str",
":",
"codecs",
"=",
"[",
"]",
"# Find moov",
"moov_location",
"=",
"next",
"(",
"find_box",
"(",
"mp4_bytes",
",",
"b\"moov\"",
")",
")",
"# Find tracks",
"for",
"trak_location",
"i... | [
27,
0
] | [
136,
27
] | python | cy | ['fr', 'cy', 'en'] | False |
configured_sensors | (hass) | Return a set of configured Luftdaten sensors. | Return a set of configured Luftdaten sensors. | def configured_sensors(hass):
"""Return a set of configured Luftdaten sensors."""
return {
entry.data[CONF_SENSOR_ID]
for entry in hass.config_entries.async_entries(DOMAIN)
} | [
"def",
"configured_sensors",
"(",
"hass",
")",
":",
"return",
"{",
"entry",
".",
"data",
"[",
"CONF_SENSOR_ID",
"]",
"for",
"entry",
"in",
"hass",
".",
"config_entries",
".",
"async_entries",
"(",
"DOMAIN",
")",
"}"
] | [
22,
0
] | [
27,
5
] | python | en | ['en', 'da', 'en'] | True |
duplicate_stations | (hass) | Return a set of duplicate configured Luftdaten stations. | Return a set of duplicate configured Luftdaten stations. | def duplicate_stations(hass):
"""Return a set of duplicate configured Luftdaten stations."""
stations = [
int(entry.data[CONF_SENSOR_ID])
for entry in hass.config_entries.async_entries(DOMAIN)
]
return {x for x in stations if stations.count(x) > 1} | [
"def",
"duplicate_stations",
"(",
"hass",
")",
":",
"stations",
"=",
"[",
"int",
"(",
"entry",
".",
"data",
"[",
"CONF_SENSOR_ID",
"]",
")",
"for",
"entry",
"in",
"hass",
".",
"config_entries",
".",
"async_entries",
"(",
"DOMAIN",
")",
"]",
"return",
"{"... | [
31,
0
] | [
37,
57
] | python | en | ['en', 'da', 'en'] | True |
LuftDatenFlowHandler._show_form | (self, errors=None) | Show the form to the user. | Show the form to the user. | def _show_form(self, errors=None):
"""Show the form to the user."""
data_schema = OrderedDict()
data_schema[vol.Required(CONF_SENSOR_ID)] = cv.positive_int
data_schema[vol.Optional(CONF_SHOW_ON_MAP, default=False)] = bool
return self.async_show_form(
step_id="user", ... | [
"def",
"_show_form",
"(",
"self",
",",
"errors",
"=",
"None",
")",
":",
"data_schema",
"=",
"OrderedDict",
"(",
")",
"data_schema",
"[",
"vol",
".",
"Required",
"(",
"CONF_SENSOR_ID",
")",
"]",
"=",
"cv",
".",
"positive_int",
"data_schema",
"[",
"vol",
"... | [
46,
4
] | [
54,
9
] | python | en | ['en', 'en', 'en'] | True |
LuftDatenFlowHandler.async_step_import | (self, import_config) | Import a config entry from configuration.yaml. | Import a config entry from configuration.yaml. | async def async_step_import(self, import_config):
"""Import a config entry from configuration.yaml."""
return await self.async_step_user(import_config) | [
"async",
"def",
"async_step_import",
"(",
"self",
",",
"import_config",
")",
":",
"return",
"await",
"self",
".",
"async_step_user",
"(",
"import_config",
")"
] | [
56,
4
] | [
58,
56
] | python | en | ['en', 'en', 'en'] | True |
LuftDatenFlowHandler.async_step_user | (self, user_input=None) | Handle the start of the config flow. | Handle the start of the config flow. | async def async_step_user(self, user_input=None):
"""Handle the start of the config flow."""
if not user_input:
return self._show_form()
sensor_id = user_input[CONF_SENSOR_ID]
if sensor_id in configured_sensors(self.hass):
return self._show_form({CONF_SENSOR_ID... | [
"async",
"def",
"async_step_user",
"(",
"self",
",",
"user_input",
"=",
"None",
")",
":",
"if",
"not",
"user_input",
":",
"return",
"self",
".",
"_show_form",
"(",
")",
"sensor_id",
"=",
"user_input",
"[",
"CONF_SENSOR_ID",
"]",
"if",
"sensor_id",
"in",
"c... | [
60,
4
] | [
94,
77
] | python | en | ['en', 'en', 'en'] | True |
test_sensors | (hass, config_entry, aioclient_mock_fixture) | Test Flo by Moen sensors. | Test Flo by Moen sensors. | async def test_sensors(hass, config_entry, aioclient_mock_fixture):
"""Test Flo by Moen sensors."""
config_entry.add_to_hass(hass)
assert await async_setup_component(
hass, FLO_DOMAIN, {CONF_USERNAME: TEST_USER_ID, CONF_PASSWORD: TEST_PASSWORD}
)
await hass.async_block_till_done()
asser... | [
"async",
"def",
"test_sensors",
"(",
"hass",
",",
"config_entry",
",",
"aioclient_mock_fixture",
")",
":",
"config_entry",
".",
"add_to_hass",
"(",
"hass",
")",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"FLO_DOMAIN",
",",
"{",
"CONF_USERNAME",
... | [
8,
0
] | [
28,
59
] | python | en | ['en', 'no', 'en'] | True |
test_manual_update_entity | (
hass, config_entry, aioclient_mock_fixture, aioclient_mock
) | Test manual update entity via service homeasasistant/update_entity. | Test manual update entity via service homeasasistant/update_entity. | async def test_manual_update_entity(
hass, config_entry, aioclient_mock_fixture, aioclient_mock
):
"""Test manual update entity via service homeasasistant/update_entity."""
config_entry.add_to_hass(hass)
assert await async_setup_component(
hass, FLO_DOMAIN, {CONF_USERNAME: TEST_USER_ID, CONF_PAS... | [
"async",
"def",
"test_manual_update_entity",
"(",
"hass",
",",
"config_entry",
",",
"aioclient_mock_fixture",
",",
"aioclient_mock",
")",
":",
"config_entry",
".",
"add_to_hass",
"(",
"hass",
")",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"FLO_DO... | [
31,
0
] | [
52,
54
] | python | en | ['en', 'en', 'en'] | True |
version_validator | (value) | Validate a Home Assistant version. | Validate a Home Assistant version. | def version_validator(value):
"""Validate a Home Assistant version."""
if not isinstance(value, str):
raise vol.Invalid("Version needs to be a string")
parts = value.split(".")
if len(parts) != 3:
raise vol.Invalid("Version needs to be formatted as {major}.{minor}.{patch}")
try:
... | [
"def",
"version_validator",
"(",
"value",
")",
":",
"if",
"not",
"isinstance",
"(",
"value",
",",
"str",
")",
":",
"raise",
"vol",
".",
"Invalid",
"(",
"\"Version needs to be a string\"",
")",
"parts",
"=",
"value",
".",
"split",
"(",
"\".\"",
")",
"if",
... | [
26,
0
] | [
43,
16
] | python | en | ['en', 'en', 'en'] | True |
is_blueprint_config | (config: Any) | Return if it is a blueprint config. | Return if it is a blueprint config. | def is_blueprint_config(config: Any) -> bool:
"""Return if it is a blueprint config."""
return isinstance(config, dict) and CONF_BLUEPRINT in config | [
"def",
"is_blueprint_config",
"(",
"config",
":",
"Any",
")",
"->",
"bool",
":",
"return",
"isinstance",
"(",
"config",
",",
"dict",
")",
"and",
"CONF_BLUEPRINT",
"in",
"config"
] | [
47,
0
] | [
49,
64
] | python | en | ['en', 'en', 'en'] | True |
is_blueprint_instance_config | (config: Any) | Return if it is a blueprint instance config. | Return if it is a blueprint instance config. | def is_blueprint_instance_config(config: Any) -> bool:
"""Return if it is a blueprint instance config."""
return isinstance(config, dict) and CONF_USE_BLUEPRINT in config | [
"def",
"is_blueprint_instance_config",
"(",
"config",
":",
"Any",
")",
"->",
"bool",
":",
"return",
"isinstance",
"(",
"config",
",",
"dict",
")",
"and",
"CONF_USE_BLUEPRINT",
"in",
"config"
] | [
53,
0
] | [
55,
68
] | python | en | ['en', 'en', 'en'] | True |
validate_yaml_suffix | (value: str) | Validate value has a YAML suffix. | Validate value has a YAML suffix. | def validate_yaml_suffix(value: str) -> str:
"""Validate value has a YAML suffix."""
if not value.endswith(".yaml"):
raise vol.Invalid("Path needs to end in .yaml")
return value | [
"def",
"validate_yaml_suffix",
"(",
"value",
":",
"str",
")",
"->",
"str",
":",
"if",
"not",
"value",
".",
"endswith",
"(",
"\".yaml\"",
")",
":",
"raise",
"vol",
".",
"Invalid",
"(",
"\"Path needs to end in .yaml\"",
")",
"return",
"value"
] | [
91,
0
] | [
95,
16
] | python | en | ['en', 'en', 'en'] | True |
async_validate_condition_config | (
hass: HomeAssistant, config: ConfigType
) | Validate config. | Validate config. | async def async_validate_condition_config(
hass: HomeAssistant, config: ConfigType
) -> ConfigType:
"""Validate config."""
config = CONDITION_SCHEMA(config)
# We return early if the config entry for this device is not ready because we can't
# validate the value without knowing the state of the devi... | [
"async",
"def",
"async_validate_condition_config",
"(",
"hass",
":",
"HomeAssistant",
",",
"config",
":",
"ConfigType",
")",
"->",
"ConfigType",
":",
"config",
"=",
"CONDITION_SCHEMA",
"(",
"config",
")",
"# We return early if the config entry for this device is not ready b... | [
97,
0
] | [
115,
17
] | python | en | ['en', 'la', 'it'] | False |
async_get_conditions | (
hass: HomeAssistant, device_id: str
) | List device conditions for Z-Wave JS devices. | List device conditions for Z-Wave JS devices. | async def async_get_conditions(
hass: HomeAssistant, device_id: str
) -> list[dict[str, str]]:
"""List device conditions for Z-Wave JS devices."""
conditions = []
base_condition = {
CONF_CONDITION: "device",
CONF_DEVICE_ID: device_id,
CONF_DOMAIN: DOMAIN,
}
node = async_g... | [
"async",
"def",
"async_get_conditions",
"(",
"hass",
":",
"HomeAssistant",
",",
"device_id",
":",
"str",
")",
"->",
"list",
"[",
"dict",
"[",
"str",
",",
"str",
"]",
"]",
":",
"conditions",
"=",
"[",
"]",
"base_condition",
"=",
"{",
"CONF_CONDITION",
":"... | [
118,
0
] | [
149,
21
] | python | en | ['en', 'en', 'en'] | True |
async_condition_from_config | (
config: ConfigType, config_validation: bool
) | Create a function to test a device condition. | Create a function to test a device condition. | def async_condition_from_config(
config: ConfigType, config_validation: bool
) -> condition.ConditionCheckerType:
"""Create a function to test a device condition."""
if config_validation:
config = CONDITION_SCHEMA(config)
condition_type = config[CONF_TYPE]
device_id = config[CONF_DEVICE_ID]... | [
"def",
"async_condition_from_config",
"(",
"config",
":",
"ConfigType",
",",
"config_validation",
":",
"bool",
")",
"->",
"condition",
".",
"ConditionCheckerType",
":",
"if",
"config_validation",
":",
"config",
"=",
"CONDITION_SCHEMA",
"(",
"config",
")",
"condition... | [
153,
0
] | [
192,
74
] | python | en | ['en', 'en', 'en'] | True |
async_get_condition_capabilities | (
hass: HomeAssistant, config: ConfigType
) | List condition capabilities. | List condition capabilities. | async def async_get_condition_capabilities(
hass: HomeAssistant, config: ConfigType
) -> dict[str, vol.Schema]:
"""List condition capabilities."""
device_id = config[CONF_DEVICE_ID]
node = async_get_node_from_device_id(hass, device_id)
# Add additional fields to the automation trigger UI
if con... | [
"async",
"def",
"async_get_condition_capabilities",
"(",
"hass",
":",
"HomeAssistant",
",",
"config",
":",
"ConfigType",
")",
"->",
"dict",
"[",
"str",
",",
"vol",
".",
"Schema",
"]",
":",
"device_id",
"=",
"config",
"[",
"CONF_DEVICE_ID",
"]",
"node",
"=",
... | [
196,
0
] | [
240,
13
] | python | en | ['ro', 'sr', 'en'] | False |
test_scan_match_st | (hass, caplog, mock_get_source_ip) | Test matching based on ST. | Test matching based on ST. | async def test_scan_match_st(hass, caplog, mock_get_source_ip):
"""Test matching based on ST."""
mock_ssdp_response = {
"st": "mock-st",
"location": None,
"usn": "mock-usn",
"server": "mock-server",
"ext": "",
}
mock_get_ssdp = {"mock-domain": [{"st": "mock-st"}]}... | [
"async",
"def",
"test_scan_match_st",
"(",
"hass",
",",
"caplog",
",",
"mock_get_source_ip",
")",
":",
"mock_ssdp_response",
"=",
"{",
"\"st\"",
":",
"\"mock-st\"",
",",
"\"location\"",
":",
"None",
",",
"\"usn\"",
":",
"\"mock-usn\"",
",",
"\"server\"",
":",
... | [
66,
0
] | [
90,
57
] | python | en | ['en', 'en', 'en'] | True |
test_partial_response | (hass, caplog, mock_get_source_ip) | Test location and st missing. | Test location and st missing. | async def test_partial_response(hass, caplog, mock_get_source_ip):
"""Test location and st missing."""
mock_ssdp_response = {
"usn": "mock-usn",
"server": "mock-server",
"ext": "",
}
mock_get_ssdp = {"mock-domain": [{"st": "mock-st"}]}
mock_init = await _async_run_mocked_scan... | [
"async",
"def",
"test_partial_response",
"(",
"hass",
",",
"caplog",
",",
"mock_get_source_ip",
")",
":",
"mock_ssdp_response",
"=",
"{",
"\"usn\"",
":",
"\"mock-usn\"",
",",
"\"server\"",
":",
"\"mock-server\"",
",",
"\"ext\"",
":",
"\"\"",
",",
"}",
"mock_get_... | [
93,
0
] | [
103,
41
] | python | en | ['en', 'en', 'en'] | True |
test_scan_match_upnp_devicedesc | (
hass, aioclient_mock, key, mock_get_source_ip
) | Test matching based on UPnP device description data. | Test matching based on UPnP device description data. | async def test_scan_match_upnp_devicedesc(
hass, aioclient_mock, key, mock_get_source_ip
):
"""Test matching based on UPnP device description data."""
aioclient_mock.get(
"http://1.1.1.1",
text=f"""
<root>
<device>
<{key}>Paulus</{key}>
</device>
</root>
""",
)
mock_get_s... | [
"async",
"def",
"test_scan_match_upnp_devicedesc",
"(",
"hass",
",",
"aioclient_mock",
",",
"key",
",",
"mock_get_source_ip",
")",
":",
"aioclient_mock",
".",
"get",
"(",
"\"http://1.1.1.1\"",
",",
"text",
"=",
"f\"\"\"\n<root>\n <device>\n <{key}>Paulus</{key}>\n </de... | [
109,
0
] | [
135,
5
] | python | en | ['en', 'en', 'en'] | True |
test_scan_not_all_present | (hass, aioclient_mock, mock_get_source_ip) | Test match fails if some specified attributes are not present. | Test match fails if some specified attributes are not present. | async def test_scan_not_all_present(hass, aioclient_mock, mock_get_source_ip):
"""Test match fails if some specified attributes are not present."""
aioclient_mock.get(
"http://1.1.1.1",
text="""
<root>
<device>
<deviceType>Paulus</deviceType>
</device>
</root>
""",
)
mock_ssd... | [
"async",
"def",
"test_scan_not_all_present",
"(",
"hass",
",",
"aioclient_mock",
",",
"mock_get_source_ip",
")",
":",
"aioclient_mock",
".",
"get",
"(",
"\"http://1.1.1.1\"",
",",
"text",
"=",
"\"\"\"\n<root>\n <device>\n <deviceType>Paulus</deviceType>\n </device>\n</root... | [
138,
0
] | [
164,
35
] | python | en | ['en', 'en', 'en'] | True |
test_scan_not_all_match | (hass, aioclient_mock, mock_get_source_ip) | Test match fails if some specified attribute values differ. | Test match fails if some specified attribute values differ. | async def test_scan_not_all_match(hass, aioclient_mock, mock_get_source_ip):
"""Test match fails if some specified attribute values differ."""
aioclient_mock.get(
"http://1.1.1.1",
text="""
<root>
<device>
<deviceType>Paulus</deviceType>
<manufacturer>Paulus</manufacturer>
</device>
... | [
"async",
"def",
"test_scan_not_all_match",
"(",
"hass",
",",
"aioclient_mock",
",",
"mock_get_source_ip",
")",
":",
"aioclient_mock",
".",
"get",
"(",
"\"http://1.1.1.1\"",
",",
"text",
"=",
"\"\"\"\n<root>\n <device>\n <deviceType>Paulus</deviceType>\n <manufacturer>Pau... | [
167,
0
] | [
194,
35
] | python | en | ['en', 'en', 'en'] | True |
test_scan_description_fetch_fail | (
hass, aioclient_mock, exc, mock_get_source_ip
) | Test failing to fetch description. | Test failing to fetch description. | async def test_scan_description_fetch_fail(
hass, aioclient_mock, exc, mock_get_source_ip
):
"""Test failing to fetch description."""
aioclient_mock.get("http://1.1.1.1", exc=exc)
mock_ssdp_response = {
"st": "mock-st",
"usn": "uuid:TIVRTLSR7ANF-D6E-1557809135086-RETAIL::urn:mdx-netflix-... | [
"async",
"def",
"test_scan_description_fetch_fail",
"(",
"hass",
",",
"aioclient_mock",
",",
"exc",
",",
"mock_get_source_ip",
")",
":",
"aioclient_mock",
".",
"get",
"(",
"\"http://1.1.1.1\"",
",",
"exc",
"=",
"exc",
")",
"mock_ssdp_response",
"=",
"{",
"\"st\"",... | [
198,
0
] | [
227,
5
] | python | en | ['en', 'fr', 'en'] | True |
test_scan_description_parse_fail | (hass, aioclient_mock, mock_get_source_ip) | Test invalid XML. | Test invalid XML. | async def test_scan_description_parse_fail(hass, aioclient_mock, mock_get_source_ip):
"""Test invalid XML."""
aioclient_mock.get(
"http://1.1.1.1",
text="""
<root>INVALIDXML
""",
)
mock_ssdp_response = {
"st": "mock-st",
"location": "http://1.1.1.1",
}
mock_g... | [
"async",
"def",
"test_scan_description_parse_fail",
"(",
"hass",
",",
"aioclient_mock",
",",
"mock_get_source_ip",
")",
":",
"aioclient_mock",
".",
"get",
"(",
"\"http://1.1.1.1\"",
",",
"text",
"=",
"\"\"\"\n<root>INVALIDXML\n \"\"\"",
",",
")",
"mock_ssdp_response",
... | [
230,
0
] | [
253,
35
] | python | en | ['en', 'et', 'en'] | True |
test_invalid_characters | (hass, aioclient_mock, mock_get_source_ip) | Test that we replace bad characters with placeholders. | Test that we replace bad characters with placeholders. | async def test_invalid_characters(hass, aioclient_mock, mock_get_source_ip):
"""Test that we replace bad characters with placeholders."""
aioclient_mock.get(
"http://1.1.1.1",
text="""
<root>
<device>
<deviceType>ABC</deviceType>
<serialNumber>\xff\xff\xff\xff</serialNumber>
</device... | [
"async",
"def",
"test_invalid_characters",
"(",
"hass",
",",
"aioclient_mock",
",",
"mock_get_source_ip",
")",
":",
"aioclient_mock",
".",
"get",
"(",
"\"http://1.1.1.1\"",
",",
"text",
"=",
"\"\"\"\n<root>\n <device>\n <deviceType>ABC</deviceType>\n <serialNumber>\\xff\... | [
256,
0
] | [
294,
5
] | python | en | ['en', 'en', 'en'] | True |
test_start_stop_scanner | (
async_stop_mock, async_search_mock, async_start_mock, hass, mock_get_source_ip
) | Test we start and stop the scanner. | Test we start and stop the scanner. | async def test_start_stop_scanner(
async_stop_mock, async_search_mock, async_start_mock, hass, mock_get_source_ip
):
"""Test we start and stop the scanner."""
assert await async_setup_component(hass, ssdp.DOMAIN, {ssdp.DOMAIN: {}})
hass.bus.async_fire(EVENT_HOMEASSISTANT_STARTED)
await hass.async_b... | [
"async",
"def",
"test_start_stop_scanner",
"(",
"async_stop_mock",
",",
"async_search_mock",
",",
"async_start_mock",
",",
"hass",
",",
"mock_get_source_ip",
")",
":",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"ssdp",
".",
"DOMAIN",
",",
"{",
"... | [
300,
0
] | [
321,
42
] | python | en | ['en', 'en', 'en'] | True |
test_unexpected_exception_while_fetching | (
hass, aioclient_mock, caplog, mock_get_source_ip
) | Test unexpected exception while fetching. | Test unexpected exception while fetching. | async def test_unexpected_exception_while_fetching(
hass, aioclient_mock, caplog, mock_get_source_ip
):
"""Test unexpected exception while fetching."""
aioclient_mock.get(
"http://1.1.1.1",
text="""
<root>
<device>
<deviceType>ABC</deviceType>
<serialNumber>\xff\xff\xff\xff</serial... | [
"async",
"def",
"test_unexpected_exception_while_fetching",
"(",
"hass",
",",
"aioclient_mock",
",",
"caplog",
",",
"mock_get_source_ip",
")",
":",
"aioclient_mock",
".",
"get",
"(",
"\"http://1.1.1.1\"",
",",
"text",
"=",
"\"\"\"\n<root>\n <device>\n <deviceType>ABC</d... | [
324,
0
] | [
360,
74
] | python | en | ['en', 'en', 'en'] | True |
test_scan_with_registered_callback | (
hass, aioclient_mock, caplog, mock_get_source_ip
) | Test matching based on callback. | Test matching based on callback. | async def test_scan_with_registered_callback(
hass, aioclient_mock, caplog, mock_get_source_ip
):
"""Test matching based on callback."""
aioclient_mock.get(
"http://1.1.1.1",
text="""
<root>
<device>
<deviceType>Paulus</deviceType>
</device>
</root>
""",
)
mock_ssdp_respo... | [
"async",
"def",
"test_scan_with_registered_callback",
"(",
"hass",
",",
"aioclient_mock",
",",
"caplog",
",",
"mock_get_source_ip",
")",
":",
"aioclient_mock",
".",
"get",
"(",
"\"http://1.1.1.1\"",
",",
"text",
"=",
"\"\"\"\n<root>\n <device>\n <deviceType>Paulus</devi... | [
363,
0
] | [
497,
51
] | python | en | ['en', 'zu', 'en'] | True |
test_unsolicited_ssdp_registered_callback | (
hass, aioclient_mock, caplog, mock_get_source_ip
) | Test matching based on callback can handle unsolicited ssdp traffic without st. | Test matching based on callback can handle unsolicited ssdp traffic without st. | async def test_unsolicited_ssdp_registered_callback(
hass, aioclient_mock, caplog, mock_get_source_ip
):
"""Test matching based on callback can handle unsolicited ssdp traffic without st."""
aioclient_mock.get(
"http://10.6.9.12:1400/xml/device_description.xml",
text="""
<root>
<device>
... | [
"async",
"def",
"test_unsolicited_ssdp_registered_callback",
"(",
"hass",
",",
"aioclient_mock",
",",
"caplog",
",",
"mock_get_source_ip",
")",
":",
"aioclient_mock",
".",
"get",
"(",
"\"http://10.6.9.12:1400/xml/device_description.xml\"",
",",
"text",
"=",
"\"\"\"\n<root>\... | [
500,
0
] | [
587,
55
] | python | en | ['en', 'en', 'en'] | True |
test_scan_second_hit | (hass, aioclient_mock, caplog, mock_get_source_ip) | Test matching on second scan. | Test matching on second scan. | async def test_scan_second_hit(hass, aioclient_mock, caplog, mock_get_source_ip):
"""Test matching on second scan."""
aioclient_mock.get(
"http://1.1.1.1",
text="""
<root>
<device>
<deviceType>Paulus</deviceType>
</device>
</root>
""",
)
mock_ssdp_response = CaseInsensitiveD... | [
"async",
"def",
"test_scan_second_hit",
"(",
"hass",
",",
"aioclient_mock",
",",
"caplog",
",",
"mock_get_source_ip",
")",
":",
"aioclient_mock",
".",
"get",
"(",
"\"http://1.1.1.1\"",
",",
"text",
"=",
"\"\"\"\n<root>\n <device>\n <deviceType>Paulus</deviceType>\n </d... | [
590,
0
] | [
726,
84
] | python | en | ['en', 'en', 'en'] | True |
test_async_detect_interfaces_setting_empty_route | (hass, mock_get_source_ip) | Test without default interface config and the route returns nothing. | Test without default interface config and the route returns nothing. | async def test_async_detect_interfaces_setting_empty_route(hass, mock_get_source_ip):
"""Test without default interface config and the route returns nothing."""
mock_get_ssdp = {
"mock-domain": [
{
ssdp.ATTR_UPNP_DEVICE_TYPE: "ABC",
}
]
}
create_ar... | [
"async",
"def",
"test_async_detect_interfaces_setting_empty_route",
"(",
"hass",
",",
"mock_get_source_ip",
")",
":",
"mock_get_ssdp",
"=",
"{",
"\"mock-domain\"",
":",
"[",
"{",
"ssdp",
".",
"ATTR_UPNP_DEVICE_TYPE",
":",
"\"ABC\"",
",",
"}",
"]",
"}",
"create_args"... | [
764,
0
] | [
812,
5
] | python | en | ['en', 'en', 'en'] | True |
test_bind_failure_skips_adapter | (hass, caplog, mock_get_source_ip) | Test that an adapter with a bind failure is skipped. | Test that an adapter with a bind failure is skipped. | async def test_bind_failure_skips_adapter(hass, caplog, mock_get_source_ip):
"""Test that an adapter with a bind failure is skipped."""
mock_get_ssdp = {
"mock-domain": [
{
ssdp.ATTR_UPNP_DEVICE_TYPE: "ABC",
}
]
}
create_args = []
search_args =... | [
"async",
"def",
"test_bind_failure_skips_adapter",
"(",
"hass",
",",
"caplog",
",",
"mock_get_source_ip",
")",
":",
"mock_get_ssdp",
"=",
"{",
"\"mock-domain\"",
":",
"[",
"{",
"ssdp",
".",
"ATTR_UPNP_DEVICE_TYPE",
":",
"\"ABC\"",
",",
"}",
"]",
"}",
"create_arg... | [
815,
0
] | [
881,
5
] | python | en | ['en', 'en', 'en'] | True |
test_ipv4_does_additional_search_for_sonos | (hass, caplog, mock_get_source_ip) | Test that only ipv4 does an additional search for Sonos. | Test that only ipv4 does an additional search for Sonos. | async def test_ipv4_does_additional_search_for_sonos(hass, caplog, mock_get_source_ip):
"""Test that only ipv4 does an additional search for Sonos."""
mock_get_ssdp = {
"mock-domain": [
{
ssdp.ATTR_UPNP_DEVICE_TYPE: "ABC",
}
]
}
search_args = []
... | [
"async",
"def",
"test_ipv4_does_additional_search_for_sonos",
"(",
"hass",
",",
"caplog",
",",
"mock_get_source_ip",
")",
":",
"mock_get_ssdp",
"=",
"{",
"\"mock-domain\"",
":",
"[",
"{",
"ssdp",
".",
"ATTR_UPNP_DEVICE_TYPE",
":",
"\"ABC\"",
",",
"}",
"]",
"}",
... | [
884,
0
] | [
937,
5
] | python | en | ['en', 'en', 'en'] | True |
test_location_change_evicts_prior_location_from_cache | (
hass, aioclient_mock, mock_get_source_ip
) | Test that a location change for a UDN will evict the prior location from the cache. | Test that a location change for a UDN will evict the prior location from the cache. | async def test_location_change_evicts_prior_location_from_cache(
hass, aioclient_mock, mock_get_source_ip
):
"""Test that a location change for a UDN will evict the prior location from the cache."""
mock_get_ssdp = {
"hue": [{"manufacturer": "Signify", "modelName": "Philips hue bridge 2015"}]
}
... | [
"async",
"def",
"test_location_change_evicts_prior_location_from_cache",
"(",
"hass",
",",
"aioclient_mock",
",",
"mock_get_source_ip",
")",
":",
"mock_get_ssdp",
"=",
"{",
"\"hue\"",
":",
"[",
"{",
"\"manufacturer\"",
":",
"\"Signify\"",
",",
"\"modelName\"",
":",
"\... | [
940,
0
] | [
1060,
9
] | python | en | ['en', 'en', 'en'] | True |
test_location_change_with_overlapping_udn_st_combinations | (
hass, aioclient_mock
) | Test handling when a UDN and ST broadcast multiple locations. | Test handling when a UDN and ST broadcast multiple locations. | async def test_location_change_with_overlapping_udn_st_combinations(
hass, aioclient_mock
):
"""Test handling when a UDN and ST broadcast multiple locations."""
mock_get_ssdp = {
"test_integration": [
{"manufacturer": "test_manufacturer", "modelName": "test_model"}
]
}
h... | [
"async",
"def",
"test_location_change_with_overlapping_udn_st_combinations",
"(",
"hass",
",",
"aioclient_mock",
")",
":",
"mock_get_ssdp",
"=",
"{",
"\"test_integration\"",
":",
"[",
"{",
"\"manufacturer\"",
":",
"\"test_manufacturer\"",
",",
"\"modelName\"",
":",
"\"tes... | [
1063,
0
] | [
1170,
9
] | python | en | ['en', 'en', 'en'] | True |
CloudGoogleConfig.__init__ | (
self, hass, config, cloud_user: str, prefs: CloudPreferences, cloud: Cloud
) | Initialize the Google config. | Initialize the Google config. | def __init__(
self, hass, config, cloud_user: str, prefs: CloudPreferences, cloud: Cloud
):
"""Initialize the Google config."""
super().__init__(hass)
self._config = config
self._user = cloud_user
self._prefs = prefs
self._cloud = cloud
self._cur_entit... | [
"def",
"__init__",
"(",
"self",
",",
"hass",
",",
"config",
",",
"cloud_user",
":",
"str",
",",
"prefs",
":",
"CloudPreferences",
",",
"cloud",
":",
"Cloud",
")",
":",
"super",
"(",
")",
".",
"__init__",
"(",
"hass",
")",
"self",
".",
"_config",
"=",... | [
28,
4
] | [
40,
37
] | python | en | ['en', 'en', 'en'] | True |
CloudGoogleConfig.enabled | (self) | Return if Google is enabled. | Return if Google is enabled. | def enabled(self):
"""Return if Google is enabled."""
return (
self._cloud.is_logged_in
and not self._cloud.subscription_expired
and self._prefs.google_enabled
) | [
"def",
"enabled",
"(",
"self",
")",
":",
"return",
"(",
"self",
".",
"_cloud",
".",
"is_logged_in",
"and",
"not",
"self",
".",
"_cloud",
".",
"subscription_expired",
"and",
"self",
".",
"_prefs",
".",
"google_enabled",
")"
] | [
43,
4
] | [
49,
9
] | python | en | ['en', 'en', 'en'] | True |
CloudGoogleConfig.entity_config | (self) | Return entity config. | Return entity config. | def entity_config(self):
"""Return entity config."""
return self._config.get(CONF_ENTITY_CONFIG) or {} | [
"def",
"entity_config",
"(",
"self",
")",
":",
"return",
"self",
".",
"_config",
".",
"get",
"(",
"CONF_ENTITY_CONFIG",
")",
"or",
"{",
"}"
] | [
52,
4
] | [
54,
57
] | python | en | ['en', 'cy', 'en'] | True |
CloudGoogleConfig.secure_devices_pin | (self) | Return entity config. | Return entity config. | def secure_devices_pin(self):
"""Return entity config."""
return self._prefs.google_secure_devices_pin | [
"def",
"secure_devices_pin",
"(",
"self",
")",
":",
"return",
"self",
".",
"_prefs",
".",
"google_secure_devices_pin"
] | [
57,
4
] | [
59,
52
] | python | en | ['en', 'cy', 'en'] | True |
CloudGoogleConfig.should_report_state | (self) | Return if states should be proactively reported. | Return if states should be proactively reported. | def should_report_state(self):
"""Return if states should be proactively reported."""
return self.enabled and self._prefs.google_report_state | [
"def",
"should_report_state",
"(",
"self",
")",
":",
"return",
"self",
".",
"enabled",
"and",
"self",
".",
"_prefs",
".",
"google_report_state"
] | [
62,
4
] | [
64,
63
] | python | en | ['en', 'en', 'en'] | True |
CloudGoogleConfig.local_sdk_webhook_id | (self) | Return the local SDK webhook.
Return None to disable the local SDK.
| Return the local SDK webhook. | def local_sdk_webhook_id(self):
"""Return the local SDK webhook.
Return None to disable the local SDK.
"""
return self._prefs.google_local_webhook_id | [
"def",
"local_sdk_webhook_id",
"(",
"self",
")",
":",
"return",
"self",
".",
"_prefs",
".",
"google_local_webhook_id"
] | [
67,
4
] | [
72,
50
] | python | en | ['en', 'zh', 'en'] | True |
CloudGoogleConfig.local_sdk_user_id | (self) | Return the user ID to be used for actions received via the local SDK. | Return the user ID to be used for actions received via the local SDK. | def local_sdk_user_id(self):
"""Return the user ID to be used for actions received via the local SDK."""
return self._user | [
"def",
"local_sdk_user_id",
"(",
"self",
")",
":",
"return",
"self",
".",
"_user"
] | [
75,
4
] | [
77,
25
] | python | en | ['en', 'en', 'en'] | True |
CloudGoogleConfig.cloud_user | (self) | Return Cloud User account. | Return Cloud User account. | def cloud_user(self):
"""Return Cloud User account."""
return self._user | [
"def",
"cloud_user",
"(",
"self",
")",
":",
"return",
"self",
".",
"_user"
] | [
80,
4
] | [
82,
25
] | python | en | ['en', 'id', 'en'] | True |
CloudGoogleConfig.async_initialize | (self) | Perform async initialization of config. | Perform async initialization of config. | async def async_initialize(self):
"""Perform async initialization of config."""
await super().async_initialize()
async def hass_started(hass):
if self.enabled and GOOGLE_DOMAIN not in self.hass.config.components:
await async_setup_component(self.hass, GOOGLE_DOMAIN, ... | [
"async",
"def",
"async_initialize",
"(",
"self",
")",
":",
"await",
"super",
"(",
")",
".",
"async_initialize",
"(",
")",
"async",
"def",
"hass_started",
"(",
"hass",
")",
":",
"if",
"self",
".",
"enabled",
"and",
"GOOGLE_DOMAIN",
"not",
"in",
"self",
".... | [
84,
4
] | [
108,
9
] | python | en | ['en', 'en', 'en'] | True |
CloudGoogleConfig.should_expose | (self, state) | If a state object should be exposed. | If a state object should be exposed. | def should_expose(self, state):
"""If a state object should be exposed."""
return self._should_expose_entity_id(state.entity_id) | [
"def",
"should_expose",
"(",
"self",
",",
"state",
")",
":",
"return",
"self",
".",
"_should_expose_entity_id",
"(",
"state",
".",
"entity_id",
")"
] | [
110,
4
] | [
112,
61
] | python | en | ['en', 'en', 'en'] | True |
CloudGoogleConfig._should_expose_entity_id | (self, entity_id) | If an entity ID should be exposed. | If an entity ID should be exposed. | def _should_expose_entity_id(self, entity_id):
"""If an entity ID should be exposed."""
if entity_id in CLOUD_NEVER_EXPOSED_ENTITIES:
return False
if not self._config["filter"].empty_filter:
return self._config["filter"](entity_id)
entity_configs = self._prefs.g... | [
"def",
"_should_expose_entity_id",
"(",
"self",
",",
"entity_id",
")",
":",
"if",
"entity_id",
"in",
"CLOUD_NEVER_EXPOSED_ENTITIES",
":",
"return",
"False",
"if",
"not",
"self",
".",
"_config",
"[",
"\"filter\"",
"]",
".",
"empty_filter",
":",
"return",
"self",
... | [
114,
4
] | [
134,
62
] | python | en | ['en', 'en', 'en'] | True |
CloudGoogleConfig.agent_user_id | (self) | Return Agent User Id to use for query responses. | Return Agent User Id to use for query responses. | def agent_user_id(self):
"""Return Agent User Id to use for query responses."""
return self._cloud.username | [
"def",
"agent_user_id",
"(",
"self",
")",
":",
"return",
"self",
".",
"_cloud",
".",
"username"
] | [
137,
4
] | [
139,
35
] | python | en | ['en', 'en', 'en'] | True |
CloudGoogleConfig.has_registered_user_agent | (self) | Return if we have a Agent User Id registered. | Return if we have a Agent User Id registered. | def has_registered_user_agent(self):
"""Return if we have a Agent User Id registered."""
return len(self._store.agent_user_ids) > 0 | [
"def",
"has_registered_user_agent",
"(",
"self",
")",
":",
"return",
"len",
"(",
"self",
".",
"_store",
".",
"agent_user_ids",
")",
">",
"0"
] | [
142,
4
] | [
144,
50
] | python | en | ['en', 'en', 'en'] | True |
CloudGoogleConfig.get_agent_user_id | (self, context) | Get agent user ID making request. | Get agent user ID making request. | def get_agent_user_id(self, context):
"""Get agent user ID making request."""
return self.agent_user_id | [
"def",
"get_agent_user_id",
"(",
"self",
",",
"context",
")",
":",
"return",
"self",
".",
"agent_user_id"
] | [
146,
4
] | [
148,
33
] | python | en | ['fr', 'en', 'en'] | True |
CloudGoogleConfig.should_2fa | (self, state) | If an entity should be checked for 2FA. | If an entity should be checked for 2FA. | def should_2fa(self, state):
"""If an entity should be checked for 2FA."""
entity_configs = self._prefs.google_entity_configs
entity_config = entity_configs.get(state.entity_id, {})
return not entity_config.get(PREF_DISABLE_2FA, DEFAULT_DISABLE_2FA) | [
"def",
"should_2fa",
"(",
"self",
",",
"state",
")",
":",
"entity_configs",
"=",
"self",
".",
"_prefs",
".",
"google_entity_configs",
"entity_config",
"=",
"entity_configs",
".",
"get",
"(",
"state",
".",
"entity_id",
",",
"{",
"}",
")",
"return",
"not",
"... | [
150,
4
] | [
154,
75
] | python | en | ['en', 'en', 'en'] | True |
CloudGoogleConfig.async_report_state | (self, message, agent_user_id: str) | Send a state report to Google. | Send a state report to Google. | async def async_report_state(self, message, agent_user_id: str):
"""Send a state report to Google."""
try:
await self._cloud.google_report_state.async_send_message(message)
except ErrorResponse as err:
_LOGGER.warning("Error reporting state - %s: %s", err.code, err.messag... | [
"async",
"def",
"async_report_state",
"(",
"self",
",",
"message",
",",
"agent_user_id",
":",
"str",
")",
":",
"try",
":",
"await",
"self",
".",
"_cloud",
".",
"google_report_state",
".",
"async_send_message",
"(",
"message",
")",
"except",
"ErrorResponse",
"a... | [
156,
4
] | [
161,
84
] | python | en | ['en', 'en', 'en'] | True |
CloudGoogleConfig._async_request_sync_devices | (self, agent_user_id: str) | Trigger a sync with Google. | Trigger a sync with Google. | async def _async_request_sync_devices(self, agent_user_id: str):
"""Trigger a sync with Google."""
if self._sync_entities_lock.locked():
return HTTP_OK
async with self._sync_entities_lock:
resp = await cloud_api.async_google_actions_request_sync(self._cloud)
... | [
"async",
"def",
"_async_request_sync_devices",
"(",
"self",
",",
"agent_user_id",
":",
"str",
")",
":",
"if",
"self",
".",
"_sync_entities_lock",
".",
"locked",
"(",
")",
":",
"return",
"HTTP_OK",
"async",
"with",
"self",
".",
"_sync_entities_lock",
":",
"resp... | [
163,
4
] | [
170,
30
] | python | en | ['en', 'en', 'en'] | True |
CloudGoogleConfig._async_prefs_updated | (self, prefs) | Handle updated preferences. | Handle updated preferences. | async def _async_prefs_updated(self, prefs):
"""Handle updated preferences."""
if not self._cloud.is_logged_in:
if self.is_reporting_state:
self.async_disable_report_state()
if self.is_local_sdk_active:
self.async_disable_local_sdk()
re... | [
"async",
"def",
"_async_prefs_updated",
"(",
"self",
",",
"prefs",
")",
":",
"if",
"not",
"self",
".",
"_cloud",
".",
"is_logged_in",
":",
"if",
"self",
".",
"is_reporting_state",
":",
"self",
".",
"async_disable_report_state",
"(",
")",
"if",
"self",
".",
... | [
172,
4
] | [
208,
62
] | python | en | ['en', 'en', 'en'] | True |
CloudGoogleConfig._handle_entity_registry_updated | (self, event) | Handle when entity registry updated. | Handle when entity registry updated. | async def _handle_entity_registry_updated(self, event):
"""Handle when entity registry updated."""
if not self.enabled or not self._cloud.is_logged_in:
return
# Only consider entity registry updates if info relevant for Google has changed
if event.data["action"] == "update" ... | [
"async",
"def",
"_handle_entity_registry_updated",
"(",
"self",
",",
"event",
")",
":",
"if",
"not",
"self",
".",
"enabled",
"or",
"not",
"self",
".",
"_cloud",
".",
"is_logged_in",
":",
"return",
"# Only consider entity registry updates if info relevant for Google has ... | [
210,
4
] | [
229,
45
] | python | en | ['en', 'en', 'en'] | True |
validate_input | (hass: core.HomeAssistant, data) | Validate the user input allows us to connect.
Data has the keys from DATA_SCHEMA with values provided by the user.
| Validate the user input allows us to connect. | async def validate_input(hass: core.HomeAssistant, data):
"""Validate the user input allows us to connect.
Data has the keys from DATA_SCHEMA with values provided by the user.
"""
roomba = RoombaFactory.create_roomba(
address=data[CONF_HOST],
blid=data[CONF_BLID],
password=data[... | [
"async",
"def",
"validate_input",
"(",
"hass",
":",
"core",
".",
"HomeAssistant",
",",
"data",
")",
":",
"roomba",
"=",
"RoombaFactory",
".",
"create_roomba",
"(",
"address",
"=",
"data",
"[",
"CONF_HOST",
"]",
",",
"blid",
"=",
"data",
"[",
"CONF_BLID",
... | [
37,
0
] | [
58,
5
] | python | en | ['en', 'en', 'en'] | True |
_async_get_roomba_discovery | () | Create a discovery object. | Create a discovery object. | def _async_get_roomba_discovery():
"""Create a discovery object."""
discovery = RoombaDiscovery()
discovery.amount_of_broadcasted_messages = MAX_NUM_DEVICES_TO_DISCOVER
return discovery | [
"def",
"_async_get_roomba_discovery",
"(",
")",
":",
"discovery",
"=",
"RoombaDiscovery",
"(",
")",
"discovery",
".",
"amount_of_broadcasted_messages",
"=",
"MAX_NUM_DEVICES_TO_DISCOVER",
"return",
"discovery"
] | [
295,
0
] | [
299,
20
] | python | en | ['en', 'en', 'en'] | True |
_async_blid_from_hostname | (hostname) | Extract the blid from the hostname. | Extract the blid from the hostname. | def _async_blid_from_hostname(hostname):
"""Extract the blid from the hostname."""
return hostname.split("-")[1].split(".")[0].upper() | [
"def",
"_async_blid_from_hostname",
"(",
"hostname",
")",
":",
"return",
"hostname",
".",
"split",
"(",
"\"-\"",
")",
"[",
"1",
"]",
".",
"split",
"(",
"\".\"",
")",
"[",
"0",
"]",
".",
"upper",
"(",
")"
] | [
303,
0
] | [
305,
55
] | python | en | ['en', 'en', 'en'] | True |
RoombaConfigFlow.__init__ | (self) | Initialize the roomba flow. | Initialize the roomba flow. | def __init__(self):
"""Initialize the roomba flow."""
self.discovered_robots = {}
self.name = None
self.blid = None
self.host = None | [
"def",
"__init__",
"(",
"self",
")",
":",
"self",
".",
"discovered_robots",
"=",
"{",
"}",
"self",
".",
"name",
"=",
"None",
"self",
".",
"blid",
"=",
"None",
"self",
".",
"host",
"=",
"None"
] | [
66,
4
] | [
71,
24
] | python | en | ['en', 'en', 'en'] | True |
RoombaConfigFlow.async_get_options_flow | (config_entry) | Get the options flow for this handler. | Get the options flow for this handler. | def async_get_options_flow(config_entry):
"""Get the options flow for this handler."""
return OptionsFlowHandler(config_entry) | [
"def",
"async_get_options_flow",
"(",
"config_entry",
")",
":",
"return",
"OptionsFlowHandler",
"(",
"config_entry",
")"
] | [
75,
4
] | [
77,
47
] | python | en | ['en', 'en', 'en'] | True |
RoombaConfigFlow.async_step_dhcp | (self, discovery_info) | Handle dhcp discovery. | Handle dhcp discovery. | async def async_step_dhcp(self, discovery_info):
"""Handle dhcp discovery."""
self._async_abort_entries_match({CONF_HOST: discovery_info[IP_ADDRESS]})
if not discovery_info[HOSTNAME].startswith(("irobot-", "roomba-")):
return self.async_abort(reason="not_irobot_device")
sel... | [
"async",
"def",
"async_step_dhcp",
"(",
"self",
",",
"discovery_info",
")",
":",
"self",
".",
"_async_abort_entries_match",
"(",
"{",
"CONF_HOST",
":",
"discovery_info",
"[",
"IP_ADDRESS",
"]",
"}",
")",
"if",
"not",
"discovery_info",
"[",
"HOSTNAME",
"]",
"."... | [
79,
4
] | [
104,
43
] | python | en | ['fr', 'en', 'en'] | True |
RoombaConfigFlow._async_start_link | (self) | Start linking. | Start linking. | async def _async_start_link(self):
"""Start linking."""
device = self.discovered_robots[self.host]
self.blid = device.blid
self.name = device.robot_name
await self.async_set_unique_id(self.blid, raise_on_progress=False)
self._abort_if_unique_id_configured()
return... | [
"async",
"def",
"_async_start_link",
"(",
"self",
")",
":",
"device",
"=",
"self",
".",
"discovered_robots",
"[",
"self",
".",
"host",
"]",
"self",
".",
"blid",
"=",
"device",
".",
"blid",
"self",
".",
"name",
"=",
"device",
".",
"robot_name",
"await",
... | [
106,
4
] | [
113,
43
] | python | en | ['en', 'fi', 'en'] | False |
RoombaConfigFlow.async_step_user | (self, user_input=None) | Handle a flow start. | Handle a flow start. | async def async_step_user(self, user_input=None):
"""Handle a flow start."""
# Check if user chooses manual entry
if user_input is not None and not user_input.get(CONF_HOST):
return await self.async_step_manual()
if (
user_input is not None
and self.d... | [
"async",
"def",
"async_step_user",
"(",
"self",
",",
"user_input",
"=",
"None",
")",
":",
"# Check if user chooses manual entry",
"if",
"user_input",
"is",
"not",
"None",
"and",
"not",
"user_input",
".",
"get",
"(",
"CONF_HOST",
")",
":",
"return",
"await",
"s... | [
115,
4
] | [
168,
9
] | python | en | ['en', 'lb', 'en'] | True |
RoombaConfigFlow.async_step_manual | (self, user_input=None) | Handle manual device setup. | Handle manual device setup. | async def async_step_manual(self, user_input=None):
"""Handle manual device setup."""
if user_input is None:
return self.async_show_form(
step_id="manual",
description_placeholders={AUTH_HELP_URL_KEY: AUTH_HELP_URL_VALUE},
data_schema=vol.Schem... | [
"async",
"def",
"async_step_manual",
"(",
"self",
",",
"user_input",
"=",
"None",
")",
":",
"if",
"user_input",
"is",
"None",
":",
"return",
"self",
".",
"async_show_form",
"(",
"step_id",
"=",
"\"manual\"",
",",
"description_placeholders",
"=",
"{",
"AUTH_HEL... | [
170,
4
] | [
193,
43
] | python | en | ['ro', 'haw', 'en'] | False |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.