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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
EcoalTempSensor.__init__ | (self, ecoal_contr, name, status_attr) | Initialize the sensor. | Initialize the sensor. | def __init__(self, ecoal_contr, name, status_attr):
"""Initialize the sensor."""
self._ecoal_contr = ecoal_contr
self._name = name
self._status_attr = status_attr
self._state = None | [
"def",
"__init__",
"(",
"self",
",",
"ecoal_contr",
",",
"name",
",",
"status_attr",
")",
":",
"self",
".",
"_ecoal_contr",
"=",
"ecoal_contr",
"self",
".",
"_name",
"=",
"name",
"self",
".",
"_status_attr",
"=",
"status_attr",
"self",
".",
"_state",
"=",
... | [
22,
4
] | [
27,
26
] | python | en | ['en', 'en', 'en'] | True |
EcoalTempSensor.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"
] | [
30,
4
] | [
32,
25
] | python | en | ['en', 'mi', 'en'] | True |
EcoalTempSensor.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"
] | [
35,
4
] | [
37,
26
] | python | en | ['en', 'en', 'en'] | True |
EcoalTempSensor.device_class | (self) | Return the class of this device, from component DEVICE_CLASSES. | Return the class of this device, from component DEVICE_CLASSES. | def device_class(self):
"""Return the class of this device, from component DEVICE_CLASSES."""
return DEVICE_CLASS_TEMPERATURE | [
"def",
"device_class",
"(",
"self",
")",
":",
"return",
"DEVICE_CLASS_TEMPERATURE"
] | [
40,
4
] | [
42,
39
] | python | en | ['en', 'en', 'en'] | True |
EcoalTempSensor.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 TEMP_CELSIUS | [
"def",
"native_unit_of_measurement",
"(",
"self",
")",
":",
"return",
"TEMP_CELSIUS"
] | [
45,
4
] | [
47,
27
] | python | en | ['en', 'la', 'en'] | True |
EcoalTempSensor.update | (self) | Fetch new state data for the sensor.
This is the only method that should fetch new data for Home Assistant.
| Fetch new state data for the sensor. | def update(self):
"""Fetch new state data for the sensor.
This is the only method that should fetch new data for Home Assistant.
"""
# Old values read 0.5 back can still be used
status = self._ecoal_contr.get_cached_status()
self._state = getattr(status, self._status_att... | [
"def",
"update",
"(",
"self",
")",
":",
"# Old values read 0.5 back can still be used",
"status",
"=",
"self",
".",
"_ecoal_contr",
".",
"get_cached_status",
"(",
")",
"self",
".",
"_state",
"=",
"getattr",
"(",
"status",
",",
"self",
".",
"_status_attr",
")"
] | [
49,
4
] | [
56,
56
] | python | en | ['en', 'en', 'en'] | True |
test_creating_entry_tries_discover | (hass) | Test setting up does discovery. | Test setting up does discovery. | async def test_creating_entry_tries_discover(hass):
"""Test setting up does discovery."""
with patch(
"homeassistant.components.tplink.async_setup_entry",
return_value=mock_coro(True),
) as mock_setup, patch(
"homeassistant.components.tplink.common.Discover.discover",
return_... | [
"async",
"def",
"test_creating_entry_tries_discover",
"(",
"hass",
")",
":",
"with",
"patch",
"(",
"\"homeassistant.components.tplink.async_setup_entry\"",
",",
"return_value",
"=",
"mock_coro",
"(",
"True",
")",
",",
")",
"as",
"mock_setup",
",",
"patch",
"(",
"\"h... | [
39,
0
] | [
60,
42
] | python | en | ['fr', 'en', 'en'] | True |
test_configuring_tplink_causes_discovery | (hass) | Test that specifying empty config does discovery. | Test that specifying empty config does discovery. | async def test_configuring_tplink_causes_discovery(hass):
"""Test that specifying empty config does discovery."""
with patch("homeassistant.components.tplink.common.Discover.discover") as discover:
discover.return_value = {"host": 1234}
await async_setup_component(hass, tplink.DOMAIN, {tplink.DO... | [
"async",
"def",
"test_configuring_tplink_causes_discovery",
"(",
"hass",
")",
":",
"with",
"patch",
"(",
"\"homeassistant.components.tplink.common.Discover.discover\"",
")",
"as",
"discover",
":",
"discover",
".",
"return_value",
"=",
"{",
"\"host\"",
":",
"1234",
"}",
... | [
63,
0
] | [
70,
40
] | python | en | ['en', 'en', 'en'] | True |
test_configuring_device_types | (hass, name, cls, platform, count) | Test that light or switch platform list is filled correctly. | Test that light or switch platform list is filled correctly. | async def test_configuring_device_types(hass, name, cls, platform, count):
"""Test that light or switch platform list is filled correctly."""
with patch(
"homeassistant.components.tplink.common.Discover.discover"
) as discover, patch(
"homeassistant.components.tplink.common.SmartDevice._quer... | [
"async",
"def",
"test_configuring_device_types",
"(",
"hass",
",",
"name",
",",
"cls",
",",
"platform",
",",
"count",
")",
":",
"with",
"patch",
"(",
"\"homeassistant.components.tplink.common.Discover.discover\"",
")",
"as",
"discover",
",",
"patch",
"(",
"\"homeass... | [
81,
0
] | [
99,
59
] | python | en | ['en', 'en', 'en'] | True |
test_configuring_devices_from_multiple_sources | (hass) | Test static and discover devices are not duplicated. | Test static and discover devices are not duplicated. | async def test_configuring_devices_from_multiple_sources(hass):
"""Test static and discover devices are not duplicated."""
with patch(
"homeassistant.components.tplink.common.Discover.discover"
) as discover, patch(
"homeassistant.components.tplink.common.SmartDevice._query_helper"
), pa... | [
"async",
"def",
"test_configuring_devices_from_multiple_sources",
"(",
"hass",
")",
":",
"with",
"patch",
"(",
"\"homeassistant.components.tplink.common.Discover.discover\"",
")",
"as",
"discover",
",",
"patch",
"(",
"\"homeassistant.components.tplink.common.SmartDevice._query_help... | [
124,
0
] | [
160,
62
] | python | en | ['en', 'en', 'en'] | True |
test_is_dimmable | (hass) | Test that is_dimmable switches are correctly added as lights. | Test that is_dimmable switches are correctly added as lights. | async def test_is_dimmable(hass):
"""Test that is_dimmable switches are correctly added as lights."""
with patch(
"homeassistant.components.tplink.common.Discover.discover"
) as discover, patch(
"homeassistant.components.tplink.light.async_setup_entry",
return_value=mock_coro(True),
... | [
"async",
"def",
"test_is_dimmable",
"(",
"hass",
")",
":",
"with",
"patch",
"(",
"\"homeassistant.components.tplink.common.Discover.discover\"",
")",
"as",
"discover",
",",
"patch",
"(",
"\"homeassistant.components.tplink.light.async_setup_entry\"",
",",
"return_value",
"=",
... | [
163,
0
] | [
184,
52
] | python | en | ['en', 'en', 'en'] | True |
test_configuring_discovery_disabled | (hass) | Test that discover does not get called when disabled. | Test that discover does not get called when disabled. | async def test_configuring_discovery_disabled(hass):
"""Test that discover does not get called when disabled."""
with patch(
"homeassistant.components.tplink.async_setup_entry",
return_value=mock_coro(True),
) as mock_setup, patch(
"homeassistant.components.tplink.common.Discover.dis... | [
"async",
"def",
"test_configuring_discovery_disabled",
"(",
"hass",
")",
":",
"with",
"patch",
"(",
"\"homeassistant.components.tplink.async_setup_entry\"",
",",
"return_value",
"=",
"mock_coro",
"(",
"True",
")",
",",
")",
"as",
"mock_setup",
",",
"patch",
"(",
"\"... | [
187,
0
] | [
201,
37
] | python | en | ['en', 'en', 'en'] | True |
test_platforms_are_initialized | (hass: HomeAssistant) | Test that platforms are initialized per configuration array. | Test that platforms are initialized per configuration array. | async def test_platforms_are_initialized(hass: HomeAssistant):
"""Test that platforms are initialized per configuration array."""
config = {
tplink.DOMAIN: {
CONF_DISCOVERY: False,
CONF_LIGHT: [{CONF_HOST: "123.123.123.123"}],
CONF_SWITCH: [{CONF_HOST: "321.321.321.32... | [
"async",
"def",
"test_platforms_are_initialized",
"(",
"hass",
":",
"HomeAssistant",
")",
":",
"config",
"=",
"{",
"tplink",
".",
"DOMAIN",
":",
"{",
"CONF_DISCOVERY",
":",
"False",
",",
"CONF_LIGHT",
":",
"[",
"{",
"CONF_HOST",
":",
"\"123.123.123.123\"",
"}"... | [
204,
0
] | [
259,
68
] | python | en | ['en', 'en', 'en'] | True |
test_smartplug_without_consumption_sensors | (hass: HomeAssistant) | Test that platforms are initialized per configuration array. | Test that platforms are initialized per configuration array. | async def test_smartplug_without_consumption_sensors(hass: HomeAssistant):
"""Test that platforms are initialized per configuration array."""
config = {
tplink.DOMAIN: {
CONF_DISCOVERY: False,
CONF_SWITCH: [{CONF_HOST: "321.321.321.321"}],
}
}
with patch("homeass... | [
"async",
"def",
"test_smartplug_without_consumption_sensors",
"(",
"hass",
":",
"HomeAssistant",
")",
":",
"config",
"=",
"{",
"tplink",
".",
"DOMAIN",
":",
"{",
"CONF_DISCOVERY",
":",
"False",
",",
"CONF_SWITCH",
":",
"[",
"{",
"CONF_HOST",
":",
"\"321.321.321.... | [
262,
0
] | [
293,
33
] | python | en | ['en', 'en', 'en'] | True |
test_smartstrip_device | (hass: HomeAssistant) | Test discover a SmartStrip devices. | Test discover a SmartStrip devices. | async def test_smartstrip_device(hass: HomeAssistant):
"""Test discover a SmartStrip devices."""
config = {
tplink.DOMAIN: {
CONF_DISCOVERY: True,
}
}
class SmartStrip(smartstrip.SmartStrip):
"""Moked SmartStrip class."""
def get_sysinfo(self):
r... | [
"async",
"def",
"test_smartstrip_device",
"(",
"hass",
":",
"HomeAssistant",
")",
":",
"config",
"=",
"{",
"tplink",
".",
"DOMAIN",
":",
"{",
"CONF_DISCOVERY",
":",
"True",
",",
"}",
"}",
"class",
"SmartStrip",
"(",
"smartstrip",
".",
"SmartStrip",
")",
":... | [
296,
0
] | [
326,
33
] | python | en | ['ro', 'en', 'en'] | True |
test_no_config_creates_no_entry | (hass) | Test for when there is no tplink in config. | Test for when there is no tplink in config. | async def test_no_config_creates_no_entry(hass):
"""Test for when there is no tplink in config."""
with patch(
"homeassistant.components.tplink.async_setup_entry",
return_value=mock_coro(True),
) as mock_setup:
await async_setup_component(hass, tplink.DOMAIN, {})
await hass.a... | [
"async",
"def",
"test_no_config_creates_no_entry",
"(",
"hass",
")",
":",
"with",
"patch",
"(",
"\"homeassistant.components.tplink.async_setup_entry\"",
",",
"return_value",
"=",
"mock_coro",
"(",
"True",
")",
",",
")",
"as",
"mock_setup",
":",
"await",
"async_setup_c... | [
329,
0
] | [
338,
37
] | python | en | ['en', 'en', 'en'] | True |
test_not_available_at_startup | (hass: HomeAssistant) | Test when configured devices are not available. | Test when configured devices are not available. | async def test_not_available_at_startup(hass: HomeAssistant):
"""Test when configured devices are not available."""
config = {
tplink.DOMAIN: {
CONF_DISCOVERY: False,
CONF_SWITCH: [{CONF_HOST: "321.321.321.321"}],
}
}
with patch("homeassistant.components.tplink.c... | [
"async",
"def",
"test_not_available_at_startup",
"(",
"hass",
":",
"HomeAssistant",
")",
":",
"config",
"=",
"{",
"tplink",
".",
"DOMAIN",
":",
"{",
"CONF_DISCOVERY",
":",
"False",
",",
"CONF_SWITCH",
":",
"[",
"{",
"CONF_HOST",
":",
"\"321.321.321.321\"",
"}"... | [
341,
0
] | [
397,
33
] | python | en | ['en', 'en', 'en'] | True |
test_unload | (hass, platform) | Test that the async_unload_entry works. | Test that the async_unload_entry works. | async def test_unload(hass, platform):
"""Test that the async_unload_entry works."""
# As we have currently no configuration, we just to pass the domain here.
entry = MockConfigEntry(domain=tplink.DOMAIN)
entry.add_to_hass(hass)
with patch(
"homeassistant.components.tplink.get_static_device... | [
"async",
"def",
"test_unload",
"(",
"hass",
",",
"platform",
")",
":",
"# As we have currently no configuration, we just to pass the domain here.",
"entry",
"=",
"MockConfigEntry",
"(",
"domain",
"=",
"tplink",
".",
"DOMAIN",
")",
"entry",
".",
"add_to_hass",
"(",
"ha... | [
401,
0
] | [
440,
39
] | python | en | ['en', 'en', 'en'] | True |
UnknownSmartDevice.has_emeter | (self) | Do nothing. | Do nothing. | def has_emeter(self) -> bool:
"""Do nothing.""" | [
"def",
"has_emeter",
"(",
"self",
")",
"->",
"bool",
":"
] | [
106,
4
] | [
107,
25
] | python | en | ['en', 'zu', 'en'] | False |
UnknownSmartDevice.turn_off | (self) | Do nothing. | Do nothing. | def turn_off(self) -> None:
"""Do nothing.""" | [
"def",
"turn_off",
"(",
"self",
")",
"->",
"None",
":"
] | [
109,
4
] | [
110,
25
] | python | en | ['en', 'zu', 'en'] | False |
UnknownSmartDevice.turn_on | (self) | Do nothing. | Do nothing. | def turn_on(self) -> None:
"""Do nothing.""" | [
"def",
"turn_on",
"(",
"self",
")",
"->",
"None",
":"
] | [
112,
4
] | [
113,
25
] | python | en | ['en', 'zu', 'en'] | False |
UnknownSmartDevice.is_on | (self) | Do nothing. | Do nothing. | def is_on(self) -> bool:
"""Do nothing.""" | [
"def",
"is_on",
"(",
"self",
")",
"->",
"bool",
":"
] | [
116,
4
] | [
117,
25
] | python | en | ['en', 'zu', 'en'] | False |
UnknownSmartDevice.state_information | (self) | Do nothing. | Do nothing. | def state_information(self) -> dict[str, Any]:
"""Do nothing.""" | [
"def",
"state_information",
"(",
"self",
")",
"->",
"dict",
"[",
"str",
",",
"Any",
"]",
":"
] | [
120,
4
] | [
121,
25
] | python | en | ['en', 'zu', 'en'] | False |
async_setup | (hass: HomeAssistant, config: ConfigType) | Set up the Firmata domain. | Set up the Firmata domain. | async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
"""Set up the Firmata domain."""
# Delete specific entries that no longer exist in the config
if hass.config_entries.async_entries(DOMAIN):
for entry in hass.config_entries.async_entries(DOMAIN):
remove = True
... | [
"async",
"def",
"async_setup",
"(",
"hass",
":",
"HomeAssistant",
",",
"config",
":",
"ConfigType",
")",
"->",
"bool",
":",
"# Delete specific entries that no longer exist in the config",
"if",
"hass",
".",
"config_entries",
".",
"async_entries",
"(",
"DOMAIN",
")",
... | [
125,
0
] | [
157,
15
] | python | en | ['en', 'en', 'en'] | True |
async_setup_entry | (
hass: HomeAssistant, config_entry: config_entries.ConfigEntry
) | Set up a Firmata board for a config entry. | Set up a Firmata board for a config entry. | async def async_setup_entry(
hass: HomeAssistant, config_entry: config_entries.ConfigEntry
) -> bool:
"""Set up a Firmata board for a config entry."""
if DOMAIN not in hass.data:
hass.data[DOMAIN] = {}
_LOGGER.debug(
"Setting up Firmata id %s, name %s, config %s",
config_entry.e... | [
"async",
"def",
"async_setup_entry",
"(",
"hass",
":",
"HomeAssistant",
",",
"config_entry",
":",
"config_entries",
".",
"ConfigEntry",
")",
"->",
"bool",
":",
"if",
"DOMAIN",
"not",
"in",
"hass",
".",
"data",
":",
"hass",
".",
"data",
"[",
"DOMAIN",
"]",
... | [
160,
0
] | [
206,
15
] | python | en | ['en', 'en', 'en'] | True |
async_unload_entry | (
hass: HomeAssistant, config_entry: config_entries.ConfigEntry
) | Shutdown and close a Firmata board for a config entry. | Shutdown and close a Firmata board for a config entry. | async def async_unload_entry(
hass: HomeAssistant, config_entry: config_entries.ConfigEntry
) -> None:
"""Shutdown and close a Firmata board for a config entry."""
_LOGGER.debug("Closing Firmata board %s", config_entry.data[CONF_NAME])
unload_entries = []
for (conf, platform) in CONF_PLATFORM_MAP.i... | [
"async",
"def",
"async_unload_entry",
"(",
"hass",
":",
"HomeAssistant",
",",
"config_entry",
":",
"config_entries",
".",
"ConfigEntry",
")",
"->",
"None",
":",
"_LOGGER",
".",
"debug",
"(",
"\"Closing Firmata board %s\"",
",",
"config_entry",
".",
"data",
"[",
... | [
209,
0
] | [
226,
31
] | python | en | ['en', 'en', 'en'] | True |
test_thermostat | (hass, hk_driver, events) | Test if accessory and HA are updated accordingly. | Test if accessory and HA are updated accordingly. | async def test_thermostat(hass, hk_driver, events):
"""Test if accessory and HA are updated accordingly."""
entity_id = "climate.test"
hass.states.async_set(
entity_id,
HVAC_MODE_OFF,
{
ATTR_SUPPORTED_FEATURES: SUPPORT_TARGET_TEMPERATURE,
ATTR_HVAC_MODES: [
... | [
"async",
"def",
"test_thermostat",
"(",
"hass",
",",
"hk_driver",
",",
"events",
")",
":",
"entity_id",
"=",
"\"climate.test\"",
"hass",
".",
"states",
".",
"async_set",
"(",
"entity_id",
",",
"HVAC_MODE_OFF",
",",
"{",
"ATTR_SUPPORTED_FEATURES",
":",
"SUPPORT_T... | [
68,
0
] | [
405,
74
] | python | en | ['en', 'en', 'en'] | True |
test_thermostat_auto | (hass, hk_driver, events) | Test if accessory and HA are updated accordingly. | Test if accessory and HA are updated accordingly. | async def test_thermostat_auto(hass, hk_driver, events):
"""Test if accessory and HA are updated accordingly."""
entity_id = "climate.test"
# support_auto = True
hass.states.async_set(
entity_id,
HVAC_MODE_OFF,
{
ATTR_SUPPORTED_FEATURES: SUPPORT_TARGET_TEMPERATURE
... | [
"async",
"def",
"test_thermostat_auto",
"(",
"hass",
",",
"hk_driver",
",",
"events",
")",
":",
"entity_id",
"=",
"\"climate.test\"",
"# support_auto = True",
"hass",
".",
"states",
".",
"async_set",
"(",
"entity_id",
",",
"HVAC_MODE_OFF",
",",
"{",
"ATTR_SUPPORTE... | [
408,
0
] | [
559,
5
] | python | en | ['en', 'en', 'en'] | True |
test_thermostat_humidity | (hass, hk_driver, events) | Test if accessory and HA are updated accordingly with humidity. | Test if accessory and HA are updated accordingly with humidity. | async def test_thermostat_humidity(hass, hk_driver, events):
"""Test if accessory and HA are updated accordingly with humidity."""
entity_id = "climate.test"
# support_auto = True
hass.states.async_set(entity_id, HVAC_MODE_OFF, {ATTR_SUPPORTED_FEATURES: 4})
await hass.async_block_till_done()
ac... | [
"async",
"def",
"test_thermostat_humidity",
"(",
"hass",
",",
"hk_driver",
",",
"events",
")",
":",
"entity_id",
"=",
"\"climate.test\"",
"# support_auto = True",
"hass",
".",
"states",
".",
"async_set",
"(",
"entity_id",
",",
"HVAC_MODE_OFF",
",",
"{",
"ATTR_SUPP... | [
562,
0
] | [
618,
47
] | python | en | ['en', 'en', 'en'] | True |
test_thermostat_power_state | (hass, hk_driver, events) | Test if accessory and HA are updated accordingly. | Test if accessory and HA are updated accordingly. | async def test_thermostat_power_state(hass, hk_driver, events):
"""Test if accessory and HA are updated accordingly."""
entity_id = "climate.test"
# SUPPORT_ON_OFF = True
hass.states.async_set(
entity_id,
HVAC_MODE_HEAT,
{
ATTR_SUPPORTED_FEATURES: 4096,
A... | [
"async",
"def",
"test_thermostat_power_state",
"(",
"hass",
",",
"hk_driver",
",",
"events",
")",
":",
"entity_id",
"=",
"\"climate.test\"",
"# SUPPORT_ON_OFF = True",
"hass",
".",
"states",
".",
"async_set",
"(",
"entity_id",
",",
"HVAC_MODE_HEAT",
",",
"{",
"ATT... | [
621,
0
] | [
738,
47
] | python | en | ['en', 'en', 'en'] | True |
test_thermostat_fahrenheit | (hass, hk_driver, events) | Test if accessory and HA are updated accordingly. | Test if accessory and HA are updated accordingly. | async def test_thermostat_fahrenheit(hass, hk_driver, events):
"""Test if accessory and HA are updated accordingly."""
entity_id = "climate.test"
# support_ = True
hass.states.async_set(
entity_id,
HVAC_MODE_OFF,
{
ATTR_SUPPORTED_FEATURES: SUPPORT_TARGET_TEMPERATURE
... | [
"async",
"def",
"test_thermostat_fahrenheit",
"(",
"hass",
",",
"hk_driver",
",",
"events",
")",
":",
"entity_id",
"=",
"\"climate.test\"",
"# support_ = True",
"hass",
".",
"states",
".",
"async_set",
"(",
"entity_id",
",",
"HVAC_MODE_OFF",
",",
"{",
"ATTR_SUPPOR... | [
741,
0
] | [
847,
72
] | python | en | ['en', 'en', 'en'] | True |
test_thermostat_get_temperature_range | (hass, hk_driver) | Test if temperature range is evaluated correctly. | Test if temperature range is evaluated correctly. | async def test_thermostat_get_temperature_range(hass, hk_driver):
"""Test if temperature range is evaluated correctly."""
entity_id = "climate.test"
hass.states.async_set(entity_id, HVAC_MODE_OFF)
await hass.async_block_till_done()
acc = Thermostat(hass, hk_driver, "Climate", entity_id, 2, None)
... | [
"async",
"def",
"test_thermostat_get_temperature_range",
"(",
"hass",
",",
"hk_driver",
")",
":",
"entity_id",
"=",
"\"climate.test\"",
"hass",
".",
"states",
".",
"async_set",
"(",
"entity_id",
",",
"HVAC_MODE_OFF",
")",
"await",
"hass",
".",
"async_block_till_done... | [
850,
0
] | [
869,
54
] | python | en | ['en', 'en', 'en'] | True |
test_thermostat_temperature_step_whole | (hass, hk_driver) | Test climate device with single digit precision. | Test climate device with single digit precision. | async def test_thermostat_temperature_step_whole(hass, hk_driver):
"""Test climate device with single digit precision."""
entity_id = "climate.test"
hass.states.async_set(entity_id, HVAC_MODE_OFF, {ATTR_TARGET_TEMP_STEP: 1})
await hass.async_block_till_done()
acc = Thermostat(hass, hk_driver, "Clim... | [
"async",
"def",
"test_thermostat_temperature_step_whole",
"(",
"hass",
",",
"hk_driver",
")",
":",
"entity_id",
"=",
"\"climate.test\"",
"hass",
".",
"states",
".",
"async_set",
"(",
"entity_id",
",",
"HVAC_MODE_OFF",
",",
"{",
"ATTR_TARGET_TEMP_STEP",
":",
"1",
"... | [
872,
0
] | [
884,
64
] | python | en | ['en', 'en', 'en'] | True |
test_thermostat_restore | (hass, hk_driver, events) | Test setting up an entity from state in the event registry. | Test setting up an entity from state in the event registry. | async def test_thermostat_restore(hass, hk_driver, events):
"""Test setting up an entity from state in the event registry."""
hass.state = CoreState.not_running
registry = er.async_get(hass)
registry.async_get_or_create(
"climate", "generic", "1234", suggested_object_id="simple"
)
regi... | [
"async",
"def",
"test_thermostat_restore",
"(",
"hass",
",",
"hk_driver",
",",
"events",
")",
":",
"hass",
".",
"state",
"=",
"CoreState",
".",
"not_running",
"registry",
"=",
"er",
".",
"async_get",
"(",
"hass",
")",
"registry",
".",
"async_get_or_create",
... | [
887,
0
] | [
929,
5
] | python | en | ['en', 'en', 'en'] | True |
test_thermostat_hvac_modes | (hass, hk_driver) | Test if unsupported HVAC modes are deactivated in HomeKit. | Test if unsupported HVAC modes are deactivated in HomeKit. | async def test_thermostat_hvac_modes(hass, hk_driver):
"""Test if unsupported HVAC modes are deactivated in HomeKit."""
entity_id = "climate.test"
hass.states.async_set(
entity_id, HVAC_MODE_OFF, {ATTR_HVAC_MODES: [HVAC_MODE_HEAT, HVAC_MODE_OFF]}
)
await hass.async_block_till_done()
ac... | [
"async",
"def",
"test_thermostat_hvac_modes",
"(",
"hass",
",",
"hk_driver",
")",
":",
"entity_id",
"=",
"\"climate.test\"",
"hass",
".",
"states",
".",
"async_set",
"(",
"entity_id",
",",
"HVAC_MODE_OFF",
",",
"{",
"ATTR_HVAC_MODES",
":",
"[",
"HVAC_MODE_HEAT",
... | [
932,
0
] | [
962,
47
] | python | en | ['en', 'en', 'en'] | True |
test_thermostat_hvac_modes_with_auto_heat_cool | (hass, hk_driver) | Test we get heat cool over auto. | Test we get heat cool over auto. | async def test_thermostat_hvac_modes_with_auto_heat_cool(hass, hk_driver):
"""Test we get heat cool over auto."""
entity_id = "climate.test"
hass.states.async_set(
entity_id,
HVAC_MODE_OFF,
{
ATTR_HVAC_MODES: [
HVAC_MODE_HEAT_COOL,
HVAC_MO... | [
"async",
"def",
"test_thermostat_hvac_modes_with_auto_heat_cool",
"(",
"hass",
",",
"hk_driver",
")",
":",
"entity_id",
"=",
"\"climate.test\"",
"hass",
".",
"states",
".",
"async_set",
"(",
"entity_id",
",",
"HVAC_MODE_OFF",
",",
"{",
"ATTR_HVAC_MODES",
":",
"[",
... | [
965,
0
] | [
1025,
47
] | python | en | ['nl', 'en', 'en'] | True |
test_thermostat_hvac_modes_with_auto_no_heat_cool | (hass, hk_driver) | Test we get auto when there is no heat cool. | Test we get auto when there is no heat cool. | async def test_thermostat_hvac_modes_with_auto_no_heat_cool(hass, hk_driver):
"""Test we get auto when there is no heat cool."""
entity_id = "climate.test"
hass.states.async_set(
entity_id,
HVAC_MODE_HEAT,
{ATTR_HVAC_MODES: [HVAC_MODE_AUTO, HVAC_MODE_HEAT, HVAC_MODE_OFF]},
)
... | [
"async",
"def",
"test_thermostat_hvac_modes_with_auto_no_heat_cool",
"(",
"hass",
",",
"hk_driver",
")",
":",
"entity_id",
"=",
"\"climate.test\"",
"hass",
".",
"states",
".",
"async_set",
"(",
"entity_id",
",",
"HVAC_MODE_HEAT",
",",
"{",
"ATTR_HVAC_MODES",
":",
"[... | [
1028,
0
] | [
1082,
47
] | python | en | ['en', 'en', 'en'] | True |
test_thermostat_hvac_modes_with_auto_only | (hass, hk_driver) | Test if unsupported HVAC modes are deactivated in HomeKit. | Test if unsupported HVAC modes are deactivated in HomeKit. | async def test_thermostat_hvac_modes_with_auto_only(hass, hk_driver):
"""Test if unsupported HVAC modes are deactivated in HomeKit."""
entity_id = "climate.test"
hass.states.async_set(
entity_id, HVAC_MODE_AUTO, {ATTR_HVAC_MODES: [HVAC_MODE_AUTO, HVAC_MODE_OFF]}
)
await hass.async_block_ti... | [
"async",
"def",
"test_thermostat_hvac_modes_with_auto_only",
"(",
"hass",
",",
"hk_driver",
")",
":",
"entity_id",
"=",
"\"climate.test\"",
"hass",
".",
"states",
".",
"async_set",
"(",
"entity_id",
",",
"HVAC_MODE_AUTO",
",",
"{",
"ATTR_HVAC_MODES",
":",
"[",
"HV... | [
1085,
0
] | [
1136,
71
] | python | en | ['en', 'en', 'en'] | True |
test_thermostat_hvac_modes_with_heat_only | (hass, hk_driver) | Test if unsupported HVAC modes are deactivated in HomeKit and siri calls get converted to heat. | Test if unsupported HVAC modes are deactivated in HomeKit and siri calls get converted to heat. | async def test_thermostat_hvac_modes_with_heat_only(hass, hk_driver):
"""Test if unsupported HVAC modes are deactivated in HomeKit and siri calls get converted to heat."""
entity_id = "climate.test"
hass.states.async_set(
entity_id, HVAC_MODE_HEAT, {ATTR_HVAC_MODES: [HVAC_MODE_HEAT, HVAC_MODE_OFF]}... | [
"async",
"def",
"test_thermostat_hvac_modes_with_heat_only",
"(",
"hass",
",",
"hk_driver",
")",
":",
"entity_id",
"=",
"\"climate.test\"",
"hass",
".",
"states",
".",
"async_set",
"(",
"entity_id",
",",
"HVAC_MODE_HEAT",
",",
"{",
"ATTR_HVAC_MODES",
":",
"[",
"HV... | [
1139,
0
] | [
1196,
71
] | python | en | ['en', 'en', 'en'] | True |
test_thermostat_hvac_modes_with_cool_only | (hass, hk_driver) | Test if unsupported HVAC modes are deactivated in HomeKit and siri calls get converted to cool. | Test if unsupported HVAC modes are deactivated in HomeKit and siri calls get converted to cool. | async def test_thermostat_hvac_modes_with_cool_only(hass, hk_driver):
"""Test if unsupported HVAC modes are deactivated in HomeKit and siri calls get converted to cool."""
entity_id = "climate.test"
hass.states.async_set(
entity_id, HVAC_MODE_COOL, {ATTR_HVAC_MODES: [HVAC_MODE_COOL, HVAC_MODE_OFF]}... | [
"async",
"def",
"test_thermostat_hvac_modes_with_cool_only",
"(",
"hass",
",",
"hk_driver",
")",
":",
"entity_id",
"=",
"\"climate.test\"",
"hass",
".",
"states",
".",
"async_set",
"(",
"entity_id",
",",
"HVAC_MODE_COOL",
",",
"{",
"ATTR_HVAC_MODES",
":",
"[",
"HV... | [
1199,
0
] | [
1255,
71
] | python | en | ['en', 'en', 'en'] | True |
test_thermostat_hvac_modes_with_heat_cool_only | (hass, hk_driver) | Test if unsupported HVAC modes are deactivated in HomeKit and siri calls get converted to heat or cool. | Test if unsupported HVAC modes are deactivated in HomeKit and siri calls get converted to heat or cool. | async def test_thermostat_hvac_modes_with_heat_cool_only(hass, hk_driver):
"""Test if unsupported HVAC modes are deactivated in HomeKit and siri calls get converted to heat or cool."""
entity_id = "climate.test"
hass.states.async_set(
entity_id,
HVAC_MODE_COOL,
{
ATTR_CU... | [
"async",
"def",
"test_thermostat_hvac_modes_with_heat_cool_only",
"(",
"hass",
",",
"hk_driver",
")",
":",
"entity_id",
"=",
"\"climate.test\"",
"hass",
".",
"states",
".",
"async_set",
"(",
"entity_id",
",",
"HVAC_MODE_COOL",
",",
"{",
"ATTR_CURRENT_TEMPERATURE",
":"... | [
1258,
0
] | [
1349,
71
] | python | en | ['en', 'en', 'en'] | True |
test_thermostat_hvac_modes_without_off | (hass, hk_driver) | Test a thermostat that has no off. | Test a thermostat that has no off. | async def test_thermostat_hvac_modes_without_off(hass, hk_driver):
"""Test a thermostat that has no off."""
entity_id = "climate.test"
hass.states.async_set(
entity_id, HVAC_MODE_AUTO, {ATTR_HVAC_MODES: [HVAC_MODE_AUTO, HVAC_MODE_HEAT]}
)
await hass.async_block_till_done()
acc = Thermo... | [
"async",
"def",
"test_thermostat_hvac_modes_without_off",
"(",
"hass",
",",
"hk_driver",
")",
":",
"entity_id",
"=",
"\"climate.test\"",
"hass",
".",
"states",
".",
"async_set",
"(",
"entity_id",
",",
"HVAC_MODE_AUTO",
",",
"{",
"ATTR_HVAC_MODES",
":",
"[",
"HVAC_... | [
1352,
0
] | [
1386,
47
] | python | en | ['en', 'en', 'en'] | True |
test_thermostat_without_target_temp_only_range | (hass, hk_driver, events) | Test a thermostat that only supports a range. | Test a thermostat that only supports a range. | async def test_thermostat_without_target_temp_only_range(hass, hk_driver, events):
"""Test a thermostat that only supports a range."""
entity_id = "climate.test"
# support_auto = True
hass.states.async_set(
entity_id,
HVAC_MODE_OFF,
{ATTR_SUPPORTED_FEATURES: SUPPORT_TARGET_TEMPE... | [
"async",
"def",
"test_thermostat_without_target_temp_only_range",
"(",
"hass",
",",
"hk_driver",
",",
"events",
")",
":",
"entity_id",
"=",
"\"climate.test\"",
"# support_auto = True",
"hass",
".",
"states",
".",
"async_set",
"(",
"entity_id",
",",
"HVAC_MODE_OFF",
",... | [
1389,
0
] | [
1568,
82
] | python | en | ['en', 'en', 'en'] | True |
test_water_heater | (hass, hk_driver, events) | Test if accessory and HA are updated accordingly. | Test if accessory and HA are updated accordingly. | async def test_water_heater(hass, hk_driver, events):
"""Test if accessory and HA are updated accordingly."""
entity_id = "water_heater.test"
hass.states.async_set(entity_id, HVAC_MODE_HEAT)
await hass.async_block_till_done()
acc = WaterHeater(hass, hk_driver, "WaterHeater", entity_id, 2, None)
... | [
"async",
"def",
"test_water_heater",
"(",
"hass",
",",
"hk_driver",
",",
"events",
")",
":",
"entity_id",
"=",
"\"water_heater.test\"",
"hass",
".",
"states",
".",
"async_set",
"(",
"entity_id",
",",
"HVAC_MODE_HEAT",
")",
"await",
"hass",
".",
"async_block_till... | [
1571,
0
] | [
1646,
47
] | python | en | ['en', 'en', 'en'] | True |
test_water_heater_fahrenheit | (hass, hk_driver, events) | Test if accessory and HA are update accordingly. | Test if accessory and HA are update accordingly. | async def test_water_heater_fahrenheit(hass, hk_driver, events):
"""Test if accessory and HA are update accordingly."""
entity_id = "water_heater.test"
hass.states.async_set(entity_id, HVAC_MODE_HEAT)
await hass.async_block_till_done()
with patch.object(hass.config.units, CONF_TEMPERATURE_UNIT, new... | [
"async",
"def",
"test_water_heater_fahrenheit",
"(",
"hass",
",",
"hk_driver",
",",
"events",
")",
":",
"entity_id",
"=",
"\"water_heater.test\"",
"hass",
".",
"states",
".",
"async_set",
"(",
"entity_id",
",",
"HVAC_MODE_HEAT",
")",
"await",
"hass",
".",
"async... | [
1649,
0
] | [
1678,
52
] | python | en | ['en', 'en', 'en'] | True |
test_water_heater_get_temperature_range | (hass, hk_driver) | Test if temperature range is evaluated correctly. | Test if temperature range is evaluated correctly. | async def test_water_heater_get_temperature_range(hass, hk_driver):
"""Test if temperature range is evaluated correctly."""
entity_id = "water_heater.test"
hass.states.async_set(entity_id, HVAC_MODE_HEAT)
await hass.async_block_till_done()
acc = WaterHeater(hass, hk_driver, "WaterHeater", entity_id... | [
"async",
"def",
"test_water_heater_get_temperature_range",
"(",
"hass",
",",
"hk_driver",
")",
":",
"entity_id",
"=",
"\"water_heater.test\"",
"hass",
".",
"states",
".",
"async_set",
"(",
"entity_id",
",",
"HVAC_MODE_HEAT",
")",
"await",
"hass",
".",
"async_block_t... | [
1681,
0
] | [
1700,
54
] | python | en | ['en', 'en', 'en'] | True |
test_water_heater_restore | (hass, hk_driver, events) | Test setting up an entity from state in the event registry. | Test setting up an entity from state in the event registry. | async def test_water_heater_restore(hass, hk_driver, events):
"""Test setting up an entity from state in the event registry."""
hass.state = CoreState.not_running
registry = er.async_get(hass)
registry.async_get_or_create(
"water_heater", "generic", "1234", suggested_object_id="simple"
)
... | [
"async",
"def",
"test_water_heater_restore",
"(",
"hass",
",",
"hk_driver",
",",
"events",
")",
":",
"hass",
".",
"state",
"=",
"CoreState",
".",
"not_running",
"registry",
"=",
"er",
".",
"async_get",
"(",
"hass",
")",
"registry",
".",
"async_get_or_create",
... | [
1703,
0
] | [
1743,
5
] | python | en | ['en', 'en', 'en'] | True |
test_thermostat_with_no_modes_when_we_first_see | (hass, hk_driver, events) | Test if a thermostat that is not ready when we first see it. | Test if a thermostat that is not ready when we first see it. | async def test_thermostat_with_no_modes_when_we_first_see(hass, hk_driver, events):
"""Test if a thermostat that is not ready when we first see it."""
entity_id = "climate.test"
# support_auto = True
hass.states.async_set(
entity_id,
HVAC_MODE_OFF,
{
ATTR_SUPPORTED_F... | [
"async",
"def",
"test_thermostat_with_no_modes_when_we_first_see",
"(",
"hass",
",",
"hk_driver",
",",
"events",
")",
":",
"entity_id",
"=",
"\"climate.test\"",
"# support_auto = True",
"hass",
".",
"states",
".",
"async_set",
"(",
"entity_id",
",",
"HVAC_MODE_OFF",
"... | [
1746,
0
] | [
1796,
44
] | python | en | ['en', 'en', 'en'] | True |
test_thermostat_with_no_off_after_recheck | (hass, hk_driver, events) | Test if a thermostat that is not ready when we first see it that actually does not have off. | Test if a thermostat that is not ready when we first see it that actually does not have off. | async def test_thermostat_with_no_off_after_recheck(hass, hk_driver, events):
"""Test if a thermostat that is not ready when we first see it that actually does not have off."""
entity_id = "climate.test"
# support_auto = True
hass.states.async_set(
entity_id,
HVAC_MODE_COOL,
{
... | [
"async",
"def",
"test_thermostat_with_no_off_after_recheck",
"(",
"hass",
",",
"hk_driver",
",",
"events",
")",
":",
"entity_id",
"=",
"\"climate.test\"",
"# support_auto = True",
"hass",
".",
"states",
".",
"async_set",
"(",
"entity_id",
",",
"HVAC_MODE_COOL",
",",
... | [
1799,
0
] | [
1849,
44
] | python | en | ['en', 'en', 'en'] | True |
test_thermostat_with_temp_clamps | (hass, hk_driver, events) | Test that tempatures are clamped to valid values to prevent homekit crash. | Test that tempatures are clamped to valid values to prevent homekit crash. | async def test_thermostat_with_temp_clamps(hass, hk_driver, events):
"""Test that tempatures are clamped to valid values to prevent homekit crash."""
entity_id = "climate.test"
hass.states.async_set(
entity_id,
HVAC_MODE_COOL,
{
ATTR_SUPPORTED_FEATURES: SUPPORT_TARGET_TE... | [
"async",
"def",
"test_thermostat_with_temp_clamps",
"(",
"hass",
",",
"hk_driver",
",",
"events",
")",
":",
"entity_id",
"=",
"\"climate.test\"",
"hass",
".",
"states",
".",
"async_set",
"(",
"entity_id",
",",
"HVAC_MODE_COOL",
",",
"{",
"ATTR_SUPPORTED_FEATURES",
... | [
1852,
0
] | [
1903,
44
] | python | en | ['en', 'en', 'en'] | True |
VeSyncFlowHandler.__init__ | (self) | Instantiate config flow. | Instantiate config flow. | def __init__(self):
"""Instantiate config flow."""
self._username = None
self._password = None
self.data_schema = OrderedDict()
self.data_schema[vol.Required(CONF_USERNAME)] = str
self.data_schema[vol.Required(CONF_PASSWORD)] = str | [
"def",
"__init__",
"(",
"self",
")",
":",
"self",
".",
"_username",
"=",
"None",
"self",
".",
"_password",
"=",
"None",
"self",
".",
"data_schema",
"=",
"OrderedDict",
"(",
")",
"self",
".",
"data_schema",
"[",
"vol",
".",
"Required",
"(",
"CONF_USERNAME... | [
18,
4
] | [
24,
59
] | python | en | ['en', 'nl', 'en'] | True |
VeSyncFlowHandler._show_form | (self, errors=None) | Show form to the user. | Show form to the user. | def _show_form(self, errors=None):
"""Show form to the user."""
return self.async_show_form(
step_id="user",
data_schema=vol.Schema(self.data_schema),
errors=errors if errors else {},
) | [
"def",
"_show_form",
"(",
"self",
",",
"errors",
"=",
"None",
")",
":",
"return",
"self",
".",
"async_show_form",
"(",
"step_id",
"=",
"\"user\"",
",",
"data_schema",
"=",
"vol",
".",
"Schema",
"(",
"self",
".",
"data_schema",
")",
",",
"errors",
"=",
... | [
27,
4
] | [
33,
9
] | python | en | ['en', 'en', 'en'] | True |
VeSyncFlowHandler.async_step_user | (self, user_input=None) | Handle a flow start. | Handle a flow start. | async def async_step_user(self, user_input=None):
"""Handle a flow start."""
if self._async_current_entries():
return self.async_abort(reason="single_instance_allowed")
if not user_input:
return self._show_form()
self._username = user_input[CONF_USERNAME]
... | [
"async",
"def",
"async_step_user",
"(",
"self",
",",
"user_input",
"=",
"None",
")",
":",
"if",
"self",
".",
"_async_current_entries",
"(",
")",
":",
"return",
"self",
".",
"async_abort",
"(",
"reason",
"=",
"\"single_instance_allowed\"",
")",
"if",
"not",
"... | [
35,
4
] | [
54,
9
] | python | en | ['en', 'lb', 'en'] | True |
generate_mysql_errors | (root='.') |
Fetch the error code -> error #define mappings from dev.mysql.com
and write the mappings out to the generated source files:
zgrab2_schema/zgrab2/mysql_errors.py and lib/mysql/errors.go.
|
Fetch the error code -> error #define mappings from dev.mysql.com
and write the mappings out to the generated source files:
zgrab2_schema/zgrab2/mysql_errors.py and lib/mysql/errors.go.
| def generate_mysql_errors(root='.'):
"""
Fetch the error code -> error #define mappings from dev.mysql.com
and write the mappings out to the generated source files:
zgrab2_schema/zgrab2/mysql_errors.py and lib/mysql/errors.go.
"""
from requests import get
import re
li_pat = re.compile('<... | [
"def",
"generate_mysql_errors",
"(",
"root",
"=",
"'.'",
")",
":",
"from",
"requests",
"import",
"get",
"import",
"re",
"li_pat",
"=",
"re",
".",
"compile",
"(",
"'<li[^>]*>(.*?)</li>'",
",",
"re",
".",
"DOTALL",
")",
"urls",
"=",
"[",
"'https://dev.mysql.co... | [
76,
0
] | [
130,
23
] | python | en | ['en', 'error', 'th'] | False |
InlineResponseDefault.__init__ | (self, string=None, local_vars_configuration=None) | InlineResponseDefault - a model defined in OpenAPI | InlineResponseDefault - a model defined in OpenAPI | def __init__(self, string=None, local_vars_configuration=None): # noqa: E501
"""InlineResponseDefault - a model defined in OpenAPI""" # noqa: E501
if local_vars_configuration is None:
local_vars_configuration = Configuration.get_default_copy()
self.local_vars_configuration = local_... | [
"def",
"__init__",
"(",
"self",
",",
"string",
"=",
"None",
",",
"local_vars_configuration",
"=",
"None",
")",
":",
"# noqa: E501",
"# noqa: E501",
"if",
"local_vars_configuration",
"is",
"None",
":",
"local_vars_configuration",
"=",
"Configuration",
".",
"get_defau... | [
42,
4
] | [
52,
32
] | python | en | ['en', 'en', 'en'] | True |
InlineResponseDefault.string | (self) | Gets the string of this InlineResponseDefault. # noqa: E501
:return: The string of this InlineResponseDefault. # noqa: E501
:rtype: Foo
| Gets the string of this InlineResponseDefault. # noqa: E501 | def string(self):
"""Gets the string of this InlineResponseDefault. # noqa: E501
:return: The string of this InlineResponseDefault. # noqa: E501
:rtype: Foo
"""
return self._string | [
"def",
"string",
"(",
"self",
")",
":",
"return",
"self",
".",
"_string"
] | [
55,
4
] | [
62,
27
] | python | en | ['en', 'en', 'en'] | True |
InlineResponseDefault.string | (self, string) | Sets the string of this InlineResponseDefault.
:param string: The string of this InlineResponseDefault. # noqa: E501
:type string: Foo
| Sets the string of this InlineResponseDefault. | def string(self, string):
"""Sets the string of this InlineResponseDefault.
:param string: The string of this InlineResponseDefault. # noqa: E501
:type string: Foo
"""
self._string = string | [
"def",
"string",
"(",
"self",
",",
"string",
")",
":",
"self",
".",
"_string",
"=",
"string"
] | [
65,
4
] | [
73,
29
] | python | en | ['en', 'en', 'en'] | True |
InlineResponseDefault.to_dict | (self, serialize=False) | Returns the model properties as a dict | Returns the model properties as a dict | def to_dict(self, serialize=False):
"""Returns the model properties as a dict"""
result = {}
def convert(x):
if hasattr(x, "to_dict"):
args = inspect.getargspec(x.to_dict).args
if len(args) == 1:
return x.to_dict()
... | [
"def",
"to_dict",
"(",
"self",
",",
"serialize",
"=",
"False",
")",
":",
"result",
"=",
"{",
"}",
"def",
"convert",
"(",
"x",
")",
":",
"if",
"hasattr",
"(",
"x",
",",
"\"to_dict\"",
")",
":",
"args",
"=",
"inspect",
".",
"getargspec",
"(",
"x",
... | [
75,
4
] | [
105,
21
] | python | en | ['en', 'en', 'en'] | True |
InlineResponseDefault.to_str | (self) | Returns the string representation of the model | Returns the string representation of the model | def to_str(self):
"""Returns the string representation of the model"""
return pprint.pformat(self.to_dict()) | [
"def",
"to_str",
"(",
"self",
")",
":",
"return",
"pprint",
".",
"pformat",
"(",
"self",
".",
"to_dict",
"(",
")",
")"
] | [
107,
4
] | [
109,
45
] | python | en | ['en', 'en', 'en'] | True |
InlineResponseDefault.__repr__ | (self) | For `print` and `pprint` | For `print` and `pprint` | def __repr__(self):
"""For `print` and `pprint`"""
return self.to_str() | [
"def",
"__repr__",
"(",
"self",
")",
":",
"return",
"self",
".",
"to_str",
"(",
")"
] | [
111,
4
] | [
113,
28
] | python | en | ['en', 'en', 'en'] | True |
InlineResponseDefault.__eq__ | (self, other) | Returns true if both objects are equal | Returns true if both objects are equal | def __eq__(self, other):
"""Returns true if both objects are equal"""
if not isinstance(other, InlineResponseDefault):
return False
return self.to_dict() == other.to_dict() | [
"def",
"__eq__",
"(",
"self",
",",
"other",
")",
":",
"if",
"not",
"isinstance",
"(",
"other",
",",
"InlineResponseDefault",
")",
":",
"return",
"False",
"return",
"self",
".",
"to_dict",
"(",
")",
"==",
"other",
".",
"to_dict",
"(",
")"
] | [
115,
4
] | [
120,
48
] | python | en | ['en', 'en', 'en'] | True |
InlineResponseDefault.__ne__ | (self, other) | Returns true if both objects are not equal | Returns true if both objects are not equal | def __ne__(self, other):
"""Returns true if both objects are not equal"""
if not isinstance(other, InlineResponseDefault):
return True
return self.to_dict() != other.to_dict() | [
"def",
"__ne__",
"(",
"self",
",",
"other",
")",
":",
"if",
"not",
"isinstance",
"(",
"other",
",",
"InlineResponseDefault",
")",
":",
"return",
"True",
"return",
"self",
".",
"to_dict",
"(",
")",
"!=",
"other",
".",
"to_dict",
"(",
")"
] | [
122,
4
] | [
127,
48
] | python | en | ['en', 'en', 'en'] | True |
HomePlusControlAsyncApi.__init__ | (
self,
hass: core.HomeAssistant,
config_entry: config_entries.ConfigEntry,
implementation: config_entry_oauth2_flow.AbstractOAuth2Implementation,
) | Initialize the HomePlusControlAsyncApi object.
Initialize the authenticated API for the Legrand Home+ Control component.
Args:.
hass (HomeAssistant): HomeAssistant core object.
config_entry (ConfigEntry): ConfigEntry object that configures this API.
implementation (... | Initialize the HomePlusControlAsyncApi object. | def __init__(
self,
hass: core.HomeAssistant,
config_entry: config_entries.ConfigEntry,
implementation: config_entry_oauth2_flow.AbstractOAuth2Implementation,
) -> None:
"""Initialize the HomePlusControlAsyncApi object.
Initialize the authenticated API for the Legran... | [
"def",
"__init__",
"(",
"self",
",",
"hass",
":",
"core",
".",
"HomeAssistant",
",",
"config_entry",
":",
"config_entries",
".",
"ConfigEntry",
",",
"implementation",
":",
"config_entry_oauth2_flow",
".",
"AbstractOAuth2Implementation",
",",
")",
"->",
"None",
":"... | [
22,
4
] | [
47,
9
] | python | en | ['en', 'en', 'en'] | True |
HomePlusControlAsyncApi.async_get_access_token | (self) | Return a valid access token. | Return a valid access token. | async def async_get_access_token(self) -> str:
"""Return a valid access token."""
if not self._oauth_session.valid_token:
await self._oauth_session.async_ensure_token_valid()
return self._oauth_session.token["access_token"] | [
"async",
"def",
"async_get_access_token",
"(",
"self",
")",
"->",
"str",
":",
"if",
"not",
"self",
".",
"_oauth_session",
".",
"valid_token",
":",
"await",
"self",
".",
"_oauth_session",
".",
"async_ensure_token_valid",
"(",
")",
"return",
"self",
".",
"_oauth... | [
49,
4
] | [
54,
56
] | python | en | ['en', 'lb', 'en'] | True |
async_setup_entry | (hass, config_entry, async_add_entities) | Create the Elk-M1 switch platform. | Create the Elk-M1 switch platform. | async def async_setup_entry(hass, config_entry, async_add_entities):
"""Create the Elk-M1 switch platform."""
elk_data = hass.data[DOMAIN][config_entry.entry_id]
entities = []
elk = elk_data["elk"]
create_elk_entities(elk_data, elk.outputs, "output", ElkOutput, entities)
async_add_entities(entit... | [
"async",
"def",
"async_setup_entry",
"(",
"hass",
",",
"config_entry",
",",
"async_add_entities",
")",
":",
"elk_data",
"=",
"hass",
".",
"data",
"[",
"DOMAIN",
"]",
"[",
"config_entry",
".",
"entry_id",
"]",
"entities",
"=",
"[",
"]",
"elk",
"=",
"elk_dat... | [
7,
0
] | [
13,
38
] | python | en | ['en', 'de', 'en'] | True |
ElkOutput.is_on | (self) | Get the current output status. | Get the current output status. | def is_on(self) -> bool:
"""Get the current output status."""
return self._element.output_on | [
"def",
"is_on",
"(",
"self",
")",
"->",
"bool",
":",
"return",
"self",
".",
"_element",
".",
"output_on"
] | [
20,
4
] | [
22,
38
] | python | en | ['en', 'en', 'en'] | True |
ElkOutput.async_turn_on | (self, **kwargs) | Turn on the output. | Turn on the output. | async def async_turn_on(self, **kwargs):
"""Turn on the output."""
self._element.turn_on(0) | [
"async",
"def",
"async_turn_on",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"_element",
".",
"turn_on",
"(",
"0",
")"
] | [
24,
4
] | [
26,
32
] | python | en | ['en', 'en', 'en'] | True |
ElkOutput.async_turn_off | (self, **kwargs) | Turn off the output. | Turn off the output. | async def async_turn_off(self, **kwargs):
"""Turn off the output."""
self._element.turn_off() | [
"async",
"def",
"async_turn_off",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"_element",
".",
"turn_off",
"(",
")"
] | [
28,
4
] | [
30,
32
] | python | en | ['en', 'en', 'en'] | True |
async_setup_intents | (hass: HomeAssistant) | Set up the humidifier intents. | Set up the humidifier intents. | async def async_setup_intents(hass: HomeAssistant) -> None:
"""Set up the humidifier intents."""
hass.helpers.intent.async_register(HumidityHandler())
hass.helpers.intent.async_register(SetModeHandler()) | [
"async",
"def",
"async_setup_intents",
"(",
"hass",
":",
"HomeAssistant",
")",
"->",
"None",
":",
"hass",
".",
"helpers",
".",
"intent",
".",
"async_register",
"(",
"HumidityHandler",
"(",
")",
")",
"hass",
".",
"helpers",
".",
"intent",
".",
"async_register... | [
22,
0
] | [
25,
56
] | python | en | ['en', 'en', 'en'] | True |
HumidityHandler.async_handle | (self, intent_obj: intent.Intent) | Handle the hass intent. | Handle the hass intent. | async def async_handle(self, intent_obj: intent.Intent) -> intent.IntentResponse:
"""Handle the hass intent."""
hass = intent_obj.hass
slots = self.async_validate_slots(intent_obj.slots)
state = hass.helpers.intent.async_match_state(
slots["name"]["value"], hass.states.async_... | [
"async",
"def",
"async_handle",
"(",
"self",
",",
"intent_obj",
":",
"intent",
".",
"Intent",
")",
"->",
"intent",
".",
"IntentResponse",
":",
"hass",
"=",
"intent_obj",
".",
"hass",
"slots",
"=",
"self",
".",
"async_validate_slots",
"(",
"intent_obj",
".",
... | [
37,
4
] | [
69,
23
] | python | en | ['en', 'en', 'en'] | True |
SetModeHandler.async_handle | (self, intent_obj: intent.Intent) | Handle the hass intent. | Handle the hass intent. | async def async_handle(self, intent_obj: intent.Intent) -> intent.IntentResponse:
"""Handle the hass intent."""
hass = intent_obj.hass
slots = self.async_validate_slots(intent_obj.slots)
state = hass.helpers.intent.async_match_state(
slots["name"]["value"],
hass.s... | [
"async",
"def",
"async_handle",
"(",
"self",
",",
"intent_obj",
":",
"intent",
".",
"Intent",
")",
"->",
"intent",
".",
"IntentResponse",
":",
"hass",
"=",
"intent_obj",
".",
"hass",
"slots",
"=",
"self",
".",
"async_validate_slots",
"(",
"intent_obj",
".",
... | [
81,
4
] | [
124,
23
] | python | en | ['en', 'en', 'en'] | True |
mock_client | () | Define a fixture for a client creation coroutine. | Define a fixture for a client creation coroutine. | def mock_client():
"""Define a fixture for a client creation coroutine."""
return AsyncMock(return_value=None) | [
"def",
"mock_client",
"(",
")",
":",
"return",
"AsyncMock",
"(",
"return_value",
"=",
"None",
")"
] | [
15,
0
] | [
17,
39
] | python | en | ['en', 'fr', 'en'] | True |
mock_aionotion | (mock_client) | Mock the aionotion library. | Mock the aionotion library. | def mock_aionotion(mock_client):
"""Mock the aionotion library."""
with patch("homeassistant.components.notion.config_flow.async_get_client") as mock_:
mock_.side_effect = mock_client
yield mock_ | [
"def",
"mock_aionotion",
"(",
"mock_client",
")",
":",
"with",
"patch",
"(",
"\"homeassistant.components.notion.config_flow.async_get_client\"",
")",
"as",
"mock_",
":",
"mock_",
".",
"side_effect",
"=",
"mock_client",
"yield",
"mock_"
] | [
21,
0
] | [
25,
19
] | python | en | ['en', 'en', 'en'] | True |
test_duplicate_error | (hass) | Test that errors are shown when duplicates are added. | Test that errors are shown when duplicates are added. | async def test_duplicate_error(hass):
"""Test that errors are shown when duplicates are added."""
conf = {CONF_USERNAME: "user@host.com", CONF_PASSWORD: "password123"}
MockConfigEntry(domain=DOMAIN, unique_id="user@host.com", data=conf).add_to_hass(
hass
)
result = await hass.config_entrie... | [
"async",
"def",
"test_duplicate_error",
"(",
"hass",
")",
":",
"conf",
"=",
"{",
"CONF_USERNAME",
":",
"\"user@host.com\"",
",",
"CONF_PASSWORD",
":",
"\"password123\"",
"}",
"MockConfigEntry",
"(",
"domain",
"=",
"DOMAIN",
",",
"unique_id",
"=",
"\"user@host.com\... | [
28,
0
] | [
41,
51
] | python | en | ['en', 'en', 'en'] | True |
test_invalid_credentials | (hass, mock_aionotion) | Test that an invalid API/App Key throws an error. | Test that an invalid API/App Key throws an error. | async def test_invalid_credentials(hass, mock_aionotion):
"""Test that an invalid API/App Key throws an error."""
conf = {CONF_USERNAME: "user@host.com", CONF_PASSWORD: "password123"}
flow = config_flow.NotionFlowHandler()
flow.hass = hass
flow.context = {"source": SOURCE_USER}
result = await ... | [
"async",
"def",
"test_invalid_credentials",
"(",
"hass",
",",
"mock_aionotion",
")",
":",
"conf",
"=",
"{",
"CONF_USERNAME",
":",
"\"user@host.com\"",
",",
"CONF_PASSWORD",
":",
"\"password123\"",
"}",
"flow",
"=",
"config_flow",
".",
"NotionFlowHandler",
"(",
")"... | [
47,
0
] | [
56,
55
] | python | en | ['en', 'gd', 'en'] | True |
test_show_form | (hass) | Test that the form is served with no input. | Test that the form is served with no input. | async def test_show_form(hass):
"""Test that the form is served with no input."""
flow = config_flow.NotionFlowHandler()
flow.hass = hass
flow.context = {"source": SOURCE_USER}
result = await flow.async_step_user(user_input=None)
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
as... | [
"async",
"def",
"test_show_form",
"(",
"hass",
")",
":",
"flow",
"=",
"config_flow",
".",
"NotionFlowHandler",
"(",
")",
"flow",
".",
"hass",
"=",
"hass",
"flow",
".",
"context",
"=",
"{",
"\"source\"",
":",
"SOURCE_USER",
"}",
"result",
"=",
"await",
"f... | [
59,
0
] | [
68,
38
] | python | en | ['en', 'en', 'en'] | True |
test_step_user | (hass, mock_aionotion) | Test that the user step works. | Test that the user step works. | async def test_step_user(hass, mock_aionotion):
"""Test that the user step works."""
conf = {CONF_USERNAME: "user@host.com", CONF_PASSWORD: "password123"}
flow = config_flow.NotionFlowHandler()
flow.hass = hass
flow.context = {"source": SOURCE_USER}
result = await flow.async_step_user(user_inp... | [
"async",
"def",
"test_step_user",
"(",
"hass",
",",
"mock_aionotion",
")",
":",
"conf",
"=",
"{",
"CONF_USERNAME",
":",
"\"user@host.com\"",
",",
"CONF_PASSWORD",
":",
"\"password123\"",
"}",
"flow",
"=",
"config_flow",
".",
"NotionFlowHandler",
"(",
")",
"flow"... | [
71,
0
] | [
85,
5
] | python | en | ['en', 'en', 'en'] | True |
cmp | (x, y) |
Replacement for built-in function cmp that was removed in Python 3
Compare the two objects x and y and return an integer according to
the outcome. The return value is negative if x < y, zero if x == y
and strictly positive if x > y.
|
Replacement for built-in function cmp that was removed in Python 3 | def cmp(x, y):
"""
Replacement for built-in function cmp that was removed in Python 3
Compare the two objects x and y and return an integer according to
the outcome. The return value is negative if x < y, zero if x == y
and strictly positive if x > y.
"""
return (x > y) - (x < y) | [
"def",
"cmp",
"(",
"x",
",",
"y",
")",
":",
"return",
"(",
"x",
">",
"y",
")",
"-",
"(",
"x",
"<",
"y",
")"
] | [
30,
0
] | [
39,
28
] | python | en | ['en', 'error', 'th'] | False |
hls_stream | (hass, hass_client) | Create test fixture for creating an HLS client for a stream. | Create test fixture for creating an HLS client for a stream. | def hls_stream(hass, hass_client):
"""Create test fixture for creating an HLS client for a stream."""
async def create_client_for_stream(stream):
http_client = await hass_client()
parsed_url = urlparse(stream.endpoint_url(HLS_PROVIDER))
return HlsClient(http_client, parsed_url)
ret... | [
"def",
"hls_stream",
"(",
"hass",
",",
"hass_client",
")",
":",
"async",
"def",
"create_client_for_stream",
"(",
"stream",
")",
":",
"http_client",
"=",
"await",
"hass_client",
"(",
")",
"parsed_url",
"=",
"urlparse",
"(",
"stream",
".",
"endpoint_url",
"(",
... | [
54,
0
] | [
62,
35
] | python | en | ['en', 'en', 'en'] | True |
make_segment | (segment, discontinuity=False) | Create a playlist response for a segment. | Create a playlist response for a segment. | def make_segment(segment, discontinuity=False):
"""Create a playlist response for a segment."""
response = ["#EXT-X-DISCONTINUITY"] if discontinuity else []
response.extend(
[
"#EXT-X-PROGRAM-DATE-TIME:"
+ FAKE_TIME.strftime("%Y-%m-%dT%H:%M:%S.%f")[:-3]
+ "Z",
... | [
"def",
"make_segment",
"(",
"segment",
",",
"discontinuity",
"=",
"False",
")",
":",
"response",
"=",
"[",
"\"#EXT-X-DISCONTINUITY\"",
"]",
"if",
"discontinuity",
"else",
"[",
"]",
"response",
".",
"extend",
"(",
"[",
"\"#EXT-X-PROGRAM-DATE-TIME:\"",
"+",
"FAKE_... | [
65,
0
] | [
77,
30
] | python | en | ['pt', 'en', 'en'] | True |
make_playlist | (
sequence,
discontinuity_sequence=0,
segments=None,
hint=None,
part_target_duration=None,
) | Create a an hls playlist response for tests to assert on. | Create a an hls playlist response for tests to assert on. | def make_playlist(
sequence,
discontinuity_sequence=0,
segments=None,
hint=None,
part_target_duration=None,
):
"""Create a an hls playlist response for tests to assert on."""
response = [
"#EXTM3U",
"#EXT-X-VERSION:6",
"#EXT-X-INDEPENDENT-SEGMENTS",
'#EXT-X-MA... | [
"def",
"make_playlist",
"(",
"sequence",
",",
"discontinuity_sequence",
"=",
"0",
",",
"segments",
"=",
"None",
",",
"hint",
"=",
"None",
",",
"part_target_duration",
"=",
"None",
",",
")",
":",
"response",
"=",
"[",
"\"#EXTM3U\"",
",",
"\"#EXT-X-VERSION:6\"",... | [
80,
0
] | [
114,
30
] | python | en | ['en', 'en', 'en'] | True |
test_hls_stream | (hass, hls_stream, stream_worker_sync) |
Test hls stream.
Purposefully not mocking anything here to test full
integration with the stream component.
|
Test hls stream. | async def test_hls_stream(hass, hls_stream, stream_worker_sync):
"""
Test hls stream.
Purposefully not mocking anything here to test full
integration with the stream component.
"""
await async_setup_component(hass, "stream", {"stream": {}})
stream_worker_sync.pause()
# Setup demo HLS ... | [
"async",
"def",
"test_hls_stream",
"(",
"hass",
",",
"hls_stream",
",",
"stream_worker_sync",
")",
":",
"await",
"async_setup_component",
"(",
"hass",
",",
"\"stream\"",
",",
"{",
"\"stream\"",
":",
"{",
"}",
"}",
")",
"stream_worker_sync",
".",
"pause",
"(",
... | [
117,
0
] | [
165,
49
] | python | en | ['en', 'error', 'th'] | False |
test_stream_timeout | (hass, hass_client, stream_worker_sync) | Test hls stream timeout. | Test hls stream timeout. | async def test_stream_timeout(hass, hass_client, stream_worker_sync):
"""Test hls stream timeout."""
await async_setup_component(hass, "stream", {"stream": {}})
stream_worker_sync.pause()
# Setup demo HLS track
source = generate_h264_video()
stream = create_stream(hass, source, {})
# Requ... | [
"async",
"def",
"test_stream_timeout",
"(",
"hass",
",",
"hass_client",
",",
"stream_worker_sync",
")",
":",
"await",
"async_setup_component",
"(",
"hass",
",",
"\"stream\"",
",",
"{",
"\"stream\"",
":",
"{",
"}",
"}",
")",
"stream_worker_sync",
".",
"pause",
... | [
168,
0
] | [
207,
49
] | python | en | ['en', 'en', 'en'] | True |
test_stream_timeout_after_stop | (hass, hass_client, stream_worker_sync) | Test hls stream timeout after the stream has been stopped already. | Test hls stream timeout after the stream has been stopped already. | async def test_stream_timeout_after_stop(hass, hass_client, stream_worker_sync):
"""Test hls stream timeout after the stream has been stopped already."""
await async_setup_component(hass, "stream", {"stream": {}})
stream_worker_sync.pause()
# Setup demo HLS track
source = generate_h264_video()
... | [
"async",
"def",
"test_stream_timeout_after_stop",
"(",
"hass",
",",
"hass_client",
",",
"stream_worker_sync",
")",
":",
"await",
"async_setup_component",
"(",
"hass",
",",
"\"stream\"",
",",
"{",
"\"stream\"",
":",
"{",
"}",
"}",
")",
"stream_worker_sync",
".",
... | [
210,
0
] | [
231,
38
] | python | en | ['en', 'en', 'en'] | True |
test_stream_keepalive | (hass) | Test hls stream retries the stream when keepalive=True. | Test hls stream retries the stream when keepalive=True. | async def test_stream_keepalive(hass):
"""Test hls stream retries the stream when keepalive=True."""
await async_setup_component(hass, "stream", {"stream": {}})
# Setup demo HLS track
source = "test_stream_keepalive_source"
stream = create_stream(hass, source, {})
track = stream.add_provider(HL... | [
"async",
"def",
"test_stream_keepalive",
"(",
"hass",
")",
":",
"await",
"async_setup_component",
"(",
"hass",
",",
"\"stream\"",
",",
"{",
"\"stream\"",
":",
"{",
"}",
"}",
")",
"# Setup demo HLS track",
"source",
"=",
"\"test_stream_keepalive_source\"",
"stream",
... | [
234,
0
] | [
268,
17
] | python | en | ['en', 'de', 'en'] | True |
test_hls_playlist_view_no_output | (hass, hls_stream) | Test rendering the hls playlist with no output segments. | Test rendering the hls playlist with no output segments. | async def test_hls_playlist_view_no_output(hass, hls_stream):
"""Test rendering the hls playlist with no output segments."""
await async_setup_component(hass, "stream", {"stream": {}})
stream = create_stream(hass, STREAM_SOURCE, {})
stream.add_provider(HLS_PROVIDER)
hls_client = await hls_stream(s... | [
"async",
"def",
"test_hls_playlist_view_no_output",
"(",
"hass",
",",
"hls_stream",
")",
":",
"await",
"async_setup_component",
"(",
"hass",
",",
"\"stream\"",
",",
"{",
"\"stream\"",
":",
"{",
"}",
"}",
")",
"stream",
"=",
"create_stream",
"(",
"hass",
",",
... | [
271,
0
] | [
282,
29
] | python | en | ['en', 'en', 'en'] | True |
test_hls_playlist_view | (hass, hls_stream, stream_worker_sync) | Test rendering the hls playlist with 1 and 2 output segments. | Test rendering the hls playlist with 1 and 2 output segments. | async def test_hls_playlist_view(hass, hls_stream, stream_worker_sync):
"""Test rendering the hls playlist with 1 and 2 output segments."""
await async_setup_component(hass, "stream", {"stream": {}})
stream = create_stream(hass, STREAM_SOURCE, {})
stream_worker_sync.pause()
hls = stream.add_provide... | [
"async",
"def",
"test_hls_playlist_view",
"(",
"hass",
",",
"hls_stream",
",",
"stream_worker_sync",
")",
":",
"await",
"async_setup_component",
"(",
"hass",
",",
"\"stream\"",
",",
"{",
"\"stream\"",
":",
"{",
"}",
"}",
")",
"stream",
"=",
"create_stream",
"(... | [
285,
0
] | [
315,
17
] | python | en | ['en', 'en', 'en'] | True |
test_hls_max_segments | (hass, hls_stream, stream_worker_sync) | Test rendering the hls playlist with more segments than the segment deque can hold. | Test rendering the hls playlist with more segments than the segment deque can hold. | async def test_hls_max_segments(hass, hls_stream, stream_worker_sync):
"""Test rendering the hls playlist with more segments than the segment deque can hold."""
await async_setup_component(hass, "stream", {"stream": {}})
stream = create_stream(hass, STREAM_SOURCE, {})
stream_worker_sync.pause()
hls... | [
"async",
"def",
"test_hls_max_segments",
"(",
"hass",
",",
"hls_stream",
",",
"stream_worker_sync",
")",
":",
"await",
"async_setup_component",
"(",
"hass",
",",
"\"stream\"",
",",
"{",
"\"stream\"",
":",
"{",
"}",
"}",
")",
"stream",
"=",
"create_stream",
"("... | [
318,
0
] | [
366,
17
] | python | en | ['en', 'en', 'en'] | True |
test_hls_playlist_view_discontinuity | (hass, hls_stream, stream_worker_sync) | Test a discontinuity across segments in the stream with 3 segments. | Test a discontinuity across segments in the stream with 3 segments. | async def test_hls_playlist_view_discontinuity(hass, hls_stream, stream_worker_sync):
"""Test a discontinuity across segments in the stream with 3 segments."""
await async_setup_component(hass, "stream", {"stream": {}})
stream = create_stream(hass, STREAM_SOURCE, {})
stream_worker_sync.pause()
hls ... | [
"async",
"def",
"test_hls_playlist_view_discontinuity",
"(",
"hass",
",",
"hls_stream",
",",
"stream_worker_sync",
")",
":",
"await",
"async_setup_component",
"(",
"hass",
",",
"\"stream\"",
",",
"{",
"\"stream\"",
":",
"{",
"}",
"}",
")",
"stream",
"=",
"create... | [
369,
0
] | [
403,
17
] | python | en | ['en', 'en', 'en'] | True |
test_hls_max_segments_discontinuity | (hass, hls_stream, stream_worker_sync) | Test a discontinuity with more segments than the segment deque can hold. | Test a discontinuity with more segments than the segment deque can hold. | async def test_hls_max_segments_discontinuity(hass, hls_stream, stream_worker_sync):
"""Test a discontinuity with more segments than the segment deque can hold."""
await async_setup_component(hass, "stream", {"stream": {}})
stream = create_stream(hass, STREAM_SOURCE, {})
stream_worker_sync.pause()
... | [
"async",
"def",
"test_hls_max_segments_discontinuity",
"(",
"hass",
",",
"hls_stream",
",",
"stream_worker_sync",
")",
":",
"await",
"async_setup_component",
"(",
"hass",
",",
"\"stream\"",
",",
"{",
"\"stream\"",
":",
"{",
"}",
"}",
")",
"stream",
"=",
"create_... | [
406,
0
] | [
446,
17
] | python | en | ['en', 'en', 'en'] | True |
HlsClient.__init__ | (self, http_client, parsed_url) | Initialize HlsClient. | Initialize HlsClient. | def __init__(self, http_client, parsed_url):
"""Initialize HlsClient."""
self.http_client = http_client
self.parsed_url = parsed_url | [
"def",
"__init__",
"(",
"self",
",",
"http_client",
",",
"parsed_url",
")",
":",
"self",
".",
"http_client",
"=",
"http_client",
"self",
".",
"parsed_url",
"=",
"parsed_url"
] | [
39,
4
] | [
42,
36
] | python | en | ['en', 'fr', 'it'] | False |
HlsClient.get | (self, path=None, headers=None) | Fetch the hls stream for the specified path. | Fetch the hls stream for the specified path. | async def get(self, path=None, headers=None):
"""Fetch the hls stream for the specified path."""
url = self.parsed_url.path
if path:
# Strip off the master playlist suffix and replace with path
url = "/".join(self.parsed_url.path.split("/")[:-1]) + path
return awa... | [
"async",
"def",
"get",
"(",
"self",
",",
"path",
"=",
"None",
",",
"headers",
"=",
"None",
")",
":",
"url",
"=",
"self",
".",
"parsed_url",
".",
"path",
"if",
"path",
":",
"# Strip off the master playlist suffix and replace with path",
"url",
"=",
"\"/\"",
"... | [
44,
4
] | [
50,
63
] | python | en | ['en', 'en', 'en'] | True |
_entry_is_complete | (entry) | Return True if the config entry information is complete. | Return True if the config entry information is complete. | def _entry_is_complete(entry):
"""Return True if the config entry information is complete."""
return bool(entry.unique_id and entry.data.get(CONF_MAC)) | [
"def",
"_entry_is_complete",
"(",
"entry",
")",
":",
"return",
"bool",
"(",
"entry",
".",
"unique_id",
"and",
"entry",
".",
"data",
".",
"get",
"(",
"CONF_MAC",
")",
")"
] | [
54,
0
] | [
56,
61
] | python | en | ['en', 'en', 'en'] | True |
SamsungTVConfigFlow.__init__ | (self) | Initialize flow. | Initialize flow. | def __init__(self):
"""Initialize flow."""
self._reauth_entry = None
self._host = None
self._mac = None
self._udn = None
self._manufacturer = None
self._model = None
self._name = None
self._title = None
self._id = None
self._bridge ... | [
"def",
"__init__",
"(",
"self",
")",
":",
"self",
".",
"_reauth_entry",
"=",
"None",
"self",
".",
"_host",
"=",
"None",
"self",
".",
"_mac",
"=",
"None",
"self",
".",
"_udn",
"=",
"None",
"self",
".",
"_manufacturer",
"=",
"None",
"self",
".",
"_mode... | [
64,
4
] | [
76,
32
] | python | en | ['en', 'pl', 'en'] | False |
SamsungTVConfigFlow._get_entry_from_bridge | (self) | Get device entry. | Get device entry. | def _get_entry_from_bridge(self):
"""Get device entry."""
data = {
CONF_HOST: self._host,
CONF_MAC: self._mac,
CONF_MANUFACTURER: self._manufacturer or DEFAULT_MANUFACTURER,
CONF_METHOD: self._bridge.method,
CONF_MODEL: self._model,
... | [
"def",
"_get_entry_from_bridge",
"(",
"self",
")",
":",
"data",
"=",
"{",
"CONF_HOST",
":",
"self",
".",
"_host",
",",
"CONF_MAC",
":",
"self",
".",
"_mac",
",",
"CONF_MANUFACTURER",
":",
"self",
".",
"_manufacturer",
"or",
"DEFAULT_MANUFACTURER",
",",
"CONF... | [
78,
4
] | [
94,
9
] | python | en | ['fr', 'en', 'en'] | True |
SamsungTVConfigFlow._async_set_device_unique_id | (self, raise_on_progress=True) | Set device unique_id. | Set device unique_id. | async def _async_set_device_unique_id(self, raise_on_progress=True):
"""Set device unique_id."""
if not await self._async_get_and_check_device_info():
raise data_entry_flow.AbortFlow(RESULT_NOT_SUPPORTED)
await self._async_set_unique_id_from_udn(raise_on_progress)
self._async... | [
"async",
"def",
"_async_set_device_unique_id",
"(",
"self",
",",
"raise_on_progress",
"=",
"True",
")",
":",
"if",
"not",
"await",
"self",
".",
"_async_get_and_check_device_info",
"(",
")",
":",
"raise",
"data_entry_flow",
".",
"AbortFlow",
"(",
"RESULT_NOT_SUPPORTE... | [
96,
4
] | [
101,
61
] | python | fr | ['fr', 'fr', 'en'] | True |
SamsungTVConfigFlow._async_set_unique_id_from_udn | (self, raise_on_progress=True) | Set the unique id from the udn. | Set the unique id from the udn. | async def _async_set_unique_id_from_udn(self, raise_on_progress=True):
"""Set the unique id from the udn."""
assert self._host is not None
await self.async_set_unique_id(self._udn, raise_on_progress=raise_on_progress)
if (entry := self._async_update_existing_host_entry()) and _entry_is_c... | [
"async",
"def",
"_async_set_unique_id_from_udn",
"(",
"self",
",",
"raise_on_progress",
"=",
"True",
")",
":",
"assert",
"self",
".",
"_host",
"is",
"not",
"None",
"await",
"self",
".",
"async_set_unique_id",
"(",
"self",
".",
"_udn",
",",
"raise_on_progress",
... | [
103,
4
] | [
110,
65
] | python | en | ['en', 'en', 'en'] | True |
SamsungTVConfigFlow._async_update_and_abort_for_matching_unique_id | (self) | Abort and update host and mac if we have it. | Abort and update host and mac if we have it. | def _async_update_and_abort_for_matching_unique_id(self):
"""Abort and update host and mac if we have it."""
updates = {CONF_HOST: self._host}
if self._mac:
updates[CONF_MAC] = self._mac
self._abort_if_unique_id_configured(updates=updates) | [
"def",
"_async_update_and_abort_for_matching_unique_id",
"(",
"self",
")",
":",
"updates",
"=",
"{",
"CONF_HOST",
":",
"self",
".",
"_host",
"}",
"if",
"self",
".",
"_mac",
":",
"updates",
"[",
"CONF_MAC",
"]",
"=",
"self",
".",
"_mac",
"self",
".",
"_abor... | [
112,
4
] | [
117,
60
] | python | en | ['en', 'en', 'en'] | True |
SamsungTVConfigFlow._try_connect | (self) | Try to connect and check auth. | Try to connect and check auth. | def _try_connect(self):
"""Try to connect and check auth."""
for method in SUPPORTED_METHODS:
self._bridge = SamsungTVBridge.get_bridge(method, self._host)
result = self._bridge.try_connect()
if result == RESULT_SUCCESS:
return
if result !=... | [
"def",
"_try_connect",
"(",
"self",
")",
":",
"for",
"method",
"in",
"SUPPORTED_METHODS",
":",
"self",
".",
"_bridge",
"=",
"SamsungTVBridge",
".",
"get_bridge",
"(",
"method",
",",
"self",
".",
"_host",
")",
"result",
"=",
"self",
".",
"_bridge",
".",
"... | [
119,
4
] | [
129,
62
] | python | en | ['en', 'en', 'en'] | True |
SamsungTVConfigFlow._async_get_and_check_device_info | (self) | Try to get the device info. | Try to get the device info. | async def _async_get_and_check_device_info(self):
"""Try to get the device info."""
_port, _method, info = await async_get_device_info(
self.hass, self._bridge, self._host
)
if not info:
if not _method:
LOGGER.debug(
"Samsung ho... | [
"async",
"def",
"_async_get_and_check_device_info",
"(",
"self",
")",
":",
"_port",
",",
"_method",
",",
"info",
"=",
"await",
"async_get_device_info",
"(",
"self",
".",
"hass",
",",
"self",
".",
"_bridge",
",",
"self",
".",
"_host",
")",
"if",
"not",
"inf... | [
131,
4
] | [
160,
19
] | python | en | ['en', 'en', 'en'] | True |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.