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_update_device_config_invalid_data
(hass, hass_client)
Test updating device config.
Test updating device config.
async def test_update_device_config_invalid_data(hass, hass_client): """Test updating device config.""" with patch.object(config, "SECTIONS", ["group"]): await async_setup_component(hass, "config", {}) client = await hass_client() resp = await client.post( "/api/config/group/config/hel...
[ "async", "def", "test_update_device_config_invalid_data", "(", "hass", ",", "hass_client", ")", ":", "with", "patch", ".", "object", "(", "config", ",", "\"SECTIONS\"", ",", "[", "\"group\"", "]", ")", ":", "await", "async_setup_component", "(", "hass", ",", "...
[ 91, 0 ]
[ 102, 29 ]
python
en
['de', 'en', 'en']
True
test_update_device_config_invalid_json
(hass, hass_client)
Test updating device config.
Test updating device config.
async def test_update_device_config_invalid_json(hass, hass_client): """Test updating device config.""" with patch.object(config, "SECTIONS", ["group"]): await async_setup_component(hass, "config", {}) client = await hass_client() resp = await client.post("/api/config/group/config/hello_beer",...
[ "async", "def", "test_update_device_config_invalid_json", "(", "hass", ",", "hass_client", ")", ":", "with", "patch", ".", "object", "(", "config", ",", "\"SECTIONS\"", ",", "[", "\"group\"", "]", ")", ":", "await", "async_setup_component", "(", "hass", ",", "...
[ 105, 0 ]
[ 114, 29 ]
python
en
['de', 'en', 'en']
True
setup_platform
(hass, config, add_entities, discovery_info=None)
Set up the raspihats switch devices.
Set up the raspihats switch devices.
def setup_platform(hass, config, add_entities, discovery_info=None): """Set up the raspihats switch devices.""" I2CHatSwitch.I2C_HATS_MANAGER = hass.data[I2C_HATS_MANAGER] switches = [] i2c_hat_configs = config.get(CONF_I2C_HATS) for i2c_hat_config in i2c_hat_configs: board = i2c_hat_config[...
[ "def", "setup_platform", "(", "hass", ",", "config", ",", "add_entities", ",", "discovery_info", "=", "None", ")", ":", "I2CHatSwitch", ".", "I2C_HATS_MANAGER", "=", "hass", ".", "data", "[", "I2C_HATS_MANAGER", "]", "switches", "=", "[", "]", "i2c_hat_configs...
[ 50, 0 ]
[ 75, 26 ]
python
en
['en', 'en', 'en']
True
I2CHatSwitch.__init__
(self, board, address, channel, name, invert_logic, initial_state)
Initialize switch.
Initialize switch.
def __init__(self, board, address, channel, name, invert_logic, initial_state): """Initialize switch.""" self._board = board self._address = address self._channel = channel self._name = name or DEVICE_DEFAULT_NAME self._invert_logic = invert_logic if initial_state...
[ "def", "__init__", "(", "self", ",", "board", ",", "address", ",", "channel", ",", "name", ",", "invert_logic", ",", "initial_state", ")", ":", "self", ".", "_board", "=", "board", "self", ".", "_address", "=", "address", "self", ".", "_channel", "=", ...
[ 83, 4 ]
[ 103, 9 ]
python
en
['en', 'pl', 'en']
False
I2CHatSwitch._log_message
(self, message)
Create log message.
Create log message.
def _log_message(self, message): """Create log message.""" string = f"{self._name} " string += f"{self._board}I2CHat@{hex(self._address)} " string += f"channel:{str(self._channel)}{message}" return string
[ "def", "_log_message", "(", "self", ",", "message", ")", ":", "string", "=", "f\"{self._name} \"", "string", "+=", "f\"{self._board}I2CHat@{hex(self._address)} \"", "string", "+=", "f\"channel:{str(self._channel)}{message}\"", "return", "string" ]
[ 105, 4 ]
[ 110, 21 ]
python
da
['da', 'ky', 'en']
False
I2CHatSwitch.name
(self)
Return the name of the switch.
Return the name of the switch.
def name(self): """Return the name of the switch.""" return self._name
[ "def", "name", "(", "self", ")", ":", "return", "self", ".", "_name" ]
[ 113, 4 ]
[ 115, 25 ]
python
en
['en', 'en', 'en']
True
I2CHatSwitch.should_poll
(self)
Return the polling state.
Return the polling state.
def should_poll(self): """Return the polling state.""" return False
[ "def", "should_poll", "(", "self", ")", ":", "return", "False" ]
[ 118, 4 ]
[ 120, 20 ]
python
en
['en', 'en', 'en']
True
I2CHatSwitch.is_on
(self)
Return true if device is on.
Return true if device is on.
def is_on(self): """Return true if device is on.""" try: state = self.I2C_HATS_MANAGER.read_dq(self._address, self._channel) return state != self._invert_logic except I2CHatsException as ex: _LOGGER.error(self._log_message(f"Is ON check failed, {ex!s}")) ...
[ "def", "is_on", "(", "self", ")", ":", "try", ":", "state", "=", "self", ".", "I2C_HATS_MANAGER", ".", "read_dq", "(", "self", ".", "_address", ",", "self", ".", "_channel", ")", "return", "state", "!=", "self", ".", "_invert_logic", "except", "I2CHatsEx...
[ 123, 4 ]
[ 130, 24 ]
python
en
['en', 'fy', 'en']
True
I2CHatSwitch.turn_on
(self, **kwargs)
Turn the device on.
Turn the device on.
def turn_on(self, **kwargs): """Turn the device on.""" try: state = self._invert_logic is False self.I2C_HATS_MANAGER.write_dq(self._address, self._channel, state) self.schedule_update_ha_state() except I2CHatsException as ex: _LOGGER.error(self._l...
[ "def", "turn_on", "(", "self", ",", "*", "*", "kwargs", ")", ":", "try", ":", "state", "=", "self", ".", "_invert_logic", "is", "False", "self", ".", "I2C_HATS_MANAGER", ".", "write_dq", "(", "self", ".", "_address", ",", "self", ".", "_channel", ",", ...
[ 132, 4 ]
[ 139, 71 ]
python
en
['en', 'en', 'en']
True
I2CHatSwitch.turn_off
(self, **kwargs)
Turn the device off.
Turn the device off.
def turn_off(self, **kwargs): """Turn the device off.""" try: state = self._invert_logic is not False self.I2C_HATS_MANAGER.write_dq(self._address, self._channel, state) self.schedule_update_ha_state() except I2CHatsException as ex: _LOGGER.error(s...
[ "def", "turn_off", "(", "self", ",", "*", "*", "kwargs", ")", ":", "try", ":", "state", "=", "self", ".", "_invert_logic", "is", "not", "False", "self", ".", "I2C_HATS_MANAGER", ".", "write_dq", "(", "self", ".", "_address", ",", "self", ".", "_channel...
[ 141, 4 ]
[ 148, 72 ]
python
en
['en', 'en', 'en']
True
test_show_config_form
()
Test show configuration form.
Test show configuration form.
async def test_show_config_form(): """Test show configuration form.""" hass = Mock() flow = config_flow.IpmaFlowHandler() flow.hass = hass result = await flow._show_config_form() assert result["type"] == "form" assert result["step_id"] == "user"
[ "async", "def", "test_show_config_form", "(", ")", ":", "hass", "=", "Mock", "(", ")", "flow", "=", "config_flow", ".", "IpmaFlowHandler", "(", ")", "flow", ".", "hass", "=", "hass", "result", "=", "await", "flow", ".", "_show_config_form", "(", ")", "as...
[ 13, 0 ]
[ 22, 38 ]
python
en
['en', 'fr', 'en']
True
test_show_config_form_default_values
()
Test show configuration form.
Test show configuration form.
async def test_show_config_form_default_values(): """Test show configuration form.""" hass = Mock() flow = config_flow.IpmaFlowHandler() flow.hass = hass result = await flow._show_config_form(name="test", latitude="0", longitude="0") assert result["type"] == "form" assert result["step_id"]...
[ "async", "def", "test_show_config_form_default_values", "(", ")", ":", "hass", "=", "Mock", "(", ")", "flow", "=", "config_flow", ".", "IpmaFlowHandler", "(", ")", "flow", ".", "hass", "=", "hass", "result", "=", "await", "flow", ".", "_show_config_form", "(...
[ 25, 0 ]
[ 34, 38 ]
python
en
['en', 'fr', 'en']
True
test_flow_with_home_location
(hass)
Test config flow . Tests the flow when a default location is configured then it should return a form with default values
Test config flow .
async def test_flow_with_home_location(hass): """Test config flow . Tests the flow when a default location is configured then it should return a form with default values """ flow = config_flow.IpmaFlowHandler() flow.hass = hass hass.config.location_name = "Home" hass.config.latitude = ...
[ "async", "def", "test_flow_with_home_location", "(", "hass", ")", ":", "flow", "=", "config_flow", ".", "IpmaFlowHandler", "(", ")", "flow", ".", "hass", "=", "hass", "hass", ".", "config", ".", "location_name", "=", "\"Home\"", "hass", ".", "config", ".", ...
[ 37, 0 ]
[ 52, 38 ]
python
en
['en', 'da', 'en']
True
test_flow_show_form
()
Test show form scenarios first time. Test when the form should show when no configurations exists
Test show form scenarios first time.
async def test_flow_show_form(): """Test show form scenarios first time. Test when the form should show when no configurations exists """ hass = Mock() flow = config_flow.IpmaFlowHandler() flow.hass = hass with patch( "homeassistant.components.ipma.config_flow.IpmaFlowHandler._show...
[ "async", "def", "test_flow_show_form", "(", ")", ":", "hass", "=", "Mock", "(", ")", "flow", "=", "config_flow", ".", "IpmaFlowHandler", "(", ")", "flow", ".", "hass", "=", "hass", "with", "patch", "(", "\"homeassistant.components.ipma.config_flow.IpmaFlowHandler....
[ 55, 0 ]
[ 68, 47 ]
python
en
['es', 'en', 'en']
True
test_flow_entry_created_from_user_input
()
Test that create data from user input. Test when the form should show when no configurations exists
Test that create data from user input.
async def test_flow_entry_created_from_user_input(): """Test that create data from user input. Test when the form should show when no configurations exists """ hass = Mock() flow = config_flow.IpmaFlowHandler() flow.hass = hass test_data = {"name": "home", CONF_LONGITUDE: "0", CONF_LATITUD...
[ "async", "def", "test_flow_entry_created_from_user_input", "(", ")", ":", "hass", "=", "Mock", "(", ")", "flow", "=", "config_flow", ".", "IpmaFlowHandler", "(", ")", "flow", ".", "hass", "=", "hass", "test_data", "=", "{", "\"name\"", ":", "\"home\"", ",", ...
[ 71, 0 ]
[ 96, 41 ]
python
en
['en', 'en', 'en']
True
test_flow_entry_config_entry_already_exists
()
Test that create data from user input and config_entry already exists. Test when the form should show when user puts existing name in the config gui. Then the form should show with error
Test that create data from user input and config_entry already exists.
async def test_flow_entry_config_entry_already_exists(): """Test that create data from user input and config_entry already exists. Test when the form should show when user puts existing name in the config gui. Then the form should show with error """ hass = Mock() flow = config_flow.IpmaFlowHan...
[ "async", "def", "test_flow_entry_config_entry_already_exists", "(", ")", ":", "hass", "=", "Mock", "(", ")", "flow", "=", "config_flow", ".", "IpmaFlowHandler", "(", ")", "flow", ".", "hass", "=", "hass", "test_data", "=", "{", "\"name\"", ":", "\"home\"", "...
[ 99, 0 ]
[ 122, 37 ]
python
en
['en', 'en', 'en']
True
test_config_entry_migration
(hass)
Tests config entry without mode in unique_id can be migrated.
Tests config entry without mode in unique_id can be migrated.
async def test_config_entry_migration(hass): """Tests config entry without mode in unique_id can be migrated.""" ipma_entry = MockConfigEntry( domain=DOMAIN, title="Home", data={CONF_LATITUDE: 0, CONF_LONGITUDE: 0, CONF_MODE: "daily"}, ) ipma_entry.add_to_hass(hass) ipma_ent...
[ "async", "def", "test_config_entry_migration", "(", "hass", ")", ":", "ipma_entry", "=", "MockConfigEntry", "(", "domain", "=", "DOMAIN", ",", "title", "=", "\"Home\"", ",", "data", "=", "{", "CONF_LATITUDE", ":", "0", ",", "CONF_LONGITUDE", ":", "0", ",", ...
[ 125, 0 ]
[ 172, 56 ]
python
en
['en', 'en', 'en']
True
setup_platform
(hass, config, add_entities, discovery_info=None)
Set up the Ping Binary sensor.
Set up the Ping Binary sensor.
def setup_platform(hass, config, add_entities, discovery_info=None) -> None: """Set up the Ping Binary sensor.""" setup_reload_service(hass, DOMAIN, PLATFORMS) host = config[CONF_HOST] count = config[CONF_PING_COUNT] name = config.get(CONF_NAME, f"{DEFAULT_NAME} {host}") try: # Verify ...
[ "def", "setup_platform", "(", "hass", ",", "config", ",", "add_entities", ",", "discovery_info", "=", "None", ")", "->", "None", ":", "setup_reload_service", "(", "hass", ",", "DOMAIN", ",", "PLATFORMS", ")", "host", "=", "config", "[", "CONF_HOST", "]", "...
[ 62, 0 ]
[ 80, 59 ]
python
en
['en', 'ceb', 'en']
True
PingBinarySensor.__init__
(self, name: str, ping)
Initialize the Ping Binary sensor.
Initialize the Ping Binary sensor.
def __init__(self, name: str, ping) -> None: """Initialize the Ping Binary sensor.""" self._name = name self._ping = ping
[ "def", "__init__", "(", "self", ",", "name", ":", "str", ",", "ping", ")", "->", "None", ":", "self", ".", "_name", "=", "name", "self", ".", "_ping", "=", "ping" ]
[ 86, 4 ]
[ 89, 25 ]
python
en
['en', 'zh-Latn', 'en']
True
PingBinarySensor.name
(self)
Return the name of the device.
Return the name of the device.
def name(self) -> str: """Return the name of the device.""" return self._name
[ "def", "name", "(", "self", ")", "->", "str", ":", "return", "self", ".", "_name" ]
[ 92, 4 ]
[ 94, 25 ]
python
en
['en', 'en', 'en']
True
PingBinarySensor.device_class
(self)
Return the class of this sensor.
Return the class of this sensor.
def device_class(self) -> str: """Return the class of this sensor.""" return DEVICE_CLASS_CONNECTIVITY
[ "def", "device_class", "(", "self", ")", "->", "str", ":", "return", "DEVICE_CLASS_CONNECTIVITY" ]
[ 97, 4 ]
[ 99, 40 ]
python
en
['en', 'en', 'en']
True
PingBinarySensor.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.""" return self._ping.available
[ "def", "is_on", "(", "self", ")", "->", "bool", ":", "return", "self", ".", "_ping", ".", "available" ]
[ 102, 4 ]
[ 104, 35 ]
python
en
['en', 'fy', 'en']
True
PingBinarySensor.device_state_attributes
(self)
Return the state attributes of the ICMP checo request.
Return the state attributes of the ICMP checo request.
def device_state_attributes(self) -> Dict[str, Any]: """Return the state attributes of the ICMP checo request.""" if self._ping.data is not False: return { ATTR_ROUND_TRIP_TIME_AVG: self._ping.data["avg"], ATTR_ROUND_TRIP_TIME_MAX: self._ping.data["max"], ...
[ "def", "device_state_attributes", "(", "self", ")", "->", "Dict", "[", "str", ",", "Any", "]", ":", "if", "self", ".", "_ping", ".", "data", "is", "not", "False", ":", "return", "{", "ATTR_ROUND_TRIP_TIME_AVG", ":", "self", ".", "_ping", ".", "data", "...
[ 107, 4 ]
[ 115, 13 ]
python
en
['en', 'en', 'en']
True
PingBinarySensor.async_update
(self)
Get the latest data.
Get the latest data.
async def async_update(self) -> None: """Get the latest data.""" await self._ping.async_update()
[ "async", "def", "async_update", "(", "self", ")", "->", "None", ":", "await", "self", ".", "_ping", ".", "async_update", "(", ")" ]
[ 117, 4 ]
[ 119, 39 ]
python
en
['en', 'en', 'en']
True
PingData.__init__
(self, hass, host, count)
Initialize the data object.
Initialize the data object.
def __init__(self, hass, host, count) -> None: """Initialize the data object.""" self.hass = hass self._ip_address = host self._count = count self.data = {} self.available = False
[ "def", "__init__", "(", "self", ",", "hass", ",", "host", ",", "count", ")", "->", "None", ":", "self", ".", "hass", "=", "hass", "self", ".", "_ip_address", "=", "host", "self", ".", "_count", "=", "count", "self", ".", "data", "=", "{", "}", "s...
[ 125, 4 ]
[ 131, 30 ]
python
en
['en', 'en', 'en']
True
PingDataICMPLib.async_update
(self)
Retrieve the latest details from the host.
Retrieve the latest details from the host.
async def async_update(self) -> None: """Retrieve the latest details from the host.""" _LOGGER.debug("ping address: %s", self._ip_address) data = await self.hass.async_add_executor_job( partial( icmp_ping, self._ip_address, count=self._...
[ "async", "def", "async_update", "(", "self", ")", "->", "None", ":", "_LOGGER", ".", "debug", "(", "\"ping address: %s\"", ",", "self", ".", "_ip_address", ")", "data", "=", "await", "self", ".", "hass", ".", "async_add_executor_job", "(", "partial", "(", ...
[ 137, 4 ]
[ 159, 9 ]
python
en
['en', 'en', 'en']
True
PingDataSubProcess.__init__
(self, hass, host, count)
Initialize the data object.
Initialize the data object.
def __init__(self, hass, host, count) -> None: """Initialize the data object.""" super().__init__(hass, host, count) if sys.platform == "win32": self._ping_cmd = [ "ping", "-n", str(self._count), "-w", "1...
[ "def", "__init__", "(", "self", ",", "hass", ",", "host", ",", "count", ")", "->", "None", ":", "super", "(", ")", ".", "__init__", "(", "hass", ",", "host", ",", "count", ")", "if", "sys", ".", "platform", "==", "\"win32\"", ":", "self", ".", "_...
[ 165, 4 ]
[ 186, 13 ]
python
en
['en', 'en', 'en']
True
PingDataSubProcess.async_ping
(self)
Send ICMP echo request and return details if success.
Send ICMP echo request and return details if success.
async def async_ping(self): """Send ICMP echo request and return details if success.""" pinger = await asyncio.create_subprocess_exec( *self._ping_cmd, stdin=None, stdout=asyncio.subprocess.PIPE, stderr=asyncio.subprocess.PIPE, ) try: ...
[ "async", "def", "async_ping", "(", "self", ")", ":", "pinger", "=", "await", "asyncio", ".", "create_subprocess_exec", "(", "*", "self", ".", "_ping_cmd", ",", "stdin", "=", "None", ",", "stdout", "=", "asyncio", ".", "subprocess", ".", "PIPE", ",", "std...
[ 188, 4 ]
[ 250, 24 ]
python
en
['en', 'en', 'en']
True
PingDataSubProcess.async_update
(self)
Retrieve the latest details from the host.
Retrieve the latest details from the host.
async def async_update(self) -> None: """Retrieve the latest details from the host.""" self.data = await self.async_ping() self.available = bool(self.data)
[ "async", "def", "async_update", "(", "self", ")", "->", "None", ":", "self", ".", "data", "=", "await", "self", ".", "async_ping", "(", ")", "self", ".", "available", "=", "bool", "(", "self", ".", "data", ")" ]
[ 252, 4 ]
[ 255, 40 ]
python
en
['en', 'en', 'en']
True
create_model
(samples_x, samples_y_aggregation, n_restarts_optimizer=250, is_white_kernel=False)
Trains GP regression model
Trains GP regression model
def create_model(samples_x, samples_y_aggregation, n_restarts_optimizer=250, is_white_kernel=False): ''' Trains GP regression model ''' kernel = gp.kernels.ConstantKernel(constant_value=1, constant_value_bounds=(1e-12, 1e12)) * \ ...
[ "def", "create_model", "(", "samples_x", ",", "samples_y_aggregation", ",", "n_restarts_optimizer", "=", "250", ",", "is_white_kernel", "=", "False", ")", ":", "kernel", "=", "gp", ".", "kernels", ".", "ConstantKernel", "(", "constant_value", "=", "1", ",", "c...
[ 12, 0 ]
[ 34, 16 ]
python
en
['en', 'error', 'th']
False
setup
(hass, config)
Set up the Hive Component.
Set up the Hive Component.
def setup(hass, config): """Set up the Hive Component.""" def heating_boost(service): """Handle the service call.""" node_id = HiveSession.entity_lookup.get(service.data[ATTR_ENTITY_ID]) if not node_id: # log or raise error _LOGGER.error("Cannot boost entity id e...
[ "def", "setup", "(", "hass", ",", "config", ")", ":", "def", "heating_boost", "(", "service", ")", ":", "\"\"\"Handle the service call.\"\"\"", "node_id", "=", "HiveSession", ".", "entity_lookup", ".", "get", "(", "service", ".", "data", "[", "ATTR_ENTITY_ID", ...
[ 86, 0 ]
[ 158, 15 ]
python
en
['en', 'en', 'en']
True
refresh_system
(func)
Force update all entities after state change.
Force update all entities after state change.
def refresh_system(func): """Force update all entities after state change.""" @wraps(func) def wrapper(self, *args, **kwargs): func(self, *args, **kwargs) dispatcher_send(self.hass, DOMAIN) return wrapper
[ "def", "refresh_system", "(", "func", ")", ":", "@", "wraps", "(", "func", ")", "def", "wrapper", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "func", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", "dispatcher_s...
[ 161, 0 ]
[ 169, 18 ]
python
en
['en', 'en', 'en']
True
HiveEntity.__init__
(self, session, hive_device)
Initialize the instance.
Initialize the instance.
def __init__(self, session, hive_device): """Initialize the instance.""" self.node_id = hive_device["Hive_NodeID"] self.node_name = hive_device["Hive_NodeName"] self.device_type = hive_device["HA_DeviceType"] self.node_device_type = hive_device["Hive_DeviceType"] self.ses...
[ "def", "__init__", "(", "self", ",", "session", ",", "hive_device", ")", ":", "self", ".", "node_id", "=", "hive_device", "[", "\"Hive_NodeID\"", "]", "self", ".", "node_name", "=", "hive_device", "[", "\"Hive_NodeName\"", "]", "self", ".", "device_type", "=...
[ 175, 4 ]
[ 183, 62 ]
python
en
['en', 'en', 'en']
True
HiveEntity.async_added_to_hass
(self)
When entity is added to Home Assistant.
When entity is added to Home Assistant.
async def async_added_to_hass(self): """When entity is added to Home Assistant.""" self.async_on_remove( async_dispatcher_connect(self.hass, DOMAIN, self.async_write_ha_state) ) if self.device_type in SERVICES: self.session.entity_lookup[self.entity_id] = self.nod...
[ "async", "def", "async_added_to_hass", "(", "self", ")", ":", "self", ".", "async_on_remove", "(", "async_dispatcher_connect", "(", "self", ".", "hass", ",", "DOMAIN", ",", "self", ".", "async_write_ha_state", ")", ")", "if", "self", ".", "device_type", "in", ...
[ 185, 4 ]
[ 191, 69 ]
python
en
['en', 'en', 'en']
True
format_time
(t)
Format `t` (in seconds) to (h):mm:ss
Format `t` (in seconds) to (h):mm:ss
def format_time(t): "Format `t` (in seconds) to (h):mm:ss" t = int(t) h, m, s = t // 3600, (t // 60) % 60, t % 60 return f"{h}:{m:02d}:{s:02d}" if h != 0 else f"{m:02d}:{s:02d}"
[ "def", "format_time", "(", "t", ")", ":", "t", "=", "int", "(", "t", ")", "h", ",", "m", ",", "s", "=", "t", "//", "3600", ",", "(", "t", "//", "60", ")", "%", "60", ",", "t", "%", "60", "return", "f\"{h}:{m:02d}:{s:02d}\"", "if", "h", "!=", ...
[ 24, 0 ]
[ 28, 67 ]
python
en
['en', 'en', 'en']
True
text_to_html_table
(items)
Put the texts in `items` in an HTML table.
Put the texts in `items` in an HTML table.
def text_to_html_table(items): "Put the texts in `items` in an HTML table." html_code = """<table border="1" class="dataframe">\n""" html_code += """ <thead>\n <tr style="text-align: left;">\n""" for i in items[0]: html_code += f" <th>{i}</th>\n" html_code += " </tr>\n </thead>\...
[ "def", "text_to_html_table", "(", "items", ")", ":", "html_code", "=", "\"\"\"<table border=\"1\" class=\"dataframe\">\\n\"\"\"", "html_code", "+=", "\"\"\" <thead>\\n <tr style=\"text-align: left;\">\\n\"\"\"", "for", "i", "in", "items", "[", "0", "]", ":", "html_code", ...
[ 51, 0 ]
[ 65, 20 ]
python
en
['en', 'en', 'en']
True
NotebookProgressBar.update
(self, value: int, force_update: bool = False, comment: str = None)
The main method to update the progress bar to :obj:`value`. Args: value (:obj:`int`): The value to use. Must be between 0 and :obj:`total`. force_update (:obj:`bool`, `optional`, defaults to :obj:`False`): Whether or not to force and update of t...
The main method to update the progress bar to :obj:`value`.
def update(self, value: int, force_update: bool = False, comment: str = None): """ The main method to update the progress bar to :obj:`value`. Args: value (:obj:`int`): The value to use. Must be between 0 and :obj:`total`. force_update (:obj:`bool`, `opt...
[ "def", "update", "(", "self", ",", "value", ":", "int", ",", "force_update", ":", "bool", "=", "False", ",", "comment", ":", "str", "=", "None", ")", ":", "self", ".", "value", "=", "value", "if", "comment", "is", "not", "None", ":", "self", ".", ...
[ 125, 4 ]
[ 168, 87 ]
python
en
['en', 'error', 'th']
False
NotebookProgressBar.close
(self)
Closes the progress bar.
Closes the progress bar.
def close(self): "Closes the progress bar." if self.parent is None and self.output is not None: self.output.update(disp.HTML(""))
[ "def", "close", "(", "self", ")", ":", "if", "self", ".", "parent", "is", "None", "and", "self", ".", "output", "is", "not", "None", ":", "self", ".", "output", ".", "update", "(", "disp", ".", "HTML", "(", "\"\"", ")", ")" ]
[ 193, 4 ]
[ 196, 45 ]
python
en
['en', 'ca', 'en']
True
NotebookTrainingTracker.write_line
(self, values)
Write the values in the inner table. Args: values (:obj:`Dict[str, float]`): The values to display.
Write the values in the inner table.
def write_line(self, values): """ Write the values in the inner table. Args: values (:obj:`Dict[str, float]`): The values to display. """ if self.inner_table is None: self.inner_table = [list(values.keys()), list(values.values())] else: ...
[ "def", "write_line", "(", "self", ",", "values", ")", ":", "if", "self", ".", "inner_table", "is", "None", ":", "self", ".", "inner_table", "=", "[", "list", "(", "values", ".", "keys", "(", ")", ")", ",", "list", "(", "values", ".", "values", "(",...
[ 227, 4 ]
[ 244, 65 ]
python
en
['en', 'error', 'th']
False
NotebookTrainingTracker.add_child
(self, total, prefix=None, width=300)
Add a child progress bar displayed under the table of metrics. The child progress bar is returned (so it can be easily updated). Args: total (:obj:`int`): The number of iterations for the child progress bar. prefix (:obj:`str`, `optional`): A prefix to write on the left...
Add a child progress bar displayed under the table of metrics. The child progress bar is returned (so it can be easily updated).
def add_child(self, total, prefix=None, width=300): """ Add a child progress bar displayed under the table of metrics. The child progress bar is returned (so it can be easily updated). Args: total (:obj:`int`): The number of iterations for the child progress bar. ...
[ "def", "add_child", "(", "self", ",", "total", ",", "prefix", "=", "None", ",", "width", "=", "300", ")", ":", "self", ".", "child_bar", "=", "NotebookProgressBar", "(", "total", ",", "prefix", "=", "prefix", ",", "parent", "=", "self", ",", "width", ...
[ 246, 4 ]
[ 257, 29 ]
python
en
['en', 'error', 'th']
False
NotebookTrainingTracker.remove_child
(self)
Closes the child progress bar.
Closes the child progress bar.
def remove_child(self): """ Closes the child progress bar. """ self.child_bar = None self.display()
[ "def", "remove_child", "(", "self", ")", ":", "self", ".", "child_bar", "=", "None", "self", ".", "display", "(", ")" ]
[ 259, 4 ]
[ 264, 22 ]
python
en
['en', 'error', 'th']
False
async_get_actions
(hass: HomeAssistant, device_id: str)
List device actions for Water Heater devices.
List device actions for Water Heater devices.
async def async_get_actions(hass: HomeAssistant, device_id: str) -> List[dict]: """List device actions for Water Heater devices.""" registry = await entity_registry.async_get_registry(hass) actions = [] for entry in entity_registry.async_entries_for_device(registry, device_id): if entry.domain ...
[ "async", "def", "async_get_actions", "(", "hass", ":", "HomeAssistant", ",", "device_id", ":", "str", ")", "->", "List", "[", "dict", "]", ":", "registry", "=", "await", "entity_registry", ".", "async_get_registry", "(", "hass", ")", "actions", "=", "[", "...
[ 30, 0 ]
[ 56, 18 ]
python
en
['fr', 'en', 'en']
True
async_call_action_from_config
( hass: HomeAssistant, config: dict, variables: dict, context: Optional[Context] )
Execute a device action.
Execute a device action.
async def async_call_action_from_config( hass: HomeAssistant, config: dict, variables: dict, context: Optional[Context] ) -> None: """Execute a device action.""" config = ACTION_SCHEMA(config) service_data = {ATTR_ENTITY_ID: config[CONF_ENTITY_ID]} if config[CONF_TYPE] == "turn_on": servic...
[ "async", "def", "async_call_action_from_config", "(", "hass", ":", "HomeAssistant", ",", "config", ":", "dict", ",", "variables", ":", "dict", ",", "context", ":", "Optional", "[", "Context", "]", ")", "->", "None", ":", "config", "=", "ACTION_SCHEMA", "(", ...
[ 59, 0 ]
[ 74, 5 ]
python
en
['ro', 'en', 'en']
True
run
(args)
Handle credstash script.
Handle credstash script.
def run(args): """Handle credstash script.""" parser = argparse.ArgumentParser( description=( "Modify Home Assistant secrets in credstash." "Use the secrets in configuration files with: " "!secret <name>" ) ) parser.add_argument("--script", choices=["c...
[ "def", "run", "(", "args", ")", ":", "parser", "=", "argparse", ".", "ArgumentParser", "(", "description", "=", "(", "\"Modify Home Assistant secrets in credstash.\"", "\"Use the secrets in configuration files with: \"", "\"!secret <name>\"", ")", ")", "parser", ".", "add...
[ 11, 0 ]
[ 73, 44 ]
python
es
['es', 'es', 'en']
True
_async_supported
(hass: HomeAssistant)
Return if the system supports under voltage detection.
Return if the system supports under voltage detection.
async def _async_supported(hass: HomeAssistant) -> bool: """Return if the system supports under voltage detection.""" under_voltage = await hass.async_add_executor_job(new_under_voltage) return under_voltage is not None
[ "async", "def", "_async_supported", "(", "hass", ":", "HomeAssistant", ")", "->", "bool", ":", "under_voltage", "=", "await", "hass", ".", "async_add_executor_job", "(", "new_under_voltage", ")", "return", "under_voltage", "is", "not", "None" ]
[ 12, 0 ]
[ 15, 36 ]
python
en
['en', 'en', 'en']
True
RPiPowerFlow.__init__
(self)
Set up config flow.
Set up config flow.
def __init__(self) -> None: """Set up config flow.""" super().__init__( DOMAIN, "Raspberry Pi Power Supply Checker", _async_supported, config_entries.CONN_CLASS_LOCAL_POLL, )
[ "def", "__init__", "(", "self", ")", "->", "None", ":", "super", "(", ")", ".", "__init__", "(", "DOMAIN", ",", "\"Raspberry Pi Power Supply Checker\"", ",", "_async_supported", ",", "config_entries", ".", "CONN_CLASS_LOCAL_POLL", ",", ")" ]
[ 23, 4 ]
[ 30, 9 ]
python
en
['en', 'da', 'en']
True
RPiPowerFlow.async_step_onboarding
( self, data: Optional[Dict[str, Any]] = None )
Handle a flow initialized by onboarding.
Handle a flow initialized by onboarding.
async def async_step_onboarding( self, data: Optional[Dict[str, Any]] = None ) -> Dict[str, Any]: """Handle a flow initialized by onboarding.""" has_devices = await self._discovery_function(self.hass) if not has_devices: return self.async_abort(reason="no_devices_found")...
[ "async", "def", "async_step_onboarding", "(", "self", ",", "data", ":", "Optional", "[", "Dict", "[", "str", ",", "Any", "]", "]", "=", "None", ")", "->", "Dict", "[", "str", ",", "Any", "]", ":", "has_devices", "=", "await", "self", ".", "_discovery...
[ 32, 4 ]
[ 40, 66 ]
python
en
['en', 'en', 'en']
True
radar_map_url
(dim: int = 512, country_code: str = "NL")
Build map url, defaulting to 512 wide (as in component).
Build map url, defaulting to 512 wide (as in component).
def radar_map_url(dim: int = 512, country_code: str = "NL") -> str: """Build map url, defaulting to 512 wide (as in component).""" return f"https://api.buienradar.nl/image/1.0/RadarMap{country_code}?w={dim}&h={dim}"
[ "def", "radar_map_url", "(", "dim", ":", "int", "=", "512", ",", "country_code", ":", "str", "=", "\"NL\"", ")", "->", "str", ":", "return", "f\"https://api.buienradar.nl/image/1.0/RadarMap{country_code}?w={dim}&h={dim}\"" ]
[ 13, 0 ]
[ 15, 88 ]
python
en
['en', 'en', 'en']
True
test_fetching_url_and_caching
(aioclient_mock, hass, hass_client)
Test that it fetches the given url.
Test that it fetches the given url.
async def test_fetching_url_and_caching(aioclient_mock, hass, hass_client): """Test that it fetches the given url.""" aioclient_mock.get(radar_map_url(), text="hello world") await async_setup_component( hass, "camera", {"camera": {"name": "config_test", "platform": "buienradar"}} ) await ha...
[ "async", "def", "test_fetching_url_and_caching", "(", "aioclient_mock", ",", "hass", ",", "hass_client", ")", ":", "aioclient_mock", ".", "get", "(", "radar_map_url", "(", ")", ",", "text", "=", "\"hello world\"", ")", "await", "async_setup_component", "(", "hass"...
[ 18, 0 ]
[ 40, 41 ]
python
en
['en', 'en', 'en']
True
test_expire_delta
(aioclient_mock, hass, hass_client)
Test that the cache expires after delta.
Test that the cache expires after delta.
async def test_expire_delta(aioclient_mock, hass, hass_client): """Test that the cache expires after delta.""" aioclient_mock.get(radar_map_url(), text="hello world") await async_setup_component( hass, "camera", { "camera": { "name": "config_test", ...
[ "async", "def", "test_expire_delta", "(", "aioclient_mock", ",", "hass", ",", "hass_client", ")", ":", "aioclient_mock", ".", "get", "(", "radar_map_url", "(", ")", ",", "text", "=", "\"hello world\"", ")", "await", "async_setup_component", "(", "hass", ",", "...
[ 43, 0 ]
[ 72, 41 ]
python
en
['en', 'en', 'en']
True
test_only_one_fetch_at_a_time
(aioclient_mock, hass, hass_client)
Test that it fetches with only one request at the same time.
Test that it fetches with only one request at the same time.
async def test_only_one_fetch_at_a_time(aioclient_mock, hass, hass_client): """Test that it fetches with only one request at the same time.""" aioclient_mock.get(radar_map_url(), text="hello world") await async_setup_component( hass, "camera", {"camera": {"name": "config_test", "platform": "buienra...
[ "async", "def", "test_only_one_fetch_at_a_time", "(", "aioclient_mock", ",", "hass", ",", "hass_client", ")", ":", "aioclient_mock", ".", "get", "(", "radar_map_url", "(", ")", ",", "text", "=", "\"hello world\"", ")", "await", "async_setup_component", "(", "hass"...
[ 75, 0 ]
[ 94, 41 ]
python
en
['en', 'en', 'en']
True
test_dimension
(aioclient_mock, hass, hass_client)
Test that it actually adheres to the dimension.
Test that it actually adheres to the dimension.
async def test_dimension(aioclient_mock, hass, hass_client): """Test that it actually adheres to the dimension.""" aioclient_mock.get(radar_map_url(700), text="hello world") await async_setup_component( hass, "camera", {"camera": {"name": "config_test", "platform": "buienradar", "di...
[ "async", "def", "test_dimension", "(", "aioclient_mock", ",", "hass", ",", "hass_client", ")", ":", "aioclient_mock", ".", "get", "(", "radar_map_url", "(", "700", ")", ",", "text", "=", "\"hello world\"", ")", "await", "async_setup_component", "(", "hass", ",...
[ 97, 0 ]
[ 112, 41 ]
python
en
['en', 'en', 'en']
True
test_belgium_country
(aioclient_mock, hass, hass_client)
Test that it actually adheres to another country like Belgium.
Test that it actually adheres to another country like Belgium.
async def test_belgium_country(aioclient_mock, hass, hass_client): """Test that it actually adheres to another country like Belgium.""" aioclient_mock.get(radar_map_url(country_code="BE"), text="hello world") await async_setup_component( hass, "camera", { "camera": { ...
[ "async", "def", "test_belgium_country", "(", "aioclient_mock", ",", "hass", ",", "hass_client", ")", ":", "aioclient_mock", ".", "get", "(", "radar_map_url", "(", "country_code", "=", "\"BE\"", ")", ",", "text", "=", "\"hello world\"", ")", "await", "async_setup...
[ 115, 0 ]
[ 136, 41 ]
python
en
['en', 'en', 'en']
True
test_failure_response_not_cached
(aioclient_mock, hass, hass_client)
Test that it does not cache a failure response.
Test that it does not cache a failure response.
async def test_failure_response_not_cached(aioclient_mock, hass, hass_client): """Test that it does not cache a failure response.""" aioclient_mock.get(radar_map_url(), text="hello world", status=401) await async_setup_component( hass, "camera", {"camera": {"name": "config_test", "platform": "buien...
[ "async", "def", "test_failure_response_not_cached", "(", "aioclient_mock", ",", "hass", ",", "hass_client", ")", ":", "aioclient_mock", ".", "get", "(", "radar_map_url", "(", ")", ",", "text", "=", "\"hello world\"", ",", "status", "=", "401", ")", "await", "a...
[ 139, 0 ]
[ 153, 41 ]
python
en
['en', 'en', 'en']
True
test_last_modified_updates
(aioclient_mock, hass, hass_client)
Test that it does respect HTTP not modified.
Test that it does respect HTTP not modified.
async def test_last_modified_updates(aioclient_mock, hass, hass_client): """Test that it does respect HTTP not modified.""" # Build Last-Modified header value now = dt_util.utcnow() last_modified = now.strftime("%a, %d %m %Y %H:%M:%S GMT") aioclient_mock.get( radar_map_url(), text="...
[ "async", "def", "test_last_modified_updates", "(", "aioclient_mock", ",", "hass", ",", "hass_client", ")", ":", "# Build Last-Modified header value", "now", "=", "dt_util", ".", "utcnow", "(", ")", "last_modified", "=", "now", ".", "strftime", "(", "\"%a, %d %m %Y %...
[ 156, 0 ]
[ 201, 57 ]
python
en
['en', 'en', 'en']
True
test_retries_after_error
(aioclient_mock, hass, hass_client)
Test that it does retry after an error instead of caching.
Test that it does retry after an error instead of caching.
async def test_retries_after_error(aioclient_mock, hass, hass_client): """Test that it does retry after an error instead of caching.""" await async_setup_component( hass, "camera", {"camera": {"name": "config_test", "platform": "buienradar"}} ) await hass.async_block_till_done() client = aw...
[ "async", "def", "test_retries_after_error", "(", "aioclient_mock", ",", "hass", ",", "hass_client", ")", ":", "await", "async_setup_component", "(", "hass", ",", "\"camera\"", ",", "{", "\"camera\"", ":", "{", "\"name\"", ":", "\"config_test\"", ",", "\"platform\"...
[ 204, 0 ]
[ 235, 47 ]
python
en
['en', 'en', 'en']
True
async_setup
(hass: HomeAssistant, config: dict)
Set up the Raspberry Pi Power Supply Checker component.
Set up the Raspberry Pi Power Supply Checker component.
async def async_setup(hass: HomeAssistant, config: dict): """Set up the Raspberry Pi Power Supply Checker component.""" return True
[ "async", "def", "async_setup", "(", "hass", ":", "HomeAssistant", ",", "config", ":", "dict", ")", ":", "return", "True" ]
[ 5, 0 ]
[ 7, 15 ]
python
en
['en', 'en', 'en']
True
async_setup_entry
(hass: HomeAssistant, entry: ConfigEntry)
Set up Raspberry Pi Power Supply Checker from a config entry.
Set up Raspberry Pi Power Supply Checker from a config entry.
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry): """Set up Raspberry Pi Power Supply Checker from a config entry.""" hass.async_create_task( hass.config_entries.async_forward_entry_setup(entry, "binary_sensor") ) return True
[ "async", "def", "async_setup_entry", "(", "hass", ":", "HomeAssistant", ",", "entry", ":", "ConfigEntry", ")", ":", "hass", ".", "async_create_task", "(", "hass", ".", "config_entries", ".", "async_forward_entry_setup", "(", "entry", ",", "\"binary_sensor\"", ")",...
[ 10, 0 ]
[ 15, 15 ]
python
en
['en', 'en', 'en']
True
async_unload_entry
(hass: HomeAssistant, entry: ConfigEntry)
Unload a config entry.
Unload a config entry.
async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry): """Unload a config entry.""" return await hass.config_entries.async_forward_entry_unload(entry, "binary_sensor")
[ "async", "def", "async_unload_entry", "(", "hass", ":", "HomeAssistant", ",", "entry", ":", "ConfigEntry", ")", ":", "return", "await", "hass", ".", "config_entries", ".", "async_forward_entry_unload", "(", "entry", ",", "\"binary_sensor\"", ")" ]
[ 18, 0 ]
[ 20, 87 ]
python
en
['en', 'es', 'en']
True
hassio_env_fixture
()
Fixture to inject hassio env.
Fixture to inject hassio env.
def hassio_env_fixture(): """Fixture to inject hassio env.""" with patch.dict(os.environ, {"HASSIO": "127.0.0.1"}), patch( "homeassistant.components.hassio.HassIO.is_connected", return_value={"result": "ok", "data": {}}, ), patch.dict(os.environ, {"HASSIO_TOKEN": "123456"}): yield
[ "def", "hassio_env_fixture", "(", ")", ":", "with", "patch", ".", "dict", "(", "os", ".", "environ", ",", "{", "\"HASSIO\"", ":", "\"127.0.0.1\"", "}", ")", ",", "patch", "(", "\"homeassistant.components.hassio.HassIO.is_connected\"", ",", "return_value", "=", "...
[ 34, 0 ]
[ 40, 13 ]
python
en
['en', 'en', 'en']
True
gethostbyaddr_mock
()
Fixture to mock out I/O on getting host by address.
Fixture to mock out I/O on getting host by address.
def gethostbyaddr_mock(): """Fixture to mock out I/O on getting host by address.""" with patch( "homeassistant.components.http.ban.gethostbyaddr", return_value=("example.com", ["0.0.0.0.in-addr.arpa"], ["0.0.0.0"]), ): yield
[ "def", "gethostbyaddr_mock", "(", ")", ":", "with", "patch", "(", "\"homeassistant.components.http.ban.gethostbyaddr\"", ",", "return_value", "=", "(", "\"example.com\"", ",", "[", "\"0.0.0.0.in-addr.arpa\"", "]", ",", "[", "\"0.0.0.0\"", "]", ")", ",", ")", ":", ...
[ 44, 0 ]
[ 50, 13 ]
python
en
['en', 'en', 'en']
True
test_access_from_banned_ip
(hass, aiohttp_client)
Test accessing to server from banned IP. Both trusted and not.
Test accessing to server from banned IP. Both trusted and not.
async def test_access_from_banned_ip(hass, aiohttp_client): """Test accessing to server from banned IP. Both trusted and not.""" app = web.Application() app["hass"] = hass setup_bans(hass, app, 5) set_real_ip = mock_real_ip(app) with patch( "homeassistant.components.http.ban.async_load_...
[ "async", "def", "test_access_from_banned_ip", "(", "hass", ",", "aiohttp_client", ")", ":", "app", "=", "web", ".", "Application", "(", ")", "app", "[", "\"hass\"", "]", "=", "hass", "setup_bans", "(", "hass", ",", "app", ",", "5", ")", "set_real_ip", "=...
[ 53, 0 ]
[ 69, 44 ]
python
en
['en', 'en', 'en']
True
test_access_from_supervisor_ip
( remote_addr, bans, status, hass, aiohttp_client, hassio_env )
Test accessing to server from supervisor IP.
Test accessing to server from supervisor IP.
async def test_access_from_supervisor_ip( remote_addr, bans, status, hass, aiohttp_client, hassio_env ): """Test accessing to server from supervisor IP.""" app = web.Application() app["hass"] = hass async def unauth_handler(request): """Return a mock web response.""" raise HTTPUnaut...
[ "async", "def", "test_access_from_supervisor_ip", "(", "remote_addr", ",", "bans", ",", "status", ",", "hass", ",", "aiohttp_client", ",", "hassio_env", ")", ":", "app", "=", "web", ".", "Application", "(", ")", "app", "[", "\"hass\"", "]", "=", "hass", "a...
[ 80, 0 ]
[ 115, 47 ]
python
en
['en', 'en', 'en']
True
test_ban_middleware_not_loaded_by_config
(hass)
Test accessing to server from banned IP when feature is off.
Test accessing to server from banned IP when feature is off.
async def test_ban_middleware_not_loaded_by_config(hass): """Test accessing to server from banned IP when feature is off.""" with patch("homeassistant.components.http.setup_bans") as mock_setup: await async_setup_component( hass, "http", {"http": {http.CONF_IP_BAN_ENABLED: False}} ) ...
[ "async", "def", "test_ban_middleware_not_loaded_by_config", "(", "hass", ")", ":", "with", "patch", "(", "\"homeassistant.components.http.setup_bans\"", ")", "as", "mock_setup", ":", "await", "async_setup_component", "(", "hass", ",", "\"http\"", ",", "{", "\"http\"", ...
[ 118, 0 ]
[ 125, 42 ]
python
en
['en', 'en', 'en']
True
test_ban_middleware_loaded_by_default
(hass)
Test accessing to server from banned IP when feature is off.
Test accessing to server from banned IP when feature is off.
async def test_ban_middleware_loaded_by_default(hass): """Test accessing to server from banned IP when feature is off.""" with patch("homeassistant.components.http.setup_bans") as mock_setup: await async_setup_component(hass, "http", {"http": {}}) assert len(mock_setup.mock_calls) == 1
[ "async", "def", "test_ban_middleware_loaded_by_default", "(", "hass", ")", ":", "with", "patch", "(", "\"homeassistant.components.http.setup_bans\"", ")", "as", "mock_setup", ":", "await", "async_setup_component", "(", "hass", ",", "\"http\"", ",", "{", "\"http\"", ":...
[ 128, 0 ]
[ 133, 42 ]
python
en
['en', 'en', 'en']
True
test_ip_bans_file_creation
(hass, aiohttp_client)
Testing if banned IP file created.
Testing if banned IP file created.
async def test_ip_bans_file_creation(hass, aiohttp_client): """Testing if banned IP file created.""" notification_calls = async_mock_service(hass, "persistent_notification", "create") app = web.Application() app["hass"] = hass async def unauth_handler(request): """Return a mock web respons...
[ "async", "def", "test_ip_bans_file_creation", "(", "hass", ",", "aiohttp_client", ")", ":", "notification_calls", "=", "async_mock_service", "(", "hass", ",", "\"persistent_notification\"", ",", "\"create\"", ")", "app", "=", "web", ".", "Application", "(", ")", "...
[ 136, 0 ]
[ 178, 9 ]
python
en
['en', 'en', 'en']
True
test_failed_login_attempts_counter
(hass, aiohttp_client)
Testing if failed login attempts counter increased.
Testing if failed login attempts counter increased.
async def test_failed_login_attempts_counter(hass, aiohttp_client): """Testing if failed login attempts counter increased.""" app = web.Application() app["hass"] = hass async def auth_handler(request): """Return 200 status code.""" return None, 200 app.router.add_get( "/aut...
[ "async", "def", "test_failed_login_attempts_counter", "(", "hass", ",", "aiohttp_client", ")", ":", "app", "=", "web", ".", "Application", "(", ")", "app", "[", "\"hass\"", "]", "=", "hass", "async", "def", "auth_handler", "(", "request", ")", ":", "\"\"\"Re...
[ 181, 0 ]
[ 233, 57 ]
python
en
['en', 'en', 'en']
True
test_user_form
(hass)
Test we get the user form.
Test we get the user form.
async def test_user_form(hass): """Test we get the user 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 resu...
[ "async", "def", "test_user_form", "(", "hass", ")", ":", "await", "setup", ".", "async_setup_component", "(", "hass", ",", "\"persistent_notification\"", ",", "{", "}", ")", "result", "=", "await", "hass", ".", "config_entries", ".", "flow", ".", "async_init",...
[ 35, 0 ]
[ 64, 48 ]
python
en
['en', 'da', 'en']
True
test_form_import
(hass)
Test we get the form with import source.
Test we get the form with import source.
async def test_form_import(hass): """Test we get the form with import source.""" await setup.async_setup_component(hass, "persistent_notification", {}) harmonyapi = _get_mock_harmonyapi(connect=True) with patch( "homeassistant.components.harmony.util.HarmonyAPI", return_value=harmonyapi...
[ "async", "def", "test_form_import", "(", "hass", ")", ":", "await", "setup", ".", "async_setup_component", "(", "hass", ",", "\"persistent_notification\"", ",", "{", "}", ")", "harmonyapi", "=", "_get_mock_harmonyapi", "(", "connect", "=", "True", ")", "with", ...
[ 67, 0 ]
[ 107, 48 ]
python
en
['en', 'en', 'en']
True
test_form_ssdp
(hass)
Test we get the form with ssdp source.
Test we get the form with ssdp source.
async def test_form_ssdp(hass): """Test we get the form with ssdp source.""" await setup.async_setup_component(hass, "persistent_notification", {}) harmonyapi = _get_mock_harmonyapi(connect=True) with patch( "homeassistant.components.harmony.util.HarmonyAPI", return_value=harmonyapi, ...
[ "async", "def", "test_form_ssdp", "(", "hass", ")", ":", "await", "setup", ".", "async_setup_component", "(", "hass", ",", "\"persistent_notification\"", ",", "{", "}", ")", "harmonyapi", "=", "_get_mock_harmonyapi", "(", "connect", "=", "True", ")", "with", "...
[ 110, 0 ]
[ 155, 48 ]
python
en
['en', 'en', 'en']
True
test_form_ssdp_aborts_before_checking_remoteid_if_host_known
(hass)
Test we abort without connecting if the host is already known.
Test we abort without connecting if the host is already known.
async def test_form_ssdp_aborts_before_checking_remoteid_if_host_known(hass): """Test we abort without connecting if the host is already known.""" await setup.async_setup_component(hass, "persistent_notification", {}) config_entry = MockConfigEntry( domain=DOMAIN, data={"host": "2.2.2.2", "n...
[ "async", "def", "test_form_ssdp_aborts_before_checking_remoteid_if_host_known", "(", "hass", ")", ":", "await", "setup", ".", "async_setup_component", "(", "hass", ",", "\"persistent_notification\"", ",", "{", "}", ")", "config_entry", "=", "MockConfigEntry", "(", "doma...
[ 158, 0 ]
[ 187, 36 ]
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( "homeassistant.components.harmony.util.HarmonyAPI", side_effect=CannotCon...
[ "async", "def", "test_form_cannot_connect", "(", "hass", ")", ":", "result", "=", "await", "hass", ".", "config_entries", ".", "flow", ".", "async_init", "(", "DOMAIN", ",", "context", "=", "{", "\"source\"", ":", "config_entries", ".", "SOURCE_USER", "}", "...
[ 190, 0 ]
[ 211, 58 ]
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, unique_id="abcde12345", data={CONF_HOST: "1.2.3.4", CONF_NAME: "Guest Room"}, options={"activity": "Watch TV", "delay_secs": 0.5}, ) harmony_client = _get_m...
[ "async", "def", "test_options_flow", "(", "hass", ")", ":", "config_entry", "=", "MockConfigEntry", "(", "domain", "=", "DOMAIN", ",", "unique_id", "=", "\"abcde12345\"", ",", "data", "=", "{", "CONF_HOST", ":", "\"1.2.3.4\"", ",", "CONF_NAME", ":", "\"Guest R...
[ 214, 0 ]
[ 250, 5 ]
python
en
['en', 'fr', 'en']
True
storage_setup
(hass, hass_storage)
Storage setup.
Storage setup.
def storage_setup(hass, hass_storage): """Storage setup.""" async def _storage(items=None, config=None): if items is None: hass_storage[DOMAIN] = { "key": DOMAIN, "version": 1, "data": { "items": [ {...
[ "def", "storage_setup", "(", "hass", ",", "hass_storage", ")", ":", "async", "def", "_storage", "(", "items", "=", "None", ",", "config", "=", "None", ")", ":", "if", "items", "is", "None", ":", "hass_storage", "[", "DOMAIN", "]", "=", "{", "\"key\"", ...
[ 22, 0 ]
[ 54, 19 ]
python
en
['en', 'bs', 'en']
False
test_setup_no_zones_still_adds_home_zone
(hass)
Test if no config is passed in we still get the home zone.
Test if no config is passed in we still get the home zone.
async def test_setup_no_zones_still_adds_home_zone(hass): """Test if no config is passed in we still get the home zone.""" assert await setup.async_setup_component(hass, zone.DOMAIN, {"zone": None}) assert len(hass.states.async_entity_ids("zone")) == 1 state = hass.states.get("zone.home") assert has...
[ "async", "def", "test_setup_no_zones_still_adds_home_zone", "(", "hass", ")", ":", "assert", "await", "setup", ".", "async_setup_component", "(", "hass", ",", "zone", ".", "DOMAIN", ",", "{", "\"zone\"", ":", "None", "}", ")", "assert", "len", "(", "hass", "...
[ 57, 0 ]
[ 65, 53 ]
python
en
['en', 'en', 'en']
True
test_setup
(hass)
Test a successful setup.
Test a successful setup.
async def test_setup(hass): """Test a successful setup.""" info = { "name": "Test Zone", "latitude": 32.880837, "longitude": -117.237561, "radius": 250, "passive": True, } assert await setup.async_setup_component(hass, zone.DOMAIN, {"zone": info}) assert len(...
[ "async", "def", "test_setup", "(", "hass", ")", ":", "info", "=", "{", "\"name\"", ":", "\"Test Zone\"", ",", "\"latitude\"", ":", "32.880837", ",", "\"longitude\"", ":", "-", "117.237561", ",", "\"radius\"", ":", "250", ",", "\"passive\"", ":", "True", ",...
[ 68, 0 ]
[ 85, 57 ]
python
en
['en', 'co', 'en']
True
test_setup_zone_skips_home_zone
(hass)
Test that zone named Home should override hass home zone.
Test that zone named Home should override hass home zone.
async def test_setup_zone_skips_home_zone(hass): """Test that zone named Home should override hass home zone.""" info = {"name": "Home", "latitude": 1.1, "longitude": -2.2} assert await setup.async_setup_component(hass, zone.DOMAIN, {"zone": info}) assert len(hass.states.async_entity_ids("zone")) == 1 ...
[ "async", "def", "test_setup_zone_skips_home_zone", "(", "hass", ")", ":", "info", "=", "{", "\"name\"", ":", "\"Home\"", ",", "\"latitude\"", ":", "1.1", ",", "\"longitude\"", ":", "-", "2.2", "}", "assert", "await", "setup", ".", "async_setup_component", "(",...
[ 88, 0 ]
[ 95, 37 ]
python
en
['en', 'en', 'en']
True
test_setup_name_can_be_same_on_multiple_zones
(hass)
Test that zone named Home should override hass home zone.
Test that zone named Home should override hass home zone.
async def test_setup_name_can_be_same_on_multiple_zones(hass): """Test that zone named Home should override hass home zone.""" info = {"name": "Test Zone", "latitude": 1.1, "longitude": -2.2} assert await setup.async_setup_component(hass, zone.DOMAIN, {"zone": [info, info]}) assert len(hass.states.async...
[ "async", "def", "test_setup_name_can_be_same_on_multiple_zones", "(", "hass", ")", ":", "info", "=", "{", "\"name\"", ":", "\"Test Zone\"", ",", "\"latitude\"", ":", "1.1", ",", "\"longitude\"", ":", "-", "2.2", "}", "assert", "await", "setup", ".", "async_setup...
[ 98, 0 ]
[ 102, 57 ]
python
en
['en', 'en', 'en']
True
test_active_zone_skips_passive_zones
(hass)
Test active and passive zones.
Test active and passive zones.
async def test_active_zone_skips_passive_zones(hass): """Test active and passive zones.""" assert await setup.async_setup_component( hass, zone.DOMAIN, { "zone": [ { "name": "Passive Zone", "latitude": 32.880600, ...
[ "async", "def", "test_active_zone_skips_passive_zones", "(", "hass", ")", ":", "assert", "await", "setup", ".", "async_setup_component", "(", "hass", ",", "zone", ".", "DOMAIN", ",", "{", "\"zone\"", ":", "[", "{", "\"name\"", ":", "\"Passive Zone\"", ",", "\"...
[ 105, 0 ]
[ 124, 25 ]
python
en
['en', 'en', 'en']
True
test_active_zone_skips_passive_zones_2
(hass)
Test active and passive zones.
Test active and passive zones.
async def test_active_zone_skips_passive_zones_2(hass): """Test active and passive zones.""" assert await setup.async_setup_component( hass, zone.DOMAIN, { "zone": [ { "name": "Active Zone", "latitude": 32.880800, ...
[ "async", "def", "test_active_zone_skips_passive_zones_2", "(", "hass", ")", ":", "assert", "await", "setup", ".", "async_setup_component", "(", "hass", ",", "zone", ".", "DOMAIN", ",", "{", "\"zone\"", ":", "[", "{", "\"name\"", ":", "\"Active Zone\"", ",", "\...
[ 127, 0 ]
[ 145, 49 ]
python
en
['en', 'en', 'en']
True
test_active_zone_prefers_smaller_zone_if_same_distance
(hass)
Test zone size preferences.
Test zone size preferences.
async def test_active_zone_prefers_smaller_zone_if_same_distance(hass): """Test zone size preferences.""" latitude = 32.880600 longitude = -117.237561 assert await setup.async_setup_component( hass, zone.DOMAIN, { "zone": [ { "name"...
[ "async", "def", "test_active_zone_prefers_smaller_zone_if_same_distance", "(", "hass", ")", ":", "latitude", "=", "32.880600", "longitude", "=", "-", "117.237561", "assert", "await", "setup", ".", "async_setup_component", "(", "hass", ",", "zone", ".", "DOMAIN", ","...
[ 148, 0 ]
[ 174, 48 ]
python
cs
['pl', 'cs', 'en']
False
test_active_zone_prefers_smaller_zone_if_same_distance_2
(hass)
Test zone size preferences.
Test zone size preferences.
async def test_active_zone_prefers_smaller_zone_if_same_distance_2(hass): """Test zone size preferences.""" latitude = 32.880600 longitude = -117.237561 assert await setup.async_setup_component( hass, zone.DOMAIN, { "zone": [ { "nam...
[ "async", "def", "test_active_zone_prefers_smaller_zone_if_same_distance_2", "(", "hass", ")", ":", "latitude", "=", "32.880600", "longitude", "=", "-", "117.237561", "assert", "await", "setup", ".", "async_setup_component", "(", "hass", ",", "zone", ".", "DOMAIN", "...
[ 177, 0 ]
[ 197, 51 ]
python
cs
['pl', 'cs', 'en']
False
test_in_zone_works_for_passive_zones
(hass)
Test working in passive zones.
Test working in passive zones.
async def test_in_zone_works_for_passive_zones(hass): """Test working in passive zones.""" latitude = 32.880600 longitude = -117.237561 assert await setup.async_setup_component( hass, zone.DOMAIN, { "zone": [ { "name": "Passive Zone...
[ "async", "def", "test_in_zone_works_for_passive_zones", "(", "hass", ")", ":", "latitude", "=", "32.880600", "longitude", "=", "-", "117.237561", "assert", "await", "setup", ".", "async_setup_component", "(", "hass", ",", "zone", ".", "DOMAIN", ",", "{", "\"zone...
[ 200, 0 ]
[ 220, 82 ]
python
nl
['nl', 'nl', 'en']
True
test_core_config_update
(hass)
Test updating core config will update home zone.
Test updating core config will update home zone.
async def test_core_config_update(hass): """Test updating core config will update home zone.""" assert await setup.async_setup_component(hass, "zone", {}) home = hass.states.get("zone.home") await hass.config.async_update( location_name="Updated Name", latitude=10, longitude=20 ) await...
[ "async", "def", "test_core_config_update", "(", "hass", ")", ":", "assert", "await", "setup", ".", "async_setup_component", "(", "hass", ",", "\"zone\"", ",", "{", "}", ")", "home", "=", "hass", ".", "states", ".", "get", "(", "\"zone.home\"", ")", "await"...
[ 223, 0 ]
[ 239, 53 ]
python
en
['en', 'en', 'en']
True
test_reload
(hass, hass_admin_user, hass_read_only_user)
Test reload service.
Test reload service.
async def test_reload(hass, hass_admin_user, hass_read_only_user): """Test reload service.""" count_start = len(hass.states.async_entity_ids()) ent_reg = await entity_registry.async_get_registry(hass) assert await setup.async_setup_component( hass, DOMAIN, { DOMAIN: ...
[ "async", "def", "test_reload", "(", "hass", ",", "hass_admin_user", ",", "hass_read_only_user", ")", ":", "count_start", "=", "len", "(", "hass", ".", "states", ".", "async_entity_ids", "(", ")", ")", "ent_reg", "=", "await", "entity_registry", ".", "async_get...
[ 242, 0 ]
[ 310, 47 ]
python
en
['en', 'da', 'en']
True
test_load_from_storage
(hass, storage_setup)
Test set up from storage.
Test set up from storage.
async def test_load_from_storage(hass, storage_setup): """Test set up from storage.""" assert await storage_setup() state = hass.states.get(f"{DOMAIN}.from_storage") assert state.state == "zoning" assert state.name == "from storage" assert state.attributes.get(ATTR_EDITABLE)
[ "async", "def", "test_load_from_storage", "(", "hass", ",", "storage_setup", ")", ":", "assert", "await", "storage_setup", "(", ")", "state", "=", "hass", ".", "states", ".", "get", "(", "f\"{DOMAIN}.from_storage\"", ")", "assert", "state", ".", "state", "==",...
[ 313, 0 ]
[ 319, 46 ]
python
en
['en', 'en', 'en']
True
test_editable_state_attribute
(hass, storage_setup)
Test editable attribute.
Test editable attribute.
async def test_editable_state_attribute(hass, storage_setup): """Test editable attribute.""" assert await storage_setup( config={DOMAIN: [{"name": "yaml option", "latitude": 3, "longitude": 4}]} ) state = hass.states.get(f"{DOMAIN}.from_storage") assert state.state == "zoning" assert st...
[ "async", "def", "test_editable_state_attribute", "(", "hass", ",", "storage_setup", ")", ":", "assert", "await", "storage_setup", "(", "config", "=", "{", "DOMAIN", ":", "[", "{", "\"name\"", ":", "\"yaml option\"", ",", "\"latitude\"", ":", "3", ",", "\"longi...
[ 322, 0 ]
[ 335, 50 ]
python
de
['de', 'et', 'en']
False
test_ws_list
(hass, hass_ws_client, storage_setup)
Test listing via WS.
Test listing via WS.
async def test_ws_list(hass, hass_ws_client, storage_setup): """Test listing via WS.""" assert await storage_setup( config={DOMAIN: [{"name": "yaml option", "latitude": 3, "longitude": 4}]} ) client = await hass_ws_client(hass) await client.send_json({"id": 6, "type": f"{DOMAIN}/list"}) ...
[ "async", "def", "test_ws_list", "(", "hass", ",", "hass_ws_client", ",", "storage_setup", ")", ":", "assert", "await", "storage_setup", "(", "config", "=", "{", "DOMAIN", ":", "[", "{", "\"name\"", ":", "\"yaml option\"", ",", "\"latitude\"", ":", "3", ",", ...
[ 338, 0 ]
[ 357, 59 ]
python
hmn
['nl', 'hmn', 'it']
False
test_ws_delete
(hass, hass_ws_client, storage_setup)
Test WS delete cleans up entity registry.
Test WS delete cleans up entity registry.
async def test_ws_delete(hass, hass_ws_client, storage_setup): """Test WS delete cleans up entity registry.""" assert await storage_setup() input_id = "from_storage" input_entity_id = f"{DOMAIN}.{input_id}" ent_reg = await entity_registry.async_get_registry(hass) state = hass.states.get(input_...
[ "async", "def", "test_ws_delete", "(", "hass", ",", "hass_ws_client", ",", "storage_setup", ")", ":", "assert", "await", "storage_setup", "(", ")", "input_id", "=", "\"from_storage\"", "input_entity_id", "=", "f\"{DOMAIN}.{input_id}\"", "ent_reg", "=", "await", "ent...
[ 360, 0 ]
[ 382, 72 ]
python
en
['en', 'en', 'en']
True
test_update
(hass, hass_ws_client, storage_setup)
Test updating min/max updates the state.
Test updating min/max updates the state.
async def test_update(hass, hass_ws_client, storage_setup): """Test updating min/max updates the state.""" items = [ { "id": "from_storage", "name": "from storage", "latitude": 1, "longitude": 2, "radius": 3, "passive": False, ...
[ "async", "def", "test_update", "(", "hass", ",", "hass_ws_client", ",", "storage_setup", ")", ":", "items", "=", "[", "{", "\"id\"", ":", "\"from_storage\"", ",", "\"name\"", ":", "\"from storage\"", ",", "\"latitude\"", ":", "1", ",", "\"longitude\"", ":", ...
[ 385, 0 ]
[ 427, 46 ]
python
en
['en', 'en', 'en']
True
test_ws_create
(hass, hass_ws_client, storage_setup)
Test create WS.
Test create WS.
async def test_ws_create(hass, hass_ws_client, storage_setup): """Test create WS.""" assert await storage_setup(items=[]) input_id = "new_input" input_entity_id = f"{DOMAIN}.{input_id}" ent_reg = await entity_registry.async_get_registry(hass) state = hass.states.get(input_entity_id) assert...
[ "async", "def", "test_ws_create", "(", "hass", ",", "hass_ws_client", ",", "storage_setup", ")", ":", "assert", "await", "storage_setup", "(", "items", "=", "[", "]", ")", "input_id", "=", "\"new_input\"", "input_entity_id", "=", "f\"{DOMAIN}.{input_id}\"", "ent_r...
[ 430, 0 ]
[ 461, 46 ]
python
en
['en', 'gd', 'en']
True
test_import_config_entry
(hass)
Test we import config entry and then delete it.
Test we import config entry and then delete it.
async def test_import_config_entry(hass): """Test we import config entry and then delete it.""" entry = MockConfigEntry( domain="zone", data={ "name": "from config entry", "latitude": 1, "longitude": 2, "radius": 3, "passive": False, ...
[ "async", "def", "test_import_config_entry", "(", "hass", ")", ":", "entry", "=", "MockConfigEntry", "(", "domain", "=", "\"zone\"", ",", "data", "=", "{", "\"name\"", ":", "\"from config entry\"", ",", "\"latitude\"", ":", "1", ",", "\"longitude\"", ":", "2", ...
[ 464, 0 ]
[ 488, 65 ]
python
en
['en', 'en', 'en']
True
test_zone_empty_setup
(hass)
Set up zone with empty config.
Set up zone with empty config.
async def test_zone_empty_setup(hass): """Set up zone with empty config.""" assert await setup.async_setup_component(hass, DOMAIN, {"zone": {}})
[ "async", "def", "test_zone_empty_setup", "(", "hass", ")", ":", "assert", "await", "setup", ".", "async_setup_component", "(", "hass", ",", "DOMAIN", ",", "{", "\"zone\"", ":", "{", "}", "}", ")" ]
[ 491, 0 ]
[ 493, 72 ]
python
en
['en', 'en', 'en']
True
test_unavailable_zone
(hass)
Test active zone with unavailable zones.
Test active zone with unavailable zones.
async def test_unavailable_zone(hass): """Test active zone with unavailable zones.""" assert await setup.async_setup_component(hass, DOMAIN, {"zone": {}}) hass.states.async_set("zone.bla", "unavailable", {"restored": True}) assert zone.async_active_zone(hass, 0.0, 0.01) is None assert zone.in_zone...
[ "async", "def", "test_unavailable_zone", "(", "hass", ")", ":", "assert", "await", "setup", ".", "async_setup_component", "(", "hass", ",", "DOMAIN", ",", "{", "\"zone\"", ":", "{", "}", "}", ")", "hass", ".", "states", ".", "async_set", "(", "\"zone.bla\"...
[ 496, 0 ]
[ 503, 67 ]
python
en
['sw', 'en', 'en']
True
setup_platform
(hass, config, add_entities, discovery_info=None)
Set up the BMW sensors.
Set up the BMW sensors.
def setup_platform(hass, config, add_entities, discovery_info=None): """Set up the BMW sensors.""" if hass.config.units.name == CONF_UNIT_SYSTEM_IMPERIAL: attribute_info = ATTR_TO_HA_IMPERIAL else: attribute_info = ATTR_TO_HA_METRIC accounts = hass.data[BMW_DOMAIN] _LOGGER.debug("Fo...
[ "def", "setup_platform", "(", "hass", ",", "config", ",", "add_entities", ",", "discovery_info", "=", "None", ")", ":", "if", "hass", ".", "config", ".", "units", ".", "name", "==", "CONF_UNIT_SYSTEM_IMPERIAL", ":", "attribute_info", "=", "ATTR_TO_HA_IMPERIAL", ...
[ 50, 0 ]
[ 68, 31 ]
python
en
['en', 'bg', 'en']
True
BMWConnectedDriveSensor.__init__
(self, account, vehicle, attribute: str, attribute_info)
Initialize BMW vehicle sensor.
Initialize BMW vehicle sensor.
def __init__(self, account, vehicle, attribute: str, attribute_info): """Initialize BMW vehicle sensor.""" self._vehicle = vehicle self._account = account self._attribute = attribute self._state = None self._name = f"{self._vehicle.name} {self._attribute}" self._u...
[ "def", "__init__", "(", "self", ",", "account", ",", "vehicle", ",", "attribute", ":", "str", ",", "attribute_info", ")", ":", "self", ".", "_vehicle", "=", "vehicle", "self", ".", "_account", "=", "account", "self", ".", "_attribute", "=", "attribute", ...
[ 74, 4 ]
[ 82, 45 ]
python
en
['en', 'zu', 'en']
True
BMWConnectedDriveSensor.should_poll
(self)
Return False. Data update is triggered from BMWConnectedDriveEntity.
Return False.
def should_poll(self) -> bool: """Return False. Data update is triggered from BMWConnectedDriveEntity. """ return False
[ "def", "should_poll", "(", "self", ")", "->", "bool", ":", "return", "False" ]
[ 85, 4 ]
[ 90, 20 ]
python
en
['en', 'ms', 'en']
False
BMWConnectedDriveSensor.unique_id
(self)
Return the unique ID of the sensor.
Return the unique ID of the sensor.
def unique_id(self): """Return the unique ID of the sensor.""" return self._unique_id
[ "def", "unique_id", "(", "self", ")", ":", "return", "self", ".", "_unique_id" ]
[ 93, 4 ]
[ 95, 30 ]
python
en
['en', 'la', 'en']
True
BMWConnectedDriveSensor.name
(self)
Return the name of the sensor.
Return the name of the sensor.
def name(self) -> str: """Return the name of the sensor.""" return self._name
[ "def", "name", "(", "self", ")", "->", "str", ":", "return", "self", ".", "_name" ]
[ 98, 4 ]
[ 100, 25 ]
python
en
['en', 'mi', 'en']
True
BMWConnectedDriveSensor.icon
(self)
Icon to use in the frontend, if any.
Icon to use in the frontend, if any.
def icon(self): """Icon to use in the frontend, if any.""" vehicle_state = self._vehicle.state charging_state = vehicle_state.charging_status in [ChargingState.CHARGING] if self._attribute == "charging_level_hv": return icon_for_battery_level( battery_level=v...
[ "def", "icon", "(", "self", ")", ":", "vehicle_state", "=", "self", ".", "_vehicle", ".", "state", "charging_state", "=", "vehicle_state", ".", "charging_status", "in", "[", "ChargingState", ".", "CHARGING", "]", "if", "self", ".", "_attribute", "==", "\"cha...
[ 103, 4 ]
[ 113, 19 ]
python
en
['en', 'en', 'en']
True