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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
slow | (test_case) |
Decorator marking a test as slow.
Slow tests are skipped by default. Set the RUN_SLOW environment variable to a truthy value to run them.
|
Decorator marking a test as slow. | def slow(test_case):
"""
Decorator marking a test as slow.
Slow tests are skipped by default. Set the RUN_SLOW environment variable to a truthy value to run them.
"""
if not _run_slow_tests:
return unittest.skip("test is slow")(test_case)
else:
return test_case | [
"def",
"slow",
"(",
"test_case",
")",
":",
"if",
"not",
"_run_slow_tests",
":",
"return",
"unittest",
".",
"skip",
"(",
"\"test is slow\"",
")",
"(",
"test_case",
")",
"else",
":",
"return",
"test_case"
] | [
147,
0
] | [
157,
24
] | python | en | ['en', 'error', 'th'] | False |
tooslow | (test_case) |
Decorator marking a test as too slow.
Slow tests are skipped while they're in the process of being fixed. No test should stay tagged as "tooslow" as
these will not be tested by the CI.
|
Decorator marking a test as too slow. | def tooslow(test_case):
"""
Decorator marking a test as too slow.
Slow tests are skipped while they're in the process of being fixed. No test should stay tagged as "tooslow" as
these will not be tested by the CI.
"""
return unittest.skip("test is too slow")(test_case) | [
"def",
"tooslow",
"(",
"test_case",
")",
":",
"return",
"unittest",
".",
"skip",
"(",
"\"test is too slow\"",
")",
"(",
"test_case",
")"
] | [
160,
0
] | [
168,
55
] | python | en | ['en', 'error', 'th'] | False |
custom_tokenizers | (test_case) |
Decorator marking a test for a custom tokenizer.
Custom tokenizers require additional dependencies, and are skipped by default. Set the RUN_CUSTOM_TOKENIZERS
environment variable to a truthy value to run them.
|
Decorator marking a test for a custom tokenizer. | def custom_tokenizers(test_case):
"""
Decorator marking a test for a custom tokenizer.
Custom tokenizers require additional dependencies, and are skipped by default. Set the RUN_CUSTOM_TOKENIZERS
environment variable to a truthy value to run them.
"""
if not _run_custom_tokenizers:
retu... | [
"def",
"custom_tokenizers",
"(",
"test_case",
")",
":",
"if",
"not",
"_run_custom_tokenizers",
":",
"return",
"unittest",
".",
"skip",
"(",
"\"test of custom tokenizers\"",
")",
"(",
"test_case",
")",
"else",
":",
"return",
"test_case"
] | [
171,
0
] | [
181,
24
] | python | en | ['en', 'error', 'th'] | False |
require_git_lfs | (test_case) |
Decorator marking a test that requires git-lfs.
git-lfs requires additional dependencies, and tests are skipped by default. Set the RUN_GIT_LFS_TESTS environment
variable to a truthy value to run them.
|
Decorator marking a test that requires git-lfs. | def require_git_lfs(test_case):
"""
Decorator marking a test that requires git-lfs.
git-lfs requires additional dependencies, and tests are skipped by default. Set the RUN_GIT_LFS_TESTS environment
variable to a truthy value to run them.
"""
if not _run_git_lfs_tests:
return unittest.sk... | [
"def",
"require_git_lfs",
"(",
"test_case",
")",
":",
"if",
"not",
"_run_git_lfs_tests",
":",
"return",
"unittest",
".",
"skip",
"(",
"\"test of git lfs workflow\"",
")",
"(",
"test_case",
")",
"else",
":",
"return",
"test_case"
] | [
184,
0
] | [
194,
24
] | python | en | ['en', 'error', 'th'] | False |
require_torch | (test_case) |
Decorator marking a test that requires PyTorch.
These tests are skipped when PyTorch isn't installed.
|
Decorator marking a test that requires PyTorch. | def require_torch(test_case):
"""
Decorator marking a test that requires PyTorch.
These tests are skipped when PyTorch isn't installed.
"""
if not is_torch_available():
return unittest.skip("test requires PyTorch")(test_case)
else:
return test_case | [
"def",
"require_torch",
"(",
"test_case",
")",
":",
"if",
"not",
"is_torch_available",
"(",
")",
":",
"return",
"unittest",
".",
"skip",
"(",
"\"test requires PyTorch\"",
")",
"(",
"test_case",
")",
"else",
":",
"return",
"test_case"
] | [
204,
0
] | [
214,
24
] | python | en | ['en', 'error', 'th'] | False |
require_torch_scatter | (test_case) |
Decorator marking a test that requires PyTorch scatter.
These tests are skipped when PyTorch scatter isn't installed.
|
Decorator marking a test that requires PyTorch scatter. | def require_torch_scatter(test_case):
"""
Decorator marking a test that requires PyTorch scatter.
These tests are skipped when PyTorch scatter isn't installed.
"""
if not is_scatter_available():
return unittest.skip("test requires PyTorch scatter")(test_case)
else:
return test_... | [
"def",
"require_torch_scatter",
"(",
"test_case",
")",
":",
"if",
"not",
"is_scatter_available",
"(",
")",
":",
"return",
"unittest",
".",
"skip",
"(",
"\"test requires PyTorch scatter\"",
")",
"(",
"test_case",
")",
"else",
":",
"return",
"test_case"
] | [
217,
0
] | [
227,
24
] | python | en | ['en', 'error', 'th'] | False |
require_torchaudio | (test_case) |
Decorator marking a test that requires torchaudio. These tests are skipped when torchaudio isn't installed.
|
Decorator marking a test that requires torchaudio. These tests are skipped when torchaudio isn't installed.
| def require_torchaudio(test_case):
"""
Decorator marking a test that requires torchaudio. These tests are skipped when torchaudio isn't installed.
"""
if not is_torchaudio_available():
return unittest.skip("test requires torchaudio")(test_case)
else:
return test_case | [
"def",
"require_torchaudio",
"(",
"test_case",
")",
":",
"if",
"not",
"is_torchaudio_available",
"(",
")",
":",
"return",
"unittest",
".",
"skip",
"(",
"\"test requires torchaudio\"",
")",
"(",
"test_case",
")",
"else",
":",
"return",
"test_case"
] | [
230,
0
] | [
237,
24
] | python | en | ['en', 'error', 'th'] | False |
require_tf | (test_case) |
Decorator marking a test that requires TensorFlow. These tests are skipped when TensorFlow isn't installed.
|
Decorator marking a test that requires TensorFlow. These tests are skipped when TensorFlow isn't installed.
| def require_tf(test_case):
"""
Decorator marking a test that requires TensorFlow. These tests are skipped when TensorFlow isn't installed.
"""
if not is_tf_available():
return unittest.skip("test requires TensorFlow")(test_case)
else:
return test_case | [
"def",
"require_tf",
"(",
"test_case",
")",
":",
"if",
"not",
"is_tf_available",
"(",
")",
":",
"return",
"unittest",
".",
"skip",
"(",
"\"test requires TensorFlow\"",
")",
"(",
"test_case",
")",
"else",
":",
"return",
"test_case"
] | [
240,
0
] | [
247,
24
] | python | en | ['en', 'error', 'th'] | False |
require_flax | (test_case) |
Decorator marking a test that requires JAX & Flax. These tests are skipped when one / both are not installed
|
Decorator marking a test that requires JAX & Flax. These tests are skipped when one / both are not installed
| def require_flax(test_case):
"""
Decorator marking a test that requires JAX & Flax. These tests are skipped when one / both are not installed
"""
if not is_flax_available():
test_case = unittest.skip("test requires JAX & Flax")(test_case)
return test_case | [
"def",
"require_flax",
"(",
"test_case",
")",
":",
"if",
"not",
"is_flax_available",
"(",
")",
":",
"test_case",
"=",
"unittest",
".",
"skip",
"(",
"\"test requires JAX & Flax\"",
")",
"(",
"test_case",
")",
"return",
"test_case"
] | [
250,
0
] | [
256,
20
] | python | en | ['en', 'error', 'th'] | False |
require_sentencepiece | (test_case) |
Decorator marking a test that requires SentencePiece. These tests are skipped when SentencePiece isn't installed.
|
Decorator marking a test that requires SentencePiece. These tests are skipped when SentencePiece isn't installed.
| def require_sentencepiece(test_case):
"""
Decorator marking a test that requires SentencePiece. These tests are skipped when SentencePiece isn't installed.
"""
if not is_sentencepiece_available():
return unittest.skip("test requires SentencePiece")(test_case)
else:
return test_case | [
"def",
"require_sentencepiece",
"(",
"test_case",
")",
":",
"if",
"not",
"is_sentencepiece_available",
"(",
")",
":",
"return",
"unittest",
".",
"skip",
"(",
"\"test requires SentencePiece\"",
")",
"(",
"test_case",
")",
"else",
":",
"return",
"test_case"
] | [
259,
0
] | [
266,
24
] | python | en | ['en', 'error', 'th'] | False |
require_tokenizers | (test_case) |
Decorator marking a test that requires 🤗 Tokenizers. These tests are skipped when 🤗 Tokenizers isn't installed.
|
Decorator marking a test that requires 🤗 Tokenizers. These tests are skipped when 🤗 Tokenizers isn't installed.
| def require_tokenizers(test_case):
"""
Decorator marking a test that requires 🤗 Tokenizers. These tests are skipped when 🤗 Tokenizers isn't installed.
"""
if not is_tokenizers_available():
return unittest.skip("test requires tokenizers")(test_case)
else:
return test_case | [
"def",
"require_tokenizers",
"(",
"test_case",
")",
":",
"if",
"not",
"is_tokenizers_available",
"(",
")",
":",
"return",
"unittest",
".",
"skip",
"(",
"\"test requires tokenizers\"",
")",
"(",
"test_case",
")",
"else",
":",
"return",
"test_case"
] | [
269,
0
] | [
276,
24
] | python | en | ['en', 'error', 'th'] | False |
require_pandas | (test_case) |
Decorator marking a test that requires pandas. These tests are skipped when pandas isn't installed.
|
Decorator marking a test that requires pandas. These tests are skipped when pandas isn't installed.
| def require_pandas(test_case):
"""
Decorator marking a test that requires pandas. These tests are skipped when pandas isn't installed.
"""
if not is_pandas_available():
return unittest.skip("test requires pandas")(test_case)
else:
return test_case | [
"def",
"require_pandas",
"(",
"test_case",
")",
":",
"if",
"not",
"is_pandas_available",
"(",
")",
":",
"return",
"unittest",
".",
"skip",
"(",
"\"test requires pandas\"",
")",
"(",
"test_case",
")",
"else",
":",
"return",
"test_case"
] | [
279,
0
] | [
286,
24
] | python | en | ['en', 'error', 'th'] | False |
require_scatter | (test_case) |
Decorator marking a test that requires PyTorch Scatter. These tests are skipped when PyTorch Scatter isn't
installed.
|
Decorator marking a test that requires PyTorch Scatter. These tests are skipped when PyTorch Scatter isn't
installed.
| def require_scatter(test_case):
"""
Decorator marking a test that requires PyTorch Scatter. These tests are skipped when PyTorch Scatter isn't
installed.
"""
if not is_scatter_available():
return unittest.skip("test requires PyTorch Scatter")(test_case)
else:
return test_case | [
"def",
"require_scatter",
"(",
"test_case",
")",
":",
"if",
"not",
"is_scatter_available",
"(",
")",
":",
"return",
"unittest",
".",
"skip",
"(",
"\"test requires PyTorch Scatter\"",
")",
"(",
"test_case",
")",
"else",
":",
"return",
"test_case"
] | [
289,
0
] | [
297,
24
] | python | en | ['en', 'error', 'th'] | False |
require_vision | (test_case) |
Decorator marking a test that requires the vision dependencies. These tests are skipped when torchaudio isn't
installed.
|
Decorator marking a test that requires the vision dependencies. These tests are skipped when torchaudio isn't
installed.
| def require_vision(test_case):
"""
Decorator marking a test that requires the vision dependencies. These tests are skipped when torchaudio isn't
installed.
"""
if not is_vision_available():
return unittest.skip("test requires vision")(test_case)
else:
return test_case | [
"def",
"require_vision",
"(",
"test_case",
")",
":",
"if",
"not",
"is_vision_available",
"(",
")",
":",
"return",
"unittest",
".",
"skip",
"(",
"\"test requires vision\"",
")",
"(",
"test_case",
")",
"else",
":",
"return",
"test_case"
] | [
300,
0
] | [
308,
24
] | python | en | ['en', 'error', 'th'] | False |
require_torch_multi_gpu | (test_case) |
Decorator marking a test that requires a multi-GPU setup (in PyTorch). These tests are skipped on a machine without
multiple GPUs.
To run *only* the multi_gpu tests, assuming all test names contain multi_gpu: $ pytest -sv ./tests -k "multi_gpu"
|
Decorator marking a test that requires a multi-GPU setup (in PyTorch). These tests are skipped on a machine without
multiple GPUs. | def require_torch_multi_gpu(test_case):
"""
Decorator marking a test that requires a multi-GPU setup (in PyTorch). These tests are skipped on a machine without
multiple GPUs.
To run *only* the multi_gpu tests, assuming all test names contain multi_gpu: $ pytest -sv ./tests -k "multi_gpu"
"""
if... | [
"def",
"require_torch_multi_gpu",
"(",
"test_case",
")",
":",
"if",
"not",
"is_torch_available",
"(",
")",
":",
"return",
"unittest",
".",
"skip",
"(",
"\"test requires PyTorch\"",
")",
"(",
"test_case",
")",
"import",
"torch",
"if",
"torch",
".",
"cuda",
".",... | [
311,
0
] | [
326,
24
] | python | en | ['en', 'error', 'th'] | False |
require_torch_non_multi_gpu | (test_case) |
Decorator marking a test that requires 0 or 1 GPU setup (in PyTorch).
|
Decorator marking a test that requires 0 or 1 GPU setup (in PyTorch).
| def require_torch_non_multi_gpu(test_case):
"""
Decorator marking a test that requires 0 or 1 GPU setup (in PyTorch).
"""
if not is_torch_available():
return unittest.skip("test requires PyTorch")(test_case)
import torch
if torch.cuda.device_count() > 1:
return unittest.skip("t... | [
"def",
"require_torch_non_multi_gpu",
"(",
"test_case",
")",
":",
"if",
"not",
"is_torch_available",
"(",
")",
":",
"return",
"unittest",
".",
"skip",
"(",
"\"test requires PyTorch\"",
")",
"(",
"test_case",
")",
"import",
"torch",
"if",
"torch",
".",
"cuda",
... | [
329,
0
] | [
341,
24
] | python | en | ['en', 'error', 'th'] | False |
require_torch_tpu | (test_case) |
Decorator marking a test that requires a TPU (in PyTorch).
|
Decorator marking a test that requires a TPU (in PyTorch).
| def require_torch_tpu(test_case):
"""
Decorator marking a test that requires a TPU (in PyTorch).
"""
if not is_torch_tpu_available():
return unittest.skip("test requires PyTorch TPU")
else:
return test_case | [
"def",
"require_torch_tpu",
"(",
"test_case",
")",
":",
"if",
"not",
"is_torch_tpu_available",
"(",
")",
":",
"return",
"unittest",
".",
"skip",
"(",
"\"test requires PyTorch TPU\"",
")",
"else",
":",
"return",
"test_case"
] | [
344,
0
] | [
351,
24
] | python | en | ['en', 'error', 'th'] | False |
require_torch_gpu | (test_case) | Decorator marking a test that requires CUDA and PyTorch. | Decorator marking a test that requires CUDA and PyTorch. | def require_torch_gpu(test_case):
"""Decorator marking a test that requires CUDA and PyTorch. """
if torch_device != "cuda":
return unittest.skip("test requires CUDA")(test_case)
else:
return test_case | [
"def",
"require_torch_gpu",
"(",
"test_case",
")",
":",
"if",
"torch_device",
"!=",
"\"cuda\"",
":",
"return",
"unittest",
".",
"skip",
"(",
"\"test requires CUDA\"",
")",
"(",
"test_case",
")",
"else",
":",
"return",
"test_case"
] | [
363,
0
] | [
368,
24
] | python | en | ['en', 'en', 'en'] | True |
require_datasets | (test_case) | Decorator marking a test that requires datasets. | Decorator marking a test that requires datasets. | def require_datasets(test_case):
"""Decorator marking a test that requires datasets."""
if not is_datasets_available():
return unittest.skip("test requires `datasets`")(test_case)
else:
return test_case | [
"def",
"require_datasets",
"(",
"test_case",
")",
":",
"if",
"not",
"is_datasets_available",
"(",
")",
":",
"return",
"unittest",
".",
"skip",
"(",
"\"test requires `datasets`\"",
")",
"(",
"test_case",
")",
"else",
":",
"return",
"test_case"
] | [
371,
0
] | [
377,
24
] | python | en | ['en', 'en', 'en'] | True |
require_faiss | (test_case) | Decorator marking a test that requires faiss. | Decorator marking a test that requires faiss. | def require_faiss(test_case):
"""Decorator marking a test that requires faiss."""
if not is_faiss_available():
return unittest.skip("test requires `faiss`")(test_case)
else:
return test_case | [
"def",
"require_faiss",
"(",
"test_case",
")",
":",
"if",
"not",
"is_faiss_available",
"(",
")",
":",
"return",
"unittest",
".",
"skip",
"(",
"\"test requires `faiss`\"",
")",
"(",
"test_case",
")",
"else",
":",
"return",
"test_case"
] | [
380,
0
] | [
385,
24
] | python | en | ['en', 'en', 'en'] | True |
require_optuna | (test_case) |
Decorator marking a test that requires optuna.
These tests are skipped when optuna isn't installed.
|
Decorator marking a test that requires optuna. | def require_optuna(test_case):
"""
Decorator marking a test that requires optuna.
These tests are skipped when optuna isn't installed.
"""
if not is_optuna_available():
return unittest.skip("test requires optuna")(test_case)
else:
return test_case | [
"def",
"require_optuna",
"(",
"test_case",
")",
":",
"if",
"not",
"is_optuna_available",
"(",
")",
":",
"return",
"unittest",
".",
"skip",
"(",
"\"test requires optuna\"",
")",
"(",
"test_case",
")",
"else",
":",
"return",
"test_case"
] | [
388,
0
] | [
398,
24
] | python | en | ['en', 'error', 'th'] | False |
require_ray | (test_case) |
Decorator marking a test that requires Ray/tune.
These tests are skipped when Ray/tune isn't installed.
|
Decorator marking a test that requires Ray/tune. | def require_ray(test_case):
"""
Decorator marking a test that requires Ray/tune.
These tests are skipped when Ray/tune isn't installed.
"""
if not is_ray_available():
return unittest.skip("test requires Ray/tune")(test_case)
else:
return test_case | [
"def",
"require_ray",
"(",
"test_case",
")",
":",
"if",
"not",
"is_ray_available",
"(",
")",
":",
"return",
"unittest",
".",
"skip",
"(",
"\"test requires Ray/tune\"",
")",
"(",
"test_case",
")",
"else",
":",
"return",
"test_case"
] | [
401,
0
] | [
411,
24
] | python | en | ['en', 'error', 'th'] | False |
require_soundfile | (test_case) |
Decorator marking a test that requires soundfile
These tests are skipped when soundfile isn't installed.
|
Decorator marking a test that requires soundfile | def require_soundfile(test_case):
"""
Decorator marking a test that requires soundfile
These tests are skipped when soundfile isn't installed.
"""
if not is_soundfile_availble():
return unittest.skip("test requires soundfile")(test_case)
else:
return test_case | [
"def",
"require_soundfile",
"(",
"test_case",
")",
":",
"if",
"not",
"is_soundfile_availble",
"(",
")",
":",
"return",
"unittest",
".",
"skip",
"(",
"\"test requires soundfile\"",
")",
"(",
"test_case",
")",
"else",
":",
"return",
"test_case"
] | [
414,
0
] | [
424,
24
] | python | en | ['en', 'error', 'th'] | False |
get_gpu_count | () |
Return the number of available gpus (regardless of whether torch or tf is used)
|
Return the number of available gpus (regardless of whether torch or tf is used)
| def get_gpu_count():
"""
Return the number of available gpus (regardless of whether torch or tf is used)
"""
if is_torch_available():
import torch
return torch.cuda.device_count()
elif is_tf_available():
import tensorflow as tf
return len(tf.config.list_physical_dev... | [
"def",
"get_gpu_count",
"(",
")",
":",
"if",
"is_torch_available",
"(",
")",
":",
"import",
"torch",
"return",
"torch",
".",
"cuda",
".",
"device_count",
"(",
")",
"elif",
"is_tf_available",
"(",
")",
":",
"import",
"tensorflow",
"as",
"tf",
"return",
"len... | [
427,
0
] | [
440,
16
] | python | en | ['en', 'error', 'th'] | False |
get_tests_dir | (append_path=None) |
Args:
append_path: optional path to append to the tests dir path
Return:
The full path to the `tests` dir, so that the tests can be invoked from anywhere. Optionally `append_path` is
joined after the `tests` dir the former is provided.
|
Args:
append_path: optional path to append to the tests dir path | def get_tests_dir(append_path=None):
"""
Args:
append_path: optional path to append to the tests dir path
Return:
The full path to the `tests` dir, so that the tests can be invoked from anywhere. Optionally `append_path` is
joined after the `tests` dir the former is provided.
"... | [
"def",
"get_tests_dir",
"(",
"append_path",
"=",
"None",
")",
":",
"# this function caller's __file__",
"caller__file__",
"=",
"inspect",
".",
"stack",
"(",
")",
"[",
"1",
"]",
"[",
"1",
"]",
"tests_dir",
"=",
"os",
".",
"path",
".",
"abspath",
"(",
"os",
... | [
443,
0
] | [
459,
24
] | python | en | ['en', 'error', 'th'] | False |
mockenv | (**kwargs) |
this is a convenience wrapper, that allows this ::
@mockenv(RUN_SLOW=True, USE_TF=False)
def test_something():
run_slow = os.getenv("RUN_SLOW", False)
use_tf = os.getenv("USE_TF", False)
|
this is a convenience wrapper, that allows this :: | def mockenv(**kwargs):
"""
this is a convenience wrapper, that allows this ::
@mockenv(RUN_SLOW=True, USE_TF=False)
def test_something():
run_slow = os.getenv("RUN_SLOW", False)
use_tf = os.getenv("USE_TF", False)
"""
return unittest.mock.patch.dict(os.environ, kwargs) | [
"def",
"mockenv",
"(",
"*",
"*",
"kwargs",
")",
":",
"return",
"unittest",
".",
"mock",
".",
"patch",
".",
"dict",
"(",
"os",
".",
"environ",
",",
"kwargs",
")"
] | [
870,
0
] | [
880,
55
] | python | en | ['en', 'error', 'th'] | False |
mockenv_context | (*remove, **update) |
Temporarily updates the ``os.environ`` dictionary in-place. Similar to mockenv
The ``os.environ`` dictionary is updated in-place so that the modification is sure to work in all situations.
Args:
remove: Environment variables to remove.
update: Dictionary of environment variables and values to... |
Temporarily updates the ``os.environ`` dictionary in-place. Similar to mockenv | def mockenv_context(*remove, **update):
"""
Temporarily updates the ``os.environ`` dictionary in-place. Similar to mockenv
The ``os.environ`` dictionary is updated in-place so that the modification is sure to work in all situations.
Args:
remove: Environment variables to remove.
update: Di... | [
"def",
"mockenv_context",
"(",
"*",
"remove",
",",
"*",
"*",
"update",
")",
":",
"env",
"=",
"os",
".",
"environ",
"update",
"=",
"update",
"or",
"{",
"}",
"remove",
"=",
"remove",
"or",
"[",
"]",
"# List of environment variables being updated or removed.",
... | [
885,
0
] | [
912,
42
] | python | en | ['en', 'error', 'th'] | False |
pytest_addoption_shared | (parser) |
This function is to be called from `conftest.py` via `pytest_addoption` wrapper that has to be defined there.
It allows loading both `conftest.py` files at once without causing a failure due to adding the same `pytest`
option.
|
This function is to be called from `conftest.py` via `pytest_addoption` wrapper that has to be defined there. | def pytest_addoption_shared(parser):
"""
This function is to be called from `conftest.py` via `pytest_addoption` wrapper that has to be defined there.
It allows loading both `conftest.py` files at once without causing a failure due to adding the same `pytest`
option.
"""
option = "--make-repor... | [
"def",
"pytest_addoption_shared",
"(",
"parser",
")",
":",
"option",
"=",
"\"--make-reports\"",
"if",
"option",
"not",
"in",
"pytest_opt_registered",
":",
"parser",
".",
"addoption",
"(",
"option",
",",
"action",
"=",
"\"store\"",
",",
"default",
"=",
"False",
... | [
921,
0
] | [
937,
41
] | python | en | ['en', 'error', 'th'] | False |
pytest_terminal_summary_main | (tr, id) |
Generate multiple reports at the end of test suite run - each report goes into a dedicated file in the current
directory. The report files are prefixed with the test suite name.
This function emulates --duration and -rA pytest arguments.
This function is to be called from `conftest.py` via `pytest_te... |
Generate multiple reports at the end of test suite run - each report goes into a dedicated file in the current
directory. The report files are prefixed with the test suite name. | def pytest_terminal_summary_main(tr, id):
"""
Generate multiple reports at the end of test suite run - each report goes into a dedicated file in the current
directory. The report files are prefixed with the test suite name.
This function emulates --duration and -rA pytest arguments.
This function ... | [
"def",
"pytest_terminal_summary_main",
"(",
"tr",
",",
"id",
")",
":",
"from",
"_pytest",
".",
"config",
"import",
"create_terminal_writer",
"if",
"not",
"len",
"(",
"id",
")",
":",
"id",
"=",
"\"tests\"",
"config",
"=",
"tr",
".",
"config",
"orig_writer",
... | [
940,
0
] | [
1067,
40
] | python | en | ['en', 'error', 'th'] | False |
TestCasePlus.get_env | (self) |
Return a copy of the ``os.environ`` object that sets up ``PYTHONPATH`` correctly, depending on the test suite
it's invoked from. This is useful for invoking external programs from the test suite - e.g. distributed
training.
It always inserts ``./src`` first, then ``./tests`` or ``./exa... |
Return a copy of the ``os.environ`` object that sets up ``PYTHONPATH`` correctly, depending on the test suite
it's invoked from. This is useful for invoking external programs from the test suite - e.g. distributed
training. | def get_env(self):
"""
Return a copy of the ``os.environ`` object that sets up ``PYTHONPATH`` correctly, depending on the test suite
it's invoked from. This is useful for invoking external programs from the test suite - e.g. distributed
training.
It always inserts ``./src`` firs... | [
"def",
"get_env",
"(",
"self",
")",
":",
"env",
"=",
"os",
".",
"environ",
".",
"copy",
"(",
")",
"paths",
"=",
"[",
"self",
".",
"src_dir_str",
"]",
"if",
"\"/examples\"",
"in",
"self",
".",
"test_file_dir_str",
":",
"paths",
".",
"append",
"(",
"se... | [
771,
4
] | [
790,
18
] | python | en | ['en', 'error', 'th'] | False |
TestCasePlus.get_auto_remove_tmp_dir | (self, tmp_dir=None, before=None, after=None) |
Args:
tmp_dir (:obj:`string`, `optional`):
if :obj:`None`:
- a unique temporary path will be created
- sets ``before=True`` if ``before`` is :obj:`None`
- sets ``after=True`` if ``after`` is :obj:`None`
else:
... |
Args:
tmp_dir (:obj:`string`, `optional`):
if :obj:`None`: | def get_auto_remove_tmp_dir(self, tmp_dir=None, before=None, after=None):
"""
Args:
tmp_dir (:obj:`string`, `optional`):
if :obj:`None`:
- a unique temporary path will be created
- sets ``before=True`` if ``before`` is :obj:`None`
... | [
"def",
"get_auto_remove_tmp_dir",
"(",
"self",
",",
"tmp_dir",
"=",
"None",
",",
"before",
"=",
"None",
",",
"after",
"=",
"None",
")",
":",
"if",
"tmp_dir",
"is",
"not",
"None",
":",
"# defining the most likely desired behavior for when a custom path is provided.",
... | [
792,
4
] | [
860,
22
] | python | en | ['en', 'error', 'th'] | False |
async_setup_platform | (
hass: HomeAssistantType, config: ConfigType, async_add_entities, discovery_info=None
) | Set up the NSW Rural Fire Service Feed platform. | Set up the NSW Rural Fire Service Feed platform. | async def async_setup_platform(
hass: HomeAssistantType, config: ConfigType, async_add_entities, discovery_info=None
):
"""Set up the NSW Rural Fire Service Feed platform."""
scan_interval = config.get(CONF_SCAN_INTERVAL, SCAN_INTERVAL)
coordinates = (
config.get(CONF_LATITUDE, hass.config.latit... | [
"async",
"def",
"async_setup_platform",
"(",
"hass",
":",
"HomeAssistantType",
",",
"config",
":",
"ConfigType",
",",
"async_add_entities",
",",
"discovery_info",
"=",
"None",
")",
":",
"scan_interval",
"=",
"config",
".",
"get",
"(",
"CONF_SCAN_INTERVAL",
",",
... | [
66,
0
] | [
92,
50
] | python | en | ['en', 'en', 'en'] | True |
NswRuralFireServiceFeedEntityManager.__init__ | (
self,
hass,
async_add_entities,
scan_interval,
coordinates,
radius_in_km,
categories,
) | Initialize the Feed Entity Manager. | Initialize the Feed Entity Manager. | def __init__(
self,
hass,
async_add_entities,
scan_interval,
coordinates,
radius_in_km,
categories,
):
"""Initialize the Feed Entity Manager."""
self._hass = hass
websession = aiohttp_client.async_get_clientsession(hass)
self._f... | [
"def",
"__init__",
"(",
"self",
",",
"hass",
",",
"async_add_entities",
",",
"scan_interval",
",",
"coordinates",
",",
"radius_in_km",
",",
"categories",
",",
")",
":",
"self",
".",
"_hass",
"=",
"hass",
"websession",
"=",
"aiohttp_client",
".",
"async_get_cli... | [
98,
4
] | [
121,
47
] | python | en | ['en', 'en', 'en'] | True |
NswRuralFireServiceFeedEntityManager.async_init | (self) | Schedule initial and regular updates based on configured time interval. | Schedule initial and regular updates based on configured time interval. | async def async_init(self):
"""Schedule initial and regular updates based on configured time interval."""
async def update(event_time):
"""Update."""
await self.async_update()
# Trigger updates at regular intervals.
self._track_time_remove_callback = async_track... | [
"async",
"def",
"async_init",
"(",
"self",
")",
":",
"async",
"def",
"update",
"(",
"event_time",
")",
":",
"\"\"\"Update.\"\"\"",
"await",
"self",
".",
"async_update",
"(",
")",
"# Trigger updates at regular intervals.",
"self",
".",
"_track_time_remove_callback",
... | [
123,
4
] | [
135,
56
] | python | en | ['en', 'en', 'en'] | True |
NswRuralFireServiceFeedEntityManager.async_update | (self) | Refresh data. | Refresh data. | async def async_update(self):
"""Refresh data."""
await self._feed_manager.update()
_LOGGER.debug("Feed entity manager updated") | [
"async",
"def",
"async_update",
"(",
"self",
")",
":",
"await",
"self",
".",
"_feed_manager",
".",
"update",
"(",
")",
"_LOGGER",
".",
"debug",
"(",
"\"Feed entity manager updated\"",
")"
] | [
137,
4
] | [
140,
52
] | python | de | ['de', 'sn', 'en'] | False |
NswRuralFireServiceFeedEntityManager.async_stop | (self) | Stop this feed entity manager from refreshing. | Stop this feed entity manager from refreshing. | async def async_stop(self):
"""Stop this feed entity manager from refreshing."""
if self._track_time_remove_callback:
self._track_time_remove_callback()
_LOGGER.debug("Feed entity manager stopped") | [
"async",
"def",
"async_stop",
"(",
"self",
")",
":",
"if",
"self",
".",
"_track_time_remove_callback",
":",
"self",
".",
"_track_time_remove_callback",
"(",
")",
"_LOGGER",
".",
"debug",
"(",
"\"Feed entity manager stopped\"",
")"
] | [
142,
4
] | [
146,
52
] | python | en | ['en', 'en', 'en'] | True |
NswRuralFireServiceFeedEntityManager.get_entry | (self, external_id) | Get feed entry by external id. | Get feed entry by external id. | def get_entry(self, external_id):
"""Get feed entry by external id."""
return self._feed_manager.feed_entries.get(external_id) | [
"def",
"get_entry",
"(",
"self",
",",
"external_id",
")",
":",
"return",
"self",
".",
"_feed_manager",
".",
"feed_entries",
".",
"get",
"(",
"external_id",
")"
] | [
148,
4
] | [
150,
63
] | python | en | ['en', 'en', 'en'] | True |
NswRuralFireServiceFeedEntityManager._generate_entity | (self, external_id) | Generate new entity. | Generate new entity. | async def _generate_entity(self, external_id):
"""Generate new entity."""
new_entity = NswRuralFireServiceLocationEvent(self, external_id)
# Add new entities to HA.
self._async_add_entities([new_entity], True) | [
"async",
"def",
"_generate_entity",
"(",
"self",
",",
"external_id",
")",
":",
"new_entity",
"=",
"NswRuralFireServiceLocationEvent",
"(",
"self",
",",
"external_id",
")",
"# Add new entities to HA.",
"self",
".",
"_async_add_entities",
"(",
"[",
"new_entity",
"]",
... | [
152,
4
] | [
156,
52
] | python | en | ['en', 'en', 'en'] | True |
NswRuralFireServiceFeedEntityManager._update_entity | (self, external_id) | Update entity. | Update entity. | async def _update_entity(self, external_id):
"""Update entity."""
async_dispatcher_send(self._hass, SIGNAL_UPDATE_ENTITY.format(external_id)) | [
"async",
"def",
"_update_entity",
"(",
"self",
",",
"external_id",
")",
":",
"async_dispatcher_send",
"(",
"self",
".",
"_hass",
",",
"SIGNAL_UPDATE_ENTITY",
".",
"format",
"(",
"external_id",
")",
")"
] | [
158,
4
] | [
160,
83
] | python | en | ['es', 'en', 'en'] | False |
NswRuralFireServiceFeedEntityManager._remove_entity | (self, external_id) | Remove entity. | Remove entity. | async def _remove_entity(self, external_id):
"""Remove entity."""
async_dispatcher_send(self._hass, SIGNAL_DELETE_ENTITY.format(external_id)) | [
"async",
"def",
"_remove_entity",
"(",
"self",
",",
"external_id",
")",
":",
"async_dispatcher_send",
"(",
"self",
".",
"_hass",
",",
"SIGNAL_DELETE_ENTITY",
".",
"format",
"(",
"external_id",
")",
")"
] | [
162,
4
] | [
164,
83
] | python | en | ['es', 'it', 'en'] | False |
NswRuralFireServiceLocationEvent.__init__ | (self, feed_manager, external_id) | Initialize entity with data from feed entry. | Initialize entity with data from feed entry. | def __init__(self, feed_manager, external_id):
"""Initialize entity with data from feed entry."""
self._feed_manager = feed_manager
self._external_id = external_id
self._name = None
self._distance = None
self._latitude = None
self._longitude = None
self._a... | [
"def",
"__init__",
"(",
"self",
",",
"feed_manager",
",",
"external_id",
")",
":",
"self",
".",
"_feed_manager",
"=",
"feed_manager",
"self",
".",
"_external_id",
"=",
"external_id",
"self",
".",
"_name",
"=",
"None",
"self",
".",
"_distance",
"=",
"None",
... | [
170,
4
] | [
189,
41
] | python | en | ['en', 'en', 'en'] | True |
NswRuralFireServiceLocationEvent.async_added_to_hass | (self) | Call when entity is added to hass. | Call when entity is added to hass. | async def async_added_to_hass(self):
"""Call when entity is added to hass."""
self._remove_signal_delete = async_dispatcher_connect(
self.hass,
SIGNAL_DELETE_ENTITY.format(self._external_id),
self._delete_callback,
)
self._remove_signal_update = async_... | [
"async",
"def",
"async_added_to_hass",
"(",
"self",
")",
":",
"self",
".",
"_remove_signal_delete",
"=",
"async_dispatcher_connect",
"(",
"self",
".",
"hass",
",",
"SIGNAL_DELETE_ENTITY",
".",
"format",
"(",
"self",
".",
"_external_id",
")",
",",
"self",
".",
... | [
191,
4
] | [
202,
9
] | python | en | ['en', 'en', 'en'] | True |
NswRuralFireServiceLocationEvent.async_will_remove_from_hass | (self) | Call when entity will be removed from hass. | Call when entity will be removed from hass. | async def async_will_remove_from_hass(self) -> None:
"""Call when entity will be removed from hass."""
self._remove_signal_delete()
self._remove_signal_update() | [
"async",
"def",
"async_will_remove_from_hass",
"(",
"self",
")",
"->",
"None",
":",
"self",
".",
"_remove_signal_delete",
"(",
")",
"self",
".",
"_remove_signal_update",
"(",
")"
] | [
204,
4
] | [
207,
36
] | python | en | ['en', 'en', 'en'] | True |
NswRuralFireServiceLocationEvent._delete_callback | (self) | Remove this entity. | Remove this entity. | def _delete_callback(self):
"""Remove this entity."""
self.hass.async_create_task(self.async_remove()) | [
"def",
"_delete_callback",
"(",
"self",
")",
":",
"self",
".",
"hass",
".",
"async_create_task",
"(",
"self",
".",
"async_remove",
"(",
")",
")"
] | [
210,
4
] | [
212,
56
] | python | en | ['en', 'en', 'en'] | True |
NswRuralFireServiceLocationEvent._update_callback | (self) | Call update method. | Call update method. | def _update_callback(self):
"""Call update method."""
self.async_schedule_update_ha_state(True) | [
"def",
"_update_callback",
"(",
"self",
")",
":",
"self",
".",
"async_schedule_update_ha_state",
"(",
"True",
")"
] | [
215,
4
] | [
217,
49
] | python | en | ['en', 'sn', 'en'] | True |
NswRuralFireServiceLocationEvent.should_poll | (self) | No polling needed for NSW Rural Fire Service location events. | No polling needed for NSW Rural Fire Service location events. | def should_poll(self):
"""No polling needed for NSW Rural Fire Service location events."""
return False | [
"def",
"should_poll",
"(",
"self",
")",
":",
"return",
"False"
] | [
220,
4
] | [
222,
20
] | python | en | ['en', 'en', 'en'] | True |
NswRuralFireServiceLocationEvent.async_update | (self) | Update this entity from the data held in the feed manager. | Update this entity from the data held in the feed manager. | async def async_update(self):
"""Update this entity from the data held in the feed manager."""
_LOGGER.debug("Updating %s", self._external_id)
feed_entry = self._feed_manager.get_entry(self._external_id)
if feed_entry:
self._update_from_feed(feed_entry) | [
"async",
"def",
"async_update",
"(",
"self",
")",
":",
"_LOGGER",
".",
"debug",
"(",
"\"Updating %s\"",
",",
"self",
".",
"_external_id",
")",
"feed_entry",
"=",
"self",
".",
"_feed_manager",
".",
"get_entry",
"(",
"self",
".",
"_external_id",
")",
"if",
"... | [
224,
4
] | [
229,
46
] | python | en | ['en', 'en', 'en'] | True |
NswRuralFireServiceLocationEvent._update_from_feed | (self, feed_entry) | Update the internal state from the provided feed entry. | Update the internal state from the provided feed entry. | def _update_from_feed(self, feed_entry):
"""Update the internal state from the provided feed entry."""
self._name = feed_entry.title
self._distance = feed_entry.distance_to_home
self._latitude = feed_entry.coordinates[0]
self._longitude = feed_entry.coordinates[1]
self._a... | [
"def",
"_update_from_feed",
"(",
"self",
",",
"feed_entry",
")",
":",
"self",
".",
"_name",
"=",
"feed_entry",
".",
"title",
"self",
".",
"_distance",
"=",
"feed_entry",
".",
"distance_to_home",
"self",
".",
"_latitude",
"=",
"feed_entry",
".",
"coordinates",
... | [
231,
4
] | [
246,
64
] | python | en | ['en', 'en', 'en'] | True |
NswRuralFireServiceLocationEvent.icon | (self) | Return the icon to use in the frontend. | Return the icon to use in the frontend. | def icon(self):
"""Return the icon to use in the frontend."""
if self._fire:
return "mdi:fire"
return "mdi:alarm-light" | [
"def",
"icon",
"(",
"self",
")",
":",
"if",
"self",
".",
"_fire",
":",
"return",
"\"mdi:fire\"",
"return",
"\"mdi:alarm-light\""
] | [
249,
4
] | [
253,
32
] | python | en | ['en', 'en', 'en'] | True |
NswRuralFireServiceLocationEvent.source | (self) | Return source value of this external event. | Return source value of this external event. | def source(self) -> str:
"""Return source value of this external event."""
return SOURCE | [
"def",
"source",
"(",
"self",
")",
"->",
"str",
":",
"return",
"SOURCE"
] | [
256,
4
] | [
258,
21
] | python | en | ['en', 'en', 'en'] | True |
NswRuralFireServiceLocationEvent.name | (self) | Return the name of the entity. | Return the name of the entity. | def name(self) -> Optional[str]:
"""Return the name of the entity."""
return self._name | [
"def",
"name",
"(",
"self",
")",
"->",
"Optional",
"[",
"str",
"]",
":",
"return",
"self",
".",
"_name"
] | [
261,
4
] | [
263,
25
] | python | en | ['en', 'en', 'en'] | True |
NswRuralFireServiceLocationEvent.distance | (self) | Return distance value of this external event. | Return distance value of this external event. | def distance(self) -> Optional[float]:
"""Return distance value of this external event."""
return self._distance | [
"def",
"distance",
"(",
"self",
")",
"->",
"Optional",
"[",
"float",
"]",
":",
"return",
"self",
".",
"_distance"
] | [
266,
4
] | [
268,
29
] | python | en | ['en', 'en', 'en'] | True |
NswRuralFireServiceLocationEvent.latitude | (self) | Return latitude value of this external event. | Return latitude value of this external event. | def latitude(self) -> Optional[float]:
"""Return latitude value of this external event."""
return self._latitude | [
"def",
"latitude",
"(",
"self",
")",
"->",
"Optional",
"[",
"float",
"]",
":",
"return",
"self",
".",
"_latitude"
] | [
271,
4
] | [
273,
29
] | python | en | ['en', 'la', 'en'] | True |
NswRuralFireServiceLocationEvent.longitude | (self) | Return longitude value of this external event. | Return longitude value of this external event. | def longitude(self) -> Optional[float]:
"""Return longitude value of this external event."""
return self._longitude | [
"def",
"longitude",
"(",
"self",
")",
"->",
"Optional",
"[",
"float",
"]",
":",
"return",
"self",
".",
"_longitude"
] | [
276,
4
] | [
278,
30
] | python | en | ['en', 'en', 'en'] | True |
NswRuralFireServiceLocationEvent.unit_of_measurement | (self) | Return the unit of measurement. | Return the unit of measurement. | def unit_of_measurement(self):
"""Return the unit of measurement."""
return LENGTH_KILOMETERS | [
"def",
"unit_of_measurement",
"(",
"self",
")",
":",
"return",
"LENGTH_KILOMETERS"
] | [
281,
4
] | [
283,
32
] | python | en | ['en', 'la', 'en'] | True |
NswRuralFireServiceLocationEvent.device_state_attributes | (self) | Return the device state attributes. | Return the device state attributes. | def device_state_attributes(self):
"""Return the device state attributes."""
attributes = {}
for key, value in (
(ATTR_EXTERNAL_ID, self._external_id),
(ATTR_CATEGORY, self._category),
(ATTR_LOCATION, self._location),
(ATTR_ATTRIBUTION, self._attri... | [
"def",
"device_state_attributes",
"(",
"self",
")",
":",
"attributes",
"=",
"{",
"}",
"for",
"key",
",",
"value",
"in",
"(",
"(",
"ATTR_EXTERNAL_ID",
",",
"self",
".",
"_external_id",
")",
",",
"(",
"ATTR_CATEGORY",
",",
"self",
".",
"_category",
")",
",... | [
286,
4
] | [
304,
25
] | python | en | ['en', 'en', 'en'] | True |
calls | (hass) | Track calls to a mock service. | Track calls to a mock service. | def calls(hass):
"""Track calls to a mock service."""
return async_mock_service(hass, "test", "automation") | [
"def",
"calls",
"(",
"hass",
")",
":",
"return",
"async_mock_service",
"(",
"hass",
",",
"\"test\"",
",",
"\"automation\"",
")"
] | [
19,
0
] | [
21,
57
] | python | en | ['en', 'en', 'en'] | True |
create_remote | (accessory) | Define characteristics for a button (that is inn a group). | Define characteristics for a button (that is inn a group). | def create_remote(accessory):
"""Define characteristics for a button (that is inn a group)."""
service_label = accessory.add_service(ServicesTypes.SERVICE_LABEL)
char = service_label.add_char(CharacteristicsTypes.SERVICE_LABEL_NAMESPACE)
char.value = 1
for i in range(4):
button = accessory... | [
"def",
"create_remote",
"(",
"accessory",
")",
":",
"service_label",
"=",
"accessory",
".",
"add_service",
"(",
"ServicesTypes",
".",
"SERVICE_LABEL",
")",
"char",
"=",
"service_label",
".",
"add_char",
"(",
"CharacteristicsTypes",
".",
"SERVICE_LABEL_NAMESPACE",
")... | [
24,
0
] | [
46,
56
] | python | en | ['en', 'en', 'en'] | True |
create_button | (accessory) | Define a button (that is not in a group). | Define a button (that is not in a group). | def create_button(accessory):
"""Define a button (that is not in a group)."""
button = accessory.add_service(ServicesTypes.STATELESS_PROGRAMMABLE_SWITCH)
char = button.add_char(CharacteristicsTypes.INPUT_EVENT)
char.value = 0
char.perms = ["pw", "pr", "ev"]
char = button.add_char(Characteristi... | [
"def",
"create_button",
"(",
"accessory",
")",
":",
"button",
"=",
"accessory",
".",
"add_service",
"(",
"ServicesTypes",
".",
"STATELESS_PROGRAMMABLE_SWITCH",
")",
"char",
"=",
"button",
".",
"add_char",
"(",
"CharacteristicsTypes",
".",
"INPUT_EVENT",
")",
"char... | [
49,
0
] | [
61,
56
] | python | en | ['en', 'en', 'en'] | True |
create_doorbell | (accessory) | Define a button (that is not in a group). | Define a button (that is not in a group). | def create_doorbell(accessory):
"""Define a button (that is not in a group)."""
button = accessory.add_service(ServicesTypes.DOORBELL)
char = button.add_char(CharacteristicsTypes.INPUT_EVENT)
char.value = 0
char.perms = ["pw", "pr", "ev"]
char = button.add_char(CharacteristicsTypes.NAME)
c... | [
"def",
"create_doorbell",
"(",
"accessory",
")",
":",
"button",
"=",
"accessory",
".",
"add_service",
"(",
"ServicesTypes",
".",
"DOORBELL",
")",
"char",
"=",
"button",
".",
"add_char",
"(",
"CharacteristicsTypes",
".",
"INPUT_EVENT",
")",
"char",
".",
"value"... | [
64,
0
] | [
76,
56
] | python | en | ['en', 'en', 'en'] | True |
test_enumerate_remote | (hass, utcnow) | Test that remote is correctly enumerated. | Test that remote is correctly enumerated. | async def test_enumerate_remote(hass, utcnow):
"""Test that remote is correctly enumerated."""
await setup_test_component(hass, create_remote)
entity_registry = await hass.helpers.entity_registry.async_get_registry()
entry = entity_registry.async_get("sensor.testdevice_battery")
device_registry = ... | [
"async",
"def",
"test_enumerate_remote",
"(",
"hass",
",",
"utcnow",
")",
":",
"await",
"setup_test_component",
"(",
"hass",
",",
"create_remote",
")",
"entity_registry",
"=",
"await",
"hass",
".",
"helpers",
".",
"entity_registry",
".",
"async_get_registry",
"(",... | [
79,
0
] | [
112,
41
] | python | en | ['en', 'en', 'en'] | True |
test_enumerate_button | (hass, utcnow) | Test that a button is correctly enumerated. | Test that a button is correctly enumerated. | async def test_enumerate_button(hass, utcnow):
"""Test that a button is correctly enumerated."""
await setup_test_component(hass, create_button)
entity_registry = await hass.helpers.entity_registry.async_get_registry()
entry = entity_registry.async_get("sensor.testdevice_battery")
device_registry ... | [
"async",
"def",
"test_enumerate_button",
"(",
"hass",
",",
"utcnow",
")",
":",
"await",
"setup_test_component",
"(",
"hass",
",",
"create_button",
")",
"entity_registry",
"=",
"await",
"hass",
".",
"helpers",
".",
"entity_registry",
".",
"async_get_registry",
"(",... | [
115,
0
] | [
147,
41
] | python | en | ['en', 'en', 'en'] | True |
test_enumerate_doorbell | (hass, utcnow) | Test that a button is correctly enumerated. | Test that a button is correctly enumerated. | async def test_enumerate_doorbell(hass, utcnow):
"""Test that a button is correctly enumerated."""
await setup_test_component(hass, create_doorbell)
entity_registry = await hass.helpers.entity_registry.async_get_registry()
entry = entity_registry.async_get("sensor.testdevice_battery")
device_regis... | [
"async",
"def",
"test_enumerate_doorbell",
"(",
"hass",
",",
"utcnow",
")",
":",
"await",
"setup_test_component",
"(",
"hass",
",",
"create_doorbell",
")",
"entity_registry",
"=",
"await",
"hass",
".",
"helpers",
".",
"entity_registry",
".",
"async_get_registry",
... | [
150,
0
] | [
182,
41
] | python | en | ['en', 'en', 'en'] | True |
test_handle_events | (hass, utcnow, calls) | Test that events are handled. | Test that events are handled. | async def test_handle_events(hass, utcnow, calls):
"""Test that events are handled."""
helper = await setup_test_component(hass, create_remote)
entity_registry = await hass.helpers.entity_registry.async_get_registry()
entry = entity_registry.async_get("sensor.testdevice_battery")
device_registry =... | [
"async",
"def",
"test_handle_events",
"(",
"hass",
",",
"utcnow",
",",
"calls",
")",
":",
"helper",
"=",
"await",
"setup_test_component",
"(",
"hass",
",",
"create_remote",
")",
"entity_registry",
"=",
"await",
"hass",
".",
"helpers",
".",
"entity_registry",
"... | [
185,
0
] | [
297,
26
] | python | en | ['en', 'en', 'en'] | True |
async_setup | (hass: HomeAssistant, config: ConfigType) | Set up the profiler component. | Set up the profiler component. | async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
"""Set up the profiler component."""
return True | [
"async",
"def",
"async_setup",
"(",
"hass",
":",
"HomeAssistant",
",",
"config",
":",
"ConfigType",
")",
"->",
"bool",
":",
"return",
"True"
] | [
46,
0
] | [
48,
15
] | python | en | ['en', 'en', 'en'] | True |
async_setup_entry | (hass: HomeAssistant, entry: ConfigEntry) | Set up Profiler from a config entry. | Set up Profiler from a config entry. | async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry):
"""Set up Profiler from a config entry."""
lock = asyncio.Lock()
domain_data = hass.data[DOMAIN] = {}
async def _async_run_profile(call: ServiceCall):
async with lock:
await _async_generate_profile(hass, call)
... | [
"async",
"def",
"async_setup_entry",
"(",
"hass",
":",
"HomeAssistant",
",",
"entry",
":",
"ConfigEntry",
")",
":",
"lock",
"=",
"asyncio",
".",
"Lock",
"(",
")",
"domain_data",
"=",
"hass",
".",
"data",
"[",
"DOMAIN",
"]",
"=",
"{",
"}",
"async",
"def... | [
51,
0
] | [
151,
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."""
for service in SERVICES:
hass.services.async_remove(domain=DOMAIN, service=service)
if LOG_INTERVAL_SUB in hass.data[DOMAIN]:
hass.data[DOMAIN][LOG_INTERVAL_SUB]()
hass.data.pop(DOMAIN)
... | [
"async",
"def",
"async_unload_entry",
"(",
"hass",
":",
"HomeAssistant",
",",
"entry",
":",
"ConfigEntry",
")",
":",
"for",
"service",
"in",
"SERVICES",
":",
"hass",
".",
"services",
".",
"async_remove",
"(",
"domain",
"=",
"DOMAIN",
",",
"service",
"=",
"... | [
154,
0
] | [
161,
15
] | python | en | ['en', 'es', 'en'] | True |
setup_platform | (hass, config, add_entities, discovery_info=None) | Set up the Linode Node switch. | Set up the Linode Node switch. | def setup_platform(hass, config, add_entities, discovery_info=None):
"""Set up the Linode Node switch."""
linode = hass.data.get(DATA_LINODE)
nodes = config.get(CONF_NODES)
dev = []
for node in nodes:
node_id = linode.get_node_id(node)
if node_id is None:
_LOGGER.error("... | [
"def",
"setup_platform",
"(",
"hass",
",",
"config",
",",
"add_entities",
",",
"discovery_info",
"=",
"None",
")",
":",
"linode",
"=",
"hass",
".",
"data",
".",
"get",
"(",
"DATA_LINODE",
")",
"nodes",
"=",
"config",
".",
"get",
"(",
"CONF_NODES",
")",
... | [
30,
0
] | [
43,
27
] | python | en | ['en', 'en', 'en'] | True |
LinodeSwitch.__init__ | (self, li, node_id) | Initialize a new Linode sensor. | Initialize a new Linode sensor. | def __init__(self, li, node_id):
"""Initialize a new Linode sensor."""
self._linode = li
self._node_id = node_id
self.data = None
self._state = None
self._attrs = {}
self._name = None | [
"def",
"__init__",
"(",
"self",
",",
"li",
",",
"node_id",
")",
":",
"self",
".",
"_linode",
"=",
"li",
"self",
".",
"_node_id",
"=",
"node_id",
"self",
".",
"data",
"=",
"None",
"self",
".",
"_state",
"=",
"None",
"self",
".",
"_attrs",
"=",
"{",
... | [
49,
4
] | [
56,
25
] | python | en | ['en', 'pt', 'en'] | True |
LinodeSwitch.name | (self) | Return the name of the switch. | Return the name of the switch. | def name(self):
"""Return the name of the switch."""
return self._name | [
"def",
"name",
"(",
"self",
")",
":",
"return",
"self",
".",
"_name"
] | [
59,
4
] | [
61,
25
] | python | en | ['en', 'en', 'en'] | True |
LinodeSwitch.is_on | (self) | Return true if switch is on. | Return true if switch is on. | def is_on(self):
"""Return true if switch is on."""
return self._state | [
"def",
"is_on",
"(",
"self",
")",
":",
"return",
"self",
".",
"_state"
] | [
64,
4
] | [
66,
26
] | python | en | ['en', 'fy', 'en'] | True |
LinodeSwitch.device_state_attributes | (self) | Return the state attributes of the Linode Node. | Return the state attributes of the Linode Node. | def device_state_attributes(self):
"""Return the state attributes of the Linode Node."""
return self._attrs | [
"def",
"device_state_attributes",
"(",
"self",
")",
":",
"return",
"self",
".",
"_attrs"
] | [
69,
4
] | [
71,
26
] | python | en | ['en', 'en', 'en'] | True |
LinodeSwitch.turn_on | (self, **kwargs) | Boot-up the Node. | Boot-up the Node. | def turn_on(self, **kwargs):
"""Boot-up the Node."""
if self.data.status != "running":
self.data.boot() | [
"def",
"turn_on",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"self",
".",
"data",
".",
"status",
"!=",
"\"running\"",
":",
"self",
".",
"data",
".",
"boot",
"(",
")"
] | [
73,
4
] | [
76,
28
] | python | en | ['en', 'en', 'en'] | True |
LinodeSwitch.turn_off | (self, **kwargs) | Shutdown the nodes. | Shutdown the nodes. | def turn_off(self, **kwargs):
"""Shutdown the nodes."""
if self.data.status == "running":
self.data.shutdown() | [
"def",
"turn_off",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"self",
".",
"data",
".",
"status",
"==",
"\"running\"",
":",
"self",
".",
"data",
".",
"shutdown",
"(",
")"
] | [
78,
4
] | [
81,
32
] | python | en | ['en', 'bg-Latn', 'en'] | True |
LinodeSwitch.update | (self) | Get the latest data from the device and update the data. | Get the latest data from the device and update the data. | def update(self):
"""Get the latest data from the device and update the data."""
self._linode.update()
if self._linode.data is not None:
for node in self._linode.data:
if node.id == self._node_id:
self.data = node
if self.data is not None:
... | [
"def",
"update",
"(",
"self",
")",
":",
"self",
".",
"_linode",
".",
"update",
"(",
")",
"if",
"self",
".",
"_linode",
".",
"data",
"is",
"not",
"None",
":",
"for",
"node",
"in",
"self",
".",
"_linode",
".",
"data",
":",
"if",
"node",
".",
"id",
... | [
83,
4
] | [
102,
40
] | python | en | ['en', 'en', 'en'] | True |
parse_annotation_mutable_layers | (code, lineno, nas_mode) | Parse the string of mutable layers in annotation.
Return a list of AST Expr nodes
code: annotation string (excluding '@')
nas_mode: the mode of NAS
| Parse the string of mutable layers in annotation.
Return a list of AST Expr nodes
code: annotation string (excluding ' | def parse_annotation_mutable_layers(code, lineno, nas_mode):
"""Parse the string of mutable layers in annotation.
Return a list of AST Expr nodes
code: annotation string (excluding '@')
nas_mode: the mode of NAS
"""
module = ast.parse(code)
assert type(module) is ast.Module, 'internal error ... | [
"def",
"parse_annotation_mutable_layers",
"(",
"code",
",",
"lineno",
",",
"nas_mode",
")",
":",
"module",
"=",
"ast",
".",
"parse",
"(",
"code",
")",
"assert",
"type",
"(",
"module",
")",
"is",
"ast",
".",
"Module",
",",
"'internal error #1'",
"assert",
"... | [
10,
0
] | [
103,
16
] | python | en | ['en', 'en', 'en'] | True |
parse_annotation | (code) | Parse an annotation string.
Return an AST Expr node.
code: annotation string (excluding '@')
| Parse an annotation string.
Return an AST Expr node.
code: annotation string (excluding ' | def parse_annotation(code):
"""Parse an annotation string.
Return an AST Expr node.
code: annotation string (excluding '@')
"""
module = ast.parse(code)
assert type(module) is ast.Module, 'internal error #1'
assert len(module.body) == 1, 'Annotation contains more than one expression'
ass... | [
"def",
"parse_annotation",
"(",
"code",
")",
":",
"module",
"=",
"ast",
".",
"parse",
"(",
"code",
")",
"assert",
"type",
"(",
"module",
")",
"is",
"ast",
".",
"Module",
",",
"'internal error #1'",
"assert",
"len",
"(",
"module",
".",
"body",
")",
"=="... | [
106,
0
] | [
115,
25
] | python | en | ['en', 'en', 'en'] | True |
parse_annotation_function | (code, func_name) | Parse an annotation function.
Return the value of `name` keyword argument and the AST Call node.
func_name: expected function name
| Parse an annotation function.
Return the value of `name` keyword argument and the AST Call node.
func_name: expected function name
| def parse_annotation_function(code, func_name):
"""Parse an annotation function.
Return the value of `name` keyword argument and the AST Call node.
func_name: expected function name
"""
expr = parse_annotation(code)
call = expr.value
assert type(call) is ast.Call, 'Annotation is not a functi... | [
"def",
"parse_annotation_function",
"(",
"code",
",",
"func_name",
")",
":",
"expr",
"=",
"parse_annotation",
"(",
"code",
")",
"call",
"=",
"expr",
".",
"value",
"assert",
"type",
"(",
"call",
")",
"is",
"ast",
".",
"Call",
",",
"'Annotation is not a functi... | [
118,
0
] | [
136,
21
] | python | en | ['en', 'en', 'en'] | True |
parse_nni_variable | (code) | Parse `nni.variable` expression.
Return the name argument and AST node of annotated expression.
code: annotation string
| Parse `nni.variable` expression.
Return the name argument and AST node of annotated expression.
code: annotation string
| def parse_nni_variable(code):
"""Parse `nni.variable` expression.
Return the name argument and AST node of annotated expression.
code: annotation string
"""
name, call = parse_annotation_function(code, 'variable')
assert len(call.args) == 1, 'nni.variable contains more than one arguments'
a... | [
"def",
"parse_nni_variable",
"(",
"code",
")",
":",
"name",
",",
"call",
"=",
"parse_annotation_function",
"(",
"code",
",",
"'variable'",
")",
"assert",
"len",
"(",
"call",
".",
"args",
")",
"==",
"1",
",",
"'nni.variable contains more than one arguments'",
"ar... | [
139,
0
] | [
159,
20
] | python | en | ['en', 'en', 'en'] | True |
parse_nni_function | (code) | Parse `nni.function_choice` expression.
Return the AST node of annotated expression and a list of dumped function call expressions.
code: annotation string
| Parse `nni.function_choice` expression.
Return the AST node of annotated expression and a list of dumped function call expressions.
code: annotation string
| def parse_nni_function(code):
"""Parse `nni.function_choice` expression.
Return the AST node of annotated expression and a list of dumped function call expressions.
code: annotation string
"""
name, call = parse_annotation_function(code, 'function_choice')
funcs = [ast.dump(func, False) for func... | [
"def",
"parse_nni_function",
"(",
"code",
")",
":",
"name",
",",
"call",
"=",
"parse_annotation_function",
"(",
"code",
",",
"'function_choice'",
")",
"funcs",
"=",
"[",
"ast",
".",
"dump",
"(",
"func",
",",
"False",
")",
"for",
"func",
"in",
"call",
"."... | [
162,
0
] | [
174,
22
] | python | en | ['en', 'en', 'en'] | True |
convert_args_to_dict | (call, with_lambda=False) | Convert all args to a dict such that every key and value in the dict is the same as the value of the arg.
Return the AST Call node with only one arg that is the dictionary
| Convert all args to a dict such that every key and value in the dict is the same as the value of the arg.
Return the AST Call node with only one arg that is the dictionary
| def convert_args_to_dict(call, with_lambda=False):
"""Convert all args to a dict such that every key and value in the dict is the same as the value of the arg.
Return the AST Call node with only one arg that is the dictionary
"""
keys, values = list(), list()
for arg in call.args:
if type(ar... | [
"def",
"convert_args_to_dict",
"(",
"call",
",",
"with_lambda",
"=",
"False",
")",
":",
"keys",
",",
"values",
"=",
"list",
"(",
")",
",",
"list",
"(",
")",
"for",
"arg",
"in",
"call",
".",
"args",
":",
"if",
"type",
"(",
"arg",
")",
"in",
"[",
"... | [
177,
0
] | [
195,
15
] | python | en | ['en', 'en', 'en'] | True |
make_lambda | (call) | Wrap an AST Call node to lambda expression node.
call: ast.Call node
| Wrap an AST Call node to lambda expression node.
call: ast.Call node
| def make_lambda(call):
"""Wrap an AST Call node to lambda expression node.
call: ast.Call node
"""
empty_args = ast.arguments(args=[], vararg=None, kwarg=None, defaults=[])
return ast.Lambda(args=empty_args, body=call) | [
"def",
"make_lambda",
"(",
"call",
")",
":",
"empty_args",
"=",
"ast",
".",
"arguments",
"(",
"args",
"=",
"[",
"]",
",",
"vararg",
"=",
"None",
",",
"kwarg",
"=",
"None",
",",
"defaults",
"=",
"[",
"]",
")",
"return",
"ast",
".",
"Lambda",
"(",
... | [
198,
0
] | [
203,
49
] | python | en | ['en', 'lb', 'en'] | True |
test_variable_equal | (node1, node2) | Test whether two variables are the same. | Test whether two variables are the same. | def test_variable_equal(node1, node2):
"""Test whether two variables are the same."""
if type(node1) is not type(node2):
return False
if isinstance(node1, ast.AST):
for k, v in vars(node1).items():
if k in ('lineno', 'col_offset', 'ctx', 'end_lineno', 'end_col_offset'):
... | [
"def",
"test_variable_equal",
"(",
"node1",
",",
"node2",
")",
":",
"if",
"type",
"(",
"node1",
")",
"is",
"not",
"type",
"(",
"node2",
")",
":",
"return",
"False",
"if",
"isinstance",
"(",
"node1",
",",
"ast",
".",
"AST",
")",
":",
"for",
"k",
","... | [
206,
0
] | [
222,
25
] | python | en | ['en', 'en', 'en'] | True |
replace_variable_node | (node, annotation) | Replace a node annotated by `nni.variable`.
node: the AST node to replace
annotation: annotation string
| Replace a node annotated by `nni.variable`.
node: the AST node to replace
annotation: annotation string
| def replace_variable_node(node, annotation):
"""Replace a node annotated by `nni.variable`.
node: the AST node to replace
annotation: annotation string
"""
assert type(node) is ast.Assign, 'nni.variable is not annotating assignment expression'
assert len(node.targets) == 1, 'Annotated assignment... | [
"def",
"replace_variable_node",
"(",
"node",
",",
"annotation",
")",
":",
"assert",
"type",
"(",
"node",
")",
"is",
"ast",
".",
"Assign",
",",
"'nni.variable is not annotating assignment expression'",
"assert",
"len",
"(",
"node",
".",
"targets",
")",
"==",
"1",... | [
225,
0
] | [
235,
15
] | python | en | ['en', 'en', 'en'] | True |
replace_function_node | (node, annotation) | Replace a node annotated by `nni.function_choice`.
node: the AST node to replace
annotation: annotation string
| Replace a node annotated by `nni.function_choice`.
node: the AST node to replace
annotation: annotation string
| def replace_function_node(node, annotation):
"""Replace a node annotated by `nni.function_choice`.
node: the AST node to replace
annotation: annotation string
"""
target, funcs = parse_nni_function(annotation)
FuncReplacer(funcs, target).visit(node)
return node | [
"def",
"replace_function_node",
"(",
"node",
",",
"annotation",
")",
":",
"target",
",",
"funcs",
"=",
"parse_nni_function",
"(",
"annotation",
")",
"FuncReplacer",
"(",
"funcs",
",",
"target",
")",
".",
"visit",
"(",
"node",
")",
"return",
"node"
] | [
238,
0
] | [
245,
15
] | python | en | ['en', 'en', 'en'] | True |
parse | (code, nas_mode=None) | Annotate user code.
Return annotated code (str) if annotation detected; return None if not.
code: original user code (str),
nas_mode: the mode of NAS given that NAS interface is used
| Annotate user code.
Return annotated code (str) if annotation detected; return None if not.
code: original user code (str),
nas_mode: the mode of NAS given that NAS interface is used
| def parse(code, nas_mode=None):
"""Annotate user code.
Return annotated code (str) if annotation detected; return None if not.
code: original user code (str),
nas_mode: the mode of NAS given that NAS interface is used
"""
try:
ast_tree = ast.parse(code)
except Exception:
rais... | [
"def",
"parse",
"(",
"code",
",",
"nas_mode",
"=",
"None",
")",
":",
"try",
":",
"ast_tree",
"=",
"ast",
".",
"parse",
"(",
"code",
")",
"except",
"Exception",
":",
"raise",
"RuntimeError",
"(",
"'Bad Python code'",
")",
"transformer",
"=",
"Transformer",
... | [
336,
0
] | [
368,
36
] | python | en | ['en', 'en', 'en'] | True |
FuncReplacer.__init__ | (self, funcs, target) | Constructor.
funcs: list of dumped function call expressions to replace
target: use this AST node to replace matching expressions
| Constructor.
funcs: list of dumped function call expressions to replace
target: use this AST node to replace matching expressions
| def __init__(self, funcs, target):
"""Constructor.
funcs: list of dumped function call expressions to replace
target: use this AST node to replace matching expressions
"""
self.funcs = set(funcs)
self.target = target | [
"def",
"__init__",
"(",
"self",
",",
"funcs",
",",
"target",
")",
":",
"self",
".",
"funcs",
"=",
"set",
"(",
"funcs",
")",
"self",
".",
"target",
"=",
"target"
] | [
251,
4
] | [
257,
28
] | python | en | ['en', 'en', 'en'] | False |
async_setup_platform | (hass, config, async_add_entities, discovery_info=None) | Set up the Ampio Smog air quality platform. | Set up the Ampio Smog air quality platform. | async def async_setup_platform(hass, config, async_add_entities, discovery_info=None):
"""Set up the Ampio Smog air quality platform."""
name = config.get(CONF_NAME)
station_id = config[CONF_STATION_ID]
session = async_get_clientsession(hass)
api = AmpioSmogMapData(AmpioSmog(station_id, hass.loop,... | [
"async",
"def",
"async_setup_platform",
"(",
"hass",
",",
"config",
",",
"async_add_entities",
",",
"discovery_info",
"=",
"None",
")",
":",
"name",
"=",
"config",
".",
"get",
"(",
"CONF_NAME",
")",
"station_id",
"=",
"config",
"[",
"CONF_STATION_ID",
"]",
"... | [
24,
0
] | [
39,
71
] | python | en | ['en', 'pt', 'en'] | True |
AmpioSmogQuality.__init__ | (self, api, station_id, name) | Initialize the air quality entity. | Initialize the air quality entity. | def __init__(self, api, station_id, name):
"""Initialize the air quality entity."""
self._ampio = api
self._station_id = station_id
self._name = name or api.api.name | [
"def",
"__init__",
"(",
"self",
",",
"api",
",",
"station_id",
",",
"name",
")",
":",
"self",
".",
"_ampio",
"=",
"api",
"self",
".",
"_station_id",
"=",
"station_id",
"self",
".",
"_name",
"=",
"name",
"or",
"api",
".",
"api",
".",
"name"
] | [
45,
4
] | [
49,
41
] | python | en | ['en', 'en', 'en'] | True |
AmpioSmogQuality.name | (self) | Return the name of the air quality entity. | Return the name of the air quality entity. | def name(self):
"""Return the name of the air quality entity."""
return self._name | [
"def",
"name",
"(",
"self",
")",
":",
"return",
"self",
".",
"_name"
] | [
52,
4
] | [
54,
25
] | python | en | ['en', 'en', 'en'] | True |
AmpioSmogQuality.unique_id | (self) | Return unique_name. | Return unique_name. | def unique_id(self):
"""Return unique_name."""
return f"ampio_smog_{self._station_id}" | [
"def",
"unique_id",
"(",
"self",
")",
":",
"return",
"f\"ampio_smog_{self._station_id}\""
] | [
57,
4
] | [
59,
47
] | python | en | ['fr', 'la', 'en'] | False |
AmpioSmogQuality.particulate_matter_2_5 | (self) | Return the particulate matter 2.5 level. | Return the particulate matter 2.5 level. | def particulate_matter_2_5(self):
"""Return the particulate matter 2.5 level."""
return self._ampio.api.pm2_5 | [
"def",
"particulate_matter_2_5",
"(",
"self",
")",
":",
"return",
"self",
".",
"_ampio",
".",
"api",
".",
"pm2_5"
] | [
62,
4
] | [
64,
36
] | python | en | ['en', 'en', 'en'] | True |
AmpioSmogQuality.particulate_matter_10 | (self) | Return the particulate matter 10 level. | Return the particulate matter 10 level. | def particulate_matter_10(self):
"""Return the particulate matter 10 level."""
return self._ampio.api.pm10 | [
"def",
"particulate_matter_10",
"(",
"self",
")",
":",
"return",
"self",
".",
"_ampio",
".",
"api",
".",
"pm10"
] | [
67,
4
] | [
69,
35
] | python | en | ['en', 'en', 'en'] | True |
AmpioSmogQuality.attribution | (self) | Return the attribution. | Return the attribution. | def attribution(self):
"""Return the attribution."""
return ATTRIBUTION | [
"def",
"attribution",
"(",
"self",
")",
":",
"return",
"ATTRIBUTION"
] | [
72,
4
] | [
74,
26
] | python | en | ['en', 'ja', 'en'] | True |
AmpioSmogQuality.async_update | (self) | Get the latest data from the AmpioMap API. | Get the latest data from the AmpioMap API. | async def async_update(self):
"""Get the latest data from the AmpioMap API."""
await self._ampio.async_update() | [
"async",
"def",
"async_update",
"(",
"self",
")",
":",
"await",
"self",
".",
"_ampio",
".",
"async_update",
"(",
")"
] | [
76,
4
] | [
78,
40
] | python | en | ['en', 'en', 'en'] | True |
AmpioSmogMapData.__init__ | (self, api) | Initialize the data object. | Initialize the data object. | def __init__(self, api):
"""Initialize the data object."""
self.api = api | [
"def",
"__init__",
"(",
"self",
",",
"api",
")",
":",
"self",
".",
"api",
"=",
"api"
] | [
84,
4
] | [
86,
22
] | python | en | ['en', 'en', 'en'] | True |
AmpioSmogMapData.async_update | (self) | Get the latest data from AmpioMap. | Get the latest data from AmpioMap. | async def async_update(self):
"""Get the latest data from AmpioMap."""
await self.api.get_data() | [
"async",
"def",
"async_update",
"(",
"self",
")",
":",
"await",
"self",
".",
"api",
".",
"get_data",
"(",
")"
] | [
89,
4
] | [
91,
33
] | python | en | ['en', 'en', 'en'] | True |
async_condition_from_config | (
config: ConfigType, config_validation: bool
) | Evaluate state based on configuration. | Evaluate state based on configuration. | def async_condition_from_config(
config: ConfigType, config_validation: bool
) -> ConditionCheckerType:
"""Evaluate state based on configuration."""
if config_validation:
config = CONDITION_SCHEMA(config)
return toggle_entity.async_condition_from_config(config) | [
"def",
"async_condition_from_config",
"(",
"config",
":",
"ConfigType",
",",
"config_validation",
":",
"bool",
")",
"->",
"ConditionCheckerType",
":",
"if",
"config_validation",
":",
"config",
"=",
"CONDITION_SCHEMA",
"(",
"config",
")",
"return",
"toggle_entity",
"... | [
19,
0
] | [
25,
60
] | python | en | ['en', 'en', 'en'] | True |
async_get_conditions | (
hass: HomeAssistant, device_id: str
) | List device conditions. | List device conditions. | async def async_get_conditions(
hass: HomeAssistant, device_id: str
) -> List[Dict[str, str]]:
"""List device conditions."""
return await toggle_entity.async_get_conditions(hass, device_id, DOMAIN) | [
"async",
"def",
"async_get_conditions",
"(",
"hass",
":",
"HomeAssistant",
",",
"device_id",
":",
"str",
")",
"->",
"List",
"[",
"Dict",
"[",
"str",
",",
"str",
"]",
"]",
":",
"return",
"await",
"toggle_entity",
".",
"async_get_conditions",
"(",
"hass",
",... | [
28,
0
] | [
32,
76
] | python | en | ['fr', 'en', 'en'] | True |
async_get_condition_capabilities | (hass: HomeAssistant, config: dict) | List condition capabilities. | List condition capabilities. | async def async_get_condition_capabilities(hass: HomeAssistant, config: dict) -> dict:
"""List condition capabilities."""
return await toggle_entity.async_get_condition_capabilities(hass, config) | [
"async",
"def",
"async_get_condition_capabilities",
"(",
"hass",
":",
"HomeAssistant",
",",
"config",
":",
"dict",
")",
"->",
"dict",
":",
"return",
"await",
"toggle_entity",
".",
"async_get_condition_capabilities",
"(",
"hass",
",",
"config",
")"
] | [
35,
0
] | [
37,
77
] | python | en | ['ro', 'sr', 'en'] | False |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.