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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
HomeKit.reset_accessories | (self, entity_ids) | Reset the accessory to load the latest configuration. | Reset the accessory to load the latest configuration. | def reset_accessories(self, entity_ids):
"""Reset the accessory to load the latest configuration."""
if not self.bridge:
self.driver.config_changed()
return
aid_storage = self.hass.data[DOMAIN][self._entry_id][AID_STORAGE]
removed = []
for entity_id in en... | [
"def",
"reset_accessories",
"(",
"self",
",",
"entity_ids",
")",
":",
"if",
"not",
"self",
".",
"bridge",
":",
"self",
".",
"driver",
".",
"config_changed",
"(",
")",
"return",
"aid_storage",
"=",
"self",
".",
"hass",
".",
"data",
"[",
"DOMAIN",
"]",
"... | [
476,
4
] | [
506,
36
] | python | en | ['en', 'en', 'en'] | True |
HomeKit.add_bridge_accessory | (self, state) | Try adding accessory to bridge if configured beforehand. | Try adding accessory to bridge if configured beforehand. | def add_bridge_accessory(self, state):
"""Try adding accessory to bridge if configured beforehand."""
if not self._filter(state.entity_id):
return
# The bridge itself counts as an accessory
if len(self.bridge.accessories) + 1 >= MAX_DEVICES:
_LOGGER.warning(
... | [
"def",
"add_bridge_accessory",
"(",
"self",
",",
"state",
")",
":",
"if",
"not",
"self",
".",
"_filter",
"(",
"state",
".",
"entity_id",
")",
":",
"return",
"# The bridge itself counts as an accessory",
"if",
"len",
"(",
"self",
".",
"bridge",
".",
"accessorie... | [
508,
4
] | [
536,
13
] | python | en | ['en', 'en', 'en'] | True |
HomeKit.remove_bridge_accessory | (self, aid) | Try adding accessory to bridge if configured beforehand. | Try adding accessory to bridge if configured beforehand. | def remove_bridge_accessory(self, aid):
"""Try adding accessory to bridge if configured beforehand."""
acc = None
if aid in self.bridge.accessories:
acc = self.bridge.accessories.pop(aid)
return acc | [
"def",
"remove_bridge_accessory",
"(",
"self",
",",
"aid",
")",
":",
"acc",
"=",
"None",
"if",
"aid",
"in",
"self",
".",
"bridge",
".",
"accessories",
":",
"acc",
"=",
"self",
".",
"bridge",
".",
"accessories",
".",
"pop",
"(",
"aid",
")",
"return",
... | [
538,
4
] | [
543,
18
] | python | en | ['en', 'en', 'en'] | True |
HomeKit.async_start | (self, *args) | Start the accessory driver. | Start the accessory driver. | async def async_start(self, *args):
"""Start the accessory driver."""
if self.status != STATUS_READY:
return
self.status = STATUS_WAIT
ent_reg = await entity_registry.async_get_registry(self.hass)
dev_reg = await device_registry.async_get_registry(self.hass)
... | [
"async",
"def",
"async_start",
"(",
"self",
",",
"*",
"args",
")",
":",
"if",
"self",
".",
"status",
"!=",
"STATUS_READY",
":",
"return",
"self",
".",
"status",
"=",
"STATUS_WAIT",
"ent_reg",
"=",
"await",
"entity_registry",
".",
"async_get_registry",
"(",
... | [
545,
4
] | [
582,
36
] | python | en | ['en', 'en', 'en'] | True |
HomeKit._async_register_bridge | (self, dev_reg) | Register the bridge as a device so homekit_controller and exclude it from discovery. | Register the bridge as a device so homekit_controller and exclude it from discovery. | def _async_register_bridge(self, dev_reg):
"""Register the bridge as a device so homekit_controller and exclude it from discovery."""
formatted_mac = device_registry.format_mac(self.driver.state.mac)
# Connections and identifiers are both used here.
#
# connections exists so home... | [
"def",
"_async_register_bridge",
"(",
"self",
",",
"dev_reg",
")",
":",
"formatted_mac",
"=",
"device_registry",
".",
"format_mac",
"(",
"self",
".",
"driver",
".",
"state",
".",
"mac",
")",
"# Connections and identifiers are both used here.",
"#",
"# connections exis... | [
585,
4
] | [
610,
9
] | python | en | ['en', 'en', 'en'] | True |
HomeKit._async_purge_old_bridges | (self, dev_reg, identifier, connection) | Purge bridges that exist from failed pairing or manual resets. | Purge bridges that exist from failed pairing or manual resets. | def _async_purge_old_bridges(self, dev_reg, identifier, connection):
"""Purge bridges that exist from failed pairing or manual resets."""
devices_to_purge = []
for entry in dev_reg.devices.values():
if self._entry_id in entry.config_entries and (
identifier not in ent... | [
"def",
"_async_purge_old_bridges",
"(",
"self",
",",
"dev_reg",
",",
"identifier",
",",
"connection",
")",
":",
"devices_to_purge",
"=",
"[",
"]",
"for",
"entry",
"in",
"dev_reg",
".",
"devices",
".",
"values",
"(",
")",
":",
"if",
"self",
".",
"_entry_id"... | [
613,
4
] | [
624,
50
] | python | en | ['en', 'en', 'en'] | True |
HomeKit.async_stop | (self, *args) | Stop the accessory driver. | Stop the accessory driver. | async def async_stop(self, *args):
"""Stop the accessory driver."""
if self.status != STATUS_RUNNING:
return
self.status = STATUS_STOPPED
_LOGGER.debug("Driver stop for %s", self._name)
await self.driver.async_stop()
if self.bridge:
for acc in self... | [
"async",
"def",
"async_stop",
"(",
"self",
",",
"*",
"args",
")",
":",
"if",
"self",
".",
"status",
"!=",
"STATUS_RUNNING",
":",
"return",
"self",
".",
"status",
"=",
"STATUS_STOPPED",
"_LOGGER",
".",
"debug",
"(",
"\"Driver stop for %s\"",
",",
"self",
".... | [
664,
4
] | [
675,
46
] | python | en | ['en', 'en', 'en'] | True |
HomeKit._async_set_device_info_attributes | (self, ent_reg_ent, dev_reg, entity_id) | Set attributes that will be used for homekit device info. | Set attributes that will be used for homekit device info. | async def _async_set_device_info_attributes(self, ent_reg_ent, dev_reg, entity_id):
"""Set attributes that will be used for homekit device info."""
ent_cfg = self._config.setdefault(entity_id, {})
if ent_reg_ent.device_id:
dev_reg_ent = dev_reg.async_get(ent_reg_ent.device_id)
... | [
"async",
"def",
"_async_set_device_info_attributes",
"(",
"self",
",",
"ent_reg_ent",
",",
"dev_reg",
",",
"entity_id",
")",
":",
"ent_cfg",
"=",
"self",
".",
"_config",
".",
"setdefault",
"(",
"entity_id",
",",
"{",
"}",
")",
"if",
"ent_reg_ent",
".",
"devi... | [
735,
4
] | [
755,
65
] | python | en | ['en', 'en', 'en'] | True |
HomeKitPairingQRView.get | (self, request) | Retrieve the pairing QRCode image. | Retrieve the pairing QRCode image. | async def get(self, request):
"""Retrieve the pairing QRCode image."""
if not request.query_string:
raise Unauthorized()
entry_id, secret = request.query_string.split("-")
if (
entry_id not in request.app["hass"].data[DOMAIN]
or secret
!= ... | [
"async",
"def",
"get",
"(",
"self",
",",
"request",
")",
":",
"if",
"not",
"request",
".",
"query_string",
":",
"raise",
"Unauthorized",
"(",
")",
"entry_id",
",",
"secret",
"=",
"request",
".",
"query_string",
".",
"split",
"(",
"\"-\"",
")",
"if",
"(... | [
765,
4
] | [
780,
9
] | python | en | ['en', 'sr', 'en'] | True |
setup_platform | (hass, config, add_entities, discovery_info=None) | Set up the Homematic light platform. | Set up the Homematic light platform. | def setup_platform(hass, config, add_entities, discovery_info=None):
"""Set up the Homematic light platform."""
if discovery_info is None:
return
devices = []
for conf in discovery_info[ATTR_DISCOVER_DEVICES]:
new_device = HMLight(conf)
devices.append(new_device)
add_entiti... | [
"def",
"setup_platform",
"(",
"hass",
",",
"config",
",",
"add_entities",
",",
"discovery_info",
"=",
"None",
")",
":",
"if",
"discovery_info",
"is",
"None",
":",
"return",
"devices",
"=",
"[",
"]",
"for",
"conf",
"in",
"discovery_info",
"[",
"ATTR_DISCOVER_... | [
20,
0
] | [
30,
31
] | python | en | ['en', 'da', 'en'] | True |
HMLight.brightness | (self) | Return the brightness of this light between 0..255. | Return the brightness of this light between 0..255. | def brightness(self):
"""Return the brightness of this light between 0..255."""
# Is dimmer?
if self._state == "LEVEL":
return int(self._hm_get_state() * 255)
return None | [
"def",
"brightness",
"(",
"self",
")",
":",
"# Is dimmer?",
"if",
"self",
".",
"_state",
"==",
"\"LEVEL\"",
":",
"return",
"int",
"(",
"self",
".",
"_hm_get_state",
"(",
")",
"*",
"255",
")",
"return",
"None"
] | [
37,
4
] | [
42,
19
] | python | en | ['en', 'en', 'en'] | True |
HMLight.is_on | (self) | Return true if light is on. | Return true if light is on. | def is_on(self):
"""Return true if light is on."""
try:
return self._hm_get_state() > 0
except TypeError:
return False | [
"def",
"is_on",
"(",
"self",
")",
":",
"try",
":",
"return",
"self",
".",
"_hm_get_state",
"(",
")",
">",
"0",
"except",
"TypeError",
":",
"return",
"False"
] | [
45,
4
] | [
50,
24
] | python | en | ['en', 'et', 'en'] | True |
HMLight.supported_features | (self) | Flag supported features. | Flag supported features. | def supported_features(self):
"""Flag supported features."""
features = SUPPORT_BRIGHTNESS
if "COLOR" in self._hmdevice.WRITENODE:
features |= SUPPORT_COLOR
if "PROGRAM" in self._hmdevice.WRITENODE:
features |= SUPPORT_EFFECT
if hasattr(self._hmdevice, "ge... | [
"def",
"supported_features",
"(",
"self",
")",
":",
"features",
"=",
"SUPPORT_BRIGHTNESS",
"if",
"\"COLOR\"",
"in",
"self",
".",
"_hmdevice",
".",
"WRITENODE",
":",
"features",
"|=",
"SUPPORT_COLOR",
"if",
"\"PROGRAM\"",
"in",
"self",
".",
"_hmdevice",
".",
"W... | [
53,
4
] | [
62,
23
] | python | en | ['da', 'en', 'en'] | True |
HMLight.hs_color | (self) | Return the hue and saturation color value [float, float]. | Return the hue and saturation color value [float, float]. | def hs_color(self):
"""Return the hue and saturation color value [float, float]."""
if not self.supported_features & SUPPORT_COLOR:
return None
hue, sat = self._hmdevice.get_hs_color(self._channel)
return hue * 360.0, sat * 100.0 | [
"def",
"hs_color",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"supported_features",
"&",
"SUPPORT_COLOR",
":",
"return",
"None",
"hue",
",",
"sat",
"=",
"self",
".",
"_hmdevice",
".",
"get_hs_color",
"(",
"self",
".",
"_channel",
")",
"return",
"hu... | [
65,
4
] | [
70,
39
] | python | en | ['en', 'en', 'en'] | True |
HMLight.color_temp | (self) | Return the color temp in mireds [int]. | Return the color temp in mireds [int]. | def color_temp(self):
"""Return the color temp in mireds [int]."""
if not self.supported_features & SUPPORT_COLOR_TEMP:
return None
hm_color_temp = self._hmdevice.get_color_temp(self._channel)
return self.max_mireds - (self.max_mireds - self.min_mireds) * hm_color_temp | [
"def",
"color_temp",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"supported_features",
"&",
"SUPPORT_COLOR_TEMP",
":",
"return",
"None",
"hm_color_temp",
"=",
"self",
".",
"_hmdevice",
".",
"get_color_temp",
"(",
"self",
".",
"_channel",
")",
"return",
... | [
73,
4
] | [
78,
84
] | python | en | ['en', 'en', 'en'] | True |
HMLight.effect_list | (self) | Return the list of supported effects. | Return the list of supported effects. | def effect_list(self):
"""Return the list of supported effects."""
if not self.supported_features & SUPPORT_EFFECT:
return None
return self._hmdevice.get_effect_list() | [
"def",
"effect_list",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"supported_features",
"&",
"SUPPORT_EFFECT",
":",
"return",
"None",
"return",
"self",
".",
"_hmdevice",
".",
"get_effect_list",
"(",
")"
] | [
81,
4
] | [
85,
47
] | python | en | ['en', 'en', 'en'] | True |
HMLight.effect | (self) | Return the current color change program of the light. | Return the current color change program of the light. | def effect(self):
"""Return the current color change program of the light."""
if not self.supported_features & SUPPORT_EFFECT:
return None
return self._hmdevice.get_effect() | [
"def",
"effect",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"supported_features",
"&",
"SUPPORT_EFFECT",
":",
"return",
"None",
"return",
"self",
".",
"_hmdevice",
".",
"get_effect",
"(",
")"
] | [
88,
4
] | [
92,
42
] | python | en | ['en', 'da', 'en'] | True |
HMLight.turn_on | (self, **kwargs) | Turn the light on and/or change color or color effect settings. | Turn the light on and/or change color or color effect settings. | def turn_on(self, **kwargs):
"""Turn the light on and/or change color or color effect settings."""
if ATTR_TRANSITION in kwargs:
self._hmdevice.setValue("RAMP_TIME", kwargs[ATTR_TRANSITION])
if ATTR_BRIGHTNESS in kwargs and self._state == "LEVEL":
percent_bright = float(... | [
"def",
"turn_on",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"ATTR_TRANSITION",
"in",
"kwargs",
":",
"self",
".",
"_hmdevice",
".",
"setValue",
"(",
"\"RAMP_TIME\"",
",",
"kwargs",
"[",
"ATTR_TRANSITION",
"]",
")",
"if",
"ATTR_BRIGHTNESS",
"in",... | [
94,
4
] | [
121,
58
] | python | en | ['en', 'en', 'en'] | True |
HMLight.turn_off | (self, **kwargs) | Turn the light off. | Turn the light off. | def turn_off(self, **kwargs):
"""Turn the light off."""
self._hmdevice.off(self._channel) | [
"def",
"turn_off",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"_hmdevice",
".",
"off",
"(",
"self",
".",
"_channel",
")"
] | [
123,
4
] | [
125,
41
] | python | en | ['en', 'zh', 'en'] | True |
HMLight._init_data_struct | (self) | Generate a data dict (self._data) from the Homematic metadata. | Generate a data dict (self._data) from the Homematic metadata. | def _init_data_struct(self):
"""Generate a data dict (self._data) from the Homematic metadata."""
# Use LEVEL
self._state = "LEVEL"
self._data[self._state] = None
if self.supported_features & SUPPORT_COLOR:
self._data.update({"COLOR": None})
if self.supported... | [
"def",
"_init_data_struct",
"(",
"self",
")",
":",
"# Use LEVEL",
"self",
".",
"_state",
"=",
"\"LEVEL\"",
"self",
".",
"_data",
"[",
"self",
".",
"_state",
"]",
"=",
"None",
"if",
"self",
".",
"supported_features",
"&",
"SUPPORT_COLOR",
":",
"self",
".",
... | [
127,
4
] | [
136,
48
] | python | en | ['en', 'en', 'en'] | True |
async_setup | (hass: HomeAssistantType, config: ConfigType) | Set up the shell_command component. | Set up the shell_command component. | async def async_setup(hass: HomeAssistantType, config: ConfigType) -> bool:
"""Set up the shell_command component."""
conf = config.get(DOMAIN, {})
cache = {}
async def async_service_handler(service: ServiceCall) -> None:
"""Execute a shell command service."""
cmd = conf[service.servic... | [
"async",
"def",
"async_setup",
"(",
"hass",
":",
"HomeAssistantType",
",",
"config",
":",
"ConfigType",
")",
"->",
"bool",
":",
"conf",
"=",
"config",
".",
"get",
"(",
"DOMAIN",
",",
"{",
"}",
")",
"cache",
"=",
"{",
"}",
"async",
"def",
"async_service... | [
23,
0
] | [
118,
15
] | python | en | ['en', 'en', 'en'] | True |
_get_dyson_purecool_device | () | Return a valid device as provided by the Dyson web services. | Return a valid device as provided by the Dyson web services. | def _get_dyson_purecool_device():
"""Return a valid device as provided by the Dyson web services."""
device = mock.Mock(spec=DysonPureCool)
load_mock_device(device)
device.name = "Living room"
return device | [
"def",
"_get_dyson_purecool_device",
"(",
")",
":",
"device",
"=",
"mock",
".",
"Mock",
"(",
"spec",
"=",
"DysonPureCool",
")",
"load_mock_device",
"(",
"device",
")",
"device",
".",
"name",
"=",
"\"Living room\"",
"return",
"device"
] | [
45,
0
] | [
50,
17
] | python | en | ['en', 'en', 'en'] | True |
_get_dyson_purecoollink_device | () | Return a valid device as provided by the Dyson web services. | Return a valid device as provided by the Dyson web services. | def _get_dyson_purecoollink_device():
"""Return a valid device as provided by the Dyson web services."""
device = mock.Mock(spec=DysonPureCoolLink)
load_mock_device(device)
device.name = "Living room"
device.state.oscillation = "ON"
device.state.fan_mode = "FAN"
device.state.speed = FanSpeed... | [
"def",
"_get_dyson_purecoollink_device",
"(",
")",
":",
"device",
"=",
"mock",
".",
"Mock",
"(",
"spec",
"=",
"DysonPureCoolLink",
")",
"load_mock_device",
"(",
"device",
")",
"device",
".",
"name",
"=",
"\"Living room\"",
"device",
".",
"state",
".",
"oscilla... | [
53,
0
] | [
61,
17
] | python | en | ['en', 'en', 'en'] | True |
_get_config | () | Return a config dictionary. | Return a config dictionary. | def _get_config():
"""Return a config dictionary."""
return {
dyson_parent.DOMAIN: {
dyson_parent.CONF_USERNAME: "email",
dyson_parent.CONF_PASSWORD: "password",
dyson_parent.CONF_LANGUAGE: "GB",
dyson_parent.CONF_DEVICES: [
{"device_id": "... | [
"def",
"_get_config",
"(",
")",
":",
"return",
"{",
"dyson_parent",
".",
"DOMAIN",
":",
"{",
"dyson_parent",
".",
"CONF_USERNAME",
":",
"\"email\"",
",",
"dyson_parent",
".",
"CONF_PASSWORD",
":",
"\"password\"",
",",
"dyson_parent",
".",
"CONF_LANGUAGE",
":",
... | [
79,
0
] | [
90,
5
] | python | en | ['en', 'pt', 'en'] | True |
_get_device_with_no_state | () | Return a device with no state. | Return a device with no state. | def _get_device_with_no_state():
"""Return a device with no state."""
device = mock.Mock()
device.name = "Device_name"
device.state = None
return device | [
"def",
"_get_device_with_no_state",
"(",
")",
":",
"device",
"=",
"mock",
".",
"Mock",
"(",
")",
"device",
".",
"name",
"=",
"\"Device_name\"",
"device",
".",
"state",
"=",
"None",
"return",
"device"
] | [
93,
0
] | [
98,
17
] | python | en | ['en', 'en', 'en'] | True |
_get_device_off | () | Return a device with state off. | Return a device with state off. | def _get_device_off():
"""Return a device with state off."""
device = mock.Mock()
device.name = "Device_name"
device.state = mock.Mock()
device.state.fan_mode = "OFF"
device.state.night_mode = "ON"
device.state.speed = "0004"
return device | [
"def",
"_get_device_off",
"(",
")",
":",
"device",
"=",
"mock",
".",
"Mock",
"(",
")",
"device",
".",
"name",
"=",
"\"Device_name\"",
"device",
".",
"state",
"=",
"mock",
".",
"Mock",
"(",
")",
"device",
".",
"state",
".",
"fan_mode",
"=",
"\"OFF\"",
... | [
101,
0
] | [
109,
17
] | python | en | ['en', 'en', 'en'] | True |
_get_device_auto | () | Return a device with state auto. | Return a device with state auto. | def _get_device_auto():
"""Return a device with state auto."""
device = mock.Mock()
device.name = "Device_name"
device.state = mock.Mock()
device.state.fan_mode = "AUTO"
device.state.night_mode = "ON"
device.state.speed = "AUTO"
return device | [
"def",
"_get_device_auto",
"(",
")",
":",
"device",
"=",
"mock",
".",
"Mock",
"(",
")",
"device",
".",
"name",
"=",
"\"Device_name\"",
"device",
".",
"state",
"=",
"mock",
".",
"Mock",
"(",
")",
"device",
".",
"state",
".",
"fan_mode",
"=",
"\"AUTO\"",... | [
112,
0
] | [
120,
17
] | python | en | ['en', 'en', 'en'] | True |
_get_device_on | () | Return a valid state on. | Return a valid state on. | def _get_device_on():
"""Return a valid state on."""
device = mock.Mock(spec=DysonPureCoolLink)
device.name = "Device_name"
device.state = mock.Mock()
device.state.fan_mode = "FAN"
device.state.fan_state = "FAN"
device.state.oscillation = "ON"
device.state.night_mode = "OFF"
device.s... | [
"def",
"_get_device_on",
"(",
")",
":",
"device",
"=",
"mock",
".",
"Mock",
"(",
"spec",
"=",
"DysonPureCoolLink",
")",
"device",
".",
"name",
"=",
"\"Device_name\"",
"device",
".",
"state",
"=",
"mock",
".",
"Mock",
"(",
")",
"device",
".",
"state",
"... | [
123,
0
] | [
133,
17
] | python | en | ['en', 'et', 'en'] | True |
test_purecoollink_attributes | (devices, login, hass) | Test state attributes. | Test state attributes. | async def test_purecoollink_attributes(devices, login, hass):
"""Test state attributes."""
await async_setup_component(hass, dyson.DYSON_DOMAIN, _get_config())
await hass.async_block_till_done()
fan_state = hass.states.get("fan.living_room")
attributes = fan_state.attributes
assert fan_state.st... | [
"async",
"def",
"test_purecoollink_attributes",
"(",
"devices",
",",
"login",
",",
"hass",
")",
":",
"await",
"async_setup_component",
"(",
"hass",
",",
"dyson",
".",
"DYSON_DOMAIN",
",",
"_get_config",
"(",
")",
")",
"await",
"hass",
".",
"async_block_till_done... | [
399,
0
] | [
409,
47
] | python | en | ['en', 'en', 'en'] | True |
test_purecool_turn_on | (devices, login, hass) | Test turn on. | Test turn on. | async def test_purecool_turn_on(devices, login, hass):
"""Test turn on."""
device = devices.return_value[0]
await async_setup_component(hass, dyson.DYSON_DOMAIN, _get_config())
await hass.async_block_till_done()
await hass.services.async_call(
DOMAIN, SERVICE_TURN_ON, {ATTR_ENTITY_ID: "fan.... | [
"async",
"def",
"test_purecool_turn_on",
"(",
"devices",
",",
"login",
",",
"hass",
")",
":",
"device",
"=",
"devices",
".",
"return_value",
"[",
"0",
"]",
"await",
"async_setup_component",
"(",
"hass",
",",
"dyson",
".",
"DYSON_DOMAIN",
",",
"_get_config",
... | [
417,
0
] | [
431,
41
] | python | en | ['en', 'et', 'en'] | True |
test_purecool_set_speed | (devices, login, hass) | Test set speed. | Test set speed. | async def test_purecool_set_speed(devices, login, hass):
"""Test set speed."""
device = devices.return_value[0]
await async_setup_component(hass, dyson.DYSON_DOMAIN, _get_config())
await hass.async_block_till_done()
await hass.services.async_call(
DOMAIN,
SERVICE_TURN_ON,
{A... | [
"async",
"def",
"test_purecool_set_speed",
"(",
"devices",
",",
"login",
",",
"hass",
")",
":",
"device",
"=",
"devices",
".",
"return_value",
"[",
"0",
"]",
"await",
"async_setup_component",
"(",
"hass",
",",
"dyson",
".",
"DYSON_DOMAIN",
",",
"_get_config",
... | [
439,
0
] | [
475,
66
] | python | en | ['en', 'de', 'en'] | True |
test_purecool_turn_off | (devices, login, hass) | Test turn off. | Test turn off. | async def test_purecool_turn_off(devices, login, hass):
"""Test turn off."""
device = devices.return_value[0]
await async_setup_component(hass, dyson.DYSON_DOMAIN, _get_config())
await hass.async_block_till_done()
await hass.services.async_call(
DOMAIN, SERVICE_TURN_OFF, {ATTR_ENTITY_ID: "f... | [
"async",
"def",
"test_purecool_turn_off",
"(",
"devices",
",",
"login",
",",
"hass",
")",
":",
"device",
"=",
"devices",
".",
"return_value",
"[",
"0",
"]",
"await",
"async_setup_component",
"(",
"hass",
",",
"dyson",
".",
"DYSON_DOMAIN",
",",
"_get_config",
... | [
483,
0
] | [
497,
42
] | python | en | ['en', 'cy', 'en'] | True |
test_purecool_set_dyson_speed | (devices, login, hass) | Test set exact dyson speed. | Test set exact dyson speed. | async def test_purecool_set_dyson_speed(devices, login, hass):
"""Test set exact dyson speed."""
device = devices.return_value[0]
await async_setup_component(hass, dyson.DYSON_DOMAIN, _get_config())
await hass.async_block_till_done()
await hass.services.async_call(
dyson.DYSON_DOMAIN,
... | [
"async",
"def",
"test_purecool_set_dyson_speed",
"(",
"devices",
",",
"login",
",",
"hass",
")",
":",
"device",
"=",
"devices",
".",
"return_value",
"[",
"0",
"]",
"await",
"async_setup_component",
"(",
"hass",
",",
"dyson",
".",
"DYSON_DOMAIN",
",",
"_get_con... | [
505,
0
] | [
531,
65
] | python | el-Latn | ['no', 'el-Latn', 'en'] | False |
test_purecool_oscillate | (devices, login, hass) | Test set oscillation. | Test set oscillation. | async def test_purecool_oscillate(devices, login, hass):
"""Test set oscillation."""
device = devices.return_value[0]
await async_setup_component(hass, dyson.DYSON_DOMAIN, _get_config())
await hass.async_block_till_done()
await hass.services.async_call(
DOMAIN,
SERVICE_OSCILLATE,
... | [
"async",
"def",
"test_purecool_oscillate",
"(",
"devices",
",",
"login",
",",
"hass",
")",
":",
"device",
"=",
"devices",
".",
"return_value",
"[",
"0",
"]",
"await",
"async_setup_component",
"(",
"hass",
",",
"dyson",
".",
"DYSON_DOMAIN",
",",
"_get_config",
... | [
539,
0
] | [
567,
53
] | python | en | ['en', 'is', 'en'] | True |
test_purecool_set_night_mode | (devices, login, hass) | Test set night mode. | Test set night mode. | async def test_purecool_set_night_mode(devices, login, hass):
"""Test set night mode."""
device = devices.return_value[0]
await async_setup_component(hass, dyson.DYSON_DOMAIN, _get_config())
await hass.async_block_till_done()
await hass.services.async_call(
dyson.DYSON_DOMAIN,
dyso... | [
"async",
"def",
"test_purecool_set_night_mode",
"(",
"devices",
",",
"login",
",",
"hass",
")",
":",
"device",
"=",
"devices",
".",
"return_value",
"[",
"0",
"]",
"await",
"async_setup_component",
"(",
"hass",
",",
"dyson",
".",
"DYSON_DOMAIN",
",",
"_get_conf... | [
575,
0
] | [
604,
52
] | python | en | ['en', 'jv', 'en'] | True |
test_purecool_set_auto_mode | (devices, login, hass) | Test set auto mode. | Test set auto mode. | async def test_purecool_set_auto_mode(devices, login, hass):
"""Test set auto mode."""
device = devices.return_value[0]
await async_setup_component(hass, dyson.DYSON_DOMAIN, _get_config())
await hass.async_block_till_done()
await hass.services.async_call(
dyson.DYSON_DOMAIN,
dyson.S... | [
"async",
"def",
"test_purecool_set_auto_mode",
"(",
"devices",
",",
"login",
",",
"hass",
")",
":",
"device",
"=",
"devices",
".",
"return_value",
"[",
"0",
"]",
"await",
"async_setup_component",
"(",
"hass",
",",
"dyson",
".",
"DYSON_DOMAIN",
",",
"_get_confi... | [
612,
0
] | [
640,
51
] | python | el-Latn | ['en', 'el-Latn', 'nl'] | False |
test_purecool_set_angle | (devices, login, hass) | Test set angle. | Test set angle. | async def test_purecool_set_angle(devices, login, hass):
"""Test set angle."""
device = devices.return_value[0]
await async_setup_component(hass, dyson.DYSON_DOMAIN, _get_config())
await hass.async_block_till_done()
await hass.services.async_call(
dyson.DYSON_DOMAIN,
dyson.SERVICE_S... | [
"async",
"def",
"test_purecool_set_angle",
"(",
"devices",
",",
"login",
",",
"hass",
")",
":",
"device",
"=",
"devices",
".",
"return_value",
"[",
"0",
"]",
"await",
"async_setup_component",
"(",
"hass",
",",
"dyson",
".",
"DYSON_DOMAIN",
",",
"_get_config",
... | [
648,
0
] | [
676,
57
] | python | en | ['tl', 'haw', 'en'] | False |
test_purecool_set_flow_direction_front | (devices, login, hass) | Test set frontal flow direction. | Test set frontal flow direction. | async def test_purecool_set_flow_direction_front(devices, login, hass):
"""Test set frontal flow direction."""
device = devices.return_value[0]
await async_setup_component(hass, dyson.DYSON_DOMAIN, _get_config())
await hass.async_block_till_done()
await hass.services.async_call(
dyson.DYSON... | [
"async",
"def",
"test_purecool_set_flow_direction_front",
"(",
"devices",
",",
"login",
",",
"hass",
")",
":",
"device",
"=",
"devices",
".",
"return_value",
"[",
"0",
"]",
"await",
"async_setup_component",
"(",
"hass",
",",
"dyson",
".",
"DYSON_DOMAIN",
",",
... | [
684,
0
] | [
712,
59
] | python | en | ['en', 'da', 'en'] | True |
test_purecool_set_timer | (devices, login, hass) | Test set timer. | Test set timer. | async def test_purecool_set_timer(devices, login, hass):
"""Test set timer."""
device = devices.return_value[0]
await async_setup_component(hass, dyson.DYSON_DOMAIN, _get_config())
await hass.async_block_till_done()
await hass.services.async_call(
dyson.DYSON_DOMAIN,
dyson.SERVICE_S... | [
"async",
"def",
"test_purecool_set_timer",
"(",
"devices",
",",
"login",
",",
"hass",
")",
":",
"device",
"=",
"devices",
".",
"return_value",
"[",
"0",
"]",
"await",
"async_setup_component",
"(",
"hass",
",",
"dyson",
".",
"DYSON_DOMAIN",
",",
"_get_config",
... | [
720,
0
] | [
748,
53
] | python | da | ['da', 'da', 'en'] | True |
test_purecool_update_state | (devices, login, hass) | Test state update. | Test state update. | async def test_purecool_update_state(devices, login, hass):
"""Test state update."""
device = devices.return_value[0]
await async_setup_component(hass, dyson.DYSON_DOMAIN, _get_config())
await hass.async_block_till_done()
event = {
"msg": "CURRENT-STATE",
"product-state": {
... | [
"async",
"def",
"test_purecool_update_state",
"(",
"devices",
",",
"login",
",",
"hass",
")",
":",
"device",
"=",
"devices",
".",
"return_value",
"[",
"0",
"]",
"await",
"async_setup_component",
"(",
"hass",
",",
"dyson",
".",
"DYSON_DOMAIN",
",",
"_get_config... | [
756,
0
] | [
809,
77
] | python | en | ['en', 'co', 'en'] | True |
test_purecool_update_state_filter_inv | (devices, login, hass) | Test state TP06 carbon filter state. | Test state TP06 carbon filter state. | async def test_purecool_update_state_filter_inv(devices, login, hass):
"""Test state TP06 carbon filter state."""
device = devices.return_value[0]
await async_setup_component(hass, dyson.DYSON_DOMAIN, _get_config())
await hass.async_block_till_done()
event = {
"msg": "CURRENT-STATE",
... | [
"async",
"def",
"test_purecool_update_state_filter_inv",
"(",
"devices",
",",
"login",
",",
"hass",
")",
":",
"device",
"=",
"devices",
".",
"return_value",
"[",
"0",
"]",
"await",
"async_setup_component",
"(",
"hass",
",",
"dyson",
".",
"DYSON_DOMAIN",
",",
"... | [
817,
0
] | [
870,
77
] | python | en | ['en', 'en', 'en'] | True |
test_purecool_component_setup_only_once | (devices, login, hass) | Test if entities are created only once. | Test if entities are created only once. | async def test_purecool_component_setup_only_once(devices, login, hass):
"""Test if entities are created only once."""
config = _get_config()
await async_setup_component(hass, dyson_parent.DOMAIN, config)
await hass.async_block_till_done()
discovery.load_platform(hass, "fan", dyson_parent.DOMAIN, {}... | [
"async",
"def",
"test_purecool_component_setup_only_once",
"(",
"devices",
",",
"login",
",",
"hass",
")",
":",
"config",
"=",
"_get_config",
"(",
")",
"await",
"async_setup_component",
"(",
"hass",
",",
"dyson_parent",
".",
"DOMAIN",
",",
"config",
")",
"await"... | [
878,
0
] | [
893,
49
] | python | en | ['en', 'en', 'en'] | True |
MockDysonState.__init__ | (self) | Create new Mock Dyson State. | Create new Mock Dyson State. | def __init__(self):
"""Create new Mock Dyson State."""
pass | [
"def",
"__init__",
"(",
"self",
")",
":",
"pass"
] | [
36,
4
] | [
38,
12
] | python | en | ['en', 'en', 'en'] | True |
MockDysonState.__repr__ | (self) | Mock repr because original one fails since constructor not called. | Mock repr because original one fails since constructor not called. | def __repr__(self):
"""Mock repr because original one fails since constructor not called."""
return "<MockDysonState>" | [
"def",
"__repr__",
"(",
"self",
")",
":",
"return",
"\"<MockDysonState>\""
] | [
40,
4
] | [
42,
33
] | python | en | ['en', 'en', 'en'] | True |
DysonSetupTest.setUp | (self) | Set up things to be run when tests are started. | Set up things to be run when tests are started. | def setUp(self): # pylint: disable=invalid-name
"""Set up things to be run when tests are started."""
self.hass = get_test_home_assistant()
self.addCleanup(self.tear_down_cleanup) | [
"def",
"setUp",
"(",
"self",
")",
":",
"# pylint: disable=invalid-name",
"self",
".",
"hass",
"=",
"get_test_home_assistant",
"(",
")",
"self",
".",
"addCleanup",
"(",
"self",
".",
"tear_down_cleanup",
")"
] | [
139,
4
] | [
142,
47
] | python | en | ['en', 'en', 'en'] | True |
DysonSetupTest.tear_down_cleanup | (self) | Stop everything that was started. | Stop everything that was started. | def tear_down_cleanup(self):
"""Stop everything that was started."""
self.hass.stop() | [
"def",
"tear_down_cleanup",
"(",
"self",
")",
":",
"self",
".",
"hass",
".",
"stop",
"(",
")"
] | [
144,
4
] | [
146,
24
] | python | en | ['en', 'en', 'en'] | True |
DysonSetupTest.test_setup_component_with_no_devices | (self) | Test setup component with no devices. | Test setup component with no devices. | def test_setup_component_with_no_devices(self):
"""Test setup component with no devices."""
self.hass.data[dyson.DYSON_DEVICES] = []
add_entities = mock.MagicMock()
dyson.setup_platform(self.hass, None, add_entities, mock.Mock())
add_entities.assert_called_with([]) | [
"def",
"test_setup_component_with_no_devices",
"(",
"self",
")",
":",
"self",
".",
"hass",
".",
"data",
"[",
"dyson",
".",
"DYSON_DEVICES",
"]",
"=",
"[",
"]",
"add_entities",
"=",
"mock",
".",
"MagicMock",
"(",
")",
"dyson",
".",
"setup_platform",
"(",
"s... | [
148,
4
] | [
153,
43
] | python | en | ['en', 'en', 'en'] | True |
DysonSetupTest.test_setup_component | (self) | Test setup component with devices. | Test setup component with devices. | def test_setup_component(self):
"""Test setup component with devices."""
def _add_device(devices):
assert len(devices) == 2
assert devices[0].name == "Device_name"
device_fan = _get_device_on()
device_purecool_fan = _get_dyson_purecool_device()
device_no... | [
"def",
"test_setup_component",
"(",
"self",
")",
":",
"def",
"_add_device",
"(",
"devices",
")",
":",
"assert",
"len",
"(",
"devices",
")",
"==",
"2",
"assert",
"devices",
"[",
"0",
"]",
".",
"name",
"==",
"\"Device_name\"",
"device_fan",
"=",
"_get_device... | [
155,
4
] | [
171,
58
] | python | en | ['en', 'en', 'en'] | True |
DysonTest.setUp | (self) | Set up things to be run when tests are started. | Set up things to be run when tests are started. | def setUp(self): # pylint: disable=invalid-name
"""Set up things to be run when tests are started."""
self.hass = get_test_home_assistant()
self.addCleanup(self.tear_down_cleanup) | [
"def",
"setUp",
"(",
"self",
")",
":",
"# pylint: disable=invalid-name",
"self",
".",
"hass",
"=",
"get_test_home_assistant",
"(",
")",
"self",
".",
"addCleanup",
"(",
"self",
".",
"tear_down_cleanup",
")"
] | [
177,
4
] | [
180,
47
] | python | en | ['en', 'en', 'en'] | True |
DysonTest.tear_down_cleanup | (self) | Stop everything that was started. | Stop everything that was started. | def tear_down_cleanup(self):
"""Stop everything that was started."""
self.hass.stop() | [
"def",
"tear_down_cleanup",
"(",
"self",
")",
":",
"self",
".",
"hass",
".",
"stop",
"(",
")"
] | [
182,
4
] | [
184,
24
] | python | en | ['en', 'en', 'en'] | True |
DysonTest.test_dyson_set_speed | (self) | Test set fan speed. | Test set fan speed. | def test_dyson_set_speed(self):
"""Test set fan speed."""
device = _get_device_on()
component = dyson.DysonPureCoolLinkDevice(self.hass, device)
assert not component.should_poll
component.set_speed("1")
set_config = device.set_configuration
set_config.assert_calle... | [
"def",
"test_dyson_set_speed",
"(",
"self",
")",
":",
"device",
"=",
"_get_device_on",
"(",
")",
"component",
"=",
"dyson",
".",
"DysonPureCoolLinkDevice",
"(",
"self",
".",
"hass",
",",
"device",
")",
"assert",
"not",
"component",
".",
"should_poll",
"compone... | [
186,
4
] | [
199,
60
] | python | fy | ['no', 'fy', 'nl'] | False |
DysonTest.test_dyson_turn_on | (self) | Test turn on fan. | Test turn on fan. | def test_dyson_turn_on(self):
"""Test turn on fan."""
device = _get_device_on()
component = dyson.DysonPureCoolLinkDevice(self.hass, device)
assert not component.should_poll
component.turn_on()
set_config = device.set_configuration
set_config.assert_called_with(fa... | [
"def",
"test_dyson_turn_on",
"(",
"self",
")",
":",
"device",
"=",
"_get_device_on",
"(",
")",
"component",
"=",
"dyson",
".",
"DysonPureCoolLinkDevice",
"(",
"self",
".",
"hass",
",",
"device",
")",
"assert",
"not",
"component",
".",
"should_poll",
"component... | [
201,
4
] | [
208,
59
] | python | en | ['en', 'fy', 'en'] | True |
DysonTest.test_dyson_turn_night_mode | (self) | Test turn on fan with night mode. | Test turn on fan with night mode. | def test_dyson_turn_night_mode(self):
"""Test turn on fan with night mode."""
device = _get_device_on()
component = dyson.DysonPureCoolLinkDevice(self.hass, device)
assert not component.should_poll
component.set_night_mode(True)
set_config = device.set_configuration
... | [
"def",
"test_dyson_turn_night_mode",
"(",
"self",
")",
":",
"device",
"=",
"_get_device_on",
"(",
")",
"component",
"=",
"dyson",
".",
"DysonPureCoolLinkDevice",
"(",
"self",
".",
"hass",
",",
"device",
")",
"assert",
"not",
"component",
".",
"should_poll",
"c... | [
210,
4
] | [
221,
74
] | python | en | ['en', 'en', 'en'] | True |
DysonTest.test_is_night_mode | (self) | Test night mode. | Test night mode. | def test_is_night_mode(self):
"""Test night mode."""
device = _get_device_on()
component = dyson.DysonPureCoolLinkDevice(self.hass, device)
assert not component.night_mode
device = _get_device_off()
component = dyson.DysonPureCoolLinkDevice(self.hass, device)
ass... | [
"def",
"test_is_night_mode",
"(",
"self",
")",
":",
"device",
"=",
"_get_device_on",
"(",
")",
"component",
"=",
"dyson",
".",
"DysonPureCoolLinkDevice",
"(",
"self",
".",
"hass",
",",
"device",
")",
"assert",
"not",
"component",
".",
"night_mode",
"device",
... | [
223,
4
] | [
231,
35
] | python | en | ['en', 'zh', 'en'] | True |
DysonTest.test_dyson_turn_auto_mode | (self) | Test turn on/off fan with auto mode. | Test turn on/off fan with auto mode. | def test_dyson_turn_auto_mode(self):
"""Test turn on/off fan with auto mode."""
device = _get_device_on()
component = dyson.DysonPureCoolLinkDevice(self.hass, device)
assert not component.should_poll
component.set_auto_mode(True)
set_config = device.set_configuration
... | [
"def",
"test_dyson_turn_auto_mode",
"(",
"self",
")",
":",
"device",
"=",
"_get_device_on",
"(",
")",
"component",
"=",
"dyson",
".",
"DysonPureCoolLinkDevice",
"(",
"self",
".",
"hass",
",",
"device",
")",
"assert",
"not",
"component",
".",
"should_poll",
"co... | [
233,
4
] | [
244,
59
] | python | en | ['en', 'en', 'en'] | True |
DysonTest.test_is_auto_mode | (self) | Test auto mode. | Test auto mode. | def test_is_auto_mode(self):
"""Test auto mode."""
device = _get_device_on()
component = dyson.DysonPureCoolLinkDevice(self.hass, device)
assert not component.auto_mode
device = _get_device_auto()
component = dyson.DysonPureCoolLinkDevice(self.hass, device)
asser... | [
"def",
"test_is_auto_mode",
"(",
"self",
")",
":",
"device",
"=",
"_get_device_on",
"(",
")",
"component",
"=",
"dyson",
".",
"DysonPureCoolLinkDevice",
"(",
"self",
".",
"hass",
",",
"device",
")",
"assert",
"not",
"component",
".",
"auto_mode",
"device",
"... | [
246,
4
] | [
254,
34
] | python | el-Latn | ['en', 'el-Latn', 'it'] | False |
DysonTest.test_dyson_turn_on_speed | (self) | Test turn on fan with specified speed. | Test turn on fan with specified speed. | def test_dyson_turn_on_speed(self):
"""Test turn on fan with specified speed."""
device = _get_device_on()
component = dyson.DysonPureCoolLinkDevice(self.hass, device)
assert not component.should_poll
component.turn_on("1")
set_config = device.set_configuration
se... | [
"def",
"test_dyson_turn_on_speed",
"(",
"self",
")",
":",
"device",
"=",
"_get_device_on",
"(",
")",
"component",
"=",
"dyson",
".",
"DysonPureCoolLinkDevice",
"(",
"self",
".",
"hass",
",",
"device",
")",
"assert",
"not",
"component",
".",
"should_poll",
"com... | [
256,
4
] | [
269,
60
] | python | en | ['en', 'fy', 'en'] | True |
DysonTest.test_dyson_turn_off | (self) | Test turn off fan. | Test turn off fan. | def test_dyson_turn_off(self):
"""Test turn off fan."""
device = _get_device_on()
component = dyson.DysonPureCoolLinkDevice(self.hass, device)
assert not component.should_poll
component.turn_off()
set_config = device.set_configuration
set_config.assert_called_with... | [
"def",
"test_dyson_turn_off",
"(",
"self",
")",
":",
"device",
"=",
"_get_device_on",
"(",
")",
"component",
"=",
"dyson",
".",
"DysonPureCoolLinkDevice",
"(",
"self",
".",
"hass",
",",
"device",
")",
"assert",
"not",
"component",
".",
"should_poll",
"componen... | [
271,
4
] | [
278,
59
] | python | en | ['en', 'fy', 'en'] | True |
DysonTest.test_dyson_oscillate_off | (self) | Test turn off oscillation. | Test turn off oscillation. | def test_dyson_oscillate_off(self):
"""Test turn off oscillation."""
device = _get_device_on()
component = dyson.DysonPureCoolLinkDevice(self.hass, device)
component.oscillate(False)
set_config = device.set_configuration
set_config.assert_called_with(oscillation=Oscillati... | [
"def",
"test_dyson_oscillate_off",
"(",
"self",
")",
":",
"device",
"=",
"_get_device_on",
"(",
")",
"component",
"=",
"dyson",
".",
"DysonPureCoolLinkDevice",
"(",
"self",
".",
"hass",
",",
"device",
")",
"component",
".",
"oscillate",
"(",
"False",
")",
"s... | [
280,
4
] | [
286,
78
] | python | en | ['en', 'fi', 'en'] | True |
DysonTest.test_dyson_oscillate_on | (self) | Test turn on oscillation. | Test turn on oscillation. | def test_dyson_oscillate_on(self):
"""Test turn on oscillation."""
device = _get_device_on()
component = dyson.DysonPureCoolLinkDevice(self.hass, device)
component.oscillate(True)
set_config = device.set_configuration
set_config.assert_called_with(oscillation=Oscillation.... | [
"def",
"test_dyson_oscillate_on",
"(",
"self",
")",
":",
"device",
"=",
"_get_device_on",
"(",
")",
"component",
"=",
"dyson",
".",
"DysonPureCoolLinkDevice",
"(",
"self",
".",
"hass",
",",
"device",
")",
"component",
".",
"oscillate",
"(",
"True",
")",
"set... | [
288,
4
] | [
294,
77
] | python | en | ['en', 'fi', 'en'] | True |
DysonTest.test_dyson_oscillate_value_on | (self) | Test get oscillation value on. | Test get oscillation value on. | def test_dyson_oscillate_value_on(self):
"""Test get oscillation value on."""
device = _get_device_on()
component = dyson.DysonPureCoolLinkDevice(self.hass, device)
assert component.oscillating | [
"def",
"test_dyson_oscillate_value_on",
"(",
"self",
")",
":",
"device",
"=",
"_get_device_on",
"(",
")",
"component",
"=",
"dyson",
".",
"DysonPureCoolLinkDevice",
"(",
"self",
".",
"hass",
",",
"device",
")",
"assert",
"component",
".",
"oscillating"
] | [
296,
4
] | [
300,
36
] | python | en | ['en', 'da', 'en'] | True |
DysonTest.test_dyson_oscillate_value_off | (self) | Test get oscillation value off. | Test get oscillation value off. | def test_dyson_oscillate_value_off(self):
"""Test get oscillation value off."""
device = _get_device_off()
component = dyson.DysonPureCoolLinkDevice(self.hass, device)
assert not component.oscillating | [
"def",
"test_dyson_oscillate_value_off",
"(",
"self",
")",
":",
"device",
"=",
"_get_device_off",
"(",
")",
"component",
"=",
"dyson",
".",
"DysonPureCoolLinkDevice",
"(",
"self",
".",
"hass",
",",
"device",
")",
"assert",
"not",
"component",
".",
"oscillating"
... | [
302,
4
] | [
306,
40
] | python | en | ['en', 'da', 'en'] | True |
DysonTest.test_dyson_on | (self) | Test device is on. | Test device is on. | def test_dyson_on(self):
"""Test device is on."""
device = _get_device_on()
component = dyson.DysonPureCoolLinkDevice(self.hass, device)
assert component.is_on | [
"def",
"test_dyson_on",
"(",
"self",
")",
":",
"device",
"=",
"_get_device_on",
"(",
")",
"component",
"=",
"dyson",
".",
"DysonPureCoolLinkDevice",
"(",
"self",
".",
"hass",
",",
"device",
")",
"assert",
"component",
".",
"is_on"
] | [
308,
4
] | [
312,
30
] | python | en | ['en', 'en', 'en'] | True |
DysonTest.test_dyson_off | (self) | Test device is off. | Test device is off. | def test_dyson_off(self):
"""Test device is off."""
device = _get_device_off()
component = dyson.DysonPureCoolLinkDevice(self.hass, device)
assert not component.is_on
device = _get_device_with_no_state()
component = dyson.DysonPureCoolLinkDevice(self.hass, device)
... | [
"def",
"test_dyson_off",
"(",
"self",
")",
":",
"device",
"=",
"_get_device_off",
"(",
")",
"component",
"=",
"dyson",
".",
"DysonPureCoolLinkDevice",
"(",
"self",
".",
"hass",
",",
"device",
")",
"assert",
"not",
"component",
".",
"is_on",
"device",
"=",
... | [
314,
4
] | [
322,
34
] | python | en | ['en', 'en', 'en'] | True |
DysonTest.test_dyson_get_speed | (self) | Test get device speed. | Test get device speed. | def test_dyson_get_speed(self):
"""Test get device speed."""
device = _get_device_on()
component = dyson.DysonPureCoolLinkDevice(self.hass, device)
assert component.speed == 1
device = _get_device_off()
component = dyson.DysonPureCoolLinkDevice(self.hass, device)
... | [
"def",
"test_dyson_get_speed",
"(",
"self",
")",
":",
"device",
"=",
"_get_device_on",
"(",
")",
"component",
"=",
"dyson",
".",
"DysonPureCoolLinkDevice",
"(",
"self",
".",
"hass",
",",
"device",
")",
"assert",
"component",
".",
"speed",
"==",
"1",
"device"... | [
324,
4
] | [
340,
40
] | python | de | ['nl', 'de', 'en'] | False |
DysonTest.test_dyson_get_direction | (self) | Test get device direction. | Test get device direction. | def test_dyson_get_direction(self):
"""Test get device direction."""
device = _get_device_on()
component = dyson.DysonPureCoolLinkDevice(self.hass, device)
assert component.current_direction is None | [
"def",
"test_dyson_get_direction",
"(",
"self",
")",
":",
"device",
"=",
"_get_device_on",
"(",
")",
"component",
"=",
"dyson",
".",
"DysonPureCoolLinkDevice",
"(",
"self",
".",
"hass",
",",
"device",
")",
"assert",
"component",
".",
"current_direction",
"is",
... | [
342,
4
] | [
346,
50
] | python | en | ['nl', 'en', 'en'] | True |
DysonTest.test_dyson_get_speed_list | (self) | Test get speeds list. | Test get speeds list. | def test_dyson_get_speed_list(self):
"""Test get speeds list."""
device = _get_device_on()
component = dyson.DysonPureCoolLinkDevice(self.hass, device)
assert len(component.speed_list) == 11 | [
"def",
"test_dyson_get_speed_list",
"(",
"self",
")",
":",
"device",
"=",
"_get_device_on",
"(",
")",
"component",
"=",
"dyson",
".",
"DysonPureCoolLinkDevice",
"(",
"self",
".",
"hass",
",",
"device",
")",
"assert",
"len",
"(",
"component",
".",
"speed_list",... | [
348,
4
] | [
352,
46
] | python | de | ['nl', 'de', 'en'] | False |
DysonTest.test_dyson_supported_features | (self) | Test supported features. | Test supported features. | def test_dyson_supported_features(self):
"""Test supported features."""
device = _get_device_on()
component = dyson.DysonPureCoolLinkDevice(self.hass, device)
assert component.supported_features == 3 | [
"def",
"test_dyson_supported_features",
"(",
"self",
")",
":",
"device",
"=",
"_get_device_on",
"(",
")",
"component",
"=",
"dyson",
".",
"DysonPureCoolLinkDevice",
"(",
"self",
".",
"hass",
",",
"device",
")",
"assert",
"component",
".",
"supported_features",
"... | [
354,
4
] | [
358,
48
] | python | en | ['en', 'en', 'en'] | True |
DysonTest.test_on_message | (self) | Test when message is received. | Test when message is received. | def test_on_message(self):
"""Test when message is received."""
device = _get_device_on()
component = dyson.DysonPureCoolLinkDevice(self.hass, device)
component.entity_id = "entity_id"
component.schedule_update_ha_state = mock.Mock()
component.on_message(MockDysonState())... | [
"def",
"test_on_message",
"(",
"self",
")",
":",
"device",
"=",
"_get_device_on",
"(",
")",
"component",
"=",
"dyson",
".",
"DysonPureCoolLinkDevice",
"(",
"self",
".",
"hass",
",",
"device",
")",
"component",
".",
"entity_id",
"=",
"\"entity_id\"",
"component... | [
360,
4
] | [
367,
63
] | python | en | ['en', 'en', 'en'] | True |
DysonTest.test_service_set_night_mode | (self) | Test set night mode service. | Test set night mode service. | def test_service_set_night_mode(self):
"""Test set night mode service."""
dyson_device = mock.MagicMock()
self.hass.data[DYSON_DEVICES] = []
dyson_device.entity_id = "fan.living_room"
self.hass.data[dyson.DYSON_FAN_DEVICES] = [dyson_device]
dyson.setup_platform(self.hass,... | [
"def",
"test_service_set_night_mode",
"(",
"self",
")",
":",
"dyson_device",
"=",
"mock",
".",
"MagicMock",
"(",
")",
"self",
".",
"hass",
".",
"data",
"[",
"DYSON_DEVICES",
"]",
"=",
"[",
"]",
"dyson_device",
".",
"entity_id",
"=",
"\"fan.living_room\"",
"s... | [
369,
4
] | [
391,
60
] | python | en | ['en', 'zh', 'en'] | True |
async_setup | (hass, config) | Set up the Mill platform. | Set up the Mill platform. | async def async_setup(hass, config):
"""Set up the Mill platform."""
return True | [
"async",
"def",
"async_setup",
"(",
"hass",
",",
"config",
")",
":",
"return",
"True"
] | [
3,
0
] | [
5,
15
] | python | en | ['en', 'da', 'en'] | True |
async_setup_entry | (hass, entry) | Set up the Mill heater. | Set up the Mill heater. | async def async_setup_entry(hass, entry):
"""Set up the Mill heater."""
hass.async_create_task(
hass.config_entries.async_forward_entry_setup(entry, "climate")
)
return True | [
"async",
"def",
"async_setup_entry",
"(",
"hass",
",",
"entry",
")",
":",
"hass",
".",
"async_create_task",
"(",
"hass",
".",
"config_entries",
".",
"async_forward_entry_setup",
"(",
"entry",
",",
"\"climate\"",
")",
")",
"return",
"True"
] | [
8,
0
] | [
13,
15
] | python | en | ['en', 'en', 'en'] | True |
async_unload_entry | (hass, config_entry) | Unload a config entry. | Unload a config entry. | async def async_unload_entry(hass, config_entry):
"""Unload a config entry."""
unload_ok = await hass.config_entries.async_forward_entry_unload(
config_entry, "climate"
)
return unload_ok | [
"async",
"def",
"async_unload_entry",
"(",
"hass",
",",
"config_entry",
")",
":",
"unload_ok",
"=",
"await",
"hass",
".",
"config_entries",
".",
"async_forward_entry_unload",
"(",
"config_entry",
",",
"\"climate\"",
")",
"return",
"unload_ok"
] | [
16,
0
] | [
21,
20
] | python | en | ['en', 'es', 'en'] | True |
_check_sensor_schema | (conf) | Check sensors and attributes are valid. | Check sensors and attributes are valid. | def _check_sensor_schema(conf):
"""Check sensors and attributes are valid."""
try:
valid = [s.name for s in pysma.Sensors()]
except (ImportError, AttributeError):
return conf
customs = list(conf[CONF_CUSTOM])
for sensor in conf[CONF_SENSORS]:
if sensor in customs:
... | [
"def",
"_check_sensor_schema",
"(",
"conf",
")",
":",
"try",
":",
"valid",
"=",
"[",
"s",
".",
"name",
"for",
"s",
"in",
"pysma",
".",
"Sensors",
"(",
")",
"]",
"except",
"(",
"ImportError",
",",
"AttributeError",
")",
":",
"return",
"conf",
"customs",... | [
35,
0
] | [
52,
15
] | python | en | ['en', 'en', 'en'] | True |
async_setup_platform | (hass, config, async_add_entities, discovery_info=None) | Set up SMA WebConnect sensor. | Set up SMA WebConnect sensor. | async def async_setup_platform(hass, config, async_add_entities, discovery_info=None):
"""Set up SMA WebConnect sensor."""
# Check config again during load - dependency available
config = _check_sensor_schema(config)
# Init all default sensors
sensor_def = pysma.Sensors()
# Sensor from the cu... | [
"async",
"def",
"async_setup_platform",
"(",
"hass",
",",
"config",
",",
"async_add_entities",
",",
"discovery_info",
"=",
"None",
")",
":",
"# Check config again during load - dependency available",
"config",
"=",
"_check_sensor_schema",
"(",
"config",
")",
"# Init all d... | [
86,
0
] | [
169,
56
] | python | en | ['en', 'da', 'en'] | True |
SMAsensor.__init__ | (self, pysma_sensor, sub_sensors) | Initialize the sensor. | Initialize the sensor. | def __init__(self, pysma_sensor, sub_sensors):
"""Initialize the sensor."""
self._sensor = pysma_sensor
self._sub_sensors = sub_sensors # Can be remove from 0.99
self._attr = {s.name: "" for s in sub_sensors}
self._state = self._sensor.value | [
"def",
"__init__",
"(",
"self",
",",
"pysma_sensor",
",",
"sub_sensors",
")",
":",
"self",
".",
"_sensor",
"=",
"pysma_sensor",
"self",
".",
"_sub_sensors",
"=",
"sub_sensors",
"# Can be remove from 0.99",
"self",
".",
"_attr",
"=",
"{",
"s",
".",
"name",
":... | [
175,
4
] | [
181,
40
] | python | en | ['en', 'en', 'en'] | True |
SMAsensor.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._sensor.name | [
"def",
"name",
"(",
"self",
")",
":",
"return",
"self",
".",
"_sensor",
".",
"name"
] | [
184,
4
] | [
186,
32
] | python | en | ['en', 'mi', 'en'] | True |
SMAsensor.state | (self) | Return the state of the sensor. | Return the state of the sensor. | def state(self):
"""Return the state of the sensor."""
return self._state | [
"def",
"state",
"(",
"self",
")",
":",
"return",
"self",
".",
"_state"
] | [
189,
4
] | [
191,
26
] | python | en | ['en', 'en', 'en'] | True |
SMAsensor.unit_of_measurement | (self) | Return the unit the value is expressed in. | Return the unit the value is expressed in. | def unit_of_measurement(self):
"""Return the unit the value is expressed in."""
return self._sensor.unit | [
"def",
"unit_of_measurement",
"(",
"self",
")",
":",
"return",
"self",
".",
"_sensor",
".",
"unit"
] | [
194,
4
] | [
196,
32
] | python | en | ['en', 'en', 'en'] | True |
SMAsensor.device_state_attributes | (self) | Return the state attributes of the sensor. | Return the state attributes of the sensor. | def device_state_attributes(self): # Can be remove from 0.99
"""Return the state attributes of the sensor."""
return self._attr | [
"def",
"device_state_attributes",
"(",
"self",
")",
":",
"# Can be remove from 0.99",
"return",
"self",
".",
"_attr"
] | [
199,
4
] | [
201,
25
] | python | en | ['en', 'en', 'en'] | True |
SMAsensor.poll | (self) | SMA sensors are updated & don't poll. | SMA sensors are updated & don't poll. | def poll(self):
"""SMA sensors are updated & don't poll."""
return False | [
"def",
"poll",
"(",
"self",
")",
":",
"return",
"False"
] | [
204,
4
] | [
206,
20
] | python | en | ['en', 'en', 'en'] | True |
SMAsensor.async_update_values | (self) | Update this sensor. | Update this sensor. | def async_update_values(self):
"""Update this sensor."""
update = False
for sens in self._sub_sensors: # Can be remove from 0.99
newval = f"{sens.value} {sens.unit}"
if self._attr[sens.name] != newval:
update = True
self._attr[sens.name] ... | [
"def",
"async_update_values",
"(",
"self",
")",
":",
"update",
"=",
"False",
"for",
"sens",
"in",
"self",
".",
"_sub_sensors",
":",
"# Can be remove from 0.99",
"newval",
"=",
"f\"{sens.value} {sens.unit}\"",
"if",
"self",
".",
"_attr",
"[",
"sens",
".",
"name",... | [
209,
4
] | [
224,
39
] | python | en | ['en', 'id', 'en'] | True |
SMAsensor.unique_id | (self) | Return a unique identifier for this sensor. | Return a unique identifier for this sensor. | def unique_id(self):
"""Return a unique identifier for this sensor."""
return f"sma-{self._sensor.key}-{self._sensor.name}" | [
"def",
"unique_id",
"(",
"self",
")",
":",
"return",
"f\"sma-{self._sensor.key}-{self._sensor.name}\""
] | [
227,
4
] | [
229,
60
] | python | en | ['en', 'fr', 'en'] | True |
mock_now | () | Fixture for dtutil.now. | Fixture for dtutil.now. | def mock_now() -> datetime:
"""Fixture for dtutil.now."""
return dt_util.utcnow() | [
"def",
"mock_now",
"(",
")",
"->",
"datetime",
":",
"return",
"dt_util",
".",
"utcnow",
"(",
")"
] | [
73,
0
] | [
75,
27
] | python | da | ['da', 'da', 'en'] | True |
async_turn_on | (
hass: HomeAssistantType, entity_id: Optional[str] = None
) | Turn on specified media player or all. | Turn on specified media player or all. | async def async_turn_on(
hass: HomeAssistantType, entity_id: Optional[str] = None
) -> None:
"""Turn on specified media player or all."""
data = {ATTR_ENTITY_ID: entity_id} if entity_id else {}
await hass.services.async_call(MP_DOMAIN, SERVICE_TURN_ON, data) | [
"async",
"def",
"async_turn_on",
"(",
"hass",
":",
"HomeAssistantType",
",",
"entity_id",
":",
"Optional",
"[",
"str",
"]",
"=",
"None",
")",
"->",
"None",
":",
"data",
"=",
"{",
"ATTR_ENTITY_ID",
":",
"entity_id",
"}",
"if",
"entity_id",
"else",
"{",
"}... | [
78,
0
] | [
83,
68
] | python | en | ['en', 'en', 'en'] | True |
async_turn_off | (
hass: HomeAssistantType, entity_id: Optional[str] = None
) | Turn off specified media player or all. | Turn off specified media player or all. | async def async_turn_off(
hass: HomeAssistantType, entity_id: Optional[str] = None
) -> None:
"""Turn off specified media player or all."""
data = {ATTR_ENTITY_ID: entity_id} if entity_id else {}
await hass.services.async_call(MP_DOMAIN, SERVICE_TURN_OFF, data) | [
"async",
"def",
"async_turn_off",
"(",
"hass",
":",
"HomeAssistantType",
",",
"entity_id",
":",
"Optional",
"[",
"str",
"]",
"=",
"None",
")",
"->",
"None",
":",
"data",
"=",
"{",
"ATTR_ENTITY_ID",
":",
"entity_id",
"}",
"if",
"entity_id",
"else",
"{",
"... | [
86,
0
] | [
91,
69
] | python | en | ['en', 'en', 'en'] | True |
async_media_pause | (
hass: HomeAssistantType, entity_id: Optional[str] = None
) | Send the media player the command for pause. | Send the media player the command for pause. | async def async_media_pause(
hass: HomeAssistantType, entity_id: Optional[str] = None
) -> None:
"""Send the media player the command for pause."""
data = {ATTR_ENTITY_ID: entity_id} if entity_id else {}
await hass.services.async_call(MP_DOMAIN, SERVICE_MEDIA_PAUSE, data) | [
"async",
"def",
"async_media_pause",
"(",
"hass",
":",
"HomeAssistantType",
",",
"entity_id",
":",
"Optional",
"[",
"str",
"]",
"=",
"None",
")",
"->",
"None",
":",
"data",
"=",
"{",
"ATTR_ENTITY_ID",
":",
"entity_id",
"}",
"if",
"entity_id",
"else",
"{",
... | [
94,
0
] | [
99,
72
] | python | en | ['en', 'en', 'en'] | True |
async_media_play | (
hass: HomeAssistantType, entity_id: Optional[str] = None
) | Send the media player the command for play/pause. | Send the media player the command for play/pause. | async def async_media_play(
hass: HomeAssistantType, entity_id: Optional[str] = None
) -> None:
"""Send the media player the command for play/pause."""
data = {ATTR_ENTITY_ID: entity_id} if entity_id else {}
await hass.services.async_call(MP_DOMAIN, SERVICE_MEDIA_PLAY, data) | [
"async",
"def",
"async_media_play",
"(",
"hass",
":",
"HomeAssistantType",
",",
"entity_id",
":",
"Optional",
"[",
"str",
"]",
"=",
"None",
")",
"->",
"None",
":",
"data",
"=",
"{",
"ATTR_ENTITY_ID",
":",
"entity_id",
"}",
"if",
"entity_id",
"else",
"{",
... | [
102,
0
] | [
107,
71
] | python | en | ['en', 'en', 'en'] | True |
async_media_stop | (
hass: HomeAssistantType, entity_id: Optional[str] = None
) | Send the media player the command for stop. | Send the media player the command for stop. | async def async_media_stop(
hass: HomeAssistantType, entity_id: Optional[str] = None
) -> None:
"""Send the media player the command for stop."""
data = {ATTR_ENTITY_ID: entity_id} if entity_id else {}
await hass.services.async_call(MP_DOMAIN, SERVICE_MEDIA_STOP, data) | [
"async",
"def",
"async_media_stop",
"(",
"hass",
":",
"HomeAssistantType",
",",
"entity_id",
":",
"Optional",
"[",
"str",
"]",
"=",
"None",
")",
"->",
"None",
":",
"data",
"=",
"{",
"ATTR_ENTITY_ID",
":",
"entity_id",
"}",
"if",
"entity_id",
"else",
"{",
... | [
110,
0
] | [
115,
71
] | python | en | ['en', 'en', 'en'] | True |
async_media_next_track | (
hass: HomeAssistantType, entity_id: Optional[str] = None
) | Send the media player the command for next track. | Send the media player the command for next track. | async def async_media_next_track(
hass: HomeAssistantType, entity_id: Optional[str] = None
) -> None:
"""Send the media player the command for next track."""
data = {ATTR_ENTITY_ID: entity_id} if entity_id else {}
await hass.services.async_call(MP_DOMAIN, SERVICE_MEDIA_NEXT_TRACK, data) | [
"async",
"def",
"async_media_next_track",
"(",
"hass",
":",
"HomeAssistantType",
",",
"entity_id",
":",
"Optional",
"[",
"str",
"]",
"=",
"None",
")",
"->",
"None",
":",
"data",
"=",
"{",
"ATTR_ENTITY_ID",
":",
"entity_id",
"}",
"if",
"entity_id",
"else",
... | [
118,
0
] | [
123,
77
] | python | en | ['en', 'en', 'en'] | True |
async_media_previous_track | (
hass: HomeAssistantType, entity_id: Optional[str] = None
) | Send the media player the command for prev track. | Send the media player the command for prev track. | async def async_media_previous_track(
hass: HomeAssistantType, entity_id: Optional[str] = None
) -> None:
"""Send the media player the command for prev track."""
data = {ATTR_ENTITY_ID: entity_id} if entity_id else {}
await hass.services.async_call(MP_DOMAIN, SERVICE_MEDIA_PREVIOUS_TRACK, data) | [
"async",
"def",
"async_media_previous_track",
"(",
"hass",
":",
"HomeAssistantType",
",",
"entity_id",
":",
"Optional",
"[",
"str",
"]",
"=",
"None",
")",
"->",
"None",
":",
"data",
"=",
"{",
"ATTR_ENTITY_ID",
":",
"entity_id",
"}",
"if",
"entity_id",
"else"... | [
126,
0
] | [
131,
81
] | python | en | ['en', 'en', 'en'] | True |
async_play_media | (
hass: HomeAssistantType,
media_type: str,
media_id: str,
entity_id: Optional[str] = None,
enqueue: Optional[str] = None,
) | Send the media player the command for playing media. | Send the media player the command for playing media. | async def async_play_media(
hass: HomeAssistantType,
media_type: str,
media_id: str,
entity_id: Optional[str] = None,
enqueue: Optional[str] = None,
) -> None:
"""Send the media player the command for playing media."""
data = {ATTR_MEDIA_CONTENT_TYPE: media_type, ATTR_MEDIA_CONTENT_ID: media... | [
"async",
"def",
"async_play_media",
"(",
"hass",
":",
"HomeAssistantType",
",",
"media_type",
":",
"str",
",",
"media_id",
":",
"str",
",",
"entity_id",
":",
"Optional",
"[",
"str",
"]",
"=",
"None",
",",
"enqueue",
":",
"Optional",
"[",
"str",
"]",
"=",... | [
134,
0
] | [
150,
71
] | python | en | ['en', 'en', 'en'] | True |
test_setup | (
hass: HomeAssistantType, aioclient_mock: AiohttpClientMocker
) | Test setup with basic config. | Test setup with basic config. | async def test_setup(
hass: HomeAssistantType, aioclient_mock: AiohttpClientMocker
) -> None:
"""Test setup with basic config."""
await setup_integration(hass, aioclient_mock)
assert hass.states.get(MAIN_ENTITY_ID)
assert hass.states.get(CLIENT_ENTITY_ID)
assert hass.states.get(UNAVAILABLE_ENTIT... | [
"async",
"def",
"test_setup",
"(",
"hass",
":",
"HomeAssistantType",
",",
"aioclient_mock",
":",
"AiohttpClientMocker",
")",
"->",
"None",
":",
"await",
"setup_integration",
"(",
"hass",
",",
"aioclient_mock",
")",
"assert",
"hass",
".",
"states",
".",
"get",
... | [
153,
0
] | [
160,
49
] | python | en | ['en', 'zu', 'en'] | True |
test_unique_id | (
hass: HomeAssistantType, aioclient_mock: AiohttpClientMocker
) | Test unique id. | Test unique id. | async def test_unique_id(
hass: HomeAssistantType, aioclient_mock: AiohttpClientMocker
) -> None:
"""Test unique id."""
await setup_integration(hass, aioclient_mock)
entity_registry = await hass.helpers.entity_registry.async_get_registry()
main = entity_registry.async_get(MAIN_ENTITY_ID)
asser... | [
"async",
"def",
"test_unique_id",
"(",
"hass",
":",
"HomeAssistantType",
",",
"aioclient_mock",
":",
"AiohttpClientMocker",
")",
"->",
"None",
":",
"await",
"setup_integration",
"(",
"hass",
",",
"aioclient_mock",
")",
"entity_registry",
"=",
"await",
"hass",
".",... | [
163,
0
] | [
181,
57
] | python | en | ['fr', 'la', 'en'] | False |
test_supported_features | (
hass: HomeAssistantType, aioclient_mock: AiohttpClientMocker
) | Test supported features. | Test supported features. | async def test_supported_features(
hass: HomeAssistantType, aioclient_mock: AiohttpClientMocker
) -> None:
"""Test supported features."""
await setup_integration(hass, aioclient_mock)
# Features supported for main DVR
state = hass.states.get(MAIN_ENTITY_ID)
assert (
SUPPORT_PAUSE
... | [
"async",
"def",
"test_supported_features",
"(",
"hass",
":",
"HomeAssistantType",
",",
"aioclient_mock",
":",
"AiohttpClientMocker",
")",
"->",
"None",
":",
"await",
"setup_integration",
"(",
"hass",
",",
"aioclient_mock",
")",
"# Features supported for main DVR",
"stat... | [
184,
0
] | [
214,
5
] | python | en | ['en', 'en', 'en'] | True |
test_check_attributes | (
hass: HomeAssistantType,
mock_now: dt_util.dt.datetime,
aioclient_mock: AiohttpClientMocker,
) | Test attributes. | Test attributes. | async def test_check_attributes(
hass: HomeAssistantType,
mock_now: dt_util.dt.datetime,
aioclient_mock: AiohttpClientMocker,
) -> None:
"""Test attributes."""
await setup_integration(hass, aioclient_mock)
state = hass.states.get(MAIN_ENTITY_ID)
assert state.state == STATE_PLAYING
asse... | [
"async",
"def",
"test_check_attributes",
"(",
"hass",
":",
"HomeAssistantType",
",",
"mock_now",
":",
"dt_util",
".",
"dt",
".",
"datetime",
",",
"aioclient_mock",
":",
"AiohttpClientMocker",
",",
")",
"->",
"None",
":",
"await",
"setup_integration",
"(",
"hass"... | [
217,
0
] | [
321,
43
] | python | en | ['en', 'la', 'en'] | False |
test_attributes_paused | (
hass: HomeAssistantType,
mock_now: dt_util.dt.datetime,
aioclient_mock: AiohttpClientMocker,
) | Test attributes while paused. | Test attributes while paused. | async def test_attributes_paused(
hass: HomeAssistantType,
mock_now: dt_util.dt.datetime,
aioclient_mock: AiohttpClientMocker,
):
"""Test attributes while paused."""
await setup_integration(hass, aioclient_mock)
state = hass.states.get(CLIENT_ENTITY_ID)
last_updated = state.attributes.get(A... | [
"async",
"def",
"test_attributes_paused",
"(",
"hass",
":",
"HomeAssistantType",
",",
"mock_now",
":",
"dt_util",
".",
"dt",
".",
"datetime",
",",
"aioclient_mock",
":",
"AiohttpClientMocker",
",",
")",
":",
"await",
"setup_integration",
"(",
"hass",
",",
"aiocl... | [
324,
0
] | [
345,
79
] | python | en | ['en', 'en', 'en'] | True |
test_main_services | (
hass: HomeAssistantType,
mock_now: dt_util.dt.datetime,
aioclient_mock: AiohttpClientMocker,
) | Test the different services. | Test the different services. | async def test_main_services(
hass: HomeAssistantType,
mock_now: dt_util.dt.datetime,
aioclient_mock: AiohttpClientMocker,
) -> None:
"""Test the different services."""
await setup_integration(hass, aioclient_mock)
with patch("directv.DIRECTV.remote") as remote_mock:
await async_turn_of... | [
"async",
"def",
"test_main_services",
"(",
"hass",
":",
"HomeAssistantType",
",",
"mock_now",
":",
"dt_util",
".",
"dt",
".",
"datetime",
",",
"aioclient_mock",
":",
"AiohttpClientMocker",
",",
")",
"->",
"None",
":",
"await",
"setup_integration",
"(",
"hass",
... | [
348,
0
] | [
394,
53
] | python | en | ['en', 'en', 'en'] | True |
run | (args) | Handle Home Assistant auth provider script. | Handle Home Assistant auth provider script. | def run(args):
"""Handle Home Assistant auth provider script."""
parser = argparse.ArgumentParser(description="Manage Home Assistant users")
parser.add_argument("--script", choices=["auth"])
parser.add_argument(
"-c",
"--config",
default=get_default_config_dir(),
help="Di... | [
"def",
"run",
"(",
"args",
")",
":",
"parser",
"=",
"argparse",
".",
"ArgumentParser",
"(",
"description",
"=",
"\"Manage Home Assistant users\"",
")",
"parser",
".",
"add_argument",
"(",
"\"--script\"",
",",
"choices",
"=",
"[",
"\"auth\"",
"]",
")",
"parser"... | [
15,
0
] | [
47,
53
] | python | en | ['fr', 'en', 'en'] | True |
run_command | (args) | Run the command. | Run the command. | async def run_command(args):
"""Run the command."""
hass = HomeAssistant()
hass.config.config_dir = os.path.join(os.getcwd(), args.config)
hass.auth = await auth_manager_from_config(hass, [{"type": "homeassistant"}], [])
provider = hass.auth.auth_providers[0]
await provider.async_initialize()
... | [
"async",
"def",
"run_command",
"(",
"args",
")",
":",
"hass",
"=",
"HomeAssistant",
"(",
")",
"hass",
".",
"config",
".",
"config_dir",
"=",
"os",
".",
"path",
".",
"join",
"(",
"os",
".",
"getcwd",
"(",
")",
",",
"args",
".",
"config",
")",
"hass"... | [
50,
0
] | [
62,
27
] | python | en | ['en', 'it', 'en'] | True |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.