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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
WLEDFlowHandler.async_step_zeroconf_confirm | (
self, user_input: ConfigType = None
) | Handle a flow initiated by zeroconf. | Handle a flow initiated by zeroconf. | async def async_step_zeroconf_confirm(
self, user_input: ConfigType = None
) -> Dict[str, Any]:
"""Handle a flow initiated by zeroconf."""
return await self._handle_config_flow(user_input) | [
"async",
"def",
"async_step_zeroconf_confirm",
"(",
"self",
",",
"user_input",
":",
"ConfigType",
"=",
"None",
")",
"->",
"Dict",
"[",
"str",
",",
"Any",
"]",
":",
"return",
"await",
"self",
".",
"_handle_config_flow",
"(",
"user_input",
")"
] | [
54,
4
] | [
58,
57
] | python | en | ['en', 'en', 'en'] | True |
WLEDFlowHandler._handle_config_flow | (
self, user_input: Optional[ConfigType] = None, prepare: bool = False
) | Config flow handler for WLED. | Config flow handler for WLED. | async def _handle_config_flow(
self, user_input: Optional[ConfigType] = None, prepare: bool = False
) -> Dict[str, Any]:
"""Config flow handler for WLED."""
# pylint: disable=no-member # https://github.com/PyCQA/pylint/issues/3167
source = self.context.get("source")
# Reques... | [
"async",
"def",
"_handle_config_flow",
"(",
"self",
",",
"user_input",
":",
"Optional",
"[",
"ConfigType",
"]",
"=",
"None",
",",
"prepare",
":",
"bool",
"=",
"False",
")",
"->",
"Dict",
"[",
"str",
",",
"Any",
"]",
":",
"# pylint: disable=no-member # https:... | [
60,
4
] | [
104,
9
] | python | da | ['da', 'da', 'en'] | True |
WLEDFlowHandler._show_setup_form | (self, errors: Optional[Dict] = None) | Show the setup form to the user. | Show the setup form to the user. | def _show_setup_form(self, errors: Optional[Dict] = None) -> Dict[str, Any]:
"""Show the setup form to the user."""
return self.async_show_form(
step_id="user",
data_schema=vol.Schema({vol.Required(CONF_HOST): str}),
errors=errors or {},
) | [
"def",
"_show_setup_form",
"(",
"self",
",",
"errors",
":",
"Optional",
"[",
"Dict",
"]",
"=",
"None",
")",
"->",
"Dict",
"[",
"str",
",",
"Any",
"]",
":",
"return",
"self",
".",
"async_show_form",
"(",
"step_id",
"=",
"\"user\"",
",",
"data_schema",
"... | [
106,
4
] | [
112,
9
] | python | en | ['en', 'en', 'en'] | True |
WLEDFlowHandler._show_confirm_dialog | (self, errors: Optional[Dict] = None) | Show the confirm dialog to the user. | Show the confirm dialog to the user. | def _show_confirm_dialog(self, errors: Optional[Dict] = None) -> Dict[str, Any]:
"""Show the confirm dialog to the user."""
# pylint: disable=no-member # https://github.com/PyCQA/pylint/issues/3167
name = self.context.get(CONF_NAME)
return self.async_show_form(
step_id="zeroc... | [
"def",
"_show_confirm_dialog",
"(",
"self",
",",
"errors",
":",
"Optional",
"[",
"Dict",
"]",
"=",
"None",
")",
"->",
"Dict",
"[",
"str",
",",
"Any",
"]",
":",
"# pylint: disable=no-member # https://github.com/PyCQA/pylint/issues/3167",
"name",
"=",
"self",
".",
... | [
114,
4
] | [
122,
9
] | python | en | ['en', 'en', 'en'] | True |
AutoModel.from_config | (cls, config) | r"""
Instantiates one of the base model classes of the library from a configuration.
Note:
Loading a model from its configuration file does **not** load the model weights. It only affects the
model's configuration. Use :meth:`~transformers.AutoModel.from_pretrained` to load the ... | r"""
Instantiates one of the base model classes of the library from a configuration. | def from_config(cls, config):
r"""
Instantiates one of the base model classes of the library from a configuration.
Note:
Loading a model from its configuration file does **not** load the model weights. It only affects the
model's configuration. Use :meth:`~transformers.A... | [
"def",
"from_config",
"(",
"cls",
",",
"config",
")",
":",
"if",
"type",
"(",
"config",
")",
"in",
"MODEL_MAPPING",
".",
"keys",
"(",
")",
":",
"return",
"MODEL_MAPPING",
"[",
"type",
"(",
"config",
")",
"]",
"(",
"config",
")",
"raise",
"ValueError",
... | [
751,
4
] | [
779,
9
] | python | cy | ['en', 'cy', 'hi'] | False |
AutoModel.from_pretrained | (cls, pretrained_model_name_or_path, *model_args, **kwargs) | r"""
Examples::
>>> from transformers import AutoConfig, AutoModel
>>> # Download model and configuration from huggingface.co and cache.
>>> model = AutoModel.from_pretrained('bert-base-uncased')
>>> # Update configuration during loading
>>> model ... | r""" | def from_pretrained(cls, pretrained_model_name_or_path, *model_args, **kwargs):
r"""
Examples::
>>> from transformers import AutoConfig, AutoModel
>>> # Download model and configuration from huggingface.co and cache.
>>> model = AutoModel.from_pretrained('bert-base... | [
"def",
"from_pretrained",
"(",
"cls",
",",
"pretrained_model_name_or_path",
",",
"*",
"model_args",
",",
"*",
"*",
"kwargs",
")",
":",
"config",
"=",
"kwargs",
".",
"pop",
"(",
"\"config\"",
",",
"None",
")",
"if",
"not",
"isinstance",
"(",
"config",
",",
... | [
787,
4
] | [
821,
9
] | python | cy | ['en', 'cy', 'hi'] | False |
AutoModelForPreTraining.from_config | (cls, config) | r"""
Instantiates one of the model classes of the library---with the architecture used for pretraining this
model---from a configuration.
Note:
Loading a model from its configuration file does **not** load the model weights. It only affects the
model's configuration. Use... | r"""
Instantiates one of the model classes of the library---with the architecture used for pretraining this
model---from a configuration. | def from_config(cls, config):
r"""
Instantiates one of the model classes of the library---with the architecture used for pretraining this
model---from a configuration.
Note:
Loading a model from its configuration file does **not** load the model weights. It only affects the
... | [
"def",
"from_config",
"(",
"cls",
",",
"config",
")",
":",
"if",
"type",
"(",
"config",
")",
"in",
"MODEL_FOR_PRETRAINING_MAPPING",
".",
"keys",
"(",
")",
":",
"return",
"MODEL_FOR_PRETRAINING_MAPPING",
"[",
"type",
"(",
"config",
")",
"]",
"(",
"config",
... | [
843,
4
] | [
873,
9
] | python | cy | ['en', 'cy', 'hi'] | False |
AutoModelForPreTraining.from_pretrained | (cls, pretrained_model_name_or_path, *model_args, **kwargs) | r"""
Examples::
>>> from transformers import AutoConfig, AutoModelForPreTraining
>>> # Download model and configuration from huggingface.co and cache.
>>> model = AutoModelForPreTraining.from_pretrained('bert-base-uncased')
>>> # Update configuration during loa... | r"""
Examples:: | def from_pretrained(cls, pretrained_model_name_or_path, *model_args, **kwargs):
r"""
Examples::
>>> from transformers import AutoConfig, AutoModelForPreTraining
>>> # Download model and configuration from huggingface.co and cache.
>>> model = AutoModelForPreTraining... | [
"def",
"from_pretrained",
"(",
"cls",
",",
"pretrained_model_name_or_path",
",",
"*",
"model_args",
",",
"*",
"*",
"kwargs",
")",
":",
"config",
"=",
"kwargs",
".",
"pop",
"(",
"\"config\"",
",",
"None",
")",
"if",
"not",
"isinstance",
"(",
"config",
",",
... | [
882,
4
] | [
915,
9
] | python | cy | ['en', 'cy', 'hi'] | False |
AutoModelWithLMHead.from_config | (cls, config) | r"""
Instantiates one of the model classes of the library---with a language modeling head---from a configuration.
Note:
Loading a model from its configuration file does **not** load the model weights. It only affects the
model's configuration. Use :meth:`~transformers.AutoModelW... | r"""
Instantiates one of the model classes of the library---with a language modeling head---from a configuration. | def from_config(cls, config):
r"""
Instantiates one of the model classes of the library---with a language modeling head---from a configuration.
Note:
Loading a model from its configuration file does **not** load the model weights. It only affects the
model's configuratio... | [
"def",
"from_config",
"(",
"cls",
",",
"config",
")",
":",
"warnings",
".",
"warn",
"(",
"\"The class `AutoModelWithLMHead` is deprecated and will be removed in a future version. Please use \"",
"\"`AutoModelForCausalLM` for causal language models, `AutoModelForMaskedLM` for masked languag... | [
943,
4
] | [
978,
9
] | python | cy | ['en', 'cy', 'hi'] | False |
AutoModelWithLMHead.from_pretrained | (cls, pretrained_model_name_or_path, *model_args, **kwargs) | r"""
Examples::
>>> from transformers import AutoConfig, AutoModelWithLMHead
>>> # Download model and configuration from huggingface.co and cache.
>>> model = AutoModelWithLMHead.from_pretrained('bert-base-uncased')
>>> # Update configuration during loading
... | r"""
Examples:: | def from_pretrained(cls, pretrained_model_name_or_path, *model_args, **kwargs):
r"""
Examples::
>>> from transformers import AutoConfig, AutoModelWithLMHead
>>> # Download model and configuration from huggingface.co and cache.
>>> model = AutoModelWithLMHead.from_pr... | [
"def",
"from_pretrained",
"(",
"cls",
",",
"pretrained_model_name_or_path",
",",
"*",
"model_args",
",",
"*",
"*",
"kwargs",
")",
":",
"warnings",
".",
"warn",
"(",
"\"The class `AutoModelWithLMHead` is deprecated and will be removed in a future version. Please use \"",
"\"`A... | [
987,
4
] | [
1026,
9
] | python | cy | ['en', 'cy', 'hi'] | False |
AutoModelForCausalLM.from_config | (cls, config) | r"""
Instantiates one of the model classes of the library---with a causal language modeling head---from a
configuration.
Note:
Loading a model from its configuration file does **not** load the model weights. It only affects the
model's configuration. Use :meth:`~transfor... | r"""
Instantiates one of the model classes of the library---with a causal language modeling head---from a
configuration. | def from_config(cls, config):
r"""
Instantiates one of the model classes of the library---with a causal language modeling head---from a
configuration.
Note:
Loading a model from its configuration file does **not** load the model weights. It only affects the
model... | [
"def",
"from_config",
"(",
"cls",
",",
"config",
")",
":",
"if",
"type",
"(",
"config",
")",
"in",
"MODEL_FOR_CAUSAL_LM_MAPPING",
".",
"keys",
"(",
")",
":",
"return",
"MODEL_FOR_CAUSAL_LM_MAPPING",
"[",
"type",
"(",
"config",
")",
"]",
"(",
"config",
")",... | [
1047,
4
] | [
1077,
9
] | python | cy | ['en', 'cy', 'hi'] | False |
AutoModelForCausalLM.from_pretrained | (cls, pretrained_model_name_or_path, *model_args, **kwargs) | r"""
Examples::
>>> from transformers import AutoConfig, AutoModelForCausalLM
>>> # Download model and configuration from huggingface.co and cache.
>>> model = AutoModelForCausalLM.from_pretrained('gpt2')
>>> # Update configuration during loading
>>... | r"""
Examples:: | def from_pretrained(cls, pretrained_model_name_or_path, *model_args, **kwargs):
r"""
Examples::
>>> from transformers import AutoConfig, AutoModelForCausalLM
>>> # Download model and configuration from huggingface.co and cache.
>>> model = AutoModelForCausalLM.from_... | [
"def",
"from_pretrained",
"(",
"cls",
",",
"pretrained_model_name_or_path",
",",
"*",
"model_args",
",",
"*",
"*",
"kwargs",
")",
":",
"config",
"=",
"kwargs",
".",
"pop",
"(",
"\"config\"",
",",
"None",
")",
"if",
"not",
"isinstance",
"(",
"config",
",",
... | [
1086,
4
] | [
1119,
9
] | python | cy | ['en', 'cy', 'hi'] | False |
AutoModelForMaskedLM.from_config | (cls, config) | r"""
Instantiates one of the model classes of the library---with a masked language modeling head---from a
configuration.
Note:
Loading a model from its configuration file does **not** load the model weights. It only affects the
model's configuration. Use :meth:`~transfor... | r"""
Instantiates one of the model classes of the library---with a masked language modeling head---from a
configuration. | def from_config(cls, config):
r"""
Instantiates one of the model classes of the library---with a masked language modeling head---from a
configuration.
Note:
Loading a model from its configuration file does **not** load the model weights. It only affects the
model... | [
"def",
"from_config",
"(",
"cls",
",",
"config",
")",
":",
"if",
"type",
"(",
"config",
")",
"in",
"MODEL_FOR_MASKED_LM_MAPPING",
".",
"keys",
"(",
")",
":",
"return",
"MODEL_FOR_MASKED_LM_MAPPING",
"[",
"type",
"(",
"config",
")",
"]",
"(",
"config",
")",... | [
1140,
4
] | [
1170,
9
] | python | cy | ['en', 'cy', 'hi'] | False |
AutoModelForMaskedLM.from_pretrained | (cls, pretrained_model_name_or_path, *model_args, **kwargs) | r"""
Examples::
>>> from transformers import AutoConfig, AutoModelForMaskedLM
>>> # Download model and configuration from huggingface.co and cache.
>>> model = AutoModelForMaskedLM.from_pretrained('bert-base-uncased')
>>> # Update configuration during loading
... | r"""
Examples:: | def from_pretrained(cls, pretrained_model_name_or_path, *model_args, **kwargs):
r"""
Examples::
>>> from transformers import AutoConfig, AutoModelForMaskedLM
>>> # Download model and configuration from huggingface.co and cache.
>>> model = AutoModelForMaskedLM.from_... | [
"def",
"from_pretrained",
"(",
"cls",
",",
"pretrained_model_name_or_path",
",",
"*",
"model_args",
",",
"*",
"*",
"kwargs",
")",
":",
"config",
"=",
"kwargs",
".",
"pop",
"(",
"\"config\"",
",",
"None",
")",
"if",
"not",
"isinstance",
"(",
"config",
",",
... | [
1179,
4
] | [
1212,
9
] | python | cy | ['en', 'cy', 'hi'] | False |
AutoModelForSeq2SeqLM.from_config | (cls, config) | r"""
Instantiates one of the model classes of the library---with a sequence-to-sequence language modeling
head---from a configuration.
Note:
Loading a model from its configuration file does **not** load the model weights. It only affects the
model's configuration. Use :m... | r"""
Instantiates one of the model classes of the library---with a sequence-to-sequence language modeling
head---from a configuration. | def from_config(cls, config):
r"""
Instantiates one of the model classes of the library---with a sequence-to-sequence language modeling
head---from a configuration.
Note:
Loading a model from its configuration file does **not** load the model weights. It only affects the
... | [
"def",
"from_config",
"(",
"cls",
",",
"config",
")",
":",
"if",
"type",
"(",
"config",
")",
"in",
"MODEL_FOR_SEQ_TO_SEQ_CAUSAL_LM_MAPPING",
".",
"keys",
"(",
")",
":",
"return",
"MODEL_FOR_SEQ_TO_SEQ_CAUSAL_LM_MAPPING",
"[",
"type",
"(",
"config",
")",
"]",
"... | [
1234,
4
] | [
1266,
9
] | python | cy | ['en', 'cy', 'hi'] | False |
AutoModelForSeq2SeqLM.from_pretrained | (cls, pretrained_model_name_or_path, *model_args, **kwargs) | r"""
Examples::
>>> from transformers import AutoConfig, AutoModelForSeq2SeqLM
>>> # Download model and configuration from huggingface.co and cache.
>>> model = AutoModelForSeq2SeqLM.from_pretrained('t5-base')
>>> # Update configuration during loading
... | r"""
Examples:: | def from_pretrained(cls, pretrained_model_name_or_path, *model_args, **kwargs):
r"""
Examples::
>>> from transformers import AutoConfig, AutoModelForSeq2SeqLM
>>> # Download model and configuration from huggingface.co and cache.
>>> model = AutoModelForSeq2SeqLM.fro... | [
"def",
"from_pretrained",
"(",
"cls",
",",
"pretrained_model_name_or_path",
",",
"*",
"model_args",
",",
"*",
"*",
"kwargs",
")",
":",
"config",
"=",
"kwargs",
".",
"pop",
"(",
"\"config\"",
",",
"None",
")",
"if",
"not",
"isinstance",
"(",
"config",
",",
... | [
1275,
4
] | [
1310,
9
] | python | cy | ['en', 'cy', 'hi'] | False |
AutoModelForSequenceClassification.from_config | (cls, config) | r"""
Instantiates one of the model classes of the library---with a sequence classification head---from a
configuration.
Note:
Loading a model from its configuration file does **not** load the model weights. It only affects the
model's configuration. Use :meth:`~transform... | r"""
Instantiates one of the model classes of the library---with a sequence classification head---from a
configuration. | def from_config(cls, config):
r"""
Instantiates one of the model classes of the library---with a sequence classification head---from a
configuration.
Note:
Loading a model from its configuration file does **not** load the model weights. It only affects the
model'... | [
"def",
"from_config",
"(",
"cls",
",",
"config",
")",
":",
"if",
"type",
"(",
"config",
")",
"in",
"MODEL_FOR_SEQUENCE_CLASSIFICATION_MAPPING",
".",
"keys",
"(",
")",
":",
"return",
"MODEL_FOR_SEQUENCE_CLASSIFICATION_MAPPING",
"[",
"type",
"(",
"config",
")",
"]... | [
1332,
4
] | [
1364,
9
] | python | cy | ['en', 'cy', 'hi'] | False |
AutoModelForSequenceClassification.from_pretrained | (cls, pretrained_model_name_or_path, *model_args, **kwargs) | r"""
Examples::
>>> from transformers import AutoConfig, AutoModelForSequenceClassification
>>> # Download model and configuration from huggingface.co and cache.
>>> model = AutoModelForSequenceClassification.from_pretrained('bert-base-uncased')
>>> # Update co... | r"""
Examples:: | def from_pretrained(cls, pretrained_model_name_or_path, *model_args, **kwargs):
r"""
Examples::
>>> from transformers import AutoConfig, AutoModelForSequenceClassification
>>> # Download model and configuration from huggingface.co and cache.
>>> model = AutoModelFor... | [
"def",
"from_pretrained",
"(",
"cls",
",",
"pretrained_model_name_or_path",
",",
"*",
"model_args",
",",
"*",
"*",
"kwargs",
")",
":",
"config",
"=",
"kwargs",
".",
"pop",
"(",
"\"config\"",
",",
"None",
")",
"if",
"not",
"isinstance",
"(",
"config",
",",
... | [
1373,
4
] | [
1408,
9
] | python | cy | ['en', 'cy', 'hi'] | False |
AutoModelForQuestionAnswering.from_config | (cls, config) | r"""
Instantiates one of the model classes of the library---with a question answering head---from a configuration.
Note:
Loading a model from its configuration file does **not** load the model weights. It only affects the
model's configuration. Use :meth:`~transformers.AutoModel... | r"""
Instantiates one of the model classes of the library---with a question answering head---from a configuration. | def from_config(cls, config):
r"""
Instantiates one of the model classes of the library---with a question answering head---from a configuration.
Note:
Loading a model from its configuration file does **not** load the model weights. It only affects the
model's configurati... | [
"def",
"from_config",
"(",
"cls",
",",
"config",
")",
":",
"if",
"type",
"(",
"config",
")",
"in",
"MODEL_FOR_QUESTION_ANSWERING_MAPPING",
".",
"keys",
"(",
")",
":",
"return",
"MODEL_FOR_QUESTION_ANSWERING_MAPPING",
"[",
"type",
"(",
"config",
")",
"]",
"(",
... | [
1429,
4
] | [
1461,
9
] | python | cy | ['en', 'cy', 'hi'] | False |
AutoModelForQuestionAnswering.from_pretrained | (cls, pretrained_model_name_or_path, *model_args, **kwargs) | r"""
Examples::
>>> from transformers import AutoConfig, AutoModelForQuestionAnswering
>>> # Download model and configuration from huggingface.co and cache.
>>> model = AutoModelForQuestionAnswering.from_pretrained('bert-base-uncased')
>>> # Update configuratio... | r"""
Examples:: | def from_pretrained(cls, pretrained_model_name_or_path, *model_args, **kwargs):
r"""
Examples::
>>> from transformers import AutoConfig, AutoModelForQuestionAnswering
>>> # Download model and configuration from huggingface.co and cache.
>>> model = AutoModelForQuest... | [
"def",
"from_pretrained",
"(",
"cls",
",",
"pretrained_model_name_or_path",
",",
"*",
"model_args",
",",
"*",
"*",
"kwargs",
")",
":",
"config",
"=",
"kwargs",
".",
"pop",
"(",
"\"config\"",
",",
"None",
")",
"if",
"not",
"isinstance",
"(",
"config",
",",
... | [
1470,
4
] | [
1506,
9
] | python | cy | ['en', 'cy', 'hi'] | False |
AutoModelForTableQuestionAnswering.from_config | (cls, config) | r"""
Instantiates one of the model classes of the library---with a table question answering head---from a
configuration.
Note:
Loading a model from its configuration file does **not** load the model weights. It only affects the
model's configuration. Use :meth:`~transfor... | r"""
Instantiates one of the model classes of the library---with a table question answering head---from a
configuration. | def from_config(cls, config):
r"""
Instantiates one of the model classes of the library---with a table question answering head---from a
configuration.
Note:
Loading a model from its configuration file does **not** load the model weights. It only affects the
model... | [
"def",
"from_config",
"(",
"cls",
",",
"config",
")",
":",
"if",
"type",
"(",
"config",
")",
"in",
"MODEL_FOR_TABLE_QUESTION_ANSWERING_MAPPING",
".",
"keys",
"(",
")",
":",
"return",
"MODEL_FOR_TABLE_QUESTION_ANSWERING_MAPPING",
"[",
"type",
"(",
"config",
")",
... | [
1528,
4
] | [
1561,
9
] | python | cy | ['en', 'cy', 'hi'] | False |
AutoModelForTableQuestionAnswering.from_pretrained | (cls, pretrained_model_name_or_path, *model_args, **kwargs) | r"""
Examples::
>>> from transformers import AutoConfig, AutoModelForTableQuestionAnswering
>>> # Download model and configuration from huggingface.co and cache.
>>> model = AutoModelForTableQuestionAnswering.from_pretrained('google/tapas-base-finetuned-wtq')
>... | r"""
Examples:: | def from_pretrained(cls, pretrained_model_name_or_path, *model_args, **kwargs):
r"""
Examples::
>>> from transformers import AutoConfig, AutoModelForTableQuestionAnswering
>>> # Download model and configuration from huggingface.co and cache.
>>> model = AutoModelFor... | [
"def",
"from_pretrained",
"(",
"cls",
",",
"pretrained_model_name_or_path",
",",
"*",
"model_args",
",",
"*",
"*",
"kwargs",
")",
":",
"config",
"=",
"kwargs",
".",
"pop",
"(",
"\"config\"",
",",
"None",
")",
"if",
"not",
"isinstance",
"(",
"config",
",",
... | [
1570,
4
] | [
1606,
9
] | python | cy | ['en', 'cy', 'hi'] | False |
AutoModelForTokenClassification.from_config | (cls, config) | r"""
Instantiates one of the model classes of the library---with a token classification head---from a configuration.
Note:
Loading a model from its configuration file does **not** load the model weights. It only affects the
model's configuration. Use :meth:`~transformers.AutoMod... | r"""
Instantiates one of the model classes of the library---with a token classification head---from a configuration. | def from_config(cls, config):
r"""
Instantiates one of the model classes of the library---with a token classification head---from a configuration.
Note:
Loading a model from its configuration file does **not** load the model weights. It only affects the
model's configura... | [
"def",
"from_config",
"(",
"cls",
",",
"config",
")",
":",
"if",
"type",
"(",
"config",
")",
"in",
"MODEL_FOR_TOKEN_CLASSIFICATION_MAPPING",
".",
"keys",
"(",
")",
":",
"return",
"MODEL_FOR_TOKEN_CLASSIFICATION_MAPPING",
"[",
"type",
"(",
"config",
")",
"]",
"... | [
1627,
4
] | [
1659,
9
] | python | cy | ['en', 'cy', 'hi'] | False |
AutoModelForTokenClassification.from_pretrained | (cls, pretrained_model_name_or_path, *model_args, **kwargs) | r"""
Examples::
>>> from transformers import AutoConfig, AutoModelForTokenClassification
>>> # Download model and configuration from huggingface.co and cache.
>>> model = AutoModelForTokenClassification.from_pretrained('bert-base-uncased')
>>> # Update configur... | r"""
Examples:: | def from_pretrained(cls, pretrained_model_name_or_path, *model_args, **kwargs):
r"""
Examples::
>>> from transformers import AutoConfig, AutoModelForTokenClassification
>>> # Download model and configuration from huggingface.co and cache.
>>> model = AutoModelForTok... | [
"def",
"from_pretrained",
"(",
"cls",
",",
"pretrained_model_name_or_path",
",",
"*",
"model_args",
",",
"*",
"*",
"kwargs",
")",
":",
"config",
"=",
"kwargs",
".",
"pop",
"(",
"\"config\"",
",",
"None",
")",
"if",
"not",
"isinstance",
"(",
"config",
",",
... | [
1668,
4
] | [
1704,
9
] | python | cy | ['en', 'cy', 'hi'] | False |
AutoModelForMultipleChoice.from_config | (cls, config) | r"""
Instantiates one of the model classes of the library---with a multiple choice classification head---from a
configuration.
Note:
Loading a model from its configuration file does **not** load the model weights. It only affects the
model's configuration. Use :meth:`~tr... | r"""
Instantiates one of the model classes of the library---with a multiple choice classification head---from a
configuration. | def from_config(cls, config):
r"""
Instantiates one of the model classes of the library---with a multiple choice classification head---from a
configuration.
Note:
Loading a model from its configuration file does **not** load the model weights. It only affects the
... | [
"def",
"from_config",
"(",
"cls",
",",
"config",
")",
":",
"if",
"type",
"(",
"config",
")",
"in",
"MODEL_FOR_MULTIPLE_CHOICE_MAPPING",
".",
"keys",
"(",
")",
":",
"return",
"MODEL_FOR_MULTIPLE_CHOICE_MAPPING",
"[",
"type",
"(",
"config",
")",
"]",
"(",
"con... | [
1726,
4
] | [
1759,
9
] | python | cy | ['en', 'cy', 'hi'] | False |
AutoModelForMultipleChoice.from_pretrained | (cls, pretrained_model_name_or_path, *model_args, **kwargs) | r"""
Examples::
>>> from transformers import AutoConfig, AutoModelForMultipleChoice
>>> # Download model and configuration from huggingface.co and cache.
>>> model = AutoModelForMultipleChoice.from_pretrained('bert-base-uncased')
>>> # Update configuration duri... | r"""
Examples:: | def from_pretrained(cls, pretrained_model_name_or_path, *model_args, **kwargs):
r"""
Examples::
>>> from transformers import AutoConfig, AutoModelForMultipleChoice
>>> # Download model and configuration from huggingface.co and cache.
>>> model = AutoModelForMultiple... | [
"def",
"from_pretrained",
"(",
"cls",
",",
"pretrained_model_name_or_path",
",",
"*",
"model_args",
",",
"*",
"*",
"kwargs",
")",
":",
"config",
"=",
"kwargs",
".",
"pop",
"(",
"\"config\"",
",",
"None",
")",
"if",
"not",
"isinstance",
"(",
"config",
",",
... | [
1768,
4
] | [
1804,
9
] | python | cy | ['en', 'cy', 'hi'] | False |
AutoModelForNextSentencePrediction.from_config | (cls, config) | r"""
Instantiates one of the model classes of the library---with a multiple choice classification head---from a
configuration.
Note:
Loading a model from its configuration file does **not** load the model weights. It only affects the
model's configuration. Use :meth:`~tr... | r"""
Instantiates one of the model classes of the library---with a multiple choice classification head---from a
configuration. | def from_config(cls, config):
r"""
Instantiates one of the model classes of the library---with a multiple choice classification head---from a
configuration.
Note:
Loading a model from its configuration file does **not** load the model weights. It only affects the
... | [
"def",
"from_config",
"(",
"cls",
",",
"config",
")",
":",
"if",
"type",
"(",
"config",
")",
"in",
"MODEL_FOR_NEXT_SENTENCE_PREDICTION_MAPPING",
".",
"keys",
"(",
")",
":",
"return",
"MODEL_FOR_NEXT_SENTENCE_PREDICTION_MAPPING",
"[",
"type",
"(",
"config",
")",
... | [
1826,
4
] | [
1859,
9
] | python | cy | ['en', 'cy', 'hi'] | False |
AutoModelForNextSentencePrediction.from_pretrained | (cls, pretrained_model_name_or_path, *model_args, **kwargs) | r"""
Examples::
>>> from transformers import AutoConfig, AutoModelForNextSentencePrediction
>>> # Download model and configuration from huggingface.co and cache.
>>> model = AutoModelForNextSentencePrediction.from_pretrained('bert-base-uncased')
>>> # Update co... | r"""
Examples:: | def from_pretrained(cls, pretrained_model_name_or_path, *model_args, **kwargs):
r"""
Examples::
>>> from transformers import AutoConfig, AutoModelForNextSentencePrediction
>>> # Download model and configuration from huggingface.co and cache.
>>> model = AutoModelFor... | [
"def",
"from_pretrained",
"(",
"cls",
",",
"pretrained_model_name_or_path",
",",
"*",
"model_args",
",",
"*",
"*",
"kwargs",
")",
":",
"config",
"=",
"kwargs",
".",
"pop",
"(",
"\"config\"",
",",
"None",
")",
"if",
"not",
"isinstance",
"(",
"config",
",",
... | [
1868,
4
] | [
1904,
9
] | python | cy | ['en', 'cy', 'hi'] | False |
setup_androidtv | (hass, config) | Generate an ADB key (if needed) and load it. | Generate an ADB key (if needed) and load it. | def setup_androidtv(hass, config):
"""Generate an ADB key (if needed) and load it."""
adbkey = config.get(CONF_ADBKEY, hass.config.path(STORAGE_DIR, "androidtv_adbkey"))
if CONF_ADB_SERVER_IP not in config:
# Use "adb_shell" (Python ADB implementation)
if not os.path.isfile(adbkey):
... | [
"def",
"setup_androidtv",
"(",
"hass",
",",
"config",
")",
":",
"adbkey",
"=",
"config",
".",
"get",
"(",
"CONF_ADBKEY",
",",
"hass",
".",
"config",
".",
"path",
"(",
"STORAGE_DIR",
",",
"\"androidtv_adbkey\"",
")",
")",
"if",
"CONF_ADB_SERVER_IP",
"not",
... | [
168,
0
] | [
186,
34
] | python | en | ['en', 'en', 'en'] | True |
async_setup_platform | (hass, config, async_add_entities, discovery_info=None) | Set up the Android TV / Fire TV platform. | Set up the Android TV / Fire TV platform. | async def async_setup_platform(hass, config, async_add_entities, discovery_info=None):
"""Set up the Android TV / Fire TV platform."""
hass.data.setdefault(ANDROIDTV_DOMAIN, {})
address = f"{config[CONF_HOST]}:{config[CONF_PORT]}"
if address in hass.data[ANDROIDTV_DOMAIN]:
_LOGGER.warning("Pla... | [
"async",
"def",
"async_setup_platform",
"(",
"hass",
",",
"config",
",",
"async_add_entities",
",",
"discovery_info",
"=",
"None",
")",
":",
"hass",
".",
"data",
".",
"setdefault",
"(",
"ANDROIDTV_DOMAIN",
",",
"{",
"}",
")",
"address",
"=",
"f\"{config[CONF_H... | [
189,
0
] | [
342,
5
] | python | en | ['en', 'en', 'en'] | True |
adb_decorator | (override_available=False) | Wrap ADB methods and catch exceptions.
Allows for overriding the available status of the ADB connection via the
`override_available` parameter.
| Wrap ADB methods and catch exceptions. | def adb_decorator(override_available=False):
"""Wrap ADB methods and catch exceptions.
Allows for overriding the available status of the ADB connection via the
`override_available` parameter.
"""
def _adb_decorator(func):
"""Wrap the provided ADB method and catch exceptions."""
@f... | [
"def",
"adb_decorator",
"(",
"override_available",
"=",
"False",
")",
":",
"def",
"_adb_decorator",
"(",
"func",
")",
":",
"\"\"\"Wrap the provided ADB method and catch exceptions.\"\"\"",
"@",
"functools",
".",
"wraps",
"(",
"func",
")",
"async",
"def",
"_adb_excepti... | [
345,
0
] | [
387,
25
] | python | en | ['en', 'en', 'en'] | True |
ADBDevice.__init__ | (
self,
aftv,
name,
apps,
get_sources,
turn_on_command,
turn_off_command,
exclude_unnamed_apps,
screencap,
) | Initialize the Android TV / Fire TV device. | Initialize the Android TV / Fire TV device. | def __init__(
self,
aftv,
name,
apps,
get_sources,
turn_on_command,
turn_off_command,
exclude_unnamed_apps,
screencap,
):
"""Initialize the Android TV / Fire TV device."""
self.aftv = aftv
self._name = name
self.... | [
"def",
"__init__",
"(",
"self",
",",
"aftv",
",",
"name",
",",
"apps",
",",
"get_sources",
",",
"turn_on_command",
",",
"turn_off_command",
",",
"exclude_unnamed_apps",
",",
"screencap",
",",
")",
":",
"self",
".",
"aftv",
"=",
"aftv",
"self",
".",
"_name"... | [
393,
4
] | [
453,
31
] | python | en | ['en', 'en', 'en'] | True |
ADBDevice.app_id | (self) | Return the current app. | Return the current app. | def app_id(self):
"""Return the current app."""
return self._current_app | [
"def",
"app_id",
"(",
"self",
")",
":",
"return",
"self",
".",
"_current_app"
] | [
456,
4
] | [
458,
32
] | python | en | ['en', 'la', 'en'] | True |
ADBDevice.app_name | (self) | Return the friendly name of the current app. | Return the friendly name of the current app. | def app_name(self):
"""Return the friendly name of the current app."""
return self._app_id_to_name.get(self._current_app, self._current_app) | [
"def",
"app_name",
"(",
"self",
")",
":",
"return",
"self",
".",
"_app_id_to_name",
".",
"get",
"(",
"self",
".",
"_current_app",
",",
"self",
".",
"_current_app",
")"
] | [
461,
4
] | [
463,
77
] | python | en | ['en', 'en', 'en'] | True |
ADBDevice.available | (self) | Return whether or not the ADB connection is valid. | Return whether or not the ADB connection is valid. | def available(self):
"""Return whether or not the ADB connection is valid."""
return self._available | [
"def",
"available",
"(",
"self",
")",
":",
"return",
"self",
".",
"_available"
] | [
466,
4
] | [
468,
30
] | python | en | ['en', 'en', 'en'] | True |
ADBDevice.device_state_attributes | (self) | Provide the last ADB command's response and the device's HDMI input as attributes. | Provide the last ADB command's response and the device's HDMI input as attributes. | def device_state_attributes(self):
"""Provide the last ADB command's response and the device's HDMI input as attributes."""
return {
"adb_response": self._adb_response,
"hdmi_input": self._hdmi_input,
} | [
"def",
"device_state_attributes",
"(",
"self",
")",
":",
"return",
"{",
"\"adb_response\"",
":",
"self",
".",
"_adb_response",
",",
"\"hdmi_input\"",
":",
"self",
".",
"_hdmi_input",
",",
"}"
] | [
471,
4
] | [
476,
9
] | python | en | ['en', 'en', 'en'] | True |
ADBDevice.media_image_hash | (self) | Hash value for media image. | Hash value for media image. | def media_image_hash(self):
"""Hash value for media image."""
return f"{datetime.now().timestamp()}" if self._screencap else None | [
"def",
"media_image_hash",
"(",
"self",
")",
":",
"return",
"f\"{datetime.now().timestamp()}\"",
"if",
"self",
".",
"_screencap",
"else",
"None"
] | [
479,
4
] | [
481,
75
] | python | en | ['en', 'en', 'en'] | True |
ADBDevice.name | (self) | Return the device name. | Return the device name. | def name(self):
"""Return the device name."""
return self._name | [
"def",
"name",
"(",
"self",
")",
":",
"return",
"self",
".",
"_name"
] | [
484,
4
] | [
486,
25
] | python | en | ['en', 'en', 'en'] | True |
ADBDevice.source | (self) | Return the current app. | Return the current app. | def source(self):
"""Return the current app."""
return self._app_id_to_name.get(self._current_app, self._current_app) | [
"def",
"source",
"(",
"self",
")",
":",
"return",
"self",
".",
"_app_id_to_name",
".",
"get",
"(",
"self",
".",
"_current_app",
",",
"self",
".",
"_current_app",
")"
] | [
489,
4
] | [
491,
77
] | python | en | ['en', 'la', 'en'] | True |
ADBDevice.source_list | (self) | Return a list of running apps. | Return a list of running apps. | def source_list(self):
"""Return a list of running apps."""
return self._sources | [
"def",
"source_list",
"(",
"self",
")",
":",
"return",
"self",
".",
"_sources"
] | [
494,
4
] | [
496,
28
] | python | en | ['en', 'lb', 'en'] | True |
ADBDevice.state | (self) | Return the state of the player. | Return the state of the player. | def state(self):
"""Return the state of the player."""
return self._state | [
"def",
"state",
"(",
"self",
")",
":",
"return",
"self",
".",
"_state"
] | [
499,
4
] | [
501,
26
] | python | en | ['en', 'en', 'en'] | True |
ADBDevice.unique_id | (self) | Return the device unique id. | Return the device unique id. | def unique_id(self):
"""Return the device unique id."""
return self._unique_id | [
"def",
"unique_id",
"(",
"self",
")",
":",
"return",
"self",
".",
"_unique_id"
] | [
504,
4
] | [
506,
30
] | python | en | ['en', 'it', 'en'] | True |
ADBDevice._adb_screencap | (self) | Take a screen capture from the device. | Take a screen capture from the device. | async def _adb_screencap(self):
"""Take a screen capture from the device."""
return await self.aftv.adb_screencap() | [
"async",
"def",
"_adb_screencap",
"(",
"self",
")",
":",
"return",
"await",
"self",
".",
"aftv",
".",
"adb_screencap",
"(",
")"
] | [
509,
4
] | [
511,
46
] | python | en | ['en', 'en', 'en'] | True |
ADBDevice.async_get_media_image | (self) | Fetch current playing image. | Fetch current playing image. | async def async_get_media_image(self):
"""Fetch current playing image."""
if not self._screencap or self.state in [STATE_OFF, None] or not self.available:
return None, None
media_data = await self._adb_screencap()
if media_data:
return media_data, "image/png"
... | [
"async",
"def",
"async_get_media_image",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"_screencap",
"or",
"self",
".",
"state",
"in",
"[",
"STATE_OFF",
",",
"None",
"]",
"or",
"not",
"self",
".",
"available",
":",
"return",
"None",
",",
"None",
"me... | [
513,
4
] | [
526,
25
] | python | en | ['en', 'en', 'en'] | True |
ADBDevice.async_media_play | (self) | Send play command. | Send play command. | async def async_media_play(self):
"""Send play command."""
await self.aftv.media_play() | [
"async",
"def",
"async_media_play",
"(",
"self",
")",
":",
"await",
"self",
".",
"aftv",
".",
"media_play",
"(",
")"
] | [
529,
4
] | [
531,
36
] | python | en | ['en', 'en', 'en'] | True |
ADBDevice.async_media_pause | (self) | Send pause command. | Send pause command. | async def async_media_pause(self):
"""Send pause command."""
await self.aftv.media_pause() | [
"async",
"def",
"async_media_pause",
"(",
"self",
")",
":",
"await",
"self",
".",
"aftv",
".",
"media_pause",
"(",
")"
] | [
534,
4
] | [
536,
37
] | python | en | ['en', 'en', 'en'] | True |
ADBDevice.async_media_play_pause | (self) | Send play/pause command. | Send play/pause command. | async def async_media_play_pause(self):
"""Send play/pause command."""
await self.aftv.media_play_pause() | [
"async",
"def",
"async_media_play_pause",
"(",
"self",
")",
":",
"await",
"self",
".",
"aftv",
".",
"media_play_pause",
"(",
")"
] | [
539,
4
] | [
541,
42
] | python | en | ['en', 'en', 'en'] | True |
ADBDevice.async_turn_on | (self) | Turn on the device. | Turn on the device. | async def async_turn_on(self):
"""Turn on the device."""
if self.turn_on_command:
await self.aftv.adb_shell(self.turn_on_command)
else:
await self.aftv.turn_on() | [
"async",
"def",
"async_turn_on",
"(",
"self",
")",
":",
"if",
"self",
".",
"turn_on_command",
":",
"await",
"self",
".",
"aftv",
".",
"adb_shell",
"(",
"self",
".",
"turn_on_command",
")",
"else",
":",
"await",
"self",
".",
"aftv",
".",
"turn_on",
"(",
... | [
544,
4
] | [
549,
37
] | python | en | ['en', 'en', 'en'] | True |
ADBDevice.async_turn_off | (self) | Turn off the device. | Turn off the device. | async def async_turn_off(self):
"""Turn off the device."""
if self.turn_off_command:
await self.aftv.adb_shell(self.turn_off_command)
else:
await self.aftv.turn_off() | [
"async",
"def",
"async_turn_off",
"(",
"self",
")",
":",
"if",
"self",
".",
"turn_off_command",
":",
"await",
"self",
".",
"aftv",
".",
"adb_shell",
"(",
"self",
".",
"turn_off_command",
")",
"else",
":",
"await",
"self",
".",
"aftv",
".",
"turn_off",
"(... | [
552,
4
] | [
557,
38
] | python | en | ['en', 'en', 'en'] | True |
ADBDevice.async_media_previous_track | (self) | Send previous track command (results in rewind). | Send previous track command (results in rewind). | async def async_media_previous_track(self):
"""Send previous track command (results in rewind)."""
await self.aftv.media_previous_track() | [
"async",
"def",
"async_media_previous_track",
"(",
"self",
")",
":",
"await",
"self",
".",
"aftv",
".",
"media_previous_track",
"(",
")"
] | [
560,
4
] | [
562,
46
] | python | en | ['en', 'en', 'en'] | True |
ADBDevice.async_media_next_track | (self) | Send next track command (results in fast-forward). | Send next track command (results in fast-forward). | async def async_media_next_track(self):
"""Send next track command (results in fast-forward)."""
await self.aftv.media_next_track() | [
"async",
"def",
"async_media_next_track",
"(",
"self",
")",
":",
"await",
"self",
".",
"aftv",
".",
"media_next_track",
"(",
")"
] | [
565,
4
] | [
567,
42
] | python | en | ['en', 'en', 'en'] | True |
ADBDevice.async_select_source | (self, source) | Select input source.
If the source starts with a '!', then it will close the app instead of
opening it.
| Select input source. | async def async_select_source(self, source):
"""Select input source.
If the source starts with a '!', then it will close the app instead of
opening it.
"""
if isinstance(source, str):
if not source.startswith("!"):
await self.aftv.launch_app(self._app... | [
"async",
"def",
"async_select_source",
"(",
"self",
",",
"source",
")",
":",
"if",
"isinstance",
"(",
"source",
",",
"str",
")",
":",
"if",
"not",
"source",
".",
"startswith",
"(",
"\"!\"",
")",
":",
"await",
"self",
".",
"aftv",
".",
"launch_app",
"("... | [
570,
4
] | [
581,
84
] | python | en | ['fr', 'su', 'en'] | False |
ADBDevice.adb_command | (self, cmd) | Send an ADB command to an Android TV / Fire TV device. | Send an ADB command to an Android TV / Fire TV device. | async def adb_command(self, cmd):
"""Send an ADB command to an Android TV / Fire TV device."""
key = self._keys.get(cmd)
if key:
await self.aftv.adb_shell(f"input keyevent {key}")
return
if cmd == "GET_PROPERTIES":
self._adb_response = str(await self.... | [
"async",
"def",
"adb_command",
"(",
"self",
",",
"cmd",
")",
":",
"key",
"=",
"self",
".",
"_keys",
".",
"get",
"(",
"cmd",
")",
"if",
"key",
":",
"await",
"self",
".",
"aftv",
".",
"adb_shell",
"(",
"f\"input keyevent {key}\"",
")",
"return",
"if",
... | [
584,
4
] | [
605,
33
] | python | en | ['en', 'en', 'en'] | True |
ADBDevice.learn_sendevent | (self) | Translate a key press on a remote to ADB 'sendevent' commands. | Translate a key press on a remote to ADB 'sendevent' commands. | async def learn_sendevent(self):
"""Translate a key press on a remote to ADB 'sendevent' commands."""
output = await self.aftv.learn_sendevent()
if output:
self._adb_response = output
self.async_write_ha_state()
msg = f"Output from service '{SERVICE_LEARN_SEN... | [
"async",
"def",
"learn_sendevent",
"(",
"self",
")",
":",
"output",
"=",
"await",
"self",
".",
"aftv",
".",
"learn_sendevent",
"(",
")",
"if",
"output",
":",
"self",
".",
"_adb_response",
"=",
"output",
"self",
".",
"async_write_ha_state",
"(",
")",
"msg",... | [
608,
4
] | [
620,
35
] | python | en | ['en', 'en', 'en'] | True |
ADBDevice.adb_pull | (self, local_path, device_path) | Download a file from your Android TV / Fire TV device to your Home Assistant instance. | Download a file from your Android TV / Fire TV device to your Home Assistant instance. | async def adb_pull(self, local_path, device_path):
"""Download a file from your Android TV / Fire TV device to your Home Assistant instance."""
await self.aftv.adb_pull(local_path, device_path) | [
"async",
"def",
"adb_pull",
"(",
"self",
",",
"local_path",
",",
"device_path",
")",
":",
"await",
"self",
".",
"aftv",
".",
"adb_pull",
"(",
"local_path",
",",
"device_path",
")"
] | [
623,
4
] | [
625,
57
] | python | en | ['en', 'en', 'en'] | True |
ADBDevice.adb_push | (self, local_path, device_path) | Upload a file from your Home Assistant instance to an Android TV / Fire TV device. | Upload a file from your Home Assistant instance to an Android TV / Fire TV device. | async def adb_push(self, local_path, device_path):
"""Upload a file from your Home Assistant instance to an Android TV / Fire TV device."""
await self.aftv.adb_push(local_path, device_path) | [
"async",
"def",
"adb_push",
"(",
"self",
",",
"local_path",
",",
"device_path",
")",
":",
"await",
"self",
".",
"aftv",
".",
"adb_push",
"(",
"local_path",
",",
"device_path",
")"
] | [
628,
4
] | [
630,
57
] | python | en | ['en', 'en', 'en'] | True |
AndroidTVDevice.__init__ | (
self,
aftv,
name,
apps,
get_sources,
turn_on_command,
turn_off_command,
exclude_unnamed_apps,
screencap,
) | Initialize the Android TV device. | Initialize the Android TV device. | def __init__(
self,
aftv,
name,
apps,
get_sources,
turn_on_command,
turn_off_command,
exclude_unnamed_apps,
screencap,
):
"""Initialize the Android TV device."""
super().__init__(
aftv,
name,
... | [
"def",
"__init__",
"(",
"self",
",",
"aftv",
",",
"name",
",",
"apps",
",",
"get_sources",
",",
"turn_on_command",
",",
"turn_off_command",
",",
"exclude_unnamed_apps",
",",
"screencap",
",",
")",
":",
"super",
"(",
")",
".",
"__init__",
"(",
"aftv",
",",
... | [
636,
4
] | [
660,
33
] | python | en | ['en', 'en', 'en'] | True |
AndroidTVDevice.async_update | (self) | Update the device state and, if necessary, re-connect. | Update the device state and, if necessary, re-connect. | async def async_update(self):
"""Update the device state and, if necessary, re-connect."""
# Check if device is disconnected.
if not self._available:
# Try to connect
self._available = await self.aftv.adb_connect(always_log_errors=False)
# If the ADB connection i... | [
"async",
"def",
"async_update",
"(",
"self",
")",
":",
"# Check if device is disconnected.",
"if",
"not",
"self",
".",
"_available",
":",
"# Try to connect",
"self",
".",
"_available",
"=",
"await",
"self",
".",
"aftv",
".",
"adb_connect",
"(",
"always_log_errors"... | [
663,
4
] | [
698,
32
] | python | en | ['en', 'en', 'en'] | True |
AndroidTVDevice.is_volume_muted | (self) | Boolean if volume is currently muted. | Boolean if volume is currently muted. | def is_volume_muted(self):
"""Boolean if volume is currently muted."""
return self._is_volume_muted | [
"def",
"is_volume_muted",
"(",
"self",
")",
":",
"return",
"self",
".",
"_is_volume_muted"
] | [
701,
4
] | [
703,
36
] | python | en | ['en', 'en', 'en'] | True |
AndroidTVDevice.supported_features | (self) | Flag media player features that are supported. | Flag media player features that are supported. | def supported_features(self):
"""Flag media player features that are supported."""
return SUPPORT_ANDROIDTV | [
"def",
"supported_features",
"(",
"self",
")",
":",
"return",
"SUPPORT_ANDROIDTV"
] | [
706,
4
] | [
708,
32
] | python | en | ['en', 'en', 'en'] | True |
AndroidTVDevice.volume_level | (self) | Return the volume level. | Return the volume level. | def volume_level(self):
"""Return the volume level."""
return self._volume_level | [
"def",
"volume_level",
"(",
"self",
")",
":",
"return",
"self",
".",
"_volume_level"
] | [
711,
4
] | [
713,
33
] | python | en | ['en', 'no', 'en'] | True |
AndroidTVDevice.async_media_stop | (self) | Send stop command. | Send stop command. | async def async_media_stop(self):
"""Send stop command."""
await self.aftv.media_stop() | [
"async",
"def",
"async_media_stop",
"(",
"self",
")",
":",
"await",
"self",
".",
"aftv",
".",
"media_stop",
"(",
")"
] | [
716,
4
] | [
718,
36
] | python | en | ['en', 'en', 'en'] | True |
AndroidTVDevice.async_mute_volume | (self, mute) | Mute the volume. | Mute the volume. | async def async_mute_volume(self, mute):
"""Mute the volume."""
await self.aftv.mute_volume() | [
"async",
"def",
"async_mute_volume",
"(",
"self",
",",
"mute",
")",
":",
"await",
"self",
".",
"aftv",
".",
"mute_volume",
"(",
")"
] | [
721,
4
] | [
723,
37
] | python | en | ['en', 'sn', 'en'] | True |
AndroidTVDevice.async_set_volume_level | (self, volume) | Set the volume level. | Set the volume level. | async def async_set_volume_level(self, volume):
"""Set the volume level."""
await self.aftv.set_volume_level(volume) | [
"async",
"def",
"async_set_volume_level",
"(",
"self",
",",
"volume",
")",
":",
"await",
"self",
".",
"aftv",
".",
"set_volume_level",
"(",
"volume",
")"
] | [
726,
4
] | [
728,
48
] | python | en | ['en', 'sr', 'en'] | True |
AndroidTVDevice.async_volume_down | (self) | Send volume down command. | Send volume down command. | async def async_volume_down(self):
"""Send volume down command."""
self._volume_level = await self.aftv.volume_down(self._volume_level) | [
"async",
"def",
"async_volume_down",
"(",
"self",
")",
":",
"self",
".",
"_volume_level",
"=",
"await",
"self",
".",
"aftv",
".",
"volume_down",
"(",
"self",
".",
"_volume_level",
")"
] | [
731,
4
] | [
733,
76
] | python | en | ['en', 'it', 'en'] | True |
AndroidTVDevice.async_volume_up | (self) | Send volume up command. | Send volume up command. | async def async_volume_up(self):
"""Send volume up command."""
self._volume_level = await self.aftv.volume_up(self._volume_level) | [
"async",
"def",
"async_volume_up",
"(",
"self",
")",
":",
"self",
".",
"_volume_level",
"=",
"await",
"self",
".",
"aftv",
".",
"volume_up",
"(",
"self",
".",
"_volume_level",
")"
] | [
736,
4
] | [
738,
74
] | python | en | ['en', 'en', 'en'] | True |
FireTVDevice.async_update | (self) | Update the device state and, if necessary, re-connect. | Update the device state and, if necessary, re-connect. | async def async_update(self):
"""Update the device state and, if necessary, re-connect."""
# Check if device is disconnected.
if not self._available:
# Try to connect
self._available = await self.aftv.adb_connect(always_log_errors=False)
# If the ADB connection i... | [
"async",
"def",
"async_update",
"(",
"self",
")",
":",
"# Check if device is disconnected.",
"if",
"not",
"self",
".",
"_available",
":",
"# Try to connect",
"self",
".",
"_available",
"=",
"await",
"self",
".",
"aftv",
".",
"adb_connect",
"(",
"always_log_errors"... | [
745,
4
] | [
777,
32
] | python | en | ['en', 'en', 'en'] | True |
FireTVDevice.supported_features | (self) | Flag media player features that are supported. | Flag media player features that are supported. | def supported_features(self):
"""Flag media player features that are supported."""
return SUPPORT_FIRETV | [
"def",
"supported_features",
"(",
"self",
")",
":",
"return",
"SUPPORT_FIRETV"
] | [
780,
4
] | [
782,
29
] | python | en | ['en', 'en', 'en'] | True |
FireTVDevice.async_media_stop | (self) | Send stop (back) command. | Send stop (back) command. | async def async_media_stop(self):
"""Send stop (back) command."""
await self.aftv.back() | [
"async",
"def",
"async_media_stop",
"(",
"self",
")",
":",
"await",
"self",
".",
"aftv",
".",
"back",
"(",
")"
] | [
785,
4
] | [
787,
30
] | python | en | ['en', 'en', 'en'] | True |
setup_platform | (hass, config, add_entities, discovery_info=None) | Set up the Wink lights. | Set up the Wink lights. | def setup_platform(hass, config, add_entities, discovery_info=None):
"""Set up the Wink lights."""
for light in pywink.get_light_bulbs():
_id = light.object_id() + light.name()
if _id not in hass.data[DOMAIN]["unique_ids"]:
add_entities([WinkLight(light, hass)])
for light in pyw... | [
"def",
"setup_platform",
"(",
"hass",
",",
"config",
",",
"add_entities",
",",
"discovery_info",
"=",
"None",
")",
":",
"for",
"light",
"in",
"pywink",
".",
"get_light_bulbs",
"(",
")",
":",
"_id",
"=",
"light",
".",
"object_id",
"(",
")",
"+",
"light",
... | [
20,
0
] | [
30,
50
] | python | en | ['en', 'da', 'en'] | True |
WinkLight.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.hass.data[DOMAIN]["entities"]["light"].append(self) | [
"async",
"def",
"async_added_to_hass",
"(",
"self",
")",
":",
"self",
".",
"hass",
".",
"data",
"[",
"DOMAIN",
"]",
"[",
"\"entities\"",
"]",
"[",
"\"light\"",
"]",
".",
"append",
"(",
"self",
")"
] | [
36,
4
] | [
38,
64
] | python | en | ['en', 'en', 'en'] | True |
WinkLight.is_on | (self) | Return true if light is on. | Return true if light is on. | def is_on(self):
"""Return true if light is on."""
return self.wink.state() | [
"def",
"is_on",
"(",
"self",
")",
":",
"return",
"self",
".",
"wink",
".",
"state",
"(",
")"
] | [
41,
4
] | [
43,
32
] | python | en | ['en', 'et', 'en'] | True |
WinkLight.brightness | (self) | Return the brightness of the light. | Return the brightness of the light. | def brightness(self):
"""Return the brightness of the light."""
if self.wink.brightness() is not None:
return int(self.wink.brightness() * 255)
return None | [
"def",
"brightness",
"(",
"self",
")",
":",
"if",
"self",
".",
"wink",
".",
"brightness",
"(",
")",
"is",
"not",
"None",
":",
"return",
"int",
"(",
"self",
".",
"wink",
".",
"brightness",
"(",
")",
"*",
"255",
")",
"return",
"None"
] | [
46,
4
] | [
50,
19
] | python | en | ['en', 'no', 'en'] | True |
WinkLight.hs_color | (self) | Define current bulb color. | Define current bulb color. | def hs_color(self):
"""Define current bulb color."""
if self.wink.supports_xy_color():
return color_util.color_xy_to_hs(*self.wink.color_xy())
if self.wink.supports_hue_saturation():
hue = self.wink.color_hue()
saturation = self.wink.color_saturation()
... | [
"def",
"hs_color",
"(",
"self",
")",
":",
"if",
"self",
".",
"wink",
".",
"supports_xy_color",
"(",
")",
":",
"return",
"color_util",
".",
"color_xy_to_hs",
"(",
"*",
"self",
".",
"wink",
".",
"color_xy",
"(",
")",
")",
"if",
"self",
".",
"wink",
"."... | [
53,
4
] | [
64,
19
] | python | en | ['ro', 'en', 'en'] | True |
WinkLight.color_temp | (self) | Define current bulb color in degrees Kelvin. | Define current bulb color in degrees Kelvin. | def color_temp(self):
"""Define current bulb color in degrees Kelvin."""
if not self.wink.supports_temperature():
return None
return color_util.color_temperature_kelvin_to_mired(
self.wink.color_temperature_kelvin()
) | [
"def",
"color_temp",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"wink",
".",
"supports_temperature",
"(",
")",
":",
"return",
"None",
"return",
"color_util",
".",
"color_temperature_kelvin_to_mired",
"(",
"self",
".",
"wink",
".",
"color_temperature_kelvin... | [
67,
4
] | [
73,
9
] | python | en | ['ro', 'en', 'en'] | True |
WinkLight.supported_features | (self) | Flag supported features. | Flag supported features. | def supported_features(self):
"""Flag supported features."""
supports = SUPPORT_BRIGHTNESS
if self.wink.supports_temperature():
supports = supports | SUPPORT_COLOR_TEMP
if self.wink.supports_xy_color():
supports = supports | SUPPORT_COLOR
elif self.wink.su... | [
"def",
"supported_features",
"(",
"self",
")",
":",
"supports",
"=",
"SUPPORT_BRIGHTNESS",
"if",
"self",
".",
"wink",
".",
"supports_temperature",
"(",
")",
":",
"supports",
"=",
"supports",
"|",
"SUPPORT_COLOR_TEMP",
"if",
"self",
".",
"wink",
".",
"supports_... | [
76,
4
] | [
85,
23
] | python | en | ['da', 'en', 'en'] | True |
WinkLight.turn_on | (self, **kwargs) | Turn the switch on. | Turn the switch on. | def turn_on(self, **kwargs):
"""Turn the switch on."""
brightness = kwargs.get(ATTR_BRIGHTNESS)
hs_color = kwargs.get(ATTR_HS_COLOR)
color_temp_mired = kwargs.get(ATTR_COLOR_TEMP)
state_kwargs = {}
if hs_color:
if self.wink.supports_xy_color():
... | [
"def",
"turn_on",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"brightness",
"=",
"kwargs",
".",
"get",
"(",
"ATTR_BRIGHTNESS",
")",
"hs_color",
"=",
"kwargs",
".",
"get",
"(",
"ATTR_HS_COLOR",
")",
"color_temp_mired",
"=",
"kwargs",
".",
"get",
"(",
... | [
87,
4
] | [
109,
49
] | python | en | ['en', 'en', 'en'] | True |
WinkLight.turn_off | (self, **kwargs) | Turn the switch off. | Turn the switch off. | def turn_off(self, **kwargs):
"""Turn the switch off."""
self.wink.set_state(False) | [
"def",
"turn_off",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"wink",
".",
"set_state",
"(",
"False",
")"
] | [
111,
4
] | [
113,
34
] | python | en | ['en', 'en', 'en'] | True |
hash_from_url | (url: str) | Hash url to create a unique ID. | Hash url to create a unique ID. | def hash_from_url(url: str):
"""Hash url to create a unique ID."""
return hashlib.sha256(url.encode("utf-8")).hexdigest() | [
"def",
"hash_from_url",
"(",
"url",
":",
"str",
")",
":",
"return",
"hashlib",
".",
"sha256",
"(",
"url",
".",
"encode",
"(",
"\"utf-8\"",
")",
")",
".",
"hexdigest",
"(",
")"
] | [
4,
0
] | [
6,
58
] | python | en | ['es', 'it', 'en'] | False |
clust_name | (hostname,username,password) | Finding cluster name & feeding into the targets.json file for labels of prometheus.
In case no cluster name is found populating 'Orphan VM' value. ReST endpoint used 'pools/default'.
Parameters
----------
hostname : str
The hostname of the Couchbase VM.
username : str
The u... | Finding cluster name & feeding into the targets.json file for labels of prometheus.
In case no cluster name is found populating 'Orphan VM' value. ReST endpoint used 'pools/default'.
Parameters
----------
hostname : str
The hostname of the Couchbase VM.
username : str
The u... | def clust_name(hostname,username,password):
'''Finding cluster name & feeding into the targets.json file for labels of prometheus.
In case no cluster name is found populating 'Orphan VM' value. ReST endpoint used 'pools/default'.
Parameters
----------
hostname : str
The hostname of... | [
"def",
"clust_name",
"(",
"hostname",
",",
"username",
",",
"password",
")",
":",
"port",
"=",
"'8091'",
"URL",
"=",
"'http://'",
"+",
"hostname",
"+",
"':'",
"+",
"port",
"try",
":",
"resp",
"=",
"requests",
".",
"get",
"(",
"URL",
"+",
"'/pools/defau... | [
10,
0
] | [
46,
51
] | python | en | ['en', 'en', 'en'] | True |
get_empty_port | () | Finding and returning an empty port-number for starting couchbase-exporter process.
Each VM for exporting stats by couchbase-exporter requires it's own specific port number.
Returns
-------
port_no : int
The empty port number returned for CB-Exporter to spin its instance.
| Finding and returning an empty port-number for starting couchbase-exporter process.
Each VM for exporting stats by couchbase-exporter requires it's own specific port number. | def get_empty_port():
'''Finding and returning an empty port-number for starting couchbase-exporter process.
Each VM for exporting stats by couchbase-exporter requires it's own specific port number.
Returns
-------
port_no : int
The empty port number returned for CB-Exporter to spin it... | [
"def",
"get_empty_port",
"(",
")",
":",
"# Assumption empty is available in the given VM.",
"port_no",
"=",
"-",
"1",
"mssg_dgst",
"=",
"'-1 Imaginary Port'",
"while",
"(",
"len",
"(",
"mssg_dgst",
")",
"!=",
"0",
")",
":",
"port_no",
"=",
"random",
".",
"randin... | [
49,
0
] | [
69,
18
] | python | en | ['en', 'en', 'en'] | True |
write_util | (hostname,username, password, port_no) | write VM related information into the reference file.
Parameters
----------
hostname : str
The hostname of the Couchbase VM.
username : str
The username of that given Couchbase VM.
password : str
The password of that given Couchbase VM.
port_no : int
The port... | write VM related information into the reference file.
Parameters
----------
hostname : str
The hostname of the Couchbase VM.
username : str
The username of that given Couchbase VM.
password : str
The password of that given Couchbase VM.
port_no : int
The port... | def write_util(hostname,username, password, port_no):
'''write VM related information into the reference file.
Parameters
----------
hostname : str
The hostname of the Couchbase VM.
username : str
The username of that given Couchbase VM.
password : str
The password o... | [
"def",
"write_util",
"(",
"hostname",
",",
"username",
",",
"password",
",",
"port_no",
")",
":",
"with",
"open",
"(",
"\"targets.json\"",
",",
"\"r\"",
")",
"as",
"read_file",
":",
"data",
"=",
"json",
".",
"load",
"(",
"read_file",
")",
"str_val",
"=",... | [
74,
0
] | [
94,
73
] | python | en | ['en', 'en', 'en'] | True |
get_util | (hostname) | return information related to particular hostname passed as string argument. | return information related to particular hostname passed as string argument. | def get_util(hostname):
'''return information related to particular hostname passed as string argument.'''
with open("targets.json", "r") as read_file:
data=json.load(read_file)
if hostname in data:
return data[hostname]
return "Key Not Present. Please Check." | [
"def",
"get_util",
"(",
"hostname",
")",
":",
"with",
"open",
"(",
"\"targets.json\"",
",",
"\"r\"",
")",
"as",
"read_file",
":",
"data",
"=",
"json",
".",
"load",
"(",
"read_file",
")",
"if",
"hostname",
"in",
"data",
":",
"return",
"data",
"[",
"host... | [
97,
0
] | [
104,
43
] | python | en | ['en', 'en', 'en'] | True |
get_view | () | returns all information of reference targets.json file under consideration. | returns all information of reference targets.json file under consideration. | def get_view():
'''returns all information of reference targets.json file under consideration. '''
with open("targets.json", "r") as read_file:
data=json.load(read_file)
return data | [
"def",
"get_view",
"(",
")",
":",
"with",
"open",
"(",
"\"targets.json\"",
",",
"\"r\"",
")",
"as",
"read_file",
":",
"data",
"=",
"json",
".",
"load",
"(",
"read_file",
")",
"return",
"data"
] | [
107,
0
] | [
112,
15
] | python | en | ['en', 'en', 'en'] | True |
del_util | (hostname) | Delete given Key entry from reference targets.json file. | Delete given Key entry from reference targets.json file. | def del_util(hostname):
'''Delete given Key entry from reference targets.json file.'''
with open("targets.json", "r") as read_file:
data=json.load(read_file)
str_val = ""
port_no = "-1"
if hostname in data:
str_val = data.pop(hostname)
val_lst = str_val.split(',')
... | [
"def",
"del_util",
"(",
"hostname",
")",
":",
"with",
"open",
"(",
"\"targets.json\"",
",",
"\"r\"",
")",
"as",
"read_file",
":",
"data",
"=",
"json",
".",
"load",
"(",
"read_file",
")",
"str_val",
"=",
"\"\"",
"port_no",
"=",
"\"-1\"",
"if",
"hostname",... | [
115,
0
] | [
131,
27
] | python | en | ['en', 'en', 'en'] | True |
cbexport_start | (hostname) | Start the couchbase exporter with executing the command. | Start the couchbase exporter with executing the command. | def cbexport_start(hostname):
'''Start the couchbase exporter with executing the command.'''
with open("targets.json", "r") as read_file:
data=json.load(read_file)
if hostname in data:
str_vals=data[hostname]
lst_vals=str_vals.split(",")
eff_command="nohup ./../CBExporte... | [
"def",
"cbexport_start",
"(",
"hostname",
")",
":",
"with",
"open",
"(",
"\"targets.json\"",
",",
"\"r\"",
")",
"as",
"read_file",
":",
"data",
"=",
"json",
".",
"load",
"(",
"read_file",
")",
"if",
"hostname",
"in",
"data",
":",
"str_vals",
"=",
"data",... | [
134,
0
] | [
148,
33
] | python | en | ['en', 'en', 'en'] | True |
cbexport_del | (port_no) | Delete or end the couchbase exporter process. | Delete or end the couchbase exporter process. | def cbexport_del(port_no):
'''Delete or end the couchbase exporter process.'''
# Need to be 'root' to know the process id information.
port_command = 'netstat -nlp | grep ":'+str(port_no)+'"'
p = subprocess.Popen(port_command, stdout=subprocess.PIPE, shell=True)
mssg_dgst = p.communicate()[0]
i... | [
"def",
"cbexport_del",
"(",
"port_no",
")",
":",
"# Need to be 'root' to know the process id information.",
"port_command",
"=",
"'netstat -nlp | grep \":'",
"+",
"str",
"(",
"port_no",
")",
"+",
"'\"'",
"p",
"=",
"subprocess",
".",
"Popen",
"(",
"port_command",
",",
... | [
155,
0
] | [
175,
40
] | python | en | ['en', 'en', 'en'] | True |
write_targets | (port_no,hostname,username,password) | Write into json file of prometheus running server. For dynamic detection by Node Exporter. | Write into json file of prometheus running server. For dynamic detection by Node Exporter. | def write_targets(port_no,hostname,username,password):
'''Write into json file of prometheus running server. For dynamic detection by Node Exporter.'''
targ_str = "localhost:"+str(port_no)
# These two entries can be fetched from global repository
# get this data with another rest query to server
... | [
"def",
"write_targets",
"(",
"port_no",
",",
"hostname",
",",
"username",
",",
"password",
")",
":",
"targ_str",
"=",
"\"localhost:\"",
"+",
"str",
"(",
"port_no",
")",
"# These two entries can be fetched from global repository",
"# get this data with another rest query to ... | [
178,
0
] | [
192,
73
] | python | en | ['en', 'en', 'en'] | True |
del_targets | (port_no) | Delete value from json file of prometheus running server. For dynamic detection by Node Exporter. | Delete value from json file of prometheus running server. For dynamic detection by Node Exporter. | def del_targets(port_no):
'''Delete value from json file of prometheus running server. For dynamic detection by Node Exporter.'''
with open('../prometheus-2.9.2.linux-amd64/targets.json','r') as read_file:
data = json.load(read_file)
i=0
for x in data:
str_ports = ''.join(x['targets... | [
"def",
"del_targets",
"(",
"port_no",
")",
":",
"with",
"open",
"(",
"'../prometheus-2.9.2.linux-amd64/targets.json'",
",",
"'r'",
")",
"as",
"read_file",
":",
"data",
"=",
"json",
".",
"load",
"(",
"read_file",
")",
"i",
"=",
"0",
"for",
"x",
"in",
"data"... | [
195,
0
] | [
214,
73
] | python | en | ['en', 'en', 'en'] | True |
async_set_lights_xy | (hass, lights, x_val, y_val, brightness, transition) | Set color of array of lights. | Set color of array of lights. | async def async_set_lights_xy(hass, lights, x_val, y_val, brightness, transition):
"""Set color of array of lights."""
for light in lights:
if is_on(hass, light):
service_data = {ATTR_ENTITY_ID: light}
if x_val is not None and y_val is not None:
service_data[ATTR_... | [
"async",
"def",
"async_set_lights_xy",
"(",
"hass",
",",
"lights",
",",
"x_val",
",",
"y_val",
",",
"brightness",
",",
"transition",
")",
":",
"for",
"light",
"in",
"lights",
":",
"if",
"is_on",
"(",
"hass",
",",
"light",
")",
":",
"service_data",
"=",
... | [
89,
0
] | [
101,
87
] | python | en | ['en', 'da', 'en'] | True |
async_set_lights_temp | (hass, lights, mired, brightness, transition) | Set color of array of lights. | Set color of array of lights. | async def async_set_lights_temp(hass, lights, mired, brightness, transition):
"""Set color of array of lights."""
for light in lights:
if is_on(hass, light):
service_data = {ATTR_ENTITY_ID: light}
if mired is not None:
service_data[ATTR_COLOR_TEMP] = int(mired)
... | [
"async",
"def",
"async_set_lights_temp",
"(",
"hass",
",",
"lights",
",",
"mired",
",",
"brightness",
",",
"transition",
")",
":",
"for",
"light",
"in",
"lights",
":",
"if",
"is_on",
"(",
"hass",
",",
"light",
")",
":",
"service_data",
"=",
"{",
"ATTR_EN... | [
104,
0
] | [
115,
87
] | python | en | ['en', 'da', 'en'] | True |
async_set_lights_rgb | (hass, lights, rgb, transition) | Set color of array of lights. | Set color of array of lights. | async def async_set_lights_rgb(hass, lights, rgb, transition):
"""Set color of array of lights."""
for light in lights:
if is_on(hass, light):
service_data = {ATTR_ENTITY_ID: light}
if rgb is not None:
service_data[ATTR_RGB_COLOR] = rgb
if transition i... | [
"async",
"def",
"async_set_lights_rgb",
"(",
"hass",
",",
"lights",
",",
"rgb",
",",
"transition",
")",
":",
"for",
"light",
"in",
"lights",
":",
"if",
"is_on",
"(",
"hass",
",",
"light",
")",
":",
"service_data",
"=",
"{",
"ATTR_ENTITY_ID",
":",
"light"... | [
118,
0
] | [
127,
87
] | python | en | ['en', 'da', 'en'] | True |
async_setup_platform | (hass, config, async_add_entities, discovery_info=None) | Set up the Flux switches. | Set up the Flux switches. | async def async_setup_platform(hass, config, async_add_entities, discovery_info=None):
"""Set up the Flux switches."""
name = config.get(CONF_NAME)
lights = config.get(CONF_LIGHTS)
start_time = config.get(CONF_START_TIME)
stop_time = config.get(CONF_STOP_TIME)
start_colortemp = config.get(CONF_S... | [
"async",
"def",
"async_setup_platform",
"(",
"hass",
",",
"config",
",",
"async_add_entities",
",",
"discovery_info",
"=",
"None",
")",
":",
"name",
"=",
"config",
".",
"get",
"(",
"CONF_NAME",
")",
"lights",
"=",
"config",
".",
"get",
"(",
"CONF_LIGHTS",
... | [
130,
0
] | [
166,
68
] | python | en | ['en', 'en', 'en'] | True |
FluxSwitch.__init__ | (
self,
name,
hass,
lights,
start_time,
stop_time,
start_colortemp,
sunset_colortemp,
stop_colortemp,
brightness,
disable_brightness_adjust,
mode,
interval,
transition,
) | Initialize the Flux switch. | Initialize the Flux switch. | def __init__(
self,
name,
hass,
lights,
start_time,
stop_time,
start_colortemp,
sunset_colortemp,
stop_colortemp,
brightness,
disable_brightness_adjust,
mode,
interval,
transition,
):
"""Initializ... | [
"def",
"__init__",
"(",
"self",
",",
"name",
",",
"hass",
",",
"lights",
",",
"start_time",
",",
"stop_time",
",",
"start_colortemp",
",",
"sunset_colortemp",
",",
"stop_colortemp",
",",
"brightness",
",",
"disable_brightness_adjust",
",",
"mode",
",",
"interval... | [
172,
4
] | [
202,
33
] | python | en | ['en', 'en', 'en'] | True |
FluxSwitch.name | (self) | Return the name of the device if any. | Return the name of the device if any. | def name(self):
"""Return the name of the device if any."""
return self._name | [
"def",
"name",
"(",
"self",
")",
":",
"return",
"self",
".",
"_name"
] | [
205,
4
] | [
207,
25
] | python | en | ['en', 'en', 'en'] | True |
FluxSwitch.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.unsub_tracker is not None | [
"def",
"is_on",
"(",
"self",
")",
":",
"return",
"self",
".",
"unsub_tracker",
"is",
"not",
"None"
] | [
210,
4
] | [
212,
45
] | python | en | ['en', 'fy', 'en'] | True |
FluxSwitch.async_added_to_hass | (self) | Call when entity about to be added to hass. | Call when entity about to be added to hass. | async def async_added_to_hass(self):
"""Call when entity about to be added to hass."""
last_state = await self.async_get_last_state()
if last_state and last_state.state == STATE_ON:
await self.async_turn_on() | [
"async",
"def",
"async_added_to_hass",
"(",
"self",
")",
":",
"last_state",
"=",
"await",
"self",
".",
"async_get_last_state",
"(",
")",
"if",
"last_state",
"and",
"last_state",
".",
"state",
"==",
"STATE_ON",
":",
"await",
"self",
".",
"async_turn_on",
"(",
... | [
214,
4
] | [
218,
38
] | python | en | ['en', 'en', 'en'] | True |
FluxSwitch.async_turn_on | (self, **kwargs) | Turn on flux. | Turn on flux. | async def async_turn_on(self, **kwargs):
"""Turn on flux."""
if self.is_on:
return
self.unsub_tracker = event.async_track_time_interval(
self.hass,
self.async_flux_update,
datetime.timedelta(seconds=self._interval),
)
# Make initi... | [
"async",
"def",
"async_turn_on",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"self",
".",
"is_on",
":",
"return",
"self",
".",
"unsub_tracker",
"=",
"event",
".",
"async_track_time_interval",
"(",
"self",
".",
"hass",
",",
"self",
".",
"async_f... | [
220,
4
] | [
234,
35
] | python | en | ['en', 'et', 'en'] | True |
FluxSwitch.async_turn_off | (self, **kwargs) | Turn off flux. | Turn off flux. | async def async_turn_off(self, **kwargs):
"""Turn off flux."""
if self.is_on:
self.unsub_tracker()
self.unsub_tracker = None
self.async_write_ha_state() | [
"async",
"def",
"async_turn_off",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"self",
".",
"is_on",
":",
"self",
".",
"unsub_tracker",
"(",
")",
"self",
".",
"unsub_tracker",
"=",
"None",
"self",
".",
"async_write_ha_state",
"(",
")"
] | [
236,
4
] | [
242,
35
] | python | en | ['en', 'da', 'en'] | True |
FluxSwitch.async_flux_update | (self, utcnow=None) | Update all the lights using flux. | Update all the lights using flux. | async def async_flux_update(self, utcnow=None):
"""Update all the lights using flux."""
if utcnow is None:
utcnow = dt_utcnow()
now = as_local(utcnow)
sunset = get_astral_event_date(self.hass, SUN_EVENT_SUNSET, now.date())
start_time = self.find_start_time(now)
... | [
"async",
"def",
"async_flux_update",
"(",
"self",
",",
"utcnow",
"=",
"None",
")",
":",
"if",
"utcnow",
"is",
"None",
":",
"utcnow",
"=",
"dt_utcnow",
"(",
")",
"now",
"=",
"as_local",
"(",
"utcnow",
")",
"sunset",
"=",
"get_astral_event_date",
"(",
"sel... | [
244,
4
] | [
341,
13
] | python | en | ['en', 'en', 'en'] | True |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.