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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
light_rgb_msg_fixture | (hass) | Return a mock MQTT msg with a light actuator message. | Return a mock MQTT msg with a light actuator message. | async def light_rgb_msg_fixture(hass):
"""Return a mock MQTT msg with a light actuator message."""
light_json = json.loads(
await hass.async_add_executor_job(load_fixture, "ozw/light_rgb.json")
)
message = MQTTMessage(topic=light_json["topic"], payload=light_json["payload"])
message.encode()... | [
"async",
"def",
"light_rgb_msg_fixture",
"(",
"hass",
")",
":",
"light_json",
"=",
"json",
".",
"loads",
"(",
"await",
"hass",
".",
"async_add_executor_job",
"(",
"load_fixture",
",",
"\"ozw/light_rgb.json\"",
")",
")",
"message",
"=",
"MQTTMessage",
"(",
"topic... | [
140,
0
] | [
147,
18
] | python | en | ['en', 'lb', 'en'] | True |
light_pure_rgb_msg_fixture | (hass) | Return a mock MQTT msg with a pure rgb light actuator message. | Return a mock MQTT msg with a pure rgb light actuator message. | async def light_pure_rgb_msg_fixture(hass):
"""Return a mock MQTT msg with a pure rgb light actuator message."""
light_json = json.loads(
await hass.async_add_executor_job(load_fixture, "ozw/light_pure_rgb.json")
)
message = MQTTMessage(topic=light_json["topic"], payload=light_json["payload"])
... | [
"async",
"def",
"light_pure_rgb_msg_fixture",
"(",
"hass",
")",
":",
"light_json",
"=",
"json",
".",
"loads",
"(",
"await",
"hass",
".",
"async_add_executor_job",
"(",
"load_fixture",
",",
"\"ozw/light_pure_rgb.json\"",
")",
")",
"message",
"=",
"MQTTMessage",
"("... | [
151,
0
] | [
158,
18
] | python | en | ['en', 'en', 'en'] | True |
switch_msg_fixture | (hass) | Return a mock MQTT msg with a switch actuator message. | Return a mock MQTT msg with a switch actuator message. | async def switch_msg_fixture(hass):
"""Return a mock MQTT msg with a switch actuator message."""
switch_json = json.loads(
await hass.async_add_executor_job(load_fixture, "ozw/switch.json")
)
message = MQTTMessage(topic=switch_json["topic"], payload=switch_json["payload"])
message.encode()
... | [
"async",
"def",
"switch_msg_fixture",
"(",
"hass",
")",
":",
"switch_json",
"=",
"json",
".",
"loads",
"(",
"await",
"hass",
".",
"async_add_executor_job",
"(",
"load_fixture",
",",
"\"ozw/switch.json\"",
")",
")",
"message",
"=",
"MQTTMessage",
"(",
"topic",
... | [
162,
0
] | [
169,
18
] | python | en | ['en', 'en', 'en'] | True |
sensor_msg_fixture | (hass) | Return a mock MQTT msg with a sensor change message. | Return a mock MQTT msg with a sensor change message. | async def sensor_msg_fixture(hass):
"""Return a mock MQTT msg with a sensor change message."""
sensor_json = json.loads(
await hass.async_add_executor_job(load_fixture, "ozw/sensor.json")
)
message = MQTTMessage(topic=sensor_json["topic"], payload=sensor_json["payload"])
message.encode()
... | [
"async",
"def",
"sensor_msg_fixture",
"(",
"hass",
")",
":",
"sensor_json",
"=",
"json",
".",
"loads",
"(",
"await",
"hass",
".",
"async_add_executor_job",
"(",
"load_fixture",
",",
"\"ozw/sensor.json\"",
")",
")",
"message",
"=",
"MQTTMessage",
"(",
"topic",
... | [
173,
0
] | [
180,
18
] | python | en | ['en', 'da', 'en'] | True |
binary_sensor_msg_fixture | (hass) | Return a mock MQTT msg with a binary_sensor change message. | Return a mock MQTT msg with a binary_sensor change message. | async def binary_sensor_msg_fixture(hass):
"""Return a mock MQTT msg with a binary_sensor change message."""
sensor_json = json.loads(
await hass.async_add_executor_job(load_fixture, "ozw/binary_sensor.json")
)
message = MQTTMessage(topic=sensor_json["topic"], payload=sensor_json["payload"])
... | [
"async",
"def",
"binary_sensor_msg_fixture",
"(",
"hass",
")",
":",
"sensor_json",
"=",
"json",
".",
"loads",
"(",
"await",
"hass",
".",
"async_add_executor_job",
"(",
"load_fixture",
",",
"\"ozw/binary_sensor.json\"",
")",
")",
"message",
"=",
"MQTTMessage",
"(",... | [
184,
0
] | [
191,
18
] | python | en | ['en', 'en', 'en'] | True |
binary_sensor_alt_msg_fixture | (hass) | Return a mock MQTT msg with a binary_sensor change message. | Return a mock MQTT msg with a binary_sensor change message. | async def binary_sensor_alt_msg_fixture(hass):
"""Return a mock MQTT msg with a binary_sensor change message."""
sensor_json = json.loads(
await hass.async_add_executor_job(load_fixture, "ozw/binary_sensor_alt.json")
)
message = MQTTMessage(topic=sensor_json["topic"], payload=sensor_json["payloa... | [
"async",
"def",
"binary_sensor_alt_msg_fixture",
"(",
"hass",
")",
":",
"sensor_json",
"=",
"json",
".",
"loads",
"(",
"await",
"hass",
".",
"async_add_executor_job",
"(",
"load_fixture",
",",
"\"ozw/binary_sensor_alt.json\"",
")",
")",
"message",
"=",
"MQTTMessage"... | [
195,
0
] | [
202,
18
] | python | en | ['en', 'en', 'en'] | True |
cover_msg_fixture | (hass) | Return a mock MQTT msg with a cover level change message. | Return a mock MQTT msg with a cover level change message. | async def cover_msg_fixture(hass):
"""Return a mock MQTT msg with a cover level change message."""
sensor_json = json.loads(
await hass.async_add_executor_job(load_fixture, "ozw/cover.json")
)
message = MQTTMessage(topic=sensor_json["topic"], payload=sensor_json["payload"])
message.encode()
... | [
"async",
"def",
"cover_msg_fixture",
"(",
"hass",
")",
":",
"sensor_json",
"=",
"json",
".",
"loads",
"(",
"await",
"hass",
".",
"async_add_executor_job",
"(",
"load_fixture",
",",
"\"ozw/cover.json\"",
")",
")",
"message",
"=",
"MQTTMessage",
"(",
"topic",
"=... | [
206,
0
] | [
213,
18
] | python | en | ['en', 'en', 'en'] | True |
cover_gdo_msg_fixture | (hass) | Return a mock MQTT msg with a cover barrier state change message. | Return a mock MQTT msg with a cover barrier state change message. | async def cover_gdo_msg_fixture(hass):
"""Return a mock MQTT msg with a cover barrier state change message."""
sensor_json = json.loads(
await hass.async_add_executor_job(load_fixture, "ozw/cover_gdo.json")
)
message = MQTTMessage(topic=sensor_json["topic"], payload=sensor_json["payload"])
m... | [
"async",
"def",
"cover_gdo_msg_fixture",
"(",
"hass",
")",
":",
"sensor_json",
"=",
"json",
".",
"loads",
"(",
"await",
"hass",
".",
"async_add_executor_job",
"(",
"load_fixture",
",",
"\"ozw/cover_gdo.json\"",
")",
")",
"message",
"=",
"MQTTMessage",
"(",
"topi... | [
217,
0
] | [
224,
18
] | python | en | ['en', 'en', 'en'] | True |
climate_msg_fixture | (hass) | Return a mock MQTT msg with a climate mode change message. | Return a mock MQTT msg with a climate mode change message. | async def climate_msg_fixture(hass):
"""Return a mock MQTT msg with a climate mode change message."""
sensor_json = json.loads(
await hass.async_add_executor_job(load_fixture, "ozw/climate.json")
)
message = MQTTMessage(topic=sensor_json["topic"], payload=sensor_json["payload"])
message.enco... | [
"async",
"def",
"climate_msg_fixture",
"(",
"hass",
")",
":",
"sensor_json",
"=",
"json",
".",
"loads",
"(",
"await",
"hass",
".",
"async_add_executor_job",
"(",
"load_fixture",
",",
"\"ozw/climate.json\"",
")",
")",
"message",
"=",
"MQTTMessage",
"(",
"topic",
... | [
228,
0
] | [
235,
18
] | python | en | ['en', 'en', 'en'] | True |
lock_msg_fixture | (hass) | Return a mock MQTT msg with a lock actuator message. | Return a mock MQTT msg with a lock actuator message. | async def lock_msg_fixture(hass):
"""Return a mock MQTT msg with a lock actuator message."""
lock_json = json.loads(
await hass.async_add_executor_job(load_fixture, "ozw/lock.json")
)
message = MQTTMessage(topic=lock_json["topic"], payload=lock_json["payload"])
message.encode()
return me... | [
"async",
"def",
"lock_msg_fixture",
"(",
"hass",
")",
":",
"lock_json",
"=",
"json",
".",
"loads",
"(",
"await",
"hass",
".",
"async_add_executor_job",
"(",
"load_fixture",
",",
"\"ozw/lock.json\"",
")",
")",
"message",
"=",
"MQTTMessage",
"(",
"topic",
"=",
... | [
239,
0
] | [
246,
18
] | python | en | ['en', 'en', 'en'] | True |
mock_install_addon | () | Mock stop add-on. | Mock stop add-on. | def mock_install_addon():
"""Mock stop add-on."""
with patch("homeassistant.components.hassio.async_stop_addon") as stop_addon:
yield stop_addon | [
"def",
"mock_install_addon",
"(",
")",
":",
"with",
"patch",
"(",
"\"homeassistant.components.hassio.async_stop_addon\"",
")",
"as",
"stop_addon",
":",
"yield",
"stop_addon"
] | [
250,
0
] | [
253,
24
] | python | en | ['en', 'fy', 'en'] | True |
mock_uninstall_addon | () | Mock uninstall add-on. | Mock uninstall add-on. | def mock_uninstall_addon():
"""Mock uninstall add-on."""
with patch(
"homeassistant.components.hassio.async_uninstall_addon"
) as uninstall_addon:
yield uninstall_addon | [
"def",
"mock_uninstall_addon",
"(",
")",
":",
"with",
"patch",
"(",
"\"homeassistant.components.hassio.async_uninstall_addon\"",
")",
"as",
"uninstall_addon",
":",
"yield",
"uninstall_addon"
] | [
257,
0
] | [
262,
29
] | python | en | ['en', 'so', 'en'] | True |
mock_get_addon_discovery_info | () | Mock get add-on discovery info. | Mock get add-on discovery info. | def mock_get_addon_discovery_info():
"""Mock get add-on discovery info."""
with patch(
"homeassistant.components.hassio.async_get_addon_discovery_info"
) as get_addon_discovery_info:
yield get_addon_discovery_info | [
"def",
"mock_get_addon_discovery_info",
"(",
")",
":",
"with",
"patch",
"(",
"\"homeassistant.components.hassio.async_get_addon_discovery_info\"",
")",
"as",
"get_addon_discovery_info",
":",
"yield",
"get_addon_discovery_info"
] | [
266,
0
] | [
271,
38
] | python | en | ['af', 'en', 'en'] | True |
mock_mqtt_fixture | (hass) | Mock the MQTT integration. | Mock the MQTT integration. | async def mock_mqtt_fixture(hass):
"""Mock the MQTT integration."""
mqtt_entry = MockConfigEntry(domain="mqtt", state=ConfigEntryState.LOADED)
mqtt_entry.add_to_hass(hass)
return mqtt_entry | [
"async",
"def",
"mock_mqtt_fixture",
"(",
"hass",
")",
":",
"mqtt_entry",
"=",
"MockConfigEntry",
"(",
"domain",
"=",
"\"mqtt\"",
",",
"state",
"=",
"ConfigEntryState",
".",
"LOADED",
")",
"mqtt_entry",
".",
"add_to_hass",
"(",
"hass",
")",
"return",
"mqtt_ent... | [
275,
0
] | [
279,
21
] | python | en | ['en', 'sv', 'en'] | True |
Error._get_message | (self) | Getter for 'message'; needed only to override deprecation in
BaseException. | Getter for 'message'; needed only to override deprecation in
BaseException. | def _get_message(self):
"""Getter for 'message'; needed only to override deprecation in
BaseException."""
return self.__message | [
"def",
"_get_message",
"(",
"self",
")",
":",
"return",
"self",
".",
"__message"
] | [
114,
4
] | [
117,
29
] | python | en | ['en', 'en', 'en'] | True |
Error._set_message | (self, value) | Setter for 'message'; needed only to override deprecation in
BaseException. | Setter for 'message'; needed only to override deprecation in
BaseException. | def _set_message(self, value):
"""Setter for 'message'; needed only to override deprecation in
BaseException."""
self.__message = value | [
"def",
"_set_message",
"(",
"self",
",",
"value",
")",
":",
"self",
".",
"__message",
"=",
"value"
] | [
119,
4
] | [
122,
30
] | python | en | ['en', 'en', 'en'] | True |
RawConfigParser.sections | (self) | Return a list of section names, excluding [DEFAULT] | Return a list of section names, excluding [DEFAULT] | def sections(self):
"""Return a list of section names, excluding [DEFAULT]"""
# self._sections will never have [DEFAULT] in it
return self._sections.keys() | [
"def",
"sections",
"(",
"self",
")",
":",
"# self._sections will never have [DEFAULT] in it",
"return",
"self",
".",
"_sections",
".",
"keys",
"(",
")"
] | [
247,
4
] | [
250,
36
] | python | en | ['en', 'en', 'en'] | True |
RawConfigParser.add_section | (self, section) | Create a new section in the configuration.
Raise DuplicateSectionError if a section by the specified name
already exists. Raise ValueError if name is DEFAULT or any of it's
case-insensitive variants.
| Create a new section in the configuration. | def add_section(self, section):
"""Create a new section in the configuration.
Raise DuplicateSectionError if a section by the specified name
already exists. Raise ValueError if name is DEFAULT or any of it's
case-insensitive variants.
"""
if section.lower() == "default":... | [
"def",
"add_section",
"(",
"self",
",",
"section",
")",
":",
"if",
"section",
".",
"lower",
"(",
")",
"==",
"\"default\"",
":",
"raise",
"ValueError",
"(",
"'Invalid section name: %s'",
"%",
"section",
")",
"if",
"section",
"in",
"self",
".",
"_sections",
... | [
252,
4
] | [
264,
46
] | python | en | ['en', 'en', 'en'] | True |
RawConfigParser.has_section | (self, section) | Indicate whether the named section is present in the configuration.
The DEFAULT section is not acknowledged.
| Indicate whether the named section is present in the configuration. | def has_section(self, section):
"""Indicate whether the named section is present in the configuration.
The DEFAULT section is not acknowledged.
"""
return section in self._sections | [
"def",
"has_section",
"(",
"self",
",",
"section",
")",
":",
"return",
"section",
"in",
"self",
".",
"_sections"
] | [
266,
4
] | [
271,
40
] | python | en | ['en', 'en', 'en'] | True |
RawConfigParser.options | (self, section) | Return a list of option names for the given section name. | Return a list of option names for the given section name. | def options(self, section):
"""Return a list of option names for the given section name."""
try:
opts = self._sections[section].copy()
except KeyError:
raise NoSectionError(section)
opts.update(self._defaults)
if '__name__' in opts:
del opts['_... | [
"def",
"options",
"(",
"self",
",",
"section",
")",
":",
"try",
":",
"opts",
"=",
"self",
".",
"_sections",
"[",
"section",
"]",
".",
"copy",
"(",
")",
"except",
"KeyError",
":",
"raise",
"NoSectionError",
"(",
"section",
")",
"opts",
".",
"update",
... | [
273,
4
] | [
282,
26
] | python | en | ['en', 'en', 'en'] | True |
RawConfigParser.read | (self, filenames) | Read and parse a filename or a list of filenames.
Files that cannot be opened are silently ignored; this is
designed so that you can specify a list of potential
configuration file locations (e.g. current directory, user's
home directory, systemwide directory), and all existing
c... | Read and parse a filename or a list of filenames. | def read(self, filenames):
"""Read and parse a filename or a list of filenames.
Files that cannot be opened are silently ignored; this is
designed so that you can specify a list of potential
configuration file locations (e.g. current directory, user's
home directory, systemwide ... | [
"def",
"read",
"(",
"self",
",",
"filenames",
")",
":",
"if",
"isinstance",
"(",
"filenames",
",",
"basestring",
")",
":",
"filenames",
"=",
"[",
"filenames",
"]",
"read_ok",
"=",
"[",
"]",
"for",
"filename",
"in",
"filenames",
":",
"try",
":",
"fp",
... | [
284,
4
] | [
307,
22
] | python | en | ['en', 'en', 'en'] | True |
RawConfigParser.readfp | (self, fp, filename=None) | Like read() but the argument must be a file-like object.
The `fp' argument must have a `readline' method. Optional
second argument is the `filename', which if not given, is
taken from fp.name. If fp has no `name' attribute, `<???>' is
used.
| Like read() but the argument must be a file-like object. | def readfp(self, fp, filename=None):
"""Like read() but the argument must be a file-like object.
The `fp' argument must have a `readline' method. Optional
second argument is the `filename', which if not given, is
taken from fp.name. If fp has no `name' attribute, `<???>' is
us... | [
"def",
"readfp",
"(",
"self",
",",
"fp",
",",
"filename",
"=",
"None",
")",
":",
"if",
"filename",
"is",
"None",
":",
"try",
":",
"filename",
"=",
"fp",
".",
"name",
"except",
"AttributeError",
":",
"filename",
"=",
"'<???>'",
"self",
".",
"_read",
"... | [
309,
4
] | [
323,
32
] | python | en | ['en', 'en', 'en'] | True |
RawConfigParser.has_option | (self, section, option) | Check for the existence of a given option in a given section. | Check for the existence of a given option in a given section. | def has_option(self, section, option):
"""Check for the existence of a given option in a given section."""
if not section or section == DEFAULTSECT:
option = self.optionxform(option)
return option in self._defaults
elif section not in self._sections:
return Fa... | [
"def",
"has_option",
"(",
"self",
",",
"section",
",",
"option",
")",
":",
"if",
"not",
"section",
"or",
"section",
"==",
"DEFAULTSECT",
":",
"option",
"=",
"self",
".",
"optionxform",
"(",
"option",
")",
"return",
"option",
"in",
"self",
".",
"_defaults... | [
375,
4
] | [
385,
48
] | python | en | ['en', 'en', 'en'] | True |
RawConfigParser.set | (self, section, option, value=None) | Set an option. | Set an option. | def set(self, section, option, value=None):
"""Set an option."""
if not section or section == DEFAULTSECT:
sectdict = self._defaults
else:
try:
sectdict = self._sections[section]
except KeyError:
raise NoSectionError(section)
... | [
"def",
"set",
"(",
"self",
",",
"section",
",",
"option",
",",
"value",
"=",
"None",
")",
":",
"if",
"not",
"section",
"or",
"section",
"==",
"DEFAULTSECT",
":",
"sectdict",
"=",
"self",
".",
"_defaults",
"else",
":",
"try",
":",
"sectdict",
"=",
"se... | [
387,
4
] | [
396,
50
] | python | en | ['en', 'lb', 'en'] | True |
RawConfigParser.write | (self, fp) | Write an .ini-format representation of the configuration state. | Write an .ini-format representation of the configuration state. | def write(self, fp):
"""Write an .ini-format representation of the configuration state."""
if self._defaults:
fp.write("[%s]\n" % DEFAULTSECT)
for (key, value) in self._defaults.items():
fp.write("%s = %s\n" % (key, str(value).replace('\n', '\n\t')))
f... | [
"def",
"write",
"(",
"self",
",",
"fp",
")",
":",
"if",
"self",
".",
"_defaults",
":",
"fp",
".",
"write",
"(",
"\"[%s]\\n\"",
"%",
"DEFAULTSECT",
")",
"for",
"(",
"key",
",",
"value",
")",
"in",
"self",
".",
"_defaults",
".",
"items",
"(",
")",
... | [
398,
4
] | [
413,
26
] | python | en | ['en', 'en', 'en'] | True |
RawConfigParser.remove_option | (self, section, option) | Remove an option. | Remove an option. | def remove_option(self, section, option):
"""Remove an option."""
if not section or section == DEFAULTSECT:
sectdict = self._defaults
else:
try:
sectdict = self._sections[section]
except KeyError:
raise NoSectionError(section)
... | [
"def",
"remove_option",
"(",
"self",
",",
"section",
",",
"option",
")",
":",
"if",
"not",
"section",
"or",
"section",
"==",
"DEFAULTSECT",
":",
"sectdict",
"=",
"self",
".",
"_defaults",
"else",
":",
"try",
":",
"sectdict",
"=",
"self",
".",
"_sections"... | [
415,
4
] | [
428,
22
] | python | en | ['en', 'en', 'en'] | True |
RawConfigParser.remove_section | (self, section) | Remove a file section. | Remove a file section. | def remove_section(self, section):
"""Remove a file section."""
existed = section in self._sections
if existed:
del self._sections[section]
return existed | [
"def",
"remove_section",
"(",
"self",
",",
"section",
")",
":",
"existed",
"=",
"section",
"in",
"self",
".",
"_sections",
"if",
"existed",
":",
"del",
"self",
".",
"_sections",
"[",
"section",
"]",
"return",
"existed"
] | [
430,
4
] | [
435,
22
] | python | en | ['ro', 'en', 'en'] | True |
RawConfigParser._read | (self, fp, fpname) | Parse a sectioned setup file.
The sections in setup file contains a title line at the top,
indicated by a name in square brackets (`[]'), plus key/value
options lines, indicated by `name: value' format lines.
Continuations are represented by an embedded newline then
leading whit... | Parse a sectioned setup file. | def _read(self, fp, fpname):
"""Parse a sectioned setup file.
The sections in setup file contains a title line at the top,
indicated by a name in square brackets (`[]'), plus key/value
options lines, indicated by `name: value' format lines.
Continuations are represented by an em... | [
"def",
"_read",
"(",
"self",
",",
"fp",
",",
"fpname",
")",
":",
"cursect",
"=",
"None",
"# None, or a dictionary",
"optname",
"=",
"None",
"lineno",
"=",
"0",
"e",
"=",
"None",
"# None, or an exception",
"while",
"True",
":",
"line",
"=",
"fp",
".",
"re... | [
463,
4
] | [
553,
50
] | python | en | ['en', 'en', 'en'] | True |
ConfigParser.get | (self, section, option, raw=False, vars=None) | Get an option value for a given section.
If `vars' is provided, it must be a dictionary. The option is looked up
in `vars' (if provided), `section', and in `defaults' in that order.
All % interpolations are expanded in the return values, unless the
optional argument `raw' is true. Valu... | Get an option value for a given section. | def get(self, section, option, raw=False, vars=None):
"""Get an option value for a given section.
If `vars' is provided, it must be a dictionary. The option is looked up
in `vars' (if provided), `section', and in `defaults' in that order.
All % interpolations are expanded in the return... | [
"def",
"get",
"(",
"self",
",",
"section",
",",
"option",
",",
"raw",
"=",
"False",
",",
"vars",
"=",
"None",
")",
":",
"sectiondict",
"=",
"{",
"}",
"try",
":",
"sectiondict",
"=",
"self",
".",
"_sections",
"[",
"section",
"]",
"except",
"KeyError",... | [
594,
4
] | [
627,
63
] | python | en | ['en', 'en', 'en'] | True |
ConfigParser.items | (self, section, raw=False, vars=None) | Return a list of tuples with (name, value) for each option
in the section.
All % interpolations are expanded in the return values, based on the
defaults passed into the constructor, unless the optional argument
`raw' is true. Additional substitutions may be provided using the
`... | Return a list of tuples with (name, value) for each option
in the section. | def items(self, section, raw=False, vars=None):
"""Return a list of tuples with (name, value) for each option
in the section.
All % interpolations are expanded in the return values, based on the
defaults passed into the constructor, unless the optional argument
`raw' is true. A... | [
"def",
"items",
"(",
"self",
",",
"section",
",",
"raw",
"=",
"False",
",",
"vars",
"=",
"None",
")",
":",
"d",
"=",
"self",
".",
"_defaults",
".",
"copy",
"(",
")",
"try",
":",
"d",
".",
"update",
"(",
"self",
".",
"_sections",
"[",
"section",
... | [
629,
4
] | [
659,
42
] | python | en | ['en', 'en', 'en'] | True |
SafeConfigParser.set | (self, section, option, value=None) | Set an option. Extend ConfigParser.set: check for string values. | Set an option. Extend ConfigParser.set: check for string values. | def set(self, section, option, value=None):
"""Set an option. Extend ConfigParser.set: check for string values."""
# The only legal non-string value if we allow valueless
# options is None, so we need to check if the value is a
# string if:
# - we do not allow valueless options,... | [
"def",
"set",
"(",
"self",
",",
"section",
",",
"option",
",",
"value",
"=",
"None",
")",
":",
"# The only legal non-string value if we allow valueless",
"# options is None, so we need to check if the value is a",
"# string if:",
"# - we do not allow valueless options, or",
"# - ... | [
738,
4
] | [
757,
54
] | python | en | ['en', 'en', 'en'] | True |
save_samples_truncted_prob | (fname, points, prob) |
Save the visualization of sampling to a ply file.
Red points represent positive predictions.
Green points represent negative predictions.
:param fname: File name to save
:param points: [N, 3] array of points
:param prob: [N, 1] array of predictions in the range [0~1]
:return:
|
Save the visualization of sampling to a ply file.
Red points represent positive predictions.
Green points represent negative predictions.
:param fname: File name to save
:param points: [N, 3] array of points
:param prob: [N, 1] array of predictions in the range [0~1]
:return:
| def save_samples_truncted_prob(fname, points, prob):
'''
Save the visualization of sampling to a ply file.
Red points represent positive predictions.
Green points represent negative predictions.
:param fname: File name to save
:param points: [N, 3] array of points
:param prob: [N, 1] array o... | [
"def",
"save_samples_truncted_prob",
"(",
"fname",
",",
"points",
",",
"prob",
")",
":",
"r",
"=",
"(",
"prob",
">",
"0.5",
")",
".",
"reshape",
"(",
"[",
"-",
"1",
",",
"1",
"]",
")",
"*",
"255",
"g",
"=",
"(",
"prob",
"<",
"0.5",
")",
".",
... | [
3,
0
] | [
25,
23
] | python | en | ['en', 'error', 'th'] | False |
save_samples_rgb | (fname, points, rgb) |
Save the visualization of sampling to a ply file.
Red points represent positive predictions.
Green points represent negative predictions.
:param fname: File name to save
:param points: [N, 3] array of points
:param rgb: [N, 3] array of rgb values in the range [0~1]
:return:
|
Save the visualization of sampling to a ply file.
Red points represent positive predictions.
Green points represent negative predictions.
:param fname: File name to save
:param points: [N, 3] array of points
:param rgb: [N, 3] array of rgb values in the range [0~1]
:return:
| def save_samples_rgb(fname, points, rgb):
'''
Save the visualization of sampling to a ply file.
Red points represent positive predictions.
Green points represent negative predictions.
:param fname: File name to save
:param points: [N, 3] array of points
:param rgb: [N, 3] array of rgb values... | [
"def",
"save_samples_rgb",
"(",
"fname",
",",
"points",
",",
"rgb",
")",
":",
"to_save",
"=",
"np",
".",
"concatenate",
"(",
"[",
"points",
",",
"rgb",
"*",
"255",
"]",
",",
"axis",
"=",
"-",
"1",
")",
"return",
"np",
".",
"savetxt",
"(",
"fname",
... | [
28,
0
] | [
46,
23
] | python | en | ['en', 'error', 'th'] | False |
setup_test_entity | (hass: HomeAssistant, config_dict: dict[str, Any]) | Set up a test command line notify service. | Set up a test command line notify service. | async def setup_test_entity(hass: HomeAssistant, config_dict: dict[str, Any]) -> None:
"""Set up a test command line notify service."""
assert await setup.async_setup_component(
hass,
DOMAIN,
{
DOMAIN: [
{"platform": "command_line", "covers": config_dict},
... | [
"async",
"def",
"setup_test_entity",
"(",
"hass",
":",
"HomeAssistant",
",",
"config_dict",
":",
"dict",
"[",
"str",
",",
"Any",
"]",
")",
"->",
"None",
":",
"assert",
"await",
"setup",
".",
"async_setup_component",
"(",
"hass",
",",
"DOMAIN",
",",
"{",
... | [
23,
0
] | [
34,
38
] | python | en | ['en', 'cs', 'en'] | True |
test_no_covers | (caplog: Any, hass: HomeAssistant) | Test that the cover does not polls when there's no state command. | Test that the cover does not polls when there's no state command. | async def test_no_covers(caplog: Any, hass: HomeAssistant) -> None:
"""Test that the cover does not polls when there's no state command."""
with patch(
"homeassistant.components.command_line.subprocess.check_output",
return_value=b"50\n",
):
await setup_test_entity(hass, {})
... | [
"async",
"def",
"test_no_covers",
"(",
"caplog",
":",
"Any",
",",
"hass",
":",
"HomeAssistant",
")",
"->",
"None",
":",
"with",
"patch",
"(",
"\"homeassistant.components.command_line.subprocess.check_output\"",
",",
"return_value",
"=",
"b\"50\\n\"",
",",
")",
":",
... | [
37,
0
] | [
45,
47
] | python | en | ['en', 'en', 'en'] | True |
test_no_poll_when_cover_has_no_command_state | (hass: HomeAssistant) | Test that the cover does not polls when there's no state command. | Test that the cover does not polls when there's no state command. | async def test_no_poll_when_cover_has_no_command_state(hass: HomeAssistant) -> None:
"""Test that the cover does not polls when there's no state command."""
with patch(
"homeassistant.components.command_line.subprocess.check_output",
return_value=b"50\n",
) as check_output:
await se... | [
"async",
"def",
"test_no_poll_when_cover_has_no_command_state",
"(",
"hass",
":",
"HomeAssistant",
")",
"->",
"None",
":",
"with",
"patch",
"(",
"\"homeassistant.components.command_line.subprocess.check_output\"",
",",
"return_value",
"=",
"b\"50\\n\"",
",",
")",
"as",
"c... | [
48,
0
] | [
58,
38
] | python | en | ['en', 'en', 'en'] | True |
test_poll_when_cover_has_command_state | (hass: HomeAssistant) | Test that the cover polls when there's a state command. | Test that the cover polls when there's a state command. | async def test_poll_when_cover_has_command_state(hass: HomeAssistant) -> None:
"""Test that the cover polls when there's a state command."""
with patch(
"homeassistant.components.command_line.subprocess.check_output",
return_value=b"50\n",
) as check_output:
await setup_test_entity... | [
"async",
"def",
"test_poll_when_cover_has_command_state",
"(",
"hass",
":",
"HomeAssistant",
")",
"->",
"None",
":",
"with",
"patch",
"(",
"\"homeassistant.components.command_line.subprocess.check_output\"",
",",
"return_value",
"=",
"b\"50\\n\"",
",",
")",
"as",
"check_o... | [
61,
0
] | [
73,
9
] | python | en | ['en', 'en', 'en'] | True |
test_state_value | (hass: HomeAssistant) | Test with state value. | Test with state value. | async def test_state_value(hass: HomeAssistant) -> None:
"""Test with state value."""
with tempfile.TemporaryDirectory() as tempdirname:
path = os.path.join(tempdirname, "cover_status")
await setup_test_entity(
hass,
{
"test": {
"comman... | [
"async",
"def",
"test_state_value",
"(",
"hass",
":",
"HomeAssistant",
")",
"->",
"None",
":",
"with",
"tempfile",
".",
"TemporaryDirectory",
"(",
")",
"as",
"tempdirname",
":",
"path",
"=",
"os",
".",
"path",
".",
"join",
"(",
"tempdirname",
",",
"\"cover... | [
76,
0
] | [
116,
45
] | python | en | ['en', 'en', 'en'] | True |
test_reload | (hass: HomeAssistant) | Verify we can reload command_line covers. | Verify we can reload command_line covers. | async def test_reload(hass: HomeAssistant) -> None:
"""Verify we can reload command_line covers."""
await setup_test_entity(
hass,
{
"test": {
"command_state": "echo open",
"value_template": "{{ value }}",
}
},
)
entity_sta... | [
"async",
"def",
"test_reload",
"(",
"hass",
":",
"HomeAssistant",
")",
"->",
"None",
":",
"await",
"setup_test_entity",
"(",
"hass",
",",
"{",
"\"test\"",
":",
"{",
"\"command_state\"",
":",
"\"echo open\"",
",",
"\"value_template\"",
":",
"\"{{ value }}\"",
","... | [
119,
0
] | [
152,
45
] | python | en | ['en', 'en', 'en'] | True |
test_move_cover_failure | (caplog: Any, hass: HomeAssistant) | Test with state value. | Test with state value. | async def test_move_cover_failure(caplog: Any, hass: HomeAssistant) -> None:
"""Test with state value."""
await setup_test_entity(
hass,
{"test": {"command_open": "exit 1"}},
)
await hass.services.async_call(
DOMAIN, SERVICE_OPEN_COVER, {ATTR_ENTITY_ID: "cover.test"}, blocking=T... | [
"async",
"def",
"test_move_cover_failure",
"(",
"caplog",
":",
"Any",
",",
"hass",
":",
"HomeAssistant",
")",
"->",
"None",
":",
"await",
"setup_test_entity",
"(",
"hass",
",",
"{",
"\"test\"",
":",
"{",
"\"command_open\"",
":",
"\"exit 1\"",
"}",
"}",
",",
... | [
155,
0
] | [
165,
42
] | python | en | ['en', 'en', 'en'] | True |
device_reg | (hass) | Return an empty, loaded, registry. | Return an empty, loaded, registry. | def device_reg(hass):
"""Return an empty, loaded, registry."""
return mock_device_registry(hass) | [
"def",
"device_reg",
"(",
"hass",
")",
":",
"return",
"mock_device_registry",
"(",
"hass",
")"
] | [
23,
0
] | [
25,
37
] | python | en | ['en', 'fy', 'en'] | True |
calls | (hass) | Track calls to a mock service. | Track calls to a mock service. | def calls(hass):
"""Track calls to a mock service."""
return async_mock_service(hass, "test", "automation") | [
"def",
"calls",
"(",
"hass",
")",
":",
"return",
"async_mock_service",
"(",
"hass",
",",
"\"test\"",
",",
"\"automation\"",
")"
] | [
29,
0
] | [
31,
57
] | python | en | ['en', 'en', 'en'] | True |
test_get_triggers | (hass, mock_bridge, device_reg) | Test we get the expected triggers from a hue remote. | Test we get the expected triggers from a hue remote. | async def test_get_triggers(hass, mock_bridge, device_reg):
"""Test we get the expected triggers from a hue remote."""
mock_bridge.mock_sensor_responses.append(REMOTES_RESPONSE)
await setup_bridge(hass, mock_bridge)
assert len(mock_bridge.mock_requests) == 1
# 2 remotes, just 1 battery sensor
a... | [
"async",
"def",
"test_get_triggers",
"(",
"hass",
",",
"mock_bridge",
",",
"device_reg",
")",
":",
"mock_bridge",
".",
"mock_sensor_responses",
".",
"append",
"(",
"REMOTES_RESPONSE",
")",
"await",
"setup_bridge",
"(",
"hass",
",",
"mock_bridge",
")",
"assert",
... | [
34,
0
] | [
87,
50
] | python | en | ['en', 'en', 'en'] | True |
test_if_fires_on_state_change | (hass, mock_bridge, device_reg, calls) | Test for button press trigger firing. | Test for button press trigger firing. | async def test_if_fires_on_state_change(hass, mock_bridge, device_reg, calls):
"""Test for button press trigger firing."""
mock_bridge.mock_sensor_responses.append(REMOTES_RESPONSE)
await setup_bridge(hass, mock_bridge)
assert len(mock_bridge.mock_requests) == 1
assert len(hass.states.async_all()) =... | [
"async",
"def",
"test_if_fires_on_state_change",
"(",
"hass",
",",
"mock_bridge",
",",
"device_reg",
",",
"calls",
")",
":",
"mock_bridge",
".",
"mock_sensor_responses",
".",
"append",
"(",
"REMOTES_RESPONSE",
")",
"await",
"setup_bridge",
"(",
"hass",
",",
"mock_... | [
90,
0
] | [
170,
26
] | python | en | ['en', 'lb', 'en'] | True |
TestHelpersDiscovery.setup_method | (self, method) | Set up things to be run when tests are started. | Set up things to be run when tests are started. | def setup_method(self, method):
"""Set up things to be run when tests are started."""
self.hass = get_test_home_assistant() | [
"def",
"setup_method",
"(",
"self",
",",
"method",
")",
":",
"self",
".",
"hass",
"=",
"get_test_home_assistant",
"(",
")"
] | [
22,
4
] | [
24,
45
] | python | en | ['en', 'en', 'en'] | True |
TestHelpersDiscovery.teardown_method | (self, method) | Stop everything that was started. | Stop everything that was started. | def teardown_method(self, method):
"""Stop everything that was started."""
self.hass.stop() | [
"def",
"teardown_method",
"(",
"self",
",",
"method",
")",
":",
"self",
".",
"hass",
".",
"stop",
"(",
")"
] | [
26,
4
] | [
28,
24
] | python | en | ['en', 'en', 'en'] | True |
TestHelpersDiscovery.test_listen | (self, mock_setup_component) | Test discovery listen/discover combo. | Test discovery listen/discover combo. | def test_listen(self, mock_setup_component):
"""Test discovery listen/discover combo."""
helpers = self.hass.helpers
calls_single = []
@callback
def callback_single(service, info):
"""Service discovered callback."""
calls_single.append((service, info))
... | [
"def",
"test_listen",
"(",
"self",
",",
"mock_setup_component",
")",
":",
"helpers",
"=",
"self",
".",
"hass",
".",
"helpers",
"calls_single",
"=",
"[",
"]",
"@",
"callback",
"def",
"callback_single",
"(",
"service",
",",
"info",
")",
":",
"\"\"\"Service dis... | [
31,
4
] | [
57,
68
] | python | en | ['en', 'en', 'en'] | True |
TestHelpersDiscovery.test_platform | (self, mock_setup_component) | Test discover platform method. | Test discover platform method. | def test_platform(self, mock_setup_component):
"""Test discover platform method."""
calls = []
@callback
def platform_callback(platform, info):
"""Platform callback method."""
calls.append((platform, info))
run_callback_threadsafe(
self.hass.... | [
"def",
"test_platform",
"(",
"self",
",",
"mock_setup_component",
")",
":",
"calls",
"=",
"[",
"]",
"@",
"callback",
"def",
"platform_callback",
"(",
"platform",
",",
"info",
")",
":",
"\"\"\"Platform callback method.\"\"\"",
"calls",
".",
"append",
"(",
"(",
... | [
60,
4
] | [
112,
30
] | python | da | ['fr', 'da', 'en'] | False |
TestHelpersDiscovery.test_circular_import | (self) | Test we don't break doing circular import.
This test will have test_component discover the switch.test_circular
component while setting up.
The supplied config will load test_component and will load
switch.test_circular.
That means that after startup, we will have test_compone... | Test we don't break doing circular import. | def test_circular_import(self):
"""Test we don't break doing circular import.
This test will have test_component discover the switch.test_circular
component while setting up.
The supplied config will load test_component and will load
switch.test_circular.
That means th... | [
"def",
"test_circular_import",
"(",
"self",
")",
":",
"component_calls",
"=",
"[",
"]",
"platform_calls",
"=",
"[",
"]",
"def",
"component_setup",
"(",
"hass",
",",
"config",
")",
":",
"\"\"\"Set up mock component.\"\"\"",
"discovery",
".",
"load_platform",
"(",
... | [
114,
4
] | [
164,
54
] | python | en | ['en', 'no', 'en'] | True |
TestHelpersDiscovery.test_1st_discovers_2nd_component | (self, mock_signal) | Test that we don't break if one component discovers the other.
If the first component fires a discovery event to set up the
second component while the second component is about to be set up,
it should not set up the second component twice.
| Test that we don't break if one component discovers the other. | def test_1st_discovers_2nd_component(self, mock_signal):
"""Test that we don't break if one component discovers the other.
If the first component fires a discovery event to set up the
second component while the second component is about to be set up,
it should not set up the second comp... | [
"def",
"test_1st_discovers_2nd_component",
"(",
"self",
",",
"mock_signal",
")",
":",
"component_calls",
"=",
"[",
"]",
"async",
"def",
"component1_setup",
"(",
"hass",
",",
"config",
")",
":",
"\"\"\"Set up mock component.\"\"\"",
"print",
"(",
"\"component1 setup\""... | [
167,
4
] | [
211,
40
] | python | en | ['en', 'en', 'en'] | True |
VerifyFileExists | (directory, relative_path) | Verifies that the given file exists; aborts on failure.
relative_path is the file path relative to the given directory.
| Verifies that the given file exists; aborts on failure. | def VerifyFileExists(directory, relative_path):
"""Verifies that the given file exists; aborts on failure.
relative_path is the file path relative to the given directory.
"""
if not os.path.isfile(os.path.join(directory, relative_path)):
print('ERROR: Cannot find %s in directory %s.' % (relative_path,
... | [
"def",
"VerifyFileExists",
"(",
"directory",
",",
"relative_path",
")",
":",
"if",
"not",
"os",
".",
"path",
".",
"isfile",
"(",
"os",
".",
"path",
".",
"join",
"(",
"directory",
",",
"relative_path",
")",
")",
":",
"print",
"(",
"'ERROR: Cannot find %s in... | [
88,
0
] | [
99,
15
] | python | en | ['en', 'en', 'en'] | True |
ValidateGTestRootDir | (gtest_root) | Makes sure gtest_root points to a valid gtest root directory.
The function aborts the program on failure.
| Makes sure gtest_root points to a valid gtest root directory. | def ValidateGTestRootDir(gtest_root):
"""Makes sure gtest_root points to a valid gtest root directory.
The function aborts the program on failure.
"""
VerifyFileExists(gtest_root, GTEST_H_SEED)
VerifyFileExists(gtest_root, GTEST_ALL_CC_SEED) | [
"def",
"ValidateGTestRootDir",
"(",
"gtest_root",
")",
":",
"VerifyFileExists",
"(",
"gtest_root",
",",
"GTEST_H_SEED",
")",
"VerifyFileExists",
"(",
"gtest_root",
",",
"GTEST_ALL_CC_SEED",
")"
] | [
102,
0
] | [
109,
49
] | python | en | ['en', 'en', 'en'] | True |
VerifyOutputFile | (output_dir, relative_path) | Verifies that the given output file path is valid.
relative_path is relative to the output_dir directory.
| Verifies that the given output file path is valid. | def VerifyOutputFile(output_dir, relative_path):
"""Verifies that the given output file path is valid.
relative_path is relative to the output_dir directory.
"""
# Makes sure the output file either doesn't exist or can be overwritten.
output_file = os.path.join(output_dir, relative_path)
if os.path.exists... | [
"def",
"VerifyOutputFile",
"(",
"output_dir",
",",
"relative_path",
")",
":",
"# Makes sure the output file either doesn't exist or can be overwritten.",
"output_file",
"=",
"os",
".",
"path",
".",
"join",
"(",
"output_dir",
",",
"relative_path",
")",
"if",
"os",
".",
... | [
112,
0
] | [
135,
33
] | python | en | ['en', 'en', 'en'] | True |
ValidateOutputDir | (output_dir) | Makes sure output_dir points to a valid output directory.
The function aborts the program on failure.
| Makes sure output_dir points to a valid output directory. | def ValidateOutputDir(output_dir):
"""Makes sure output_dir points to a valid output directory.
The function aborts the program on failure.
"""
VerifyOutputFile(output_dir, GTEST_H_OUTPUT)
VerifyOutputFile(output_dir, GTEST_ALL_CC_OUTPUT) | [
"def",
"ValidateOutputDir",
"(",
"output_dir",
")",
":",
"VerifyOutputFile",
"(",
"output_dir",
",",
"GTEST_H_OUTPUT",
")",
"VerifyOutputFile",
"(",
"output_dir",
",",
"GTEST_ALL_CC_OUTPUT",
")"
] | [
138,
0
] | [
145,
51
] | python | en | ['en', 'en', 'en'] | True |
FuseGTestH | (gtest_root, output_dir) | Scans folder gtest_root to generate gtest/gtest.h in output_dir. | Scans folder gtest_root to generate gtest/gtest.h in output_dir. | def FuseGTestH(gtest_root, output_dir):
"""Scans folder gtest_root to generate gtest/gtest.h in output_dir."""
output_file = open(os.path.join(output_dir, GTEST_H_OUTPUT), 'w')
processed_files = set() # Holds all gtest headers we've processed.
def ProcessFile(gtest_header_path):
"""Processes the given gt... | [
"def",
"FuseGTestH",
"(",
"gtest_root",
",",
"output_dir",
")",
":",
"output_file",
"=",
"open",
"(",
"os",
".",
"path",
".",
"join",
"(",
"output_dir",
",",
"GTEST_H_OUTPUT",
")",
",",
"'w'",
")",
"processed_files",
"=",
"set",
"(",
")",
"# Holds all gtes... | [
148,
0
] | [
174,
21
] | python | en | ['af', 'en', 'en'] | True |
FuseGTestAllCcToFile | (gtest_root, output_file) | Scans folder gtest_root to generate gtest/gtest-all.cc in output_file. | Scans folder gtest_root to generate gtest/gtest-all.cc in output_file. | def FuseGTestAllCcToFile(gtest_root, output_file):
"""Scans folder gtest_root to generate gtest/gtest-all.cc in output_file."""
processed_files = set()
def ProcessFile(gtest_source_file):
"""Processes the given gtest source file."""
# We don't process the same #included file twice.
if gtest_source_... | [
"def",
"FuseGTestAllCcToFile",
"(",
"gtest_root",
",",
"output_file",
")",
":",
"processed_files",
"=",
"set",
"(",
")",
"def",
"ProcessFile",
"(",
"gtest_source_file",
")",
":",
"\"\"\"Processes the given gtest source file.\"\"\"",
"# We don't process the same #included file... | [
177,
0
] | [
217,
32
] | python | en | ['af', 'en', 'en'] | True |
FuseGTestAllCc | (gtest_root, output_dir) | Scans folder gtest_root to generate gtest/gtest-all.cc in output_dir. | Scans folder gtest_root to generate gtest/gtest-all.cc in output_dir. | def FuseGTestAllCc(gtest_root, output_dir):
"""Scans folder gtest_root to generate gtest/gtest-all.cc in output_dir."""
output_file = open(os.path.join(output_dir, GTEST_ALL_CC_OUTPUT), 'w')
FuseGTestAllCcToFile(gtest_root, output_file)
output_file.close() | [
"def",
"FuseGTestAllCc",
"(",
"gtest_root",
",",
"output_dir",
")",
":",
"output_file",
"=",
"open",
"(",
"os",
".",
"path",
".",
"join",
"(",
"output_dir",
",",
"GTEST_ALL_CC_OUTPUT",
")",
",",
"'w'",
")",
"FuseGTestAllCcToFile",
"(",
"gtest_root",
",",
"ou... | [
220,
0
] | [
225,
21
] | python | en | ['af', 'en', 'en'] | True |
FuseGTest | (gtest_root, output_dir) | Fuses gtest.h and gtest-all.cc. | Fuses gtest.h and gtest-all.cc. | def FuseGTest(gtest_root, output_dir):
"""Fuses gtest.h and gtest-all.cc."""
ValidateGTestRootDir(gtest_root)
ValidateOutputDir(output_dir)
FuseGTestH(gtest_root, output_dir)
FuseGTestAllCc(gtest_root, output_dir) | [
"def",
"FuseGTest",
"(",
"gtest_root",
",",
"output_dir",
")",
":",
"ValidateGTestRootDir",
"(",
"gtest_root",
")",
"ValidateOutputDir",
"(",
"output_dir",
")",
"FuseGTestH",
"(",
"gtest_root",
",",
"output_dir",
")",
"FuseGTestAllCc",
"(",
"gtest_root",
",",
"out... | [
228,
0
] | [
235,
40
] | python | en | ['en', 'en', 'en'] | True |
unique_id | (webhook_id, sensor_unique_id) | Return a unique sensor ID. | Return a unique sensor ID. | def unique_id(webhook_id, sensor_unique_id):
"""Return a unique sensor ID."""
return f"{webhook_id}_{sensor_unique_id}" | [
"def",
"unique_id",
"(",
"webhook_id",
",",
"sensor_unique_id",
")",
":",
"return",
"f\"{webhook_id}_{sensor_unique_id}\""
] | [
20,
0
] | [
22,
45
] | python | ca | ['ca', 'ca', 'en'] | True |
MobileAppEntity.__init__ | (self, config: dict, device: DeviceEntry, entry: ConfigEntry) | Initialize the entity. | Initialize the entity. | def __init__(self, config: dict, device: DeviceEntry, entry: ConfigEntry) -> None:
"""Initialize the entity."""
self._config = config
self._device = device
self._entry = entry
self._registration = entry.data
self._unique_id = config[CONF_UNIQUE_ID]
self._entity_ty... | [
"def",
"__init__",
"(",
"self",
",",
"config",
":",
"dict",
",",
"device",
":",
"DeviceEntry",
",",
"entry",
":",
"ConfigEntry",
")",
"->",
"None",
":",
"self",
".",
"_config",
"=",
"config",
"self",
".",
"_device",
"=",
"device",
"self",
".",
"_entry"... | [
28,
4
] | [
36,
38
] | python | en | ['en', 'en', 'en'] | True |
MobileAppEntity.async_added_to_hass | (self) | Register callbacks. | Register callbacks. | async def async_added_to_hass(self):
"""Register callbacks."""
self.async_on_remove(
async_dispatcher_connect(
self.hass, SIGNAL_SENSOR_UPDATE, self._handle_update
)
)
state = await self.async_get_last_state()
if state is None:
... | [
"async",
"def",
"async_added_to_hass",
"(",
"self",
")",
":",
"self",
".",
"async_on_remove",
"(",
"async_dispatcher_connect",
"(",
"self",
".",
"hass",
",",
"SIGNAL_SENSOR_UPDATE",
",",
"self",
".",
"_handle_update",
")",
")",
"state",
"=",
"await",
"self",
"... | [
38,
4
] | [
50,
44
] | python | en | ['en', 'no', 'en'] | False |
MobileAppEntity.async_restore_last_state | (self, last_state) | Restore previous state. | Restore previous state. | def async_restore_last_state(self, last_state):
"""Restore previous state."""
self._config[ATTR_SENSOR_STATE] = last_state.state
self._config[ATTR_SENSOR_ATTRIBUTES] = {
**last_state.attributes,
**self._config[ATTR_SENSOR_ATTRIBUTES],
}
if ATTR_ICON in las... | [
"def",
"async_restore_last_state",
"(",
"self",
",",
"last_state",
")",
":",
"self",
".",
"_config",
"[",
"ATTR_SENSOR_STATE",
"]",
"=",
"last_state",
".",
"state",
"self",
".",
"_config",
"[",
"ATTR_SENSOR_ATTRIBUTES",
"]",
"=",
"{",
"*",
"*",
"last_state",
... | [
53,
4
] | [
61,
77
] | python | it | ['it', 'it', 'en'] | True |
MobileAppEntity.should_poll | (self) | Declare that this entity pushes its state to HA. | Declare that this entity pushes its state to HA. | def should_poll(self) -> bool:
"""Declare that this entity pushes its state to HA."""
return False | [
"def",
"should_poll",
"(",
"self",
")",
"->",
"bool",
":",
"return",
"False"
] | [
64,
4
] | [
66,
20
] | python | en | ['en', 'en', 'en'] | True |
MobileAppEntity.name | (self) | Return the name of the mobile app sensor. | Return the name of the mobile app sensor. | def name(self):
"""Return the name of the mobile app sensor."""
return self._name | [
"def",
"name",
"(",
"self",
")",
":",
"return",
"self",
".",
"_name"
] | [
69,
4
] | [
71,
25
] | python | en | ['en', 'no', 'en'] | True |
MobileAppEntity.device_class | (self) | Return the device class. | Return the device class. | def device_class(self):
"""Return the device class."""
return self._config.get(ATTR_SENSOR_DEVICE_CLASS) | [
"def",
"device_class",
"(",
"self",
")",
":",
"return",
"self",
".",
"_config",
".",
"get",
"(",
"ATTR_SENSOR_DEVICE_CLASS",
")"
] | [
74,
4
] | [
76,
57
] | python | en | ['en', 'en', 'en'] | True |
MobileAppEntity.extra_state_attributes | (self) | Return the device state attributes. | Return the device state attributes. | def extra_state_attributes(self):
"""Return the device state attributes."""
return self._config[ATTR_SENSOR_ATTRIBUTES] | [
"def",
"extra_state_attributes",
"(",
"self",
")",
":",
"return",
"self",
".",
"_config",
"[",
"ATTR_SENSOR_ATTRIBUTES",
"]"
] | [
79,
4
] | [
81,
51
] | python | en | ['en', 'en', 'en'] | True |
MobileAppEntity.icon | (self) | Return the icon to use in the frontend, if any. | Return the icon to use in the frontend, if any. | def icon(self):
"""Return the icon to use in the frontend, if any."""
return self._config[ATTR_SENSOR_ICON] | [
"def",
"icon",
"(",
"self",
")",
":",
"return",
"self",
".",
"_config",
"[",
"ATTR_SENSOR_ICON",
"]"
] | [
84,
4
] | [
86,
45
] | python | en | ['en', 'en', 'en'] | True |
MobileAppEntity.unique_id | (self) | Return the unique ID of this sensor. | Return the unique ID of this sensor. | def unique_id(self):
"""Return the unique ID of this sensor."""
return self._unique_id | [
"def",
"unique_id",
"(",
"self",
")",
":",
"return",
"self",
".",
"_unique_id"
] | [
89,
4
] | [
91,
30
] | python | en | ['en', 'la', 'en'] | True |
MobileAppEntity.device_info | (self) | Return device registry information for this entity. | Return device registry information for this entity. | def device_info(self):
"""Return device registry information for this entity."""
return device_info(self._registration) | [
"def",
"device_info",
"(",
"self",
")",
":",
"return",
"device_info",
"(",
"self",
".",
"_registration",
")"
] | [
94,
4
] | [
96,
46
] | python | en | ['en', 'en', 'en'] | True |
MobileAppEntity._handle_update | (self, data) | Handle async event updates. | Handle async event updates. | def _handle_update(self, data):
"""Handle async event updates."""
incoming_id = unique_id(data[CONF_WEBHOOK_ID], data[ATTR_SENSOR_UNIQUE_ID])
if incoming_id != self._unique_id:
return
self._config = {**self._config, **data}
self.async_write_ha_state() | [
"def",
"_handle_update",
"(",
"self",
",",
"data",
")",
":",
"incoming_id",
"=",
"unique_id",
"(",
"data",
"[",
"CONF_WEBHOOK_ID",
"]",
",",
"data",
"[",
"ATTR_SENSOR_UNIQUE_ID",
"]",
")",
"if",
"incoming_id",
"!=",
"self",
".",
"_unique_id",
":",
"return",
... | [
99,
4
] | [
106,
35
] | python | en | ['fr', 'en', 'en'] | True |
get_scanner | (hass, config) | Return the Arris device scanner. | Return the Arris device scanner. | def get_scanner(hass, config):
"""Return the Arris device scanner."""
conf = config[DOMAIN]
url = f"http://{conf[CONF_HOST]}"
connect_box = ConnectBox(url, conf[CONF_PASSWORD])
return ArrisDeviceScanner(connect_box) | [
"def",
"get_scanner",
"(",
"hass",
",",
"config",
")",
":",
"conf",
"=",
"config",
"[",
"DOMAIN",
"]",
"url",
"=",
"f\"http://{conf[CONF_HOST]}\"",
"connect_box",
"=",
"ConnectBox",
"(",
"url",
",",
"conf",
"[",
"CONF_PASSWORD",
"]",
")",
"return",
"ArrisDev... | [
24,
0
] | [
29,
42
] | python | en | ['en', 'en', 'en'] | True |
ArrisDeviceScanner.__init__ | (self, connect_box: ConnectBox) | Initialize the scanner. | Initialize the scanner. | def __init__(self, connect_box: ConnectBox) -> None:
"""Initialize the scanner."""
self.connect_box = connect_box
self.last_results: list[Device] = [] | [
"def",
"__init__",
"(",
"self",
",",
"connect_box",
":",
"ConnectBox",
")",
"->",
"None",
":",
"self",
".",
"connect_box",
"=",
"connect_box",
"self",
".",
"last_results",
":",
"list",
"[",
"Device",
"]",
"=",
"[",
"]"
] | [
35,
4
] | [
38,
44
] | python | en | ['en', 'en', 'en'] | True |
ArrisDeviceScanner.scan_devices | (self) | Scan for new devices and return a list with found device IDs. | Scan for new devices and return a list with found device IDs. | def scan_devices(self):
"""Scan for new devices and return a list with found device IDs."""
self._update_info()
return [device.mac for device in self.last_results] | [
"def",
"scan_devices",
"(",
"self",
")",
":",
"self",
".",
"_update_info",
"(",
")",
"return",
"[",
"device",
".",
"mac",
"for",
"device",
"in",
"self",
".",
"last_results",
"]"
] | [
40,
4
] | [
44,
59
] | python | en | ['en', 'en', 'en'] | True |
ArrisDeviceScanner.get_device_name | (self, device) | Return the name of the given device or None if we don't know. | Return the name of the given device or None if we don't know. | def get_device_name(self, device):
"""Return the name of the given device or None if we don't know."""
name = next(
(result.hostname for result in self.last_results if result.mac == device),
None,
)
return name | [
"def",
"get_device_name",
"(",
"self",
",",
"device",
")",
":",
"name",
"=",
"next",
"(",
"(",
"result",
".",
"hostname",
"for",
"result",
"in",
"self",
".",
"last_results",
"if",
"result",
".",
"mac",
"==",
"device",
")",
",",
"None",
",",
")",
"ret... | [
46,
4
] | [
52,
19
] | python | en | ['en', 'en', 'en'] | True |
ArrisDeviceScanner._update_info | (self) | Ensure the information from the Arris TG2492LG router is up to date. | Ensure the information from the Arris TG2492LG router is up to date. | def _update_info(self):
"""Ensure the information from the Arris TG2492LG router is up to date."""
result = self.connect_box.get_connected_devices()
last_results = []
mac_addresses = set()
for device in result:
if device.online and device.mac not in mac_addresses:
... | [
"def",
"_update_info",
"(",
"self",
")",
":",
"result",
"=",
"self",
".",
"connect_box",
".",
"get_connected_devices",
"(",
")",
"last_results",
"=",
"[",
"]",
"mac_addresses",
"=",
"set",
"(",
")",
"for",
"device",
"in",
"result",
":",
"if",
"device",
"... | [
54,
4
] | [
66,
40
] | python | en | ['en', 'en', 'en'] | True |
async_setup | (hass, config) | Set up the image processing. | Set up the image processing. | async def async_setup(hass, config):
"""Set up the image processing."""
component = EntityComponent(_LOGGER, DOMAIN, hass, SCAN_INTERVAL)
await component.async_setup(config)
async def async_scan_service(service):
"""Service handler for scan."""
image_entities = await component.async_ex... | [
"async",
"def",
"async_setup",
"(",
"hass",
",",
"config",
")",
":",
"component",
"=",
"EntityComponent",
"(",
"_LOGGER",
",",
"DOMAIN",
",",
"hass",
",",
"SCAN_INTERVAL",
")",
"await",
"component",
".",
"async_setup",
"(",
"config",
")",
"async",
"def",
"... | [
71,
0
] | [
93,
15
] | python | en | ['en', 'en', 'en'] | True |
ImageProcessingEntity.camera_entity | (self) | Return camera entity id from process pictures. | Return camera entity id from process pictures. | def camera_entity(self):
"""Return camera entity id from process pictures."""
return None | [
"def",
"camera_entity",
"(",
"self",
")",
":",
"return",
"None"
] | [
102,
4
] | [
104,
19
] | python | en | ['en', 'en', 'en'] | True |
ImageProcessingEntity.confidence | (self) | Return minimum confidence for do some things. | Return minimum confidence for do some things. | def confidence(self):
"""Return minimum confidence for do some things."""
return None | [
"def",
"confidence",
"(",
"self",
")",
":",
"return",
"None"
] | [
107,
4
] | [
109,
19
] | python | en | ['en', 'en', 'en'] | True |
ImageProcessingEntity.process_image | (self, image) | Process image. | Process image. | def process_image(self, image):
"""Process image."""
raise NotImplementedError() | [
"def",
"process_image",
"(",
"self",
",",
"image",
")",
":",
"raise",
"NotImplementedError",
"(",
")"
] | [
111,
4
] | [
113,
35
] | python | en | ['en', 'ny', 'en'] | False |
ImageProcessingEntity.async_process_image | (self, image) | Process image. | Process image. | async def async_process_image(self, image):
"""Process image."""
return await self.hass.async_add_executor_job(self.process_image, image) | [
"async",
"def",
"async_process_image",
"(",
"self",
",",
"image",
")",
":",
"return",
"await",
"self",
".",
"hass",
".",
"async_add_executor_job",
"(",
"self",
".",
"process_image",
",",
"image",
")"
] | [
115,
4
] | [
117,
80
] | python | en | ['en', 'ny', 'en'] | False |
ImageProcessingEntity.async_update | (self) | Update image and process it.
This method is a coroutine.
| Update image and process it. | async def async_update(self):
"""Update image and process it.
This method is a coroutine.
"""
camera = self.hass.components.camera
image = None
try:
image = await camera.async_get_image(
self.camera_entity, timeout=self.timeout
)
... | [
"async",
"def",
"async_update",
"(",
"self",
")",
":",
"camera",
"=",
"self",
".",
"hass",
".",
"components",
".",
"camera",
"image",
"=",
"None",
"try",
":",
"image",
"=",
"await",
"camera",
".",
"async_get_image",
"(",
"self",
".",
"camera_entity",
","... | [
119,
4
] | [
137,
53
] | python | en | ['en', 'en', 'en'] | True |
ImageProcessingFaceEntity.__init__ | (self) | Initialize base face identify/verify entity. | Initialize base face identify/verify entity. | def __init__(self):
"""Initialize base face identify/verify entity."""
self.faces = []
self.total_faces = 0 | [
"def",
"__init__",
"(",
"self",
")",
":",
"self",
".",
"faces",
"=",
"[",
"]",
"self",
".",
"total_faces",
"=",
"0"
] | [
143,
4
] | [
146,
28
] | python | en | ['en', 'cs', 'en'] | True |
ImageProcessingFaceEntity.state | (self) | Return the state of the entity. | Return the state of the entity. | def state(self):
"""Return the state of the entity."""
confidence = 0
state = None
# No confidence support
if not self.confidence:
return self.total_faces
# Search high confidence
for face in self.faces:
if ATTR_CONFIDENCE not in face:
... | [
"def",
"state",
"(",
"self",
")",
":",
"confidence",
"=",
"0",
"state",
"=",
"None",
"# No confidence support",
"if",
"not",
"self",
".",
"confidence",
":",
"return",
"self",
".",
"total_faces",
"# Search high confidence",
"for",
"face",
"in",
"self",
".",
"... | [
149,
4
] | [
171,
20
] | python | en | ['en', 'en', 'en'] | True |
ImageProcessingFaceEntity.device_class | (self) | Return the class of this device, from component DEVICE_CLASSES. | Return the class of this device, from component DEVICE_CLASSES. | def device_class(self):
"""Return the class of this device, from component DEVICE_CLASSES."""
return "face" | [
"def",
"device_class",
"(",
"self",
")",
":",
"return",
"\"face\""
] | [
174,
4
] | [
176,
21
] | python | en | ['en', 'en', 'en'] | True |
ImageProcessingFaceEntity.state_attributes | (self) | Return device specific state attributes. | Return device specific state attributes. | def state_attributes(self):
"""Return device specific state attributes."""
return {ATTR_FACES: self.faces, ATTR_TOTAL_FACES: self.total_faces} | [
"def",
"state_attributes",
"(",
"self",
")",
":",
"return",
"{",
"ATTR_FACES",
":",
"self",
".",
"faces",
",",
"ATTR_TOTAL_FACES",
":",
"self",
".",
"total_faces",
"}"
] | [
180,
4
] | [
182,
75
] | python | en | ['fr', 'en', 'en'] | True |
ImageProcessingFaceEntity.process_faces | (self, faces, total) | Send event with detected faces and store data. | Send event with detected faces and store data. | def process_faces(self, faces, total):
"""Send event with detected faces and store data."""
run_callback_threadsafe(
self.hass.loop, self.async_process_faces, faces, total
).result() | [
"def",
"process_faces",
"(",
"self",
",",
"faces",
",",
"total",
")",
":",
"run_callback_threadsafe",
"(",
"self",
".",
"hass",
".",
"loop",
",",
"self",
".",
"async_process_faces",
",",
"faces",
",",
"total",
")",
".",
"result",
"(",
")"
] | [
184,
4
] | [
188,
18
] | python | en | ['en', 'en', 'en'] | True |
ImageProcessingFaceEntity.async_process_faces | (self, faces, total) | Send event with detected faces and store data.
known are a dict in follow format:
[
{
ATTR_CONFIDENCE: 80,
ATTR_NAME: 'Name',
ATTR_AGE: 12.0,
ATTR_GENDER: 'man',
ATTR_MOTION: 'smile',
ATTR_GLASSES: 'sunglass... | Send event with detected faces and store data. | def async_process_faces(self, faces, total):
"""Send event with detected faces and store data.
known are a dict in follow format:
[
{
ATTR_CONFIDENCE: 80,
ATTR_NAME: 'Name',
ATTR_AGE: 12.0,
ATTR_GENDER: 'man',
ATT... | [
"def",
"async_process_faces",
"(",
"self",
",",
"faces",
",",
"total",
")",
":",
"# Send events",
"for",
"face",
"in",
"faces",
":",
"if",
"(",
"ATTR_CONFIDENCE",
"in",
"face",
"and",
"self",
".",
"confidence",
"and",
"face",
"[",
"ATTR_CONFIDENCE",
"]",
"... | [
191,
4
] | [
222,
32
] | 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_user_flow_cannot_create_multiple_instances | (hass) | Test that the user flow aborts if an instance is already configured. | Test that the user flow aborts if an instance is already configured. | async def test_user_flow_cannot_create_multiple_instances(hass):
"""Test that the user flow aborts if an instance is already configured."""
entry = MockConfigEntry(
domain=DOMAIN, data={CONF_DEVICE: "/already/configured/path"}
)
entry.add_to_hass(hass)
with patch(DONGLE_VALIDATE_PATH_METHOD... | [
"async",
"def",
"test_user_flow_cannot_create_multiple_instances",
"(",
"hass",
")",
":",
"entry",
"=",
"MockConfigEntry",
"(",
"domain",
"=",
"DOMAIN",
",",
"data",
"=",
"{",
"CONF_DEVICE",
":",
"\"/already/configured/path\"",
"}",
")",
"entry",
".",
"add_to_hass",... | [
14,
0
] | [
27,
56
] | python | en | ['en', 'en', 'en'] | True |
test_user_flow_with_detected_dongle | (hass) | Test the user flow with a detected ENOcean dongle. | Test the user flow with a detected ENOcean dongle. | async def test_user_flow_with_detected_dongle(hass):
"""Test the user flow with a detected ENOcean dongle."""
FAKE_DONGLE_PATH = "/fake/dongle"
with patch(DONGLE_DETECT_METHOD, Mock(return_value=[FAKE_DONGLE_PATH])):
result = await hass.config_entries.flow.async_init(
DOMAIN, context={"... | [
"async",
"def",
"test_user_flow_with_detected_dongle",
"(",
"hass",
")",
":",
"FAKE_DONGLE_PATH",
"=",
"\"/fake/dongle\"",
"with",
"patch",
"(",
"DONGLE_DETECT_METHOD",
",",
"Mock",
"(",
"return_value",
"=",
"[",
"FAKE_DONGLE_PATH",
"]",
")",
")",
":",
"result",
"... | [
30,
0
] | [
43,
58
] | python | en | ['en', 'en', 'en'] | True |
test_user_flow_with_no_detected_dongle | (hass) | Test the user flow with a detected ENOcean dongle. | Test the user flow with a detected ENOcean dongle. | async def test_user_flow_with_no_detected_dongle(hass):
"""Test the user flow with a detected ENOcean dongle."""
with patch(DONGLE_DETECT_METHOD, Mock(return_value=[])):
result = await hass.config_entries.flow.async_init(
DOMAIN, context={"source": config_entries.SOURCE_USER}
)
... | [
"async",
"def",
"test_user_flow_with_no_detected_dongle",
"(",
"hass",
")",
":",
"with",
"patch",
"(",
"DONGLE_DETECT_METHOD",
",",
"Mock",
"(",
"return_value",
"=",
"[",
"]",
")",
")",
":",
"result",
"=",
"await",
"hass",
".",
"config_entries",
".",
"flow",
... | [
46,
0
] | [
54,
40
] | python | en | ['en', 'en', 'en'] | True |
test_detection_flow_with_valid_path | (hass) | Test the detection flow with a valid path selected. | Test the detection flow with a valid path selected. | async def test_detection_flow_with_valid_path(hass):
"""Test the detection flow with a valid path selected."""
USER_PROVIDED_PATH = "/user/provided/path"
with patch(DONGLE_VALIDATE_PATH_METHOD, Mock(return_value=True)):
result = await hass.config_entries.flow.async_init(
DOMAIN, context... | [
"async",
"def",
"test_detection_flow_with_valid_path",
"(",
"hass",
")",
":",
"USER_PROVIDED_PATH",
"=",
"\"/user/provided/path\"",
"with",
"patch",
"(",
"DONGLE_VALIDATE_PATH_METHOD",
",",
"Mock",
"(",
"return_value",
"=",
"True",
")",
")",
":",
"result",
"=",
"awa... | [
57,
0
] | [
67,
60
] | python | en | ['en', 'en', 'en'] | True |
test_detection_flow_with_custom_path | (hass) | Test the detection flow with custom path selected. | Test the detection flow with custom path selected. | async def test_detection_flow_with_custom_path(hass):
"""Test the detection flow with custom path selected."""
USER_PROVIDED_PATH = EnOceanFlowHandler.MANUAL_PATH_VALUE
FAKE_DONGLE_PATH = "/fake/dongle"
with patch(DONGLE_VALIDATE_PATH_METHOD, Mock(return_value=True)), patch(
DONGLE_DETECT_METHO... | [
"async",
"def",
"test_detection_flow_with_custom_path",
"(",
"hass",
")",
":",
"USER_PROVIDED_PATH",
"=",
"EnOceanFlowHandler",
".",
"MANUAL_PATH_VALUE",
"FAKE_DONGLE_PATH",
"=",
"\"/fake/dongle\"",
"with",
"patch",
"(",
"DONGLE_VALIDATE_PATH_METHOD",
",",
"Mock",
"(",
"r... | [
70,
0
] | [
85,
40
] | python | en | ['en', 'en', 'en'] | True |
test_detection_flow_with_invalid_path | (hass) | Test the detection flow with an invalid path selected. | Test the detection flow with an invalid path selected. | async def test_detection_flow_with_invalid_path(hass):
"""Test the detection flow with an invalid path selected."""
USER_PROVIDED_PATH = "/invalid/path"
FAKE_DONGLE_PATH = "/fake/dongle"
with patch(DONGLE_VALIDATE_PATH_METHOD, Mock(return_value=False)), patch(
DONGLE_DETECT_METHOD, Mock(return_... | [
"async",
"def",
"test_detection_flow_with_invalid_path",
"(",
"hass",
")",
":",
"USER_PROVIDED_PATH",
"=",
"\"/invalid/path\"",
"FAKE_DONGLE_PATH",
"=",
"\"/fake/dongle\"",
"with",
"patch",
"(",
"DONGLE_VALIDATE_PATH_METHOD",
",",
"Mock",
"(",
"return_value",
"=",
"False"... | [
88,
0
] | [
104,
42
] | python | en | ['en', 'en', 'en'] | True |
test_manual_flow_with_valid_path | (hass) | Test the manual flow with a valid path. | Test the manual flow with a valid path. | async def test_manual_flow_with_valid_path(hass):
"""Test the manual flow with a valid path."""
USER_PROVIDED_PATH = "/user/provided/path"
with patch(DONGLE_VALIDATE_PATH_METHOD, Mock(return_value=True)):
result = await hass.config_entries.flow.async_init(
DOMAIN, context={"source": "ma... | [
"async",
"def",
"test_manual_flow_with_valid_path",
"(",
"hass",
")",
":",
"USER_PROVIDED_PATH",
"=",
"\"/user/provided/path\"",
"with",
"patch",
"(",
"DONGLE_VALIDATE_PATH_METHOD",
",",
"Mock",
"(",
"return_value",
"=",
"True",
")",
")",
":",
"result",
"=",
"await"... | [
107,
0
] | [
117,
60
] | python | en | ['en', 'en', 'en'] | True |
test_manual_flow_with_invalid_path | (hass) | Test the manual flow with an invalid path. | Test the manual flow with an invalid path. | async def test_manual_flow_with_invalid_path(hass):
"""Test the manual flow with an invalid path."""
USER_PROVIDED_PATH = "/user/provided/path"
with patch(
DONGLE_VALIDATE_PATH_METHOD,
Mock(return_value=False),
):
result = await hass.config_entries.flow.async_init(
D... | [
"async",
"def",
"test_manual_flow_with_invalid_path",
"(",
"hass",
")",
":",
"USER_PROVIDED_PATH",
"=",
"\"/user/provided/path\"",
"with",
"patch",
"(",
"DONGLE_VALIDATE_PATH_METHOD",
",",
"Mock",
"(",
"return_value",
"=",
"False",
")",
",",
")",
":",
"result",
"=",... | [
120,
0
] | [
134,
42
] | python | en | ['en', 'en', 'en'] | True |
test_import_flow_with_valid_path | (hass) | Test the import flow with a valid path. | Test the import flow with a valid path. | async def test_import_flow_with_valid_path(hass):
"""Test the import flow with a valid path."""
DATA_TO_IMPORT = {CONF_DEVICE: "/valid/path/to/import"}
with patch(DONGLE_VALIDATE_PATH_METHOD, Mock(return_value=True)):
result = await hass.config_entries.flow.async_init(
DOMAIN,
... | [
"async",
"def",
"test_import_flow_with_valid_path",
"(",
"hass",
")",
":",
"DATA_TO_IMPORT",
"=",
"{",
"CONF_DEVICE",
":",
"\"/valid/path/to/import\"",
"}",
"with",
"patch",
"(",
"DONGLE_VALIDATE_PATH_METHOD",
",",
"Mock",
"(",
"return_value",
"=",
"True",
")",
")",... | [
137,
0
] | [
149,
69
] | python | en | ['en', 'en', 'en'] | True |
test_import_flow_with_invalid_path | (hass) | Test the import flow with an invalid path. | Test the import flow with an invalid path. | async def test_import_flow_with_invalid_path(hass):
"""Test the import flow with an invalid path."""
DATA_TO_IMPORT = {CONF_DEVICE: "/invalid/path/to/import"}
with patch(
DONGLE_VALIDATE_PATH_METHOD,
Mock(return_value=False),
):
result = await hass.config_entries.flow.async_init... | [
"async",
"def",
"test_import_flow_with_invalid_path",
"(",
"hass",
")",
":",
"DATA_TO_IMPORT",
"=",
"{",
"CONF_DEVICE",
":",
"\"/invalid/path/to/import\"",
"}",
"with",
"patch",
"(",
"DONGLE_VALIDATE_PATH_METHOD",
",",
"Mock",
"(",
"return_value",
"=",
"False",
")",
... | [
152,
0
] | [
167,
52
] | python | en | ['en', 'en', 'en'] | True |
async_setup | (hass: HomeAssistant, config: ConfigType) | Set up the Coronavirus component. | Set up the Coronavirus component. | async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
"""Set up the Coronavirus component."""
# Make sure coordinator is initialized.
await get_coordinator(hass)
return True | [
"async",
"def",
"async_setup",
"(",
"hass",
":",
"HomeAssistant",
",",
"config",
":",
"ConfigType",
")",
"->",
"bool",
":",
"# Make sure coordinator is initialized.",
"await",
"get_coordinator",
"(",
"hass",
")",
"return",
"True"
] | [
17,
0
] | [
21,
15
] | python | en | ['en', 'sn', 'en'] | True |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.