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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
TestKiraSensor.test_service_call | (self) | Test Kira's ability to send commands. | Test Kira's ability to send commands. | def test_service_call(self):
"""Test Kira's ability to send commands."""
kira.setup_platform(self.hass, TEST_CONFIG, self.add_entities, DISCOVERY_INFO)
assert len(self.DEVICES) == 1
remote = self.DEVICES[0]
assert remote.name == "kira"
command = ["FAKE_COMMAND"]
... | [
"def",
"test_service_call",
"(",
"self",
")",
":",
"kira",
".",
"setup_platform",
"(",
"self",
".",
"hass",
",",
"TEST_CONFIG",
",",
"self",
".",
"add_entities",
",",
"DISCOVERY_INFO",
")",
"assert",
"len",
"(",
"self",
".",
"DEVICES",
")",
"==",
"1",
"r... | [
34,
4
] | [
47,
64
] | python | en | ['en', 'en', 'en'] | True |
script_includes | (script_code) | Returns a set of script codes 'included' by the provided one. Intended to
deal with script codes like 'Jpan' used to describe writing systems that
use/require multiple scripts. The script code itself (and other subsets)
are also included in the result. | Returns a set of script codes 'included' by the provided one. Intended to
deal with script codes like 'Jpan' used to describe writing systems that
use/require multiple scripts. The script code itself (and other subsets)
are also included in the result. | def script_includes(script_code):
"""Returns a set of script codes 'included' by the provided one. Intended to
deal with script codes like 'Jpan' used to describe writing systems that
use/require multiple scripts. The script code itself (and other subsets)
are also included in the result."""
if script_c... | [
"def",
"script_includes",
"(",
"script_code",
")",
":",
"if",
"script_code",
"not",
"in",
"scripts",
"(",
")",
":",
"raise",
"ValueError",
"(",
"\"!not a script code: %s\"",
"%",
"script_code",
")",
"if",
"script_code",
"==",
"\"Hrkt\"",
":",
"return",
"frozense... | [
45,
0
] | [
58,
35
] | python | en | ['en', 'en', 'en'] | True |
_create_lang_data | () | Generates language data from CLDR plus extensions.
Returns a mapping from lang to a tuple of:
- a set of scripts used in some region
- a set of scripts not used in any region. | Generates language data from CLDR plus extensions.
Returns a mapping from lang to a tuple of:
- a set of scripts used in some region
- a set of scripts not used in any region. | def _create_lang_data():
"""Generates language data from CLDR plus extensions.
Returns a mapping from lang to a tuple of:
- a set of scripts used in some region
- a set of scripts not used in any region."""
all_lang_scripts = collections.defaultdict(set)
used_lang_scripts = collections.defaultdict(se... | [
"def",
"_create_lang_data",
"(",
")",
":",
"all_lang_scripts",
"=",
"collections",
".",
"defaultdict",
"(",
"set",
")",
"used_lang_scripts",
"=",
"collections",
".",
"defaultdict",
"(",
"set",
")",
"known_scripts",
"=",
"set",
"(",
")",
"all_langs",
"=",
"set"... | [
61,
0
] | [
132,
20
] | python | en | ['en', 'en', 'en'] | True |
_langs_with_no_scripts | (lang_script_data) | Return a set of langs with no scripts in lang_script_data. | Return a set of langs with no scripts in lang_script_data. | def _langs_with_no_scripts(lang_script_data):
"""Return a set of langs with no scripts in lang_script_data."""
return set(
[
k
for k in lang_script_data
if not (lang_script_data[k][0] or lang_script_data[k][1])
]
) | [
"def",
"_langs_with_no_scripts",
"(",
"lang_script_data",
")",
":",
"return",
"set",
"(",
"[",
"k",
"for",
"k",
"in",
"lang_script_data",
"if",
"not",
"(",
"lang_script_data",
"[",
"k",
"]",
"[",
"0",
"]",
"or",
"lang_script_data",
"[",
"k",
"]",
"[",
"1... | [
135,
0
] | [
143,
5
] | python | en | ['en', 'en', 'en'] | True |
_create_script_to_default_lang | (lang_script_data) | Iterates over all the scripts in lang_script_data, and returns a map
from each script to the default language code, generally based on cldr
likely subtag data. This assigns 'en' to Latn by fiat (cldr defaults to
'und'). Some other scripts (e.g. Dsrt) just get 'und'.
This checks that the default lang for a sc... | Iterates over all the scripts in lang_script_data, and returns a map
from each script to the default language code, generally based on cldr
likely subtag data. This assigns 'en' to Latn by fiat (cldr defaults to
'und'). Some other scripts (e.g. Dsrt) just get 'und'. | def _create_script_to_default_lang(lang_script_data):
"""Iterates over all the scripts in lang_script_data, and returns a map
from each script to the default language code, generally based on cldr
likely subtag data. This assigns 'en' to Latn by fiat (cldr defaults to
'und'). Some other scripts (e.g. Dsrt) ... | [
"def",
"_create_script_to_default_lang",
"(",
"lang_script_data",
")",
":",
"script_to_default_lang",
"=",
"{",
"}",
"all_scripts",
"=",
"set",
"(",
")",
"script_to_used",
"=",
"collections",
".",
"defaultdict",
"(",
"set",
")",
"script_to_unused",
"=",
"collections... | [
151,
0
] | [
206,
33
] | python | en | ['en', 'en', 'en'] | True |
_create_lang_script_to_names | (lang_script_data) | Generate a map from lang-script to English (and possibly native) names.
Whether the script is included in the name depends on the number of used
and unused scripts. If there's one used script, that script is omitted.
Else if there's no used script and one unused script, that script is
omitted. Else the script... | Generate a map from lang-script to English (and possibly native) names.
Whether the script is included in the name depends on the number of used
and unused scripts. If there's one used script, that script is omitted.
Else if there's no used script and one unused script, that script is
omitted. Else the script... | def _create_lang_script_to_names(lang_script_data):
"""Generate a map from lang-script to English (and possibly native) names.
Whether the script is included in the name depends on the number of used
and unused scripts. If there's one used script, that script is omitted.
Else if there's no used script and on... | [
"def",
"_create_lang_script_to_names",
"(",
"lang_script_data",
")",
":",
"lang_to_names",
"=",
"{",
"}",
"for",
"lang",
"in",
"lang_script_data",
":",
"used",
",",
"unused",
"=",
"lang_script_data",
"[",
"lang",
"]",
"if",
"len",
"(",
"used",
")",
"==",
"1"... | [
209,
0
] | [
252,
24
] | python | en | ['en', 'en', 'en'] | True |
test_jewish_calendar_min_config | (hass) | Test minimum jewish calendar configuration. | Test minimum jewish calendar configuration. | async def test_jewish_calendar_min_config(hass):
"""Test minimum jewish calendar configuration."""
assert await async_setup_component(
hass, jewish_calendar.DOMAIN, {"jewish_calendar": {}}
)
await hass.async_block_till_done()
assert hass.states.get("sensor.jewish_calendar_date") is not None | [
"async",
"def",
"test_jewish_calendar_min_config",
"(",
"hass",
")",
":",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"jewish_calendar",
".",
"DOMAIN",
",",
"{",
"\"jewish_calendar\"",
":",
"{",
"}",
"}",
")",
"await",
"hass",
".",
"async_block... | [
20,
0
] | [
26,
69
] | python | de | ['de', 'la', 'en'] | False |
test_jewish_calendar_hebrew | (hass) | Test jewish calendar sensor with language set to hebrew. | Test jewish calendar sensor with language set to hebrew. | async def test_jewish_calendar_hebrew(hass):
"""Test jewish calendar sensor with language set to hebrew."""
assert await async_setup_component(
hass, jewish_calendar.DOMAIN, {"jewish_calendar": {"language": "hebrew"}}
)
await hass.async_block_till_done()
assert hass.states.get("sensor.jewish... | [
"async",
"def",
"test_jewish_calendar_hebrew",
"(",
"hass",
")",
":",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"jewish_calendar",
".",
"DOMAIN",
",",
"{",
"\"jewish_calendar\"",
":",
"{",
"\"language\"",
":",
"\"hebrew\"",
"}",
"}",
")",
"aw... | [
29,
0
] | [
35,
69
] | python | en | ['en', 'su', 'en'] | True |
test_jewish_calendar_sensor | (
hass,
legacy_patchable_time,
now,
tzname,
latitude,
longitude,
language,
sensor,
diaspora,
result,
) | Test Jewish calendar sensor output. | Test Jewish calendar sensor output. | async def test_jewish_calendar_sensor(
hass,
legacy_patchable_time,
now,
tzname,
latitude,
longitude,
language,
sensor,
diaspora,
result,
):
"""Test Jewish calendar sensor output."""
time_zone = dt_util.get_time_zone(tzname)
test_time = now.replace(tzinfo=time_zone)
... | [
"async",
"def",
"test_jewish_calendar_sensor",
"(",
"hass",
",",
"legacy_patchable_time",
",",
"now",
",",
"tzname",
",",
"latitude",
",",
"longitude",
",",
"language",
",",
"sensor",
",",
"diaspora",
",",
"result",
",",
")",
":",
"time_zone",
"=",
"dt_util",
... | [
151,
0
] | [
201,
59
] | python | en | ['en', 'su', 'en'] | True |
test_shabbat_times_sensor | (
hass,
legacy_patchable_time,
language,
now,
candle_lighting,
havdalah,
diaspora,
tzname,
latitude,
longitude,
result,
) | Test sensor output for upcoming shabbat/yomtov times. | Test sensor output for upcoming shabbat/yomtov times. | async def test_shabbat_times_sensor(
hass,
legacy_patchable_time,
language,
now,
candle_lighting,
havdalah,
diaspora,
tzname,
latitude,
longitude,
result,
):
"""Test sensor output for upcoming shabbat/yomtov times."""
time_zone = dt_util.get_time_zone(tzname)
test... | [
"async",
"def",
"test_shabbat_times_sensor",
"(",
"hass",
",",
"legacy_patchable_time",
",",
"language",
",",
"now",
",",
"candle_lighting",
",",
"havdalah",
",",
"diaspora",
",",
"tzname",
",",
"latitude",
",",
"longitude",
",",
"result",
",",
")",
":",
"time... | [
495,
0
] | [
573,
45
] | python | en | ['en', 'en', 'en'] | True |
test_omer_sensor | (hass, legacy_patchable_time, test_time, result) | Test Omer Count sensor output. | Test Omer Count sensor output. | async def test_omer_sensor(hass, legacy_patchable_time, test_time, result):
"""Test Omer Count sensor output."""
test_time = test_time.replace(tzinfo=dt_util.get_time_zone(hass.config.time_zone))
with alter_time(test_time):
assert await async_setup_component(
hass, jewish_calendar.DOMAI... | [
"async",
"def",
"test_omer_sensor",
"(",
"hass",
",",
"legacy_patchable_time",
",",
"test_time",
",",
"result",
")",
":",
"test_time",
"=",
"test_time",
".",
"replace",
"(",
"tzinfo",
"=",
"dt_util",
".",
"get_time_zone",
"(",
"hass",
".",
"config",
".",
"ti... | [
595,
0
] | [
609,
73
] | python | da | ['sv', 'da', 'en'] | False |
test_dafyomi_sensor | (hass, legacy_patchable_time, test_time, result) | Test Daf Yomi sensor output. | Test Daf Yomi sensor output. | async def test_dafyomi_sensor(hass, legacy_patchable_time, test_time, result):
"""Test Daf Yomi sensor output."""
test_time = test_time.replace(tzinfo=dt_util.get_time_zone(hass.config.time_zone))
with alter_time(test_time):
assert await async_setup_component(
hass, jewish_calendar.DOMA... | [
"async",
"def",
"test_dafyomi_sensor",
"(",
"hass",
",",
"legacy_patchable_time",
",",
"test_time",
",",
"result",
")",
":",
"test_time",
"=",
"test_time",
".",
"replace",
"(",
"tzinfo",
"=",
"dt_util",
".",
"get_time_zone",
"(",
"hass",
".",
"config",
".",
... | [
629,
0
] | [
643,
66
] | python | da | ['da', 'is', 'en'] | False |
lookup_all | (
perm_lookup: PermissionLookup, lookup_dict: SubCategoryDict, object_id: str
) | Look up permission for all. | Look up permission for all. | def lookup_all(
perm_lookup: PermissionLookup, lookup_dict: SubCategoryDict, object_id: str
) -> ValueType:
"""Look up permission for all."""
# In case of ALL category, lookup_dict IS the schema.
return cast(ValueType, lookup_dict) | [
"def",
"lookup_all",
"(",
"perm_lookup",
":",
"PermissionLookup",
",",
"lookup_dict",
":",
"SubCategoryDict",
",",
"object_id",
":",
"str",
")",
"->",
"ValueType",
":",
"# In case of ALL category, lookup_dict IS the schema.",
"return",
"cast",
"(",
"ValueType",
",",
"... | [
14,
0
] | [
19,
39
] | python | en | ['en', 'en', 'en'] | True |
compile_policy | (
policy: CategoryType, subcategories: SubCatLookupType, perm_lookup: PermissionLookup
) | Compile policy into a function that tests policy.
Subcategories are mapping key -> lookup function, ordered by highest
priority first.
| Compile policy into a function that tests policy. | def compile_policy(
policy: CategoryType, subcategories: SubCatLookupType, perm_lookup: PermissionLookup
) -> Callable[[str, str], bool]:
"""Compile policy into a function that tests policy.
Subcategories are mapping key -> lookup function, ordered by highest
priority first.
"""
# None, False, ... | [
"def",
"compile_policy",
"(",
"policy",
":",
"CategoryType",
",",
"subcategories",
":",
"SubCatLookupType",
",",
"perm_lookup",
":",
"PermissionLookup",
")",
"->",
"Callable",
"[",
"[",
"str",
",",
"str",
"]",
",",
"bool",
"]",
":",
"# None, False, empty dict",
... | [
22,
0
] | [
79,
29
] | python | en | ['en', 'en', 'en'] | True |
_gen_dict_test_func | (
perm_lookup: PermissionLookup, lookup_func: LookupFunc, lookup_dict: SubCategoryDict
) | Generate a lookup function. | Generate a lookup function. | def _gen_dict_test_func(
perm_lookup: PermissionLookup, lookup_func: LookupFunc, lookup_dict: SubCategoryDict
) -> Callable[[str, str], bool | None]:
"""Generate a lookup function."""
def test_value(object_id: str, key: str) -> bool | None:
"""Test if permission is allowed based on the keys."""
... | [
"def",
"_gen_dict_test_func",
"(",
"perm_lookup",
":",
"PermissionLookup",
",",
"lookup_func",
":",
"LookupFunc",
",",
"lookup_dict",
":",
"SubCategoryDict",
")",
"->",
"Callable",
"[",
"[",
"str",
",",
"str",
"]",
",",
"bool",
"|",
"None",
"]",
":",
"def",
... | [
82,
0
] | [
98,
21
] | python | en | ['es', 'en', 'en'] | True |
test_all | (policy: CategoryType, key: str) | Test if a policy has an ALL access for a specific key. | Test if a policy has an ALL access for a specific key. | def test_all(policy: CategoryType, key: str) -> bool:
"""Test if a policy has an ALL access for a specific key."""
if not isinstance(policy, dict):
return bool(policy)
all_policy = policy.get(SUBCAT_ALL)
if not isinstance(all_policy, dict):
return bool(all_policy)
return all_polic... | [
"def",
"test_all",
"(",
"policy",
":",
"CategoryType",
",",
"key",
":",
"str",
")",
"->",
"bool",
":",
"if",
"not",
"isinstance",
"(",
"policy",
",",
"dict",
")",
":",
"return",
"bool",
"(",
"policy",
")",
"all_policy",
"=",
"policy",
".",
"get",
"("... | [
101,
0
] | [
111,
37
] | python | en | ['en', 'en', 'en'] | True |
setup_platform | (hass, config, add_entities, discovery_info=None) | Create the ViCare sensor devices. | Create the ViCare sensor devices. | def setup_platform(hass, config, add_entities, discovery_info=None):
"""Create the ViCare sensor devices."""
if discovery_info is None:
return
vicare_api = hass.data[VICARE_DOMAIN][VICARE_API]
heating_type = hass.data[VICARE_DOMAIN][VICARE_HEATING_TYPE]
sensors = SENSORS_GENERIC.copy()
... | [
"def",
"setup_platform",
"(",
"hass",
",",
"config",
",",
"add_entities",
",",
"discovery_info",
"=",
"None",
")",
":",
"if",
"discovery_info",
"is",
"None",
":",
"return",
"vicare_api",
"=",
"hass",
".",
"data",
"[",
"VICARE_DOMAIN",
"]",
"[",
"VICARE_API",... | [
318,
0
] | [
336,
5
] | python | en | ['en', 'en', 'en'] | True |
ViCareSensor.__init__ | (self, name, api, sensor_type) | Initialize the sensor. | Initialize the sensor. | def __init__(self, name, api, sensor_type):
"""Initialize the sensor."""
self._sensor = SENSOR_TYPES[sensor_type]
self._name = f"{name} {self._sensor[CONF_NAME]}"
self._api = api
self._sensor_type = sensor_type
self._state = None | [
"def",
"__init__",
"(",
"self",
",",
"name",
",",
"api",
",",
"sensor_type",
")",
":",
"self",
".",
"_sensor",
"=",
"SENSOR_TYPES",
"[",
"sensor_type",
"]",
"self",
".",
"_name",
"=",
"f\"{name} {self._sensor[CONF_NAME]}\"",
"self",
".",
"_api",
"=",
"api",
... | [
342,
4
] | [
348,
26
] | python | en | ['en', 'en', 'en'] | True |
ViCareSensor.available | (self) | Return True if entity is available. | Return True if entity is available. | def available(self):
"""Return True if entity is available."""
return self._state is not None | [
"def",
"available",
"(",
"self",
")",
":",
"return",
"self",
".",
"_state",
"is",
"not",
"None"
] | [
351,
4
] | [
353,
38
] | python | en | ['en', 'en', 'en'] | True |
ViCareSensor.unique_id | (self) | Return a unique ID. | Return a unique ID. | def unique_id(self):
"""Return a unique ID."""
return f"{self._api.service.id}-{self._sensor_type}" | [
"def",
"unique_id",
"(",
"self",
")",
":",
"return",
"f\"{self._api.service.id}-{self._sensor_type}\""
] | [
356,
4
] | [
358,
60
] | python | ca | ['fr', 'ca', 'en'] | False |
ViCareSensor.name | (self) | Return the name of the sensor. | Return the name of the sensor. | def name(self):
"""Return the name of the sensor."""
return self._name | [
"def",
"name",
"(",
"self",
")",
":",
"return",
"self",
".",
"_name"
] | [
361,
4
] | [
363,
25
] | python | en | ['en', 'mi', 'en'] | True |
ViCareSensor.icon | (self) | Icon to use in the frontend, if any. | Icon to use in the frontend, if any. | def icon(self):
"""Icon to use in the frontend, if any."""
return self._sensor[CONF_ICON] | [
"def",
"icon",
"(",
"self",
")",
":",
"return",
"self",
".",
"_sensor",
"[",
"CONF_ICON",
"]"
] | [
366,
4
] | [
368,
38
] | python | en | ['en', 'en', 'en'] | True |
ViCareSensor.native_value | (self) | Return the state of the sensor. | Return the state of the sensor. | def native_value(self):
"""Return the state of the sensor."""
return self._state | [
"def",
"native_value",
"(",
"self",
")",
":",
"return",
"self",
".",
"_state"
] | [
371,
4
] | [
373,
26
] | python | en | ['en', 'en', 'en'] | True |
ViCareSensor.native_unit_of_measurement | (self) | Return the unit of measurement. | Return the unit of measurement. | def native_unit_of_measurement(self):
"""Return the unit of measurement."""
return self._sensor[CONF_UNIT_OF_MEASUREMENT] | [
"def",
"native_unit_of_measurement",
"(",
"self",
")",
":",
"return",
"self",
".",
"_sensor",
"[",
"CONF_UNIT_OF_MEASUREMENT",
"]"
] | [
376,
4
] | [
378,
53
] | python | en | ['en', 'la', 'en'] | True |
ViCareSensor.device_class | (self) | Return the class of this device, from component DEVICE_CLASSES. | Return the class of this device, from component DEVICE_CLASSES. | def device_class(self):
"""Return the class of this device, from component DEVICE_CLASSES."""
return self._sensor[CONF_DEVICE_CLASS] | [
"def",
"device_class",
"(",
"self",
")",
":",
"return",
"self",
".",
"_sensor",
"[",
"CONF_DEVICE_CLASS",
"]"
] | [
381,
4
] | [
383,
46
] | python | en | ['en', 'en', 'en'] | True |
ViCareSensor.update | (self) | Update state of sensor. | Update state of sensor. | def update(self):
"""Update state of sensor."""
try:
with suppress(PyViCareNotSupportedFeatureError):
self._state = self._sensor[CONF_GETTER](self._api)
except requests.exceptions.ConnectionError:
_LOGGER.error("Unable to retrieve data from ViCare server")... | [
"def",
"update",
"(",
"self",
")",
":",
"try",
":",
"with",
"suppress",
"(",
"PyViCareNotSupportedFeatureError",
")",
":",
"self",
".",
"_state",
"=",
"self",
".",
"_sensor",
"[",
"CONF_GETTER",
"]",
"(",
"self",
".",
"_api",
")",
"except",
"requests",
"... | [
385,
4
] | [
395,
80
] | python | en | ['en', 'co', 'en'] | True |
ceiling_fan | (name: str) | Create a ceiling fan with given name. | Create a ceiling fan with given name. | def ceiling_fan(name: str):
"""Create a ceiling fan with given name."""
return {
"name": name,
"type": DeviceType.CEILING_FAN,
"actions": ["SetSpeed", "SetDirection"],
} | [
"def",
"ceiling_fan",
"(",
"name",
":",
"str",
")",
":",
"return",
"{",
"\"name\"",
":",
"name",
",",
"\"type\"",
":",
"DeviceType",
".",
"CEILING_FAN",
",",
"\"actions\"",
":",
"[",
"\"SetSpeed\"",
",",
"\"SetDirection\"",
"]",
",",
"}"
] | [
42,
0
] | [
48,
5
] | python | en | ['en', 'en', 'en'] | True |
turn_fan_on | (
hass: core.HomeAssistant,
fan_id: str,
speed: str | None = None,
percentage: int | None = None,
) | Turn the fan on at the specified speed. | Turn the fan on at the specified speed. | async def turn_fan_on(
hass: core.HomeAssistant,
fan_id: str,
speed: str | None = None,
percentage: int | None = None,
) -> None:
"""Turn the fan on at the specified speed."""
service_data = {ATTR_ENTITY_ID: fan_id}
if speed:
service_data[fan.ATTR_SPEED] = speed
if percentage:
... | [
"async",
"def",
"turn_fan_on",
"(",
"hass",
":",
"core",
".",
"HomeAssistant",
",",
"fan_id",
":",
"str",
",",
"speed",
":",
"str",
"|",
"None",
"=",
"None",
",",
"percentage",
":",
"int",
"|",
"None",
"=",
"None",
",",
")",
"->",
"None",
":",
"ser... | [
51,
0
] | [
69,
38
] | python | en | ['en', 'en', 'en'] | True |
test_entity_registry | (hass: core.HomeAssistant) | Tests that the devices are registered in the entity registry. | Tests that the devices are registered in the entity registry. | async def test_entity_registry(hass: core.HomeAssistant):
"""Tests that the devices are registered in the entity registry."""
await setup_platform(
hass,
FAN_DOMAIN,
ceiling_fan("name-1"),
bond_version={"bondid": "test-hub-id"},
bond_device_id="test-device-id",
)
... | [
"async",
"def",
"test_entity_registry",
"(",
"hass",
":",
"core",
".",
"HomeAssistant",
")",
":",
"await",
"setup_platform",
"(",
"hass",
",",
"FAN_DOMAIN",
",",
"ceiling_fan",
"(",
"\"name-1\"",
")",
",",
"bond_version",
"=",
"{",
"\"bondid\"",
":",
"\"test-h... | [
72,
0
] | [
84,
59
] | python | en | ['en', 'en', 'en'] | True |
test_non_standard_speed_list | (hass: core.HomeAssistant) | Tests that the device is registered with custom speed list if number of supported speeds differs form 3. | Tests that the device is registered with custom speed list if number of supported speeds differs form 3. | async def test_non_standard_speed_list(hass: core.HomeAssistant):
"""Tests that the device is registered with custom speed list if number of supported speeds differs form 3."""
await setup_platform(
hass,
FAN_DOMAIN,
ceiling_fan("name-1"),
bond_device_id="test-device-id",
... | [
"async",
"def",
"test_non_standard_speed_list",
"(",
"hass",
":",
"core",
".",
"HomeAssistant",
")",
":",
"await",
"setup_platform",
"(",
"hass",
",",
"FAN_DOMAIN",
",",
"ceiling_fan",
"(",
"\"name-1\"",
")",
",",
"bond_device_id",
"=",
"\"test-device-id\"",
",",
... | [
87,
0
] | [
122,
9
] | python | en | ['en', 'en', 'en'] | True |
test_fan_speed_with_no_max_seed | (hass: core.HomeAssistant) | Tests that fans without max speed (increase/decrease controls) map speed to HA standard. | Tests that fans without max speed (increase/decrease controls) map speed to HA standard. | async def test_fan_speed_with_no_max_seed(hass: core.HomeAssistant):
"""Tests that fans without max speed (increase/decrease controls) map speed to HA standard."""
await setup_platform(
hass,
FAN_DOMAIN,
ceiling_fan("name-1"),
bond_device_id="test-device-id",
props={"no":... | [
"async",
"def",
"test_fan_speed_with_no_max_seed",
"(",
"hass",
":",
"core",
".",
"HomeAssistant",
")",
":",
"await",
"setup_platform",
"(",
"hass",
",",
"FAN_DOMAIN",
",",
"ceiling_fan",
"(",
"\"name-1\"",
")",
",",
"bond_device_id",
"=",
"\"test-device-id\"",
",... | [
125,
0
] | [
136,
78
] | python | en | ['en', 'en', 'en'] | True |
test_turn_on_fan_with_speed | (hass: core.HomeAssistant) | Tests that turn on command delegates to set speed API. | Tests that turn on command delegates to set speed API. | async def test_turn_on_fan_with_speed(hass: core.HomeAssistant):
"""Tests that turn on command delegates to set speed API."""
await setup_platform(
hass, FAN_DOMAIN, ceiling_fan("name-1"), bond_device_id="test-device-id"
)
with patch_bond_action() as mock_set_speed, patch_bond_device_state():
... | [
"async",
"def",
"test_turn_on_fan_with_speed",
"(",
"hass",
":",
"core",
".",
"HomeAssistant",
")",
":",
"await",
"setup_platform",
"(",
"hass",
",",
"FAN_DOMAIN",
",",
"ceiling_fan",
"(",
"\"name-1\"",
")",
",",
"bond_device_id",
"=",
"\"test-device-id\"",
")",
... | [
139,
0
] | [
148,
76
] | python | en | ['en', 'en', 'en'] | True |
test_turn_on_fan_with_percentage_3_speeds | (hass: core.HomeAssistant) | Tests that turn on command delegates to set speed API. | Tests that turn on command delegates to set speed API. | async def test_turn_on_fan_with_percentage_3_speeds(hass: core.HomeAssistant):
"""Tests that turn on command delegates to set speed API."""
await setup_platform(
hass, FAN_DOMAIN, ceiling_fan("name-1"), bond_device_id="test-device-id"
)
with patch_bond_action() as mock_set_speed, patch_bond_dev... | [
"async",
"def",
"test_turn_on_fan_with_percentage_3_speeds",
"(",
"hass",
":",
"core",
".",
"HomeAssistant",
")",
":",
"await",
"setup_platform",
"(",
"hass",
",",
"FAN_DOMAIN",
",",
"ceiling_fan",
"(",
"\"name-1\"",
")",
",",
"bond_device_id",
"=",
"\"test-device-i... | [
151,
0
] | [
172,
76
] | python | en | ['en', 'en', 'en'] | True |
test_turn_on_fan_with_percentage_6_speeds | (hass: core.HomeAssistant) | Tests that turn on command delegates to set speed API. | Tests that turn on command delegates to set speed API. | async def test_turn_on_fan_with_percentage_6_speeds(hass: core.HomeAssistant):
"""Tests that turn on command delegates to set speed API."""
await setup_platform(
hass,
FAN_DOMAIN,
ceiling_fan("name-1"),
bond_device_id="test-device-id",
props={"max_speed": 6},
)
w... | [
"async",
"def",
"test_turn_on_fan_with_percentage_6_speeds",
"(",
"hass",
":",
"core",
".",
"HomeAssistant",
")",
":",
"await",
"setup_platform",
"(",
"hass",
",",
"FAN_DOMAIN",
",",
"ceiling_fan",
"(",
"\"name-1\"",
")",
",",
"bond_device_id",
"=",
"\"test-device-i... | [
175,
0
] | [
200,
76
] | python | en | ['en', 'en', 'en'] | True |
test_turn_on_fan_without_speed | (hass: core.HomeAssistant) | Tests that turn on command delegates to turn on API. | Tests that turn on command delegates to turn on API. | async def test_turn_on_fan_without_speed(hass: core.HomeAssistant):
"""Tests that turn on command delegates to turn on API."""
await setup_platform(
hass, FAN_DOMAIN, ceiling_fan("name-1"), bond_device_id="test-device-id"
)
with patch_bond_action() as mock_turn_on, patch_bond_device_state():
... | [
"async",
"def",
"test_turn_on_fan_without_speed",
"(",
"hass",
":",
"core",
".",
"HomeAssistant",
")",
":",
"await",
"setup_platform",
"(",
"hass",
",",
"FAN_DOMAIN",
",",
"ceiling_fan",
"(",
"\"name-1\"",
")",
",",
"bond_device_id",
"=",
"\"test-device-id\"",
")"... | [
203,
0
] | [
212,
71
] | python | en | ['en', 'en', 'en'] | True |
test_turn_on_fan_with_off_speed | (hass: core.HomeAssistant) | Tests that turn on command delegates to turn off API. | Tests that turn on command delegates to turn off API. | async def test_turn_on_fan_with_off_speed(hass: core.HomeAssistant):
"""Tests that turn on command delegates to turn off API."""
await setup_platform(
hass, FAN_DOMAIN, ceiling_fan("name-1"), bond_device_id="test-device-id"
)
with patch_bond_action() as mock_turn_off, patch_bond_device_state():... | [
"async",
"def",
"test_turn_on_fan_with_off_speed",
"(",
"hass",
":",
"core",
".",
"HomeAssistant",
")",
":",
"await",
"setup_platform",
"(",
"hass",
",",
"FAN_DOMAIN",
",",
"ceiling_fan",
"(",
"\"name-1\"",
")",
",",
"bond_device_id",
"=",
"\"test-device-id\"",
")... | [
215,
0
] | [
224,
73
] | python | en | ['en', 'en', 'en'] | True |
test_set_speed_off | (hass: core.HomeAssistant) | Tests that set_speed(off) command delegates to turn off API. | Tests that set_speed(off) command delegates to turn off API. | async def test_set_speed_off(hass: core.HomeAssistant):
"""Tests that set_speed(off) command delegates to turn off API."""
await setup_platform(
hass, FAN_DOMAIN, ceiling_fan("name-1"), bond_device_id="test-device-id"
)
with patch_bond_action() as mock_turn_off, patch_bond_device_state():
... | [
"async",
"def",
"test_set_speed_off",
"(",
"hass",
":",
"core",
".",
"HomeAssistant",
")",
":",
"await",
"setup_platform",
"(",
"hass",
",",
"FAN_DOMAIN",
",",
"ceiling_fan",
"(",
"\"name-1\"",
")",
",",
"bond_device_id",
"=",
"\"test-device-id\"",
")",
"with",
... | [
227,
0
] | [
242,
73
] | python | en | ['en', 'en', 'en'] | True |
test_turn_off_fan | (hass: core.HomeAssistant) | Tests that turn off command delegates to API. | Tests that turn off command delegates to API. | async def test_turn_off_fan(hass: core.HomeAssistant):
"""Tests that turn off command delegates to API."""
await setup_platform(
hass, FAN_DOMAIN, ceiling_fan("name-1"), bond_device_id="test-device-id"
)
with patch_bond_action() as mock_turn_off, patch_bond_device_state():
await hass.se... | [
"async",
"def",
"test_turn_off_fan",
"(",
"hass",
":",
"core",
".",
"HomeAssistant",
")",
":",
"await",
"setup_platform",
"(",
"hass",
",",
"FAN_DOMAIN",
",",
"ceiling_fan",
"(",
"\"name-1\"",
")",
",",
"bond_device_id",
"=",
"\"test-device-id\"",
")",
"with",
... | [
245,
0
] | [
260,
78
] | python | en | ['en', 'en', 'en'] | True |
test_set_speed_belief_speed_zero | (hass: core.HomeAssistant) | Tests that set power belief service delegates to API. | Tests that set power belief service delegates to API. | async def test_set_speed_belief_speed_zero(hass: core.HomeAssistant):
"""Tests that set power belief service delegates to API."""
await setup_platform(
hass, FAN_DOMAIN, ceiling_fan("name-1"), bond_device_id="test-device-id"
)
with patch_bond_action() as mock_action, patch_bond_device_state():
... | [
"async",
"def",
"test_set_speed_belief_speed_zero",
"(",
"hass",
":",
"core",
".",
"HomeAssistant",
")",
":",
"await",
"setup_platform",
"(",
"hass",
",",
"FAN_DOMAIN",
",",
"ceiling_fan",
"(",
"\"name-1\"",
")",
",",
"bond_device_id",
"=",
"\"test-device-id\"",
"... | [
263,
0
] | [
280,
5
] | python | en | ['en', 'en', 'en'] | True |
test_set_speed_belief_speed_api_error | (hass: core.HomeAssistant) | Tests that set power belief service delegates to API. | Tests that set power belief service delegates to API. | async def test_set_speed_belief_speed_api_error(hass: core.HomeAssistant):
"""Tests that set power belief service delegates to API."""
await setup_platform(
hass, FAN_DOMAIN, ceiling_fan("name-1"), bond_device_id="test-device-id"
)
with pytest.raises(
HomeAssistantError
), patch_bon... | [
"async",
"def",
"test_set_speed_belief_speed_api_error",
"(",
"hass",
":",
"core",
".",
"HomeAssistant",
")",
":",
"await",
"setup_platform",
"(",
"hass",
",",
"FAN_DOMAIN",
",",
"ceiling_fan",
"(",
"\"name-1\"",
")",
",",
"bond_device_id",
"=",
"\"test-device-id\""... | [
283,
0
] | [
298,
42
] | python | en | ['en', 'en', 'en'] | True |
test_set_speed_belief_speed_100 | (hass: core.HomeAssistant) | Tests that set power belief service delegates to API. | Tests that set power belief service delegates to API. | async def test_set_speed_belief_speed_100(hass: core.HomeAssistant):
"""Tests that set power belief service delegates to API."""
await setup_platform(
hass, FAN_DOMAIN, ceiling_fan("name-1"), bond_device_id="test-device-id"
)
with patch_bond_action() as mock_action, patch_bond_device_state():
... | [
"async",
"def",
"test_set_speed_belief_speed_100",
"(",
"hass",
":",
"core",
".",
"HomeAssistant",
")",
":",
"await",
"setup_platform",
"(",
"hass",
",",
"FAN_DOMAIN",
",",
"ceiling_fan",
"(",
"\"name-1\"",
")",
",",
"bond_device_id",
"=",
"\"test-device-id\"",
")... | [
301,
0
] | [
317,
80
] | python | en | ['en', 'en', 'en'] | True |
test_update_reports_fan_on | (hass: core.HomeAssistant) | Tests that update command sets correct state when Bond API reports fan power is on. | Tests that update command sets correct state when Bond API reports fan power is on. | async def test_update_reports_fan_on(hass: core.HomeAssistant):
"""Tests that update command sets correct state when Bond API reports fan power is on."""
await setup_platform(hass, FAN_DOMAIN, ceiling_fan("name-1"))
with patch_bond_device_state(return_value={"power": 1, "speed": 1}):
async_fire_tim... | [
"async",
"def",
"test_update_reports_fan_on",
"(",
"hass",
":",
"core",
".",
"HomeAssistant",
")",
":",
"await",
"setup_platform",
"(",
"hass",
",",
"FAN_DOMAIN",
",",
"ceiling_fan",
"(",
"\"name-1\"",
")",
")",
"with",
"patch_bond_device_state",
"(",
"return_valu... | [
320,
0
] | [
328,
54
] | python | en | ['en', 'en', 'en'] | True |
test_update_reports_fan_off | (hass: core.HomeAssistant) | Tests that update command sets correct state when Bond API reports fan power is off. | Tests that update command sets correct state when Bond API reports fan power is off. | async def test_update_reports_fan_off(hass: core.HomeAssistant):
"""Tests that update command sets correct state when Bond API reports fan power is off."""
await setup_platform(hass, FAN_DOMAIN, ceiling_fan("name-1"))
with patch_bond_device_state(return_value={"power": 0, "speed": 1}):
async_fire_t... | [
"async",
"def",
"test_update_reports_fan_off",
"(",
"hass",
":",
"core",
".",
"HomeAssistant",
")",
":",
"await",
"setup_platform",
"(",
"hass",
",",
"FAN_DOMAIN",
",",
"ceiling_fan",
"(",
"\"name-1\"",
")",
")",
"with",
"patch_bond_device_state",
"(",
"return_val... | [
331,
0
] | [
339,
55
] | python | en | ['en', 'en', 'en'] | True |
test_update_reports_direction_forward | (hass: core.HomeAssistant) | Tests that update command sets correct direction when Bond API reports fan direction is forward. | Tests that update command sets correct direction when Bond API reports fan direction is forward. | async def test_update_reports_direction_forward(hass: core.HomeAssistant):
"""Tests that update command sets correct direction when Bond API reports fan direction is forward."""
await setup_platform(hass, FAN_DOMAIN, ceiling_fan("name-1"))
with patch_bond_device_state(return_value={"direction": Direction.F... | [
"async",
"def",
"test_update_reports_direction_forward",
"(",
"hass",
":",
"core",
".",
"HomeAssistant",
")",
":",
"await",
"setup_platform",
"(",
"hass",
",",
"FAN_DOMAIN",
",",
"ceiling_fan",
"(",
"\"name-1\"",
")",
")",
"with",
"patch_bond_device_state",
"(",
"... | [
342,
0
] | [
350,
88
] | python | en | ['en', 'en', 'en'] | True |
test_update_reports_direction_reverse | (hass: core.HomeAssistant) | Tests that update command sets correct direction when Bond API reports fan direction is reverse. | Tests that update command sets correct direction when Bond API reports fan direction is reverse. | async def test_update_reports_direction_reverse(hass: core.HomeAssistant):
"""Tests that update command sets correct direction when Bond API reports fan direction is reverse."""
await setup_platform(hass, FAN_DOMAIN, ceiling_fan("name-1"))
with patch_bond_device_state(return_value={"direction": Direction.R... | [
"async",
"def",
"test_update_reports_direction_reverse",
"(",
"hass",
":",
"core",
".",
"HomeAssistant",
")",
":",
"await",
"setup_platform",
"(",
"hass",
",",
"FAN_DOMAIN",
",",
"ceiling_fan",
"(",
"\"name-1\"",
")",
")",
"with",
"patch_bond_device_state",
"(",
"... | [
353,
0
] | [
361,
88
] | python | en | ['en', 'en', 'en'] | True |
test_set_fan_direction | (hass: core.HomeAssistant) | Tests that set direction command delegates to API. | Tests that set direction command delegates to API. | async def test_set_fan_direction(hass: core.HomeAssistant):
"""Tests that set direction command delegates to API."""
await setup_platform(
hass, FAN_DOMAIN, ceiling_fan("name-1"), bond_device_id="test-device-id"
)
with patch_bond_action() as mock_set_direction, patch_bond_device_state():
... | [
"async",
"def",
"test_set_fan_direction",
"(",
"hass",
":",
"core",
".",
"HomeAssistant",
")",
":",
"await",
"setup_platform",
"(",
"hass",
",",
"FAN_DOMAIN",
",",
"ceiling_fan",
"(",
"\"name-1\"",
")",
",",
"bond_device_id",
"=",
"\"test-device-id\"",
")",
"wit... | [
364,
0
] | [
381,
5
] | python | en | ['en', 'en', 'en'] | True |
test_fan_available | (hass: core.HomeAssistant) | Tests that available state is updated based on API errors. | Tests that available state is updated based on API errors. | async def test_fan_available(hass: core.HomeAssistant):
"""Tests that available state is updated based on API errors."""
await help_test_entity_available(
hass, FAN_DOMAIN, ceiling_fan("name-1"), "fan.name_1"
) | [
"async",
"def",
"test_fan_available",
"(",
"hass",
":",
"core",
".",
"HomeAssistant",
")",
":",
"await",
"help_test_entity_available",
"(",
"hass",
",",
"FAN_DOMAIN",
",",
"ceiling_fan",
"(",
"\"name-1\"",
")",
",",
"\"fan.name_1\"",
")"
] | [
384,
0
] | [
388,
5
] | python | en | ['en', 'en', 'en'] | True |
request | (method, url, **kwargs) | Constructs and sends a :class:`Request <Request>`.
:param method: method for the new :class:`Request` object: ``GET``, ``OPTIONS``, ``HEAD``, ``POST``, ``PUT``, ``PATCH``, or ``DELETE``.
:param url: URL for the new :class:`Request` object.
:param params: (optional) Dictionary, list of tuples or bytes to se... | Constructs and sends a :class:`Request <Request>`. | def request(method, url, **kwargs):
"""Constructs and sends a :class:`Request <Request>`.
:param method: method for the new :class:`Request` object: ``GET``, ``OPTIONS``, ``HEAD``, ``POST``, ``PUT``, ``PATCH``, or ``DELETE``.
:param url: URL for the new :class:`Request` object.
:param params: (optional... | [
"def",
"request",
"(",
"method",
",",
"url",
",",
"*",
"*",
"kwargs",
")",
":",
"# By using the 'with' statement we are sure the session is closed, thus we",
"# avoid leaving sockets open which can trigger a ResourceWarning in some",
"# cases, and look like a memory leak in others.",
"... | [
15,
0
] | [
60,
64
] | python | en | ['en', 'en', 'en'] | True |
get | (url, params=None, **kwargs) | r"""Sends a GET request.
:param url: URL for the new :class:`Request` object.
:param params: (optional) Dictionary, list of tuples or bytes to send
in the query string for the :class:`Request`.
:param \*\*kwargs: Optional arguments that ``request`` takes.
:return: :class:`Response <Response>` o... | r"""Sends a GET request. | def get(url, params=None, **kwargs):
r"""Sends a GET request.
:param url: URL for the new :class:`Request` object.
:param params: (optional) Dictionary, list of tuples or bytes to send
in the query string for the :class:`Request`.
:param \*\*kwargs: Optional arguments that ``request`` takes.
... | [
"def",
"get",
"(",
"url",
",",
"params",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"kwargs",
".",
"setdefault",
"(",
"'allow_redirects'",
",",
"True",
")",
"return",
"request",
"(",
"'get'",
",",
"url",
",",
"params",
"=",
"params",
",",
"*",
... | [
63,
0
] | [
75,
55
] | python | en | ['en', 'co', 'en'] | True |
options | (url, **kwargs) | r"""Sends an OPTIONS request.
:param url: URL for the new :class:`Request` object.
:param \*\*kwargs: Optional arguments that ``request`` takes.
:return: :class:`Response <Response>` object
:rtype: requests.Response
| r"""Sends an OPTIONS request. | def options(url, **kwargs):
r"""Sends an OPTIONS request.
:param url: URL for the new :class:`Request` object.
:param \*\*kwargs: Optional arguments that ``request`` takes.
:return: :class:`Response <Response>` object
:rtype: requests.Response
"""
kwargs.setdefault('allow_redirects', True)... | [
"def",
"options",
"(",
"url",
",",
"*",
"*",
"kwargs",
")",
":",
"kwargs",
".",
"setdefault",
"(",
"'allow_redirects'",
",",
"True",
")",
"return",
"request",
"(",
"'options'",
",",
"url",
",",
"*",
"*",
"kwargs",
")"
] | [
78,
0
] | [
88,
44
] | python | en | ['en', 'en', 'en'] | True |
head | (url, **kwargs) | r"""Sends a HEAD request.
:param url: URL for the new :class:`Request` object.
:param \*\*kwargs: Optional arguments that ``request`` takes. If
`allow_redirects` is not provided, it will be set to `False` (as
opposed to the default :meth:`request` behavior).
:return: :class:`Response <Respo... | r"""Sends a HEAD request. | def head(url, **kwargs):
r"""Sends a HEAD request.
:param url: URL for the new :class:`Request` object.
:param \*\*kwargs: Optional arguments that ``request`` takes. If
`allow_redirects` is not provided, it will be set to `False` (as
opposed to the default :meth:`request` behavior).
:re... | [
"def",
"head",
"(",
"url",
",",
"*",
"*",
"kwargs",
")",
":",
"kwargs",
".",
"setdefault",
"(",
"'allow_redirects'",
",",
"False",
")",
"return",
"request",
"(",
"'head'",
",",
"url",
",",
"*",
"*",
"kwargs",
")"
] | [
91,
0
] | [
103,
41
] | python | en | ['en', 'co', 'en'] | True |
post | (url, data=None, json=None, **kwargs) | r"""Sends a POST request.
:param url: URL for the new :class:`Request` object.
:param data: (optional) Dictionary, list of tuples, bytes, or file-like
object to send in the body of the :class:`Request`.
:param json: (optional) json data to send in the body of the :class:`Request`.
:param \*\*kw... | r"""Sends a POST request. | def post(url, data=None, json=None, **kwargs):
r"""Sends a POST request.
:param url: URL for the new :class:`Request` object.
:param data: (optional) Dictionary, list of tuples, bytes, or file-like
object to send in the body of the :class:`Request`.
:param json: (optional) json data to send in ... | [
"def",
"post",
"(",
"url",
",",
"data",
"=",
"None",
",",
"json",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"request",
"(",
"'post'",
",",
"url",
",",
"data",
"=",
"data",
",",
"json",
"=",
"json",
",",
"*",
"*",
"kwargs",
")"
] | [
106,
0
] | [
118,
63
] | python | en | ['en', 'en', 'en'] | True |
put | (url, data=None, **kwargs) | r"""Sends a PUT request.
:param url: URL for the new :class:`Request` object.
:param data: (optional) Dictionary, list of tuples, bytes, or file-like
object to send in the body of the :class:`Request`.
:param json: (optional) json data to send in the body of the :class:`Request`.
:param \*\*kwa... | r"""Sends a PUT request. | def put(url, data=None, **kwargs):
r"""Sends a PUT request.
:param url: URL for the new :class:`Request` object.
:param data: (optional) Dictionary, list of tuples, bytes, or file-like
object to send in the body of the :class:`Request`.
:param json: (optional) json data to send in the body of t... | [
"def",
"put",
"(",
"url",
",",
"data",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"request",
"(",
"'put'",
",",
"url",
",",
"data",
"=",
"data",
",",
"*",
"*",
"kwargs",
")"
] | [
121,
0
] | [
133,
51
] | python | en | ['en', 'co', 'en'] | True |
patch | (url, data=None, **kwargs) | r"""Sends a PATCH request.
:param url: URL for the new :class:`Request` object.
:param data: (optional) Dictionary, list of tuples, bytes, or file-like
object to send in the body of the :class:`Request`.
:param json: (optional) json data to send in the body of the :class:`Request`.
:param \*\*k... | r"""Sends a PATCH request. | def patch(url, data=None, **kwargs):
r"""Sends a PATCH request.
:param url: URL for the new :class:`Request` object.
:param data: (optional) Dictionary, list of tuples, bytes, or file-like
object to send in the body of the :class:`Request`.
:param json: (optional) json data to send in the body ... | [
"def",
"patch",
"(",
"url",
",",
"data",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"request",
"(",
"'patch'",
",",
"url",
",",
"data",
"=",
"data",
",",
"*",
"*",
"kwargs",
")"
] | [
136,
0
] | [
148,
53
] | python | en | ['en', 'co', 'en'] | True |
delete | (url, **kwargs) | r"""Sends a DELETE request.
:param url: URL for the new :class:`Request` object.
:param \*\*kwargs: Optional arguments that ``request`` takes.
:return: :class:`Response <Response>` object
:rtype: requests.Response
| r"""Sends a DELETE request. | def delete(url, **kwargs):
r"""Sends a DELETE request.
:param url: URL for the new :class:`Request` object.
:param \*\*kwargs: Optional arguments that ``request`` takes.
:return: :class:`Response <Response>` object
:rtype: requests.Response
"""
return request('delete', url, **kwargs) | [
"def",
"delete",
"(",
"url",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"request",
"(",
"'delete'",
",",
"url",
",",
"*",
"*",
"kwargs",
")"
] | [
151,
0
] | [
160,
43
] | python | en | ['en', 'it', 'en'] | True |
async_setup_entry | (hass: HomeAssistant, entry: ConfigEntry) | Set up local_ip from a config entry. | Set up local_ip from a config entry. | async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
"""Set up local_ip from a config entry."""
hass.config_entries.async_setup_platforms(entry, PLATFORMS)
return True | [
"async",
"def",
"async_setup_entry",
"(",
"hass",
":",
"HomeAssistant",
",",
"entry",
":",
"ConfigEntry",
")",
"->",
"bool",
":",
"hass",
".",
"config_entries",
".",
"async_setup_platforms",
"(",
"entry",
",",
"PLATFORMS",
")",
"return",
"True"
] | [
10,
0
] | [
13,
15
] | python | en | ['en', 'en', 'en'] | True |
async_unload_entry | (hass: HomeAssistant, entry: ConfigEntry) | Unload a config entry. | Unload a config entry. | async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
"""Unload a config entry."""
return await hass.config_entries.async_unload_platforms(entry, PLATFORMS) | [
"async",
"def",
"async_unload_entry",
"(",
"hass",
":",
"HomeAssistant",
",",
"entry",
":",
"ConfigEntry",
")",
"->",
"bool",
":",
"return",
"await",
"hass",
".",
"config_entries",
".",
"async_unload_platforms",
"(",
"entry",
",",
"PLATFORMS",
")"
] | [
16,
0
] | [
18,
77
] | python | en | ['en', 'es', 'en'] | True |
KeywordMessage.__init__ | (self, fmt: Any, args: Any, kwargs: Mapping[str, Any]) | Initialize a new KeywordMessage object. | Initialize a new KeywordMessage object. | def __init__(self, fmt: Any, args: Any, kwargs: Mapping[str, Any]) -> None:
"""Initialize a new KeywordMessage object."""
self._fmt = fmt
self._args = args
self._kwargs = kwargs | [
"def",
"__init__",
"(",
"self",
",",
"fmt",
":",
"Any",
",",
"args",
":",
"Any",
",",
"kwargs",
":",
"Mapping",
"[",
"str",
",",
"Any",
"]",
")",
"->",
"None",
":",
"self",
".",
"_fmt",
"=",
"fmt",
"self",
".",
"_args",
"=",
"args",
"self",
"."... | [
16,
4
] | [
20,
29
] | python | en | ['en', 'en', 'en'] | True |
KeywordMessage.__str__ | (self) | Convert the object to a string for logging. | Convert the object to a string for logging. | def __str__(self) -> str:
"""Convert the object to a string for logging."""
return str(self._fmt).format(*self._args, **self._kwargs) | [
"def",
"__str__",
"(",
"self",
")",
"->",
"str",
":",
"return",
"str",
"(",
"self",
".",
"_fmt",
")",
".",
"format",
"(",
"*",
"self",
".",
"_args",
",",
"*",
"*",
"self",
".",
"_kwargs",
")"
] | [
22,
4
] | [
24,
65
] | python | en | ['en', 'en', 'en'] | True |
KeywordStyleAdapter.__init__ | (
self, logger: logging.Logger, extra: Mapping[str, Any] | None = None
) | Initialize a new StyleAdapter for the provided logger. | Initialize a new StyleAdapter for the provided logger. | def __init__(
self, logger: logging.Logger, extra: Mapping[str, Any] | None = None
) -> None:
"""Initialize a new StyleAdapter for the provided logger."""
super().__init__(logger, extra or {}) | [
"def",
"__init__",
"(",
"self",
",",
"logger",
":",
"logging",
".",
"Logger",
",",
"extra",
":",
"Mapping",
"[",
"str",
",",
"Any",
"]",
"|",
"None",
"=",
"None",
")",
"->",
"None",
":",
"super",
"(",
")",
".",
"__init__",
"(",
"logger",
",",
"ex... | [
30,
4
] | [
34,
45
] | python | en | ['en', 'en', 'en'] | True |
KeywordStyleAdapter.log | (self, level: int, msg: Any, *args: Any, **kwargs: Any) | Log the message provided at the appropriate level. | Log the message provided at the appropriate level. | def log(self, level: int, msg: Any, *args: Any, **kwargs: Any) -> None:
"""Log the message provided at the appropriate level."""
if self.isEnabledFor(level):
msg, log_kwargs = self.process(msg, kwargs)
self.logger._log( # pylint: disable=protected-access
level, K... | [
"def",
"log",
"(",
"self",
",",
"level",
":",
"int",
",",
"msg",
":",
"Any",
",",
"*",
"args",
":",
"Any",
",",
"*",
"*",
"kwargs",
":",
"Any",
")",
"->",
"None",
":",
"if",
"self",
".",
"isEnabledFor",
"(",
"level",
")",
":",
"msg",
",",
"lo... | [
36,
4
] | [
42,
13
] | python | en | ['en', 'en', 'en'] | True |
KeywordStyleAdapter.process | (
self, msg: Any, kwargs: MutableMapping[str, Any]
) | Process the keyword args in preparation for logging. | Process the keyword args in preparation for logging. | def process(
self, msg: Any, kwargs: MutableMapping[str, Any]
) -> tuple[Any, MutableMapping[str, Any]]:
"""Process the keyword args in preparation for logging."""
return (
msg,
{
k: kwargs[k]
for k in inspect.getfullargspec(
... | [
"def",
"process",
"(",
"self",
",",
"msg",
":",
"Any",
",",
"kwargs",
":",
"MutableMapping",
"[",
"str",
",",
"Any",
"]",
")",
"->",
"tuple",
"[",
"Any",
",",
"MutableMapping",
"[",
"str",
",",
"Any",
"]",
"]",
":",
"return",
"(",
"msg",
",",
"{"... | [
44,
4
] | [
57,
9
] | python | en | ['en', 'en', 'en'] | True |
test_setup_entry_login_error | (hass) | Test entry setup failed due to login error. | Test entry setup failed due to login error. | async def test_setup_entry_login_error(hass):
"""Test entry setup failed due to login error."""
entry = mock_config_entry()
with patch(
"homeassistant.components.ruckus_unleashed.Ruckus",
side_effect=AuthenticationError,
):
entry.add_to_hass(hass)
result = await hass.conf... | [
"async",
"def",
"test_setup_entry_login_error",
"(",
"hass",
")",
":",
"entry",
"=",
"mock_config_entry",
"(",
")",
"with",
"patch",
"(",
"\"homeassistant.components.ruckus_unleashed.Ruckus\"",
",",
"side_effect",
"=",
"AuthenticationError",
",",
")",
":",
"entry",
".... | [
29,
0
] | [
40,
26
] | python | en | ['en', 'en', 'en'] | True |
test_setup_entry_connection_error | (hass) | Test entry setup failed due to connection error. | Test entry setup failed due to connection error. | async def test_setup_entry_connection_error(hass):
"""Test entry setup failed due to connection error."""
entry = mock_config_entry()
with patch(
"homeassistant.components.ruckus_unleashed.Ruckus",
side_effect=ConnectionError,
):
entry.add_to_hass(hass)
await hass.config_... | [
"async",
"def",
"test_setup_entry_connection_error",
"(",
"hass",
")",
":",
"entry",
"=",
"mock_config_entry",
"(",
")",
"with",
"patch",
"(",
"\"homeassistant.components.ruckus_unleashed.Ruckus\"",
",",
"side_effect",
"=",
"ConnectionError",
",",
")",
":",
"entry",
"... | [
43,
0
] | [
54,
54
] | python | en | ['en', 'en', 'en'] | True |
test_router_device_setup | (hass) | Test a router device is created. | Test a router device is created. | async def test_router_device_setup(hass):
"""Test a router device is created."""
await init_integration(hass)
device_info = DEFAULT_AP_INFO[API_AP][API_ID]["1"]
device_registry = dr.async_get(hass)
device = device_registry.async_get_device(
identifiers={(CONNECTION_NETWORK_MAC, device_info... | [
"async",
"def",
"test_router_device_setup",
"(",
"hass",
")",
":",
"await",
"init_integration",
"(",
"hass",
")",
"device_info",
"=",
"DEFAULT_AP_INFO",
"[",
"API_AP",
"]",
"[",
"API_ID",
"]",
"[",
"\"1\"",
"]",
"device_registry",
"=",
"dr",
".",
"async_get",
... | [
57,
0
] | [
74,
39
] | python | en | ['en', 'en', 'en'] | True |
test_unload_entry | (hass) | Test successful unload of entry. | Test successful unload of entry. | async def test_unload_entry(hass):
"""Test successful unload of entry."""
entry = await init_integration(hass)
assert len(hass.config_entries.async_entries(DOMAIN)) == 1
assert entry.state is ConfigEntryState.LOADED
assert await hass.config_entries.async_unload(entry.entry_id)
await hass.async... | [
"async",
"def",
"test_unload_entry",
"(",
"hass",
")",
":",
"entry",
"=",
"await",
"init_integration",
"(",
"hass",
")",
"assert",
"len",
"(",
"hass",
".",
"config_entries",
".",
"async_entries",
"(",
"DOMAIN",
")",
")",
"==",
"1",
"assert",
"entry",
".",
... | [
77,
0
] | [
88,
36
] | python | en | ['en', 'en', 'en'] | True |
test_config_not_ready_during_setup | (hass) | Test we throw a ConfigNotReady if Coordinator update fails. | Test we throw a ConfigNotReady if Coordinator update fails. | async def test_config_not_ready_during_setup(hass):
"""Test we throw a ConfigNotReady if Coordinator update fails."""
entry = mock_config_entry()
with patch(
"homeassistant.components.ruckus_unleashed.Ruckus.connect",
return_value=None,
), patch(
"homeassistant.components.ruckus_... | [
"async",
"def",
"test_config_not_ready_during_setup",
"(",
"hass",
")",
":",
"entry",
"=",
"mock_config_entry",
"(",
")",
"with",
"patch",
"(",
"\"homeassistant.components.ruckus_unleashed.Ruckus.connect\"",
",",
"return_value",
"=",
"None",
",",
")",
",",
"patch",
"(... | [
91,
0
] | [
111,
54
] | python | en | ['en', 'en', 'en'] | True |
_find_vc2017 | () | Returns "15, path" based on the result of invoking vswhere.exe
If no install is found, returns "None, None"
The version is returned to avoid unnecessarily changing the function
result. It may be ignored when the path is not None.
If vswhere.exe is not available, by definition, VS 2017 is not
insta... | Returns "15, path" based on the result of invoking vswhere.exe
If no install is found, returns "None, None" | def _find_vc2017():
"""Returns "15, path" based on the result of invoking vswhere.exe
If no install is found, returns "None, None"
The version is returned to avoid unnecessarily changing the function
result. It may be ignored when the path is not None.
If vswhere.exe is not available, by definitio... | [
"def",
"_find_vc2017",
"(",
")",
":",
"root",
"=",
"os",
".",
"environ",
".",
"get",
"(",
"\"ProgramFiles(x86)\"",
")",
"or",
"os",
".",
"environ",
".",
"get",
"(",
"\"ProgramFiles\"",
")",
"if",
"not",
"root",
":",
"return",
"None",
",",
"None",
"try"... | [
59,
0
] | [
89,
21
] | python | en | ['en', 'en', 'en'] | True |
_find_exe | (exe, paths=None) | Return path to an MSVC executable program.
Tries to find the program in several places: first, one of the
MSVC program search paths from the registry; next, the directories
in the PATH environment variable. If any of those work, return an
absolute path that is known to exist. If none of them work, ju... | Return path to an MSVC executable program. | def _find_exe(exe, paths=None):
"""Return path to an MSVC executable program.
Tries to find the program in several places: first, one of the
MSVC program search paths from the registry; next, the directories
in the PATH environment variable. If any of those work, return an
absolute path that is kn... | [
"def",
"_find_exe",
"(",
"exe",
",",
"paths",
"=",
"None",
")",
":",
"if",
"not",
"paths",
":",
"paths",
"=",
"os",
".",
"getenv",
"(",
"'path'",
")",
".",
"split",
"(",
"os",
".",
"pathsep",
")",
"for",
"p",
"in",
"paths",
":",
"fn",
"=",
"os"... | [
146,
0
] | [
161,
14
] | python | en | ['en', 'en', 'en'] | True |
MSVCCompiler._fallback_spawn | (self, cmd, env) |
Discovered in pypa/distutils#15, some tools monkeypatch the compiler,
so the 'env' kwarg causes a TypeError. Detect this condition and
restore the legacy, unsafe behavior.
|
Discovered in pypa/distutils#15, some tools monkeypatch the compiler,
so the 'env' kwarg causes a TypeError. Detect this condition and
restore the legacy, unsafe behavior.
| def _fallback_spawn(self, cmd, env):
"""
Discovered in pypa/distutils#15, some tools monkeypatch the compiler,
so the 'env' kwarg causes a TypeError. Detect this condition and
restore the legacy, unsafe behavior.
"""
bag = type('Bag', (), {})()
try:
yi... | [
"def",
"_fallback_spawn",
"(",
"self",
",",
"cmd",
",",
"env",
")",
":",
"bag",
"=",
"type",
"(",
"'Bag'",
",",
"(",
")",
",",
"{",
"}",
")",
"(",
")",
"try",
":",
"yield",
"bag",
"except",
"TypeError",
"as",
"exc",
":",
"if",
"\"unexpected keyword... | [
513,
4
] | [
530,
42
] | python | en | ['en', 'error', 'th'] | False |
create_motion_sensor_service | (accessory) | Define motion characteristics as per page 225 of HAP spec. | Define motion characteristics as per page 225 of HAP spec. | def create_motion_sensor_service(accessory):
"""Define motion characteristics as per page 225 of HAP spec."""
service = accessory.add_service(ServicesTypes.MOTION_SENSOR)
cur_state = service.add_char(CharacteristicsTypes.MOTION_DETECTED)
cur_state.value = 0 | [
"def",
"create_motion_sensor_service",
"(",
"accessory",
")",
":",
"service",
"=",
"accessory",
".",
"add_service",
"(",
"ServicesTypes",
".",
"MOTION_SENSOR",
")",
"cur_state",
"=",
"service",
".",
"add_char",
"(",
"CharacteristicsTypes",
".",
"MOTION_DETECTED",
")... | [
23,
0
] | [
28,
23
] | python | en | ['en', 'en', 'en'] | True |
test_motion_sensor_read_state | (hass, utcnow) | Test that we can read the state of a HomeKit motion sensor accessory. | Test that we can read the state of a HomeKit motion sensor accessory. | async def test_motion_sensor_read_state(hass, utcnow):
"""Test that we can read the state of a HomeKit motion sensor accessory."""
helper = await setup_test_component(hass, create_motion_sensor_service)
helper.characteristics[MOTION_DETECTED].value = False
state = await helper.poll_and_get_state()
... | [
"async",
"def",
"test_motion_sensor_read_state",
"(",
"hass",
",",
"utcnow",
")",
":",
"helper",
"=",
"await",
"setup_test_component",
"(",
"hass",
",",
"create_motion_sensor_service",
")",
"helper",
".",
"characteristics",
"[",
"MOTION_DETECTED",
"]",
".",
"value",... | [
31,
0
] | [
43,
66
] | python | en | ['en', 'en', 'en'] | True |
create_contact_sensor_service | (accessory) | Define contact characteristics. | Define contact characteristics. | def create_contact_sensor_service(accessory):
"""Define contact characteristics."""
service = accessory.add_service(ServicesTypes.CONTACT_SENSOR)
cur_state = service.add_char(CharacteristicsTypes.CONTACT_STATE)
cur_state.value = 0 | [
"def",
"create_contact_sensor_service",
"(",
"accessory",
")",
":",
"service",
"=",
"accessory",
".",
"add_service",
"(",
"ServicesTypes",
".",
"CONTACT_SENSOR",
")",
"cur_state",
"=",
"service",
".",
"add_char",
"(",
"CharacteristicsTypes",
".",
"CONTACT_STATE",
")... | [
46,
0
] | [
51,
23
] | python | ca | ['it', 'ca', 'en'] | False |
test_contact_sensor_read_state | (hass, utcnow) | Test that we can read the state of a HomeKit contact accessory. | Test that we can read the state of a HomeKit contact accessory. | async def test_contact_sensor_read_state(hass, utcnow):
"""Test that we can read the state of a HomeKit contact accessory."""
helper = await setup_test_component(hass, create_contact_sensor_service)
helper.characteristics[CONTACT_STATE].value = 0
state = await helper.poll_and_get_state()
assert sta... | [
"async",
"def",
"test_contact_sensor_read_state",
"(",
"hass",
",",
"utcnow",
")",
":",
"helper",
"=",
"await",
"setup_test_component",
"(",
"hass",
",",
"create_contact_sensor_service",
")",
"helper",
".",
"characteristics",
"[",
"CONTACT_STATE",
"]",
".",
"value",... | [
54,
0
] | [
66,
67
] | python | en | ['en', 'en', 'en'] | True |
create_smoke_sensor_service | (accessory) | Define smoke sensor characteristics. | Define smoke sensor characteristics. | def create_smoke_sensor_service(accessory):
"""Define smoke sensor characteristics."""
service = accessory.add_service(ServicesTypes.SMOKE_SENSOR)
cur_state = service.add_char(CharacteristicsTypes.SMOKE_DETECTED)
cur_state.value = 0 | [
"def",
"create_smoke_sensor_service",
"(",
"accessory",
")",
":",
"service",
"=",
"accessory",
".",
"add_service",
"(",
"ServicesTypes",
".",
"SMOKE_SENSOR",
")",
"cur_state",
"=",
"service",
".",
"add_char",
"(",
"CharacteristicsTypes",
".",
"SMOKE_DETECTED",
")",
... | [
69,
0
] | [
74,
23
] | python | en | ['en', 'bs', 'en'] | True |
test_smoke_sensor_read_state | (hass, utcnow) | Test that we can read the state of a HomeKit contact accessory. | Test that we can read the state of a HomeKit contact accessory. | async def test_smoke_sensor_read_state(hass, utcnow):
"""Test that we can read the state of a HomeKit contact accessory."""
helper = await setup_test_component(hass, create_smoke_sensor_service)
helper.characteristics[SMOKE_DETECTED].value = 0
state = await helper.poll_and_get_state()
assert state.... | [
"async",
"def",
"test_smoke_sensor_read_state",
"(",
"hass",
",",
"utcnow",
")",
":",
"helper",
"=",
"await",
"setup_test_component",
"(",
"hass",
",",
"create_smoke_sensor_service",
")",
"helper",
".",
"characteristics",
"[",
"SMOKE_DETECTED",
"]",
".",
"value",
... | [
77,
0
] | [
89,
65
] | python | en | ['en', 'en', 'en'] | True |
create_carbon_monoxide_sensor_service | (accessory) | Define carbon monoxide sensor characteristics. | Define carbon monoxide sensor characteristics. | def create_carbon_monoxide_sensor_service(accessory):
"""Define carbon monoxide sensor characteristics."""
service = accessory.add_service(ServicesTypes.CARBON_MONOXIDE_SENSOR)
cur_state = service.add_char(CharacteristicsTypes.CARBON_MONOXIDE_DETECTED)
cur_state.value = 0 | [
"def",
"create_carbon_monoxide_sensor_service",
"(",
"accessory",
")",
":",
"service",
"=",
"accessory",
".",
"add_service",
"(",
"ServicesTypes",
".",
"CARBON_MONOXIDE_SENSOR",
")",
"cur_state",
"=",
"service",
".",
"add_char",
"(",
"CharacteristicsTypes",
".",
"CARB... | [
92,
0
] | [
97,
23
] | python | it | ['it', 'ca', 'it'] | True |
test_carbon_monoxide_sensor_read_state | (hass, utcnow) | Test that we can read the state of a HomeKit contact accessory. | Test that we can read the state of a HomeKit contact accessory. | async def test_carbon_monoxide_sensor_read_state(hass, utcnow):
"""Test that we can read the state of a HomeKit contact accessory."""
helper = await setup_test_component(hass, create_carbon_monoxide_sensor_service)
helper.characteristics[CARBON_MONOXIDE_DETECTED].value = 0
state = await helper.poll_and... | [
"async",
"def",
"test_carbon_monoxide_sensor_read_state",
"(",
"hass",
",",
"utcnow",
")",
":",
"helper",
"=",
"await",
"setup_test_component",
"(",
"hass",
",",
"create_carbon_monoxide_sensor_service",
")",
"helper",
".",
"characteristics",
"[",
"CARBON_MONOXIDE_DETECTED... | [
100,
0
] | [
112,
63
] | python | en | ['en', 'en', 'en'] | True |
create_occupancy_sensor_service | (accessory) | Define occupancy characteristics. | Define occupancy characteristics. | def create_occupancy_sensor_service(accessory):
"""Define occupancy characteristics."""
service = accessory.add_service(ServicesTypes.OCCUPANCY_SENSOR)
cur_state = service.add_char(CharacteristicsTypes.OCCUPANCY_DETECTED)
cur_state.value = 0 | [
"def",
"create_occupancy_sensor_service",
"(",
"accessory",
")",
":",
"service",
"=",
"accessory",
".",
"add_service",
"(",
"ServicesTypes",
".",
"OCCUPANCY_SENSOR",
")",
"cur_state",
"=",
"service",
".",
"add_char",
"(",
"CharacteristicsTypes",
".",
"OCCUPANCY_DETECT... | [
115,
0
] | [
120,
23
] | python | en | ['sv', 'zh', 'en'] | False |
test_occupancy_sensor_read_state | (hass, utcnow) | Test that we can read the state of a HomeKit occupancy sensor accessory. | Test that we can read the state of a HomeKit occupancy sensor accessory. | async def test_occupancy_sensor_read_state(hass, utcnow):
"""Test that we can read the state of a HomeKit occupancy sensor accessory."""
helper = await setup_test_component(hass, create_occupancy_sensor_service)
helper.characteristics[OCCUPANCY_DETECTED].value = False
state = await helper.poll_and_get_... | [
"async",
"def",
"test_occupancy_sensor_read_state",
"(",
"hass",
",",
"utcnow",
")",
":",
"helper",
"=",
"await",
"setup_test_component",
"(",
"hass",
",",
"create_occupancy_sensor_service",
")",
"helper",
".",
"characteristics",
"[",
"OCCUPANCY_DETECTED",
"]",
".",
... | [
123,
0
] | [
135,
69
] | python | en | ['en', 'en', 'en'] | True |
create_leak_sensor_service | (accessory) | Define leak characteristics. | Define leak characteristics. | def create_leak_sensor_service(accessory):
"""Define leak characteristics."""
service = accessory.add_service(ServicesTypes.LEAK_SENSOR)
cur_state = service.add_char(CharacteristicsTypes.LEAK_DETECTED)
cur_state.value = 0 | [
"def",
"create_leak_sensor_service",
"(",
"accessory",
")",
":",
"service",
"=",
"accessory",
".",
"add_service",
"(",
"ServicesTypes",
".",
"LEAK_SENSOR",
")",
"cur_state",
"=",
"service",
".",
"add_char",
"(",
"CharacteristicsTypes",
".",
"LEAK_DETECTED",
")",
"... | [
138,
0
] | [
143,
23
] | python | en | ['en', 'bg', 'en'] | True |
test_leak_sensor_read_state | (hass, utcnow) | Test that we can read the state of a HomeKit leak sensor accessory. | Test that we can read the state of a HomeKit leak sensor accessory. | async def test_leak_sensor_read_state(hass, utcnow):
"""Test that we can read the state of a HomeKit leak sensor accessory."""
helper = await setup_test_component(hass, create_leak_sensor_service)
helper.characteristics[LEAK_DETECTED].value = 0
state = await helper.poll_and_get_state()
assert state... | [
"async",
"def",
"test_leak_sensor_read_state",
"(",
"hass",
",",
"utcnow",
")",
":",
"helper",
"=",
"await",
"setup_test_component",
"(",
"hass",
",",
"create_leak_sensor_service",
")",
"helper",
".",
"characteristics",
"[",
"LEAK_DETECTED",
"]",
".",
"value",
"="... | [
146,
0
] | [
158,
68
] | python | en | ['en', 'en', 'en'] | True |
Dog.openapi_types | () |
This must be a method because a model may have properties that are
of type self, this must run after the class is loaded
Returns
openapi_types (dict): The key is attribute name
and the value is attribute type.
|
This must be a method because a model may have properties that are
of type self, this must run after the class is loaded | def openapi_types():
"""
This must be a method because a model may have properties that are
of type self, this must run after the class is loaded
Returns
openapi_types (dict): The key is attribute name
and the value is attribute type.
"""
lazy... | [
"def",
"openapi_types",
"(",
")",
":",
"lazy_import",
"(",
")",
"return",
"{",
"'class_name'",
":",
"(",
"str",
",",
")",
",",
"# noqa: E501",
"'breed'",
":",
"(",
"str",
",",
")",
",",
"# noqa: E501",
"'color'",
":",
"(",
"str",
",",
")",
",",
"# no... | [
70,
4
] | [
84,
9
] | python | en | ['en', 'error', 'th'] | False |
Dog.__init__ | (self, class_name, *args, **kwargs) | Dog - a model defined in OpenAPI
Args:
class_name (str):
Keyword Args:
_check_type (bool): if True, values for parameters in openapi_types
will be type checked and a TypeError will be
raised if the wrong type is in... | Dog - a model defined in OpenAPI | def __init__(self, class_name, *args, **kwargs): # noqa: E501
"""Dog - a model defined in OpenAPI
Args:
class_name (str):
Keyword Args:
_check_type (bool): if True, values for parameters in openapi_types
will be type checked and a TypeEr... | [
"def",
"__init__",
"(",
"self",
",",
"class_name",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"# noqa: E501",
"_check_type",
"=",
"kwargs",
".",
"pop",
"(",
"'_check_type'",
",",
"True",
")",
"_spec_property_naming",
"=",
"kwargs",
".",
"pop",
... | [
113,
4
] | [
206,
46
] | python | en | ['en', 'en', 'en'] | True |
generate_filter | (
include_domains,
include_entities,
exclude_domains,
exclude_entites,
include_globs=None,
exclude_globs=None,
) | Generate an entity filter using the standard method. | Generate an entity filter using the standard method. | def generate_filter(
include_domains,
include_entities,
exclude_domains,
exclude_entites,
include_globs=None,
exclude_globs=None,
):
"""Generate an entity filter using the standard method."""
return convert_filter(
{
CONF_INCLUDE_DOMAINS: include_domains,
... | [
"def",
"generate_filter",
"(",
"include_domains",
",",
"include_entities",
",",
"exclude_domains",
",",
"exclude_entites",
",",
"include_globs",
"=",
"None",
",",
"exclude_globs",
"=",
"None",
",",
")",
":",
"return",
"convert_filter",
"(",
"{",
"CONF_INCLUDE_DOMAIN... | [
78,
0
] | [
96,
5
] | python | en | ['en', 'en', 'en'] | True |
always_patch_driver | (hk_driver) | Load the hk_driver fixture. | Load the hk_driver fixture. | def always_patch_driver(hk_driver):
"""Load the hk_driver fixture.""" | [
"def",
"always_patch_driver",
"(",
"hk_driver",
")",
":"
] | [
100,
0
] | [
101,
37
] | python | en | ['en', 'en', 'en'] | True |
patch_source_ip | (mock_get_source_ip) | Patch homeassistant and pyhap functions for getting local address. | Patch homeassistant and pyhap functions for getting local address. | def patch_source_ip(mock_get_source_ip):
"""Patch homeassistant and pyhap functions for getting local address."""
with patch("pyhap.util.get_local_address", return_value="10.10.10.10"):
yield | [
"def",
"patch_source_ip",
"(",
"mock_get_source_ip",
")",
":",
"with",
"patch",
"(",
"\"pyhap.util.get_local_address\"",
",",
"return_value",
"=",
"\"10.10.10.10\"",
")",
":",
"yield"
] | [
105,
0
] | [
108,
13
] | python | en | ['en', 'en', 'en'] | True |
test_setup_min | (hass, mock_zeroconf) | Test async_setup with min config options. | Test async_setup with min config options. | async def test_setup_min(hass, mock_zeroconf):
"""Test async_setup with min config options."""
await async_setup_component(hass, "persistent_notification", {})
entry = MockConfigEntry(
domain=DOMAIN,
data={CONF_NAME: BRIDGE_NAME, CONF_PORT: DEFAULT_PORT},
options={},
)
entry.... | [
"async",
"def",
"test_setup_min",
"(",
"hass",
",",
"mock_zeroconf",
")",
":",
"await",
"async_setup_component",
"(",
"hass",
",",
"\"persistent_notification\"",
",",
"{",
"}",
")",
"entry",
"=",
"MockConfigEntry",
"(",
"domain",
"=",
"DOMAIN",
",",
"data",
"=... | [
147,
0
] | [
183,
52
] | python | en | ['en', 'en', 'en'] | True |
test_setup_auto_start_disabled | (hass, mock_zeroconf) | Test async_setup with auto start disabled and test service calls. | Test async_setup with auto start disabled and test service calls. | async def test_setup_auto_start_disabled(hass, mock_zeroconf):
"""Test async_setup with auto start disabled and test service calls."""
await async_setup_component(hass, "persistent_notification", {})
entry = MockConfigEntry(
domain=DOMAIN,
data={CONF_NAME: "Test Name", CONF_PORT: 11111, CONF... | [
"async",
"def",
"test_setup_auto_start_disabled",
"(",
"hass",
",",
"mock_zeroconf",
")",
":",
"await",
"async_setup_component",
"(",
"hass",
",",
"\"persistent_notification\"",
",",
"{",
"}",
")",
"entry",
"=",
"MockConfigEntry",
"(",
"domain",
"=",
"DOMAIN",
","... | [
186,
0
] | [
240,
46
] | python | en | ['en', 'en', 'en'] | True |
test_homekit_setup | (hass, hk_driver, mock_zeroconf) | Test setup of bridge and driver. | Test setup of bridge and driver. | async def test_homekit_setup(hass, hk_driver, mock_zeroconf):
"""Test setup of bridge and driver."""
entry = MockConfigEntry(
domain=DOMAIN,
data={CONF_NAME: "mock_name", CONF_PORT: 12345},
source=SOURCE_IMPORT,
)
homekit = HomeKit(
hass,
BRIDGE_NAME,
DEFA... | [
"async",
"def",
"test_homekit_setup",
"(",
"hass",
",",
"hk_driver",
",",
"mock_zeroconf",
")",
":",
"entry",
"=",
"MockConfigEntry",
"(",
"domain",
"=",
"DOMAIN",
",",
"data",
"=",
"{",
"CONF_NAME",
":",
"\"mock_name\"",
",",
"CONF_PORT",
":",
"12345",
"}",... | [
243,
0
] | [
283,
44
] | python | en | ['en', 'ceb', 'en'] | True |
test_homekit_setup_ip_address | (hass, hk_driver, mock_zeroconf) | Test setup with given IP address. | Test setup with given IP address. | async def test_homekit_setup_ip_address(hass, hk_driver, mock_zeroconf):
"""Test setup with given IP address."""
entry = MockConfigEntry(
domain=DOMAIN,
data={CONF_NAME: "mock_name", CONF_PORT: 12345},
source=SOURCE_IMPORT,
)
homekit = HomeKit(
hass,
BRIDGE_NAME,
... | [
"async",
"def",
"test_homekit_setup_ip_address",
"(",
"hass",
",",
"hk_driver",
",",
"mock_zeroconf",
")",
":",
"entry",
"=",
"MockConfigEntry",
"(",
"domain",
"=",
"DOMAIN",
",",
"data",
"=",
"{",
"CONF_NAME",
":",
"\"mock_name\"",
",",
"CONF_PORT",
":",
"123... | [
286,
0
] | [
322,
5
] | python | en | ['en', 'en', 'en'] | True |
test_homekit_setup_advertise_ip | (hass, hk_driver, mock_zeroconf) | Test setup with given IP address to advertise. | Test setup with given IP address to advertise. | async def test_homekit_setup_advertise_ip(hass, hk_driver, mock_zeroconf):
"""Test setup with given IP address to advertise."""
entry = MockConfigEntry(
domain=DOMAIN,
data={CONF_NAME: "mock_name", CONF_PORT: 12345},
source=SOURCE_IMPORT,
)
homekit = HomeKit(
hass,
... | [
"async",
"def",
"test_homekit_setup_advertise_ip",
"(",
"hass",
",",
"hk_driver",
",",
"mock_zeroconf",
")",
":",
"entry",
"=",
"MockConfigEntry",
"(",
"domain",
"=",
"DOMAIN",
",",
"data",
"=",
"{",
"CONF_NAME",
":",
"\"mock_name\"",
",",
"CONF_PORT",
":",
"1... | [
325,
0
] | [
361,
5
] | python | en | ['en', 'en', 'en'] | True |
test_homekit_add_accessory | (hass, mock_zeroconf) | Add accessory if config exists and get_acc returns an accessory. | Add accessory if config exists and get_acc returns an accessory. | async def test_homekit_add_accessory(hass, mock_zeroconf):
"""Add accessory if config exists and get_acc returns an accessory."""
await async_setup_component(hass, "persistent_notification", {})
entry = MockConfigEntry(
domain=DOMAIN, data={CONF_NAME: "mock_name", CONF_PORT: 12345}
)
entry.a... | [
"async",
"def",
"test_homekit_add_accessory",
"(",
"hass",
",",
"mock_zeroconf",
")",
":",
"await",
"async_setup_component",
"(",
"hass",
",",
"\"persistent_notification\"",
",",
"{",
"}",
")",
"entry",
"=",
"MockConfigEntry",
"(",
"domain",
"=",
"DOMAIN",
",",
... | [
364,
0
] | [
396,
50
] | python | en | ['en', 'en', 'en'] | True |
test_homekit_warn_add_accessory_bridge | (
hass, acc_category, mock_zeroconf, caplog
) | Test we warn when adding cameras or tvs to a bridge. | Test we warn when adding cameras or tvs to a bridge. | async def test_homekit_warn_add_accessory_bridge(
hass, acc_category, mock_zeroconf, caplog
):
"""Test we warn when adding cameras or tvs to a bridge."""
await async_setup_component(hass, "persistent_notification", {})
entry = MockConfigEntry(
domain=DOMAIN, data={CONF_NAME: "mock_name", CONF_PO... | [
"async",
"def",
"test_homekit_warn_add_accessory_bridge",
"(",
"hass",
",",
"acc_category",
",",
"mock_zeroconf",
",",
"caplog",
")",
":",
"await",
"async_setup_component",
"(",
"hass",
",",
"\"persistent_notification\"",
",",
"{",
"}",
")",
"entry",
"=",
"MockConfi... | [
400,
0
] | [
426,
42
] | python | en | ['en', 'de', 'en'] | True |
test_homekit_remove_accessory | (hass, mock_zeroconf) | Remove accessory from bridge. | Remove accessory from bridge. | async def test_homekit_remove_accessory(hass, mock_zeroconf):
"""Remove accessory from bridge."""
entry = await async_init_integration(hass)
homekit = _mock_homekit(hass, entry, HOMEKIT_MODE_BRIDGE)
homekit.driver = "driver"
homekit.bridge = _mock_pyhap_bridge()
acc_mock = MagicMock()
home... | [
"async",
"def",
"test_homekit_remove_accessory",
"(",
"hass",
",",
"mock_zeroconf",
")",
":",
"entry",
"=",
"await",
"async_init_integration",
"(",
"hass",
")",
"homekit",
"=",
"_mock_homekit",
"(",
"hass",
",",
"entry",
",",
"HOMEKIT_MODE_BRIDGE",
")",
"homekit",... | [
429,
0
] | [
443,
47
] | python | en | ['en', 'it', 'en'] | True |
test_homekit_entity_filter | (hass, mock_zeroconf) | Test the entity filter. | Test the entity filter. | async def test_homekit_entity_filter(hass, mock_zeroconf):
"""Test the entity filter."""
entry = await async_init_integration(hass)
entity_filter = generate_filter(["cover"], ["demo.test"], [], [])
homekit = _mock_homekit(hass, entry, HOMEKIT_MODE_BRIDGE, entity_filter)
homekit.bridge = Mock()
... | [
"async",
"def",
"test_homekit_entity_filter",
"(",
"hass",
",",
"mock_zeroconf",
")",
":",
"entry",
"=",
"await",
"async_init_integration",
"(",
"hass",
")",
"entity_filter",
"=",
"generate_filter",
"(",
"[",
"\"cover\"",
"]",
",",
"[",
"\"demo.test\"",
"]",
","... | [
446,
0
] | [
462,
63
] | python | en | ['en', 'en', 'en'] | True |
test_homekit_entity_glob_filter | (hass, mock_zeroconf) | Test the entity filter. | Test the entity filter. | async def test_homekit_entity_glob_filter(hass, mock_zeroconf):
"""Test the entity filter."""
entry = await async_init_integration(hass)
entity_filter = generate_filter(
["cover"], ["demo.test"], [], [], ["*.included_*"], ["*.excluded_*"]
)
homekit = _mock_homekit(hass, entry, HOMEKIT_MODE_... | [
"async",
"def",
"test_homekit_entity_glob_filter",
"(",
"hass",
",",
"mock_zeroconf",
")",
":",
"entry",
"=",
"await",
"async_init_integration",
"(",
"hass",
")",
"entity_filter",
"=",
"generate_filter",
"(",
"[",
"\"cover\"",
"]",
",",
"[",
"\"demo.test\"",
"]",
... | [
465,
0
] | [
486,
68
] | python | en | ['en', 'en', 'en'] | True |
test_homekit_start | (hass, hk_driver, mock_zeroconf, device_reg) | Test HomeKit start method. | Test HomeKit start method. | async def test_homekit_start(hass, hk_driver, mock_zeroconf, device_reg):
"""Test HomeKit start method."""
entry = await async_init_integration(hass)
homekit = _mock_homekit(hass, entry, HOMEKIT_MODE_BRIDGE)
homekit.bridge = Mock()
homekit.bridge.accessories = []
homekit.driver = hk_driver
... | [
"async",
"def",
"test_homekit_start",
"(",
"hass",
",",
"hk_driver",
",",
"mock_zeroconf",
",",
"device_reg",
")",
":",
"entry",
"=",
"await",
"async_init_integration",
"(",
"hass",
")",
"homekit",
"=",
"_mock_homekit",
"(",
"hass",
",",
"entry",
",",
"HOMEKIT... | [
489,
0
] | [
561,
51
] | python | en | ['en', 'et', 'en'] | True |
test_homekit_start_with_a_broken_accessory | (hass, hk_driver, mock_zeroconf) | Test HomeKit start method. | Test HomeKit start method. | async def test_homekit_start_with_a_broken_accessory(hass, hk_driver, mock_zeroconf):
"""Test HomeKit start method."""
entry = MockConfigEntry(
domain=DOMAIN, data={CONF_NAME: "mock_name", CONF_PORT: 12345}
)
entity_filter = generate_filter(["cover", "light"], ["demo.test"], [], [])
await a... | [
"async",
"def",
"test_homekit_start_with_a_broken_accessory",
"(",
"hass",
",",
"hk_driver",
",",
"mock_zeroconf",
")",
":",
"entry",
"=",
"MockConfigEntry",
"(",
"domain",
"=",
"DOMAIN",
",",
"data",
"=",
"{",
"CONF_NAME",
":",
"\"mock_name\"",
",",
"CONF_PORT",
... | [
564,
0
] | [
600,
37
] | python | en | ['en', 'et', 'en'] | True |
test_homekit_start_with_a_device | (
hass, hk_driver, mock_zeroconf, demo_cleanup, device_reg, entity_reg
) | Test HomeKit start method with a device. | Test HomeKit start method with a device. | async def test_homekit_start_with_a_device(
hass, hk_driver, mock_zeroconf, demo_cleanup, device_reg, entity_reg
):
"""Test HomeKit start method with a device."""
entry = MockConfigEntry(
domain=DOMAIN, data={CONF_NAME: "mock_name", CONF_PORT: 12345}
)
assert await async_setup_component(has... | [
"async",
"def",
"test_homekit_start_with_a_device",
"(",
"hass",
",",
"hk_driver",
",",
"mock_zeroconf",
",",
"demo_cleanup",
",",
"device_reg",
",",
"entity_reg",
")",
":",
"entry",
"=",
"MockConfigEntry",
"(",
"domain",
"=",
"DOMAIN",
",",
"data",
"=",
"{",
... | [
603,
0
] | [
635,
30
] | 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.