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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
_ScriptRun._async_variables_step | (self) | Set a variable value. | Set a variable value. | async def _async_variables_step(self):
"""Set a variable value."""
self._step_log("setting variables")
self._variables = self._action[CONF_VARIABLES].async_render(
self._hass, self._variables, render_as_defaults=False
) | [
"async",
"def",
"_async_variables_step",
"(",
"self",
")",
":",
"self",
".",
"_step_log",
"(",
"\"setting variables\"",
")",
"self",
".",
"_variables",
"=",
"self",
".",
"_action",
"[",
"CONF_VARIABLES",
"]",
".",
"async_render",
"(",
"self",
".",
"_hass",
"... | [
817,
4
] | [
822,
9
] | python | en | ['en', 'en', 'en'] | True |
_ScriptRun._async_run_script | (self, script: Script) | Execute a script. | Execute a script. | async def _async_run_script(self, script: Script) -> None:
"""Execute a script."""
await self._async_run_long_action(
self._hass.async_create_task(
script.async_run(self._variables, self._context)
)
) | [
"async",
"def",
"_async_run_script",
"(",
"self",
",",
"script",
":",
"Script",
")",
"->",
"None",
":",
"await",
"self",
".",
"_async_run_long_action",
"(",
"self",
".",
"_hass",
".",
"async_create_task",
"(",
"script",
".",
"async_run",
"(",
"self",
".",
... | [
824,
4
] | [
830,
9
] | python | en | ['en', 'ca', 'en'] | True |
_QueuedScriptRun.async_run | (self) | Run script. | Run script. | async def async_run(self) -> None:
"""Run script."""
# Wait for previous run, if any, to finish by attempting to acquire the script's
# shared lock. At the same time monitor if we've been told to stop.
lock_task = self._hass.async_create_task(
self._script._queue_lck.acquire(... | [
"async",
"def",
"async_run",
"(",
"self",
")",
"->",
"None",
":",
"# Wait for previous run, if any, to finish by attempting to acquire the script's",
"# shared lock. At the same time monitor if we've been told to stop.",
"lock_task",
"=",
"self",
".",
"_hass",
".",
"async_create_ta... | [
838,
4
] | [
863,
37
] | python | en | ['ro', 'ms', 'en'] | False |
Script.__init__ | (
self,
hass: HomeAssistant,
sequence: Sequence[dict[str, Any]],
name: str,
domain: str,
*,
# Used in "Running <running_description>" log message
running_description: str | None = None,
change_listener: Callable[..., Any] | None = None,
scr... | Initialize the script. | Initialize the script. | def __init__(
self,
hass: HomeAssistant,
sequence: Sequence[dict[str, Any]],
name: str,
domain: str,
*,
# Used in "Running <running_description>" log message
running_description: str | None = None,
change_listener: Callable[..., Any] | None = None,... | [
"def",
"__init__",
"(",
"self",
",",
"hass",
":",
"HomeAssistant",
",",
"sequence",
":",
"Sequence",
"[",
"dict",
"[",
"str",
",",
"Any",
"]",
"]",
",",
"name",
":",
"str",
",",
"domain",
":",
"str",
",",
"*",
",",
"# Used in \"Running <running_descripti... | [
936,
4
] | [
1001,
44
] | python | en | ['en', 'co', 'en'] | True |
Script.change_listener | (self) | Return the change_listener. | Return the change_listener. | def change_listener(self) -> Callable[..., Any] | None:
"""Return the change_listener."""
return self._change_listener | [
"def",
"change_listener",
"(",
"self",
")",
"->",
"Callable",
"[",
"...",
",",
"Any",
"]",
"|",
"None",
":",
"return",
"self",
".",
"_change_listener"
] | [
1004,
4
] | [
1006,
36
] | python | en | ['en', 'no', 'en'] | True |
Script.change_listener | (self, change_listener: Callable[..., Any]) | Update the change_listener. | Update the change_listener. | def change_listener(self, change_listener: Callable[..., Any]) -> None:
"""Update the change_listener."""
self._change_listener = change_listener
if (
self._change_listener_job is None
or change_listener != self._change_listener_job.target
):
self._cha... | [
"def",
"change_listener",
"(",
"self",
",",
"change_listener",
":",
"Callable",
"[",
"...",
",",
"Any",
"]",
")",
"->",
"None",
":",
"self",
".",
"_change_listener",
"=",
"change_listener",
"if",
"(",
"self",
".",
"_change_listener_job",
"is",
"None",
"or",
... | [
1009,
4
] | [
1016,
64
] | python | en | ['en', 'de', 'en'] | True |
Script.update_logger | (self, logger: logging.Logger | None = None) | Update logger. | Update logger. | def update_logger(self, logger: logging.Logger | None = None) -> None:
"""Update logger."""
self._set_logger(logger)
for script in self._repeat_script.values():
script.update_logger(self._logger)
for choose_data in self._choose_data.values():
for _, script in choo... | [
"def",
"update_logger",
"(",
"self",
",",
"logger",
":",
"logging",
".",
"Logger",
"|",
"None",
"=",
"None",
")",
"->",
"None",
":",
"self",
".",
"_set_logger",
"(",
"logger",
")",
"for",
"script",
"in",
"self",
".",
"_repeat_script",
".",
"values",
"(... | [
1024,
4
] | [
1033,
66
] | python | en | ['es', 'en', 'en'] | False |
Script.is_running | (self) | Return true if script is on. | Return true if script is on. | def is_running(self) -> bool:
"""Return true if script is on."""
return len(self._runs) > 0 | [
"def",
"is_running",
"(",
"self",
")",
"->",
"bool",
":",
"return",
"len",
"(",
"self",
".",
"_runs",
")",
">",
"0"
] | [
1045,
4
] | [
1047,
34
] | python | en | ['en', 'fy', 'en'] | True |
Script.runs | (self) | Return the number of current runs. | Return the number of current runs. | def runs(self) -> int:
"""Return the number of current runs."""
return len(self._runs) | [
"def",
"runs",
"(",
"self",
")",
"->",
"int",
":",
"return",
"len",
"(",
"self",
".",
"_runs",
")"
] | [
1050,
4
] | [
1052,
30
] | python | en | ['en', 'en', 'en'] | True |
Script.supports_max | (self) | Return true if the current mode support max. | Return true if the current mode support max. | def supports_max(self) -> bool:
"""Return true if the current mode support max."""
return self.script_mode in (SCRIPT_MODE_PARALLEL, SCRIPT_MODE_QUEUED) | [
"def",
"supports_max",
"(",
"self",
")",
"->",
"bool",
":",
"return",
"self",
".",
"script_mode",
"in",
"(",
"SCRIPT_MODE_PARALLEL",
",",
"SCRIPT_MODE_QUEUED",
")"
] | [
1055,
4
] | [
1057,
77
] | python | en | ['en', 'en', 'en'] | True |
Script.referenced_areas | (self) | Return a set of referenced areas. | Return a set of referenced areas. | def referenced_areas(self):
"""Return a set of referenced areas."""
if self._referenced_areas is not None:
return self._referenced_areas
referenced: set[str] = set()
for step in self.sequence:
action = cv.determine_script_action(step)
if action == c... | [
"def",
"referenced_areas",
"(",
"self",
")",
":",
"if",
"self",
".",
"_referenced_areas",
"is",
"not",
"None",
":",
"return",
"self",
".",
"_referenced_areas",
"referenced",
":",
"set",
"[",
"str",
"]",
"=",
"set",
"(",
")",
"for",
"step",
"in",
"self",
... | [
1060,
4
] | [
1079,
25
] | python | en | ['en', 'en', 'en'] | True |
Script.referenced_devices | (self) | Return a set of referenced devices. | Return a set of referenced devices. | def referenced_devices(self):
"""Return a set of referenced devices."""
if self._referenced_devices is not None:
return self._referenced_devices
referenced: set[str] = set()
for step in self.sequence:
action = cv.determine_script_action(step)
if act... | [
"def",
"referenced_devices",
"(",
"self",
")",
":",
"if",
"self",
".",
"_referenced_devices",
"is",
"not",
"None",
":",
"return",
"self",
".",
"_referenced_devices",
"referenced",
":",
"set",
"[",
"str",
"]",
"=",
"set",
"(",
")",
"for",
"step",
"in",
"s... | [
1082,
4
] | [
1107,
25
] | python | en | ['en', 'en', 'en'] | True |
Script.referenced_entities | (self) | Return a set of referenced entities. | Return a set of referenced entities. | def referenced_entities(self):
"""Return a set of referenced entities."""
if self._referenced_entities is not None:
return self._referenced_entities
referenced: set[str] = set()
for step in self.sequence:
action = cv.determine_script_action(step)
if... | [
"def",
"referenced_entities",
"(",
"self",
")",
":",
"if",
"self",
".",
"_referenced_entities",
"is",
"not",
"None",
":",
"return",
"self",
".",
"_referenced_entities",
"referenced",
":",
"set",
"[",
"str",
"]",
"=",
"set",
"(",
")",
"for",
"step",
"in",
... | [
1110,
4
] | [
1136,
25
] | python | en | ['en', 'en', 'en'] | True |
Script.run | (
self, variables: _VarsType | None = None, context: Context | None = None
) | Run script. | Run script. | def run(
self, variables: _VarsType | None = None, context: Context | None = None
) -> None:
"""Run script."""
asyncio.run_coroutine_threadsafe(
self.async_run(variables, context), self._hass.loop
).result() | [
"def",
"run",
"(",
"self",
",",
"variables",
":",
"_VarsType",
"|",
"None",
"=",
"None",
",",
"context",
":",
"Context",
"|",
"None",
"=",
"None",
")",
"->",
"None",
":",
"asyncio",
".",
"run_coroutine_threadsafe",
"(",
"self",
".",
"async_run",
"(",
"... | [
1138,
4
] | [
1144,
18
] | python | en | ['ro', 'ms', 'en'] | False |
Script.async_run | (
self,
run_variables: _VarsType | None = None,
context: Context | None = None,
started_action: Callable[..., Any] | None = None,
) | Run script. | Run script. | async def async_run(
self,
run_variables: _VarsType | None = None,
context: Context | None = None,
started_action: Callable[..., Any] | None = None,
) -> None:
"""Run script."""
if context is None:
self._log(
"Running script requires passin... | [
"async",
"def",
"async_run",
"(",
"self",
",",
"run_variables",
":",
"_VarsType",
"|",
"None",
"=",
"None",
",",
"context",
":",
"Context",
"|",
"None",
"=",
"None",
",",
"started_action",
":",
"Callable",
"[",
"...",
",",
"Any",
"]",
"|",
"None",
"=",... | [
1146,
4
] | [
1222,
17
] | python | en | ['ro', 'ms', 'en'] | False |
Script.async_stop | (
self, update_state: bool = True, spare: _ScriptRun | None = None
) | Stop running script. | Stop running script. | async def async_stop(
self, update_state: bool = True, spare: _ScriptRun | None = None
) -> None:
"""Stop running script."""
# Collect a a list of script runs to stop. This must be done before calling
# asyncio.shield as asyncio.shield yields to the event loop, which would cause
... | [
"async",
"def",
"async_stop",
"(",
"self",
",",
"update_state",
":",
"bool",
"=",
"True",
",",
"spare",
":",
"_ScriptRun",
"|",
"None",
"=",
"None",
")",
"->",
"None",
":",
"# Collect a a list of script runs to stop. This must be done before calling",
"# asyncio.shiel... | [
1231,
4
] | [
1243,
72
] | python | en | ['en', 'sv', 'en'] | True |
async_setup_entry | (
hass: HomeAssistant, entry: ConfigEntry, async_add_entities: AddEntitiesCallback
) | Set up SimpliSafe locks based on a config entry. | Set up SimpliSafe locks based on a config entry. | async def async_setup_entry(
hass: HomeAssistant, entry: ConfigEntry, async_add_entities: AddEntitiesCallback
) -> None:
"""Set up SimpliSafe locks based on a config entry."""
simplisafe = hass.data[DOMAIN][DATA_CLIENT][entry.entry_id]
locks = []
for system in simplisafe.systems.values():
i... | [
"async",
"def",
"async_setup_entry",
"(",
"hass",
":",
"HomeAssistant",
",",
"entry",
":",
"ConfigEntry",
",",
"async_add_entities",
":",
"AddEntitiesCallback",
")",
"->",
"None",
":",
"simplisafe",
"=",
"hass",
".",
"data",
"[",
"DOMAIN",
"]",
"[",
"DATA_CLIE... | [
21,
0
] | [
36,
29
] | python | en | ['en', 'da', 'en'] | True |
SimpliSafeLock.__init__ | (self, simplisafe: SimpliSafe, system: SystemV3, lock: Lock) | Initialize. | Initialize. | def __init__(self, simplisafe: SimpliSafe, system: SystemV3, lock: Lock) -> None:
"""Initialize."""
super().__init__(simplisafe, system, lock.name, serial=lock.serial)
self._lock = lock | [
"def",
"__init__",
"(",
"self",
",",
"simplisafe",
":",
"SimpliSafe",
",",
"system",
":",
"SystemV3",
",",
"lock",
":",
"Lock",
")",
"->",
"None",
":",
"super",
"(",
")",
".",
"__init__",
"(",
"simplisafe",
",",
"system",
",",
"lock",
".",
"name",
",... | [
42,
4
] | [
46,
25
] | python | en | ['en', 'en', 'it'] | False |
SimpliSafeLock.async_lock | (self, **kwargs: Any) | Lock the lock. | Lock the lock. | async def async_lock(self, **kwargs: Any) -> None:
"""Lock the lock."""
try:
await self._lock.lock()
except SimplipyError as err:
LOGGER.error('Error while locking "%s": %s', self._lock.name, err)
return
self._attr_is_locked = True
self.async_... | [
"async",
"def",
"async_lock",
"(",
"self",
",",
"*",
"*",
"kwargs",
":",
"Any",
")",
"->",
"None",
":",
"try",
":",
"await",
"self",
".",
"_lock",
".",
"lock",
"(",
")",
"except",
"SimplipyError",
"as",
"err",
":",
"LOGGER",
".",
"error",
"(",
"'Er... | [
48,
4
] | [
57,
35
] | python | en | ['en', 'la', 'en'] | True |
SimpliSafeLock.async_unlock | (self, **kwargs: Any) | Unlock the lock. | Unlock the lock. | async def async_unlock(self, **kwargs: Any) -> None:
"""Unlock the lock."""
try:
await self._lock.unlock()
except SimplipyError as err:
LOGGER.error('Error while unlocking "%s": %s', self._lock.name, err)
return
self._attr_is_locked = False
se... | [
"async",
"def",
"async_unlock",
"(",
"self",
",",
"*",
"*",
"kwargs",
":",
"Any",
")",
"->",
"None",
":",
"try",
":",
"await",
"self",
".",
"_lock",
".",
"unlock",
"(",
")",
"except",
"SimplipyError",
"as",
"err",
":",
"LOGGER",
".",
"error",
"(",
... | [
59,
4
] | [
68,
35
] | python | en | ['en', 'ms', 'en'] | True |
SimpliSafeLock.async_update_from_rest_api | (self) | Update the entity with the provided REST API data. | Update the entity with the provided REST API data. | def async_update_from_rest_api(self) -> None:
"""Update the entity with the provided REST API data."""
self._attr_extra_state_attributes.update(
{
ATTR_LOCK_LOW_BATTERY: self._lock.lock_low_battery,
ATTR_PIN_PAD_LOW_BATTERY: self._lock.pin_pad_low_battery,
... | [
"def",
"async_update_from_rest_api",
"(",
"self",
")",
"->",
"None",
":",
"self",
".",
"_attr_extra_state_attributes",
".",
"update",
"(",
"{",
"ATTR_LOCK_LOW_BATTERY",
":",
"self",
".",
"_lock",
".",
"lock_low_battery",
",",
"ATTR_PIN_PAD_LOW_BATTERY",
":",
"self",... | [
71,
4
] | [
81,
68
] | python | en | ['en', 'en', 'en'] | True |
setup_platform | (hass, config, add_entities, discovery_info=None) | Set up the sensor platform. | Set up the sensor platform. | def setup_platform(hass, config, add_entities, discovery_info=None):
"""Set up the sensor platform."""
i2c_address = config.get(CONF_I2C_ADDRESS)
sensor = SHT31(address=i2c_address)
try:
if sensor.read_status() is None:
raise ValueError("CRC error while reading SHT31 status")
e... | [
"def",
"setup_platform",
"(",
"hass",
",",
"config",
",",
"add_entities",
",",
"discovery_info",
"=",
"None",
")",
":",
"i2c_address",
"=",
"config",
".",
"get",
"(",
"CONF_I2C_ADDRESS",
")",
"sensor",
"=",
"SHT31",
"(",
"address",
"=",
"i2c_address",
")",
... | [
46,
0
] | [
70,
22
] | python | en | ['en', 'da', 'en'] | True |
SHTClient.__init__ | (self, adafruit_sht) | Initialize the sensor. | Initialize the sensor. | def __init__(self, adafruit_sht):
"""Initialize the sensor."""
self.adafruit_sht = adafruit_sht
self.temperature = None
self.humidity = None | [
"def",
"__init__",
"(",
"self",
",",
"adafruit_sht",
")",
":",
"self",
".",
"adafruit_sht",
"=",
"adafruit_sht",
"self",
".",
"temperature",
"=",
"None",
"self",
".",
"humidity",
"=",
"None"
] | [
76,
4
] | [
80,
28
] | python | en | ['en', 'en', 'en'] | True |
SHTClient.update | (self) | Get the latest data from the SHT sensor. | Get the latest data from the SHT sensor. | def update(self):
"""Get the latest data from the SHT sensor."""
temperature, humidity = self.adafruit_sht.read_temperature_humidity()
if math.isnan(temperature) or math.isnan(humidity):
_LOGGER.warning("Bad sample from sensor SHT31")
return
self.temperature = tem... | [
"def",
"update",
"(",
"self",
")",
":",
"temperature",
",",
"humidity",
"=",
"self",
".",
"adafruit_sht",
".",
"read_temperature_humidity",
"(",
")",
"if",
"math",
".",
"isnan",
"(",
"temperature",
")",
"or",
"math",
".",
"isnan",
"(",
"humidity",
")",
"... | [
83,
4
] | [
90,
32
] | python | en | ['en', 'en', 'en'] | True |
SHTSensor.__init__ | (self, sensor, name) | Initialize the sensor. | Initialize the sensor. | def __init__(self, sensor, name):
"""Initialize the sensor."""
self._sensor = sensor
self._name = name
self._state = None | [
"def",
"__init__",
"(",
"self",
",",
"sensor",
",",
"name",
")",
":",
"self",
".",
"_sensor",
"=",
"sensor",
"self",
".",
"_name",
"=",
"name",
"self",
".",
"_state",
"=",
"None"
] | [
96,
4
] | [
100,
26
] | python | en | ['en', 'en', 'en'] | True |
SHTSensor.name | (self) | Return the name of the sensor. | Return the name of the sensor. | def name(self):
"""Return the name of the sensor."""
return self._name | [
"def",
"name",
"(",
"self",
")",
":",
"return",
"self",
".",
"_name"
] | [
103,
4
] | [
105,
25
] | python | en | ['en', 'mi', 'en'] | True |
SHTSensor.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 self._state | [
"def",
"native_value",
"(",
"self",
")",
":",
"return",
"self",
".",
"_state"
] | [
108,
4
] | [
110,
26
] | python | en | ['en', 'en', 'en'] | True |
SHTSensor.update | (self) | Fetch temperature and humidity from the sensor. | Fetch temperature and humidity from the sensor. | def update(self):
"""Fetch temperature and humidity from the sensor."""
self._sensor.update() | [
"def",
"update",
"(",
"self",
")",
":",
"self",
".",
"_sensor",
".",
"update",
"(",
")"
] | [
112,
4
] | [
114,
29
] | python | en | ['en', 'en', 'en'] | True |
SHTSensorTemperature.update | (self) | Fetch temperature from the sensor. | Fetch temperature from the sensor. | def update(self):
"""Fetch temperature from the sensor."""
super().update()
self._state = self._sensor.temperature | [
"def",
"update",
"(",
"self",
")",
":",
"super",
"(",
")",
".",
"update",
"(",
")",
"self",
".",
"_state",
"=",
"self",
".",
"_sensor",
".",
"temperature"
] | [
123,
4
] | [
126,
46
] | python | en | ['en', 'en', 'en'] | True |
SHTSensorHumidity.native_unit_of_measurement | (self) | Return the unit of measurement. | Return the unit of measurement. | def native_unit_of_measurement(self):
"""Return the unit of measurement."""
return PERCENTAGE | [
"def",
"native_unit_of_measurement",
"(",
"self",
")",
":",
"return",
"PERCENTAGE"
] | [
133,
4
] | [
135,
25
] | python | en | ['en', 'la', 'en'] | True |
SHTSensorHumidity.update | (self) | Fetch humidity from the sensor. | Fetch humidity from the sensor. | def update(self):
"""Fetch humidity from the sensor."""
super().update()
humidity = self._sensor.humidity
if humidity is not None:
self._state = round(humidity) | [
"def",
"update",
"(",
"self",
")",
":",
"super",
"(",
")",
".",
"update",
"(",
")",
"humidity",
"=",
"self",
".",
"_sensor",
".",
"humidity",
"if",
"humidity",
"is",
"not",
"None",
":",
"self",
".",
"_state",
"=",
"round",
"(",
"humidity",
")"
] | [
137,
4
] | [
142,
41
] | python | en | ['en', 'en', 'en'] | True |
async_setup_entry | (hass, config_entry, async_add_entities) | Set up the Transmission sensors. | Set up the Transmission sensors. | async def async_setup_entry(hass, config_entry, async_add_entities):
"""Set up the Transmission sensors."""
tm_client = hass.data[DOMAIN][config_entry.entry_id]
name = config_entry.data[CONF_NAME]
dev = [
TransmissionSpeedSensor(tm_client, name, "Down Speed", "download"),
TransmissionS... | [
"async",
"def",
"async_setup_entry",
"(",
"hass",
",",
"config_entry",
",",
"async_add_entities",
")",
":",
"tm_client",
"=",
"hass",
".",
"data",
"[",
"DOMAIN",
"]",
"[",
"config_entry",
".",
"entry_id",
"]",
"name",
"=",
"config_entry",
".",
"data",
"[",
... | [
22,
0
] | [
39,
33
] | python | en | ['en', 'da', 'en'] | True |
TransmissionSensor.__init__ | (self, tm_client, client_name, sensor_name, sub_type=None) | Initialize the sensor. | Initialize the sensor. | def __init__(self, tm_client, client_name, sensor_name, sub_type=None):
"""Initialize the sensor."""
self._tm_client: TransmissionClient = tm_client
self._client_name = client_name
self._name = sensor_name
self._sub_type = sub_type
self._state = None | [
"def",
"__init__",
"(",
"self",
",",
"tm_client",
",",
"client_name",
",",
"sensor_name",
",",
"sub_type",
"=",
"None",
")",
":",
"self",
".",
"_tm_client",
":",
"TransmissionClient",
"=",
"tm_client",
"self",
".",
"_client_name",
"=",
"client_name",
"self",
... | [
45,
4
] | [
51,
26
] | python | en | ['en', 'en', 'en'] | True |
TransmissionSensor.name | (self) | Return the name of the sensor. | Return the name of the sensor. | def name(self):
"""Return the name of the sensor."""
return f"{self._client_name} {self._name}" | [
"def",
"name",
"(",
"self",
")",
":",
"return",
"f\"{self._client_name} {self._name}\""
] | [
54,
4
] | [
56,
50
] | python | en | ['en', 'mi', 'en'] | True |
TransmissionSensor.unique_id | (self) | Return the unique id of the entity. | Return the unique id of the entity. | def unique_id(self):
"""Return the unique id of the entity."""
return f"{self._tm_client.api.host}-{self.name}" | [
"def",
"unique_id",
"(",
"self",
")",
":",
"return",
"f\"{self._tm_client.api.host}-{self.name}\""
] | [
59,
4
] | [
61,
56
] | python | en | ['en', 'en', 'en'] | True |
TransmissionSensor.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 self._state | [
"def",
"native_value",
"(",
"self",
")",
":",
"return",
"self",
".",
"_state"
] | [
64,
4
] | [
66,
26
] | python | en | ['en', 'en', 'en'] | True |
TransmissionSensor.should_poll | (self) | Return the polling requirement for this sensor. | Return the polling requirement for this sensor. | def should_poll(self):
"""Return the polling requirement for this sensor."""
return False | [
"def",
"should_poll",
"(",
"self",
")",
":",
"return",
"False"
] | [
69,
4
] | [
71,
20
] | python | en | ['en', 'en', 'en'] | True |
TransmissionSensor.available | (self) | Could the device be accessed during the last update call. | Could the device be accessed during the last update call. | def available(self):
"""Could the device be accessed during the last update call."""
return self._tm_client.api.available | [
"def",
"available",
"(",
"self",
")",
":",
"return",
"self",
".",
"_tm_client",
".",
"api",
".",
"available"
] | [
74,
4
] | [
76,
44
] | python | en | ['en', 'en', 'en'] | True |
TransmissionSensor.async_added_to_hass | (self) | Handle entity which will be added. | Handle entity which will be added. | async def async_added_to_hass(self):
"""Handle entity which will be added."""
@callback
def update():
"""Update the state."""
self.async_schedule_update_ha_state(True)
self.async_on_remove(
async_dispatcher_connect(
self.hass, self._t... | [
"async",
"def",
"async_added_to_hass",
"(",
"self",
")",
":",
"@",
"callback",
"def",
"update",
"(",
")",
":",
"\"\"\"Update the state.\"\"\"",
"self",
".",
"async_schedule_update_ha_state",
"(",
"True",
")",
"self",
".",
"async_on_remove",
"(",
"async_dispatcher_co... | [
78,
4
] | [
90,
9
] | python | en | ['en', 'en', 'en'] | True |
TransmissionSpeedSensor.native_unit_of_measurement | (self) | Return the unit of measurement of this entity, if any. | Return the unit of measurement of this entity, if any. | def native_unit_of_measurement(self):
"""Return the unit of measurement of this entity, if any."""
return DATA_RATE_MEGABYTES_PER_SECOND | [
"def",
"native_unit_of_measurement",
"(",
"self",
")",
":",
"return",
"DATA_RATE_MEGABYTES_PER_SECOND"
] | [
97,
4
] | [
99,
45
] | python | en | ['en', 'en', 'en'] | True |
TransmissionSpeedSensor.update | (self) | Get the latest data from Transmission and updates the state. | Get the latest data from Transmission and updates the state. | def update(self):
"""Get the latest data from Transmission and updates the state."""
data = self._tm_client.api.data
if data:
mb_spd = (
float(data.downloadSpeed)
if self._sub_type == "download"
else float(data.uploadSpeed)
... | [
"def",
"update",
"(",
"self",
")",
":",
"data",
"=",
"self",
".",
"_tm_client",
".",
"api",
".",
"data",
"if",
"data",
":",
"mb_spd",
"=",
"(",
"float",
"(",
"data",
".",
"downloadSpeed",
")",
"if",
"self",
".",
"_sub_type",
"==",
"\"download\"",
"el... | [
101,
4
] | [
111,
65
] | python | en | ['en', 'en', 'en'] | True |
TransmissionStatusSensor.update | (self) | Get the latest data from Transmission and updates the state. | Get the latest data from Transmission and updates the state. | def update(self):
"""Get the latest data from Transmission and updates the state."""
data = self._tm_client.api.data
if data:
upload = data.uploadSpeed
download = data.downloadSpeed
if upload > 0 and download > 0:
self._state = "Up/Down"
... | [
"def",
"update",
"(",
"self",
")",
":",
"data",
"=",
"self",
".",
"_tm_client",
".",
"api",
".",
"data",
"if",
"data",
":",
"upload",
"=",
"data",
".",
"uploadSpeed",
"download",
"=",
"data",
".",
"downloadSpeed",
"if",
"upload",
">",
"0",
"and",
"do... | [
117,
4
] | [
132,
30
] | python | en | ['en', 'en', 'en'] | True |
TransmissionTorrentsSensor.native_unit_of_measurement | (self) | Return the unit of measurement of this entity, if any. | Return the unit of measurement of this entity, if any. | def native_unit_of_measurement(self):
"""Return the unit of measurement of this entity, if any."""
return "Torrents" | [
"def",
"native_unit_of_measurement",
"(",
"self",
")",
":",
"return",
"\"Torrents\""
] | [
147,
4
] | [
149,
25
] | python | en | ['en', 'en', 'en'] | True |
TransmissionTorrentsSensor.extra_state_attributes | (self) | Return the state attributes, if any. | Return the state attributes, if any. | def extra_state_attributes(self):
"""Return the state attributes, if any."""
info = _torrents_info(
torrents=self._tm_client.api.torrents,
order=self._tm_client.config_entry.options[CONF_ORDER],
limit=self._tm_client.config_entry.options[CONF_LIMIT],
statu... | [
"def",
"extra_state_attributes",
"(",
"self",
")",
":",
"info",
"=",
"_torrents_info",
"(",
"torrents",
"=",
"self",
".",
"_tm_client",
".",
"api",
".",
"torrents",
",",
"order",
"=",
"self",
".",
"_tm_client",
".",
"config_entry",
".",
"options",
"[",
"CO... | [
152,
4
] | [
162,
9
] | python | en | ['en', 'en', 'en'] | True |
TransmissionTorrentsSensor.update | (self) | Get the latest data from Transmission and updates the state. | Get the latest data from Transmission and updates the state. | def update(self):
"""Get the latest data from Transmission and updates the state."""
torrents = _filter_torrents(
self._tm_client.api.torrents, statuses=self.SUBTYPE_MODES[self._sub_type]
)
self._state = len(torrents) | [
"def",
"update",
"(",
"self",
")",
":",
"torrents",
"=",
"_filter_torrents",
"(",
"self",
".",
"_tm_client",
".",
"api",
".",
"torrents",
",",
"statuses",
"=",
"self",
".",
"SUBTYPE_MODES",
"[",
"self",
".",
"_sub_type",
"]",
")",
"self",
".",
"_state",
... | [
164,
4
] | [
169,
35
] | 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",
"}"
] | [
64,
4
] | [
76,
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... | [
100,
4
] | [
168,
46
] | python | en | ['en', 'en', 'en'] | True |
async_condition_from_config | (
config: ConfigType, config_validation: bool
) | Evaluate state based on configuration. | Evaluate state based on configuration. | def async_condition_from_config(
config: ConfigType, config_validation: bool
) -> ConditionCheckerType:
"""Evaluate state based on configuration."""
if config_validation:
config = CONDITION_SCHEMA(config)
return toggle_entity.async_condition_from_config(config) | [
"def",
"async_condition_from_config",
"(",
"config",
":",
"ConfigType",
",",
"config_validation",
":",
"bool",
")",
"->",
"ConditionCheckerType",
":",
"if",
"config_validation",
":",
"config",
"=",
"CONDITION_SCHEMA",
"(",
"config",
")",
"return",
"toggle_entity",
"... | [
21,
0
] | [
27,
60
] | python | en | ['en', 'en', 'en'] | True |
async_get_conditions | (
hass: HomeAssistant, device_id: str
) | List device conditions. | List device conditions. | async def async_get_conditions(
hass: HomeAssistant, device_id: str
) -> list[dict[str, str]]:
"""List device conditions."""
return await toggle_entity.async_get_conditions(hass, device_id, DOMAIN) | [
"async",
"def",
"async_get_conditions",
"(",
"hass",
":",
"HomeAssistant",
",",
"device_id",
":",
"str",
")",
"->",
"list",
"[",
"dict",
"[",
"str",
",",
"str",
"]",
"]",
":",
"return",
"await",
"toggle_entity",
".",
"async_get_conditions",
"(",
"hass",
",... | [
30,
0
] | [
34,
76
] | python | en | ['fr', 'en', 'en'] | True |
async_get_condition_capabilities | (
hass: HomeAssistant, config: ConfigType
) | List condition capabilities. | List condition capabilities. | async def async_get_condition_capabilities(
hass: HomeAssistant, config: ConfigType
) -> dict[str, vol.Schema]:
"""List condition capabilities."""
return await toggle_entity.async_get_condition_capabilities(hass, config) | [
"async",
"def",
"async_get_condition_capabilities",
"(",
"hass",
":",
"HomeAssistant",
",",
"config",
":",
"ConfigType",
")",
"->",
"dict",
"[",
"str",
",",
"vol",
".",
"Schema",
"]",
":",
"return",
"await",
"toggle_entity",
".",
"async_get_condition_capabilities"... | [
37,
0
] | [
41,
77
] | python | en | ['ro', 'sr', 'en'] | False |
_cf_data_from_bytes | (bytestring) |
Given a bytestring, create a CFData object from it. This CFData object must
be CFReleased by the caller.
|
Given a bytestring, create a CFData object from it. This CFData object must
be CFReleased by the caller.
| def _cf_data_from_bytes(bytestring):
"""
Given a bytestring, create a CFData object from it. This CFData object must
be CFReleased by the caller.
"""
return CoreFoundation.CFDataCreate(
CoreFoundation.kCFAllocatorDefault, bytestring, len(bytestring)
) | [
"def",
"_cf_data_from_bytes",
"(",
"bytestring",
")",
":",
"return",
"CoreFoundation",
".",
"CFDataCreate",
"(",
"CoreFoundation",
".",
"kCFAllocatorDefault",
",",
"bytestring",
",",
"len",
"(",
"bytestring",
")",
")"
] | [
26,
0
] | [
33,
5
] | python | en | ['en', 'error', 'th'] | False |
_cf_dictionary_from_tuples | (tuples) |
Given a list of Python tuples, create an associated CFDictionary.
|
Given a list of Python tuples, create an associated CFDictionary.
| def _cf_dictionary_from_tuples(tuples):
"""
Given a list of Python tuples, create an associated CFDictionary.
"""
dictionary_size = len(tuples)
# We need to get the dictionary keys and values out in the same order.
keys = (t[0] for t in tuples)
values = (t[1] for t in tuples)
cf_keys = ... | [
"def",
"_cf_dictionary_from_tuples",
"(",
"tuples",
")",
":",
"dictionary_size",
"=",
"len",
"(",
"tuples",
")",
"# We need to get the dictionary keys and values out in the same order.",
"keys",
"=",
"(",
"t",
"[",
"0",
"]",
"for",
"t",
"in",
"tuples",
")",
"values"... | [
36,
0
] | [
55,
5
] | python | en | ['en', 'error', 'th'] | False |
_cf_string_to_unicode | (value) |
Creates a Unicode string from a CFString object. Used entirely for error
reporting.
Yes, it annoys me quite a lot that this function is this complex.
|
Creates a Unicode string from a CFString object. Used entirely for error
reporting. | def _cf_string_to_unicode(value):
"""
Creates a Unicode string from a CFString object. Used entirely for error
reporting.
Yes, it annoys me quite a lot that this function is this complex.
"""
value_as_void_p = ctypes.cast(value, ctypes.POINTER(ctypes.c_void_p))
string = CoreFoundation.CFSt... | [
"def",
"_cf_string_to_unicode",
"(",
"value",
")",
":",
"value_as_void_p",
"=",
"ctypes",
".",
"cast",
"(",
"value",
",",
"ctypes",
".",
"POINTER",
"(",
"ctypes",
".",
"c_void_p",
")",
")",
"string",
"=",
"CoreFoundation",
".",
"CFStringGetCStringPtr",
"(",
... | [
58,
0
] | [
80,
17
] | python | en | ['en', 'error', 'th'] | False |
_assert_no_error | (error, exception_class=None) |
Checks the return code and throws an exception if there is an error to
report
|
Checks the return code and throws an exception if there is an error to
report
| def _assert_no_error(error, exception_class=None):
"""
Checks the return code and throws an exception if there is an error to
report
"""
if error == 0:
return
cf_error_string = Security.SecCopyErrorMessageString(error, None)
output = _cf_string_to_unicode(cf_error_string)
CoreFo... | [
"def",
"_assert_no_error",
"(",
"error",
",",
"exception_class",
"=",
"None",
")",
":",
"if",
"error",
"==",
"0",
":",
"return",
"cf_error_string",
"=",
"Security",
".",
"SecCopyErrorMessageString",
"(",
"error",
",",
"None",
")",
"output",
"=",
"_cf_string_to... | [
83,
0
] | [
101,
33
] | python | en | ['en', 'error', 'th'] | False |
_cert_array_from_pem | (pem_bundle) |
Given a bundle of certs in PEM format, turns them into a CFArray of certs
that can be used to validate a cert chain.
|
Given a bundle of certs in PEM format, turns them into a CFArray of certs
that can be used to validate a cert chain.
| def _cert_array_from_pem(pem_bundle):
"""
Given a bundle of certs in PEM format, turns them into a CFArray of certs
that can be used to validate a cert chain.
"""
# Normalize the PEM bundle's line endings.
pem_bundle = pem_bundle.replace(b"\r\n", b"\n")
der_certs = [
base64.b64decod... | [
"def",
"_cert_array_from_pem",
"(",
"pem_bundle",
")",
":",
"# Normalize the PEM bundle's line endings.",
"pem_bundle",
"=",
"pem_bundle",
".",
"replace",
"(",
"b\"\\r\\n\"",
",",
"b\"\\n\"",
")",
"der_certs",
"=",
"[",
"base64",
".",
"b64decode",
"(",
"match",
".",... | [
104,
0
] | [
146,
21
] | python | en | ['en', 'error', 'th'] | False |
_is_cert | (item) |
Returns True if a given CFTypeRef is a certificate.
|
Returns True if a given CFTypeRef is a certificate.
| def _is_cert(item):
"""
Returns True if a given CFTypeRef is a certificate.
"""
expected = Security.SecCertificateGetTypeID()
return CoreFoundation.CFGetTypeID(item) == expected | [
"def",
"_is_cert",
"(",
"item",
")",
":",
"expected",
"=",
"Security",
".",
"SecCertificateGetTypeID",
"(",
")",
"return",
"CoreFoundation",
".",
"CFGetTypeID",
"(",
"item",
")",
"==",
"expected"
] | [
149,
0
] | [
154,
55
] | python | en | ['en', 'error', 'th'] | False |
_is_identity | (item) |
Returns True if a given CFTypeRef is an identity.
|
Returns True if a given CFTypeRef is an identity.
| def _is_identity(item):
"""
Returns True if a given CFTypeRef is an identity.
"""
expected = Security.SecIdentityGetTypeID()
return CoreFoundation.CFGetTypeID(item) == expected | [
"def",
"_is_identity",
"(",
"item",
")",
":",
"expected",
"=",
"Security",
".",
"SecIdentityGetTypeID",
"(",
")",
"return",
"CoreFoundation",
".",
"CFGetTypeID",
"(",
"item",
")",
"==",
"expected"
] | [
157,
0
] | [
162,
55
] | python | en | ['en', 'error', 'th'] | False |
_temporary_keychain | () |
This function creates a temporary Mac keychain that we can use to work with
credentials. This keychain uses a one-time password and a temporary file to
store the data. We expect to have one keychain per socket. The returned
SecKeychainRef must be freed by the caller, including calling
SecKeychainDe... |
This function creates a temporary Mac keychain that we can use to work with
credentials. This keychain uses a one-time password and a temporary file to
store the data. We expect to have one keychain per socket. The returned
SecKeychainRef must be freed by the caller, including calling
SecKeychainDe... | def _temporary_keychain():
"""
This function creates a temporary Mac keychain that we can use to work with
credentials. This keychain uses a one-time password and a temporary file to
store the data. We expect to have one keychain per socket. The returned
SecKeychainRef must be freed by the caller, i... | [
"def",
"_temporary_keychain",
"(",
")",
":",
"# Unfortunately, SecKeychainCreate requires a path to a keychain. This",
"# means we cannot use mkstemp to use a generic temporary file. Instead,",
"# we're going to create a temporary directory and a filename to use there.",
"# This filename will be 8 r... | [
165,
0
] | [
197,
34
] | python | en | ['en', 'error', 'th'] | False |
_load_items_from_file | (keychain, path) |
Given a single file, loads all the trust objects from it into arrays and
the keychain.
Returns a tuple of lists: the first list is a list of identities, the
second a list of certs.
|
Given a single file, loads all the trust objects from it into arrays and
the keychain.
Returns a tuple of lists: the first list is a list of identities, the
second a list of certs.
| def _load_items_from_file(keychain, path):
"""
Given a single file, loads all the trust objects from it into arrays and
the keychain.
Returns a tuple of lists: the first list is a list of identities, the
second a list of certs.
"""
certificates = []
identities = []
result_array = Non... | [
"def",
"_load_items_from_file",
"(",
"keychain",
",",
"path",
")",
":",
"certificates",
"=",
"[",
"]",
"identities",
"=",
"[",
"]",
"result_array",
"=",
"None",
"with",
"open",
"(",
"path",
",",
"\"rb\"",
")",
"as",
"f",
":",
"raw_filedata",
"=",
"f",
... | [
200,
0
] | [
252,
37
] | python | en | ['en', 'error', 'th'] | False |
_load_client_cert_chain | (keychain, *paths) |
Load certificates and maybe keys from a number of files. Has the end goal
of returning a CFArray containing one SecIdentityRef, and then zero or more
SecCertificateRef objects, suitable for use as a client certificate trust
chain.
|
Load certificates and maybe keys from a number of files. Has the end goal
of returning a CFArray containing one SecIdentityRef, and then zero or more
SecCertificateRef objects, suitable for use as a client certificate trust
chain.
| def _load_client_cert_chain(keychain, *paths):
"""
Load certificates and maybe keys from a number of files. Has the end goal
of returning a CFArray containing one SecIdentityRef, and then zero or more
SecCertificateRef objects, suitable for use as a client certificate trust
chain.
"""
# Ok, ... | [
"def",
"_load_client_cert_chain",
"(",
"keychain",
",",
"*",
"paths",
")",
":",
"# Ok, the strategy.",
"#",
"# This relies on knowing that macOS will not give you a SecIdentityRef",
"# unless you have imported a key into a keychain. This is a somewhat",
"# artificial limitation of macOS (f... | [
255,
0
] | [
327,
41
] | python | en | ['en', 'error', 'th'] | False |
async_setup_platform | (
hass: HomeAssistant,
config: ConfigType,
async_add_entities: AddEntitiesCallback,
discovery_info: DiscoveryInfoType | None = None,
) | Set up a sensor for an Amcrest IP Camera. | Set up a sensor for an Amcrest IP Camera. | async def async_setup_platform(
hass: HomeAssistant,
config: ConfigType,
async_add_entities: AddEntitiesCallback,
discovery_info: DiscoveryInfoType | None = None,
) -> None:
"""Set up a sensor for an Amcrest IP Camera."""
if discovery_info is None:
return
name = discovery_info[CONF_... | [
"async",
"def",
"async_setup_platform",
"(",
"hass",
":",
"HomeAssistant",
",",
"config",
":",
"ConfigType",
",",
"async_add_entities",
":",
"AddEntitiesCallback",
",",
"discovery_info",
":",
"DiscoveryInfoType",
"|",
"None",
"=",
"None",
",",
")",
"->",
"None",
... | [
46,
0
] | [
66,
5
] | python | en | ['en', 'da', 'en'] | True |
AmcrestSensor.__init__ | (
self, name: str, device: AmcrestDevice, description: SensorEntityDescription
) | Initialize a sensor for Amcrest camera. | Initialize a sensor for Amcrest camera. | def __init__(
self, name: str, device: AmcrestDevice, description: SensorEntityDescription
) -> None:
"""Initialize a sensor for Amcrest camera."""
self.entity_description = description
self._signal_name = name
self._api = device.api
self._unsub_dispatcher: Callable[[... | [
"def",
"__init__",
"(",
"self",
",",
"name",
":",
"str",
",",
"device",
":",
"AmcrestDevice",
",",
"description",
":",
"SensorEntityDescription",
")",
"->",
"None",
":",
"self",
".",
"entity_description",
"=",
"description",
"self",
".",
"_signal_name",
"=",
... | [
72,
4
] | [
82,
46
] | python | en | ['en', 'pt', 'en'] | True |
AmcrestSensor.available | (self) | Return True if entity is available. | Return True if entity is available. | def available(self) -> bool:
"""Return True if entity is available."""
return self._api.available | [
"def",
"available",
"(",
"self",
")",
"->",
"bool",
":",
"return",
"self",
".",
"_api",
".",
"available"
] | [
85,
4
] | [
87,
34
] | python | en | ['en', 'en', 'en'] | True |
AmcrestSensor.update | (self) | Get the latest data and updates the state. | Get the latest data and updates the state. | def update(self) -> None:
"""Get the latest data and updates the state."""
if not self.available:
return
_LOGGER.debug("Updating %s sensor", self.name)
sensor_type = self.entity_description.key
try:
if sensor_type == SENSOR_PTZ_PRESET:
sel... | [
"def",
"update",
"(",
"self",
")",
"->",
"None",
":",
"if",
"not",
"self",
".",
"available",
":",
"return",
"_LOGGER",
".",
"debug",
"(",
"\"Updating %s sensor\"",
",",
"self",
".",
"name",
")",
"sensor_type",
"=",
"self",
".",
"entity_description",
".",
... | [
89,
4
] | [
123,
75
] | python | en | ['en', 'en', 'en'] | True |
AmcrestSensor.async_on_demand_update | (self) | Update state. | Update state. | async def async_on_demand_update(self) -> None:
"""Update state."""
self.async_schedule_update_ha_state(True) | [
"async",
"def",
"async_on_demand_update",
"(",
"self",
")",
"->",
"None",
":",
"self",
".",
"async_schedule_update_ha_state",
"(",
"True",
")"
] | [
125,
4
] | [
127,
49
] | python | en | ['en', 'co', 'en'] | False |
AmcrestSensor.async_added_to_hass | (self) | Subscribe to update signal. | Subscribe to update signal. | async def async_added_to_hass(self) -> None:
"""Subscribe to update signal."""
self._unsub_dispatcher = async_dispatcher_connect(
self.hass,
service_signal(SERVICE_UPDATE, self._signal_name),
self.async_on_demand_update,
) | [
"async",
"def",
"async_added_to_hass",
"(",
"self",
")",
"->",
"None",
":",
"self",
".",
"_unsub_dispatcher",
"=",
"async_dispatcher_connect",
"(",
"self",
".",
"hass",
",",
"service_signal",
"(",
"SERVICE_UPDATE",
",",
"self",
".",
"_signal_name",
")",
",",
"... | [
129,
4
] | [
135,
9
] | python | en | ['en', 'en', 'en'] | True |
AmcrestSensor.async_will_remove_from_hass | (self) | Disconnect from update signal. | Disconnect from update signal. | async def async_will_remove_from_hass(self) -> None:
"""Disconnect from update signal."""
assert self._unsub_dispatcher is not None
self._unsub_dispatcher() | [
"async",
"def",
"async_will_remove_from_hass",
"(",
"self",
")",
"->",
"None",
":",
"assert",
"self",
".",
"_unsub_dispatcher",
"is",
"not",
"None",
"self",
".",
"_unsub_dispatcher",
"(",
")"
] | [
137,
4
] | [
140,
32
] | python | en | ['en', 'en', 'en'] | True |
validate_projector | (
hass: HomeAssistant, host, check_power=True, check_powered_on=True
) | Validate the given projector host allows us to connect. | Validate the given projector host allows us to connect. | async def validate_projector(
hass: HomeAssistant, host, check_power=True, check_powered_on=True
):
"""Validate the given projector host allows us to connect."""
epson_proj = Projector(
host=host,
websession=async_get_clientsession(hass, verify_ssl=False),
type=HTTP,
)
if che... | [
"async",
"def",
"validate_projector",
"(",
"hass",
":",
"HomeAssistant",
",",
"host",
",",
"check_power",
"=",
"True",
",",
"check_powered_on",
"=",
"True",
")",
":",
"epson_proj",
"=",
"Projector",
"(",
"host",
"=",
"host",
",",
"websession",
"=",
"async_ge... | [
23,
0
] | [
40,
21
] | python | en | ['en', 'en', 'en'] | True |
async_setup_entry | (hass: HomeAssistant, entry: ConfigEntry) | Set up epson from a config entry. | Set up epson from a config entry. | async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
"""Set up epson from a config entry."""
projector = await validate_projector(
hass=hass,
host=entry.data[CONF_HOST],
check_power=False,
check_powered_on=False,
)
hass.data.setdefault(DOMAIN, {})... | [
"async",
"def",
"async_setup_entry",
"(",
"hass",
":",
"HomeAssistant",
",",
"entry",
":",
"ConfigEntry",
")",
"->",
"bool",
":",
"projector",
"=",
"await",
"validate_projector",
"(",
"hass",
"=",
"hass",
",",
"host",
"=",
"entry",
".",
"data",
"[",
"CONF_... | [
43,
0
] | [
55,
15
] | python | en | ['en', 'en', 'en'] | True |
async_unload_entry | (hass: HomeAssistant, entry: ConfigEntry) | Unload a config entry. | Unload a config entry. | async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry):
"""Unload a config entry."""
unload_ok = await hass.config_entries.async_unload_platforms(entry, PLATFORMS)
if unload_ok:
hass.data[DOMAIN].pop(entry.entry_id)
return unload_ok | [
"async",
"def",
"async_unload_entry",
"(",
"hass",
":",
"HomeAssistant",
",",
"entry",
":",
"ConfigEntry",
")",
":",
"unload_ok",
"=",
"await",
"hass",
".",
"config_entries",
".",
"async_unload_platforms",
"(",
"entry",
",",
"PLATFORMS",
")",
"if",
"unload_ok",
... | [
58,
0
] | [
63,
20
] | python | en | ['en', 'es', 'en'] | True |
Pet.__init__ | (self, id=None, category=None, name=None, photo_urls=None, tags=None, status=None) | Pet - a model defined in OpenAPI
:param id: The id of this Pet. # noqa: E501
:type id: int
:param category: The category of this Pet. # noqa: E501
:type category: Category
:param name: The name of this Pet. # noqa: E501
:type name: str
:param photo_urls: The p... | Pet - a model defined in OpenAPI | def __init__(self, id=None, category=None, name=None, photo_urls=None, tags=None, status=None): # noqa: E501
"""Pet - a model defined in OpenAPI
:param id: The id of this Pet. # noqa: E501
:type id: int
:param category: The category of this Pet. # noqa: E501
:type category: C... | [
"def",
"__init__",
"(",
"self",
",",
"id",
"=",
"None",
",",
"category",
"=",
"None",
",",
"name",
"=",
"None",
",",
"photo_urls",
"=",
"None",
",",
"tags",
"=",
"None",
",",
"status",
"=",
"None",
")",
":",
"# noqa: E501",
"self",
".",
"openapi_type... | [
21,
4
] | [
60,
29
] | python | en | ['en', 'en', 'en'] | True |
Pet.from_dict | (cls, dikt) | Returns the dict as a model
:param dikt: A dict.
:type: dict
:return: The Pet of this Pet. # noqa: E501
:rtype: Pet
| Returns the dict as a model | def from_dict(cls, dikt) -> 'Pet':
"""Returns the dict as a model
:param dikt: A dict.
:type: dict
:return: The Pet of this Pet. # noqa: E501
:rtype: Pet
"""
return util.deserialize_model(dikt, cls) | [
"def",
"from_dict",
"(",
"cls",
",",
"dikt",
")",
"->",
"'Pet'",
":",
"return",
"util",
".",
"deserialize_model",
"(",
"dikt",
",",
"cls",
")"
] | [
63,
4
] | [
71,
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"
] | [
74,
4
] | [
81,
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"
] | [
84,
4
] | [
92,
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"
] | [
95,
4
] | [
102,
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"
] | [
105,
4
] | [
113,
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"
] | [
116,
4
] | [
123,
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`") # noqa: E501
self._name = name | [
"def",
"name",
"(",
"self",
",",
"name",
")",
":",
"if",
"name",
"is",
"None",
":",
"raise",
"ValueError",
"(",
"\"Invalid value for `name`, must not be `None`\"",
")",
"# noqa: E501",
"self",
".",
"_name",
"=",
"name"
] | [
126,
4
] | [
136,
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"
] | [
139,
4
] | [
146,
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`") # noqa: E501
... | [
"def",
"photo_urls",
"(",
"self",
",",
"photo_urls",
")",
":",
"if",
"photo_urls",
"is",
"None",
":",
"raise",
"ValueError",
"(",
"\"Invalid value for `photo_urls`, must not be `None`\"",
")",
"# noqa: E501",
"self",
".",
"_photo_urls",
"=",
"photo_urls"
] | [
149,
4
] | [
159,
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"
] | [
162,
4
] | [
169,
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"
] | [
172,
4
] | [
180,
25
] | python | en | ['en', 'en', 'en'] | True |
Pet.status | (self) | Gets the status of this Pet.
pet status in the store # noqa: E501
: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 # noqa: E501
:return: The status of this Pet.
:rtype: str
"""
return self._status | [
"def",
"status",
"(",
"self",
")",
":",
"return",
"self",
".",
"_status"
] | [
183,
4
] | [
191,
27
] | python | en | ['en', 'en', 'en'] | True |
Pet.status | (self, status) | Sets the status of this Pet.
pet status in the store # noqa: E501
: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 # noqa: E501
:param status: The status of this Pet.
:type status: str
"""
allowed_values = ["available", "pending", "sold"] # noqa: E501
if status not in allowed_values:
... | [
"def",
"status",
"(",
"self",
",",
"status",
")",
":",
"allowed_values",
"=",
"[",
"\"available\"",
",",
"\"pending\"",
",",
"\"sold\"",
"]",
"# noqa: E501",
"if",
"status",
"not",
"in",
"allowed_values",
":",
"raise",
"ValueError",
"(",
"\"Invalid value for `st... | [
194,
4
] | [
209,
29
] | python | en | ['en', 'en', 'en'] | True |
_setup | () | The config consists of lines of the form <name> = <value>.
values will hold a mapping from the <name> to value.
Blank lines and lines starting with '#' are ignored. | The config consists of lines of the form <name> = <value>.
values will hold a mapping from the <name> to value.
Blank lines and lines starting with '#' are ignored. | def _setup():
"""The config consists of lines of the form <name> = <value>.
values will hold a mapping from the <name> to value.
Blank lines and lines starting with '#' are ignored."""
global _config_path
paths = [path.expanduser("~/.notoconfig"), "/usr/local/share/noto/config"]
for configfile in p... | [
"def",
"_setup",
"(",
")",
":",
"global",
"_config_path",
"paths",
"=",
"[",
"path",
".",
"expanduser",
"(",
"\"~/.notoconfig\"",
")",
",",
"\"/usr/local/share/noto/config\"",
"]",
"for",
"configfile",
"in",
"paths",
":",
"if",
"path",
".",
"exists",
"(",
"c... | [
52,
0
] | [
69,
17
] | python | en | ['en', 'en', 'en'] | True |
noto_tools | (default="") | Local path to nototools git repo. If this is called, we require config
to be set up. | Local path to nototools git repo. If this is called, we require config
to be set up. | def noto_tools(default=""):
"""Local path to nototools git repo. If this is called, we require config
to be set up."""
result = _values.get("noto_tools", default)
if result:
return result
raise Exception(_ERR_MSG) | [
"def",
"noto_tools",
"(",
"default",
"=",
"\"\"",
")",
":",
"result",
"=",
"_values",
".",
"get",
"(",
"\"noto_tools\"",
",",
"default",
")",
"if",
"result",
":",
"return",
"result",
"raise",
"Exception",
"(",
"_ERR_MSG",
")"
] | [
84,
0
] | [
90,
29
] | python | en | ['en', 'en', 'en'] | True |
noto_fonts | (default="") | Local path to noto-font git repo | Local path to noto-font git repo | def noto_fonts(default=""):
"""Local path to noto-font git repo"""
return _values.get("noto_fonts", default) | [
"def",
"noto_fonts",
"(",
"default",
"=",
"\"\"",
")",
":",
"return",
"_values",
".",
"get",
"(",
"\"noto_fonts\"",
",",
"default",
")"
] | [
93,
0
] | [
95,
45
] | python | it | ['en', 'it', 'it'] | True |
noto_cjk | (default="") | Local path to noto-cjk git repo | Local path to noto-cjk git repo | def noto_cjk(default=""):
"""Local path to noto-cjk git repo"""
return _values.get("noto_cjk", default) | [
"def",
"noto_cjk",
"(",
"default",
"=",
"\"\"",
")",
":",
"return",
"_values",
".",
"get",
"(",
"\"noto_cjk\"",
",",
"default",
")"
] | [
98,
0
] | [
100,
43
] | python | en | ['en', 'it', 'sw'] | False |
noto_emoji | (default="") | Local path to noto-emoji git repo | Local path to noto-emoji git repo | def noto_emoji(default=""):
"""Local path to noto-emoji git repo"""
return _values.get("noto_emoji", default) | [
"def",
"noto_emoji",
"(",
"default",
"=",
"\"\"",
")",
":",
"return",
"_values",
".",
"get",
"(",
"\"noto_emoji\"",
",",
"default",
")"
] | [
103,
0
] | [
105,
45
] | python | it | ['en', 'it', 'it'] | True |
noto_source | (default="") | Local path to noto-source git repo | Local path to noto-source git repo | def noto_source(default=""):
"""Local path to noto-source git repo"""
return _values.get("noto_source", default) | [
"def",
"noto_source",
"(",
"default",
"=",
"\"\"",
")",
":",
"return",
"_values",
".",
"get",
"(",
"\"noto_source\"",
",",
"default",
")"
] | [
108,
0
] | [
110,
46
] | python | it | ['en', 'it', 'it'] | True |
noto_fonts_alpha | (default="") | Local path to noto-fonts-alpha git repo | Local path to noto-fonts-alpha git repo | def noto_fonts_alpha(default=""):
"""Local path to noto-fonts-alpha git repo"""
return _values.get("noto_fonts_alpha", default) | [
"def",
"noto_fonts_alpha",
"(",
"default",
"=",
"\"\"",
")",
":",
"return",
"_values",
".",
"get",
"(",
"\"noto_fonts_alpha\"",
",",
"default",
")"
] | [
113,
0
] | [
115,
51
] | python | en | ['en', 'en', 'en'] | True |
async_setup | (hass: HomeAssistant, config: ConfigType) | Set up the electricity price sensor from configuration.yaml. | Set up the electricity price sensor from configuration.yaml. | async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
"""Set up the electricity price sensor from configuration.yaml."""
for conf in config.get(DOMAIN, []):
hass.async_create_task(
hass.config_entries.flow.async_init(
DOMAIN, data=conf, context={"source": SO... | [
"async",
"def",
"async_setup",
"(",
"hass",
":",
"HomeAssistant",
",",
"config",
":",
"ConfigType",
")",
"->",
"bool",
":",
"for",
"conf",
"in",
"config",
".",
"get",
"(",
"DOMAIN",
",",
"[",
"]",
")",
":",
"hass",
".",
"async_create_task",
"(",
"hass"... | [
44,
0
] | [
53,
15
] | python | en | ['en', 'en', 'en'] | True |
async_setup_entry | (hass: HomeAssistant, entry: ConfigEntry) | Set up pvpc hourly pricing from a config entry. | Set up pvpc hourly pricing from a config entry. | async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
"""Set up pvpc hourly pricing from a config entry."""
if len(entry.data) == 2:
defaults = {
ATTR_TARIFF: _DEFAULT_TARIFF,
ATTR_POWER: DEFAULT_POWER_KW,
ATTR_POWER_P3: DEFAULT_POWER_KW,
... | [
"async",
"def",
"async_setup_entry",
"(",
"hass",
":",
"HomeAssistant",
",",
"entry",
":",
"ConfigEntry",
")",
"->",
"bool",
":",
"if",
"len",
"(",
"entry",
".",
"data",
")",
"==",
"2",
":",
"defaults",
"=",
"{",
"ATTR_TARIFF",
":",
"_DEFAULT_TARIFF",
",... | [
56,
0
] | [
103,
15
] | python | en | ['en', 'en', 'en'] | True |
async_update_options | (hass: HomeAssistant, entry: ConfigEntry) | Handle options update. | Handle options update. | async def async_update_options(hass: HomeAssistant, entry: ConfigEntry) -> None:
"""Handle options update."""
if any(
entry.data.get(attrib) != entry.options.get(attrib)
for attrib in (ATTR_TARIFF, ATTR_POWER, ATTR_POWER_P3)
):
# update entry replacing data with new options
h... | [
"async",
"def",
"async_update_options",
"(",
"hass",
":",
"HomeAssistant",
",",
"entry",
":",
"ConfigEntry",
")",
"->",
"None",
":",
"if",
"any",
"(",
"entry",
".",
"data",
".",
"get",
"(",
"attrib",
")",
"!=",
"entry",
".",
"options",
".",
"get",
"(",... | [
106,
0
] | [
116,
62
] | python | en | ['en', 'nl', 'en'] | True |
async_unload_entry | (hass: HomeAssistant, entry: ConfigEntry) | Unload a config entry. | Unload a config entry. | async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
"""Unload a config entry."""
return await hass.config_entries.async_unload_platforms(entry, PLATFORMS) | [
"async",
"def",
"async_unload_entry",
"(",
"hass",
":",
"HomeAssistant",
",",
"entry",
":",
"ConfigEntry",
")",
"->",
"bool",
":",
"return",
"await",
"hass",
".",
"config_entries",
".",
"async_unload_platforms",
"(",
"entry",
",",
"PLATFORMS",
")"
] | [
119,
0
] | [
121,
77
] | python | en | ['en', 'es', 'en'] | True |
_fixup_find_links | (find_links) | Ensure find-links option end-up being a list of strings. | Ensure find-links option end-up being a list of strings. | def _fixup_find_links(find_links):
"""Ensure find-links option end-up being a list of strings."""
if isinstance(find_links, str):
return find_links.split()
assert isinstance(find_links, (tuple, list))
return find_links | [
"def",
"_fixup_find_links",
"(",
"find_links",
")",
":",
"if",
"isinstance",
"(",
"find_links",
",",
"str",
")",
":",
"return",
"find_links",
".",
"split",
"(",
")",
"assert",
"isinstance",
"(",
"find_links",
",",
"(",
"tuple",
",",
"list",
")",
")",
"re... | [
13,
0
] | [
18,
21
] | python | en | ['en', 'en', 'en'] | True |
_legacy_fetch_build_egg | (dist, req) | Fetch an egg needed for building.
Legacy path using EasyInstall.
| Fetch an egg needed for building. | def _legacy_fetch_build_egg(dist, req):
"""Fetch an egg needed for building.
Legacy path using EasyInstall.
"""
tmp_dist = dist.__class__({'script_args': ['easy_install']})
opts = tmp_dist.get_option_dict('easy_install')
opts.clear()
opts.update(
(k, v)
for k, v in dist.get_... | [
"def",
"_legacy_fetch_build_egg",
"(",
"dist",
",",
"req",
")",
":",
"tmp_dist",
"=",
"dist",
".",
"__class__",
"(",
"{",
"'script_args'",
":",
"[",
"'easy_install'",
"]",
"}",
")",
"opts",
"=",
"tmp_dist",
".",
"get_option_dict",
"(",
"'easy_install'",
")",... | [
21,
0
] | [
50,
32
] | python | en | ['en', 'en', 'en'] | True |
fetch_build_egg | (dist, req) | Fetch an egg needed for building.
Use pip/wheel to fetch/build a wheel. | Fetch an egg needed for building. | def fetch_build_egg(dist, req):
"""Fetch an egg needed for building.
Use pip/wheel to fetch/build a wheel."""
# Check pip is available.
try:
pkg_resources.get_distribution('pip')
except pkg_resources.DistributionNotFound:
dist.announce(
'WARNING: The pip package is not a... | [
"def",
"fetch_build_egg",
"(",
"dist",
",",
"req",
")",
":",
"# Check pip is available.",
"try",
":",
"pkg_resources",
".",
"get_distribution",
"(",
"'pip'",
")",
"except",
"pkg_resources",
".",
"DistributionNotFound",
":",
"dist",
".",
"announce",
"(",
"'WARNING:... | [
53,
0
] | [
135,
19
] | python | en | ['en', 'en', 'en'] | True |
strip_marker | (req) |
Return a new requirement without the environment marker to avoid
calling pip with something like `babel; extra == "i18n"`, which
would always be ignored.
|
Return a new requirement without the environment marker to avoid
calling pip with something like `babel; extra == "i18n"`, which
would always be ignored.
| def strip_marker(req):
"""
Return a new requirement without the environment marker to avoid
calling pip with something like `babel; extra == "i18n"`, which
would always be ignored.
"""
# create a copy to avoid mutating the input
req = pkg_resources.Requirement.parse(str(req))
req.marker ... | [
"def",
"strip_marker",
"(",
"req",
")",
":",
"# create a copy to avoid mutating the input",
"req",
"=",
"pkg_resources",
".",
"Requirement",
".",
"parse",
"(",
"str",
"(",
"req",
")",
")",
"req",
".",
"marker",
"=",
"None",
"return",
"req"
] | [
138,
0
] | [
147,
14
] | python | en | ['en', 'error', 'th'] | False |
setup_platform | (hass, config, add_entities, discovery_info=None) | Set up the GitLab sensor platform. | Set up the GitLab sensor platform. | def setup_platform(hass, config, add_entities, discovery_info=None):
"""Set up the GitLab sensor platform."""
_name = config.get(CONF_NAME)
_interval = config.get(CONF_SCAN_INTERVAL, SCAN_INTERVAL)
_url = config.get(CONF_URL)
_gitlab_data = GitLabData(
priv_token=config[CONF_TOKEN],
... | [
"def",
"setup_platform",
"(",
"hass",
",",
"config",
",",
"add_entities",
",",
"discovery_info",
"=",
"None",
")",
":",
"_name",
"=",
"config",
".",
"get",
"(",
"CONF_NAME",
")",
"_interval",
"=",
"config",
".",
"get",
"(",
"CONF_SCAN_INTERVAL",
",",
"SCAN... | [
51,
0
] | [
64,
59
] | python | en | ['en', 'da', 'en'] | True |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.