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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
BraviaTVConfigFlow.async_step_user | (self, user_input=None) | Handle the initial step. | Handle the initial step. | async def async_step_user(self, user_input=None):
"""Handle the initial step."""
errors = {}
if user_input is not None:
if host_valid(user_input[CONF_HOST]):
self.host = user_input[CONF_HOST]
self.braviarc = BraviaRC(self.host)
return... | [
"async",
"def",
"async_step_user",
"(",
"self",
",",
"user_input",
"=",
"None",
")",
":",
"errors",
"=",
"{",
"}",
"if",
"user_input",
"is",
"not",
"None",
":",
"if",
"host_valid",
"(",
"user_input",
"[",
"CONF_HOST",
"]",
")",
":",
"self",
".",
"host"... | [
100,
4
] | [
117,
9
] | python | en | ['en', 'en', 'en'] | True |
BraviaTVConfigFlow.async_step_authorize | (self, user_input=None) | Get PIN from the Bravia TV device. | Get PIN from the Bravia TV device. | async def async_step_authorize(self, user_input=None):
"""Get PIN from the Bravia TV device."""
errors = {}
if user_input is not None:
try:
await self.init_device(user_input[CONF_PIN])
except CannotConnect:
errors["base"] = "cannot_connect... | [
"async",
"def",
"async_step_authorize",
"(",
"self",
",",
"user_input",
"=",
"None",
")",
":",
"errors",
"=",
"{",
"}",
"if",
"user_input",
"is",
"not",
"None",
":",
"try",
":",
"await",
"self",
".",
"init_device",
"(",
"user_input",
"[",
"CONF_PIN",
"]"... | [
119,
4
] | [
147,
9
] | python | en | ['en', 'en', 'en'] | True |
BraviaTVOptionsFlowHandler.__init__ | (self, config_entry) | Initialize Bravia TV options flow. | Initialize Bravia TV options flow. | def __init__(self, config_entry):
"""Initialize Bravia TV options flow."""
self.braviarc = None
self.config_entry = config_entry
self.pin = config_entry.data[CONF_PIN]
self.ignored_sources = config_entry.options.get(CONF_IGNORED_SOURCES)
self.source_list = [] | [
"def",
"__init__",
"(",
"self",
",",
"config_entry",
")",
":",
"self",
".",
"braviarc",
"=",
"None",
"self",
".",
"config_entry",
"=",
"config_entry",
"self",
".",
"pin",
"=",
"config_entry",
".",
"data",
"[",
"CONF_PIN",
"]",
"self",
".",
"ignored_sources... | [
153,
4
] | [
159,
29
] | python | en | ['en', 'en', 'en'] | True |
BraviaTVOptionsFlowHandler.async_step_init | (self, user_input=None) | Manage the options. | Manage the options. | async def async_step_init(self, user_input=None):
"""Manage the options."""
self.braviarc = self.hass.data[DOMAIN][self.config_entry.entry_id][BRAVIARC]
connected = await self.hass.async_add_executor_job(self.braviarc.is_connected)
if not connected:
await self.hass.async_add_... | [
"async",
"def",
"async_step_init",
"(",
"self",
",",
"user_input",
"=",
"None",
")",
":",
"self",
".",
"braviarc",
"=",
"self",
".",
"hass",
".",
"data",
"[",
"DOMAIN",
"]",
"[",
"self",
".",
"config_entry",
".",
"entry_id",
"]",
"[",
"BRAVIARC",
"]",
... | [
161,
4
] | [
174,
43
] | python | en | ['en', 'en', 'en'] | True |
BraviaTVOptionsFlowHandler.async_step_user | (self, user_input=None) | Handle a flow initialized by the user. | Handle a flow initialized by the user. | async def async_step_user(self, user_input=None):
"""Handle a flow initialized by the user."""
if user_input is not None:
return self.async_create_entry(title="", data=user_input)
return self.async_show_form(
step_id="user",
data_schema=vol.Schema(
... | [
"async",
"def",
"async_step_user",
"(",
"self",
",",
"user_input",
"=",
"None",
")",
":",
"if",
"user_input",
"is",
"not",
"None",
":",
"return",
"self",
".",
"async_create_entry",
"(",
"title",
"=",
"\"\"",
",",
"data",
"=",
"user_input",
")",
"return",
... | [
176,
4
] | [
190,
9
] | python | en | ['en', 'en', 'en'] | True |
async_setup_entry | (hass, config_entry, async_add_entities) | Set up Abode cover devices. | Set up Abode cover devices. | async def async_setup_entry(hass, config_entry, async_add_entities):
"""Set up Abode cover devices."""
data = hass.data[DOMAIN]
entities = []
for device in data.abode.get_devices(generic_type=CONST.TYPE_COVER):
entities.append(AbodeCover(data, device))
async_add_entities(entities) | [
"async",
"def",
"async_setup_entry",
"(",
"hass",
",",
"config_entry",
",",
"async_add_entities",
")",
":",
"data",
"=",
"hass",
".",
"data",
"[",
"DOMAIN",
"]",
"entities",
"=",
"[",
"]",
"for",
"device",
"in",
"data",
".",
"abode",
".",
"get_devices",
... | [
9,
0
] | [
18,
32
] | python | en | ['fr', 'en', 'en'] | True |
AbodeCover.is_closed | (self) | Return true if cover is closed, else False. | Return true if cover is closed, else False. | def is_closed(self):
"""Return true if cover is closed, else False."""
return not self._device.is_open | [
"def",
"is_closed",
"(",
"self",
")",
":",
"return",
"not",
"self",
".",
"_device",
".",
"is_open"
] | [
25,
4
] | [
27,
39
] | python | en | ['en', 'en', 'en'] | True |
AbodeCover.close_cover | (self, **kwargs) | Issue close command to cover. | Issue close command to cover. | def close_cover(self, **kwargs):
"""Issue close command to cover."""
self._device.close_cover() | [
"def",
"close_cover",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"_device",
".",
"close_cover",
"(",
")"
] | [
29,
4
] | [
31,
34
] | python | en | ['en', 'en', 'en'] | True |
AbodeCover.open_cover | (self, **kwargs) | Issue open command to cover. | Issue open command to cover. | def open_cover(self, **kwargs):
"""Issue open command to cover."""
self._device.open_cover() | [
"def",
"open_cover",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"_device",
".",
"open_cover",
"(",
")"
] | [
33,
4
] | [
35,
33
] | python | en | ['en', 'en', 'en'] | True |
async_setup | (hass: HomeAssistant, config: ConfigType) | Set up the WLED components. | Set up the WLED components. | async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
"""Set up the WLED components."""
return True | [
"async",
"def",
"async_setup",
"(",
"hass",
":",
"HomeAssistant",
",",
"config",
":",
"ConfigType",
")",
"->",
"bool",
":",
"return",
"True"
] | [
37,
0
] | [
39,
15
] | python | en | ['en', 'en', 'en'] | True |
async_setup_entry | (hass: HomeAssistant, entry: ConfigEntry) | Set up WLED from a config entry. | Set up WLED from a config entry. | async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
"""Set up WLED from a config entry."""
# Create WLED instance for this entry
coordinator = WLEDDataUpdateCoordinator(hass, host=entry.data[CONF_HOST])
await coordinator.async_refresh()
if not coordinator.last_update_succ... | [
"async",
"def",
"async_setup_entry",
"(",
"hass",
":",
"HomeAssistant",
",",
"entry",
":",
"ConfigEntry",
")",
"->",
"bool",
":",
"# Create WLED instance for this entry",
"coordinator",
"=",
"WLEDDataUpdateCoordinator",
"(",
"hass",
",",
"host",
"=",
"entry",
".",
... | [
42,
0
] | [
67,
15
] | python | en | ['en', 'en', 'en'] | True |
async_unload_entry | (hass: HomeAssistant, entry: ConfigEntry) | Unload WLED config entry. | Unload WLED config entry. | async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
"""Unload WLED config entry."""
# Unload entities for this entry/device.
await asyncio.gather(
*(
hass.config_entries.async_forward_entry_unload(entry, component)
for component in WLED_COMPONENTS
... | [
"async",
"def",
"async_unload_entry",
"(",
"hass",
":",
"HomeAssistant",
",",
"entry",
":",
"ConfigEntry",
")",
"->",
"bool",
":",
"# Unload entities for this entry/device.",
"await",
"asyncio",
".",
"gather",
"(",
"*",
"(",
"hass",
".",
"config_entries",
".",
"... | [
70,
0
] | [
86,
15
] | python | en | ['da', 'en', 'en'] | True |
wled_exception_handler | (func) | Decorate WLED calls to handle WLED exceptions.
A decorator that wraps the passed in function, catches WLED errors,
and handles the availability of the device in the data coordinator.
| Decorate WLED calls to handle WLED exceptions. | def wled_exception_handler(func):
"""Decorate WLED calls to handle WLED exceptions.
A decorator that wraps the passed in function, catches WLED errors,
and handles the availability of the device in the data coordinator.
"""
async def handler(self, *args, **kwargs):
try:
await f... | [
"def",
"wled_exception_handler",
"(",
"func",
")",
":",
"async",
"def",
"handler",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"try",
":",
"await",
"func",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
"self",
... | [
89,
0
] | [
109,
18
] | python | en | ['en', 'en', 'en'] | True |
WLEDDataUpdateCoordinator.__init__ | (
self,
hass: HomeAssistant,
*,
host: str,
) | Initialize global WLED data updater. | Initialize global WLED data updater. | def __init__(
self,
hass: HomeAssistant,
*,
host: str,
):
"""Initialize global WLED data updater."""
self.wled = WLED(host, session=async_get_clientsession(hass))
super().__init__(
hass,
_LOGGER,
name=DOMAIN,
up... | [
"def",
"__init__",
"(",
"self",
",",
"hass",
":",
"HomeAssistant",
",",
"*",
",",
"host",
":",
"str",
",",
")",
":",
"self",
".",
"wled",
"=",
"WLED",
"(",
"host",
",",
"session",
"=",
"async_get_clientsession",
"(",
"hass",
")",
")",
"super",
"(",
... | [
115,
4
] | [
129,
9
] | python | en | ['en', 'en', 'it'] | True |
WLEDDataUpdateCoordinator.update_listeners | (self) | Call update on all listeners. | Call update on all listeners. | def update_listeners(self) -> None:
"""Call update on all listeners."""
for update_callback in self._listeners:
update_callback() | [
"def",
"update_listeners",
"(",
"self",
")",
"->",
"None",
":",
"for",
"update_callback",
"in",
"self",
".",
"_listeners",
":",
"update_callback",
"(",
")"
] | [
131,
4
] | [
134,
29
] | python | en | ['en', 'en', 'en'] | True |
WLEDDataUpdateCoordinator._async_update_data | (self) | Fetch data from WLED. | Fetch data from WLED. | async def _async_update_data(self) -> WLEDDevice:
"""Fetch data from WLED."""
try:
return await self.wled.update(full_update=not self.last_update_success)
except WLEDError as error:
raise UpdateFailed(f"Invalid response from API: {error}") from error | [
"async",
"def",
"_async_update_data",
"(",
"self",
")",
"->",
"WLEDDevice",
":",
"try",
":",
"return",
"await",
"self",
".",
"wled",
".",
"update",
"(",
"full_update",
"=",
"not",
"self",
".",
"last_update_success",
")",
"except",
"WLEDError",
"as",
"error",... | [
136,
4
] | [
141,
80
] | python | en | ['en', 'en', 'en'] | True |
WLEDEntity.__init__ | (
self,
*,
entry_id: str,
coordinator: WLEDDataUpdateCoordinator,
name: str,
icon: str,
enabled_default: bool = True,
) | Initialize the WLED entity. | Initialize the WLED entity. | def __init__(
self,
*,
entry_id: str,
coordinator: WLEDDataUpdateCoordinator,
name: str,
icon: str,
enabled_default: bool = True,
) -> None:
"""Initialize the WLED entity."""
super().__init__(coordinator)
self._enabled_default = enabled... | [
"def",
"__init__",
"(",
"self",
",",
"*",
",",
"entry_id",
":",
"str",
",",
"coordinator",
":",
"WLEDDataUpdateCoordinator",
",",
"name",
":",
"str",
",",
"icon",
":",
"str",
",",
"enabled_default",
":",
"bool",
"=",
"True",
",",
")",
"->",
"None",
":"... | [
147,
4
] | [
162,
37
] | python | en | ['en', 'en', 'en'] | True |
WLEDEntity.name | (self) | Return the name of the entity. | Return the name of the entity. | def name(self) -> str:
"""Return the name of the entity."""
return self._name | [
"def",
"name",
"(",
"self",
")",
"->",
"str",
":",
"return",
"self",
".",
"_name"
] | [
165,
4
] | [
167,
25
] | python | en | ['en', 'en', 'en'] | True |
WLEDEntity.icon | (self) | Return the mdi icon of the entity. | Return the mdi icon of the entity. | def icon(self) -> str:
"""Return the mdi icon of the entity."""
return self._icon | [
"def",
"icon",
"(",
"self",
")",
"->",
"str",
":",
"return",
"self",
".",
"_icon"
] | [
170,
4
] | [
172,
25
] | python | en | ['en', 'en', 'en'] | True |
WLEDEntity.entity_registry_enabled_default | (self) | Return if the entity should be enabled when first added to the entity registry. | Return if the entity should be enabled when first added to the entity registry. | def entity_registry_enabled_default(self) -> bool:
"""Return if the entity should be enabled when first added to the entity registry."""
return self._enabled_default | [
"def",
"entity_registry_enabled_default",
"(",
"self",
")",
"->",
"bool",
":",
"return",
"self",
".",
"_enabled_default"
] | [
175,
4
] | [
177,
36
] | python | en | ['en', 'en', 'en'] | True |
WLEDDeviceEntity.device_info | (self) | Return device information about this WLED device. | Return device information about this WLED device. | def device_info(self) -> Dict[str, Any]:
"""Return device information about this WLED device."""
return {
ATTR_IDENTIFIERS: {(DOMAIN, self.coordinator.data.info.mac_address)},
ATTR_NAME: self.coordinator.data.info.name,
ATTR_MANUFACTURER: self.coordinator.data.info.br... | [
"def",
"device_info",
"(",
"self",
")",
"->",
"Dict",
"[",
"str",
",",
"Any",
"]",
":",
"return",
"{",
"ATTR_IDENTIFIERS",
":",
"{",
"(",
"DOMAIN",
",",
"self",
".",
"coordinator",
".",
"data",
".",
"info",
".",
"mac_address",
")",
"}",
",",
"ATTR_NA... | [
184,
4
] | [
192,
9
] | python | en | ['en', 'en', 'en'] | True |
async_setup_platform | (hass, config, async_add_entities, discovery_info=None) | Set up the ipma platform.
Deprecated.
| Set up the ipma platform. | async def async_setup_platform(hass, config, async_add_entities, discovery_info=None):
"""Set up the ipma platform.
Deprecated.
"""
_LOGGER.warning("Loading IPMA via platform config is deprecated")
latitude = config.get(CONF_LATITUDE, hass.config.latitude)
longitude = config.get(CONF_LONGITUDE... | [
"async",
"def",
"async_setup_platform",
"(",
"hass",
",",
"config",
",",
"async_add_entities",
",",
"discovery_info",
"=",
"None",
")",
":",
"_LOGGER",
".",
"warning",
"(",
"\"Loading IPMA via platform config is deprecated\"",
")",
"latitude",
"=",
"config",
".",
"g... | [
68,
0
] | [
85,
66
] | python | en | ['en', 'lv', 'en'] | True |
async_setup_entry | (hass, config_entry, async_add_entities) | Add a weather entity from a config_entry. | Add a weather entity from a config_entry. | async def async_setup_entry(hass, config_entry, async_add_entities):
"""Add a weather entity from a config_entry."""
latitude = config_entry.data[CONF_LATITUDE]
longitude = config_entry.data[CONF_LONGITUDE]
mode = config_entry.data[CONF_MODE]
api = await async_get_api(hass)
location = await asy... | [
"async",
"def",
"async_setup_entry",
"(",
"hass",
",",
"config_entry",
",",
"async_add_entities",
")",
":",
"latitude",
"=",
"config_entry",
".",
"data",
"[",
"CONF_LATITUDE",
"]",
"longitude",
"=",
"config_entry",
".",
"data",
"[",
"CONF_LONGITUDE",
"]",
"mode"... | [
88,
0
] | [
119,
77
] | python | en | ['en', 'en', 'en'] | True |
async_get_api | (hass) | Get the pyipma api object. | Get the pyipma api object. | async def async_get_api(hass):
"""Get the pyipma api object."""
websession = async_get_clientsession(hass)
return IPMA_API(websession) | [
"async",
"def",
"async_get_api",
"(",
"hass",
")",
":",
"websession",
"=",
"async_get_clientsession",
"(",
"hass",
")",
"return",
"IPMA_API",
"(",
"websession",
")"
] | [
122,
0
] | [
125,
31
] | python | en | ['en', 'haw', 'en'] | True |
async_get_location | (hass, api, latitude, longitude) | Retrieve pyipma location, location name to be used as the entity name. | Retrieve pyipma location, location name to be used as the entity name. | async def async_get_location(hass, api, latitude, longitude):
"""Retrieve pyipma location, location name to be used as the entity name."""
with async_timeout.timeout(30):
location = await Location.get(api, float(latitude), float(longitude))
_LOGGER.debug(
"Initializing for coordinates %s, %... | [
"async",
"def",
"async_get_location",
"(",
"hass",
",",
"api",
",",
"latitude",
",",
"longitude",
")",
":",
"with",
"async_timeout",
".",
"timeout",
"(",
"30",
")",
":",
"location",
"=",
"await",
"Location",
".",
"get",
"(",
"api",
",",
"float",
"(",
"... | [
128,
0
] | [
142,
19
] | python | en | ['en', 'en', 'en'] | True |
IPMAWeather.__init__ | (self, location: Location, api: IPMA_API, config) | Initialise the platform with a data instance and station name. | Initialise the platform with a data instance and station name. | def __init__(self, location: Location, api: IPMA_API, config):
"""Initialise the platform with a data instance and station name."""
self._api = api
self._location_name = config.get(CONF_NAME, location.name)
self._mode = config.get(CONF_MODE)
self._location = location
self... | [
"def",
"__init__",
"(",
"self",
",",
"location",
":",
"Location",
",",
"api",
":",
"IPMA_API",
",",
"config",
")",
":",
"self",
".",
"_api",
"=",
"api",
"self",
".",
"_location_name",
"=",
"config",
".",
"get",
"(",
"CONF_NAME",
",",
"location",
".",
... | [
148,
4
] | [
155,
29
] | python | en | ['en', 'en', 'en'] | True |
IPMAWeather.async_update | (self) | Update Condition and Forecast. | Update Condition and Forecast. | async def async_update(self):
"""Update Condition and Forecast."""
with async_timeout.timeout(10):
new_observation = await self._location.observation(self._api)
new_forecast = await self._location.forecast(self._api)
if new_observation:
self._observat... | [
"async",
"def",
"async_update",
"(",
"self",
")",
":",
"with",
"async_timeout",
".",
"timeout",
"(",
"10",
")",
":",
"new_observation",
"=",
"await",
"self",
".",
"_location",
".",
"observation",
"(",
"self",
".",
"_api",
")",
"new_forecast",
"=",
"await",... | [
158,
4
] | [
178,
13
] | python | en | ['en', 'en', 'en'] | True |
IPMAWeather.unique_id | (self) | Return a unique id. | Return a unique id. | def unique_id(self) -> str:
"""Return a unique id."""
return f"{self._location.station_latitude}, {self._location.station_longitude}, {self._mode}" | [
"def",
"unique_id",
"(",
"self",
")",
"->",
"str",
":",
"return",
"f\"{self._location.station_latitude}, {self._location.station_longitude}, {self._mode}\""
] | [
181,
4
] | [
183,
101
] | python | ca | ['fr', 'ca', 'en'] | False |
IPMAWeather.attribution | (self) | Return the attribution. | Return the attribution. | def attribution(self):
"""Return the attribution."""
return ATTRIBUTION | [
"def",
"attribution",
"(",
"self",
")",
":",
"return",
"ATTRIBUTION"
] | [
186,
4
] | [
188,
26
] | python | en | ['en', 'ja', 'en'] | True |
IPMAWeather.name | (self) | Return the name of the station. | Return the name of the station. | def name(self):
"""Return the name of the station."""
return self._location_name | [
"def",
"name",
"(",
"self",
")",
":",
"return",
"self",
".",
"_location_name"
] | [
191,
4
] | [
193,
34
] | python | en | ['en', 'en', 'en'] | True |
IPMAWeather.condition | (self) | Return the current condition. | Return the current condition. | def condition(self):
"""Return the current condition."""
if not self._forecast:
return
return next(
(
k
for k, v in CONDITION_CLASSES.items()
if self._forecast[0].weather_type in v
),
None,
) | [
"def",
"condition",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"_forecast",
":",
"return",
"return",
"next",
"(",
"(",
"k",
"for",
"k",
",",
"v",
"in",
"CONDITION_CLASSES",
".",
"items",
"(",
")",
"if",
"self",
".",
"_forecast",
"[",
"0",
"]"... | [
196,
4
] | [
208,
9
] | python | en | ['en', 'en', 'en'] | True |
IPMAWeather.temperature | (self) | Return the current temperature. | Return the current temperature. | def temperature(self):
"""Return the current temperature."""
if not self._observation:
return None
return self._observation.temperature | [
"def",
"temperature",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"_observation",
":",
"return",
"None",
"return",
"self",
".",
"_observation",
".",
"temperature"
] | [
211,
4
] | [
216,
44
] | python | en | ['en', 'la', 'en'] | True |
IPMAWeather.pressure | (self) | Return the current pressure. | Return the current pressure. | def pressure(self):
"""Return the current pressure."""
if not self._observation:
return None
return self._observation.pressure | [
"def",
"pressure",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"_observation",
":",
"return",
"None",
"return",
"self",
".",
"_observation",
".",
"pressure"
] | [
219,
4
] | [
224,
41
] | python | en | ['en', 'co', 'en'] | True |
IPMAWeather.humidity | (self) | Return the name of the sensor. | Return the name of the sensor. | def humidity(self):
"""Return the name of the sensor."""
if not self._observation:
return None
return self._observation.humidity | [
"def",
"humidity",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"_observation",
":",
"return",
"None",
"return",
"self",
".",
"_observation",
".",
"humidity"
] | [
227,
4
] | [
232,
41
] | python | en | ['en', 'mi', 'en'] | True |
IPMAWeather.wind_speed | (self) | Return the current windspeed. | Return the current windspeed. | def wind_speed(self):
"""Return the current windspeed."""
if not self._observation:
return None
return self._observation.wind_intensity_km | [
"def",
"wind_speed",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"_observation",
":",
"return",
"None",
"return",
"self",
".",
"_observation",
".",
"wind_intensity_km"
] | [
235,
4
] | [
240,
50
] | python | en | ['en', 'en', 'en'] | True |
IPMAWeather.wind_bearing | (self) | Return the current wind bearing (degrees). | Return the current wind bearing (degrees). | def wind_bearing(self):
"""Return the current wind bearing (degrees)."""
if not self._observation:
return None
return self._observation.wind_direction | [
"def",
"wind_bearing",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"_observation",
":",
"return",
"None",
"return",
"self",
".",
"_observation",
".",
"wind_direction"
] | [
243,
4
] | [
248,
47
] | python | en | ['en', 'en', 'en'] | True |
IPMAWeather.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"
] | [
251,
4
] | [
253,
27
] | python | en | ['en', 'la', 'en'] | True |
IPMAWeather.forecast | (self) | Return the forecast array. | Return the forecast array. | def forecast(self):
"""Return the forecast array."""
if not self._forecast:
return []
if self._mode == "hourly":
forecast_filtered = [
x
for x in self._forecast
if x.forecasted_hours == 1
and parse_datetime(... | [
"def",
"forecast",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"_forecast",
":",
"return",
"[",
"]",
"if",
"self",
".",
"_mode",
"==",
"\"hourly\"",
":",
"forecast_filtered",
"=",
"[",
"x",
"for",
"x",
"in",
"self",
".",
"_forecast",
"if",
"x",
... | [
256,
4
] | [
314,
25
] | python | en | ['en', 'ga', 'en'] | True |
setup_platform | (hass, config, add_entities, discovery_info=None) | Set up the StiebelEltron platform. | Set up the StiebelEltron platform. | def setup_platform(hass, config, add_entities, discovery_info=None):
"""Set up the StiebelEltron platform."""
name = hass.data[STE_DOMAIN]["name"]
ste_data = hass.data[STE_DOMAIN]["ste_data"]
add_entities([StiebelEltron(name, ste_data)], True) | [
"def",
"setup_platform",
"(",
"hass",
",",
"config",
",",
"add_entities",
",",
"discovery_info",
"=",
"None",
")",
":",
"name",
"=",
"hass",
".",
"data",
"[",
"STE_DOMAIN",
"]",
"[",
"\"name\"",
"]",
"ste_data",
"=",
"hass",
".",
"data",
"[",
"STE_DOMAIN... | [
55,
0
] | [
60,
55
] | python | en | ['en', 'lb', 'en'] | True |
StiebelEltron.__init__ | (self, name, ste_data) | Initialize the unit. | Initialize the unit. | def __init__(self, name, ste_data):
"""Initialize the unit."""
self._name = name
self._target_temperature = None
self._current_temperature = None
self._current_humidity = None
self._operation = None
self._filter_alarm = None
self._force_update = False
... | [
"def",
"__init__",
"(",
"self",
",",
"name",
",",
"ste_data",
")",
":",
"self",
".",
"_name",
"=",
"name",
"self",
".",
"_target_temperature",
"=",
"None",
"self",
".",
"_current_temperature",
"=",
"None",
"self",
".",
"_current_humidity",
"=",
"None",
"se... | [
66,
4
] | [
75,
33
] | python | en | ['en', 'en', 'en'] | True |
StiebelEltron.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"
] | [
78,
4
] | [
80,
28
] | python | en | ['en', 'en', 'en'] | True |
StiebelEltron.update | (self) | Update unit attributes. | Update unit attributes. | def update(self):
"""Update unit attributes."""
self._ste_data.update(no_throttle=self._force_update)
self._force_update = False
self._target_temperature = self._ste_data.api.get_target_temp()
self._current_temperature = self._ste_data.api.get_current_temp()
self._curren... | [
"def",
"update",
"(",
"self",
")",
":",
"self",
".",
"_ste_data",
".",
"update",
"(",
"no_throttle",
"=",
"self",
".",
"_force_update",
")",
"self",
".",
"_force_update",
"=",
"False",
"self",
".",
"_target_temperature",
"=",
"self",
".",
"_ste_data",
".",... | [
82,
4
] | [
95,
9
] | python | en | ['en', 'la', 'en'] | True |
StiebelEltron.device_state_attributes | (self) | Return device specific state attributes. | Return device specific state attributes. | def device_state_attributes(self):
"""Return device specific state attributes."""
return {"filter_alarm": self._filter_alarm} | [
"def",
"device_state_attributes",
"(",
"self",
")",
":",
"return",
"{",
"\"filter_alarm\"",
":",
"self",
".",
"_filter_alarm",
"}"
] | [
98,
4
] | [
100,
51
] | python | en | ['fr', 'en', 'en'] | True |
StiebelEltron.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"
] | [
103,
4
] | [
105,
25
] | python | en | ['en', 'en', 'en'] | True |
StiebelEltron.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"
] | [
109,
4
] | [
111,
27
] | python | en | ['en', 'la', 'en'] | True |
StiebelEltron.current_temperature | (self) | Return the current temperature. | Return the current temperature. | def current_temperature(self):
"""Return the current temperature."""
return self._current_temperature | [
"def",
"current_temperature",
"(",
"self",
")",
":",
"return",
"self",
".",
"_current_temperature"
] | [
114,
4
] | [
116,
40
] | python | en | ['en', 'la', 'en'] | True |
StiebelEltron.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."""
return self._target_temperature | [
"def",
"target_temperature",
"(",
"self",
")",
":",
"return",
"self",
".",
"_target_temperature"
] | [
119,
4
] | [
121,
39
] | python | en | ['en', 'en', 'en'] | True |
StiebelEltron.target_temperature_step | (self) | Return the supported step of target temperature. | Return the supported step of target temperature. | def target_temperature_step(self):
"""Return the supported step of target temperature."""
return 0.1 | [
"def",
"target_temperature_step",
"(",
"self",
")",
":",
"return",
"0.1"
] | [
124,
4
] | [
126,
18
] | python | en | ['en', 'en', 'en'] | True |
StiebelEltron.min_temp | (self) | Return the minimum temperature. | Return the minimum temperature. | def min_temp(self):
"""Return the minimum temperature."""
return 10.0 | [
"def",
"min_temp",
"(",
"self",
")",
":",
"return",
"10.0"
] | [
129,
4
] | [
131,
19
] | python | en | ['en', 'la', 'en'] | True |
StiebelEltron.max_temp | (self) | Return the maximum temperature. | Return the maximum temperature. | def max_temp(self):
"""Return the maximum temperature."""
return 30.0 | [
"def",
"max_temp",
"(",
"self",
")",
":",
"return",
"30.0"
] | [
134,
4
] | [
136,
19
] | python | en | ['en', 'la', 'en'] | True |
StiebelEltron.current_humidity | (self) | Return the current humidity. | Return the current humidity. | def current_humidity(self):
"""Return the current humidity."""
return float(f"{self._current_humidity:.1f}") | [
"def",
"current_humidity",
"(",
"self",
")",
":",
"return",
"float",
"(",
"f\"{self._current_humidity:.1f}\"",
")"
] | [
139,
4
] | [
141,
53
] | python | en | ['en', 'en', 'en'] | True |
StiebelEltron.hvac_modes | (self) | List of the operation modes. | List of the operation modes. | def hvac_modes(self):
"""List of the operation modes."""
return SUPPORT_HVAC | [
"def",
"hvac_modes",
"(",
"self",
")",
":",
"return",
"SUPPORT_HVAC"
] | [
144,
4
] | [
146,
27
] | python | en | ['en', 'en', 'en'] | True |
StiebelEltron.hvac_mode | (self) | Return current operation ie. heat, cool, idle. | Return current operation ie. heat, cool, idle. | def hvac_mode(self):
"""Return current operation ie. heat, cool, idle."""
return STE_TO_HA_HVAC.get(self._operation) | [
"def",
"hvac_mode",
"(",
"self",
")",
":",
"return",
"STE_TO_HA_HVAC",
".",
"get",
"(",
"self",
".",
"_operation",
")"
] | [
149,
4
] | [
151,
50
] | python | en | ['nl', 'en', 'en'] | True |
StiebelEltron.preset_mode | (self) | Return the current preset mode, e.g., home, away, temp. | Return the current preset mode, e.g., home, away, temp. | def preset_mode(self):
"""Return the current preset mode, e.g., home, away, temp."""
return STE_TO_HA_PRESET.get(self._operation) | [
"def",
"preset_mode",
"(",
"self",
")",
":",
"return",
"STE_TO_HA_PRESET",
".",
"get",
"(",
"self",
".",
"_operation",
")"
] | [
154,
4
] | [
156,
52
] | python | en | ['en', 'pt', 'en'] | True |
StiebelEltron.preset_modes | (self) | Return a list of available preset modes. | Return a list of available preset modes. | def preset_modes(self):
"""Return a list of available preset modes."""
return SUPPORT_PRESET | [
"def",
"preset_modes",
"(",
"self",
")",
":",
"return",
"SUPPORT_PRESET"
] | [
159,
4
] | [
161,
29
] | python | en | ['en', 'en', 'en'] | True |
StiebelEltron.set_hvac_mode | (self, hvac_mode) | Set new operation mode. | Set new operation mode. | def set_hvac_mode(self, hvac_mode):
"""Set new operation mode."""
if self.preset_mode:
return
new_mode = HA_TO_STE_HVAC.get(hvac_mode)
_LOGGER.debug("set_hvac_mode: %s -> %s", self._operation, new_mode)
self._ste_data.api.set_operation(new_mode)
self._force_up... | [
"def",
"set_hvac_mode",
"(",
"self",
",",
"hvac_mode",
")",
":",
"if",
"self",
".",
"preset_mode",
":",
"return",
"new_mode",
"=",
"HA_TO_STE_HVAC",
".",
"get",
"(",
"hvac_mode",
")",
"_LOGGER",
".",
"debug",
"(",
"\"set_hvac_mode: %s -> %s\"",
",",
"self",
... | [
163,
4
] | [
170,
33
] | python | en | ['en', 'ny', 'en'] | True |
StiebelEltron.set_temperature | (self, **kwargs) | Set new target temperature. | Set new target temperature. | def set_temperature(self, **kwargs):
"""Set new target temperature."""
target_temperature = kwargs.get(ATTR_TEMPERATURE)
if target_temperature is not None:
_LOGGER.debug("set_temperature: %s", target_temperature)
self._ste_data.api.set_target_temp(target_temperature)
... | [
"def",
"set_temperature",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"target_temperature",
"=",
"kwargs",
".",
"get",
"(",
"ATTR_TEMPERATURE",
")",
"if",
"target_temperature",
"is",
"not",
"None",
":",
"_LOGGER",
".",
"debug",
"(",
"\"set_temperature: %s\... | [
172,
4
] | [
178,
37
] | python | en | ['en', 'ca', 'en'] | True |
StiebelEltron.set_preset_mode | (self, preset_mode: str) | Set new preset mode. | Set new preset mode. | def set_preset_mode(self, preset_mode: str):
"""Set new preset mode."""
new_mode = HA_TO_STE_PRESET.get(preset_mode)
_LOGGER.debug("set_hvac_mode: %s -> %s", self._operation, new_mode)
self._ste_data.api.set_operation(new_mode)
self._force_update = True | [
"def",
"set_preset_mode",
"(",
"self",
",",
"preset_mode",
":",
"str",
")",
":",
"new_mode",
"=",
"HA_TO_STE_PRESET",
".",
"get",
"(",
"preset_mode",
")",
"_LOGGER",
".",
"debug",
"(",
"\"set_hvac_mode: %s -> %s\"",
",",
"self",
".",
"_operation",
",",
"new_mo... | [
180,
4
] | [
185,
33
] | python | en | ['en', 'sr', 'en'] | True |
isotonic_regression | (y, sample_weight=None, y_min=None, y_max=None,
increasing=True) | Solve the isotonic regression model::
min sum w[i] (y[i] - y_[i]) ** 2
subject to y_min = y_[1] <= y_[2] ... <= y_[n] = y_max
where:
- y[i] are inputs (real numbers)
- y_[i] are fitted
- w[i] are optional strictly positive weights (default to 1.0)
Read more in the :re... | Solve the isotonic regression model:: | def isotonic_regression(y, sample_weight=None, y_min=None, y_max=None,
increasing=True):
"""Solve the isotonic regression model::
min sum w[i] (y[i] - y_[i]) ** 2
subject to y_min = y_[1] <= y_[2] ... <= y_[n] = y_max
where:
- y[i] are inputs (real numbers)
... | [
"def",
"isotonic_regression",
"(",
"y",
",",
"sample_weight",
"=",
"None",
",",
"y_min",
"=",
"None",
",",
"y_max",
"=",
"None",
",",
"increasing",
"=",
"True",
")",
":",
"order",
"=",
"np",
".",
"s_",
"[",
":",
"]",
"if",
"increasing",
"else",
"np",... | [
11,
0
] | [
71,
19
] | python | en | ['en', 'en', 'en'] | True |
async_setup_entry | (
hass: HomeAssistant, entry: ConfigEntry, async_add_entities: Callable
) | Set up Guardian switches based on a config entry. | Set up Guardian switches based on a config entry. | async def async_setup_entry(
hass: HomeAssistant, entry: ConfigEntry, async_add_entities: Callable
) -> None:
"""Set up Guardian switches based on a config entry."""
@callback
def add_new_paired_sensor(uid: str) -> None:
"""Add a new paired sensor."""
coordinator = hass.data[DOMAIN][DAT... | [
"async",
"def",
"async_setup_entry",
"(",
"hass",
":",
"HomeAssistant",
",",
"entry",
":",
"ConfigEntry",
",",
"async_add_entities",
":",
"Callable",
")",
"->",
"None",
":",
"@",
"callback",
"def",
"add_new_paired_sensor",
"(",
"uid",
":",
"str",
")",
"->",
... | [
42,
0
] | [
112,
31
] | python | en | ['en', 'en', 'en'] | True |
PairedSensorBinarySensor.__init__ | (
self,
entry: ConfigEntry,
coordinator: DataUpdateCoordinator,
kind: str,
name: str,
device_class: Optional[str],
icon: Optional[str],
) | Initialize. | Initialize. | def __init__(
self,
entry: ConfigEntry,
coordinator: DataUpdateCoordinator,
kind: str,
name: str,
device_class: Optional[str],
icon: Optional[str],
) -> None:
"""Initialize."""
super().__init__(entry, coordinator, kind, name, device_class, icon... | [
"def",
"__init__",
"(",
"self",
",",
"entry",
":",
"ConfigEntry",
",",
"coordinator",
":",
"DataUpdateCoordinator",
",",
"kind",
":",
"str",
",",
"name",
":",
"str",
",",
"device_class",
":",
"Optional",
"[",
"str",
"]",
",",
"icon",
":",
"Optional",
"["... | [
118,
4
] | [
130,
26
] | python | en | ['en', 'en', 'it'] | False |
PairedSensorBinarySensor.available | (self) | Return whether the entity is available. | Return whether the entity is available. | def available(self) -> bool:
"""Return whether the entity is available."""
return self.coordinator.last_update_success | [
"def",
"available",
"(",
"self",
")",
"->",
"bool",
":",
"return",
"self",
".",
"coordinator",
".",
"last_update_success"
] | [
133,
4
] | [
135,
51
] | python | en | ['en', 'en', 'en'] | True |
PairedSensorBinarySensor.is_on | (self) | Return True if the binary sensor is on. | Return True if the binary sensor is on. | def is_on(self) -> bool:
"""Return True if the binary sensor is on."""
return self._is_on | [
"def",
"is_on",
"(",
"self",
")",
"->",
"bool",
":",
"return",
"self",
".",
"_is_on"
] | [
138,
4
] | [
140,
26
] | python | en | ['en', 'fy', 'en'] | True |
PairedSensorBinarySensor._async_update_from_latest_data | (self) | Update the entity. | Update the entity. | def _async_update_from_latest_data(self) -> None:
"""Update the entity."""
if self._kind == SENSOR_KIND_LEAK_DETECTED:
self._is_on = self.coordinator.data["wet"]
elif self._kind == SENSOR_KIND_MOVED:
self._is_on = self.coordinator.data["moved"] | [
"def",
"_async_update_from_latest_data",
"(",
"self",
")",
"->",
"None",
":",
"if",
"self",
".",
"_kind",
"==",
"SENSOR_KIND_LEAK_DETECTED",
":",
"self",
".",
"_is_on",
"=",
"self",
".",
"coordinator",
".",
"data",
"[",
"\"wet\"",
"]",
"elif",
"self",
".",
... | [
143,
4
] | [
148,
56
] | python | en | ['en', 'en', 'en'] | True |
ValveControllerBinarySensor.__init__ | (
self,
entry: ConfigEntry,
coordinators: Dict[str, DataUpdateCoordinator],
kind: str,
name: str,
device_class: Optional[str],
icon: Optional[str],
) | Initialize. | Initialize. | def __init__(
self,
entry: ConfigEntry,
coordinators: Dict[str, DataUpdateCoordinator],
kind: str,
name: str,
device_class: Optional[str],
icon: Optional[str],
) -> None:
"""Initialize."""
super().__init__(entry, coordinators, kind, name, devic... | [
"def",
"__init__",
"(",
"self",
",",
"entry",
":",
"ConfigEntry",
",",
"coordinators",
":",
"Dict",
"[",
"str",
",",
"DataUpdateCoordinator",
"]",
",",
"kind",
":",
"str",
",",
"name",
":",
"str",
",",
"device_class",
":",
"Optional",
"[",
"str",
"]",
... | [
154,
4
] | [
166,
26
] | python | en | ['en', 'en', 'it'] | False |
ValveControllerBinarySensor.available | (self) | Return whether the entity is available. | Return whether the entity is available. | def available(self) -> bool:
"""Return whether the entity is available."""
if self._kind == SENSOR_KIND_AP_INFO:
return self.coordinators[API_WIFI_STATUS].last_update_success
if self._kind == SENSOR_KIND_LEAK_DETECTED:
return self.coordinators[
API_SYSTEM_... | [
"def",
"available",
"(",
"self",
")",
"->",
"bool",
":",
"if",
"self",
".",
"_kind",
"==",
"SENSOR_KIND_AP_INFO",
":",
"return",
"self",
".",
"coordinators",
"[",
"API_WIFI_STATUS",
"]",
".",
"last_update_success",
"if",
"self",
".",
"_kind",
"==",
"SENSOR_K... | [
169,
4
] | [
177,
20
] | python | en | ['en', 'en', 'en'] | True |
ValveControllerBinarySensor.is_on | (self) | Return True if the binary sensor is on. | Return True if the binary sensor is on. | def is_on(self) -> bool:
"""Return True if the binary sensor is on."""
return self._is_on | [
"def",
"is_on",
"(",
"self",
")",
"->",
"bool",
":",
"return",
"self",
".",
"_is_on"
] | [
180,
4
] | [
182,
26
] | python | en | ['en', 'fy', 'en'] | True |
ValveControllerBinarySensor._async_continue_entity_setup | (self) | Add an API listener. | Add an API listener. | async def _async_continue_entity_setup(self) -> None:
"""Add an API listener."""
if self._kind == SENSOR_KIND_AP_INFO:
self.async_add_coordinator_update_listener(API_WIFI_STATUS)
elif self._kind == SENSOR_KIND_LEAK_DETECTED:
self.async_add_coordinator_update_listener(API_... | [
"async",
"def",
"_async_continue_entity_setup",
"(",
"self",
")",
"->",
"None",
":",
"if",
"self",
".",
"_kind",
"==",
"SENSOR_KIND_AP_INFO",
":",
"self",
".",
"async_add_coordinator_update_listener",
"(",
"API_WIFI_STATUS",
")",
"elif",
"self",
".",
"_kind",
"=="... | [
184,
4
] | [
189,
88
] | python | cy | ['en', 'cy', 'nl'] | False |
ValveControllerBinarySensor._async_update_from_latest_data | (self) | Update the entity. | Update the entity. | def _async_update_from_latest_data(self) -> None:
"""Update the entity."""
if self._kind == SENSOR_KIND_AP_INFO:
self._is_on = self.coordinators[API_WIFI_STATUS].data["station_connected"]
self._attrs.update(
{
ATTR_CONNECTED_CLIENTS: self.coord... | [
"def",
"_async_update_from_latest_data",
"(",
"self",
")",
"->",
"None",
":",
"if",
"self",
".",
"_kind",
"==",
"SENSOR_KIND_AP_INFO",
":",
"self",
".",
"_is_on",
"=",
"self",
".",
"coordinators",
"[",
"API_WIFI_STATUS",
"]",
".",
"data",
"[",
"\"station_conne... | [
192,
4
] | [
206,
13
] | python | en | ['en', 'en', 'en'] | True |
get_mock_info | (
model=TEST_MODEL,
mac_address=TEST_MAC,
hardware_version=TEST_HARDWARE_VERSION,
firmware_version=TEST_FIRMWARE_VERSION,
) | Return a mock gateway info instance. | Return a mock gateway info instance. | def get_mock_info(
model=TEST_MODEL,
mac_address=TEST_MAC,
hardware_version=TEST_HARDWARE_VERSION,
firmware_version=TEST_FIRMWARE_VERSION,
):
"""Return a mock gateway info instance."""
gateway_info = Mock()
gateway_info.model = model
gateway_info.mac_address = mac_address
gateway_inf... | [
"def",
"get_mock_info",
"(",
"model",
"=",
"TEST_MODEL",
",",
"mac_address",
"=",
"TEST_MAC",
",",
"hardware_version",
"=",
"TEST_HARDWARE_VERSION",
",",
"firmware_version",
"=",
"TEST_FIRMWARE_VERSION",
",",
")",
":",
"gateway_info",
"=",
"Mock",
"(",
")",
"gatew... | [
26,
0
] | [
39,
23
] | python | en | ['en', 'fy', 'en'] | True |
test_config_flow_step_user_no_device | (hass) | Test config flow, user step with no device selected. | Test config flow, user step with no device selected. | async def test_config_flow_step_user_no_device(hass):
"""Test config flow, user step with no device selected."""
result = await hass.config_entries.flow.async_init(
const.DOMAIN, context={"source": config_entries.SOURCE_USER}
)
assert result["type"] == "form"
assert result["step_id"] == "us... | [
"async",
"def",
"test_config_flow_step_user_no_device",
"(",
"hass",
")",
":",
"result",
"=",
"await",
"hass",
".",
"config_entries",
".",
"flow",
".",
"async_init",
"(",
"const",
".",
"DOMAIN",
",",
"context",
"=",
"{",
"\"source\"",
":",
"config_entries",
".... | [
42,
0
] | [
59,
61
] | python | en | ['en', 'en', 'en'] | True |
test_config_flow_step_gateway_connect_error | (hass) | Test config flow, gateway connection error. | Test config flow, gateway connection error. | async def test_config_flow_step_gateway_connect_error(hass):
"""Test config flow, gateway connection error."""
result = await hass.config_entries.flow.async_init(
const.DOMAIN, context={"source": config_entries.SOURCE_USER}
)
assert result["type"] == "form"
assert result["step_id"] == "user... | [
"async",
"def",
"test_config_flow_step_gateway_connect_error",
"(",
"hass",
")",
":",
"result",
"=",
"await",
"hass",
".",
"config_entries",
".",
"flow",
".",
"async_init",
"(",
"const",
".",
"DOMAIN",
",",
"context",
"=",
"{",
"\"source\"",
":",
"config_entries... | [
62,
0
] | [
92,
57
] | python | da | ['da', 'fr', 'en'] | False |
test_config_flow_gateway_success | (hass) | Test a successful config flow. | Test a successful config flow. | async def test_config_flow_gateway_success(hass):
"""Test a successful config flow."""
result = await hass.config_entries.flow.async_init(
const.DOMAIN, context={"source": config_entries.SOURCE_USER}
)
assert result["type"] == "form"
assert result["step_id"] == "user"
assert result["err... | [
"async",
"def",
"test_config_flow_gateway_success",
"(",
"hass",
")",
":",
"result",
"=",
"await",
"hass",
".",
"config_entries",
".",
"flow",
".",
"async_init",
"(",
"const",
".",
"DOMAIN",
",",
"context",
"=",
"{",
"\"source\"",
":",
"config_entries",
".",
... | [
95,
0
] | [
138,
5
] | python | en | ['en', 'en', 'en'] | True |
test_zeroconf_gateway_success | (hass) | Test a successful zeroconf discovery of a gateway. | Test a successful zeroconf discovery of a gateway. | async def test_zeroconf_gateway_success(hass):
"""Test a successful zeroconf discovery of a gateway."""
result = await hass.config_entries.flow.async_init(
const.DOMAIN,
context={"source": config_entries.SOURCE_ZEROCONF},
data={
zeroconf.ATTR_HOST: TEST_HOST,
ZERO... | [
"async",
"def",
"test_zeroconf_gateway_success",
"(",
"hass",
")",
":",
"result",
"=",
"await",
"hass",
".",
"config_entries",
".",
"flow",
".",
"async_init",
"(",
"const",
".",
"DOMAIN",
",",
"context",
"=",
"{",
"\"source\"",
":",
"config_entries",
".",
"S... | [
141,
0
] | [
181,
5
] | python | en | ['en', 'en', 'en'] | True |
test_zeroconf_unknown_device | (hass) | Test a failed zeroconf discovery because of a unknown device. | Test a failed zeroconf discovery because of a unknown device. | async def test_zeroconf_unknown_device(hass):
"""Test a failed zeroconf discovery because of a unknown device."""
result = await hass.config_entries.flow.async_init(
const.DOMAIN,
context={"source": config_entries.SOURCE_ZEROCONF},
data={
zeroconf.ATTR_HOST: TEST_HOST,
... | [
"async",
"def",
"test_zeroconf_unknown_device",
"(",
"hass",
")",
":",
"result",
"=",
"await",
"hass",
".",
"config_entries",
".",
"flow",
".",
"async_init",
"(",
"const",
".",
"DOMAIN",
",",
"context",
"=",
"{",
"\"source\"",
":",
"config_entries",
".",
"SO... | [
184,
0
] | [
197,
48
] | python | en | ['en', 'en', 'en'] | True |
test_zeroconf_no_data | (hass) | Test a failed zeroconf discovery because of no data. | Test a failed zeroconf discovery because of no data. | async def test_zeroconf_no_data(hass):
"""Test a failed zeroconf discovery because of no data."""
result = await hass.config_entries.flow.async_init(
const.DOMAIN, context={"source": config_entries.SOURCE_ZEROCONF}, data={}
)
assert result["type"] == "abort"
assert result["reason"] == "not_... | [
"async",
"def",
"test_zeroconf_no_data",
"(",
"hass",
")",
":",
"result",
"=",
"await",
"hass",
".",
"config_entries",
".",
"flow",
".",
"async_init",
"(",
"const",
".",
"DOMAIN",
",",
"context",
"=",
"{",
"\"source\"",
":",
"config_entries",
".",
"SOURCE_ZE... | [
200,
0
] | [
207,
48
] | python | en | ['en', 'en', 'en'] | True |
test_zeroconf_missing_data | (hass) | Test a failed zeroconf discovery because of missing data. | Test a failed zeroconf discovery because of missing data. | async def test_zeroconf_missing_data(hass):
"""Test a failed zeroconf discovery because of missing data."""
result = await hass.config_entries.flow.async_init(
const.DOMAIN,
context={"source": config_entries.SOURCE_ZEROCONF},
data={zeroconf.ATTR_HOST: TEST_HOST, ZEROCONF_NAME: TEST_ZEROC... | [
"async",
"def",
"test_zeroconf_missing_data",
"(",
"hass",
")",
":",
"result",
"=",
"await",
"hass",
".",
"config_entries",
".",
"flow",
".",
"async_init",
"(",
"const",
".",
"DOMAIN",
",",
"context",
"=",
"{",
"\"source\"",
":",
"config_entries",
".",
"SOUR... | [
210,
0
] | [
219,
48
] | python | en | ['en', 'en', 'en'] | True |
_only_one_selected | (*args) | Test if only one item is True. | Test if only one item is True. | def _only_one_selected(*args):
"""Test if only one item is True."""
return sum(args) == 1 | [
"def",
"_only_one_selected",
"(",
"*",
"args",
")",
":",
"return",
"sum",
"(",
"args",
")",
"==",
"1"
] | [
58,
0
] | [
60,
25
] | python | en | ['en', 'en', 'en'] | True |
_async_connect | (**kwargs) | Connect to the Insteon modem. | Connect to the Insteon modem. | async def _async_connect(**kwargs):
"""Connect to the Insteon modem."""
try:
await async_connect(**kwargs)
_LOGGER.info("Connected to Insteon modem.")
return True
except ConnectionError:
_LOGGER.error("Could not connect to Insteon modem.")
return False | [
"async",
"def",
"_async_connect",
"(",
"*",
"*",
"kwargs",
")",
":",
"try",
":",
"await",
"async_connect",
"(",
"*",
"*",
"kwargs",
")",
"_LOGGER",
".",
"info",
"(",
"\"Connected to Insteon modem.\"",
")",
"return",
"True",
"except",
"ConnectionError",
":",
... | [
63,
0
] | [
71,
20
] | python | en | ['en', 'en', 'en'] | True |
_remove_override | (address, options) | Remove a device override from config. | Remove a device override from config. | def _remove_override(address, options):
"""Remove a device override from config."""
new_options = {}
if options.get(CONF_X10):
new_options[CONF_X10] = options.get(CONF_X10)
new_overrides = []
for override in options[CONF_OVERRIDE]:
if override[CONF_ADDRESS] != address:
ne... | [
"def",
"_remove_override",
"(",
"address",
",",
"options",
")",
":",
"new_options",
"=",
"{",
"}",
"if",
"options",
".",
"get",
"(",
"CONF_X10",
")",
":",
"new_options",
"[",
"CONF_X10",
"]",
"=",
"options",
".",
"get",
"(",
"CONF_X10",
")",
"new_overrid... | [
74,
0
] | [
85,
22
] | python | en | ['en', 'en', 'en'] | True |
_remove_x10 | (device, options) | Remove an X10 device from the config. | Remove an X10 device from the config. | def _remove_x10(device, options):
"""Remove an X10 device from the config."""
housecode = device[11].lower()
unitcode = int(device[24:])
new_options = {}
if options.get(CONF_OVERRIDE):
new_options[CONF_OVERRIDE] = options.get(CONF_OVERRIDE)
new_x10 = []
for existing_device in options... | [
"def",
"_remove_x10",
"(",
"device",
",",
"options",
")",
":",
"housecode",
"=",
"device",
"[",
"11",
"]",
".",
"lower",
"(",
")",
"unitcode",
"=",
"int",
"(",
"device",
"[",
"24",
":",
"]",
")",
"new_options",
"=",
"{",
"}",
"if",
"options",
".",
... | [
88,
0
] | [
104,
43
] | python | en | ['en', 'en', 'en'] | True |
InsteonFlowHandler.async_get_options_flow | (config_entry) | Define the config flow to handle options. | Define the config flow to handle options. | def async_get_options_flow(config_entry):
"""Define the config flow to handle options."""
return InsteonOptionsFlowHandler(config_entry) | [
"def",
"async_get_options_flow",
"(",
"config_entry",
")",
":",
"return",
"InsteonOptionsFlowHandler",
"(",
"config_entry",
")"
] | [
112,
4
] | [
114,
54
] | python | en | ['en', 'en', 'en'] | True |
InsteonFlowHandler.async_step_user | (self, user_input=None) | Init the config flow. | Init the config flow. | async def async_step_user(self, user_input=None):
"""Init the config flow."""
errors = {}
if self._async_current_entries():
return self.async_abort(reason="single_instance_allowed")
if user_input is not None:
selection = user_input.get(MODEM_TYPE)
if ... | [
"async",
"def",
"async_step_user",
"(",
"self",
",",
"user_input",
"=",
"None",
")",
":",
"errors",
"=",
"{",
"}",
"if",
"self",
".",
"_async_current_entries",
"(",
")",
":",
"return",
"self",
".",
"async_abort",
"(",
"reason",
"=",
"\"single_instance_allowe... | [
116,
4
] | [
133,
9
] | python | en | ['en', 'en', 'en'] | True |
InsteonFlowHandler.async_step_plm | (self, user_input=None) | Set up the PLM modem type. | Set up the PLM modem type. | async def async_step_plm(self, user_input=None):
"""Set up the PLM modem type."""
errors = {}
if user_input is not None:
if await _async_connect(**user_input):
return self.async_create_entry(title="", data=user_input)
errors["base"] = "cannot_connect"
... | [
"async",
"def",
"async_step_plm",
"(",
"self",
",",
"user_input",
"=",
"None",
")",
":",
"errors",
"=",
"{",
"}",
"if",
"user_input",
"is",
"not",
"None",
":",
"if",
"await",
"_async_connect",
"(",
"*",
"*",
"user_input",
")",
":",
"return",
"self",
".... | [
135,
4
] | [
146,
9
] | python | en | ['en', 'yi', 'en'] | True |
InsteonFlowHandler.async_step_hubv1 | (self, user_input=None) | Set up the Hub v1 modem type. | Set up the Hub v1 modem type. | async def async_step_hubv1(self, user_input=None):
"""Set up the Hub v1 modem type."""
return await self._async_setup_hub(hub_version=1, user_input=user_input) | [
"async",
"def",
"async_step_hubv1",
"(",
"self",
",",
"user_input",
"=",
"None",
")",
":",
"return",
"await",
"self",
".",
"_async_setup_hub",
"(",
"hub_version",
"=",
"1",
",",
"user_input",
"=",
"user_input",
")"
] | [
148,
4
] | [
150,
80
] | python | en | ['en', 'ru-Latn', 'en'] | True |
InsteonFlowHandler.async_step_hubv2 | (self, user_input=None) | Set up the Hub v2 modem type. | Set up the Hub v2 modem type. | async def async_step_hubv2(self, user_input=None):
"""Set up the Hub v2 modem type."""
return await self._async_setup_hub(hub_version=2, user_input=user_input) | [
"async",
"def",
"async_step_hubv2",
"(",
"self",
",",
"user_input",
"=",
"None",
")",
":",
"return",
"await",
"self",
".",
"_async_setup_hub",
"(",
"hub_version",
"=",
"2",
",",
"user_input",
"=",
"user_input",
")"
] | [
152,
4
] | [
154,
80
] | python | en | ['en', 'ru-Latn', 'en'] | True |
InsteonFlowHandler._async_setup_hub | (self, hub_version, user_input) | Set up the Hub versions 1 and 2. | Set up the Hub versions 1 and 2. | async def _async_setup_hub(self, hub_version, user_input):
"""Set up the Hub versions 1 and 2."""
errors = {}
if user_input is not None:
user_input[CONF_HUB_VERSION] = hub_version
if await _async_connect(**user_input):
return self.async_create_entry(title=... | [
"async",
"def",
"_async_setup_hub",
"(",
"self",
",",
"hub_version",
",",
"user_input",
")",
":",
"errors",
"=",
"{",
"}",
"if",
"user_input",
"is",
"not",
"None",
":",
"user_input",
"[",
"CONF_HUB_VERSION",
"]",
"=",
"hub_version",
"if",
"await",
"_async_co... | [
156,
4
] | [
170,
9
] | python | en | ['en', 'en', 'en'] | True |
InsteonFlowHandler.async_step_import | (self, import_info) | Import a yaml entry as a config entry. | Import a yaml entry as a config entry. | async def async_step_import(self, import_info):
"""Import a yaml entry as a config entry."""
if self._async_current_entries():
return self.async_abort(reason="single_instance_allowed")
if not await _async_connect(**import_info):
return self.async_abort(reason="cannot_conn... | [
"async",
"def",
"async_step_import",
"(",
"self",
",",
"import_info",
")",
":",
"if",
"self",
".",
"_async_current_entries",
"(",
")",
":",
"return",
"self",
".",
"async_abort",
"(",
"reason",
"=",
"\"single_instance_allowed\"",
")",
"if",
"not",
"await",
"_as... | [
172,
4
] | [
178,
66
] | python | en | ['en', 'en', 'en'] | True |
InsteonOptionsFlowHandler.__init__ | (self, config_entry) | Init the InsteonOptionsFlowHandler class. | Init the InsteonOptionsFlowHandler class. | def __init__(self, config_entry):
"""Init the InsteonOptionsFlowHandler class."""
self.config_entry = config_entry | [
"def",
"__init__",
"(",
"self",
",",
"config_entry",
")",
":",
"self",
".",
"config_entry",
"=",
"config_entry"
] | [
184,
4
] | [
186,
40
] | python | en | ['en', 'en', 'en'] | True |
InsteonOptionsFlowHandler.async_step_init | (self, user_input=None) | Init the options config flow. | Init the options config flow. | async def async_step_init(self, user_input=None):
"""Init the options config flow."""
errors = {}
if user_input is not None:
change_hub_config = user_input.get(STEP_CHANGE_HUB_CONFIG, False)
device_override = user_input.get(STEP_ADD_OVERRIDE, False)
x10_device... | [
"async",
"def",
"async_step_init",
"(",
"self",
",",
"user_input",
"=",
"None",
")",
":",
"errors",
"=",
"{",
"}",
"if",
"user_input",
"is",
"not",
"None",
":",
"change_hub_config",
"=",
"user_input",
".",
"get",
"(",
"STEP_CHANGE_HUB_CONFIG",
",",
"False",
... | [
188,
4
] | [
231,
9
] | python | en | ['en', 'en', 'en'] | True |
InsteonOptionsFlowHandler.async_step_change_hub_config | (self, user_input=None) | Change the Hub configuration. | Change the Hub configuration. | async def async_step_change_hub_config(self, user_input=None):
"""Change the Hub configuration."""
if user_input is not None:
data = {
**self.config_entry.data,
CONF_HOST: user_input[CONF_HOST],
CONF_PORT: user_input[CONF_PORT],
}
... | [
"async",
"def",
"async_step_change_hub_config",
"(",
"self",
",",
"user_input",
"=",
"None",
")",
":",
"if",
"user_input",
"is",
"not",
"None",
":",
"data",
"=",
"{",
"*",
"*",
"self",
".",
"config_entry",
".",
"data",
",",
"CONF_HOST",
":",
"user_input",
... | [
233,
4
] | [
252,
9
] | python | en | ['en', 'xh', 'en'] | True |
InsteonOptionsFlowHandler.async_step_add_override | (self, user_input=None) | Add a device override. | Add a device override. | async def async_step_add_override(self, user_input=None):
"""Add a device override."""
errors = {}
if user_input is not None:
try:
data = add_device_override({**self.config_entry.options}, user_input)
async_dispatcher_send(self.hass, SIGNAL_ADD_DEVICE_... | [
"async",
"def",
"async_step_add_override",
"(",
"self",
",",
"user_input",
"=",
"None",
")",
":",
"errors",
"=",
"{",
"}",
"if",
"user_input",
"is",
"not",
"None",
":",
"try",
":",
"data",
"=",
"add_device_override",
"(",
"{",
"*",
"*",
"self",
".",
"c... | [
254,
4
] | [
268,
9
] | python | en | ['es', 'en', 'en'] | True |
InsteonOptionsFlowHandler.async_step_add_x10 | (self, user_input=None) | Add an X10 device. | Add an X10 device. | async def async_step_add_x10(self, user_input=None):
"""Add an X10 device."""
errors = {}
if user_input is not None:
options = add_x10_device({**self.config_entry.options}, user_input)
async_dispatcher_send(self.hass, SIGNAL_ADD_X10_DEVICE, user_input)
return ... | [
"async",
"def",
"async_step_add_x10",
"(",
"self",
",",
"user_input",
"=",
"None",
")",
":",
"errors",
"=",
"{",
"}",
"if",
"user_input",
"is",
"not",
"None",
":",
"options",
"=",
"add_x10_device",
"(",
"{",
"*",
"*",
"self",
".",
"config_entry",
".",
... | [
270,
4
] | [
281,
9
] | python | en | ['en', 'pl', 'en'] | True |
InsteonOptionsFlowHandler.async_step_remove_override | (self, user_input=None) | Remove a device override. | Remove a device override. | async def async_step_remove_override(self, user_input=None):
"""Remove a device override."""
errors = {}
options = self.config_entry.options
if user_input is not None:
options = _remove_override(user_input[CONF_ADDRESS], options)
async_dispatcher_send(
... | [
"async",
"def",
"async_step_remove_override",
"(",
"self",
",",
"user_input",
"=",
"None",
")",
":",
"errors",
"=",
"{",
"}",
"options",
"=",
"self",
".",
"config_entry",
".",
"options",
"if",
"user_input",
"is",
"not",
"None",
":",
"options",
"=",
"_remov... | [
283,
4
] | [
299,
9
] | python | en | ['es', 'it', 'en'] | False |
InsteonOptionsFlowHandler.async_step_remove_x10 | (self, user_input=None) | Remove an X10 device. | Remove an X10 device. | async def async_step_remove_x10(self, user_input=None):
"""Remove an X10 device."""
errors = {}
options = self.config_entry.options
if user_input is not None:
options, housecode, unitcode = _remove_x10(user_input[CONF_DEVICE], options)
async_dispatcher_send(
... | [
"async",
"def",
"async_step_remove_x10",
"(",
"self",
",",
"user_input",
"=",
"None",
")",
":",
"errors",
"=",
"{",
"}",
"options",
"=",
"self",
".",
"config_entry",
".",
"options",
"if",
"user_input",
"is",
"not",
"None",
":",
"options",
",",
"housecode",... | [
301,
4
] | [
315,
9
] | python | en | ['en', 'en', 'en'] | True |
TadoZoneEntity.__init__ | (self, zone_name, device_info, device_id, zone_id) | Initialize an August device. | Initialize an August device. | def __init__(self, zone_name, device_info, device_id, zone_id):
"""Initialize an August device."""
super().__init__()
self._device_zone_id = f"{device_id}_{zone_id}"
self._device_info = device_info
self.zone_name = zone_name | [
"def",
"__init__",
"(",
"self",
",",
"zone_name",
",",
"device_info",
",",
"device_id",
",",
"zone_id",
")",
":",
"super",
"(",
")",
".",
"__init__",
"(",
")",
"self",
".",
"_device_zone_id",
"=",
"f\"{device_id}_{zone_id}\"",
"self",
".",
"_device_info",
"=... | [
9,
4
] | [
14,
34
] | python | en | ['en', 'en', 'en'] | True |
TadoZoneEntity.device_info | (self) | Return the device_info of the device. | Return the device_info of the device. | def device_info(self):
"""Return the device_info of the device."""
return {
"identifiers": {(DOMAIN, self._device_zone_id)},
"name": self.zone_name,
"manufacturer": DEFAULT_NAME,
"sw_version": self._device_info["currentFwVersion"],
"model": sel... | [
"def",
"device_info",
"(",
"self",
")",
":",
"return",
"{",
"\"identifiers\"",
":",
"{",
"(",
"DOMAIN",
",",
"self",
".",
"_device_zone_id",
")",
"}",
",",
"\"name\"",
":",
"self",
".",
"zone_name",
",",
"\"manufacturer\"",
":",
"DEFAULT_NAME",
",",
"\"sw_... | [
17,
4
] | [
26,
9
] | python | en | ['en', 'en', 'en'] | True |
TadoZoneEntity.should_poll | (self) | Do not poll. | Do not poll. | def should_poll(self):
"""Do not poll."""
return False | [
"def",
"should_poll",
"(",
"self",
")",
":",
"return",
"False"
] | [
29,
4
] | [
31,
20
] | python | en | ['en', 'lb', 'en'] | True |
hass_recorder | () | Home Assistant fixture with in-memory recorder. | Home Assistant fixture with in-memory recorder. | def hass_recorder():
"""Home Assistant fixture with in-memory recorder."""
hass = get_test_home_assistant()
def setup_recorder(config=None):
"""Set up with params."""
init_recorder_component(hass, config)
hass.start()
hass.block_till_done()
hass.data[DATA_INSTANCE].b... | [
"def",
"hass_recorder",
"(",
")",
":",
"hass",
"=",
"get_test_home_assistant",
"(",
")",
"def",
"setup_recorder",
"(",
"config",
"=",
"None",
")",
":",
"\"\"\"Set up with params.\"\"\"",
"init_recorder_component",
"(",
"hass",
",",
"config",
")",
"hass",
".",
"s... | [
10,
0
] | [
23,
15
] | python | en | ['en', 'en', 'en'] | True |
random_uuid_hex | () | Generate a random UUID hex.
This uuid should not be used for cryptographically secure
operations.
| Generate a random UUID hex. | def random_uuid_hex() -> str:
"""Generate a random UUID hex.
This uuid should not be used for cryptographically secure
operations.
"""
return "%032x" % getrandbits(32 * 4) | [
"def",
"random_uuid_hex",
"(",
")",
"->",
"str",
":",
"return",
"\"%032x\"",
"%",
"getrandbits",
"(",
"32",
"*",
"4",
")"
] | [
5,
0
] | [
11,
40
] | python | en | ['en', 'co', 'en'] | True |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.