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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
_get_red | (temperature: float) | Get the red component of the temperature in RGB space. | Get the red component of the temperature in RGB space. | def _get_red(temperature: float) -> float:
"""Get the red component of the temperature in RGB space."""
if temperature <= 66:
return 255
tmp_red = 329.698727446 * math.pow(temperature - 60, -0.1332047592)
return _clamp(tmp_red) | [
"def",
"_get_red",
"(",
"temperature",
":",
"float",
")",
"->",
"float",
":",
"if",
"temperature",
"<=",
"66",
":",
"return",
"255",
"tmp_red",
"=",
"329.698727446",
"*",
"math",
".",
"pow",
"(",
"temperature",
"-",
"60",
",",
"-",
"0.1332047592",
")",
... | [
541,
0
] | [
546,
26
] | python | en | ['en', 'en', 'en'] | True |
_get_green | (temperature: float) | Get the green component of the given color temp in RGB space. | Get the green component of the given color temp in RGB space. | def _get_green(temperature: float) -> float:
"""Get the green component of the given color temp in RGB space."""
if temperature <= 66:
green = 99.4708025861 * math.log(temperature) - 161.1195681661
else:
green = 288.1221695283 * math.pow(temperature - 60, -0.0755148492)
return _clamp(gre... | [
"def",
"_get_green",
"(",
"temperature",
":",
"float",
")",
"->",
"float",
":",
"if",
"temperature",
"<=",
"66",
":",
"green",
"=",
"99.4708025861",
"*",
"math",
".",
"log",
"(",
"temperature",
")",
"-",
"161.1195681661",
"else",
":",
"green",
"=",
"288.... | [
549,
0
] | [
555,
24
] | python | en | ['en', 'en', 'en'] | True |
_get_blue | (temperature: float) | Get the blue component of the given color temperature in RGB space. | Get the blue component of the given color temperature in RGB space. | def _get_blue(temperature: float) -> float:
"""Get the blue component of the given color temperature in RGB space."""
if temperature >= 66:
return 255
if temperature <= 19:
return 0
blue = 138.5177312231 * math.log(temperature - 10) - 305.0447927307
return _clamp(blue) | [
"def",
"_get_blue",
"(",
"temperature",
":",
"float",
")",
"->",
"float",
":",
"if",
"temperature",
">=",
"66",
":",
"return",
"255",
"if",
"temperature",
"<=",
"19",
":",
"return",
"0",
"blue",
"=",
"138.5177312231",
"*",
"math",
".",
"log",
"(",
"tem... | [
558,
0
] | [
565,
23
] | python | en | ['en', 'en', 'en'] | True |
color_temperature_mired_to_kelvin | (mired_temperature: float) | Convert absolute mired shift to degrees kelvin. | Convert absolute mired shift to degrees kelvin. | def color_temperature_mired_to_kelvin(mired_temperature: float) -> int:
"""Convert absolute mired shift to degrees kelvin."""
return math.floor(1000000 / mired_temperature) | [
"def",
"color_temperature_mired_to_kelvin",
"(",
"mired_temperature",
":",
"float",
")",
"->",
"int",
":",
"return",
"math",
".",
"floor",
"(",
"1000000",
"/",
"mired_temperature",
")"
] | [
568,
0
] | [
570,
50
] | python | en | ['en', 'en', 'en'] | True |
color_temperature_kelvin_to_mired | (kelvin_temperature: float) | Convert degrees kelvin to mired shift. | Convert degrees kelvin to mired shift. | def color_temperature_kelvin_to_mired(kelvin_temperature: float) -> int:
"""Convert degrees kelvin to mired shift."""
return math.floor(1000000 / kelvin_temperature) | [
"def",
"color_temperature_kelvin_to_mired",
"(",
"kelvin_temperature",
":",
"float",
")",
"->",
"int",
":",
"return",
"math",
".",
"floor",
"(",
"1000000",
"/",
"kelvin_temperature",
")"
] | [
573,
0
] | [
575,
51
] | python | en | ['en', 'en', 'en'] | True |
cross_product | (p1: XYPoint, p2: XYPoint) | Calculate the cross product of two XYPoints. | Calculate the cross product of two XYPoints. | def cross_product(p1: XYPoint, p2: XYPoint) -> float:
"""Calculate the cross product of two XYPoints."""
return float(p1.x * p2.y - p1.y * p2.x) | [
"def",
"cross_product",
"(",
"p1",
":",
"XYPoint",
",",
"p2",
":",
"XYPoint",
")",
"->",
"float",
":",
"return",
"float",
"(",
"p1",
".",
"x",
"*",
"p2",
".",
"y",
"-",
"p1",
".",
"y",
"*",
"p2",
".",
"x",
")"
] | [
581,
0
] | [
583,
43
] | python | en | ['en', 'en', 'en'] | True |
get_distance_between_two_points | (one: XYPoint, two: XYPoint) | Calculate the distance between two XYPoints. | Calculate the distance between two XYPoints. | def get_distance_between_two_points(one: XYPoint, two: XYPoint) -> float:
"""Calculate the distance between two XYPoints."""
dx = one.x - two.x
dy = one.y - two.y
return math.sqrt(dx * dx + dy * dy) | [
"def",
"get_distance_between_two_points",
"(",
"one",
":",
"XYPoint",
",",
"two",
":",
"XYPoint",
")",
"->",
"float",
":",
"dx",
"=",
"one",
".",
"x",
"-",
"two",
".",
"x",
"dy",
"=",
"one",
".",
"y",
"-",
"two",
".",
"y",
"return",
"math",
".",
... | [
586,
0
] | [
590,
39
] | python | en | ['en', 'en', 'en'] | True |
get_closest_point_to_line | (A: XYPoint, B: XYPoint, P: XYPoint) |
Find the closest point from P to a line defined by A and B.
This point will be reproducible by the lamp
as it is on the edge of the gamut.
|
Find the closest point from P to a line defined by A and B. | def get_closest_point_to_line(A: XYPoint, B: XYPoint, P: XYPoint) -> XYPoint:
"""
Find the closest point from P to a line defined by A and B.
This point will be reproducible by the lamp
as it is on the edge of the gamut.
"""
AP = XYPoint(P.x - A.x, P.y - A.y)
AB = XYPoint(B.x - A.x, B.y - A... | [
"def",
"get_closest_point_to_line",
"(",
"A",
":",
"XYPoint",
",",
"B",
":",
"XYPoint",
",",
"P",
":",
"XYPoint",
")",
"->",
"XYPoint",
":",
"AP",
"=",
"XYPoint",
"(",
"P",
".",
"x",
"-",
"A",
".",
"x",
",",
"P",
".",
"y",
"-",
"A",
".",
"y",
... | [
593,
0
] | [
611,
50
] | python | en | ['en', 'error', 'th'] | False |
get_closest_point_to_point | (
xy_tuple: tuple[float, float], Gamut: GamutType
) |
Get the closest matching color within the gamut of the light.
Should only be used if the supplied color is outside of the color gamut.
|
Get the closest matching color within the gamut of the light. | def get_closest_point_to_point(
xy_tuple: tuple[float, float], Gamut: GamutType
) -> tuple[float, float]:
"""
Get the closest matching color within the gamut of the light.
Should only be used if the supplied color is outside of the color gamut.
"""
xy_point = XYPoint(xy_tuple[0], xy_tuple[1])
... | [
"def",
"get_closest_point_to_point",
"(",
"xy_tuple",
":",
"tuple",
"[",
"float",
",",
"float",
"]",
",",
"Gamut",
":",
"GamutType",
")",
"->",
"tuple",
"[",
"float",
",",
"float",
"]",
":",
"xy_point",
"=",
"XYPoint",
"(",
"xy_tuple",
"[",
"0",
"]",
"... | [
614,
0
] | [
649,
19
] | python | en | ['en', 'error', 'th'] | False |
check_point_in_lamps_reach | (p: tuple[float, float], Gamut: GamutType) | Check if the provided XYPoint can be recreated by a Hue lamp. | Check if the provided XYPoint can be recreated by a Hue lamp. | def check_point_in_lamps_reach(p: tuple[float, float], Gamut: GamutType) -> bool:
"""Check if the provided XYPoint can be recreated by a Hue lamp."""
v1 = XYPoint(Gamut.green.x - Gamut.red.x, Gamut.green.y - Gamut.red.y)
v2 = XYPoint(Gamut.blue.x - Gamut.red.x, Gamut.blue.y - Gamut.red.y)
q = XYPoint(p... | [
"def",
"check_point_in_lamps_reach",
"(",
"p",
":",
"tuple",
"[",
"float",
",",
"float",
"]",
",",
"Gamut",
":",
"GamutType",
")",
"->",
"bool",
":",
"v1",
"=",
"XYPoint",
"(",
"Gamut",
".",
"green",
".",
"x",
"-",
"Gamut",
".",
"red",
".",
"x",
",... | [
652,
0
] | [
661,
55
] | python | en | ['en', 'en', 'en'] | True |
check_valid_gamut | (Gamut: GamutType) | Check if the supplied gamut is valid. | Check if the supplied gamut is valid. | def check_valid_gamut(Gamut: GamutType) -> bool:
"""Check if the supplied gamut is valid."""
# Check if the three points of the supplied gamut are not on the same line.
v1 = XYPoint(Gamut.green.x - Gamut.red.x, Gamut.green.y - Gamut.red.y)
v2 = XYPoint(Gamut.blue.x - Gamut.red.x, Gamut.blue.y - Gamut.re... | [
"def",
"check_valid_gamut",
"(",
"Gamut",
":",
"GamutType",
")",
"->",
"bool",
":",
"# Check if the three points of the supplied gamut are not on the same line.",
"v1",
"=",
"XYPoint",
"(",
"Gamut",
".",
"green",
".",
"x",
"-",
"Gamut",
".",
"red",
".",
"x",
",",
... | [
664,
0
] | [
688,
67
] | python | en | ['en', 'en', 'en'] | True |
async_setup_platform | (
hass: HomeAssistant, config: ConfigType, async_add_entities, discovery_info=None
) | Set up MQTT camera through configuration.yaml. | Set up MQTT camera through configuration.yaml. | async def async_setup_platform(
hass: HomeAssistant, config: ConfigType, async_add_entities, discovery_info=None
):
"""Set up MQTT camera through configuration.yaml."""
await async_setup_reload_service(hass, DOMAIN, PLATFORMS)
await _async_setup_entity(hass, async_add_entities, config) | [
"async",
"def",
"async_setup_platform",
"(",
"hass",
":",
"HomeAssistant",
",",
"config",
":",
"ConfigType",
",",
"async_add_entities",
",",
"discovery_info",
"=",
"None",
")",
":",
"await",
"async_setup_reload_service",
"(",
"hass",
",",
"DOMAIN",
",",
"PLATFORMS... | [
40,
0
] | [
45,
63
] | python | en | ['en', 'zh', 'en'] | True |
async_setup_entry | (hass, config_entry, async_add_entities) | Set up MQTT camera dynamically through MQTT discovery. | Set up MQTT camera dynamically through MQTT discovery. | async def async_setup_entry(hass, config_entry, async_add_entities):
"""Set up MQTT camera dynamically through MQTT discovery."""
setup = functools.partial(
_async_setup_entity, hass, async_add_entities, config_entry=config_entry
)
await async_setup_entry_helper(hass, camera.DOMAIN, setup, PLATF... | [
"async",
"def",
"async_setup_entry",
"(",
"hass",
",",
"config_entry",
",",
"async_add_entities",
")",
":",
"setup",
"=",
"functools",
".",
"partial",
"(",
"_async_setup_entity",
",",
"hass",
",",
"async_add_entities",
",",
"config_entry",
"=",
"config_entry",
")"... | [
48,
0
] | [
53,
79
] | python | en | ['en', 'vi', 'en'] | True |
_async_setup_entity | (
hass, async_add_entities, config, config_entry=None, discovery_data=None
) | Set up the MQTT Camera. | Set up the MQTT Camera. | async def _async_setup_entity(
hass, async_add_entities, config, config_entry=None, discovery_data=None
):
"""Set up the MQTT Camera."""
async_add_entities([MqttCamera(hass, config, config_entry, discovery_data)]) | [
"async",
"def",
"_async_setup_entity",
"(",
"hass",
",",
"async_add_entities",
",",
"config",
",",
"config_entry",
"=",
"None",
",",
"discovery_data",
"=",
"None",
")",
":",
"async_add_entities",
"(",
"[",
"MqttCamera",
"(",
"hass",
",",
"config",
",",
"config... | [
56,
0
] | [
60,
80
] | python | en | ['en', 'sv', 'en'] | True |
MqttCamera.__init__ | (self, hass, config, config_entry, discovery_data) | Initialize the MQTT Camera. | Initialize the MQTT Camera. | def __init__(self, hass, config, config_entry, discovery_data):
"""Initialize the MQTT Camera."""
self._last_image = None
Camera.__init__(self)
MqttEntity.__init__(self, hass, config, config_entry, discovery_data) | [
"def",
"__init__",
"(",
"self",
",",
"hass",
",",
"config",
",",
"config_entry",
",",
"discovery_data",
")",
":",
"self",
".",
"_last_image",
"=",
"None",
"Camera",
".",
"__init__",
"(",
"self",
")",
"MqttEntity",
".",
"__init__",
"(",
"self",
",",
"hass... | [
68,
4
] | [
73,
77
] | python | en | ['en', 'co', 'en'] | True |
MqttCamera.config_schema | () | Return the config schema. | Return the config schema. | def config_schema():
"""Return the config schema."""
return PLATFORM_SCHEMA | [
"def",
"config_schema",
"(",
")",
":",
"return",
"PLATFORM_SCHEMA"
] | [
76,
4
] | [
78,
30
] | python | en | ['en', 'de', 'en'] | True |
MqttCamera._subscribe_topics | (self) | (Re)Subscribe to topics. | (Re)Subscribe to topics. | async def _subscribe_topics(self):
"""(Re)Subscribe to topics."""
@callback
@log_messages(self.hass, self.entity_id)
def message_received(msg):
"""Handle new MQTT messages."""
self._last_image = msg.payload
self._sub_state = await subscription.async_subs... | [
"async",
"def",
"_subscribe_topics",
"(",
"self",
")",
":",
"@",
"callback",
"@",
"log_messages",
"(",
"self",
".",
"hass",
",",
"self",
".",
"entity_id",
")",
"def",
"message_received",
"(",
"msg",
")",
":",
"\"\"\"Handle new MQTT messages.\"\"\"",
"self",
".... | [
80,
4
] | [
100,
9
] | python | en | ['en', 'en', 'en'] | True |
MqttCamera.async_camera_image | (
self, width: int | None = None, height: int | None = None
) | Return image response. | Return image response. | async def async_camera_image(
self, width: int | None = None, height: int | None = None
) -> bytes | None:
"""Return image response."""
return self._last_image | [
"async",
"def",
"async_camera_image",
"(",
"self",
",",
"width",
":",
"int",
"|",
"None",
"=",
"None",
",",
"height",
":",
"int",
"|",
"None",
"=",
"None",
")",
"->",
"bytes",
"|",
"None",
":",
"return",
"self",
".",
"_last_image"
] | [
102,
4
] | [
106,
31
] | python | en | ['en', 'jv', 'en'] | True |
check_binary_sensors | (value: list[str]) | Validate binary sensor configurations. | Validate binary sensor configurations. | def check_binary_sensors(value: list[str]) -> list[str]:
"""Validate binary sensor configurations."""
for exclusive_options in _EXCLUSIVE_OPTIONS:
if len(set(value) & exclusive_options) > 1:
raise vol.Invalid(
f"must contain at most one of {', '.join(exclusive_options)}."
... | [
"def",
"check_binary_sensors",
"(",
"value",
":",
"list",
"[",
"str",
"]",
")",
"->",
"list",
"[",
"str",
"]",
":",
"for",
"exclusive_options",
"in",
"_EXCLUSIVE_OPTIONS",
":",
"if",
"len",
"(",
"set",
"(",
"value",
")",
"&",
"exclusive_options",
")",
">... | [
125,
0
] | [
132,
16
] | python | en | ['en', 'ky', 'en'] | True |
async_setup_platform | (
hass: HomeAssistant,
config: ConfigType,
async_add_entities: AddEntitiesCallback,
discovery_info: DiscoveryInfoType | None = None,
) | Set up a binary sensor for an Amcrest IP Camera. | Set up a binary sensor for an Amcrest IP Camera. | async def async_setup_platform(
hass: HomeAssistant,
config: ConfigType,
async_add_entities: AddEntitiesCallback,
discovery_info: DiscoveryInfoType | None = None,
) -> None:
"""Set up a binary sensor for an Amcrest IP Camera."""
if discovery_info is None:
return
name = discovery_inf... | [
"async",
"def",
"async_setup_platform",
"(",
"hass",
":",
"HomeAssistant",
",",
"config",
":",
"ConfigType",
",",
"async_add_entities",
":",
"AddEntitiesCallback",
",",
"discovery_info",
":",
"DiscoveryInfoType",
"|",
"None",
"=",
"None",
",",
")",
"->",
"None",
... | [
135,
0
] | [
155,
5
] | python | en | ['en', 'pt', 'en'] | True |
AmcrestBinarySensor.__init__ | (
self,
name: str,
device: AmcrestDevice,
entity_description: AmcrestSensorEntityDescription,
) | Initialize entity. | Initialize entity. | def __init__(
self,
name: str,
device: AmcrestDevice,
entity_description: AmcrestSensorEntityDescription,
) -> None:
"""Initialize entity."""
self._signal_name = name
self._api = device.api
self.entity_description: AmcrestSensorEntityDescription = enti... | [
"def",
"__init__",
"(",
"self",
",",
"name",
":",
"str",
",",
"device",
":",
"AmcrestDevice",
",",
"entity_description",
":",
"AmcrestSensorEntityDescription",
",",
")",
"->",
"None",
":",
"self",
".",
"_signal_name",
"=",
"name",
"self",
".",
"_api",
"=",
... | [
161,
4
] | [
174,
61
] | python | es | ['es', 'pl', 'it'] | False |
AmcrestBinarySensor.available | (self) | Return True if entity is available. | Return True if entity is available. | def available(self) -> bool:
"""Return True if entity is available."""
return self.entity_description.key == _ONLINE_KEY or self._api.available | [
"def",
"available",
"(",
"self",
")",
"->",
"bool",
":",
"return",
"self",
".",
"entity_description",
".",
"key",
"==",
"_ONLINE_KEY",
"or",
"self",
".",
"_api",
".",
"available"
] | [
177,
4
] | [
179,
80
] | python | en | ['en', 'en', 'en'] | True |
AmcrestBinarySensor.update | (self) | Update entity. | Update entity. | def update(self) -> None:
"""Update entity."""
if self.entity_description.key == _ONLINE_KEY:
self._update_online()
else:
self._update_others() | [
"def",
"update",
"(",
"self",
")",
"->",
"None",
":",
"if",
"self",
".",
"entity_description",
".",
"key",
"==",
"_ONLINE_KEY",
":",
"self",
".",
"_update_online",
"(",
")",
"else",
":",
"self",
".",
"_update_others",
"(",
")"
] | [
181,
4
] | [
186,
33
] | python | en | ['es', 'en', 'en'] | False |
AmcrestBinarySensor.async_on_demand_update | (self) | Update state. | Update state. | async def async_on_demand_update(self) -> None:
"""Update state."""
if self.entity_description.key == _ONLINE_KEY:
_LOGGER.debug(_UPDATE_MSG, self.name)
self._attr_is_on = self._api.available
self.async_write_ha_state()
else:
self.async_schedule_up... | [
"async",
"def",
"async_on_demand_update",
"(",
"self",
")",
"->",
"None",
":",
"if",
"self",
".",
"entity_description",
".",
"key",
"==",
"_ONLINE_KEY",
":",
"_LOGGER",
".",
"debug",
"(",
"_UPDATE_MSG",
",",
"self",
".",
"name",
")",
"self",
".",
"_attr_is... | [
216,
4
] | [
223,
53
] | python | en | ['en', 'co', 'en'] | False |
AmcrestBinarySensor.async_event_received | (self, state: bool) | Update state from received event. | Update state from received event. | def async_event_received(self, state: bool) -> None:
"""Update state from received event."""
_LOGGER.debug(_UPDATE_MSG, self.name)
self._attr_is_on = state
self.async_write_ha_state() | [
"def",
"async_event_received",
"(",
"self",
",",
"state",
":",
"bool",
")",
"->",
"None",
":",
"_LOGGER",
".",
"debug",
"(",
"_UPDATE_MSG",
",",
"self",
".",
"name",
")",
"self",
".",
"_attr_is_on",
"=",
"state",
"self",
".",
"async_write_ha_state",
"(",
... | [
226,
4
] | [
230,
35
] | python | en | ['en', 'en', 'en'] | True |
AmcrestBinarySensor.async_added_to_hass | (self) | Subscribe to signals. | Subscribe to signals. | async def async_added_to_hass(self) -> None:
"""Subscribe to signals."""
self._unsub_dispatcher.append(
async_dispatcher_connect(
self.hass,
service_signal(SERVICE_UPDATE, self._signal_name),
self.async_on_demand_update,
)
)... | [
"async",
"def",
"async_added_to_hass",
"(",
"self",
")",
"->",
"None",
":",
"self",
".",
"_unsub_dispatcher",
".",
"append",
"(",
"async_dispatcher_connect",
"(",
"self",
".",
"hass",
",",
"service_signal",
"(",
"SERVICE_UPDATE",
",",
"self",
".",
"_signal_name"... | [
232,
4
] | [
255,
13
] | python | en | ['en', 'en', 'en'] | True |
AmcrestBinarySensor.async_will_remove_from_hass | (self) | Disconnect from update signal. | Disconnect from update signal. | async def async_will_remove_from_hass(self) -> None:
"""Disconnect from update signal."""
for unsub_dispatcher in self._unsub_dispatcher:
unsub_dispatcher() | [
"async",
"def",
"async_will_remove_from_hass",
"(",
"self",
")",
"->",
"None",
":",
"for",
"unsub_dispatcher",
"in",
"self",
".",
"_unsub_dispatcher",
":",
"unsub_dispatcher",
"(",
")"
] | [
257,
4
] | [
260,
30
] | python | en | ['en', 'en', 'en'] | True |
valid_uuid_or_None | (s) |
Returns if `s` is a valid UUID string.
|
Returns if `s` is a valid UUID string.
| def valid_uuid_or_None(s):
"""
Returns if `s` is a valid UUID string.
"""
if not s:
return None
try:
return str(uuid.UUID(s))
except Exception:
return None | [
"def",
"valid_uuid_or_None",
"(",
"s",
")",
":",
"if",
"not",
"s",
":",
"return",
"None",
"try",
":",
"return",
"str",
"(",
"uuid",
".",
"UUID",
"(",
"s",
")",
")",
"except",
"Exception",
":",
"return",
"None"
] | [
12,
0
] | [
21,
19
] | python | en | ['en', 'error', 'th'] | False |
test_siren | (hass, client, aeotec_zw164_siren, integration) | Test the siren entity. | Test the siren entity. | async def test_siren(hass, client, aeotec_zw164_siren, integration):
"""Test the siren entity."""
node = aeotec_zw164_siren
state = hass.states.get(SIREN_ENTITY)
assert state
assert state.state == STATE_OFF
assert state.attributes.get(ATTR_AVAILABLE_TONES) == {
0: "off",
1: "01D... | [
"async",
"def",
"test_siren",
"(",
"hass",
",",
"client",
",",
"aeotec_zw164_siren",
",",
"integration",
")",
":",
"node",
"=",
"aeotec_zw164_siren",
"state",
"=",
"hass",
".",
"states",
".",
"get",
"(",
"SIREN_ENTITY",
")",
"assert",
"state",
"assert",
"sta... | [
61,
0
] | [
201,
34
] | python | en | ['en', 'el-Latn', 'en'] | True |
test_config_with_sensor_passed_to_config_entry | (hass) | Test that configured options for a sensor are loaded. | Test that configured options for a sensor are loaded. | async def test_config_with_sensor_passed_to_config_entry(hass):
"""Test that configured options for a sensor are loaded."""
conf = {
CONF_SENSOR_ID: "12345abcde",
CONF_SHOW_ON_MAP: False,
CONF_SCAN_INTERVAL: 600,
}
with patch.object(
hass.config_entries.flow, "async_init... | [
"async",
"def",
"test_config_with_sensor_passed_to_config_entry",
"(",
"hass",
")",
":",
"conf",
"=",
"{",
"CONF_SENSOR_ID",
":",
"\"12345abcde\"",
",",
"CONF_SHOW_ON_MAP",
":",
"False",
",",
"CONF_SCAN_INTERVAL",
":",
"600",
",",
"}",
"with",
"patch",
".",
"objec... | [
9,
0
] | [
24,
56
] | python | en | ['en', 'en', 'en'] | True |
test_config_already_registered_not_passed_to_config_entry | (hass) | Test that an already registered sensor does not initiate an import. | Test that an already registered sensor does not initiate an import. | async def test_config_already_registered_not_passed_to_config_entry(hass):
"""Test that an already registered sensor does not initiate an import."""
conf = {CONF_SENSOR_ID: "12345abcde"}
with patch.object(
hass.config_entries.flow, "async_init"
) as mock_config_entries, patch.object(
lu... | [
"async",
"def",
"test_config_already_registered_not_passed_to_config_entry",
"(",
"hass",
")",
":",
"conf",
"=",
"{",
"CONF_SENSOR_ID",
":",
"\"12345abcde\"",
"}",
"with",
"patch",
".",
"object",
"(",
"hass",
".",
"config_entries",
".",
"flow",
",",
"\"async_init\""... | [
27,
0
] | [
38,
56
] | python | en | ['en', 'en', 'en'] | True |
async_setup_platform | (hass, config, async_add_entities, discovery_info=None) | Set up the Ness Alarm binary sensor devices. | Set up the Ness Alarm binary sensor devices. | async def async_setup_platform(hass, config, async_add_entities, discovery_info=None):
"""Set up the Ness Alarm binary sensor devices."""
if not discovery_info:
return
configured_zones = discovery_info[CONF_ZONES]
devices = []
for zone_config in configured_zones:
zone_type = zone_... | [
"async",
"def",
"async_setup_platform",
"(",
"hass",
",",
"config",
",",
"async_add_entities",
",",
"discovery_info",
"=",
"None",
")",
":",
"if",
"not",
"discovery_info",
":",
"return",
"configured_zones",
"=",
"discovery_info",
"[",
"CONF_ZONES",
"]",
"devices",... | [
15,
0
] | [
33,
31
] | python | en | ['en', 'pt', 'en'] | True |
NessZoneBinarySensor.__init__ | (self, zone_id, name, zone_type) | Initialize the binary_sensor. | Initialize the binary_sensor. | def __init__(self, zone_id, name, zone_type):
"""Initialize the binary_sensor."""
self._zone_id = zone_id
self._name = name
self._type = zone_type
self._state = 0 | [
"def",
"__init__",
"(",
"self",
",",
"zone_id",
",",
"name",
",",
"zone_type",
")",
":",
"self",
".",
"_zone_id",
"=",
"zone_id",
"self",
".",
"_name",
"=",
"name",
"self",
".",
"_type",
"=",
"zone_type",
"self",
".",
"_state",
"=",
"0"
] | [
39,
4
] | [
44,
23
] | python | en | ['en', 'haw', 'en'] | True |
NessZoneBinarySensor.async_added_to_hass | (self) | Register callbacks. | Register callbacks. | async def async_added_to_hass(self):
"""Register callbacks."""
self.async_on_remove(
async_dispatcher_connect(
self.hass, SIGNAL_ZONE_CHANGED, self._handle_zone_change
)
) | [
"async",
"def",
"async_added_to_hass",
"(",
"self",
")",
":",
"self",
".",
"async_on_remove",
"(",
"async_dispatcher_connect",
"(",
"self",
".",
"hass",
",",
"SIGNAL_ZONE_CHANGED",
",",
"self",
".",
"_handle_zone_change",
")",
")"
] | [
46,
4
] | [
52,
9
] | python | en | ['en', 'no', 'en'] | False |
NessZoneBinarySensor.name | (self) | Return the name of the entity. | Return the name of the entity. | def name(self):
"""Return the name of the entity."""
return self._name | [
"def",
"name",
"(",
"self",
")",
":",
"return",
"self",
".",
"_name"
] | [
55,
4
] | [
57,
25
] | python | en | ['en', 'en', 'en'] | True |
NessZoneBinarySensor.should_poll | (self) | No polling needed. | No polling needed. | def should_poll(self):
"""No polling needed."""
return False | [
"def",
"should_poll",
"(",
"self",
")",
":",
"return",
"False"
] | [
60,
4
] | [
62,
20
] | python | en | ['en', 'en', 'en'] | True |
NessZoneBinarySensor.is_on | (self) | Return true if sensor is on. | Return true if sensor is on. | def is_on(self):
"""Return true if sensor is on."""
return self._state == 1 | [
"def",
"is_on",
"(",
"self",
")",
":",
"return",
"self",
".",
"_state",
"==",
"1"
] | [
65,
4
] | [
67,
31
] | python | en | ['en', 'et', 'en'] | True |
NessZoneBinarySensor.device_class | (self) | Return the class of this sensor, from DEVICE_CLASSES. | Return the class of this sensor, from DEVICE_CLASSES. | def device_class(self):
"""Return the class of this sensor, from DEVICE_CLASSES."""
return self._type | [
"def",
"device_class",
"(",
"self",
")",
":",
"return",
"self",
".",
"_type"
] | [
70,
4
] | [
72,
25
] | python | en | ['en', 'en', 'en'] | True |
NessZoneBinarySensor._handle_zone_change | (self, data: ZoneChangedData) | Handle zone state update. | Handle zone state update. | def _handle_zone_change(self, data: ZoneChangedData):
"""Handle zone state update."""
if self._zone_id == data.zone_id:
self._state = data.state
self.async_write_ha_state() | [
"def",
"_handle_zone_change",
"(",
"self",
",",
"data",
":",
"ZoneChangedData",
")",
":",
"if",
"self",
".",
"_zone_id",
"==",
"data",
".",
"zone_id",
":",
"self",
".",
"_state",
"=",
"data",
".",
"state",
"self",
".",
"async_write_ha_state",
"(",
")"
] | [
75,
4
] | [
79,
39
] | python | en | ['pl', 'en', 'en'] | True |
test_build_import | () | Test the mingw32ccompiler.build_import_library, which builds a
`python.a` from the MSVC `python.lib`
| Test the mingw32ccompiler.build_import_library, which builds a
`python.a` from the MSVC `python.lib`
| def test_build_import():
'''Test the mingw32ccompiler.build_import_library, which builds a
`python.a` from the MSVC `python.lib`
'''
# make sure `nm.exe` exists and supports the current python version. This
# can get mixed up when the PATH has a 64-bit nm but the python is 32-bit
try:
o... | [
"def",
"test_build_import",
"(",
")",
":",
"# make sure `nm.exe` exists and supports the current python version. This",
"# can get mixed up when the PATH has a 64-bit nm but the python is 32-bit",
"try",
":",
"out",
"=",
"subprocess",
".",
"check_output",
"(",
"[",
"'nm.exe'",
",",... | [
9,
0
] | [
41,
52
] | python | en | ['en', 'en', 'en'] | True |
test_config_flow_single_account | (hass: HomeAssistant) | Test we get the form. | Test we get the form. | async def test_config_flow_single_account(hass: HomeAssistant):
"""Test we get the form."""
with patch(
"homeassistant.components.renault.async_setup_entry",
return_value=True,
) as mock_setup_entry:
result = await hass.config_entries.flow.async_init(
DOMAIN, context={"so... | [
"async",
"def",
"test_config_flow_single_account",
"(",
"hass",
":",
"HomeAssistant",
")",
":",
"with",
"patch",
"(",
"\"homeassistant.components.renault.async_setup_entry\"",
",",
"return_value",
"=",
"True",
",",
")",
"as",
"mock_setup_entry",
":",
"result",
"=",
"a... | [
23,
0
] | [
85,
48
] | python | en | ['en', 'en', 'en'] | True |
test_config_flow_no_account | (hass: HomeAssistant) | Test we get the form. | Test we get the form. | async def test_config_flow_no_account(hass: HomeAssistant):
"""Test we get the form."""
with patch(
"homeassistant.components.renault.async_setup_entry",
return_value=True,
) as mock_setup_entry:
result = await hass.config_entries.flow.async_init(
DOMAIN, context={"source... | [
"async",
"def",
"test_config_flow_no_account",
"(",
"hass",
":",
"HomeAssistant",
")",
":",
"with",
"patch",
"(",
"\"homeassistant.components.renault.async_setup_entry\"",
",",
"return_value",
"=",
"True",
",",
")",
"as",
"mock_setup_entry",
":",
"result",
"=",
"await... | [
88,
0
] | [
117,
48
] | python | en | ['en', 'en', 'en'] | True |
test_config_flow_multiple_accounts | (hass: HomeAssistant) | Test what happens if multiple Kamereon accounts are available. | Test what happens if multiple Kamereon accounts are available. | async def test_config_flow_multiple_accounts(hass: HomeAssistant):
"""Test what happens if multiple Kamereon accounts are available."""
with patch(
"homeassistant.components.renault.async_setup_entry",
return_value=True,
) as mock_setup_entry:
result = await hass.config_entries.flow.... | [
"async",
"def",
"test_config_flow_multiple_accounts",
"(",
"hass",
":",
"HomeAssistant",
")",
":",
"with",
"patch",
"(",
"\"homeassistant.components.renault.async_setup_entry\"",
",",
"return_value",
"=",
"True",
",",
")",
"as",
"mock_setup_entry",
":",
"result",
"=",
... | [
120,
0
] | [
170,
48
] | python | en | ['en', 'en', 'en'] | True |
test_config_flow_duplicate | (hass: HomeAssistant) | Test abort if unique_id configured. | Test abort if unique_id configured. | async def test_config_flow_duplicate(hass: HomeAssistant):
"""Test abort if unique_id configured."""
with patch(
"homeassistant.components.renault.async_setup_entry",
return_value=True,
) as mock_setup_entry:
get_mock_config_entry().add_to_hass(hass)
assert len(hass.config_en... | [
"async",
"def",
"test_config_flow_duplicate",
"(",
"hass",
":",
"HomeAssistant",
")",
":",
"with",
"patch",
"(",
"\"homeassistant.components.renault.async_setup_entry\"",
",",
"return_value",
"=",
"True",
",",
")",
"as",
"mock_setup_entry",
":",
"get_mock_config_entry",
... | [
173,
0
] | [
209,
48
] | python | en | ['fr', 'la', 'en'] | False |
test_reauth | (hass) | Test the start of the config flow. | Test the start of the config flow. | async def test_reauth(hass):
"""Test the start of the config flow."""
with patch(
"homeassistant.components.renault.async_setup_entry",
return_value=True,
):
original_entry = get_mock_config_entry()
original_entry.add_to_hass(hass)
assert len(hass.config_entries.async... | [
"async",
"def",
"test_reauth",
"(",
"hass",
")",
":",
"with",
"patch",
"(",
"\"homeassistant.components.renault.async_setup_entry\"",
",",
"return_value",
"=",
"True",
",",
")",
":",
"original_entry",
"=",
"get_mock_config_entry",
"(",
")",
"original_entry",
".",
"a... | [
212,
0
] | [
260,
55
] | python | en | ['en', 'en', 'en'] | True |
async_setup_entry | (hass, config_entry, async_add_entities) | Set up Homekit climate. | Set up Homekit climate. | async def async_setup_entry(hass, config_entry, async_add_entities):
"""Set up Homekit climate."""
hkid = config_entry.data["AccessoryPairingID"]
conn = hass.data[KNOWN_DEVICES][hkid]
@callback
def async_add_service(service):
entity_class = ENTITY_TYPES.get(service.short_type)
if no... | [
"async",
"def",
"async_setup_entry",
"(",
"hass",
",",
"config_entry",
",",
"async_add_entities",
")",
":",
"hkid",
"=",
"config_entry",
".",
"data",
"[",
"\"AccessoryPairingID\"",
"]",
"conn",
"=",
"hass",
".",
"data",
"[",
"KNOWN_DEVICES",
"]",
"[",
"hkid",
... | [
88,
0
] | [
102,
40
] | python | en | ['en', 'haw', 'en'] | True |
HomeKitHeaterCoolerEntity.get_characteristic_types | (self) | Define the homekit characteristics the entity cares about. | Define the homekit characteristics the entity cares about. | def get_characteristic_types(self):
"""Define the homekit characteristics the entity cares about."""
return [
CharacteristicsTypes.ACTIVE,
CharacteristicsTypes.CURRENT_HEATER_COOLER_STATE,
CharacteristicsTypes.TARGET_HEATER_COOLER_STATE,
CharacteristicsTyp... | [
"def",
"get_characteristic_types",
"(",
"self",
")",
":",
"return",
"[",
"CharacteristicsTypes",
".",
"ACTIVE",
",",
"CharacteristicsTypes",
".",
"CURRENT_HEATER_COOLER_STATE",
",",
"CharacteristicsTypes",
".",
"TARGET_HEATER_COOLER_STATE",
",",
"CharacteristicsTypes",
".",... | [
108,
4
] | [
118,
9
] | python | en | ['en', 'en', 'en'] | True |
HomeKitHeaterCoolerEntity.async_set_temperature | (self, **kwargs) | Set new target temperature. | Set new target temperature. | async def async_set_temperature(self, **kwargs):
"""Set new target temperature."""
temp = kwargs.get(ATTR_TEMPERATURE)
state = self.service.value(CharacteristicsTypes.TARGET_HEATER_COOLER_STATE)
if state == TargetHeaterCoolerStateValues.COOL:
await self.async_put_characterist... | [
"async",
"def",
"async_set_temperature",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"temp",
"=",
"kwargs",
".",
"get",
"(",
"ATTR_TEMPERATURE",
")",
"state",
"=",
"self",
".",
"service",
".",
"value",
"(",
"CharacteristicsTypes",
".",
"TARGET_HEATER_COO... | [
120,
4
] | [
139,
13
] | python | en | ['en', 'ca', 'en'] | True |
HomeKitHeaterCoolerEntity.async_set_hvac_mode | (self, hvac_mode) | Set new target operation mode. | Set new target operation mode. | async def async_set_hvac_mode(self, hvac_mode):
"""Set new target operation mode."""
if hvac_mode == HVAC_MODE_OFF:
await self.async_put_characteristics(
{CharacteristicsTypes.ACTIVE: ActivationStateValues.INACTIVE}
)
return
if hvac_mode not in... | [
"async",
"def",
"async_set_hvac_mode",
"(",
"self",
",",
"hvac_mode",
")",
":",
"if",
"hvac_mode",
"==",
"HVAC_MODE_OFF",
":",
"await",
"self",
".",
"async_put_characteristics",
"(",
"{",
"CharacteristicsTypes",
".",
"ACTIVE",
":",
"ActivationStateValues",
".",
"I... | [
141,
4
] | [
161,
9
] | python | en | ['nl', 'en', 'en'] | True |
HomeKitHeaterCoolerEntity.current_temperature | (self) | Return the current temperature. | Return the current temperature. | def current_temperature(self):
"""Return the current temperature."""
return self.service.value(CharacteristicsTypes.TEMPERATURE_CURRENT) | [
"def",
"current_temperature",
"(",
"self",
")",
":",
"return",
"self",
".",
"service",
".",
"value",
"(",
"CharacteristicsTypes",
".",
"TEMPERATURE_CURRENT",
")"
] | [
164,
4
] | [
166,
75
] | python | en | ['en', 'la', 'en'] | True |
HomeKitHeaterCoolerEntity.target_temperature | (self) | Return the temperature we try to reach. | Return the temperature we try to reach. | def target_temperature(self):
"""Return the temperature we try to reach."""
state = self.service.value(CharacteristicsTypes.TARGET_HEATER_COOLER_STATE)
if state == TargetHeaterCoolerStateValues.COOL:
return self.service.value(
CharacteristicsTypes.TEMPERATURE_COOLING_... | [
"def",
"target_temperature",
"(",
"self",
")",
":",
"state",
"=",
"self",
".",
"service",
".",
"value",
"(",
"CharacteristicsTypes",
".",
"TARGET_HEATER_COOLER_STATE",
")",
"if",
"state",
"==",
"TargetHeaterCoolerStateValues",
".",
"COOL",
":",
"return",
"self",
... | [
169,
4
] | [
180,
19
] | python | en | ['en', 'en', 'en'] | True |
HomeKitHeaterCoolerEntity.target_temperature_step | (self) | Return the supported step of target temperature. | Return the supported step of target temperature. | def target_temperature_step(self):
"""Return the supported step of target temperature."""
state = self.service.value(CharacteristicsTypes.TARGET_HEATER_COOLER_STATE)
if state == TargetHeaterCoolerStateValues.COOL and self.service.has(
CharacteristicsTypes.TEMPERATURE_COOLING_THRESHOL... | [
"def",
"target_temperature_step",
"(",
"self",
")",
":",
"state",
"=",
"self",
".",
"service",
".",
"value",
"(",
"CharacteristicsTypes",
".",
"TARGET_HEATER_COOLER_STATE",
")",
"if",
"state",
"==",
"TargetHeaterCoolerStateValues",
".",
"COOL",
"and",
"self",
".",... | [
183,
4
] | [
198,
19
] | python | en | ['en', 'en', 'en'] | True |
HomeKitHeaterCoolerEntity.min_temp | (self) | Return the minimum target temp. | Return the minimum target temp. | def min_temp(self):
"""Return the minimum target temp."""
state = self.service.value(CharacteristicsTypes.TARGET_HEATER_COOLER_STATE)
if state == TargetHeaterCoolerStateValues.COOL and self.service.has(
CharacteristicsTypes.TEMPERATURE_COOLING_THRESHOLD
):
return ... | [
"def",
"min_temp",
"(",
"self",
")",
":",
"state",
"=",
"self",
".",
"service",
".",
"value",
"(",
"CharacteristicsTypes",
".",
"TARGET_HEATER_COOLER_STATE",
")",
"if",
"state",
"==",
"TargetHeaterCoolerStateValues",
".",
"COOL",
"and",
"self",
".",
"service",
... | [
201,
4
] | [
216,
31
] | python | en | ['en', 'hi-Latn', 'en'] | True |
HomeKitHeaterCoolerEntity.max_temp | (self) | Return the maximum target temp. | Return the maximum target temp. | def max_temp(self):
"""Return the maximum target temp."""
state = self.service.value(CharacteristicsTypes.TARGET_HEATER_COOLER_STATE)
if state == TargetHeaterCoolerStateValues.COOL and self.service.has(
CharacteristicsTypes.TEMPERATURE_COOLING_THRESHOLD
):
return ... | [
"def",
"max_temp",
"(",
"self",
")",
":",
"state",
"=",
"self",
".",
"service",
".",
"value",
"(",
"CharacteristicsTypes",
".",
"TARGET_HEATER_COOLER_STATE",
")",
"if",
"state",
"==",
"TargetHeaterCoolerStateValues",
".",
"COOL",
"and",
"self",
".",
"service",
... | [
219,
4
] | [
234,
31
] | python | en | ['en', 'ms', 'en'] | True |
HomeKitHeaterCoolerEntity.hvac_action | (self) | Return the current running hvac operation. | Return the current running hvac operation. | def hvac_action(self):
"""Return the current running hvac operation."""
# This characteristic describes the current mode of a device,
# e.g. a thermostat is "heating" a room to 75 degrees Fahrenheit.
# Can be 0 - 3 (Off, Idle, Heat, Cool)
if (
self.service.value(Chara... | [
"def",
"hvac_action",
"(",
"self",
")",
":",
"# This characteristic describes the current mode of a device,",
"# e.g. a thermostat is \"heating\" a room to 75 degrees Fahrenheit.",
"# Can be 0 - 3 (Off, Idle, Heat, Cool)",
"if",
"(",
"self",
".",
"service",
".",
"value",
"(",
"Char... | [
237,
4
] | [
248,
69
] | python | en | ['en', 'is', 'en'] | True |
HomeKitHeaterCoolerEntity.hvac_mode | (self) | Return hvac operation ie. heat, cool mode. | Return hvac operation ie. heat, cool mode. | def hvac_mode(self):
"""Return hvac operation ie. heat, cool mode."""
# This characteristic describes the target mode
# E.g. should the device start heating a room if the temperature
# falls below the target temperature.
# Can be 0 - 2 (Auto, Heat, Cool)
if (
... | [
"def",
"hvac_mode",
"(",
"self",
")",
":",
"# This characteristic describes the target mode",
"# E.g. should the device start heating a room if the temperature",
"# falls below the target temperature.",
"# Can be 0 - 2 (Auto, Heat, Cool)",
"if",
"(",
"self",
".",
"service",
".",
"val... | [
251,
4
] | [
263,
68
] | python | bg | ['en', 'bg', 'bg'] | True |
HomeKitHeaterCoolerEntity.hvac_modes | (self) | Return the list of available hvac operation modes. | Return the list of available hvac operation modes. | def hvac_modes(self):
"""Return the list of available hvac operation modes."""
valid_values = clamp_enum_to_char(
TargetHeaterCoolerStateValues,
self.service[CharacteristicsTypes.TARGET_HEATER_COOLER_STATE],
)
modes = [
TARGET_HEATER_COOLER_STATE_HOMEK... | [
"def",
"hvac_modes",
"(",
"self",
")",
":",
"valid_values",
"=",
"clamp_enum_to_char",
"(",
"TargetHeaterCoolerStateValues",
",",
"self",
".",
"service",
"[",
"CharacteristicsTypes",
".",
"TARGET_HEATER_COOLER_STATE",
"]",
",",
")",
"modes",
"=",
"[",
"TARGET_HEATER... | [
266,
4
] | [
276,
20
] | python | en | ['en', 'en', 'en'] | True |
HomeKitHeaterCoolerEntity.swing_mode | (self) | Return the swing setting.
Requires SUPPORT_SWING_MODE.
| Return the swing setting. | def swing_mode(self):
"""Return the swing setting.
Requires SUPPORT_SWING_MODE.
"""
value = self.service.value(CharacteristicsTypes.SWING_MODE)
return SWING_MODE_HOMEKIT_TO_HASS[value] | [
"def",
"swing_mode",
"(",
"self",
")",
":",
"value",
"=",
"self",
".",
"service",
".",
"value",
"(",
"CharacteristicsTypes",
".",
"SWING_MODE",
")",
"return",
"SWING_MODE_HOMEKIT_TO_HASS",
"[",
"value",
"]"
] | [
279,
4
] | [
285,
48
] | python | en | ['en', 'ig', 'en'] | True |
HomeKitHeaterCoolerEntity.swing_modes | (self) | Return the list of available swing modes.
Requires SUPPORT_SWING_MODE.
| Return the list of available swing modes. | def swing_modes(self):
"""Return the list of available swing modes.
Requires SUPPORT_SWING_MODE.
"""
valid_values = clamp_enum_to_char(
SwingModeValues,
self.service[CharacteristicsTypes.SWING_MODE],
)
return [SWING_MODE_HOMEKIT_TO_HASS[mode] for ... | [
"def",
"swing_modes",
"(",
"self",
")",
":",
"valid_values",
"=",
"clamp_enum_to_char",
"(",
"SwingModeValues",
",",
"self",
".",
"service",
"[",
"CharacteristicsTypes",
".",
"SWING_MODE",
"]",
",",
")",
"return",
"[",
"SWING_MODE_HOMEKIT_TO_HASS",
"[",
"mode",
... | [
288,
4
] | [
297,
74
] | python | en | ['en', 'en', 'en'] | True |
HomeKitHeaterCoolerEntity.async_set_swing_mode | (self, swing_mode: str) | Set new target swing operation. | Set new target swing operation. | async def async_set_swing_mode(self, swing_mode: str) -> None:
"""Set new target swing operation."""
await self.async_put_characteristics(
{CharacteristicsTypes.SWING_MODE: SWING_MODE_HASS_TO_HOMEKIT[swing_mode]}
) | [
"async",
"def",
"async_set_swing_mode",
"(",
"self",
",",
"swing_mode",
":",
"str",
")",
"->",
"None",
":",
"await",
"self",
".",
"async_put_characteristics",
"(",
"{",
"CharacteristicsTypes",
".",
"SWING_MODE",
":",
"SWING_MODE_HASS_TO_HOMEKIT",
"[",
"swing_mode",
... | [
299,
4
] | [
303,
9
] | python | en | ['en', 'en', 'en'] | True |
HomeKitHeaterCoolerEntity.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."""
features = 0
if self.service.has(CharacteristicsTypes.TEMPERATURE_COOLING_THRESHOLD):
features |= SUPPORT_TARGET_TEMPERATURE
if self.service.has(CharacteristicsTypes.TEMPERATURE_HEATING_THRESHOLD):
... | [
"def",
"supported_features",
"(",
"self",
")",
":",
"features",
"=",
"0",
"if",
"self",
".",
"service",
".",
"has",
"(",
"CharacteristicsTypes",
".",
"TEMPERATURE_COOLING_THRESHOLD",
")",
":",
"features",
"|=",
"SUPPORT_TARGET_TEMPERATURE",
"if",
"self",
".",
"s... | [
306,
4
] | [
319,
23
] | python | en | ['en', 'en', 'en'] | True |
HomeKitHeaterCoolerEntity.temperature_unit | (self) | Return the unit of measurement. | Return the unit of measurement. | def temperature_unit(self):
"""Return the unit of measurement."""
return TEMP_CELSIUS | [
"def",
"temperature_unit",
"(",
"self",
")",
":",
"return",
"TEMP_CELSIUS"
] | [
322,
4
] | [
324,
27
] | python | en | ['en', 'la', 'en'] | True |
HomeKitClimateEntity.get_characteristic_types | (self) | Define the homekit characteristics the entity cares about. | Define the homekit characteristics the entity cares about. | def get_characteristic_types(self):
"""Define the homekit characteristics the entity cares about."""
return [
CharacteristicsTypes.HEATING_COOLING_CURRENT,
CharacteristicsTypes.HEATING_COOLING_TARGET,
CharacteristicsTypes.TEMPERATURE_COOLING_THRESHOLD,
Cha... | [
"def",
"get_characteristic_types",
"(",
"self",
")",
":",
"return",
"[",
"CharacteristicsTypes",
".",
"HEATING_COOLING_CURRENT",
",",
"CharacteristicsTypes",
".",
"HEATING_COOLING_TARGET",
",",
"CharacteristicsTypes",
".",
"TEMPERATURE_COOLING_THRESHOLD",
",",
"Characteristic... | [
330,
4
] | [
341,
9
] | python | en | ['en', 'en', 'en'] | True |
HomeKitClimateEntity.async_set_temperature | (self, **kwargs) | Set new target temperature. | Set new target temperature. | async def async_set_temperature(self, **kwargs):
"""Set new target temperature."""
chars = {}
value = self.service.value(CharacteristicsTypes.HEATING_COOLING_TARGET)
mode = MODE_HOMEKIT_TO_HASS.get(value)
if kwargs.get(ATTR_HVAC_MODE, mode) != mode:
mode = kwargs[AT... | [
"async",
"def",
"async_set_temperature",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"chars",
"=",
"{",
"}",
"value",
"=",
"self",
".",
"service",
".",
"value",
"(",
"CharacteristicsTypes",
".",
"HEATING_COOLING_TARGET",
")",
"mode",
"=",
"MODE_HOMEKIT_T... | [
343,
4
] | [
375,
51
] | python | en | ['en', 'ca', 'en'] | True |
HomeKitClimateEntity.async_set_humidity | (self, humidity) | Set new target humidity. | Set new target humidity. | async def async_set_humidity(self, humidity):
"""Set new target humidity."""
await self.async_put_characteristics(
{CharacteristicsTypes.RELATIVE_HUMIDITY_TARGET: humidity}
) | [
"async",
"def",
"async_set_humidity",
"(",
"self",
",",
"humidity",
")",
":",
"await",
"self",
".",
"async_put_characteristics",
"(",
"{",
"CharacteristicsTypes",
".",
"RELATIVE_HUMIDITY_TARGET",
":",
"humidity",
"}",
")"
] | [
377,
4
] | [
381,
9
] | python | en | ['en', 'en', 'en'] | True |
HomeKitClimateEntity.async_set_hvac_mode | (self, hvac_mode) | Set new target operation mode. | Set new target operation mode. | async def async_set_hvac_mode(self, hvac_mode):
"""Set new target operation mode."""
await self.async_put_characteristics(
{
CharacteristicsTypes.HEATING_COOLING_TARGET: MODE_HASS_TO_HOMEKIT[
hvac_mode
],
}
) | [
"async",
"def",
"async_set_hvac_mode",
"(",
"self",
",",
"hvac_mode",
")",
":",
"await",
"self",
".",
"async_put_characteristics",
"(",
"{",
"CharacteristicsTypes",
".",
"HEATING_COOLING_TARGET",
":",
"MODE_HASS_TO_HOMEKIT",
"[",
"hvac_mode",
"]",
",",
"}",
")"
] | [
383,
4
] | [
391,
9
] | python | en | ['nl', 'en', 'en'] | True |
HomeKitClimateEntity.current_temperature | (self) | Return the current temperature. | Return the current temperature. | def current_temperature(self):
"""Return the current temperature."""
return self.service.value(CharacteristicsTypes.TEMPERATURE_CURRENT) | [
"def",
"current_temperature",
"(",
"self",
")",
":",
"return",
"self",
".",
"service",
".",
"value",
"(",
"CharacteristicsTypes",
".",
"TEMPERATURE_CURRENT",
")"
] | [
394,
4
] | [
396,
75
] | python | en | ['en', 'la', 'en'] | True |
HomeKitClimateEntity.target_temperature | (self) | Return the temperature we try to reach. | Return the temperature we try to reach. | def target_temperature(self):
"""Return the temperature we try to reach."""
value = self.service.value(CharacteristicsTypes.HEATING_COOLING_TARGET)
if (MODE_HOMEKIT_TO_HASS.get(value) in {HVAC_MODE_HEAT, HVAC_MODE_COOL}) or (
(MODE_HOMEKIT_TO_HASS.get(value) in {HVAC_MODE_HEAT_COOL})... | [
"def",
"target_temperature",
"(",
"self",
")",
":",
"value",
"=",
"self",
".",
"service",
".",
"value",
"(",
"CharacteristicsTypes",
".",
"HEATING_COOLING_TARGET",
")",
"if",
"(",
"MODE_HOMEKIT_TO_HASS",
".",
"get",
"(",
"value",
")",
"in",
"{",
"HVAC_MODE_HEA... | [
399,
4
] | [
407,
19
] | python | en | ['en', 'en', 'en'] | True |
HomeKitClimateEntity.target_temperature_high | (self) | Return the highbound target temperature we try to reach. | Return the highbound target temperature we try to reach. | def target_temperature_high(self):
"""Return the highbound target temperature we try to reach."""
value = self.service.value(CharacteristicsTypes.HEATING_COOLING_TARGET)
if (MODE_HOMEKIT_TO_HASS.get(value) in {HVAC_MODE_HEAT_COOL}) and (
SUPPORT_TARGET_TEMPERATURE_RANGE & self.suppor... | [
"def",
"target_temperature_high",
"(",
"self",
")",
":",
"value",
"=",
"self",
".",
"service",
".",
"value",
"(",
"CharacteristicsTypes",
".",
"HEATING_COOLING_TARGET",
")",
"if",
"(",
"MODE_HOMEKIT_TO_HASS",
".",
"get",
"(",
"value",
")",
"in",
"{",
"HVAC_MOD... | [
410,
4
] | [
419,
19
] | python | en | ['en', 'en', 'en'] | True |
HomeKitClimateEntity.target_temperature_low | (self) | Return the lowbound target temperature we try to reach. | Return the lowbound target temperature we try to reach. | def target_temperature_low(self):
"""Return the lowbound target temperature we try to reach."""
value = self.service.value(CharacteristicsTypes.HEATING_COOLING_TARGET)
if (MODE_HOMEKIT_TO_HASS.get(value) in {HVAC_MODE_HEAT_COOL}) and (
SUPPORT_TARGET_TEMPERATURE_RANGE & self.supporte... | [
"def",
"target_temperature_low",
"(",
"self",
")",
":",
"value",
"=",
"self",
".",
"service",
".",
"value",
"(",
"CharacteristicsTypes",
".",
"HEATING_COOLING_TARGET",
")",
"if",
"(",
"MODE_HOMEKIT_TO_HASS",
".",
"get",
"(",
"value",
")",
"in",
"{",
"HVAC_MODE... | [
422,
4
] | [
431,
19
] | python | en | ['en', 'en', 'en'] | True |
HomeKitClimateEntity.min_temp | (self) | Return the minimum target temp. | Return the minimum target temp. | def min_temp(self):
"""Return the minimum target temp."""
value = self.service.value(CharacteristicsTypes.HEATING_COOLING_TARGET)
if (MODE_HOMEKIT_TO_HASS.get(value) in {HVAC_MODE_HEAT_COOL}) and (
SUPPORT_TARGET_TEMPERATURE_RANGE & self.supported_features
):
min_... | [
"def",
"min_temp",
"(",
"self",
")",
":",
"value",
"=",
"self",
".",
"service",
".",
"value",
"(",
"CharacteristicsTypes",
".",
"HEATING_COOLING_TARGET",
")",
"if",
"(",
"MODE_HOMEKIT_TO_HASS",
".",
"get",
"(",
"value",
")",
"in",
"{",
"HVAC_MODE_HEAT_COOL",
... | [
434,
4
] | [
453,
31
] | python | en | ['en', 'hi-Latn', 'en'] | True |
HomeKitClimateEntity.max_temp | (self) | Return the maximum target temp. | Return the maximum target temp. | def max_temp(self):
"""Return the maximum target temp."""
value = self.service.value(CharacteristicsTypes.HEATING_COOLING_TARGET)
if (MODE_HOMEKIT_TO_HASS.get(value) in {HVAC_MODE_HEAT_COOL}) and (
SUPPORT_TARGET_TEMPERATURE_RANGE & self.supported_features
):
max_... | [
"def",
"max_temp",
"(",
"self",
")",
":",
"value",
"=",
"self",
".",
"service",
".",
"value",
"(",
"CharacteristicsTypes",
".",
"HEATING_COOLING_TARGET",
")",
"if",
"(",
"MODE_HOMEKIT_TO_HASS",
".",
"get",
"(",
"value",
")",
"in",
"{",
"HVAC_MODE_HEAT_COOL",
... | [
456,
4
] | [
475,
31
] | python | en | ['en', 'ms', 'en'] | True |
HomeKitClimateEntity.current_humidity | (self) | Return the current humidity. | Return the current humidity. | def current_humidity(self):
"""Return the current humidity."""
return self.service.value(CharacteristicsTypes.RELATIVE_HUMIDITY_CURRENT) | [
"def",
"current_humidity",
"(",
"self",
")",
":",
"return",
"self",
".",
"service",
".",
"value",
"(",
"CharacteristicsTypes",
".",
"RELATIVE_HUMIDITY_CURRENT",
")"
] | [
478,
4
] | [
480,
81
] | python | en | ['en', 'en', 'en'] | True |
HomeKitClimateEntity.target_humidity | (self) | Return the humidity we try to reach. | Return the humidity we try to reach. | def target_humidity(self):
"""Return the humidity we try to reach."""
return self.service.value(CharacteristicsTypes.RELATIVE_HUMIDITY_TARGET) | [
"def",
"target_humidity",
"(",
"self",
")",
":",
"return",
"self",
".",
"service",
".",
"value",
"(",
"CharacteristicsTypes",
".",
"RELATIVE_HUMIDITY_TARGET",
")"
] | [
483,
4
] | [
485,
80
] | python | en | ['en', 'en', 'en'] | True |
HomeKitClimateEntity.min_humidity | (self) | Return the minimum humidity. | Return the minimum humidity. | def min_humidity(self):
"""Return the minimum humidity."""
char = self.service[CharacteristicsTypes.RELATIVE_HUMIDITY_TARGET]
return char.minValue or DEFAULT_MIN_HUMIDITY | [
"def",
"min_humidity",
"(",
"self",
")",
":",
"char",
"=",
"self",
".",
"service",
"[",
"CharacteristicsTypes",
".",
"RELATIVE_HUMIDITY_TARGET",
"]",
"return",
"char",
".",
"minValue",
"or",
"DEFAULT_MIN_HUMIDITY"
] | [
488,
4
] | [
491,
52
] | python | en | ['en', 'et', 'en'] | True |
HomeKitClimateEntity.max_humidity | (self) | Return the maximum humidity. | Return the maximum humidity. | def max_humidity(self):
"""Return the maximum humidity."""
char = self.service[CharacteristicsTypes.RELATIVE_HUMIDITY_TARGET]
return char.maxValue or DEFAULT_MAX_HUMIDITY | [
"def",
"max_humidity",
"(",
"self",
")",
":",
"char",
"=",
"self",
".",
"service",
"[",
"CharacteristicsTypes",
".",
"RELATIVE_HUMIDITY_TARGET",
"]",
"return",
"char",
".",
"maxValue",
"or",
"DEFAULT_MAX_HUMIDITY"
] | [
494,
4
] | [
497,
52
] | python | en | ['en', 'la', 'en'] | True |
HomeKitClimateEntity.hvac_action | (self) | Return the current running hvac operation. | Return the current running hvac operation. | def hvac_action(self):
"""Return the current running hvac operation."""
# This characteristic describes the current mode of a device,
# e.g. a thermostat is "heating" a room to 75 degrees Fahrenheit.
# Can be 0 - 2 (Off, Heat, Cool)
value = self.service.value(CharacteristicsTypes... | [
"def",
"hvac_action",
"(",
"self",
")",
":",
"# This characteristic describes the current mode of a device,",
"# e.g. a thermostat is \"heating\" a room to 75 degrees Fahrenheit.",
"# Can be 0 - 2 (Off, Heat, Cool)",
"value",
"=",
"self",
".",
"service",
".",
"value",
"(",
"Charact... | [
500,
4
] | [
506,
54
] | python | en | ['en', 'is', 'en'] | True |
HomeKitClimateEntity.hvac_mode | (self) | Return hvac operation ie. heat, cool mode. | Return hvac operation ie. heat, cool mode. | def hvac_mode(self):
"""Return hvac operation ie. heat, cool mode."""
# This characteristic describes the target mode
# E.g. should the device start heating a room if the temperature
# falls below the target temperature.
# Can be 0 - 3 (Off, Heat, Cool, Auto)
value = self... | [
"def",
"hvac_mode",
"(",
"self",
")",
":",
"# This characteristic describes the target mode",
"# E.g. should the device start heating a room if the temperature",
"# falls below the target temperature.",
"# Can be 0 - 3 (Off, Heat, Cool, Auto)",
"value",
"=",
"self",
".",
"service",
"."... | [
509,
4
] | [
516,
46
] | python | bg | ['en', 'bg', 'bg'] | True |
HomeKitClimateEntity.hvac_modes | (self) | Return the list of available hvac operation modes. | Return the list of available hvac operation modes. | def hvac_modes(self):
"""Return the list of available hvac operation modes."""
valid_values = clamp_enum_to_char(
HeatingCoolingTargetValues,
self.service[CharacteristicsTypes.HEATING_COOLING_TARGET],
)
return [MODE_HOMEKIT_TO_HASS[mode] for mode in valid_values] | [
"def",
"hvac_modes",
"(",
"self",
")",
":",
"valid_values",
"=",
"clamp_enum_to_char",
"(",
"HeatingCoolingTargetValues",
",",
"self",
".",
"service",
"[",
"CharacteristicsTypes",
".",
"HEATING_COOLING_TARGET",
"]",
",",
")",
"return",
"[",
"MODE_HOMEKIT_TO_HASS",
"... | [
519,
4
] | [
525,
68
] | python | en | ['en', 'en', 'en'] | True |
HomeKitClimateEntity.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."""
features = 0
if self.service.has(CharacteristicsTypes.TEMPERATURE_TARGET):
features |= SUPPORT_TARGET_TEMPERATURE
if self.service.has(
CharacteristicsTypes.TEMPERATURE_COOLING_THRESHOLD
... | [
"def",
"supported_features",
"(",
"self",
")",
":",
"features",
"=",
"0",
"if",
"self",
".",
"service",
".",
"has",
"(",
"CharacteristicsTypes",
".",
"TEMPERATURE_TARGET",
")",
":",
"features",
"|=",
"SUPPORT_TARGET_TEMPERATURE",
"if",
"self",
".",
"service",
... | [
528,
4
] | [
543,
23
] | python | en | ['en', 'en', 'en'] | True |
HomeKitClimateEntity.temperature_unit | (self) | Return the unit of measurement. | Return the unit of measurement. | def temperature_unit(self):
"""Return the unit of measurement."""
return TEMP_CELSIUS | [
"def",
"temperature_unit",
"(",
"self",
")",
":",
"return",
"TEMP_CELSIUS"
] | [
546,
4
] | [
548,
27
] | python | en | ['en', 'la', 'en'] | True |
RachioDevice.__init__ | (self, controller) | Initialize a Rachio device. | Initialize a Rachio device. | def __init__(self, controller):
"""Initialize a Rachio device."""
super().__init__()
self._controller = controller | [
"def",
"__init__",
"(",
"self",
",",
"controller",
")",
":",
"super",
"(",
")",
".",
"__init__",
"(",
")",
"self",
".",
"_controller",
"=",
"controller"
] | [
11,
4
] | [
14,
37
] | python | it | ['it', 'en', 'it'] | True |
RachioDevice.should_poll | (self) | Declare that this entity pushes its state to HA. | Declare that this entity pushes its state to HA. | def should_poll(self) -> bool:
"""Declare that this entity pushes its state to HA."""
return False | [
"def",
"should_poll",
"(",
"self",
")",
"->",
"bool",
":",
"return",
"False"
] | [
17,
4
] | [
19,
20
] | python | en | ['en', 'en', 'en'] | True |
RachioDevice.device_info | (self) | Return the device_info of the device. | Return the device_info of the device. | def device_info(self):
"""Return the device_info of the device."""
return {
"identifiers": {
(
DOMAIN,
self._controller.serial_number,
)
},
"connections": {
(
d... | [
"def",
"device_info",
"(",
"self",
")",
":",
"return",
"{",
"\"identifiers\"",
":",
"{",
"(",
"DOMAIN",
",",
"self",
".",
"_controller",
".",
"serial_number",
",",
")",
"}",
",",
"\"connections\"",
":",
"{",
"(",
"device_registry",
".",
"CONNECTION_NETWORK_M... | [
22,
4
] | [
40,
9
] | python | en | ['en', 'en', 'en'] | True |
create | (hass, message, title=None, notification_id=None) | Generate a notification. | Generate a notification. | def create(hass, message, title=None, notification_id=None):
"""Generate a notification."""
hass.add_job(async_create, hass, message, title, notification_id) | [
"def",
"create",
"(",
"hass",
",",
"message",
",",
"title",
"=",
"None",
",",
"notification_id",
"=",
"None",
")",
":",
"hass",
".",
"add_job",
"(",
"async_create",
",",
"hass",
",",
"message",
",",
"title",
",",
"notification_id",
")"
] | [
61,
0
] | [
63,
69
] | python | en | ['en', 'en', 'en'] | True |
dismiss | (hass, notification_id) | Remove a notification. | Remove a notification. | def dismiss(hass, notification_id):
"""Remove a notification."""
hass.add_job(async_dismiss, hass, notification_id) | [
"def",
"dismiss",
"(",
"hass",
",",
"notification_id",
")",
":",
"hass",
".",
"add_job",
"(",
"async_dismiss",
",",
"hass",
",",
"notification_id",
")"
] | [
67,
0
] | [
69,
54
] | python | en | ['en', 'en', 'en'] | True |
async_create | (
hass: HomeAssistant,
message: str,
title: str | None = None,
notification_id: str | None = None,
) | Generate a notification. | Generate a notification. | def async_create(
hass: HomeAssistant,
message: str,
title: str | None = None,
notification_id: str | None = None,
) -> None:
"""Generate a notification."""
data = {
key: value
for key, value in (
(ATTR_TITLE, title),
(ATTR_MESSAGE, message),
(... | [
"def",
"async_create",
"(",
"hass",
":",
"HomeAssistant",
",",
"message",
":",
"str",
",",
"title",
":",
"str",
"|",
"None",
"=",
"None",
",",
"notification_id",
":",
"str",
"|",
"None",
"=",
"None",
",",
")",
"->",
"None",
":",
"data",
"=",
"{",
"... | [
74,
0
] | [
91,
82
] | python | en | ['en', 'en', 'en'] | True |
async_dismiss | (hass: HomeAssistant, notification_id: str) | Remove a notification. | Remove a notification. | def async_dismiss(hass: HomeAssistant, notification_id: str) -> None:
"""Remove a notification."""
data = {ATTR_NOTIFICATION_ID: notification_id}
hass.async_create_task(hass.services.async_call(DOMAIN, SERVICE_DISMISS, data)) | [
"def",
"async_dismiss",
"(",
"hass",
":",
"HomeAssistant",
",",
"notification_id",
":",
"str",
")",
"->",
"None",
":",
"data",
"=",
"{",
"ATTR_NOTIFICATION_ID",
":",
"notification_id",
"}",
"hass",
".",
"async_create_task",
"(",
"hass",
".",
"services",
".",
... | [
96,
0
] | [
100,
83
] | python | en | ['en', 'en', 'en'] | True |
async_setup | (hass: HomeAssistant, config: ConfigType) | Set up the persistent notification component. | Set up the persistent notification component. | async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
"""Set up the persistent notification component."""
persistent_notifications: MutableMapping[str, MutableMapping] = OrderedDict()
hass.data[DOMAIN] = {"notifications": persistent_notifications}
@callback
def create_service(call... | [
"async",
"def",
"async_setup",
"(",
"hass",
":",
"HomeAssistant",
",",
"config",
":",
"ConfigType",
")",
"->",
"bool",
":",
"persistent_notifications",
":",
"MutableMapping",
"[",
"str",
",",
"MutableMapping",
"]",
"=",
"OrderedDict",
"(",
")",
"hass",
".",
... | [
103,
0
] | [
205,
15
] | python | en | ['en', 'en', 'en'] | True |
websocket_get_notifications | (
hass: HomeAssistant,
connection: websocket_api.ActiveConnection,
msg: Mapping[str, Any],
) | Return a list of persistent_notifications. | Return a list of persistent_notifications. | def websocket_get_notifications(
hass: HomeAssistant,
connection: websocket_api.ActiveConnection,
msg: Mapping[str, Any],
) -> None:
"""Return a list of persistent_notifications."""
connection.send_message(
websocket_api.result_message(
msg["id"],
[
{
... | [
"def",
"websocket_get_notifications",
"(",
"hass",
":",
"HomeAssistant",
",",
"connection",
":",
"websocket_api",
".",
"ActiveConnection",
",",
"msg",
":",
"Mapping",
"[",
"str",
",",
"Any",
"]",
",",
")",
"->",
"None",
":",
"connection",
".",
"send_message",
... | [
210,
0
] | [
233,
5
] | python | en | ['en', 'en', 'en'] | True |
mock_updater | () | Mock updater. | Mock updater. | def mock_updater():
"""Mock updater."""
with patch("homeassistant.components.updater.get_newest_version"):
yield | [
"def",
"mock_updater",
"(",
")",
":",
"with",
"patch",
"(",
"\"homeassistant.components.updater.get_newest_version\"",
")",
":",
"yield"
] | [
18,
0
] | [
21,
13
] | python | en | ['en', 'nl', 'en'] | False |
recorder_url_mock | () | Mock recorder url. | Mock recorder url. | def recorder_url_mock():
"""Mock recorder url."""
with patch("homeassistant.components.recorder.DEFAULT_URL", "sqlite://"):
yield | [
"def",
"recorder_url_mock",
"(",
")",
":",
"with",
"patch",
"(",
"\"homeassistant.components.recorder.DEFAULT_URL\"",
",",
"\"sqlite://\"",
")",
":",
"yield"
] | [
25,
0
] | [
28,
13
] | python | en | ['fr', 'sv', 'en'] | False |
test_setup | (hass, mock_zeroconf) | Test setup. | Test setup. | async def test_setup(hass, mock_zeroconf):
"""Test setup."""
assert await async_setup_component(hass, "default_config", {"foo": "bar"}) | [
"async",
"def",
"test_setup",
"(",
"hass",
",",
"mock_zeroconf",
")",
":",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"\"default_config\"",
",",
"{",
"\"foo\"",
":",
"\"bar\"",
"}",
")"
] | [
31,
0
] | [
33,
78
] | python | en | ['en', 'haw', 'en'] | False |
Model.from_dict | (cls: typing.Type[T], dikt) | Returns the dict as a model | Returns the dict as a model | def from_dict(cls: typing.Type[T], dikt) -> T:
"""Returns the dict as a model"""
return util.deserialize_model(dikt, cls) | [
"def",
"from_dict",
"(",
"cls",
":",
"typing",
".",
"Type",
"[",
"T",
"]",
",",
"dikt",
")",
"->",
"T",
":",
"return",
"util",
".",
"deserialize_model",
"(",
"dikt",
",",
"cls",
")"
] | [
20,
4
] | [
22,
48
] | python | en | ['en', 'en', 'en'] | True |
Model.to_dict | (self) | Returns the model properties as a dict
:rtype: dict
| Returns the model properties as a dict | def to_dict(self):
"""Returns the model properties as a dict
:rtype: dict
"""
result = {}
for attr, _ in six.iteritems(self.openapi_types):
value = getattr(self, attr)
if isinstance(value, list):
result[attr] = list(map(
... | [
"def",
"to_dict",
"(",
"self",
")",
":",
"result",
"=",
"{",
"}",
"for",
"attr",
",",
"_",
"in",
"six",
".",
"iteritems",
"(",
"self",
".",
"openapi_types",
")",
":",
"value",
"=",
"getattr",
"(",
"self",
",",
"attr",
")",
"if",
"isinstance",
"(",
... | [
24,
4
] | [
49,
21
] | python | en | ['en', 'en', 'en'] | True |
Model.to_str | (self) | Returns the string representation of the model
:rtype: str
| Returns the string representation of the model | def to_str(self):
"""Returns the string representation of the model
:rtype: str
"""
return pprint.pformat(self.to_dict()) | [
"def",
"to_str",
"(",
"self",
")",
":",
"return",
"pprint",
".",
"pformat",
"(",
"self",
".",
"to_dict",
"(",
")",
")"
] | [
51,
4
] | [
56,
45
] | python | en | ['en', 'en', 'en'] | True |
Model.__repr__ | (self) | For `print` and `pprint` | For `print` and `pprint` | def __repr__(self):
"""For `print` and `pprint`"""
return self.to_str() | [
"def",
"__repr__",
"(",
"self",
")",
":",
"return",
"self",
".",
"to_str",
"(",
")"
] | [
58,
4
] | [
60,
28
] | python | en | ['en', 'en', 'en'] | True |
Model.__eq__ | (self, other) | Returns true if both objects are equal | Returns true if both objects are equal | def __eq__(self, other):
"""Returns true if both objects are equal"""
return self.__dict__ == other.__dict__ | [
"def",
"__eq__",
"(",
"self",
",",
"other",
")",
":",
"return",
"self",
".",
"__dict__",
"==",
"other",
".",
"__dict__"
] | [
62,
4
] | [
64,
46
] | python | en | ['en', 'en', 'en'] | True |
Model.__ne__ | (self, other) | Returns true if both objects are not equal | Returns true if both objects are not equal | def __ne__(self, other):
"""Returns true if both objects are not equal"""
return not self == other | [
"def",
"__ne__",
"(",
"self",
",",
"other",
")",
":",
"return",
"not",
"self",
"==",
"other"
] | [
66,
4
] | [
68,
32
] | python | en | ['en', 'en', 'en'] | True |
init_integration | (
hass: HomeAssistant,
aioclient_mock: AiohttpClientMocker,
skip_setup: bool = False,
) | Set up the Agent DVR integration in Home Assistant. | Set up the Agent DVR integration in Home Assistant. | async def init_integration(
hass: HomeAssistant,
aioclient_mock: AiohttpClientMocker,
skip_setup: bool = False,
) -> MockConfigEntry:
"""Set up the Agent DVR integration in Home Assistant."""
aioclient_mock.get(
"http://example.local:8090/command.cgi?cmd=getStatus",
text=load_fixtur... | [
"async",
"def",
"init_integration",
"(",
"hass",
":",
"HomeAssistant",
",",
"aioclient_mock",
":",
"AiohttpClientMocker",
",",
"skip_setup",
":",
"bool",
"=",
"False",
",",
")",
"->",
"MockConfigEntry",
":",
"aioclient_mock",
".",
"get",
"(",
"\"http://example.loc... | [
10,
0
] | [
43,
16
] | python | en | ['en', 'en', 'en'] | True |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.