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
validate_value
(value_name, value, value_list)
Validate tag value is in the list of items and logs error if not.
Validate tag value is in the list of items and logs error if not.
def validate_value(value_name, value, value_list): """Validate tag value is in the list of items and logs error if not.""" valid_values = {v["tag"]: v["title"] for v in value_list} if value not in valid_values: _LOGGER.error( "Invalid %s tag `%s`. Please use one of the following: %s", ...
[ "def", "validate_value", "(", "value_name", ",", "value", ",", "value_list", ")", ":", "valid_values", "=", "{", "v", "[", "\"tag\"", "]", ":", "v", "[", "\"title\"", "]", "for", "v", "in", "value_list", "}", "if", "value", "not", "in", "valid_values", ...
[ 53, 0 ]
[ 65, 15 ]
python
en
['en', 'en', 'en']
True
validate_tags
(client, agency, route, stop)
Validate provided tags.
Validate provided tags.
def validate_tags(client, agency, route, stop): """Validate provided tags.""" # Validate agencies if not validate_value("agency", agency, client.get_agency_list()["agency"]): return False # Validate the route if not validate_value("route", route, client.get_route_list(agency)["route"]): ...
[ "def", "validate_tags", "(", "client", ",", "agency", ",", "route", ",", "stop", ")", ":", "# Validate agencies", "if", "not", "validate_value", "(", "\"agency\"", ",", "agency", ",", "client", ".", "get_agency_list", "(", ")", "[", "\"agency\"", "]", ")", ...
[ 68, 0 ]
[ 83, 15 ]
python
en
['en', 'et', 'en']
True
setup_platform
(hass, config, add_entities, discovery_info=None)
Load values from configuration and initialize the platform.
Load values from configuration and initialize the platform.
def setup_platform(hass, config, add_entities, discovery_info=None): """Load values from configuration and initialize the platform.""" agency = config[CONF_AGENCY] route = config[CONF_ROUTE] stop = config[CONF_STOP] name = config.get(CONF_NAME) client = NextBusClient(output_format="json") ...
[ "def", "setup_platform", "(", "hass", ",", "config", ",", "add_entities", ",", "discovery_info", "=", "None", ")", ":", "agency", "=", "config", "[", "CONF_AGENCY", "]", "route", "=", "config", "[", "CONF_ROUTE", "]", "stop", "=", "config", "[", "CONF_STOP...
[ 86, 0 ]
[ 100, 83 ]
python
en
['en', 'en', 'en']
True
NextBusDepartureSensor.__init__
(self, client, agency, route, stop, name=None)
Initialize sensor with all required config.
Initialize sensor with all required config.
def __init__(self, client, agency, route, stop, name=None): """Initialize sensor with all required config.""" self.agency = agency self.route = route self.stop = stop self._custom_name = name # Maybe pull a more user friendly name from the API here self._name = f"...
[ "def", "__init__", "(", "self", ",", "client", ",", "agency", ",", "route", ",", "stop", ",", "name", "=", "None", ")", ":", "self", ".", "agency", "=", "agency", "self", ".", "route", "=", "route", "self", ".", "stop", "=", "stop", "self", ".", ...
[ 117, 4 ]
[ 129, 29 ]
python
en
['en', 'en', 'en']
True
NextBusDepartureSensor._log_debug
(self, message, *args)
Log debug message with prefix.
Log debug message with prefix.
def _log_debug(self, message, *args): """Log debug message with prefix.""" _LOGGER.debug(":".join((self.agency, self.route, self.stop, message)), *args)
[ "def", "_log_debug", "(", "self", ",", "message", ",", "*", "args", ")", ":", "_LOGGER", ".", "debug", "(", "\":\"", ".", "join", "(", "(", "self", ".", "agency", ",", "self", ".", "route", ",", "self", ".", "stop", ",", "message", ")", ")", ",",...
[ 131, 4 ]
[ 133, 85 ]
python
en
['en', 'ceb', 'en']
True
NextBusDepartureSensor.name
(self)
Return sensor name. Uses an auto generated name based on the data from the API unless a custom name is provided in the configuration.
Return sensor name.
def name(self): """Return sensor name. Uses an auto generated name based on the data from the API unless a custom name is provided in the configuration. """ if self._custom_name: return self._custom_name return self._name
[ "def", "name", "(", "self", ")", ":", "if", "self", ".", "_custom_name", ":", "return", "self", ".", "_custom_name", "return", "self", ".", "_name" ]
[ 136, 4 ]
[ 145, 25 ]
python
en
['en', 'id', 'en']
True
NextBusDepartureSensor.native_value
(self)
Return current state of the sensor.
Return current state of the sensor.
def native_value(self): """Return current state of the sensor.""" return self._state
[ "def", "native_value", "(", "self", ")", ":", "return", "self", ".", "_state" ]
[ 148, 4 ]
[ 150, 26 ]
python
en
['en', 'en', 'en']
True
NextBusDepartureSensor.extra_state_attributes
(self)
Return additional state attributes.
Return additional state attributes.
def extra_state_attributes(self): """Return additional state attributes.""" return self._attributes
[ "def", "extra_state_attributes", "(", "self", ")", ":", "return", "self", ".", "_attributes" ]
[ 153, 4 ]
[ 155, 31 ]
python
en
['en', 'en', 'en']
True
NextBusDepartureSensor.update
(self)
Update sensor with new departures times.
Update sensor with new departures times.
def update(self): """Update sensor with new departures times.""" # Note: using Multi because there is a bug with the single stop impl results = self._client.get_predictions_for_multi_stops( [{"stop_tag": self.stop, "route_tag": self.route}], self.agency ) self._log_d...
[ "def", "update", "(", "self", ")", ":", "# Note: using Multi because there is a bug with the single stop impl", "results", "=", "self", ".", "_client", ".", "get_predictions_for_multi_stops", "(", "[", "{", "\"stop_tag\"", ":", "self", ".", "stop", ",", "\"route_tag\"",...
[ 157, 4 ]
[ 222, 21 ]
python
en
['en', 'en', 'en']
True
connection
(conn_type, device, **kwargs)
Depending on the given connection type return an object of the appropriate class type.
Depending on the given connection type return an object of the appropriate class type.
def connection(conn_type, device, **kwargs): ''' Depending on the given connection type return an object of the appropriate class type. ''' if conn_type in ("ser2net"): return ser2net_connection.Ser2NetConnection(device=device,**kwargs) if conn_type in ("local_serial"): return local...
[ "def", "connection", "(", "conn_type", ",", "device", ",", "*", "*", "kwargs", ")", ":", "if", "conn_type", "in", "(", "\"ser2net\"", ")", ":", "return", "ser2net_connection", ".", "Ser2NetConnection", "(", "device", "=", "device", ",", "*", "*", "kwargs",...
[ 5, 0 ]
[ 25, 57 ]
python
en
['en', 'error', 'th']
False
async_setup_entry
( hass: HomeAssistant, entry: ConfigEntry, async_add_entities: AddEntitiesCallback, )
Set up the ISY994 fan platform.
Set up the ISY994 fan platform.
async def async_setup_entry( hass: HomeAssistant, entry: ConfigEntry, async_add_entities: AddEntitiesCallback, ) -> bool: """Set up the ISY994 fan platform.""" hass_isy_data = hass.data[ISY994_DOMAIN][entry.entry_id] devices = [] for node in hass_isy_data[ISY994_NODES][FAN]: devices...
[ "async", "def", "async_setup_entry", "(", "hass", ":", "HomeAssistant", ",", "entry", ":", "ConfigEntry", ",", "async_add_entities", ":", "AddEntitiesCallback", ",", ")", "->", "bool", ":", "hass_isy_data", "=", "hass", ".", "data", "[", "ISY994_DOMAIN", "]", ...
[ 24, 0 ]
[ 40, 31 ]
python
en
['en', 'cs', 'en']
True
ISYFanEntity.percentage
(self)
Return the current speed percentage.
Return the current speed percentage.
def percentage(self) -> int | None: """Return the current speed percentage.""" if self._node.status == ISY_VALUE_UNKNOWN: return None return ranged_value_to_percentage(SPEED_RANGE, self._node.status)
[ "def", "percentage", "(", "self", ")", "->", "int", "|", "None", ":", "if", "self", ".", "_node", ".", "status", "==", "ISY_VALUE_UNKNOWN", ":", "return", "None", "return", "ranged_value_to_percentage", "(", "SPEED_RANGE", ",", "self", ".", "_node", ".", "...
[ 47, 4 ]
[ 51, 73 ]
python
en
['en', 'en', 'en']
True
ISYFanEntity.speed_count
(self)
Return the number of speeds the fan supports.
Return the number of speeds the fan supports.
def speed_count(self) -> int: """Return the number of speeds the fan supports.""" if self._node.protocol == PROTO_INSTEON: return 3 return int_states_in_range(SPEED_RANGE)
[ "def", "speed_count", "(", "self", ")", "->", "int", ":", "if", "self", ".", "_node", ".", "protocol", "==", "PROTO_INSTEON", ":", "return", "3", "return", "int_states_in_range", "(", "SPEED_RANGE", ")" ]
[ 54, 4 ]
[ 58, 47 ]
python
en
['en', 'en', 'en']
True
ISYFanEntity.is_on
(self)
Get if the fan is on.
Get if the fan is on.
def is_on(self) -> bool: """Get if the fan is on.""" if self._node.status == ISY_VALUE_UNKNOWN: return None return self._node.status != 0
[ "def", "is_on", "(", "self", ")", "->", "bool", ":", "if", "self", ".", "_node", ".", "status", "==", "ISY_VALUE_UNKNOWN", ":", "return", "None", "return", "self", ".", "_node", ".", "status", "!=", "0" ]
[ 61, 4 ]
[ 65, 37 ]
python
en
['en', 'fy', 'en']
True
ISYFanEntity.async_set_percentage
(self, percentage: int)
Set node to speed percentage for the ISY994 fan device.
Set node to speed percentage for the ISY994 fan device.
async def async_set_percentage(self, percentage: int) -> None: """Set node to speed percentage for the ISY994 fan device.""" if percentage == 0: await self._node.turn_off() return isy_speed = math.ceil(percentage_to_ranged_value(SPEED_RANGE, percentage)) await s...
[ "async", "def", "async_set_percentage", "(", "self", ",", "percentage", ":", "int", ")", "->", "None", ":", "if", "percentage", "==", "0", ":", "await", "self", ".", "_node", ".", "turn_off", "(", ")", "return", "isy_speed", "=", "math", ".", "ceil", "...
[ 67, 4 ]
[ 75, 47 ]
python
en
['en', 'en', 'en']
True
ISYFanEntity.async_turn_on
( self, speed: str = None, percentage: int = None, preset_mode: str = None, **kwargs, )
Send the turn on command to the ISY994 fan device.
Send the turn on command to the ISY994 fan device.
async def async_turn_on( self, speed: str = None, percentage: int = None, preset_mode: str = None, **kwargs, ) -> None: """Send the turn on command to the ISY994 fan device.""" await self.async_set_percentage(percentage or 67)
[ "async", "def", "async_turn_on", "(", "self", ",", "speed", ":", "str", "=", "None", ",", "percentage", ":", "int", "=", "None", ",", "preset_mode", ":", "str", "=", "None", ",", "*", "*", "kwargs", ",", ")", "->", "None", ":", "await", "self", "."...
[ 77, 4 ]
[ 85, 57 ]
python
en
['en', 'en', 'en']
True
ISYFanEntity.async_turn_off
(self, **kwargs)
Send the turn off command to the ISY994 fan device.
Send the turn off command to the ISY994 fan device.
async def async_turn_off(self, **kwargs) -> None: """Send the turn off command to the ISY994 fan device.""" await self._node.turn_off()
[ "async", "def", "async_turn_off", "(", "self", ",", "*", "*", "kwargs", ")", "->", "None", ":", "await", "self", ".", "_node", ".", "turn_off", "(", ")" ]
[ 87, 4 ]
[ 89, 35 ]
python
en
['en', 'en', 'en']
True
ISYFanEntity.supported_features
(self)
Flag supported features.
Flag supported features.
def supported_features(self) -> int: """Flag supported features.""" return SUPPORT_SET_SPEED
[ "def", "supported_features", "(", "self", ")", "->", "int", ":", "return", "SUPPORT_SET_SPEED" ]
[ 92, 4 ]
[ 94, 32 ]
python
en
['da', 'en', 'en']
True
ISYFanProgramEntity.percentage
(self)
Return the current speed percentage.
Return the current speed percentage.
def percentage(self) -> int | None: """Return the current speed percentage.""" if self._node.status == ISY_VALUE_UNKNOWN: return None return ranged_value_to_percentage(SPEED_RANGE, self._node.status)
[ "def", "percentage", "(", "self", ")", "->", "int", "|", "None", ":", "if", "self", ".", "_node", ".", "status", "==", "ISY_VALUE_UNKNOWN", ":", "return", "None", "return", "ranged_value_to_percentage", "(", "SPEED_RANGE", ",", "self", ".", "_node", ".", "...
[ 101, 4 ]
[ 105, 73 ]
python
en
['en', 'en', 'en']
True
ISYFanProgramEntity.speed_count
(self)
Return the number of speeds the fan supports.
Return the number of speeds the fan supports.
def speed_count(self) -> int: """Return the number of speeds the fan supports.""" return int_states_in_range(SPEED_RANGE)
[ "def", "speed_count", "(", "self", ")", "->", "int", ":", "return", "int_states_in_range", "(", "SPEED_RANGE", ")" ]
[ 108, 4 ]
[ 110, 47 ]
python
en
['en', 'en', 'en']
True
ISYFanProgramEntity.is_on
(self)
Get if the fan is on.
Get if the fan is on.
def is_on(self) -> bool: """Get if the fan is on.""" return self._node.status != 0
[ "def", "is_on", "(", "self", ")", "->", "bool", ":", "return", "self", ".", "_node", ".", "status", "!=", "0" ]
[ 113, 4 ]
[ 115, 37 ]
python
en
['en', 'fy', 'en']
True
ISYFanProgramEntity.async_turn_off
(self, **kwargs)
Send the turn on command to ISY994 fan program.
Send the turn on command to ISY994 fan program.
async def async_turn_off(self, **kwargs) -> None: """Send the turn on command to ISY994 fan program.""" if not await self._actions.run_then(): _LOGGER.error("Unable to turn off the fan")
[ "async", "def", "async_turn_off", "(", "self", ",", "*", "*", "kwargs", ")", "->", "None", ":", "if", "not", "await", "self", ".", "_actions", ".", "run_then", "(", ")", ":", "_LOGGER", ".", "error", "(", "\"Unable to turn off the fan\"", ")" ]
[ 117, 4 ]
[ 120, 55 ]
python
en
['en', 'fy', 'en']
True
ISYFanProgramEntity.async_turn_on
( self, speed: str = None, percentage: int = None, preset_mode: str = None, **kwargs, )
Send the turn off command to ISY994 fan program.
Send the turn off command to ISY994 fan program.
async def async_turn_on( self, speed: str = None, percentage: int = None, preset_mode: str = None, **kwargs, ) -> None: """Send the turn off command to ISY994 fan program.""" if not await self._actions.run_else(): _LOGGER.error("Unable to turn on t...
[ "async", "def", "async_turn_on", "(", "self", ",", "speed", ":", "str", "=", "None", ",", "percentage", ":", "int", "=", "None", ",", "preset_mode", ":", "str", "=", "None", ",", "*", "*", "kwargs", ",", ")", "->", "None", ":", "if", "not", "await"...
[ 122, 4 ]
[ 131, 54 ]
python
en
['en', 'fy', 'en']
True
validate_input
(hass: core.HomeAssistant, data)
Validate the user input allows to connect. Data has the keys from STEP_USER_DATA_SCHEMA with values provided by the user.
Validate the user input allows to connect.
async def validate_input(hass: core.HomeAssistant, data): """Validate the user input allows to connect. Data has the keys from STEP_USER_DATA_SCHEMA with values provided by the user. """ hub = WallboxHub(data["station"], data["username"], data["password"], hass) await hub.async_get_data() # R...
[ "async", "def", "validate_input", "(", "hass", ":", "core", ".", "HomeAssistant", ",", "data", ")", ":", "hub", "=", "WallboxHub", "(", "data", "[", "\"station\"", "]", ",", "data", "[", "\"username\"", "]", ",", "data", "[", "\"password\"", "]", ",", ...
[ 20, 0 ]
[ 30, 38 ]
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.""" if user_input is None: return self.async_show_form( step_id="user", data_schema=STEP_USER_DATA_SCHEMA, ) errors = {} try: info = await va...
[ "async", "def", "async_step_user", "(", "self", ",", "user_input", "=", "None", ")", ":", "if", "user_input", "is", "None", ":", "return", "self", ".", "async_show_form", "(", "step_id", "=", "\"user\"", ",", "data_schema", "=", "STEP_USER_DATA_SCHEMA", ",", ...
[ 36, 4 ]
[ 57, 9 ]
python
en
['en', 'en', 'en']
True
_contains_egg_info
(s)
Determine whether the string looks like an egg_info. :param s: The string to parse. E.g. foo-2.1
Determine whether the string looks like an egg_info.
def _contains_egg_info(s): # type: (str) -> bool """Determine whether the string looks like an egg_info. :param s: The string to parse. E.g. foo-2.1 """ return bool(_egg_info_re.search(s))
[ "def", "_contains_egg_info", "(", "s", ")", ":", "# type: (str) -> bool", "return", "bool", "(", "_egg_info_re", ".", "search", "(", "s", ")", ")" ]
[ 36, 0 ]
[ 42, 39 ]
python
en
['en', 'en', 'en']
True
_should_build
( req, # type: InstallRequirement need_wheel, # type: bool check_binary_allowed, # type: BinaryAllowedPredicate )
Return whether an InstallRequirement should be built into a wheel.
Return whether an InstallRequirement should be built into a wheel.
def _should_build( req, # type: InstallRequirement need_wheel, # type: bool check_binary_allowed, # type: BinaryAllowedPredicate ): # type: (...) -> bool """Return whether an InstallRequirement should be built into a wheel.""" if req.constraint: # never build requirements that are mer...
[ "def", "_should_build", "(", "req", ",", "# type: InstallRequirement", "need_wheel", ",", "# type: bool", "check_binary_allowed", ",", "# type: BinaryAllowedPredicate", ")", ":", "# type: (...) -> bool", "if", "req", ".", "constraint", ":", "# never build requirements that ar...
[ 45, 0 ]
[ 87, 15 ]
python
en
['en', 'en', 'en']
True
_should_cache
( req, # type: InstallRequirement )
Return whether a built InstallRequirement can be stored in the persistent wheel cache, assuming the wheel cache is available, and _should_build() has determined a wheel needs to be built.
Return whether a built InstallRequirement can be stored in the persistent wheel cache, assuming the wheel cache is available, and _should_build() has determined a wheel needs to be built.
def _should_cache( req, # type: InstallRequirement ): # type: (...) -> Optional[bool] """ Return whether a built InstallRequirement can be stored in the persistent wheel cache, assuming the wheel cache is available, and _should_build() has determined a wheel needs to be built. """ if re...
[ "def", "_should_cache", "(", "req", ",", "# type: InstallRequirement", ")", ":", "# type: (...) -> Optional[bool]", "if", "req", ".", "editable", "or", "not", "req", ".", "source_dir", ":", "# never cache editable requirements", "return", "False", "if", "req", ".", ...
[ 109, 0 ]
[ 139, 16 ]
python
en
['en', 'error', 'th']
False
_get_cache_dir
( req, # type: InstallRequirement wheel_cache, # type: WheelCache )
Return the persistent or temporary cache directory where the built wheel need to be stored.
Return the persistent or temporary cache directory where the built wheel need to be stored.
def _get_cache_dir( req, # type: InstallRequirement wheel_cache, # type: WheelCache ): # type: (...) -> str """Return the persistent or temporary cache directory where the built wheel need to be stored. """ cache_available = bool(wheel_cache.cache_dir) assert req.link if cache_avai...
[ "def", "_get_cache_dir", "(", "req", ",", "# type: InstallRequirement", "wheel_cache", ",", "# type: WheelCache", ")", ":", "# type: (...) -> str", "cache_available", "=", "bool", "(", "wheel_cache", ".", "cache_dir", ")", "assert", "req", ".", "link", "if", "cache_...
[ 142, 0 ]
[ 156, 20 ]
python
en
['en', 'en', 'en']
True
_build_one
( req, # type: InstallRequirement output_dir, # type: str build_options, # type: List[str] global_options, # type: List[str] )
Build one wheel. :return: The filename of the built wheel, or None if the build failed.
Build one wheel.
def _build_one( req, # type: InstallRequirement output_dir, # type: str build_options, # type: List[str] global_options, # type: List[str] ): # type: (...) -> Optional[str] """Build one wheel. :return: The filename of the built wheel, or None if the build failed. """ try: ...
[ "def", "_build_one", "(", "req", ",", "# type: InstallRequirement", "output_dir", ",", "# type: str", "build_options", ",", "# type: List[str]", "global_options", ",", "# type: List[str]", ")", ":", "# type: (...) -> Optional[str]", "try", ":", "ensure_dir", "(", "output_...
[ 164, 0 ]
[ 188, 9 ]
python
en
['en', 'sr', 'en']
True
build
( requirements, # type: Iterable[InstallRequirement] wheel_cache, # type: WheelCache build_options, # type: List[str] global_options, # type: List[str] )
Build wheels. :return: The list of InstallRequirement that succeeded to build and the list of InstallRequirement that failed to build.
Build wheels.
def build( requirements, # type: Iterable[InstallRequirement] wheel_cache, # type: WheelCache build_options, # type: List[str] global_options, # type: List[str] ): # type: (...) -> BuildResult """Build wheels. :return: The list of InstallRequirement that succeeded to build and t...
[ "def", "build", "(", "requirements", ",", "# type: Iterable[InstallRequirement]", "wheel_cache", ",", "# type: WheelCache", "build_options", ",", "# type: List[str]", "global_options", ",", "# type: List[str]", ")", ":", "# type: (...) -> BuildResult", "if", "not", "requireme...
[ 258, 0 ]
[ 307, 42 ]
python
en
['en', 'sr', 'en']
False
_default_recorder
(hass)
Return a recorder with reasonable defaults.
Return a recorder with reasonable defaults.
def _default_recorder(hass): """Return a recorder with reasonable defaults.""" return Recorder( hass, auto_purge=True, keep_days=7, commit_interval=1, uri="sqlite://", db_max_retries=10, db_retry_wait=3, entity_filter=CONFIG_SCHEMA({DOMAIN: {}}), ...
[ "def", "_default_recorder", "(", "hass", ")", ":", "return", "Recorder", "(", "hass", ",", "auto_purge", "=", "True", ",", "keep_days", "=", "7", ",", "commit_interval", "=", "1", ",", "uri", "=", "\"sqlite://\"", ",", "db_max_retries", "=", "10", ",", "...
[ 63, 0 ]
[ 75, 5 ]
python
en
['en', 'en', 'en']
True
test_shutdown_before_startup_finishes
(hass)
Test shutdown before recorder starts is clean.
Test shutdown before recorder starts is clean.
async def test_shutdown_before_startup_finishes(hass): """Test shutdown before recorder starts is clean.""" hass.state = CoreState.not_running await async_init_recorder_component(hass) await hass.data[DATA_INSTANCE].async_db_ready await hass.async_block_till_done() session = await hass.async_...
[ "async", "def", "test_shutdown_before_startup_finishes", "(", "hass", ")", ":", "hass", ".", "state", "=", "CoreState", ".", "not_running", "await", "async_init_recorder_component", "(", "hass", ")", "await", "hass", ".", "data", "[", "DATA_INSTANCE", "]", ".", ...
[ 78, 0 ]
[ 98, 35 ]
python
en
['en', 'de', 'en']
True
test_state_gets_saved_when_set_before_start_event
( hass: HomeAssistant, async_setup_recorder_instance: SetupRecorderInstanceT )
Test we can record an event when starting with not running.
Test we can record an event when starting with not running.
async def test_state_gets_saved_when_set_before_start_event( hass: HomeAssistant, async_setup_recorder_instance: SetupRecorderInstanceT ): """Test we can record an event when starting with not running.""" hass.state = CoreState.not_running await async_init_recorder_component(hass) entity_id = "te...
[ "async", "def", "test_state_gets_saved_when_set_before_start_event", "(", "hass", ":", "HomeAssistant", ",", "async_setup_recorder_instance", ":", "SetupRecorderInstanceT", ")", ":", "hass", ".", "state", "=", "CoreState", ".", "not_running", "await", "async_init_recorder_c...
[ 101, 0 ]
[ 123, 40 ]
python
en
['en', 'en', 'en']
True
test_saving_state
( hass: HomeAssistant, async_setup_recorder_instance: SetupRecorderInstanceT )
Test saving and restoring a state.
Test saving and restoring a state.
async def test_saving_state( hass: HomeAssistant, async_setup_recorder_instance: SetupRecorderInstanceT ): """Test saving and restoring a state.""" instance = await async_setup_recorder_instance(hass) entity_id = "test.recorder" state = "restoring_from_db" attributes = {"test_attr": 5, "test_at...
[ "async", "def", "test_saving_state", "(", "hass", ":", "HomeAssistant", ",", "async_setup_recorder_instance", ":", "SetupRecorderInstanceT", ")", ":", "instance", "=", "await", "async_setup_recorder_instance", "(", "hass", ")", "entity_id", "=", "\"test.recorder\"", "st...
[ 126, 0 ]
[ 146, 57 ]
python
en
['en', 'en', 'en']
True
test_saving_many_states
( hass: HomeAssistant, async_setup_recorder_instance: SetupRecorderInstanceT )
Test we expire after many commits.
Test we expire after many commits.
async def test_saving_many_states( hass: HomeAssistant, async_setup_recorder_instance: SetupRecorderInstanceT ): """Test we expire after many commits.""" instance = await async_setup_recorder_instance(hass) entity_id = "test.recorder" attributes = {"test_attr": 5, "test_attr_10": "nice"} with ...
[ "async", "def", "test_saving_many_states", "(", "hass", ":", "HomeAssistant", ",", "async_setup_recorder_instance", ":", "SetupRecorderInstanceT", ")", ":", "instance", "=", "await", "async_setup_recorder_instance", "(", "hass", ")", "entity_id", "=", "\"test.recorder\"",...
[ 149, 0 ]
[ 172, 40 ]
python
en
['en', 'en', 'en']
True
test_saving_state_with_intermixed_time_changes
( hass: HomeAssistant, async_setup_recorder_instance: SetupRecorderInstanceT )
Test saving states with intermixed time changes.
Test saving states with intermixed time changes.
async def test_saving_state_with_intermixed_time_changes( hass: HomeAssistant, async_setup_recorder_instance: SetupRecorderInstanceT ): """Test saving states with intermixed time changes.""" instance = await async_setup_recorder_instance(hass) entity_id = "test.recorder" state = "restoring_from_db"...
[ "async", "def", "test_saving_state_with_intermixed_time_changes", "(", "hass", ":", "HomeAssistant", ",", "async_setup_recorder_instance", ":", "SetupRecorderInstanceT", ")", ":", "instance", "=", "await", "async_setup_recorder_instance", "(", "hass", ")", "entity_id", "=",...
[ 175, 0 ]
[ 198, 40 ]
python
en
['en', 'en', 'en']
True
test_saving_state_with_exception
(hass, hass_recorder, caplog)
Test saving and restoring a state.
Test saving and restoring a state.
def test_saving_state_with_exception(hass, hass_recorder, caplog): """Test saving and restoring a state.""" hass = hass_recorder() entity_id = "test.recorder" state = "restoring_from_db" attributes = {"test_attr": 5, "test_attr_10": "nice"} def _throw_if_state_in_session(*args, **kwargs): ...
[ "def", "test_saving_state_with_exception", "(", "hass", ",", "hass_recorder", ",", "caplog", ")", ":", "hass", "=", "hass_recorder", "(", ")", "entity_id", "=", "\"test.recorder\"", "state", "=", "\"restoring_from_db\"", "attributes", "=", "{", "\"test_attr\"", ":",...
[ 201, 0 ]
[ 236, 51 ]
python
en
['en', 'en', 'en']
True
test_saving_state_with_sqlalchemy_exception
(hass, hass_recorder, caplog)
Test saving state when there is an SQLAlchemyError.
Test saving state when there is an SQLAlchemyError.
def test_saving_state_with_sqlalchemy_exception(hass, hass_recorder, caplog): """Test saving state when there is an SQLAlchemyError.""" hass = hass_recorder() entity_id = "test.recorder" state = "restoring_from_db" attributes = {"test_attr": 5, "test_attr_10": "nice"} def _throw_if_state_in_se...
[ "def", "test_saving_state_with_sqlalchemy_exception", "(", "hass", ",", "hass_recorder", ",", "caplog", ")", ":", "hass", "=", "hass_recorder", "(", ")", "entity_id", "=", "\"test.recorder\"", "state", "=", "\"restoring_from_db\"", "attributes", "=", "{", "\"test_attr...
[ 239, 0 ]
[ 274, 70 ]
python
en
['en', 'en', 'en']
True
test_force_shutdown_with_queue_of_writes_that_generate_exceptions
( hass, async_setup_recorder_instance, caplog )
Test forcing shutdown.
Test forcing shutdown.
async def test_force_shutdown_with_queue_of_writes_that_generate_exceptions( hass, async_setup_recorder_instance, caplog ): """Test forcing shutdown.""" instance = await async_setup_recorder_instance(hass) entity_id = "test.recorder" attributes = {"test_attr": 5, "test_attr_10": "nice"} await ...
[ "async", "def", "test_force_shutdown_with_queue_of_writes_that_generate_exceptions", "(", "hass", ",", "async_setup_recorder_instance", ",", "caplog", ")", ":", "instance", "=", "await", "async_setup_recorder_instance", "(", "hass", ")", "entity_id", "=", "\"test.recorder\"",...
[ 277, 0 ]
[ 304, 51 ]
python
en
['en', 'no', 'en']
True
test_saving_event
(hass, hass_recorder)
Test saving and restoring an event.
Test saving and restoring an event.
def test_saving_event(hass, hass_recorder): """Test saving and restoring an event.""" hass = hass_recorder() event_type = "EVENT_TEST" event_data = {"test_attr": 5, "test_attr_10": "nice"} events = [] @callback def event_listener(event): """Record events from eventbus.""" ...
[ "def", "test_saving_event", "(", "hass", ",", "hass_recorder", ")", ":", "hass", "=", "hass_recorder", "(", ")", "event_type", "=", "\"EVENT_TEST\"", "event_data", "=", "{", "\"test_attr\"", ":", "5", ",", "\"test_attr_10\"", ":", "\"nice\"", "}", "events", "=...
[ 307, 0 ]
[ 345, 5 ]
python
en
['en', 'en', 'en']
True
test_saving_state_with_commit_interval_zero
(hass_recorder)
Test saving a state with a commit interval of zero.
Test saving a state with a commit interval of zero.
def test_saving_state_with_commit_interval_zero(hass_recorder): """Test saving a state with a commit interval of zero.""" hass = hass_recorder({"commit_interval": 0}) assert hass.data[DATA_INSTANCE].commit_interval == 0 entity_id = "test.recorder" state = "restoring_from_db" attributes = {"test...
[ "def", "test_saving_state_with_commit_interval_zero", "(", "hass_recorder", ")", ":", "hass", "=", "hass_recorder", "(", "{", "\"commit_interval\"", ":", "0", "}", ")", "assert", "hass", ".", "data", "[", "DATA_INSTANCE", "]", ".", "commit_interval", "==", "0", ...
[ 348, 0 ]
[ 364, 40 ]
python
en
['en', 'en', 'en']
True
_add_entities
(hass, entity_ids)
Add entities.
Add entities.
def _add_entities(hass, entity_ids): """Add entities.""" attributes = {"test_attr": 5, "test_attr_10": "nice"} for idx, entity_id in enumerate(entity_ids): hass.states.set(entity_id, f"state{idx}", attributes) wait_recording_done(hass) with session_scope(hass=hass) as session: retur...
[ "def", "_add_entities", "(", "hass", ",", "entity_ids", ")", ":", "attributes", "=", "{", "\"test_attr\"", ":", "5", ",", "\"test_attr_10\"", ":", "\"nice\"", "}", "for", "idx", ",", "entity_id", "in", "enumerate", "(", "entity_ids", ")", ":", "hass", ".",...
[ 367, 0 ]
[ 375, 63 ]
python
en
['en', 'fy', 'en']
False
test_saving_state_include_domains
(hass_recorder)
Test saving and restoring a state.
Test saving and restoring a state.
def test_saving_state_include_domains(hass_recorder): """Test saving and restoring a state.""" hass = hass_recorder({"include": {"domains": "test2"}}) states = _add_entities(hass, ["test.recorder", "test2.recorder"]) assert len(states) == 1 assert _state_empty_context(hass, "test2.recorder") == stat...
[ "def", "test_saving_state_include_domains", "(", "hass_recorder", ")", ":", "hass", "=", "hass_recorder", "(", "{", "\"include\"", ":", "{", "\"domains\"", ":", "\"test2\"", "}", "}", ")", "states", "=", "_add_entities", "(", "hass", ",", "[", "\"test.recorder\"...
[ 398, 0 ]
[ 403, 68 ]
python
en
['en', 'en', 'en']
True
test_saving_state_include_domains_globs
(hass_recorder)
Test saving and restoring a state.
Test saving and restoring a state.
def test_saving_state_include_domains_globs(hass_recorder): """Test saving and restoring a state.""" hass = hass_recorder( {"include": {"domains": "test2", "entity_globs": "*.included_*"}} ) states = _add_entities( hass, ["test.recorder", "test2.recorder", "test3.included_entity"] ) ...
[ "def", "test_saving_state_include_domains_globs", "(", "hass_recorder", ")", ":", "hass", "=", "hass_recorder", "(", "{", "\"include\"", ":", "{", "\"domains\"", ":", "\"test2\"", ",", "\"entity_globs\"", ":", "\"*.included_*\"", "}", "}", ")", "states", "=", "_ad...
[ 406, 0 ]
[ 416, 75 ]
python
en
['en', 'en', 'en']
True
test_saving_state_incl_entities
(hass_recorder)
Test saving and restoring a state.
Test saving and restoring a state.
def test_saving_state_incl_entities(hass_recorder): """Test saving and restoring a state.""" hass = hass_recorder({"include": {"entities": "test2.recorder"}}) states = _add_entities(hass, ["test.recorder", "test2.recorder"]) assert len(states) == 1 assert _state_empty_context(hass, "test2.recorder")...
[ "def", "test_saving_state_incl_entities", "(", "hass_recorder", ")", ":", "hass", "=", "hass_recorder", "(", "{", "\"include\"", ":", "{", "\"entities\"", ":", "\"test2.recorder\"", "}", "}", ")", "states", "=", "_add_entities", "(", "hass", ",", "[", "\"test.re...
[ 419, 0 ]
[ 424, 68 ]
python
en
['en', 'en', 'en']
True
test_saving_event_exclude_event_type
(hass_recorder)
Test saving and restoring an event.
Test saving and restoring an event.
def test_saving_event_exclude_event_type(hass_recorder): """Test saving and restoring an event.""" hass = hass_recorder( { "exclude": { "event_types": [ "service_registered", "homeassistant_start", "component_loaded"...
[ "def", "test_saving_event_exclude_event_type", "(", "hass_recorder", ")", ":", "hass", "=", "hass_recorder", "(", "{", "\"exclude\"", ":", "{", "\"event_types\"", ":", "[", "\"service_registered\"", ",", "\"homeassistant_start\"", ",", "\"component_loaded\"", ",", "\"co...
[ 427, 0 ]
[ 445, 42 ]
python
en
['en', 'en', 'en']
True
test_saving_state_exclude_domains
(hass_recorder)
Test saving and restoring a state.
Test saving and restoring a state.
def test_saving_state_exclude_domains(hass_recorder): """Test saving and restoring a state.""" hass = hass_recorder({"exclude": {"domains": "test"}}) states = _add_entities(hass, ["test.recorder", "test2.recorder"]) assert len(states) == 1 assert _state_empty_context(hass, "test2.recorder") == state...
[ "def", "test_saving_state_exclude_domains", "(", "hass_recorder", ")", ":", "hass", "=", "hass_recorder", "(", "{", "\"exclude\"", ":", "{", "\"domains\"", ":", "\"test\"", "}", "}", ")", "states", "=", "_add_entities", "(", "hass", ",", "[", "\"test.recorder\""...
[ 448, 0 ]
[ 453, 68 ]
python
en
['en', 'en', 'en']
True
test_saving_state_exclude_domains_globs
(hass_recorder)
Test saving and restoring a state.
Test saving and restoring a state.
def test_saving_state_exclude_domains_globs(hass_recorder): """Test saving and restoring a state.""" hass = hass_recorder( {"exclude": {"domains": "test", "entity_globs": "*.excluded_*"}} ) states = _add_entities( hass, ["test.recorder", "test2.recorder", "test2.excluded_entity"] ) ...
[ "def", "test_saving_state_exclude_domains_globs", "(", "hass_recorder", ")", ":", "hass", "=", "hass_recorder", "(", "{", "\"exclude\"", ":", "{", "\"domains\"", ":", "\"test\"", ",", "\"entity_globs\"", ":", "\"*.excluded_*\"", "}", "}", ")", "states", "=", "_add...
[ 456, 0 ]
[ 465, 68 ]
python
en
['en', 'en', 'en']
True
test_saving_state_exclude_entities
(hass_recorder)
Test saving and restoring a state.
Test saving and restoring a state.
def test_saving_state_exclude_entities(hass_recorder): """Test saving and restoring a state.""" hass = hass_recorder({"exclude": {"entities": "test.recorder"}}) states = _add_entities(hass, ["test.recorder", "test2.recorder"]) assert len(states) == 1 assert _state_empty_context(hass, "test2.recorder...
[ "def", "test_saving_state_exclude_entities", "(", "hass_recorder", ")", ":", "hass", "=", "hass_recorder", "(", "{", "\"exclude\"", ":", "{", "\"entities\"", ":", "\"test.recorder\"", "}", "}", ")", "states", "=", "_add_entities", "(", "hass", ",", "[", "\"test....
[ 468, 0 ]
[ 473, 68 ]
python
en
['en', 'en', 'en']
True
test_saving_state_exclude_domain_include_entity
(hass_recorder)
Test saving and restoring a state.
Test saving and restoring a state.
def test_saving_state_exclude_domain_include_entity(hass_recorder): """Test saving and restoring a state.""" hass = hass_recorder( {"include": {"entities": "test.recorder"}, "exclude": {"domains": "test"}} ) states = _add_entities(hass, ["test.recorder", "test2.recorder"]) assert len(states)...
[ "def", "test_saving_state_exclude_domain_include_entity", "(", "hass_recorder", ")", ":", "hass", "=", "hass_recorder", "(", "{", "\"include\"", ":", "{", "\"entities\"", ":", "\"test.recorder\"", "}", ",", "\"exclude\"", ":", "{", "\"domains\"", ":", "\"test\"", "}...
[ 476, 0 ]
[ 482, 27 ]
python
en
['en', 'en', 'en']
True
test_saving_state_exclude_domain_glob_include_entity
(hass_recorder)
Test saving and restoring a state.
Test saving and restoring a state.
def test_saving_state_exclude_domain_glob_include_entity(hass_recorder): """Test saving and restoring a state.""" hass = hass_recorder( { "include": {"entities": ["test.recorder", "test.excluded_entity"]}, "exclude": {"domains": "test", "entity_globs": "*._excluded_*"}, }...
[ "def", "test_saving_state_exclude_domain_glob_include_entity", "(", "hass_recorder", ")", ":", "hass", "=", "hass_recorder", "(", "{", "\"include\"", ":", "{", "\"entities\"", ":", "[", "\"test.recorder\"", ",", "\"test.excluded_entity\"", "]", "}", ",", "\"exclude\"", ...
[ 485, 0 ]
[ 496, 27 ]
python
en
['en', 'en', 'en']
True
test_saving_state_include_domain_exclude_entity
(hass_recorder)
Test saving and restoring a state.
Test saving and restoring a state.
def test_saving_state_include_domain_exclude_entity(hass_recorder): """Test saving and restoring a state.""" hass = hass_recorder( {"exclude": {"entities": "test.recorder"}, "include": {"domains": "test"}} ) states = _add_entities(hass, ["test.recorder", "test2.recorder", "test.ok"]) assert ...
[ "def", "test_saving_state_include_domain_exclude_entity", "(", "hass_recorder", ")", ":", "hass", "=", "hass_recorder", "(", "{", "\"exclude\"", ":", "{", "\"entities\"", ":", "\"test.recorder\"", "}", ",", "\"include\"", ":", "{", "\"domains\"", ":", "\"test\"", "}...
[ 499, 0 ]
[ 507, 66 ]
python
en
['en', 'en', 'en']
True
test_saving_state_include_domain_glob_exclude_entity
(hass_recorder)
Test saving and restoring a state.
Test saving and restoring a state.
def test_saving_state_include_domain_glob_exclude_entity(hass_recorder): """Test saving and restoring a state.""" hass = hass_recorder( { "exclude": {"entities": ["test.recorder", "test2.included_entity"]}, "include": {"domains": "test", "entity_globs": "*._included_*"}, ...
[ "def", "test_saving_state_include_domain_glob_exclude_entity", "(", "hass_recorder", ")", ":", "hass", "=", "hass_recorder", "(", "{", "\"exclude\"", ":", "{", "\"entities\"", ":", "[", "\"test.recorder\"", ",", "\"test2.included_entity\"", "]", "}", ",", "\"include\"",...
[ 510, 0 ]
[ 523, 66 ]
python
en
['en', 'en', 'en']
True
test_saving_state_and_removing_entity
(hass, hass_recorder)
Test saving the state of a removed entity.
Test saving the state of a removed entity.
def test_saving_state_and_removing_entity(hass, hass_recorder): """Test saving the state of a removed entity.""" hass = hass_recorder() entity_id = "lock.mine" hass.states.set(entity_id, STATE_LOCKED) hass.states.set(entity_id, STATE_UNLOCKED) hass.states.async_remove(entity_id) wait_record...
[ "def", "test_saving_state_and_removing_entity", "(", "hass", ",", "hass_recorder", ")", ":", "hass", "=", "hass_recorder", "(", ")", "entity_id", "=", "\"lock.mine\"", "hass", ".", "states", ".", "set", "(", "entity_id", ",", "STATE_LOCKED", ")", "hass", ".", ...
[ 526, 0 ]
[ 544, 38 ]
python
en
['en', 'en', 'en']
True
test_recorder_setup_failure
(hass)
Test some exceptions.
Test some exceptions.
def test_recorder_setup_failure(hass): """Test some exceptions.""" with patch.object(Recorder, "_setup_connection") as setup, patch( "homeassistant.components.recorder.time.sleep" ): setup.side_effect = ImportError("driver not found") rec = _default_recorder(hass) rec.async_i...
[ "def", "test_recorder_setup_failure", "(", "hass", ")", ":", "with", "patch", ".", "object", "(", "Recorder", ",", "\"_setup_connection\"", ")", "as", "setup", ",", "patch", "(", "\"homeassistant.components.recorder.time.sleep\"", ")", ":", "setup", ".", "side_effec...
[ 547, 0 ]
[ 558, 15 ]
python
en
['en', 'en', 'en']
True
test_recorder_setup_failure_without_event_listener
(hass)
Test recorder setup failure when the event listener is not setup.
Test recorder setup failure when the event listener is not setup.
def test_recorder_setup_failure_without_event_listener(hass): """Test recorder setup failure when the event listener is not setup.""" with patch.object(Recorder, "_setup_connection") as setup, patch( "homeassistant.components.recorder.time.sleep" ): setup.side_effect = ImportError("driver no...
[ "def", "test_recorder_setup_failure_without_event_listener", "(", "hass", ")", ":", "with", "patch", ".", "object", "(", "Recorder", ",", "\"_setup_connection\"", ")", "as", "setup", ",", "patch", "(", "\"homeassistant.components.recorder.time.sleep\"", ")", ":", "setup...
[ 561, 0 ]
[ 571, 15 ]
python
en
['en', 'en', 'en']
True
test_defaults_set
(hass)
Test the config defaults are set.
Test the config defaults are set.
async def test_defaults_set(hass): """Test the config defaults are set.""" recorder_config = None async def mock_setup(hass, config): """Mock setup.""" nonlocal recorder_config recorder_config = config["recorder"] return True with patch("homeassistant.components.recorde...
[ "async", "def", "test_defaults_set", "(", "hass", ")", ":", "recorder_config", "=", "None", "async", "def", "mock_setup", "(", "hass", ",", "config", ")", ":", "\"\"\"Mock setup.\"\"\"", "nonlocal", "recorder_config", "recorder_config", "=", "config", "[", "\"reco...
[ 574, 0 ]
[ 590, 51 ]
python
en
['en', 'en', 'en']
True
run_tasks_at_time
(hass, test_time)
Advance the clock and wait for any callbacks to finish.
Advance the clock and wait for any callbacks to finish.
def run_tasks_at_time(hass, test_time): """Advance the clock and wait for any callbacks to finish.""" fire_time_changed(hass, test_time) hass.block_till_done() hass.data[DATA_INSTANCE].block_till_done()
[ "def", "run_tasks_at_time", "(", "hass", ",", "test_time", ")", ":", "fire_time_changed", "(", "hass", ",", "test_time", ")", "hass", ".", "block_till_done", "(", ")", "hass", ".", "data", "[", "DATA_INSTANCE", "]", ".", "block_till_done", "(", ")" ]
[ 593, 0 ]
[ 597, 46 ]
python
en
['en', 'en', 'en']
True
test_auto_purge
(hass_recorder)
Test periodic purge scheduling.
Test periodic purge scheduling.
def test_auto_purge(hass_recorder): """Test periodic purge scheduling.""" hass = hass_recorder() original_tz = dt_util.DEFAULT_TIME_ZONE tz = dt_util.get_time_zone("Europe/Copenhagen") dt_util.set_default_time_zone(tz) # Purging is scheduled to happen at 4:12am every day. Exercise this behavi...
[ "def", "test_auto_purge", "(", "hass_recorder", ")", ":", "hass", "=", "hass_recorder", "(", ")", "original_tz", "=", "dt_util", ".", "DEFAULT_TIME_ZONE", "tz", "=", "dt_util", ".", "get_time_zone", "(", "\"Europe/Copenhagen\"", ")", "dt_util", ".", "set_default_t...
[ 600, 0 ]
[ 654, 46 ]
python
co
['en', 'co', 'hi']
False
test_auto_purge_disabled
(hass_recorder)
Test periodic db cleanup still run when auto purge is disabled.
Test periodic db cleanup still run when auto purge is disabled.
def test_auto_purge_disabled(hass_recorder): """Test periodic db cleanup still run when auto purge is disabled.""" hass = hass_recorder({CONF_AUTO_PURGE: False}) original_tz = dt_util.DEFAULT_TIME_ZONE tz = dt_util.get_time_zone("Europe/Copenhagen") dt_util.set_default_time_zone(tz) # Purging...
[ "def", "test_auto_purge_disabled", "(", "hass_recorder", ")", ":", "hass", "=", "hass_recorder", "(", "{", "CONF_AUTO_PURGE", ":", "False", "}", ")", "original_tz", "=", "dt_util", ".", "DEFAULT_TIME_ZONE", "tz", "=", "dt_util", ".", "get_time_zone", "(", "\"Eur...
[ 657, 0 ]
[ 689, 46 ]
python
en
['en', 'en', 'en']
True
test_auto_statistics
(hass_recorder)
Test periodic statistics scheduling.
Test periodic statistics scheduling.
def test_auto_statistics(hass_recorder): """Test periodic statistics scheduling.""" hass = hass_recorder() original_tz = dt_util.DEFAULT_TIME_ZONE tz = dt_util.get_time_zone("Europe/Copenhagen") dt_util.set_default_time_zone(tz) # Statistics is scheduled to happen at *:12am every hour. Exerci...
[ "def", "test_auto_statistics", "(", "hass_recorder", ")", ":", "hass", "=", "hass_recorder", "(", ")", "original_tz", "=", "dt_util", ".", "DEFAULT_TIME_ZONE", "tz", "=", "dt_util", ".", "get_time_zone", "(", "\"Europe/Copenhagen\"", ")", "dt_util", ".", "set_defa...
[ 693, 0 ]
[ 740, 46 ]
python
en
['en', 'co', 'en']
True
test_statistics_runs_initiated
(hass_recorder)
Test statistics_runs is initiated when DB is created.
Test statistics_runs is initiated when DB is created.
def test_statistics_runs_initiated(hass_recorder): """Test statistics_runs is initiated when DB is created.""" now = dt_util.utcnow() with patch("homeassistant.components.recorder.dt_util.utcnow", return_value=now): hass = hass_recorder() wait_recording_done(hass) with session_scop...
[ "def", "test_statistics_runs_initiated", "(", "hass_recorder", ")", ":", "now", "=", "dt_util", ".", "utcnow", "(", ")", "with", "patch", "(", "\"homeassistant.components.recorder.dt_util.utcnow\"", ",", "return_value", "=", "now", ")", ":", "hass", "=", "hass_recor...
[ 743, 0 ]
[ 757, 34 ]
python
en
['en', 'en', 'en']
True
test_compile_missing_statistics
(tmpdir)
Test missing statistics are compiled on startup.
Test missing statistics are compiled on startup.
def test_compile_missing_statistics(tmpdir): """Test missing statistics are compiled on startup.""" now = dt_util.utcnow().replace(minute=0, second=0, microsecond=0) test_db_file = tmpdir.mkdir("sqlite").join("test_run_info.db") dburl = f"{SQLITE_URL_PREFIX}//{test_db_file}" with patch("homeassista...
[ "def", "test_compile_missing_statistics", "(", "tmpdir", ")", ":", "now", "=", "dt_util", ".", "utcnow", "(", ")", ".", "replace", "(", "minute", "=", "0", ",", "second", "=", "0", ",", "microsecond", "=", "0", ")", "test_db_file", "=", "tmpdir", ".", ...
[ 760, 0 ]
[ 803, 19 ]
python
en
['en', 'en', 'en']
True
test_saving_sets_old_state
(hass_recorder)
Test saving sets old state.
Test saving sets old state.
def test_saving_sets_old_state(hass_recorder): """Test saving sets old state.""" hass = hass_recorder() hass.states.set("test.one", "on", {}) hass.states.set("test.two", "on", {}) wait_recording_done(hass) hass.states.set("test.one", "off", {}) hass.states.set("test.two", "off", {}) wai...
[ "def", "test_saving_sets_old_state", "(", "hass_recorder", ")", ":", "hass", "=", "hass_recorder", "(", ")", "hass", ".", "states", ".", "set", "(", "\"test.one\"", ",", "\"on\"", ",", "{", "}", ")", "hass", ".", "states", ".", "set", "(", "\"test.two\"", ...
[ 806, 0 ]
[ 829, 59 ]
python
en
['en', 'jv', 'en']
True
test_saving_state_with_serializable_data
(hass_recorder, caplog)
Test saving data that cannot be serialized does not crash.
Test saving data that cannot be serialized does not crash.
def test_saving_state_with_serializable_data(hass_recorder, caplog): """Test saving data that cannot be serialized does not crash.""" hass = hass_recorder() hass.bus.fire("bad_event", {"fail": CannotSerializeMe()}) hass.states.set("test.one", "on", {"fail": CannotSerializeMe()}) wait_recording_done...
[ "def", "test_saving_state_with_serializable_data", "(", "hass_recorder", ",", "caplog", ")", ":", "hass", "=", "hass_recorder", "(", ")", "hass", ".", "bus", ".", "fire", "(", "\"bad_event\"", ",", "{", "\"fail\"", ":", "CannotSerializeMe", "(", ")", "}", ")",...
[ 832, 0 ]
[ 853, 58 ]
python
en
['en', 'en', 'en']
True
test_run_information
(hass_recorder)
Ensure run_information returns expected data.
Ensure run_information returns expected data.
def test_run_information(hass_recorder): """Ensure run_information returns expected data.""" before_start_recording = dt_util.utcnow() hass = hass_recorder() run_info = run_information_from_instance(hass) assert isinstance(run_info, RecorderRuns) assert run_info.closed_incorrect is False wi...
[ "def", "test_run_information", "(", "hass_recorder", ")", ":", "before_start_recording", "=", "dt_util", ".", "utcnow", "(", ")", "hass", "=", "hass_recorder", "(", ")", "run_info", "=", "run_information_from_instance", "(", "hass", ")", "assert", "isinstance", "(...
[ 856, 0 ]
[ 884, 45 ]
python
de
['de', 'no', 'en']
False
test_has_services
(hass_recorder)
Test the services exist.
Test the services exist.
def test_has_services(hass_recorder): """Test the services exist.""" hass = hass_recorder() assert hass.services.has_service(DOMAIN, SERVICE_DISABLE) assert hass.services.has_service(DOMAIN, SERVICE_ENABLE) assert hass.services.has_service(DOMAIN, SERVICE_PURGE) assert hass.services.has_service...
[ "def", "test_has_services", "(", "hass_recorder", ")", ":", "hass", "=", "hass_recorder", "(", ")", "assert", "hass", ".", "services", ".", "has_service", "(", "DOMAIN", ",", "SERVICE_DISABLE", ")", "assert", "hass", ".", "services", ".", "has_service", "(", ...
[ 887, 0 ]
[ 894, 68 ]
python
en
['en', 'en', 'en']
True
test_service_disable_events_not_recording
(hass, hass_recorder)
Test that events are not recorded when recorder is disabled using service.
Test that events are not recorded when recorder is disabled using service.
def test_service_disable_events_not_recording(hass, hass_recorder): """Test that events are not recorded when recorder is disabled using service.""" hass = hass_recorder() assert hass.services.call( DOMAIN, SERVICE_DISABLE, {}, blocking=True, ) event_type = "EVENT_T...
[ "def", "test_service_disable_events_not_recording", "(", "hass", ",", "hass_recorder", ")", ":", "hass", "=", "hass_recorder", "(", ")", "assert", "hass", ".", "services", ".", "call", "(", "DOMAIN", ",", "SERVICE_DISABLE", ",", "{", "}", ",", "blocking", "=",...
[ 897, 0 ]
[ 958, 5 ]
python
en
['en', 'en', 'en']
True
test_service_disable_states_not_recording
(hass, hass_recorder)
Test that state changes are not recorded when recorder is disabled using service.
Test that state changes are not recorded when recorder is disabled using service.
def test_service_disable_states_not_recording(hass, hass_recorder): """Test that state changes are not recorded when recorder is disabled using service.""" hass = hass_recorder() assert hass.services.call( DOMAIN, SERVICE_DISABLE, {}, blocking=True, ) hass.states.se...
[ "def", "test_service_disable_states_not_recording", "(", "hass", ",", "hass_recorder", ")", ":", "hass", "=", "hass_recorder", "(", ")", "assert", "hass", ".", "services", ".", "call", "(", "DOMAIN", ",", "SERVICE_DISABLE", ",", "{", "}", ",", "blocking", "=",...
[ 961, 0 ]
[ 992, 81 ]
python
en
['en', 'en', 'en']
True
test_service_disable_run_information_recorded
(tmpdir)
Test that runs are still recorded when recorder is disabled.
Test that runs are still recorded when recorder is disabled.
def test_service_disable_run_information_recorded(tmpdir): """Test that runs are still recorded when recorder is disabled.""" test_db_file = tmpdir.mkdir("sqlite").join("test_run_info.db") dburl = f"{SQLITE_URL_PREFIX}//{test_db_file}" hass = get_test_home_assistant() setup_component(hass, DOMAIN, ...
[ "def", "test_service_disable_run_information_recorded", "(", "tmpdir", ")", ":", "test_db_file", "=", "tmpdir", ".", "mkdir", "(", "\"sqlite\"", ")", ".", "join", "(", "\"test_run_info.db\"", ")", "dburl", "=", "f\"{SQLITE_URL_PREFIX}//{test_db_file}\"", "hass", "=", ...
[ 995, 0 ]
[ 1034, 15 ]
python
en
['en', 'en', 'en']
True
test_database_corruption_while_running
(hass, tmpdir, caplog)
Test we can recover from sqlite3 db corruption.
Test we can recover from sqlite3 db corruption.
async def test_database_corruption_while_running(hass, tmpdir, caplog): """Test we can recover from sqlite3 db corruption.""" def _create_tmpdir_for_test_db(): return tmpdir.mkdir("sqlite").join("test.db") test_db_file = await hass.async_add_executor_job(_create_tmpdir_for_test_db) dburl = f"{...
[ "async", "def", "test_database_corruption_while_running", "(", "hass", ",", "tmpdir", ",", "caplog", ")", ":", "def", "_create_tmpdir_for_test_db", "(", ")", ":", "return", "tmpdir", ".", "mkdir", "(", "\"sqlite\"", ")", ".", "join", "(", "\"test.db\"", ")", "...
[ 1041, 0 ]
[ 1100, 15 ]
python
en
['en', 'en', 'en']
True
test_entity_id_filter
(hass_recorder)
Test that entity ID filtering filters string and list.
Test that entity ID filtering filters string and list.
def test_entity_id_filter(hass_recorder): """Test that entity ID filtering filters string and list.""" hass = hass_recorder( {"include": {"domains": "hello"}, "exclude": {"domains": "hidden_domain"}} ) for idx, data in enumerate( ( {}, {"entity_id": "hello.world"...
[ "def", "test_entity_id_filter", "(", "hass_recorder", ")", ":", "hass", "=", "hass_recorder", "(", "{", "\"include\"", ":", "{", "\"domains\"", ":", "\"hello\"", "}", ",", "\"exclude\"", ":", "{", "\"domains\"", ":", "\"hidden_domain\"", "}", "}", ")", "for", ...
[ 1103, 0 ]
[ 1135, 50 ]
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", "(...
[ 26, 0 ]
[ 62, 48 ]
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} ) response = Response() response.status_code = 401 api_auth_error = AuthenticationError( response...
[ "async", "def", "test_form_invalid_auth", "(", "hass", ")", ":", "result", "=", "await", "hass", ".", "config_entries", ".", "flow", ".", "async_init", "(", "DOMAIN", ",", "context", "=", "{", "\"source\"", ":", "config_entries", ".", "SOURCE_USER", "}", ")"...
[ 65, 0 ]
[ 92, 56 ]
python
en
['en', 'en', 'en']
True
test_form_cannot_connect
(hass)
Test we handle cannot connect error.
Test we handle cannot connect error.
async def test_form_cannot_connect(hass): """Test we handle cannot connect error.""" result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": config_entries.SOURCE_USER} ) with patch( "coinbase.wallet.client.Client.get_current_user", side_effect=ConnectionE...
[ "async", "def", "test_form_cannot_connect", "(", "hass", ")", ":", "result", "=", "await", "hass", ".", "config_entries", ".", "flow", ".", "async_init", "(", "DOMAIN", ",", "context", "=", "{", "\"source\"", ":", "config_entries", ".", "SOURCE_USER", "}", "...
[ 95, 0 ]
[ 114, 58 ]
python
en
['en', 'en', 'en']
True
test_form_catch_all_exception
(hass)
Test we handle unknown exceptions.
Test we handle unknown exceptions.
async def test_form_catch_all_exception(hass): """Test we handle unknown exceptions.""" result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": config_entries.SOURCE_USER} ) with patch( "coinbase.wallet.client.Client.get_current_user", side_effect=Exceptio...
[ "async", "def", "test_form_catch_all_exception", "(", "hass", ")", ":", "result", "=", "await", "hass", ".", "config_entries", ".", "flow", ".", "async_init", "(", "DOMAIN", ",", "context", "=", "{", "\"source\"", ":", "config_entries", ".", "SOURCE_USER", "}"...
[ 117, 0 ]
[ 136, 51 ]
python
en
['en', 'en', 'en']
True
test_option_form
(hass)
Test we handle a good wallet currency option.
Test we handle a good wallet currency option.
async def test_option_form(hass): """Test we handle a good wallet currency option.""" with patch( "coinbase.wallet.client.Client.get_current_user", return_value=mock_get_current_user(), ), patch( "coinbase.wallet.client.Client.get_accounts", new=mocked_get_accounts ), patch( ...
[ "async", "def", "test_option_form", "(", "hass", ")", ":", "with", "patch", "(", "\"coinbase.wallet.client.Client.get_current_user\"", ",", "return_value", "=", "mock_get_current_user", "(", ")", ",", ")", ",", "patch", "(", "\"coinbase.wallet.client.Client.get_accounts\"...
[ 139, 0 ]
[ 167, 56 ]
python
en
['en', 'en', 'en']
True
test_form_bad_account_currency
(hass)
Test we handle a bad currency option.
Test we handle a bad currency option.
async def test_form_bad_account_currency(hass): """Test we handle a bad currency option.""" with patch( "coinbase.wallet.client.Client.get_current_user", return_value=mock_get_current_user(), ), patch( "coinbase.wallet.client.Client.get_accounts", new=mocked_get_accounts ), patch...
[ "async", "def", "test_form_bad_account_currency", "(", "hass", ")", ":", "with", "patch", "(", "\"coinbase.wallet.client.Client.get_current_user\"", ",", "return_value", "=", "mock_get_current_user", "(", ")", ",", ")", ",", "patch", "(", "\"coinbase.wallet.client.Client....
[ 170, 0 ]
[ 193, 64 ]
python
en
['en', 'en', 'en']
True
test_form_bad_exchange_rate
(hass)
Test we handle a bad exchange rate.
Test we handle a bad exchange rate.
async def test_form_bad_exchange_rate(hass): """Test we handle a bad exchange rate.""" with patch( "coinbase.wallet.client.Client.get_current_user", return_value=mock_get_current_user(), ), patch( "coinbase.wallet.client.Client.get_accounts", new=mocked_get_accounts ), patch( ...
[ "async", "def", "test_form_bad_exchange_rate", "(", "hass", ")", ":", "with", "patch", "(", "\"coinbase.wallet.client.Client.get_current_user\"", ",", "return_value", "=", "mock_get_current_user", "(", ")", ",", ")", ",", "patch", "(", "\"coinbase.wallet.client.Client.get...
[ 196, 0 ]
[ 218, 69 ]
python
en
['en', 'xh', 'en']
True
test_option_catch_all_exception
(hass)
Test we handle an unknown exception in the option flow.
Test we handle an unknown exception in the option flow.
async def test_option_catch_all_exception(hass): """Test we handle an unknown exception in the option flow.""" with patch( "coinbase.wallet.client.Client.get_current_user", return_value=mock_get_current_user(), ), patch( "coinbase.wallet.client.Client.get_accounts", new=mocked_get_ac...
[ "async", "def", "test_option_catch_all_exception", "(", "hass", ")", ":", "with", "patch", "(", "\"coinbase.wallet.client.Client.get_current_user\"", ",", "return_value", "=", "mock_get_current_user", "(", ")", ",", ")", ",", "patch", "(", "\"coinbase.wallet.client.Client...
[ 221, 0 ]
[ 249, 51 ]
python
en
['en', 'en', 'en']
True
test_yaml_import
(hass)
Test YAML import works.
Test YAML import works.
async def test_yaml_import(hass): """Test YAML import works.""" conf = { CONF_API_KEY: "123456", CONF_YAML_API_TOKEN: "AbCDeF", CONF_CURRENCIES: ["BTC", "USD"], CONF_EXCHANGE_RATES: ["ATOM", "BTC"], } with patch( "coinbase.wallet.client.Client.get_current_user", ...
[ "async", "def", "test_yaml_import", "(", "hass", ")", ":", "conf", "=", "{", "CONF_API_KEY", ":", "\"123456\"", ",", "CONF_YAML_API_TOKEN", ":", "\"AbCDeF\"", ",", "CONF_CURRENCIES", ":", "[", "\"BTC\"", ",", "\"USD\"", "]", ",", "CONF_EXCHANGE_RATES", ":", "[...
[ 252, 0 ]
[ 285, 48 ]
python
en
['nl', 'en', 'tr']
False
test_yaml_existing
(hass)
Test YAML ignored when already processed.
Test YAML ignored when already processed.
async def test_yaml_existing(hass): """Test YAML ignored when already processed.""" MockConfigEntry( domain=DOMAIN, data={ CONF_API_KEY: "123456", CONF_API_TOKEN: "AbCDeF", }, ).add_to_hass(hass) result = await hass.config_entries.flow.async_init( ...
[ "async", "def", "test_yaml_existing", "(", "hass", ")", ":", "MockConfigEntry", "(", "domain", "=", "DOMAIN", ",", "data", "=", "{", "CONF_API_KEY", ":", "\"123456\"", ",", "CONF_API_TOKEN", ":", "\"AbCDeF\"", ",", "}", ",", ")", ".", "add_to_hass", "(", "...
[ 288, 0 ]
[ 308, 51 ]
python
en
['en', 'en', 'en']
True
async_setup_platform
( hass: HomeAssistant, config: ConfigType, async_add_entities: AddEntitiesCallback, discovery_info: DiscoveryInfoType | None = None, )
Set up the Fast.com sensor.
Set up the Fast.com sensor.
async def async_setup_platform( hass: HomeAssistant, config: ConfigType, async_add_entities: AddEntitiesCallback, discovery_info: DiscoveryInfoType | None = None, ) -> None: """Set up the Fast.com sensor.""" async_add_entities([SpeedtestSensor(hass.data[FASTDOTCOM_DOMAIN])])
[ "async", "def", "async_setup_platform", "(", "hass", ":", "HomeAssistant", ",", "config", ":", "ConfigType", ",", "async_add_entities", ":", "AddEntitiesCallback", ",", "discovery_info", ":", "DiscoveryInfoType", "|", "None", "=", "None", ",", ")", "->", "None", ...
[ 18, 0 ]
[ 25, 71 ]
python
en
['en', 'pt', 'en']
True
SpeedtestSensor.__init__
(self, speedtest_data: dict[str, Any])
Initialize the sensor.
Initialize the sensor.
def __init__(self, speedtest_data: dict[str, Any]) -> None: """Initialize the sensor.""" self._speedtest_data = speedtest_data
[ "def", "__init__", "(", "self", ",", "speedtest_data", ":", "dict", "[", "str", ",", "Any", "]", ")", "->", "None", ":", "self", ".", "_speedtest_data", "=", "speedtest_data" ]
[ 37, 4 ]
[ 39, 45 ]
python
en
['en', 'en', 'en']
True
SpeedtestSensor.async_added_to_hass
(self)
Handle entity which will be added.
Handle entity which will be added.
async def async_added_to_hass(self) -> None: """Handle entity which will be added.""" await super().async_added_to_hass() self.async_on_remove( async_dispatcher_connect( self.hass, DATA_UPDATED, self._schedule_immediate_update ) ) state =...
[ "async", "def", "async_added_to_hass", "(", "self", ")", "->", "None", ":", "await", "super", "(", ")", ".", "async_added_to_hass", "(", ")", "self", ".", "async_on_remove", "(", "async_dispatcher_connect", "(", "self", ".", "hass", ",", "DATA_UPDATED", ",", ...
[ 41, 4 ]
[ 54, 45 ]
python
en
['en', 'en', 'en']
True
SpeedtestSensor.update
(self)
Get the latest data and update the states.
Get the latest data and update the states.
def update(self) -> None: """Get the latest data and update the states.""" data = self._speedtest_data.data # type: ignore[attr-defined] if data is None: return self._attr_native_value = data["download"]
[ "def", "update", "(", "self", ")", "->", "None", ":", "data", "=", "self", ".", "_speedtest_data", ".", "data", "# type: ignore[attr-defined]", "if", "data", "is", "None", ":", "return", "self", ".", "_attr_native_value", "=", "data", "[", "\"download\"", "]...
[ 56, 4 ]
[ 61, 50 ]
python
en
['en', 'en', 'en']
True
is_on
(hass: HomeAssistant, entity_id: str)
Return the state if any or a specified device is home.
Return the state if any or a specified device is home.
def is_on(hass: HomeAssistant, entity_id: str) -> bool: """Return the state if any or a specified device is home.""" return hass.states.is_state(entity_id, STATE_HOME)
[ "def", "is_on", "(", "hass", ":", "HomeAssistant", ",", "entity_id", ":", "str", ")", "->", "bool", ":", "return", "hass", ".", "states", ".", "is_state", "(", "entity_id", ",", "STATE_HOME", ")" ]
[ 39, 0 ]
[ 41, 54 ]
python
en
['en', 'en', 'en']
True
async_setup
(hass: HomeAssistant, config: ConfigType)
Set up the device tracker.
Set up the device tracker.
async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool: """Set up the device tracker.""" await async_setup_legacy_integration(hass, config) return True
[ "async", "def", "async_setup", "(", "hass", ":", "HomeAssistant", ",", "config", ":", "ConfigType", ")", "->", "bool", ":", "await", "async_setup_legacy_integration", "(", "hass", ",", "config", ")", "return", "True" ]
[ 44, 0 ]
[ 48, 15 ]
python
en
['en', 'en', 'en']
True
async_register_commands
( hass: HomeAssistant, async_reg: Callable[[HomeAssistant, const.WebSocketCommandHandler], None], )
Register commands.
Register commands.
def async_register_commands( hass: HomeAssistant, async_reg: Callable[[HomeAssistant, const.WebSocketCommandHandler], None], ) -> None: """Register commands.""" async_reg(hass, handle_call_service) async_reg(hass, handle_entity_source) async_reg(hass, handle_execute_script) async_reg(hass, h...
[ "def", "async_register_commands", "(", "hass", ":", "HomeAssistant", ",", "async_reg", ":", "Callable", "[", "[", "HomeAssistant", ",", "const", ".", "WebSocketCommandHandler", "]", ",", "None", "]", ",", ")", "->", "None", ":", "async_reg", "(", "hass", ","...
[ 38, 0 ]
[ 58, 46 ]
python
en
['en', 'da', 'en']
False
pong_message
(iden: int)
Return a pong message.
Return a pong message.
def pong_message(iden: int) -> dict[str, Any]: """Return a pong message.""" return {"id": iden, "type": "pong"}
[ "def", "pong_message", "(", "iden", ":", "int", ")", "->", "dict", "[", "str", ",", "Any", "]", ":", "return", "{", "\"id\"", ":", "iden", ",", "\"type\"", ":", "\"pong\"", "}" ]
[ 61, 0 ]
[ 63, 39 ]
python
en
['en', 'lb', 'en']
True
handle_subscribe_events
( hass: HomeAssistant, connection: ActiveConnection, msg: dict[str, Any] )
Handle subscribe events command.
Handle subscribe events command.
def handle_subscribe_events( hass: HomeAssistant, connection: ActiveConnection, msg: dict[str, Any] ) -> None: """Handle subscribe events command.""" # Circular dep # pylint: disable=import-outside-toplevel from .permissions import SUBSCRIBE_ALLOWLIST event_type = msg["event_type"] if even...
[ "def", "handle_subscribe_events", "(", "hass", ":", "HomeAssistant", ",", "connection", ":", "ActiveConnection", ",", "msg", ":", "dict", "[", "str", ",", "Any", "]", ")", "->", "None", ":", "# Circular dep", "# pylint: disable=import-outside-toplevel", "from", "....
[ 73, 0 ]
[ 112, 63 ]
python
en
['en', 'en', 'en']
True
handle_subscribe_bootstrap_integrations
( hass: HomeAssistant, connection: ActiveConnection, msg: dict[str, Any] )
Handle subscribe bootstrap integrations command.
Handle subscribe bootstrap integrations command.
def handle_subscribe_bootstrap_integrations( hass: HomeAssistant, connection: ActiveConnection, msg: dict[str, Any] ) -> None: """Handle subscribe bootstrap integrations command.""" @callback def forward_bootstrap_integrations(message: dict[str, Any]) -> None: """Forward bootstrap integrations ...
[ "def", "handle_subscribe_bootstrap_integrations", "(", "hass", ":", "HomeAssistant", ",", "connection", ":", "ActiveConnection", ",", "msg", ":", "dict", "[", "str", ",", "Any", "]", ")", "->", "None", ":", "@", "callback", "def", "forward_bootstrap_integrations",...
[ 121, 0 ]
[ 135, 63 ]
python
en
['en', 'en', 'en']
True
handle_unsubscribe_events
( hass: HomeAssistant, connection: ActiveConnection, msg: dict[str, Any] )
Handle unsubscribe events command.
Handle unsubscribe events command.
def handle_unsubscribe_events( hass: HomeAssistant, connection: ActiveConnection, msg: dict[str, Any] ) -> None: """Handle unsubscribe events command.""" subscription = msg["subscription"] if subscription in connection.subscriptions: connection.subscriptions.pop(subscription)() connecti...
[ "def", "handle_unsubscribe_events", "(", "hass", ":", "HomeAssistant", ",", "connection", ":", "ActiveConnection", ",", "msg", ":", "dict", "[", "str", ",", "Any", "]", ")", "->", "None", ":", "subscription", "=", "msg", "[", "\"subscription\"", "]", "if", ...
[ 145, 0 ]
[ 159, 9 ]
python
en
['en', 'en', 'en']
True
handle_call_service
( hass: HomeAssistant, connection: ActiveConnection, msg: dict[str, Any] )
Handle call service command.
Handle call service command.
async def handle_call_service( hass: HomeAssistant, connection: ActiveConnection, msg: dict[str, Any] ) -> None: """Handle call service command.""" blocking = True # We do not support templates. target = msg.get("target") if template.is_complex(target): raise vol.Invalid("Templates are n...
[ "async", "def", "handle_call_service", "(", "hass", ":", "HomeAssistant", ",", "connection", ":", "ActiveConnection", ",", "msg", ":", "dict", "[", "str", ",", "Any", "]", ")", "->", "None", ":", "blocking", "=", "True", "# We do not support templates.", "targ...
[ 172, 0 ]
[ 221, 9 ]
python
en
['en', 'en', 'en']
True
handle_get_states
( hass: HomeAssistant, connection: ActiveConnection, msg: dict[str, Any] )
Handle get states command.
Handle get states command.
def handle_get_states( hass: HomeAssistant, connection: ActiveConnection, msg: dict[str, Any] ) -> None: """Handle get states command.""" if connection.user.permissions.access_all_entities("read"): states = hass.states.async_all() else: entity_perm = connection.user.permissions.check_ent...
[ "def", "handle_get_states", "(", "hass", ":", "HomeAssistant", ",", "connection", ":", "ActiveConnection", ",", "msg", ":", "dict", "[", "str", ",", "Any", "]", ")", "->", "None", ":", "if", "connection", ".", "user", ".", "permissions", ".", "access_all_e...
[ 226, 0 ]
[ 240, 71 ]
python
en
['nl', 'en', 'en']
True
handle_get_services
( hass: HomeAssistant, connection: ActiveConnection, msg: dict[str, Any] )
Handle get services command.
Handle get services command.
async def handle_get_services( hass: HomeAssistant, connection: ActiveConnection, msg: dict[str, Any] ) -> None: """Handle get services command.""" descriptions = await async_get_all_descriptions(hass) connection.send_message(messages.result_message(msg["id"], descriptions))
[ "async", "def", "handle_get_services", "(", "hass", ":", "HomeAssistant", ",", "connection", ":", "ActiveConnection", ",", "msg", ":", "dict", "[", "str", ",", "Any", "]", ")", "->", "None", ":", "descriptions", "=", "await", "async_get_all_descriptions", "(",...
[ 245, 0 ]
[ 250, 77 ]
python
en
['nl', 'en', 'en']
True
handle_get_config
( hass: HomeAssistant, connection: ActiveConnection, msg: dict[str, Any] )
Handle get config command.
Handle get config command.
def handle_get_config( hass: HomeAssistant, connection: ActiveConnection, msg: dict[str, Any] ) -> None: """Handle get config command.""" connection.send_message(messages.result_message(msg["id"], hass.config.as_dict()))
[ "def", "handle_get_config", "(", "hass", ":", "HomeAssistant", ",", "connection", ":", "ActiveConnection", ",", "msg", ":", "dict", "[", "str", ",", "Any", "]", ")", "->", "None", ":", "connection", ".", "send_message", "(", "messages", ".", "result_message"...
[ 255, 0 ]
[ 259, 86 ]
python
en
['nl', 'en', 'en']
True
handle_manifest_list
( hass: HomeAssistant, connection: ActiveConnection, msg: dict[str, Any] )
Handle integrations command.
Handle integrations command.
async def handle_manifest_list( hass: HomeAssistant, connection: ActiveConnection, msg: dict[str, Any] ) -> None: """Handle integrations command.""" loaded_integrations = async_get_loaded_integrations(hass) integrations = await asyncio.gather( *(async_get_integration(hass, domain) for domain in ...
[ "async", "def", "handle_manifest_list", "(", "hass", ":", "HomeAssistant", ",", "connection", ":", "ActiveConnection", ",", "msg", ":", "dict", "[", "str", ",", "Any", "]", ")", "->", "None", ":", "loaded_integrations", "=", "async_get_loaded_integrations", "(",...
[ 264, 0 ]
[ 274, 5 ]
python
ca
['fr', 'ca', 'en']
False
handle_manifest_get
( hass: HomeAssistant, connection: ActiveConnection, msg: dict[str, Any] )
Handle integrations command.
Handle integrations command.
async def handle_manifest_get( hass: HomeAssistant, connection: ActiveConnection, msg: dict[str, Any] ) -> None: """Handle integrations command.""" try: integration = await async_get_integration(hass, msg["integration"]) connection.send_result(msg["id"], integration.manifest) except Inte...
[ "async", "def", "handle_manifest_get", "(", "hass", ":", "HomeAssistant", ",", "connection", ":", "ActiveConnection", ",", "msg", ":", "dict", "[", "str", ",", "Any", "]", ")", "->", "None", ":", "try", ":", "integration", "=", "await", "async_get_integratio...
[ 281, 0 ]
[ 289, 86 ]
python
ca
['fr', 'ca', 'en']
False