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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
ArcamFmj.media_title | (self) | Title of current playing media. | Title of current playing media. | def media_title(self):
"""Title of current playing media."""
source = self._state.get_source()
if source is None:
return None
channel = self.media_channel
if channel:
value = f"{source.name} - {channel}"
else:
value = source.name
... | [
"def",
"media_title",
"(",
"self",
")",
":",
"source",
"=",
"self",
".",
"_state",
".",
"get_source",
"(",
")",
"if",
"source",
"is",
"None",
":",
"return",
"None",
"channel",
"=",
"self",
".",
"media_channel",
"if",
"channel",
":",
"value",
"=",
"f\"{... | [
371,
4
] | [
383,
20
] | python | en | ['en', 'en', 'en'] | True |
DeserializationTests.test_enum_test | (self) | deserialize dict(str, Enum_Test) | deserialize dict(str, Enum_Test) | def test_enum_test(self):
""" deserialize dict(str, Enum_Test) """
data = {
'enum_test': {
"enum_string": "UPPER",
"enum_string_required": "lower",
"enum_integer": 1,
"enum_number": 1.1,
"stringEnum": "placed"
... | [
"def",
"test_enum_test",
"(",
"self",
")",
":",
"data",
"=",
"{",
"'enum_test'",
":",
"{",
"\"enum_string\"",
":",
"\"UPPER\"",
",",
"\"enum_string_required\"",
":",
"\"lower\"",
",",
"\"enum_integer\"",
":",
"1",
",",
"\"enum_number\"",
":",
"1.1",
",",
"\"st... | [
53,
4
] | [
81,
68
] | python | fr | ['it', 'la', 'fr'] | False |
DeserializationTests.test_deserialize_dict_str_pet | (self) | deserialize dict(str, Pet) | deserialize dict(str, Pet) | def test_deserialize_dict_str_pet(self):
""" deserialize dict(str, Pet) """
data = {
'pet': {
"id": 0,
"category": {
"id": 0,
"name": "string"
},
"name": "doggie",
"photoUr... | [
"def",
"test_deserialize_dict_str_pet",
"(",
"self",
")",
":",
"data",
"=",
"{",
"'pet'",
":",
"{",
"\"id\"",
":",
"0",
",",
"\"category\"",
":",
"{",
"\"id\"",
":",
"0",
",",
"\"name\"",
":",
"\"string\"",
"}",
",",
"\"name\"",
":",
"\"doggie\"",
",",
... | [
83,
4
] | [
110,
65
] | python | fr | ['it', 'fr', 'fr'] | True |
DeserializationTests.test_deserialize_dict_str_dog | (self) | deserialize dict(str, Dog), use discriminator | deserialize dict(str, Dog), use discriminator | def test_deserialize_dict_str_dog(self):
""" deserialize dict(str, Dog), use discriminator"""
data = {
'dog': {
"className": "Dog",
"color": "white",
"breed": "Jack Russel Terrier"
}
}
response = MockResponse(data=js... | [
"def",
"test_deserialize_dict_str_dog",
"(",
"self",
")",
":",
"data",
"=",
"{",
"'dog'",
":",
"{",
"\"className\"",
":",
"\"Dog\"",
",",
"\"color\"",
":",
"\"white\"",
",",
"\"breed\"",
":",
"\"Jack Russel Terrier\"",
"}",
"}",
"response",
"=",
"MockResponse",
... | [
112,
4
] | [
130,
63
] | python | da | ['it', 'da', 'fr'] | False |
DeserializationTests.test_deserialize_lizard | (self) | deserialize ChildLizard, use discriminator | deserialize ChildLizard, use discriminator | def test_deserialize_lizard(self):
""" deserialize ChildLizard, use discriminator"""
data = {
"pet_type": "ChildLizard",
"lovesRocks": True
}
response = MockResponse(data=json.dumps(data))
lizard = self.deserialize(response,
(parent_pet.Parent... | [
"def",
"test_deserialize_lizard",
"(",
"self",
")",
":",
"data",
"=",
"{",
"\"pet_type\"",
":",
"\"ChildLizard\"",
",",
"\"lovesRocks\"",
":",
"True",
"}",
"response",
"=",
"MockResponse",
"(",
"data",
"=",
"json",
".",
"dumps",
"(",
"data",
")",
")",
"liz... | [
132,
4
] | [
144,
50
] | python | ro | ['ro', 'ro', 'it'] | True |
DeserializationTests.test_deserialize_dict_str_int | (self) | deserialize dict(str, int) | deserialize dict(str, int) | def test_deserialize_dict_str_int(self):
""" deserialize dict(str, int) """
data = {
'integer': 1
}
response = MockResponse(data=json.dumps(data))
deserialized = self.deserialize(response, ({str: (int,)},), True)
self.assertTrue(isinstance(deserialized, dict)... | [
"def",
"test_deserialize_dict_str_int",
"(",
"self",
")",
":",
"data",
"=",
"{",
"'integer'",
":",
"1",
"}",
"response",
"=",
"MockResponse",
"(",
"data",
"=",
"json",
".",
"dumps",
"(",
"data",
")",
")",
"deserialized",
"=",
"self",
".",
"deserialize",
... | [
146,
4
] | [
155,
65
] | python | it | ['it', 'en', 'it'] | True |
DeserializationTests.test_deserialize_str | (self) | deserialize str | deserialize str | def test_deserialize_str(self):
""" deserialize str """
data = "test str"
response = MockResponse(data=json.dumps(data))
deserialized = self.deserialize(response, (str,), True)
self.assertTrue(isinstance(deserialized, str)) | [
"def",
"test_deserialize_str",
"(",
"self",
")",
":",
"data",
"=",
"\"test str\"",
"response",
"=",
"MockResponse",
"(",
"data",
"=",
"json",
".",
"dumps",
"(",
"data",
")",
")",
"deserialized",
"=",
"self",
".",
"deserialize",
"(",
"response",
",",
"(",
... | [
157,
4
] | [
163,
54
] | python | es | ['es', 'sl', 'fr'] | False |
DeserializationTests.test_deserialize_date | (self) | deserialize date | deserialize date | def test_deserialize_date(self):
""" deserialize date """
data = "1997-07-16"
response = MockResponse(data=json.dumps(data))
deserialized = self.deserialize(response, (datetime.date,), True)
self.assertTrue(isinstance(deserialized, datetime.date)) | [
"def",
"test_deserialize_date",
"(",
"self",
")",
":",
"data",
"=",
"\"1997-07-16\"",
"response",
"=",
"MockResponse",
"(",
"data",
"=",
"json",
".",
"dumps",
"(",
"data",
")",
")",
"deserialized",
"=",
"self",
".",
"deserialize",
"(",
"response",
",",
"("... | [
165,
4
] | [
171,
64
] | python | en | ['es', 'en', 'fr'] | False |
DeserializationTests.test_deserialize_datetime | (self) | deserialize datetime | deserialize datetime | def test_deserialize_datetime(self):
""" deserialize datetime """
data = "1997-07-16T19:20:30.45+01:00"
response = MockResponse(data=json.dumps(data))
deserialized = self.deserialize(response, (datetime.datetime,), True)
self.assertTrue(isinstance(deserialized, datetime.datetime... | [
"def",
"test_deserialize_datetime",
"(",
"self",
")",
":",
"data",
"=",
"\"1997-07-16T19:20:30.45+01:00\"",
"response",
"=",
"MockResponse",
"(",
"data",
"=",
"json",
".",
"dumps",
"(",
"data",
")",
")",
"deserialized",
"=",
"self",
".",
"deserialize",
"(",
"r... | [
173,
4
] | [
179,
68
] | python | es | ['es', 'ro', 'fr'] | False |
DeserializationTests.test_deserialize_pet | (self) | deserialize pet | deserialize pet | def test_deserialize_pet(self):
""" deserialize pet """
data = {
"id": 0,
"category": {
"id": 0,
"name": "string"
},
"name": "doggie",
"photoUrls": [
"string"
],
"tags": [
... | [
"def",
"test_deserialize_pet",
"(",
"self",
")",
":",
"data",
"=",
"{",
"\"id\"",
":",
"0",
",",
"\"category\"",
":",
"{",
"\"id\"",
":",
"0",
",",
"\"name\"",
":",
"\"string\"",
"}",
",",
"\"name\"",
":",
"\"doggie\"",
",",
"\"photoUrls\"",
":",
"[",
... | [
181,
4
] | [
210,
66
] | python | ro | ['ro', 'ro', 'fr'] | False |
DeserializationTests.test_deserialize_list_of_pet | (self) | deserialize list[Pet] | deserialize list[Pet] | def test_deserialize_list_of_pet(self):
""" deserialize list[Pet] """
data = [
{
"id": 0,
"category": {
"id": 0,
"name": "string"
},
"name": "doggie0",
"photoUrls": [
... | [
"def",
"test_deserialize_list_of_pet",
"(",
"self",
")",
":",
"data",
"=",
"[",
"{",
"\"id\"",
":",
"0",
",",
"\"category\"",
":",
"{",
"\"id\"",
":",
"0",
",",
"\"name\"",
":",
"\"string\"",
"}",
",",
"\"name\"",
":",
"\"doggie0\"",
",",
"\"photoUrls\"",
... | [
212,
4
] | [
260,
57
] | python | es | ['es', 'fr', 'nl'] | False |
DeserializationTests.test_deserialize_nested_dict | (self) | deserialize dict(str, dict(str, int)) | deserialize dict(str, dict(str, int)) | def test_deserialize_nested_dict(self):
""" deserialize dict(str, dict(str, int)) """
data = {
"foo": {
"bar": 1
}
}
response = MockResponse(data=json.dumps(data))
deserialized = self.deserialize(response,
({str: ({str: (int,)}... | [
"def",
"test_deserialize_nested_dict",
"(",
"self",
")",
":",
"data",
"=",
"{",
"\"foo\"",
":",
"{",
"\"bar\"",
":",
"1",
"}",
"}",
"response",
"=",
"MockResponse",
"(",
"data",
"=",
"json",
".",
"dumps",
"(",
"data",
")",
")",
"deserialized",
"=",
"se... | [
262,
4
] | [
275,
68
] | python | da | ['es', 'da', 'fr'] | False |
DeserializationTests.test_deserialize_nested_list | (self) | deserialize list[list[str]] | deserialize list[list[str]] | def test_deserialize_nested_list(self):
""" deserialize list[list[str]] """
data = [["foo"]]
response = MockResponse(data=json.dumps(data))
deserialized = self.deserialize(response, ([[str]],), True)
self.assertTrue(isinstance(deserialized, list))
self.assertTrue(isinsta... | [
"def",
"test_deserialize_nested_list",
"(",
"self",
")",
":",
"data",
"=",
"[",
"[",
"\"foo\"",
"]",
"]",
"response",
"=",
"MockResponse",
"(",
"data",
"=",
"json",
".",
"dumps",
"(",
"data",
")",
")",
"deserialized",
"=",
"self",
".",
"deserialize",
"("... | [
277,
4
] | [
285,
60
] | python | es | ['es', 'no', 'nl'] | False |
DeserializationTests.test_deserialize_none | (self) | deserialize None | deserialize None | def test_deserialize_none(self):
""" deserialize None """
response = MockResponse(data=json.dumps(None))
error_msg = (
"Invalid type for variable 'received_data'. Required value type is "
"datetime and passed type was NoneType at ['received_data']"
)
with... | [
"def",
"test_deserialize_none",
"(",
"self",
")",
":",
"response",
"=",
"MockResponse",
"(",
"data",
"=",
"json",
".",
"dumps",
"(",
"None",
")",
")",
"error_msg",
"=",
"(",
"\"Invalid type for variable 'received_data'. Required value type is \"",
"\"datetime and passed... | [
287,
4
] | [
297,
55
] | python | es | ['es', 'it', 'fr'] | False |
DeserializationTests.test_deserialize_OuterEnum | (self) | deserialize OuterEnum | deserialize OuterEnum | def test_deserialize_OuterEnum(self):
""" deserialize OuterEnum """
# make sure that an exception is thrown on an invalid value
with self.assertRaises(ApiValueError):
self.deserialize(
MockResponse(data=json.dumps("test str")),
(string_enum.StringEnum,... | [
"def",
"test_deserialize_OuterEnum",
"(",
"self",
")",
":",
"# make sure that an exception is thrown on an invalid value",
"with",
"self",
".",
"assertRaises",
"(",
"ApiValueError",
")",
":",
"self",
".",
"deserialize",
"(",
"MockResponse",
"(",
"data",
"=",
"json",
"... | [
299,
4
] | [
317,
57
] | python | pt | ['pt', 'it', 'pt'] | False |
DeserializationTests.test_deserialize_NumberWithValidations | (self) | deserialize NumberWithValidations | deserialize NumberWithValidations | def test_deserialize_NumberWithValidations(self):
""" deserialize NumberWithValidations """
# make sure that an exception is thrown on an invalid type value
with self.assertRaises(ApiTypeError):
deserialized = self.deserialize(
MockResponse(data=json.dumps("test str")... | [
"def",
"test_deserialize_NumberWithValidations",
"(",
"self",
")",
":",
"# make sure that an exception is thrown on an invalid type value",
"with",
"self",
".",
"assertRaises",
"(",
"ApiTypeError",
")",
":",
"deserialized",
"=",
"self",
".",
"deserialize",
"(",
"MockRespons... | [
319,
4
] | [
343,
51
] | python | en | ['en', 'en', 'en'] | False |
DeserializationTests.test_deserialize_file | (self) | Ensures that file deserialization works | Ensures that file deserialization works | def test_deserialize_file(self):
"""Ensures that file deserialization works"""
response_types_mixed = (file_type,)
# sample from http://www.jtricks.com/download-text
HTTPResponse = namedtuple(
'urllib3_response_HTTPResponse',
['status', 'reason', 'data', 'gethead... | [
"def",
"test_deserialize_file",
"(",
"self",
")",
":",
"response_types_mixed",
"=",
"(",
"file_type",
",",
")",
"# sample from http://www.jtricks.com/download-text",
"HTTPResponse",
"=",
"namedtuple",
"(",
"'urllib3_response_HTTPResponse'",
",",
"[",
"'status'",
",",
"'re... | [
345,
4
] | [
386,
32
] | python | en | ['en', 'en', 'en'] | True |
DeserializationTests.test_deserialize_binary_to_str | (self) | Ensures that bytes deserialization works | Ensures that bytes deserialization works | def test_deserialize_binary_to_str(self):
"""Ensures that bytes deserialization works"""
response_types_mixed = (str,)
# sample from http://www.jtricks.com/download-text
HTTPResponse = namedtuple(
'urllib3_response_HTTPResponse',
['status', 'reason', 'data', 'get... | [
"def",
"test_deserialize_binary_to_str",
"(",
"self",
")",
":",
"response_types_mixed",
"=",
"(",
"str",
",",
")",
"# sample from http://www.jtricks.com/download-text",
"HTTPResponse",
"=",
"namedtuple",
"(",
"'urllib3_response_HTTPResponse'",
",",
"[",
"'status'",
",",
"... | [
388,
4
] | [
416,
38
] | python | en | ['en', 'en', 'en'] | True |
DeserializationTests.test_deserialize_string_boolean_map | (self) |
Ensures that string boolean (additional properties)
deserialization works
|
Ensures that string boolean (additional properties)
deserialization works
| def test_deserialize_string_boolean_map(self):
"""
Ensures that string boolean (additional properties)
deserialization works
"""
# make sure that an exception is thrown on an invalid type
with self.assertRaises(ApiTypeError):
deserialized = self.deserialize(
... | [
"def",
"test_deserialize_string_boolean_map",
"(",
"self",
")",
":",
"# make sure that an exception is thrown on an invalid type",
"with",
"self",
".",
"assertRaises",
"(",
"ApiTypeError",
")",
":",
"deserialized",
"=",
"self",
".",
"deserialize",
"(",
"MockResponse",
"("... | [
418,
4
] | [
439,
46
] | python | en | ['en', 'error', 'th'] | False |
Pet.openapi_types | () |
This must be a method because a model may have properties that are
of type self, this must run after the class is loaded
Returns
openapi_types (dict): The key is attribute name
and the value is attribute type.
|
This must be a method because a model may have properties that are
of type self, this must run after the class is loaded | def openapi_types():
"""
This must be a method because a model may have properties that are
of type self, this must run after the class is loaded
Returns
openapi_types (dict): The key is attribute name
and the value is attribute type.
"""
lazy... | [
"def",
"openapi_types",
"(",
")",
":",
"lazy_import",
"(",
")",
"return",
"{",
"'name'",
":",
"(",
"str",
",",
")",
",",
"# noqa: E501",
"'photo_urls'",
":",
"(",
"[",
"str",
"]",
",",
")",
",",
"# noqa: E501",
"'id'",
":",
"(",
"int",
",",
")",
",... | [
75,
4
] | [
92,
9
] | python | en | ['en', 'error', 'th'] | False |
Pet.__init__ | (self, name, photo_urls, *args, **kwargs) | Pet - a model defined in OpenAPI
Args:
name (str):
photo_urls ([str]):
Keyword Args:
_check_type (bool): if True, values for parameters in openapi_types
will be type checked and a TypeError will be
rais... | Pet - a model defined in OpenAPI | def __init__(self, name, photo_urls, *args, **kwargs): # noqa: E501
"""Pet - a model defined in OpenAPI
Args:
name (str):
photo_urls ([str]):
Keyword Args:
_check_type (bool): if True, values for parameters in openapi_types
w... | [
"def",
"__init__",
"(",
"self",
",",
"name",
",",
"photo_urls",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"# noqa: E501",
"_check_type",
"=",
"kwargs",
".",
"pop",
"(",
"'_check_type'",
",",
"True",
")",
"_spec_property_naming",
"=",
"kwargs",
... | [
120,
4
] | [
196,
46
] | python | en | ['en', 'en', 'en'] | True |
mock_connection | (
aioclient_mock: AiohttpClientMocker,
device: str = "roku3",
app: str = "roku",
host: str = HOST,
power: bool = True,
media_state: str = "close",
error: bool = False,
server_error: bool = False,
) | Mock the Roku connection. | Mock the Roku connection. | def mock_connection(
aioclient_mock: AiohttpClientMocker,
device: str = "roku3",
app: str = "roku",
host: str = HOST,
power: bool = True,
media_state: str = "close",
error: bool = False,
server_error: bool = False,
) -> None:
"""Mock the Roku connection."""
roku_url = f"http://{h... | [
"def",
"mock_connection",
"(",
"aioclient_mock",
":",
"AiohttpClientMocker",
",",
"device",
":",
"str",
"=",
"\"roku3\"",
",",
"app",
":",
"str",
"=",
"\"roku\"",
",",
"host",
":",
"str",
"=",
"HOST",
",",
"power",
":",
"bool",
"=",
"True",
",",
"media_s... | [
41,
0
] | [
120,
56
] | python | en | ['en', 'en', 'en'] | True |
mock_connection_error | (
aioclient_mock: AiohttpClientMocker,
device: str = "roku3",
app: str = "roku",
host: str = HOST,
) | Mock the Roku connection error. | Mock the Roku connection error. | def mock_connection_error(
aioclient_mock: AiohttpClientMocker,
device: str = "roku3",
app: str = "roku",
host: str = HOST,
) -> None:
"""Mock the Roku connection error."""
roku_url = f"http://{host}:8060"
aioclient_mock.get(f"{roku_url}/query/device-info", exc=SocketGIAError)
aioclient... | [
"def",
"mock_connection_error",
"(",
"aioclient_mock",
":",
"AiohttpClientMocker",
",",
"device",
":",
"str",
"=",
"\"roku3\"",
",",
"app",
":",
"str",
"=",
"\"roku\"",
",",
"host",
":",
"str",
"=",
"HOST",
",",
")",
"->",
"None",
":",
"roku_url",
"=",
"... | [
123,
0
] | [
140,
65
] | python | en | ['en', 'gl', 'en'] | True |
mock_connection_server_error | (
aioclient_mock: AiohttpClientMocker,
device: str = "roku3",
app: str = "roku",
host: str = HOST,
) | Mock the Roku server error. | Mock the Roku server error. | def mock_connection_server_error(
aioclient_mock: AiohttpClientMocker,
device: str = "roku3",
app: str = "roku",
host: str = HOST,
) -> None:
"""Mock the Roku server error."""
roku_url = f"http://{host}:8060"
aioclient_mock.get(f"{roku_url}/query/device-info", status=500)
aioclient_mock... | [
"def",
"mock_connection_server_error",
"(",
"aioclient_mock",
":",
"AiohttpClientMocker",
",",
"device",
":",
"str",
"=",
"\"roku3\"",
",",
"app",
":",
"str",
"=",
"\"roku\"",
",",
"host",
":",
"str",
"=",
"HOST",
",",
")",
"->",
"None",
":",
"roku_url",
"... | [
143,
0
] | [
160,
57
] | python | en | ['en', 'pt', 'en'] | True |
setup_integration | (
hass: HomeAssistant,
aioclient_mock: AiohttpClientMocker,
device: str = "roku3",
app: str = "roku",
host: str = HOST,
unique_id: str = UPNP_SERIAL,
error: bool = False,
power: bool = True,
media_state: str = "close",
server_error: bool = False,
skip_entry_setup: bool = Fals... | Set up the Roku integration in Home Assistant. | Set up the Roku integration in Home Assistant. | async def setup_integration(
hass: HomeAssistant,
aioclient_mock: AiohttpClientMocker,
device: str = "roku3",
app: str = "roku",
host: str = HOST,
unique_id: str = UPNP_SERIAL,
error: bool = False,
power: bool = True,
media_state: str = "close",
server_error: bool = False,
sk... | [
"async",
"def",
"setup_integration",
"(",
"hass",
":",
"HomeAssistant",
",",
"aioclient_mock",
":",
"AiohttpClientMocker",
",",
"device",
":",
"str",
"=",
"\"roku3\"",
",",
"app",
":",
"str",
"=",
"\"roku\"",
",",
"host",
":",
"str",
"=",
"HOST",
",",
"uni... | [
163,
0
] | [
195,
16
] | python | en | ['en', 'en', 'en'] | True |
async_setup_entry | (hass: HomeAssistant, entry: ConfigEntry) | Configure the base Nexia device for Home Assistant. | Configure the base Nexia device for Home Assistant. | async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
"""Configure the base Nexia device for Home Assistant."""
conf = entry.data
username = conf[CONF_USERNAME]
password = conf[CONF_PASSWORD]
brand = conf.get(CONF_BRAND, BRAND_NEXIA)
state_file = hass.config.path(f"nexi... | [
"async",
"def",
"async_setup_entry",
"(",
"hass",
":",
"HomeAssistant",
",",
"entry",
":",
"ConfigEntry",
")",
"->",
"bool",
":",
"conf",
"=",
"entry",
".",
"data",
"username",
"=",
"conf",
"[",
"CONF_USERNAME",
"]",
"password",
"=",
"conf",
"[",
"CONF_PAS... | [
26,
0
] | [
79,
15
] | python | en | ['en', 'en', 'en'] | True |
async_unload_entry | (hass: HomeAssistant, entry: ConfigEntry) | Unload a config entry. | Unload a config entry. | async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry):
"""Unload a config entry."""
unload_ok = await hass.config_entries.async_unload_platforms(entry, PLATFORMS)
if unload_ok:
hass.data[DOMAIN].pop(entry.entry_id)
return unload_ok | [
"async",
"def",
"async_unload_entry",
"(",
"hass",
":",
"HomeAssistant",
",",
"entry",
":",
"ConfigEntry",
")",
":",
"unload_ok",
"=",
"await",
"hass",
".",
"config_entries",
".",
"async_unload_platforms",
"(",
"entry",
",",
"PLATFORMS",
")",
"if",
"unload_ok",
... | [
82,
0
] | [
88,
20
] | python | en | ['en', 'es', 'en'] | True |
fft | (a, n=None, axis=-1, norm=None) |
Compute the one-dimensional discrete Fourier Transform.
This function computes the one-dimensional *n*-point discrete Fourier
Transform (DFT) with the efficient Fast Fourier Transform (FFT)
algorithm [CT].
Parameters
----------
a : array_like
Input array, can be complex.
n : i... |
Compute the one-dimensional discrete Fourier Transform. | def fft(a, n=None, axis=-1, norm=None):
"""
Compute the one-dimensional discrete Fourier Transform.
This function computes the one-dimensional *n*-point discrete Fourier
Transform (DFT) with the efficient Fast Fourier Transform (FFT)
algorithm [CT].
Parameters
----------
a : array_like... | [
"def",
"fft",
"(",
"a",
",",
"n",
"=",
"None",
",",
"axis",
"=",
"-",
"1",
",",
"norm",
"=",
"None",
")",
":",
"a",
"=",
"asarray",
"(",
"a",
")",
"if",
"n",
"is",
"None",
":",
"n",
"=",
"a",
".",
"shape",
"[",
"axis",
"]",
"inv_norm",
"=... | [
95,
0
] | [
185,
17
] | python | en | ['en', 'error', 'th'] | False |
ifft | (a, n=None, axis=-1, norm=None) |
Compute the one-dimensional inverse discrete Fourier Transform.
This function computes the inverse of the one-dimensional *n*-point
discrete Fourier transform computed by `fft`. In other words,
``ifft(fft(a)) == a`` to within numerical accuracy.
For a general description of the algorithm and defi... |
Compute the one-dimensional inverse discrete Fourier Transform. | def ifft(a, n=None, axis=-1, norm=None):
"""
Compute the one-dimensional inverse discrete Fourier Transform.
This function computes the inverse of the one-dimensional *n*-point
discrete Fourier transform computed by `fft`. In other words,
``ifft(fft(a)) == a`` to within numerical accuracy.
For... | [
"def",
"ifft",
"(",
"a",
",",
"n",
"=",
"None",
",",
"axis",
"=",
"-",
"1",
",",
"norm",
"=",
"None",
")",
":",
"a",
"=",
"asarray",
"(",
"a",
")",
"if",
"n",
"is",
"None",
":",
"n",
"=",
"a",
".",
"shape",
"[",
"axis",
"]",
"if",
"norm",... | [
189,
0
] | [
281,
17
] | python | en | ['en', 'error', 'th'] | False |
rfft | (a, n=None, axis=-1, norm=None) |
Compute the one-dimensional discrete Fourier Transform for real input.
This function computes the one-dimensional *n*-point discrete Fourier
Transform (DFT) of a real-valued array by means of an efficient algorithm
called the Fast Fourier Transform (FFT).
Parameters
----------
a : array_l... |
Compute the one-dimensional discrete Fourier Transform for real input. | def rfft(a, n=None, axis=-1, norm=None):
"""
Compute the one-dimensional discrete Fourier Transform for real input.
This function computes the one-dimensional *n*-point discrete Fourier
Transform (DFT) of a real-valued array by means of an efficient algorithm
called the Fast Fourier Transform (FFT)... | [
"def",
"rfft",
"(",
"a",
",",
"n",
"=",
"None",
",",
"axis",
"=",
"-",
"1",
",",
"norm",
"=",
"None",
")",
":",
"a",
"=",
"asarray",
"(",
"a",
")",
"inv_norm",
"=",
"1",
"if",
"norm",
"is",
"not",
"None",
"and",
"_unitary",
"(",
"norm",
")",
... | [
286,
0
] | [
371,
17
] | python | en | ['en', 'error', 'th'] | False |
irfft | (a, n=None, axis=-1, norm=None) |
Compute the inverse of the n-point DFT for real input.
This function computes the inverse of the one-dimensional *n*-point
discrete Fourier Transform of real input computed by `rfft`.
In other words, ``irfft(rfft(a), len(a)) == a`` to within numerical
accuracy. (See Notes below for why ``len(a)`` ... |
Compute the inverse of the n-point DFT for real input. | def irfft(a, n=None, axis=-1, norm=None):
"""
Compute the inverse of the n-point DFT for real input.
This function computes the inverse of the one-dimensional *n*-point
discrete Fourier Transform of real input computed by `rfft`.
In other words, ``irfft(rfft(a), len(a)) == a`` to within numerical
... | [
"def",
"irfft",
"(",
"a",
",",
"n",
"=",
"None",
",",
"axis",
"=",
"-",
"1",
",",
"norm",
"=",
"None",
")",
":",
"a",
"=",
"asarray",
"(",
"a",
")",
"if",
"n",
"is",
"None",
":",
"n",
"=",
"(",
"a",
".",
"shape",
"[",
"axis",
"]",
"-",
... | [
375,
0
] | [
471,
17
] | python | en | ['en', 'error', 'th'] | False |
hfft | (a, n=None, axis=-1, norm=None) |
Compute the FFT of a signal that has Hermitian symmetry, i.e., a real
spectrum.
Parameters
----------
a : array_like
The input array.
n : int, optional
Length of the transformed axis of the output. For `n` output
points, ``n//2 + 1`` input points are necessary. If the ... |
Compute the FFT of a signal that has Hermitian symmetry, i.e., a real
spectrum. | def hfft(a, n=None, axis=-1, norm=None):
"""
Compute the FFT of a signal that has Hermitian symmetry, i.e., a real
spectrum.
Parameters
----------
a : array_like
The input array.
n : int, optional
Length of the transformed axis of the output. For `n` output
points, `... | [
"def",
"hfft",
"(",
"a",
",",
"n",
"=",
"None",
",",
"axis",
"=",
"-",
"1",
",",
"norm",
"=",
"None",
")",
":",
"a",
"=",
"asarray",
"(",
"a",
")",
"if",
"n",
"is",
"None",
":",
"n",
"=",
"(",
"a",
".",
"shape",
"[",
"axis",
"]",
"-",
"... | [
475,
0
] | [
562,
69
] | python | en | ['en', 'error', 'th'] | False |
ihfft | (a, n=None, axis=-1, norm=None) |
Compute the inverse FFT of a signal that has Hermitian symmetry.
Parameters
----------
a : array_like
Input array.
n : int, optional
Length of the inverse FFT, the number of points along
transformation axis in the input to use. If `n` is smaller than
the length of ... |
Compute the inverse FFT of a signal that has Hermitian symmetry. | def ihfft(a, n=None, axis=-1, norm=None):
"""
Compute the inverse FFT of a signal that has Hermitian symmetry.
Parameters
----------
a : array_like
Input array.
n : int, optional
Length of the inverse FFT, the number of points along
transformation axis in the input to us... | [
"def",
"ihfft",
"(",
"a",
",",
"n",
"=",
"None",
",",
"axis",
"=",
"-",
"1",
",",
"norm",
"=",
"None",
")",
":",
"a",
"=",
"asarray",
"(",
"a",
")",
"if",
"n",
"is",
"None",
":",
"n",
"=",
"a",
".",
"shape",
"[",
"axis",
"]",
"unitary",
"... | [
566,
0
] | [
623,
53
] | python | en | ['en', 'error', 'th'] | False |
fftn | (a, s=None, axes=None, norm=None) |
Compute the N-dimensional discrete Fourier Transform.
This function computes the *N*-dimensional discrete Fourier Transform over
any number of axes in an *M*-dimensional array by means of the Fast Fourier
Transform (FFT).
Parameters
----------
a : array_like
Input array, can be co... |
Compute the N-dimensional discrete Fourier Transform. | def fftn(a, s=None, axes=None, norm=None):
"""
Compute the N-dimensional discrete Fourier Transform.
This function computes the *N*-dimensional discrete Fourier Transform over
any number of axes in an *M*-dimensional array by means of the Fast Fourier
Transform (FFT).
Parameters
----------... | [
"def",
"fftn",
"(",
"a",
",",
"s",
"=",
"None",
",",
"axes",
"=",
"None",
",",
"norm",
"=",
"None",
")",
":",
"return",
"_raw_fftnd",
"(",
"a",
",",
"s",
",",
"axes",
",",
"fft",
",",
"norm",
")"
] | [
660,
0
] | [
754,
44
] | python | en | ['en', 'error', 'th'] | False |
ifftn | (a, s=None, axes=None, norm=None) |
Compute the N-dimensional inverse discrete Fourier Transform.
This function computes the inverse of the N-dimensional discrete
Fourier Transform over any number of axes in an M-dimensional array by
means of the Fast Fourier Transform (FFT). In other words,
``ifftn(fftn(a)) == a`` to within numeri... |
Compute the N-dimensional inverse discrete Fourier Transform. | def ifftn(a, s=None, axes=None, norm=None):
"""
Compute the N-dimensional inverse discrete Fourier Transform.
This function computes the inverse of the N-dimensional discrete
Fourier Transform over any number of axes in an M-dimensional array by
means of the Fast Fourier Transform (FFT). In other ... | [
"def",
"ifftn",
"(",
"a",
",",
"s",
"=",
"None",
",",
"axes",
"=",
"None",
",",
"norm",
"=",
"None",
")",
":",
"return",
"_raw_fftnd",
"(",
"a",
",",
"s",
",",
"axes",
",",
"ifft",
",",
"norm",
")"
] | [
758,
0
] | [
852,
45
] | python | en | ['en', 'error', 'th'] | False |
fft2 | (a, s=None, axes=(-2, -1), norm=None) |
Compute the 2-dimensional discrete Fourier Transform
This function computes the *n*-dimensional discrete Fourier Transform
over any axes in an *M*-dimensional array by means of the
Fast Fourier Transform (FFT). By default, the transform is computed over
the last two axes of the input array, i.e.,... |
Compute the 2-dimensional discrete Fourier Transform | def fft2(a, s=None, axes=(-2, -1), norm=None):
"""
Compute the 2-dimensional discrete Fourier Transform
This function computes the *n*-dimensional discrete Fourier Transform
over any axes in an *M*-dimensional array by means of the
Fast Fourier Transform (FFT). By default, the transform is compute... | [
"def",
"fft2",
"(",
"a",
",",
"s",
"=",
"None",
",",
"axes",
"=",
"(",
"-",
"2",
",",
"-",
"1",
")",
",",
"norm",
"=",
"None",
")",
":",
"return",
"_raw_fftnd",
"(",
"a",
",",
"s",
",",
"axes",
",",
"fft",
",",
"norm",
")"
] | [
856,
0
] | [
943,
44
] | python | en | ['en', 'error', 'th'] | False |
ifft2 | (a, s=None, axes=(-2, -1), norm=None) |
Compute the 2-dimensional inverse discrete Fourier Transform.
This function computes the inverse of the 2-dimensional discrete Fourier
Transform over any number of axes in an M-dimensional array by means of
the Fast Fourier Transform (FFT). In other words, ``ifft2(fft2(a)) == a``
to within numeri... |
Compute the 2-dimensional inverse discrete Fourier Transform. | def ifft2(a, s=None, axes=(-2, -1), norm=None):
"""
Compute the 2-dimensional inverse discrete Fourier Transform.
This function computes the inverse of the 2-dimensional discrete Fourier
Transform over any number of axes in an M-dimensional array by means of
the Fast Fourier Transform (FFT). In ot... | [
"def",
"ifft2",
"(",
"a",
",",
"s",
"=",
"None",
",",
"axes",
"=",
"(",
"-",
"2",
",",
"-",
"1",
")",
",",
"norm",
"=",
"None",
")",
":",
"return",
"_raw_fftnd",
"(",
"a",
",",
"s",
",",
"axes",
",",
"ifft",
",",
"norm",
")"
] | [
947,
0
] | [
1031,
45
] | python | en | ['en', 'error', 'th'] | False |
rfftn | (a, s=None, axes=None, norm=None) |
Compute the N-dimensional discrete Fourier Transform for real input.
This function computes the N-dimensional discrete Fourier Transform over
any number of axes in an M-dimensional real array by means of the Fast
Fourier Transform (FFT). By default, all axes are transformed, with the
real transfo... |
Compute the N-dimensional discrete Fourier Transform for real input. | def rfftn(a, s=None, axes=None, norm=None):
"""
Compute the N-dimensional discrete Fourier Transform for real input.
This function computes the N-dimensional discrete Fourier Transform over
any number of axes in an M-dimensional real array by means of the Fast
Fourier Transform (FFT). By default, ... | [
"def",
"rfftn",
"(",
"a",
",",
"s",
"=",
"None",
",",
"axes",
"=",
"None",
",",
"norm",
"=",
"None",
")",
":",
"a",
"=",
"asarray",
"(",
"a",
")",
"s",
",",
"axes",
"=",
"_cook_nd_args",
"(",
"a",
",",
"s",
",",
"axes",
")",
"a",
"=",
"rfft... | [
1035,
0
] | [
1123,
12
] | python | en | ['en', 'error', 'th'] | False |
rfft2 | (a, s=None, axes=(-2, -1), norm=None) |
Compute the 2-dimensional FFT of a real array.
Parameters
----------
a : array
Input array, taken to be real.
s : sequence of ints, optional
Shape of the FFT.
axes : sequence of ints, optional
Axes over which to compute the FFT.
norm : {None, "ortho"}, optional
... |
Compute the 2-dimensional FFT of a real array. | def rfft2(a, s=None, axes=(-2, -1), norm=None):
"""
Compute the 2-dimensional FFT of a real array.
Parameters
----------
a : array
Input array, taken to be real.
s : sequence of ints, optional
Shape of the FFT.
axes : sequence of ints, optional
Axes over which to com... | [
"def",
"rfft2",
"(",
"a",
",",
"s",
"=",
"None",
",",
"axes",
"=",
"(",
"-",
"2",
",",
"-",
"1",
")",
",",
"norm",
"=",
"None",
")",
":",
"return",
"rfftn",
"(",
"a",
",",
"s",
",",
"axes",
",",
"norm",
")"
] | [
1127,
0
] | [
1161,
34
] | python | en | ['en', 'error', 'th'] | False |
irfftn | (a, s=None, axes=None, norm=None) |
Compute the inverse of the N-dimensional FFT of real input.
This function computes the inverse of the N-dimensional discrete
Fourier Transform for real input over any number of axes in an
M-dimensional array by means of the Fast Fourier Transform (FFT). In
other words, ``irfftn(rfftn(a), a.shape)... |
Compute the inverse of the N-dimensional FFT of real input. | def irfftn(a, s=None, axes=None, norm=None):
"""
Compute the inverse of the N-dimensional FFT of real input.
This function computes the inverse of the N-dimensional discrete
Fourier Transform for real input over any number of axes in an
M-dimensional array by means of the Fast Fourier Transform (FF... | [
"def",
"irfftn",
"(",
"a",
",",
"s",
"=",
"None",
",",
"axes",
"=",
"None",
",",
"norm",
"=",
"None",
")",
":",
"a",
"=",
"asarray",
"(",
"a",
")",
"s",
",",
"axes",
"=",
"_cook_nd_args",
"(",
"a",
",",
"s",
",",
"axes",
",",
"invreal",
"=",
... | [
1165,
0
] | [
1265,
12
] | python | en | ['en', 'error', 'th'] | False |
irfft2 | (a, s=None, axes=(-2, -1), norm=None) |
Compute the 2-dimensional inverse FFT of a real array.
Parameters
----------
a : array_like
The input array
s : sequence of ints, optional
Shape of the real output to the inverse FFT.
axes : sequence of ints, optional
The axes over which to compute the inverse fft.
... |
Compute the 2-dimensional inverse FFT of a real array. | def irfft2(a, s=None, axes=(-2, -1), norm=None):
"""
Compute the 2-dimensional inverse FFT of a real array.
Parameters
----------
a : array_like
The input array
s : sequence of ints, optional
Shape of the real output to the inverse FFT.
axes : sequence of ints, optional
... | [
"def",
"irfft2",
"(",
"a",
",",
"s",
"=",
"None",
",",
"axes",
"=",
"(",
"-",
"2",
",",
"-",
"1",
")",
",",
"norm",
"=",
"None",
")",
":",
"return",
"irfftn",
"(",
"a",
",",
"s",
",",
"axes",
",",
"norm",
")"
] | [
1269,
0
] | [
1303,
35
] | python | en | ['en', 'error', 'th'] | False |
FirmataEntity.__init__ | (self, api) | Initialize the entity. | Initialize the entity. | def __init__(self, api):
"""Initialize the entity."""
self._api = api | [
"def",
"__init__",
"(",
"self",
",",
"api",
")",
":",
"self",
".",
"_api",
"=",
"api"
] | [
14,
4
] | [
16,
23
] | python | en | ['en', 'en', 'en'] | True |
FirmataEntity.device_info | (self) | Return device info. | Return device info. | def device_info(self) -> DeviceInfo:
"""Return device info."""
return {
"connections": {},
"identifiers": {(DOMAIN, self._api.board.name)},
"manufacturer": FIRMATA_MANUFACTURER,
"name": self._api.board.name,
"sw_version": self._api.board.firmwa... | [
"def",
"device_info",
"(",
"self",
")",
"->",
"DeviceInfo",
":",
"return",
"{",
"\"connections\"",
":",
"{",
"}",
",",
"\"identifiers\"",
":",
"{",
"(",
"DOMAIN",
",",
"self",
".",
"_api",
".",
"board",
".",
"name",
")",
"}",
",",
"\"manufacturer\"",
"... | [
19,
4
] | [
27,
9
] | python | en | ['es', 'hr', 'en'] | False |
FirmataPinEntity.__init__ | (
self,
api: type[FirmataBoardPin],
config_entry: ConfigEntry,
name: str,
pin: FirmataPinType,
) | Initialize the pin entity. | Initialize the pin entity. | def __init__(
self,
api: type[FirmataBoardPin],
config_entry: ConfigEntry,
name: str,
pin: FirmataPinType,
) -> None:
"""Initialize the pin entity."""
super().__init__(api)
self._name = name
location = (config_entry.entry_id, "pin", pin)
... | [
"def",
"__init__",
"(",
"self",
",",
"api",
":",
"type",
"[",
"FirmataBoardPin",
"]",
",",
"config_entry",
":",
"ConfigEntry",
",",
"name",
":",
"str",
",",
"pin",
":",
"FirmataPinType",
",",
")",
"->",
"None",
":",
"super",
"(",
")",
".",
"__init__",
... | [
33,
4
] | [
45,
60
] | python | en | ['en', 'en', 'en'] | True |
FirmataPinEntity.name | (self) | Get the name of the pin. | Get the name of the pin. | def name(self) -> str:
"""Get the name of the pin."""
return self._name | [
"def",
"name",
"(",
"self",
")",
"->",
"str",
":",
"return",
"self",
".",
"_name"
] | [
48,
4
] | [
50,
25
] | python | en | ['en', 'en', 'en'] | True |
FirmataPinEntity.should_poll | (self) | No polling needed. | No polling needed. | def should_poll(self) -> bool:
"""No polling needed."""
return False | [
"def",
"should_poll",
"(",
"self",
")",
"->",
"bool",
":",
"return",
"False"
] | [
53,
4
] | [
55,
20
] | python | en | ['en', 'en', 'en'] | True |
FirmataPinEntity.unique_id | (self) | Return a unique identifier for this device. | Return a unique identifier for this device. | def unique_id(self) -> str:
"""Return a unique identifier for this device."""
return self._unique_id | [
"def",
"unique_id",
"(",
"self",
")",
"->",
"str",
":",
"return",
"self",
".",
"_unique_id"
] | [
58,
4
] | [
60,
30
] | python | en | ['en', 'en', 'en'] | True |
test_setup | (hass: HomeAssistant, fritz: Mock) | Test setup of integration. | Test setup of integration. | async def test_setup(hass: HomeAssistant, fritz: Mock):
"""Test setup of integration."""
assert await setup_config_entry(hass, MOCK_CONFIG[FB_DOMAIN][CONF_DEVICES][0])
entries = hass.config_entries.async_entries()
assert entries
assert len(entries) == 1
assert entries[0].data[CONF_HOST] == "fake... | [
"async",
"def",
"test_setup",
"(",
"hass",
":",
"HomeAssistant",
",",
"fritz",
":",
"Mock",
")",
":",
"assert",
"await",
"setup_config_entry",
"(",
"hass",
",",
"MOCK_CONFIG",
"[",
"FB_DOMAIN",
"]",
"[",
"CONF_DEVICES",
"]",
"[",
"0",
"]",
")",
"entries",
... | [
29,
0
] | [
41,
5
] | python | en | ['en', 'da', 'en'] | True |
test_update_unique_id | (hass: HomeAssistant, fritz: Mock) | Test unique_id update of integration. | Test unique_id update of integration. | async def test_update_unique_id(hass: HomeAssistant, fritz: Mock):
"""Test unique_id update of integration."""
entry = MockConfigEntry(
domain=FB_DOMAIN,
data=MOCK_CONFIG[FB_DOMAIN][CONF_DEVICES][0],
unique_id="any",
)
entry.add_to_hass(hass)
entity_registry = er.async_get(h... | [
"async",
"def",
"test_update_unique_id",
"(",
"hass",
":",
"HomeAssistant",
",",
"fritz",
":",
"Mock",
")",
":",
"entry",
"=",
"MockConfigEntry",
"(",
"domain",
"=",
"FB_DOMAIN",
",",
"data",
"=",
"MOCK_CONFIG",
"[",
"FB_DOMAIN",
"]",
"[",
"CONF_DEVICES",
"]... | [
44,
0
] | [
67,
70
] | python | en | ['en', 'en', 'en'] | True |
test_update_unique_id_no_change | (hass: HomeAssistant, fritz: Mock) | Test unique_id is not updated of integration. | Test unique_id is not updated of integration. | async def test_update_unique_id_no_change(hass: HomeAssistant, fritz: Mock):
"""Test unique_id is not updated of integration."""
entry = MockConfigEntry(
domain=FB_DOMAIN,
data=MOCK_CONFIG[FB_DOMAIN][CONF_DEVICES][0],
unique_id="any",
)
entry.add_to_hass(hass)
entity_registr... | [
"async",
"def",
"test_update_unique_id_no_change",
"(",
"hass",
":",
"HomeAssistant",
",",
"fritz",
":",
"Mock",
")",
":",
"entry",
"=",
"MockConfigEntry",
"(",
"domain",
"=",
"FB_DOMAIN",
",",
"data",
"=",
"MOCK_CONFIG",
"[",
"FB_DOMAIN",
"]",
"[",
"CONF_DEVI... | [
70,
0
] | [
93,
70
] | python | en | ['en', 'en', 'en'] | True |
test_coordinator_update_after_reboot | (hass: HomeAssistant, fritz: Mock) | Test coordinator after reboot. | Test coordinator after reboot. | async def test_coordinator_update_after_reboot(hass: HomeAssistant, fritz: Mock):
"""Test coordinator after reboot."""
entry = MockConfigEntry(
domain=FB_DOMAIN,
data=MOCK_CONFIG[FB_DOMAIN][CONF_DEVICES][0],
unique_id="any",
)
entry.add_to_hass(hass)
fritz().get_devices.side_... | [
"async",
"def",
"test_coordinator_update_after_reboot",
"(",
"hass",
":",
"HomeAssistant",
",",
"fritz",
":",
"Mock",
")",
":",
"entry",
"=",
"MockConfigEntry",
"(",
"domain",
"=",
"FB_DOMAIN",
",",
"data",
"=",
"MOCK_CONFIG",
"[",
"FB_DOMAIN",
"]",
"[",
"CONF... | [
96,
0
] | [
108,
40
] | python | en | ['en', 'da', 'en'] | True |
test_coordinator_update_after_password_change | (
hass: HomeAssistant, fritz: Mock
) | Test coordinator after password change. | Test coordinator after password change. | async def test_coordinator_update_after_password_change(
hass: HomeAssistant, fritz: Mock
):
"""Test coordinator after password change."""
entry = MockConfigEntry(
domain=FB_DOMAIN,
data=MOCK_CONFIG[FB_DOMAIN][CONF_DEVICES][0],
unique_id="any",
)
entry.add_to_hass(hass)
f... | [
"async",
"def",
"test_coordinator_update_after_password_change",
"(",
"hass",
":",
"HomeAssistant",
",",
"fritz",
":",
"Mock",
")",
":",
"entry",
"=",
"MockConfigEntry",
"(",
"domain",
"=",
"FB_DOMAIN",
",",
"data",
"=",
"MOCK_CONFIG",
"[",
"FB_DOMAIN",
"]",
"["... | [
111,
0
] | [
126,
40
] | python | da | ['da', 'nl', 'en'] | False |
test_unload_remove | (hass: HomeAssistant, fritz: Mock) | Test unload and remove of integration. | Test unload and remove of integration. | async def test_unload_remove(hass: HomeAssistant, fritz: Mock):
"""Test unload and remove of integration."""
fritz().get_devices.return_value = [FritzDeviceSwitchMock()]
entity_id = f"{SWITCH_DOMAIN}.{CONF_FAKE_NAME}"
entry = MockConfigEntry(
domain=FB_DOMAIN,
data=MOCK_CONFIG[FB_DOMAIN... | [
"async",
"def",
"test_unload_remove",
"(",
"hass",
":",
"HomeAssistant",
",",
"fritz",
":",
"Mock",
")",
":",
"fritz",
"(",
")",
".",
"get_devices",
".",
"return_value",
"=",
"[",
"FritzDeviceSwitchMock",
"(",
")",
"]",
"entity_id",
"=",
"f\"{SWITCH_DOMAIN}.{C... | [
129,
0
] | [
165,
24
] | python | en | ['en', 'en', 'en'] | True |
test_raise_config_entry_not_ready_when_offline | (hass: HomeAssistant) | Config entry state is SETUP_RETRY when fritzbox is offline. | Config entry state is SETUP_RETRY when fritzbox is offline. | async def test_raise_config_entry_not_ready_when_offline(hass: HomeAssistant):
"""Config entry state is SETUP_RETRY when fritzbox is offline."""
entry = MockConfigEntry(
domain=FB_DOMAIN,
data={CONF_HOST: "any", **MOCK_CONFIG[FB_DOMAIN][CONF_DEVICES][0]},
unique_id="any",
)
entry... | [
"async",
"def",
"test_raise_config_entry_not_ready_when_offline",
"(",
"hass",
":",
"HomeAssistant",
")",
":",
"entry",
"=",
"MockConfigEntry",
"(",
"domain",
"=",
"FB_DOMAIN",
",",
"data",
"=",
"{",
"CONF_HOST",
":",
"\"any\"",
",",
"*",
"*",
"MOCK_CONFIG",
"["... | [
168,
0
] | [
186,
61
] | python | en | ['en', 'en', 'en'] | True |
FlowHandler.__init__ | (self) | Initialize the Daikin config flow. | Initialize the Daikin config flow. | def __init__(self):
"""Initialize the Daikin config flow."""
self.host = None | [
"def",
"__init__",
"(",
"self",
")",
":",
"self",
".",
"host",
"=",
"None"
] | [
24,
4
] | [
26,
24
] | python | en | ['en', 'en', 'en'] | True |
FlowHandler.schema | (self) | Return current schema. | Return current schema. | def schema(self):
"""Return current schema."""
return vol.Schema(
{
vol.Required(CONF_HOST, default=self.host): str,
vol.Optional(CONF_API_KEY): str,
vol.Optional(CONF_PASSWORD): str,
}
) | [
"def",
"schema",
"(",
"self",
")",
":",
"return",
"vol",
".",
"Schema",
"(",
"{",
"vol",
".",
"Required",
"(",
"CONF_HOST",
",",
"default",
"=",
"self",
".",
"host",
")",
":",
"str",
",",
"vol",
".",
"Optional",
"(",
"CONF_API_KEY",
")",
":",
"str"... | [
29,
4
] | [
37,
9
] | python | de | ['de', 'de', 'en'] | True |
FlowHandler._create_entry | (self, host, mac, key=None, uuid=None, password=None) | Register new entry. | Register new entry. | async def _create_entry(self, host, mac, key=None, uuid=None, password=None):
"""Register new entry."""
if not self.unique_id:
await self.async_set_unique_id(mac)
self._abort_if_unique_id_configured()
return self.async_create_entry(
title=host,
data={... | [
"async",
"def",
"_create_entry",
"(",
"self",
",",
"host",
",",
"mac",
",",
"key",
"=",
"None",
",",
"uuid",
"=",
"None",
",",
"password",
"=",
"None",
")",
":",
"if",
"not",
"self",
".",
"unique_id",
":",
"await",
"self",
".",
"async_set_unique_id",
... | [
39,
4
] | [
54,
9
] | python | en | ['en', 'no', 'en'] | True |
FlowHandler._create_device | (self, host, key=None, password=None) | Create device. | Create device. | async def _create_device(self, host, key=None, password=None):
"""Create device."""
# BRP07Cxx devices needs uuid together with key
if key:
uuid = str(uuid4())
else:
uuid = None
key = None
if not password:
password = None
... | [
"async",
"def",
"_create_device",
"(",
"self",
",",
"host",
",",
"key",
"=",
"None",
",",
"password",
"=",
"None",
")",
":",
"# BRP07Cxx devices needs uuid together with key",
"if",
"key",
":",
"uuid",
"=",
"str",
"(",
"uuid4",
"(",
")",
")",
"else",
":",
... | [
56,
4
] | [
105,
71
] | python | en | ['fr', 'ro', 'en'] | False |
FlowHandler.async_step_user | (self, user_input=None) | User initiated config flow. | User initiated config flow. | async def async_step_user(self, user_input=None):
"""User initiated config flow."""
if user_input is None:
return self.async_show_form(step_id="user", data_schema=self.schema)
return await self._create_device(
user_input[CONF_HOST],
user_input.get(CONF_API_KEY... | [
"async",
"def",
"async_step_user",
"(",
"self",
",",
"user_input",
"=",
"None",
")",
":",
"if",
"user_input",
"is",
"None",
":",
"return",
"self",
".",
"async_show_form",
"(",
"step_id",
"=",
"\"user\"",
",",
"data_schema",
"=",
"self",
".",
"schema",
")",... | [
107,
4
] | [
115,
9
] | python | en | ['en', 'en', 'en'] | True |
FlowHandler.async_step_zeroconf | (self, discovery_info) | Prepare configuration for a discovered Daikin device. | Prepare configuration for a discovered Daikin device. | async def async_step_zeroconf(self, discovery_info):
"""Prepare configuration for a discovered Daikin device."""
_LOGGER.debug("Zeroconf user_input: %s", discovery_info)
devices = Discovery().poll(ip=discovery_info[CONF_HOST])
if not devices:
_LOGGER.debug(
"C... | [
"async",
"def",
"async_step_zeroconf",
"(",
"self",
",",
"discovery_info",
")",
":",
"_LOGGER",
".",
"debug",
"(",
"\"Zeroconf user_input: %s\"",
",",
"discovery_info",
")",
"devices",
"=",
"Discovery",
"(",
")",
".",
"poll",
"(",
"ip",
"=",
"discovery_info",
... | [
117,
4
] | [
131,
43
] | python | en | ['en', 'it', 'en'] | True |
async_setup | (hass, config) | Set up the Luftdaten component. | Set up the Luftdaten component. | async def async_setup(hass, config):
"""Set up the Luftdaten component."""
hass.data[DOMAIN] = {}
hass.data[DOMAIN][DATA_LUFTDATEN_CLIENT] = {}
hass.data[DOMAIN][DATA_LUFTDATEN_LISTENER] = {}
if DOMAIN not in config:
return True
conf = config[DOMAIN]
station_id = conf[CONF_SENSOR_I... | [
"async",
"def",
"async_setup",
"(",
"hass",
",",
"config",
")",
":",
"hass",
".",
"data",
"[",
"DOMAIN",
"]",
"=",
"{",
"}",
"hass",
".",
"data",
"[",
"DOMAIN",
"]",
"[",
"DATA_LUFTDATEN_CLIENT",
"]",
"=",
"{",
"}",
"hass",
".",
"data",
"[",
"DOMAI... | [
130,
0
] | [
157,
15
] | python | en | ['en', 'en', 'en'] | True |
async_setup_entry | (hass, config_entry) | Set up Luftdaten as config entry. | Set up Luftdaten as config entry. | async def async_setup_entry(hass, config_entry):
"""Set up Luftdaten as config entry."""
if not isinstance(config_entry.data[CONF_SENSOR_ID], int):
_async_fixup_sensor_id(hass, config_entry, config_entry.data[CONF_SENSOR_ID])
if (
config_entry.data[CONF_SENSOR_ID] in duplicate_stations(has... | [
"async",
"def",
"async_setup_entry",
"(",
"hass",
",",
"config_entry",
")",
":",
"if",
"not",
"isinstance",
"(",
"config_entry",
".",
"data",
"[",
"CONF_SENSOR_ID",
"]",
",",
"int",
")",
":",
"_async_fixup_sensor_id",
"(",
"hass",
",",
"config_entry",
",",
"... | [
160,
0
] | [
206,
15
] | python | en | ['en', 'en', 'de'] | True |
async_unload_entry | (hass, config_entry) | Unload an Luftdaten config entry. | Unload an Luftdaten config entry. | async def async_unload_entry(hass, config_entry):
"""Unload an Luftdaten config entry."""
remove_listener = hass.data[DOMAIN][DATA_LUFTDATEN_LISTENER].pop(
config_entry.entry_id
)
remove_listener()
hass.data[DOMAIN][DATA_LUFTDATEN_CLIENT].pop(config_entry.entry_id)
return await hass.co... | [
"async",
"def",
"async_unload_entry",
"(",
"hass",
",",
"config_entry",
")",
":",
"remove_listener",
"=",
"hass",
".",
"data",
"[",
"DOMAIN",
"]",
"[",
"DATA_LUFTDATEN_LISTENER",
"]",
".",
"pop",
"(",
"config_entry",
".",
"entry_id",
")",
"remove_listener",
"(... | [
209,
0
] | [
218,
84
] | python | de | ['de', 'en', 'nl'] | False |
LuftDatenData.__init__ | (self, client, sensor_conditions) | Initialize the Luftdata object. | Initialize the Luftdata object. | def __init__(self, client, sensor_conditions):
"""Initialize the Luftdata object."""
self.client = client
self.data = {}
self.sensor_conditions = sensor_conditions | [
"def",
"__init__",
"(",
"self",
",",
"client",
",",
"sensor_conditions",
")",
":",
"self",
".",
"client",
"=",
"client",
"self",
".",
"data",
"=",
"{",
"}",
"self",
".",
"sensor_conditions",
"=",
"sensor_conditions"
] | [
224,
4
] | [
228,
50
] | python | en | ['en', 'en', 'en'] | True |
LuftDatenData.async_update | (self) | Update sensor/binary sensor data. | Update sensor/binary sensor data. | async def async_update(self):
"""Update sensor/binary sensor data."""
try:
await self.client.get_data()
if self.client.values:
self.data[DATA_LUFTDATEN] = self.client.values
self.data[DATA_LUFTDATEN].update(self.client.meta)
except Luftda... | [
"async",
"def",
"async_update",
"(",
"self",
")",
":",
"try",
":",
"await",
"self",
".",
"client",
".",
"get_data",
"(",
")",
"if",
"self",
".",
"client",
".",
"values",
":",
"self",
".",
"data",
"[",
"DATA_LUFTDATEN",
"]",
"=",
"self",
".",
"client"... | [
230,
4
] | [
240,
72
] | python | en | ['en', 'bs', 'en'] | True |
async_setup_entry | (
hass: HomeAssistant, entry: ConfigEntry, async_add_entities: AddEntitiesCallback
) | Set up P1 Monitor Sensors based on a config entry. | Set up P1 Monitor Sensors based on a config entry. | async def async_setup_entry(
hass: HomeAssistant, entry: ConfigEntry, async_add_entities: AddEntitiesCallback
) -> None:
"""Set up P1 Monitor Sensors based on a config entry."""
async_add_entities(
P1MonitorSensorEntity(
coordinator=hass.data[DOMAIN][entry.entry_id],
descript... | [
"async",
"def",
"async_setup_entry",
"(",
"hass",
":",
"HomeAssistant",
",",
"entry",
":",
"ConfigEntry",
",",
"async_add_entities",
":",
"AddEntitiesCallback",
")",
"->",
"None",
":",
"async_add_entities",
"(",
"P1MonitorSensorEntity",
"(",
"coordinator",
"=",
"has... | [
228,
0
] | [
242,
5
] | python | en | ['en', 'en', 'en'] | True |
P1MonitorSensorEntity.__init__ | (
self,
*,
coordinator: P1MonitorDataUpdateCoordinator,
description: SensorEntityDescription,
service_key: Literal["smartmeter", "phases", "settings"],
name: str,
service: str,
) | Initialize P1 Monitor sensor. | Initialize P1 Monitor sensor. | def __init__(
self,
*,
coordinator: P1MonitorDataUpdateCoordinator,
description: SensorEntityDescription,
service_key: Literal["smartmeter", "phases", "settings"],
name: str,
service: str,
) -> None:
"""Initialize P1 Monitor sensor."""
super().... | [
"def",
"__init__",
"(",
"self",
",",
"*",
",",
"coordinator",
":",
"P1MonitorDataUpdateCoordinator",
",",
"description",
":",
"SensorEntityDescription",
",",
"service_key",
":",
"Literal",
"[",
"\"smartmeter\"",
",",
"\"phases\"",
",",
"\"settings\"",
"]",
",",
"n... | [
250,
4
] | [
276,
9
] | python | en | ['en', 'zh-Latn', 'it'] | False |
P1MonitorSensorEntity.native_value | (self) | Return the state of the sensor. | Return the state of the sensor. | def native_value(self) -> StateType:
"""Return the state of the sensor."""
value = getattr(
self.coordinator.data[self._service_key], self.entity_description.key
)
if isinstance(value, str):
return value.lower()
return value | [
"def",
"native_value",
"(",
"self",
")",
"->",
"StateType",
":",
"value",
"=",
"getattr",
"(",
"self",
".",
"coordinator",
".",
"data",
"[",
"self",
".",
"_service_key",
"]",
",",
"self",
".",
"entity_description",
".",
"key",
")",
"if",
"isinstance",
"(... | [
279,
4
] | [
286,
20
] | python | en | ['en', 'en', 'en'] | True |
supported | (event) | Return whether an event supports light. | Return whether an event supports light. | def supported(event):
"""Return whether an event supports light."""
return (
isinstance(event.device, rfxtrxmod.LightingDevice)
and event.device.known_to_be_dimmable
) | [
"def",
"supported",
"(",
"event",
")",
":",
"return",
"(",
"isinstance",
"(",
"event",
".",
"device",
",",
"rfxtrxmod",
".",
"LightingDevice",
")",
"and",
"event",
".",
"device",
".",
"known_to_be_dimmable",
")"
] | [
32,
0
] | [
37,
5
] | python | en | ['en', 'en', 'en'] | True |
async_setup_entry | (
hass,
config_entry,
async_add_entities,
) | Set up config entry. | Set up config entry. | async def async_setup_entry(
hass,
config_entry,
async_add_entities,
):
"""Set up config entry."""
discovery_info = config_entry.data
device_ids = set()
# Add switch from config file
entities = []
for packet_id, entity_info in discovery_info[CONF_DEVICES].items():
event = ge... | [
"async",
"def",
"async_setup_entry",
"(",
"hass",
",",
"config_entry",
",",
"async_add_entities",
",",
")",
":",
"discovery_info",
"=",
"config_entry",
".",
"data",
"device_ids",
"=",
"set",
"(",
")",
"# Add switch from config file",
"entities",
"=",
"[",
"]",
"... | [
40,
0
] | [
99,
56
] | python | en | ['en', 'en', 'en'] | True |
RfxtrxLight.async_added_to_hass | (self) | Restore RFXtrx device state (ON/OFF). | Restore RFXtrx device state (ON/OFF). | async def async_added_to_hass(self):
"""Restore RFXtrx device state (ON/OFF)."""
await super().async_added_to_hass()
if self._event is None:
old_state = await self.async_get_last_state()
if old_state is not None:
self._state = old_state.state == STATE_ON
... | [
"async",
"def",
"async_added_to_hass",
"(",
"self",
")",
":",
"await",
"super",
"(",
")",
".",
"async_added_to_hass",
"(",
")",
"if",
"self",
".",
"_event",
"is",
"None",
":",
"old_state",
"=",
"await",
"self",
".",
"async_get_last_state",
"(",
")",
"if",
... | [
107,
4
] | [
115,
76
] | python | en | ['it', 'en', 'en'] | True |
RfxtrxLight.brightness | (self) | Return the brightness of this light between 0..255. | Return the brightness of this light between 0..255. | def brightness(self):
"""Return the brightness of this light between 0..255."""
return self._brightness | [
"def",
"brightness",
"(",
"self",
")",
":",
"return",
"self",
".",
"_brightness"
] | [
118,
4
] | [
120,
31
] | python | en | ['en', 'en', 'en'] | True |
RfxtrxLight.supported_features | (self) | Flag supported features. | Flag supported features. | def supported_features(self):
"""Flag supported features."""
return SUPPORT_RFXTRX | [
"def",
"supported_features",
"(",
"self",
")",
":",
"return",
"SUPPORT_RFXTRX"
] | [
123,
4
] | [
125,
29
] | python | en | ['da', 'en', 'en'] | True |
RfxtrxLight.is_on | (self) | Return true if device is on. | Return true if device is on. | def is_on(self):
"""Return true if device is on."""
return self._state | [
"def",
"is_on",
"(",
"self",
")",
":",
"return",
"self",
".",
"_state"
] | [
128,
4
] | [
130,
26
] | python | en | ['en', 'fy', 'en'] | True |
RfxtrxLight.async_turn_on | (self, **kwargs) | Turn the device on. | Turn the device on. | async def async_turn_on(self, **kwargs):
"""Turn the device on."""
brightness = kwargs.get(ATTR_BRIGHTNESS)
self._state = True
if brightness is None:
await self._async_send(self._device.send_on)
self._brightness = 255
else:
await self._async_se... | [
"async",
"def",
"async_turn_on",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"brightness",
"=",
"kwargs",
".",
"get",
"(",
"ATTR_BRIGHTNESS",
")",
"self",
".",
"_state",
"=",
"True",
"if",
"brightness",
"is",
"None",
":",
"await",
"self",
".",
"_as... | [
132,
4
] | [
143,
35
] | python | en | ['en', 'en', 'en'] | True |
RfxtrxLight.async_turn_off | (self, **kwargs) | Turn the device off. | Turn the device off. | async def async_turn_off(self, **kwargs):
"""Turn the device off."""
await self._async_send(self._device.send_off)
self._state = False
self._brightness = 0
self.async_write_ha_state() | [
"async",
"def",
"async_turn_off",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"await",
"self",
".",
"_async_send",
"(",
"self",
".",
"_device",
".",
"send_off",
")",
"self",
".",
"_state",
"=",
"False",
"self",
".",
"_brightness",
"=",
"0",
"self",... | [
145,
4
] | [
150,
35
] | python | en | ['en', 'en', 'en'] | True |
RfxtrxLight._apply_event | (self, event) | Apply command from rfxtrx. | Apply command from rfxtrx. | def _apply_event(self, event):
"""Apply command from rfxtrx."""
super()._apply_event(event)
if event.values["Command"] in COMMAND_ON_LIST:
self._state = True
elif event.values["Command"] in COMMAND_OFF_LIST:
self._state = False
elif event.values["Command"]... | [
"def",
"_apply_event",
"(",
"self",
",",
"event",
")",
":",
"super",
"(",
")",
".",
"_apply_event",
"(",
"event",
")",
"if",
"event",
".",
"values",
"[",
"\"Command\"",
"]",
"in",
"COMMAND_ON_LIST",
":",
"self",
".",
"_state",
"=",
"True",
"elif",
"eve... | [
152,
4
] | [
161,
46
] | python | en | ['en', 'en', 'en'] | True |
RfxtrxLight._handle_event | (self, event, device_id) | Check if event applies to me and update. | Check if event applies to me and update. | def _handle_event(self, event, device_id):
"""Check if event applies to me and update."""
if device_id != self._device_id:
return
self._apply_event(event)
self.async_write_ha_state() | [
"def",
"_handle_event",
"(",
"self",
",",
"event",
",",
"device_id",
")",
":",
"if",
"device_id",
"!=",
"self",
".",
"_device_id",
":",
"return",
"self",
".",
"_apply_event",
"(",
"event",
")",
"self",
".",
"async_write_ha_state",
"(",
")"
] | [
164,
4
] | [
171,
35
] | python | en | ['en', 'en', 'en'] | True |
test_mysa_living_setup | (hass) | Test that the accessory can be correctly setup in HA. | Test that the accessory can be correctly setup in HA. | async def test_mysa_living_setup(hass):
"""Test that the accessory can be correctly setup in HA."""
accessories = await setup_accessories_from_file(hass, "mysa_living.json")
config_entry, pairing = await setup_test_accessories(hass, accessories)
entity_registry = er.async_get(hass)
device_registry ... | [
"async",
"def",
"test_mysa_living_setup",
"(",
"hass",
")",
":",
"accessories",
"=",
"await",
"setup_accessories_from_file",
"(",
"hass",
",",
"\"mysa_living.json\"",
")",
"config_entry",
",",
"pairing",
"=",
"await",
"setup_test_accessories",
"(",
"hass",
",",
"acc... | [
11,
0
] | [
90,
39
] | python | en | ['en', 'en', 'en'] | True |
async_setup_entry | (hass, config, async_add_entities) | Set up the Blink Alarm Control Panels. | Set up the Blink Alarm Control Panels. | async def async_setup_entry(hass, config, async_add_entities):
"""Set up the Blink Alarm Control Panels."""
data = hass.data[DOMAIN][config.entry_id]
sync_modules = []
for sync_name, sync_module in data.sync.items():
sync_modules.append(BlinkSyncModule(data, sync_name, sync_module))
async_a... | [
"async",
"def",
"async_setup_entry",
"(",
"hass",
",",
"config",
",",
"async_add_entities",
")",
":",
"data",
"=",
"hass",
".",
"data",
"[",
"DOMAIN",
"]",
"[",
"config",
".",
"entry_id",
"]",
"sync_modules",
"=",
"[",
"]",
"for",
"sync_name",
",",
"sync... | [
18,
0
] | [
25,
36
] | python | en | ['en', 'en', 'en'] | True |
BlinkSyncModule.__init__ | (self, data, name, sync) | Initialize the alarm control panel. | Initialize the alarm control panel. | def __init__(self, data, name, sync):
"""Initialize the alarm control panel."""
self.data = data
self.sync = sync
self._name = name
self._attr_unique_id = sync.serial
self._attr_name = f"{DOMAIN} {name}" | [
"def",
"__init__",
"(",
"self",
",",
"data",
",",
"name",
",",
"sync",
")",
":",
"self",
".",
"data",
"=",
"data",
"self",
".",
"sync",
"=",
"sync",
"self",
".",
"_name",
"=",
"name",
"self",
".",
"_attr_unique_id",
"=",
"sync",
".",
"serial",
"sel... | [
34,
4
] | [
40,
44
] | python | en | ['en', 'en', 'en'] | True |
BlinkSyncModule.update | (self) | Update the state of the device. | Update the state of the device. | def update(self):
"""Update the state of the device."""
_LOGGER.debug("Updating Blink Alarm Control Panel %s", self._name)
self.data.refresh()
self._attr_state = (
STATE_ALARM_ARMED_AWAY if self.sync.arm else STATE_ALARM_DISARMED
)
self.sync.attributes["networ... | [
"def",
"update",
"(",
"self",
")",
":",
"_LOGGER",
".",
"debug",
"(",
"\"Updating Blink Alarm Control Panel %s\"",
",",
"self",
".",
"_name",
")",
"self",
".",
"data",
".",
"refresh",
"(",
")",
"self",
".",
"_attr_state",
"=",
"(",
"STATE_ALARM_ARMED_AWAY",
... | [
42,
4
] | [
52,
64
] | python | en | ['en', 'en', 'en'] | True |
BlinkSyncModule.alarm_disarm | (self, code=None) | Send disarm command. | Send disarm command. | def alarm_disarm(self, code=None):
"""Send disarm command."""
self.sync.arm = False
self.sync.refresh() | [
"def",
"alarm_disarm",
"(",
"self",
",",
"code",
"=",
"None",
")",
":",
"self",
".",
"sync",
".",
"arm",
"=",
"False",
"self",
".",
"sync",
".",
"refresh",
"(",
")"
] | [
54,
4
] | [
57,
27
] | python | en | ['en', 'pt', 'en'] | True |
BlinkSyncModule.alarm_arm_away | (self, code=None) | Send arm command. | Send arm command. | def alarm_arm_away(self, code=None):
"""Send arm command."""
self.sync.arm = True
self.sync.refresh() | [
"def",
"alarm_arm_away",
"(",
"self",
",",
"code",
"=",
"None",
")",
":",
"self",
".",
"sync",
".",
"arm",
"=",
"True",
"self",
".",
"sync",
".",
"refresh",
"(",
")"
] | [
59,
4
] | [
62,
27
] | python | en | ['en', 'fr', 'en'] | True |
async_setup | (hass, config) | Set up the Nuki component. | Set up the Nuki component. | async def async_setup(hass, config):
"""Set up the Nuki component."""
hass.data.setdefault(DOMAIN, {})
for platform in PLATFORMS:
confs = config.get(platform)
if confs is None:
continue
for conf in confs:
if CONF_PLATFORM in conf and conf[CONF_PLATFORM] == D... | [
"async",
"def",
"async_setup",
"(",
"hass",
",",
"config",
")",
":",
"hass",
".",
"data",
".",
"setdefault",
"(",
"DOMAIN",
",",
"{",
"}",
")",
"for",
"platform",
"in",
"PLATFORMS",
":",
"confs",
"=",
"config",
".",
"get",
"(",
"platform",
")",
"if",... | [
52,
0
] | [
75,
15
] | python | en | ['en', 'fr', 'en'] | True |
async_setup_entry | (hass, entry) | Set up the Nuki entry. | Set up the Nuki entry. | async def async_setup_entry(hass, entry):
"""Set up the Nuki entry."""
hass.data.setdefault(DOMAIN, {})
try:
bridge = await hass.async_add_executor_job(
NukiBridge,
entry.data[CONF_HOST],
entry.data[CONF_TOKEN],
entry.data[CONF_PORT],
Tru... | [
"async",
"def",
"async_setup_entry",
"(",
"hass",
",",
"entry",
")",
":",
"hass",
".",
"data",
".",
"setdefault",
"(",
"DOMAIN",
",",
"{",
"}",
")",
"try",
":",
"bridge",
"=",
"await",
"hass",
".",
"async_add_executor_job",
"(",
"NukiBridge",
",",
"entry... | [
78,
0
] | [
133,
15
] | python | en | ['en', 'en', 'en'] | True |
async_unload_entry | (hass, entry) | Unload the Nuki entry. | Unload the Nuki entry. | async def async_unload_entry(hass, entry):
"""Unload the Nuki entry."""
unload_ok = await hass.config_entries.async_unload_platforms(entry, PLATFORMS)
if unload_ok:
hass.data[DOMAIN].pop(entry.entry_id)
return unload_ok | [
"async",
"def",
"async_unload_entry",
"(",
"hass",
",",
"entry",
")",
":",
"unload_ok",
"=",
"await",
"hass",
".",
"config_entries",
".",
"async_unload_platforms",
"(",
"entry",
",",
"PLATFORMS",
")",
"if",
"unload_ok",
":",
"hass",
".",
"data",
"[",
"DOMAIN... | [
136,
0
] | [
142,
20
] | python | en | ['en', 'en', 'en'] | True |
NukiEntity.__init__ | (self, coordinator, nuki_device) | Pass coordinator to CoordinatorEntity. | Pass coordinator to CoordinatorEntity. | def __init__(self, coordinator, nuki_device):
"""Pass coordinator to CoordinatorEntity."""
super().__init__(coordinator)
self._nuki_device = nuki_device | [
"def",
"__init__",
"(",
"self",
",",
"coordinator",
",",
"nuki_device",
")",
":",
"super",
"(",
")",
".",
"__init__",
"(",
"coordinator",
")",
"self",
".",
"_nuki_device",
"=",
"nuki_device"
] | [
156,
4
] | [
159,
39
] | python | en | ['en', 'ky', 'en'] | True |
setup_platform | (hass, config, add_entities, discovery_info=None) | Set up the raspihats binary_sensor devices. | Set up the raspihats binary_sensor devices. | def setup_platform(hass, config, add_entities, discovery_info=None):
"""Set up the raspihats binary_sensor devices."""
I2CHatBinarySensor.I2C_HATS_MANAGER = hass.data[I2C_HATS_MANAGER]
binary_sensors = []
i2c_hat_configs = config.get(CONF_I2C_HATS)
for i2c_hat_config in i2c_hat_configs:
addr... | [
"def",
"setup_platform",
"(",
"hass",
",",
"config",
",",
"add_entities",
",",
"discovery_info",
"=",
"None",
")",
":",
"I2CHatBinarySensor",
".",
"I2C_HATS_MANAGER",
"=",
"hass",
".",
"data",
"[",
"I2C_HATS_MANAGER",
"]",
"binary_sensors",
"=",
"[",
"]",
"i2c... | [
56,
0
] | [
80,
32
] | python | en | ['en', 'haw', 'en'] | True |
I2CHatBinarySensor.__init__ | (self, address, channel, name, invert_logic, device_class) | Initialize the raspihats sensor. | Initialize the raspihats sensor. | def __init__(self, address, channel, name, invert_logic, device_class):
"""Initialize the raspihats sensor."""
self._address = address
self._channel = channel
self._name = name or DEVICE_DEFAULT_NAME
self._invert_logic = invert_logic
self._device_class = device_class
... | [
"def",
"__init__",
"(",
"self",
",",
"address",
",",
"channel",
",",
"name",
",",
"invert_logic",
",",
"device_class",
")",
":",
"self",
".",
"_address",
"=",
"address",
"self",
".",
"_channel",
"=",
"channel",
"self",
".",
"_name",
"=",
"name",
"or",
... | [
88,
4
] | [
112,
9
] | python | en | ['en', 'bg', 'en'] | True |
I2CHatBinarySensor.device_class | (self) | Return the class of this sensor. | Return the class of this sensor. | def device_class(self):
"""Return the class of this sensor."""
return self._device_class | [
"def",
"device_class",
"(",
"self",
")",
":",
"return",
"self",
".",
"_device_class"
] | [
115,
4
] | [
117,
33
] | python | en | ['en', 'en', 'en'] | True |
I2CHatBinarySensor.name | (self) | Return the name of this sensor. | Return the name of this sensor. | def name(self):
"""Return the name of this sensor."""
return self._name | [
"def",
"name",
"(",
"self",
")",
":",
"return",
"self",
".",
"_name"
] | [
120,
4
] | [
122,
25
] | python | en | ['en', 'mi', 'en'] | True |
I2CHatBinarySensor.should_poll | (self) | No polling needed for this sensor. | No polling needed for this sensor. | def should_poll(self):
"""No polling needed for this sensor."""
return False | [
"def",
"should_poll",
"(",
"self",
")",
":",
"return",
"False"
] | [
125,
4
] | [
127,
20
] | python | en | ['en', 'en', 'en'] | True |
I2CHatBinarySensor.is_on | (self) | Return the state of this sensor. | Return the state of this sensor. | def is_on(self):
"""Return the state of this sensor."""
return self._state != self._invert_logic | [
"def",
"is_on",
"(",
"self",
")",
":",
"return",
"self",
".",
"_state",
"!=",
"self",
".",
"_invert_logic"
] | [
130,
4
] | [
132,
48
] | python | en | ['en', 'en', 'en'] | True |
async_setup_entry | (hass, config_entry, async_add_entities) | Set up the iRobot Roomba vacuum cleaner. | Set up the iRobot Roomba vacuum cleaner. | async def async_setup_entry(hass, config_entry, async_add_entities):
"""Set up the iRobot Roomba vacuum cleaner."""
domain_data = hass.data[DOMAIN][config_entry.entry_id]
roomba = domain_data[ROOMBA_SESSION]
blid = domain_data[BLID]
status = roomba_reported_state(roomba).get("bin", {})
if "full"... | [
"async",
"def",
"async_setup_entry",
"(",
"hass",
",",
"config_entry",
",",
"async_add_entities",
")",
":",
"domain_data",
"=",
"hass",
".",
"data",
"[",
"DOMAIN",
"]",
"[",
"config_entry",
".",
"entry_id",
"]",
"roomba",
"=",
"domain_data",
"[",
"ROOMBA_SESSI... | [
8,
0
] | [
16,
46
] | python | en | ['en', 'en', 'en'] | True |
RoombaBinStatus.name | (self) | Return the name of the sensor. | Return the name of the sensor. | def name(self):
"""Return the name of the sensor."""
return f"{self._name} Bin Full" | [
"def",
"name",
"(",
"self",
")",
":",
"return",
"f\"{self._name} Bin Full\""
] | [
25,
4
] | [
27,
39
] | python | en | ['en', 'mi', 'en'] | True |
RoombaBinStatus.unique_id | (self) | Return the ID of this sensor. | Return the ID of this sensor. | def unique_id(self):
"""Return the ID of this sensor."""
return f"bin_{self._blid}" | [
"def",
"unique_id",
"(",
"self",
")",
":",
"return",
"f\"bin_{self._blid}\""
] | [
30,
4
] | [
32,
34
] | python | en | ['en', 'ja', 'en'] | True |
RoombaBinStatus.icon | (self) | Return the icon of this sensor. | Return the icon of this sensor. | def icon(self):
"""Return the icon of this sensor."""
return self.ICON | [
"def",
"icon",
"(",
"self",
")",
":",
"return",
"self",
".",
"ICON"
] | [
35,
4
] | [
37,
24
] | python | en | ['en', 'en', 'en'] | True |
RoombaBinStatus.is_on | (self) | Return the state of the sensor. | Return the state of the sensor. | def is_on(self):
"""Return the state of the sensor."""
return roomba_reported_state(self.vacuum).get("bin", {}).get("full", False) | [
"def",
"is_on",
"(",
"self",
")",
":",
"return",
"roomba_reported_state",
"(",
"self",
".",
"vacuum",
")",
".",
"get",
"(",
"\"bin\"",
",",
"{",
"}",
")",
".",
"get",
"(",
"\"full\"",
",",
"False",
")"
] | [
40,
4
] | [
42,
83
] | python | en | ['en', 'en', 'en'] | True |
RoombaBinStatus.new_state_filter | (self, new_state) | Filter the new state. | Filter the new state. | def new_state_filter(self, new_state):
"""Filter the new state."""
return "bin" in new_state | [
"def",
"new_state_filter",
"(",
"self",
",",
"new_state",
")",
":",
"return",
"\"bin\"",
"in",
"new_state"
] | [
44,
4
] | [
46,
33
] | python | en | ['en', 'en', 'en'] | True |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.