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_lights_turn_on_when_coming_home_after_sun_set_person
(hass, scanner)
Test lights turn on when coming home after sun set.
Test lights turn on when coming home after sun set.
async def test_lights_turn_on_when_coming_home_after_sun_set_person(hass, scanner): """Test lights turn on when coming home after sun set.""" device_1 = f"{DOMAIN}.device_1" device_2 = f"{DOMAIN}.device_2" test_time = datetime(2017, 4, 5, 3, 2, 3, tzinfo=dt_util.UTC) with patch("homeassistant.util....
[ "async", "def", "test_lights_turn_on_when_coming_home_after_sun_set_person", "(", "hass", ",", "scanner", ")", ":", "device_1", "=", "f\"{DOMAIN}.device_1\"", "device_2", "=", "f\"{DOMAIN}.device_2\"", "test_time", "=", "datetime", "(", "2017", ",", "4", ",", "5", ","...
[ 151, 0 ]
[ 219, 59 ]
python
en
['en', 'en', 'en']
True
test_initialize_start
(hass)
Test we initialize when HA starts.
Test we initialize when HA starts.
async def test_initialize_start(hass): """Test we initialize when HA starts.""" hass.state = CoreState.not_running assert await async_setup_component( hass, device_sun_light_trigger.DOMAIN, {device_sun_light_trigger.DOMAIN: {}}, ) with patch( "homeassistant.component...
[ "async", "def", "test_initialize_start", "(", "hass", ")", ":", "hass", ".", "state", "=", "CoreState", ".", "not_running", "assert", "await", "async_setup_component", "(", "hass", ",", "device_sun_light_trigger", ".", "DOMAIN", ",", "{", "device_sun_light_trigger",...
[ 222, 0 ]
[ 237, 45 ]
python
en
['en', 'en', 'en']
True
light_mock_data_fixture
()
Create light mock data.
Create light mock data.
def light_mock_data_fixture() -> None: """Create light mock data.""" sys_info = { "sw_ver": "1.2.3", "hw_ver": "2.3.4", "mac": "aa:bb:cc:dd:ee:ff", "mic_mac": "00:11:22:33:44", "type": "light", "hwId": "1234", "fwId": "4567", "oemId": "891011", ...
[ "def", "light_mock_data_fixture", "(", ")", "->", "None", ":", "sys_info", "=", "{", "\"sw_ver\"", ":", "\"1.2.3\"", ",", "\"hw_ver\"", ":", "\"2.3.4\"", ",", "\"mac\"", ":", "\"aa:bb:cc:dd:ee:ff\"", ",", "\"mic_mac\"", ":", "\"00:11:22:33:44\"", ",", "\"type\"", ...
[ 63, 0 ]
[ 170, 9 ]
python
en
['es', 'no', 'en']
False
dimmer_switch_mock_data_fixture
()
Create dimmer switch mock data.
Create dimmer switch mock data.
def dimmer_switch_mock_data_fixture() -> None: """Create dimmer switch mock data.""" sys_info = { "sw_ver": "1.2.3", "hw_ver": "2.3.4", "mac": "aa:bb:cc:dd:ee:ff", "mic_mac": "00:11:22:33:44", "type": "switch", "hwId": "1234", "fwId": "4567", "oemI...
[ "def", "dimmer_switch_mock_data_fixture", "(", ")", "->", "None", ":", "sys_info", "=", "{", "\"sw_ver\"", ":", "\"1.2.3\"", ",", "\"hw_ver\"", ":", "\"2.3.4\"", ",", "\"mac\"", ":", "\"aa:bb:cc:dd:ee:ff\"", ",", "\"mic_mac\"", ":", "\"00:11:22:33:44\"", ",", "\"t...
[ 174, 0 ]
[ 238, 9 ]
python
en
['en', 'en', 'it']
True
update_entity
(hass: HomeAssistant, entity_id: str)
Run an update action for an entity.
Run an update action for an entity.
async def update_entity(hass: HomeAssistant, entity_id: str) -> None: """Run an update action for an entity.""" await hass.services.async_call( HA_DOMAIN, SERVICE_UPDATE_ENTITY, {ATTR_ENTITY_ID: entity_id}, blocking=True, ) await hass.async_block_till_done()
[ "async", "def", "update_entity", "(", "hass", ":", "HomeAssistant", ",", "entity_id", ":", "str", ")", "->", "None", ":", "await", "hass", ".", "services", ".", "async_call", "(", "HA_DOMAIN", ",", "SERVICE_UPDATE_ENTITY", ",", "{", "ATTR_ENTITY_ID", ":", "e...
[ 241, 0 ]
[ 249, 38 ]
python
en
['br', 'en', 'en']
True
test_smartswitch
( hass: HomeAssistant, dimmer_switch_mock_data: SmartSwitchMockData )
Test function.
Test function.
async def test_smartswitch( hass: HomeAssistant, dimmer_switch_mock_data: SmartSwitchMockData ) -> None: """Test function.""" sys_info = dimmer_switch_mock_data.sys_info await async_setup_component(hass, HA_DOMAIN, {}) await hass.async_block_till_done() await async_setup_component( has...
[ "async", "def", "test_smartswitch", "(", "hass", ":", "HomeAssistant", ",", "dimmer_switch_mock_data", ":", "SmartSwitchMockData", ")", "->", "None", ":", "sys_info", "=", "dimmer_switch_mock_data", ".", "sys_info", "await", "async_setup_component", "(", "hass", ",", ...
[ 252, 0 ]
[ 342, 39 ]
python
en
['en', 'en', 'en']
False
test_light
(hass: HomeAssistant, light_mock_data: LightMockData)
Test function.
Test function.
async def test_light(hass: HomeAssistant, light_mock_data: LightMockData) -> None: """Test function.""" light_state = light_mock_data.light_state set_light_state = light_mock_data.set_light_state await async_setup_component(hass, HA_DOMAIN, {}) await hass.async_block_till_done() await async_se...
[ "async", "def", "test_light", "(", "hass", ":", "HomeAssistant", ",", "light_mock_data", ":", "LightMockData", ")", "->", "None", ":", "light_state", "=", "light_mock_data", ".", "light_state", "set_light_state", "=", "light_mock_data", ".", "set_light_state", "awai...
[ 345, 0 ]
[ 457, 48 ]
python
en
['en', 'en', 'en']
False
test_get_light_state_retry
( hass: HomeAssistant, light_mock_data: LightMockData )
Test function.
Test function.
async def test_get_light_state_retry( hass: HomeAssistant, light_mock_data: LightMockData ) -> None: """Test function.""" # Setup test for retries for sysinfo. get_sysinfo_call_count = 0 def get_sysinfo_side_effect(): nonlocal get_sysinfo_call_count get_sysinfo_call_count += 1 ...
[ "async", "def", "test_get_light_state_retry", "(", "hass", ":", "HomeAssistant", ",", "light_mock_data", ":", "LightMockData", ")", "->", "None", ":", "# Setup test for retries for sysinfo.", "get_sysinfo_call_count", "=", "0", "def", "get_sysinfo_side_effect", "(", ")", ...
[ 460, 0 ]
[ 526, 63 ]
python
en
['en', 'en', 'en']
False
test_update_failure
( hass: HomeAssistant, light_mock_data: LightMockData, caplog )
Test that update failures are logged.
Test that update failures are logged.
async def test_update_failure( hass: HomeAssistant, light_mock_data: LightMockData, caplog ): """Test that update failures are logged.""" await async_setup_component(hass, HA_DOMAIN, {}) await hass.async_block_till_done() await async_setup_component( hass, tplink.DOMAIN, { ...
[ "async", "def", "test_update_failure", "(", "hass", ":", "HomeAssistant", ",", "light_mock_data", ":", "LightMockData", ",", "caplog", ")", ":", "await", "async_setup_component", "(", "hass", ",", "HA_DOMAIN", ",", "{", "}", ")", "await", "hass", ".", "async_b...
[ 529, 0 ]
[ 581, 78 ]
python
en
['en', 'en', 'en']
True
test_async_setup_entry_unavailable
( hass: HomeAssistant, light_mock_data: LightMockData, caplog )
Test unavailable devices trigger a later retry.
Test unavailable devices trigger a later retry.
async def test_async_setup_entry_unavailable( hass: HomeAssistant, light_mock_data: LightMockData, caplog ): """Test unavailable devices trigger a later retry.""" caplog.clear() caplog.set_level(logging.WARNING) with patch( "homeassistant.components.tplink.common.SmartDevice.get_sysinfo", ...
[ "async", "def", "test_async_setup_entry_unavailable", "(", "hass", ":", "HomeAssistant", ",", "light_mock_data", ":", "LightMockData", ",", "caplog", ")", ":", "caplog", ".", "clear", "(", ")", "caplog", ".", "set_level", "(", "logging", ".", "WARNING", ")", "...
[ 584, 0 ]
[ 615, 42 ]
python
ca
['ca', 'en', 'it']
False
random_archi_generator
(nas_ss, random_state)
random
random
def random_archi_generator(nas_ss, random_state): '''random ''' chosen_arch = {} for key, val in nas_ss.items(): assert val['_type'] in ['layer_choice', 'input_choice'], \ "Random NAS Tuner only receives NAS search space whose _type is 'layer_choice' or 'input_choice'" if val...
[ "def", "random_archi_generator", "(", "nas_ss", ",", "random_state", ")", ":", "chosen_arch", "=", "{", "}", "for", "key", ",", "val", "in", "nas_ss", ".", "items", "(", ")", ":", "assert", "val", "[", "'_type'", "]", "in", "[", "'layer_choice'", ",", ...
[ 5, 0 ]
[ 28, 22 ]
python
en
['en', 'mn', 'en']
False
RandomNASTuner.update_search_space
(self, search_space)
update
update
def update_search_space(self, search_space): '''update ''' self.searchspace_json = search_space self.random_state = np.random.RandomState()
[ "def", "update_search_space", "(", "self", ",", "search_space", ")", ":", "self", ".", "searchspace_json", "=", "search_space", "self", ".", "random_state", "=", "np", ".", "random", ".", "RandomState", "(", ")" ]
[ 39, 4 ]
[ 43, 51 ]
python
co
['en', 'co', 'sw']
False
RandomNASTuner.generate_parameters
(self, parameter_id, **kwargs)
generate
generate
def generate_parameters(self, parameter_id, **kwargs): '''generate ''' return random_archi_generator(self.searchspace_json, self.random_state)
[ "def", "generate_parameters", "(", "self", ",", "parameter_id", ",", "*", "*", "kwargs", ")", ":", "return", "random_archi_generator", "(", "self", ".", "searchspace_json", ",", "self", ".", "random_state", ")" ]
[ 45, 4 ]
[ 48, 79 ]
python
en
['en', 'la', 'en']
False
RandomNASTuner.receive_trial_result
(self, parameter_id, parameters, value, **kwargs)
receive
receive
def receive_trial_result(self, parameter_id, parameters, value, **kwargs): '''receive ''' pass
[ "def", "receive_trial_result", "(", "self", ",", "parameter_id", ",", "parameters", ",", "value", ",", "*", "*", "kwargs", ")", ":", "pass" ]
[ 50, 4 ]
[ 53, 12 ]
python
en
['en', 'sr', 'en']
False
_async_reproduce_state
( hass: HomeAssistantType, state: State, *, context: Optional[Context] = None, reproduce_options: Optional[Dict[str, Any]] = None, )
Reproduce a single state.
Reproduce a single state.
async def _async_reproduce_state( hass: HomeAssistantType, state: State, *, context: Optional[Context] = None, reproduce_options: Optional[Dict[str, Any]] = None, ) -> None: """Reproduce a single state.""" cur_state = hass.states.get(state.entity_id) if cur_state is None: _LOGGE...
[ "async", "def", "_async_reproduce_state", "(", "hass", ":", "HomeAssistantType", ",", "state", ":", "State", ",", "*", ",", "context", ":", "Optional", "[", "Context", "]", "=", "None", ",", "reproduce_options", ":", "Optional", "[", "Dict", "[", "str", ",...
[ 42, 0 ]
[ 94, 9 ]
python
en
['en', 'en', 'en']
True
async_reproduce_states
( hass: HomeAssistantType, states: Iterable[State], *, context: Optional[Context] = None, reproduce_options: Optional[Dict[str, Any]] = None, )
Reproduce Vacuum states.
Reproduce Vacuum states.
async def async_reproduce_states( hass: HomeAssistantType, states: Iterable[State], *, context: Optional[Context] = None, reproduce_options: Optional[Dict[str, Any]] = None, ) -> None: """Reproduce Vacuum states.""" # Reproduce states in parallel. await asyncio.gather( *( ...
[ "async", "def", "async_reproduce_states", "(", "hass", ":", "HomeAssistantType", ",", "states", ":", "Iterable", "[", "State", "]", ",", "*", ",", "context", ":", "Optional", "[", "Context", "]", "=", "None", ",", "reproduce_options", ":", "Optional", "[", ...
[ 97, 0 ]
[ 113, 5 ]
python
de
['de', 'la', 'en']
False
dimmer_fixture
()
Return a default light entity mock.
Return a default light entity mock.
def dimmer_fixture(): """Return a default light entity mock.""" feature = mock_feature( "lights", blebox_uniapi.light.Light, unique_id="BleBox-dimmerBox-1afe34e750b8-brightness", full_name="dimmerBox-brightness", device_class=None, brightness=65, is_on=Tr...
[ "def", "dimmer_fixture", "(", ")", ":", "feature", "=", "mock_feature", "(", "\"lights\"", ",", "blebox_uniapi", ".", "light", ".", "Light", ",", "unique_id", "=", "\"BleBox-dimmerBox-1afe34e750b8-brightness\"", ",", "full_name", "=", "\"dimmerBox-brightness\"", ",", ...
[ 32, 0 ]
[ 49, 50 ]
python
en
['en', 'da', 'en']
True
test_dimmer_init
(dimmer, hass, config)
Test cover default state.
Test cover default state.
async def test_dimmer_init(dimmer, hass, config): """Test cover default state.""" _, entity_id = dimmer entry = await async_setup_entity(hass, config, entity_id) assert entry.unique_id == "BleBox-dimmerBox-1afe34e750b8-brightness" state = hass.states.get(entity_id) assert state.name == "dimmer...
[ "async", "def", "test_dimmer_init", "(", "dimmer", ",", "hass", ",", "config", ")", ":", "_", ",", "entity_id", "=", "dimmer", "entry", "=", "await", "async_setup_entity", "(", "hass", ",", "config", ",", "entity_id", ")", "assert", "entry", ".", "unique_i...
[ 52, 0 ]
[ 75, 38 ]
python
en
['da', 'en', 'en']
True
test_dimmer_update
(dimmer, hass, config)
Test light updating.
Test light updating.
async def test_dimmer_update(dimmer, hass, config): """Test light updating.""" feature_mock, entity_id = dimmer def initial_update(): feature_mock.brightness = 53 feature_mock.async_update = AsyncMock(side_effect=initial_update) await async_setup_entity(hass, config, entity_id) state...
[ "async", "def", "test_dimmer_update", "(", "dimmer", ",", "hass", ",", "config", ")", ":", "feature_mock", ",", "entity_id", "=", "dimmer", "def", "initial_update", "(", ")", ":", "feature_mock", ".", "brightness", "=", "53", "feature_mock", ".", "async_update...
[ 78, 0 ]
[ 91, 34 ]
python
en
['en', 'no', 'en']
True
test_dimmer_on
(dimmer, hass, config)
Test light on.
Test light on.
async def test_dimmer_on(dimmer, hass, config): """Test light on.""" feature_mock, entity_id = dimmer def initial_update(): feature_mock.is_on = False feature_mock.brightness = 0 # off feature_mock.sensible_on_value = 254 feature_mock.async_update = AsyncMock(side_effect=init...
[ "async", "def", "test_dimmer_on", "(", "dimmer", ",", "hass", ",", "config", ")", ":", "feature_mock", ",", "entity_id", "=", "dimmer", "def", "initial_update", "(", ")", ":", "feature_mock", ".", "is_on", "=", "False", "feature_mock", ".", "brightness", "="...
[ 94, 0 ]
[ 126, 51 ]
python
en
['en', 'et', 'en']
True
test_dimmer_on_with_brightness
(dimmer, hass, config)
Test light on with a brightness value.
Test light on with a brightness value.
async def test_dimmer_on_with_brightness(dimmer, hass, config): """Test light on with a brightness value.""" feature_mock, entity_id = dimmer def initial_update(): feature_mock.is_on = False feature_mock.brightness = 0 # off feature_mock.sensible_on_value = 254 feature_mock.a...
[ "async", "def", "test_dimmer_on_with_brightness", "(", "dimmer", ",", "hass", ",", "config", ")", ":", "feature_mock", ",", "entity_id", "=", "dimmer", "def", "initial_update", "(", ")", ":", "feature_mock", ".", "is_on", "=", "False", "feature_mock", ".", "br...
[ 129, 0 ]
[ 167, 34 ]
python
en
['en', 'en', 'en']
True
test_dimmer_off
(dimmer, hass, config)
Test light off.
Test light off.
async def test_dimmer_off(dimmer, hass, config): """Test light off.""" feature_mock, entity_id = dimmer def initial_update(): feature_mock.is_on = True feature_mock.async_update = AsyncMock(side_effect=initial_update) await async_setup_entity(hass, config, entity_id) feature_mock.asyn...
[ "async", "def", "test_dimmer_off", "(", "dimmer", ",", "hass", ",", "config", ")", ":", "feature_mock", ",", "entity_id", "=", "dimmer", "def", "initial_update", "(", ")", ":", "feature_mock", ".", "is_on", "=", "True", "feature_mock", ".", "async_update", "...
[ 170, 0 ]
[ 199, 50 ]
python
en
['en', 'lb', 'en']
True
wlightboxs_fixture
()
Return a default light entity mock.
Return a default light entity mock.
def wlightboxs_fixture(): """Return a default light entity mock.""" feature = mock_feature( "lights", blebox_uniapi.light.Light, unique_id="BleBox-wLightBoxS-1afe34e750b8-color", full_name="wLightBoxS-color", device_class=None, brightness=None, is_on=None...
[ "def", "wlightboxs_fixture", "(", ")", ":", "feature", "=", "mock_feature", "(", "\"lights\"", ",", "blebox_uniapi", ".", "light", ".", "Light", ",", "unique_id", "=", "\"BleBox-wLightBoxS-1afe34e750b8-color\"", ",", "full_name", "=", "\"wLightBoxS-color\"", ",", "d...
[ 203, 0 ]
[ 220, 46 ]
python
en
['en', 'da', 'en']
True
test_wlightbox_s_init
(wlightbox_s, hass, config)
Test cover default state.
Test cover default state.
async def test_wlightbox_s_init(wlightbox_s, hass, config): """Test cover default state.""" _, entity_id = wlightbox_s entry = await async_setup_entity(hass, config, entity_id) assert entry.unique_id == "BleBox-wLightBoxS-1afe34e750b8-color" state = hass.states.get(entity_id) assert state.name...
[ "async", "def", "test_wlightbox_s_init", "(", "wlightbox_s", ",", "hass", ",", "config", ")", ":", "_", ",", "entity_id", "=", "wlightbox_s", "entry", "=", "await", "async_setup_entity", "(", "hass", ",", "config", ",", "entity_id", ")", "assert", "entry", "...
[ 223, 0 ]
[ 246, 38 ]
python
en
['da', 'en', 'en']
True
test_wlightbox_s_update
(wlightbox_s, hass, config)
Test light updating.
Test light updating.
async def test_wlightbox_s_update(wlightbox_s, hass, config): """Test light updating.""" feature_mock, entity_id = wlightbox_s def initial_update(): feature_mock.brightness = 0xAB feature_mock.is_on = True feature_mock.async_update = AsyncMock(side_effect=initial_update) await as...
[ "async", "def", "test_wlightbox_s_update", "(", "wlightbox_s", ",", "hass", ",", "config", ")", ":", "feature_mock", ",", "entity_id", "=", "wlightbox_s", "def", "initial_update", "(", ")", ":", "feature_mock", ".", "brightness", "=", "0xAB", "feature_mock", "."...
[ 249, 0 ]
[ 264, 52 ]
python
en
['en', 'no', 'en']
True
test_wlightbox_s_on
(wlightbox_s, hass, config)
Test light on.
Test light on.
async def test_wlightbox_s_on(wlightbox_s, hass, config): """Test light on.""" feature_mock, entity_id = wlightbox_s def initial_update(): feature_mock.is_on = False feature_mock.sensible_on_value = 254 feature_mock.async_update = AsyncMock(side_effect=initial_update) await async_...
[ "async", "def", "test_wlightbox_s_on", "(", "wlightbox_s", ",", "hass", ",", "config", ")", ":", "feature_mock", ",", "entity_id", "=", "wlightbox_s", "def", "initial_update", "(", ")", ":", "feature_mock", ".", "is_on", "=", "False", "feature_mock", ".", "sen...
[ 267, 0 ]
[ 298, 34 ]
python
en
['en', 'et', 'en']
True
wlightbox_fixture
()
Return a default light entity mock.
Return a default light entity mock.
def wlightbox_fixture(): """Return a default light entity mock.""" feature = mock_feature( "lights", blebox_uniapi.light.Light, unique_id="BleBox-wLightBox-1afe34e750b8-color", full_name="wLightBox-color", device_class=None, is_on=None, supports_color=Tru...
[ "def", "wlightbox_fixture", "(", ")", ":", "feature", "=", "mock_feature", "(", "\"lights\"", ",", "blebox_uniapi", ".", "light", ".", "Light", ",", "unique_id", "=", "\"BleBox-wLightBox-1afe34e750b8-color\"", ",", "full_name", "=", "\"wLightBox-color\"", ",", "devi...
[ 302, 0 ]
[ 320, 45 ]
python
en
['en', 'da', 'en']
True
test_wlightbox_init
(wlightbox, hass, config)
Test cover default state.
Test cover default state.
async def test_wlightbox_init(wlightbox, hass, config): """Test cover default state.""" _, entity_id = wlightbox entry = await async_setup_entity(hass, config, entity_id) assert entry.unique_id == "BleBox-wLightBox-1afe34e750b8-color" state = hass.states.get(entity_id) assert state.name == "wL...
[ "async", "def", "test_wlightbox_init", "(", "wlightbox", ",", "hass", ",", "config", ")", ":", "_", ",", "entity_id", "=", "wlightbox", "entry", "=", "await", "async_setup_entity", "(", "hass", ",", "config", ",", "entity_id", ")", "assert", "entry", ".", ...
[ 323, 0 ]
[ 349, 38 ]
python
en
['da', 'en', 'en']
True
test_wlightbox_update
(wlightbox, hass, config)
Test light updating.
Test light updating.
async def test_wlightbox_update(wlightbox, hass, config): """Test light updating.""" feature_mock, entity_id = wlightbox def initial_update(): feature_mock.is_on = True feature_mock.rgbw_hex = "fa00203A" feature_mock.white_value = 0x3A feature_mock.async_update = AsyncMock(sid...
[ "async", "def", "test_wlightbox_update", "(", "wlightbox", ",", "hass", ",", "config", ")", ":", "feature_mock", ",", "entity_id", "=", "wlightbox", "def", "initial_update", "(", ")", ":", "feature_mock", ".", "is_on", "=", "True", "feature_mock", ".", "rgbw_h...
[ 352, 0 ]
[ 368, 34 ]
python
en
['en', 'no', 'en']
True
test_wlightbox_on_via_just_whiteness
(wlightbox, hass, config)
Test light on.
Test light on.
async def test_wlightbox_on_via_just_whiteness(wlightbox, hass, config): """Test light on.""" feature_mock, entity_id = wlightbox def initial_update(): feature_mock.is_on = False feature_mock.async_update = AsyncMock(side_effect=initial_update) await async_setup_entity(hass, config, entit...
[ "async", "def", "test_wlightbox_on_via_just_whiteness", "(", "wlightbox", ",", "hass", ",", "config", ")", ":", "feature_mock", ",", "entity_id", "=", "wlightbox", "def", "initial_update", "(", ")", ":", "feature_mock", ".", "is_on", "=", "False", "feature_mock", ...
[ 371, 0 ]
[ 414, 85 ]
python
en
['en', 'et', 'en']
True
test_wlightbox_on_via_reset_whiteness
(wlightbox, hass, config)
Test light on.
Test light on.
async def test_wlightbox_on_via_reset_whiteness(wlightbox, hass, config): """Test light on.""" feature_mock, entity_id = wlightbox def initial_update(): feature_mock.is_on = False feature_mock.async_update = AsyncMock(side_effect=initial_update) await async_setup_entity(hass, config, enti...
[ "async", "def", "test_wlightbox_on_via_reset_whiteness", "(", "wlightbox", ",", "hass", ",", "config", ")", ":", "feature_mock", ",", "entity_id", "=", "wlightbox", "def", "initial_update", "(", ")", ":", "feature_mock", ".", "is_on", "=", "False", "feature_mock",...
[ 417, 0 ]
[ 459, 85 ]
python
en
['en', 'et', 'en']
True
test_wlightbox_on_via_just_hsl_color
(wlightbox, hass, config)
Test light on.
Test light on.
async def test_wlightbox_on_via_just_hsl_color(wlightbox, hass, config): """Test light on.""" feature_mock, entity_id = wlightbox def initial_update(): feature_mock.is_on = False feature_mock.rgbw_hex = "00000000" feature_mock.async_update = AsyncMock(side_effect=initial_update) a...
[ "async", "def", "test_wlightbox_on_via_just_hsl_color", "(", "wlightbox", ",", "hass", ",", "config", ")", ":", "feature_mock", ",", "entity_id", "=", "wlightbox", "def", "initial_update", "(", ")", ":", "feature_mock", ".", "is_on", "=", "False", "feature_mock", ...
[ 462, 0 ]
[ 506, 34 ]
python
en
['en', 'et', 'en']
True
test_wlightbox_on_to_last_color
(wlightbox, hass, config)
Test light on.
Test light on.
async def test_wlightbox_on_to_last_color(wlightbox, hass, config): """Test light on.""" feature_mock, entity_id = wlightbox def initial_update(): feature_mock.is_on = False feature_mock.async_update = AsyncMock(side_effect=initial_update) await async_setup_entity(hass, config, entity_id)...
[ "async", "def", "test_wlightbox_on_to_last_color", "(", "wlightbox", ",", "hass", ",", "config", ")", ":", "feature_mock", ",", "entity_id", "=", "wlightbox", "def", "initial_update", "(", ")", ":", "feature_mock", ".", "is_on", "=", "False", "feature_mock", "."...
[ 509, 0 ]
[ 543, 34 ]
python
en
['en', 'et', 'en']
True
test_wlightbox_off
(wlightbox, hass, config)
Test light off.
Test light off.
async def test_wlightbox_off(wlightbox, hass, config): """Test light off.""" feature_mock, entity_id = wlightbox def initial_update(): feature_mock.is_on = True feature_mock.async_update = AsyncMock(side_effect=initial_update) await async_setup_entity(hass, config, entity_id) feature_...
[ "async", "def", "test_wlightbox_off", "(", "wlightbox", ",", "hass", ",", "config", ")", ":", "feature_mock", ",", "entity_id", "=", "wlightbox", "def", "initial_update", "(", ")", ":", "feature_mock", ".", "is_on", "=", "True", "feature_mock", ".", "async_upd...
[ 546, 0 ]
[ 578, 35 ]
python
en
['en', 'lb', 'en']
True
test_update_failure
(feature, hass, config, caplog)
Test that update failures are logged.
Test that update failures are logged.
async def test_update_failure(feature, hass, config, caplog): """Test that update failures are logged.""" caplog.set_level(logging.ERROR) feature_mock, entity_id = feature feature_mock.async_update = AsyncMock(side_effect=blebox_uniapi.error.ClientError) await async_setup_entity(hass, config, enti...
[ "async", "def", "test_update_failure", "(", "feature", ",", "hass", ",", "config", ",", "caplog", ")", ":", "caplog", ".", "set_level", "(", "logging", ".", "ERROR", ")", "feature_mock", ",", "entity_id", "=", "feature", "feature_mock", ".", "async_update", ...
[ 582, 0 ]
[ 591, 73 ]
python
en
['en', 'en', 'en']
True
test_turn_on_failure
(feature, hass, config, caplog)
Test that turn_on failures are logged.
Test that turn_on failures are logged.
async def test_turn_on_failure(feature, hass, config, caplog): """Test that turn_on failures are logged.""" caplog.set_level(logging.ERROR) feature_mock, entity_id = feature feature_mock.async_on = AsyncMock(side_effect=blebox_uniapi.error.BadOnValueError) await async_setup_entity(hass, config, en...
[ "async", "def", "test_turn_on_failure", "(", "feature", ",", "hass", ",", "config", ",", "caplog", ")", ":", "caplog", ".", "set_level", "(", "logging", ".", "ERROR", ")", "feature_mock", ",", "entity_id", "=", "feature", "feature_mock", ".", "async_on", "="...
[ 595, 0 ]
[ 614, 5 ]
python
en
['en', 'en', 'en']
True
cls
()
Patch debounce decorator during import of type_covers.
Patch debounce decorator during import of type_covers.
def cls(): """Patch debounce decorator during import of type_covers.""" patcher = patch_debounce() patcher.start() _import = __import__( "homeassistant.components.homekit.type_covers", fromlist=["GarageDoorOpener", "WindowCovering", "WindowCoveringBasic"], ) patcher_tuple = named...
[ "def", "cls", "(", ")", ":", "patcher", "=", "patch_debounce", "(", ")", "patcher", ".", "start", "(", ")", "_import", "=", "__import__", "(", "\"homeassistant.components.homekit.type_covers\"", ",", "fromlist", "=", "[", "\"GarageDoorOpener\"", ",", "\"WindowCove...
[ 46, 0 ]
[ 63, 18 ]
python
en
['en', 'en', 'en']
True
test_garage_door_open_close
(hass, hk_driver, cls, events)
Test if accessory and HA are updated accordingly.
Test if accessory and HA are updated accordingly.
async def test_garage_door_open_close(hass, hk_driver, cls, events): """Test if accessory and HA are updated accordingly.""" entity_id = "cover.garage_door" hass.states.async_set(entity_id, None) await hass.async_block_till_done() acc = cls.garage(hass, hk_driver, "Garage Door", entity_id, 2, None)...
[ "async", "def", "test_garage_door_open_close", "(", "hass", ",", "hk_driver", ",", "cls", ",", "events", ")", ":", "entity_id", "=", "\"cover.garage_door\"", "hass", ".", "states", ".", "async_set", "(", "entity_id", ",", "None", ")", "await", "hass", ".", "...
[ 66, 0 ]
[ 147, 46 ]
python
en
['en', 'en', 'en']
True
test_windowcovering_set_cover_position
(hass, hk_driver, cls, events)
Test if accessory and HA are updated accordingly.
Test if accessory and HA are updated accordingly.
async def test_windowcovering_set_cover_position(hass, hk_driver, cls, events): """Test if accessory and HA are updated accordingly.""" entity_id = "cover.window" hass.states.async_set(entity_id, None) await hass.async_block_till_done() acc = cls.windowcovering(hass, hk_driver, "Cover", entity_id, ...
[ "async", "def", "test_windowcovering_set_cover_position", "(", "hass", ",", "hk_driver", ",", "cls", ",", "events", ")", ":", "entity_id", "=", "\"cover.window\"", "hass", ".", "states", ".", "async_set", "(", "entity_id", ",", "None", ")", "await", "hass", "....
[ 150, 0 ]
[ 217, 44 ]
python
en
['en', 'en', 'en']
True
test_window_instantiate
(hass, hk_driver, cls, events)
Test if Window accessory is instantiated correctly.
Test if Window accessory is instantiated correctly.
async def test_window_instantiate(hass, hk_driver, cls, events): """Test if Window accessory is instantiated correctly.""" entity_id = "cover.window" hass.states.async_set(entity_id, None) await hass.async_block_till_done() acc = cls.window(hass, hk_driver, "Window", entity_id, 2, None) await a...
[ "async", "def", "test_window_instantiate", "(", "hass", ",", "hk_driver", ",", "cls", ",", "events", ")", ":", "entity_id", "=", "\"cover.window\"", "hass", ".", "states", ".", "async_set", "(", "entity_id", ",", "None", ")", "await", "hass", ".", "async_blo...
[ 220, 0 ]
[ 234, 46 ]
python
en
['en', 'en', 'en']
True
test_windowcovering_cover_set_tilt
(hass, hk_driver, cls, events)
Test if accessory and HA update slat tilt accordingly.
Test if accessory and HA update slat tilt accordingly.
async def test_windowcovering_cover_set_tilt(hass, hk_driver, cls, events): """Test if accessory and HA update slat tilt accordingly.""" entity_id = "cover.window" hass.states.async_set( entity_id, STATE_UNKNOWN, {ATTR_SUPPORTED_FEATURES: SUPPORT_SET_TILT_POSITION} ) await hass.async_block_...
[ "async", "def", "test_windowcovering_cover_set_tilt", "(", "hass", ",", "hk_driver", ",", "cls", ",", "events", ")", ":", "entity_id", "=", "\"cover.window\"", "hass", ".", "states", ".", "async_set", "(", "entity_id", ",", "STATE_UNKNOWN", ",", "{", "ATTR_SUPPO...
[ 237, 0 ]
[ 301, 44 ]
python
en
['en', 'bg', 'en']
True
test_windowcovering_open_close
(hass, hk_driver, cls, events)
Test if accessory and HA are updated accordingly.
Test if accessory and HA are updated accordingly.
async def test_windowcovering_open_close(hass, hk_driver, cls, events): """Test if accessory and HA are updated accordingly.""" entity_id = "cover.window" hass.states.async_set(entity_id, STATE_UNKNOWN, {ATTR_SUPPORTED_FEATURES: 0}) acc = cls.windowcovering_basic(hass, hk_driver, "Cover", entity_id, 2,...
[ "async", "def", "test_windowcovering_open_close", "(", "hass", ",", "hk_driver", ",", "cls", ",", "events", ")", ":", "entity_id", "=", "\"cover.window\"", "hass", ".", "states", ".", "async_set", "(", "entity_id", ",", "STATE_UNKNOWN", ",", "{", "ATTR_SUPPORTED...
[ 304, 0 ]
[ 382, 46 ]
python
en
['en', 'en', 'en']
True
test_windowcovering_open_close_stop
(hass, hk_driver, cls, events)
Test if accessory and HA are updated accordingly.
Test if accessory and HA are updated accordingly.
async def test_windowcovering_open_close_stop(hass, hk_driver, cls, events): """Test if accessory and HA are updated accordingly.""" entity_id = "cover.window" hass.states.async_set( entity_id, STATE_UNKNOWN, {ATTR_SUPPORTED_FEATURES: SUPPORT_STOP} ) acc = cls.windowcovering_basic(hass, hk_...
[ "async", "def", "test_windowcovering_open_close_stop", "(", "hass", ",", "hk_driver", ",", "cls", ",", "events", ")", ":", "entity_id", "=", "\"cover.window\"", "hass", ".", "states", ".", "async_set", "(", "entity_id", ",", "STATE_UNKNOWN", ",", "{", "ATTR_SUPP...
[ 385, 0 ]
[ 429, 46 ]
python
en
['en', 'en', 'en']
True
test_windowcovering_open_close_with_position_and_stop
( hass, hk_driver, cls, events )
Test if accessory and HA are updated accordingly.
Test if accessory and HA are updated accordingly.
async def test_windowcovering_open_close_with_position_and_stop( hass, hk_driver, cls, events ): """Test if accessory and HA are updated accordingly.""" entity_id = "cover.stop_window" hass.states.async_set( entity_id, STATE_UNKNOWN, {ATTR_SUPPORTED_FEATURES: SUPPORT_STOP | SUPP...
[ "async", "def", "test_windowcovering_open_close_with_position_and_stop", "(", "hass", ",", "hk_driver", ",", "cls", ",", "events", ")", ":", "entity_id", "=", "\"cover.stop_window\"", "hass", ".", "states", ".", "async_set", "(", "entity_id", ",", "STATE_UNKNOWN", "...
[ 432, 0 ]
[ 460, 46 ]
python
en
['en', 'en', 'en']
True
test_windowcovering_basic_restore
(hass, hk_driver, cls, events)
Test setting up an entity from state in the event registry.
Test setting up an entity from state in the event registry.
async def test_windowcovering_basic_restore(hass, hk_driver, cls, events): """Test setting up an entity from state in the event registry.""" hass.state = CoreState.not_running registry = await entity_registry.async_get_registry(hass) registry.async_get_or_create( "cover", "generic", ...
[ "async", "def", "test_windowcovering_basic_restore", "(", "hass", ",", "hk_driver", ",", "cls", ",", "events", ")", ":", "hass", ".", "state", "=", "CoreState", ".", "not_running", "registry", "=", "await", "entity_registry", ".", "async_get_registry", "(", "has...
[ 463, 0 ]
[ 500, 46 ]
python
en
['en', 'en', 'en']
True
test_windowcovering_restore
(hass, hk_driver, cls, events)
Test setting up an entity from state in the event registry.
Test setting up an entity from state in the event registry.
async def test_windowcovering_restore(hass, hk_driver, cls, events): """Test setting up an entity from state in the event registry.""" hass.state = CoreState.not_running registry = await entity_registry.async_get_registry(hass) registry.async_get_or_create( "cover", "generic", ...
[ "async", "def", "test_windowcovering_restore", "(", "hass", ",", "hk_driver", ",", "cls", ",", "events", ")", ":", "hass", ".", "state", "=", "CoreState", ".", "not_running", "registry", "=", "await", "entity_registry", ".", "async_get_registry", "(", "hass", ...
[ 503, 0 ]
[ 538, 46 ]
python
en
['en', 'en', 'en']
True
test_garage_door_with_linked_obstruction_sensor
(hass, hk_driver, cls, events)
Test if accessory and HA are updated accordingly with a linked obstruction sensor.
Test if accessory and HA are updated accordingly with a linked obstruction sensor.
async def test_garage_door_with_linked_obstruction_sensor(hass, hk_driver, cls, events): """Test if accessory and HA are updated accordingly with a linked obstruction sensor.""" linked_obstruction_sensor_entity_id = "binary_sensor.obstruction" entity_id = "cover.garage_door" hass.states.async_set(linke...
[ "async", "def", "test_garage_door_with_linked_obstruction_sensor", "(", "hass", ",", "hk_driver", ",", "cls", ",", "events", ")", ":", "linked_obstruction_sensor_entity_id", "=", "\"binary_sensor.obstruction\"", "entity_id", "=", "\"cover.garage_door\"", "hass", ".", "state...
[ 541, 0 ]
[ 588, 38 ]
python
en
['en', 'en', 'en']
True
test_setup_missing_basic_config
(hass)
Test setup with configuration missing required entries.
Test setup with configuration missing required entries.
async def test_setup_missing_basic_config(hass): """Test setup with configuration missing required entries.""" assert await async_setup_component( hass, binary_sensor.DOMAIN, {"binary_sensor": {"platform": "rest"}} ) await hass.async_block_till_done() assert len(hass.states.async_all()) == 0
[ "async", "def", "test_setup_missing_basic_config", "(", "hass", ")", ":", "assert", "await", "async_setup_component", "(", "hass", ",", "binary_sensor", ".", "DOMAIN", ",", "{", "\"binary_sensor\"", ":", "{", "\"platform\"", ":", "\"rest\"", "}", "}", ")", "awai...
[ 23, 0 ]
[ 29, 44 ]
python
en
['en', 'en', 'en']
True
test_setup_missing_config
(hass)
Test setup with configuration missing required entries.
Test setup with configuration missing required entries.
async def test_setup_missing_config(hass): """Test setup with configuration missing required entries.""" assert await async_setup_component( hass, binary_sensor.DOMAIN, { "binary_sensor": { "platform": "rest", "resource": "localhost", ...
[ "async", "def", "test_setup_missing_config", "(", "hass", ")", ":", "assert", "await", "async_setup_component", "(", "hass", ",", "binary_sensor", ".", "DOMAIN", ",", "{", "\"binary_sensor\"", ":", "{", "\"platform\"", ":", "\"rest\"", ",", "\"resource\"", ":", ...
[ 32, 0 ]
[ 46, 44 ]
python
en
['en', 'en', 'en']
True
test_setup_failed_connect
(hass)
Test setup when connection error occurs.
Test setup when connection error occurs.
async def test_setup_failed_connect(hass): """Test setup when connection error occurs.""" respx.get( "http://localhost", content=httpx.RequestError(message="any", request=Mock()) ) assert await async_setup_component( hass, binary_sensor.DOMAIN, { "binary_senso...
[ "async", "def", "test_setup_failed_connect", "(", "hass", ")", ":", "respx", ".", "get", "(", "\"http://localhost\"", ",", "content", "=", "httpx", ".", "RequestError", "(", "message", "=", "\"any\"", ",", "request", "=", "Mock", "(", ")", ")", ")", "asser...
[ 50, 0 ]
[ 67, 44 ]
python
en
['en', 'en', 'en']
True
test_setup_timeout
(hass)
Test setup when connection timeout occurs.
Test setup when connection timeout occurs.
async def test_setup_timeout(hass): """Test setup when connection timeout occurs.""" respx.get("http://localhost", content=asyncio.TimeoutError()) assert await async_setup_component( hass, binary_sensor.DOMAIN, { "binary_sensor": { "platform": "rest", ...
[ "async", "def", "test_setup_timeout", "(", "hass", ")", ":", "respx", ".", "get", "(", "\"http://localhost\"", ",", "content", "=", "asyncio", ".", "TimeoutError", "(", ")", ")", "assert", "await", "async_setup_component", "(", "hass", ",", "binary_sensor", "....
[ 71, 0 ]
[ 86, 44 ]
python
en
['en', 'en', 'en']
True
test_setup_minimum
(hass)
Test setup with minimum configuration.
Test setup with minimum configuration.
async def test_setup_minimum(hass): """Test setup with minimum configuration.""" respx.get("http://localhost", status_code=200) assert await async_setup_component( hass, binary_sensor.DOMAIN, { "binary_sensor": { "platform": "rest", "resour...
[ "async", "def", "test_setup_minimum", "(", "hass", ")", ":", "respx", ".", "get", "(", "\"http://localhost\"", ",", "status_code", "=", "200", ")", "assert", "await", "async_setup_component", "(", "hass", ",", "binary_sensor", ".", "DOMAIN", ",", "{", "\"binar...
[ 90, 0 ]
[ 105, 44 ]
python
en
['en', 'zu', 'en']
True
test_setup_minimum_resource_template
(hass)
Test setup with minimum configuration (resource_template).
Test setup with minimum configuration (resource_template).
async def test_setup_minimum_resource_template(hass): """Test setup with minimum configuration (resource_template).""" respx.get("http://localhost", status_code=200) assert await async_setup_component( hass, binary_sensor.DOMAIN, { "binary_sensor": { "plat...
[ "async", "def", "test_setup_minimum_resource_template", "(", "hass", ")", ":", "respx", ".", "get", "(", "\"http://localhost\"", ",", "status_code", "=", "200", ")", "assert", "await", "async_setup_component", "(", "hass", ",", "binary_sensor", ".", "DOMAIN", ",",...
[ 109, 0 ]
[ 123, 44 ]
python
en
['en', 'en', 'en']
True
test_setup_duplicate_resource_template
(hass)
Test setup with duplicate resources.
Test setup with duplicate resources.
async def test_setup_duplicate_resource_template(hass): """Test setup with duplicate resources.""" respx.get("http://localhost", status_code=200) assert await async_setup_component( hass, binary_sensor.DOMAIN, { "binary_sensor": { "platform": "rest", ...
[ "async", "def", "test_setup_duplicate_resource_template", "(", "hass", ")", ":", "respx", ".", "get", "(", "\"http://localhost\"", ",", "status_code", "=", "200", ")", "assert", "await", "async_setup_component", "(", "hass", ",", "binary_sensor", ".", "DOMAIN", ",...
[ 127, 0 ]
[ 142, 44 ]
python
en
['en', 'en', 'en']
True
test_setup_get
(hass)
Test setup with valid configuration.
Test setup with valid configuration.
async def test_setup_get(hass): """Test setup with valid configuration.""" respx.get("http://localhost", status_code=200, content="{}") assert await async_setup_component( hass, "binary_sensor", { "binary_sensor": { "platform": "rest", "res...
[ "async", "def", "test_setup_get", "(", "hass", ")", ":", "respx", ".", "get", "(", "\"http://localhost\"", ",", "status_code", "=", "200", ",", "content", "=", "\"{}\"", ")", "assert", "await", "async_setup_component", "(", "hass", ",", "\"binary_sensor\"", ",...
[ 146, 0 ]
[ 170, 44 ]
python
en
['en', 'en', 'en']
True
test_setup_get_digest_auth
(hass)
Test setup with valid configuration.
Test setup with valid configuration.
async def test_setup_get_digest_auth(hass): """Test setup with valid configuration.""" respx.get("http://localhost", status_code=200, content="{}") assert await async_setup_component( hass, "binary_sensor", { "binary_sensor": { "platform": "rest", ...
[ "async", "def", "test_setup_get_digest_auth", "(", "hass", ")", ":", "respx", ".", "get", "(", "\"http://localhost\"", ",", "status_code", "=", "200", ",", "content", "=", "\"{}\"", ")", "assert", "await", "async_setup_component", "(", "hass", ",", "\"binary_sen...
[ 174, 0 ]
[ 198, 44 ]
python
en
['en', 'en', 'en']
True
test_setup_post
(hass)
Test setup with valid configuration.
Test setup with valid configuration.
async def test_setup_post(hass): """Test setup with valid configuration.""" respx.post("http://localhost", status_code=200, content="{}") assert await async_setup_component( hass, "binary_sensor", { "binary_sensor": { "platform": "rest", "r...
[ "async", "def", "test_setup_post", "(", "hass", ")", ":", "respx", ".", "post", "(", "\"http://localhost\"", ",", "status_code", "=", "200", ",", "content", "=", "\"{}\"", ")", "assert", "await", "async_setup_component", "(", "hass", ",", "\"binary_sensor\"", ...
[ 202, 0 ]
[ 226, 44 ]
python
en
['en', 'en', 'en']
True
test_setup_get_off
(hass)
Test setup with valid off configuration.
Test setup with valid off configuration.
async def test_setup_get_off(hass): """Test setup with valid off configuration.""" respx.get( "http://localhost", status_code=200, headers={"content-type": "text/json"}, content='{"dog": false}', ) assert await async_setup_component( hass, "binary_sensor",...
[ "async", "def", "test_setup_get_off", "(", "hass", ")", ":", "respx", ".", "get", "(", "\"http://localhost\"", ",", "status_code", "=", "200", ",", "headers", "=", "{", "\"content-type\"", ":", "\"text/json\"", "}", ",", "content", "=", "'{\"dog\": false}'", "...
[ 230, 0 ]
[ 257, 35 ]
python
en
['en', 'en', 'en']
True
test_setup_get_on
(hass)
Test setup with valid on configuration.
Test setup with valid on configuration.
async def test_setup_get_on(hass): """Test setup with valid on configuration.""" respx.get( "http://localhost", status_code=200, headers={"content-type": "text/json"}, content='{"dog": true}', ) assert await async_setup_component( hass, "binary_sensor", ...
[ "async", "def", "test_setup_get_on", "(", "hass", ")", ":", "respx", ".", "get", "(", "\"http://localhost\"", ",", "status_code", "=", "200", ",", "headers", "=", "{", "\"content-type\"", ":", "\"text/json\"", "}", ",", "content", "=", "'{\"dog\": true}'", ","...
[ 261, 0 ]
[ 288, 34 ]
python
en
['en', 'en', 'en']
True
test_setup_with_exception
(hass)
Test setup with exception.
Test setup with exception.
async def test_setup_with_exception(hass): """Test setup with exception.""" respx.get("http://localhost", status_code=200, content="{}") assert await async_setup_component( hass, "binary_sensor", { "binary_sensor": { "platform": "rest", "re...
[ "async", "def", "test_setup_with_exception", "(", "hass", ")", ":", "respx", ".", "get", "(", "\"http://localhost\"", ",", "status_code", "=", "200", ",", "content", "=", "\"{}\"", ")", "assert", "await", "async_setup_component", "(", "hass", ",", "\"binary_sens...
[ 292, 0 ]
[ 332, 43 ]
python
en
['en', 'en', 'en']
True
test_reload
(hass)
Verify we can reload reset sensors.
Verify we can reload reset sensors.
async def test_reload(hass): """Verify we can reload reset sensors.""" respx.get("http://localhost", status_code=200) await async_setup_component( hass, "binary_sensor", { "binary_sensor": { "platform": "rest", "method": "GET", ...
[ "async", "def", "test_reload", "(", "hass", ")", ":", "respx", ".", "get", "(", "\"http://localhost\"", ",", "status_code", "=", "200", ")", "await", "async_setup_component", "(", "hass", ",", "\"binary_sensor\"", ",", "{", "\"binary_sensor\"", ":", "{", "\"pl...
[ 336, 0 ]
[ 376, 51 ]
python
en
['en', 'ca', 'en']
True
test_setup_query_params
(hass)
Test setup with query params.
Test setup with query params.
async def test_setup_query_params(hass): """Test setup with query params.""" respx.get( "http://localhost?search=something", status_code=200, ) assert await async_setup_component( hass, binary_sensor.DOMAIN, { "binary_sensor": { "platfo...
[ "async", "def", "test_setup_query_params", "(", "hass", ")", ":", "respx", ".", "get", "(", "\"http://localhost?search=something\"", ",", "status_code", "=", "200", ",", ")", "assert", "await", "async_setup_component", "(", "hass", ",", "binary_sensor", ".", "DOMA...
[ 380, 0 ]
[ 399, 44 ]
python
en
['en', 'en', 'en']
True
sha512half
(buf)
Return the first 256 bits (32 bytes) of a SHA-512 hash.
Return the first 256 bits (32 bytes) of a SHA-512 hash.
def sha512half(buf): """ Return the first 256 bits (32 bytes) of a SHA-512 hash. """ return sha512(buf).digest()[:32]
[ "def", "sha512half", "(", "buf", ")", ":", "return", "sha512", "(", "buf", ")", ".", "digest", "(", ")", "[", ":", "32", "]" ]
[ 39, 0 ]
[ 43, 36 ]
python
en
['en', 'error', 'th']
False
secp256k1_secret_key_from
(seed)
Calculate a valid secp256k1 secret key by hashing a seed value; if the result isn't a valid key, increment a seq value and try again. Returns a secret key as a 32-byte integer.
Calculate a valid secp256k1 secret key by hashing a seed value; if the result isn't a valid key, increment a seq value and try again.
def secp256k1_secret_key_from(seed): """ Calculate a valid secp256k1 secret key by hashing a seed value; if the result isn't a valid key, increment a seq value and try again. Returns a secret key as a 32-byte integer. """ seq = 0 while True: buf = seed + seq.to_bytes(4, byteorde...
[ "def", "secp256k1_secret_key_from", "(", "seed", ")", ":", "seq", "=", "0", "while", "True", ":", "buf", "=", "seed", "+", "seq", ".", "to_bytes", "(", "4", ",", "byteorder", "=", "\"big\"", ",", "signed", "=", "False", ")", "h", "=", "sha512half", "...
[ 245, 0 ]
[ 261, 16 ]
python
en
['en', 'error', 'th']
False
compress_secp256k1_public
(point)
Returns a 33-byte compressed key from an secp256k1 public key, which is a point in the form (x,y) where both x and y are 32-byte ints
Returns a 33-byte compressed key from an secp256k1 public key, which is a point in the form (x,y) where both x and y are 32-byte ints
def compress_secp256k1_public(point): """ Returns a 33-byte compressed key from an secp256k1 public key, which is a point in the form (x,y) where both x and y are 32-byte ints """ if point.y % 2: prefix = b'\x03' else: prefix = b'\x02' return prefix + point.x.to_bytes(32, byt...
[ "def", "compress_secp256k1_public", "(", "point", ")", ":", "if", "point", ".", "y", "%", "2", ":", "prefix", "=", "b'\\x03'", "else", ":", "prefix", "=", "b'\\x02'", "return", "prefix", "+", "point", ".", "x", ".", "to_bytes", "(", "32", ",", "byteord...
[ 263, 0 ]
[ 272, 71 ]
python
en
['en', 'error', 'th']
False
swap_byte_order
(buf)
Swap the byte order of a bytes object. The rippled implementation of RFC-1751 uses the reversed byte order as the examples included in the RFC-1751 spec (which doesn't mention byte order).
Swap the byte order of a bytes object. The rippled implementation of RFC-1751 uses the reversed byte order as the examples included in the RFC-1751 spec (which doesn't mention byte order).
def swap_byte_order(buf): """ Swap the byte order of a bytes object. The rippled implementation of RFC-1751 uses the reversed byte order as the examples included in the RFC-1751 spec (which doesn't mention byte order). """ size = len(buf) # doesn't actually matter if it's "really" big-endian...
[ "def", "swap_byte_order", "(", "buf", ")", ":", "size", "=", "len", "(", "buf", ")", "# doesn't actually matter if it's \"really\" big-endian", "i", "=", "int", ".", "from_bytes", "(", "buf", ",", "byteorder", "=", "\"big\"", ",", "signed", "=", "False", ")", ...
[ 274, 0 ]
[ 284, 17 ]
python
en
['en', 'error', 'th']
False
Seed.__init__
(self, in_string=None, correct_rfc1751=False)
Decode a buffer input in one of the formats the XRPL supports and convert it to a buffer representing the 16-byte seed to use for key derivation. Formats include: - XRPL base58 encoding - RFC-1751 - hexadecimal - passphrase
Decode a buffer input in one of the formats the XRPL supports and convert it to a buffer representing the 16-byte seed to use for key derivation. Formats include: - XRPL base58 encoding - RFC-1751 - hexadecimal - passphrase
def __init__(self, in_string=None, correct_rfc1751=False): """ Decode a buffer input in one of the formats the XRPL supports and convert it to a buffer representing the 16-byte seed to use for key derivation. Formats include: - XRPL base58 encoding - RFC-1751 - he...
[ "def", "__init__", "(", "self", ",", "in_string", "=", "None", ",", "correct_rfc1751", "=", "False", ")", ":", "self", ".", "correct_rfc1751", "=", "correct_rfc1751", "# Keys are lazy-derived later", "self", ".", "_secp256k1_sec", "=", "None", "self", ".", "_sec...
[ 50, 4 ]
[ 113, 14 ]
python
en
['en', 'error', 'th']
False
Seed.encode_base58
(self)
Returns a string representation of this seed as an XRPL base58 encoded string such as 'snoPBrXtMeMyMHUVTgbuqAfg1SUTb'.
Returns a string representation of this seed as an XRPL base58 encoded string such as 'snoPBrXtMeMyMHUVTgbuqAfg1SUTb'.
def encode_base58(self): """ Returns a string representation of this seed as an XRPL base58 encoded string such as 'snoPBrXtMeMyMHUVTgbuqAfg1SUTb'. """ return base58.b58encode_check(XRPL_SEED_PREFIX + self.bytes).decode()
[ "def", "encode_base58", "(", "self", ")", ":", "return", "base58", ".", "b58encode_check", "(", "XRPL_SEED_PREFIX", "+", "self", ".", "bytes", ")", ".", "decode", "(", ")" ]
[ 115, 4 ]
[ 120, 77 ]
python
en
['en', 'error', 'th']
False
Seed.encode_hex
(self)
Returns a string representation of this seed as hexadecimal.
Returns a string representation of this seed as hexadecimal.
def encode_hex(self): """ Returns a string representation of this seed as hexadecimal. """ return self.bytes.hex().upper()
[ "def", "encode_hex", "(", "self", ")", ":", "return", "self", ".", "bytes", ".", "hex", "(", ")", ".", "upper", "(", ")" ]
[ 122, 4 ]
[ 126, 39 ]
python
en
['en', 'error', 'th']
False
Seed.encode_rfc1751
(self, correct_rfc1751=None)
Returns a string representation of this seed as an RFC-1751 encoded passphrase.
Returns a string representation of this seed as an RFC-1751 encoded passphrase.
def encode_rfc1751(self, correct_rfc1751=None): """ Returns a string representation of this seed as an RFC-1751 encoded passphrase. """ # Use the default byte order swap this Seed was generated with # unless the method call overrides it. if correct_rfc1751 is None...
[ "def", "encode_rfc1751", "(", "self", ",", "correct_rfc1751", "=", "None", ")", ":", "# Use the default byte order swap this Seed was generated with", "# unless the method call overrides it.", "if", "correct_rfc1751", "is", "None", ":", "correct_rfc1751", "=", "self", ".", ...
[ 128, 4 ]
[ 142, 42 ]
python
en
['en', 'error', 'th']
False
Seed.ed25519_secret_key
(self)
Returns a 32-byte Ed25519 secret key (bytes). Saves the calculation for later calls.
Returns a 32-byte Ed25519 secret key (bytes). Saves the calculation for later calls.
def ed25519_secret_key(self): """ Returns a 32-byte Ed25519 secret key (bytes). Saves the calculation for later calls. """ if self._ed25519_sec is None: self._ed25519_sec = sha512half(self.bytes) return self._ed25519_sec
[ "def", "ed25519_secret_key", "(", "self", ")", ":", "if", "self", ".", "_ed25519_sec", "is", "None", ":", "self", ".", "_ed25519_sec", "=", "sha512half", "(", "self", ".", "bytes", ")", "return", "self", ".", "_ed25519_sec" ]
[ 145, 4 ]
[ 152, 32 ]
python
en
['en', 'error', 'th']
False
Seed.ed25519_public_key
(self)
33-byte Ed25519 public key (bytes)—really a 32-byte key prefixed with the byte 0xED to indicate that it's an Ed25519 key.
33-byte Ed25519 public key (bytes)—really a 32-byte key prefixed with the byte 0xED to indicate that it's an Ed25519 key.
def ed25519_public_key(self): """ 33-byte Ed25519 public key (bytes)—really a 32-byte key prefixed with the byte 0xED to indicate that it's an Ed25519 key. """ if self._ed25519_pub is None: self._ed25519_pub = (ED_PREFIX + ed25519.publ...
[ "def", "ed25519_public_key", "(", "self", ")", ":", "if", "self", ".", "_ed25519_pub", "is", "None", ":", "self", ".", "_ed25519_pub", "=", "(", "ED_PREFIX", "+", "ed25519", ".", "publickey", "(", "self", ".", "ed25519_secret_key", ")", ")", "return", "sel...
[ 155, 4 ]
[ 163, 32 ]
python
en
['en', 'error', 'th']
False
Seed.secp256k1_secret_key
(self)
32-byte secp256k1 secret key (bytes)
32-byte secp256k1 secret key (bytes)
def secp256k1_secret_key(self): """ 32-byte secp256k1 secret key (bytes) """ if self._secp256k1_sec is None: self.derive_secp256k1_master_keys() return self._secp256k1_sec
[ "def", "secp256k1_secret_key", "(", "self", ")", ":", "if", "self", ".", "_secp256k1_sec", "is", "None", ":", "self", ".", "derive_secp256k1_master_keys", "(", ")", "return", "self", ".", "_secp256k1_sec" ]
[ 166, 4 ]
[ 172, 34 ]
python
en
['en', 'error', 'th']
False
Seed.secp256k1_public_key
(self)
33-byte secp256k1 account public key (bytes)
33-byte secp256k1 account public key (bytes)
def secp256k1_public_key(self): """ 33-byte secp256k1 account public key (bytes) """ if self._secp256k1_pub is None: self.derive_secp256k1_master_keys() return self._secp256k1_pub
[ "def", "secp256k1_public_key", "(", "self", ")", ":", "if", "self", ".", "_secp256k1_pub", "is", "None", ":", "self", ".", "derive_secp256k1_master_keys", "(", ")", "return", "self", ".", "_secp256k1_pub" ]
[ 175, 4 ]
[ 181, 34 ]
python
en
['en', 'error', 'th']
False
Seed.secp256k1_root_public_key
(self)
33-byte secp256k1 root public key (bytes) This is the public key used for validators.
33-byte secp256k1 root public key (bytes) This is the public key used for validators.
def secp256k1_root_public_key(self): """ 33-byte secp256k1 root public key (bytes) This is the public key used for validators. """ if self._secp256k1_root_pub is None: self.derive_secp256k1_master_keys() return self._secp256k1_root_pub
[ "def", "secp256k1_root_public_key", "(", "self", ")", ":", "if", "self", ".", "_secp256k1_root_pub", "is", "None", ":", "self", ".", "derive_secp256k1_master_keys", "(", ")", "return", "self", ".", "_secp256k1_root_pub" ]
[ 184, 4 ]
[ 191, 39 ]
python
en
['en', 'error', 'th']
False
Seed.derive_secp256k1_master_keys
(self)
Uses the XRPL's convoluted key derivation process to get the secp256k1 master keypair for this seed value. Saves the values to the object for later reference.
Uses the XRPL's convoluted key derivation process to get the secp256k1 master keypair for this seed value. Saves the values to the object for later reference.
def derive_secp256k1_master_keys(self): """ Uses the XRPL's convoluted key derivation process to get the secp256k1 master keypair for this seed value. Saves the values to the object for later reference. """ root_sec_i = secp256k1_secret_key_from(self.bytes) root_...
[ "def", "derive_secp256k1_master_keys", "(", "self", ")", ":", "root_sec_i", "=", "secp256k1_secret_key_from", "(", "self", ".", "bytes", ")", "root_pub_point", "=", "keys", ".", "get_public_key", "(", "root_sec_i", ",", "curve", ".", "secp256k1", ")", "root_pub_b"...
[ 193, 4 ]
[ 217, 47 ]
python
en
['en', 'error', 'th']
False
Seed.encode_secp256k1_public_base58
(self, validator=False)
Return the base58-encoded version of the secp256k1 public key.
Return the base58-encoded version of the secp256k1 public key.
def encode_secp256k1_public_base58(self, validator=False): """ Return the base58-encoded version of the secp256k1 public key. """ if validator: # Validators use the "root" public key key = self.secp256k1_root_public_key prefix = XRPL_VALIDATOR_PUBKEY_P...
[ "def", "encode_secp256k1_public_base58", "(", "self", ",", "validator", "=", "False", ")", ":", "if", "validator", ":", "# Validators use the \"root\" public key", "key", "=", "self", ".", "secp256k1_root_public_key", "prefix", "=", "XRPL_VALIDATOR_PUBKEY_PREFIX", "else",...
[ 219, 4 ]
[ 232, 60 ]
python
en
['en', 'error', 'th']
False
Seed.encode_ed25519_public_base58
(self)
Return the base58-encoded version of the Ed25519 public key.
Return the base58-encoded version of the Ed25519 public key.
def encode_ed25519_public_base58(self): """ Return the base58-encoded version of the Ed25519 public key. """ # Unlike secp256k1, Ed25519 public keys are the same for # accounts and for validators. prefix = XRPL_ACCT_PUBKEY_PREFIX return base58.b58encode_check(pre...
[ "def", "encode_ed25519_public_base58", "(", "self", ")", ":", "# Unlike secp256k1, Ed25519 public keys are the same for", "# accounts and for validators.", "prefix", "=", "XRPL_ACCT_PUBKEY_PREFIX", "return", "base58", ".", "b58encode_check", "(", "prefix", "+", "self", ".", "...
[ 234, 4 ]
[ 243, 71 ]
python
en
['en', 'error', 'th']
False
setup_platform
(hass, config, add_entities, discovery_info=None)
Set up a Nest Cam. No longer in use.
Set up a Nest Cam.
def setup_platform(hass, config, add_entities, discovery_info=None): """Set up a Nest Cam. No longer in use. """
[ "def", "setup_platform", "(", "hass", ",", "config", ",", "add_entities", ",", "discovery_info", "=", "None", ")", ":" ]
[ 17, 0 ]
[ 21, 7 ]
python
en
['en', 'pt', 'en']
True
async_setup_legacy_entry
(hass, entry, async_add_entities)
Set up a Nest sensor based on a config entry.
Set up a Nest sensor based on a config entry.
async def async_setup_legacy_entry(hass, entry, async_add_entities): """Set up a Nest sensor based on a config entry.""" camera_devices = await hass.async_add_executor_job( hass.data[nest.DATA_NEST].cameras ) cameras = [NestCamera(structure, device) for structure, device in camera_devices] a...
[ "async", "def", "async_setup_legacy_entry", "(", "hass", ",", "entry", ",", "async_add_entities", ")", ":", "camera_devices", "=", "await", "hass", ".", "async_add_executor_job", "(", "hass", ".", "data", "[", "nest", ".", "DATA_NEST", "]", ".", "cameras", ")"...
[ 24, 0 ]
[ 30, 37 ]
python
en
['en', 'da', 'en']
True
NestCamera.__init__
(self, structure, device)
Initialize a Nest Camera.
Initialize a Nest Camera.
def __init__(self, structure, device): """Initialize a Nest Camera.""" super().__init__() self.structure = structure self.device = device self._location = None self._name = None self._online = None self._is_streaming = None self._is_video_history_e...
[ "def", "__init__", "(", "self", ",", "structure", ",", "device", ")", ":", "super", "(", ")", ".", "__init__", "(", ")", "self", ".", "structure", "=", "structure", "self", ".", "device", "=", "device", "self", ".", "_location", "=", "None", "self", ...
[ 36, 4 ]
[ 49, 37 ]
python
co
['en', 'co', 'it']
False
NestCamera.name
(self)
Return the name of the nest, if any.
Return the name of the nest, if any.
def name(self): """Return the name of the nest, if any.""" return self._name
[ "def", "name", "(", "self", ")", ":", "return", "self", ".", "_name" ]
[ 52, 4 ]
[ 54, 25 ]
python
en
['en', 'en', 'en']
True
NestCamera.unique_id
(self)
Return the serial number.
Return the serial number.
def unique_id(self): """Return the serial number.""" return self.device.device_id
[ "def", "unique_id", "(", "self", ")", ":", "return", "self", ".", "device", ".", "device_id" ]
[ 57, 4 ]
[ 59, 36 ]
python
en
['en', 'id', 'en']
True
NestCamera.device_info
(self)
Return information about the device.
Return information about the device.
def device_info(self): """Return information about the device.""" return { "identifiers": {(nest.DOMAIN, self.device.device_id)}, "name": self.device.name_long, "manufacturer": "Nest Labs", "model": "Camera", }
[ "def", "device_info", "(", "self", ")", ":", "return", "{", "\"identifiers\"", ":", "{", "(", "nest", ".", "DOMAIN", ",", "self", ".", "device", ".", "device_id", ")", "}", ",", "\"name\"", ":", "self", ".", "device", ".", "name_long", ",", "\"manufact...
[ 62, 4 ]
[ 69, 9 ]
python
en
['en', 'en', 'en']
True
NestCamera.should_poll
(self)
Nest camera should poll periodically.
Nest camera should poll periodically.
def should_poll(self): """Nest camera should poll periodically.""" return True
[ "def", "should_poll", "(", "self", ")", ":", "return", "True" ]
[ 72, 4 ]
[ 74, 19 ]
python
en
['en', 'pt', 'en']
True
NestCamera.is_recording
(self)
Return true if the device is recording.
Return true if the device is recording.
def is_recording(self): """Return true if the device is recording.""" return self._is_streaming
[ "def", "is_recording", "(", "self", ")", ":", "return", "self", ".", "_is_streaming" ]
[ 77, 4 ]
[ 79, 33 ]
python
en
['en', 'en', 'en']
True
NestCamera.brand
(self)
Return the brand of the camera.
Return the brand of the camera.
def brand(self): """Return the brand of the camera.""" return NEST_BRAND
[ "def", "brand", "(", "self", ")", ":", "return", "NEST_BRAND" ]
[ 82, 4 ]
[ 84, 25 ]
python
en
['en', 'en', 'en']
True
NestCamera.supported_features
(self)
Nest Cam support turn on and off.
Nest Cam support turn on and off.
def supported_features(self): """Nest Cam support turn on and off.""" return SUPPORT_ON_OFF
[ "def", "supported_features", "(", "self", ")", ":", "return", "SUPPORT_ON_OFF" ]
[ 87, 4 ]
[ 89, 29 ]
python
en
['en', 'en', 'en']
True
NestCamera.is_on
(self)
Return true if on.
Return true if on.
def is_on(self): """Return true if on.""" return self._online and self._is_streaming
[ "def", "is_on", "(", "self", ")", ":", "return", "self", ".", "_online", "and", "self", ".", "_is_streaming" ]
[ 92, 4 ]
[ 94, 50 ]
python
en
['en', 'mt', 'en']
True
NestCamera.turn_off
(self)
Turn off camera.
Turn off camera.
def turn_off(self): """Turn off camera.""" _LOGGER.debug("Turn off camera %s", self._name) # Calling Nest API in is_streaming setter. # device.is_streaming would not immediately change until the process # finished in Nest Cam. self.device.is_streaming = False
[ "def", "turn_off", "(", "self", ")", ":", "_LOGGER", ".", "debug", "(", "\"Turn off camera %s\"", ",", "self", ".", "_name", ")", "# Calling Nest API in is_streaming setter.", "# device.is_streaming would not immediately change until the process", "# finished in Nest Cam.", "se...
[ 96, 4 ]
[ 102, 40 ]
python
en
['en', 'ja', 'en']
True
NestCamera.turn_on
(self)
Turn on camera.
Turn on camera.
def turn_on(self): """Turn on camera.""" if not self._online: _LOGGER.error("Camera %s is offline", self._name) return _LOGGER.debug("Turn on camera %s", self._name) # Calling Nest API in is_streaming setter. # device.is_streaming would not immediately ch...
[ "def", "turn_on", "(", "self", ")", ":", "if", "not", "self", ".", "_online", ":", "_LOGGER", ".", "error", "(", "\"Camera %s is offline\"", ",", "self", ".", "_name", ")", "return", "_LOGGER", ".", "debug", "(", "\"Turn on camera %s\"", ",", "self", ".", ...
[ 104, 4 ]
[ 114, 39 ]
python
en
['en', 'et', 'en']
True
NestCamera.update
(self)
Cache value from Python-nest.
Cache value from Python-nest.
def update(self): """Cache value from Python-nest.""" self._location = self.device.where self._name = self.device.name self._online = self.device.online self._is_streaming = self.device.is_streaming self._is_video_history_enabled = self.device.is_video_history_enabled ...
[ "def", "update", "(", "self", ")", ":", "self", ".", "_location", "=", "self", ".", "device", ".", "where", "self", ".", "_name", "=", "self", ".", "device", ".", "name", "self", ".", "_online", "=", "self", ".", "device", ".", "online", "self", "....
[ 116, 4 ]
[ 129, 64 ]
python
en
['en', 'en', 'en']
True
NestCamera.camera_image
(self)
Return a still image response from the camera.
Return a still image response from the camera.
def camera_image(self): """Return a still image response from the camera.""" now = utcnow() if self._ready_for_snapshot(now): url = self.device.snapshot_url try: response = requests.get(url) except requests.exceptions.RequestException as error...
[ "def", "camera_image", "(", "self", ")", ":", "now", "=", "utcnow", "(", ")", "if", "self", ".", "_ready_for_snapshot", "(", "now", ")", ":", "url", "=", "self", ".", "device", ".", "snapshot_url", "try", ":", "response", "=", "requests", ".", "get", ...
[ 134, 4 ]
[ 149, 31 ]
python
en
['en', 'en', 'en']
True
run
(args)
Handle benchmark commandline script.
Handle benchmark commandline script.
def run(args): """Handle benchmark commandline script.""" # Disable logging logging.getLogger("homeassistant.core").setLevel(logging.CRITICAL) parser = argparse.ArgumentParser(description=("Run a Home Assistant benchmark.")) parser.add_argument("name", choices=BENCHMARKS) parser.add_argument("-...
[ "def", "run", "(", "args", ")", ":", "# Disable logging", "logging", ".", "getLogger", "(", "\"homeassistant.core\"", ")", ".", "setLevel", "(", "logging", ".", "CRITICAL", ")", "parser", "=", "argparse", ".", "ArgumentParser", "(", "description", "=", "(", ...
[ 26, 0 ]
[ 42, 45 ]
python
de
['de', 'nl', 'en']
False
run_benchmark
(bench)
Run a benchmark.
Run a benchmark.
async def run_benchmark(bench): """Run a benchmark.""" hass = core.HomeAssistant() runtime = await bench(hass) print(f"Benchmark {bench.__name__} done in {runtime}s") await hass.async_stop()
[ "async", "def", "run_benchmark", "(", "bench", ")", ":", "hass", "=", "core", ".", "HomeAssistant", "(", ")", "runtime", "=", "await", "bench", "(", "hass", ")", "print", "(", "f\"Benchmark {bench.__name__} done in {runtime}s\"", ")", "await", "hass", ".", "as...
[ 45, 0 ]
[ 50, 27 ]
python
en
['it', 'gl', 'en']
False
benchmark
(func: CALLABLE_T)
Decorate to mark a benchmark.
Decorate to mark a benchmark.
def benchmark(func: CALLABLE_T) -> CALLABLE_T: """Decorate to mark a benchmark.""" BENCHMARKS[func.__name__] = func return func
[ "def", "benchmark", "(", "func", ":", "CALLABLE_T", ")", "->", "CALLABLE_T", ":", "BENCHMARKS", "[", "func", ".", "__name__", "]", "=", "func", "return", "func" ]
[ 53, 0 ]
[ 56, 15 ]
python
en
['en', 'en', 'en']
True
fire_events
(hass)
Fire a million events.
Fire a million events.
async def fire_events(hass): """Fire a million events.""" count = 0 event_name = "benchmark_event" event = asyncio.Event() @core.callback def listener(_): """Handle event.""" nonlocal count count += 1 if count == 10 ** 6: event.set() hass.bus.as...
[ "async", "def", "fire_events", "(", "hass", ")", ":", "count", "=", "0", "event_name", "=", "\"benchmark_event\"", "event", "=", "asyncio", ".", "Event", "(", ")", "@", "core", ".", "callback", "def", "listener", "(", "_", ")", ":", "\"\"\"Handle event.\"\...
[ 60, 0 ]
[ 84, 26 ]
python
en
['fr', 'en', 'en']
True
time_changed_helper
(hass)
Run a million events through time changed helper.
Run a million events through time changed helper.
async def time_changed_helper(hass): """Run a million events through time changed helper.""" count = 0 event = asyncio.Event() @core.callback def listener(_): """Handle event.""" nonlocal count count += 1 if count == 10 ** 6: event.set() hass.helper...
[ "async", "def", "time_changed_helper", "(", "hass", ")", ":", "count", "=", "0", "event", "=", "asyncio", ".", "Event", "(", ")", "@", "core", ".", "callback", "def", "listener", "(", "_", ")", ":", "\"\"\"Handle event.\"\"\"", "nonlocal", "count", "count"...
[ 88, 0 ]
[ 112, 26 ]
python
en
['en', 'gd', 'en']
True
state_changed_helper
(hass)
Run a million events through state changed helper with 1000 entities.
Run a million events through state changed helper with 1000 entities.
async def state_changed_helper(hass): """Run a million events through state changed helper with 1000 entities.""" count = 0 entity_id = "light.kitchen" event = asyncio.Event() @core.callback def listener(*args): """Handle event.""" nonlocal count count += 1 if c...
[ "async", "def", "state_changed_helper", "(", "hass", ")", ":", "count", "=", "0", "entity_id", "=", "\"light.kitchen\"", "event", "=", "asyncio", ".", "Event", "(", ")", "@", "core", ".", "callback", "def", "listener", "(", "*", "args", ")", ":", "\"\"\"...
[ 116, 0 ]
[ 148, 26 ]
python
en
['en', 'en', 'en']
True
state_changed_event_helper
(hass)
Run a million events through state changed event helper with 1000 entities.
Run a million events through state changed event helper with 1000 entities.
async def state_changed_event_helper(hass): """Run a million events through state changed event helper with 1000 entities.""" count = 0 entity_id = "light.kitchen" event = asyncio.Event() @core.callback def listener(*args): """Handle event.""" nonlocal count count += 1 ...
[ "async", "def", "state_changed_event_helper", "(", "hass", ")", ":", "count", "=", "0", "entity_id", "=", "\"light.kitchen\"", "event", "=", "asyncio", ".", "Event", "(", ")", "@", "core", ".", "callback", "def", "listener", "(", "*", "args", ")", ":", "...
[ 152, 0 ]
[ 184, 26 ]
python
en
['en', 'en', 'en']
True