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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
ImportCollector.visit_ImportFrom | (self, node) | Visit ImportFrom node. | Visit ImportFrom node. | def visit_ImportFrom(self, node):
"""Visit ImportFrom node."""
if node.module is None:
return
if node.module.startswith("homeassistant.components."):
# from homeassistant.components.alexa.smart_home import EVENT_ALEXA_SMART_HOME
# from homeassistant.component... | [
"def",
"visit_ImportFrom",
"(",
"self",
",",
"node",
")",
":",
"if",
"node",
".",
"module",
"is",
"None",
":",
"return",
"if",
"node",
".",
"module",
".",
"startswith",
"(",
"\"homeassistant.components.\"",
")",
":",
"# from homeassistant.components.alexa.smart_ho... | [
36,
4
] | [
49,
51
] | python | en | ['en', 'en', 'en'] | True |
ImportCollector.visit_Import | (self, node) | Visit Import node. | Visit Import node. | def visit_Import(self, node):
"""Visit Import node."""
# import homeassistant.components.hue as hue
for name_node in node.names:
if name_node.name.startswith("homeassistant.components."):
self._add_reference(name_node.name.split(".")[2]) | [
"def",
"visit_Import",
"(",
"self",
",",
"node",
")",
":",
"# import homeassistant.components.hue as hue",
"for",
"name_node",
"in",
"node",
".",
"names",
":",
"if",
"name_node",
".",
"name",
".",
"startswith",
"(",
"\"homeassistant.components.\"",
")",
":",
"self... | [
51,
4
] | [
56,
65
] | python | en | ['en', 'da', 'en'] | True |
ImportCollector.visit_Attribute | (self, node) | Visit Attribute node. | Visit Attribute node. | def visit_Attribute(self, node):
"""Visit Attribute node."""
# hass.components.hue.async_create()
# Name(id=hass)
# .Attribute(attr=hue)
# .Attribute(attr=async_create)
# self.hass.components.hue.async_create()
# Name(id=self)
# .Attribute(attr=hass... | [
"def",
"visit_Attribute",
"(",
"self",
",",
"node",
")",
":",
"# hass.components.hue.async_create()",
"# Name(id=hass)",
"# .Attribute(attr=hue)",
"# .Attribute(attr=async_create)",
"# self.hass.components.hue.async_create()",
"# Name(id=self)",
"# .Attribute(attr=hass) or .Attribu... | [
58,
4
] | [
87,
36
] | python | en | ['en', 'la', 'en'] | True |
clean_folder | (path) |
Function to clean all Cython and Python artifacts and cache folders. It
clean the folder as well as its direct children recursively.
Parameters
----------
path : String
Path to the folder to be cleaned.
|
Function to clean all Cython and Python artifacts and cache folders. It
clean the folder as well as its direct children recursively. | def clean_folder(path):
"""
Function to clean all Cython and Python artifacts and cache folders. It
clean the folder as well as its direct children recursively.
Parameters
----------
path : String
Path to the folder to be cleaned.
"""
shutil.rmtree(path + '/__pycache__', ignore_... | [
"def",
"clean_folder",
"(",
"path",
")",
":",
"shutil",
".",
"rmtree",
"(",
"path",
"+",
"'/__pycache__'",
",",
"ignore_errors",
"=",
"True",
")",
"folders",
"=",
"glob",
".",
"glob",
"(",
"path",
"+",
"'/*/'",
")",
"for",
"folder",
"in",
"folders",
":... | [
46,
0
] | [
67,
27
] | python | en | ['en', 'error', 'th'] | False |
use_raft_package | (raft_path, cpp_build_path,
git_info_file='../cpp/cmake/Dependencies.cmake') |
Function to use the python code in RAFT in package.raft
- Uses RAFT located in $RAFT_PATH if $RAFT_PATH exists.
- Otherwise it will look for RAFT in the libcuml build folder,
located either in the default location ../cpp/build or in
$CUML_BUILD_PATH.
-Otherwise it will clone RAFT into ... |
Function to use the python code in RAFT in package.raft | def use_raft_package(raft_path, cpp_build_path,
git_info_file='../cpp/cmake/Dependencies.cmake'):
"""
Function to use the python code in RAFT in package.raft
- Uses RAFT located in $RAFT_PATH if $RAFT_PATH exists.
- Otherwise it will look for RAFT in the libcuml build folder,
... | [
"def",
"use_raft_package",
"(",
"raft_path",
",",
"cpp_build_path",
",",
"git_info_file",
"=",
"'../cpp/cmake/Dependencies.cmake'",
")",
":",
"if",
"not",
"raft_path",
":",
"raft_path",
",",
"raft_cloned",
"=",
"clone_repo_if_needed",
"(",
"'raft'",
",",
"cpp_build_pa... | [
70,
0
] | [
99,
58
] | python | en | ['en', 'error', 'th'] | False |
get_submodule_dependency | (repo,
git_info_file='../cpp/cmake/Dependencies.cmake',
cpp_build_path='../cpp/build/') |
Function to check if sub repositories (i.e. submodules in git terminology)
already exist in the libcuml build folder, otherwise will clone the
repos needed to build the cuML Python package.
Parameters
----------
repo : Strings or list of Strings
Name of the repos to be cloned. Must mat... |
Function to check if sub repositories (i.e. submodules in git terminology)
already exist in the libcuml build folder, otherwise will clone the
repos needed to build the cuML Python package. | def get_submodule_dependency(repo,
git_info_file='../cpp/cmake/Dependencies.cmake',
cpp_build_path='../cpp/build/'):
"""
Function to check if sub repositories (i.e. submodules in git terminology)
already exist in the libcuml build folder, otherwise w... | [
"def",
"get_submodule_dependency",
"(",
"repo",
",",
"git_info_file",
"=",
"'../cpp/cmake/Dependencies.cmake'",
",",
"cpp_build_path",
"=",
"'../cpp/build/'",
")",
":",
"if",
"isinstance",
"(",
"repo",
",",
"str",
")",
":",
"repos",
"=",
"[",
"repo",
"]",
"repo_... | [
121,
0
] | [
173,
19
] | python | en | ['en', 'error', 'th'] | False |
clone_repo | (name, GIT_REPOSITORY, GIT_TAG,
location_to_clone='_external_repositories/', force_clone=False) |
Function to clone repos if they have not been cloned already.
Variables are named identical to the cmake counterparts for clarity,
in spite of not being very pythonic.
Parameters
----------
name : String
Name of the repo to be cloned
GIT_REPOSITORY : String
URL of the repo ... |
Function to clone repos if they have not been cloned already.
Variables are named identical to the cmake counterparts for clarity,
in spite of not being very pythonic. | def clone_repo(name, GIT_REPOSITORY, GIT_TAG,
location_to_clone='_external_repositories/', force_clone=False):
"""
Function to clone repos if they have not been cloned already.
Variables are named identical to the cmake counterparts for clarity,
in spite of not being very pythonic.
P... | [
"def",
"clone_repo",
"(",
"name",
",",
"GIT_REPOSITORY",
",",
"GIT_TAG",
",",
"location_to_clone",
"=",
"'_external_repositories/'",
",",
"force_clone",
"=",
"False",
")",
":",
"if",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"location_to_clone",
"+",
"name... | [
176,
0
] | [
211,
19
] | python | en | ['en', 'error', 'th'] | False |
get_repo_cmake_info | (names, file_path) |
Function to find information about submodules from cpp/CMakeLists file
Parameters
----------
name : List of Strings
List containing the names of the repos to be cloned. Must match
the names of the cmake git clone instruction
`ExternalProject_Add(name`
file_path : String
... |
Function to find information about submodules from cpp/CMakeLists file | def get_repo_cmake_info(names, file_path):
"""
Function to find information about submodules from cpp/CMakeLists file
Parameters
----------
name : List of Strings
List containing the names of the repos to be cloned. Must match
the names of the cmake git clone instruction
`Ex... | [
"def",
"get_repo_cmake_info",
"(",
"names",
",",
"file_path",
")",
":",
"with",
"open",
"(",
"file_path",
")",
"as",
"f",
":",
"s",
"=",
"f",
".",
"read",
"(",
")",
"results",
"=",
"{",
"}",
"for",
"name",
"in",
"names",
":",
"res",
"=",
"re",
".... | [
214,
0
] | [
253,
18
] | python | en | ['en', 'error', 'th'] | False |
RetrieveableMixin.get | (self, object_id) |
Method for getting an object with the specified id
|
Method for getting an object with the specified id
| def get(self, object_id):
'''
Method for getting an object with the specified id
'''
headers, _ = self.build_request_args()
url = "%s%s/%s" % (self.PAYSTACK_URL, self._endpoint, object_id)
response = requests.get(url, headers=headers)
content = response.content
... | [
"def",
"get",
"(",
"self",
",",
"object_id",
")",
":",
"headers",
",",
"_",
"=",
"self",
".",
"build_request_args",
"(",
")",
"url",
"=",
"\"%s%s/%s\"",
"%",
"(",
"self",
".",
"PAYSTACK_URL",
",",
"self",
".",
"_endpoint",
",",
"object_id",
")",
"respo... | [
59,
4
] | [
77,
51
] | python | en | ['en', 'error', 'th'] | False |
UpdateableMixin.update | (self, object_id, updated_object) |
Method for updating existing plan
|
Method for updating existing plan
| def update(self, object_id, updated_object):
'''
Method for updating existing plan
'''
if not isinstance(updated_object, self._object_class):
raise TypeError
data = updated_object.to_json()
headers, _ = self.build_request_args()
url = "%s%s/%s" % (sel... | [
"def",
"update",
"(",
"self",
",",
"object_id",
",",
"updated_object",
")",
":",
"if",
"not",
"isinstance",
"(",
"updated_object",
",",
"self",
".",
"_object_class",
")",
":",
"raise",
"TypeError",
"data",
"=",
"updated_object",
".",
"to_json",
"(",
")",
"... | [
81,
4
] | [
100,
51
] | python | en | ['en', 'error', 'th'] | False |
test_state_via_state_topic | (hass, mqtt_mock) | Test the controlling state via topic. | Test the controlling state via topic. | async def test_state_via_state_topic(hass, mqtt_mock):
"""Test the controlling state via topic."""
assert await async_setup_component(
hass,
cover.DOMAIN,
{
cover.DOMAIN: {
"platform": "mqtt",
"name": "test",
"state_topic": "sta... | [
"async",
"def",
"test_state_via_state_topic",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"cover",
".",
"DOMAIN",
",",
"{",
"cover",
".",
"DOMAIN",
":",
"{",
"\"platform\"",
":",
"\"mqtt\"",
",",
"\"... | [
63,
0
] | [
95,
36
] | python | en | ['en', 'en', 'en'] | True |
test_opening_and_closing_state_via_custom_state_payload | (hass, mqtt_mock) | Test the controlling opening and closing state via a custom payload. | Test the controlling opening and closing state via a custom payload. | async def test_opening_and_closing_state_via_custom_state_payload(hass, mqtt_mock):
"""Test the controlling opening and closing state via a custom payload."""
assert await async_setup_component(
hass,
cover.DOMAIN,
{
cover.DOMAIN: {
"platform": "mqtt",
... | [
"async",
"def",
"test_opening_and_closing_state_via_custom_state_payload",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"cover",
".",
"DOMAIN",
",",
"{",
"cover",
".",
"DOMAIN",
":",
"{",
"\"platform\"",
":... | [
98,
0
] | [
137,
38
] | python | en | ['en', 'en', 'en'] | True |
test_open_closed_state_from_position_optimistic | (hass, mqtt_mock) | Test the state after setting the position using optimistic mode. | Test the state after setting the position using optimistic mode. | async def test_open_closed_state_from_position_optimistic(hass, mqtt_mock):
"""Test the state after setting the position using optimistic mode."""
assert await async_setup_component(
hass,
cover.DOMAIN,
{
cover.DOMAIN: {
"platform": "mqtt",
"na... | [
"async",
"def",
"test_open_closed_state_from_position_optimistic",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"cover",
".",
"DOMAIN",
",",
"{",
"cover",
".",
"DOMAIN",
":",
"{",
"\"platform\"",
":",
"\"... | [
140,
0
] | [
184,
51
] | python | en | ['en', 'en', 'en'] | True |
test_position_via_position_topic | (hass, mqtt_mock) | Test the controlling state via topic. | Test the controlling state via topic. | async def test_position_via_position_topic(hass, mqtt_mock):
"""Test the controlling state via topic."""
assert await async_setup_component(
hass,
cover.DOMAIN,
{
cover.DOMAIN: {
"platform": "mqtt",
"name": "test",
"position_top... | [
"async",
"def",
"test_position_via_position_topic",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"cover",
".",
"DOMAIN",
",",
"{",
"cover",
".",
"DOMAIN",
":",
"{",
"\"platform\"",
":",
"\"mqtt\"",
",",... | [
187,
0
] | [
221,
36
] | python | en | ['en', 'en', 'en'] | True |
test_state_via_template | (hass, mqtt_mock) | Test the controlling state via topic. | Test the controlling state via topic. | async def test_state_via_template(hass, mqtt_mock):
"""Test the controlling state via topic."""
assert await async_setup_component(
hass,
cover.DOMAIN,
{
cover.DOMAIN: {
"platform": "mqtt",
"name": "test",
"state_topic": "state-... | [
"async",
"def",
"test_state_via_template",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"cover",
".",
"DOMAIN",
",",
"{",
"cover",
".",
"DOMAIN",
":",
"{",
"\"platform\"",
":",
"\"mqtt\"",
",",
"\"nam... | [
224,
0
] | [
258,
38
] | python | en | ['en', 'en', 'en'] | True |
test_position_via_template | (hass, mqtt_mock) | Test the controlling state via topic. | Test the controlling state via topic. | async def test_position_via_template(hass, mqtt_mock):
"""Test the controlling state via topic."""
assert await async_setup_component(
hass,
cover.DOMAIN,
{
cover.DOMAIN: {
"platform": "mqtt",
"name": "test",
"position_topic": "... | [
"async",
"def",
"test_position_via_template",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"cover",
".",
"DOMAIN",
",",
"{",
"cover",
".",
"DOMAIN",
":",
"{",
"\"platform\"",
":",
"\"mqtt\"",
",",
"\"... | [
261,
0
] | [
295,
38
] | python | en | ['en', 'en', 'en'] | True |
test_optimistic_state_change | (hass, mqtt_mock) | Test changing state optimistically. | Test changing state optimistically. | async def test_optimistic_state_change(hass, mqtt_mock):
"""Test changing state optimistically."""
assert await async_setup_component(
hass,
cover.DOMAIN,
{
cover.DOMAIN: {
"platform": "mqtt",
"name": "test",
"command_topic": "c... | [
"async",
"def",
"test_optimistic_state_change",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"cover",
".",
"DOMAIN",
",",
"{",
"cover",
".",
"DOMAIN",
":",
"{",
"\"platform\"",
":",
"\"mqtt\"",
",",
"... | [
298,
0
] | [
351,
38
] | python | en | ['en', 'en', 'en'] | True |
test_optimistic_state_change_with_position | (hass, mqtt_mock) | Test changing state optimistically. | Test changing state optimistically. | async def test_optimistic_state_change_with_position(hass, mqtt_mock):
"""Test changing state optimistically."""
assert await async_setup_component(
hass,
cover.DOMAIN,
{
cover.DOMAIN: {
"platform": "mqtt",
"name": "test",
"opti... | [
"async",
"def",
"test_optimistic_state_change_with_position",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"cover",
".",
"DOMAIN",
",",
"{",
"cover",
".",
"DOMAIN",
":",
"{",
"\"platform\"",
":",
"\"mqtt\... | [
354,
0
] | [
414,
59
] | python | en | ['en', 'en', 'en'] | True |
test_send_open_cover_command | (hass, mqtt_mock) | Test the sending of open_cover. | Test the sending of open_cover. | async def test_send_open_cover_command(hass, mqtt_mock):
"""Test the sending of open_cover."""
assert await async_setup_component(
hass,
cover.DOMAIN,
{
cover.DOMAIN: {
"platform": "mqtt",
"name": "test",
"state_topic": "state-t... | [
"async",
"def",
"test_send_open_cover_command",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"cover",
".",
"DOMAIN",
",",
"{",
"cover",
".",
"DOMAIN",
":",
"{",
"\"platform\"",
":",
"\"mqtt\"",
",",
"... | [
417,
0
] | [
443,
39
] | python | en | ['en', 'en', 'en'] | True |
test_send_close_cover_command | (hass, mqtt_mock) | Test the sending of close_cover. | Test the sending of close_cover. | async def test_send_close_cover_command(hass, mqtt_mock):
"""Test the sending of close_cover."""
assert await async_setup_component(
hass,
cover.DOMAIN,
{
cover.DOMAIN: {
"platform": "mqtt",
"name": "test",
"state_topic": "state... | [
"async",
"def",
"test_send_close_cover_command",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"cover",
".",
"DOMAIN",
",",
"{",
"cover",
".",
"DOMAIN",
":",
"{",
"\"platform\"",
":",
"\"mqtt\"",
",",
... | [
446,
0
] | [
472,
39
] | python | en | ['en', 'en', 'en'] | True |
test_send_stop__cover_command | (hass, mqtt_mock) | Test the sending of stop_cover. | Test the sending of stop_cover. | async def test_send_stop__cover_command(hass, mqtt_mock):
"""Test the sending of stop_cover."""
assert await async_setup_component(
hass,
cover.DOMAIN,
{
cover.DOMAIN: {
"platform": "mqtt",
"name": "test",
"state_topic": "state-... | [
"async",
"def",
"test_send_stop__cover_command",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"cover",
".",
"DOMAIN",
",",
"{",
"cover",
".",
"DOMAIN",
":",
"{",
"\"platform\"",
":",
"\"mqtt\"",
",",
... | [
475,
0
] | [
501,
39
] | python | en | ['en', 'en', 'en'] | True |
test_current_cover_position | (hass, mqtt_mock) | Test the current cover position. | Test the current cover position. | async def test_current_cover_position(hass, mqtt_mock):
"""Test the current cover position."""
assert await async_setup_component(
hass,
cover.DOMAIN,
{
cover.DOMAIN: {
"platform": "mqtt",
"name": "test",
"position_topic": "get-... | [
"async",
"def",
"test_current_cover_position",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"cover",
".",
"DOMAIN",
",",
"{",
"cover",
".",
"DOMAIN",
":",
"{",
"\"platform\"",
":",
"\"mqtt\"",
",",
"\... | [
504,
0
] | [
552,
40
] | python | en | ['en', 'en', 'en'] | True |
test_current_cover_position_inverted | (hass, mqtt_mock) | Test the current cover position. | Test the current cover position. | async def test_current_cover_position_inverted(hass, mqtt_mock):
"""Test the current cover position."""
assert await async_setup_component(
hass,
cover.DOMAIN,
{
cover.DOMAIN: {
"platform": "mqtt",
"name": "test",
"position_topi... | [
"async",
"def",
"test_current_cover_position_inverted",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"cover",
".",
"DOMAIN",
",",
"{",
"cover",
".",
"DOMAIN",
":",
"{",
"\"platform\"",
":",
"\"mqtt\"",
... | [
555,
0
] | [
614,
62
] | python | en | ['en', 'en', 'en'] | True |
test_optimistic_position | (hass, mqtt_mock) | Test optimistic position is not supported. | Test optimistic position is not supported. | async def test_optimistic_position(hass, mqtt_mock):
"""Test optimistic position is not supported."""
assert await async_setup_component(
hass,
cover.DOMAIN,
{
cover.DOMAIN: {
"platform": "mqtt",
"name": "test",
"command_topic":... | [
"async",
"def",
"test_optimistic_position",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"cover",
".",
"DOMAIN",
",",
"{",
"cover",
".",
"DOMAIN",
":",
"{",
"\"platform\"",
":",
"\"mqtt\"",
",",
"\"na... | [
617,
0
] | [
634,
24
] | python | en | ['en', 'en', 'en'] | True |
test_position_update | (hass, mqtt_mock) | Test cover position update from received MQTT message. | Test cover position update from received MQTT message. | async def test_position_update(hass, mqtt_mock):
"""Test cover position update from received MQTT message."""
assert await async_setup_component(
hass,
cover.DOMAIN,
{
cover.DOMAIN: {
"platform": "mqtt",
"name": "test",
"positio... | [
"async",
"def",
"test_position_update",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"cover",
".",
"DOMAIN",
",",
"{",
"cover",
".",
"DOMAIN",
":",
"{",
"\"platform\"",
":",
"\"mqtt\"",
",",
"\"name\"... | [
637,
0
] | [
671,
39
] | python | en | ['en', 'en', 'en'] | True |
test_set_position_templated | (hass, mqtt_mock) | Test setting cover position via template. | Test setting cover position via template. | async def test_set_position_templated(hass, mqtt_mock):
"""Test setting cover position via template."""
assert await async_setup_component(
hass,
cover.DOMAIN,
{
cover.DOMAIN: {
"platform": "mqtt",
"name": "test",
"position_topi... | [
"async",
"def",
"test_set_position_templated",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"cover",
".",
"DOMAIN",
",",
"{",
"cover",
".",
"DOMAIN",
":",
"{",
"\"platform\"",
":",
"\"mqtt\"",
",",
"\... | [
674,
0
] | [
706,
5
] | python | en | ['en', 'en', 'en'] | True |
test_set_position_untemplated | (hass, mqtt_mock) | Test setting cover position via template. | Test setting cover position via template. | async def test_set_position_untemplated(hass, mqtt_mock):
"""Test setting cover position via template."""
assert await async_setup_component(
hass,
cover.DOMAIN,
{
cover.DOMAIN: {
"platform": "mqtt",
"name": "test",
"position_to... | [
"async",
"def",
"test_set_position_untemplated",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"cover",
".",
"DOMAIN",
",",
"{",
"cover",
".",
"DOMAIN",
":",
"{",
"\"platform\"",
":",
"\"mqtt\"",
",",
... | [
709,
0
] | [
736,
85
] | python | en | ['en', 'en', 'en'] | True |
test_set_position_untemplated_custom_percentage_range | (hass, mqtt_mock) | Test setting cover position via template. | Test setting cover position via template. | async def test_set_position_untemplated_custom_percentage_range(hass, mqtt_mock):
"""Test setting cover position via template."""
assert await async_setup_component(
hass,
cover.DOMAIN,
{
cover.DOMAIN: {
"platform": "mqtt",
"name": "test",
... | [
"async",
"def",
"test_set_position_untemplated_custom_percentage_range",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"cover",
".",
"DOMAIN",
",",
"{",
"cover",
".",
"DOMAIN",
":",
"{",
"\"platform\"",
":",... | [
739,
0
] | [
768,
85
] | python | en | ['en', 'en', 'en'] | True |
test_no_command_topic | (hass, mqtt_mock) | Test with no command topic. | Test with no command topic. | async def test_no_command_topic(hass, mqtt_mock):
"""Test with no command topic."""
assert await async_setup_component(
hass,
cover.DOMAIN,
{
cover.DOMAIN: {
"platform": "mqtt",
"name": "test",
"qos": 0,
"payload... | [
"async",
"def",
"test_no_command_topic",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"cover",
".",
"DOMAIN",
",",
"{",
"cover",
".",
"DOMAIN",
":",
"{",
"\"platform\"",
":",
"\"mqtt\"",
",",
"\"name\... | [
771,
0
] | [
791,
80
] | python | en | ['en', 'en', 'en'] | True |
test_no_payload_stop | (hass, mqtt_mock) | Test with no stop payload. | Test with no stop payload. | async def test_no_payload_stop(hass, mqtt_mock):
"""Test with no stop payload."""
assert await async_setup_component(
hass,
cover.DOMAIN,
{
cover.DOMAIN: {
"platform": "mqtt",
"name": "test",
"command_topic": "command-topic",
... | [
"async",
"def",
"test_no_payload_stop",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"cover",
".",
"DOMAIN",
",",
"{",
"cover",
".",
"DOMAIN",
":",
"{",
"\"platform\"",
":",
"\"mqtt\"",
",",
"\"name\"... | [
794,
0
] | [
813,
78
] | python | en | ['en', 'en', 'en'] | True |
test_with_command_topic_and_tilt | (hass, mqtt_mock) | Test with command topic and tilt config. | Test with command topic and tilt config. | async def test_with_command_topic_and_tilt(hass, mqtt_mock):
"""Test with command topic and tilt config."""
assert await async_setup_component(
hass,
cover.DOMAIN,
{
cover.DOMAIN: {
"command_topic": "test",
"platform": "mqtt",
"... | [
"async",
"def",
"test_with_command_topic_and_tilt",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"cover",
".",
"DOMAIN",
",",
"{",
"cover",
".",
"DOMAIN",
":",
"{",
"\"command_topic\"",
":",
"\"test\"",
... | [
816,
0
] | [
837,
80
] | python | en | ['en', 'en', 'en'] | True |
test_tilt_defaults | (hass, mqtt_mock) | Test the defaults. | Test the defaults. | async def test_tilt_defaults(hass, mqtt_mock):
"""Test the defaults."""
assert await async_setup_component(
hass,
cover.DOMAIN,
{
cover.DOMAIN: {
"platform": "mqtt",
"name": "test",
"state_topic": "state-topic",
... | [
"async",
"def",
"test_tilt_defaults",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"cover",
".",
"DOMAIN",
",",
"{",
"cover",
".",
"DOMAIN",
":",
"{",
"\"platform\"",
":",
"\"mqtt\"",
",",
"\"name\"",... | [
840,
0
] | [
868,
50
] | python | en | ['en', 'en', 'en'] | True |
test_tilt_via_invocation_defaults | (hass, mqtt_mock) | Test tilt defaults on close/open. | Test tilt defaults on close/open. | async def test_tilt_via_invocation_defaults(hass, mqtt_mock):
"""Test tilt defaults on close/open."""
assert await async_setup_component(
hass,
cover.DOMAIN,
{
cover.DOMAIN: {
"platform": "mqtt",
"name": "test",
"state_topic": "... | [
"async",
"def",
"test_tilt_via_invocation_defaults",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"cover",
".",
"DOMAIN",
",",
"{",
"cover",
".",
"DOMAIN",
":",
"{",
"\"platform\"",
":",
"\"mqtt\"",
","... | [
871,
0
] | [
950,
88
] | python | en | ['en', 'fr', 'en'] | True |
test_tilt_given_value | (hass, mqtt_mock) | Test tilting to a given value. | Test tilting to a given value. | async def test_tilt_given_value(hass, mqtt_mock):
"""Test tilting to a given value."""
assert await async_setup_component(
hass,
cover.DOMAIN,
{
cover.DOMAIN: {
"platform": "mqtt",
"name": "test",
"state_topic": "state-topic",
... | [
"async",
"def",
"test_tilt_given_value",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"cover",
".",
"DOMAIN",
",",
"{",
"cover",
".",
"DOMAIN",
":",
"{",
"\"platform\"",
":",
"\"mqtt\"",
",",
"\"name\... | [
953,
0
] | [
1038,
5
] | python | en | ['en', 'en', 'en'] | True |
test_tilt_given_value_optimistic | (hass, mqtt_mock) | Test tilting to a given value. | Test tilting to a given value. | async def test_tilt_given_value_optimistic(hass, mqtt_mock):
"""Test tilting to a given value."""
assert await async_setup_component(
hass,
cover.DOMAIN,
{
cover.DOMAIN: {
"platform": "mqtt",
"name": "test",
"state_topic": "stat... | [
"async",
"def",
"test_tilt_given_value_optimistic",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"cover",
".",
"DOMAIN",
",",
"{",
"cover",
".",
"DOMAIN",
":",
"{",
"\"platform\"",
":",
"\"mqtt\"",
",",... | [
1041,
0
] | [
1097,
5
] | python | en | ['en', 'en', 'en'] | True |
test_tilt_given_value_altered_range | (hass, mqtt_mock) | Test tilting to a given value. | Test tilting to a given value. | async def test_tilt_given_value_altered_range(hass, mqtt_mock):
"""Test tilting to a given value."""
assert await async_setup_component(
hass,
cover.DOMAIN,
{
cover.DOMAIN: {
"platform": "mqtt",
"name": "test",
"state_topic": "s... | [
"async",
"def",
"test_tilt_given_value_altered_range",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"cover",
".",
"DOMAIN",
",",
"{",
"cover",
".",
"DOMAIN",
":",
"{",
"\"platform\"",
":",
"\"mqtt\"",
"... | [
1100,
0
] | [
1173,
5
] | python | en | ['en', 'en', 'en'] | True |
test_tilt_via_topic | (hass, mqtt_mock) | Test tilt by updating status via MQTT. | Test tilt by updating status via MQTT. | async def test_tilt_via_topic(hass, mqtt_mock):
"""Test tilt by updating status via MQTT."""
assert await async_setup_component(
hass,
cover.DOMAIN,
{
cover.DOMAIN: {
"platform": "mqtt",
"name": "test",
"state_topic": "state-top... | [
"async",
"def",
"test_tilt_via_topic",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"cover",
".",
"DOMAIN",
",",
"{",
"cover",
".",
"DOMAIN",
":",
"{",
"\"platform\"",
":",
"\"mqtt\"",
",",
"\"name\""... | [
1176,
0
] | [
1210,
44
] | python | bg | ['en', 'no', 'bg'] | False |
test_tilt_via_topic_template | (hass, mqtt_mock) | Test tilt by updating status via MQTT and template. | Test tilt by updating status via MQTT and template. | async def test_tilt_via_topic_template(hass, mqtt_mock):
"""Test tilt by updating status via MQTT and template."""
assert await async_setup_component(
hass,
cover.DOMAIN,
{
cover.DOMAIN: {
"platform": "mqtt",
"name": "test",
"st... | [
"async",
"def",
"test_tilt_via_topic_template",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"cover",
".",
"DOMAIN",
",",
"{",
"cover",
".",
"DOMAIN",
":",
"{",
"\"platform\"",
":",
"\"mqtt\"",
",",
"... | [
1213,
0
] | [
1250,
44
] | python | en | ['en', 'en', 'en'] | True |
test_tilt_via_topic_altered_range | (hass, mqtt_mock) | Test tilt status via MQTT with altered tilt range. | Test tilt status via MQTT with altered tilt range. | async def test_tilt_via_topic_altered_range(hass, mqtt_mock):
"""Test tilt status via MQTT with altered tilt range."""
assert await async_setup_component(
hass,
cover.DOMAIN,
{
cover.DOMAIN: {
"platform": "mqtt",
"name": "test",
... | [
"async",
"def",
"test_tilt_via_topic_altered_range",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"cover",
".",
"DOMAIN",
",",
"{",
"cover",
".",
"DOMAIN",
":",
"{",
"\"platform\"",
":",
"\"mqtt\"",
","... | [
1253,
0
] | [
1296,
44
] | python | en | ['en', 'no', 'ur'] | False |
test_tilt_via_topic_template_altered_range | (hass, mqtt_mock) | Test tilt status via MQTT and template with altered tilt range. | Test tilt status via MQTT and template with altered tilt range. | async def test_tilt_via_topic_template_altered_range(hass, mqtt_mock):
"""Test tilt status via MQTT and template with altered tilt range."""
assert await async_setup_component(
hass,
cover.DOMAIN,
{
cover.DOMAIN: {
"platform": "mqtt",
"name": "... | [
"async",
"def",
"test_tilt_via_topic_template_altered_range",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"cover",
".",
"DOMAIN",
",",
"{",
"cover",
".",
"DOMAIN",
":",
"{",
"\"platform\"",
":",
"\"mqtt\... | [
1299,
0
] | [
1345,
44
] | python | en | ['en', 'no', 'en'] | True |
test_tilt_position | (hass, mqtt_mock) | Test tilt via method invocation. | Test tilt via method invocation. | async def test_tilt_position(hass, mqtt_mock):
"""Test tilt via method invocation."""
assert await async_setup_component(
hass,
cover.DOMAIN,
{
cover.DOMAIN: {
"platform": "mqtt",
"name": "test",
"state_topic": "state-topic",
... | [
"async",
"def",
"test_tilt_position",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"cover",
".",
"DOMAIN",
",",
"{",
"cover",
".",
"DOMAIN",
":",
"{",
"\"platform\"",
":",
"\"mqtt\"",
",",
"\"name\"",... | [
1348,
0
] | [
1379,
5
] | python | da | ['da', 'da', 'en'] | True |
test_tilt_position_altered_range | (hass, mqtt_mock) | Test tilt via method invocation with altered range. | Test tilt via method invocation with altered range. | async def test_tilt_position_altered_range(hass, mqtt_mock):
"""Test tilt via method invocation with altered range."""
assert await async_setup_component(
hass,
cover.DOMAIN,
{
cover.DOMAIN: {
"platform": "mqtt",
"name": "test",
... | [
"async",
"def",
"test_tilt_position_altered_range",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"cover",
".",
"DOMAIN",
",",
"{",
"cover",
".",
"DOMAIN",
":",
"{",
"\"platform\"",
":",
"\"mqtt\"",
",",... | [
1382,
0
] | [
1417,
5
] | python | en | ['en', 'da', 'en'] | True |
test_find_percentage_in_range_defaults | (hass, mqtt_mock) | Test find percentage in range with default range. | Test find percentage in range with default range. | async def test_find_percentage_in_range_defaults(hass, mqtt_mock):
"""Test find percentage in range with default range."""
mqtt_cover = MqttCover(
hass,
{
"name": "cover.test",
"state_topic": "state-topic",
"get_position_topic": None,
"command_topi... | [
"async",
"def",
"test_find_percentage_in_range_defaults",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"mqtt_cover",
"=",
"MqttCover",
"(",
"hass",
",",
"{",
"\"name\"",
":",
"\"cover.test\"",
",",
"\"state_topic\"",
":",
"\"state-topic\"",
",",
"\"get_position_topic\"",
... | [
1420,
0
] | [
1461,
65
] | python | en | ['en', 'da', 'en'] | True |
test_find_percentage_in_range_altered | (hass, mqtt_mock) | Test find percentage in range with altered range. | Test find percentage in range with altered range. | async def test_find_percentage_in_range_altered(hass, mqtt_mock):
"""Test find percentage in range with altered range."""
mqtt_cover = MqttCover(
hass,
{
"name": "cover.test",
"state_topic": "state-topic",
"get_position_topic": None,
"command_topic... | [
"async",
"def",
"test_find_percentage_in_range_altered",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"mqtt_cover",
"=",
"MqttCover",
"(",
"hass",
",",
"{",
"\"name\"",
":",
"\"cover.test\"",
",",
"\"state_topic\"",
":",
"\"state-topic\"",
",",
"\"get_position_topic\"",
... | [
1464,
0
] | [
1505,
66
] | python | en | ['en', 'da', 'en'] | True |
test_find_percentage_in_range_defaults_inverted | (hass, mqtt_mock) | Test find percentage in range with default range but inverted. | Test find percentage in range with default range but inverted. | async def test_find_percentage_in_range_defaults_inverted(hass, mqtt_mock):
"""Test find percentage in range with default range but inverted."""
mqtt_cover = MqttCover(
hass,
{
"name": "cover.test",
"state_topic": "state-topic",
"get_position_topic": None,
... | [
"async",
"def",
"test_find_percentage_in_range_defaults_inverted",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"mqtt_cover",
"=",
"MqttCover",
"(",
"hass",
",",
"{",
"\"name\"",
":",
"\"cover.test\"",
",",
"\"state_topic\"",
":",
"\"state-topic\"",
",",
"\"get_position_t... | [
1508,
0
] | [
1549,
65
] | python | en | ['en', 'da', 'en'] | True |
test_find_percentage_in_range_altered_inverted | (hass, mqtt_mock) | Test find percentage in range with altered range and inverted. | Test find percentage in range with altered range and inverted. | async def test_find_percentage_in_range_altered_inverted(hass, mqtt_mock):
"""Test find percentage in range with altered range and inverted."""
mqtt_cover = MqttCover(
hass,
{
"name": "cover.test",
"state_topic": "state-topic",
"get_position_topic": None,
... | [
"async",
"def",
"test_find_percentage_in_range_altered_inverted",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"mqtt_cover",
"=",
"MqttCover",
"(",
"hass",
",",
"{",
"\"name\"",
":",
"\"cover.test\"",
",",
"\"state_topic\"",
":",
"\"state-topic\"",
",",
"\"get_position_to... | [
1552,
0
] | [
1593,
66
] | python | en | ['en', 'en', 'en'] | True |
test_find_in_range_defaults | (hass, mqtt_mock) | Test find in range with default range. | Test find in range with default range. | async def test_find_in_range_defaults(hass, mqtt_mock):
"""Test find in range with default range."""
mqtt_cover = MqttCover(
hass,
{
"name": "cover.test",
"state_topic": "state-topic",
"get_position_topic": None,
"command_topic": "command-topic",
... | [
"async",
"def",
"test_find_in_range_defaults",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"mqtt_cover",
"=",
"MqttCover",
"(",
"hass",
",",
"{",
"\"name\"",
":",
"\"cover.test\"",
",",
"\"state_topic\"",
":",
"\"state-topic\"",
",",
"\"get_position_topic\"",
":",
"N... | [
1596,
0
] | [
1637,
67
] | python | en | ['en', 'de', 'en'] | True |
test_find_in_range_altered | (hass, mqtt_mock) | Test find in range with altered range. | Test find in range with altered range. | async def test_find_in_range_altered(hass, mqtt_mock):
"""Test find in range with altered range."""
mqtt_cover = MqttCover(
hass,
{
"name": "cover.test",
"state_topic": "state-topic",
"get_position_topic": None,
"command_topic": "command-topic",
... | [
"async",
"def",
"test_find_in_range_altered",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"mqtt_cover",
"=",
"MqttCover",
"(",
"hass",
",",
"{",
"\"name\"",
":",
"\"cover.test\"",
",",
"\"state_topic\"",
":",
"\"state-topic\"",
",",
"\"get_position_topic\"",
":",
"No... | [
1640,
0
] | [
1681,
68
] | python | en | ['en', 'de', 'en'] | True |
test_find_in_range_defaults_inverted | (hass, mqtt_mock) | Test find in range with default range but inverted. | Test find in range with default range but inverted. | async def test_find_in_range_defaults_inverted(hass, mqtt_mock):
"""Test find in range with default range but inverted."""
mqtt_cover = MqttCover(
hass,
{
"name": "cover.test",
"state_topic": "state-topic",
"get_position_topic": None,
"command_topi... | [
"async",
"def",
"test_find_in_range_defaults_inverted",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"mqtt_cover",
"=",
"MqttCover",
"(",
"hass",
",",
"{",
"\"name\"",
":",
"\"cover.test\"",
",",
"\"state_topic\"",
":",
"\"state-topic\"",
",",
"\"get_position_topic\"",
... | [
1684,
0
] | [
1725,
67
] | python | en | ['en', 'da', 'en'] | True |
test_find_in_range_altered_inverted | (hass, mqtt_mock) | Test find in range with altered range and inverted. | Test find in range with altered range and inverted. | async def test_find_in_range_altered_inverted(hass, mqtt_mock):
"""Test find in range with altered range and inverted."""
mqtt_cover = MqttCover(
hass,
{
"name": "cover.test",
"state_topic": "state-topic",
"get_position_topic": None,
"command_topic... | [
"async",
"def",
"test_find_in_range_altered_inverted",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"mqtt_cover",
"=",
"MqttCover",
"(",
"hass",
",",
"{",
"\"name\"",
":",
"\"cover.test\"",
",",
"\"state_topic\"",
":",
"\"state-topic\"",
",",
"\"get_position_topic\"",
"... | [
1728,
0
] | [
1769,
68
] | python | en | ['en', 'en', 'en'] | True |
test_availability_when_connection_lost | (hass, mqtt_mock) | Test availability after MQTT disconnection. | Test availability after MQTT disconnection. | async def test_availability_when_connection_lost(hass, mqtt_mock):
"""Test availability after MQTT disconnection."""
await help_test_availability_when_connection_lost(
hass, mqtt_mock, cover.DOMAIN, DEFAULT_CONFIG
) | [
"async",
"def",
"test_availability_when_connection_lost",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"await",
"help_test_availability_when_connection_lost",
"(",
"hass",
",",
"mqtt_mock",
",",
"cover",
".",
"DOMAIN",
",",
"DEFAULT_CONFIG",
")"
] | [
1772,
0
] | [
1776,
5
] | python | en | ['en', 'en', 'en'] | True |
test_availability_without_topic | (hass, mqtt_mock) | Test availability without defined availability topic. | Test availability without defined availability topic. | async def test_availability_without_topic(hass, mqtt_mock):
"""Test availability without defined availability topic."""
await help_test_availability_without_topic(
hass, mqtt_mock, cover.DOMAIN, DEFAULT_CONFIG
) | [
"async",
"def",
"test_availability_without_topic",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"await",
"help_test_availability_without_topic",
"(",
"hass",
",",
"mqtt_mock",
",",
"cover",
".",
"DOMAIN",
",",
"DEFAULT_CONFIG",
")"
] | [
1779,
0
] | [
1783,
5
] | python | en | ['en', 'en', 'en'] | True |
test_default_availability_payload | (hass, mqtt_mock) | Test availability by default payload with defined topic. | Test availability by default payload with defined topic. | async def test_default_availability_payload(hass, mqtt_mock):
"""Test availability by default payload with defined topic."""
await help_test_default_availability_payload(
hass, mqtt_mock, cover.DOMAIN, DEFAULT_CONFIG
) | [
"async",
"def",
"test_default_availability_payload",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"await",
"help_test_default_availability_payload",
"(",
"hass",
",",
"mqtt_mock",
",",
"cover",
".",
"DOMAIN",
",",
"DEFAULT_CONFIG",
")"
] | [
1786,
0
] | [
1790,
5
] | python | en | ['en', 'en', 'en'] | True |
test_custom_availability_payload | (hass, mqtt_mock) | Test availability by custom payload with defined topic. | Test availability by custom payload with defined topic. | async def test_custom_availability_payload(hass, mqtt_mock):
"""Test availability by custom payload with defined topic."""
await help_test_custom_availability_payload(
hass, mqtt_mock, cover.DOMAIN, DEFAULT_CONFIG
) | [
"async",
"def",
"test_custom_availability_payload",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"await",
"help_test_custom_availability_payload",
"(",
"hass",
",",
"mqtt_mock",
",",
"cover",
".",
"DOMAIN",
",",
"DEFAULT_CONFIG",
")"
] | [
1793,
0
] | [
1797,
5
] | python | en | ['en', 'en', 'en'] | True |
test_valid_device_class | (hass, mqtt_mock) | Test the setting of a valid sensor class. | Test the setting of a valid sensor class. | async def test_valid_device_class(hass, mqtt_mock):
"""Test the setting of a valid sensor class."""
assert await async_setup_component(
hass,
cover.DOMAIN,
{
cover.DOMAIN: {
"platform": "mqtt",
"name": "test",
"device_class": "g... | [
"async",
"def",
"test_valid_device_class",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"cover",
".",
"DOMAIN",
",",
"{",
"cover",
".",
"DOMAIN",
":",
"{",
"\"platform\"",
":",
"\"mqtt\"",
",",
"\"nam... | [
1800,
0
] | [
1817,
59
] | python | en | ['en', 'en', 'en'] | True |
test_invalid_device_class | (hass, mqtt_mock) | Test the setting of an invalid sensor class. | Test the setting of an invalid sensor class. | async def test_invalid_device_class(hass, mqtt_mock):
"""Test the setting of an invalid sensor class."""
assert await async_setup_component(
hass,
cover.DOMAIN,
{
cover.DOMAIN: {
"platform": "mqtt",
"name": "test",
"device_class... | [
"async",
"def",
"test_invalid_device_class",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"cover",
".",
"DOMAIN",
",",
"{",
"cover",
".",
"DOMAIN",
":",
"{",
"\"platform\"",
":",
"\"mqtt\"",
",",
"\"n... | [
1820,
0
] | [
1837,
24
] | python | en | ['en', 'en', 'en'] | True |
test_setting_attribute_via_mqtt_json_message | (hass, mqtt_mock) | Test the setting of attribute via MQTT with JSON payload. | Test the setting of attribute via MQTT with JSON payload. | async def test_setting_attribute_via_mqtt_json_message(hass, mqtt_mock):
"""Test the setting of attribute via MQTT with JSON payload."""
await help_test_setting_attribute_via_mqtt_json_message(
hass, mqtt_mock, cover.DOMAIN, DEFAULT_CONFIG
) | [
"async",
"def",
"test_setting_attribute_via_mqtt_json_message",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"await",
"help_test_setting_attribute_via_mqtt_json_message",
"(",
"hass",
",",
"mqtt_mock",
",",
"cover",
".",
"DOMAIN",
",",
"DEFAULT_CONFIG",
")"
] | [
1840,
0
] | [
1844,
5
] | python | en | ['en', 'en', 'en'] | True |
test_setting_attribute_with_template | (hass, mqtt_mock) | Test the setting of attribute via MQTT with JSON payload. | Test the setting of attribute via MQTT with JSON payload. | async def test_setting_attribute_with_template(hass, mqtt_mock):
"""Test the setting of attribute via MQTT with JSON payload."""
await help_test_setting_attribute_with_template(
hass, mqtt_mock, cover.DOMAIN, DEFAULT_CONFIG
) | [
"async",
"def",
"test_setting_attribute_with_template",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"await",
"help_test_setting_attribute_with_template",
"(",
"hass",
",",
"mqtt_mock",
",",
"cover",
".",
"DOMAIN",
",",
"DEFAULT_CONFIG",
")"
] | [
1847,
0
] | [
1851,
5
] | python | en | ['en', 'en', 'en'] | True |
test_update_with_json_attrs_not_dict | (hass, mqtt_mock, caplog) | Test attributes get extracted from a JSON result. | Test attributes get extracted from a JSON result. | async def test_update_with_json_attrs_not_dict(hass, mqtt_mock, caplog):
"""Test attributes get extracted from a JSON result."""
await help_test_update_with_json_attrs_not_dict(
hass, mqtt_mock, caplog, cover.DOMAIN, DEFAULT_CONFIG
) | [
"async",
"def",
"test_update_with_json_attrs_not_dict",
"(",
"hass",
",",
"mqtt_mock",
",",
"caplog",
")",
":",
"await",
"help_test_update_with_json_attrs_not_dict",
"(",
"hass",
",",
"mqtt_mock",
",",
"caplog",
",",
"cover",
".",
"DOMAIN",
",",
"DEFAULT_CONFIG",
")... | [
1854,
0
] | [
1858,
5
] | python | en | ['en', 'en', 'en'] | True |
test_update_with_json_attrs_bad_JSON | (hass, mqtt_mock, caplog) | Test attributes get extracted from a JSON result. | Test attributes get extracted from a JSON result. | async def test_update_with_json_attrs_bad_JSON(hass, mqtt_mock, caplog):
"""Test attributes get extracted from a JSON result."""
await help_test_update_with_json_attrs_bad_JSON(
hass, mqtt_mock, caplog, cover.DOMAIN, DEFAULT_CONFIG
) | [
"async",
"def",
"test_update_with_json_attrs_bad_JSON",
"(",
"hass",
",",
"mqtt_mock",
",",
"caplog",
")",
":",
"await",
"help_test_update_with_json_attrs_bad_JSON",
"(",
"hass",
",",
"mqtt_mock",
",",
"caplog",
",",
"cover",
".",
"DOMAIN",
",",
"DEFAULT_CONFIG",
")... | [
1861,
0
] | [
1865,
5
] | python | en | ['en', 'en', 'en'] | True |
test_discovery_update_attr | (hass, mqtt_mock, caplog) | Test update of discovered MQTTAttributes. | Test update of discovered MQTTAttributes. | async def test_discovery_update_attr(hass, mqtt_mock, caplog):
"""Test update of discovered MQTTAttributes."""
await help_test_discovery_update_attr(
hass, mqtt_mock, caplog, cover.DOMAIN, DEFAULT_CONFIG
) | [
"async",
"def",
"test_discovery_update_attr",
"(",
"hass",
",",
"mqtt_mock",
",",
"caplog",
")",
":",
"await",
"help_test_discovery_update_attr",
"(",
"hass",
",",
"mqtt_mock",
",",
"caplog",
",",
"cover",
".",
"DOMAIN",
",",
"DEFAULT_CONFIG",
")"
] | [
1868,
0
] | [
1872,
5
] | python | en | ['en', 'en', 'en'] | True |
test_unique_id | (hass, mqtt_mock) | Test unique_id option only creates one cover per id. | Test unique_id option only creates one cover per id. | async def test_unique_id(hass, mqtt_mock):
"""Test unique_id option only creates one cover per id."""
config = {
cover.DOMAIN: [
{
"platform": "mqtt",
"name": "Test 1",
"state_topic": "test-topic",
"unique_id": "TOTALLY_UNIQUE",... | [
"async",
"def",
"test_unique_id",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"config",
"=",
"{",
"cover",
".",
"DOMAIN",
":",
"[",
"{",
"\"platform\"",
":",
"\"mqtt\"",
",",
"\"name\"",
":",
"\"Test 1\"",
",",
"\"state_topic\"",
":",
"\"test-topic\"",
",",
"... | [
1875,
0
] | [
1893,
68
] | python | en | ['en', 'en', 'en'] | True |
test_discovery_removal_cover | (hass, mqtt_mock, caplog) | Test removal of discovered cover. | Test removal of discovered cover. | async def test_discovery_removal_cover(hass, mqtt_mock, caplog):
"""Test removal of discovered cover."""
data = '{ "name": "test", "command_topic": "test_topic" }'
await help_test_discovery_removal(hass, mqtt_mock, caplog, cover.DOMAIN, data) | [
"async",
"def",
"test_discovery_removal_cover",
"(",
"hass",
",",
"mqtt_mock",
",",
"caplog",
")",
":",
"data",
"=",
"'{ \"name\": \"test\", \"command_topic\": \"test_topic\" }'",
"await",
"help_test_discovery_removal",
"(",
"hass",
",",
"mqtt_mock",
",",
"caplog",
",",
... | [
1896,
0
] | [
1899,
82
] | python | en | ['en', 'en', 'en'] | True |
test_discovery_update_cover | (hass, mqtt_mock, caplog) | Test update of discovered cover. | Test update of discovered cover. | async def test_discovery_update_cover(hass, mqtt_mock, caplog):
"""Test update of discovered cover."""
data1 = '{ "name": "Beer", "command_topic": "test_topic" }'
data2 = '{ "name": "Milk", "command_topic": "test_topic" }'
await help_test_discovery_update(
hass, mqtt_mock, caplog, cover.DOMAIN, ... | [
"async",
"def",
"test_discovery_update_cover",
"(",
"hass",
",",
"mqtt_mock",
",",
"caplog",
")",
":",
"data1",
"=",
"'{ \"name\": \"Beer\", \"command_topic\": \"test_topic\" }'",
"data2",
"=",
"'{ \"name\": \"Milk\", \"command_topic\": \"test_topic\" }'",
"await",
"help_test_dis... | [
1902,
0
] | [
1908,
5
] | python | en | ['en', 'en', 'en'] | True |
test_discovery_update_unchanged_cover | (hass, mqtt_mock, caplog) | Test update of discovered cover. | Test update of discovered cover. | async def test_discovery_update_unchanged_cover(hass, mqtt_mock, caplog):
"""Test update of discovered cover."""
data1 = '{ "name": "Beer", "command_topic": "test_topic" }'
with patch(
"homeassistant.components.mqtt.cover.MqttCover.discovery_update"
) as discovery_update:
await help_test... | [
"async",
"def",
"test_discovery_update_unchanged_cover",
"(",
"hass",
",",
"mqtt_mock",
",",
"caplog",
")",
":",
"data1",
"=",
"'{ \"name\": \"Beer\", \"command_topic\": \"test_topic\" }'",
"with",
"patch",
"(",
"\"homeassistant.components.mqtt.cover.MqttCover.discovery_update\"",
... | [
1911,
0
] | [
1919,
9
] | python | en | ['en', 'en', 'en'] | True |
test_discovery_broken | (hass, mqtt_mock, caplog) | Test handling of bad discovery message. | Test handling of bad discovery message. | async def test_discovery_broken(hass, mqtt_mock, caplog):
"""Test handling of bad discovery message."""
data1 = '{ "name": "Beer", "command_topic": "test_topic#" }'
data2 = '{ "name": "Milk", "command_topic": "test_topic" }'
await help_test_discovery_broken(
hass, mqtt_mock, caplog, cover.DOMAIN... | [
"async",
"def",
"test_discovery_broken",
"(",
"hass",
",",
"mqtt_mock",
",",
"caplog",
")",
":",
"data1",
"=",
"'{ \"name\": \"Beer\", \"command_topic\": \"test_topic#\" }'",
"data2",
"=",
"'{ \"name\": \"Milk\", \"command_topic\": \"test_topic\" }'",
"await",
"help_test_discover... | [
1923,
0
] | [
1929,
5
] | python | en | ['en', 'en', 'en'] | True |
test_entity_device_info_with_connection | (hass, mqtt_mock) | Test MQTT cover device registry integration. | Test MQTT cover device registry integration. | async def test_entity_device_info_with_connection(hass, mqtt_mock):
"""Test MQTT cover device registry integration."""
await help_test_entity_device_info_with_connection(
hass, mqtt_mock, cover.DOMAIN, DEFAULT_CONFIG
) | [
"async",
"def",
"test_entity_device_info_with_connection",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"await",
"help_test_entity_device_info_with_connection",
"(",
"hass",
",",
"mqtt_mock",
",",
"cover",
".",
"DOMAIN",
",",
"DEFAULT_CONFIG",
")"
] | [
1932,
0
] | [
1936,
5
] | python | en | ['en', 'sv', 'en'] | True |
test_entity_device_info_with_identifier | (hass, mqtt_mock) | Test MQTT cover device registry integration. | Test MQTT cover device registry integration. | async def test_entity_device_info_with_identifier(hass, mqtt_mock):
"""Test MQTT cover device registry integration."""
await help_test_entity_device_info_with_identifier(
hass, mqtt_mock, cover.DOMAIN, DEFAULT_CONFIG
) | [
"async",
"def",
"test_entity_device_info_with_identifier",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"await",
"help_test_entity_device_info_with_identifier",
"(",
"hass",
",",
"mqtt_mock",
",",
"cover",
".",
"DOMAIN",
",",
"DEFAULT_CONFIG",
")"
] | [
1939,
0
] | [
1943,
5
] | python | en | ['en', 'sv', 'en'] | True |
test_entity_device_info_update | (hass, mqtt_mock) | Test device registry update. | Test device registry update. | async def test_entity_device_info_update(hass, mqtt_mock):
"""Test device registry update."""
await help_test_entity_device_info_update(
hass, mqtt_mock, cover.DOMAIN, DEFAULT_CONFIG
) | [
"async",
"def",
"test_entity_device_info_update",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"await",
"help_test_entity_device_info_update",
"(",
"hass",
",",
"mqtt_mock",
",",
"cover",
".",
"DOMAIN",
",",
"DEFAULT_CONFIG",
")"
] | [
1946,
0
] | [
1950,
5
] | python | en | ['fr', 'fy', 'en'] | False |
test_entity_device_info_remove | (hass, mqtt_mock) | Test device registry remove. | Test device registry remove. | async def test_entity_device_info_remove(hass, mqtt_mock):
"""Test device registry remove."""
await help_test_entity_device_info_remove(
hass, mqtt_mock, cover.DOMAIN, DEFAULT_CONFIG
) | [
"async",
"def",
"test_entity_device_info_remove",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"await",
"help_test_entity_device_info_remove",
"(",
"hass",
",",
"mqtt_mock",
",",
"cover",
".",
"DOMAIN",
",",
"DEFAULT_CONFIG",
")"
] | [
1953,
0
] | [
1957,
5
] | python | en | ['fr', 'en', 'en'] | True |
test_entity_id_update_subscriptions | (hass, mqtt_mock) | Test MQTT subscriptions are managed when entity_id is updated. | Test MQTT subscriptions are managed when entity_id is updated. | async def test_entity_id_update_subscriptions(hass, mqtt_mock):
"""Test MQTT subscriptions are managed when entity_id is updated."""
await help_test_entity_id_update_subscriptions(
hass, mqtt_mock, cover.DOMAIN, DEFAULT_CONFIG
) | [
"async",
"def",
"test_entity_id_update_subscriptions",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"await",
"help_test_entity_id_update_subscriptions",
"(",
"hass",
",",
"mqtt_mock",
",",
"cover",
".",
"DOMAIN",
",",
"DEFAULT_CONFIG",
")"
] | [
1960,
0
] | [
1964,
5
] | python | en | ['en', 'en', 'en'] | True |
test_entity_id_update_discovery_update | (hass, mqtt_mock) | Test MQTT discovery update when entity_id is updated. | Test MQTT discovery update when entity_id is updated. | async def test_entity_id_update_discovery_update(hass, mqtt_mock):
"""Test MQTT discovery update when entity_id is updated."""
await help_test_entity_id_update_discovery_update(
hass, mqtt_mock, cover.DOMAIN, DEFAULT_CONFIG
) | [
"async",
"def",
"test_entity_id_update_discovery_update",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"await",
"help_test_entity_id_update_discovery_update",
"(",
"hass",
",",
"mqtt_mock",
",",
"cover",
".",
"DOMAIN",
",",
"DEFAULT_CONFIG",
")"
] | [
1967,
0
] | [
1971,
5
] | python | en | ['en', 'en', 'en'] | True |
test_entity_debug_info_message | (hass, mqtt_mock) | Test MQTT debug info. | Test MQTT debug info. | async def test_entity_debug_info_message(hass, mqtt_mock):
"""Test MQTT debug info."""
await help_test_entity_debug_info_message(
hass, mqtt_mock, cover.DOMAIN, DEFAULT_CONFIG
) | [
"async",
"def",
"test_entity_debug_info_message",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"await",
"help_test_entity_debug_info_message",
"(",
"hass",
",",
"mqtt_mock",
",",
"cover",
".",
"DOMAIN",
",",
"DEFAULT_CONFIG",
")"
] | [
1974,
0
] | [
1978,
5
] | python | es | ['es', 'mt', 'it'] | False |
test_binary_sensor | (hass, generic_data, binary_sensor_msg) | Test setting up config entry. | Test setting up config entry. | async def test_binary_sensor(hass, generic_data, binary_sensor_msg):
"""Test setting up config entry."""
receive_msg = await setup_ozw(hass, fixture=generic_data)
# Test Legacy sensor (disabled by default)
registry = await hass.helpers.entity_registry.async_get_registry()
entity_id = "binary_sensor... | [
"async",
"def",
"test_binary_sensor",
"(",
"hass",
",",
"generic_data",
",",
"binary_sensor_msg",
")",
":",
"receive_msg",
"=",
"await",
"setup_ozw",
"(",
"hass",
",",
"fixture",
"=",
"generic_data",
")",
"# Test Legacy sensor (disabled by default)",
"registry",
"=",
... | [
11,
0
] | [
42,
30
] | python | en | ['en', 'en', 'en'] | True |
test_sensor_enabled | (hass, generic_data, binary_sensor_alt_msg) | Test enabling a legacy binary_sensor. | Test enabling a legacy binary_sensor. | async def test_sensor_enabled(hass, generic_data, binary_sensor_alt_msg):
"""Test enabling a legacy binary_sensor."""
registry = await hass.helpers.entity_registry.async_get_registry()
entry = registry.async_get_or_create(
BINARY_SENSOR_DOMAIN,
DOMAIN,
"1-37-625737744",
sug... | [
"async",
"def",
"test_sensor_enabled",
"(",
"hass",
",",
"generic_data",
",",
"binary_sensor_alt_msg",
")",
":",
"registry",
"=",
"await",
"hass",
".",
"helpers",
".",
"entity_registry",
".",
"async_get_registry",
"(",
")",
"entry",
"=",
"registry",
".",
"async_... | [
45,
0
] | [
65,
30
] | python | en | ['en', 'cy', 'en'] | True |
setup_platform | (hass, config, add_entities, discovery_info=None) | Set up a Rain Bird sensor. | Set up a Rain Bird sensor. | def setup_platform(hass, config, add_entities, discovery_info=None):
"""Set up a Rain Bird sensor."""
if discovery_info is None:
return
controller = hass.data[DATA_RAINBIRD][discovery_info[RAINBIRD_CONTROLLER]]
add_entities(
[RainBirdSensor(controller, sensor_type) for sensor_type in SE... | [
"def",
"setup_platform",
"(",
"hass",
",",
"config",
",",
"add_entities",
",",
"discovery_info",
"=",
"None",
")",
":",
"if",
"discovery_info",
"is",
"None",
":",
"return",
"controller",
"=",
"hass",
".",
"data",
"[",
"DATA_RAINBIRD",
"]",
"[",
"discovery_in... | [
18,
0
] | [
26,
5
] | python | en | ['en', 'su', 'en'] | True |
RainBirdSensor.__init__ | (self, controller: RainbirdController, sensor_type) | Initialize the Rain Bird sensor. | Initialize the Rain Bird sensor. | def __init__(self, controller: RainbirdController, sensor_type):
"""Initialize the Rain Bird sensor."""
self._sensor_type = sensor_type
self._controller = controller
self._name = SENSOR_TYPES[self._sensor_type][0]
self._icon = SENSOR_TYPES[self._sensor_type][2]
self._stat... | [
"def",
"__init__",
"(",
"self",
",",
"controller",
":",
"RainbirdController",
",",
"sensor_type",
")",
":",
"self",
".",
"_sensor_type",
"=",
"sensor_type",
"self",
".",
"_controller",
"=",
"controller",
"self",
".",
"_name",
"=",
"SENSOR_TYPES",
"[",
"self",
... | [
32,
4
] | [
38,
26
] | python | en | ['en', 'eu', 'en'] | True |
RainBirdSensor.is_on | (self) | Return true if the binary sensor is on. | Return true if the binary sensor is on. | def is_on(self):
"""Return true if the binary sensor is on."""
return None if self._state is None else bool(self._state) | [
"def",
"is_on",
"(",
"self",
")",
":",
"return",
"None",
"if",
"self",
".",
"_state",
"is",
"None",
"else",
"bool",
"(",
"self",
".",
"_state",
")"
] | [
41,
4
] | [
43,
65
] | python | en | ['en', 'fy', 'en'] | True |
RainBirdSensor.update | (self) | Get the latest data and updates the states. | Get the latest data and updates the states. | def update(self):
"""Get the latest data and updates the states."""
_LOGGER.debug("Updating sensor: %s", self._name)
state = None
if self._sensor_type == SENSOR_TYPE_RAINSENSOR:
state = self._controller.get_rain_sensor_state()
elif self._sensor_type == SENSOR_TYPE_RAI... | [
"def",
"update",
"(",
"self",
")",
":",
"_LOGGER",
".",
"debug",
"(",
"\"Updating sensor: %s\"",
",",
"self",
".",
"_name",
")",
"state",
"=",
"None",
"if",
"self",
".",
"_sensor_type",
"==",
"SENSOR_TYPE_RAINSENSOR",
":",
"state",
"=",
"self",
".",
"_cont... | [
45,
4
] | [
53,
60
] | python | en | ['en', 'en', 'en'] | True |
RainBirdSensor.name | (self) | Return the name of this camera. | Return the name of this camera. | def name(self):
"""Return the name of this camera."""
return self._name | [
"def",
"name",
"(",
"self",
")",
":",
"return",
"self",
".",
"_name"
] | [
56,
4
] | [
58,
25
] | python | en | ['en', 'en', 'en'] | True |
RainBirdSensor.icon | (self) | Return icon. | Return icon. | def icon(self):
"""Return icon."""
return self._icon | [
"def",
"icon",
"(",
"self",
")",
":",
"return",
"self",
".",
"_icon"
] | [
61,
4
] | [
63,
25
] | python | en | ['en', 'la', 'en'] | False |
async_setup_entry | (hass, config_entry, async_add_entities) | Set up sensors for device. | Set up sensors for device. | async def async_setup_entry(hass, config_entry, async_add_entities):
"""Set up sensors for device."""
await async_setup_entry_attribute_entities(
hass, config_entry, async_add_entities, SENSORS, ShellyBinarySensor
)
await async_setup_entry_rest(
hass, config_entry, async_add_entities, R... | [
"async",
"def",
"async_setup_entry",
"(",
"hass",
",",
"config_entry",
",",
"async_add_entities",
")",
":",
"await",
"async_setup_entry_attribute_entities",
"(",
"hass",
",",
"config_entry",
",",
"async_add_entities",
",",
"SENSORS",
",",
"ShellyBinarySensor",
")",
"a... | [
94,
0
] | [
102,
5
] | python | en | ['en', 'en', 'en'] | True |
ShellyBinarySensor.is_on | (self) | Return true if sensor state is on. | Return true if sensor state is on. | def is_on(self):
"""Return true if sensor state is on."""
return bool(self.attribute_value) | [
"def",
"is_on",
"(",
"self",
")",
":",
"return",
"bool",
"(",
"self",
".",
"attribute_value",
")"
] | [
109,
4
] | [
111,
41
] | python | en | ['en', 'et', 'en'] | True |
ShellyRestBinarySensor.is_on | (self) | Return true if REST sensor state is on. | Return true if REST sensor state is on. | def is_on(self):
"""Return true if REST sensor state is on."""
return bool(self.attribute_value) | [
"def",
"is_on",
"(",
"self",
")",
":",
"return",
"bool",
"(",
"self",
".",
"attribute_value",
")"
] | [
118,
4
] | [
120,
41
] | python | en | ['en', 'mt', 'en'] | True |
get_default_transform | (dataset: str) |
To get a default transformation of image for a specific dataset.
This is needed because transform objects can not be directly passed as arguments.
Parameters
----------
dataset : str
Dataset class name.
Returns
-------
transform object
|
To get a default transformation of image for a specific dataset.
This is needed because transform objects can not be directly passed as arguments. | def get_default_transform(dataset: str) -> Any:
"""
To get a default transformation of image for a specific dataset.
This is needed because transform objects can not be directly passed as arguments.
Parameters
----------
dataset : str
Dataset class name.
Returns
-------
tra... | [
"def",
"get_default_transform",
"(",
"dataset",
":",
"str",
")",
"->",
"Any",
":",
"if",
"dataset",
"==",
"'MNIST'",
":",
"return",
"transforms",
".",
"Compose",
"(",
"[",
"transforms",
".",
"ToTensor",
"(",
")",
",",
"transforms",
".",
"Normalize",
"(",
... | [
22,
0
] | [
50,
15
] | python | en | ['en', 'error', 'th'] | False |
PyTorchImageClassificationTrainer.__init__ | (self, model,
dataset_cls='MNIST', dataset_kwargs=None, dataloader_kwargs=None,
optimizer_cls='SGD', optimizer_kwargs=None, trainer_kwargs=None) | Initialization of image classification trainer.
Parameters
----------
model : nn.Module
Model to train.
dataset_cls : str, optional
Dataset class name that is available in ``torchvision.datasets``, by default 'MNIST'
dataset_kwargs : dict, optional
... | Initialization of image classification trainer. | def __init__(self, model,
dataset_cls='MNIST', dataset_kwargs=None, dataloader_kwargs=None,
optimizer_cls='SGD', optimizer_kwargs=None, trainer_kwargs=None):
"""Initialization of image classification trainer.
Parameters
----------
model : nn.Module
... | [
"def",
"__init__",
"(",
"self",
",",
"model",
",",
"dataset_cls",
"=",
"'MNIST'",
",",
"dataset_kwargs",
"=",
"None",
",",
"dataloader_kwargs",
"=",
"None",
",",
"optimizer_cls",
"=",
"'SGD'",
",",
"optimizer_kwargs",
"=",
"None",
",",
"trainer_kwargs",
"=",
... | [
66,
4
] | [
103,
89
] | python | en | ['en', 'en', 'en'] | True |
async_get_handler | (hass, config, discovery_info=None) | Set up the Asterix VM platform. | Set up the Asterix VM platform. | async def async_get_handler(hass, config, discovery_info=None):
"""Set up the Asterix VM platform."""
return AsteriskMailbox(hass, ASTERISK_DOMAIN) | [
"async",
"def",
"async_get_handler",
"(",
"hass",
",",
"config",
",",
"discovery_info",
"=",
"None",
")",
":",
"return",
"AsteriskMailbox",
"(",
"hass",
",",
"ASTERISK_DOMAIN",
")"
] | [
18,
0
] | [
20,
49
] | python | en | ['en', 'da', 'en'] | True |
AsteriskMailbox.__init__ | (self, hass, name) | Initialize Asterisk mailbox. | Initialize Asterisk mailbox. | def __init__(self, hass, name):
"""Initialize Asterisk mailbox."""
super().__init__(hass, name)
async_dispatcher_connect(
self.hass, SIGNAL_MESSAGE_UPDATE, self._update_callback
) | [
"def",
"__init__",
"(",
"self",
",",
"hass",
",",
"name",
")",
":",
"super",
"(",
")",
".",
"__init__",
"(",
"hass",
",",
"name",
")",
"async_dispatcher_connect",
"(",
"self",
".",
"hass",
",",
"SIGNAL_MESSAGE_UPDATE",
",",
"self",
".",
"_update_callback",... | [
26,
4
] | [
31,
9
] | python | co | ['no', 'co', 'it'] | False |
AsteriskMailbox._update_callback | (self, msg) | Update the message count in HA, if needed. | Update the message count in HA, if needed. | def _update_callback(self, msg):
"""Update the message count in HA, if needed."""
self.async_update() | [
"def",
"_update_callback",
"(",
"self",
",",
"msg",
")",
":",
"self",
".",
"async_update",
"(",
")"
] | [
34,
4
] | [
36,
27
] | python | en | ['en', 'en', 'en'] | True |
AsteriskMailbox.media_type | (self) | Return the supported media type. | Return the supported media type. | def media_type(self):
"""Return the supported media type."""
return CONTENT_TYPE_MPEG | [
"def",
"media_type",
"(",
"self",
")",
":",
"return",
"CONTENT_TYPE_MPEG"
] | [
39,
4
] | [
41,
32
] | python | en | ['en', 'en', 'en'] | True |
AsteriskMailbox.can_delete | (self) | Return if messages can be deleted. | Return if messages can be deleted. | def can_delete(self):
"""Return if messages can be deleted."""
return True | [
"def",
"can_delete",
"(",
"self",
")",
":",
"return",
"True"
] | [
44,
4
] | [
46,
19
] | python | en | ['en', 'en', 'en'] | True |
AsteriskMailbox.has_media | (self) | Return if messages have attached media files. | Return if messages have attached media files. | def has_media(self):
"""Return if messages have attached media files."""
return True | [
"def",
"has_media",
"(",
"self",
")",
":",
"return",
"True"
] | [
49,
4
] | [
51,
19
] | python | en | ['en', 'en', 'en'] | True |
AsteriskMailbox.async_get_media | (self, msgid) | Return the media blob for the msgid. | Return the media blob for the msgid. | async def async_get_media(self, msgid):
"""Return the media blob for the msgid."""
client = self.hass.data[ASTERISK_DOMAIN].client
try:
return await self.hass.async_add_executor_job(
partial(client.mp3, msgid, sync=True)
)
except ServerError as er... | [
"async",
"def",
"async_get_media",
"(",
"self",
",",
"msgid",
")",
":",
"client",
"=",
"self",
".",
"hass",
".",
"data",
"[",
"ASTERISK_DOMAIN",
"]",
".",
"client",
"try",
":",
"return",
"await",
"self",
".",
"hass",
".",
"async_add_executor_job",
"(",
"... | [
53,
4
] | [
62,
43
] | python | en | ['en', 'no', 'en'] | True |
AsteriskMailbox.async_get_messages | (self) | Return a list of the current messages. | Return a list of the current messages. | async def async_get_messages(self):
"""Return a list of the current messages."""
return self.hass.data[ASTERISK_DOMAIN].messages | [
"async",
"def",
"async_get_messages",
"(",
"self",
")",
":",
"return",
"self",
".",
"hass",
".",
"data",
"[",
"ASTERISK_DOMAIN",
"]",
".",
"messages"
] | [
64,
4
] | [
66,
55
] | python | en | ['en', 'en', 'en'] | True |
AsteriskMailbox.async_delete | (self, msgid) | Delete the specified messages. | Delete the specified messages. | async def async_delete(self, msgid):
"""Delete the specified messages."""
client = self.hass.data[ASTERISK_DOMAIN].client
_LOGGER.info("Deleting: %s", msgid)
await self.hass.async_add_executor_job(client.delete, msgid)
return True | [
"async",
"def",
"async_delete",
"(",
"self",
",",
"msgid",
")",
":",
"client",
"=",
"self",
".",
"hass",
".",
"data",
"[",
"ASTERISK_DOMAIN",
"]",
".",
"client",
"_LOGGER",
".",
"info",
"(",
"\"Deleting: %s\"",
",",
"msgid",
")",
"await",
"self",
".",
... | [
68,
4
] | [
73,
19
] | python | en | ['en', 'en', 'en'] | True |
get_service | (hass, config, discovery_info=None) | Get the Twitter notification service. | Get the Twitter notification service. | def get_service(hass, config, discovery_info=None):
"""Get the Twitter notification service."""
return TwitterNotificationService(
hass,
config[CONF_CONSUMER_KEY],
config[CONF_CONSUMER_SECRET],
config[CONF_ACCESS_TOKEN],
config[CONF_ACCESS_TOKEN_SECRET],
config.ge... | [
"def",
"get_service",
"(",
"hass",
",",
"config",
",",
"discovery_info",
"=",
"None",
")",
":",
"return",
"TwitterNotificationService",
"(",
"hass",
",",
"config",
"[",
"CONF_CONSUMER_KEY",
"]",
",",
"config",
"[",
"CONF_CONSUMER_SECRET",
"]",
",",
"config",
"... | [
39,
0
] | [
48,
5
] | python | en | ['en', 'en', 'en'] | True |
TwitterNotificationService.__init__ | (
self,
hass,
consumer_key,
consumer_secret,
access_token_key,
access_token_secret,
username,
) | Initialize the service. | Initialize the service. | def __init__(
self,
hass,
consumer_key,
consumer_secret,
access_token_key,
access_token_secret,
username,
):
"""Initialize the service."""
self.user = username
self.hass = hass
self.api = TwitterAPI(
consumer_key, co... | [
"def",
"__init__",
"(",
"self",
",",
"hass",
",",
"consumer_key",
",",
"consumer_secret",
",",
"access_token_key",
",",
"access_token_secret",
",",
"username",
",",
")",
":",
"self",
".",
"user",
"=",
"username",
"self",
".",
"hass",
"=",
"hass",
"self",
"... | [
54,
4
] | [
68,
9
] | python | en | ['en', 'en', 'en'] | True |
TwitterNotificationService.send_message | (self, message="", **kwargs) | Tweet a message, optionally with media. | Tweet a message, optionally with media. | def send_message(self, message="", **kwargs):
"""Tweet a message, optionally with media."""
data = kwargs.get(ATTR_DATA)
media = None
if data:
media = data.get(ATTR_MEDIA)
if not self.hass.config.is_allowed_path(media):
_LOGGER.warning("'%s' is no... | [
"def",
"send_message",
"(",
"self",
",",
"message",
"=",
"\"\"",
",",
"*",
"*",
"kwargs",
")",
":",
"data",
"=",
"kwargs",
".",
"get",
"(",
"ATTR_DATA",
")",
"media",
"=",
"None",
"if",
"data",
":",
"media",
"=",
"data",
".",
"get",
"(",
"ATTR_MEDI... | [
70,
4
] | [
83,
56
] | python | en | ['en', 'en', 'en'] | True |
TwitterNotificationService.send_message_callback | (self, message, media_id=None) | Tweet a message, optionally with media. | Tweet a message, optionally with media. | def send_message_callback(self, message, media_id=None):
"""Tweet a message, optionally with media."""
if self.user:
user_resp = self.api.request("users/lookup", {"screen_name": self.user})
user_id = user_resp.json()[0]["id"]
if user_resp.status_code != HTTP_OK:
... | [
"def",
"send_message_callback",
"(",
"self",
",",
"message",
",",
"media_id",
"=",
"None",
")",
":",
"if",
"self",
".",
"user",
":",
"user_resp",
"=",
"self",
".",
"api",
".",
"request",
"(",
"\"users/lookup\"",
",",
"{",
"\"screen_name\"",
":",
"self",
... | [
85,
4
] | [
113,
60
] | python | en | ['en', 'en', 'en'] | True |
TwitterNotificationService.upload_media_then_callback | (self, callback, media_path=None) | Upload media. | Upload media. | def upload_media_then_callback(self, callback, media_path=None):
"""Upload media."""
if not media_path:
return callback()
with open(media_path, "rb") as file:
total_bytes = os.path.getsize(media_path)
(media_category, media_type) = self.media_info(media_path)... | [
"def",
"upload_media_then_callback",
"(",
"self",
",",
"callback",
",",
"media_path",
"=",
"None",
")",
":",
"if",
"not",
"media_path",
":",
"return",
"callback",
"(",
")",
"with",
"open",
"(",
"media_path",
",",
"\"rb\"",
")",
"as",
"file",
":",
"total_by... | [
115,
4
] | [
140,
60
] | python | en | ['en', 'sv', 'ur'] | False |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.