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
toggle
(hass, entity_id)
Toggle the script. This is a legacy helper method. Do not use it for new tests.
Toggle the script.
def toggle(hass, entity_id): """Toggle the script. This is a legacy helper method. Do not use it for new tests. """ hass.services.call(DOMAIN, SERVICE_TOGGLE, {ATTR_ENTITY_ID: entity_id})
[ "def", "toggle", "(", "hass", ",", "entity_id", ")", ":", "hass", ".", "services", ".", "call", "(", "DOMAIN", ",", "SERVICE_TOGGLE", ",", "{", "ATTR_ENTITY_ID", ":", "entity_id", "}", ")" ]
[ 53, 0 ]
[ 58, 75 ]
python
en
['en', 'it', 'en']
True
reload
(hass)
Reload script component. This is a legacy helper method. Do not use it for new tests.
Reload script component.
def reload(hass): """Reload script component. This is a legacy helper method. Do not use it for new tests. """ hass.services.call(DOMAIN, SERVICE_RELOAD)
[ "def", "reload", "(", "hass", ")", ":", "hass", ".", "services", ".", "call", "(", "DOMAIN", ",", "SERVICE_RELOAD", ")" ]
[ 62, 0 ]
[ 67, 46 ]
python
ca
['de', 'ca', 'en']
False
test_turn_on_off_toggle
(hass, toggle)
Verify turn_on, turn_off & toggle services.
Verify turn_on, turn_off & toggle services.
async def test_turn_on_off_toggle(hass, toggle): """Verify turn_on, turn_off & toggle services.""" event = "test_event" event_mock = Mock() hass.bus.async_listen(event, event_mock) was_on = False @callback def state_listener(entity_id, old_state, new_state): nonlocal was_on ...
[ "async", "def", "test_turn_on_off_toggle", "(", "hass", ",", "toggle", ")", ":", "event", "=", "\"test_event\"", "event_mock", "=", "Mock", "(", ")", "hass", ".", "bus", ".", "async_listen", "(", "event", ",", "event_mock", ")", "was_on", "=", "False", "@"...
[ 131, 0 ]
[ 175, 37 ]
python
en
['en', 'en', 'en']
True
test_setup_with_invalid_configs
(hass, value)
Test setup with invalid configs.
Test setup with invalid configs.
async def test_setup_with_invalid_configs(hass, value): """Test setup with invalid configs.""" assert await async_setup_component( hass, "script", {"script": value} ), f"Script loaded with wrong config {value}" assert 0 == len(hass.states.async_entity_ids("script"))
[ "async", "def", "test_setup_with_invalid_configs", "(", "hass", ",", "value", ")", ":", "assert", "await", "async_setup_component", "(", "hass", ",", "\"script\"", ",", "{", "\"script\"", ":", "value", "}", ")", ",", "f\"Script loaded with wrong config {value}\"", "...
[ 186, 0 ]
[ 192, 59 ]
python
en
['en', 'en', 'en']
True
test_reload_service
(hass, running)
Verify the reload service.
Verify the reload service.
async def test_reload_service(hass, running): """Verify the reload service.""" event = "test_event" event_flag = asyncio.Event() @callback def event_handler(event): event_flag.set() hass.bus.async_listen_once(event, event_handler) hass.states.async_set("test.script", "off") as...
[ "async", "def", "test_reload_service", "(", "hass", ",", "running", ")", ":", "event", "=", "\"test_event\"", "event_flag", "=", "asyncio", ".", "Event", "(", ")", "@", "callback", "def", "event_handler", "(", "event", ")", ":", "event_flag", ".", "set", "...
[ 196, 0 ]
[ 250, 63 ]
python
en
['en', 'en', 'en']
True
test_service_descriptions
(hass)
Test that service descriptions are loaded and reloaded correctly.
Test that service descriptions are loaded and reloaded correctly.
async def test_service_descriptions(hass): """Test that service descriptions are loaded and reloaded correctly.""" # Test 1: has "description" but no "fields" assert await async_setup_component( hass, "script", { "script": { "test": { "...
[ "async", "def", "test_service_descriptions", "(", "hass", ")", ":", "# Test 1: has \"description\" but no \"fields\"", "assert", "await", "async_setup_component", "(", "hass", ",", "\"script\"", ",", "{", "\"script\"", ":", "{", "\"test\"", ":", "{", "\"description\"", ...
[ 253, 0 ]
[ 303, 5 ]
python
en
['en', 'en', 'en']
True
test_shared_context
(hass)
Test that the shared context is passed down the chain.
Test that the shared context is passed down the chain.
async def test_shared_context(hass): """Test that the shared context is passed down the chain.""" event = "test_event" context = Context() event_mock = Mock() run_mock = Mock() hass.bus.async_listen(event, event_mock) hass.bus.async_listen(EVENT_SCRIPT_STARTED, run_mock) assert await ...
[ "async", "def", "test_shared_context", "(", "hass", ")", ":", "event", "=", "\"test_event\"", "context", "=", "Context", "(", ")", "event_mock", "=", "Mock", "(", ")", "run_mock", "=", "Mock", "(", ")", "hass", ".", "bus", ".", "async_listen", "(", "even...
[ 306, 0 ]
[ 342, 35 ]
python
en
['en', 'en', 'en']
True
test_logging_script_error
(hass, caplog)
Test logging script error.
Test logging script error.
async def test_logging_script_error(hass, caplog): """Test logging script error.""" assert await async_setup_component( hass, "script", {"script": {"hello": {"sequence": [{"service": "non.existing"}]}}}, ) with pytest.raises(ServiceNotFound) as err: await hass.services.as...
[ "async", "def", "test_logging_script_error", "(", "hass", ",", "caplog", ")", ":", "assert", "await", "async_setup_component", "(", "hass", ",", "\"script\"", ",", "{", "\"script\"", ":", "{", "\"hello\"", ":", "{", "\"sequence\"", ":", "[", "{", "\"service\""...
[ 345, 0 ]
[ 357, 50 ]
python
en
['nb', 'la', 'en']
False
test_turning_no_scripts_off
(hass)
Test it is possible to turn two scripts off.
Test it is possible to turn two scripts off.
async def test_turning_no_scripts_off(hass): """Test it is possible to turn two scripts off.""" assert await async_setup_component(hass, "script", {}) # Testing it doesn't raise await hass.services.async_call( DOMAIN, SERVICE_TURN_OFF, {"entity_id": []}, blocking=True )
[ "async", "def", "test_turning_no_scripts_off", "(", "hass", ")", ":", "assert", "await", "async_setup_component", "(", "hass", ",", "\"script\"", ",", "{", "}", ")", "# Testing it doesn't raise", "await", "hass", ".", "services", ".", "async_call", "(", "DOMAIN", ...
[ 360, 0 ]
[ 367, 5 ]
python
en
['en', 'en', 'en']
True
test_async_get_descriptions_script
(hass)
Test async_set_service_schema for the script integration.
Test async_set_service_schema for the script integration.
async def test_async_get_descriptions_script(hass): """Test async_set_service_schema for the script integration.""" script_config = { DOMAIN: { "test1": {"sequence": [{"service": "homeassistant.restart"}]}, "test2": { "description": "test2", "field...
[ "async", "def", "test_async_get_descriptions_script", "(", "hass", ")", ":", "script_config", "=", "{", "DOMAIN", ":", "{", "\"test1\"", ":", "{", "\"sequence\"", ":", "[", "{", "\"service\"", ":", "\"homeassistant.restart\"", "}", "]", "}", ",", "\"test2\"", ...
[ 370, 0 ]
[ 401, 5 ]
python
en
['en', 'fr', 'en']
True
test_extraction_functions
(hass)
Test extraction functions.
Test extraction functions.
async def test_extraction_functions(hass): """Test extraction functions.""" assert await async_setup_component( hass, DOMAIN, { DOMAIN: { "test1": { "sequence": [ { "service": "test.script...
[ "async", "def", "test_extraction_functions", "(", "hass", ")", ":", "assert", "await", "async_setup_component", "(", "hass", ",", "DOMAIN", ",", "{", "DOMAIN", ":", "{", "\"test1\"", ":", "{", "\"sequence\"", ":", "[", "{", "\"service\"", ":", "\"test.script\"...
[ 404, 0 ]
[ 474, 5 ]
python
en
['en', 'en', 'en']
True
test_config_basic
(hass)
Test passing info in config.
Test passing info in config.
async def test_config_basic(hass): """Test passing info in config.""" assert await async_setup_component( hass, "script", { "script": { "test_script": { "alias": "Script Name", "icon": "mdi:party", "s...
[ "async", "def", "test_config_basic", "(", "hass", ")", ":", "assert", "await", "async_setup_component", "(", "hass", ",", "\"script\"", ",", "{", "\"script\"", ":", "{", "\"test_script\"", ":", "{", "\"alias\"", ":", "\"Script Name\"", ",", "\"icon\"", ":", "\...
[ 477, 0 ]
[ 495, 56 ]
python
en
['en', 'en', 'en']
True
test_logbook_humanify_script_started_event
(hass)
Test humanifying script started event.
Test humanifying script started event.
async def test_logbook_humanify_script_started_event(hass): """Test humanifying script started event.""" hass.config.components.add("recorder") await async_setup_component(hass, DOMAIN, {}) await async_setup_component(hass, "logbook", {}) entity_attr_cache = logbook.EntityAttributeCache(hass) e...
[ "async", "def", "test_logbook_humanify_script_started_event", "(", "hass", ")", ":", "hass", ".", "config", ".", "components", ".", "add", "(", "\"recorder\"", ")", "await", "async_setup_component", "(", "hass", ",", "DOMAIN", ",", "{", "}", ")", "await", "asy...
[ 498, 0 ]
[ 531, 46 ]
python
en
['en', 'en', 'en']
True
test_concurrent_script
(hass, concurrently)
Test calling script concurrently or not.
Test calling script concurrently or not.
async def test_concurrent_script(hass, concurrently): """Test calling script concurrently or not.""" if concurrently: call_script_2 = { "service": "script.turn_on", "data": {"entity_id": "script.script2"}, } else: call_script_2 = {"service": "script.script2"} ...
[ "async", "def", "test_concurrent_script", "(", "hass", ",", "concurrently", ")", ":", "if", "concurrently", ":", "call_script_2", "=", "{", "\"service\"", ":", "\"script.turn_on\"", ",", "\"data\"", ":", "{", "\"entity_id\"", ":", "\"script.script2\"", "}", ",", ...
[ 535, 0 ]
[ 617, 51 ]
python
en
['en', 'en', 'en']
True
test_script_variables
(hass, caplog)
Test defining scripts.
Test defining scripts.
async def test_script_variables(hass, caplog): """Test defining scripts.""" assert await async_setup_component( hass, "script", { "script": { "script1": { "variables": { "test_var": "from_config", ...
[ "async", "def", "test_script_variables", "(", "hass", ",", "caplog", ")", ":", "assert", "await", "async_setup_component", "(", "hass", ",", "\"script\"", ",", "{", "\"script\"", ":", "{", "\"script1\"", ":", "{", "\"variables\"", ":", "{", "\"test_var\"", ":"...
[ 620, 0 ]
[ 707, 43 ]
python
cy
['fr', 'cy', 'en']
False
TestScriptComponent.setUp
(self)
Set up things to be run when tests are started.
Set up things to be run when tests are started.
def setUp(self): """Set up things to be run when tests are started.""" self.hass = get_test_home_assistant() self.addCleanup(self.tear_down_cleanup)
[ "def", "setUp", "(", "self", ")", ":", "self", ".", "hass", "=", "get_test_home_assistant", "(", ")", "self", ".", "addCleanup", "(", "self", ".", "tear_down_cleanup", ")" ]
[ 74, 4 ]
[ 78, 47 ]
python
en
['en', 'en', 'en']
True
TestScriptComponent.tear_down_cleanup
(self)
Stop down everything that was started.
Stop down everything that was started.
def tear_down_cleanup(self): """Stop down everything that was started.""" self.hass.stop()
[ "def", "tear_down_cleanup", "(", "self", ")", ":", "self", ".", "hass", ".", "stop", "(", ")" ]
[ 80, 4 ]
[ 82, 24 ]
python
en
['en', 'en', 'en']
True
TestScriptComponent.test_passing_variables
(self)
Test different ways of passing in variables.
Test different ways of passing in variables.
def test_passing_variables(self): """Test different ways of passing in variables.""" calls = [] context = Context() @callback def record_call(service): """Add recorded event to set.""" calls.append(service) self.hass.services.register("test", "sc...
[ "def", "test_passing_variables", "(", "self", ")", ":", "calls", "=", "[", "]", "context", "=", "Context", "(", ")", "@", "callback", "def", "record_call", "(", "service", ")", ":", "\"\"\"Add recorded event to set.\"\"\"", "calls", ".", "append", "(", "servic...
[ 84, 4 ]
[ 127, 51 ]
python
en
['en', 'en', 'en']
True
patch_requests
()
Stub out services that makes requests.
Stub out services that makes requests.
def patch_requests(): """Stub out services that makes requests.""" patch_client = patch("homeassistant.components.meteo_france.MeteoFranceClient") with patch_client: yield
[ "def", "patch_requests", "(", ")", ":", "patch_client", "=", "patch", "(", "\"homeassistant.components.meteo_france.MeteoFranceClient\"", ")", "with", "patch_client", ":", "yield" ]
[ 7, 0 ]
[ 12, 13 ]
python
en
['en', 'en', 'en']
True
get_indent
(line)
Returns the indent in `line`.
Returns the indent in `line`.
def get_indent(line): """Returns the indent in `line`.""" search = _re_indent.search(line) return "" if search is None else search.groups()[0]
[ "def", "get_indent", "(", "line", ")", ":", "search", "=", "_re_indent", ".", "search", "(", "line", ")", "return", "\"\"", "if", "search", "is", "None", "else", "search", ".", "groups", "(", ")", "[", "0", "]" ]
[ 34, 0 ]
[ 37, 55 ]
python
en
['en', 'en', 'en']
True
split_code_in_indented_blocks
(code, indent_level="", start_prompt=None, end_prompt=None)
Split `code` into its indented blocks, starting at `indent_level`. If provided, begins splitting after `start_prompt` and stops at `end_prompt` (but returns what's before `start_prompt` as a first block and what's after `end_prompt` as a last block, so `code` is always the same as joining the result of thi...
Split `code` into its indented blocks, starting at `indent_level`. If provided, begins splitting after `start_prompt` and stops at `end_prompt` (but returns what's before `start_prompt` as a first block and what's after `end_prompt` as a last block, so `code` is always the same as joining the result of thi...
def split_code_in_indented_blocks(code, indent_level="", start_prompt=None, end_prompt=None): """ Split `code` into its indented blocks, starting at `indent_level`. If provided, begins splitting after `start_prompt` and stops at `end_prompt` (but returns what's before `start_prompt` as a first block and wha...
[ "def", "split_code_in_indented_blocks", "(", "code", ",", "indent_level", "=", "\"\"", ",", "start_prompt", "=", "None", ",", "end_prompt", "=", "None", ")", ":", "# Let's split the code into lines and move to start_index.", "index", "=", "0", "lines", "=", "code", ...
[ 40, 0 ]
[ 84, 17 ]
python
en
['en', 'error', 'th']
False
ignore_underscore
(key)
Wraps a `key` (that maps an object to string) to lower case and remove underscores.
Wraps a `key` (that maps an object to string) to lower case and remove underscores.
def ignore_underscore(key): "Wraps a `key` (that maps an object to string) to lower case and remove underscores." def _inner(x): return key(x).lower().replace("_", "") return _inner
[ "def", "ignore_underscore", "(", "key", ")", ":", "def", "_inner", "(", "x", ")", ":", "return", "key", "(", "x", ")", ".", "lower", "(", ")", ".", "replace", "(", "\"_\"", ",", "\"\"", ")", "return", "_inner" ]
[ 87, 0 ]
[ 93, 17 ]
python
en
['en', 'en', 'en']
True
sort_objects
(objects, key=None)
Sort a list of `objects` following the rules of isort. `key` optionally maps an object to a str.
Sort a list of `objects` following the rules of isort. `key` optionally maps an object to a str.
def sort_objects(objects, key=None): "Sort a list of `objects` following the rules of isort. `key` optionally maps an object to a str." # If no key is provided, we use a noop. def noop(x): return x if key is None: key = noop # Constants are all uppercase, they go first. constant...
[ "def", "sort_objects", "(", "objects", ",", "key", "=", "None", ")", ":", "# If no key is provided, we use a noop.", "def", "noop", "(", "x", ")", ":", "return", "x", "if", "key", "is", "None", ":", "key", "=", "noop", "# Constants are all uppercase, they go fir...
[ 96, 0 ]
[ 112, 96 ]
python
en
['en', 'en', 'en']
True
sort_objects_in_import
(import_statement)
Return the same `import_statement` but with objects properly sorted.
Return the same `import_statement` but with objects properly sorted.
def sort_objects_in_import(import_statement): """ Return the same `import_statement` but with objects properly sorted. """ # This inner function sort imports between [ ]. def _replace(match): imports = match.groups()[0] if "," not in imports: return f"[{imports}]" ...
[ "def", "sort_objects_in_import", "(", "import_statement", ")", ":", "# This inner function sort imports between [ ].", "def", "_replace", "(", "match", ")", ":", "imports", "=", "match", ".", "groups", "(", ")", "[", "0", "]", "if", "\",\"", "not", "in", "import...
[ 115, 0 ]
[ 162, 31 ]
python
en
['en', 'error', 'th']
False
sort_imports
(file, check_only=True)
Sort `_import_structure` imports in `file`, `check_only` determines if we only check or overwrite.
Sort `_import_structure` imports in `file`, `check_only` determines if we only check or overwrite.
def sort_imports(file, check_only=True): """ Sort `_import_structure` imports in `file`, `check_only` determines if we only check or overwrite. """ with open(file, "r") as f: code = f.read() if "_import_structure" not in code: return # Blocks of indent level 0 main_blocks =...
[ "def", "sort_imports", "(", "file", ",", "check_only", "=", "True", ")", ":", "with", "open", "(", "file", ",", "\"r\"", ")", "as", "f", ":", "code", "=", "f", ".", "read", "(", ")", "if", "\"_import_structure\"", "not", "in", "code", ":", "return", ...
[ 165, 0 ]
[ 221, 47 ]
python
en
['en', 'error', 'th']
False
setup_platform
(hass, config, add_entities, discovery_info=None)
Iterate through all MAX! Devices and add window shutters.
Iterate through all MAX! Devices and add window shutters.
def setup_platform(hass, config, add_entities, discovery_info=None): """Iterate through all MAX! Devices and add window shutters.""" devices = [] for handler in hass.data[DATA_KEY].values(): cube = handler.cube for device in cube.devices: name = f"{cube.room_by_id(device.room_id)...
[ "def", "setup_platform", "(", "hass", ",", "config", ",", "add_entities", ",", "discovery_info", "=", "None", ")", ":", "devices", "=", "[", "]", "for", "handler", "in", "hass", ".", "data", "[", "DATA_KEY", "]", ".", "values", "(", ")", ":", "cube", ...
[ 9, 0 ]
[ 22, 29 ]
python
en
['en', 'en', 'en']
True
MaxCubeShutter.__init__
(self, handler, name, rf_address)
Initialize MAX! Cube BinarySensorEntity.
Initialize MAX! Cube BinarySensorEntity.
def __init__(self, handler, name, rf_address): """Initialize MAX! Cube BinarySensorEntity.""" self._name = name self._sensor_type = DEVICE_CLASS_WINDOW self._rf_address = rf_address self._cubehandle = handler self._state = None
[ "def", "__init__", "(", "self", ",", "handler", ",", "name", ",", "rf_address", ")", ":", "self", ".", "_name", "=", "name", "self", ".", "_sensor_type", "=", "DEVICE_CLASS_WINDOW", "self", ".", "_rf_address", "=", "rf_address", "self", ".", "_cubehandle", ...
[ 28, 4 ]
[ 34, 26 ]
python
en
['en', 'ny', 'it']
False
MaxCubeShutter.name
(self)
Return the name of the BinarySensorEntity.
Return the name of the BinarySensorEntity.
def name(self): """Return the name of the BinarySensorEntity.""" return self._name
[ "def", "name", "(", "self", ")", ":", "return", "self", ".", "_name" ]
[ 37, 4 ]
[ 39, 25 ]
python
en
['en', 'ig', 'en']
True
MaxCubeShutter.device_class
(self)
Return the class of this sensor.
Return the class of this sensor.
def device_class(self): """Return the class of this sensor.""" return self._sensor_type
[ "def", "device_class", "(", "self", ")", ":", "return", "self", ".", "_sensor_type" ]
[ 42, 4 ]
[ 44, 32 ]
python
en
['en', 'en', 'en']
True
MaxCubeShutter.is_on
(self)
Return true if the binary sensor is on/open.
Return true if the binary sensor is on/open.
def is_on(self): """Return true if the binary sensor is on/open.""" return self._state
[ "def", "is_on", "(", "self", ")", ":", "return", "self", ".", "_state" ]
[ 47, 4 ]
[ 49, 26 ]
python
en
['en', 'fy', 'en']
True
MaxCubeShutter.update
(self)
Get latest data from MAX! Cube.
Get latest data from MAX! Cube.
def update(self): """Get latest data from MAX! Cube.""" self._cubehandle.update() device = self._cubehandle.cube.device_by_rf(self._rf_address) self._state = device.is_open
[ "def", "update", "(", "self", ")", ":", "self", ".", "_cubehandle", ".", "update", "(", ")", "device", "=", "self", ".", "_cubehandle", ".", "cube", ".", "device_by_rf", "(", "self", ".", "_rf_address", ")", "self", ".", "_state", "=", "device", ".", ...
[ 51, 4 ]
[ 55, 36 ]
python
en
['en', 'en', 'en']
True
_update_twentemilieu
( hass: HomeAssistantType, unique_id: Optional[str] )
Update Twente Milieu.
Update Twente Milieu.
async def _update_twentemilieu( hass: HomeAssistantType, unique_id: Optional[str] ) -> None: """Update Twente Milieu.""" if unique_id is not None: twentemilieu = hass.data[DOMAIN].get(unique_id) if twentemilieu is not None: await twentemilieu.update() async_dispatcher...
[ "async", "def", "_update_twentemilieu", "(", "hass", ":", "HomeAssistantType", ",", "unique_id", ":", "Optional", "[", "str", "]", ")", "->", "None", ":", "if", "unique_id", "is", "not", "None", ":", "twentemilieu", "=", "hass", ".", "data", "[", "DOMAIN",...
[ 29, 0 ]
[ 45, 57 ]
python
fr
['fr', 'nl', 'it']
False
async_setup
(hass: HomeAssistantType, config: ConfigType)
Set up the Twente Milieu components.
Set up the Twente Milieu components.
async def async_setup(hass: HomeAssistantType, config: ConfigType) -> bool: """Set up the Twente Milieu components.""" async def update(call) -> None: """Service call to manually update the data.""" unique_id = call.data.get(CONF_ID) await _update_twentemilieu(hass, unique_id) hass...
[ "async", "def", "async_setup", "(", "hass", ":", "HomeAssistantType", ",", "config", ":", "ConfigType", ")", "->", "bool", ":", "async", "def", "update", "(", "call", ")", "->", "None", ":", "\"\"\"Service call to manually update the data.\"\"\"", "unique_id", "="...
[ 48, 0 ]
[ 58, 15 ]
python
en
['en', 'fr', 'en']
True
async_setup_entry
(hass: HomeAssistantType, entry: ConfigEntry)
Set up Twente Milieu from a config entry.
Set up Twente Milieu from a config entry.
async def async_setup_entry(hass: HomeAssistantType, entry: ConfigEntry) -> bool: """Set up Twente Milieu from a config entry.""" session = async_get_clientsession(hass) twentemilieu = TwenteMilieu( post_code=entry.data[CONF_POST_CODE], house_number=entry.data[CONF_HOUSE_NUMBER], hou...
[ "async", "def", "async_setup_entry", "(", "hass", ":", "HomeAssistantType", ",", "entry", ":", "ConfigEntry", ")", "->", "bool", ":", "session", "=", "async_get_clientsession", "(", "hass", ")", "twentemilieu", "=", "TwenteMilieu", "(", "post_code", "=", "entry"...
[ 61, 0 ]
[ 84, 15 ]
python
en
['en', 'pt', 'en']
True
async_unload_entry
(hass: HomeAssistantType, entry: ConfigEntry)
Unload Twente Milieu config entry.
Unload Twente Milieu config entry.
async def async_unload_entry(hass: HomeAssistantType, entry: ConfigEntry) -> bool: """Unload Twente Milieu config entry.""" await hass.config_entries.async_forward_entry_unload(entry, "sensor") del hass.data[DOMAIN][entry.data[CONF_ID]] return True
[ "async", "def", "async_unload_entry", "(", "hass", ":", "HomeAssistantType", ",", "entry", ":", "ConfigEntry", ")", "->", "bool", ":", "await", "hass", ".", "config_entries", ".", "async_forward_entry_unload", "(", "entry", ",", "\"sensor\"", ")", "del", "hass",...
[ 87, 0 ]
[ 93, 15 ]
python
en
['fr', 'es', 'en']
False
async_condition_from_config
( config: ConfigType, config_validation: bool )
Evaluate state based on configuration.
Evaluate state based on configuration.
def async_condition_from_config( config: ConfigType, config_validation: bool ) -> ConditionCheckerType: """Evaluate state based on configuration.""" if config_validation: config = CONDITION_SCHEMA(config) return toggle_entity.async_condition_from_config(config)
[ "def", "async_condition_from_config", "(", "config", ":", "ConfigType", ",", "config_validation", ":", "bool", ")", "->", "ConditionCheckerType", ":", "if", "config_validation", ":", "config", "=", "CONDITION_SCHEMA", "(", "config", ")", "return", "toggle_entity", "...
[ 19, 0 ]
[ 25, 60 ]
python
en
['en', 'en', 'en']
True
async_get_conditions
( hass: HomeAssistant, device_id: str )
List device conditions.
List device conditions.
async def async_get_conditions( hass: HomeAssistant, device_id: str ) -> List[Dict[str, str]]: """List device conditions.""" return await toggle_entity.async_get_conditions(hass, device_id, DOMAIN)
[ "async", "def", "async_get_conditions", "(", "hass", ":", "HomeAssistant", ",", "device_id", ":", "str", ")", "->", "List", "[", "Dict", "[", "str", ",", "str", "]", "]", ":", "return", "await", "toggle_entity", ".", "async_get_conditions", "(", "hass", ",...
[ 28, 0 ]
[ 32, 76 ]
python
en
['fr', 'en', 'en']
True
async_get_condition_capabilities
(hass: HomeAssistant, config: dict)
List condition capabilities.
List condition capabilities.
async def async_get_condition_capabilities(hass: HomeAssistant, config: dict) -> dict: """List condition capabilities.""" return await toggle_entity.async_get_condition_capabilities(hass, config)
[ "async", "def", "async_get_condition_capabilities", "(", "hass", ":", "HomeAssistant", ",", "config", ":", "dict", ")", "->", "dict", ":", "return", "await", "toggle_entity", ".", "async_get_condition_capabilities", "(", "hass", ",", "config", ")" ]
[ 35, 0 ]
[ 37, 77 ]
python
en
['ro', 'sr', 'en']
False
call_from_config
( hass: HomeAssistantType, config: ConfigType, blocking: bool = False, variables: TemplateVarsType = None, validate_config: bool = True, )
Call a service based on a config hash.
Call a service based on a config hash.
def call_from_config( hass: HomeAssistantType, config: ConfigType, blocking: bool = False, variables: TemplateVarsType = None, validate_config: bool = True, ) -> None: """Call a service based on a config hash.""" asyncio.run_coroutine_threadsafe( async_call_from_config(hass, config, ...
[ "def", "call_from_config", "(", "hass", ":", "HomeAssistantType", ",", "config", ":", "ConfigType", ",", "blocking", ":", "bool", "=", "False", ",", "variables", ":", "TemplateVarsType", "=", "None", ",", "validate_config", ":", "bool", "=", "True", ",", ")"...
[ 65, 0 ]
[ 76, 14 ]
python
en
['en', 'en', 'en']
True
async_call_from_config
( hass: HomeAssistantType, config: ConfigType, blocking: bool = False, variables: TemplateVarsType = None, validate_config: bool = True, context: Optional[ha.Context] = None, )
Call a service based on a config hash.
Call a service based on a config hash.
async def async_call_from_config( hass: HomeAssistantType, config: ConfigType, blocking: bool = False, variables: TemplateVarsType = None, validate_config: bool = True, context: Optional[ha.Context] = None, ) -> None: """Call a service based on a config hash.""" try: parms = asyn...
[ "async", "def", "async_call_from_config", "(", "hass", ":", "HomeAssistantType", ",", "config", ":", "ConfigType", ",", "blocking", ":", "bool", "=", "False", ",", "variables", ":", "TemplateVarsType", "=", "None", ",", "validate_config", ":", "bool", "=", "Tr...
[ 80, 0 ]
[ 96, 65 ]
python
en
['en', 'en', 'en']
True
async_prepare_call_from_config
( hass: HomeAssistantType, config: ConfigType, variables: TemplateVarsType = None, validate_config: bool = False, )
Prepare to call a service based on a config hash.
Prepare to call a service based on a config hash.
def async_prepare_call_from_config( hass: HomeAssistantType, config: ConfigType, variables: TemplateVarsType = None, validate_config: bool = False, ) -> Tuple[str, str, Dict[str, Any]]: """Prepare to call a service based on a config hash.""" if validate_config: try: config = ...
[ "def", "async_prepare_call_from_config", "(", "hass", ":", "HomeAssistantType", ",", "config", ":", "ConfigType", ",", "variables", ":", "TemplateVarsType", "=", "None", ",", "validate_config", ":", "bool", "=", "False", ",", ")", "->", "Tuple", "[", "str", ",...
[ 101, 0 ]
[ 150, 40 ]
python
en
['en', 'en', 'en']
True
extract_entity_ids
( hass: HomeAssistantType, service_call: ha.ServiceCall, expand_group: bool = True )
Extract a list of entity ids from a service call. Will convert group entity ids to the entity ids it represents.
Extract a list of entity ids from a service call.
def extract_entity_ids( hass: HomeAssistantType, service_call: ha.ServiceCall, expand_group: bool = True ) -> Set[str]: """Extract a list of entity ids from a service call. Will convert group entity ids to the entity ids it represents. """ return asyncio.run_coroutine_threadsafe( async_extr...
[ "def", "extract_entity_ids", "(", "hass", ":", "HomeAssistantType", ",", "service_call", ":", "ha", ".", "ServiceCall", ",", "expand_group", ":", "bool", "=", "True", ")", "->", "Set", "[", "str", "]", ":", "return", "asyncio", ".", "run_coroutine_threadsafe",...
[ 154, 0 ]
[ 163, 14 ]
python
en
['en', 'en', 'en']
True
async_extract_entities
( hass: HomeAssistantType, entities: Iterable["Entity"], service_call: ha.ServiceCall, expand_group: bool = True, )
Extract a list of entity objects from a service call. Will convert group entity ids to the entity ids it represents.
Extract a list of entity objects from a service call.
async def async_extract_entities( hass: HomeAssistantType, entities: Iterable["Entity"], service_call: ha.ServiceCall, expand_group: bool = True, ) -> List["Entity"]: """Extract a list of entity objects from a service call. Will convert group entity ids to the entity ids it represents. """ ...
[ "async", "def", "async_extract_entities", "(", "hass", ":", "HomeAssistantType", ",", "entities", ":", "Iterable", "[", "\"Entity\"", "]", ",", "service_call", ":", "ha", ".", "ServiceCall", ",", "expand_group", ":", "bool", "=", "True", ",", ")", "->", "Lis...
[ 167, 0 ]
[ 202, 16 ]
python
en
['en', 'en', 'en']
True
async_extract_entity_ids
( hass: HomeAssistantType, service_call: ha.ServiceCall, expand_group: bool = True )
Extract a list of entity ids from a service call. Will convert group entity ids to the entity ids it represents.
Extract a list of entity ids from a service call.
async def async_extract_entity_ids( hass: HomeAssistantType, service_call: ha.ServiceCall, expand_group: bool = True ) -> Set[str]: """Extract a list of entity ids from a service call. Will convert group entity ids to the entity ids it represents. """ entity_ids = service_call.data.get(ATTR_ENTITY_...
[ "async", "def", "async_extract_entity_ids", "(", "hass", ":", "HomeAssistantType", ",", "service_call", ":", "ha", ".", "ServiceCall", ",", "expand_group", ":", "bool", "=", "True", ")", "->", "Set", "[", "str", "]", ":", "entity_ids", "=", "service_call", "...
[ 206, 0 ]
[ 267, 20 ]
python
en
['en', 'en', 'en']
True
_load_services_file
(hass: HomeAssistantType, integration: Integration)
Load services file for an integration.
Load services file for an integration.
def _load_services_file(hass: HomeAssistantType, integration: Integration) -> JSON_TYPE: """Load services file for an integration.""" try: return load_yaml(str(integration.file_path / "services.yaml")) except FileNotFoundError: _LOGGER.warning( "Unable to find services.yaml for t...
[ "def", "_load_services_file", "(", "hass", ":", "HomeAssistantType", ",", "integration", ":", "Integration", ")", "->", "JSON_TYPE", ":", "try", ":", "return", "load_yaml", "(", "str", "(", "integration", ".", "file_path", "/", "\"services.yaml\"", ")", ")", "...
[ 270, 0 ]
[ 283, 17 ]
python
en
['en', 'en', 'en']
True
_load_services_files
( hass: HomeAssistantType, integrations: Iterable[Integration] )
Load service files for multiple intergrations.
Load service files for multiple intergrations.
def _load_services_files( hass: HomeAssistantType, integrations: Iterable[Integration] ) -> List[JSON_TYPE]: """Load service files for multiple intergrations.""" return [_load_services_file(hass, integration) for integration in integrations]
[ "def", "_load_services_files", "(", "hass", ":", "HomeAssistantType", ",", "integrations", ":", "Iterable", "[", "Integration", "]", ")", "->", "List", "[", "JSON_TYPE", "]", ":", "return", "[", "_load_services_file", "(", "hass", ",", "integration", ")", "for...
[ 286, 0 ]
[ 290, 83 ]
python
en
['en', 'en', 'en']
True
async_get_all_descriptions
( hass: HomeAssistantType, )
Return descriptions (i.e. user documentation) for all service calls.
Return descriptions (i.e. user documentation) for all service calls.
async def async_get_all_descriptions( hass: HomeAssistantType, ) -> Dict[str, Dict[str, Any]]: """Return descriptions (i.e. user documentation) for all service calls.""" descriptions_cache = hass.data.setdefault(SERVICE_DESCRIPTION_CACHE, {}) format_cache_key = "{}.{}".format services = hass.service...
[ "async", "def", "async_get_all_descriptions", "(", "hass", ":", "HomeAssistantType", ",", ")", "->", "Dict", "[", "str", ",", "Dict", "[", "str", ",", "Any", "]", "]", ":", "descriptions_cache", "=", "hass", ".", "data", ".", "setdefault", "(", "SERVICE_DE...
[ 294, 0 ]
[ 351, 23 ]
python
en
['en', 'pt', 'en']
True
async_set_service_schema
( hass: HomeAssistantType, domain: str, service: str, schema: Dict[str, Any] )
Register a description for a service.
Register a description for a service.
def async_set_service_schema( hass: HomeAssistantType, domain: str, service: str, schema: Dict[str, Any] ) -> None: """Register a description for a service.""" hass.data.setdefault(SERVICE_DESCRIPTION_CACHE, {}) description = { "description": schema.get("description") or "", "fields": s...
[ "def", "async_set_service_schema", "(", "hass", ":", "HomeAssistantType", ",", "domain", ":", "str", ",", "service", ":", "str", ",", "schema", ":", "Dict", "[", "str", ",", "Any", "]", ")", "->", "None", ":", "hass", ".", "data", ".", "setdefault", "(...
[ 356, 0 ]
[ 367, 77 ]
python
en
['es', 'fr', 'en']
False
entity_service_call
( hass: HomeAssistantType, platforms: Iterable["EntityPlatform"], func: Union[str, Callable[..., Any]], call: ha.ServiceCall, required_features: Optional[Iterable[int]] = None, )
Handle an entity service call. Calls all platforms simultaneously.
Handle an entity service call.
async def entity_service_call( hass: HomeAssistantType, platforms: Iterable["EntityPlatform"], func: Union[str, Callable[..., Any]], call: ha.ServiceCall, required_features: Optional[Iterable[int]] = None, ) -> None: """Handle an entity service call. Calls all platforms simultaneously. ...
[ "async", "def", "entity_service_call", "(", "hass", ":", "HomeAssistantType", ",", "platforms", ":", "Iterable", "[", "\"EntityPlatform\"", "]", ",", "func", ":", "Union", "[", "str", ",", "Callable", "[", "...", ",", "Any", "]", "]", ",", "call", ":", "...
[ 371, 0 ]
[ 515, 27 ]
python
en
['en', 'en', 'en']
True
_handle_entity_call
( hass: HomeAssistantType, entity: "Entity", func: Union[str, Callable[..., Any]], data: Union[Dict, ha.ServiceCall], context: ha.Context, )
Handle calling service method.
Handle calling service method.
async def _handle_entity_call( hass: HomeAssistantType, entity: "Entity", func: Union[str, Callable[..., Any]], data: Union[Dict, ha.ServiceCall], context: ha.Context, ) -> None: """Handle calling service method.""" entity.async_set_context(context) if isinstance(func, str): res...
[ "async", "def", "_handle_entity_call", "(", "hass", ":", "HomeAssistantType", ",", "entity", ":", "\"Entity\"", ",", "func", ":", "Union", "[", "str", ",", "Callable", "[", "...", ",", "Any", "]", "]", ",", "data", ":", "Union", "[", "Dict", ",", "ha",...
[ 518, 0 ]
[ 543, 20 ]
python
en
['en', 'xh', 'en']
True
async_register_admin_service
( hass: HomeAssistantType, domain: str, service: str, service_func: Callable[[ha.ServiceCall], Optional[Awaitable]], schema: vol.Schema = vol.Schema({}, extra=vol.PREVENT_EXTRA), )
Register a service that requires admin access.
Register a service that requires admin access.
def async_register_admin_service( hass: HomeAssistantType, domain: str, service: str, service_func: Callable[[ha.ServiceCall], Optional[Awaitable]], schema: vol.Schema = vol.Schema({}, extra=vol.PREVENT_EXTRA), ) -> None: """Register a service that requires admin access.""" @wraps(service_f...
[ "def", "async_register_admin_service", "(", "hass", ":", "HomeAssistantType", ",", "domain", ":", "str", ",", "service", ":", "str", ",", "service_func", ":", "Callable", "[", "[", "ha", ".", "ServiceCall", "]", ",", "Optional", "[", "Awaitable", "]", "]", ...
[ 548, 0 ]
[ 570, 72 ]
python
en
['en', 'en', 'en']
True
verify_domain_control
(hass: HomeAssistantType, domain: str)
Ensure permission to access any entity under domain in service call.
Ensure permission to access any entity under domain in service call.
def verify_domain_control(hass: HomeAssistantType, domain: str) -> Callable: """Ensure permission to access any entity under domain in service call.""" def decorator(service_handler: Callable[[ha.ServiceCall], Any]) -> Callable: """Decorate.""" if not asyncio.iscoroutinefunction(service_handler...
[ "def", "verify_domain_control", "(", "hass", ":", "HomeAssistantType", ",", "domain", ":", "str", ")", "->", "Callable", ":", "def", "decorator", "(", "service_handler", ":", "Callable", "[", "[", "ha", ".", "ServiceCall", "]", ",", "Any", "]", ")", "->", ...
[ 575, 0 ]
[ 621, 20 ]
python
en
['en', 'en', 'en']
True
test_form
(hass)
Test we get the form.
Test we get the form.
async def test_form(hass): """Test we get the form.""" await setup.async_setup_component(hass, "persistent_notification", {}) result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": config_entries.SOURCE_USER} ) assert result["type"] == "form" assert result["errors...
[ "async", "def", "test_form", "(", "hass", ")", ":", "await", "setup", ".", "async_setup_component", "(", "hass", ",", "\"persistent_notification\"", ",", "{", "}", ")", "result", "=", "await", "hass", ".", "config_entries", ".", "flow", ".", "async_init", "(...
[ 5, 0 ]
[ 25, 44 ]
python
en
['en', 'en', 'en']
True
test_bridge_setup
(hass)
Test a successful setup.
Test a successful setup.
async def test_bridge_setup(hass): """Test a successful setup.""" entry = Mock() api = Mock(initialize=AsyncMock()) entry.data = {"host": "1.2.3.4", "username": "mock-username"} entry.options = {CONF_ALLOW_HUE_GROUPS: False, CONF_ALLOW_UNREACHABLE: False} hue_bridge = bridge.HueBridge(hass, entr...
[ "async", "def", "test_bridge_setup", "(", "hass", ")", ":", "entry", "=", "Mock", "(", ")", "api", "=", "Mock", "(", "initialize", "=", "AsyncMock", "(", ")", ")", "entry", ".", "data", "=", "{", "\"host\"", ":", "\"1.2.3.4\"", ",", "\"username\"", ":"...
[ 15, 0 ]
[ 31, 66 ]
python
en
['en', 'co', 'en']
True
test_bridge_setup_invalid_username
(hass)
Test we start config flow if username is no longer whitelisted.
Test we start config flow if username is no longer whitelisted.
async def test_bridge_setup_invalid_username(hass): """Test we start config flow if username is no longer whitelisted.""" entry = Mock() entry.data = {"host": "1.2.3.4", "username": "mock-username"} entry.options = {CONF_ALLOW_HUE_GROUPS: False, CONF_ALLOW_UNREACHABLE: False} hue_bridge = bridge.Hue...
[ "async", "def", "test_bridge_setup_invalid_username", "(", "hass", ")", ":", "entry", "=", "Mock", "(", ")", "entry", ".", "data", "=", "{", "\"host\"", ":", "\"1.2.3.4\"", ",", "\"username\"", ":", "\"mock-username\"", "}", "entry", ".", "options", "=", "{"...
[ 34, 0 ]
[ 47, 68 ]
python
en
['en', 'en', 'en']
True
test_bridge_setup_timeout
(hass)
Test we retry to connect if we cannot connect.
Test we retry to connect if we cannot connect.
async def test_bridge_setup_timeout(hass): """Test we retry to connect if we cannot connect.""" entry = Mock() entry.data = {"host": "1.2.3.4", "username": "mock-username"} entry.options = {CONF_ALLOW_HUE_GROUPS: False, CONF_ALLOW_UNREACHABLE: False} hue_bridge = bridge.HueBridge(hass, entry) w...
[ "async", "def", "test_bridge_setup_timeout", "(", "hass", ")", ":", "entry", "=", "Mock", "(", ")", "entry", ".", "data", "=", "{", "\"host\"", ":", "\"1.2.3.4\"", ",", "\"username\"", ":", "\"mock-username\"", "}", "entry", ".", "options", "=", "{", "CONF...
[ 50, 0 ]
[ 60, 38 ]
python
en
['en', 'en', 'en']
True
test_reset_if_entry_had_wrong_auth
(hass)
Test calling reset when the entry contained wrong auth.
Test calling reset when the entry contained wrong auth.
async def test_reset_if_entry_had_wrong_auth(hass): """Test calling reset when the entry contained wrong auth.""" entry = Mock() entry.data = {"host": "1.2.3.4", "username": "mock-username"} entry.options = {CONF_ALLOW_HUE_GROUPS: False, CONF_ALLOW_UNREACHABLE: False} hue_bridge = bridge.HueBridge(h...
[ "async", "def", "test_reset_if_entry_had_wrong_auth", "(", "hass", ")", ":", "entry", "=", "Mock", "(", ")", "entry", ".", "data", "=", "{", "\"host\"", ":", "\"1.2.3.4\"", ",", "\"username\"", ":", "\"mock-username\"", "}", "entry", ".", "options", "=", "{"...
[ 63, 0 ]
[ 77, 41 ]
python
en
['en', 'en', 'en']
True
test_reset_unloads_entry_if_setup
(hass)
Test calling reset while the entry has been setup.
Test calling reset while the entry has been setup.
async def test_reset_unloads_entry_if_setup(hass): """Test calling reset while the entry has been setup.""" entry = Mock() entry.data = {"host": "1.2.3.4", "username": "mock-username"} entry.options = {CONF_ALLOW_HUE_GROUPS: False, CONF_ALLOW_UNREACHABLE: False} hue_bridge = bridge.HueBridge(hass, e...
[ "async", "def", "test_reset_unloads_entry_if_setup", "(", "hass", ")", ":", "entry", "=", "Mock", "(", ")", "entry", ".", "data", "=", "{", "\"host\"", ":", "\"1.2.3.4\"", ",", "\"username\"", ":", "\"mock-username\"", "}", "entry", ".", "options", "=", "{",...
[ 80, 0 ]
[ 101, 51 ]
python
en
['en', 'en', 'en']
True
test_handle_unauthorized
(hass)
Test handling an unauthorized error on update.
Test handling an unauthorized error on update.
async def test_handle_unauthorized(hass): """Test handling an unauthorized error on update.""" entry = Mock(async_setup=AsyncMock()) entry.data = {"host": "1.2.3.4", "username": "mock-username"} entry.options = {CONF_ALLOW_HUE_GROUPS: False, CONF_ALLOW_UNREACHABLE: False} hue_bridge = bridge.HueBrid...
[ "async", "def", "test_handle_unauthorized", "(", "hass", ")", ":", "entry", "=", "Mock", "(", "async_setup", "=", "AsyncMock", "(", ")", ")", "entry", ".", "data", "=", "{", "\"host\"", ":", "\"1.2.3.4\"", ",", "\"username\"", ":", "\"mock-username\"", "}", ...
[ 104, 0 ]
[ 123, 55 ]
python
en
['en', 'de', 'en']
True
test_hue_activate_scene
(hass, mock_api)
Test successful hue_activate_scene.
Test successful hue_activate_scene.
async def test_hue_activate_scene(hass, mock_api): """Test successful hue_activate_scene.""" config_entry = config_entries.ConfigEntry( 1, hue.DOMAIN, "Mock Title", {"host": "mock-host", "username": "mock-username"}, "test", config_entries.CONN_CLASS_LOCAL_POLL, ...
[ "async", "def", "test_hue_activate_scene", "(", "hass", ",", "mock_api", ")", ":", "config_entry", "=", "config_entries", ".", "ConfigEntry", "(", "1", ",", "hue", ".", "DOMAIN", ",", "\"Mock Title\"", ",", "{", "\"host\"", ":", "\"mock-host\"", ",", "\"userna...
[ 160, 0 ]
[ 191, 71 ]
python
en
['en', 'la', 'en']
True
test_hue_activate_scene_group_not_found
(hass, mock_api)
Test failed hue_activate_scene due to missing group.
Test failed hue_activate_scene due to missing group.
async def test_hue_activate_scene_group_not_found(hass, mock_api): """Test failed hue_activate_scene due to missing group.""" config_entry = config_entries.ConfigEntry( 1, hue.DOMAIN, "Mock Title", {"host": "mock-host", "username": "mock-username"}, "test", config...
[ "async", "def", "test_hue_activate_scene_group_not_found", "(", "hass", ",", "mock_api", ")", ":", "config_entry", "=", "config_entries", ".", "ConfigEntry", "(", "1", ",", "hue", ".", "DOMAIN", ",", "\"Mock Title\"", ",", "{", "\"host\"", ":", "\"mock-host\"", ...
[ 194, 0 ]
[ 221, 65 ]
python
en
['en', 'en', 'en']
True
test_hue_activate_scene_scene_not_found
(hass, mock_api)
Test failed hue_activate_scene due to missing scene.
Test failed hue_activate_scene due to missing scene.
async def test_hue_activate_scene_scene_not_found(hass, mock_api): """Test failed hue_activate_scene due to missing scene.""" config_entry = config_entries.ConfigEntry( 1, hue.DOMAIN, "Mock Title", {"host": "mock-host", "username": "mock-username"}, "test", config...
[ "async", "def", "test_hue_activate_scene_scene_not_found", "(", "hass", ",", "mock_api", ")", ":", "config_entry", "=", "config_entries", ".", "ConfigEntry", "(", "1", ",", "hue", ".", "DOMAIN", ",", "\"Mock Title\"", ",", "{", "\"host\"", ":", "\"mock-host\"", ...
[ 224, 0 ]
[ 251, 65 ]
python
en
['en', 'en', 'en']
True
async_setup_platform
(hass, config, async_add_entities, discovery_info=None)
Set up climate(s) for KNX platform.
Set up climate(s) for KNX platform.
async def async_setup_platform(hass, config, async_add_entities, discovery_info=None): """Set up climate(s) for KNX platform.""" entities = [] for device in hass.data[DOMAIN].xknx.devices: if isinstance(device, XknxClimate): entities.append(KNXClimate(device)) async_add_entities(enti...
[ "async", "def", "async_setup_platform", "(", "hass", ",", "config", ",", "async_add_entities", ",", "discovery_info", "=", "None", ")", ":", "entities", "=", "[", "]", "for", "device", "in", "hass", ".", "data", "[", "DOMAIN", "]", ".", "xknx", ".", "dev...
[ 23, 0 ]
[ 29, 32 ]
python
en
['en', 'da', 'en']
True
KNXClimate.__init__
(self, device: XknxClimate)
Initialize of a KNX climate device.
Initialize of a KNX climate device.
def __init__(self, device: XknxClimate): """Initialize of a KNX climate device.""" super().__init__(device) self._unit_of_measurement = TEMP_CELSIUS
[ "def", "__init__", "(", "self", ",", "device", ":", "XknxClimate", ")", ":", "super", "(", ")", ".", "__init__", "(", "device", ")", "self", ".", "_unit_of_measurement", "=", "TEMP_CELSIUS" ]
[ 35, 4 ]
[ 39, 48 ]
python
en
['en', 'en', 'en']
True
KNXClimate.supported_features
(self)
Return the list of supported features.
Return the list of supported features.
def supported_features(self) -> int: """Return the list of supported features.""" return SUPPORT_TARGET_TEMPERATURE | SUPPORT_PRESET_MODE
[ "def", "supported_features", "(", "self", ")", "->", "int", ":", "return", "SUPPORT_TARGET_TEMPERATURE", "|", "SUPPORT_PRESET_MODE" ]
[ 42, 4 ]
[ 44, 63 ]
python
en
['en', 'en', 'en']
True
KNXClimate.async_update
(self)
Request a state update from KNX bus.
Request a state update from KNX bus.
async def async_update(self): """Request a state update from KNX bus.""" await self._device.sync() await self._device.mode.sync()
[ "async", "def", "async_update", "(", "self", ")", ":", "await", "self", ".", "_device", ".", "sync", "(", ")", "await", "self", ".", "_device", ".", "mode", ".", "sync", "(", ")" ]
[ 46, 4 ]
[ 49, 38 ]
python
en
['en', 'en', 'en']
True
KNXClimate.temperature_unit
(self)
Return the unit of measurement.
Return the unit of measurement.
def temperature_unit(self): """Return the unit of measurement.""" return self._unit_of_measurement
[ "def", "temperature_unit", "(", "self", ")", ":", "return", "self", ".", "_unit_of_measurement" ]
[ 52, 4 ]
[ 54, 40 ]
python
en
['en', 'la', 'en']
True
KNXClimate.current_temperature
(self)
Return the current temperature.
Return the current temperature.
def current_temperature(self): """Return the current temperature.""" return self._device.temperature.value
[ "def", "current_temperature", "(", "self", ")", ":", "return", "self", ".", "_device", ".", "temperature", ".", "value" ]
[ 57, 4 ]
[ 59, 45 ]
python
en
['en', 'la', 'en']
True
KNXClimate.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.""" return self._device.temperature_step
[ "def", "target_temperature_step", "(", "self", ")", ":", "return", "self", ".", "_device", ".", "temperature_step" ]
[ 62, 4 ]
[ 64, 44 ]
python
en
['en', 'en', 'en']
True
KNXClimate.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.""" return self._device.target_temperature.value
[ "def", "target_temperature", "(", "self", ")", ":", "return", "self", ".", "_device", ".", "target_temperature", ".", "value" ]
[ 67, 4 ]
[ 69, 52 ]
python
en
['en', 'en', 'en']
True
KNXClimate.min_temp
(self)
Return the minimum temperature.
Return the minimum temperature.
def min_temp(self): """Return the minimum temperature.""" return self._device.target_temperature_min
[ "def", "min_temp", "(", "self", ")", ":", "return", "self", ".", "_device", ".", "target_temperature_min" ]
[ 72, 4 ]
[ 74, 50 ]
python
en
['en', 'la', 'en']
True
KNXClimate.max_temp
(self)
Return the maximum temperature.
Return the maximum temperature.
def max_temp(self): """Return the maximum temperature.""" return self._device.target_temperature_max
[ "def", "max_temp", "(", "self", ")", ":", "return", "self", ".", "_device", ".", "target_temperature_max" ]
[ 77, 4 ]
[ 79, 50 ]
python
en
['en', 'la', 'en']
True
KNXClimate.async_set_temperature
(self, **kwargs)
Set new target temperature.
Set new target temperature.
async def async_set_temperature(self, **kwargs) -> None: """Set new target temperature.""" temperature = kwargs.get(ATTR_TEMPERATURE) if temperature is None: return await self._device.set_target_temperature(temperature) self.async_write_ha_state()
[ "async", "def", "async_set_temperature", "(", "self", ",", "*", "*", "kwargs", ")", "->", "None", ":", "temperature", "=", "kwargs", ".", "get", "(", "ATTR_TEMPERATURE", ")", "if", "temperature", "is", "None", ":", "return", "await", "self", ".", "_device"...
[ 81, 4 ]
[ 87, 35 ]
python
en
['en', 'ca', 'en']
True
KNXClimate.hvac_mode
(self)
Return current operation ie. heat, cool, idle.
Return current operation ie. heat, cool, idle.
def hvac_mode(self) -> Optional[str]: """Return current operation ie. heat, cool, idle.""" if self._device.supports_on_off and not self._device.is_on: return HVAC_MODE_OFF if self._device.mode.supports_controller_mode: return CONTROLLER_MODES.get( self._de...
[ "def", "hvac_mode", "(", "self", ")", "->", "Optional", "[", "str", "]", ":", "if", "self", ".", "_device", ".", "supports_on_off", "and", "not", "self", ".", "_device", ".", "is_on", ":", "return", "HVAC_MODE_OFF", "if", "self", ".", "_device", ".", "...
[ 90, 4 ]
[ 99, 29 ]
python
en
['nl', 'en', 'en']
True
KNXClimate.hvac_modes
(self)
Return the list of available operation/controller modes.
Return the list of available operation/controller modes.
def hvac_modes(self) -> Optional[List[str]]: """Return the list of available operation/controller modes.""" _controller_modes = [ CONTROLLER_MODES.get(controller_mode.value) for controller_mode in self._device.mode.controller_modes ] if self._device.supports_on_o...
[ "def", "hvac_modes", "(", "self", ")", "->", "Optional", "[", "List", "[", "str", "]", "]", ":", "_controller_modes", "=", "[", "CONTROLLER_MODES", ".", "get", "(", "controller_mode", ".", "value", ")", "for", "controller_mode", "in", "self", ".", "_device...
[ 102, 4 ]
[ 116, 53 ]
python
en
['en', 'en', 'en']
True
KNXClimate.async_set_hvac_mode
(self, hvac_mode: str)
Set operation mode.
Set operation mode.
async def async_set_hvac_mode(self, hvac_mode: str) -> None: """Set operation mode.""" if self._device.supports_on_off and hvac_mode == HVAC_MODE_OFF: await self._device.turn_off() else: if self._device.supports_on_off and not self._device.is_on: await sel...
[ "async", "def", "async_set_hvac_mode", "(", "self", ",", "hvac_mode", ":", "str", ")", "->", "None", ":", "if", "self", ".", "_device", ".", "supports_on_off", "and", "hvac_mode", "==", "HVAC_MODE_OFF", ":", "await", "self", ".", "_device", ".", "turn_off", ...
[ 118, 4 ]
[ 130, 35 ]
python
en
['nl', 'ny', 'en']
False
KNXClimate.preset_mode
(self)
Return the current preset mode, e.g., home, away, temp. Requires SUPPORT_PRESET_MODE.
Return the current preset mode, e.g., home, away, temp.
def preset_mode(self) -> Optional[str]: """Return the current preset mode, e.g., home, away, temp. Requires SUPPORT_PRESET_MODE. """ if self._device.mode.supports_operation_mode: return PRESET_MODES.get(self._device.mode.operation_mode.value, PRESET_AWAY) return None
[ "def", "preset_mode", "(", "self", ")", "->", "Optional", "[", "str", "]", ":", "if", "self", ".", "_device", ".", "mode", ".", "supports_operation_mode", ":", "return", "PRESET_MODES", ".", "get", "(", "self", ".", "_device", ".", "mode", ".", "operatio...
[ 133, 4 ]
[ 140, 19 ]
python
en
['en', 'pt', 'en']
True
KNXClimate.preset_modes
(self)
Return a list of available preset modes. Requires SUPPORT_PRESET_MODE.
Return a list of available preset modes.
def preset_modes(self) -> Optional[List[str]]: """Return a list of available preset modes. Requires SUPPORT_PRESET_MODE. """ _presets = [ PRESET_MODES.get(operation_mode.value) for operation_mode in self._device.mode.operation_modes ] return list...
[ "def", "preset_modes", "(", "self", ")", "->", "Optional", "[", "List", "[", "str", "]", "]", ":", "_presets", "=", "[", "PRESET_MODES", ".", "get", "(", "operation_mode", ".", "value", ")", "for", "operation_mode", "in", "self", ".", "_device", ".", "...
[ 143, 4 ]
[ 153, 43 ]
python
en
['en', 'en', 'en']
True
KNXClimate.async_set_preset_mode
(self, preset_mode: str)
Set new preset mode.
Set new preset mode.
async def async_set_preset_mode(self, preset_mode: str) -> None: """Set new preset mode.""" if self._device.mode.supports_operation_mode: knx_operation_mode = HVACOperationMode(PRESET_MODES_INV.get(preset_mode)) await self._device.mode.set_operation_mode(knx_operation_mode) ...
[ "async", "def", "async_set_preset_mode", "(", "self", ",", "preset_mode", ":", "str", ")", "->", "None", ":", "if", "self", ".", "_device", ".", "mode", ".", "supports_operation_mode", ":", "knx_operation_mode", "=", "HVACOperationMode", "(", "PRESET_MODES_INV", ...
[ 155, 4 ]
[ 160, 39 ]
python
en
['en', 'sr', 'en']
True
async_setup_platform
(hass, config, async_add_entities, discovery_info=None)
Set up the AfterShip sensor platform.
Set up the AfterShip sensor platform.
async def async_setup_platform(hass, config, async_add_entities, discovery_info=None): """Set up the AfterShip sensor platform.""" apikey = config[CONF_API_KEY] name = config[CONF_NAME] session = async_get_clientsession(hass) aftership = Tracking(hass.loop, session, apikey) await aftership.get...
[ "async", "def", "async_setup_platform", "(", "hass", ",", "config", ",", "async_add_entities", ",", "discovery_info", "=", "None", ")", ":", "apikey", "=", "config", "[", "CONF_API_KEY", "]", "name", "=", "config", "[", "CONF_NAME", "]", "session", "=", "asy...
[ 58, 0 ]
[ 107, 5 ]
python
en
['en', 'da', 'en']
True
AfterShipSensor.__init__
(self, aftership, name)
Initialize the sensor.
Initialize the sensor.
def __init__(self, aftership, name): """Initialize the sensor.""" self._attributes = {} self._name = name self._state = None self.aftership = aftership
[ "def", "__init__", "(", "self", ",", "aftership", ",", "name", ")", ":", "self", ".", "_attributes", "=", "{", "}", "self", ".", "_name", "=", "name", "self", ".", "_state", "=", "None", "self", ".", "aftership", "=", "aftership" ]
[ 113, 4 ]
[ 118, 34 ]
python
en
['en', 'en', 'en']
True
AfterShipSensor.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" ]
[ 121, 4 ]
[ 123, 25 ]
python
en
['en', 'mi', 'en']
True
AfterShipSensor.state
(self)
Return the state of the sensor.
Return the state of the sensor.
def state(self): """Return the state of the sensor.""" return self._state
[ "def", "state", "(", "self", ")", ":", "return", "self", ".", "_state" ]
[ 126, 4 ]
[ 128, 26 ]
python
en
['en', 'en', 'en']
True
AfterShipSensor.unit_of_measurement
(self)
Return the unit of measurement of this entity, if any.
Return the unit of measurement of this entity, if any.
def unit_of_measurement(self): """Return the unit of measurement of this entity, if any.""" return "packages"
[ "def", "unit_of_measurement", "(", "self", ")", ":", "return", "\"packages\"" ]
[ 131, 4 ]
[ 133, 25 ]
python
en
['en', 'en', 'en']
True
AfterShipSensor.device_state_attributes
(self)
Return attributes for the sensor.
Return attributes for the sensor.
def device_state_attributes(self): """Return attributes for the sensor.""" return self._attributes
[ "def", "device_state_attributes", "(", "self", ")", ":", "return", "self", ".", "_attributes" ]
[ 136, 4 ]
[ 138, 31 ]
python
en
['en', 'no', 'en']
True
AfterShipSensor.icon
(self)
Icon to use in the frontend.
Icon to use in the frontend.
def icon(self): """Icon to use in the frontend.""" return ICON
[ "def", "icon", "(", "self", ")", ":", "return", "ICON" ]
[ 141, 4 ]
[ 143, 19 ]
python
en
['en', 'en', 'en']
True
AfterShipSensor.async_added_to_hass
(self)
Register callbacks.
Register callbacks.
async def async_added_to_hass(self): """Register callbacks.""" self.async_on_remove( self.hass.helpers.dispatcher.async_dispatcher_connect( UPDATE_TOPIC, self._force_update ) )
[ "async", "def", "async_added_to_hass", "(", "self", ")", ":", "self", ".", "async_on_remove", "(", "self", ".", "hass", ".", "helpers", ".", "dispatcher", ".", "async_dispatcher_connect", "(", "UPDATE_TOPIC", ",", "self", ".", "_force_update", ")", ")" ]
[ 145, 4 ]
[ 151, 9 ]
python
en
['en', 'no', 'en']
False
AfterShipSensor._force_update
(self)
Force update of data.
Force update of data.
async def _force_update(self): """Force update of data.""" await self.async_update(no_throttle=True) self.async_write_ha_state()
[ "async", "def", "_force_update", "(", "self", ")", ":", "await", "self", ".", "async_update", "(", "no_throttle", "=", "True", ")", "self", ".", "async_write_ha_state", "(", ")" ]
[ 153, 4 ]
[ 156, 35 ]
python
en
['en', 'en', 'en']
True
AfterShipSensor.async_update
(self, **kwargs)
Get the latest data from the AfterShip API.
Get the latest data from the AfterShip API.
async def async_update(self, **kwargs): """Get the latest data from the AfterShip API.""" await self.aftership.get_trackings() if not self.aftership.meta: _LOGGER.error("Unknown errors when querying") return if self.aftership.meta["code"] != HTTP_OK: ...
[ "async", "def", "async_update", "(", "self", ",", "*", "*", "kwargs", ")", ":", "await", "self", ".", "aftership", ".", "get_trackings", "(", ")", "if", "not", "self", ".", "aftership", ".", "meta", ":", "_LOGGER", ".", "error", "(", "\"Unknown errors wh...
[ 159, 4 ]
[ 212, 41 ]
python
en
['en', 'en', 'en']
True
MPNetTokenizerFast.mask_token
(self)
:obj:`str`: Mask token, to use when training a model with masked-language modeling. Log an error if used while not having been set. MPNet tokenizer has a special mask token to be usble in the fill-mask pipeline. The mask token will greedily comprise the space before the `<mask>`. ...
:obj:`str`: Mask token, to use when training a model with masked-language modeling. Log an error if used while not having been set.
def mask_token(self) -> str: """ :obj:`str`: Mask token, to use when training a model with masked-language modeling. Log an error if used while not having been set. MPNet tokenizer has a special mask token to be usble in the fill-mask pipeline. The mask token will greedily compr...
[ "def", "mask_token", "(", "self", ")", "->", "str", ":", "if", "self", ".", "_mask_token", "is", "None", "and", "self", ".", "verbose", ":", "logger", ".", "error", "(", "\"Using mask_token, but it is not set yet.\"", ")", "return", "None", "return", "str", ...
[ 151, 4 ]
[ 162, 36 ]
python
en
['en', 'error', 'th']
False
MPNetTokenizerFast.mask_token
(self, value)
Overriding the default behavior of the mask token to have it eat the space before it. This is needed to preserve backward compatibility with all the previously used models based on MPNet.
Overriding the default behavior of the mask token to have it eat the space before it.
def mask_token(self, value): """ Overriding the default behavior of the mask token to have it eat the space before it. This is needed to preserve backward compatibility with all the previously used models based on MPNet. """ # Mask token behave like a normal word, i.e. include t...
[ "def", "mask_token", "(", "self", ",", "value", ")", ":", "# Mask token behave like a normal word, i.e. include the space before it", "# So we set lstrip to True", "value", "=", "AddedToken", "(", "value", ",", "lstrip", "=", "True", ",", "rstrip", "=", "False", ")", ...
[ 165, 4 ]
[ 174, 32 ]
python
en
['en', 'error', 'th']
False
MPNetTokenizerFast.create_token_type_ids_from_sequences
( self, token_ids_0: List[int], token_ids_1: Optional[List[int]] = None )
Creates a mask from the two sequences passed to be used in a sequence-pair classification task. MPNet does not make use of token type ids, therefore a list of zeros is returned Args: token_ids_0 (:obj:`List[int]`): List of ids. token_ids_1 (:obj:`List[in...
Creates a mask from the two sequences passed to be used in a sequence-pair classification task. MPNet does not make use of token type ids, therefore a list of zeros is returned
def create_token_type_ids_from_sequences( self, token_ids_0: List[int], token_ids_1: Optional[List[int]] = None ) -> List[int]: """ Creates a mask from the two sequences passed to be used in a sequence-pair classification task. MPNet does not make use of token type ids, therefore a l...
[ "def", "create_token_type_ids_from_sequences", "(", "self", ",", "token_ids_0", ":", "List", "[", "int", "]", ",", "token_ids_1", ":", "Optional", "[", "List", "[", "int", "]", "]", "=", "None", ")", "->", "List", "[", "int", "]", ":", "sep", "=", "[",...
[ 183, 4 ]
[ 204, 75 ]
python
en
['en', 'error', 'th']
False
async_setup
(hass, config)
Set up water_heater devices.
Set up water_heater devices.
async def async_setup(hass, config): """Set up water_heater devices.""" component = hass.data[DOMAIN] = EntityComponent( _LOGGER, DOMAIN, hass, SCAN_INTERVAL ) await component.async_setup(config) component.async_register_entity_service( SERVICE_SET_AWAY_MODE, SET_AWAY_MODE_SCHEMA, a...
[ "async", "def", "async_setup", "(", "hass", ",", "config", ")", ":", "component", "=", "hass", ".", "data", "[", "DOMAIN", "]", "=", "EntityComponent", "(", "_LOGGER", ",", "DOMAIN", ",", "hass", ",", "SCAN_INTERVAL", ")", "await", "component", ".", "asy...
[ 92, 0 ]
[ 117, 15 ]
python
en
['en', 'en', 'en']
True
async_setup_entry
(hass, entry)
Set up a config entry.
Set up a config entry.
async def async_setup_entry(hass, entry): """Set up a config entry.""" return await hass.data[DOMAIN].async_setup_entry(entry)
[ "async", "def", "async_setup_entry", "(", "hass", ",", "entry", ")", ":", "return", "await", "hass", ".", "data", "[", "DOMAIN", "]", ".", "async_setup_entry", "(", "entry", ")" ]
[ 120, 0 ]
[ 122, 59 ]
python
en
['en', 'en', 'en']
True
async_unload_entry
(hass, entry)
Unload a config entry.
Unload a config entry.
async def async_unload_entry(hass, entry): """Unload a config entry.""" return await hass.data[DOMAIN].async_unload_entry(entry)
[ "async", "def", "async_unload_entry", "(", "hass", ",", "entry", ")", ":", "return", "await", "hass", ".", "data", "[", "DOMAIN", "]", ".", "async_unload_entry", "(", "entry", ")" ]
[ 125, 0 ]
[ 127, 60 ]
python
en
['en', 'es', 'en']
True
async_service_away_mode
(entity, service)
Handle away mode service.
Handle away mode service.
async def async_service_away_mode(entity, service): """Handle away mode service.""" if service.data[ATTR_AWAY_MODE]: await entity.async_turn_away_mode_on() else: await entity.async_turn_away_mode_off()
[ "async", "def", "async_service_away_mode", "(", "entity", ",", "service", ")", ":", "if", "service", ".", "data", "[", "ATTR_AWAY_MODE", "]", ":", "await", "entity", ".", "async_turn_away_mode_on", "(", ")", "else", ":", "await", "entity", ".", "async_turn_awa...
[ 299, 0 ]
[ 304, 47 ]
python
en
['en', 'en', 'en']
True
async_service_temperature_set
(entity, service)
Handle set temperature service.
Handle set temperature service.
async def async_service_temperature_set(entity, service): """Handle set temperature service.""" hass = entity.hass kwargs = {} for value, temp in service.data.items(): if value in CONVERTIBLE_ATTRIBUTE: kwargs[value] = convert_temperature( temp, hass.config.units.tem...
[ "async", "def", "async_service_temperature_set", "(", "entity", ",", "service", ")", ":", "hass", "=", "entity", ".", "hass", "kwargs", "=", "{", "}", "for", "value", ",", "temp", "in", "service", ".", "data", ".", "items", "(", ")", ":", "if", "value"...
[ 307, 0 ]
[ 320, 48 ]
python
ca
['es', 'ca', 'en']
False
WaterHeaterEntity.state
(self)
Return the current state.
Return the current state.
def state(self): """Return the current state.""" return self.current_operation
[ "def", "state", "(", "self", ")", ":", "return", "self", ".", "current_operation" ]
[ 134, 4 ]
[ 136, 37 ]
python
en
['en', 'en', 'en']
True
WaterHeaterEntity.precision
(self)
Return the precision of the system.
Return the precision of the system.
def precision(self): """Return the precision of the system.""" if self.hass.config.units.temperature_unit == TEMP_CELSIUS: return PRECISION_TENTHS return PRECISION_WHOLE
[ "def", "precision", "(", "self", ")", ":", "if", "self", ".", "hass", ".", "config", ".", "units", ".", "temperature_unit", "==", "TEMP_CELSIUS", ":", "return", "PRECISION_TENTHS", "return", "PRECISION_WHOLE" ]
[ 139, 4 ]
[ 143, 30 ]
python
en
['en', 'en', 'en']
True
WaterHeaterEntity.capability_attributes
(self)
Return capability attributes.
Return capability attributes.
def capability_attributes(self): """Return capability attributes.""" supported_features = self.supported_features or 0 data = { ATTR_MIN_TEMP: show_temp( self.hass, self.min_temp, self.temperature_unit, self.precision ), ATTR_MAX_TEMP: show_te...
[ "def", "capability_attributes", "(", "self", ")", ":", "supported_features", "=", "self", ".", "supported_features", "or", "0", "data", "=", "{", "ATTR_MIN_TEMP", ":", "show_temp", "(", "self", ".", "hass", ",", "self", ".", "min_temp", ",", "self", ".", "...
[ 146, 4 ]
[ 162, 19 ]
python
en
['en', 'la', 'en']
True