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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
_build_bounding_box_lookup | (bounding_box_file) | Build a lookup from image file to bounding boxes.
Args:
bounding_box_file: string, path to file with bounding boxes annotations.
Assumes each line of the file looks like:
n00007846_64193.JPEG,0.0060,0.2620,0.7545,0.9940
where each line corresponds to one bounding box annotation associated
... | Build a lookup from image file to bounding boxes. | def _build_bounding_box_lookup(bounding_box_file):
"""Build a lookup from image file to bounding boxes.
Args:
bounding_box_file: string, path to file with bounding boxes annotations.
Assumes each line of the file looks like:
n00007846_64193.JPEG,0.0060,0.2620,0.7545,0.9940
where each lin... | [
"def",
"_build_bounding_box_lookup",
"(",
"bounding_box_file",
")",
":",
"lines",
"=",
"tf",
".",
"gfile",
".",
"GFile",
"(",
"bounding_box_file",
",",
"'r'",
")",
".",
"readlines",
"(",
")",
"images_to_bboxes",
"=",
"{",
"}",
"num_bbox",
"=",
"0",
"num_imag... | [
636,
0
] | [
681,
25
] | python | en | ['en', 'en', 'en'] | True |
MasterAgent.start | (self) | Start agents. | Start agents. | def start(self) -> None:
"""Start agents."""
pending_job_agent = PendingJobAgent(
cluster_detail=self.cluster_detail,
redis_connection=self.redis_connection,
check_interval=self.check_interval
)
pending_job_agent.start()
killed_job_agent = Kil... | [
"def",
"start",
"(",
"self",
")",
"->",
"None",
":",
"pending_job_agent",
"=",
"PendingJobAgent",
"(",
"cluster_detail",
"=",
"self",
".",
"cluster_detail",
",",
"redis_connection",
"=",
"self",
".",
"redis_connection",
",",
"check_interval",
"=",
"self",
".",
... | [
179,
4
] | [
200,
34
] | python | en | ['en', 'de', 'en'] | False |
generate_alexa_id | (entity_id: str) | Return the alexa ID for an entity ID. | Return the alexa ID for an entity ID. | def generate_alexa_id(entity_id: str) -> str:
"""Return the alexa ID for an entity ID."""
return entity_id.replace(".", "#").translate(TRANSLATION_TABLE) | [
"def",
"generate_alexa_id",
"(",
"entity_id",
":",
"str",
")",
"->",
"str",
":",
"return",
"entity_id",
".",
"replace",
"(",
"\".\"",
",",
"\"#\"",
")",
".",
"translate",
"(",
"TRANSLATION_TABLE",
")"
] | [
242,
0
] | [
244,
67
] | python | en | ['en', 'cy', 'en'] | True |
async_get_entities | (hass, config) | Return all entities that are supported by Alexa. | Return all entities that are supported by Alexa. | def async_get_entities(hass, config) -> List[AlexaEntity]:
"""Return all entities that are supported by Alexa."""
entities = []
for state in hass.states.async_all():
if state.entity_id in CLOUD_NEVER_EXPOSED_ENTITIES:
continue
if state.domain not in ENTITY_ADAPTERS:
... | [
"def",
"async_get_entities",
"(",
"hass",
",",
"config",
")",
"->",
"List",
"[",
"AlexaEntity",
"]",
":",
"entities",
"=",
"[",
"]",
"for",
"state",
"in",
"hass",
".",
"states",
".",
"async_all",
"(",
")",
":",
"if",
"state",
".",
"entity_id",
"in",
... | [
355,
0
] | [
372,
19
] | python | en | ['en', 'en', 'en'] | True |
AlexaEntity.__init__ | (self, hass: HomeAssistant, config: "AbstractConfig", entity: State) | Initialize Alexa Entity. | Initialize Alexa Entity. | def __init__(self, hass: HomeAssistant, config: "AbstractConfig", entity: State):
"""Initialize Alexa Entity."""
self.hass = hass
self.config = config
self.entity = entity
self.entity_conf = config.entity_config.get(entity.entity_id, {}) | [
"def",
"__init__",
"(",
"self",
",",
"hass",
":",
"HomeAssistant",
",",
"config",
":",
"\"AbstractConfig\"",
",",
"entity",
":",
"State",
")",
":",
"self",
".",
"hass",
"=",
"hass",
"self",
".",
"config",
"=",
"config",
"self",
".",
"entity",
"=",
"ent... | [
253,
4
] | [
258,
73
] | python | it | ['ro', 'pl', 'it'] | False |
AlexaEntity.entity_id | (self) | Return the Entity ID. | Return the Entity ID. | def entity_id(self):
"""Return the Entity ID."""
return self.entity.entity_id | [
"def",
"entity_id",
"(",
"self",
")",
":",
"return",
"self",
".",
"entity",
".",
"entity_id"
] | [
261,
4
] | [
263,
36
] | python | en | ['en', 'cy', 'en'] | True |
AlexaEntity.friendly_name | (self) | Return the Alexa API friendly name. | Return the Alexa API friendly name. | def friendly_name(self):
"""Return the Alexa API friendly name."""
return self.entity_conf.get(CONF_NAME, self.entity.name).translate(
TRANSLATION_TABLE
) | [
"def",
"friendly_name",
"(",
"self",
")",
":",
"return",
"self",
".",
"entity_conf",
".",
"get",
"(",
"CONF_NAME",
",",
"self",
".",
"entity",
".",
"name",
")",
".",
"translate",
"(",
"TRANSLATION_TABLE",
")"
] | [
265,
4
] | [
269,
9
] | python | en | ['en', 'mi', 'en'] | True |
AlexaEntity.description | (self) | Return the Alexa API description. | Return the Alexa API description. | def description(self):
"""Return the Alexa API description."""
description = self.entity_conf.get(CONF_DESCRIPTION) or self.entity_id
return f"{description} via Home Assistant".translate(TRANSLATION_TABLE) | [
"def",
"description",
"(",
"self",
")",
":",
"description",
"=",
"self",
".",
"entity_conf",
".",
"get",
"(",
"CONF_DESCRIPTION",
")",
"or",
"self",
".",
"entity_id",
"return",
"f\"{description} via Home Assistant\"",
".",
"translate",
"(",
"TRANSLATION_TABLE",
")... | [
271,
4
] | [
274,
79
] | python | en | ['en', 'pt', 'en'] | True |
AlexaEntity.alexa_id | (self) | Return the Alexa API entity id. | Return the Alexa API entity id. | def alexa_id(self):
"""Return the Alexa API entity id."""
return generate_alexa_id(self.entity.entity_id) | [
"def",
"alexa_id",
"(",
"self",
")",
":",
"return",
"generate_alexa_id",
"(",
"self",
".",
"entity",
".",
"entity_id",
")"
] | [
276,
4
] | [
278,
55
] | python | en | ['en', 'cy', 'en'] | True |
AlexaEntity.display_categories | (self) | Return a list of display categories. | Return a list of display categories. | def display_categories(self):
"""Return a list of display categories."""
entity_conf = self.config.entity_config.get(self.entity.entity_id, {})
if CONF_DISPLAY_CATEGORIES in entity_conf:
return [entity_conf[CONF_DISPLAY_CATEGORIES]]
return self.default_display_categories() | [
"def",
"display_categories",
"(",
"self",
")",
":",
"entity_conf",
"=",
"self",
".",
"config",
".",
"entity_config",
".",
"get",
"(",
"self",
".",
"entity",
".",
"entity_id",
",",
"{",
"}",
")",
"if",
"CONF_DISPLAY_CATEGORIES",
"in",
"entity_conf",
":",
"r... | [
280,
4
] | [
285,
48
] | python | en | ['en', 'af', 'en'] | True |
AlexaEntity.default_display_categories | (self) | Return a list of default display categories.
This can be overridden by the user in the Home Assistant configuration.
See also DisplayCategory.
| Return a list of default display categories. | def default_display_categories(self):
"""Return a list of default display categories.
This can be overridden by the user in the Home Assistant configuration.
See also DisplayCategory.
"""
raise NotImplementedError | [
"def",
"default_display_categories",
"(",
"self",
")",
":",
"raise",
"NotImplementedError"
] | [
287,
4
] | [
294,
33
] | python | en | ['en', 'da', 'en'] | True |
AlexaEntity.get_interface | (self, capability) | Return the given AlexaInterface.
Raises _UnsupportedInterface.
| Return the given AlexaInterface. | def get_interface(self, capability) -> AlexaCapability:
"""Return the given AlexaInterface.
Raises _UnsupportedInterface.
""" | [
"def",
"get_interface",
"(",
"self",
",",
"capability",
")",
"->",
"AlexaCapability",
":"
] | [
296,
4
] | [
300,
11
] | python | en | ['en', 'en', 'en'] | True |
AlexaEntity.interfaces | (self) | Return a list of supported interfaces.
Used for discovery. The list should contain AlexaInterface instances.
If the list is empty, this entity will not be discovered.
| Return a list of supported interfaces. | def interfaces(self) -> List[AlexaCapability]:
"""Return a list of supported interfaces.
Used for discovery. The list should contain AlexaInterface instances.
If the list is empty, this entity will not be discovered.
"""
raise NotImplementedError | [
"def",
"interfaces",
"(",
"self",
")",
"->",
"List",
"[",
"AlexaCapability",
"]",
":",
"raise",
"NotImplementedError"
] | [
302,
4
] | [
308,
33
] | python | en | ['en', 'en', 'en'] | True |
AlexaEntity.serialize_properties | (self) | Yield each supported property in API format. | Yield each supported property in API format. | def serialize_properties(self):
"""Yield each supported property in API format."""
for interface in self.interfaces():
if not interface.properties_proactively_reported():
continue
yield from interface.serialize_properties() | [
"def",
"serialize_properties",
"(",
"self",
")",
":",
"for",
"interface",
"in",
"self",
".",
"interfaces",
"(",
")",
":",
"if",
"not",
"interface",
".",
"properties_proactively_reported",
"(",
")",
":",
"continue",
"yield",
"from",
"interface",
".",
"serialize... | [
310,
4
] | [
316,
55
] | python | en | ['en', 'en', 'en'] | True |
AlexaEntity.serialize_discovery | (self) | Serialize the entity for discovery. | Serialize the entity for discovery. | def serialize_discovery(self):
"""Serialize the entity for discovery."""
result = {
"displayCategories": self.display_categories(),
"cookie": {},
"endpointId": self.alexa_id(),
"friendlyName": self.friendly_name(),
"description": self.descripti... | [
"def",
"serialize_discovery",
"(",
"self",
")",
":",
"result",
"=",
"{",
"\"displayCategories\"",
":",
"self",
".",
"display_categories",
"(",
")",
",",
"\"cookie\"",
":",
"{",
"}",
",",
"\"endpointId\"",
":",
"self",
".",
"alexa_id",
"(",
")",
",",
"\"fri... | [
318,
4
] | [
351,
21
] | python | en | ['en', 'en', 'en'] | True |
hass_hue | (loop, hass) | Set up a Home Assistant instance for these tests. | Set up a Home Assistant instance for these tests. | def hass_hue(loop, hass):
"""Set up a Home Assistant instance for these tests."""
# We need to do this to get access to homeassistant/turn_(on,off)
loop.run_until_complete(setup.async_setup_component(hass, "homeassistant", {}))
loop.run_until_complete(
setup.async_setup_component(
h... | [
"def",
"hass_hue",
"(",
"loop",
",",
"hass",
")",
":",
"# We need to do this to get access to homeassistant/turn_(on,off)",
"loop",
".",
"run_until_complete",
"(",
"setup",
".",
"async_setup_component",
"(",
"hass",
",",
"\"homeassistant\"",
",",
"{",
"}",
")",
")",
... | [
88,
0
] | [
194,
15
] | python | en | ['en', 'en', 'en'] | True |
hue_client | (loop, hass_hue, aiohttp_client) | Create web client for emulated hue api. | Create web client for emulated hue api. | def hue_client(loop, hass_hue, aiohttp_client):
"""Create web client for emulated hue api."""
web_app = hass_hue.http.app
config = Config(
None,
{
emulated_hue.CONF_ENTITIES: {
"light.bed_light": {emulated_hue.CONF_ENTITY_HIDDEN: True},
# Kitchen l... | [
"def",
"hue_client",
"(",
"loop",
",",
"hass_hue",
",",
"aiohttp_client",
")",
":",
"web_app",
"=",
"hass_hue",
".",
"http",
".",
"app",
"config",
"=",
"Config",
"(",
"None",
",",
"{",
"emulated_hue",
".",
"CONF_ENTITIES",
":",
"{",
"\"light.bed_light\"",
... | [
198,
0
] | [
240,
59
] | python | en | ['en', 'pt', 'en'] | True |
test_discover_lights | (hue_client) | Test the discovery of lights. | Test the discovery of lights. | async def test_discover_lights(hue_client):
"""Test the discovery of lights."""
result = await hue_client.get("/api/username/lights")
assert result.status == HTTP_OK
assert CONTENT_TYPE_JSON in result.headers["content-type"]
result_json = await result.json()
devices = {val["uniqueid"] for val... | [
"async",
"def",
"test_discover_lights",
"(",
"hue_client",
")",
":",
"result",
"=",
"await",
"hue_client",
".",
"get",
"(",
"\"/api/username/lights\"",
")",
"assert",
"result",
".",
"status",
"==",
"HTTP_OK",
"assert",
"CONTENT_TYPE_JSON",
"in",
"result",
".",
"... | [
243,
0
] | [
274,
50
] | python | en | ['en', 'en', 'en'] | True |
test_light_without_brightness_supported | (hass_hue, hue_client) | Test that light without brightness is supported. | Test that light without brightness is supported. | async def test_light_without_brightness_supported(hass_hue, hue_client):
"""Test that light without brightness is supported."""
light_without_brightness_json = await perform_get_light_state(
hue_client, "light.no_brightness", HTTP_OK
)
assert light_without_brightness_json["state"][HUE_API_STATE... | [
"async",
"def",
"test_light_without_brightness_supported",
"(",
"hass_hue",
",",
"hue_client",
")",
":",
"light_without_brightness_json",
"=",
"await",
"perform_get_light_state",
"(",
"hue_client",
",",
"\"light.no_brightness\"",
",",
"HTTP_OK",
")",
"assert",
"light_withou... | [
277,
0
] | [
284,
66
] | python | en | ['en', 'en', 'en'] | True |
test_lights_all_dimmable | (hass, aiohttp_client) | Test CONF_LIGHTS_ALL_DIMMABLE. | Test CONF_LIGHTS_ALL_DIMMABLE. | async def test_lights_all_dimmable(hass, aiohttp_client):
"""Test CONF_LIGHTS_ALL_DIMMABLE."""
# create a lamp without brightness support
hass.states.async_set("light.no_brightness", "on", {})
await setup.async_setup_component(
hass, http.DOMAIN, {http.DOMAIN: {http.CONF_SERVER_PORT: HTTP_SERVER... | [
"async",
"def",
"test_lights_all_dimmable",
"(",
"hass",
",",
"aiohttp_client",
")",
":",
"# create a lamp without brightness support",
"hass",
".",
"states",
".",
"async_set",
"(",
"\"light.no_brightness\"",
",",
"\"on\"",
",",
"{",
"}",
")",
"await",
"setup",
".",... | [
287,
0
] | [
320,
5
] | python | en | ['en', 'en', 'en'] | False |
test_light_without_brightness_can_be_turned_off | (hass_hue, hue_client) | Test that light without brightness can be turned off. | Test that light without brightness can be turned off. | async def test_light_without_brightness_can_be_turned_off(hass_hue, hue_client):
"""Test that light without brightness can be turned off."""
hass_hue.states.async_set("light.no_brightness", "on", {})
turn_off_calls = []
# Check if light can be turned off
@callback
def mock_service_call(call):
... | [
"async",
"def",
"test_light_without_brightness_can_be_turned_off",
"(",
"hass_hue",
",",
"hue_client",
")",
":",
"hass_hue",
".",
"states",
".",
"async_set",
"(",
"\"light.no_brightness\"",
",",
"\"on\"",
",",
"{",
"}",
")",
"turn_off_calls",
"=",
"[",
"]",
"# Che... | [
323,
0
] | [
355,
61
] | python | en | ['en', 'en', 'en'] | True |
test_light_without_brightness_can_be_turned_on | (hass_hue, hue_client) | Test that light without brightness can be turned on. | Test that light without brightness can be turned on. | async def test_light_without_brightness_can_be_turned_on(hass_hue, hue_client):
"""Test that light without brightness can be turned on."""
hass_hue.states.async_set("light.no_brightness", "off", {})
# Check if light can be turned on
turn_on_calls = []
@callback
def mock_service_call(call):
... | [
"async",
"def",
"test_light_without_brightness_can_be_turned_on",
"(",
"hass_hue",
",",
"hue_client",
")",
":",
"hass_hue",
".",
"states",
".",
"async_set",
"(",
"\"light.no_brightness\"",
",",
"\"off\"",
",",
"{",
"}",
")",
"# Check if light can be turned on",
"turn_on... | [
358,
0
] | [
397,
61
] | python | en | ['en', 'en', 'en'] | True |
test_reachable_for_state | (hass_hue, hue_client, state, is_reachable) | Test that an entity is reported as unreachable if in unavailable state. | Test that an entity is reported as unreachable if in unavailable state. | async def test_reachable_for_state(hass_hue, hue_client, state, is_reachable):
"""Test that an entity is reported as unreachable if in unavailable state."""
entity_id = "light.ceiling_lights"
hass_hue.states.async_set(entity_id, state)
state_json = await perform_get_light_state(hue_client, entity_id, ... | [
"async",
"def",
"test_reachable_for_state",
"(",
"hass_hue",
",",
"hue_client",
",",
"state",
",",
"is_reachable",
")",
":",
"entity_id",
"=",
"\"light.ceiling_lights\"",
"hass_hue",
".",
"states",
".",
"async_set",
"(",
"entity_id",
",",
"state",
")",
"state_json... | [
408,
0
] | [
416,
71
] | python | en | ['en', 'en', 'en'] | True |
test_discover_full_state | (hue_client) | Test the discovery of full state. | Test the discovery of full state. | async def test_discover_full_state(hue_client):
"""Test the discovery of full state."""
result = await hue_client.get(f"/api/{HUE_API_USERNAME}")
assert result.status == HTTP_OK
assert CONTENT_TYPE_JSON in result.headers["content-type"]
result_json = await result.json()
# Make sure array has ... | [
"async",
"def",
"test_discover_full_state",
"(",
"hue_client",
")",
":",
"result",
"=",
"await",
"hue_client",
".",
"get",
"(",
"f\"/api/{HUE_API_USERNAME}\"",
")",
"assert",
"result",
".",
"status",
"==",
"HTTP_OK",
"assert",
"CONTENT_TYPE_JSON",
"in",
"result",
... | [
419,
0
] | [
466,
44
] | python | en | ['en', 'en', 'en'] | True |
test_discover_config | (hue_client) | Test the discovery of configuration. | Test the discovery of configuration. | async def test_discover_config(hue_client):
"""Test the discovery of configuration."""
result = await hue_client.get(f"/api/{HUE_API_USERNAME}/config")
assert result.status == 200
assert CONTENT_TYPE_JSON in result.headers["content-type"]
config_json = await result.json()
# Make sure array is... | [
"async",
"def",
"test_discover_config",
"(",
"hue_client",
")",
":",
"result",
"=",
"await",
"hue_client",
".",
"get",
"(",
"f\"/api/{HUE_API_USERNAME}/config\"",
")",
"assert",
"result",
".",
"status",
"==",
"200",
"assert",
"CONTENT_TYPE_JSON",
"in",
"result",
"... | [
469,
0
] | [
523,
37
] | python | en | ['en', 'en', 'en'] | True |
test_get_light_state | (hass_hue, hue_client) | Test the getting of light state. | Test the getting of light state. | async def test_get_light_state(hass_hue, hue_client):
"""Test the getting of light state."""
# Turn ceiling lights on and set to 127 brightness, and set light color
await hass_hue.services.async_call(
light.DOMAIN,
const.SERVICE_TURN_ON,
{
const.ATTR_ENTITY_ID: "light.cei... | [
"async",
"def",
"test_get_light_state",
"(",
"hass_hue",
",",
"hue_client",
")",
":",
"# Turn ceiling lights on and set to 127 brightness, and set light color",
"await",
"hass_hue",
".",
"services",
".",
"async_call",
"(",
"light",
".",
"DOMAIN",
",",
"const",
".",
"SER... | [
526,
0
] | [
586,
88
] | python | en | ['en', 'en', 'en'] | True |
test_put_light_state | (hass, hass_hue, hue_client) | Test the setting of light states. | Test the setting of light states. | async def test_put_light_state(hass, hass_hue, hue_client):
"""Test the setting of light states."""
await perform_put_test_on_ceiling_lights(hass_hue, hue_client)
# Turn the bedroom light on first
await hass_hue.services.async_call(
light.DOMAIN,
const.SERVICE_TURN_ON,
{const.AT... | [
"async",
"def",
"test_put_light_state",
"(",
"hass",
",",
"hass_hue",
",",
"hue_client",
")",
":",
"await",
"perform_put_test_on_ceiling_lights",
"(",
"hass_hue",
",",
"hue_client",
")",
"# Turn the bedroom light on first",
"await",
"hass_hue",
".",
"services",
".",
"... | [
589,
0
] | [
711,
5
] | python | en | ['en', 'en', 'en'] | True |
test_put_light_state_script | (hass, hass_hue, hue_client) | Test the setting of script variables. | Test the setting of script variables. | async def test_put_light_state_script(hass, hass_hue, hue_client):
"""Test the setting of script variables."""
# Turn the kitchen light off first
await hass_hue.services.async_call(
light.DOMAIN,
const.SERVICE_TURN_OFF,
{const.ATTR_ENTITY_ID: "light.kitchen_lights"},
blocking... | [
"async",
"def",
"test_put_light_state_script",
"(",
"hass",
",",
"hass_hue",
",",
"hue_client",
")",
":",
"# Turn the kitchen light off first",
"await",
"hass_hue",
".",
"services",
".",
"async_call",
"(",
"light",
".",
"DOMAIN",
",",
"const",
".",
"SERVICE_TURN_OFF... | [
714,
0
] | [
743,
5
] | python | en | ['en', 'en', 'en'] | True |
test_put_light_state_climate_set_temperature | (hass_hue, hue_client) | Test setting climate temperature. | Test setting climate temperature. | async def test_put_light_state_climate_set_temperature(hass_hue, hue_client):
"""Test setting climate temperature."""
brightness = 19
temperature = round(brightness / 254 * 100)
hvac_result = await perform_put_light_state(
hass_hue, hue_client, "climate.hvac", True, brightness
)
hvac_r... | [
"async",
"def",
"test_put_light_state_climate_set_temperature",
"(",
"hass_hue",
",",
"hue_client",
")",
":",
"brightness",
"=",
"19",
"temperature",
"=",
"round",
"(",
"brightness",
"/",
"254",
"*",
"100",
")",
"hvac_result",
"=",
"await",
"perform_put_light_state"... | [
746,
0
] | [
768,
52
] | python | en | ['en', 'en', 'en'] | True |
test_put_light_state_humidifier_set_humidity | (hass_hue, hue_client) | Test setting humidifier target humidity. | Test setting humidifier target humidity. | async def test_put_light_state_humidifier_set_humidity(hass_hue, hue_client):
"""Test setting humidifier target humidity."""
# Turn the humidifier off first
await hass_hue.services.async_call(
humidifier.DOMAIN,
const.SERVICE_TURN_OFF,
{const.ATTR_ENTITY_ID: "humidifier.humidifier"},... | [
"async",
"def",
"test_put_light_state_humidifier_set_humidity",
"(",
"hass_hue",
",",
"hue_client",
")",
":",
"# Turn the humidifier off first",
"await",
"hass_hue",
".",
"services",
".",
"async_call",
"(",
"humidifier",
".",
"DOMAIN",
",",
"const",
".",
"SERVICE_TURN_O... | [
771,
0
] | [
801,
55
] | python | en | ['en', 'en', 'en'] | True |
test_put_light_state_media_player | (hass_hue, hue_client) | Test turning on media player and setting volume. | Test turning on media player and setting volume. | async def test_put_light_state_media_player(hass_hue, hue_client):
"""Test turning on media player and setting volume."""
# Turn the music player off first
await hass_hue.services.async_call(
media_player.DOMAIN,
const.SERVICE_TURN_OFF,
{const.ATTR_ENTITY_ID: "media_player.walkman"},... | [
"async",
"def",
"test_put_light_state_media_player",
"(",
"hass_hue",
",",
"hue_client",
")",
":",
"# Turn the music player off first",
"await",
"hass_hue",
".",
"services",
".",
"async_call",
"(",
"media_player",
".",
"DOMAIN",
",",
"const",
".",
"SERVICE_TURN_OFF",
... | [
804,
0
] | [
829,
76
] | python | en | ['en', 'en', 'en'] | True |
test_close_cover | (hass_hue, hue_client) | Test opening cover . | Test opening cover . | async def test_close_cover(hass_hue, hue_client):
"""Test opening cover ."""
cover_id = "cover.living_room_window"
# Turn the office light off first
await hass_hue.services.async_call(
cover.DOMAIN,
const.SERVICE_CLOSE_COVER,
{const.ATTR_ENTITY_ID: cover_id},
blocking=Tru... | [
"async",
"def",
"test_close_cover",
"(",
"hass_hue",
",",
"hue_client",
")",
":",
"cover_id",
"=",
"\"cover.living_room_window\"",
"# Turn the office light off first",
"await",
"hass_hue",
".",
"services",
".",
"async_call",
"(",
"cover",
".",
"DOMAIN",
",",
"const",
... | [
832,
0
] | [
873,
39
] | python | en | ['nl', 'en', 'en'] | True |
test_set_position_cover | (hass_hue, hue_client) | Test setting position cover . | Test setting position cover . | async def test_set_position_cover(hass_hue, hue_client):
"""Test setting position cover ."""
cover_id = "cover.living_room_window"
cover_number = ENTITY_NUMBERS_BY_ID[cover_id]
# Turn the office light off first
await hass_hue.services.async_call(
cover.DOMAIN,
const.SERVICE_CLOSE_COV... | [
"async",
"def",
"test_set_position_cover",
"(",
"hass_hue",
",",
"hue_client",
")",
":",
"cover_id",
"=",
"\"cover.living_room_window\"",
"cover_number",
"=",
"ENTITY_NUMBERS_BY_ID",
"[",
"cover_id",
"]",
"# Turn the office light off first",
"await",
"hass_hue",
".",
"ser... | [
876,
0
] | [
924,
67
] | python | en | ['en', 'en', 'en'] | True |
test_put_light_state_fan | (hass_hue, hue_client) | Test turning on fan and setting speed. | Test turning on fan and setting speed. | async def test_put_light_state_fan(hass_hue, hue_client):
"""Test turning on fan and setting speed."""
# Turn the fan off first
await hass_hue.services.async_call(
fan.DOMAIN,
const.SERVICE_TURN_OFF,
{const.ATTR_ENTITY_ID: "fan.living_room_fan"},
blocking=True,
)
# E... | [
"async",
"def",
"test_put_light_state_fan",
"(",
"hass_hue",
",",
"hue_client",
")",
":",
"# Turn the fan off first",
"await",
"hass_hue",
".",
"services",
".",
"async_call",
"(",
"fan",
".",
"DOMAIN",
",",
"const",
".",
"SERVICE_TURN_OFF",
",",
"{",
"const",
".... | [
927,
0
] | [
1017,
77
] | python | en | ['en', 'en', 'en'] | True |
test_put_with_form_urlencoded_content_type | (hass_hue, hue_client) | Test the form with urlencoded content. | Test the form with urlencoded content. | async def test_put_with_form_urlencoded_content_type(hass_hue, hue_client):
"""Test the form with urlencoded content."""
entity_number = ENTITY_NUMBERS_BY_ID["light.ceiling_lights"]
# Needed for Alexa
await perform_put_test_on_ceiling_lights(
hass_hue, hue_client, "application/x-www-form-urlenco... | [
"async",
"def",
"test_put_with_form_urlencoded_content_type",
"(",
"hass_hue",
",",
"hue_client",
")",
":",
"entity_number",
"=",
"ENTITY_NUMBERS_BY_ID",
"[",
"\"light.ceiling_lights\"",
"]",
"# Needed for Alexa",
"await",
"perform_put_test_on_ceiling_lights",
"(",
"hass_hue",
... | [
1021,
0
] | [
1037,
31
] | python | en | ['en', 'en', 'en'] | True |
test_entity_not_found | (hue_client) | Test for entity which are not found. | Test for entity which are not found. | async def test_entity_not_found(hue_client):
"""Test for entity which are not found."""
result = await hue_client.get("/api/username/lights/98")
assert result.status == HTTP_NOT_FOUND
result = await hue_client.put("/api/username/lights/98/state")
assert result.status == HTTP_NOT_FOUND | [
"async",
"def",
"test_entity_not_found",
"(",
"hue_client",
")",
":",
"result",
"=",
"await",
"hue_client",
".",
"get",
"(",
"\"/api/username/lights/98\"",
")",
"assert",
"result",
".",
"status",
"==",
"HTTP_NOT_FOUND",
"result",
"=",
"await",
"hue_client",
".",
... | [
1040,
0
] | [
1048,
42
] | python | en | ['en', 'en', 'en'] | True |
test_allowed_methods | (hue_client) | Test the allowed methods. | Test the allowed methods. | async def test_allowed_methods(hue_client):
"""Test the allowed methods."""
result = await hue_client.get(
"/api/username/lights/ENTITY_NUMBERS_BY_ID[light.ceiling_lights]/state"
)
assert result.status == 405
result = await hue_client.put(
"/api/username/lights/ENTITY_NUMBERS_BY_ID... | [
"async",
"def",
"test_allowed_methods",
"(",
"hue_client",
")",
":",
"result",
"=",
"await",
"hue_client",
".",
"get",
"(",
"\"/api/username/lights/ENTITY_NUMBERS_BY_ID[light.ceiling_lights]/state\"",
")",
"assert",
"result",
".",
"status",
"==",
"405",
"result",
"=",
... | [
1051,
0
] | [
1067,
31
] | python | en | ['en', 'en', 'en'] | True |
test_proper_put_state_request | (hue_client) | Test the request to set the state. | Test the request to set the state. | async def test_proper_put_state_request(hue_client):
"""Test the request to set the state."""
# Test proper on value parsing
result = await hue_client.put(
"/api/username/lights/{}/state".format(
ENTITY_NUMBERS_BY_ID["light.ceiling_lights"]
),
data=json.dumps({HUE_API_STA... | [
"async",
"def",
"test_proper_put_state_request",
"(",
"hue_client",
")",
":",
"# Test proper on value parsing",
"result",
"=",
"await",
"hue_client",
".",
"put",
"(",
"\"/api/username/lights/{}/state\"",
".",
"format",
"(",
"ENTITY_NUMBERS_BY_ID",
"[",
"\"light.ceiling_ligh... | [
1070,
0
] | [
1090,
31
] | python | en | ['en', 'en', 'en'] | True |
test_get_empty_groups_state | (hue_client) | Test the request to get groups endpoint. | Test the request to get groups endpoint. | async def test_get_empty_groups_state(hue_client):
"""Test the request to get groups endpoint."""
# Test proper on value parsing
result = await hue_client.get("/api/username/groups")
assert result.status == HTTP_OK
result_json = await result.json()
assert result_json == {} | [
"async",
"def",
"test_get_empty_groups_state",
"(",
"hue_client",
")",
":",
"# Test proper on value parsing",
"result",
"=",
"await",
"hue_client",
".",
"get",
"(",
"\"/api/username/groups\"",
")",
"assert",
"result",
".",
"status",
"==",
"HTTP_OK",
"result_json",
"="... | [
1093,
0
] | [
1102,
28
] | python | en | ['en', 'en', 'en'] | True |
perform_put_test_on_ceiling_lights | (
hass_hue, hue_client, content_type=CONTENT_TYPE_JSON
) | Test the setting of a light. | Test the setting of a light. | async def perform_put_test_on_ceiling_lights(
hass_hue, hue_client, content_type=CONTENT_TYPE_JSON
):
"""Test the setting of a light."""
# Turn the office light off first
await hass_hue.services.async_call(
light.DOMAIN,
const.SERVICE_TURN_OFF,
{const.ATTR_ENTITY_ID: "light.ceili... | [
"async",
"def",
"perform_put_test_on_ceiling_lights",
"(",
"hass_hue",
",",
"hue_client",
",",
"content_type",
"=",
"CONTENT_TYPE_JSON",
")",
":",
"# Turn the office light off first",
"await",
"hass_hue",
".",
"services",
".",
"async_call",
"(",
"light",
".",
"DOMAIN",
... | [
1106,
0
] | [
1136,
65
] | python | en | ['en', 'en', 'en'] | True |
perform_get_light_state_by_number | (client, entity_number, expected_status) | Test the getting of a light state. | Test the getting of a light state. | async def perform_get_light_state_by_number(client, entity_number, expected_status):
"""Test the getting of a light state."""
result = await client.get(f"/api/username/lights/{entity_number}")
assert result.status == expected_status
if expected_status == HTTP_OK:
assert CONTENT_TYPE_JSON in re... | [
"async",
"def",
"perform_get_light_state_by_number",
"(",
"client",
",",
"entity_number",
",",
"expected_status",
")",
":",
"result",
"=",
"await",
"client",
".",
"get",
"(",
"f\"/api/username/lights/{entity_number}\"",
")",
"assert",
"result",
".",
"status",
"==",
... | [
1139,
0
] | [
1150,
15
] | python | en | ['en', 'en', 'en'] | True |
perform_get_light_state | (client, entity_id, expected_status) | Test the getting of a light state. | Test the getting of a light state. | async def perform_get_light_state(client, entity_id, expected_status):
"""Test the getting of a light state."""
entity_number = ENTITY_NUMBERS_BY_ID[entity_id]
return await perform_get_light_state_by_number(
client, entity_number, expected_status
) | [
"async",
"def",
"perform_get_light_state",
"(",
"client",
",",
"entity_id",
",",
"expected_status",
")",
":",
"entity_number",
"=",
"ENTITY_NUMBERS_BY_ID",
"[",
"entity_id",
"]",
"return",
"await",
"perform_get_light_state_by_number",
"(",
"client",
",",
"entity_number"... | [
1153,
0
] | [
1158,
5
] | python | en | ['en', 'en', 'en'] | True |
perform_put_light_state | (
hass_hue,
client,
entity_id,
is_on,
brightness=None,
content_type=CONTENT_TYPE_JSON,
hue=None,
saturation=None,
color_temp=None,
with_state=True,
) | Test the setting of a light state. | Test the setting of a light state. | async def perform_put_light_state(
hass_hue,
client,
entity_id,
is_on,
brightness=None,
content_type=CONTENT_TYPE_JSON,
hue=None,
saturation=None,
color_temp=None,
with_state=True,
):
"""Test the setting of a light state."""
req_headers = {"Content-Type": content_type}
... | [
"async",
"def",
"perform_put_light_state",
"(",
"hass_hue",
",",
"client",
",",
"entity_id",
",",
"is_on",
",",
"brightness",
"=",
"None",
",",
"content_type",
"=",
"CONTENT_TYPE_JSON",
",",
"hue",
"=",
"None",
",",
"saturation",
"=",
"None",
",",
"color_temp"... | [
1161,
0
] | [
1200,
17
] | python | en | ['en', 'en', 'en'] | True |
test_external_ip_blocked | (hue_client) | Test external IP blocked. | Test external IP blocked. | async def test_external_ip_blocked(hue_client):
"""Test external IP blocked."""
getUrls = [
"/api/username/groups",
"/api/username",
"/api/username/config",
"/api/username/lights",
"/api/username/lights/light.ceiling_lights",
]
postUrls = ["/api"]
putUrls = ["... | [
"async",
"def",
"test_external_ip_blocked",
"(",
"hue_client",
")",
":",
"getUrls",
"=",
"[",
"\"/api/username/groups\"",
",",
"\"/api/username\"",
",",
"\"/api/username/config\"",
",",
"\"/api/username/lights\"",
",",
"\"/api/username/lights/light.ceiling_lights\"",
",",
"]"... | [
1203,
0
] | [
1228,
53
] | python | en | ['en', 'hu', 'en'] | True |
test_unauthorized_user_blocked | (hue_client) | Test unauthorized_user blocked. | Test unauthorized_user blocked. | async def test_unauthorized_user_blocked(hue_client):
"""Test unauthorized_user blocked."""
getUrls = [
"/api/wronguser",
]
for getUrl in getUrls:
result = await hue_client.get(getUrl)
assert result.status == HTTP_OK
result_json = await result.json()
assert resul... | [
"async",
"def",
"test_unauthorized_user_blocked",
"(",
"hue_client",
")",
":",
"getUrls",
"=",
"[",
"\"/api/wronguser\"",
",",
"]",
"for",
"getUrl",
"in",
"getUrls",
":",
"result",
"=",
"await",
"hue_client",
".",
"get",
"(",
"getUrl",
")",
"assert",
"result",... | [
1231,
0
] | [
1241,
76
] | python | ca | ['ca', 'zu', 'it'] | False |
test_put_then_get_cached_properly | (hass, hass_hue, hue_client) | Test the setting of light states and an immediate readback reads the same values. | Test the setting of light states and an immediate readback reads the same values. | async def test_put_then_get_cached_properly(hass, hass_hue, hue_client):
"""Test the setting of light states and an immediate readback reads the same values."""
# Turn the bedroom light on first
await hass_hue.services.async_call(
light.DOMAIN,
const.SERVICE_TURN_ON,
{const.ATTR_ENT... | [
"async",
"def",
"test_put_then_get_cached_properly",
"(",
"hass",
",",
"hass_hue",
",",
"hue_client",
")",
":",
"# Turn the bedroom light on first",
"await",
"hass_hue",
".",
"services",
".",
"async_call",
"(",
"light",
".",
"DOMAIN",
",",
"const",
".",
"SERVICE_TUR... | [
1244,
0
] | [
1364,
62
] | python | en | ['en', 'en', 'en'] | True |
test_put_than_get_when_service_call_fails | (hass, hass_hue, hue_client) | Test putting and getting the light state when the service call fails. | Test putting and getting the light state when the service call fails. | async def test_put_than_get_when_service_call_fails(hass, hass_hue, hue_client):
"""Test putting and getting the light state when the service call fails."""
# Turn the bedroom light off first
await hass_hue.services.async_call(
light.DOMAIN,
const.SERVICE_TURN_OFF,
{const.ATTR_ENTIT... | [
"async",
"def",
"test_put_than_get_when_service_call_fails",
"(",
"hass",
",",
"hass_hue",
",",
"hue_client",
")",
":",
"# Turn the bedroom light off first",
"await",
"hass_hue",
".",
"services",
".",
"async_call",
"(",
"light",
".",
"DOMAIN",
",",
"const",
".",
"SE... | [
1367,
0
] | [
1414,
59
] | python | en | ['en', 'en', 'en'] | True |
test_get_invalid_entity | (hass, hass_hue, hue_client) | Test the setting of light states and an immediate readback reads the same values. | Test the setting of light states and an immediate readback reads the same values. | async def test_get_invalid_entity(hass, hass_hue, hue_client):
"""Test the setting of light states and an immediate readback reads the same values."""
# Check that we get an error with an invalid entity number.
await perform_get_light_state_by_number(hue_client, 999, HTTP_NOT_FOUND) | [
"async",
"def",
"test_get_invalid_entity",
"(",
"hass",
",",
"hass_hue",
",",
"hue_client",
")",
":",
"# Check that we get an error with an invalid entity number.",
"await",
"perform_get_light_state_by_number",
"(",
"hue_client",
",",
"999",
",",
"HTTP_NOT_FOUND",
")"
] | [
1417,
0
] | [
1421,
76
] | python | en | ['en', 'en', 'en'] | True |
test_put_light_state_scene | (hass, hass_hue, hue_client) | Test the setting of scene variables. | Test the setting of scene variables. | async def test_put_light_state_scene(hass, hass_hue, hue_client):
"""Test the setting of scene variables."""
# Turn the kitchen lights off first
await hass_hue.services.async_call(
light.DOMAIN,
const.SERVICE_TURN_OFF,
{const.ATTR_ENTITY_ID: "light.kitchen_lights"},
blocking=... | [
"async",
"def",
"test_put_light_state_scene",
"(",
"hass",
",",
"hass_hue",
",",
"hue_client",
")",
":",
"# Turn the kitchen lights off first",
"await",
"hass_hue",
".",
"services",
".",
"async_call",
"(",
"light",
".",
"DOMAIN",
",",
"const",
".",
"SERVICE_TURN_OFF... | [
1424,
0
] | [
1463,
73
] | python | en | ['en', 'en', 'en'] | True |
test_only_change_contrast | (hass, hass_hue, hue_client) | Test when only changing the contrast of a light state. | Test when only changing the contrast of a light state. | async def test_only_change_contrast(hass, hass_hue, hue_client):
"""Test when only changing the contrast of a light state."""
# Turn the kitchen lights off first
await hass_hue.services.async_call(
light.DOMAIN,
const.SERVICE_TURN_OFF,
{const.ATTR_ENTITY_ID: "light.ceiling_lights"},... | [
"async",
"def",
"test_only_change_contrast",
"(",
"hass",
",",
"hass_hue",
",",
"hue_client",
")",
":",
"# Turn the kitchen lights off first",
"await",
"hass_hue",
".",
"services",
".",
"async_call",
"(",
"light",
".",
"DOMAIN",
",",
"const",
".",
"SERVICE_TURN_OFF"... | [
1466,
0
] | [
1492,
66
] | python | en | ['en', 'en', 'en'] | True |
test_only_change_hue_or_saturation | (hass, hass_hue, hue_client) | Test setting either the hue or the saturation but not both. | Test setting either the hue or the saturation but not both. | async def test_only_change_hue_or_saturation(hass, hass_hue, hue_client):
"""Test setting either the hue or the saturation but not both."""
# TODO: The handling of this appears wrong, as setting only one will set the other to 0.
# The return values also appear wrong.
# Turn the ceiling lights on first... | [
"async",
"def",
"test_only_change_hue_or_saturation",
"(",
"hass",
",",
"hass_hue",
",",
"hue_client",
")",
":",
"# TODO: The handling of this appears wrong, as setting only one will set the other to 0.",
"# The return values also appear wrong.",
"# Turn the ceiling lights on first and set... | [
1495,
0
] | [
1529,
15
] | python | en | ['en', 'en', 'en'] | True |
Gogogate2FlowHandler.__init__ | (self) | Initialize the config flow. | Initialize the config flow. | def __init__(self):
"""Initialize the config flow."""
self._ip_address = None
self._device_type = None | [
"def",
"__init__",
"(",
"self",
")",
":",
"self",
".",
"_ip_address",
"=",
"None",
"self",
".",
"_device_type",
"=",
"None"
] | [
28,
4
] | [
31,
32
] | python | en | ['en', 'en', 'en'] | True |
Gogogate2FlowHandler.async_step_import | (self, config_data: dict = None) | Handle importing of configuration. | Handle importing of configuration. | async def async_step_import(self, config_data: dict = None):
"""Handle importing of configuration."""
result = await self.async_step_user(config_data)
self._abort_if_unique_id_configured()
return result | [
"async",
"def",
"async_step_import",
"(",
"self",
",",
"config_data",
":",
"dict",
"=",
"None",
")",
":",
"result",
"=",
"await",
"self",
".",
"async_step_user",
"(",
"config_data",
")",
"self",
".",
"_abort_if_unique_id_configured",
"(",
")",
"return",
"resul... | [
33,
4
] | [
37,
21
] | python | en | ['en', 'en', 'en'] | True |
Gogogate2FlowHandler.async_step_homekit | (self, discovery_info) | Handle homekit discovery. | Handle homekit discovery. | async def async_step_homekit(self, discovery_info):
"""Handle homekit discovery."""
await self.async_set_unique_id(discovery_info["properties"]["id"])
self._abort_if_unique_id_configured({CONF_IP_ADDRESS: discovery_info["host"]})
ip_address = discovery_info["host"]
for entry in... | [
"async",
"def",
"async_step_homekit",
"(",
"self",
",",
"discovery_info",
")",
":",
"await",
"self",
".",
"async_set_unique_id",
"(",
"discovery_info",
"[",
"\"properties\"",
"]",
"[",
"\"id\"",
"]",
")",
"self",
".",
"_abort_if_unique_id_configured",
"(",
"{",
... | [
39,
4
] | [
52,
43
] | python | en | ['fr', 'xh', 'en'] | False |
Gogogate2FlowHandler.async_step_user | (self, user_input: dict = None) | Handle user initiated flow. | Handle user initiated flow. | async def async_step_user(self, user_input: dict = None):
"""Handle user initiated flow."""
user_input = user_input or {}
errors = {}
if user_input:
api = get_api(user_input)
try:
data: AbstractInfoResponse = await self.hass.async_add_executor_job... | [
"async",
"def",
"async_step_user",
"(",
"self",
",",
"user_input",
":",
"dict",
"=",
"None",
")",
":",
"user_input",
"=",
"user_input",
"or",
"{",
"}",
"errors",
"=",
"{",
"}",
"if",
"user_input",
":",
"api",
"=",
"get_api",
"(",
"user_input",
")",
"tr... | [
54,
4
] | [
123,
9
] | python | en | ['en', 'nl', 'en'] | True |
async_setup_entry | (hass, config_entry, async_add_entities) | Set up the Smile sensors from a config entry. | Set up the Smile sensors from a config entry. | async def async_setup_entry(hass, config_entry, async_add_entities):
"""Set up the Smile sensors from a config entry."""
api = hass.data[DOMAIN][config_entry.entry_id]["api"]
coordinator = hass.data[DOMAIN][config_entry.entry_id][COORDINATOR]
entities = []
all_devices = api.get_all_devices()
si... | [
"async",
"def",
"async_setup_entry",
"(",
"hass",
",",
"config_entry",
",",
"async_add_entities",
")",
":",
"api",
"=",
"hass",
".",
"data",
"[",
"DOMAIN",
"]",
"[",
"config_entry",
".",
"entry_id",
"]",
"[",
"\"api\"",
"]",
"coordinator",
"=",
"hass",
"."... | [
172,
0
] | [
235,
38
] | python | en | ['en', 'en', 'en'] | True |
SmileSensor.__init__ | (self, api, coordinator, name, dev_id, sensor) | Initialise the sensor. | Initialise the sensor. | def __init__(self, api, coordinator, name, dev_id, sensor):
"""Initialise the sensor."""
super().__init__(api, coordinator, name, dev_id)
self._sensor = sensor
self._dev_class = None
self._icon = None
self._state = None
self._unit_of_measurement = None
... | [
"def",
"__init__",
"(",
"self",
",",
"api",
",",
"coordinator",
",",
"name",
",",
"dev_id",
",",
"sensor",
")",
":",
"super",
"(",
")",
".",
"__init__",
"(",
"api",
",",
"coordinator",
",",
"name",
",",
"dev_id",
")",
"self",
".",
"_sensor",
"=",
"... | [
241,
4
] | [
261,
46
] | python | en | ['en', 'sm', 'en'] | True |
SmileSensor.device_class | (self) | Device class of this entity. | Device class of this entity. | def device_class(self):
"""Device class of this entity."""
return self._dev_class | [
"def",
"device_class",
"(",
"self",
")",
":",
"return",
"self",
".",
"_dev_class"
] | [
264,
4
] | [
266,
30
] | python | en | ['en', 'en', 'en'] | True |
SmileSensor.icon | (self) | Return the icon of this entity. | Return the icon of this entity. | def icon(self):
"""Return the icon of this entity."""
return self._icon | [
"def",
"icon",
"(",
"self",
")",
":",
"return",
"self",
".",
"_icon"
] | [
269,
4
] | [
271,
25
] | python | en | ['en', 'en', 'en'] | True |
SmileSensor.state | (self) | Return the state of this entity. | Return the state of this entity. | def state(self):
"""Return the state of this entity."""
return self._state | [
"def",
"state",
"(",
"self",
")",
":",
"return",
"self",
".",
"_state"
] | [
274,
4
] | [
276,
26
] | python | en | ['en', 'en', 'en'] | True |
SmileSensor.unit_of_measurement | (self) | Return the unit of measurement of this entity, if any. | Return the unit of measurement of this entity, if any. | def unit_of_measurement(self):
"""Return the unit of measurement of this entity, if any."""
return self._unit_of_measurement | [
"def",
"unit_of_measurement",
"(",
"self",
")",
":",
"return",
"self",
".",
"_unit_of_measurement"
] | [
279,
4
] | [
281,
40
] | python | en | ['en', 'en', 'en'] | True |
PwThermostatSensor.__init__ | (self, api, coordinator, name, dev_id, sensor, sensor_type) | Set up the Plugwise API. | Set up the Plugwise API. | def __init__(self, api, coordinator, name, dev_id, sensor, sensor_type):
"""Set up the Plugwise API."""
super().__init__(api, coordinator, name, dev_id, sensor)
self._icon = None
self._model = sensor_type[SENSOR_MAP_MODEL]
self._unit_of_measurement = sensor_type[SENSOR_MAP_UOM]
... | [
"def",
"__init__",
"(",
"self",
",",
"api",
",",
"coordinator",
",",
"name",
",",
"dev_id",
",",
"sensor",
",",
"sensor_type",
")",
":",
"super",
"(",
")",
".",
"__init__",
"(",
"api",
",",
"coordinator",
",",
"name",
",",
"dev_id",
",",
"sensor",
")... | [
287,
4
] | [
294,
62
] | python | en | ['en', 'zu', 'en'] | True |
PwThermostatSensor._async_process_data | (self) | Update the entity. | Update the entity. | def _async_process_data(self):
"""Update the entity."""
data = self._api.get_device_data(self._dev_id)
if not data:
_LOGGER.error("Received no data for device %s", self._entity_name)
self.async_write_ha_state()
return
if data.get(self._sensor) is not... | [
"def",
"_async_process_data",
"(",
"self",
")",
":",
"data",
"=",
"self",
".",
"_api",
".",
"get_device_data",
"(",
"self",
".",
"_dev_id",
")",
"if",
"not",
"data",
":",
"_LOGGER",
".",
"error",
"(",
"\"Received no data for device %s\"",
",",
"self",
".",
... | [
297,
4
] | [
313,
35
] | python | en | ['en', 'en', 'en'] | True |
PwAuxDeviceSensor.__init__ | (self, api, coordinator, name, dev_id, sensor) | Set up the Plugwise API. | Set up the Plugwise API. | def __init__(self, api, coordinator, name, dev_id, sensor):
"""Set up the Plugwise API."""
super().__init__(api, coordinator, name, dev_id, sensor)
self._cooling_state = False
self._heating_state = False | [
"def",
"__init__",
"(",
"self",
",",
"api",
",",
"coordinator",
",",
"name",
",",
"dev_id",
",",
"sensor",
")",
":",
"super",
"(",
")",
".",
"__init__",
"(",
"api",
",",
"coordinator",
",",
"name",
",",
"dev_id",
",",
"sensor",
")",
"self",
".",
"_... | [
319,
4
] | [
324,
35
] | python | en | ['en', 'zu', 'en'] | True |
PwAuxDeviceSensor._async_process_data | (self) | Update the entity. | Update the entity. | def _async_process_data(self):
"""Update the entity."""
data = self._api.get_device_data(self._dev_id)
if not data:
_LOGGER.error("Received no data for device %s", self._entity_name)
self.async_write_ha_state()
return
if data.get("heating_state") is ... | [
"def",
"_async_process_data",
"(",
"self",
")",
":",
"data",
"=",
"self",
".",
"_api",
".",
"get_device_data",
"(",
"self",
".",
"_dev_id",
")",
"if",
"not",
"data",
":",
"_LOGGER",
".",
"error",
"(",
"\"Received no data for device %s\"",
",",
"self",
".",
... | [
327,
4
] | [
350,
35
] | python | en | ['en', 'en', 'en'] | True |
PwPowerSensor.__init__ | (self, api, coordinator, name, dev_id, sensor, sensor_type, model) | Set up the Plugwise API. | Set up the Plugwise API. | def __init__(self, api, coordinator, name, dev_id, sensor, sensor_type, model):
"""Set up the Plugwise API."""
super().__init__(api, coordinator, name, dev_id, sensor)
self._icon = None
self._model = model
if model is None:
self._model = sensor_type[SENSOR_MAP_MODEL]... | [
"def",
"__init__",
"(",
"self",
",",
"api",
",",
"coordinator",
",",
"name",
",",
"dev_id",
",",
"sensor",
",",
"sensor_type",
",",
"model",
")",
":",
"super",
"(",
")",
".",
"__init__",
"(",
"api",
",",
"coordinator",
",",
"name",
",",
"dev_id",
","... | [
356,
4
] | [
369,
35
] | python | en | ['en', 'zu', 'en'] | True |
PwPowerSensor._async_process_data | (self) | Update the entity. | Update the entity. | def _async_process_data(self):
"""Update the entity."""
data = self._api.get_device_data(self._dev_id)
if not data:
_LOGGER.error("Received no data for device %s", self._entity_name)
self.async_write_ha_state()
return
if data.get(self._sensor) is not... | [
"def",
"_async_process_data",
"(",
"self",
")",
":",
"data",
"=",
"self",
".",
"_api",
".",
"get_device_data",
"(",
"self",
".",
"_dev_id",
")",
"if",
"not",
"data",
":",
"_LOGGER",
".",
"error",
"(",
"\"Received no data for device %s\"",
",",
"self",
".",
... | [
372,
4
] | [
388,
35
] | python | en | ['en', 'en', 'en'] | True |
async_setup_platform | (hass, config, async_add_entities, discovery_info=None) | Create the IntesisHome climate devices. | Create the IntesisHome climate devices. | async def async_setup_platform(hass, config, async_add_entities, discovery_info=None):
"""Create the IntesisHome climate devices."""
ih_user = config[CONF_USERNAME]
ih_pass = config[CONF_PASSWORD]
device_type = config[CONF_DEVICE]
controller = IntesisHome(
ih_user,
ih_pass,
... | [
"async",
"def",
"async_setup_platform",
"(",
"hass",
",",
"config",
",",
"async_add_entities",
",",
"discovery_info",
"=",
"None",
")",
":",
"ih_user",
"=",
"config",
"[",
"CONF_USERNAME",
"]",
"ih_pass",
"=",
"config",
"[",
"CONF_PASSWORD",
"]",
"device_type",
... | [
91,
0
] | [
128,
31
] | python | en | ['en', 'en', 'en'] | True |
IntesisAC.__init__ | (self, ih_device_id, ih_device, controller) | Initialize the thermostat. | Initialize the thermostat. | def __init__(self, ih_device_id, ih_device, controller):
"""Initialize the thermostat."""
self._controller = controller
self._device_id = ih_device_id
self._ih_device = ih_device
self._device_name = ih_device.get("name")
self._device_type = controller.device_type
... | [
"def",
"__init__",
"(",
"self",
",",
"ih_device_id",
",",
"ih_device",
",",
"controller",
")",
":",
"self",
".",
"_controller",
"=",
"controller",
"self",
".",
"_device_id",
"=",
"ih_device_id",
"self",
".",
"_ih_device",
"=",
"ih_device",
"self",
".",
"_dev... | [
134,
4
] | [
191,
50
] | python | en | ['en', 'en', 'en'] | True |
IntesisAC.async_added_to_hass | (self) | Subscribe to event updates. | Subscribe to event updates. | async def async_added_to_hass(self):
"""Subscribe to event updates."""
_LOGGER.debug("Added climate device with state: %s", repr(self._ih_device))
await self._controller.add_update_callback(self.async_update_callback)
try:
await self._controller.connect()
except IHCon... | [
"async",
"def",
"async_added_to_hass",
"(",
"self",
")",
":",
"_LOGGER",
".",
"debug",
"(",
"\"Added climate device with state: %s\"",
",",
"repr",
"(",
"self",
".",
"_ih_device",
")",
")",
"await",
"self",
".",
"_controller",
".",
"add_update_callback",
"(",
"s... | [
193,
4
] | [
201,
42
] | python | en | ['en', 'en', 'en'] | True |
IntesisAC.name | (self) | Return the name of the AC device. | Return the name of the AC device. | def name(self):
"""Return the name of the AC device."""
return self._device_name | [
"def",
"name",
"(",
"self",
")",
":",
"return",
"self",
".",
"_device_name"
] | [
204,
4
] | [
206,
32
] | python | en | ['en', 'en', 'en'] | True |
IntesisAC.temperature_unit | (self) | Intesishome API uses celsius on the backend. | Intesishome API uses celsius on the backend. | def temperature_unit(self):
"""Intesishome API uses celsius on the backend."""
return TEMP_CELSIUS | [
"def",
"temperature_unit",
"(",
"self",
")",
":",
"return",
"TEMP_CELSIUS"
] | [
209,
4
] | [
211,
27
] | python | en | ['en', 'haw', 'en'] | True |
IntesisAC.device_state_attributes | (self) | Return the device specific state attributes. | Return the device specific state attributes. | def device_state_attributes(self):
"""Return the device specific state attributes."""
attrs = {}
if self._outdoor_temp:
attrs["outdoor_temp"] = self._outdoor_temp
if self._power_consumption_heat:
attrs["power_consumption_heat_kw"] = round(
self._po... | [
"def",
"device_state_attributes",
"(",
"self",
")",
":",
"attrs",
"=",
"{",
"}",
"if",
"self",
".",
"_outdoor_temp",
":",
"attrs",
"[",
"\"outdoor_temp\"",
"]",
"=",
"self",
".",
"_outdoor_temp",
"if",
"self",
".",
"_power_consumption_heat",
":",
"attrs",
"[... | [
214,
4
] | [
228,
20
] | python | en | ['en', 'en', 'en'] | True |
IntesisAC.unique_id | (self) | Return unique ID for this device. | Return unique ID for this device. | def unique_id(self):
"""Return unique ID for this device."""
return self._device_id | [
"def",
"unique_id",
"(",
"self",
")",
":",
"return",
"self",
".",
"_device_id"
] | [
231,
4
] | [
233,
30
] | python | en | ['en', 'en', 'en'] | True |
IntesisAC.target_temperature_step | (self) | Return whether setpoint should be whole or half degree precision. | Return whether setpoint should be whole or half degree precision. | def target_temperature_step(self) -> float:
"""Return whether setpoint should be whole or half degree precision."""
return self._setpoint_step | [
"def",
"target_temperature_step",
"(",
"self",
")",
"->",
"float",
":",
"return",
"self",
".",
"_setpoint_step"
] | [
236,
4
] | [
238,
34
] | python | en | ['en', 'en', 'en'] | True |
IntesisAC.preset_modes | (self) | Return a list of HVAC preset modes. | Return a list of HVAC preset modes. | def preset_modes(self):
"""Return a list of HVAC preset modes."""
return self._preset_list | [
"def",
"preset_modes",
"(",
"self",
")",
":",
"return",
"self",
".",
"_preset_list"
] | [
241,
4
] | [
243,
32
] | python | en | ['en', 'is', 'en'] | True |
IntesisAC.preset_mode | (self) | Return the current preset mode. | Return the current preset mode. | def preset_mode(self):
"""Return the current preset mode."""
return self._preset | [
"def",
"preset_mode",
"(",
"self",
")",
":",
"return",
"self",
".",
"_preset"
] | [
246,
4
] | [
248,
27
] | python | en | ['en', 'en', 'en'] | True |
IntesisAC.async_set_temperature | (self, **kwargs) | Set new target temperature. | Set new target temperature. | async def async_set_temperature(self, **kwargs):
"""Set new target temperature."""
temperature = kwargs.get(ATTR_TEMPERATURE)
hvac_mode = kwargs.get(ATTR_HVAC_MODE)
if hvac_mode:
await self.async_set_hvac_mode(hvac_mode)
if temperature:
_LOGGER.debug("Se... | [
"async",
"def",
"async_set_temperature",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"temperature",
"=",
"kwargs",
".",
"get",
"(",
"ATTR_TEMPERATURE",
")",
"hvac_mode",
"=",
"kwargs",
".",
"get",
"(",
"ATTR_HVAC_MODE",
")",
"if",
"hvac_mode",
":",
"aw... | [
250,
4
] | [
264,
35
] | python | en | ['en', 'ca', 'en'] | True |
IntesisAC.async_set_hvac_mode | (self, hvac_mode) | Set operation mode. | Set operation mode. | async def async_set_hvac_mode(self, hvac_mode):
"""Set operation mode."""
_LOGGER.debug("Setting %s to %s mode", self._device_type, hvac_mode)
if hvac_mode == HVAC_MODE_OFF:
self._power = False
await self._controller.set_power_off(self._device_id)
# Write chan... | [
"async",
"def",
"async_set_hvac_mode",
"(",
"self",
",",
"hvac_mode",
")",
":",
"_LOGGER",
".",
"debug",
"(",
"\"Setting %s to %s mode\"",
",",
"self",
".",
"_device_type",
",",
"hvac_mode",
")",
"if",
"hvac_mode",
"==",
"HVAC_MODE_OFF",
":",
"self",
".",
"_po... | [
266,
4
] | [
290,
35
] | python | en | ['nl', 'ny', 'en'] | False |
IntesisAC.async_set_fan_mode | (self, fan_mode) | Set fan mode (from quiet, low, medium, high, auto). | Set fan mode (from quiet, low, medium, high, auto). | async def async_set_fan_mode(self, fan_mode):
"""Set fan mode (from quiet, low, medium, high, auto)."""
await self._controller.set_fan_speed(self._device_id, fan_mode)
# Updates can take longer than 2 seconds, so update locally
self._fan_speed = fan_mode
self.async_write_ha_stat... | [
"async",
"def",
"async_set_fan_mode",
"(",
"self",
",",
"fan_mode",
")",
":",
"await",
"self",
".",
"_controller",
".",
"set_fan_speed",
"(",
"self",
".",
"_device_id",
",",
"fan_mode",
")",
"# Updates can take longer than 2 seconds, so update locally",
"self",
".",
... | [
292,
4
] | [
298,
35
] | python | en | ['en', 'en', 'en'] | True |
IntesisAC.async_set_preset_mode | (self, preset_mode) | Set preset mode. | Set preset mode. | async def async_set_preset_mode(self, preset_mode):
"""Set preset mode."""
ih_preset_mode = MAP_PRESET_MODE_TO_IH.get(preset_mode)
await self._controller.set_preset_mode(self._device_id, ih_preset_mode) | [
"async",
"def",
"async_set_preset_mode",
"(",
"self",
",",
"preset_mode",
")",
":",
"ih_preset_mode",
"=",
"MAP_PRESET_MODE_TO_IH",
".",
"get",
"(",
"preset_mode",
")",
"await",
"self",
".",
"_controller",
".",
"set_preset_mode",
"(",
"self",
".",
"_device_id",
... | [
300,
4
] | [
303,
79
] | python | de | ['de', 'pt', 'it'] | False |
IntesisAC.async_set_swing_mode | (self, swing_mode) | Set the vertical vane. | Set the vertical vane. | async def async_set_swing_mode(self, swing_mode):
"""Set the vertical vane."""
swing_settings = MAP_SWING_TO_IH.get(swing_mode)
if swing_settings:
await self._controller.set_vertical_vane(
self._device_id, swing_settings.get("vvane")
)
await se... | [
"async",
"def",
"async_set_swing_mode",
"(",
"self",
",",
"swing_mode",
")",
":",
"swing_settings",
"=",
"MAP_SWING_TO_IH",
".",
"get",
"(",
"swing_mode",
")",
"if",
"swing_settings",
":",
"await",
"self",
".",
"_controller",
".",
"set_vertical_vane",
"(",
"self... | [
305,
4
] | [
314,
13
] | python | nl | ['en', 'nl', 'nl'] | True |
IntesisAC.async_update | (self) | Copy values from controller dictionary to climate device. | Copy values from controller dictionary to climate device. | async def async_update(self):
"""Copy values from controller dictionary to climate device."""
# Update values from controller's device dictionary
self._connected = self._controller.is_connected
self._current_temp = self._controller.get_temperature(self._device_id)
self._fan_speed... | [
"async",
"def",
"async_update",
"(",
"self",
")",
":",
"# Update values from controller's device dictionary",
"self",
".",
"_connected",
"=",
"self",
".",
"_controller",
".",
"is_connected",
"self",
".",
"_current_temp",
"=",
"self",
".",
"_controller",
".",
"get_te... | [
316,
4
] | [
349,
9
] | python | en | ['en', 'en', 'en'] | True |
IntesisAC.async_will_remove_from_hass | (self) | Shutdown the controller when the device is being removed. | Shutdown the controller when the device is being removed. | async def async_will_remove_from_hass(self):
"""Shutdown the controller when the device is being removed."""
await self._controller.stop() | [
"async",
"def",
"async_will_remove_from_hass",
"(",
"self",
")",
":",
"await",
"self",
".",
"_controller",
".",
"stop",
"(",
")"
] | [
351,
4
] | [
353,
37
] | python | en | ['en', 'en', 'en'] | True |
IntesisAC.icon | (self) | Return the icon for the current state. | Return the icon for the current state. | def icon(self):
"""Return the icon for the current state."""
icon = None
if self._power:
icon = MAP_STATE_ICONS.get(self._hvac_mode)
return icon | [
"def",
"icon",
"(",
"self",
")",
":",
"icon",
"=",
"None",
"if",
"self",
".",
"_power",
":",
"icon",
"=",
"MAP_STATE_ICONS",
".",
"get",
"(",
"self",
".",
"_hvac_mode",
")",
"return",
"icon"
] | [
356,
4
] | [
361,
19
] | python | en | ['en', 'en', 'en'] | True |
IntesisAC.async_update_callback | (self, device_id=None) | Let HA know there has been an update from the controller. | Let HA know there has been an update from the controller. | async def async_update_callback(self, device_id=None):
"""Let HA know there has been an update from the controller."""
# Track changes in connection state
if not self._controller.is_connected and self._connected:
# Connection has dropped
self._connected = False
... | [
"async",
"def",
"async_update_callback",
"(",
"self",
",",
"device_id",
"=",
"None",
")",
":",
"# Track changes in connection state",
"if",
"not",
"self",
".",
"_controller",
".",
"is_connected",
"and",
"self",
".",
"_connected",
":",
"# Connection has dropped",
"se... | [
363,
4
] | [
392,
53
] | python | en | ['en', 'en', 'en'] | True |
IntesisAC.min_temp | (self) | Return the minimum temperature for the current mode of operation. | Return the minimum temperature for the current mode of operation. | def min_temp(self):
"""Return the minimum temperature for the current mode of operation."""
return self._min_temp | [
"def",
"min_temp",
"(",
"self",
")",
":",
"return",
"self",
".",
"_min_temp"
] | [
395,
4
] | [
397,
29
] | python | en | ['en', 'en', 'en'] | True |
IntesisAC.max_temp | (self) | Return the maximum temperature for the current mode of operation. | Return the maximum temperature for the current mode of operation. | def max_temp(self):
"""Return the maximum temperature for the current mode of operation."""
return self._max_temp | [
"def",
"max_temp",
"(",
"self",
")",
":",
"return",
"self",
".",
"_max_temp"
] | [
400,
4
] | [
402,
29
] | python | en | ['en', 'en', 'en'] | True |
IntesisAC.should_poll | (self) | Poll for updates if pyIntesisHome doesn't have a socket open. | Poll for updates if pyIntesisHome doesn't have a socket open. | def should_poll(self):
"""Poll for updates if pyIntesisHome doesn't have a socket open."""
return False | [
"def",
"should_poll",
"(",
"self",
")",
":",
"return",
"False"
] | [
405,
4
] | [
407,
20
] | python | en | ['en', 'en', 'en'] | True |
IntesisAC.hvac_modes | (self) | List of available operation modes. | List of available operation modes. | def hvac_modes(self):
"""List of available operation modes."""
return self._hvac_mode_list | [
"def",
"hvac_modes",
"(",
"self",
")",
":",
"return",
"self",
".",
"_hvac_mode_list"
] | [
410,
4
] | [
412,
35
] | python | en | ['en', 'en', 'en'] | True |
IntesisAC.fan_mode | (self) | Return whether the fan is on. | Return whether the fan is on. | def fan_mode(self):
"""Return whether the fan is on."""
return self._fan_speed | [
"def",
"fan_mode",
"(",
"self",
")",
":",
"return",
"self",
".",
"_fan_speed"
] | [
415,
4
] | [
417,
30
] | python | en | ['en', 'en', 'en'] | True |
IntesisAC.swing_mode | (self) | Return current swing mode. | Return current swing mode. | def swing_mode(self):
"""Return current swing mode."""
if self._vvane == IH_SWING_SWING and self._hvane == IH_SWING_SWING:
swing = SWING_BOTH
elif self._vvane == IH_SWING_SWING:
swing = SWING_VERTICAL
elif self._hvane == IH_SWING_SWING:
swing = SWING_H... | [
"def",
"swing_mode",
"(",
"self",
")",
":",
"if",
"self",
".",
"_vvane",
"==",
"IH_SWING_SWING",
"and",
"self",
".",
"_hvane",
"==",
"IH_SWING_SWING",
":",
"swing",
"=",
"SWING_BOTH",
"elif",
"self",
".",
"_vvane",
"==",
"IH_SWING_SWING",
":",
"swing",
"="... | [
420,
4
] | [
430,
20
] | python | en | ['en', 'bg', 'en'] | True |
IntesisAC.fan_modes | (self) | List of available fan modes. | List of available fan modes. | def fan_modes(self):
"""List of available fan modes."""
return self._fan_modes | [
"def",
"fan_modes",
"(",
"self",
")",
":",
"return",
"self",
".",
"_fan_modes"
] | [
433,
4
] | [
435,
30
] | python | en | ['en', 'en', 'en'] | True |
IntesisAC.swing_modes | (self) | List of available swing positions. | List of available swing positions. | def swing_modes(self):
"""List of available swing positions."""
return self._swing_list | [
"def",
"swing_modes",
"(",
"self",
")",
":",
"return",
"self",
".",
"_swing_list"
] | [
438,
4
] | [
440,
31
] | python | en | ['en', 'en', 'en'] | True |
IntesisAC.available | (self) | If the device hasn't been able to connect, mark as unavailable. | If the device hasn't been able to connect, mark as unavailable. | def available(self) -> bool:
"""If the device hasn't been able to connect, mark as unavailable."""
return self._connected or self._connected is None | [
"def",
"available",
"(",
"self",
")",
"->",
"bool",
":",
"return",
"self",
".",
"_connected",
"or",
"self",
".",
"_connected",
"is",
"None"
] | [
443,
4
] | [
445,
57
] | python | en | ['en', 'en', 'en'] | True |
IntesisAC.current_temperature | (self) | Return the current temperature. | Return the current temperature. | def current_temperature(self):
"""Return the current temperature."""
return self._current_temp | [
"def",
"current_temperature",
"(",
"self",
")",
":",
"return",
"self",
".",
"_current_temp"
] | [
448,
4
] | [
450,
33
] | python | en | ['en', 'la', 'en'] | True |
IntesisAC.hvac_mode | (self) | Return the current mode of operation if unit is on. | Return the current mode of operation if unit is on. | def hvac_mode(self):
"""Return the current mode of operation if unit is on."""
if self._power:
return self._hvac_mode
return HVAC_MODE_OFF | [
"def",
"hvac_mode",
"(",
"self",
")",
":",
"if",
"self",
".",
"_power",
":",
"return",
"self",
".",
"_hvac_mode",
"return",
"HVAC_MODE_OFF"
] | [
453,
4
] | [
457,
28
] | python | en | ['en', 'en', 'en'] | True |
IntesisAC.target_temperature | (self) | Return the current setpoint temperature if unit is on. | Return the current setpoint temperature if unit is on. | def target_temperature(self):
"""Return the current setpoint temperature if unit is on."""
return self._target_temp | [
"def",
"target_temperature",
"(",
"self",
")",
":",
"return",
"self",
".",
"_target_temp"
] | [
460,
4
] | [
462,
32
] | python | en | ['en', 'en', 'en'] | True |
IntesisAC.supported_features | (self) | Return the list of supported features. | Return the list of supported features. | def supported_features(self):
"""Return the list of supported features."""
return self._support | [
"def",
"supported_features",
"(",
"self",
")",
":",
"return",
"self",
".",
"_support"
] | [
465,
4
] | [
467,
28
] | python | en | ['en', 'en', 'en'] | True |
setup_platform | (hass, config, add_entities, discovery_info=None) | Set up switches based on ecoal interface. | Set up switches based on ecoal interface. | def setup_platform(hass, config, add_entities, discovery_info=None):
"""Set up switches based on ecoal interface."""
if discovery_info is None:
return
ecoal_contr = hass.data[DATA_ECOAL_BOILER]
switches = []
for pump_id in discovery_info:
name = AVAILABLE_PUMPS[pump_id]
switc... | [
"def",
"setup_platform",
"(",
"hass",
",",
"config",
",",
"add_entities",
",",
"discovery_info",
"=",
"None",
")",
":",
"if",
"discovery_info",
"is",
"None",
":",
"return",
"ecoal_contr",
"=",
"hass",
".",
"data",
"[",
"DATA_ECOAL_BOILER",
"]",
"switches",
"... | [
8,
0
] | [
17,
32
] | python | en | ['en', 'zu', 'en'] | True |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.