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_logbook_view_end_time_entity
(hass, hass_client)
Test the logbook view with end_time and entity.
Test the logbook view with end_time and entity.
async def test_logbook_view_end_time_entity(hass, hass_client): """Test the logbook view with end_time and entity.""" await hass.async_add_executor_job(init_recorder_component, hass) await async_setup_component(hass, "logbook", {}) await hass.async_add_executor_job(hass.data[recorder.DATA_INSTANCE].bloc...
[ "async", "def", "test_logbook_view_end_time_entity", "(", "hass", ",", "hass_client", ")", ":", "await", "hass", ".", "async_add_executor_job", "(", "init_recorder_component", ",", "hass", ")", "await", "async_setup_component", "(", "hass", ",", "\"logbook\"", ",", ...
[ 512, 0 ]
[ 567, 58 ]
python
en
['en', 'en', 'en']
True
test_logbook_entity_filter_with_automations
(hass, hass_client)
Test the logbook view with end_time and entity with automations and scripts.
Test the logbook view with end_time and entity with automations and scripts.
async def test_logbook_entity_filter_with_automations(hass, hass_client): """Test the logbook view with end_time and entity with automations and scripts.""" await hass.async_add_executor_job(init_recorder_component, hass) await async_setup_component(hass, "logbook", {}) await async_setup_component(hass,...
[ "async", "def", "test_logbook_entity_filter_with_automations", "(", "hass", ",", "hass_client", ")", ":", "await", "hass", ".", "async_add_executor_job", "(", "init_recorder_component", ",", "hass", ")", "await", "async_setup_component", "(", "hass", ",", "\"logbook\"",...
[ 570, 0 ]
[ 642, 56 ]
python
en
['en', 'en', 'en']
True
test_filter_continuous_sensor_values
(hass, hass_client)
Test remove continuous sensor events from logbook.
Test remove continuous sensor events from logbook.
async def test_filter_continuous_sensor_values(hass, hass_client): """Test remove continuous sensor events from logbook.""" await hass.async_add_executor_job(init_recorder_component, hass) await async_setup_component(hass, "logbook", {}) await hass.async_add_executor_job(hass.data[recorder.DATA_INSTANCE...
[ "async", "def", "test_filter_continuous_sensor_values", "(", "hass", ",", "hass_client", ")", ":", "await", "hass", ".", "async_add_executor_job", "(", "init_recorder_component", ",", "hass", ")", "await", "async_setup_component", "(", "hass", ",", "\"logbook\"", ",",...
[ 645, 0 ]
[ 678, 59 ]
python
en
['en', 'en', 'en']
True
test_exclude_new_entities
(hass, hass_client)
Test if events are excluded on first update.
Test if events are excluded on first update.
async def test_exclude_new_entities(hass, hass_client): """Test if events are excluded on first update.""" await hass.async_add_executor_job(init_recorder_component, hass) await async_setup_component(hass, "logbook", {}) await hass.async_add_executor_job(hass.data[recorder.DATA_INSTANCE].block_till_done...
[ "async", "def", "test_exclude_new_entities", "(", "hass", ",", "hass_client", ")", ":", "await", "hass", ".", "async_add_executor_job", "(", "init_recorder_component", ",", "hass", ")", "await", "async_setup_component", "(", "hass", ",", "\"logbook\"", ",", "{", "...
[ 681, 0 ]
[ 713, 51 ]
python
en
['en', 'en', 'en']
True
test_exclude_removed_entities
(hass, hass_client)
Test if events are excluded on last update.
Test if events are excluded on last update.
async def test_exclude_removed_entities(hass, hass_client): """Test if events are excluded on last update.""" await hass.async_add_executor_job(init_recorder_component, hass) await async_setup_component(hass, "logbook", {}) await hass.async_add_executor_job(hass.data[recorder.DATA_INSTANCE].block_till_d...
[ "async", "def", "test_exclude_removed_entities", "(", "hass", ",", "hass_client", ")", ":", "await", "hass", ".", "async_add_executor_job", "(", "init_recorder_component", ",", "hass", ")", "await", "async_setup_component", "(", "hass", ",", "\"logbook\"", ",", "{",...
[ 716, 0 ]
[ 755, 54 ]
python
en
['en', 'en', 'en']
True
test_exclude_attribute_changes
(hass, hass_client)
Test if events of attribute changes are filtered.
Test if events of attribute changes are filtered.
async def test_exclude_attribute_changes(hass, hass_client): """Test if events of attribute changes are filtered.""" await hass.async_add_executor_job(init_recorder_component, hass) await async_setup_component(hass, "logbook", {}) await hass.async_add_executor_job(hass.data[recorder.DATA_INSTANCE].block...
[ "async", "def", "test_exclude_attribute_changes", "(", "hass", ",", "hass_client", ")", ":", "await", "hass", ".", "async_add_executor_job", "(", "init_recorder_component", ",", "hass", ")", "await", "async_setup_component", "(", "hass", ",", "\"logbook\"", ",", "{"...
[ 758, 0 ]
[ 793, 59 ]
python
en
['en', 'en', 'en']
True
test_logbook_entity_context_id
(hass, hass_client)
Test the logbook view with end_time and entity with automations and scripts.
Test the logbook view with end_time and entity with automations and scripts.
async def test_logbook_entity_context_id(hass, hass_client): """Test the logbook view with end_time and entity with automations and scripts.""" await hass.async_add_executor_job(init_recorder_component, hass) await async_setup_component(hass, "logbook", {}) await async_setup_component(hass, "automation"...
[ "async", "def", "test_logbook_entity_context_id", "(", "hass", ",", "hass_client", ")", ":", "await", "hass", ".", "async_add_executor_job", "(", "init_recorder_component", ",", "hass", ")", "await", "async_setup_component", "(", "hass", ",", "\"logbook\"", ",", "{"...
[ 796, 0 ]
[ 945, 80 ]
python
en
['en', 'en', 'en']
True
test_logbook_context_from_template
(hass, hass_client)
Test the logbook view with end_time and entity with automations and scripts.
Test the logbook view with end_time and entity with automations and scripts.
async def test_logbook_context_from_template(hass, hass_client): """Test the logbook view with end_time and entity with automations and scripts.""" await hass.async_add_executor_job(init_recorder_component, hass) await async_setup_component(hass, "logbook", {}) assert await async_setup_component( ...
[ "async", "def", "test_logbook_context_from_template", "(", "hass", ",", "hass_client", ")", ":", "await", "hass", ".", "async_add_executor_job", "(", "init_recorder_component", ",", "hass", ")", "await", "async_setup_component", "(", "hass", ",", "\"logbook\"", ",", ...
[ 948, 0 ]
[ 1031, 80 ]
python
en
['en', 'en', 'en']
True
test_logbook_entity_matches_only
(hass, hass_client)
Test the logbook view with a single entity and entity_matches_only.
Test the logbook view with a single entity and entity_matches_only.
async def test_logbook_entity_matches_only(hass, hass_client): """Test the logbook view with a single entity and entity_matches_only.""" await hass.async_add_executor_job(init_recorder_component, hass) await async_setup_component(hass, "logbook", {}) assert await async_setup_component( hass, ...
[ "async", "def", "test_logbook_entity_matches_only", "(", "hass", ",", "hass_client", ")", ":", "await", "hass", ".", "async_add_executor_job", "(", "init_recorder_component", ",", "hass", ")", "await", "async_setup_component", "(", "hass", ",", "\"logbook\"", ",", "...
[ 1034, 0 ]
[ 1105, 80 ]
python
en
['en', 'en', 'en']
True
test_logbook_entity_matches_only_multiple
(hass, hass_client)
Test the logbook view with a multiple entities and entity_matches_only.
Test the logbook view with a multiple entities and entity_matches_only.
async def test_logbook_entity_matches_only_multiple(hass, hass_client): """Test the logbook view with a multiple entities and entity_matches_only.""" await hass.async_add_executor_job(init_recorder_component, hass) await async_setup_component(hass, "logbook", {}) assert await async_setup_component( ...
[ "async", "def", "test_logbook_entity_matches_only_multiple", "(", "hass", ",", "hass_client", ")", ":", "await", "hass", ".", "async_add_executor_job", "(", "init_recorder_component", ",", "hass", ")", "await", "async_setup_component", "(", "hass", ",", "\"logbook\"", ...
[ 1108, 0 ]
[ 1189, 80 ]
python
en
['en', 'en', 'en']
True
test_logbook_invalid_entity
(hass, hass_client)
Test the logbook view with requesting an invalid entity.
Test the logbook view with requesting an invalid entity.
async def test_logbook_invalid_entity(hass, hass_client): """Test the logbook view with requesting an invalid entity.""" await hass.async_add_executor_job(init_recorder_component, hass) await async_setup_component(hass, "logbook", {}) await hass.async_block_till_done() client = await hass_client() ...
[ "async", "def", "test_logbook_invalid_entity", "(", "hass", ",", "hass_client", ")", ":", "await", "hass", ".", "async_add_executor_job", "(", "init_recorder_component", ",", "hass", ")", "await", "async_setup_component", "(", "hass", ",", "\"logbook\"", ",", "{", ...
[ 1192, 0 ]
[ 1208, 33 ]
python
en
['en', 'en', 'en']
True
test_icon_and_state
(hass, hass_client)
Test to ensure state and custom icons are returned.
Test to ensure state and custom icons are returned.
async def test_icon_and_state(hass, hass_client): """Test to ensure state and custom icons are returned.""" await hass.async_add_executor_job(init_recorder_component, hass) await async_setup_component(hass, "logbook", {}) await hass.async_add_executor_job(hass.data[recorder.DATA_INSTANCE].block_till_don...
[ "async", "def", "test_icon_and_state", "(", "hass", ",", "hass_client", ")", ":", "await", "hass", ".", "async_add_executor_job", "(", "init_recorder_component", ",", "hass", ")", "await", "async_setup_component", "(", "hass", ",", "\"logbook\"", ",", "{", "}", ...
[ 1211, 0 ]
[ 1246, 49 ]
python
en
['en', 'en', 'en']
True
test_exclude_events_domain
(hass, hass_client)
Test if events are filtered if domain is excluded in config.
Test if events are filtered if domain is excluded in config.
async def test_exclude_events_domain(hass, hass_client): """Test if events are filtered if domain is excluded in config.""" entity_id = "switch.bla" entity_id2 = "sensor.blu" config = logbook.CONFIG_SCHEMA( { ha.DOMAIN: {}, logbook.DOMAIN: {CONF_EXCLUDE: {CONF_DOMAINS: [...
[ "async", "def", "test_exclude_events_domain", "(", "hass", ",", "hass_client", ")", ":", "entity_id", "=", "\"switch.bla\"", "entity_id2", "=", "\"sensor.blu\"", "config", "=", "logbook", ".", "CONFIG_SCHEMA", "(", "{", "ha", ".", "DOMAIN", ":", "{", "}", ",",...
[ 1249, 0 ]
[ 1280, 63 ]
python
en
['en', 'en', 'en']
True
test_exclude_events_domain_glob
(hass, hass_client)
Test if events are filtered if domain or glob is excluded in config.
Test if events are filtered if domain or glob is excluded in config.
async def test_exclude_events_domain_glob(hass, hass_client): """Test if events are filtered if domain or glob is excluded in config.""" entity_id = "switch.bla" entity_id2 = "sensor.blu" entity_id3 = "sensor.excluded" config = logbook.CONFIG_SCHEMA( { ha.DOMAIN: {}, ...
[ "async", "def", "test_exclude_events_domain_glob", "(", "hass", ",", "hass_client", ")", ":", "entity_id", "=", "\"switch.bla\"", "entity_id2", "=", "\"sensor.blu\"", "entity_id3", "=", "\"sensor.excluded\"", "config", "=", "logbook", ".", "CONFIG_SCHEMA", "(", "{", ...
[ 1283, 0 ]
[ 1321, 63 ]
python
en
['en', 'en', 'en']
True
test_include_events_entity
(hass, hass_client)
Test if events are filtered if entity is included in config.
Test if events are filtered if entity is included in config.
async def test_include_events_entity(hass, hass_client): """Test if events are filtered if entity is included in config.""" entity_id = "sensor.bla" entity_id2 = "sensor.blu" config = logbook.CONFIG_SCHEMA( { ha.DOMAIN: {}, logbook.DOMAIN: { CONF_INCLUDE:...
[ "async", "def", "test_include_events_entity", "(", "hass", ",", "hass_client", ")", ":", "entity_id", "=", "\"sensor.bla\"", "entity_id2", "=", "\"sensor.blu\"", "config", "=", "logbook", ".", "CONFIG_SCHEMA", "(", "{", "ha", ".", "DOMAIN", ":", "{", "}", ",",...
[ 1324, 0 ]
[ 1359, 63 ]
python
en
['en', 'en', 'en']
True
test_exclude_events_entity
(hass, hass_client)
Test if events are filtered if entity is excluded in config.
Test if events are filtered if entity is excluded in config.
async def test_exclude_events_entity(hass, hass_client): """Test if events are filtered if entity is excluded in config.""" entity_id = "sensor.bla" entity_id2 = "sensor.blu" config = logbook.CONFIG_SCHEMA( { ha.DOMAIN: {}, logbook.DOMAIN: {CONF_EXCLUDE: {CONF_ENTITIES: ...
[ "async", "def", "test_exclude_events_entity", "(", "hass", ",", "hass_client", ")", ":", "entity_id", "=", "\"sensor.bla\"", "entity_id2", "=", "\"sensor.blu\"", "config", "=", "logbook", ".", "CONFIG_SCHEMA", "(", "{", "ha", ".", "DOMAIN", ":", "{", "}", ",",...
[ 1362, 0 ]
[ 1391, 63 ]
python
en
['en', 'en', 'en']
True
test_include_events_domain
(hass, hass_client)
Test if events are filtered if domain is included in config.
Test if events are filtered if domain is included in config.
async def test_include_events_domain(hass, hass_client): """Test if events are filtered if domain is included in config.""" assert await async_setup_component(hass, "alexa", {}) entity_id = "switch.bla" entity_id2 = "sensor.blu" config = logbook.CONFIG_SCHEMA( { ha.DOMAIN: {}, ...
[ "async", "def", "test_include_events_domain", "(", "hass", ",", "hass_client", ")", ":", "assert", "await", "async_setup_component", "(", "hass", ",", "\"alexa\"", ",", "{", "}", ")", "entity_id", "=", "\"switch.bla\"", "entity_id2", "=", "\"sensor.blu\"", "config...
[ 1394, 0 ]
[ 1431, 63 ]
python
en
['en', 'en', 'en']
True
test_include_events_domain_glob
(hass, hass_client)
Test if events are filtered if domain or glob is included in config.
Test if events are filtered if domain or glob is included in config.
async def test_include_events_domain_glob(hass, hass_client): """Test if events are filtered if domain or glob is included in config.""" assert await async_setup_component(hass, "alexa", {}) entity_id = "switch.bla" entity_id2 = "sensor.blu" entity_id3 = "switch.included" config = logbook.CONFIG...
[ "async", "def", "test_include_events_domain_glob", "(", "hass", ",", "hass_client", ")", ":", "assert", "await", "async_setup_component", "(", "hass", ",", "\"alexa\"", ",", "{", "}", ")", "entity_id", "=", "\"switch.bla\"", "entity_id2", "=", "\"sensor.blu\"", "e...
[ 1434, 0 ]
[ 1478, 68 ]
python
en
['en', 'en', 'en']
True
test_include_exclude_events
(hass, hass_client)
Test if events are filtered if include and exclude is configured.
Test if events are filtered if include and exclude is configured.
async def test_include_exclude_events(hass, hass_client): """Test if events are filtered if include and exclude is configured.""" entity_id = "switch.bla" entity_id2 = "sensor.blu" entity_id3 = "sensor.bli" entity_id4 = "sensor.keep" config = logbook.CONFIG_SCHEMA( { ha.DOMA...
[ "async", "def", "test_include_exclude_events", "(", "hass", ",", "hass_client", ")", ":", "entity_id", "=", "\"switch.bla\"", "entity_id2", "=", "\"sensor.blu\"", "entity_id3", "=", "\"sensor.bli\"", "entity_id4", "=", "\"sensor.keep\"", "config", "=", "logbook", ".",...
[ 1481, 0 ]
[ 1529, 64 ]
python
en
['en', 'en', 'en']
True
test_include_exclude_events_with_glob_filters
(hass, hass_client)
Test if events are filtered if include and exclude is configured.
Test if events are filtered if include and exclude is configured.
async def test_include_exclude_events_with_glob_filters(hass, hass_client): """Test if events are filtered if include and exclude is configured.""" entity_id = "switch.bla" entity_id2 = "sensor.blu" entity_id3 = "sensor.bli" entity_id4 = "light.included" entity_id5 = "switch.included" entity...
[ "async", "def", "test_include_exclude_events_with_glob_filters", "(", "hass", ",", "hass_client", ")", ":", "entity_id", "=", "\"switch.bla\"", "entity_id2", "=", "\"sensor.blu\"", "entity_id3", "=", "\"sensor.bli\"", "entity_id4", "=", "\"light.included\"", "entity_id5", ...
[ 1532, 0 ]
[ 1587, 68 ]
python
en
['en', 'en', 'en']
True
test_empty_config
(hass, hass_client)
Test we can handle an empty entity filter.
Test we can handle an empty entity filter.
async def test_empty_config(hass, hass_client): """Test we can handle an empty entity filter.""" entity_id = "sensor.blu" config = logbook.CONFIG_SCHEMA( { ha.DOMAIN: {}, logbook.DOMAIN: {}, } ) await hass.async_add_executor_job(init_recorder_component, hass)...
[ "async", "def", "test_empty_config", "(", "hass", ",", "hass_client", ")", ":", "entity_id", "=", "\"sensor.blu\"", "config", "=", "logbook", ".", "CONFIG_SCHEMA", "(", "{", "ha", ".", "DOMAIN", ":", "{", "}", ",", "logbook", ".", "DOMAIN", ":", "{", "}"...
[ 1590, 0 ]
[ 1617, 62 ]
python
en
['en', 'en', 'en']
True
_assert_entry
( entry, when=None, name=None, message=None, domain=None, entity_id=None )
Assert an entry is what is expected.
Assert an entry is what is expected.
def _assert_entry( entry, when=None, name=None, message=None, domain=None, entity_id=None ): """Assert an entry is what is expected.""" if when: assert when.isoformat() == entry["when"] if name: assert name == entry["name"] if message: assert message == entry["message"] ...
[ "def", "_assert_entry", "(", "entry", ",", "when", "=", "None", ",", "name", "=", "None", ",", "message", "=", "None", ",", "domain", "=", "None", ",", "entity_id", "=", "None", ")", ":", "if", "when", ":", "assert", "when", ".", "isoformat", "(", ...
[ 1643, 0 ]
[ 1660, 46 ]
python
en
['en', 'en', 'en']
True
MockLazyEventPartialState.data_entity_id
(self)
Lookup entity id.
Lookup entity id.
def data_entity_id(self): """Lookup entity id.""" return self.data.get(ATTR_ENTITY_ID)
[ "def", "data_entity_id", "(", "self", ")", ":", "return", "self", ".", "data", ".", "get", "(", "ATTR_ENTITY_ID", ")" ]
[ 1667, 4 ]
[ 1669, 44 ]
python
en
['en', 'so', 'en']
True
MockLazyEventPartialState.data_domain
(self)
Lookup domain.
Lookup domain.
def data_domain(self): """Lookup domain.""" return self.data.get(ATTR_DOMAIN)
[ "def", "data_domain", "(", "self", ")", ":", "return", "self", ".", "data", ".", "get", "(", "ATTR_DOMAIN", ")" ]
[ 1672, 4 ]
[ 1674, 41 ]
python
en
['nl', 'mg', 'en']
False
MockLazyEventPartialState.time_fired_minute
(self)
Minute the event was fired.
Minute the event was fired.
def time_fired_minute(self): """Minute the event was fired.""" return self.time_fired.minute
[ "def", "time_fired_minute", "(", "self", ")", ":", "return", "self", ".", "time_fired", ".", "minute" ]
[ 1677, 4 ]
[ 1679, 37 ]
python
en
['en', 'en', 'en']
True
MockLazyEventPartialState.context_user_id
(self)
Context user id of event.
Context user id of event.
def context_user_id(self): """Context user id of event.""" return self.context.user_id
[ "def", "context_user_id", "(", "self", ")", ":", "return", "self", ".", "context", ".", "user_id" ]
[ 1682, 4 ]
[ 1684, 35 ]
python
en
['en', 'en', 'en']
True
MockLazyEventPartialState.context_id
(self)
Context id of event.
Context id of event.
def context_id(self): """Context id of event.""" return self.context.id
[ "def", "context_id", "(", "self", ")", ":", "return", "self", ".", "context", ".", "id" ]
[ 1687, 4 ]
[ 1689, 30 ]
python
en
['en', 'en', 'en']
True
MockLazyEventPartialState.time_fired_isoformat
(self)
Time event was fired in utc isoformat.
Time event was fired in utc isoformat.
def time_fired_isoformat(self): """Time event was fired in utc isoformat.""" return process_timestamp_to_utc_isoformat(self.time_fired)
[ "def", "time_fired_isoformat", "(", "self", ")", ":", "return", "process_timestamp_to_utc_isoformat", "(", "self", ".", "time_fired", ")" ]
[ 1692, 4 ]
[ 1694, 66 ]
python
en
['en', 'en', 'en']
True
async_setup_platform
(hass, config, async_add_entities, discovery_info=None)
Set up the updater binary sensors.
Set up the updater binary sensors.
async def async_setup_platform(hass, config, async_add_entities, discovery_info=None): """Set up the updater binary sensors.""" if discovery_info is None: return async_add_entities([UpdaterBinary(hass.data[UPDATER_DOMAIN])])
[ "async", "def", "async_setup_platform", "(", "hass", ",", "config", ",", "async_add_entities", ",", "discovery_info", "=", "None", ")", ":", "if", "discovery_info", "is", "None", ":", "return", "async_add_entities", "(", "[", "UpdaterBinary", "(", "hass", ".", ...
[ 8, 0 ]
[ 13, 66 ]
python
en
['en', 'lb', 'en']
True
UpdaterBinary.name
(self)
Return the name of the binary sensor, if any.
Return the name of the binary sensor, if any.
def name(self) -> str: """Return the name of the binary sensor, if any.""" return "Updater"
[ "def", "name", "(", "self", ")", "->", "str", ":", "return", "\"Updater\"" ]
[ 20, 4 ]
[ 22, 24 ]
python
en
['en', 'ig', 'en']
True
UpdaterBinary.unique_id
(self)
Return a unique ID.
Return a unique ID.
def unique_id(self) -> str: """Return a unique ID.""" return "updater"
[ "def", "unique_id", "(", "self", ")", "->", "str", ":", "return", "\"updater\"" ]
[ 25, 4 ]
[ 27, 24 ]
python
ca
['fr', 'ca', 'en']
False
UpdaterBinary.is_on
(self)
Return true if the binary sensor is on.
Return true if the binary sensor is on.
def is_on(self) -> bool: """Return true if the binary sensor is on.""" if not self.coordinator.data: return None return self.coordinator.data.update_available
[ "def", "is_on", "(", "self", ")", "->", "bool", ":", "if", "not", "self", ".", "coordinator", ".", "data", ":", "return", "None", "return", "self", ".", "coordinator", ".", "data", ".", "update_available" ]
[ 30, 4 ]
[ 34, 53 ]
python
en
['en', 'fy', 'en']
True
UpdaterBinary.device_state_attributes
(self)
Return the optional state attributes.
Return the optional state attributes.
def device_state_attributes(self) -> dict: """Return the optional state attributes.""" if not self.coordinator.data: return None data = {} if self.coordinator.data.release_notes: data[ATTR_RELEASE_NOTES] = self.coordinator.data.release_notes if self.coordi...
[ "def", "device_state_attributes", "(", "self", ")", "->", "dict", ":", "if", "not", "self", ".", "coordinator", ".", "data", ":", "return", "None", "data", "=", "{", "}", "if", "self", ".", "coordinator", ".", "data", ".", "release_notes", ":", "data", ...
[ 37, 4 ]
[ 46, 19 ]
python
en
['en', 'en', 'en']
True
test_form
(hass)
Test we get the form.
Test we get the form.
async def test_form(hass): """Test we get the form.""" await setup.async_setup_component(hass, "persistent_notification", {}) result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": config_entries.SOURCE_USER} ) assert result["type"] == "form" assert result["errors...
[ "async", "def", "test_form", "(", "hass", ")", ":", "await", "setup", ".", "async_setup_component", "(", "hass", ",", "\"persistent_notification\"", ",", "{", "}", ")", "result", "=", "await", "hass", ".", "config_entries", ".", "flow", ".", "async_init", "(...
[ 11, 0 ]
[ 49, 48 ]
python
en
['en', 'en', 'en']
True
test_form_2fa
(hass)
Test we get the 2fa form.
Test we get the 2fa form.
async def test_form_2fa(hass): """Test we get the 2fa form.""" await setup.async_setup_component(hass, "persistent_notification", {}) result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": config_entries.SOURCE_USER} ) with patch("homeassistant.components.blink.confi...
[ "async", "def", "test_form_2fa", "(", "hass", ")", ":", "await", "setup", ".", "async_setup_component", "(", "hass", ",", "\"persistent_notification\"", ",", "{", "}", ")", "result", "=", "await", "hass", ".", "config_entries", ".", "flow", ".", "async_init", ...
[ 52, 0 ]
[ 96, 48 ]
python
en
['en', 'en', 'en']
True
test_form_2fa_connect_error
(hass)
Test we report a connect error during 2fa setup.
Test we report a connect error during 2fa setup.
async def test_form_2fa_connect_error(hass): """Test we report a connect error during 2fa setup.""" await setup.async_setup_component(hass, "persistent_notification", {}) result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": config_entries.SOURCE_USER} ) with patch(...
[ "async", "def", "test_form_2fa_connect_error", "(", "hass", ")", ":", "await", "setup", ".", "async_setup_component", "(", "hass", ",", "\"persistent_notification\"", ",", "{", "}", ")", "result", "=", "await", "hass", ".", "config_entries", ".", "flow", ".", ...
[ 99, 0 ]
[ 137, 58 ]
python
en
['en', 'en', 'en']
True
test_form_2fa_invalid_key
(hass)
Test we report an error if key is invalid.
Test we report an error if key is invalid.
async def test_form_2fa_invalid_key(hass): """Test we report an error if key is invalid.""" await setup.async_setup_component(hass, "persistent_notification", {}) result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": config_entries.SOURCE_USER} ) with patch("homeass...
[ "async", "def", "test_form_2fa_invalid_key", "(", "hass", ")", ":", "await", "setup", ".", "async_setup_component", "(", "hass", ",", "\"persistent_notification\"", ",", "{", "}", ")", "result", "=", "await", "hass", ".", "config_entries", ".", "flow", ".", "a...
[ 140, 0 ]
[ 178, 64 ]
python
en
['en', 'en', 'en']
True
test_form_2fa_unknown_error
(hass)
Test we report an unknown error during 2fa setup.
Test we report an unknown error during 2fa setup.
async def test_form_2fa_unknown_error(hass): """Test we report an unknown error during 2fa setup.""" await setup.async_setup_component(hass, "persistent_notification", {}) result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": config_entries.SOURCE_USER} ) with patch...
[ "async", "def", "test_form_2fa_unknown_error", "(", "hass", ")", ":", "await", "setup", ".", "async_setup_component", "(", "hass", ",", "\"persistent_notification\"", ",", "{", "}", ")", "result", "=", "await", "hass", ".", "config_entries", ".", "flow", ".", ...
[ 181, 0 ]
[ 219, 51 ]
python
en
['en', 'en', 'en']
True
test_form_invalid_auth
(hass)
Test we handle invalid auth.
Test we handle invalid auth.
async def test_form_invalid_auth(hass): """Test we handle invalid auth.""" result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": config_entries.SOURCE_USER} ) with patch( "homeassistant.components.blink.config_flow.Auth.startup", side_effect=LoginError, ...
[ "async", "def", "test_form_invalid_auth", "(", "hass", ")", ":", "result", "=", "await", "hass", ".", "config_entries", ".", "flow", ".", "async_init", "(", "DOMAIN", ",", "context", "=", "{", "\"source\"", ":", "config_entries", ".", "SOURCE_USER", "}", ")"...
[ 222, 0 ]
[ 237, 56 ]
python
en
['en', 'en', 'en']
True
test_form_unknown_error
(hass)
Test we handle unknown error at startup.
Test we handle unknown error at startup.
async def test_form_unknown_error(hass): """Test we handle unknown error at startup.""" result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": config_entries.SOURCE_USER} ) with patch( "homeassistant.components.blink.config_flow.Auth.startup", side_effect...
[ "async", "def", "test_form_unknown_error", "(", "hass", ")", ":", "result", "=", "await", "hass", ".", "config_entries", ".", "flow", ".", "async_init", "(", "DOMAIN", ",", "context", "=", "{", "\"source\"", ":", "config_entries", ".", "SOURCE_USER", "}", ")...
[ 240, 0 ]
[ 255, 51 ]
python
en
['en', 'de', 'en']
True
test_reauth_shows_user_step
(hass)
Test reauth shows the user form.
Test reauth shows the user form.
async def test_reauth_shows_user_step(hass): """Test reauth shows the user form.""" result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": "reauth"} ) assert result["type"] == data_entry_flow.RESULT_TYPE_FORM assert result["step_id"] == "user"
[ "async", "def", "test_reauth_shows_user_step", "(", "hass", ")", ":", "result", "=", "await", "hass", ".", "config_entries", ".", "flow", ".", "async_init", "(", "DOMAIN", ",", "context", "=", "{", "\"source\"", ":", "\"reauth\"", "}", ")", "assert", "result...
[ 258, 0 ]
[ 264, 38 ]
python
en
['en', 'en', 'en']
True
test_options_flow
(hass)
Test config flow options.
Test config flow options.
async def test_options_flow(hass): """Test config flow options.""" config_entry = MockConfigEntry( domain=DOMAIN, data={"username": "blink@example.com", "password": "example"}, options={}, entry_id=1, version=2, ) config_entry.add_to_hass(hass) mock_auth = Mo...
[ "async", "def", "test_options_flow", "(", "hass", ")", ":", "config_entry", "=", "MockConfigEntry", "(", "domain", "=", "DOMAIN", ",", "data", "=", "{", "\"username\"", ":", "\"blink@example.com\"", ",", "\"password\"", ":", "\"example\"", "}", ",", "options", ...
[ 267, 0 ]
[ 303, 39 ]
python
en
['en', 'fr', 'en']
True
test_get_id_empty
(hass, hass_storage)
Get unique ID.
Get unique ID.
async def test_get_id_empty(hass, hass_storage): """Get unique ID.""" uuid = await hass.helpers.instance_id.async_get() assert uuid is not None # Assert it's stored assert hass_storage["core.uuid"]["data"]["uuid"] == uuid
[ "async", "def", "test_get_id_empty", "(", "hass", ",", "hass_storage", ")", ":", "uuid", "=", "await", "hass", ".", "helpers", ".", "instance_id", ".", "async_get", "(", ")", "assert", "uuid", "is", "not", "None", "# Assert it's stored", "assert", "hass_storag...
[ 4, 0 ]
[ 9, 60 ]
python
en
['fr', 'la', 'en']
False
test_get_id_migrate
(hass, hass_storage)
Migrate existing file.
Migrate existing file.
async def test_get_id_migrate(hass, hass_storage): """Migrate existing file.""" with patch( "homeassistant.util.json.load_json", return_value={"uuid": "1234"} ), patch("os.path.isfile", return_value=True), patch("os.remove") as mock_remove: uuid = await hass.helpers.instance_id.async_get() ...
[ "async", "def", "test_get_id_migrate", "(", "hass", ",", "hass_storage", ")", ":", "with", "patch", "(", "\"homeassistant.util.json.load_json\"", ",", "return_value", "=", "{", "\"uuid\"", ":", "\"1234\"", "}", ")", ",", "patch", "(", "\"os.path.isfile\"", ",", ...
[ 12, 0 ]
[ 25, 43 ]
python
en
['es', 'en', 'en']
True
GAG.build_net
(self, is_training)
Build the whole neural network for the QA model.
Build the whole neural network for the QA model.
def build_net(self, is_training): """Build the whole neural network for the QA model.""" cfg = self.cfg with tf.device('/cpu:0'): word_embed = tf.get_variable( name='word_embed', initializer=self.embed, dtype=tf.float32, trainable=False) char_embed = tf.ge...
[ "def", "build_net", "(", "self", ",", "is_training", ")", ":", "cfg", "=", "self", ".", "cfg", "with", "tf", ".", "device", "(", "'/cpu:0'", ")", ":", "word_embed", "=", "tf", ".", "get_variable", "(", "name", "=", "'word_embed'", ",", "initializer", "...
[ 86, 4 ]
[ 232, 57 ]
python
en
['en', 'en', 'en']
True
GAG.build_char_states
(self, char_embed, is_training, reuse, char_ids, char_lengths)
Build char embedding network for the QA model.
Build char embedding network for the QA model.
def build_char_states(self, char_embed, is_training, reuse, char_ids, char_lengths): """Build char embedding network for the QA model.""" max_char_length = self.cfg.max_char_length inputs = dropout(tf.nn.embedding_lookup(char_embed, char_ids), self.cfg.dropout, is_train...
[ "def", "build_char_states", "(", "self", ",", "char_embed", ",", "is_training", ",", "reuse", ",", "char_ids", ",", "char_lengths", ")", ":", "max_char_length", "=", "self", ".", "cfg", ".", "max_char_length", "inputs", "=", "dropout", "(", "tf", ".", "nn", ...
[ 234, 4 ]
[ 263, 50 ]
python
en
['en', 'en', 'en']
True
test_setting_rising
(hass, legacy_patchable_time)
Test retrieving sun setting and rising.
Test retrieving sun setting and rising.
async def test_setting_rising(hass, legacy_patchable_time): """Test retrieving sun setting and rising.""" utc_now = datetime(2016, 11, 1, 8, 0, 0, tzinfo=dt_util.UTC) with patch("homeassistant.helpers.condition.dt_util.utcnow", return_value=utc_now): await async_setup_component( hass, su...
[ "async", "def", "test_setting_rising", "(", "hass", ",", "legacy_patchable_time", ")", ":", "utc_now", "=", "datetime", "(", "2016", ",", "11", ",", "1", ",", "8", ",", "0", ",", "0", ",", "tzinfo", "=", "dt_util", ".", "UTC", ")", "with", "patch", "...
[ 14, 0 ]
[ 102, 5 ]
python
en
['en', 'en', 'en']
True
test_state_change
(hass, legacy_patchable_time)
Test if the state changes at next setting/rising.
Test if the state changes at next setting/rising.
async def test_state_change(hass, legacy_patchable_time): """Test if the state changes at next setting/rising.""" now = datetime(2016, 6, 1, 8, 0, 0, tzinfo=dt_util.UTC) with patch("homeassistant.helpers.condition.dt_util.utcnow", return_value=now): await async_setup_component( hass, sun...
[ "async", "def", "test_state_change", "(", "hass", ",", "legacy_patchable_time", ")", ":", "now", "=", "datetime", "(", "2016", ",", "6", ",", "1", ",", "8", ",", "0", ",", "0", ",", "tzinfo", "=", "dt_util", ".", "UTC", ")", "with", "patch", "(", "...
[ 105, 0 ]
[ 135, 74 ]
python
en
['en', 'en', 'en']
True
test_norway_in_june
(hass)
Test location in Norway where the sun doesn't set in summer.
Test location in Norway where the sun doesn't set in summer.
async def test_norway_in_june(hass): """Test location in Norway where the sun doesn't set in summer.""" hass.config.latitude = 69.6 hass.config.longitude = 18.8 june = datetime(2016, 6, 1, tzinfo=dt_util.UTC) with patch("homeassistant.helpers.condition.dt_util.utcnow", return_value=june): ...
[ "async", "def", "test_norway_in_june", "(", "hass", ")", ":", "hass", ".", "config", ".", "latitude", "=", "69.6", "hass", ".", "config", ".", "longitude", "=", "18.8", "june", "=", "datetime", "(", "2016", ",", "6", ",", "1", ",", "tzinfo", "=", "dt...
[ 138, 0 ]
[ 160, 49 ]
python
en
['en', 'en', 'en']
True
test_state_change_count
(hass)
Count the number of state change events in a location.
Count the number of state change events in a location.
async def test_state_change_count(hass): """Count the number of state change events in a location.""" # Skipped because it's a bit slow. Has been validated with # multiple lattitudes and dates hass.config.latitude = 10 hass.config.longitude = 0 now = datetime(2016, 6, 1, tzinfo=dt_util.UTC) ...
[ "async", "def", "test_state_change_count", "(", "hass", ")", ":", "# Skipped because it's a bit slow. Has been validated with", "# multiple lattitudes and dates", "hass", ".", "config", ".", "latitude", "=", "10", "hass", ".", "config", ".", "longitude", "=", "0", "now"...
[ 164, 0 ]
[ 193, 28 ]
python
en
['en', 'en', 'en']
True
test_climate
( hass: HomeAssistant, vera_component_factory: ComponentFactory )
Test function.
Test function.
async def test_climate( hass: HomeAssistant, vera_component_factory: ComponentFactory ) -> None: """Test function.""" vera_device = MagicMock(spec=pv.VeraThermostat) # type: pv.VeraThermostat vera_device.device_id = 1 vera_device.vera_device_id = vera_device.device_id vera_device.name = "dev1" ...
[ "async", "def", "test_climate", "(", "hass", ":", "HomeAssistant", ",", "vera_component_factory", ":", "ComponentFactory", ")", "->", "None", ":", "vera_device", "=", "MagicMock", "(", "spec", "=", "pv", ".", "VeraThermostat", ")", "# type: pv.VeraThermostat", "ve...
[ 18, 0 ]
[ 125, 69 ]
python
en
['en', 'en', 'en']
False
test_climate_f
( hass: HomeAssistant, vera_component_factory: ComponentFactory )
Test function.
Test function.
async def test_climate_f( hass: HomeAssistant, vera_component_factory: ComponentFactory ) -> None: """Test function.""" vera_device = MagicMock(spec=pv.VeraThermostat) # type: pv.VeraThermostat vera_device.device_id = 1 vera_device.vera_device_id = vera_device.device_id vera_device.name = "dev1...
[ "async", "def", "test_climate_f", "(", "hass", ":", "HomeAssistant", ",", "vera_component_factory", ":", "ComponentFactory", ")", "->", "None", ":", "vera_device", "=", "MagicMock", "(", "spec", "=", "pv", ".", "VeraThermostat", ")", "# type: pv.VeraThermostat", "...
[ 128, 0 ]
[ 166, 71 ]
python
en
['en', 'en', 'en']
False
setup
(hass, config)
Set up the STIEBEL ELTRON unit. Will automatically load climate platform.
Set up the STIEBEL ELTRON unit.
def setup(hass, config): """Set up the STIEBEL ELTRON unit. Will automatically load climate platform. """ name = config[DOMAIN][CONF_NAME] modbus_client = hass.data[MODBUS_DOMAIN][config[DOMAIN][CONF_HUB]] hass.data[DOMAIN] = { "name": name, "ste_data": StiebelEltronData(name, ...
[ "def", "setup", "(", "hass", ",", "config", ")", ":", "name", "=", "config", "[", "DOMAIN", "]", "[", "CONF_NAME", "]", "modbus_client", "=", "hass", ".", "data", "[", "MODBUS_DOMAIN", "]", "[", "config", "[", "DOMAIN", "]", "[", "CONF_HUB", "]", "]"...
[ 32, 0 ]
[ 46, 15 ]
python
en
['en', 'fr', 'en']
True
StiebelEltronData.__init__
(self, name, modbus_client)
Init the STIEBEL ELTRON data object.
Init the STIEBEL ELTRON data object.
def __init__(self, name, modbus_client): """Init the STIEBEL ELTRON data object.""" self.api = pystiebeleltron.StiebelEltronAPI(modbus_client, 1)
[ "def", "__init__", "(", "self", ",", "name", ",", "modbus_client", ")", ":", "self", ".", "api", "=", "pystiebeleltron", ".", "StiebelEltronAPI", "(", "modbus_client", ",", "1", ")" ]
[ 52, 4 ]
[ 55, 69 ]
python
en
['en', 'en', 'en']
True
StiebelEltronData.update
(self)
Update unit data.
Update unit data.
def update(self): """Update unit data.""" if not self.api.update(): _LOGGER.warning("Modbus read failed") else: _LOGGER.debug("Data updated successfully")
[ "def", "update", "(", "self", ")", ":", "if", "not", "self", ".", "api", ".", "update", "(", ")", ":", "_LOGGER", ".", "warning", "(", "\"Modbus read failed\"", ")", "else", ":", "_LOGGER", ".", "debug", "(", "\"Data updated successfully\"", ")" ]
[ 58, 4 ]
[ 63, 54 ]
python
co
['fr', 'co', 'en']
False
shift_tokens_right
(input_ids: torch.Tensor, pad_token_id: int, decoder_start_token_id: int)
Shift input ids one token to the right.
Shift input ids one token to the right.
def shift_tokens_right(input_ids: torch.Tensor, pad_token_id: int, decoder_start_token_id: int): """ Shift input ids one token to the right. """ shifted_input_ids = input_ids.new_zeros(input_ids.shape) shifted_input_ids[:, 1:] = input_ids[:, :-1].clone() shifted_input_ids[:, 0] = decoder_start_t...
[ "def", "shift_tokens_right", "(", "input_ids", ":", "torch", ".", "Tensor", ",", "pad_token_id", ":", "int", ",", "decoder_start_token_id", ":", "int", ")", ":", "shifted_input_ids", "=", "input_ids", ".", "new_zeros", "(", "input_ids", ".", "shape", ")", "shi...
[ 60, 0 ]
[ 72, 28 ]
python
en
['en', 'error', 'th']
False
_make_causal_mask
(input_ids_shape: torch.Size, dtype: torch.dtype, past_key_values_length: int = 0)
Make causal mask used for bi-directional self-attention.
Make causal mask used for bi-directional self-attention.
def _make_causal_mask(input_ids_shape: torch.Size, dtype: torch.dtype, past_key_values_length: int = 0): """ Make causal mask used for bi-directional self-attention. """ bsz, tgt_len = input_ids_shape mask = torch.full((tgt_len, tgt_len), float("-inf")) mask_cond = torch.arange(mask.size(-1)) ...
[ "def", "_make_causal_mask", "(", "input_ids_shape", ":", "torch", ".", "Size", ",", "dtype", ":", "torch", ".", "dtype", ",", "past_key_values_length", ":", "int", "=", "0", ")", ":", "bsz", ",", "tgt_len", "=", "input_ids_shape", "mask", "=", "torch", "."...
[ 76, 0 ]
[ 88, 91 ]
python
en
['en', 'error', 'th']
False
_expand_mask
(mask: torch.Tensor, dtype: torch.dtype, tgt_len: Optional[int] = None)
Expands attention_mask from `[bsz, seq_len]` to `[bsz, 1, tgt_seq_len, src_seq_len]`.
Expands attention_mask from `[bsz, seq_len]` to `[bsz, 1, tgt_seq_len, src_seq_len]`.
def _expand_mask(mask: torch.Tensor, dtype: torch.dtype, tgt_len: Optional[int] = None): """ Expands attention_mask from `[bsz, seq_len]` to `[bsz, 1, tgt_seq_len, src_seq_len]`. """ bsz, src_len = mask.size() tgt_len = tgt_len if tgt_len is not None else src_len expanded_mask = mask[:, None, N...
[ "def", "_expand_mask", "(", "mask", ":", "torch", ".", "Tensor", ",", "dtype", ":", "torch", ".", "dtype", ",", "tgt_len", ":", "Optional", "[", "int", "]", "=", "None", ")", ":", "bsz", ",", "src_len", "=", "mask", ".", "size", "(", ")", "tgt_len"...
[ 92, 0 ]
[ 103, 82 ]
python
en
['en', 'error', 'th']
False
BlenderbotSmallLearnedPositionalEmbedding.forward
(self, input_ids_shape: torch.Size, past_key_values_length: int = 0)
`input_ids_shape` is expected to be [bsz x seqlen].
`input_ids_shape` is expected to be [bsz x seqlen].
def forward(self, input_ids_shape: torch.Size, past_key_values_length: int = 0): """`input_ids_shape` is expected to be [bsz x seqlen].""" bsz, seq_len = input_ids_shape[:2] positions = torch.arange( past_key_values_length, past_key_values_length + seq_len, dtype=torch.long, device=s...
[ "def", "forward", "(", "self", ",", "input_ids_shape", ":", "torch", ".", "Size", ",", "past_key_values_length", ":", "int", "=", "0", ")", ":", "bsz", ",", "seq_len", "=", "input_ids_shape", "[", ":", "2", "]", "positions", "=", "torch", ".", "arange", ...
[ 115, 4 ]
[ 121, 41 ]
python
en
['en', 'en', 'en']
True
BlenderbotSmallAttention.forward
( self, hidden_states: torch.Tensor, key_value_states: Optional[torch.Tensor] = None, past_key_value: Optional[Tuple[torch.Tensor]] = None, attention_mask: Optional[torch.Tensor] = None, layer_head_mask: Optional[torch.Tensor] = None, output_attentions: bool = Fal...
Input shape: Batch x Time x Channel
Input shape: Batch x Time x Channel
def forward( self, hidden_states: torch.Tensor, key_value_states: Optional[torch.Tensor] = None, past_key_value: Optional[Tuple[torch.Tensor]] = None, attention_mask: Optional[torch.Tensor] = None, layer_head_mask: Optional[torch.Tensor] = None, output_attentions:...
[ "def", "forward", "(", "self", ",", "hidden_states", ":", "torch", ".", "Tensor", ",", "key_value_states", ":", "Optional", "[", "torch", ".", "Tensor", "]", "=", "None", ",", "past_key_value", ":", "Optional", "[", "Tuple", "[", "torch", ".", "Tensor", ...
[ 155, 4 ]
[ 264, 65 ]
python
en
['en', 'pl', 'en']
True
BlenderbotSmallEncoderLayer.forward
( self, hidden_states: torch.Tensor, attention_mask: torch.Tensor, layer_head_mask: torch.Tensor, output_attentions: bool = False, )
Args: hidden_states (:obj:`torch.FloatTensor`): input to the layer of shape `(seq_len, batch, embed_dim)` attention_mask (:obj:`torch.FloatTensor`): attention mask of size `(batch, 1, tgt_len, src_len)` where padding elements are indicated by very large negative values. ...
Args: hidden_states (:obj:`torch.FloatTensor`): input to the layer of shape `(seq_len, batch, embed_dim)` attention_mask (:obj:`torch.FloatTensor`): attention mask of size `(batch, 1, tgt_len, src_len)` where padding elements are indicated by very large negative values. ...
def forward( self, hidden_states: torch.Tensor, attention_mask: torch.Tensor, layer_head_mask: torch.Tensor, output_attentions: bool = False, ): """ Args: hidden_states (:obj:`torch.FloatTensor`): input to the layer of shape `(seq_len, batch, embed...
[ "def", "forward", "(", "self", ",", "hidden_states", ":", "torch", ".", "Tensor", ",", "attention_mask", ":", "torch", ".", "Tensor", ",", "layer_head_mask", ":", "torch", ".", "Tensor", ",", "output_attentions", ":", "bool", "=", "False", ",", ")", ":", ...
[ 285, 4 ]
[ 333, 22 ]
python
en
['en', 'error', 'th']
False
BlenderbotSmallDecoderLayer.forward
( self, hidden_states: torch.Tensor, attention_mask: Optional[torch.Tensor] = None, encoder_hidden_states: Optional[torch.Tensor] = None, encoder_attention_mask: Optional[torch.Tensor] = None, layer_head_mask: Optional[torch.Tensor] = None, encoder_layer_head_mask...
Args: hidden_states (:obj:`torch.FloatTensor`): input to the layer of shape `(seq_len, batch, embed_dim)` attention_mask (:obj:`torch.FloatTensor`): attention mask of size `(batch, 1, tgt_len, src_len)` where padding elements are indicated by very large negative values. ...
Args: hidden_states (:obj:`torch.FloatTensor`): input to the layer of shape `(seq_len, batch, embed_dim)` attention_mask (:obj:`torch.FloatTensor`): attention mask of size `(batch, 1, tgt_len, src_len)` where padding elements are indicated by very large negative values. ...
def forward( self, hidden_states: torch.Tensor, attention_mask: Optional[torch.Tensor] = None, encoder_hidden_states: Optional[torch.Tensor] = None, encoder_attention_mask: Optional[torch.Tensor] = None, layer_head_mask: Optional[torch.Tensor] = None, encoder_laye...
[ "def", "forward", "(", "self", ",", "hidden_states", ":", "torch", ".", "Tensor", ",", "attention_mask", ":", "Optional", "[", "torch", ".", "Tensor", "]", "=", "None", ",", "encoder_hidden_states", ":", "Optional", "[", "torch", ".", "Tensor", "]", "=", ...
[ 364, 4 ]
[ 450, 22 ]
python
en
['en', 'error', 'th']
False
BlenderbotSmallEncoder.forward
( self, input_ids=None, attention_mask=None, head_mask=None, inputs_embeds=None, output_attentions=None, output_hidden_states=None, return_dict=None, )
r""" Args: input_ids (:obj:`torch.LongTensor` of shape :obj:`(batch_size, sequence_length)`): Indices of input sequence tokens in the vocabulary. Padding will be ignored by default should you provide it. Indices can be obtained using :class:`~transfor...
r""" Args: input_ids (:obj:`torch.LongTensor` of shape :obj:`(batch_size, sequence_length)`): Indices of input sequence tokens in the vocabulary. Padding will be ignored by default should you provide it.
def forward( self, input_ids=None, attention_mask=None, head_mask=None, inputs_embeds=None, output_attentions=None, output_hidden_states=None, return_dict=None, ): r""" Args: input_ids (:obj:`torch.LongTensor` of shape :obj:...
[ "def", "forward", "(", "self", ",", "input_ids", "=", "None", ",", "attention_mask", "=", "None", ",", "head_mask", "=", "None", ",", "inputs_embeds", "=", "None", ",", "output_attentions", "=", "None", ",", "output_hidden_states", "=", "None", ",", "return_...
[ 645, 4 ]
[ 773, 9 ]
python
cy
['en', 'cy', 'hi']
False
BlenderbotSmallDecoder.forward
( self, input_ids=None, attention_mask=None, encoder_hidden_states=None, encoder_attention_mask=None, head_mask=None, encoder_head_mask=None, past_key_values=None, inputs_embeds=None, use_cache=None, output_attentions=None, ...
r""" Args: input_ids (:obj:`torch.LongTensor` of shape :obj:`(batch_size, sequence_length)`): Indices of input sequence tokens in the vocabulary. Padding will be ignored by default should you provide it. Indices can be obtained using :class:`~transfor...
r""" Args: input_ids (:obj:`torch.LongTensor` of shape :obj:`(batch_size, sequence_length)`): Indices of input sequence tokens in the vocabulary. Padding will be ignored by default should you provide it.
def forward( self, input_ids=None, attention_mask=None, encoder_hidden_states=None, encoder_attention_mask=None, head_mask=None, encoder_head_mask=None, past_key_values=None, inputs_embeds=None, use_cache=None, output_attentions=Non...
[ "def", "forward", "(", "self", ",", "input_ids", "=", "None", ",", "attention_mask", "=", "None", ",", "encoder_hidden_states", "=", "None", ",", "encoder_attention_mask", "=", "None", ",", "head_mask", "=", "None", ",", "encoder_head_mask", "=", "None", ",", ...
[ 833, 4 ]
[ 1040, 9 ]
python
cy
['en', 'cy', 'hi']
False
BlenderbotSmallForCausalLM.forward
( self, input_ids=None, attention_mask=None, encoder_hidden_states=None, encoder_attention_mask=None, head_mask=None, encoder_head_mask=None, past_key_values=None, inputs_embeds=None, labels=None, use_cache=None, output_atte...
r""" Args: input_ids (:obj:`torch.LongTensor` of shape :obj:`(batch_size, sequence_length)`): Indices of input sequence tokens in the vocabulary. Padding will be ignored by default should you provide it. Indices can be obtained using :class:`~transfor...
r""" Args: input_ids (:obj:`torch.LongTensor` of shape :obj:`(batch_size, sequence_length)`): Indices of input sequence tokens in the vocabulary. Padding will be ignored by default should you provide it.
def forward( self, input_ids=None, attention_mask=None, encoder_hidden_states=None, encoder_attention_mask=None, head_mask=None, encoder_head_mask=None, past_key_values=None, inputs_embeds=None, labels=None, use_cache=None, ...
[ "def", "forward", "(", "self", ",", "input_ids", "=", "None", ",", "attention_mask", "=", "None", ",", "encoder_hidden_states", "=", "None", ",", "encoder_attention_mask", "=", "None", ",", "head_mask", "=", "None", ",", "encoder_head_mask", "=", "None", ",", ...
[ 1369, 4 ]
[ 1504, 9 ]
python
cy
['en', 'cy', 'hi']
False
TFMobileBertEmbeddings.call
(self, input_ids=None, position_ids=None, token_type_ids=None, inputs_embeds=None, training=False)
Applies embedding based on inputs tensor. Returns: final_embeddings (:obj:`tf.Tensor`): output embedding tensor.
Applies embedding based on inputs tensor.
def call(self, input_ids=None, position_ids=None, token_type_ids=None, inputs_embeds=None, training=False): """ Applies embedding based on inputs tensor. Returns: final_embeddings (:obj:`tf.Tensor`): output embedding tensor. """ assert not (input_ids is None and inpu...
[ "def", "call", "(", "self", ",", "input_ids", "=", "None", ",", "position_ids", "=", "None", ",", "token_type_ids", "=", "None", ",", "inputs_embeds", "=", "None", ",", "training", "=", "False", ")", ":", "assert", "not", "(", "input_ids", "is", "None", ...
[ 157, 4 ]
[ 204, 31 ]
python
en
['en', 'error', 'th']
False
handle_metrics
(split, metrics, output_dir)
Log and save metrics Args: - split: one of train, val, test - metrics: metrics dict - output_dir: where to save the metrics
Log and save metrics
def handle_metrics(split, metrics, output_dir): """ Log and save metrics Args: - split: one of train, val, test - metrics: metrics dict - output_dir: where to save the metrics """ logger.info(f"***** {split} metrics *****") for key in sorted(metrics.keys()): logger.info(f" ...
[ "def", "handle_metrics", "(", "split", ",", "metrics", ",", "output_dir", ")", ":", "logger", ".", "info", "(", "f\"***** {split} metrics *****\"", ")", "for", "key", "in", "sorted", "(", "metrics", ".", "keys", "(", ")", ")", ":", "logger", ".", "info", ...
[ 131, 0 ]
[ 144, 73 ]
python
en
['en', 'error', 'th']
False
get_optim_f_stop
(maxiter, maxtime, dftol_stop, freltol_stop, minibatch=True)
Check stopping conditions.
Check stopping conditions.
def get_optim_f_stop(maxiter, maxtime, dftol_stop, freltol_stop, minibatch=True): """ Check stopping conditions. """ discount_factor = 1. / 3 total_t = [0.] df_store = [np.nan] it_store = [0] relchange_store = [np.nan] f_ma = EMA(discount_factor=discount_factor...
[ "def", "get_optim_f_stop", "(", "maxiter", ",", "maxtime", ",", "dftol_stop", ",", "freltol_stop", ",", "minibatch", "=", "True", ")", ":", "discount_factor", "=", "1.", "/", "3", "total_t", "=", "[", "0.", "]", "df_store", "=", "[", "np", ".", "nan", ...
[ 36, 0 ]
[ 88, 49 ]
python
en
['en', 'error', 'th']
False
get_init
(data_train, init_type='on', rng=np.random.RandomState(0), prev_score=None)
Initialize the 'x' variable with different settings
Initialize the 'x' variable with different settings
def get_init(data_train, init_type='on', rng=np.random.RandomState(0), prev_score=None): """ Initialize the 'x' variable with different settings """ D = data_train.n_features value_off = constants.Initialization.VALUE_DICT[ constants.Initialization.OFF] value_on = constants.Initializati...
[ "def", "get_init", "(", "data_train", ",", "init_type", "=", "'on'", ",", "rng", "=", "np", ".", "random", ".", "RandomState", "(", "0", ")", ",", "prev_score", "=", "None", ")", ":", "D", "=", "data_train", ".", "n_features", "value_off", "=", "consta...
[ 91, 0 ]
[ 125, 56 ]
python
en
['en', 'error', 'th']
False
get_checkpoint
(S, stop_conds, rng=None, get_state=True)
Save the necessary information into a dictionary
Save the necessary information into a dictionary
def get_checkpoint(S, stop_conds, rng=None, get_state=True): """ Save the necessary information into a dictionary """ m = {} m['ninitfeats'] = S.ninitfeats m['x0'] = S.x0 x = S.x.clone().cpu().detach() m['feats'] = np.where(x.numpy() >= 0)[0] m.update({k: v[0] for k, v in stop_conds...
[ "def", "get_checkpoint", "(", "S", ",", "stop_conds", ",", "rng", "=", "None", ",", "get_state", "=", "True", ")", ":", "m", "=", "{", "}", "m", "[", "'ninitfeats'", "]", "=", "S", ".", "ninitfeats", "m", "[", "'x0'", "]", "=", "S", ".", "x0", ...
[ 128, 0 ]
[ 147, 12 ]
python
en
['en', 'error', 'th']
False
_train
(data_train, Nminibatch, order, C, rng, lr_train, debug, maxiter, maxtime, init, dftol_stop, freltol_stop, dn_log, accum_steps, path_save, shuffle, device=constants.Device.CPU, verbose=1, prev_checkpoint=None, groups=None, soft_groups=None)
Main training loop.
Main training loop.
def _train(data_train, Nminibatch, order, C, rng, lr_train, debug, maxiter, maxtime, init, dftol_stop, freltol_stop, dn_log, accum_steps, path_save, shuffle, device=constants.Device.CPU, verbose=1, prev_checkpoint=None, groups=None, soft_groups=None): ...
[ "def", "_train", "(", "data_train", ",", "Nminibatch", ",", "order", ",", "C", ",", "rng", ",", "lr_train", ",", "debug", ",", "maxiter", ",", "maxtime", ",", "init", ",", "dftol_stop", ",", "freltol_stop", ",", "dn_log", ",", "accum_steps", ",", "path_s...
[ 150, 0 ]
[ 203, 48 ]
python
en
['en', 'error', 'th']
False
async_setup_platform
(hass, config, async_add_entities, discovery_info=None)
Set up the IP Webcam binary sensors.
Set up the IP Webcam binary sensors.
async def async_setup_platform(hass, config, async_add_entities, discovery_info=None): """Set up the IP Webcam binary sensors.""" if discovery_info is None: return host = discovery_info[CONF_HOST] name = discovery_info[CONF_NAME] ipcam = hass.data[DATA_IP_WEBCAM][host] async_add_entiti...
[ "async", "def", "async_setup_platform", "(", "hass", ",", "config", ",", "async_add_entities", ",", "discovery_info", "=", "None", ")", ":", "if", "discovery_info", "is", "None", ":", "return", "host", "=", "discovery_info", "[", "CONF_HOST", "]", "name", "=",...
[ 9, 0 ]
[ 18, 88 ]
python
en
['en', 'bg', 'en']
True
IPWebcamBinarySensor.__init__
(self, name, host, ipcam, sensor)
Initialize the binary sensor.
Initialize the binary sensor.
def __init__(self, name, host, ipcam, sensor): """Initialize the binary sensor.""" super().__init__(host, ipcam) self._sensor = sensor self._mapped_name = KEY_MAP.get(self._sensor, self._sensor) self._name = f"{name} {self._mapped_name}" self._state = None self._...
[ "def", "__init__", "(", "self", ",", "name", ",", "host", ",", "ipcam", ",", "sensor", ")", ":", "super", "(", ")", ".", "__init__", "(", "host", ",", "ipcam", ")", "self", ".", "_sensor", "=", "sensor", "self", ".", "_mapped_name", "=", "KEY_MAP", ...
[ 24, 4 ]
[ 32, 25 ]
python
en
['en', 'haw', 'en']
True
IPWebcamBinarySensor.name
(self)
Return the name of the binary sensor, if any.
Return the name of the binary sensor, if any.
def name(self): """Return the name of the binary sensor, if any.""" return self._name
[ "def", "name", "(", "self", ")", ":", "return", "self", ".", "_name" ]
[ 35, 4 ]
[ 37, 25 ]
python
en
['en', 'ig', 'en']
True
IPWebcamBinarySensor.is_on
(self)
Return true if the binary sensor is on.
Return true if the binary sensor is on.
def is_on(self): """Return true if the binary sensor is on.""" return self._state
[ "def", "is_on", "(", "self", ")", ":", "return", "self", ".", "_state" ]
[ 40, 4 ]
[ 42, 26 ]
python
en
['en', 'fy', 'en']
True
IPWebcamBinarySensor.async_update
(self)
Retrieve latest state.
Retrieve latest state.
async def async_update(self): """Retrieve latest state.""" state, _ = self._ipcam.export_sensor(self._sensor) self._state = state == 1.0
[ "async", "def", "async_update", "(", "self", ")", ":", "state", ",", "_", "=", "self", ".", "_ipcam", ".", "export_sensor", "(", "self", ".", "_sensor", ")", "self", ".", "_state", "=", "state", "==", "1.0" ]
[ 44, 4 ]
[ 47, 34 ]
python
en
['es', 'sk', 'en']
False
IPWebcamBinarySensor.device_class
(self)
Return the class of this device, from component DEVICE_CLASSES.
Return the class of this device, from component DEVICE_CLASSES.
def device_class(self): """Return the class of this device, from component DEVICE_CLASSES.""" return DEVICE_CLASS_MOTION
[ "def", "device_class", "(", "self", ")", ":", "return", "DEVICE_CLASS_MOTION" ]
[ 50, 4 ]
[ 52, 34 ]
python
en
['en', 'en', 'en']
True
AbsAgent.choose_action
(self, state)
This method uses the underlying model(s) to compute an action from a shaped state. Args: state: A state object shaped by a ``StateShaper`` to conform to the model input format. Returns: The action to be taken given ``state``. It is usually necessary to use an ``ActionShaper`` t...
This method uses the underlying model(s) to compute an action from a shaped state.
def choose_action(self, state): """This method uses the underlying model(s) to compute an action from a shaped state. Args: state: A state object shaped by a ``StateShaper`` to conform to the model input format. Returns: The action to be taken given ``state``. It is usu...
[ "def", "choose_action", "(", "self", ",", "state", ")", ":", "return", "NotImplementedError" ]
[ 33, 4 ]
[ 43, 34 ]
python
en
['en', 'en', 'en']
True
AbsAgent.learn
(self, *args, **kwargs)
Algorithm-specific training logic. The parameters are data to train the underlying model on. Algorithm-specific loss and optimization should be reflected here.
Algorithm-specific training logic.
def learn(self, *args, **kwargs): """Algorithm-specific training logic. The parameters are data to train the underlying model on. Algorithm-specific loss and optimization should be reflected here. """ return NotImplementedError
[ "def", "learn", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "NotImplementedError" ]
[ 49, 4 ]
[ 55, 34 ]
python
en
['en', 'la', 'en']
True
AbsAgent.load_model
(self, model)
Load models from memory.
Load models from memory.
def load_model(self, model): """Load models from memory.""" self.model.load_state_dict(model)
[ "def", "load_model", "(", "self", ",", "model", ")", ":", "self", ".", "model", ".", "load_state_dict", "(", "model", ")" ]
[ 57, 4 ]
[ 59, 41 ]
python
en
['en', 'en', 'en']
True
AbsAgent.dump_model
(self)
Return the algorithm's trainable models.
Return the algorithm's trainable models.
def dump_model(self): """Return the algorithm's trainable models.""" return self.model.state_dict()
[ "def", "dump_model", "(", "self", ")", ":", "return", "self", ".", "model", ".", "state_dict", "(", ")" ]
[ 61, 4 ]
[ 63, 38 ]
python
en
['en', 'no', 'en']
True
AbsAgent.load_model_from_file
(self, path: str)
Load trainable models from disk. Load trainable models from the specified directory. The model file is always prefixed with the agent's name. Args: path (str): path to the directory where the models are saved.
Load trainable models from disk.
def load_model_from_file(self, path: str): """Load trainable models from disk. Load trainable models from the specified directory. The model file is always prefixed with the agent's name. Args: path (str): path to the directory where the models are saved. """ self.m...
[ "def", "load_model_from_file", "(", "self", ",", "path", ":", "str", ")", ":", "self", ".", "model", ".", "load_state_dict", "(", "torch", ".", "load", "(", "path", ")", ")" ]
[ 65, 4 ]
[ 73, 52 ]
python
en
['en', 'en', 'en']
True
AbsAgent.dump_model_to_file
(self, path: str)
Dump the algorithm's trainable models to disk. Dump trainable models to the specified directory. The model file is always prefixed with the agent's name. Args: path (str): path to the directory where the models are saved.
Dump the algorithm's trainable models to disk.
def dump_model_to_file(self, path: str): """Dump the algorithm's trainable models to disk. Dump trainable models to the specified directory. The model file is always prefixed with the agent's name. Args: path (str): path to the directory where the models are saved. """ ...
[ "def", "dump_model_to_file", "(", "self", ",", "path", ":", "str", ")", ":", "torch", ".", "save", "(", "self", ".", "model", ".", "state_dict", "(", ")", ",", "path", ")" ]
[ 75, 4 ]
[ 83, 49 ]
python
en
['en', 'en', 'en']
True
ConfigFlow.async_get_options_flow
(config_entry)
Get the options flow for this handler.
Get the options flow for this handler.
def async_get_options_flow(config_entry): """Get the options flow for this handler.""" return OptionsFlowHandler(config_entry)
[ "def", "async_get_options_flow", "(", "config_entry", ")", ":", "return", "OptionsFlowHandler", "(", "config_entry", ")" ]
[ 24, 4 ]
[ 26, 47 ]
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: name = user_input[CONF_NAME] longitude = user_input[CONF_LONGITUDE] latitude = user_input[CONF_LATITUDE] session = aiohttp_cli...
[ "async", "def", "async_step_user", "(", "self", ",", "user_input", "=", "None", ")", ":", "errors", "=", "{", "}", "if", "user_input", "is", "not", "None", ":", "name", "=", "user_input", "[", "CONF_NAME", "]", "longitude", "=", "user_input", "[", "CONF_...
[ 28, 4 ]
[ 78, 9 ]
python
en
['en', 'en', 'en']
True
OptionsFlowHandler.__init__
(self, config_entry)
Initialize options flow.
Initialize options flow.
def __init__(self, config_entry): """Initialize options flow.""" self.config_entry = config_entry
[ "def", "__init__", "(", "self", ",", "config_entry", ")", ":", "self", ".", "config_entry", "=", "config_entry" ]
[ 84, 4 ]
[ 86, 40 ]
python
en
['en', 'en', 'en']
True
OptionsFlowHandler.async_step_init
(self, user_input=None)
Manage options.
Manage options.
async def async_step_init(self, user_input=None): """Manage options.""" if user_input is not None: return self.async_create_entry(title="", data=user_input) return self.async_show_form( step_id="init", data_schema=vol.Schema( { ...
[ "async", "def", "async_step_init", "(", "self", ",", "user_input", "=", "None", ")", ":", "if", "user_input", "is", "not", "None", ":", "return", "self", ".", "async_create_entry", "(", "title", "=", "\"\"", ",", "data", "=", "user_input", ")", "return", ...
[ 88, 4 ]
[ 109, 9 ]
python
en
['en', 'en', 'en']
False
setup
(hass, config)
Initialize the Shiftr.io MQTT consumer.
Initialize the Shiftr.io MQTT consumer.
def setup(hass, config): """Initialize the Shiftr.io MQTT consumer.""" conf = config[DOMAIN] username = conf.get(CONF_USERNAME) password = conf.get(CONF_PASSWORD) client_id = "HomeAssistant" port = 1883 keepalive = 600 mqttc = mqtt.Client(client_id, protocol=mqtt.MQTTv311) mqttc.us...
[ "def", "setup", "(", "hass", ",", "config", ")", ":", "conf", "=", "config", "[", "DOMAIN", "]", "username", "=", "conf", ".", "get", "(", "CONF_USERNAME", ")", "password", "=", "conf", ".", "get", "(", "CONF_PASSWORD", ")", "client_id", "=", "\"HomeAs...
[ 30, 0 ]
[ 73, 15 ]
python
en
['en', 'it', 'en']
True
async_turn_on
(hass, entity_id)
Async reset the alert. This is a legacy helper method. Do not use it for new tests.
Async reset the alert.
def async_turn_on(hass, entity_id): """Async reset the alert. This is a legacy helper method. Do not use it for new tests. """ data = {ATTR_ENTITY_ID: entity_id} hass.async_create_task(hass.services.async_call(DOMAIN, SERVICE_TURN_ON, data))
[ "def", "async_turn_on", "(", "hass", ",", "entity_id", ")", ":", "data", "=", "{", "ATTR_ENTITY_ID", ":", "entity_id", "}", "hass", ".", "async_create_task", "(", "hass", ".", "services", ".", "async_call", "(", "DOMAIN", ",", "SERVICE_TURN_ON", ",", "data",...
[ 65, 0 ]
[ 71, 83 ]
python
en
['en', 'hu', 'en']
True
async_turn_off
(hass, entity_id)
Async acknowledge the alert. This is a legacy helper method. Do not use it for new tests.
Async acknowledge the alert.
def async_turn_off(hass, entity_id): """Async acknowledge the alert. This is a legacy helper method. Do not use it for new tests. """ data = {ATTR_ENTITY_ID: entity_id} hass.async_create_task(hass.services.async_call(DOMAIN, SERVICE_TURN_OFF, data))
[ "def", "async_turn_off", "(", "hass", ",", "entity_id", ")", ":", "data", "=", "{", "ATTR_ENTITY_ID", ":", "entity_id", "}", "hass", ".", "async_create_task", "(", "hass", ".", "services", ".", "async_call", "(", "DOMAIN", ",", "SERVICE_TURN_OFF", ",", "data...
[ 75, 0 ]
[ 81, 84 ]
python
en
['en', 'en', 'en']
True
async_toggle
(hass, entity_id)
Async toggle acknowledgment of alert. This is a legacy helper method. Do not use it for new tests.
Async toggle acknowledgment of alert.
def async_toggle(hass, entity_id): """Async toggle acknowledgment of alert. This is a legacy helper method. Do not use it for new tests. """ data = {ATTR_ENTITY_ID: entity_id} hass.async_create_task(hass.services.async_call(DOMAIN, SERVICE_TOGGLE, data))
[ "def", "async_toggle", "(", "hass", ",", "entity_id", ")", ":", "data", "=", "{", "ATTR_ENTITY_ID", ":", "entity_id", "}", "hass", ".", "async_create_task", "(", "hass", ".", "services", ".", "async_call", "(", "DOMAIN", ",", "SERVICE_TOGGLE", ",", "data", ...
[ 85, 0 ]
[ 91, 82 ]
python
en
['en', 'en', 'en']
True
mock_notifier
(hass)
Mock for notifier.
Mock for notifier.
def mock_notifier(hass): """Mock for notifier.""" events = [] @callback def record_event(event): """Add recorded event to set.""" events.append(event) hass.services.async_register(notify.DOMAIN, NOTIFIER, record_event) return events
[ "def", "mock_notifier", "(", "hass", ")", ":", "events", "=", "[", "]", "@", "callback", "def", "record_event", "(", "event", ")", ":", "\"\"\"Add recorded event to set.\"\"\"", "events", ".", "append", "(", "event", ")", "hass", ".", "services", ".", "async...
[ 95, 0 ]
[ 106, 17 ]
python
en
['en', 'fy', 'en']
True
test_is_on
(hass)
Test is_on method.
Test is_on method.
async def test_is_on(hass): """Test is_on method.""" hass.states.async_set(ENTITY_ID, STATE_ON) await hass.async_block_till_done() assert alert.is_on(hass, ENTITY_ID) hass.states.async_set(ENTITY_ID, STATE_OFF) await hass.async_block_till_done() assert not alert.is_on(hass, ENTITY_ID)
[ "async", "def", "test_is_on", "(", "hass", ")", ":", "hass", ".", "states", ".", "async_set", "(", "ENTITY_ID", ",", "STATE_ON", ")", "await", "hass", ".", "async_block_till_done", "(", ")", "assert", "alert", ".", "is_on", "(", "hass", ",", "ENTITY_ID", ...
[ 109, 0 ]
[ 116, 43 ]
python
en
['en', 'et', 'en']
True
test_setup
(hass)
Test setup method.
Test setup method.
async def test_setup(hass): """Test setup method.""" assert await async_setup_component(hass, alert.DOMAIN, TEST_CONFIG) assert STATE_IDLE == hass.states.get(ENTITY_ID).state
[ "async", "def", "test_setup", "(", "hass", ")", ":", "assert", "await", "async_setup_component", "(", "hass", ",", "alert", ".", "DOMAIN", ",", "TEST_CONFIG", ")", "assert", "STATE_IDLE", "==", "hass", ".", "states", ".", "get", "(", "ENTITY_ID", ")", ".",...
[ 119, 0 ]
[ 122, 57 ]
python
en
['en', 'et', 'en']
True
test_fire
(hass, mock_notifier)
Test the alert firing.
Test the alert firing.
async def test_fire(hass, mock_notifier): """Test the alert firing.""" assert await async_setup_component(hass, alert.DOMAIN, TEST_CONFIG) hass.states.async_set("sensor.test", STATE_ON) await hass.async_block_till_done() assert STATE_ON == hass.states.get(ENTITY_ID).state
[ "async", "def", "test_fire", "(", "hass", ",", "mock_notifier", ")", ":", "assert", "await", "async_setup_component", "(", "hass", ",", "alert", ".", "DOMAIN", ",", "TEST_CONFIG", ")", "hass", ".", "states", ".", "async_set", "(", "\"sensor.test\"", ",", "ST...
[ 125, 0 ]
[ 130, 55 ]
python
en
['en', 'lb', 'en']
True
test_silence
(hass, mock_notifier)
Test silencing the alert.
Test silencing the alert.
async def test_silence(hass, mock_notifier): """Test silencing the alert.""" assert await async_setup_component(hass, alert.DOMAIN, TEST_CONFIG) hass.states.async_set("sensor.test", STATE_ON) await hass.async_block_till_done() async_turn_off(hass, ENTITY_ID) await hass.async_block_till_done() ...
[ "async", "def", "test_silence", "(", "hass", ",", "mock_notifier", ")", ":", "assert", "await", "async_setup_component", "(", "hass", ",", "alert", ".", "DOMAIN", ",", "TEST_CONFIG", ")", "hass", ".", "states", ".", "async_set", "(", "\"sensor.test\"", ",", ...
[ 133, 0 ]
[ 148, 55 ]
python
en
['en', 'en', 'en']
True
test_reset
(hass, mock_notifier)
Test resetting the alert.
Test resetting the alert.
async def test_reset(hass, mock_notifier): """Test resetting the alert.""" assert await async_setup_component(hass, alert.DOMAIN, TEST_CONFIG) hass.states.async_set("sensor.test", STATE_ON) await hass.async_block_till_done() async_turn_off(hass, ENTITY_ID) await hass.async_block_till_done() ...
[ "async", "def", "test_reset", "(", "hass", ",", "mock_notifier", ")", ":", "assert", "await", "async_setup_component", "(", "hass", ",", "alert", ".", "DOMAIN", ",", "TEST_CONFIG", ")", "hass", ".", "states", ".", "async_set", "(", "\"sensor.test\"", ",", "S...
[ 151, 0 ]
[ 161, 55 ]
python
en
['en', 'en', 'en']
True
test_toggle
(hass, mock_notifier)
Test toggling alert.
Test toggling alert.
async def test_toggle(hass, mock_notifier): """Test toggling alert.""" assert await async_setup_component(hass, alert.DOMAIN, TEST_CONFIG) hass.states.async_set("sensor.test", STATE_ON) await hass.async_block_till_done() assert STATE_ON == hass.states.get(ENTITY_ID).state async_toggle(hass, ENTI...
[ "async", "def", "test_toggle", "(", "hass", ",", "mock_notifier", ")", ":", "assert", "await", "async_setup_component", "(", "hass", ",", "alert", ".", "DOMAIN", ",", "TEST_CONFIG", ")", "hass", ".", "states", ".", "async_set", "(", "\"sensor.test\"", ",", "...
[ 164, 0 ]
[ 175, 55 ]
python
en
['en', 'da', 'en']
True
test_notification_no_done_message
(hass)
Test notifications.
Test notifications.
async def test_notification_no_done_message(hass): """Test notifications.""" events = [] config = deepcopy(TEST_CONFIG) del config[alert.DOMAIN][NAME][alert.CONF_DONE_MESSAGE] @callback def record_event(event): """Add recorded event to set.""" events.append(event) hass.serv...
[ "async", "def", "test_notification_no_done_message", "(", "hass", ")", ":", "events", "=", "[", "]", "config", "=", "deepcopy", "(", "TEST_CONFIG", ")", "del", "config", "[", "alert", ".", "DOMAIN", "]", "[", "NAME", "]", "[", "alert", ".", "CONF_DONE_MESS...
[ 178, 0 ]
[ 200, 27 ]
python
en
['en', 'en', 'en']
False
test_notification
(hass)
Test notifications.
Test notifications.
async def test_notification(hass): """Test notifications.""" events = [] @callback def record_event(event): """Add recorded event to set.""" events.append(event) hass.services.async_register(notify.DOMAIN, NOTIFIER, record_event) assert await async_setup_component(hass, alert....
[ "async", "def", "test_notification", "(", "hass", ")", ":", "events", "=", "[", "]", "@", "callback", "def", "record_event", "(", "event", ")", ":", "\"\"\"Add recorded event to set.\"\"\"", "events", ".", "append", "(", "event", ")", "hass", ".", "services", ...
[ 203, 0 ]
[ 223, 27 ]
python
en
['en', 'en', 'en']
False