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
test_template
(hass)
Test a configuration using a complex template.
Test a configuration using a complex template.
async def test_template(hass): """Test a configuration using a complex template.""" config = CONFIG_FAN[DOMAIN][CONF_ENTITIES] assert await async_setup_component( hass, FAN_DOMAIN, {FAN_DOMAIN: {"platform": "demo"}} ) with patch( "sense_energy.SenseLink", return_value=Mock(st...
[ "async", "def", "test_template", "(", "hass", ")", ":", "config", "=", "CONFIG_FAN", "[", "DOMAIN", "]", "[", "CONF_ENTITIES", "]", "assert", "await", "async_setup_component", "(", "hass", ",", "FAN_DOMAIN", ",", "{", "FAN_DOMAIN", ":", "{", "\"platform\"", ...
[ 258, 0 ]
[ 314, 33 ]
python
en
['en', 'en', 'en']
True
test_sensor
(hass)
Test a configuration using a sensor in a template.
Test a configuration using a sensor in a template.
async def test_sensor(hass): """Test a configuration using a sensor in a template.""" config = CONFIG_LIGHT[DOMAIN][CONF_ENTITIES] assert await async_setup_component( hass, LIGHT_DOMAIN, {LIGHT_DOMAIN: {"platform": "demo"}} ) assert await async_setup_component( hass, SENSOR_D...
[ "async", "def", "test_sensor", "(", "hass", ")", ":", "config", "=", "CONFIG_LIGHT", "[", "DOMAIN", "]", "[", "CONF_ENTITIES", "]", "assert", "await", "async_setup_component", "(", "hass", ",", "LIGHT_DOMAIN", ",", "{", "LIGHT_DOMAIN", ":", "{", "\"platform\""...
[ 317, 0 ]
[ 371, 33 ]
python
en
['en', 'en', 'en']
True
test_sensor_state
(hass)
Test a configuration using a sensor in a template.
Test a configuration using a sensor in a template.
async def test_sensor_state(hass): """Test a configuration using a sensor in a template.""" config = CONFIG_SENSOR[DOMAIN][CONF_ENTITIES] assert await async_setup_component( hass, SENSOR_DOMAIN, {SENSOR_DOMAIN: {"platform": "demo"}}, ) with patch( "sense_energy.SenseL...
[ "async", "def", "test_sensor_state", "(", "hass", ")", ":", "config", "=", "CONFIG_SENSOR", "[", "DOMAIN", "]", "[", "CONF_ENTITIES", "]", "assert", "await", "async_setup_component", "(", "hass", ",", "SENSOR_DOMAIN", ",", "{", "SENSOR_DOMAIN", ":", "{", "\"pl...
[ 374, 0 ]
[ 418, 33 ]
python
en
['en', 'en', 'en']
True
test_multiple_devices
(hass)
Test that devices are reported correctly.
Test that devices are reported correctly.
async def test_multiple_devices(hass): """Test that devices are reported correctly.""" config = CONFIG[DOMAIN][CONF_ENTITIES] assert await async_setup_component( hass, SWITCH_DOMAIN, {SWITCH_DOMAIN: {"platform": "demo"}} ) assert await async_setup_component( hass, LIGHT_DOMAIN, {LIGH...
[ "async", "def", "test_multiple_devices", "(", "hass", ")", ":", "config", "=", "CONFIG", "[", "DOMAIN", "]", "[", "CONF_ENTITIES", "]", "assert", "await", "async_setup_component", "(", "hass", ",", "SWITCH_DOMAIN", ",", "{", "SWITCH_DOMAIN", ":", "{", "\"platf...
[ 421, 0 ]
[ 494, 38 ]
python
en
['en', 'en', 'en']
True
async_setup_entry
(hass, config_entry, async_add_entities)
Set up sensors for device.
Set up sensors for device.
async def async_setup_entry(hass, config_entry, async_add_entities): """Set up sensors for device.""" await async_setup_entry_attribute_entities( hass, config_entry, async_add_entities, SENSORS, ShellySensor ) await async_setup_entry_rest( hass, config_entry, async_add_entities, REST_SEN...
[ "async", "def", "async_setup_entry", "(", "hass", ",", "config_entry", ",", "async_add_entities", ")", ":", "await", "async_setup_entry_attribute_entities", "(", "hass", ",", "config_entry", ",", "async_add_entities", ",", "SENSORS", ",", "ShellySensor", ")", "await",...
[ 179, 0 ]
[ 186, 5 ]
python
en
['en', 'en', 'en']
True
ShellySensor.state
(self)
Return value of sensor.
Return value of sensor.
def state(self): """Return value of sensor.""" return self.attribute_value
[ "def", "state", "(", "self", ")", ":", "return", "self", ".", "attribute_value" ]
[ 193, 4 ]
[ 195, 35 ]
python
en
['en', 'no', 'en']
True
ShellyRestSensor.state
(self)
Return value of sensor.
Return value of sensor.
def state(self): """Return value of sensor.""" return self.attribute_value
[ "def", "state", "(", "self", ")", ":", "return", "self", ".", "attribute_value" ]
[ 202, 4 ]
[ 204, 35 ]
python
en
['en', 'no', 'en']
True
gdacs_setup_fixture
()
Mock gdacs entry setup.
Mock gdacs entry setup.
def gdacs_setup_fixture(): """Mock gdacs entry setup.""" with patch("homeassistant.components.gdacs.async_setup_entry", return_value=True): yield
[ "def", "gdacs_setup_fixture", "(", ")", ":", "with", "patch", "(", "\"homeassistant.components.gdacs.async_setup_entry\"", ",", "return_value", "=", "True", ")", ":", "yield" ]
[ 18, 0 ]
[ 21, 13 ]
python
en
['en', 'st', 'en']
True
test_duplicate_error
(hass, config_entry)
Test that errors are shown when duplicates are added.
Test that errors are shown when duplicates are added.
async def test_duplicate_error(hass, config_entry): """Test that errors are shown when duplicates are added.""" conf = {CONF_LATITUDE: -41.2, CONF_LONGITUDE: 174.7, CONF_RADIUS: 25} config_entry.add_to_hass(hass) result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": "us...
[ "async", "def", "test_duplicate_error", "(", "hass", ",", "config_entry", ")", ":", "conf", "=", "{", "CONF_LATITUDE", ":", "-", "41.2", ",", "CONF_LONGITUDE", ":", "174.7", ",", "CONF_RADIUS", ":", "25", "}", "config_entry", ".", "add_to_hass", "(", "hass",...
[ 24, 0 ]
[ 33, 51 ]
python
en
['en', 'en', 'en']
True
test_show_form
(hass)
Test that the form is served with no input.
Test that the form is served with no input.
async def test_show_form(hass): """Test that the form is served with no input.""" result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": "user"} ) assert result["type"] == data_entry_flow.RESULT_TYPE_FORM assert result["step_id"] == "user"
[ "async", "def", "test_show_form", "(", "hass", ")", ":", "result", "=", "await", "hass", ".", "config_entries", ".", "flow", ".", "async_init", "(", "DOMAIN", ",", "context", "=", "{", "\"source\"", ":", "\"user\"", "}", ")", "assert", "result", "[", "\"...
[ 36, 0 ]
[ 42, 38 ]
python
en
['en', 'en', 'en']
True
test_step_import
(hass)
Test that the import step works.
Test that the import step works.
async def test_step_import(hass): """Test that the import step works.""" conf = { CONF_LATITUDE: -41.2, CONF_LONGITUDE: 174.7, CONF_RADIUS: 25, CONF_SCAN_INTERVAL: timedelta(minutes=4), CONF_CATEGORIES: ["Drought", "Earthquake"], } result = await hass.config_entr...
[ "async", "def", "test_step_import", "(", "hass", ")", ":", "conf", "=", "{", "CONF_LATITUDE", ":", "-", "41.2", ",", "CONF_LONGITUDE", ":", "174.7", ",", "CONF_RADIUS", ":", "25", ",", "CONF_SCAN_INTERVAL", ":", "timedelta", "(", "minutes", "=", "4", ")", ...
[ 45, 0 ]
[ 66, 5 ]
python
en
['en', 'en', 'en']
True
test_step_user
(hass)
Test that the user step works.
Test that the user step works.
async def test_step_user(hass): """Test that the user step works.""" hass.config.latitude = -41.2 hass.config.longitude = 174.7 conf = {CONF_RADIUS: 25} result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": "user"}, data=conf ) assert result["type"] == data_...
[ "async", "def", "test_step_user", "(", "hass", ")", ":", "hass", ".", "config", ".", "latitude", "=", "-", "41.2", "hass", ".", "config", ".", "longitude", "=", "174.7", "conf", "=", "{", "CONF_RADIUS", ":", "25", "}", "result", "=", "await", "hass", ...
[ 69, 0 ]
[ 86, 5 ]
python
en
['en', 'en', 'en']
True
async_setup
(hass: HomeAssistant, config: ConfigType)
Set up the Spotify integration.
Set up the Spotify integration.
async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool: """Set up the Spotify integration.""" if DOMAIN not in config: return True if CONF_CLIENT_ID in config[DOMAIN]: config_flow.SpotifyFlowHandler.async_register_implementation( hass, config_entry_oa...
[ "async", "def", "async_setup", "(", "hass", ":", "HomeAssistant", ",", "config", ":", "ConfigType", ")", "->", "bool", ":", "if", "DOMAIN", "not", "in", "config", ":", "return", "True", "if", "CONF_CLIENT_ID", "in", "config", "[", "DOMAIN", "]", ":", "co...
[ 39, 0 ]
[ 57, 15 ]
python
en
['en', 'cs', 'en']
True
async_setup_entry
(hass: HomeAssistant, entry: ConfigEntry)
Set up Spotify from a config entry.
Set up Spotify from a config entry.
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: """Set up Spotify from a config entry.""" implementation = await async_get_config_entry_implementation(hass, entry) session = OAuth2Session(hass, entry, implementation) await session.async_ensure_token_valid() spotify = Sp...
[ "async", "def", "async_setup_entry", "(", "hass", ":", "HomeAssistant", ",", "entry", ":", "ConfigEntry", ")", "->", "bool", ":", "implementation", "=", "await", "async_get_config_entry_implementation", "(", "hass", ",", "entry", ")", "session", "=", "OAuth2Sessio...
[ 60, 0 ]
[ 91, 15 ]
python
en
['en', 'en', 'en']
True
async_unload_entry
(hass: HomeAssistant, entry: ConfigEntry)
Unload Spotify config entry.
Unload Spotify config entry.
async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: """Unload Spotify config entry.""" # Unload entities for this entry/device. await hass.config_entries.async_forward_entry_unload(entry, MEDIA_PLAYER_DOMAIN) # Cleanup del hass.data[DOMAIN][entry.entry_id] if not hass...
[ "async", "def", "async_unload_entry", "(", "hass", ":", "HomeAssistant", ",", "entry", ":", "ConfigEntry", ")", "->", "bool", ":", "# Unload entities for this entry/device.", "await", "hass", ".", "config_entries", ".", "async_forward_entry_unload", "(", "entry", ",",...
[ 94, 0 ]
[ 104, 15 ]
python
en
['da', 'en', 'en']
True
test_invalid_path_setup
(hass)
Test that an invalid path is not set up.
Test that an invalid path is not set up.
async def test_invalid_path_setup(hass): """Test that an invalid path is not set up.""" assert not await async_setup_component( hass, folder_watcher.DOMAIN, {folder_watcher.DOMAIN: {folder_watcher.CONF_FOLDER: "invalid_path"}}, )
[ "async", "def", "test_invalid_path_setup", "(", "hass", ")", ":", "assert", "not", "await", "async_setup_component", "(", "hass", ",", "folder_watcher", ".", "DOMAIN", ",", "{", "folder_watcher", ".", "DOMAIN", ":", "{", "folder_watcher", ".", "CONF_FOLDER", ":"...
[ 9, 0 ]
[ 15, 5 ]
python
en
['en', 'en', 'en']
True
test_valid_path_setup
(hass)
Test that a valid path is setup.
Test that a valid path is setup.
async def test_valid_path_setup(hass): """Test that a valid path is setup.""" cwd = os.path.join(os.path.dirname(__file__)) hass.config.allowlist_external_dirs = {cwd} with patch.object(folder_watcher, "Watcher"): assert await async_setup_component( hass, folder_watcher.D...
[ "async", "def", "test_valid_path_setup", "(", "hass", ")", ":", "cwd", "=", "os", ".", "path", ".", "join", "(", "os", ".", "path", ".", "dirname", "(", "__file__", ")", ")", "hass", ".", "config", ".", "allowlist_external_dirs", "=", "{", "cwd", "}", ...
[ 18, 0 ]
[ 27, 9 ]
python
en
['en', 'en', 'en']
True
test_event
()
Check that Home Assistant events are fired correctly on watchdog event.
Check that Home Assistant events are fired correctly on watchdog event.
def test_event(): """Check that Home Assistant events are fired correctly on watchdog event.""" class MockPatternMatchingEventHandler: """Mock base class for the pattern matcher event handler.""" def __init__(self, patterns): pass with patch( "homeassistant.components....
[ "def", "test_event", "(", ")", ":", "class", "MockPatternMatchingEventHandler", ":", "\"\"\"Mock base class for the pattern matcher event handler.\"\"\"", "def", "__init__", "(", "self", ",", "patterns", ")", ":", "pass", "with", "patch", "(", "\"homeassistant.components.fo...
[ 30, 0 ]
[ 55, 9 ]
python
en
['en', 'en', 'en']
True
turn_on
(hass, entity_id=ENTITY_MATCH_ALL)
Turn all or specified switch on.
Turn all or specified switch on.
def turn_on(hass, entity_id=ENTITY_MATCH_ALL): """Turn all or specified switch on.""" hass.add_job(async_turn_on, hass, entity_id)
[ "def", "turn_on", "(", "hass", ",", "entity_id", "=", "ENTITY_MATCH_ALL", ")", ":", "hass", ".", "add_job", "(", "async_turn_on", ",", "hass", ",", "entity_id", ")" ]
[ 16, 0 ]
[ 18, 48 ]
python
en
['en', 'en', 'en']
True
async_turn_on
(hass, entity_id=ENTITY_MATCH_ALL)
Turn all or specified switch on.
Turn all or specified switch on.
async def async_turn_on(hass, entity_id=ENTITY_MATCH_ALL): """Turn all or specified switch on.""" data = {ATTR_ENTITY_ID: entity_id} if entity_id else None await hass.services.async_call(DOMAIN, SERVICE_TURN_ON, data, blocking=True)
[ "async", "def", "async_turn_on", "(", "hass", ",", "entity_id", "=", "ENTITY_MATCH_ALL", ")", ":", "data", "=", "{", "ATTR_ENTITY_ID", ":", "entity_id", "}", "if", "entity_id", "else", "None", "await", "hass", ".", "services", ".", "async_call", "(", "DOMAIN...
[ 21, 0 ]
[ 24, 80 ]
python
en
['en', 'en', 'en']
True
turn_off
(hass, entity_id=ENTITY_MATCH_ALL)
Turn all or specified switch off.
Turn all or specified switch off.
def turn_off(hass, entity_id=ENTITY_MATCH_ALL): """Turn all or specified switch off.""" hass.add_job(async_turn_off, hass, entity_id)
[ "def", "turn_off", "(", "hass", ",", "entity_id", "=", "ENTITY_MATCH_ALL", ")", ":", "hass", ".", "add_job", "(", "async_turn_off", ",", "hass", ",", "entity_id", ")" ]
[ 28, 0 ]
[ 30, 49 ]
python
en
['en', 'en', 'en']
True
async_turn_off
(hass, entity_id=ENTITY_MATCH_ALL)
Turn all or specified switch off.
Turn all or specified switch off.
async def async_turn_off(hass, entity_id=ENTITY_MATCH_ALL): """Turn all or specified switch off.""" data = {ATTR_ENTITY_ID: entity_id} if entity_id else None await hass.services.async_call(DOMAIN, SERVICE_TURN_OFF, data, blocking=True)
[ "async", "def", "async_turn_off", "(", "hass", ",", "entity_id", "=", "ENTITY_MATCH_ALL", ")", ":", "data", "=", "{", "ATTR_ENTITY_ID", ":", "entity_id", "}", "if", "entity_id", "else", "None", "await", "hass", ".", "services", ".", "async_call", "(", "DOMAI...
[ 33, 0 ]
[ 36, 81 ]
python
en
['en', 'en', 'en']
True
mock_test_component
(hass)
Ensure a component called 'test' exists.
Ensure a component called 'test' exists.
def mock_test_component(hass): """Ensure a component called 'test' exists.""" mock_integration(hass, MockModule("test"))
[ "def", "mock_test_component", "(", "hass", ")", ":", "mock_integration", "(", "hass", ",", "MockModule", "(", "\"test\"", ")", ")" ]
[ 24, 0 ]
[ 26, 46 ]
python
en
['en', 'en', 'en']
True
client
(hass, hass_client)
Fixture that can interact with the config manager API.
Fixture that can interact with the config manager API.
def client(hass, hass_client): """Fixture that can interact with the config manager API.""" hass.loop.run_until_complete(async_setup_component(hass, "http", {})) hass.loop.run_until_complete(config_entries.async_setup(hass)) yield hass.loop.run_until_complete(hass_client())
[ "def", "client", "(", "hass", ",", "hass_client", ")", ":", "hass", ".", "loop", ".", "run_until_complete", "(", "async_setup_component", "(", "hass", ",", "\"http\"", ",", "{", "}", ")", ")", "hass", ".", "loop", ".", "run_until_complete", "(", "config_en...
[ 30, 0 ]
[ 34, 53 ]
python
en
['en', 'en', 'en']
True
test_get_entries
(hass, client)
Test get entries.
Test get entries.
async def test_get_entries(hass, client): """Test get entries.""" with patch.dict(HANDLERS, clear=True): @HANDLERS.register("comp1") class Comp1ConfigFlow: """Config flow with options flow.""" @staticmethod @callback def async_get_options_flow(co...
[ "async", "def", "test_get_entries", "(", "hass", ",", "client", ")", ":", "with", "patch", ".", "dict", "(", "HANDLERS", ",", "clear", "=", "True", ")", ":", "@", "HANDLERS", ".", "register", "(", "\"comp1\"", ")", "class", "Comp1ConfigFlow", ":", "\"\"\...
[ 37, 0 ]
[ 95, 9 ]
python
de
['nl', 'de', 'en']
False
test_remove_entry
(hass, client)
Test removing an entry via the API.
Test removing an entry via the API.
async def test_remove_entry(hass, client): """Test removing an entry via the API.""" entry = MockConfigEntry(domain="demo", state=core_ce.ENTRY_STATE_LOADED) entry.add_to_hass(hass) resp = await client.delete(f"/api/config/config_entries/entry/{entry.entry_id}") assert resp.status == 200 data = ...
[ "async", "def", "test_remove_entry", "(", "hass", ",", "client", ")", ":", "entry", "=", "MockConfigEntry", "(", "domain", "=", "\"demo\"", ",", "state", "=", "core_ce", ".", "ENTRY_STATE_LOADED", ")", "entry", ".", "add_to_hass", "(", "hass", ")", "resp", ...
[ 98, 0 ]
[ 106, 56 ]
python
en
['en', 'pt', 'en']
True
test_reload_entry
(hass, client)
Test reloading an entry via the API.
Test reloading an entry via the API.
async def test_reload_entry(hass, client): """Test reloading an entry via the API.""" entry = MockConfigEntry(domain="demo", state=core_ce.ENTRY_STATE_LOADED) entry.add_to_hass(hass) resp = await client.post( f"/api/config/config_entries/entry/{entry.entry_id}/reload" ) assert resp.statu...
[ "async", "def", "test_reload_entry", "(", "hass", ",", "client", ")", ":", "entry", "=", "MockConfigEntry", "(", "domain", "=", "\"demo\"", ",", "state", "=", "core_ce", ".", "ENTRY_STATE_LOADED", ")", "entry", ".", "add_to_hass", "(", "hass", ")", "resp", ...
[ 109, 0 ]
[ 119, 56 ]
python
en
['en', 'no', 'en']
True
test_reload_invalid_entry
(hass, client)
Test reloading an invalid entry via the API.
Test reloading an invalid entry via the API.
async def test_reload_invalid_entry(hass, client): """Test reloading an invalid entry via the API.""" resp = await client.post("/api/config/config_entries/entry/invalid/reload") assert resp.status == 404
[ "async", "def", "test_reload_invalid_entry", "(", "hass", ",", "client", ")", ":", "resp", "=", "await", "client", ".", "post", "(", "\"/api/config/config_entries/entry/invalid/reload\"", ")", "assert", "resp", ".", "status", "==", "404" ]
[ 122, 0 ]
[ 125, 29 ]
python
en
['en', 'en', 'en']
True
test_remove_entry_unauth
(hass, client, hass_admin_user)
Test removing an entry via the API.
Test removing an entry via the API.
async def test_remove_entry_unauth(hass, client, hass_admin_user): """Test removing an entry via the API.""" hass_admin_user.groups = [] entry = MockConfigEntry(domain="demo", state=core_ce.ENTRY_STATE_LOADED) entry.add_to_hass(hass) resp = await client.delete(f"/api/config/config_entries/entry/{ent...
[ "async", "def", "test_remove_entry_unauth", "(", "hass", ",", "client", ",", "hass_admin_user", ")", ":", "hass_admin_user", ".", "groups", "=", "[", "]", "entry", "=", "MockConfigEntry", "(", "domain", "=", "\"demo\"", ",", "state", "=", "core_ce", ".", "EN...
[ 128, 0 ]
[ 135, 56 ]
python
en
['en', 'pt', 'en']
True
test_reload_entry_unauth
(hass, client, hass_admin_user)
Test reloading an entry via the API.
Test reloading an entry via the API.
async def test_reload_entry_unauth(hass, client, hass_admin_user): """Test reloading an entry via the API.""" hass_admin_user.groups = [] entry = MockConfigEntry(domain="demo", state=core_ce.ENTRY_STATE_LOADED) entry.add_to_hass(hass) resp = await client.post( f"/api/config/config_entries/en...
[ "async", "def", "test_reload_entry_unauth", "(", "hass", ",", "client", ",", "hass_admin_user", ")", ":", "hass_admin_user", ".", "groups", "=", "[", "]", "entry", "=", "MockConfigEntry", "(", "domain", "=", "\"demo\"", ",", "state", "=", "core_ce", ".", "EN...
[ 138, 0 ]
[ 147, 56 ]
python
en
['en', 'no', 'en']
True
test_reload_entry_in_failed_state
(hass, client, hass_admin_user)
Test reloading an entry via the API that has already failed to unload.
Test reloading an entry via the API that has already failed to unload.
async def test_reload_entry_in_failed_state(hass, client, hass_admin_user): """Test reloading an entry via the API that has already failed to unload.""" entry = MockConfigEntry(domain="demo", state=core_ce.ENTRY_STATE_FAILED_UNLOAD) entry.add_to_hass(hass) resp = await client.post( f"/api/config...
[ "async", "def", "test_reload_entry_in_failed_state", "(", "hass", ",", "client", ",", "hass_admin_user", ")", ":", "entry", "=", "MockConfigEntry", "(", "domain", "=", "\"demo\"", ",", "state", "=", "core_ce", ".", "ENTRY_STATE_FAILED_UNLOAD", ")", "entry", ".", ...
[ 150, 0 ]
[ 158, 56 ]
python
en
['en', 'en', 'en']
True
test_available_flows
(hass, client)
Test querying the available flows.
Test querying the available flows.
async def test_available_flows(hass, client): """Test querying the available flows.""" with patch.object(config_flows, "FLOWS", ["hello", "world"]): resp = await client.get("/api/config/config_entries/flow_handlers") assert resp.status == 200 data = await resp.json() assert set(d...
[ "async", "def", "test_available_flows", "(", "hass", ",", "client", ")", ":", "with", "patch", ".", "object", "(", "config_flows", ",", "\"FLOWS\"", ",", "[", "\"hello\"", ",", "\"world\"", "]", ")", ":", "resp", "=", "await", "client", ".", "get", "(", ...
[ 161, 0 ]
[ 167, 46 ]
python
en
['en', 'en', 'en']
True
test_initialize_flow
(hass, client)
Test we can initialize a flow.
Test we can initialize a flow.
async def test_initialize_flow(hass, client): """Test we can initialize a flow.""" mock_entity_platform(hass, "config_flow.test", None) class TestFlow(core_ce.ConfigFlow): async def async_step_user(self, user_input=None): schema = OrderedDict() schema[vol.Required("username"...
[ "async", "def", "test_initialize_flow", "(", "hass", ",", "client", ")", ":", "mock_entity_platform", "(", "hass", ",", "\"config_flow.test\"", ",", "None", ")", "class", "TestFlow", "(", "core_ce", ".", "ConfigFlow", ")", ":", "async", "def", "async_step_user",...
[ 175, 0 ]
[ 219, 5 ]
python
en
['en', 'en', 'en']
True
test_initialize_flow_unauth
(hass, client, hass_admin_user)
Test we can initialize a flow.
Test we can initialize a flow.
async def test_initialize_flow_unauth(hass, client, hass_admin_user): """Test we can initialize a flow.""" hass_admin_user.groups = [] class TestFlow(core_ce.ConfigFlow): async def async_step_user(self, user_input=None): schema = OrderedDict() schema[vol.Required("username")...
[ "async", "def", "test_initialize_flow_unauth", "(", "hass", ",", "client", ",", "hass_admin_user", ")", ":", "hass_admin_user", ".", "groups", "=", "[", "]", "class", "TestFlow", "(", "core_ce", ".", "ConfigFlow", ")", ":", "async", "def", "async_step_user", "...
[ 222, 0 ]
[ 244, 29 ]
python
en
['en', 'en', 'en']
True
test_abort
(hass, client)
Test a flow that aborts.
Test a flow that aborts.
async def test_abort(hass, client): """Test a flow that aborts.""" mock_entity_platform(hass, "config_flow.test", None) class TestFlow(core_ce.ConfigFlow): async def async_step_user(self, user_input=None): return self.async_abort(reason="bla") with patch.dict(HANDLERS, {"test": Tes...
[ "async", "def", "test_abort", "(", "hass", ",", "client", ")", ":", "mock_entity_platform", "(", "hass", ",", "\"config_flow.test\"", ",", "None", ")", "class", "TestFlow", "(", "core_ce", ".", "ConfigFlow", ")", ":", "async", "def", "async_step_user", "(", ...
[ 247, 0 ]
[ 268, 5 ]
python
en
['en', 'en', 'en']
True
test_create_account
(hass, client)
Test a flow that creates an account.
Test a flow that creates an account.
async def test_create_account(hass, client): """Test a flow that creates an account.""" mock_entity_platform(hass, "config_flow.test", None) mock_integration( hass, MockModule("test", async_setup_entry=AsyncMock(return_value=True)) ) class TestFlow(core_ce.ConfigFlow): VERSION = 1 ...
[ "async", "def", "test_create_account", "(", "hass", ",", "client", ")", ":", "mock_entity_platform", "(", "hass", ",", "\"config_flow.test\"", ",", "None", ")", "mock_integration", "(", "hass", ",", "MockModule", "(", "\"test\"", ",", "async_setup_entry", "=", "...
[ 271, 0 ]
[ 307, 5 ]
python
en
['en', 'gd', 'en']
True
test_two_step_flow
(hass, client)
Test we can finish a two step flow.
Test we can finish a two step flow.
async def test_two_step_flow(hass, client): """Test we can finish a two step flow.""" mock_integration( hass, MockModule("test", async_setup_entry=AsyncMock(return_value=True)) ) mock_entity_platform(hass, "config_flow.test", None) class TestFlow(core_ce.ConfigFlow): VERSION = 1 ...
[ "async", "def", "test_two_step_flow", "(", "hass", ",", "client", ")", ":", "mock_integration", "(", "hass", ",", "MockModule", "(", "\"test\"", ",", "async_setup_entry", "=", "AsyncMock", "(", "return_value", "=", "True", ")", ")", ")", "mock_entity_platform", ...
[ 310, 0 ]
[ 366, 9 ]
python
en
['en', 'en', 'en']
True
test_continue_flow_unauth
(hass, client, hass_admin_user)
Test we can't finish a two step flow.
Test we can't finish a two step flow.
async def test_continue_flow_unauth(hass, client, hass_admin_user): """Test we can't finish a two step flow.""" mock_integration( hass, MockModule("test", async_setup_entry=AsyncMock(return_value=True)) ) mock_entity_platform(hass, "config_flow.test", None) class TestFlow(core_ce.ConfigFlow...
[ "async", "def", "test_continue_flow_unauth", "(", "hass", ",", "client", ",", "hass_admin_user", ")", ":", "mock_integration", "(", "hass", ",", "MockModule", "(", "\"test\"", ",", "async_setup_entry", "=", "AsyncMock", "(", "return_value", "=", "True", ")", ")"...
[ 369, 0 ]
[ 411, 29 ]
python
en
['en', 'en', 'en']
True
test_get_progress_index
(hass, hass_ws_client)
Test querying for the flows that are in progress.
Test querying for the flows that are in progress.
async def test_get_progress_index(hass, hass_ws_client): """Test querying for the flows that are in progress.""" assert await async_setup_component(hass, "config", {}) mock_entity_platform(hass, "config_flow.test", None) ws_client = await hass_ws_client(hass) class TestFlow(core_ce.ConfigFlow): ...
[ "async", "def", "test_get_progress_index", "(", "hass", ",", "hass_ws_client", ")", ":", "assert", "await", "async_setup_component", "(", "hass", ",", "\"config\"", ",", "{", "}", ")", "mock_entity_platform", "(", "hass", ",", "\"config_flow.test\"", ",", "None", ...
[ 414, 0 ]
[ 445, 5 ]
python
en
['en', 'en', 'en']
True
test_get_progress_index_unauth
(hass, hass_ws_client, hass_admin_user)
Test we can't get flows that are in progress.
Test we can't get flows that are in progress.
async def test_get_progress_index_unauth(hass, hass_ws_client, hass_admin_user): """Test we can't get flows that are in progress.""" assert await async_setup_component(hass, "config", {}) hass_admin_user.groups = [] ws_client = await hass_ws_client(hass) await ws_client.send_json({"id": 5, "type": ...
[ "async", "def", "test_get_progress_index_unauth", "(", "hass", ",", "hass_ws_client", ",", "hass_admin_user", ")", ":", "assert", "await", "async_setup_component", "(", "hass", ",", "\"config\"", ",", "{", "}", ")", "hass_admin_user", ".", "groups", "=", "[", "]...
[ 448, 0 ]
[ 458, 54 ]
python
en
['en', 'en', 'en']
True
test_get_progress_flow
(hass, client)
Test we can query the API for same result as we get from init a flow.
Test we can query the API for same result as we get from init a flow.
async def test_get_progress_flow(hass, client): """Test we can query the API for same result as we get from init a flow.""" mock_entity_platform(hass, "config_flow.test", None) class TestFlow(core_ce.ConfigFlow): async def async_step_user(self, user_input=None): schema = OrderedDict() ...
[ "async", "def", "test_get_progress_flow", "(", "hass", ",", "client", ")", ":", "mock_entity_platform", "(", "hass", ",", "\"config_flow.test\"", ",", "None", ")", "class", "TestFlow", "(", "core_ce", ".", "ConfigFlow", ")", ":", "async", "def", "async_step_user...
[ 461, 0 ]
[ 492, 24 ]
python
en
['en', 'en', 'en']
True
test_get_progress_flow_unauth
(hass, client, hass_admin_user)
Test we can can't query the API for result of flow.
Test we can can't query the API for result of flow.
async def test_get_progress_flow_unauth(hass, client, hass_admin_user): """Test we can can't query the API for result of flow.""" mock_entity_platform(hass, "config_flow.test", None) class TestFlow(core_ce.ConfigFlow): async def async_step_user(self, user_input=None): schema = OrderedDi...
[ "async", "def", "test_get_progress_flow_unauth", "(", "hass", ",", "client", ",", "hass_admin_user", ")", ":", "mock_entity_platform", "(", "hass", ",", "\"config_flow.test\"", ",", "None", ")", "class", "TestFlow", "(", "core_ce", ".", "ConfigFlow", ")", ":", "...
[ 495, 0 ]
[ 525, 30 ]
python
en
['en', 'en', 'en']
True
test_options_flow
(hass, client)
Test we can change options.
Test we can change options.
async def test_options_flow(hass, client): """Test we can change options.""" class TestFlow(core_ce.ConfigFlow): @staticmethod @callback def async_get_options_flow(config_entry): class OptionsFlowHandler(data_entry_flow.FlowHandler): async def async_step_init...
[ "async", "def", "test_options_flow", "(", "hass", ",", "client", ")", ":", "class", "TestFlow", "(", "core_ce", ".", "ConfigFlow", ")", ":", "@", "staticmethod", "@", "callback", "def", "async_get_options_flow", "(", "config_entry", ")", ":", "class", "Options...
[ 528, 0 ]
[ 570, 5 ]
python
en
['en', 'en', 'en']
True
test_two_step_options_flow
(hass, client)
Test we can finish a two step options flow.
Test we can finish a two step options flow.
async def test_two_step_options_flow(hass, client): """Test we can finish a two step options flow.""" mock_integration( hass, MockModule("test", async_setup_entry=AsyncMock(return_value=True)) ) class TestFlow(core_ce.ConfigFlow): @staticmethod @callback def async_get_op...
[ "async", "def", "test_two_step_options_flow", "(", "hass", ",", "client", ")", ":", "mock_integration", "(", "hass", ",", "MockModule", "(", "\"test\"", ",", "async_setup_entry", "=", "AsyncMock", "(", "return_value", "=", "True", ")", ")", ")", "class", "Test...
[ 573, 0 ]
[ 635, 9 ]
python
en
['en', 'en', 'en']
True
test_list_system_options
(hass, hass_ws_client)
Test that we can list an entries system options.
Test that we can list an entries system options.
async def test_list_system_options(hass, hass_ws_client): """Test that we can list an entries system options.""" assert await async_setup_component(hass, "config", {}) ws_client = await hass_ws_client(hass) entry = MockConfigEntry(domain="demo") entry.add_to_hass(hass) await ws_client.send_jso...
[ "async", "def", "test_list_system_options", "(", "hass", ",", "hass_ws_client", ")", ":", "assert", "await", "async_setup_component", "(", "hass", ",", "\"config\"", ",", "{", "}", ")", "ws_client", "=", "await", "hass_ws_client", "(", "hass", ")", "entry", "=...
[ 638, 0 ]
[ 656, 64 ]
python
en
['en', 'en', 'en']
True
test_update_system_options
(hass, hass_ws_client)
Test that we can update system options.
Test that we can update system options.
async def test_update_system_options(hass, hass_ws_client): """Test that we can update system options.""" assert await async_setup_component(hass, "config", {}) ws_client = await hass_ws_client(hass) entry = MockConfigEntry(domain="demo") entry.add_to_hass(hass) await ws_client.send_json( ...
[ "async", "def", "test_update_system_options", "(", "hass", ",", "hass_ws_client", ")", ":", "assert", "await", "async_setup_component", "(", "hass", ",", "\"config\"", ",", "{", "}", ")", "ws_client", "=", "await", "hass_ws_client", "(", "hass", ")", "entry", ...
[ 659, 0 ]
[ 679, 52 ]
python
en
['en', 'en', 'en']
True
test_update_entry
(hass, hass_ws_client)
Test that we can update entry.
Test that we can update entry.
async def test_update_entry(hass, hass_ws_client): """Test that we can update entry.""" assert await async_setup_component(hass, "config", {}) ws_client = await hass_ws_client(hass) entry = MockConfigEntry(domain="demo", title="Initial Title") entry.add_to_hass(hass) await ws_client.send_json(...
[ "async", "def", "test_update_entry", "(", "hass", ",", "hass_ws_client", ")", ":", "assert", "await", "async_setup_component", "(", "hass", ",", "\"config\"", ",", "{", "}", ")", "ws_client", "=", "await", "hass_ws_client", "(", "hass", ")", "entry", "=", "M...
[ 682, 0 ]
[ 702, 41 ]
python
en
['en', 'en', 'en']
True
test_update_entry_nonexisting
(hass, hass_ws_client)
Test that we can update entry.
Test that we can update entry.
async def test_update_entry_nonexisting(hass, hass_ws_client): """Test that we can update entry.""" assert await async_setup_component(hass, "config", {}) ws_client = await hass_ws_client(hass) await ws_client.send_json( { "id": 5, "type": "config_entries/update", ...
[ "async", "def", "test_update_entry_nonexisting", "(", "hass", ",", "hass_ws_client", ")", ":", "assert", "await", "async_setup_component", "(", "hass", ",", "\"config\"", ",", "{", "}", ")", "ws_client", "=", "await", "hass_ws_client", "(", "hass", ")", "await",...
[ 705, 0 ]
[ 721, 51 ]
python
en
['en', 'en', 'en']
True
test_ignore_flow
(hass, hass_ws_client)
Test we can ignore a flow.
Test we can ignore a flow.
async def test_ignore_flow(hass, hass_ws_client): """Test we can ignore a flow.""" assert await async_setup_component(hass, "config", {}) mock_integration( hass, MockModule("test", async_setup_entry=AsyncMock(return_value=True)) ) mock_entity_platform(hass, "config_flow.test", None) cla...
[ "async", "def", "test_ignore_flow", "(", "hass", ",", "hass_ws_client", ")", ":", "assert", "await", "async_setup_component", "(", "hass", ",", "\"config\"", ",", "{", "}", ")", "mock_integration", "(", "hass", ",", "MockModule", "(", "\"test\"", ",", "async_s...
[ 724, 0 ]
[ 762, 46 ]
python
en
['en', 'en', 'en']
True
FilesystemTables.create
(self: "FilesystemTables", schema: Schema, table_identifier: str, spec: PartitionSpec = None, properties: dict = None, location: str = None)
Create a new table on the filesystem. Note: it is expected that the filesystem has atomic operations to ensure consistency for metadata updates. Filesystems that don't have this guarantee could lead to data loss. Location should always be None as the table location on disk is taken fr...
Create a new table on the filesystem.
def create(self: "FilesystemTables", schema: Schema, table_identifier: str, spec: PartitionSpec = None, properties: dict = None, location: str = None) -> Table: """ Create a new table on the filesystem. Note: it is expected that the filesystem has atomic operations to ensure cons...
[ "def", "create", "(", "self", ":", "\"FilesystemTables\"", ",", "schema", ":", "Schema", ",", "table_identifier", ":", "str", ",", "spec", ":", "PartitionSpec", "=", "None", ",", "properties", ":", "dict", "=", "None", ",", "location", ":", "str", "=", "...
[ 37, 4 ]
[ 58, 47 ]
python
en
['en', 'error', 'th']
False
async_setup
(hass, config)
Track states and offer events for sensors.
Track states and offer events for sensors.
async def async_setup(hass, config): """Track states and offer events for sensors.""" component = hass.data[DOMAIN] = EntityComponent( logging.getLogger(__name__), DOMAIN, hass, SCAN_INTERVAL ) await component.async_setup(config) component.async_register_entity_service( SERVICE_ALA...
[ "async", "def", "async_setup", "(", "hass", ",", "config", ")", ":", "component", "=", "hass", ".", "data", "[", "DOMAIN", "]", "=", "EntityComponent", "(", "logging", ".", "getLogger", "(", "__name__", ")", ",", "DOMAIN", ",", "hass", ",", "SCAN_INTERVA...
[ 48, 0 ]
[ 90, 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", ")" ]
[ 93, 0 ]
[ 95, 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", ")" ]
[ 98, 0 ]
[ 100, 60 ]
python
en
['en', 'es', 'en']
True
AlarmControlPanelEntity.code_format
(self)
Regex for code format or None if no code is required.
Regex for code format or None if no code is required.
def code_format(self): """Regex for code format or None if no code is required.""" return None
[ "def", "code_format", "(", "self", ")", ":", "return", "None" ]
[ 107, 4 ]
[ 109, 19 ]
python
en
['en', 'en', 'en']
True
AlarmControlPanelEntity.changed_by
(self)
Last change triggered by.
Last change triggered by.
def changed_by(self): """Last change triggered by.""" return None
[ "def", "changed_by", "(", "self", ")", ":", "return", "None" ]
[ 112, 4 ]
[ 114, 19 ]
python
en
['en', 'en', 'en']
True
AlarmControlPanelEntity.code_arm_required
(self)
Whether the code is required for arm actions.
Whether the code is required for arm actions.
def code_arm_required(self): """Whether the code is required for arm actions.""" return True
[ "def", "code_arm_required", "(", "self", ")", ":", "return", "True" ]
[ 117, 4 ]
[ 119, 19 ]
python
en
['en', 'en', 'en']
True
AlarmControlPanelEntity.alarm_disarm
(self, code=None)
Send disarm command.
Send disarm command.
def alarm_disarm(self, code=None): """Send disarm command.""" raise NotImplementedError()
[ "def", "alarm_disarm", "(", "self", ",", "code", "=", "None", ")", ":", "raise", "NotImplementedError", "(", ")" ]
[ 121, 4 ]
[ 123, 35 ]
python
en
['en', 'pt', 'en']
True
AlarmControlPanelEntity.async_alarm_disarm
(self, code=None)
Send disarm command.
Send disarm command.
async def async_alarm_disarm(self, code=None): """Send disarm command.""" await self.hass.async_add_executor_job(self.alarm_disarm, code)
[ "async", "def", "async_alarm_disarm", "(", "self", ",", "code", "=", "None", ")", ":", "await", "self", ".", "hass", ".", "async_add_executor_job", "(", "self", ".", "alarm_disarm", ",", "code", ")" ]
[ 125, 4 ]
[ 127, 71 ]
python
en
['en', 'pt', 'en']
True
AlarmControlPanelEntity.alarm_arm_home
(self, code=None)
Send arm home command.
Send arm home command.
def alarm_arm_home(self, code=None): """Send arm home command.""" raise NotImplementedError()
[ "def", "alarm_arm_home", "(", "self", ",", "code", "=", "None", ")", ":", "raise", "NotImplementedError", "(", ")" ]
[ 129, 4 ]
[ 131, 35 ]
python
en
['en', 'pt', 'en']
True
AlarmControlPanelEntity.async_alarm_arm_home
(self, code=None)
Send arm home command.
Send arm home command.
async def async_alarm_arm_home(self, code=None): """Send arm home command.""" await self.hass.async_add_executor_job(self.alarm_arm_home, code)
[ "async", "def", "async_alarm_arm_home", "(", "self", ",", "code", "=", "None", ")", ":", "await", "self", ".", "hass", ".", "async_add_executor_job", "(", "self", ".", "alarm_arm_home", ",", "code", ")" ]
[ 133, 4 ]
[ 135, 73 ]
python
en
['en', 'pt', 'en']
True
AlarmControlPanelEntity.alarm_arm_away
(self, code=None)
Send arm away command.
Send arm away command.
def alarm_arm_away(self, code=None): """Send arm away command.""" raise NotImplementedError()
[ "def", "alarm_arm_away", "(", "self", ",", "code", "=", "None", ")", ":", "raise", "NotImplementedError", "(", ")" ]
[ 137, 4 ]
[ 139, 35 ]
python
en
['en', 'en', 'en']
True
AlarmControlPanelEntity.async_alarm_arm_away
(self, code=None)
Send arm away command.
Send arm away command.
async def async_alarm_arm_away(self, code=None): """Send arm away command.""" await self.hass.async_add_executor_job(self.alarm_arm_away, code)
[ "async", "def", "async_alarm_arm_away", "(", "self", ",", "code", "=", "None", ")", ":", "await", "self", ".", "hass", ".", "async_add_executor_job", "(", "self", ".", "alarm_arm_away", ",", "code", ")" ]
[ 141, 4 ]
[ 143, 73 ]
python
en
['en', 'en', 'en']
True
AlarmControlPanelEntity.alarm_arm_night
(self, code=None)
Send arm night command.
Send arm night command.
def alarm_arm_night(self, code=None): """Send arm night command.""" raise NotImplementedError()
[ "def", "alarm_arm_night", "(", "self", ",", "code", "=", "None", ")", ":", "raise", "NotImplementedError", "(", ")" ]
[ 145, 4 ]
[ 147, 35 ]
python
en
['en', 'zh', 'en']
True
AlarmControlPanelEntity.async_alarm_arm_night
(self, code=None)
Send arm night command.
Send arm night command.
async def async_alarm_arm_night(self, code=None): """Send arm night command.""" await self.hass.async_add_executor_job(self.alarm_arm_night, code)
[ "async", "def", "async_alarm_arm_night", "(", "self", ",", "code", "=", "None", ")", ":", "await", "self", ".", "hass", ".", "async_add_executor_job", "(", "self", ".", "alarm_arm_night", ",", "code", ")" ]
[ 149, 4 ]
[ 151, 74 ]
python
en
['en', 'zh', 'en']
True
AlarmControlPanelEntity.alarm_trigger
(self, code=None)
Send alarm trigger command.
Send alarm trigger command.
def alarm_trigger(self, code=None): """Send alarm trigger command.""" raise NotImplementedError()
[ "def", "alarm_trigger", "(", "self", ",", "code", "=", "None", ")", ":", "raise", "NotImplementedError", "(", ")" ]
[ 153, 4 ]
[ 155, 35 ]
python
en
['en', 'ca', 'en']
True
AlarmControlPanelEntity.async_alarm_trigger
(self, code=None)
Send alarm trigger command.
Send alarm trigger command.
async def async_alarm_trigger(self, code=None): """Send alarm trigger command.""" await self.hass.async_add_executor_job(self.alarm_trigger, code)
[ "async", "def", "async_alarm_trigger", "(", "self", ",", "code", "=", "None", ")", ":", "await", "self", ".", "hass", ".", "async_add_executor_job", "(", "self", ".", "alarm_trigger", ",", "code", ")" ]
[ 157, 4 ]
[ 159, 72 ]
python
en
['en', 'ca', 'en']
True
AlarmControlPanelEntity.alarm_arm_custom_bypass
(self, code=None)
Send arm custom bypass command.
Send arm custom bypass command.
def alarm_arm_custom_bypass(self, code=None): """Send arm custom bypass command.""" raise NotImplementedError()
[ "def", "alarm_arm_custom_bypass", "(", "self", ",", "code", "=", "None", ")", ":", "raise", "NotImplementedError", "(", ")" ]
[ 161, 4 ]
[ 163, 35 ]
python
en
['en', 'ga', 'en']
True
AlarmControlPanelEntity.async_alarm_arm_custom_bypass
(self, code=None)
Send arm custom bypass command.
Send arm custom bypass command.
async def async_alarm_arm_custom_bypass(self, code=None): """Send arm custom bypass command.""" await self.hass.async_add_executor_job(self.alarm_arm_custom_bypass, code)
[ "async", "def", "async_alarm_arm_custom_bypass", "(", "self", ",", "code", "=", "None", ")", ":", "await", "self", ".", "hass", ".", "async_add_executor_job", "(", "self", ".", "alarm_arm_custom_bypass", ",", "code", ")" ]
[ 165, 4 ]
[ 167, 82 ]
python
en
['en', 'ga', 'en']
True
AlarmControlPanelEntity.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."""
[ "def", "supported_features", "(", "self", ")", "->", "int", ":" ]
[ 171, 4 ]
[ 172, 52 ]
python
en
['en', 'en', 'en']
True
AlarmControlPanelEntity.state_attributes
(self)
Return the state attributes.
Return the state attributes.
def state_attributes(self): """Return the state attributes.""" return { ATTR_CODE_FORMAT: self.code_format, ATTR_CHANGED_BY: self.changed_by, ATTR_CODE_ARM_REQUIRED: self.code_arm_required, }
[ "def", "state_attributes", "(", "self", ")", ":", "return", "{", "ATTR_CODE_FORMAT", ":", "self", ".", "code_format", ",", "ATTR_CHANGED_BY", ":", "self", ".", "changed_by", ",", "ATTR_CODE_ARM_REQUIRED", ":", "self", ".", "code_arm_required", ",", "}" ]
[ 175, 4 ]
[ 181, 9 ]
python
en
['en', 'en', 'en']
True
AlarmControlPanel.__init_subclass__
(cls, **kwargs)
Print deprecation warning.
Print deprecation warning.
def __init_subclass__(cls, **kwargs): """Print deprecation warning.""" super().__init_subclass__(**kwargs) _LOGGER.warning( "AlarmControlPanel is deprecated, modify %s to extend AlarmControlPanelEntity", cls.__name__, )
[ "def", "__init_subclass__", "(", "cls", ",", "*", "*", "kwargs", ")", ":", "super", "(", ")", ".", "__init_subclass__", "(", "*", "*", "kwargs", ")", "_LOGGER", ".", "warning", "(", "\"AlarmControlPanel is deprecated, modify %s to extend AlarmControlPanelEntity\"", ...
[ 187, 4 ]
[ 193, 9 ]
python
de
['de', 'sv', 'en']
False
async_setup
(hass: HomeAssistant, config: dict)
Set up the Sense component.
Set up the Sense component.
async def async_setup(hass: HomeAssistant, config: dict): """Set up the Sense component.""" hass.data.setdefault(DOMAIN, {}) conf = config.get(DOMAIN) if not conf: return True hass.async_create_task( hass.config_entries.flow.async_init( DOMAIN, context={"sour...
[ "async", "def", "async_setup", "(", "hass", ":", "HomeAssistant", ",", "config", ":", "dict", ")", ":", "hass", ".", "data", ".", "setdefault", "(", "DOMAIN", ",", "{", "}", ")", "conf", "=", "config", ".", "get", "(", "DOMAIN", ")", "if", "not", "...
[ 69, 0 ]
[ 87, 15 ]
python
en
['en', 'fr', 'en']
True
async_setup_entry
(hass: HomeAssistant, entry: ConfigEntry)
Set up Sense from a config entry.
Set up Sense from a config entry.
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry): """Set up Sense from a config entry.""" entry_data = entry.data email = entry_data[CONF_EMAIL] password = entry_data[CONF_PASSWORD] timeout = entry_data[CONF_TIMEOUT] gateway = ASyncSenseable(api_timeout=timeout, wss_timeout...
[ "async", "def", "async_setup_entry", "(", "hass", ":", "HomeAssistant", ",", "entry", ":", "ConfigEntry", ")", ":", "entry_data", "=", "entry", ".", "data", "email", "=", "entry_data", "[", "CONF_EMAIL", "]", "password", "=", "entry_data", "[", "CONF_PASSWORD"...
[ 90, 0 ]
[ 158, 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): """Unload a config entry.""" unload_ok = all( await asyncio.gather( *[ hass.config_entries.async_forward_entry_unload(entry, component) for component in PLATFORMS ] ) ...
[ "async", "def", "async_unload_entry", "(", "hass", ":", "HomeAssistant", ",", "entry", ":", "ConfigEntry", ")", ":", "unload_ok", "=", "all", "(", "await", "asyncio", ".", "gather", "(", "*", "[", "hass", ".", "config_entries", ".", "async_forward_entry_unload...
[ 161, 0 ]
[ 179, 20 ]
python
en
['en', 'es', 'en']
True
SenseDevicesData.set_devices_data
(self, devices)
Store a device update.
Store a device update.
def set_devices_data(self, devices): """Store a device update.""" self._data_by_device = {} for device in devices: self._data_by_device[device["id"]] = device
[ "def", "set_devices_data", "(", "self", ",", "devices", ")", ":", "self", ".", "_data_by_device", "=", "{", "}", "for", "device", "in", "devices", ":", "self", ".", "_data_by_device", "[", "device", "[", "\"id\"", "]", "]", "=", "device" ]
[ 58, 4 ]
[ 62, 55 ]
python
en
['it', 'en', 'en']
True
SenseDevicesData.get_device_by_id
(self, sense_device_id)
Get the latest device data.
Get the latest device data.
def get_device_by_id(self, sense_device_id): """Get the latest device data.""" return self._data_by_device.get(sense_device_id)
[ "def", "get_device_by_id", "(", "self", ",", "sense_device_id", ")", ":", "return", "self", ".", "_data_by_device", ".", "get", "(", "sense_device_id", ")" ]
[ 64, 4 ]
[ 66, 56 ]
python
en
['en', 'en', 'en']
True
setup_platform
(hass, config, add_entities, discovery_info=None)
Set up the Open Hardware Monitor platform.
Set up the Open Hardware Monitor platform.
def setup_platform(hass, config, add_entities, discovery_info=None): """Set up the Open Hardware Monitor platform.""" data = OpenHardwareMonitorData(config, hass) if data.data is None: raise PlatformNotReady add_entities(data.devices, True)
[ "def", "setup_platform", "(", "hass", ",", "config", ",", "add_entities", ",", "discovery_info", "=", "None", ")", ":", "data", "=", "OpenHardwareMonitorData", "(", "config", ",", "hass", ")", "if", "data", ".", "data", "is", "None", ":", "raise", "Platfor...
[ 38, 0 ]
[ 43, 36 ]
python
en
['en', 'zu', 'en']
True
OpenHardwareMonitorDevice.__init__
(self, data, name, path, unit_of_measurement)
Initialize an OpenHardwareMonitor sensor.
Initialize an OpenHardwareMonitor sensor.
def __init__(self, data, name, path, unit_of_measurement): """Initialize an OpenHardwareMonitor sensor.""" self._name = name self._data = data self.path = path self.attributes = {} self._unit_of_measurement = unit_of_measurement self.value = None
[ "def", "__init__", "(", "self", ",", "data", ",", "name", ",", "path", ",", "unit_of_measurement", ")", ":", "self", ".", "_name", "=", "name", "self", ".", "_data", "=", "data", "self", ".", "path", "=", "path", "self", ".", "attributes", "=", "{", ...
[ 49, 4 ]
[ 57, 25 ]
python
en
['en', 'zh-Latn', 'en']
True
OpenHardwareMonitorDevice.name
(self)
Return the name of the device.
Return the name of the device.
def name(self): """Return the name of the device.""" return self._name
[ "def", "name", "(", "self", ")", ":", "return", "self", ".", "_name" ]
[ 60, 4 ]
[ 62, 25 ]
python
en
['en', 'en', 'en']
True
OpenHardwareMonitorDevice.unit_of_measurement
(self)
Return the unit of measurement.
Return the unit of measurement.
def unit_of_measurement(self): """Return the unit of measurement.""" return self._unit_of_measurement
[ "def", "unit_of_measurement", "(", "self", ")", ":", "return", "self", ".", "_unit_of_measurement" ]
[ 65, 4 ]
[ 67, 40 ]
python
en
['en', 'la', 'en']
True
OpenHardwareMonitorDevice.state
(self)
Return the state of the device.
Return the state of the device.
def state(self): """Return the state of the device.""" return self.value
[ "def", "state", "(", "self", ")", ":", "return", "self", ".", "value" ]
[ 70, 4 ]
[ 72, 25 ]
python
en
['en', 'en', 'en']
True
OpenHardwareMonitorDevice.state_attributes
(self)
Return the state attributes of the sun.
Return the state attributes of the sun.
def state_attributes(self): """Return the state attributes of the sun.""" return self.attributes
[ "def", "state_attributes", "(", "self", ")", ":", "return", "self", ".", "attributes" ]
[ 75, 4 ]
[ 77, 30 ]
python
en
['en', 'en', 'en']
True
OpenHardwareMonitorDevice.parse_number
(cls, string)
In some locales a decimal numbers uses ',' instead of '.'.
In some locales a decimal numbers uses ',' instead of '.'.
def parse_number(cls, string): """In some locales a decimal numbers uses ',' instead of '.'.""" return string.replace(",", ".")
[ "def", "parse_number", "(", "cls", ",", "string", ")", ":", "return", "string", ".", "replace", "(", "\",\"", ",", "\".\"", ")" ]
[ 80, 4 ]
[ 82, 39 ]
python
en
['en', 'en', 'en']
True
OpenHardwareMonitorDevice.update
(self)
Update the device from a new JSON object.
Update the device from a new JSON object.
def update(self): """Update the device from a new JSON object.""" self._data.update() array = self._data.data[OHM_CHILDREN] _attributes = {} for path_index in range(0, len(self.path)): path_number = self.path[path_index] values = array[path_number] ...
[ "def", "update", "(", "self", ")", ":", "self", ".", "_data", ".", "update", "(", ")", "array", "=", "self", ".", "_data", ".", "data", "[", "OHM_CHILDREN", "]", "_attributes", "=", "{", "}", "for", "path_index", "in", "range", "(", "0", ",", "len"...
[ 84, 4 ]
[ 112, 75 ]
python
en
['en', 'en', 'en']
True
OpenHardwareMonitorData.__init__
(self, config, hass)
Initialize the Open Hardware Monitor data-handler.
Initialize the Open Hardware Monitor data-handler.
def __init__(self, config, hass): """Initialize the Open Hardware Monitor data-handler.""" self.data = None self._config = config self._hass = hass self.devices = [] self.initialize(utcnow())
[ "def", "__init__", "(", "self", ",", "config", ",", "hass", ")", ":", "self", ".", "data", "=", "None", "self", ".", "_config", "=", "config", "self", ".", "_hass", "=", "hass", "self", ".", "devices", "=", "[", "]", "self", ".", "initialize", "(",...
[ 118, 4 ]
[ 124, 33 ]
python
en
['en', 'en', 'en']
True
OpenHardwareMonitorData.update
(self)
Hit by the timer with the configured interval.
Hit by the timer with the configured interval.
def update(self): """Hit by the timer with the configured interval.""" if self.data is None: self.initialize(utcnow()) else: self.refresh()
[ "def", "update", "(", "self", ")", ":", "if", "self", ".", "data", "is", "None", ":", "self", ".", "initialize", "(", "utcnow", "(", ")", ")", "else", ":", "self", ".", "refresh", "(", ")" ]
[ 127, 4 ]
[ 132, 26 ]
python
en
['en', 'en', 'en']
True
OpenHardwareMonitorData.refresh
(self)
Download and parse JSON from OHM.
Download and parse JSON from OHM.
def refresh(self): """Download and parse JSON from OHM.""" data_url = ( f"http://{self._config.get(CONF_HOST)}:" f"{self._config.get(CONF_PORT)}/data.json" ) try: response = requests.get(data_url, timeout=30) self.data = response.json() ...
[ "def", "refresh", "(", "self", ")", ":", "data_url", "=", "(", "f\"http://{self._config.get(CONF_HOST)}:\"", "f\"{self._config.get(CONF_PORT)}/data.json\"", ")", "try", ":", "response", "=", "requests", ".", "get", "(", "data_url", ",", "timeout", "=", "30", ")", ...
[ 134, 4 ]
[ 145, 77 ]
python
en
['en', 'en', 'en']
True
OpenHardwareMonitorData.initialize
(self, now)
Parse of the sensors and adding of devices.
Parse of the sensors and adding of devices.
def initialize(self, now): """Parse of the sensors and adding of devices.""" self.refresh() if self.data is None: return self.devices = self.parse_children(self.data, [], [], [])
[ "def", "initialize", "(", "self", ",", "now", ")", ":", "self", ".", "refresh", "(", ")", "if", "self", ".", "data", "is", "None", ":", "return", "self", ".", "devices", "=", "self", ".", "parse_children", "(", "self", ".", "data", ",", "[", "]", ...
[ 147, 4 ]
[ 154, 65 ]
python
en
['en', 'en', 'en']
True
OpenHardwareMonitorData.parse_children
(self, json, devices, path, names)
Recursively loop through child objects, finding the values.
Recursively loop through child objects, finding the values.
def parse_children(self, json, devices, path, names): """Recursively loop through child objects, finding the values.""" result = devices.copy() if json[OHM_CHILDREN]: for child_index in range(0, len(json[OHM_CHILDREN])): child_path = path.copy() child...
[ "def", "parse_children", "(", "self", ",", "json", ",", "devices", ",", "path", ",", "names", ")", ":", "result", "=", "devices", ".", "copy", "(", ")", "if", "json", "[", "OHM_CHILDREN", "]", ":", "for", "child_index", "in", "range", "(", "0", ",", ...
[ 156, 4 ]
[ 189, 21 ]
python
en
['en', 'en', 'en']
True
_has_all_unique_names_and_ports
(bridges)
Validate that each homekit bridge configured has a unique name.
Validate that each homekit bridge configured has a unique name.
def _has_all_unique_names_and_ports(bridges): """Validate that each homekit bridge configured has a unique name.""" names = [bridge[CONF_NAME] for bridge in bridges] ports = [bridge[CONF_PORT] for bridge in bridges] vol.Schema(vol.Unique())(names) vol.Schema(vol.Unique())(ports) return bridges
[ "def", "_has_all_unique_names_and_ports", "(", "bridges", ")", ":", "names", "=", "[", "bridge", "[", "CONF_NAME", "]", "for", "bridge", "in", "bridges", "]", "ports", "=", "[", "bridge", "[", "CONF_PORT", "]", "for", "bridge", "in", "bridges", "]", "vol",...
[ 105, 0 ]
[ 111, 18 ]
python
en
['en', 'fr', 'en']
True
_async_get_entries_by_name
(current_entries)
Return a dict of the entries by name.
Return a dict of the entries by name.
def _async_get_entries_by_name(current_entries): """Return a dict of the entries by name.""" # For backwards compat, its possible the first bridge is using the default # name. return {entry.data.get(CONF_NAME, BRIDGE_NAME): entry for entry in current_entries}
[ "def", "_async_get_entries_by_name", "(", "current_entries", ")", ":", "# For backwards compat, its possible the first bridge is using the default", "# name.", "return", "{", "entry", ".", "data", ".", "get", "(", "CONF_NAME", ",", "BRIDGE_NAME", ")", ":", "entry", "for",...
[ 148, 0 ]
[ 153, 87 ]
python
en
['en', 'en', 'en']
True
async_setup
(hass: HomeAssistant, config: dict)
Set up the HomeKit from yaml.
Set up the HomeKit from yaml.
async def async_setup(hass: HomeAssistant, config: dict): """Set up the HomeKit from yaml.""" hass.data.setdefault(DOMAIN, {}) _async_register_events_and_services(hass) if DOMAIN not in config: return True current_entries = hass.config_entries.async_entries(DOMAIN) entries_by_name = _...
[ "async", "def", "async_setup", "(", "hass", ":", "HomeAssistant", ",", "config", ":", "dict", ")", ":", "hass", ".", "data", ".", "setdefault", "(", "DOMAIN", ",", "{", "}", ")", "_async_register_events_and_services", "(", "hass", ")", "if", "DOMAIN", "not...
[ 156, 0 ]
[ 181, 15 ]
python
en
['en', 'sn', 'en']
True
_async_update_config_entry_if_from_yaml
(hass, entries_by_name, conf)
Update a config entry with the latest yaml. Returns True if a matching config entry was found Returns False if there is no matching config entry
Update a config entry with the latest yaml.
def _async_update_config_entry_if_from_yaml(hass, entries_by_name, conf): """Update a config entry with the latest yaml. Returns True if a matching config entry was found Returns False if there is no matching config entry """ bridge_name = conf[CONF_NAME] if ( bridge_name in entries_b...
[ "def", "_async_update_config_entry_if_from_yaml", "(", "hass", ",", "entries_by_name", ",", "conf", ")", ":", "bridge_name", "=", "conf", "[", "CONF_NAME", "]", "if", "(", "bridge_name", "in", "entries_by_name", "and", "entries_by_name", "[", "bridge_name", "]", "...
[ 185, 0 ]
[ 211, 16 ]
python
en
['en', 'en', 'en']
True
async_setup_entry
(hass: HomeAssistant, entry: ConfigEntry)
Set up HomeKit from a config entry.
Set up HomeKit from a config entry.
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry): """Set up HomeKit from a config entry.""" _async_import_options_from_data_if_missing(hass, entry) conf = entry.data options = entry.options name = conf[CONF_NAME] port = conf[CONF_PORT] _LOGGER.debug("Begin setup HomeKit...
[ "async", "def", "async_setup_entry", "(", "hass", ":", "HomeAssistant", ",", "entry", ":", "ConfigEntry", ")", ":", "_async_import_options_from_data_if_missing", "(", "hass", ",", "entry", ")", "conf", "=", "entry", ".", "data", "options", "=", "entry", ".", "...
[ 214, 0 ]
[ 279, 15 ]
python
en
['en', 'en', 'en']
True
_async_update_listener
(hass: HomeAssistant, entry: ConfigEntry)
Handle options update.
Handle options update.
async def _async_update_listener(hass: HomeAssistant, entry: ConfigEntry): """Handle options update.""" if entry.source == SOURCE_IMPORT: return await hass.config_entries.async_reload(entry.entry_id)
[ "async", "def", "_async_update_listener", "(", "hass", ":", "HomeAssistant", ",", "entry", ":", "ConfigEntry", ")", ":", "if", "entry", ".", "source", "==", "SOURCE_IMPORT", ":", "return", "await", "hass", ".", "config_entries", ".", "async_reload", "(", "entr...
[ 282, 0 ]
[ 286, 58 ]
python
en
['en', 'nl', '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): """Unload a config entry.""" dismiss_setup_message(hass, entry.entry_id) hass.data[DOMAIN][entry.entry_id][UNDO_UPDATE_LISTENER]() homekit = hass.data[DOMAIN][entry.entry_id][HOMEKIT] if homekit.status == STATUS_RUNNING: ...
[ "async", "def", "async_unload_entry", "(", "hass", ":", "HomeAssistant", ",", "entry", ":", "ConfigEntry", ")", ":", "dismiss_setup_message", "(", "hass", ",", "entry", ".", "entry_id", ")", "hass", ".", "data", "[", "DOMAIN", "]", "[", "entry", ".", "entr...
[ 289, 0 ]
[ 309, 15 ]
python
en
['en', 'es', 'en']
True
async_remove_entry
(hass: HomeAssistant, entry: ConfigEntry)
Remove a config entry.
Remove a config entry.
async def async_remove_entry(hass: HomeAssistant, entry: ConfigEntry): """Remove a config entry.""" return await hass.async_add_executor_job( remove_state_files_for_entry_id, hass, entry.entry_id )
[ "async", "def", "async_remove_entry", "(", "hass", ":", "HomeAssistant", ",", "entry", ":", "ConfigEntry", ")", ":", "return", "await", "hass", ".", "async_add_executor_job", "(", "remove_state_files_for_entry_id", ",", "hass", ",", "entry", ".", "entry_id", ")" ]
[ 312, 0 ]
[ 316, 5 ]
python
en
['en', 'gl', 'en']
True
_async_register_events_and_services
(hass: HomeAssistant)
Register events and services for HomeKit.
Register events and services for HomeKit.
def _async_register_events_and_services(hass: HomeAssistant): """Register events and services for HomeKit.""" hass.http.register_view(HomeKitPairingQRView) def handle_homekit_reset_accessory(service): """Handle start HomeKit service call.""" for entry_id in hass.data[DOMAIN]: if...
[ "def", "_async_register_events_and_services", "(", "hass", ":", "HomeAssistant", ")", ":", "hass", ".", "http", ".", "register_view", "(", "HomeKitPairingQRView", ")", "def", "handle_homekit_reset_accessory", "(", "service", ")", ":", "\"\"\"Handle start HomeKit service c...
[ 335, 0 ]
[ 409, 5 ]
python
en
['en', 'en', 'en']
True
HomeKit.__init__
( self, hass, name, port, ip_address, entity_filter, entity_config, safe_mode, homekit_mode, advertise_ip=None, entry_id=None, )
Initialize a HomeKit object.
Initialize a HomeKit object.
def __init__( self, hass, name, port, ip_address, entity_filter, entity_config, safe_mode, homekit_mode, advertise_ip=None, entry_id=None, ): """Initialize a HomeKit object.""" self.hass = hass self._name...
[ "def", "__init__", "(", "self", ",", "hass", ",", "name", ",", "port", ",", "ip_address", ",", "entity_filter", ",", "entity_config", ",", "safe_mode", ",", "homekit_mode", ",", "advertise_ip", "=", "None", ",", "entry_id", "=", "None", ",", ")", ":", "s...
[ 415, 4 ]
[ 442, 26 ]
python
en
['en', 'haw', 'en']
True
HomeKit.setup
(self, zeroconf_instance)
Set up bridge and accessory driver.
Set up bridge and accessory driver.
def setup(self, zeroconf_instance): """Set up bridge and accessory driver.""" # pylint: disable=import-outside-toplevel from .accessories import HomeDriver self.hass.bus.async_listen_once(EVENT_HOMEASSISTANT_STOP, self.async_stop) ip_addr = self._ip_address or get_local_ip() ...
[ "def", "setup", "(", "self", ",", "zeroconf_instance", ")", ":", "# pylint: disable=import-outside-toplevel", "from", ".", "accessories", "import", "HomeDriver", "self", ".", "hass", ".", "bus", ".", "async_listen_once", "(", "EVENT_HOMEASSISTANT_STOP", ",", "self", ...
[ 444, 4 ]
[ 474, 40 ]
python
en
['en', 'en', 'en']
True