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_turn_on_off_toggle_schema
(hass, hass_read_only_user)
Test the schemas for the turn on/off/toggle services.
Test the schemas for the turn on/off/toggle services.
async def test_turn_on_off_toggle_schema(hass, hass_read_only_user): """Test the schemas for the turn on/off/toggle services.""" await async_setup_component(hass, "homeassistant", {}) for service in SERVICE_TURN_ON, SERVICE_TURN_OFF, SERVICE_TOGGLE: for invalid in None, "nothing", ENTITY_MATCH_ALL,...
[ "async", "def", "test_turn_on_off_toggle_schema", "(", "hass", ",", "hass_read_only_user", ")", ":", "await", "async_setup_component", "(", "hass", ",", "\"homeassistant\"", ",", "{", "}", ")", "for", "service", "in", "SERVICE_TURN_ON", ",", "SERVICE_TURN_OFF", ",",...
[ 355, 0 ]
[ 368, 17 ]
python
en
['en', 'en', 'en']
True
test_not_allowing_recursion
(hass, caplog)
Test we do not allow recursion.
Test we do not allow recursion.
async def test_not_allowing_recursion(hass, caplog): """Test we do not allow recursion.""" await async_setup_component(hass, "homeassistant", {}) for service in SERVICE_TURN_ON, SERVICE_TURN_OFF, SERVICE_TOGGLE: await hass.services.async_call( ha.DOMAIN, service, ...
[ "async", "def", "test_not_allowing_recursion", "(", "hass", ",", "caplog", ")", ":", "await", "async_setup_component", "(", "hass", ",", "\"homeassistant\"", ",", "{", "}", ")", "for", "service", "in", "SERVICE_TURN_ON", ",", "SERVICE_TURN_OFF", ",", "SERVICE_TOGG...
[ 371, 0 ]
[ 385, 18 ]
python
en
['en', 'en', 'en']
True
TestComponentsCore.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() assert asyncio.run_coroutine_threadsafe( async_setup_component(self.hass, "homeassistant", {}), self.hass.loop ).result() self.hass.states.set("light.Bowl", S...
[ "def", "setUp", "(", "self", ")", ":", "self", ".", "hass", "=", "get_test_home_assistant", "(", ")", "assert", "asyncio", ".", "run_coroutine_threadsafe", "(", "async_setup_component", "(", "self", ".", "hass", ",", "\"homeassistant\"", ",", "{", "}", ")", ...
[ 113, 4 ]
[ 122, 39 ]
python
en
['en', 'en', 'en']
True
TestComponentsCore.test_is_on
(self)
Test is_on method.
Test is_on method.
def test_is_on(self): """Test is_on method.""" assert comps.is_on(self.hass, "light.Bowl") assert not comps.is_on(self.hass, "light.Ceiling") assert comps.is_on(self.hass) assert not comps.is_on(self.hass, "non_existing.entity")
[ "def", "test_is_on", "(", "self", ")", ":", "assert", "comps", ".", "is_on", "(", "self", ".", "hass", ",", "\"light.Bowl\"", ")", "assert", "not", "comps", ".", "is_on", "(", "self", ".", "hass", ",", "\"light.Ceiling\"", ")", "assert", "comps", ".", ...
[ 124, 4 ]
[ 129, 64 ]
python
en
['en', 'et', 'en']
True
TestComponentsCore.test_turn_on_without_entities
(self)
Test turn_on method without entities.
Test turn_on method without entities.
def test_turn_on_without_entities(self): """Test turn_on method without entities.""" calls = mock_service(self.hass, "light", SERVICE_TURN_ON) turn_on(self.hass) self.hass.block_till_done() assert 0 == len(calls)
[ "def", "test_turn_on_without_entities", "(", "self", ")", ":", "calls", "=", "mock_service", "(", "self", ".", "hass", ",", "\"light\"", ",", "SERVICE_TURN_ON", ")", "turn_on", "(", "self", ".", "hass", ")", "self", ".", "hass", ".", "block_till_done", "(", ...
[ 131, 4 ]
[ 136, 30 ]
python
en
['en', 'en', 'en']
True
TestComponentsCore.test_turn_on
(self)
Test turn_on method.
Test turn_on method.
def test_turn_on(self): """Test turn_on method.""" calls = mock_service(self.hass, "light", SERVICE_TURN_ON) turn_on(self.hass, "light.Ceiling") self.hass.block_till_done() assert 1 == len(calls)
[ "def", "test_turn_on", "(", "self", ")", ":", "calls", "=", "mock_service", "(", "self", ".", "hass", ",", "\"light\"", ",", "SERVICE_TURN_ON", ")", "turn_on", "(", "self", ".", "hass", ",", "\"light.Ceiling\"", ")", "self", ".", "hass", ".", "block_till_d...
[ 138, 4 ]
[ 143, 30 ]
python
en
['en', 'et', 'en']
True
TestComponentsCore.test_turn_off
(self)
Test turn_off method.
Test turn_off method.
def test_turn_off(self): """Test turn_off method.""" calls = mock_service(self.hass, "light", SERVICE_TURN_OFF) turn_off(self.hass, "light.Bowl") self.hass.block_till_done() assert 1 == len(calls)
[ "def", "test_turn_off", "(", "self", ")", ":", "calls", "=", "mock_service", "(", "self", ".", "hass", ",", "\"light\"", ",", "SERVICE_TURN_OFF", ")", "turn_off", "(", "self", ".", "hass", ",", "\"light.Bowl\"", ")", "self", ".", "hass", ".", "block_till_d...
[ 145, 4 ]
[ 150, 30 ]
python
en
['en', 'et', 'en']
True
TestComponentsCore.test_toggle
(self)
Test toggle method.
Test toggle method.
def test_toggle(self): """Test toggle method.""" calls = mock_service(self.hass, "light", SERVICE_TOGGLE) toggle(self.hass, "light.Bowl") self.hass.block_till_done() assert 1 == len(calls)
[ "def", "test_toggle", "(", "self", ")", ":", "calls", "=", "mock_service", "(", "self", ".", "hass", ",", "\"light\"", ",", "SERVICE_TOGGLE", ")", "toggle", "(", "self", ".", "hass", ",", "\"light.Bowl\"", ")", "self", ".", "hass", ".", "block_till_done", ...
[ 152, 4 ]
[ 157, 30 ]
python
en
['en', 'et', 'en']
True
TestComponentsCore.test_reload_core_conf
(self)
Test reload core conf service.
Test reload core conf service.
def test_reload_core_conf(self): """Test reload core conf service.""" ent = entity.Entity() ent.entity_id = "test.entity" ent.hass = self.hass ent.schedule_update_ha_state() self.hass.block_till_done() state = self.hass.states.get("test.entity") assert st...
[ "def", "test_reload_core_conf", "(", "self", ")", ":", "ent", "=", "entity", ".", "Entity", "(", ")", "ent", ".", "entity_id", "=", "\"test.entity\"", "ent", ".", "hass", "=", "self", ".", "hass", "ent", ".", "schedule_update_ha_state", "(", ")", "self", ...
[ 160, 4 ]
[ 197, 55 ]
python
en
['en', 'it', 'en']
True
TestComponentsCore.test_reload_core_with_wrong_conf
(self, mock_process, mock_error)
Test reload core conf service.
Test reload core conf service.
def test_reload_core_with_wrong_conf(self, mock_process, mock_error): """Test reload core conf service.""" files = {config.YAML_CONFIG_FILE: yaml.dump(["invalid", "config"])} with patch_yaml_files(files, True): reload_core_config(self.hass) self.hass.block_till_done() ...
[ "def", "test_reload_core_with_wrong_conf", "(", "self", ",", "mock_process", ",", "mock_error", ")", ":", "files", "=", "{", "config", ".", "YAML_CONFIG_FILE", ":", "yaml", ".", "dump", "(", "[", "\"invalid\"", ",", "\"config\"", "]", ")", "}", "with", "patc...
[ 202, 4 ]
[ 210, 43 ]
python
en
['en', 'it', 'en']
True
TestComponentsCore.test_stop_homeassistant
(self, mock_stop)
Test stop service.
Test stop service.
def test_stop_homeassistant(self, mock_stop): """Test stop service.""" stop(self.hass) self.hass.block_till_done() assert mock_stop.called
[ "def", "test_stop_homeassistant", "(", "self", ",", "mock_stop", ")", ":", "stop", "(", "self", ".", "hass", ")", "self", ".", "hass", ".", "block_till_done", "(", ")", "assert", "mock_stop", ".", "called" ]
[ 213, 4 ]
[ 217, 31 ]
python
en
['en', 'en', 'en']
True
TestComponentsCore.test_restart_homeassistant
(self, mock_check, mock_restart)
Test stop service.
Test stop service.
def test_restart_homeassistant(self, mock_check, mock_restart): """Test stop service.""" restart(self.hass) self.hass.block_till_done() assert mock_restart.called assert mock_check.called
[ "def", "test_restart_homeassistant", "(", "self", ",", "mock_check", ",", "mock_restart", ")", ":", "restart", "(", "self", ".", "hass", ")", "self", ".", "hass", ".", "block_till_done", "(", ")", "assert", "mock_restart", ".", "called", "assert", "mock_check"...
[ 221, 4 ]
[ 226, 32 ]
python
en
['en', 'en', 'en']
True
TestComponentsCore.test_restart_homeassistant_wrong_conf
(self, mock_check, mock_restart)
Test stop service.
Test stop service.
def test_restart_homeassistant_wrong_conf(self, mock_check, mock_restart): """Test stop service.""" restart(self.hass) self.hass.block_till_done() assert mock_check.called assert not mock_restart.called
[ "def", "test_restart_homeassistant_wrong_conf", "(", "self", ",", "mock_check", ",", "mock_restart", ")", ":", "restart", "(", "self", ".", "hass", ")", "self", ".", "hass", ".", "block_till_done", "(", ")", "assert", "mock_check", ".", "called", "assert", "no...
[ 233, 4 ]
[ 238, 38 ]
python
en
['en', 'en', 'en']
True
TestComponentsCore.test_check_config
(self, mock_check, mock_stop)
Test stop service.
Test stop service.
def test_check_config(self, mock_check, mock_stop): """Test stop service.""" check_config(self.hass) self.hass.block_till_done() assert mock_check.called assert not mock_stop.called
[ "def", "test_check_config", "(", "self", ",", "mock_check", ",", "mock_stop", ")", ":", "check_config", "(", "self", ".", "hass", ")", "self", ".", "hass", ".", "block_till_done", "(", ")", "assert", "mock_check", ".", "called", "assert", "not", "mock_stop",...
[ 242, 4 ]
[ 247, 35 ]
python
en
['en', 'en', 'en']
True
setup
(hass, config)
Set up Lupusec component.
Set up Lupusec component.
def setup(hass, config): """Set up Lupusec component.""" conf = config[DOMAIN] username = conf[CONF_USERNAME] password = conf[CONF_PASSWORD] ip_address = conf[CONF_IP_ADDRESS] name = conf.get(CONF_NAME) try: hass.data[DOMAIN] = LupusecSystem(username, password, ip_address, name) ...
[ "def", "setup", "(", "hass", ",", "config", ")", ":", "conf", "=", "config", "[", "DOMAIN", "]", "username", "=", "conf", "[", "CONF_USERNAME", "]", "password", "=", "conf", "[", "CONF_PASSWORD", "]", "ip_address", "=", "conf", "[", "CONF_IP_ADDRESS", "]...
[ 35, 0 ]
[ 58, 15 ]
python
en
['en', 'ca', 'en']
True
LupusecSystem.__init__
(self, username, password, ip_address, name)
Initialize the system.
Initialize the system.
def __init__(self, username, password, ip_address, name): """Initialize the system.""" self.lupusec = lupupy.Lupusec(username, password, ip_address) self.name = name
[ "def", "__init__", "(", "self", ",", "username", ",", "password", ",", "ip_address", ",", "name", ")", ":", "self", ".", "lupusec", "=", "lupupy", ".", "Lupusec", "(", "username", ",", "password", ",", "ip_address", ")", "self", ".", "name", "=", "name...
[ 64, 4 ]
[ 67, 24 ]
python
en
['en', 'en', 'en']
True
LupusecDevice.__init__
(self, data, device)
Initialize a sensor for Lupusec device.
Initialize a sensor for Lupusec device.
def __init__(self, data, device): """Initialize a sensor for Lupusec device.""" self._data = data self._device = device
[ "def", "__init__", "(", "self", ",", "data", ",", "device", ")", ":", "self", ".", "_data", "=", "data", "self", ".", "_device", "=", "device" ]
[ 73, 4 ]
[ 76, 29 ]
python
en
['en', 'en', 'en']
True
LupusecDevice.update
(self)
Update automation state.
Update automation state.
def update(self): """Update automation state.""" self._device.refresh()
[ "def", "update", "(", "self", ")", ":", "self", ".", "_device", ".", "refresh", "(", ")" ]
[ 78, 4 ]
[ 80, 30 ]
python
en
['de', 'en', 'en']
True
LupusecDevice.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._device.name
[ "def", "name", "(", "self", ")", ":", "return", "self", ".", "_device", ".", "name" ]
[ 83, 4 ]
[ 85, 32 ]
python
en
['en', 'mi', 'en']
True
_assert_tensors_equal
(a, b, atol=1e-12, prefix="")
If tensors not close, or a and b arent both tensors, raise a nice Assertion error.
If tensors not close, or a and b arent both tensors, raise a nice Assertion error.
def _assert_tensors_equal(a, b, atol=1e-12, prefix=""): """If tensors not close, or a and b arent both tensors, raise a nice Assertion error.""" if a is None and b is None: return True try: if tf.debugging.assert_near(a, b, atol=atol): return True raise except Excepti...
[ "def", "_assert_tensors_equal", "(", "a", ",", "b", ",", "atol", "=", "1e-12", ",", "prefix", "=", "\"\"", ")", ":", "if", "a", "is", "None", "and", "b", "is", "None", ":", "return", "True", "try", ":", "if", "tf", ".", "debugging", ".", "assert_ne...
[ 282, 0 ]
[ 294, 33 ]
python
en
['en', 'en', 'en']
True
_validate_input
(data)
Validate the user input allows us to connect.
Validate the user input allows us to connect.
async def _validate_input(data): """Validate the user input allows us to connect.""" def _connected_callback(): connected_event.set() connected_event = asyncio.Event() file_path = data.get(CONF_FILE_PATH) url = _make_url_from_data(data) upb = upb_lib.UpbPim({"url": url, "UPStartExport...
[ "async", "def", "_validate_input", "(", "data", ")", ":", "def", "_connected_callback", "(", ")", ":", "connected_event", ".", "set", "(", ")", "connected_event", "=", "asyncio", ".", "Event", "(", ")", "file_path", "=", "data", ".", "get", "(", "CONF_FILE...
[ 28, 0 ]
[ 62, 88 ]
python
en
['en', 'en', 'en']
True
ConfigFlow.__init__
(self)
Initialize the UPB config flow.
Initialize the UPB config flow.
def __init__(self): """Initialize the UPB config flow.""" self.importing = False
[ "def", "__init__", "(", "self", ")", ":", "self", ".", "importing", "=", "False" ]
[ 81, 4 ]
[ 83, 30 ]
python
en
['en', 'en', 'en']
True
ConfigFlow.async_step_user
(self, user_input=None)
Handle the initial step.
Handle the initial step.
async def async_step_user(self, user_input=None): """Handle the initial step.""" errors = {} if user_input is not None: try: if self._url_already_configured(_make_url_from_data(user_input)): return self.async_abort(reason="already_configured") ...
[ "async", "def", "async_step_user", "(", "self", ",", "user_input", "=", "None", ")", ":", "errors", "=", "{", "}", "if", "user_input", "is", "not", "None", ":", "try", ":", "if", "self", ".", "_url_already_configured", "(", "_make_url_from_data", "(", "use...
[ 85, 4 ]
[ 118, 9 ]
python
en
['en', 'en', 'en']
True
ConfigFlow.async_step_import
(self, user_input)
Handle import.
Handle import.
async def async_step_import(self, user_input): """Handle import.""" self.importing = True return await self.async_step_user(user_input)
[ "async", "def", "async_step_import", "(", "self", ",", "user_input", ")", ":", "self", ".", "importing", "=", "True", "return", "await", "self", ".", "async_step_user", "(", "user_input", ")" ]
[ 120, 4 ]
[ 123, 53 ]
python
en
['en', 'ja', 'en']
False
ConfigFlow._url_already_configured
(self, url)
See if we already have a UPB PIM matching user input configured.
See if we already have a UPB PIM matching user input configured.
def _url_already_configured(self, url): """See if we already have a UPB PIM matching user input configured.""" existing_hosts = { urlparse(entry.data[CONF_HOST]).hostname for entry in self._async_current_entries() } return urlparse(url).hostname in existing_hosts
[ "def", "_url_already_configured", "(", "self", ",", "url", ")", ":", "existing_hosts", "=", "{", "urlparse", "(", "entry", ".", "data", "[", "CONF_HOST", "]", ")", ".", "hostname", "for", "entry", "in", "self", ".", "_async_current_entries", "(", ")", "}",...
[ 125, 4 ]
[ 131, 55 ]
python
en
['en', 'en', 'en']
True
setup_awair
(hass, fixtures)
Add Awair devices to hass, using specified fixtures for data.
Add Awair devices to hass, using specified fixtures for data.
async def setup_awair(hass, fixtures): """Add Awair devices to hass, using specified fixtures for data.""" entry = MockConfigEntry(domain=DOMAIN, unique_id=UNIQUE_ID, data=CONFIG) with patch("python_awair.AwairClient.query", side_effect=fixtures): entry.add_to_hass(hass) await hass.config_e...
[ "async", "def", "setup_awair", "(", "hass", ",", "fixtures", ")", ":", "entry", "=", "MockConfigEntry", "(", "domain", "=", "DOMAIN", ",", "unique_id", "=", "UNIQUE_ID", ",", "data", "=", "CONFIG", ")", "with", "patch", "(", "\"python_awair.AwairClient.query\"...
[ 46, 0 ]
[ 53, 42 ]
python
en
['en', 'en', 'en']
True
assert_expected_properties
( hass, registry, name, unique_id, state_value, attributes )
Assert expected properties from a dict.
Assert expected properties from a dict.
def assert_expected_properties( hass, registry, name, unique_id, state_value, attributes ): """Assert expected properties from a dict.""" entry = registry.async_get(name) assert entry.unique_id == unique_id state = hass.states.get(name) assert state assert state.state == state_value for...
[ "def", "assert_expected_properties", "(", "hass", ",", "registry", ",", "name", ",", "unique_id", ",", "state_value", ",", "attributes", ")", ":", "entry", "=", "registry", ".", "async_get", "(", "name", ")", "assert", "entry", ".", "unique_id", "==", "uniqu...
[ 56, 0 ]
[ 67, 50 ]
python
en
['en', 'en', 'en']
True
test_awair_gen1_sensors
(hass)
Test expected sensors on a 1st gen Awair.
Test expected sensors on a 1st gen Awair.
async def test_awair_gen1_sensors(hass): """Test expected sensors on a 1st gen Awair.""" fixtures = [USER_FIXTURE, DEVICES_FIXTURE, GEN1_DATA_FIXTURE] await setup_awair(hass, fixtures) registry = await hass.helpers.entity_registry.async_get_registry() assert_expected_properties( hass, ...
[ "async", "def", "test_awair_gen1_sensors", "(", "hass", ")", ":", "fixtures", "=", "[", "USER_FIXTURE", ",", "DEVICES_FIXTURE", ",", "GEN1_DATA_FIXTURE", "]", "await", "setup_awair", "(", "hass", ",", "fixtures", ")", "registry", "=", "await", "hass", ".", "he...
[ 70, 0 ]
[ 163, 68 ]
python
en
['en', 'lb', 'en']
True
test_awair_gen2_sensors
(hass)
Test expected sensors on a 2nd gen Awair.
Test expected sensors on a 2nd gen Awair.
async def test_awair_gen2_sensors(hass): """Test expected sensors on a 2nd gen Awair.""" fixtures = [USER_FIXTURE, DEVICES_FIXTURE, GEN2_DATA_FIXTURE] await setup_awair(hass, fixtures) registry = await hass.helpers.entity_registry.async_get_registry() assert_expected_properties( hass, ...
[ "async", "def", "test_awair_gen2_sensors", "(", "hass", ")", ":", "fixtures", "=", "[", "USER_FIXTURE", ",", "DEVICES_FIXTURE", ",", "GEN2_DATA_FIXTURE", "]", "await", "setup_awair", "(", "hass", ",", "fixtures", ")", "registry", "=", "await", "hass", ".", "he...
[ 166, 0 ]
[ 197, 61 ]
python
en
['en', 'lb', 'en']
True
test_awair_mint_sensors
(hass)
Test expected sensors on an Awair mint.
Test expected sensors on an Awair mint.
async def test_awair_mint_sensors(hass): """Test expected sensors on an Awair mint.""" fixtures = [USER_FIXTURE, DEVICES_FIXTURE, MINT_DATA_FIXTURE] await setup_awair(hass, fixtures) registry = await hass.helpers.entity_registry.async_get_registry() assert_expected_properties( hass, ...
[ "async", "def", "test_awair_mint_sensors", "(", "hass", ")", ":", "fixtures", "=", "[", "USER_FIXTURE", ",", "DEVICES_FIXTURE", ",", "MINT_DATA_FIXTURE", "]", "await", "setup_awair", "(", "hass", ",", "fixtures", ")", "registry", "=", "await", "hass", ".", "he...
[ 200, 0 ]
[ 239, 71 ]
python
en
['en', 'lb', 'en']
True
test_awair_glow_sensors
(hass)
Test expected sensors on an Awair glow.
Test expected sensors on an Awair glow.
async def test_awair_glow_sensors(hass): """Test expected sensors on an Awair glow.""" fixtures = [USER_FIXTURE, DEVICES_FIXTURE, GLOW_DATA_FIXTURE] await setup_awair(hass, fixtures) registry = await hass.helpers.entity_registry.async_get_registry() assert_expected_properties( hass, ...
[ "async", "def", "test_awair_glow_sensors", "(", "hass", ")", ":", "fixtures", "=", "[", "USER_FIXTURE", ",", "DEVICES_FIXTURE", ",", "GLOW_DATA_FIXTURE", "]", "await", "setup_awair", "(", "hass", ",", "fixtures", ")", "registry", "=", "await", "hass", ".", "he...
[ 242, 0 ]
[ 259, 62 ]
python
en
['en', 'en', 'en']
True
test_awair_omni_sensors
(hass)
Test expected sensors on an Awair omni.
Test expected sensors on an Awair omni.
async def test_awair_omni_sensors(hass): """Test expected sensors on an Awair omni.""" fixtures = [USER_FIXTURE, DEVICES_FIXTURE, OMNI_DATA_FIXTURE] await setup_awair(hass, fixtures) registry = await hass.helpers.entity_registry.async_get_registry() assert_expected_properties( hass, ...
[ "async", "def", "test_awair_omni_sensors", "(", "hass", ")", ":", "fixtures", "=", "[", "USER_FIXTURE", ",", "DEVICES_FIXTURE", ",", "OMNI_DATA_FIXTURE", "]", "await", "setup_awair", "(", "hass", ",", "fixtures", ")", "registry", "=", "await", "hass", ".", "he...
[ 262, 0 ]
[ 294, 5 ]
python
en
['en', 'en', 'en']
True
test_awair_offline
(hass)
Test expected behavior when an Awair is offline.
Test expected behavior when an Awair is offline.
async def test_awair_offline(hass): """Test expected behavior when an Awair is offline.""" fixtures = [USER_FIXTURE, DEVICES_FIXTURE, OFFLINE_FIXTURE] await setup_awair(hass, fixtures) # The expected behavior is that we won't have any sensors # if the device is not online when we set it up. python...
[ "async", "def", "test_awair_offline", "(", "hass", ")", ":", "fixtures", "=", "[", "USER_FIXTURE", ",", "DEVICES_FIXTURE", ",", "OFFLINE_FIXTURE", "]", "await", "setup_awair", "(", "hass", ",", "fixtures", ")", "# The expected behavior is that we won't have any sensors"...
[ 297, 0 ]
[ 312, 68 ]
python
en
['en', 'lb', 'en']
True
test_awair_unavailable
(hass)
Test expected behavior when an Awair becomes offline later.
Test expected behavior when an Awair becomes offline later.
async def test_awair_unavailable(hass): """Test expected behavior when an Awair becomes offline later.""" fixtures = [USER_FIXTURE, DEVICES_FIXTURE, GEN1_DATA_FIXTURE] await setup_awair(hass, fixtures) registry = await hass.helpers.entity_registry.async_get_registry() assert_expected_properties( ...
[ "async", "def", "test_awair_unavailable", "(", "hass", ")", ":", "fixtures", "=", "[", "USER_FIXTURE", ",", "DEVICES_FIXTURE", ",", "GEN1_DATA_FIXTURE", "]", "await", "setup_awair", "(", "hass", ",", "fixtures", ")", "registry", "=", "await", "hass", ".", "hel...
[ 315, 0 ]
[ 342, 9 ]
python
en
['en', 'lb', 'en']
True
validate_attributes
(list_attributes)
Validate face attributes.
Validate face attributes.
def validate_attributes(list_attributes): """Validate face attributes.""" for attr in list_attributes: if attr not in SUPPORTED_ATTRIBUTES: raise vol.Invalid(f"Invalid attribute {attr}") return list_attributes
[ "def", "validate_attributes", "(", "list_attributes", ")", ":", "for", "attr", "in", "list_attributes", ":", "if", "attr", "not", "in", "SUPPORTED_ATTRIBUTES", ":", "raise", "vol", ".", "Invalid", "(", "f\"Invalid attribute {attr}\"", ")", "return", "list_attributes...
[ 28, 0 ]
[ 33, 26 ]
python
en
['en', 'la', 'en']
True
async_setup_platform
(hass, config, async_add_entities, discovery_info=None)
Set up the Microsoft Face detection platform.
Set up the Microsoft Face detection platform.
async def async_setup_platform(hass, config, async_add_entities, discovery_info=None): """Set up the Microsoft Face detection platform.""" api = hass.data[DATA_MICROSOFT_FACE] attributes = config[CONF_ATTRIBUTES] entities = [] for camera in config[CONF_SOURCE]: entities.append( ...
[ "async", "def", "async_setup_platform", "(", "hass", ",", "config", ",", "async_add_entities", ",", "discovery_info", "=", "None", ")", ":", "api", "=", "hass", ".", "data", "[", "DATA_MICROSOFT_FACE", "]", "attributes", "=", "config", "[", "CONF_ATTRIBUTES", ...
[ 45, 0 ]
[ 58, 32 ]
python
en
['en', 'da', 'en']
True
MicrosoftFaceDetectEntity.__init__
(self, camera_entity, api, attributes, name=None)
Initialize Microsoft Face.
Initialize Microsoft Face.
def __init__(self, camera_entity, api, attributes, name=None): """Initialize Microsoft Face.""" super().__init__() self._api = api self._camera = camera_entity self._attributes = attributes if name: self._name = name else: self._name = f"...
[ "def", "__init__", "(", "self", ",", "camera_entity", ",", "api", ",", "attributes", ",", "name", "=", "None", ")", ":", "super", "(", ")", ".", "__init__", "(", ")", "self", ".", "_api", "=", "api", "self", ".", "_camera", "=", "camera_entity", "sel...
[ 64, 4 ]
[ 75, 77 ]
python
co
['en', 'co', 'it']
False
MicrosoftFaceDetectEntity.camera_entity
(self)
Return camera entity id from process pictures.
Return camera entity id from process pictures.
def camera_entity(self): """Return camera entity id from process pictures.""" return self._camera
[ "def", "camera_entity", "(", "self", ")", ":", "return", "self", ".", "_camera" ]
[ 78, 4 ]
[ 80, 27 ]
python
en
['en', 'en', 'en']
True
MicrosoftFaceDetectEntity.name
(self)
Return the name of the entity.
Return the name of the entity.
def name(self): """Return the name of the entity.""" return self._name
[ "def", "name", "(", "self", ")", ":", "return", "self", ".", "_name" ]
[ 83, 4 ]
[ 85, 25 ]
python
en
['en', 'en', 'en']
True
MicrosoftFaceDetectEntity.async_process_image
(self, image)
Process image. This method is a coroutine.
Process image.
async def async_process_image(self, image): """Process image. This method is a coroutine. """ face_data = None try: face_data = await self._api.call_api( "post", "detect", image, binary=True, ...
[ "async", "def", "async_process_image", "(", "self", ",", "image", ")", ":", "face_data", "=", "None", "try", ":", "face_data", "=", "await", "self", ".", "_api", ".", "call_api", "(", "\"post\"", ",", "\"detect\"", ",", "image", ",", "binary", "=", "True...
[ 87, 4 ]
[ 119, 55 ]
python
en
['en', 'ny', 'en']
False
async_setup
(hass)
Set up the Customize config API.
Set up the Customize config API.
async def async_setup(hass): """Set up the Customize config API.""" async def hook(action, config_key): """post_write_hook for Config View that reloads groups.""" await hass.services.async_call(DOMAIN, SERVICE_RELOAD_CORE_CONFIG) hass.http.register_view( CustomizeConfigView( ...
[ "async", "def", "async_setup", "(", "hass", ")", ":", "async", "def", "hook", "(", "action", ",", "config_key", ")", ":", "\"\"\"post_write_hook for Config View that reloads groups.\"\"\"", "await", "hass", ".", "services", ".", "async_call", "(", "DOMAIN", ",", "...
[ 11, 0 ]
[ 24, 15 ]
python
en
['en', 'su', 'en']
True
init_integration
( hass: HomeAssistant, aioclient_mock: AiohttpClientMocker, skip_setup: bool = False, )
Set up the Elgato Key Light integration in Home Assistant.
Set up the Elgato Key Light integration in Home Assistant.
async def init_integration( hass: HomeAssistant, aioclient_mock: AiohttpClientMocker, skip_setup: bool = False, ) -> MockConfigEntry: """Set up the Elgato Key Light integration in Home Assistant.""" aioclient_mock.get( "http://1.2.3.4:9123/elgato/accessory-info", text=load_fixture("...
[ "async", "def", "init_integration", "(", "hass", ":", "HomeAssistant", ",", "aioclient_mock", ":", "AiohttpClientMocker", ",", "skip_setup", ":", "bool", "=", "False", ",", ")", "->", "MockConfigEntry", ":", "aioclient_mock", ".", "get", "(", "\"http://1.2.3.4:912...
[ 10, 0 ]
[ 57, 16 ]
python
en
['en', 'en', 'en']
True
SummarizationDistiller.calc_ce_loss
(self, mask, s_logits, t_logits)
Copy pasted from distillbert (transformers/examples/distillation/)
Copy pasted from distillbert (transformers/examples/distillation/)
def calc_ce_loss(self, mask, s_logits, t_logits): """Copy pasted from distillbert (transformers/examples/distillation/)""" # mask has False at padding_idx sel_mask = mask[:, :, None].expand_as(s_logits) vocab_size = s_logits.size(-1) s_logits_slct = torch.masked_select(s_logits, ...
[ "def", "calc_ce_loss", "(", "self", ",", "mask", ",", "s_logits", ",", "t_logits", ")", ":", "# mask has False at padding_idx", "sel_mask", "=", "mask", "[", ":", ",", ":", ",", "None", "]", ".", "expand_as", "(", "s_logits", ")", "vocab_size", "=", "s_log...
[ 113, 4 ]
[ 130, 22 ]
python
en
['en', 'sv', 'en']
True
SummarizationDistiller._step
(self, batch: dict)
Compute the loss for a batch
Compute the loss for a batch
def _step(self, batch: dict) -> tuple: """Compute the loss for a batch""" pad_token_id = self.tokenizer.pad_token_id input_ids, src_mask, labels = batch["input_ids"], batch["attention_mask"], batch["labels"] if isinstance(self.model, T5ForConditionalGeneration): decoder_input...
[ "def", "_step", "(", "self", ",", "batch", ":", "dict", ")", "->", "tuple", ":", "pad_token_id", "=", "self", ".", "tokenizer", ".", "pad_token_id", "input_ids", ",", "src_mask", ",", "labels", "=", "batch", "[", "\"input_ids\"", "]", ",", "batch", "[", ...
[ 138, 4 ]
[ 218, 81 ]
python
en
['en', 'en', 'en']
True
SummarizationDistiller.calc_hidden_loss
(attention_mask, hidden_states, hidden_states_T, matches, normalize_hidden)
MSE(student_hid, teacher_hid[matches]). Called "Intermediate supervision" in paper. Inspired by TinyBERT.
MSE(student_hid, teacher_hid[matches]). Called "Intermediate supervision" in paper. Inspired by TinyBERT.
def calc_hidden_loss(attention_mask, hidden_states, hidden_states_T, matches, normalize_hidden): """MSE(student_hid, teacher_hid[matches]). Called "Intermediate supervision" in paper. Inspired by TinyBERT.""" msg = "expected list or tuple for hidden_states, got tensor of shape: " assert not isin...
[ "def", "calc_hidden_loss", "(", "attention_mask", ",", "hidden_states", ",", "hidden_states_T", ",", "matches", ",", "normalize_hidden", ")", ":", "msg", "=", "\"expected list or tuple for hidden_states, got tensor of shape: \"", "assert", "not", "isinstance", "(", "hidden_...
[ 221, 4 ]
[ 236, 25 ]
python
en
['en', 'en', 'en']
True
test_abort_if_no_configuration
(hass)
Check flow aborts when no configuration is present.
Check flow aborts when no configuration is present.
async def test_abort_if_no_configuration(hass): """Check flow aborts when no configuration is present.""" result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": SOURCE_USER} ) assert result["type"] == data_entry_flow.RESULT_TYPE_ABORT assert result["reason"] == "miss...
[ "async", "def", "test_abort_if_no_configuration", "(", "hass", ")", ":", "result", "=", "await", "hass", ".", "config_entries", ".", "flow", ".", "async_init", "(", "DOMAIN", ",", "context", "=", "{", "\"source\"", ":", "SOURCE_USER", "}", ")", "assert", "re...
[ 13, 0 ]
[ 27, 54 ]
python
en
['en', 'en', 'en']
True
test_zeroconf_abort_if_existing_entry
(hass)
Check zeroconf flow aborts when an entry already exist.
Check zeroconf flow aborts when an entry already exist.
async def test_zeroconf_abort_if_existing_entry(hass): """Check zeroconf flow aborts when an entry already exist.""" MockConfigEntry(domain=DOMAIN).add_to_hass(hass) result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": SOURCE_ZEROCONF} ) assert result["type"] == d...
[ "async", "def", "test_zeroconf_abort_if_existing_entry", "(", "hass", ")", ":", "MockConfigEntry", "(", "domain", "=", "DOMAIN", ")", ".", "add_to_hass", "(", "hass", ")", "result", "=", "await", "hass", ".", "config_entries", ".", "flow", ".", "async_init", "...
[ 30, 0 ]
[ 39, 51 ]
python
en
['en', 'gl', 'en']
True
test_full_flow
(hass, aiohttp_client, aioclient_mock, current_request)
Check a full flow.
Check a full flow.
async def test_full_flow(hass, aiohttp_client, aioclient_mock, current_request): """Check a full flow.""" assert await setup.async_setup_component( hass, DOMAIN, { DOMAIN: {CONF_CLIENT_ID: "client", CONF_CLIENT_SECRET: "secret"}, "http": {"base_url": "https://exam...
[ "async", "def", "test_full_flow", "(", "hass", ",", "aiohttp_client", ",", "aioclient_mock", ",", "current_request", ")", ":", "assert", "await", "setup", ".", "async_setup_component", "(", "hass", ",", "DOMAIN", ",", "{", "DOMAIN", ":", "{", "CONF_CLIENT_ID", ...
[ 42, 0 ]
[ 101, 5 ]
python
en
['en', 'en', 'en']
True
test_abort_if_spotify_error
( hass, aiohttp_client, aioclient_mock, current_request )
Check Spotify errors causes flow to abort.
Check Spotify errors causes flow to abort.
async def test_abort_if_spotify_error( hass, aiohttp_client, aioclient_mock, current_request ): """Check Spotify errors causes flow to abort.""" await setup.async_setup_component( hass, DOMAIN, { DOMAIN: {CONF_CLIENT_ID: "client", CONF_CLIENT_SECRET: "secret"}, ...
[ "async", "def", "test_abort_if_spotify_error", "(", "hass", ",", "aiohttp_client", ",", "aioclient_mock", ",", "current_request", ")", ":", "await", "setup", ".", "async_setup_component", "(", "hass", ",", "DOMAIN", ",", "{", "DOMAIN", ":", "{", "CONF_CLIENT_ID", ...
[ 104, 0 ]
[ 143, 49 ]
python
en
['en', 'en', 'en']
True
test_reauthentication
(hass, aiohttp_client, aioclient_mock, current_request)
Test Spotify reauthentication.
Test Spotify reauthentication.
async def test_reauthentication(hass, aiohttp_client, aioclient_mock, current_request): """Test Spotify reauthentication.""" await setup.async_setup_component( hass, DOMAIN, { DOMAIN: {CONF_CLIENT_ID: "client", CONF_CLIENT_SECRET: "secret"}, "http": {"base_url": "...
[ "async", "def", "test_reauthentication", "(", "hass", ",", "aiohttp_client", ",", "aioclient_mock", ",", "current_request", ")", ":", "await", "setup", ".", "async_setup_component", "(", "hass", ",", "DOMAIN", ",", "{", "DOMAIN", ":", "{", "CONF_CLIENT_ID", ":",...
[ 146, 0 ]
[ 200, 5 ]
python
de
['de', 'en', 'it']
False
test_reauth_account_mismatch
( hass, aiohttp_client, aioclient_mock, current_request )
Test Spotify reauthentication with different account.
Test Spotify reauthentication with different account.
async def test_reauth_account_mismatch( hass, aiohttp_client, aioclient_mock, current_request ): """Test Spotify reauthentication with different account.""" await setup.async_setup_component( hass, DOMAIN, { DOMAIN: {CONF_CLIENT_ID: "client", CONF_CLIENT_SECRET: "secret"}...
[ "async", "def", "test_reauth_account_mismatch", "(", "hass", ",", "aiohttp_client", ",", "aioclient_mock", ",", "current_request", ")", ":", "await", "setup", ".", "async_setup_component", "(", "hass", ",", "DOMAIN", ",", "{", "DOMAIN", ":", "{", "CONF_CLIENT_ID",...
[ 203, 0 ]
[ 251, 56 ]
python
en
['en', 'en', 'en']
True
async_setup
(hass, yaml_config)
Activate Azure EH component.
Activate Azure EH component.
async def async_setup(hass, yaml_config): """Activate Azure EH component.""" config = yaml_config[DOMAIN] if config.get(CONF_EVENT_HUB_CON_STRING): client_args = {"conn_str": config[CONF_EVENT_HUB_CON_STRING]} conn_str_client = True else: client_args = { "fully_qualif...
[ "async", "def", "async_setup", "(", "hass", ",", "yaml_config", ")", ":", "config", "=", "yaml_config", "[", "DOMAIN", "]", "if", "config", ".", "get", "(", "CONF_EVENT_HUB_CON_STRING", ")", ":", "client_args", "=", "{", "\"conn_str\"", ":", "config", "[", ...
[ 61, 0 ]
[ 88, 15 ]
python
en
['eu', 'en', 'en']
True
AzureEventHub.__init__
( self, hass: HomeAssistant, client_args: Dict[str, Any], conn_str_client: bool, entities_filter: vol.Schema, send_interval: int, max_delay: int, )
Initialize the listener.
Initialize the listener.
def __init__( self, hass: HomeAssistant, client_args: Dict[str, Any], conn_str_client: bool, entities_filter: vol.Schema, send_interval: int, max_delay: int, ): """Initialize the listener.""" self.hass = hass self.queue = asyncio.Priori...
[ "def", "__init__", "(", "self", ",", "hass", ":", "HomeAssistant", ",", "client_args", ":", "Dict", "[", "str", ",", "Any", "]", ",", "conn_str_client", ":", "bool", ",", "entities_filter", ":", "vol", ".", "Schema", ",", "send_interval", ":", "int", ","...
[ 94, 4 ]
[ 113, 29 ]
python
en
['en', 'en', 'en']
True
AzureEventHub.async_start
(self)
Start the recorder, suppress logging and register the callbacks and do the first send after five seconds, to capture the startup events.
Start the recorder, suppress logging and register the callbacks and do the first send after five seconds, to capture the startup events.
async def async_start(self): """Start the recorder, suppress logging and register the callbacks and do the first send after five seconds, to capture the startup events.""" # suppress the INFO and below logging on the underlying packages, they are very verbose, even at INFO logging.getLogger("uam...
[ "async", "def", "async_start", "(", "self", ")", ":", "# suppress the INFO and below logging on the underlying packages, they are very verbose, even at INFO", "logging", ".", "getLogger", "(", "\"uamqp\"", ")", ".", "setLevel", "(", "logging", ".", "WARNING", ")", "logging"...
[ 115, 4 ]
[ 126, 82 ]
python
en
['en', 'en', 'en']
True
AzureEventHub.async_shutdown
(self, _: Event)
Shut down the AEH by queueing None and calling send.
Shut down the AEH by queueing None and calling send.
async def async_shutdown(self, _: Event): """Shut down the AEH by queueing None and calling send.""" if self._next_send_remover: self._next_send_remover() if self._listener_remover: self._listener_remover() await self.queue.put((3, (time.monotonic(), None))) ...
[ "async", "def", "async_shutdown", "(", "self", ",", "_", ":", "Event", ")", ":", "if", "self", ".", "_next_send_remover", ":", "self", ".", "_next_send_remover", "(", ")", "if", "self", ".", "_listener_remover", ":", "self", ".", "_listener_remover", "(", ...
[ 128, 4 ]
[ 135, 35 ]
python
en
['en', 'en', 'en']
True
AzureEventHub.async_listen
(self, event: Event)
Listen for new messages on the bus and queue them for AEH.
Listen for new messages on the bus and queue them for AEH.
async def async_listen(self, event: Event): """Listen for new messages on the bus and queue them for AEH.""" await self.queue.put((2, (time.monotonic(), event)))
[ "async", "def", "async_listen", "(", "self", ",", "event", ":", "Event", ")", ":", "await", "self", ".", "queue", ".", "put", "(", "(", "2", ",", "(", "time", ".", "monotonic", "(", ")", ",", "event", ")", ")", ")" ]
[ 137, 4 ]
[ 139, 60 ]
python
en
['en', 'en', 'en']
True
AzureEventHub.async_send
(self, _)
Write preprocessed events to eventhub, with retry.
Write preprocessed events to eventhub, with retry.
async def async_send(self, _): """Write preprocessed events to eventhub, with retry.""" client = self._get_client() async with client: while not self.queue.empty(): data_batch, dequeue_count = await self.fill_batch(client) _LOGGER.debug( ...
[ "async", "def", "async_send", "(", "self", ",", "_", ")", ":", "client", "=", "self", ".", "_get_client", "(", ")", "async", "with", "client", ":", "while", "not", "self", ".", "queue", ".", "empty", "(", ")", ":", "data_batch", ",", "dequeue_count", ...
[ 141, 4 ]
[ 165, 13 ]
python
en
['en', 'en', 'en']
True
AzureEventHub.fill_batch
(self, client)
Return a batch of events formatted for writing. Uses get_nowait instead of await get, because the functions batches and doesn't wait for each single event, the send function is called. Throws ValueError on add to batch when the EventDataBatch object reaches max_size. Put the item back in the queue and...
Return a batch of events formatted for writing.
async def fill_batch(self, client): """Return a batch of events formatted for writing. Uses get_nowait instead of await get, because the functions batches and doesn't wait for each single event, the send function is called. Throws ValueError on add to batch when the EventDataBatch object reach...
[ "async", "def", "fill_batch", "(", "self", ",", "client", ")", ":", "event_batch", "=", "await", "client", ".", "create_batch", "(", ")", "dequeue_count", "=", "0", "dropped", "=", "0", "while", "not", "self", ".", "shutdown", ":", "try", ":", "_", ","...
[ 167, 4 ]
[ 203, 41 ]
python
en
['en', 'en', 'en']
True
AzureEventHub._event_to_filtered_event_data
(self, event: Event)
Filter event states and create EventData object.
Filter event states and create EventData object.
def _event_to_filtered_event_data(self, event: Event): """Filter event states and create EventData object.""" state = event.data.get("new_state") if ( state is None or state.state in (STATE_UNKNOWN, "", STATE_UNAVAILABLE) or not self._entities_filter(state.ent...
[ "def", "_event_to_filtered_event_data", "(", "self", ",", "event", ":", "Event", ")", ":", "state", "=", "event", ".", "data", ".", "get", "(", "\"new_state\"", ")", "if", "(", "state", "is", "None", "or", "state", ".", "state", "in", "(", "STATE_UNKNOWN...
[ 205, 4 ]
[ 214, 80 ]
python
en
['en', 'en', 'en']
True
AzureEventHub._get_client
(self)
Get a Event Producer Client.
Get a Event Producer Client.
def _get_client(self): """Get a Event Producer Client.""" if self._conn_str_client: return EventHubProducerClient.from_connection_string( **self._client_args, **ADDITIONAL_ARGS ) return EventHubProducerClient(**self._client_args, **ADDITIONAL_ARGS)
[ "def", "_get_client", "(", "self", ")", ":", "if", "self", ".", "_conn_str_client", ":", "return", "EventHubProducerClient", ".", "from_connection_string", "(", "*", "*", "self", ".", "_client_args", ",", "*", "*", "ADDITIONAL_ARGS", ")", "return", "EventHubProd...
[ 216, 4 ]
[ 222, 77 ]
python
en
['en', 'en', 'en']
True
async_setup
(hass: core.HomeAssistant, config: dict)
Set up the Rollease Acmeda Automate component.
Set up the Rollease Acmeda Automate component.
async def async_setup(hass: core.HomeAssistant, config: dict): """Set up the Rollease Acmeda Automate component.""" return True
[ "async", "def", "async_setup", "(", "hass", ":", "core", ".", "HomeAssistant", ",", "config", ":", "dict", ")", ":", "return", "True" ]
[ 13, 0 ]
[ 15, 15 ]
python
en
['en', 'en', 'en']
True
async_setup_entry
( hass: core.HomeAssistant, config_entry: config_entries.ConfigEntry )
Set up Rollease Acmeda Automate hub from a config entry.
Set up Rollease Acmeda Automate hub from a config entry.
async def async_setup_entry( hass: core.HomeAssistant, config_entry: config_entries.ConfigEntry ): """Set up Rollease Acmeda Automate hub from a config entry.""" hub = PulseHub(hass, config_entry) if not await hub.async_setup(): return False hass.data.setdefault(DOMAIN, {}) hass.data[D...
[ "async", "def", "async_setup_entry", "(", "hass", ":", "core", ".", "HomeAssistant", ",", "config_entry", ":", "config_entries", ".", "ConfigEntry", ")", ":", "hub", "=", "PulseHub", "(", "hass", ",", "config_entry", ")", "if", "not", "await", "hub", ".", ...
[ 18, 0 ]
[ 35, 15 ]
python
en
['en', 'en', 'en']
True
async_unload_entry
( hass: core.HomeAssistant, config_entry: config_entries.ConfigEntry )
Unload a config entry.
Unload a config entry.
async def async_unload_entry( hass: core.HomeAssistant, config_entry: config_entries.ConfigEntry ): """Unload a config entry.""" hub = hass.data[DOMAIN][config_entry.entry_id] unload_ok = all( await asyncio.gather( *[ hass.config_entries.async_forward_entry_unload(co...
[ "async", "def", "async_unload_entry", "(", "hass", ":", "core", ".", "HomeAssistant", ",", "config_entry", ":", "config_entries", ".", "ConfigEntry", ")", ":", "hub", "=", "hass", ".", "data", "[", "DOMAIN", "]", "[", "config_entry", ".", "entry_id", "]", ...
[ 38, 0 ]
[ 58, 20 ]
python
en
['en', 'es', 'en']
True
async_setup_entry
(hass, config_entry, async_add_entities)
Set up the Tesla binary_sensors by config_entry.
Set up the Tesla binary_sensors by config_entry.
async def async_setup_entry(hass, config_entry, async_add_entities): """Set up the Tesla binary_sensors by config_entry.""" coordinator = hass.data[TESLA_DOMAIN][config_entry.entry_id]["coordinator"] entities = [] for device in hass.data[TESLA_DOMAIN][config_entry.entry_id]["devices"]["sensor"]: ...
[ "async", "def", "async_setup_entry", "(", "hass", ",", "config_entry", ",", "async_add_entities", ")", ":", "coordinator", "=", "hass", ".", "data", "[", "TESLA_DOMAIN", "]", "[", "config_entry", ".", "entry_id", "]", "[", "\"coordinator\"", "]", "entities", "...
[ 16, 0 ]
[ 26, 38 ]
python
en
['en', 'en', 'en']
True
TeslaSensor.__init__
(self, tesla_device, coordinator, sensor_type=None)
Initialize of the sensor.
Initialize of the sensor.
def __init__(self, tesla_device, coordinator, sensor_type=None): """Initialize of the sensor.""" super().__init__(tesla_device, coordinator) self.type = sensor_type if self.type: self._name = f"{super().name} ({self.type})" self._unique_id = f"{super().unique_id}_...
[ "def", "__init__", "(", "self", ",", "tesla_device", ",", "coordinator", ",", "sensor_type", "=", "None", ")", ":", "super", "(", ")", ".", "__init__", "(", "tesla_device", ",", "coordinator", ")", "self", ".", "type", "=", "sensor_type", "if", "self", "...
[ 32, 4 ]
[ 38, 64 ]
python
en
['en', 'en', 'en']
True
TeslaSensor.state
(self)
Return the state of the sensor.
Return the state of the sensor.
def state(self) -> Optional[float]: """Return the state of the sensor.""" if self.tesla_device.type == "temperature sensor": if self.type == "outside": return self.tesla_device.get_outside_temp() return self.tesla_device.get_inside_temp() if self.tesla_dev...
[ "def", "state", "(", "self", ")", "->", "Optional", "[", "float", "]", ":", "if", "self", ".", "tesla_device", ".", "type", "==", "\"temperature sensor\"", ":", "if", "self", ".", "type", "==", "\"outside\"", ":", "return", "self", ".", "tesla_device", "...
[ 41, 4 ]
[ 57, 44 ]
python
en
['en', 'en', 'en']
True
TeslaSensor.unit_of_measurement
(self)
Return the unit_of_measurement of the device.
Return the unit_of_measurement of the device.
def unit_of_measurement(self) -> Optional[str]: """Return the unit_of_measurement of the device.""" units = self.tesla_device.measurement if units == "F": return TEMP_FAHRENHEIT if units == "C": return TEMP_CELSIUS if units == "LENGTH_MILES": r...
[ "def", "unit_of_measurement", "(", "self", ")", "->", "Optional", "[", "str", "]", ":", "units", "=", "self", ".", "tesla_device", ".", "measurement", "if", "units", "==", "\"F\"", ":", "return", "TEMP_FAHRENHEIT", "if", "units", "==", "\"C\"", ":", "retur...
[ 60, 4 ]
[ 71, 20 ]
python
en
['en', 'en', 'en']
True
TeslaSensor.device_class
(self)
Return the device_class of the device.
Return the device_class of the device.
def device_class(self) -> Optional[str]: """Return the device_class of the device.""" return ( self.tesla_device.device_class if self.tesla_device.device_class in DEVICE_CLASSES else None )
[ "def", "device_class", "(", "self", ")", "->", "Optional", "[", "str", "]", ":", "return", "(", "self", ".", "tesla_device", ".", "device_class", "if", "self", ".", "tesla_device", ".", "device_class", "in", "DEVICE_CLASSES", "else", "None", ")" ]
[ 74, 4 ]
[ 80, 9 ]
python
en
['en', 'en', 'en']
True
TeslaSensor.device_state_attributes
(self)
Return the state attributes of the device.
Return the state attributes of the device.
def device_state_attributes(self): """Return the state attributes of the device.""" attr = self._attributes.copy() if self.tesla_device.type == "charging rate sensor": attr.update( { "time_left": self.tesla_device.time_left, "ad...
[ "def", "device_state_attributes", "(", "self", ")", ":", "attr", "=", "self", ".", "_attributes", ".", "copy", "(", ")", "if", "self", ".", "tesla_device", ".", "type", "==", "\"charging rate sensor\"", ":", "attr", ".", "update", "(", "{", "\"time_left\"", ...
[ 83, 4 ]
[ 97, 19 ]
python
en
['en', 'en', 'en']
True
OneWireHub.__init__
(self, hass: HomeAssistantType)
Initialize.
Initialize.
def __init__(self, hass: HomeAssistantType): """Initialize.""" self.hass = hass self.type: str = None self.pi1proxy: Pi1Wire = None self.owproxy: protocol._Proxy = None self.devices = None
[ "def", "__init__", "(", "self", ",", "hass", ":", "HomeAssistantType", ")", ":", "self", ".", "hass", "=", "hass", "self", ".", "type", ":", "str", "=", "None", "self", ".", "pi1proxy", ":", "Pi1Wire", "=", "None", "self", ".", "owproxy", ":", "proto...
[ 17, 4 ]
[ 23, 27 ]
python
en
['en', 'en', 'it']
False
OneWireHub.connect
(self, host: str, port: int)
Connect to the owserver host.
Connect to the owserver host.
async def connect(self, host: str, port: int) -> None: """Connect to the owserver host.""" try: self.owproxy = await self.hass.async_add_executor_job( protocol.proxy, host, port ) except protocol.ConnError as exc: raise CannotConnect from exc
[ "async", "def", "connect", "(", "self", ",", "host", ":", "str", ",", "port", ":", "int", ")", "->", "None", ":", "try", ":", "self", ".", "owproxy", "=", "await", "self", ".", "hass", ".", "async_add_executor_job", "(", "protocol", ".", "proxy", ","...
[ 25, 4 ]
[ 32, 40 ]
python
en
['en', 'en', 'en']
True
OneWireHub.check_mount_dir
(self, mount_dir: str)
Test that the mount_dir is a valid path.
Test that the mount_dir is a valid path.
async def check_mount_dir(self, mount_dir: str) -> None: """Test that the mount_dir is a valid path.""" if not await self.hass.async_add_executor_job(os.path.isdir, mount_dir): raise InvalidPath self.pi1proxy = Pi1Wire(mount_dir)
[ "async", "def", "check_mount_dir", "(", "self", ",", "mount_dir", ":", "str", ")", "->", "None", ":", "if", "not", "await", "self", ".", "hass", ".", "async_add_executor_job", "(", "os", ".", "path", ".", "isdir", ",", "mount_dir", ")", ":", "raise", "...
[ 34, 4 ]
[ 38, 42 ]
python
en
['en', 'en', 'en']
True
OneWireHub.initialize
(self, config_entry: ConfigEntry)
Initialize a config entry.
Initialize a config entry.
async def initialize(self, config_entry: ConfigEntry) -> None: """Initialize a config entry.""" self.type = config_entry.data[CONF_TYPE] if self.type == CONF_TYPE_SYSBUS: await self.check_mount_dir(config_entry.data[CONF_MOUNT_DIR]) elif self.type == CONF_TYPE_OWSERVER: ...
[ "async", "def", "initialize", "(", "self", ",", "config_entry", ":", "ConfigEntry", ")", "->", "None", ":", "self", ".", "type", "=", "config_entry", ".", "data", "[", "CONF_TYPE", "]", "if", "self", ".", "type", "==", "CONF_TYPE_SYSBUS", ":", "await", "...
[ 40, 4 ]
[ 49, 37 ]
python
en
['en', 'en', 'en']
True
OneWireHub.discover_devices
(self)
Discover all devices.
Discover all devices.
async def discover_devices(self): """Discover all devices.""" if self.devices is None: if self.type == CONF_TYPE_SYSBUS: self.devices = await self.hass.async_add_executor_job( self.pi1proxy.find_all_sensors ) if self.type == CON...
[ "async", "def", "discover_devices", "(", "self", ")", ":", "if", "self", ".", "devices", "is", "None", ":", "if", "self", ".", "type", "==", "CONF_TYPE_SYSBUS", ":", "self", ".", "devices", "=", "await", "self", ".", "hass", ".", "async_add_executor_job", ...
[ 51, 4 ]
[ 62, 27 ]
python
en
['sv', 'en', 'en']
True
OneWireHub._discover_devices_owserver
(self)
Discover all owserver devices.
Discover all owserver devices.
def _discover_devices_owserver(self): """Discover all owserver devices.""" devices = [] for device_path in self.owproxy.dir(): devices.append( { "path": device_path, "family": self.owproxy.read(f"{device_path}family").decode(), ...
[ "def", "_discover_devices_owserver", "(", "self", ")", ":", "devices", "=", "[", "]", "for", "device_path", "in", "self", ".", "owproxy", ".", "dir", "(", ")", ":", "devices", ".", "append", "(", "{", "\"path\"", ":", "device_path", ",", "\"family\"", ":...
[ 64, 4 ]
[ 75, 22 ]
python
en
['sv', 'en', 'en']
True
setup_platform
(hass, config, add_entities, discovery_info=None)
Set up the Homematic thermostat platform.
Set up the Homematic thermostat platform.
def setup_platform(hass, config, add_entities, discovery_info=None): """Set up the Homematic thermostat platform.""" if discovery_info is None: return devices = [] for conf in discovery_info[ATTR_DISCOVER_DEVICES]: new_device = HMThermostat(conf) devices.append(new_device) ...
[ "def", "setup_platform", "(", "hass", ",", "config", ",", "add_entities", ",", "discovery_info", "=", "None", ")", ":", "if", "discovery_info", "is", "None", ":", "return", "devices", "=", "[", "]", "for", "conf", "in", "discovery_info", "[", "ATTR_DISCOVER_...
[ 33, 0 ]
[ 43, 31 ]
python
en
['en', 'en', 'en']
True
HMThermostat.supported_features
(self)
Return the list of supported features.
Return the list of supported features.
def supported_features(self): """Return the list of supported features.""" return SUPPORT_FLAGS
[ "def", "supported_features", "(", "self", ")", ":", "return", "SUPPORT_FLAGS" ]
[ 50, 4 ]
[ 52, 28 ]
python
en
['en', 'en', 'en']
True
HMThermostat.temperature_unit
(self)
Return the unit of measurement that is used.
Return the unit of measurement that is used.
def temperature_unit(self): """Return the unit of measurement that is used.""" return TEMP_CELSIUS
[ "def", "temperature_unit", "(", "self", ")", ":", "return", "TEMP_CELSIUS" ]
[ 55, 4 ]
[ 57, 27 ]
python
en
['en', 'en', 'en']
True
HMThermostat.hvac_mode
(self)
Return hvac operation ie. heat, cool mode. Need to be one of HVAC_MODE_*.
Return hvac operation ie. heat, cool mode.
def hvac_mode(self): """Return hvac operation ie. heat, cool mode. Need to be one of HVAC_MODE_*. """ if self.target_temperature <= self._hmdevice.OFF_VALUE + 0.5: return HVAC_MODE_OFF if "MANU_MODE" in self._hmdevice.ACTIONNODE: if self._hm_control_mode ...
[ "def", "hvac_mode", "(", "self", ")", ":", "if", "self", ".", "target_temperature", "<=", "self", ".", "_hmdevice", ".", "OFF_VALUE", "+", "0.5", ":", "return", "HVAC_MODE_OFF", "if", "\"MANU_MODE\"", "in", "self", ".", "_hmdevice", ".", "ACTIONNODE", ":", ...
[ 60, 4 ]
[ 75, 29 ]
python
bg
['en', 'bg', 'bg']
True
HMThermostat.hvac_modes
(self)
Return the list of available hvac operation modes. Need to be a subset of HVAC_MODES.
Return the list of available hvac operation modes.
def hvac_modes(self): """Return the list of available hvac operation modes. Need to be a subset of HVAC_MODES. """ if "AUTO_MODE" in self._hmdevice.ACTIONNODE: return [HVAC_MODE_AUTO, HVAC_MODE_HEAT, HVAC_MODE_OFF] return [HVAC_MODE_HEAT, HVAC_MODE_OFF]
[ "def", "hvac_modes", "(", "self", ")", ":", "if", "\"AUTO_MODE\"", "in", "self", ".", "_hmdevice", ".", "ACTIONNODE", ":", "return", "[", "HVAC_MODE_AUTO", ",", "HVAC_MODE_HEAT", ",", "HVAC_MODE_OFF", "]", "return", "[", "HVAC_MODE_HEAT", ",", "HVAC_MODE_OFF", ...
[ 78, 4 ]
[ 85, 46 ]
python
en
['en', 'en', 'en']
True
HMThermostat.preset_mode
(self)
Return the current preset mode, e.g., home, away, temp.
Return the current preset mode, e.g., home, away, temp.
def preset_mode(self): """Return the current preset mode, e.g., home, away, temp.""" if self._data.get("BOOST_MODE", False): return "boost" if not self._hm_control_mode: return None mode = HM_ATTRIBUTE_SUPPORT[HM_CONTROL_MODE][1][self._hm_control_mode] m...
[ "def", "preset_mode", "(", "self", ")", ":", "if", "self", ".", "_data", ".", "get", "(", "\"BOOST_MODE\"", ",", "False", ")", ":", "return", "\"boost\"", "if", "not", "self", ".", "_hm_control_mode", ":", "return", "None", "mode", "=", "HM_ATTRIBUTE_SUPPO...
[ 88, 4 ]
[ 102, 19 ]
python
en
['en', 'pt', 'en']
True
HMThermostat.preset_modes
(self)
Return a list of available preset modes.
Return a list of available preset modes.
def preset_modes(self): """Return a list of available preset modes.""" preset_modes = [] for mode in self._hmdevice.ACTIONNODE: if mode in HM_PRESET_MAP: preset_modes.append(HM_PRESET_MAP[mode]) return preset_modes
[ "def", "preset_modes", "(", "self", ")", ":", "preset_modes", "=", "[", "]", "for", "mode", "in", "self", ".", "_hmdevice", ".", "ACTIONNODE", ":", "if", "mode", "in", "HM_PRESET_MAP", ":", "preset_modes", ".", "append", "(", "HM_PRESET_MAP", "[", "mode", ...
[ 105, 4 ]
[ 111, 27 ]
python
en
['en', 'en', 'en']
True
HMThermostat.current_humidity
(self)
Return the current humidity.
Return the current humidity.
def current_humidity(self): """Return the current humidity.""" for node in HM_HUMI_MAP: if node in self._data: return self._data[node]
[ "def", "current_humidity", "(", "self", ")", ":", "for", "node", "in", "HM_HUMI_MAP", ":", "if", "node", "in", "self", ".", "_data", ":", "return", "self", ".", "_data", "[", "node", "]" ]
[ 114, 4 ]
[ 118, 39 ]
python
en
['en', 'en', 'en']
True
HMThermostat.current_temperature
(self)
Return the current temperature.
Return the current temperature.
def current_temperature(self): """Return the current temperature.""" for node in HM_TEMP_MAP: if node in self._data: return self._data[node]
[ "def", "current_temperature", "(", "self", ")", ":", "for", "node", "in", "HM_TEMP_MAP", ":", "if", "node", "in", "self", ".", "_data", ":", "return", "self", ".", "_data", "[", "node", "]" ]
[ 121, 4 ]
[ 125, 39 ]
python
en
['en', 'la', 'en']
True
HMThermostat.target_temperature
(self)
Return the target temperature.
Return the target temperature.
def target_temperature(self): """Return the target temperature.""" return self._data.get(self._state)
[ "def", "target_temperature", "(", "self", ")", ":", "return", "self", ".", "_data", ".", "get", "(", "self", ".", "_state", ")" ]
[ 128, 4 ]
[ 130, 42 ]
python
en
['en', 'la', 'en']
True
HMThermostat.set_temperature
(self, **kwargs)
Set new target temperature.
Set new target temperature.
def set_temperature(self, **kwargs): """Set new target temperature.""" temperature = kwargs.get(ATTR_TEMPERATURE) if temperature is None: return None self._hmdevice.writeNodeData(self._state, float(temperature))
[ "def", "set_temperature", "(", "self", ",", "*", "*", "kwargs", ")", ":", "temperature", "=", "kwargs", ".", "get", "(", "ATTR_TEMPERATURE", ")", "if", "temperature", "is", "None", ":", "return", "None", "self", ".", "_hmdevice", ".", "writeNodeData", "(",...
[ 132, 4 ]
[ 138, 69 ]
python
en
['en', 'ca', 'en']
True
HMThermostat.set_hvac_mode
(self, hvac_mode)
Set new target hvac mode.
Set new target hvac mode.
def set_hvac_mode(self, hvac_mode): """Set new target hvac mode.""" if hvac_mode == HVAC_MODE_AUTO: self._hmdevice.MODE = self._hmdevice.AUTO_MODE elif hvac_mode == HVAC_MODE_HEAT: self._hmdevice.MODE = self._hmdevice.MANU_MODE elif hvac_mode == HVAC_MODE_OFF: ...
[ "def", "set_hvac_mode", "(", "self", ",", "hvac_mode", ")", ":", "if", "hvac_mode", "==", "HVAC_MODE_AUTO", ":", "self", ".", "_hmdevice", ".", "MODE", "=", "self", ".", "_hmdevice", ".", "AUTO_MODE", "elif", "hvac_mode", "==", "HVAC_MODE_HEAT", ":", "self",...
[ 140, 4 ]
[ 147, 36 ]
python
da
['da', 'su', 'en']
False
HMThermostat.set_preset_mode
(self, preset_mode: str)
Set new preset mode.
Set new preset mode.
def set_preset_mode(self, preset_mode: str) -> None: """Set new preset mode.""" if preset_mode == PRESET_BOOST: self._hmdevice.MODE = self._hmdevice.BOOST_MODE elif preset_mode == PRESET_COMFORT: self._hmdevice.MODE = self._hmdevice.COMFORT_MODE elif preset_mode =...
[ "def", "set_preset_mode", "(", "self", ",", "preset_mode", ":", "str", ")", "->", "None", ":", "if", "preset_mode", "==", "PRESET_BOOST", ":", "self", ".", "_hmdevice", ".", "MODE", "=", "self", ".", "_hmdevice", ".", "BOOST_MODE", "elif", "preset_mode", "...
[ 149, 4 ]
[ 156, 62 ]
python
en
['en', 'sr', 'en']
True
HMThermostat.min_temp
(self)
Return the minimum temperature.
Return the minimum temperature.
def min_temp(self): """Return the minimum temperature.""" return 4.5
[ "def", "min_temp", "(", "self", ")", ":", "return", "4.5" ]
[ 159, 4 ]
[ 161, 18 ]
python
en
['en', 'la', 'en']
True
HMThermostat.max_temp
(self)
Return the maximum temperature.
Return the maximum temperature.
def max_temp(self): """Return the maximum temperature.""" return 30.5
[ "def", "max_temp", "(", "self", ")", ":", "return", "30.5" ]
[ 164, 4 ]
[ 166, 19 ]
python
en
['en', 'la', 'en']
True
HMThermostat.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 0.5
[ "def", "target_temperature_step", "(", "self", ")", ":", "return", "0.5" ]
[ 169, 4 ]
[ 171, 18 ]
python
en
['en', 'en', 'en']
True
HMThermostat._hm_control_mode
(self)
Return Control mode.
Return Control mode.
def _hm_control_mode(self): """Return Control mode.""" if HMIP_CONTROL_MODE in self._data: return self._data[HMIP_CONTROL_MODE] # Homematic return self._data.get("CONTROL_MODE")
[ "def", "_hm_control_mode", "(", "self", ")", ":", "if", "HMIP_CONTROL_MODE", "in", "self", ".", "_data", ":", "return", "self", ".", "_data", "[", "HMIP_CONTROL_MODE", "]", "# Homematic", "return", "self", ".", "_data", ".", "get", "(", "\"CONTROL_MODE\"", "...
[ 174, 4 ]
[ 180, 45 ]
python
en
['en', 'co', 'en']
True
HMThermostat._init_data_struct
(self)
Generate a data dict (self._data) from the Homematic metadata.
Generate a data dict (self._data) from the Homematic metadata.
def _init_data_struct(self): """Generate a data dict (self._data) from the Homematic metadata.""" self._state = next(iter(self._hmdevice.WRITENODE.keys())) self._data[self._state] = None if ( HM_CONTROL_MODE in self._hmdevice.ATTRIBUTENODE or HMIP_CONTROL_MODE in...
[ "def", "_init_data_struct", "(", "self", ")", ":", "self", ".", "_state", "=", "next", "(", "iter", "(", "self", ".", "_hmdevice", ".", "WRITENODE", ".", "keys", "(", ")", ")", ")", "self", ".", "_data", "[", "self", ".", "_state", "]", "=", "None"...
[ 182, 4 ]
[ 194, 35 ]
python
en
['en', 'en', 'en']
True
mock_setup
()
Mock entry setup.
Mock entry setup.
def mock_setup(): """Mock entry setup.""" with patch( "homeassistant.components.islamic_prayer_times.async_setup_entry", return_value=True, ): yield
[ "def", "mock_setup", "(", ")", ":", "with", "patch", "(", "\"homeassistant.components.islamic_prayer_times.async_setup_entry\"", ",", "return_value", "=", "True", ",", ")", ":", "yield" ]
[ 12, 0 ]
[ 18, 13 ]
python
en
['en', 'da', 'en']
True
test_flow_works
(hass)
Test user config.
Test user config.
async def test_flow_works(hass): """Test user config.""" result = await hass.config_entries.flow.async_init( islamic_prayer_times.DOMAIN, context={"source": "user"} ) assert result["type"] == data_entry_flow.RESULT_TYPE_FORM assert result["step_id"] == "user" result = await hass.config_...
[ "async", "def", "test_flow_works", "(", "hass", ")", ":", "result", "=", "await", "hass", ".", "config_entries", ".", "flow", ".", "async_init", "(", "islamic_prayer_times", ".", "DOMAIN", ",", "context", "=", "{", "\"source\"", ":", "\"user\"", "}", ")", ...
[ 21, 0 ]
[ 33, 52 ]
python
en
['en', 'da', 'en']
True
test_options
(hass)
Test updating options.
Test updating options.
async def test_options(hass): """Test updating options.""" entry = MockConfigEntry( domain=DOMAIN, title="Islamic Prayer Times", data={}, options={CONF_CALC_METHOD: "isna"}, ) entry.add_to_hass(hass) result = await hass.config_entries.options.async_init(entry.entry_i...
[ "async", "def", "test_options", "(", "hass", ")", ":", "entry", "=", "MockConfigEntry", "(", "domain", "=", "DOMAIN", ",", "title", "=", "\"Islamic Prayer Times\"", ",", "data", "=", "{", "}", ",", "options", "=", "{", "CONF_CALC_METHOD", ":", "\"isna\"", ...
[ 36, 0 ]
[ 56, 55 ]
python
en
['en', 'en', 'en']
True
test_import
(hass)
Test import step.
Test import step.
async def test_import(hass): """Test import step.""" result = await hass.config_entries.flow.async_init( islamic_prayer_times.DOMAIN, context={"source": "import"}, data={CONF_CALC_METHOD: "makkah"}, ) assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY assert r...
[ "async", "def", "test_import", "(", "hass", ")", ":", "result", "=", "await", "hass", ".", "config_entries", ".", "flow", ".", "async_init", "(", "islamic_prayer_times", ".", "DOMAIN", ",", "context", "=", "{", "\"source\"", ":", "\"import\"", "}", ",", "d...
[ 59, 0 ]
[ 69, 55 ]
python
de
['de', 'sd', 'en']
False
test_integration_already_configured
(hass)
Test integration is already configured.
Test integration is already configured.
async def test_integration_already_configured(hass): """Test integration is already configured.""" entry = MockConfigEntry( domain=DOMAIN, data={}, options={}, ) entry.add_to_hass(hass) result = await hass.config_entries.flow.async_init( islamic_prayer_times.DOMAIN, c...
[ "async", "def", "test_integration_already_configured", "(", "hass", ")", ":", "entry", "=", "MockConfigEntry", "(", "domain", "=", "DOMAIN", ",", "data", "=", "{", "}", ",", "options", "=", "{", "}", ",", ")", "entry", ".", "add_to_hass", "(", "hass", ")...
[ 72, 0 ]
[ 85, 56 ]
python
en
['en', 'en', 'en']
True
setup
(hass, config)
Set up the Amcrest IP Camera component.
Set up the Amcrest IP Camera component.
def setup(hass, config): """Set up the Amcrest IP Camera component.""" hass.data.setdefault(DATA_AMCREST, {DEVICES: {}, CAMERAS: []}) for device in config[DOMAIN]: name = device[CONF_NAME] username = device[CONF_USERNAME] password = device[CONF_PASSWORD] api = AmcrestChecke...
[ "def", "setup", "(", "hass", ",", "config", ")", ":", "hass", ".", "data", ".", "setdefault", "(", "DATA_AMCREST", ",", "{", "DEVICES", ":", "{", "}", ",", "CAMERAS", ":", "[", "]", "}", ")", "for", "device", "in", "config", "[", "DOMAIN", "]", "...
[ 224, 0 ]
[ 330, 15 ]
python
en
['en', 'da', 'en']
True
AmcrestChecker.__init__
(self, hass, name, host, port, user, password)
Initialize.
Initialize.
def __init__(self, hass, name, host, port, user, password): """Initialize.""" self._hass = hass self._wrap_name = name self._wrap_errors = 0 self._wrap_lock = threading.Lock() self._wrap_login_err = False self._wrap_event_flag = threading.Event() self._wra...
[ "def", "__init__", "(", "self", ",", "hass", ",", "name", ",", "host", ",", "port", ",", "user", ",", "password", ")", ":", "self", ".", "_hass", "=", "hass", "self", ".", "_wrap_name", "=", "name", "self", ".", "_wrap_errors", "=", "0", "self", "....
[ 118, 4 ]
[ 135, 9 ]
python
en
['en', 'en', 'it']
False