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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
format_command_args | (args) |
Format command arguments for display.
|
Format command arguments for display.
| def format_command_args(args):
# type: (Union[List[str], CommandArgs]) -> str
"""
Format command arguments for display.
"""
# For HiddenText arguments, display the redacted form by calling str().
# Also, we don't apply str() to arguments that aren't HiddenText since
# this can trigger a Unic... | [
"def",
"format_command_args",
"(",
"args",
")",
":",
"# type: (Union[List[str], CommandArgs]) -> str",
"# For HiddenText arguments, display the redacted form by calling str().",
"# Also, we don't apply str() to arguments that aren't HiddenText since",
"# this can trigger a UnicodeDecodeError in Py... | [
44,
0
] | [
57,
5
] | python | en | ['en', 'error', 'th'] | False |
reveal_command_args | (args) |
Return the arguments in their raw, unredacted form.
|
Return the arguments in their raw, unredacted form.
| def reveal_command_args(args):
# type: (Union[List[str], CommandArgs]) -> List[str]
"""
Return the arguments in their raw, unredacted form.
"""
return [
arg.secret if isinstance(arg, HiddenText) else arg for arg in args
] | [
"def",
"reveal_command_args",
"(",
"args",
")",
":",
"# type: (Union[List[str], CommandArgs]) -> List[str]",
"return",
"[",
"arg",
".",
"secret",
"if",
"isinstance",
"(",
"arg",
",",
"HiddenText",
")",
"else",
"arg",
"for",
"arg",
"in",
"args",
"]"
] | [
60,
0
] | [
67,
5
] | python | en | ['en', 'error', 'th'] | False |
make_subprocess_output_error | (
cmd_args, # type: Union[List[str], CommandArgs]
cwd, # type: Optional[str]
lines, # type: List[Text]
exit_status, # type: int
) |
Create and return the error message to use to log a subprocess error
with command output.
:param lines: A list of lines, each ending with a newline.
|
Create and return the error message to use to log a subprocess error
with command output. | def make_subprocess_output_error(
cmd_args, # type: Union[List[str], CommandArgs]
cwd, # type: Optional[str]
lines, # type: List[Text]
exit_status, # type: int
):
# type: (...) -> Text
"""
Create and return the error message to use to log a subprocess error
with comm... | [
"def",
"make_subprocess_output_error",
"(",
"cmd_args",
",",
"# type: Union[List[str], CommandArgs]",
"cwd",
",",
"# type: Optional[str]",
"lines",
",",
"# type: List[Text]",
"exit_status",
",",
"# type: int",
")",
":",
"# type: (...) -> Text",
"command",
"=",
"format_command... | [
70,
0
] | [
109,
14
] | python | en | ['en', 'error', 'th'] | False |
call_subprocess | (
cmd, # type: Union[List[str], CommandArgs]
show_stdout=False, # type: bool
cwd=None, # type: Optional[str]
on_returncode='raise', # type: str
extra_ok_returncodes=None, # type: Optional[Iterable[int]]
command_desc=None, # type: Optional[str]
extra_environ=None, # type: Optional[Mapp... |
Args:
show_stdout: if true, use INFO to log the subprocess's stderr and
stdout streams. Otherwise, use DEBUG. Defaults to False.
extra_ok_returncodes: an iterable of integer return codes that are
acceptable, in addition to 0. Defaults to None, which means [].
unset_environ: an i... |
Args:
show_stdout: if true, use INFO to log the subprocess's stderr and
stdout streams. Otherwise, use DEBUG. Defaults to False.
extra_ok_returncodes: an iterable of integer return codes that are
acceptable, in addition to 0. Defaults to None, which means [].
unset_environ: an i... | def call_subprocess(
cmd, # type: Union[List[str], CommandArgs]
show_stdout=False, # type: bool
cwd=None, # type: Optional[str]
on_returncode='raise', # type: str
extra_ok_returncodes=None, # type: Optional[Iterable[int]]
command_desc=None, # type: Optional[str]
extra_environ=None, # ... | [
"def",
"call_subprocess",
"(",
"cmd",
",",
"# type: Union[List[str], CommandArgs]",
"show_stdout",
"=",
"False",
",",
"# type: bool",
"cwd",
"=",
"None",
",",
"# type: Optional[str]",
"on_returncode",
"=",
"'raise'",
",",
"# type: str",
"extra_ok_returncodes",
"=",
"Non... | [
112,
0
] | [
254,
30
] | python | en | ['en', 'error', 'th'] | False |
runner_with_spinner_message | (message) | Provide a subprocess_runner that shows a spinner message.
Intended for use with for pep517's Pep517HookCaller. Thus, the runner has
an API that matches what's expected by Pep517HookCaller.subprocess_runner.
| Provide a subprocess_runner that shows a spinner message. | def runner_with_spinner_message(message):
# type: (str) -> Callable[..., None]
"""Provide a subprocess_runner that shows a spinner message.
Intended for use with for pep517's Pep517HookCaller. Thus, the runner has
an API that matches what's expected by Pep517HookCaller.subprocess_runner.
"""
d... | [
"def",
"runner_with_spinner_message",
"(",
"message",
")",
":",
"# type: (str) -> Callable[..., None]",
"def",
"runner",
"(",
"cmd",
",",
"# type: List[str]",
"cwd",
"=",
"None",
",",
"# type: Optional[str]",
"extra_environ",
"=",
"None",
"# type: Optional[Mapping[str, Any]... | [
257,
0
] | [
279,
17
] | python | en | ['en', 'en', 'en'] | True |
_const_compare_digest_backport | (a, b) |
Compare two digests of equal length in constant time.
The digests must be of type str/bytes.
Returns True if the digests match, and False otherwise.
|
Compare two digests of equal length in constant time. | def _const_compare_digest_backport(a, b):
"""
Compare two digests of equal length in constant time.
The digests must be of type str/bytes.
Returns True if the digests match, and False otherwise.
"""
result = abs(len(a) - len(b))
for l, r in zip(bytearray(a), bytearray(b)):
result |=... | [
"def",
"_const_compare_digest_backport",
"(",
"a",
",",
"b",
")",
":",
"result",
"=",
"abs",
"(",
"len",
"(",
"a",
")",
"-",
"len",
"(",
"b",
")",
")",
"for",
"l",
",",
"r",
"in",
"zip",
"(",
"bytearray",
"(",
"a",
")",
",",
"bytearray",
"(",
"... | [
23,
0
] | [
33,
22
] | python | en | ['en', 'error', 'th'] | False |
assert_fingerprint | (cert, fingerprint) |
Checks if given fingerprint matches the supplied certificate.
:param cert:
Certificate as bytes object.
:param fingerprint:
Fingerprint as string of hexdigits, can be interspersed by colons.
|
Checks if given fingerprint matches the supplied certificate. | def assert_fingerprint(cert, fingerprint):
"""
Checks if given fingerprint matches the supplied certificate.
:param cert:
Certificate as bytes object.
:param fingerprint:
Fingerprint as string of hexdigits, can be interspersed by colons.
"""
fingerprint = fingerprint.replace(":... | [
"def",
"assert_fingerprint",
"(",
"cert",
",",
"fingerprint",
")",
":",
"fingerprint",
"=",
"fingerprint",
".",
"replace",
"(",
"\":\"",
",",
"\"\"",
")",
".",
"lower",
"(",
")",
"digest_length",
"=",
"len",
"(",
"fingerprint",
")",
"hashfunc",
"=",
"HASHF... | [
154,
0
] | [
180,
9
] | python | en | ['en', 'error', 'th'] | False |
resolve_cert_reqs | (candidate) |
Resolves the argument to a numeric constant, which can be passed to
the wrap_socket function/method from the ssl module.
Defaults to :data:`ssl.CERT_REQUIRED`.
If given a string it is assumed to be the name of the constant in the
:mod:`ssl` module or its abbreviation.
(So you can specify `REQUI... |
Resolves the argument to a numeric constant, which can be passed to
the wrap_socket function/method from the ssl module.
Defaults to :data:`ssl.CERT_REQUIRED`.
If given a string it is assumed to be the name of the constant in the
:mod:`ssl` module or its abbreviation.
(So you can specify `REQUI... | def resolve_cert_reqs(candidate):
"""
Resolves the argument to a numeric constant, which can be passed to
the wrap_socket function/method from the ssl module.
Defaults to :data:`ssl.CERT_REQUIRED`.
If given a string it is assumed to be the name of the constant in the
:mod:`ssl` module or its abb... | [
"def",
"resolve_cert_reqs",
"(",
"candidate",
")",
":",
"if",
"candidate",
"is",
"None",
":",
"return",
"CERT_REQUIRED",
"if",
"isinstance",
"(",
"candidate",
",",
"str",
")",
":",
"res",
"=",
"getattr",
"(",
"ssl",
",",
"candidate",
",",
"None",
")",
"i... | [
183,
0
] | [
203,
20
] | python | en | ['en', 'error', 'th'] | False |
resolve_ssl_version | (candidate) |
like resolve_cert_reqs
|
like resolve_cert_reqs
| def resolve_ssl_version(candidate):
"""
like resolve_cert_reqs
"""
if candidate is None:
return PROTOCOL_TLS
if isinstance(candidate, str):
res = getattr(ssl, candidate, None)
if res is None:
res = getattr(ssl, "PROTOCOL_" + candidate)
return res
ret... | [
"def",
"resolve_ssl_version",
"(",
"candidate",
")",
":",
"if",
"candidate",
"is",
"None",
":",
"return",
"PROTOCOL_TLS",
"if",
"isinstance",
"(",
"candidate",
",",
"str",
")",
":",
"res",
"=",
"getattr",
"(",
"ssl",
",",
"candidate",
",",
"None",
")",
"... | [
206,
0
] | [
219,
20
] | python | en | ['en', 'error', 'th'] | False |
create_urllib3_context | (
ssl_version=None, cert_reqs=None, options=None, ciphers=None
) | All arguments have the same meaning as ``ssl_wrap_socket``.
By default, this function does a lot of the same work that
``ssl.create_default_context`` does on Python 3.4+. It:
- Disables SSLv2, SSLv3, and compression
- Sets a restricted set of server ciphers
If you wish to enable SSLv3, you can do... | All arguments have the same meaning as ``ssl_wrap_socket``. | def create_urllib3_context(
ssl_version=None, cert_reqs=None, options=None, ciphers=None
):
"""All arguments have the same meaning as ``ssl_wrap_socket``.
By default, this function does a lot of the same work that
``ssl.create_default_context`` does on Python 3.4+. It:
- Disables SSLv2, SSLv3, and... | [
"def",
"create_urllib3_context",
"(",
"ssl_version",
"=",
"None",
",",
"cert_reqs",
"=",
"None",
",",
"options",
"=",
"None",
",",
"ciphers",
"=",
"None",
")",
":",
"context",
"=",
"SSLContext",
"(",
"ssl_version",
"or",
"PROTOCOL_TLS",
")",
"context",
".",
... | [
222,
0
] | [
295,
18
] | python | en | ['en', 'en', 'en'] | True |
ssl_wrap_socket | (
sock,
keyfile=None,
certfile=None,
cert_reqs=None,
ca_certs=None,
server_hostname=None,
ssl_version=None,
ciphers=None,
ssl_context=None,
ca_cert_dir=None,
key_password=None,
ca_cert_data=None,
) |
All arguments except for server_hostname, ssl_context, and ca_cert_dir have
the same meaning as they do when using :func:`ssl.wrap_socket`.
:param server_hostname:
When SNI is supported, the expected hostname of the certificate
:param ssl_context:
A pre-made :class:`SSLContext` object.... |
All arguments except for server_hostname, ssl_context, and ca_cert_dir have
the same meaning as they do when using :func:`ssl.wrap_socket`. | def ssl_wrap_socket(
sock,
keyfile=None,
certfile=None,
cert_reqs=None,
ca_certs=None,
server_hostname=None,
ssl_version=None,
ciphers=None,
ssl_context=None,
ca_cert_dir=None,
key_password=None,
ca_cert_data=None,
):
"""
All arguments except for server_hostname, ... | [
"def",
"ssl_wrap_socket",
"(",
"sock",
",",
"keyfile",
"=",
"None",
",",
"certfile",
"=",
"None",
",",
"cert_reqs",
"=",
"None",
",",
"ca_certs",
"=",
"None",
",",
"server_hostname",
"=",
"None",
",",
"ssl_version",
"=",
"None",
",",
"ciphers",
"=",
"Non... | [
298,
0
] | [
389,
36
] | python | en | ['en', 'error', 'th'] | False |
is_ipaddress | (hostname) | Detects whether the hostname given is an IPv4 or IPv6 address.
Also detects IPv6 addresses with Zone IDs.
:param str hostname: Hostname to examine.
:return: True if the hostname is an IP address, False otherwise.
| Detects whether the hostname given is an IPv4 or IPv6 address.
Also detects IPv6 addresses with Zone IDs. | def is_ipaddress(hostname):
"""Detects whether the hostname given is an IPv4 or IPv6 address.
Also detects IPv6 addresses with Zone IDs.
:param str hostname: Hostname to examine.
:return: True if the hostname is an IP address, False otherwise.
"""
if not six.PY2 and isinstance(hostname, bytes):... | [
"def",
"is_ipaddress",
"(",
"hostname",
")",
":",
"if",
"not",
"six",
".",
"PY2",
"and",
"isinstance",
"(",
"hostname",
",",
"bytes",
")",
":",
"# IDN A-label bytes are ASCII compatible.",
"hostname",
"=",
"hostname",
".",
"decode",
"(",
"\"ascii\"",
")",
"ret... | [
392,
0
] | [
402,
83
] | python | en | ['en', 'en', 'en'] | True |
_is_key_file_encrypted | (key_file) | Detects if a key file is encrypted or not. | Detects if a key file is encrypted or not. | def _is_key_file_encrypted(key_file):
"""Detects if a key file is encrypted or not."""
with open(key_file, "r") as f:
for line in f:
# Look for Proc-Type: 4,ENCRYPTED
if "ENCRYPTED" in line:
return True
return False | [
"def",
"_is_key_file_encrypted",
"(",
"key_file",
")",
":",
"with",
"open",
"(",
"key_file",
",",
"\"r\"",
")",
"as",
"f",
":",
"for",
"line",
"in",
"f",
":",
"# Look for Proc-Type: 4,ENCRYPTED",
"if",
"\"ENCRYPTED\"",
"in",
"line",
":",
"return",
"True",
"r... | [
405,
0
] | [
413,
16
] | python | en | ['en', 'en', 'en'] | True |
test_form | (hass) | Test we get the form. | Test we get the form. | async def test_form(hass):
"""Test we get the form."""
await setup.async_setup_component(hass, "persistent_notification", {})
result = await hass.config_entries.flow.async_init(
DOMAIN, context={"source": config_entries.SOURCE_USER}
)
assert result["type"] == "form"
assert result["errors... | [
"async",
"def",
"test_form",
"(",
"hass",
")",
":",
"await",
"setup",
".",
"async_setup_component",
"(",
"hass",
",",
"\"persistent_notification\"",
",",
"{",
"}",
")",
"result",
"=",
"await",
"hass",
".",
"config_entries",
".",
"flow",
".",
"async_init",
"(... | [
16,
0
] | [
40,
48
] | python | en | ['en', 'en', 'en'] | True |
mock_controller | () | Mock a successful _host_in_configuration_exists. | Mock a successful _host_in_configuration_exists. | def mock_controller():
"""Mock a successful _host_in_configuration_exists."""
with patch(
"homeassistant.components.solarlog.config_flow.SolarLogConfigFlow._test_connection",
return_value=True,
):
yield | [
"def",
"mock_controller",
"(",
")",
":",
"with",
"patch",
"(",
"\"homeassistant.components.solarlog.config_flow.SolarLogConfigFlow._test_connection\"",
",",
"return_value",
"=",
"True",
",",
")",
":",
"yield"
] | [
44,
0
] | [
50,
13
] | python | en | ['en', 'en', 'en'] | True |
init_config_flow | (hass) | Init a configuration flow. | Init a configuration flow. | def init_config_flow(hass):
"""Init a configuration flow."""
flow = config_flow.SolarLogConfigFlow()
flow.hass = hass
return flow | [
"def",
"init_config_flow",
"(",
"hass",
")",
":",
"flow",
"=",
"config_flow",
".",
"SolarLogConfigFlow",
"(",
")",
"flow",
".",
"hass",
"=",
"hass",
"return",
"flow"
] | [
53,
0
] | [
57,
15
] | python | en | ['es', 'fr', 'en'] | False |
test_user | (hass, test_connect) | Test user config. | Test user config. | async def test_user(hass, test_connect):
"""Test user config."""
flow = init_config_flow(hass)
result = await flow.async_step_user()
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
assert result["step_id"] == "user"
# tets with all provided
result = await flow.async_step_user({CO... | [
"async",
"def",
"test_user",
"(",
"hass",
",",
"test_connect",
")",
":",
"flow",
"=",
"init_config_flow",
"(",
"hass",
")",
"result",
"=",
"await",
"flow",
".",
"async_step_user",
"(",
")",
"assert",
"result",
"[",
"\"type\"",
"]",
"==",
"data_entry_flow",
... | [
60,
0
] | [
72,
44
] | python | en | ['en', 'da', 'en'] | True |
test_import | (hass, test_connect) | Test import step. | Test import step. | async def test_import(hass, test_connect):
"""Test import step."""
flow = init_config_flow(hass)
# import with only host
result = await flow.async_step_import({CONF_HOST: HOST})
assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
assert result["title"] == "solarlog"
assert res... | [
"async",
"def",
"test_import",
"(",
"hass",
",",
"test_connect",
")",
":",
"flow",
"=",
"init_config_flow",
"(",
"hass",
")",
"# import with only host",
"result",
"=",
"await",
"flow",
".",
"async_step_import",
"(",
"{",
"CONF_HOST",
":",
"HOST",
"}",
")",
"... | [
75,
0
] | [
95,
44
] | python | de | ['de', 'sd', 'en'] | False |
test_abort_if_already_setup | (hass, test_connect) | Test we abort if the device is already setup. | Test we abort if the device is already setup. | async def test_abort_if_already_setup(hass, test_connect):
"""Test we abort if the device is already setup."""
flow = init_config_flow(hass)
MockConfigEntry(
domain="solarlog", data={CONF_NAME: NAME, CONF_HOST: HOST}
).add_to_hass(hass)
# Should fail, same HOST different NAME (default)
... | [
"async",
"def",
"test_abort_if_already_setup",
"(",
"hass",
",",
"test_connect",
")",
":",
"flow",
"=",
"init_config_flow",
"(",
"hass",
")",
"MockConfigEntry",
"(",
"domain",
"=",
"\"solarlog\"",
",",
"data",
"=",
"{",
"CONF_NAME",
":",
"NAME",
",",
"CONF_HOS... | [
98,
0
] | [
131,
56
] | python | en | ['en', 'en', 'en'] | True |
OuterEnumInteger.__init__ | (self, local_vars_configuration=None) | OuterEnumInteger - a model defined in OpenAPI | OuterEnumInteger - a model defined in OpenAPI | def __init__(self, local_vars_configuration=None): # noqa: E501
"""OuterEnumInteger - a model defined in OpenAPI""" # noqa: E501
if local_vars_configuration is None:
local_vars_configuration = Configuration.get_default_copy()
self.local_vars_configuration = local_vars_configuration... | [
"def",
"__init__",
"(",
"self",
",",
"local_vars_configuration",
"=",
"None",
")",
":",
"# noqa: E501",
"# noqa: E501",
"if",
"local_vars_configuration",
"is",
"None",
":",
"local_vars_configuration",
"=",
"Configuration",
".",
"get_default_copy",
"(",
")",
"self",
... | [
49,
4
] | [
54,
33
] | python | en | ['en', 'en', 'en'] | True |
OuterEnumInteger.to_dict | (self, serialize=False) | Returns the model properties as a dict | Returns the model properties as a dict | def to_dict(self, serialize=False):
"""Returns the model properties as a dict"""
result = {}
def convert(x):
if hasattr(x, "to_dict"):
args = inspect.getargspec(x.to_dict).args
if len(args) == 1:
return x.to_dict()
... | [
"def",
"to_dict",
"(",
"self",
",",
"serialize",
"=",
"False",
")",
":",
"result",
"=",
"{",
"}",
"def",
"convert",
"(",
"x",
")",
":",
"if",
"hasattr",
"(",
"x",
",",
"\"to_dict\"",
")",
":",
"args",
"=",
"inspect",
".",
"getargspec",
"(",
"x",
... | [
56,
4
] | [
86,
21
] | python | en | ['en', 'en', 'en'] | True |
OuterEnumInteger.to_str | (self) | Returns the string representation of the model | Returns the string representation of the model | def to_str(self):
"""Returns the string representation of the model"""
return pprint.pformat(self.to_dict()) | [
"def",
"to_str",
"(",
"self",
")",
":",
"return",
"pprint",
".",
"pformat",
"(",
"self",
".",
"to_dict",
"(",
")",
")"
] | [
88,
4
] | [
90,
45
] | python | en | ['en', 'en', 'en'] | True |
OuterEnumInteger.__repr__ | (self) | For `print` and `pprint` | For `print` and `pprint` | def __repr__(self):
"""For `print` and `pprint`"""
return self.to_str() | [
"def",
"__repr__",
"(",
"self",
")",
":",
"return",
"self",
".",
"to_str",
"(",
")"
] | [
92,
4
] | [
94,
28
] | python | en | ['en', 'en', 'en'] | True |
OuterEnumInteger.__eq__ | (self, other) | Returns true if both objects are equal | Returns true if both objects are equal | def __eq__(self, other):
"""Returns true if both objects are equal"""
if not isinstance(other, OuterEnumInteger):
return False
return self.to_dict() == other.to_dict() | [
"def",
"__eq__",
"(",
"self",
",",
"other",
")",
":",
"if",
"not",
"isinstance",
"(",
"other",
",",
"OuterEnumInteger",
")",
":",
"return",
"False",
"return",
"self",
".",
"to_dict",
"(",
")",
"==",
"other",
".",
"to_dict",
"(",
")"
] | [
96,
4
] | [
101,
48
] | python | en | ['en', 'en', 'en'] | True |
OuterEnumInteger.__ne__ | (self, other) | Returns true if both objects are not equal | Returns true if both objects are not equal | def __ne__(self, other):
"""Returns true if both objects are not equal"""
if not isinstance(other, OuterEnumInteger):
return True
return self.to_dict() != other.to_dict() | [
"def",
"__ne__",
"(",
"self",
",",
"other",
")",
":",
"if",
"not",
"isinstance",
"(",
"other",
",",
"OuterEnumInteger",
")",
":",
"return",
"True",
"return",
"self",
".",
"to_dict",
"(",
")",
"!=",
"other",
".",
"to_dict",
"(",
")"
] | [
103,
4
] | [
108,
48
] | python | en | ['en', 'en', 'en'] | True |
Tag.openapi_types | () |
This must be a method because a model may have properties that are
of type self, this must run after the class is loaded
Returns
openapi_types (dict): The key is attribute name
and the value is attribute type.
|
This must be a method because a model may have properties that are
of type self, this must run after the class is loaded | def openapi_types():
"""
This must be a method because a model may have properties that are
of type self, this must run after the class is loaded
Returns
openapi_types (dict): The key is attribute name
and the value is attribute type.
"""
retu... | [
"def",
"openapi_types",
"(",
")",
":",
"return",
"{",
"'id'",
":",
"(",
"int",
",",
")",
",",
"# noqa: E501",
"'name'",
":",
"(",
"str",
",",
")",
",",
"# noqa: E501",
"'full_name'",
":",
"(",
"str",
",",
")",
",",
"# noqa: E501",
"}"
] | [
64,
4
] | [
77,
9
] | python | en | ['en', 'error', 'th'] | False |
Tag.__init__ | (self, *args, **kwargs) | Tag - a model defined in OpenAPI
Keyword Args:
_check_type (bool): if True, values for parameters in openapi_types
will be type checked and a TypeError will be
raised if the wrong type is input.
Defaults... | Tag - a model defined in OpenAPI | def __init__(self, *args, **kwargs): # noqa: E501
"""Tag - a model defined in OpenAPI
Keyword Args:
_check_type (bool): if True, values for parameters in openapi_types
will be type checked and a TypeError will be
raised if the... | [
"def",
"__init__",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"# noqa: E501",
"_check_type",
"=",
"kwargs",
".",
"pop",
"(",
"'_check_type'",
",",
"True",
")",
"_spec_property_naming",
"=",
"kwargs",
".",
"pop",
"(",
"'_spec_property... | [
102,
4
] | [
171,
46
] | python | en | ['en', 'en', 'en'] | True |
setup_platform | (hass, config, add_entities, discovery_info=None) | Iterate through all MAX! Devices and add thermostats. | Iterate through all MAX! Devices and add thermostats. | def setup_platform(hass, config, add_entities, discovery_info=None):
"""Iterate through all MAX! Devices and add thermostats."""
devices = []
for handler in hass.data[DATA_KEY].values():
for device in handler.cube.devices:
if device.is_thermostat() or device.is_wallthermostat():
... | [
"def",
"setup_platform",
"(",
"hass",
",",
"config",
",",
"add_entities",
",",
"discovery_info",
"=",
"None",
")",
":",
"devices",
"=",
"[",
"]",
"for",
"handler",
"in",
"hass",
".",
"data",
"[",
"DATA_KEY",
"]",
".",
"values",
"(",
")",
":",
"for",
... | [
52,
0
] | [
61,
29
] | python | en | ['en', 'en', 'en'] | True |
MaxCubeClimate.__init__ | (self, handler, device) | Initialize MAX! Cube ClimateEntity. | Initialize MAX! Cube ClimateEntity. | def __init__(self, handler, device):
"""Initialize MAX! Cube ClimateEntity."""
room = handler.cube.room_by_id(device.room_id)
self._name = f"{room.name} {device.name}"
self._cubehandle = handler
self._device = device | [
"def",
"__init__",
"(",
"self",
",",
"handler",
",",
"device",
")",
":",
"room",
"=",
"handler",
".",
"cube",
".",
"room_by_id",
"(",
"device",
".",
"room_id",
")",
"self",
".",
"_name",
"=",
"f\"{room.name} {device.name}\"",
"self",
".",
"_cubehandle",
"=... | [
67,
4
] | [
72,
29
] | python | en | ['en', 'en', 'it'] | True |
MaxCubeClimate.supported_features | (self) | Return the list of supported features. | Return the list of supported features. | def supported_features(self):
"""Return the list of supported features."""
return SUPPORT_FLAGS | [
"def",
"supported_features",
"(",
"self",
")",
":",
"return",
"SUPPORT_FLAGS"
] | [
75,
4
] | [
77,
28
] | python | en | ['en', 'en', 'en'] | True |
MaxCubeClimate.should_poll | (self) | Return the polling state. | Return the polling state. | def should_poll(self):
"""Return the polling state."""
return True | [
"def",
"should_poll",
"(",
"self",
")",
":",
"return",
"True"
] | [
80,
4
] | [
82,
19
] | python | en | ['en', 'en', 'en'] | True |
MaxCubeClimate.name | (self) | Return the name of the climate device. | Return the name of the climate device. | def name(self):
"""Return the name of the climate device."""
return self._name | [
"def",
"name",
"(",
"self",
")",
":",
"return",
"self",
".",
"_name"
] | [
85,
4
] | [
87,
25
] | python | en | ['en', 'en', 'en'] | True |
MaxCubeClimate.unique_id | (self) | Return a unique ID. | Return a unique ID. | def unique_id(self):
"""Return a unique ID."""
return self._device.serial | [
"def",
"unique_id",
"(",
"self",
")",
":",
"return",
"self",
".",
"_device",
".",
"serial"
] | [
90,
4
] | [
92,
34
] | python | ca | ['fr', 'ca', 'en'] | False |
MaxCubeClimate.min_temp | (self) | Return the minimum temperature. | Return the minimum temperature. | def min_temp(self):
"""Return the minimum temperature."""
temp = self._device.min_temperature or MIN_TEMPERATURE
# OFF_TEMPERATURE (always off) a is valid temperature to maxcube but not to Home Assistant.
# We use HVAC_MODE_OFF instead to represent a turned off thermostat.
return... | [
"def",
"min_temp",
"(",
"self",
")",
":",
"temp",
"=",
"self",
".",
"_device",
".",
"min_temperature",
"or",
"MIN_TEMPERATURE",
"# OFF_TEMPERATURE (always off) a is valid temperature to maxcube but not to Home Assistant.",
"# We use HVAC_MODE_OFF instead to represent a turned off the... | [
95,
4
] | [
100,
41
] | python | en | ['en', 'la', 'en'] | True |
MaxCubeClimate.max_temp | (self) | Return the maximum temperature. | Return the maximum temperature. | def max_temp(self):
"""Return the maximum temperature."""
return self._device.max_temperature or MAX_TEMPERATURE | [
"def",
"max_temp",
"(",
"self",
")",
":",
"return",
"self",
".",
"_device",
".",
"max_temperature",
"or",
"MAX_TEMPERATURE"
] | [
103,
4
] | [
105,
62
] | python | en | ['en', 'la', 'en'] | True |
MaxCubeClimate.temperature_unit | (self) | Return the unit of measurement. | Return the unit of measurement. | def temperature_unit(self):
"""Return the unit of measurement."""
return TEMP_CELSIUS | [
"def",
"temperature_unit",
"(",
"self",
")",
":",
"return",
"TEMP_CELSIUS"
] | [
108,
4
] | [
110,
27
] | python | en | ['en', 'la', 'en'] | True |
MaxCubeClimate.current_temperature | (self) | Return the current temperature. | Return the current temperature. | def current_temperature(self):
"""Return the current temperature."""
return self._device.actual_temperature | [
"def",
"current_temperature",
"(",
"self",
")",
":",
"return",
"self",
".",
"_device",
".",
"actual_temperature"
] | [
113,
4
] | [
115,
46
] | python | en | ['en', 'la', 'en'] | True |
MaxCubeClimate.hvac_mode | (self) | Return current operation mode. | Return current operation mode. | def hvac_mode(self):
"""Return current operation mode."""
mode = self._device.mode
if mode in (MAX_DEVICE_MODE_AUTOMATIC, MAX_DEVICE_MODE_BOOST):
return HVAC_MODE_AUTO
if (
mode == MAX_DEVICE_MODE_MANUAL
and self._device.target_temperature == OFF_TEMPE... | [
"def",
"hvac_mode",
"(",
"self",
")",
":",
"mode",
"=",
"self",
".",
"_device",
".",
"mode",
"if",
"mode",
"in",
"(",
"MAX_DEVICE_MODE_AUTOMATIC",
",",
"MAX_DEVICE_MODE_BOOST",
")",
":",
"return",
"HVAC_MODE_AUTO",
"if",
"(",
"mode",
"==",
"MAX_DEVICE_MODE_MAN... | [
118,
4
] | [
129,
29
] | python | da | ['nl', 'da', 'en'] | False |
MaxCubeClimate.hvac_modes | (self) | Return the list of available operation modes. | Return the list of available operation modes. | def hvac_modes(self):
"""Return the list of available operation modes."""
return [HVAC_MODE_OFF, HVAC_MODE_AUTO, HVAC_MODE_HEAT] | [
"def",
"hvac_modes",
"(",
"self",
")",
":",
"return",
"[",
"HVAC_MODE_OFF",
",",
"HVAC_MODE_AUTO",
",",
"HVAC_MODE_HEAT",
"]"
] | [
132,
4
] | [
134,
62
] | python | en | ['en', 'en', 'en'] | True |
MaxCubeClimate.set_hvac_mode | (self, hvac_mode: str) | Set new target hvac mode. | Set new target hvac mode. | def set_hvac_mode(self, hvac_mode: str):
"""Set new target hvac mode."""
if hvac_mode == HVAC_MODE_OFF:
self._set_target(MAX_DEVICE_MODE_MANUAL, OFF_TEMPERATURE)
elif hvac_mode == HVAC_MODE_HEAT:
temp = max(self._device.target_temperature, self.min_temp)
self.... | [
"def",
"set_hvac_mode",
"(",
"self",
",",
"hvac_mode",
":",
"str",
")",
":",
"if",
"hvac_mode",
"==",
"HVAC_MODE_OFF",
":",
"self",
".",
"_set_target",
"(",
"MAX_DEVICE_MODE_MANUAL",
",",
"OFF_TEMPERATURE",
")",
"elif",
"hvac_mode",
"==",
"HVAC_MODE_HEAT",
":",
... | [
136,
4
] | [
146,
66
] | python | da | ['da', 'su', 'en'] | False |
MaxCubeClimate._set_target | (self, mode: int | None, temp: float | None) |
Set the mode and/or temperature of the thermostat.
@param mode: this is the mode to change to.
@param temp: the temperature to target.
Both parameters are optional. When mode is undefined, it keeps
the previous mode. When temp is undefined, it fetches the
temperature f... |
Set the mode and/or temperature of the thermostat. | def _set_target(self, mode: int | None, temp: float | None) -> None:
"""
Set the mode and/or temperature of the thermostat.
@param mode: this is the mode to change to.
@param temp: the temperature to target.
Both parameters are optional. When mode is undefined, it keeps
... | [
"def",
"_set_target",
"(",
"self",
",",
"mode",
":",
"int",
"|",
"None",
",",
"temp",
":",
"float",
"|",
"None",
")",
"->",
"None",
":",
"with",
"self",
".",
"_cubehandle",
".",
"mutex",
":",
"try",
":",
"self",
".",
"_cubehandle",
".",
"cube",
"."... | [
148,
4
] | [
165,
57
] | python | en | ['en', 'error', 'th'] | False |
MaxCubeClimate.hvac_action | (self) | Return the current running hvac operation if supported. | Return the current running hvac operation if supported. | def hvac_action(self):
"""Return the current running hvac operation if supported."""
valve = 0
if self._device.is_thermostat():
valve = self._device.valve_position
elif self._device.is_wallthermostat():
cube = self._cubehandle.cube
room = cube.room_by... | [
"def",
"hvac_action",
"(",
"self",
")",
":",
"valve",
"=",
"0",
"if",
"self",
".",
"_device",
".",
"is_thermostat",
"(",
")",
":",
"valve",
"=",
"self",
".",
"_device",
".",
"valve_position",
"elif",
"self",
".",
"_device",
".",
"is_wallthermostat",
"(",... | [
168,
4
] | [
190,
9
] | python | en | ['en', 'en', 'en'] | True |
MaxCubeClimate.target_temperature | (self) | Return the temperature we try to reach. | Return the temperature we try to reach. | def target_temperature(self):
"""Return the temperature we try to reach."""
temp = self._device.target_temperature
if temp is None or temp < self.min_temp or temp > self.max_temp:
return None
return temp | [
"def",
"target_temperature",
"(",
"self",
")",
":",
"temp",
"=",
"self",
".",
"_device",
".",
"target_temperature",
"if",
"temp",
"is",
"None",
"or",
"temp",
"<",
"self",
".",
"min_temp",
"or",
"temp",
">",
"self",
".",
"max_temp",
":",
"return",
"None",... | [
193,
4
] | [
198,
19
] | python | en | ['en', 'en', 'en'] | True |
MaxCubeClimate.set_temperature | (self, **kwargs) | Set new target temperatures. | Set new target temperatures. | def set_temperature(self, **kwargs):
"""Set new target temperatures."""
temp = kwargs.get(ATTR_TEMPERATURE)
if temp is None:
raise ValueError(
f"No {ATTR_TEMPERATURE} parameter passed to set_temperature method."
)
self._set_target(None, temp) | [
"def",
"set_temperature",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"temp",
"=",
"kwargs",
".",
"get",
"(",
"ATTR_TEMPERATURE",
")",
"if",
"temp",
"is",
"None",
":",
"raise",
"ValueError",
"(",
"f\"No {ATTR_TEMPERATURE} parameter passed to set_temperature me... | [
200,
4
] | [
207,
36
] | python | en | ['en', 'ca', 'en'] | True |
MaxCubeClimate.preset_mode | (self) | Return the current preset mode. | Return the current preset mode. | def preset_mode(self):
"""Return the current preset mode."""
if self._device.mode == MAX_DEVICE_MODE_MANUAL:
if self._device.target_temperature == self._device.comfort_temperature:
return PRESET_COMFORT
if self._device.target_temperature == self._device.eco_temper... | [
"def",
"preset_mode",
"(",
"self",
")",
":",
"if",
"self",
".",
"_device",
".",
"mode",
"==",
"MAX_DEVICE_MODE_MANUAL",
":",
"if",
"self",
".",
"_device",
".",
"target_temperature",
"==",
"self",
".",
"_device",
".",
"comfort_temperature",
":",
"return",
"PR... | [
210,
4
] | [
223,
26
] | python | en | ['en', 'en', 'en'] | True |
MaxCubeClimate.preset_modes | (self) | Return available preset modes. | Return available preset modes. | def preset_modes(self):
"""Return available preset modes."""
return [
PRESET_NONE,
PRESET_BOOST,
PRESET_COMFORT,
PRESET_ECO,
PRESET_AWAY,
PRESET_ON,
] | [
"def",
"preset_modes",
"(",
"self",
")",
":",
"return",
"[",
"PRESET_NONE",
",",
"PRESET_BOOST",
",",
"PRESET_COMFORT",
",",
"PRESET_ECO",
",",
"PRESET_AWAY",
",",
"PRESET_ON",
",",
"]"
] | [
226,
4
] | [
235,
9
] | python | en | ['fr', 'en', 'en'] | True |
MaxCubeClimate.set_preset_mode | (self, preset_mode) | Set new operation mode. | Set new operation mode. | def set_preset_mode(self, preset_mode):
"""Set new operation mode."""
if preset_mode == PRESET_COMFORT:
self._set_target(MAX_DEVICE_MODE_MANUAL, self._device.comfort_temperature)
elif preset_mode == PRESET_ECO:
self._set_target(MAX_DEVICE_MODE_MANUAL, self._device.eco_tem... | [
"def",
"set_preset_mode",
"(",
"self",
",",
"preset_mode",
")",
":",
"if",
"preset_mode",
"==",
"PRESET_COMFORT",
":",
"self",
".",
"_set_target",
"(",
"MAX_DEVICE_MODE_MANUAL",
",",
"self",
".",
"_device",
".",
"comfort_temperature",
")",
"elif",
"preset_mode",
... | [
237,
4
] | [
252,
70
] | python | en | ['en', 'ny', 'en'] | True |
MaxCubeClimate.extra_state_attributes | (self) | Return the optional state attributes. | Return the optional state attributes. | def extra_state_attributes(self):
"""Return the optional state attributes."""
if not self._device.is_thermostat():
return {}
return {ATTR_VALVE_POSITION: self._device.valve_position} | [
"def",
"extra_state_attributes",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"_device",
".",
"is_thermostat",
"(",
")",
":",
"return",
"{",
"}",
"return",
"{",
"ATTR_VALVE_POSITION",
":",
"self",
".",
"_device",
".",
"valve_position",
"}"
] | [
255,
4
] | [
259,
65
] | python | en | ['en', 'en', 'en'] | True |
MaxCubeClimate.update | (self) | Get latest data from MAX! Cube. | Get latest data from MAX! Cube. | def update(self):
"""Get latest data from MAX! Cube."""
self._cubehandle.update() | [
"def",
"update",
"(",
"self",
")",
":",
"self",
".",
"_cubehandle",
".",
"update",
"(",
")"
] | [
261,
4
] | [
263,
33
] | python | en | ['en', 'en', 'en'] | True |
async_validate_trigger_config | (
hass: HomeAssistant, config: ConfigType
) | Validate config. | Validate config. | async def async_validate_trigger_config(
hass: HomeAssistant, config: ConfigType
) -> ConfigType:
"""Validate config."""
config = TRIGGER_SCHEMA(config)
# We return early if the config entry for this device is not ready because we can't
# validate the value without knowing the state of the device
... | [
"async",
"def",
"async_validate_trigger_config",
"(",
"hass",
":",
"HomeAssistant",
",",
"config",
":",
"ConfigType",
")",
"->",
"ConfigType",
":",
"config",
"=",
"TRIGGER_SCHEMA",
"(",
"config",
")",
"# We return early if the config entry for this device is not ready becau... | [
214,
0
] | [
233,
17
] | python | en | ['en', 'la', 'it'] | False |
get_trigger_platform_from_type | (trigger_type: str) | Get trigger platform from Z-Wave JS trigger type. | Get trigger platform from Z-Wave JS trigger type. | def get_trigger_platform_from_type(trigger_type: str) -> str:
"""Get trigger platform from Z-Wave JS trigger type."""
trigger_split = trigger_type.split(".")
# Our convention for trigger types is to have the trigger type at the beginning
# delimited by a `.`. For zwave_js triggers, there is a `.` in the... | [
"def",
"get_trigger_platform_from_type",
"(",
"trigger_type",
":",
"str",
")",
"->",
"str",
":",
"trigger_split",
"=",
"trigger_type",
".",
"split",
"(",
"\".\"",
")",
"# Our convention for trigger types is to have the trigger type at the beginning",
"# delimited by a `.`. For ... | [
236,
0
] | [
244,
27
] | python | en | ['en', 'da', 'en'] | True |
async_get_triggers | (
hass: HomeAssistant, device_id: str
) | List device triggers for Z-Wave JS devices. | List device triggers for Z-Wave JS devices. | async def async_get_triggers(
hass: HomeAssistant, device_id: str
) -> list[dict[str, Any]]:
"""List device triggers for Z-Wave JS devices."""
dev_reg = device_registry.async_get(hass)
node = async_get_node_from_device_id(hass, device_id, dev_reg)
triggers = []
base_trigger = {
CONF_PLA... | [
"async",
"def",
"async_get_triggers",
"(",
"hass",
":",
"HomeAssistant",
",",
"device_id",
":",
"str",
")",
"->",
"list",
"[",
"dict",
"[",
"str",
",",
"Any",
"]",
"]",
":",
"dev_reg",
"=",
"device_registry",
".",
"async_get",
"(",
"hass",
")",
"node",
... | [
247,
0
] | [
356,
19
] | python | en | ['da', 'en', 'en'] | True |
async_attach_trigger | (
hass: HomeAssistant,
config: ConfigType,
action: AutomationActionType,
automation_info: AutomationTriggerInfo,
) | Attach a trigger. | Attach a trigger. | async def async_attach_trigger(
hass: HomeAssistant,
config: ConfigType,
action: AutomationActionType,
automation_info: AutomationTriggerInfo,
) -> CALLBACK_TYPE:
"""Attach a trigger."""
trigger_type = config[CONF_TYPE]
trigger_platform = get_trigger_platform_from_type(trigger_type)
# T... | [
"async",
"def",
"async_attach_trigger",
"(",
"hass",
":",
"HomeAssistant",
",",
"config",
":",
"ConfigType",
",",
"action",
":",
"AutomationActionType",
",",
"automation_info",
":",
"AutomationTriggerInfo",
",",
")",
"->",
"CALLBACK_TYPE",
":",
"trigger_type",
"=",
... | [
359,
0
] | [
450,
70
] | python | en | ['en', 'lb', 'en'] | True |
async_get_trigger_capabilities | (
hass: HomeAssistant, config: ConfigType
) | List trigger capabilities. | List trigger capabilities. | async def async_get_trigger_capabilities(
hass: HomeAssistant, config: ConfigType
) -> dict[str, vol.Schema]:
"""List trigger capabilities."""
trigger_type = config[CONF_TYPE]
node = async_get_node_from_device_id(hass, config[CONF_DEVICE_ID])
# Add additional fields to the automation trigger UI
... | [
"async",
"def",
"async_get_trigger_capabilities",
"(",
"hass",
":",
"HomeAssistant",
",",
"config",
":",
"ConfigType",
")",
"->",
"dict",
"[",
"str",
",",
"vol",
".",
"Schema",
"]",
":",
"trigger_type",
"=",
"config",
"[",
"CONF_TYPE",
"]",
"node",
"=",
"a... | [
453,
0
] | [
543,
13
] | python | en | ['en', 'la', 'en'] | True |
Pet.__init__ | (self, id: int=None, category: Category=None, name: str=None, photo_urls: List[str]=None, tags: List[Tag]=None, status: str=None) | Pet - a model defined in OpenAPI
:param id: The id of this Pet.
:param category: The category of this Pet.
:param name: The name of this Pet.
:param photo_urls: The photo_urls of this Pet.
:param tags: The tags of this Pet.
:param status: The status of this Pet.
| Pet - a model defined in OpenAPI | def __init__(self, id: int=None, category: Category=None, name: str=None, photo_urls: List[str]=None, tags: List[Tag]=None, status: str=None):
"""Pet - a model defined in OpenAPI
:param id: The id of this Pet.
:param category: The category of this Pet.
:param name: The name of this Pet.... | [
"def",
"__init__",
"(",
"self",
",",
"id",
":",
"int",
"=",
"None",
",",
"category",
":",
"Category",
"=",
"None",
",",
"name",
":",
"str",
"=",
"None",
",",
"photo_urls",
":",
"List",
"[",
"str",
"]",
"=",
"None",
",",
"tags",
":",
"List",
"[",
... | [
18,
4
] | [
51,
29
] | python | en | ['en', 'en', 'en'] | True |
Pet.from_dict | (cls, dikt: dict) | Returns the dict as a model
:param dikt: A dict.
:return: The Pet of this Pet.
| Returns the dict as a model | def from_dict(cls, dikt: dict) -> 'Pet':
"""Returns the dict as a model
:param dikt: A dict.
:return: The Pet of this Pet.
"""
return util.deserialize_model(dikt, cls) | [
"def",
"from_dict",
"(",
"cls",
",",
"dikt",
":",
"dict",
")",
"->",
"'Pet'",
":",
"return",
"util",
".",
"deserialize_model",
"(",
"dikt",
",",
"cls",
")"
] | [
54,
4
] | [
60,
48
] | python | en | ['en', 'en', 'en'] | True |
Pet.id | (self) | Gets the id of this Pet.
:return: The id of this Pet.
:rtype: int
| Gets the id of this Pet. | def id(self):
"""Gets the id of this Pet.
:return: The id of this Pet.
:rtype: int
"""
return self._id | [
"def",
"id",
"(",
"self",
")",
":",
"return",
"self",
".",
"_id"
] | [
63,
4
] | [
70,
23
] | python | en | ['en', 'en', 'en'] | True |
Pet.id | (self, id) | Sets the id of this Pet.
:param id: The id of this Pet.
:type id: int
| Sets the id of this Pet. | def id(self, id):
"""Sets the id of this Pet.
:param id: The id of this Pet.
:type id: int
"""
self._id = id | [
"def",
"id",
"(",
"self",
",",
"id",
")",
":",
"self",
".",
"_id",
"=",
"id"
] | [
73,
4
] | [
81,
21
] | python | en | ['en', 'en', 'en'] | True |
Pet.category | (self) | Gets the category of this Pet.
:return: The category of this Pet.
:rtype: Category
| Gets the category of this Pet. | def category(self):
"""Gets the category of this Pet.
:return: The category of this Pet.
:rtype: Category
"""
return self._category | [
"def",
"category",
"(",
"self",
")",
":",
"return",
"self",
".",
"_category"
] | [
84,
4
] | [
91,
29
] | python | en | ['en', 'en', 'en'] | True |
Pet.category | (self, category) | Sets the category of this Pet.
:param category: The category of this Pet.
:type category: Category
| Sets the category of this Pet. | def category(self, category):
"""Sets the category of this Pet.
:param category: The category of this Pet.
:type category: Category
"""
self._category = category | [
"def",
"category",
"(",
"self",
",",
"category",
")",
":",
"self",
".",
"_category",
"=",
"category"
] | [
94,
4
] | [
102,
33
] | python | en | ['en', 'en', 'en'] | True |
Pet.name | (self) | Gets the name of this Pet.
:return: The name of this Pet.
:rtype: str
| Gets the name of this Pet. | def name(self):
"""Gets the name of this Pet.
:return: The name of this Pet.
:rtype: str
"""
return self._name | [
"def",
"name",
"(",
"self",
")",
":",
"return",
"self",
".",
"_name"
] | [
105,
4
] | [
112,
25
] | python | en | ['en', 'en', 'en'] | True |
Pet.name | (self, name) | Sets the name of this Pet.
:param name: The name of this Pet.
:type name: str
| Sets the name of this Pet. | def name(self, name):
"""Sets the name of this Pet.
:param name: The name of this Pet.
:type name: str
"""
if name is None:
raise ValueError("Invalid value for `name`, must not be `None`")
self._name = name | [
"def",
"name",
"(",
"self",
",",
"name",
")",
":",
"if",
"name",
"is",
"None",
":",
"raise",
"ValueError",
"(",
"\"Invalid value for `name`, must not be `None`\"",
")",
"self",
".",
"_name",
"=",
"name"
] | [
115,
4
] | [
125,
25
] | python | en | ['en', 'en', 'en'] | True |
Pet.photo_urls | (self) | Gets the photo_urls of this Pet.
:return: The photo_urls of this Pet.
:rtype: List[str]
| Gets the photo_urls of this Pet. | def photo_urls(self):
"""Gets the photo_urls of this Pet.
:return: The photo_urls of this Pet.
:rtype: List[str]
"""
return self._photo_urls | [
"def",
"photo_urls",
"(",
"self",
")",
":",
"return",
"self",
".",
"_photo_urls"
] | [
128,
4
] | [
135,
31
] | python | en | ['en', 'en', 'en'] | True |
Pet.photo_urls | (self, photo_urls) | Sets the photo_urls of this Pet.
:param photo_urls: The photo_urls of this Pet.
:type photo_urls: List[str]
| Sets the photo_urls of this Pet. | def photo_urls(self, photo_urls):
"""Sets the photo_urls of this Pet.
:param photo_urls: The photo_urls of this Pet.
:type photo_urls: List[str]
"""
if photo_urls is None:
raise ValueError("Invalid value for `photo_urls`, must not be `None`")
self._photo_ur... | [
"def",
"photo_urls",
"(",
"self",
",",
"photo_urls",
")",
":",
"if",
"photo_urls",
"is",
"None",
":",
"raise",
"ValueError",
"(",
"\"Invalid value for `photo_urls`, must not be `None`\"",
")",
"self",
".",
"_photo_urls",
"=",
"photo_urls"
] | [
138,
4
] | [
148,
37
] | python | en | ['en', 'en', 'en'] | True |
Pet.tags | (self) | Gets the tags of this Pet.
:return: The tags of this Pet.
:rtype: List[Tag]
| Gets the tags of this Pet. | def tags(self):
"""Gets the tags of this Pet.
:return: The tags of this Pet.
:rtype: List[Tag]
"""
return self._tags | [
"def",
"tags",
"(",
"self",
")",
":",
"return",
"self",
".",
"_tags"
] | [
151,
4
] | [
158,
25
] | python | en | ['en', 'en', 'en'] | True |
Pet.tags | (self, tags) | Sets the tags of this Pet.
:param tags: The tags of this Pet.
:type tags: List[Tag]
| Sets the tags of this Pet. | def tags(self, tags):
"""Sets the tags of this Pet.
:param tags: The tags of this Pet.
:type tags: List[Tag]
"""
self._tags = tags | [
"def",
"tags",
"(",
"self",
",",
"tags",
")",
":",
"self",
".",
"_tags",
"=",
"tags"
] | [
161,
4
] | [
169,
25
] | python | en | ['en', 'en', 'en'] | True |
Pet.status | (self) | Gets the status of this Pet.
pet status in the store
:return: The status of this Pet.
:rtype: str
| Gets the status of this Pet. | def status(self):
"""Gets the status of this Pet.
pet status in the store
:return: The status of this Pet.
:rtype: str
"""
return self._status | [
"def",
"status",
"(",
"self",
")",
":",
"return",
"self",
".",
"_status"
] | [
172,
4
] | [
180,
27
] | python | en | ['en', 'en', 'en'] | True |
Pet.status | (self, status) | Sets the status of this Pet.
pet status in the store
:param status: The status of this Pet.
:type status: str
| Sets the status of this Pet. | def status(self, status):
"""Sets the status of this Pet.
pet status in the store
:param status: The status of this Pet.
:type status: str
"""
allowed_values = ["available", "pending", "sold"] # noqa: E501
if status not in allowed_values:
raise Valu... | [
"def",
"status",
"(",
"self",
",",
"status",
")",
":",
"allowed_values",
"=",
"[",
"\"available\"",
",",
"\"pending\"",
",",
"\"sold\"",
"]",
"# noqa: E501",
"if",
"status",
"not",
"in",
"allowed_values",
":",
"raise",
"ValueError",
"(",
"\"Invalid value for `st... | [
183,
4
] | [
198,
29
] | python | en | ['en', 'en', 'en'] | True |
async_setup_entry | (
hass: HomeAssistant, entry: ConfigEntry, async_add_entities
) | Set up the Meteoclimatic sensor platform. | Set up the Meteoclimatic sensor platform. | async def async_setup_entry(
hass: HomeAssistant, entry: ConfigEntry, async_add_entities
) -> None:
"""Set up the Meteoclimatic sensor platform."""
coordinator = hass.data[DOMAIN][entry.entry_id]
async_add_entities(
[MeteoclimaticSensor(coordinator, description) for description in SENSOR_TYPES]... | [
"async",
"def",
"async_setup_entry",
"(",
"hass",
":",
"HomeAssistant",
",",
"entry",
":",
"ConfigEntry",
",",
"async_add_entities",
")",
"->",
"None",
":",
"coordinator",
"=",
"hass",
".",
"data",
"[",
"DOMAIN",
"]",
"[",
"entry",
".",
"entry_id",
"]",
"a... | [
17,
0
] | [
26,
5
] | python | en | ['en', 'da', 'en'] | True |
MeteoclimaticSensor.__init__ | (
self, coordinator: DataUpdateCoordinator, description: SensorEntityDescription
) | Initialize the Meteoclimatic sensor. | Initialize the Meteoclimatic sensor. | def __init__(
self, coordinator: DataUpdateCoordinator, description: SensorEntityDescription
) -> None:
"""Initialize the Meteoclimatic sensor."""
super().__init__(coordinator)
self.entity_description = description
station = self.coordinator.data["station"]
self._attr... | [
"def",
"__init__",
"(",
"self",
",",
"coordinator",
":",
"DataUpdateCoordinator",
",",
"description",
":",
"SensorEntityDescription",
")",
"->",
"None",
":",
"super",
"(",
")",
".",
"__init__",
"(",
"coordinator",
")",
"self",
".",
"entity_description",
"=",
"... | [
34,
4
] | [
42,
66
] | python | en | ['en', 'en', 'en'] | True |
MeteoclimaticSensor.device_info | (self) | Return the device info. | Return the device info. | def device_info(self):
"""Return the device info."""
return {
"identifiers": {(DOMAIN, self.platform.config_entry.unique_id)},
"name": self.coordinator.name,
"manufacturer": MANUFACTURER,
"model": MODEL,
"entry_type": "service",
} | [
"def",
"device_info",
"(",
"self",
")",
":",
"return",
"{",
"\"identifiers\"",
":",
"{",
"(",
"DOMAIN",
",",
"self",
".",
"platform",
".",
"config_entry",
".",
"unique_id",
")",
"}",
",",
"\"name\"",
":",
"self",
".",
"coordinator",
".",
"name",
",",
"... | [
45,
4
] | [
53,
9
] | python | en | ['en', 'en', 'en'] | True |
MeteoclimaticSensor.native_value | (self) | Return the state of the sensor. | Return the state of the sensor. | def native_value(self):
"""Return the state of the sensor."""
return (
getattr(self.coordinator.data["weather"], self.entity_description.key)
if self.coordinator.data
else None
) | [
"def",
"native_value",
"(",
"self",
")",
":",
"return",
"(",
"getattr",
"(",
"self",
".",
"coordinator",
".",
"data",
"[",
"\"weather\"",
"]",
",",
"self",
".",
"entity_description",
".",
"key",
")",
"if",
"self",
".",
"coordinator",
".",
"data",
"else",... | [
56,
4
] | [
62,
9
] | python | en | ['en', 'en', 'en'] | True |
SonarrEntity.__init__ | (
self,
*,
sonarr: Sonarr,
entry_id: str,
device_id: str,
) | Initialize the Sonarr entity. | Initialize the Sonarr entity. | def __init__(
self,
*,
sonarr: Sonarr,
entry_id: str,
device_id: str,
) -> None:
"""Initialize the Sonarr entity."""
self._entry_id = entry_id
self._device_id = device_id
self.sonarr = sonarr | [
"def",
"__init__",
"(",
"self",
",",
"*",
",",
"sonarr",
":",
"Sonarr",
",",
"entry_id",
":",
"str",
",",
"device_id",
":",
"str",
",",
")",
"->",
"None",
":",
"self",
".",
"_entry_id",
"=",
"entry_id",
"self",
".",
"_device_id",
"=",
"device_id",
"s... | [
19,
4
] | [
29,
28
] | python | en | ['en', 'en', 'en'] | True |
SonarrEntity.device_info | (self) | Return device information about the application. | Return device information about the application. | def device_info(self) -> DeviceInfo | None:
"""Return device information about the application."""
if self._device_id is None:
return None
return {
ATTR_IDENTIFIERS: {(DOMAIN, self._device_id)},
ATTR_NAME: "Activity Sensor",
ATTR_MANUFACTURER: "So... | [
"def",
"device_info",
"(",
"self",
")",
"->",
"DeviceInfo",
"|",
"None",
":",
"if",
"self",
".",
"_device_id",
"is",
"None",
":",
"return",
"None",
"return",
"{",
"ATTR_IDENTIFIERS",
":",
"{",
"(",
"DOMAIN",
",",
"self",
".",
"_device_id",
")",
"}",
",... | [
32,
4
] | [
43,
9
] | python | en | ['en', 'en', 'en'] | True |
test_form | (hass) | Test we get the form. | Test we get the form. | async def test_form(hass):
"""Test we get the form."""
await setup.async_setup_component(hass, "persistent_notification", {})
mock_mac = "FF-00-00-00-00-00"
result = await hass.config_entries.flow.async_init(
DOMAIN, context={"source": config_entries.SOURCE_USER}
)
assert result["type"] ... | [
"async",
"def",
"test_form",
"(",
"hass",
")",
":",
"await",
"setup",
".",
"async_setup_component",
"(",
"hass",
",",
"\"persistent_notification\"",
",",
"{",
"}",
")",
"mock_mac",
"=",
"\"FF-00-00-00-00-00\"",
"result",
"=",
"await",
"hass",
".",
"config_entrie... | [
10,
0
] | [
38,
48
] | python | en | ['en', 'en', 'en'] | True |
test_form_invalid_auth | (hass) | Test we handle invalid auth. | Test we handle invalid auth. | async def test_form_invalid_auth(hass):
"""Test we handle invalid auth."""
result = await hass.config_entries.flow.async_init(
DOMAIN, context={"source": config_entries.SOURCE_USER}
)
with patch("vilfo.Client.ping", return_value=None), patch(
"vilfo.Client.resolve_mac_address", return_v... | [
"async",
"def",
"test_form_invalid_auth",
"(",
"hass",
")",
":",
"result",
"=",
"await",
"hass",
".",
"config_entries",
".",
"flow",
".",
"async_init",
"(",
"DOMAIN",
",",
"context",
"=",
"{",
"\"source\"",
":",
"config_entries",
".",
"SOURCE_USER",
"}",
")"... | [
41,
0
] | [
59,
56
] | python | en | ['en', 'en', 'en'] | True |
test_form_cannot_connect | (hass) | Test we handle cannot connect error. | Test we handle cannot connect error. | async def test_form_cannot_connect(hass):
"""Test we handle cannot connect error."""
result = await hass.config_entries.flow.async_init(
DOMAIN, context={"source": config_entries.SOURCE_USER}
)
with patch("vilfo.Client.ping", side_effect=vilfo.exceptions.VilfoException), patch(
"vilfo.C... | [
"async",
"def",
"test_form_cannot_connect",
"(",
"hass",
")",
":",
"result",
"=",
"await",
"hass",
".",
"config_entries",
".",
"flow",
".",
"async_init",
"(",
"DOMAIN",
",",
"context",
"=",
"{",
"\"source\"",
":",
"config_entries",
".",
"SOURCE_USER",
"}",
"... | [
62,
0
] | [
88,
58
] | python | en | ['en', 'en', 'en'] | True |
test_form_wrong_host | (hass) | Test we handle wrong host errors. | Test we handle wrong host errors. | async def test_form_wrong_host(hass):
"""Test we handle wrong host errors."""
result = await hass.config_entries.flow.async_init(
DOMAIN,
context={"source": config_entries.SOURCE_USER},
data={"host": "this is an invalid hostname", "access_token": "test-token"},
)
assert result["... | [
"async",
"def",
"test_form_wrong_host",
"(",
"hass",
")",
":",
"result",
"=",
"await",
"hass",
".",
"config_entries",
".",
"flow",
".",
"async_init",
"(",
"DOMAIN",
",",
"context",
"=",
"{",
"\"source\"",
":",
"config_entries",
".",
"SOURCE_USER",
"}",
",",
... | [
91,
0
] | [
99,
53
] | python | en | ['de', 'en', 'en'] | True |
test_form_already_configured | (hass) | Test that we handle already configured exceptions appropriately. | Test that we handle already configured exceptions appropriately. | async def test_form_already_configured(hass):
"""Test that we handle already configured exceptions appropriately."""
first_flow_result1 = await hass.config_entries.flow.async_init(
DOMAIN, context={"source": config_entries.SOURCE_USER}
)
with patch("vilfo.Client.ping", return_value=None), patch... | [
"async",
"def",
"test_form_already_configured",
"(",
"hass",
")",
":",
"first_flow_result1",
"=",
"await",
"hass",
".",
"config_entries",
".",
"flow",
".",
"async_init",
"(",
"DOMAIN",
",",
"context",
"=",
"{",
"\"source\"",
":",
"config_entries",
".",
"SOURCE_U... | [
102,
0
] | [
132,
64
] | python | en | ['en', 'en', 'en'] | True |
test_form_unexpected_exception | (hass) | Test that we handle unexpected exceptions. | Test that we handle unexpected exceptions. | async def test_form_unexpected_exception(hass):
"""Test that we handle unexpected exceptions."""
result = await hass.config_entries.flow.async_init(
DOMAIN, context={"source": config_entries.SOURCE_USER}
)
with patch(
"homeassistant.components.vilfo.config_flow.VilfoClient",
) as mo... | [
"async",
"def",
"test_form_unexpected_exception",
"(",
"hass",
")",
":",
"result",
"=",
"await",
"hass",
".",
"config_entries",
".",
"flow",
".",
"async_init",
"(",
"DOMAIN",
",",
"context",
"=",
"{",
"\"source\"",
":",
"config_entries",
".",
"SOURCE_USER",
"}... | [
135,
0
] | [
150,
51
] | python | en | ['en', 'en', 'en'] | True |
test_validate_input_returns_data | (hass) | Test we handle the MAC address being resolved or not. | Test we handle the MAC address being resolved or not. | async def test_validate_input_returns_data(hass):
"""Test we handle the MAC address being resolved or not."""
mock_data = {"host": "testadmin.vilfo.com", "access_token": "test-token"}
mock_data_with_ip = {"host": "192.168.0.1", "access_token": "test-token"}
mock_data_with_ipv6 = {"host": "2001:db8::1428... | [
"async",
"def",
"test_validate_input_returns_data",
"(",
"hass",
")",
":",
"mock_data",
"=",
"{",
"\"host\"",
":",
"\"testadmin.vilfo.com\"",
",",
"\"access_token\"",
":",
"\"test-token\"",
"}",
"mock_data_with_ip",
"=",
"{",
"\"host\"",
":",
"\"192.168.0.1\"",
",",
... | [
153,
0
] | [
198,
39
] | python | en | ['en', 'en', 'en'] | True |
XMLParser.doctype | (self, name, pubid, system) | This method of XMLParser is deprecated. | This method of XMLParser is deprecated. | def doctype(self, name, pubid, system):
"""This method of XMLParser is deprecated."""
warnings.warn(
"This method of XMLParser is deprecated. Define doctype() "
"method on the TreeBuilder target.",
DeprecationWarning,
) | [
"def",
"doctype",
"(",
"self",
",",
"name",
",",
"pubid",
",",
"system",
")",
":",
"warnings",
".",
"warn",
"(",
"\"This method of XMLParser is deprecated. Define doctype() \"",
"\"method on the TreeBuilder target.\"",
",",
"DeprecationWarning",
",",
")"
] | [
1638,
4
] | [
1644,
13
] | python | en | ['en', 'en', 'en'] | True |
EnOceanFlowHandler.__init__ | (self) | Initialize the EnOcean config flow. | Initialize the EnOcean config flow. | def __init__(self):
"""Initialize the EnOcean config flow."""
self.dongle_path = None
self.discovery_info = None | [
"def",
"__init__",
"(",
"self",
")",
":",
"self",
".",
"dongle_path",
"=",
"None",
"self",
".",
"discovery_info",
"=",
"None"
] | [
17,
4
] | [
20,
34
] | python | en | ['en', 'fr', 'en'] | True |
EnOceanFlowHandler.async_step_import | (self, data=None) | Import a yaml configuration. | Import a yaml configuration. | async def async_step_import(self, data=None):
"""Import a yaml configuration."""
if not await self.validate_enocean_conf(data):
LOGGER.warning(
"Cannot import yaml configuration: %s is not a valid dongle path",
data[CONF_DEVICE],
)
ret... | [
"async",
"def",
"async_step_import",
"(",
"self",
",",
"data",
"=",
"None",
")",
":",
"if",
"not",
"await",
"self",
".",
"validate_enocean_conf",
"(",
"data",
")",
":",
"LOGGER",
".",
"warning",
"(",
"\"Cannot import yaml configuration: %s is not a valid dongle path... | [
22,
4
] | [
32,
46
] | python | en | ['tr', 'ny', 'en'] | False |
EnOceanFlowHandler.async_step_user | (self, user_input=None) | Handle an EnOcean config flow start. | Handle an EnOcean config flow start. | async def async_step_user(self, user_input=None):
"""Handle an EnOcean config flow start."""
if self._async_current_entries():
return self.async_abort(reason="single_instance_allowed")
return await self.async_step_detect() | [
"async",
"def",
"async_step_user",
"(",
"self",
",",
"user_input",
"=",
"None",
")",
":",
"if",
"self",
".",
"_async_current_entries",
"(",
")",
":",
"return",
"self",
".",
"async_abort",
"(",
"reason",
"=",
"\"single_instance_allowed\"",
")",
"return",
"await... | [
34,
4
] | [
39,
45
] | python | en | ['en', 'nl', 'en'] | True |
EnOceanFlowHandler.async_step_detect | (self, user_input=None) | Propose a list of detected dongles. | Propose a list of detected dongles. | async def async_step_detect(self, user_input=None):
"""Propose a list of detected dongles."""
errors = {}
if user_input is not None:
if user_input[CONF_DEVICE] == self.MANUAL_PATH_VALUE:
return await self.async_step_manual(None)
if await self.validate_enoc... | [
"async",
"def",
"async_step_detect",
"(",
"self",
",",
"user_input",
"=",
"None",
")",
":",
"errors",
"=",
"{",
"}",
"if",
"user_input",
"is",
"not",
"None",
":",
"if",
"user_input",
"[",
"CONF_DEVICE",
"]",
"==",
"self",
".",
"MANUAL_PATH_VALUE",
":",
"... | [
41,
4
] | [
60,
9
] | python | en | ['en', 'en', 'en'] | True |
EnOceanFlowHandler.async_step_manual | (self, user_input=None) | Request manual USB dongle path. | Request manual USB dongle path. | async def async_step_manual(self, user_input=None):
"""Request manual USB dongle path."""
default_value = None
errors = {}
if user_input is not None:
if await self.validate_enocean_conf(user_input):
return self.create_enocean_entry(user_input)
defa... | [
"async",
"def",
"async_step_manual",
"(",
"self",
",",
"user_input",
"=",
"None",
")",
":",
"default_value",
"=",
"None",
"errors",
"=",
"{",
"}",
"if",
"user_input",
"is",
"not",
"None",
":",
"if",
"await",
"self",
".",
"validate_enocean_conf",
"(",
"user... | [
62,
4
] | [
78,
9
] | python | en | ['ro', 'en', 'en'] | True |
EnOceanFlowHandler.validate_enocean_conf | (self, user_input) | Return True if the user_input contains a valid dongle path. | Return True if the user_input contains a valid dongle path. | async def validate_enocean_conf(self, user_input) -> bool:
"""Return True if the user_input contains a valid dongle path."""
dongle_path = user_input[CONF_DEVICE]
path_is_valid = await self.hass.async_add_executor_job(
dongle.validate_path, dongle_path
)
return path_i... | [
"async",
"def",
"validate_enocean_conf",
"(",
"self",
",",
"user_input",
")",
"->",
"bool",
":",
"dongle_path",
"=",
"user_input",
"[",
"CONF_DEVICE",
"]",
"path_is_valid",
"=",
"await",
"self",
".",
"hass",
".",
"async_add_executor_job",
"(",
"dongle",
".",
"... | [
80,
4
] | [
86,
28
] | python | en | ['en', 'en', 'en'] | True |
EnOceanFlowHandler.create_enocean_entry | (self, user_input) | Create an entry for the provided configuration. | Create an entry for the provided configuration. | def create_enocean_entry(self, user_input):
"""Create an entry for the provided configuration."""
return self.async_create_entry(title="EnOcean", data=user_input) | [
"def",
"create_enocean_entry",
"(",
"self",
",",
"user_input",
")",
":",
"return",
"self",
".",
"async_create_entry",
"(",
"title",
"=",
"\"EnOcean\"",
",",
"data",
"=",
"user_input",
")"
] | [
88,
4
] | [
90,
72
] | python | en | ['en', 'en', 'en'] | True |
async_setup_entry | (hass, config_entry, async_add_entities) | Set up the GSM Signal Sensor sensor. | Set up the GSM Signal Sensor sensor. | async def async_setup_entry(hass, config_entry, async_add_entities):
"""Set up the GSM Signal Sensor sensor."""
gateway = hass.data[DOMAIN][SMS_GATEWAY]
imei = await gateway.get_imei_async()
async_add_entities(
[
GSMSignalSensor(
hass,
gateway,
... | [
"async",
"def",
"async_setup_entry",
"(",
"hass",
",",
"config_entry",
",",
"async_add_entities",
")",
":",
"gateway",
"=",
"hass",
".",
"data",
"[",
"DOMAIN",
"]",
"[",
"SMS_GATEWAY",
"]",
"imei",
"=",
"await",
"gateway",
".",
"get_imei_async",
"(",
")",
... | [
13,
0
] | [
33,
5
] | python | en | ['en', 'su', 'en'] | True |
GSMSignalSensor.__init__ | (self, hass, gateway, imei, description) | Initialize the GSM Signal sensor. | Initialize the GSM Signal sensor. | def __init__(self, hass, gateway, imei, description):
"""Initialize the GSM Signal sensor."""
self._attr_device_info = {
"identifiers": {(DOMAIN, str(imei))},
"name": "SMS Gateway",
}
self._attr_unique_id = str(imei)
self._hass = hass
self._gateway... | [
"def",
"__init__",
"(",
"self",
",",
"hass",
",",
"gateway",
",",
"imei",
",",
"description",
")",
":",
"self",
".",
"_attr_device_info",
"=",
"{",
"\"identifiers\"",
":",
"{",
"(",
"DOMAIN",
",",
"str",
"(",
"imei",
")",
")",
"}",
",",
"\"name\"",
"... | [
39,
4
] | [
49,
45
] | python | en | ['en', 'pt', 'en'] | True |
GSMSignalSensor.available | (self) | Return if the sensor data are available. | Return if the sensor data are available. | def available(self):
"""Return if the sensor data are available."""
return self._state is not None | [
"def",
"available",
"(",
"self",
")",
":",
"return",
"self",
".",
"_state",
"is",
"not",
"None"
] | [
52,
4
] | [
54,
38
] | python | en | ['en', 'en', 'en'] | True |
GSMSignalSensor.native_value | (self) | Return the state of the device. | Return the state of the device. | def native_value(self):
"""Return the state of the device."""
return self._state["SignalStrength"] | [
"def",
"native_value",
"(",
"self",
")",
":",
"return",
"self",
".",
"_state",
"[",
"\"SignalStrength\"",
"]"
] | [
57,
4
] | [
59,
44
] | python | en | ['en', 'en', 'en'] | True |
GSMSignalSensor.async_update | (self) | Get the latest data from the modem. | Get the latest data from the modem. | async def async_update(self):
"""Get the latest data from the modem."""
try:
self._state = await self._gateway.get_signal_quality_async()
except gammu.GSMError as exc:
_LOGGER.error("Failed to read signal quality: %s", exc) | [
"async",
"def",
"async_update",
"(",
"self",
")",
":",
"try",
":",
"self",
".",
"_state",
"=",
"await",
"self",
".",
"_gateway",
".",
"get_signal_quality_async",
"(",
")",
"except",
"gammu",
".",
"GSMError",
"as",
"exc",
":",
"_LOGGER",
".",
"error",
"("... | [
61,
4
] | [
66,
67
] | python | en | ['en', 'en', 'en'] | True |
GSMSignalSensor.extra_state_attributes | (self) | Return the sensor attributes. | Return the sensor attributes. | def extra_state_attributes(self):
"""Return the sensor attributes."""
return self._state | [
"def",
"extra_state_attributes",
"(",
"self",
")",
":",
"return",
"self",
".",
"_state"
] | [
69,
4
] | [
71,
26
] | python | en | ['en', 'sq', 'en'] | True |
NumpyVersion._compare_version | (self, other) | Compare major.minor.bugfix | Compare major.minor.bugfix | def _compare_version(self, other):
"""Compare major.minor.bugfix"""
if self.major == other.major:
if self.minor == other.minor:
if self.bugfix == other.bugfix:
vercmp = 0
elif self.bugfix > other.bugfix:
vercmp = 1
... | [
"def",
"_compare_version",
"(",
"self",
",",
"other",
")",
":",
"if",
"self",
".",
"major",
"==",
"other",
".",
"major",
":",
"if",
"self",
".",
"minor",
"==",
"other",
".",
"minor",
":",
"if",
"self",
".",
"bugfix",
"==",
"other",
".",
"bugfix",
"... | [
77,
4
] | [
96,
21
] | python | en | ['en', 'it', 'en'] | False |
NumpyVersion._compare_pre_release | (self, other) | Compare alpha/beta/rc/final. | Compare alpha/beta/rc/final. | def _compare_pre_release(self, other):
"""Compare alpha/beta/rc/final."""
if self.pre_release == other.pre_release:
vercmp = 0
elif self.pre_release == 'final':
vercmp = 1
elif other.pre_release == 'final':
vercmp = -1
elif self.pre_release > o... | [
"def",
"_compare_pre_release",
"(",
"self",
",",
"other",
")",
":",
"if",
"self",
".",
"pre_release",
"==",
"other",
".",
"pre_release",
":",
"vercmp",
"=",
"0",
"elif",
"self",
".",
"pre_release",
"==",
"'final'",
":",
"vercmp",
"=",
"1",
"elif",
"other... | [
98,
4
] | [
111,
21
] | python | en | ['en', 'pt', 'en'] | False |
initialize_all | (irc) | Initializes all relay channels for the given IRC object. | Initializes all relay channels for the given IRC object. | def initialize_all(irc):
"""Initializes all relay channels for the given IRC object."""
def _initialize_all():
for chanpair, entrydata in db.items():
network, channel = chanpair
# Initialize all channels that are relevant to the called network (i.e. channels either hosted there... | [
"def",
"initialize_all",
"(",
"irc",
")",
":",
"def",
"_initialize_all",
"(",
")",
":",
"for",
"chanpair",
",",
"entrydata",
"in",
"db",
".",
"items",
"(",
")",
":",
"network",
",",
"channel",
"=",
"chanpair",
"# Initialize all channels that are relevant to the ... | [
50,
0
] | [
67,
13
] | python | en | ['en', 'en', 'en'] | True |
main | (irc=None) | Main function, called during plugin loading at start. | Main function, called during plugin loading at start. | def main(irc=None):
"""Main function, called during plugin loading at start."""
log.debug('relay.main: loading links database')
datastore.load()
permissions.add_default_permissions(default_permissions)
if 'relay' in conf.conf and conf.conf['relay'].get('allow_free_oper_links', True):
permi... | [
"def",
"main",
"(",
"irc",
"=",
"None",
")",
":",
"log",
".",
"debug",
"(",
"'relay.main: loading links database'",
")",
"datastore",
".",
"load",
"(",
")",
"permissions",
".",
"add_default_permissions",
"(",
"default_permissions",
")",
"if",
"'relay'",
"in",
... | [
69,
0
] | [
96,
61
] | python | en | ['en', 'jv', 'en'] | True |
die | (irc=None) | Deinitialize PyLink Relay by quitting all relay clients and saving the
relay DB. | Deinitialize PyLink Relay by quitting all relay clients and saving the
relay DB. | def die(irc=None):
"""Deinitialize PyLink Relay by quitting all relay clients and saving the
relay DB."""
if not world.shutting_down.is_set():
# Speed up shutdowns significantly by not manually splitting off every relay server -
# the connection will soon be gone anyways.
# For eve... | [
"def",
"die",
"(",
"irc",
"=",
"None",
")",
":",
"if",
"not",
"world",
".",
"shutting_down",
".",
"is_set",
"(",
")",
":",
"# Speed up shutdowns significantly by not manually splitting off every relay server -",
"# the connection will soon be gone anyways.",
"# For every conn... | [
98,
0
] | [
129,
83
] | 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.