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
KebaBinarySensor.device_state_attributes
(self)
Return the state attributes of the binary sensor.
Return the state attributes of the binary sensor.
def device_state_attributes(self): """Return the state attributes of the binary sensor.""" return self._attributes
[ "def", "device_state_attributes", "(", "self", ")", ":", "return", "self", ".", "_attributes" ]
[ 73, 4 ]
[ 75, 31 ]
python
en
['en', 'en', 'en']
True
KebaBinarySensor.async_update
(self)
Get latest cached states from the device.
Get latest cached states from the device.
async def async_update(self): """Get latest cached states from the device.""" if self._key == "Online": self._is_on = self._keba.get_value(self._key) elif self._key == "Plug": self._is_on = self._keba.get_value("Plug_plugged") self._attributes["plugged_on_wal...
[ "async", "def", "async_update", "(", "self", ")", ":", "if", "self", ".", "_key", "==", "\"Online\"", ":", "self", ".", "_is_on", "=", "self", ".", "_keba", ".", "get_value", "(", "self", ".", "_key", ")", "elif", "self", ".", "_key", "==", "\"Plug\"...
[ 77, 4 ]
[ 102, 62 ]
python
en
['en', 'en', 'en']
True
KebaBinarySensor.update_callback
(self)
Schedule a state update.
Schedule a state update.
def update_callback(self): """Schedule a state update.""" self.async_schedule_update_ha_state(True)
[ "def", "update_callback", "(", "self", ")", ":", "self", ".", "async_schedule_update_ha_state", "(", "True", ")" ]
[ 104, 4 ]
[ 106, 49 ]
python
en
['en', 'co', 'en']
True
KebaBinarySensor.async_added_to_hass
(self)
Add update callback after being added to hass.
Add update callback after being added to hass.
async def async_added_to_hass(self): """Add update callback after being added to hass.""" self._keba.add_update_listener(self.update_callback)
[ "async", "def", "async_added_to_hass", "(", "self", ")", ":", "self", ".", "_keba", ".", "add_update_listener", "(", "self", ".", "update_callback", ")" ]
[ 108, 4 ]
[ 110, 60 ]
python
en
['en', 'en', 'en']
True
test_platform_manually_configured
(hass)
Test that nothing happens when configuring unifi through device tracker platform.
Test that nothing happens when configuring unifi through device tracker platform.
async def test_platform_manually_configured(hass): """Test that nothing happens when configuring unifi through device tracker platform.""" assert ( await async_setup_component( hass, TRACKER_DOMAIN, {TRACKER_DOMAIN: {"platform": UNIFI_DOMAIN}} ) is False ) assert UNIF...
[ "async", "def", "test_platform_manually_configured", "(", "hass", ")", ":", "assert", "(", "await", "async_setup_component", "(", "hass", ",", "TRACKER_DOMAIN", ",", "{", "TRACKER_DOMAIN", ":", "{", "\"platform\"", ":", "UNIFI_DOMAIN", "}", "}", ")", "is", "Fals...
[ 152, 0 ]
[ 160, 40 ]
python
en
['en', 'en', 'en']
True
test_no_clients
(hass)
Test the update_clients function when no clients are found.
Test the update_clients function when no clients are found.
async def test_no_clients(hass): """Test the update_clients function when no clients are found.""" await setup_unifi_integration(hass) assert len(hass.states.async_entity_ids(TRACKER_DOMAIN)) == 0
[ "async", "def", "test_no_clients", "(", "hass", ")", ":", "await", "setup_unifi_integration", "(", "hass", ")", "assert", "len", "(", "hass", ".", "states", ".", "async_entity_ids", "(", "TRACKER_DOMAIN", ")", ")", "==", "0" ]
[ 163, 0 ]
[ 167, 65 ]
python
en
['en', 'en', 'en']
True
test_tracked_wireless_clients
(hass)
Test the update_items function with some clients.
Test the update_items function with some clients.
async def test_tracked_wireless_clients(hass): """Test the update_items function with some clients.""" controller = await setup_unifi_integration(hass, clients_response=[CLIENT_1]) assert len(hass.states.async_entity_ids(TRACKER_DOMAIN)) == 1 client_1 = hass.states.get("device_tracker.client_1") as...
[ "async", "def", "test_tracked_wireless_clients", "(", "hass", ")", ":", "controller", "=", "await", "setup_unifi_integration", "(", "hass", ",", "clients_response", "=", "[", "CLIENT_1", "]", ")", "assert", "len", "(", "hass", ".", "states", ".", "async_entity_i...
[ 170, 0 ]
[ 216, 35 ]
python
en
['en', 'en', 'en']
True
test_tracked_clients
(hass)
Test the update_items function with some clients.
Test the update_items function with some clients.
async def test_tracked_clients(hass): """Test the update_items function with some clients.""" client_4_copy = copy(CLIENT_4) client_4_copy["last_seen"] = dt_util.as_timestamp(dt_util.utcnow()) controller = await setup_unifi_integration( hass, options={CONF_SSID_FILTER: ["ssid"]}, ...
[ "async", "def", "test_tracked_clients", "(", "hass", ")", ":", "client_4_copy", "=", "copy", "(", "CLIENT_4", ")", "client_4_copy", "[", "\"last_seen\"", "]", "=", "dt_util", ".", "as_timestamp", "(", "dt_util", ".", "utcnow", "(", ")", ")", "controller", "=...
[ 219, 0 ]
[ 261, 35 ]
python
en
['en', 'en', 'en']
True
test_tracked_devices
(hass)
Test the update_items function with some devices.
Test the update_items function with some devices.
async def test_tracked_devices(hass): """Test the update_items function with some devices.""" controller = await setup_unifi_integration( hass, devices_response=[DEVICE_1, DEVICE_2], ) assert len(hass.states.async_entity_ids(TRACKER_DOMAIN)) == 2 device_1 = hass.states.get("device_t...
[ "async", "def", "test_tracked_devices", "(", "hass", ")", ":", "controller", "=", "await", "setup_unifi_integration", "(", "hass", ",", "devices_response", "=", "[", "DEVICE_1", ",", "DEVICE_2", "]", ",", ")", "assert", "len", "(", "hass", ".", "states", "."...
[ 264, 0 ]
[ 328, 69 ]
python
en
['en', 'en', 'en']
True
test_remove_clients
(hass)
Test the remove_items function with some clients.
Test the remove_items function with some clients.
async def test_remove_clients(hass): """Test the remove_items function with some clients.""" controller = await setup_unifi_integration( hass, clients_response=[CLIENT_1, CLIENT_2] ) assert len(hass.states.async_entity_ids(TRACKER_DOMAIN)) == 2 client_1 = hass.states.get("device_tracker.cli...
[ "async", "def", "test_remove_clients", "(", "hass", ")", ":", "controller", "=", "await", "setup_unifi_integration", "(", "hass", ",", "clients_response", "=", "[", "CLIENT_1", ",", "CLIENT_2", "]", ")", "assert", "len", "(", "hass", ".", "states", ".", "asy...
[ 331, 0 ]
[ 357, 35 ]
python
en
['en', 'en', 'en']
True
test_controller_state_change
(hass)
Verify entities state reflect on controller becoming unavailable.
Verify entities state reflect on controller becoming unavailable.
async def test_controller_state_change(hass): """Verify entities state reflect on controller becoming unavailable.""" controller = await setup_unifi_integration( hass, clients_response=[CLIENT_1], devices_response=[DEVICE_1], ) assert len(hass.states.async_entity_ids(TRACKER_DOMA...
[ "async", "def", "test_controller_state_change", "(", "hass", ")", ":", "controller", "=", "await", "setup_unifi_integration", "(", "hass", ",", "clients_response", "=", "[", "CLIENT_1", "]", ",", "devices_response", "=", "[", "DEVICE_1", "]", ",", ")", "assert",...
[ 360, 0 ]
[ 389, 35 ]
python
en
['en', 'en', 'en']
True
test_option_track_clients
(hass)
Test the tracking of clients can be turned off.
Test the tracking of clients can be turned off.
async def test_option_track_clients(hass): """Test the tracking of clients can be turned off.""" controller = await setup_unifi_integration( hass, clients_response=[CLIENT_1, CLIENT_2], devices_response=[DEVICE_1], ) assert len(hass.states.async_entity_ids(TRACKER_DOMAIN)) == 3 ...
[ "async", "def", "test_option_track_clients", "(", "hass", ")", ":", "controller", "=", "await", "setup_unifi_integration", "(", "hass", ",", "clients_response", "=", "[", "CLIENT_1", ",", "CLIENT_2", "]", ",", "devices_response", "=", "[", "DEVICE_1", "]", ",", ...
[ 392, 0 ]
[ 438, 31 ]
python
en
['en', 'en', 'en']
True
test_option_track_wired_clients
(hass)
Test the tracking of wired clients can be turned off.
Test the tracking of wired clients can be turned off.
async def test_option_track_wired_clients(hass): """Test the tracking of wired clients can be turned off.""" controller = await setup_unifi_integration( hass, clients_response=[CLIENT_1, CLIENT_2], devices_response=[DEVICE_1], ) assert len(hass.states.async_entity_ids(TRACKER_DOM...
[ "async", "def", "test_option_track_wired_clients", "(", "hass", ")", ":", "controller", "=", "await", "setup_unifi_integration", "(", "hass", ",", "clients_response", "=", "[", "CLIENT_1", ",", "CLIENT_2", "]", ",", "devices_response", "=", "[", "DEVICE_1", "]", ...
[ 441, 0 ]
[ 487, 31 ]
python
en
['en', 'en', 'en']
True
test_option_track_devices
(hass)
Test the tracking of devices can be turned off.
Test the tracking of devices can be turned off.
async def test_option_track_devices(hass): """Test the tracking of devices can be turned off.""" controller = await setup_unifi_integration( hass, clients_response=[CLIENT_1, CLIENT_2], devices_response=[DEVICE_1], ) assert len(hass.states.async_entity_ids(TRACKER_DOMAIN)) == 3 ...
[ "async", "def", "test_option_track_devices", "(", "hass", ")", ":", "controller", "=", "await", "setup_unifi_integration", "(", "hass", ",", "clients_response", "=", "[", "CLIENT_1", ",", "CLIENT_2", "]", ",", "devices_response", "=", "[", "DEVICE_1", "]", ",", ...
[ 490, 0 ]
[ 536, 31 ]
python
en
['en', 'en', 'en']
True
test_option_ssid_filter
(hass)
Test the SSID filter works. Client 1 will travel from a supported SSID to an unsupported ssid. Client 3 will be removed on change of options since it is in an unsupported SSID.
Test the SSID filter works.
async def test_option_ssid_filter(hass): """Test the SSID filter works. Client 1 will travel from a supported SSID to an unsupported ssid. Client 3 will be removed on change of options since it is in an unsupported SSID. """ client_1_copy = copy(CLIENT_1) client_1_copy["last_seen"] = dt_util.as...
[ "async", "def", "test_option_ssid_filter", "(", "hass", ")", ":", "client_1_copy", "=", "copy", "(", "CLIENT_1", ")", "client_1_copy", "[", "\"last_seen\"", "]", "=", "dt_util", ".", "as_timestamp", "(", "dt_util", ".", "utcnow", "(", ")", ")", "controller", ...
[ 539, 0 ]
[ 628, 39 ]
python
en
['en', 'en', 'en']
True
test_wireless_client_go_wired_issue
(hass)
Test the solution to catch wireless device go wired UniFi issue. UniFi has a known issue that when a wireless device goes away it sometimes gets marked as wired.
Test the solution to catch wireless device go wired UniFi issue.
async def test_wireless_client_go_wired_issue(hass): """Test the solution to catch wireless device go wired UniFi issue. UniFi has a known issue that when a wireless device goes away it sometimes gets marked as wired. """ client_1_client = copy(CLIENT_1) client_1_client["last_seen"] = dt_util.as_ti...
[ "async", "def", "test_wireless_client_go_wired_issue", "(", "hass", ")", ":", "client_1_client", "=", "copy", "(", "CLIENT_1", ")", "client_1_client", "[", "\"last_seen\"", "]", "=", "dt_util", ".", "as_timestamp", "(", "dt_util", ".", "utcnow", "(", ")", ")", ...
[ 631, 0 ]
[ 687, 51 ]
python
en
['en', 'en', 'en']
True
test_option_ignore_wired_bug
(hass)
Test option to ignore wired bug.
Test option to ignore wired bug.
async def test_option_ignore_wired_bug(hass): """Test option to ignore wired bug.""" client_1_client = copy(CLIENT_1) client_1_client["last_seen"] = dt_util.as_timestamp(dt_util.utcnow()) controller = await setup_unifi_integration( hass, options={CONF_IGNORE_WIRED_BUG: True}, clients_response=[...
[ "async", "def", "test_option_ignore_wired_bug", "(", "hass", ")", ":", "client_1_client", "=", "copy", "(", "CLIENT_1", ")", "client_1_client", "[", "\"last_seen\"", "]", "=", "dt_util", ".", "as_timestamp", "(", "dt_util", ".", "utcnow", "(", ")", ")", "contr...
[ 690, 0 ]
[ 745, 51 ]
python
en
['en', 'en', 'en']
True
test_restoring_client
(hass)
Test the update_items function with some clients.
Test the update_items function with some clients.
async def test_restoring_client(hass): """Test the update_items function with some clients.""" config_entry = config_entries.ConfigEntry( version=1, domain=UNIFI_DOMAIN, title="Mock Title", data=ENTRY_CONFIG, source="test", connection_class=config_entries.CONN_CLA...
[ "async", "def", "test_restoring_client", "(", "hass", ")", ":", "config_entry", "=", "config_entries", ".", "ConfigEntry", "(", "version", "=", "1", ",", "domain", "=", "UNIFI_DOMAIN", ",", "title", "=", "\"Mock Title\"", ",", "data", "=", "ENTRY_CONFIG", ",",...
[ 748, 0 ]
[ 787, 31 ]
python
en
['en', 'en', 'en']
True
test_dont_track_clients
(hass)
Test don't track clients config works.
Test don't track clients config works.
async def test_dont_track_clients(hass): """Test don't track clients config works.""" controller = await setup_unifi_integration( hass, options={CONF_TRACK_CLIENTS: False}, clients_response=[CLIENT_1], devices_response=[DEVICE_1], ) assert len(hass.states.async_entity_ids...
[ "async", "def", "test_dont_track_clients", "(", "hass", ")", ":", "controller", "=", "await", "setup_unifi_integration", "(", "hass", ",", "options", "=", "{", "CONF_TRACK_CLIENTS", ":", "False", "}", ",", "clients_response", "=", "[", "CLIENT_1", "]", ",", "d...
[ 790, 0 ]
[ 818, 31 ]
python
en
['nl', 'en', 'en']
True
test_dont_track_devices
(hass)
Test don't track devices config works.
Test don't track devices config works.
async def test_dont_track_devices(hass): """Test don't track devices config works.""" controller = await setup_unifi_integration( hass, options={CONF_TRACK_DEVICES: False}, clients_response=[CLIENT_1], devices_response=[DEVICE_1], ) assert len(hass.states.async_entity_ids...
[ "async", "def", "test_dont_track_devices", "(", "hass", ")", ":", "controller", "=", "await", "setup_unifi_integration", "(", "hass", ",", "options", "=", "{", "CONF_TRACK_DEVICES", ":", "False", "}", ",", "clients_response", "=", "[", "CLIENT_1", "]", ",", "d...
[ 821, 0 ]
[ 849, 31 ]
python
en
['nl', 'en', 'en']
True
test_dont_track_wired_clients
(hass)
Test don't track wired clients config works.
Test don't track wired clients config works.
async def test_dont_track_wired_clients(hass): """Test don't track wired clients config works.""" controller = await setup_unifi_integration( hass, options={CONF_TRACK_WIRED_CLIENTS: False}, clients_response=[CLIENT_1, CLIENT_2], ) assert len(hass.states.async_entity_ids(TRACKER_...
[ "async", "def", "test_dont_track_wired_clients", "(", "hass", ")", ":", "controller", "=", "await", "setup_unifi_integration", "(", "hass", ",", "options", "=", "{", "CONF_TRACK_WIRED_CLIENTS", ":", "False", "}", ",", "clients_response", "=", "[", "CLIENT_1", ",",...
[ 852, 0 ]
[ 879, 31 ]
python
en
['en', 'en', 'en']
True
async_setup
(hass, base_config)
Set up the Supla component.
Set up the Supla component.
async def async_setup(hass, base_config): """Set up the Supla component.""" server_confs = base_config[DOMAIN][CONF_SERVERS] hass.data[DOMAIN] = {SUPLA_SERVERS: {}, SUPLA_COORDINATORS: {}} session = async_get_clientsession(hass) for server_conf in server_confs: server_address = server_c...
[ "async", "def", "async_setup", "(", "hass", ",", "base_config", ")", ":", "server_confs", "=", "base_config", "[", "DOMAIN", "]", "[", "CONF_SERVERS", "]", "hass", ".", "data", "[", "DOMAIN", "]", "=", "{", "SUPLA_SERVERS", ":", "{", "}", ",", "SUPLA_COO...
[ 52, 0 ]
[ 88, 15 ]
python
en
['en', 'en', 'en']
True
discover_devices
(hass, hass_config)
Run periodically to discover new devices. Currently it is only run at startup.
Run periodically to discover new devices.
async def discover_devices(hass, hass_config): """ Run periodically to discover new devices. Currently it is only run at startup. """ component_configs = {} for server_name, server in hass.data[DOMAIN][SUPLA_SERVERS].items(): async def _fetch_channels(): async with async_t...
[ "async", "def", "discover_devices", "(", "hass", ",", "hass_config", ")", ":", "component_configs", "=", "{", "}", "for", "server_name", ",", "server", "in", "hass", ".", "data", "[", "DOMAIN", "]", "[", "SUPLA_SERVERS", "]", ".", "items", "(", ")", ":",...
[ 91, 0 ]
[ 155, 84 ]
python
en
['en', 'error', 'th']
False
SuplaChannel.__init__
(self, config, server, coordinator)
Init from config, hookup[ server and coordinator.
Init from config, hookup[ server and coordinator.
def __init__(self, config, server, coordinator): """Init from config, hookup[ server and coordinator.""" super().__init__(coordinator) self.server_name = config["server_name"] self.channel_id = config["channel_id"] self.server = server
[ "def", "__init__", "(", "self", ",", "config", ",", "server", ",", "coordinator", ")", ":", "super", "(", ")", ".", "__init__", "(", "coordinator", ")", "self", ".", "server_name", "=", "config", "[", "\"server_name\"", "]", "self", ".", "channel_id", "=...
[ 161, 4 ]
[ 166, 28 ]
python
en
['en', 'en', 'en']
True
SuplaChannel.channel_data
(self)
Return channel data taken from coordinator.
Return channel data taken from coordinator.
def channel_data(self): """Return channel data taken from coordinator.""" return self.coordinator.data.get(self.channel_id)
[ "def", "channel_data", "(", "self", ")", ":", "return", "self", ".", "coordinator", ".", "data", ".", "get", "(", "self", ".", "channel_id", ")" ]
[ 169, 4 ]
[ 171, 57 ]
python
en
['en', 'de', 'en']
True
SuplaChannel.unique_id
(self)
Return a unique ID.
Return a unique ID.
def unique_id(self) -> str: """Return a unique ID.""" return "supla-{}-{}".format( self.channel_data["iodevice"]["gUIDString"].lower(), self.channel_data["channelNumber"], )
[ "def", "unique_id", "(", "self", ")", "->", "str", ":", "return", "\"supla-{}-{}\"", ".", "format", "(", "self", ".", "channel_data", "[", "\"iodevice\"", "]", "[", "\"gUIDString\"", "]", ".", "lower", "(", ")", ",", "self", ".", "channel_data", "[", "\"...
[ 174, 4 ]
[ 179, 9 ]
python
ca
['fr', 'ca', 'en']
False
SuplaChannel.name
(self)
Return the name of the device.
Return the name of the device.
def name(self) -> Optional[str]: """Return the name of the device.""" return self.channel_data["caption"]
[ "def", "name", "(", "self", ")", "->", "Optional", "[", "str", "]", ":", "return", "self", ".", "channel_data", "[", "\"caption\"", "]" ]
[ 182, 4 ]
[ 184, 43 ]
python
en
['en', 'en', 'en']
True
SuplaChannel.available
(self)
Return True if entity is available.
Return True if entity is available.
def available(self) -> bool: """Return True if entity is available.""" if self.channel_data is None: return False state = self.channel_data.get("state") if state is None: return False return state.get("connected")
[ "def", "available", "(", "self", ")", "->", "bool", ":", "if", "self", ".", "channel_data", "is", "None", ":", "return", "False", "state", "=", "self", ".", "channel_data", ".", "get", "(", "\"state\"", ")", "if", "state", "is", "None", ":", "return", ...
[ 187, 4 ]
[ 194, 37 ]
python
en
['en', 'en', 'en']
True
SuplaChannel.async_action
(self, action, **add_pars)
Run server action. Actions are currently hardcoded in components. Supla's API enables autodiscovery
Run server action.
async def async_action(self, action, **add_pars): """ Run server action. Actions are currently hardcoded in components. Supla's API enables autodiscovery """ _LOGGER.debug( "Executing action %s on channel %d, params: %s", action, self....
[ "async", "def", "async_action", "(", "self", ",", "action", ",", "*", "*", "add_pars", ")", ":", "_LOGGER", ".", "debug", "(", "\"Executing action %s on channel %d, params: %s\"", ",", "action", ",", "self", ".", "channel_data", "[", "\"id\"", "]", ",", "add_p...
[ 196, 4 ]
[ 212, 54 ]
python
en
['en', 'error', 'th']
False
async_setup_entry
(hass, config_entry, async_add_entities)
Set up August cameras.
Set up August cameras.
async def async_setup_entry(hass, config_entry, async_add_entities): """Set up August cameras.""" data = hass.data[DOMAIN][config_entry.entry_id][DATA_AUGUST] devices = [] for doorbell in data.doorbells: devices.append(AugustCamera(data, doorbell, DEFAULT_TIMEOUT)) async_add_entities(devic...
[ "async", "def", "async_setup_entry", "(", "hass", ",", "config_entry", ",", "async_add_entities", ")", ":", "data", "=", "hass", ".", "data", "[", "DOMAIN", "]", "[", "config_entry", ".", "entry_id", "]", "[", "DATA_AUGUST", "]", "devices", "=", "[", "]", ...
[ 13, 0 ]
[ 21, 37 ]
python
en
['en', 'en', 'en']
True
AugustCamera.__init__
(self, data, device, timeout)
Initialize a August security camera.
Initialize a August security camera.
def __init__(self, data, device, timeout): """Initialize a August security camera.""" super().__init__(data, device) self._data = data self._device = device self._timeout = timeout self._image_url = None self._image_content = None
[ "def", "__init__", "(", "self", ",", "data", ",", "device", ",", "timeout", ")", ":", "super", "(", ")", ".", "__init__", "(", "data", ",", "device", ")", "self", ".", "_data", "=", "data", "self", ".", "_device", "=", "device", "self", ".", "_time...
[ 27, 4 ]
[ 34, 34 ]
python
en
['en', 'en', 'en']
True
AugustCamera.name
(self)
Return the name of this device.
Return the name of this device.
def name(self): """Return the name of this device.""" return f"{self._device.device_name} Camera"
[ "def", "name", "(", "self", ")", ":", "return", "f\"{self._device.device_name} Camera\"" ]
[ 37, 4 ]
[ 39, 51 ]
python
en
['en', 'en', 'en']
True
AugustCamera.is_recording
(self)
Return true if the device is recording.
Return true if the device is recording.
def is_recording(self): """Return true if the device is recording.""" return self._device.has_subscription
[ "def", "is_recording", "(", "self", ")", ":", "return", "self", ".", "_device", ".", "has_subscription" ]
[ 42, 4 ]
[ 44, 44 ]
python
en
['en', 'en', 'en']
True
AugustCamera.motion_detection_enabled
(self)
Return the camera motion detection status.
Return the camera motion detection status.
def motion_detection_enabled(self): """Return the camera motion detection status.""" return True
[ "def", "motion_detection_enabled", "(", "self", ")", ":", "return", "True" ]
[ 47, 4 ]
[ 49, 19 ]
python
en
['en', 'en', 'en']
True
AugustCamera.brand
(self)
Return the camera brand.
Return the camera brand.
def brand(self): """Return the camera brand.""" return DEFAULT_NAME
[ "def", "brand", "(", "self", ")", ":", "return", "DEFAULT_NAME" ]
[ 52, 4 ]
[ 54, 27 ]
python
en
['en', 'bs', 'en']
True
AugustCamera.model
(self)
Return the camera model.
Return the camera model.
def model(self): """Return the camera model.""" return self._detail.model
[ "def", "model", "(", "self", ")", ":", "return", "self", ".", "_detail", ".", "model" ]
[ 57, 4 ]
[ 59, 33 ]
python
en
['en', 'co', 'en']
True
AugustCamera._update_from_data
(self)
Get the latest state of the sensor.
Get the latest state of the sensor.
def _update_from_data(self): """Get the latest state of the sensor.""" doorbell_activity = self._data.activity_stream.get_latest_device_activity( self._device_id, [ActivityType.DOORBELL_MOTION] ) if doorbell_activity is not None: update_doorbell_image_from_activi...
[ "def", "_update_from_data", "(", "self", ")", ":", "doorbell_activity", "=", "self", ".", "_data", ".", "activity_stream", ".", "get_latest_device_activity", "(", "self", ".", "_device_id", ",", "[", "ActivityType", ".", "DOORBELL_MOTION", "]", ")", "if", "doorb...
[ 62, 4 ]
[ 69, 80 ]
python
en
['en', 'en', 'en']
True
AugustCamera.async_camera_image
(self)
Return bytes of camera image.
Return bytes of camera image.
async def async_camera_image(self): """Return bytes of camera image.""" self._update_from_data() if self._image_url is not self._detail.image_url: self._image_url = self._detail.image_url self._image_content = await self._detail.async_get_doorbell_image( ...
[ "async", "def", "async_camera_image", "(", "self", ")", ":", "self", ".", "_update_from_data", "(", ")", "if", "self", ".", "_image_url", "is", "not", "self", ".", "_detail", ".", "image_url", ":", "self", ".", "_image_url", "=", "self", ".", "_detail", ...
[ 71, 4 ]
[ 80, 34 ]
python
en
['en', 'zu', 'en']
True
AugustCamera.unique_id
(self)
Get the unique id of the camera.
Get the unique id of the camera.
def unique_id(self) -> str: """Get the unique id of the camera.""" return f"{self._device_id:s}_camera"
[ "def", "unique_id", "(", "self", ")", "->", "str", ":", "return", "f\"{self._device_id:s}_camera\"" ]
[ 83, 4 ]
[ 85, 44 ]
python
en
['en', 'en', 'en']
True
session
(hass)
Return aioclient session.
Return aioclient session.
async def session(hass): """Return aioclient session.""" return hass.helpers.aiohttp_client.async_get_clientsession()
[ "async", "def", "session", "(", "hass", ")", ":", "return", "hass", ".", "helpers", ".", "aiohttp_client", ".", "async_get_clientsession", "(", ")" ]
[ 26, 0 ]
[ 28, 64 ]
python
en
['en', 'fr', 'en']
True
raising_session
(loop)
Return an aioclient session that only fails.
Return an aioclient session that only fails.
async def raising_session(loop): """Return an aioclient session that only fails.""" return Mock(get=Mock(side_effect=aiohttp.ClientError))
[ "async", "def", "raising_session", "(", "loop", ")", ":", "return", "Mock", "(", "get", "=", "Mock", "(", "side_effect", "=", "aiohttp", ".", "ClientError", ")", ")" ]
[ 32, 0 ]
[ 34, 58 ]
python
en
['en', 'en', 'en']
True
test_get_distance_to_same_place
()
Test getting the distance.
Test getting the distance.
def test_get_distance_to_same_place(): """Test getting the distance.""" meters = location_util.distance( COORDINATES_PARIS[0], COORDINATES_PARIS[1], COORDINATES_PARIS[0], COORDINATES_PARIS[1], ) assert meters == 0
[ "def", "test_get_distance_to_same_place", "(", ")", ":", "meters", "=", "location_util", ".", "distance", "(", "COORDINATES_PARIS", "[", "0", "]", ",", "COORDINATES_PARIS", "[", "1", "]", ",", "COORDINATES_PARIS", "[", "0", "]", ",", "COORDINATES_PARIS", "[", ...
[ 37, 0 ]
[ 46, 22 ]
python
en
['en', 'en', 'en']
True
test_get_distance
()
Test getting the distance.
Test getting the distance.
def test_get_distance(): """Test getting the distance.""" meters = location_util.distance( COORDINATES_PARIS[0], COORDINATES_PARIS[1], COORDINATES_NEW_YORK[0], COORDINATES_NEW_YORK[1], ) assert meters / 1000 - DISTANCE_KM < 0.01
[ "def", "test_get_distance", "(", ")", ":", "meters", "=", "location_util", ".", "distance", "(", "COORDINATES_PARIS", "[", "0", "]", ",", "COORDINATES_PARIS", "[", "1", "]", ",", "COORDINATES_NEW_YORK", "[", "0", "]", ",", "COORDINATES_NEW_YORK", "[", "1", "...
[ 49, 0 ]
[ 58, 45 ]
python
en
['en', 'en', 'en']
True
test_get_kilometers
()
Test getting the distance between given coordinates in km.
Test getting the distance between given coordinates in km.
def test_get_kilometers(): """Test getting the distance between given coordinates in km.""" kilometers = location_util.vincenty(COORDINATES_PARIS, COORDINATES_NEW_YORK) assert round(kilometers, 2) == DISTANCE_KM
[ "def", "test_get_kilometers", "(", ")", ":", "kilometers", "=", "location_util", ".", "vincenty", "(", "COORDINATES_PARIS", ",", "COORDINATES_NEW_YORK", ")", "assert", "round", "(", "kilometers", ",", "2", ")", "==", "DISTANCE_KM" ]
[ 61, 0 ]
[ 64, 46 ]
python
en
['en', 'en', 'en']
True
test_get_miles
()
Test getting the distance between given coordinates in miles.
Test getting the distance between given coordinates in miles.
def test_get_miles(): """Test getting the distance between given coordinates in miles.""" miles = location_util.vincenty(COORDINATES_PARIS, COORDINATES_NEW_YORK, miles=True) assert round(miles, 2) == DISTANCE_MILES
[ "def", "test_get_miles", "(", ")", ":", "miles", "=", "location_util", ".", "vincenty", "(", "COORDINATES_PARIS", ",", "COORDINATES_NEW_YORK", ",", "miles", "=", "True", ")", "assert", "round", "(", "miles", ",", "2", ")", "==", "DISTANCE_MILES" ]
[ 67, 0 ]
[ 70, 44 ]
python
en
['en', 'en', 'en']
True
test_detect_location_info_ipapi
(aioclient_mock, session)
Test detect location info using ipapi.co.
Test detect location info using ipapi.co.
async def test_detect_location_info_ipapi(aioclient_mock, session): """Test detect location info using ipapi.co.""" aioclient_mock.get(location_util.IPAPI, text=load_fixture("ipapi.co.json")) info = await location_util.async_detect_location_info(session, _test_real=True) assert info is not None as...
[ "async", "def", "test_detect_location_info_ipapi", "(", "aioclient_mock", ",", "session", ")", ":", "aioclient_mock", ".", "get", "(", "location_util", ".", "IPAPI", ",", "text", "=", "load_fixture", "(", "\"ipapi.co.json\"", ")", ")", "info", "=", "await", "loc...
[ 73, 0 ]
[ 90, 26 ]
python
en
['da', 'en', 'en']
True
test_detect_location_info_ipapi_exhaust
(aioclient_mock, session)
Test detect location info using ipapi.co.
Test detect location info using ipapi.co.
async def test_detect_location_info_ipapi_exhaust(aioclient_mock, session): """Test detect location info using ipapi.co.""" aioclient_mock.get(location_util.IPAPI, json={"latitude": "Sign up to access"}) aioclient_mock.get(location_util.IP_API, text=load_fixture("ip-api.com.json")) info = await locatio...
[ "async", "def", "test_detect_location_info_ipapi_exhaust", "(", "aioclient_mock", ",", "session", ")", ":", "aioclient_mock", ".", "get", "(", "location_util", ".", "IPAPI", ",", "json", "=", "{", "\"latitude\"", ":", "\"Sign up to access\"", "}", ")", "aioclient_mo...
[ 93, 0 ]
[ 103, 46 ]
python
en
['da', 'en', 'en']
True
test_detect_location_info_ip_api
(aioclient_mock, session)
Test detect location info using ip-api.com.
Test detect location info using ip-api.com.
async def test_detect_location_info_ip_api(aioclient_mock, session): """Test detect location info using ip-api.com.""" aioclient_mock.get(location_util.IP_API, text=load_fixture("ip-api.com.json")) with patch("homeassistant.util.location._get_ipapi", return_value=None): info = await location_util.a...
[ "async", "def", "test_detect_location_info_ip_api", "(", "aioclient_mock", ",", "session", ")", ":", "aioclient_mock", ".", "get", "(", "location_util", ".", "IP_API", ",", "text", "=", "load_fixture", "(", "\"ip-api.com.json\"", ")", ")", "with", "patch", "(", ...
[ 106, 0 ]
[ 124, 30 ]
python
da
['da', 'pt', 'en']
False
test_detect_location_info_both_queries_fail
(session)
Ensure we return None if both queries fail.
Ensure we return None if both queries fail.
async def test_detect_location_info_both_queries_fail(session): """Ensure we return None if both queries fail.""" with patch("homeassistant.util.location._get_ipapi", return_value=None), patch( "homeassistant.util.location._get_ip_api", return_value=None ): info = await location_util.async_d...
[ "async", "def", "test_detect_location_info_both_queries_fail", "(", "session", ")", ":", "with", "patch", "(", "\"homeassistant.util.location._get_ipapi\"", ",", "return_value", "=", "None", ")", ",", "patch", "(", "\"homeassistant.util.location._get_ip_api\"", ",", "return...
[ 127, 0 ]
[ 133, 23 ]
python
en
['fr', 'gd', 'en']
False
test_freegeoip_query_raises
(raising_session)
Test ipapi.co query when the request to API fails.
Test ipapi.co query when the request to API fails.
async def test_freegeoip_query_raises(raising_session): """Test ipapi.co query when the request to API fails.""" info = await location_util._get_ipapi(raising_session) assert info is None
[ "async", "def", "test_freegeoip_query_raises", "(", "raising_session", ")", ":", "info", "=", "await", "location_util", ".", "_get_ipapi", "(", "raising_session", ")", "assert", "info", "is", "None" ]
[ 136, 0 ]
[ 139, 23 ]
python
en
['en', 'en', 'en']
True
test_ip_api_query_raises
(raising_session)
Test ip api query when the request to API fails.
Test ip api query when the request to API fails.
async def test_ip_api_query_raises(raising_session): """Test ip api query when the request to API fails.""" info = await location_util._get_ip_api(raising_session) assert info is None
[ "async", "def", "test_ip_api_query_raises", "(", "raising_session", ")", ":", "info", "=", "await", "location_util", ".", "_get_ip_api", "(", "raising_session", ")", "assert", "info", "is", "None" ]
[ 142, 0 ]
[ 145, 23 ]
python
en
['en', 'en', 'en']
True
Game._score_offset_to_speed
(score_offset: int)
Values were acquired experimentally.
Values were acquired experimentally.
def _score_offset_to_speed(score_offset: int) -> float: """ Values were acquired experimentally. """ if not 0 <= score_offset <= 1000: raise ValueError( f"score_offset must be between 0 and 1000: {score_offset}") if score_offset % 100: raise ValueE...
[ "def", "_score_offset_to_speed", "(", "score_offset", ":", "int", ")", "->", "float", ":", "if", "not", "0", "<=", "score_offset", "<=", "1000", ":", "raise", "ValueError", "(", "f\"score_offset must be between 0 and 1000: {score_offset}\"", ")", "if", "score_offset",...
[ 46, 4 ]
[ 77, 23 ]
python
en
['en', 'en', 'en']
True
toon_exception_handler
(func)
Decorate Toon calls to handle Toon exceptions. A decorator that wraps the passed in function, catches Toon errors, and handles the availability of the device in the data coordinator.
Decorate Toon calls to handle Toon exceptions.
def toon_exception_handler(func): """Decorate Toon calls to handle Toon exceptions. A decorator that wraps the passed in function, catches Toon errors, and handles the availability of the device in the data coordinator. """ async def handler(self, *args, **kwargs): try: await f...
[ "def", "toon_exception_handler", "(", "func", ")", ":", "async", "def", "handler", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "try", ":", "await", "func", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", "self", ...
[ 8, 0 ]
[ 28, 18 ]
python
en
['en', 'en', 'en']
True
async_set_domains_to_be_loaded
(hass: core.HomeAssistant, domains: Set[str])
Set domains that are going to be loaded from the config. This will allow us to properly handle after_dependencies.
Set domains that are going to be loaded from the config.
def async_set_domains_to_be_loaded(hass: core.HomeAssistant, domains: Set[str]) -> None: """Set domains that are going to be loaded from the config. This will allow us to properly handle after_dependencies. """ hass.data[DATA_SETUP_DONE] = {domain: asyncio.Event() for domain in domains}
[ "def", "async_set_domains_to_be_loaded", "(", "hass", ":", "core", ".", "HomeAssistant", ",", "domains", ":", "Set", "[", "str", "]", ")", "->", "None", ":", "hass", ".", "data", "[", "DATA_SETUP_DONE", "]", "=", "{", "domain", ":", "asyncio", ".", "Even...
[ 28, 0 ]
[ 33, 80 ]
python
en
['en', 'en', 'en']
True
setup_component
(hass: core.HomeAssistant, domain: str, config: ConfigType)
Set up a component and all its dependencies.
Set up a component and all its dependencies.
def setup_component(hass: core.HomeAssistant, domain: str, config: ConfigType) -> bool: """Set up a component and all its dependencies.""" return asyncio.run_coroutine_threadsafe( async_setup_component(hass, domain, config), hass.loop ).result()
[ "def", "setup_component", "(", "hass", ":", "core", ".", "HomeAssistant", ",", "domain", ":", "str", ",", "config", ":", "ConfigType", ")", "->", "bool", ":", "return", "asyncio", ".", "run_coroutine_threadsafe", "(", "async_setup_component", "(", "hass", ",",...
[ 36, 0 ]
[ 40, 14 ]
python
en
['en', 'en', 'en']
True
async_setup_component
( hass: core.HomeAssistant, domain: str, config: ConfigType )
Set up a component and all its dependencies. This method is a coroutine.
Set up a component and all its dependencies.
async def async_setup_component( hass: core.HomeAssistant, domain: str, config: ConfigType ) -> bool: """Set up a component and all its dependencies. This method is a coroutine. """ if domain in hass.config.components: return True setup_tasks = hass.data.setdefault(DATA_SETUP, {}) ...
[ "async", "def", "async_setup_component", "(", "hass", ":", "core", ".", "HomeAssistant", ",", "domain", ":", "str", ",", "config", ":", "ConfigType", ")", "->", "bool", ":", "if", "domain", "in", "hass", ".", "config", ".", "components", ":", "return", "...
[ 43, 0 ]
[ 66, 56 ]
python
en
['en', 'en', 'en']
True
_async_process_dependencies
( hass: core.HomeAssistant, config: ConfigType, integration: loader.Integration )
Ensure all dependencies are set up.
Ensure all dependencies are set up.
async def _async_process_dependencies( hass: core.HomeAssistant, config: ConfigType, integration: loader.Integration ) -> bool: """Ensure all dependencies are set up.""" dependencies_tasks = { dep: hass.loop.create_task(async_setup_component(hass, dep, config)) for dep in integration.depende...
[ "async", "def", "_async_process_dependencies", "(", "hass", ":", "core", ".", "HomeAssistant", ",", "config", ":", "ConfigType", ",", "integration", ":", "loader", ".", "Integration", ")", "->", "bool", ":", "dependencies_tasks", "=", "{", "dep", ":", "hass", ...
[ 69, 0 ]
[ 124, 15 ]
python
en
['en', 'en', 'en']
True
_async_setup_component
( hass: core.HomeAssistant, domain: str, config: ConfigType )
Set up a component for Home Assistant. This method is a coroutine.
Set up a component for Home Assistant.
async def _async_setup_component( hass: core.HomeAssistant, domain: str, config: ConfigType ) -> bool: """Set up a component for Home Assistant. This method is a coroutine. """ def log_error(msg: str, link: Optional[str] = None) -> None: """Log helper.""" _LOGGER.error("Setup faile...
[ "async", "def", "_async_setup_component", "(", "hass", ":", "core", ".", "HomeAssistant", ",", "domain", ":", "str", ",", "config", ":", "ConfigType", ")", "->", "bool", ":", "def", "log_error", "(", "msg", ":", "str", ",", "link", ":", "Optional", "[", ...
[ 127, 0 ]
[ 265, 15 ]
python
en
['en', 'en', 'en']
True
async_prepare_setup_platform
( hass: core.HomeAssistant, hass_config: ConfigType, domain: str, platform_name: str )
Load a platform and makes sure dependencies are setup. This method is a coroutine.
Load a platform and makes sure dependencies are setup.
async def async_prepare_setup_platform( hass: core.HomeAssistant, hass_config: ConfigType, domain: str, platform_name: str ) -> Optional[ModuleType]: """Load a platform and makes sure dependencies are setup. This method is a coroutine. """ platform_path = PLATFORM_FORMAT.format(domain=domain, platf...
[ "async", "def", "async_prepare_setup_platform", "(", "hass", ":", "core", ".", "HomeAssistant", ",", "hass_config", ":", "ConfigType", ",", "domain", ":", "str", ",", "platform_name", ":", "str", ")", "->", "Optional", "[", "ModuleType", "]", ":", "platform_pa...
[ 268, 0 ]
[ 320, 19 ]
python
en
['en', 'en', 'en']
True
async_process_deps_reqs
( hass: core.HomeAssistant, config: ConfigType, integration: loader.Integration )
Process all dependencies and requirements for a module. Module is a Python module of either a component or platform.
Process all dependencies and requirements for a module.
async def async_process_deps_reqs( hass: core.HomeAssistant, config: ConfigType, integration: loader.Integration ) -> None: """Process all dependencies and requirements for a module. Module is a Python module of either a component or platform. """ processed = hass.data.get(DATA_DEPS_REQS) if p...
[ "async", "def", "async_process_deps_reqs", "(", "hass", ":", "core", ".", "HomeAssistant", ",", "config", ":", "ConfigType", ",", "integration", ":", "loader", ".", "Integration", ")", "->", "None", ":", "processed", "=", "hass", ".", "data", ".", "get", "...
[ 323, 0 ]
[ 346, 37 ]
python
en
['en', 'en', 'en']
True
async_when_setup
( hass: core.HomeAssistant, component: str, when_setup_cb: Callable[[core.HomeAssistant, str], Awaitable[None]], )
Call a method when a component is setup.
Call a method when a component is setup.
def async_when_setup( hass: core.HomeAssistant, component: str, when_setup_cb: Callable[[core.HomeAssistant, str], Awaitable[None]], ) -> None: """Call a method when a component is setup.""" async def when_setup() -> None: """Call the callback.""" try: await when_setup_c...
[ "def", "async_when_setup", "(", "hass", ":", "core", ".", "HomeAssistant", ",", "component", ":", "str", ",", "when_setup_cb", ":", "Callable", "[", "[", "core", ".", "HomeAssistant", ",", "str", "]", ",", "Awaitable", "[", "None", "]", "]", ",", ")", ...
[ 350, 0 ]
[ 379, 71 ]
python
en
['en', 'en', 'en']
True
TelnetMock.__init__
(self, host, port, timeout=0)
Initialize Telnet object.
Initialize Telnet object.
def __init__(self, host, port, timeout=0): """Initialize Telnet object.""" self.host = host self.port = port self.timeout = timeout self.sample_data = bytes( "|/dev/sda1|WDC WD30EZRX-12DC0B0|29|C|" + "|/dev/sdb1|WDC WD15EADS-11P7B2|32|C|" + "|/...
[ "def", "__init__", "(", "self", ",", "host", ",", "port", ",", "timeout", "=", "0", ")", ":", "self", ".", "host", "=", "host", "self", ".", "port", "=", "port", "self", ".", "timeout", "=", "timeout", "self", ".", "sample_data", "=", "bytes", "(",...
[ 34, 4 ]
[ 45, 9 ]
python
fy
['pl', 'fy', 'it']
False
TelnetMock.read_all
(self)
Return sample values.
Return sample values.
def read_all(self): """Return sample values.""" if self.host == "alice.local": raise ConnectionRefusedError if self.host == "bob.local": raise socket.gaierror return self.sample_data
[ "def", "read_all", "(", "self", ")", ":", "if", "self", ".", "host", "==", "\"alice.local\"", ":", "raise", "ConnectionRefusedError", "if", "self", ".", "host", "==", "\"bob.local\"", ":", "raise", "socket", ".", "gaierror", "return", "self", ".", "sample_da...
[ 47, 4 ]
[ 53, 31 ]
python
en
['en', 'et', 'en']
True
TestHDDTempSensor.setUp
(self)
Set up things to run when tests begin.
Set up things to run when tests begin.
def setUp(self): """Set up things to run when tests begin.""" self.hass = get_test_home_assistant() self.config = VALID_CONFIG_ONE_DISK self.reference = { "/dev/sda1": { "device": "/dev/sda1", "temperature": "29", "unit_of_measu...
[ "def", "setUp", "(", "self", ")", ":", "self", ".", "hass", "=", "get_test_home_assistant", "(", ")", "self", ".", "config", "=", "VALID_CONFIG_ONE_DISK", "self", ".", "reference", "=", "{", "\"/dev/sda1\"", ":", "{", "\"device\"", ":", "\"/dev/sda1\"", ",",...
[ 59, 4 ]
[ 89, 39 ]
python
en
['en', 'en', 'en']
True
TestHDDTempSensor.test_hddtemp_min_config
(self)
Test minimal hddtemp configuration.
Test minimal hddtemp configuration.
def test_hddtemp_min_config(self): """Test minimal hddtemp configuration.""" assert setup_component(self.hass, "sensor", VALID_CONFIG_MINIMAL) self.hass.block_till_done() entity = self.hass.states.all()[0].entity_id state = self.hass.states.get(entity) reference = self....
[ "def", "test_hddtemp_min_config", "(", "self", ")", ":", "assert", "setup_component", "(", "self", ".", "hass", ",", "\"sensor\"", ",", "VALID_CONFIG_MINIMAL", ")", "self", ".", "hass", ".", "block_till_done", "(", ")", "entity", "=", "self", ".", "hass", "....
[ 92, 4 ]
[ 112, 9 ]
python
de
['de', 'ro', 'en']
False
TestHDDTempSensor.test_hddtemp_rename_config
(self)
Test hddtemp configuration with different name.
Test hddtemp configuration with different name.
def test_hddtemp_rename_config(self): """Test hddtemp configuration with different name.""" assert setup_component(self.hass, "sensor", VALID_CONFIG_NAME) self.hass.block_till_done() entity = self.hass.states.all()[0].entity_id state = self.hass.states.get(entity) refer...
[ "def", "test_hddtemp_rename_config", "(", "self", ")", ":", "assert", "setup_component", "(", "self", ".", "hass", ",", "\"sensor\"", ",", "VALID_CONFIG_NAME", ")", "self", ".", "hass", ".", "block_till_done", "(", ")", "entity", "=", "self", ".", "hass", "....
[ 115, 4 ]
[ 125, 87 ]
python
en
['en', 'en', 'en']
True
TestHDDTempSensor.test_hddtemp_one_disk
(self)
Test hddtemp one disk configuration.
Test hddtemp one disk configuration.
def test_hddtemp_one_disk(self): """Test hddtemp one disk configuration.""" assert setup_component(self.hass, "sensor", VALID_CONFIG_ONE_DISK) self.hass.block_till_done() state = self.hass.states.get("sensor.hd_temperature_dev_sdd1") reference = self.reference[state.attributes....
[ "def", "test_hddtemp_one_disk", "(", "self", ")", ":", "assert", "setup_component", "(", "self", ".", "hass", ",", "\"sensor\"", ",", "VALID_CONFIG_ONE_DISK", ")", "self", ".", "hass", ".", "block_till_done", "(", ")", "state", "=", "self", ".", "hass", ".",...
[ 128, 4 ]
[ 147, 9 ]
python
en
['da', 'en', 'en']
True
TestHDDTempSensor.test_hddtemp_wrong_disk
(self)
Test hddtemp wrong disk configuration.
Test hddtemp wrong disk configuration.
def test_hddtemp_wrong_disk(self): """Test hddtemp wrong disk configuration.""" assert setup_component(self.hass, "sensor", VALID_CONFIG_WRONG_DISK) self.hass.block_till_done() assert len(self.hass.states.all()) == 1 state = self.hass.states.get("sensor.hd_temperature_dev_sdx1")...
[ "def", "test_hddtemp_wrong_disk", "(", "self", ")", ":", "assert", "setup_component", "(", "self", ".", "hass", ",", "\"sensor\"", ",", "VALID_CONFIG_WRONG_DISK", ")", "self", ".", "hass", ".", "block_till_done", "(", ")", "assert", "len", "(", "self", ".", ...
[ 150, 4 ]
[ 157, 82 ]
python
en
['id', 'en', 'en']
True
TestHDDTempSensor.test_hddtemp_multiple_disks
(self)
Test hddtemp multiple disk configuration.
Test hddtemp multiple disk configuration.
def test_hddtemp_multiple_disks(self): """Test hddtemp multiple disk configuration.""" assert setup_component(self.hass, "sensor", VALID_CONFIG_MULTIPLE_DISKS) self.hass.block_till_done() for sensor in [ "sensor.hd_temperature_dev_sda1", "sensor.hd_temperature_de...
[ "def", "test_hddtemp_multiple_disks", "(", "self", ")", ":", "assert", "setup_component", "(", "self", ".", "hass", ",", "\"sensor\"", ",", "VALID_CONFIG_MULTIPLE_DISKS", ")", "self", ".", "hass", ".", "block_till_done", "(", ")", "for", "sensor", "in", "[", "...
[ 160, 4 ]
[ 185, 13 ]
python
da
['da', 'da', 'en']
True
TestHDDTempSensor.test_hddtemp_host_refused
(self)
Test hddtemp if host unreachable.
Test hddtemp if host unreachable.
def test_hddtemp_host_refused(self): """Test hddtemp if host unreachable.""" assert setup_component(self.hass, "sensor", VALID_CONFIG_HOST) self.hass.block_till_done() assert len(self.hass.states.all()) == 0
[ "def", "test_hddtemp_host_refused", "(", "self", ")", ":", "assert", "setup_component", "(", "self", ".", "hass", ",", "\"sensor\"", ",", "VALID_CONFIG_HOST", ")", "self", ".", "hass", ".", "block_till_done", "(", ")", "assert", "len", "(", "self", ".", "has...
[ 188, 4 ]
[ 192, 47 ]
python
en
['de', 'en', 'en']
True
TestHDDTempSensor.test_hddtemp_host_unreachable
(self)
Test hddtemp if host unreachable.
Test hddtemp if host unreachable.
def test_hddtemp_host_unreachable(self): """Test hddtemp if host unreachable.""" assert setup_component(self.hass, "sensor", VALID_CONFIG_HOST_UNREACHABLE) self.hass.block_till_done() assert len(self.hass.states.all()) == 0
[ "def", "test_hddtemp_host_unreachable", "(", "self", ")", ":", "assert", "setup_component", "(", "self", ".", "hass", ",", "\"sensor\"", ",", "VALID_CONFIG_HOST_UNREACHABLE", ")", "self", ".", "hass", ".", "block_till_done", "(", ")", "assert", "len", "(", "self...
[ 195, 4 ]
[ 199, 47 ]
python
en
['de', 'en', 'en']
True
test_signal_messenger_init
(hass)
Test that service loads successfully.
Test that service loads successfully.
async def test_signal_messenger_init(hass): """Test that service loads successfully.""" config = { BASE_COMPONENT: { "name": "test", "platform": "signal_messenger", "url": "http://127.0.0.1:8080", "number": "+43443434343", "recipients": ["+435...
[ "async", "def", "test_signal_messenger_init", "(", "hass", ")", ":", "config", "=", "{", "BASE_COMPONENT", ":", "{", "\"name\"", ":", "\"test\"", ",", "\"platform\"", ":", "\"signal_messenger\"", ",", "\"url\"", ":", "\"http://127.0.0.1:8080\"", ",", "\"number\"", ...
[ 17, 0 ]
[ 35, 64 ]
python
en
['en', 'en', 'en']
True
TestSignalMesssenger.setUp
(self)
Set up things to be run when tests are started.
Set up things to be run when tests are started.
def setUp(self): """Set up things to be run when tests are started.""" recipients = ["+435565656565"] number = "+43443434343" client = SignalCliRestApi("http://127.0.0.1:8080", number) self._signalmessenger = signalmessenger.SignalNotificationService( recipients, clie...
[ "def", "setUp", "(", "self", ")", ":", "recipients", "=", "[", "\"+435565656565\"", "]", "number", "=", "\"+43443434343\"", "client", "=", "SignalCliRestApi", "(", "\"http://127.0.0.1:8080\"", ",", "number", ")", "self", ".", "_signalmessenger", "=", "signalmessen...
[ 41, 4 ]
[ 48, 9 ]
python
en
['en', 'en', 'en']
True
TestSignalMesssenger.test_send_message
(self, mock)
Test send message.
Test send message.
def test_send_message(self, mock): """Test send message.""" message = "Testing Signal Messenger platform :)" mock.register_uri( "POST", "http://127.0.0.1:8080/v2/send", status_code=201, ) mock.register_uri( "GET", "http:...
[ "def", "test_send_message", "(", "self", ",", "mock", ")", ":", "message", "=", "\"Testing Signal Messenger platform :)\"", "mock", ".", "register_uri", "(", "\"POST\"", ",", "\"http://127.0.0.1:8080/v2/send\"", ",", "status_code", "=", "201", ",", ")", "mock", ".",...
[ 51, 4 ]
[ 71, 44 ]
python
en
['en', 'de', 'en']
True
TestSignalMesssenger.test_send_message_should_show_deprecation_warning
(self, mock)
Test send message.
Test send message.
def test_send_message_should_show_deprecation_warning(self, mock): """Test send message.""" message = "Testing Signal Messenger platform with attachment :)" mock.register_uri( "POST", "http://127.0.0.1:8080/v2/send", status_code=201, ) mock.reg...
[ "def", "test_send_message_should_show_deprecation_warning", "(", "self", ",", "mock", ")", ":", "message", "=", "\"Testing Signal Messenger platform with attachment :)\"", "mock", ".", "register_uri", "(", "\"POST\"", ",", "\"http://127.0.0.1:8080/v2/send\"", ",", "status_code"...
[ 74, 4 ]
[ 101, 44 ]
python
en
['en', 'de', 'en']
True
TestSignalMesssenger.test_send_message_with_attachment
(self, mock)
Test send message.
Test send message.
def test_send_message_with_attachment(self, mock): """Test send message.""" message = "Testing Signal Messenger platform :)" mock.register_uri( "POST", "http://127.0.0.1:8080/v2/send", status_code=201, ) mock.register_uri( "GET", ...
[ "def", "test_send_message_with_attachment", "(", "self", ",", "mock", ")", ":", "message", "=", "\"Testing Signal Messenger platform :)\"", "mock", ".", "register_uri", "(", "\"POST\"", ",", "\"http://127.0.0.1:8080/v2/send\"", ",", "status_code", "=", "201", ",", ")", ...
[ 104, 4 ]
[ 128, 44 ]
python
en
['en', 'de', 'en']
True
async_setup_platform
(hass, config, async_add_entities, discovery_info=None)
Set up the generic thermostat platform.
Set up the generic thermostat platform.
async def async_setup_platform(hass, config, async_add_entities, discovery_info=None): """Set up the generic thermostat platform.""" await async_setup_reload_service(hass, DOMAIN, PLATFORMS) name = config.get(CONF_NAME) heater_entity_id = config.get(CONF_HEATER) sensor_entity_id = config.get(CONF_...
[ "async", "def", "async_setup_platform", "(", "hass", ",", "config", ",", "async_add_entities", ",", "discovery_info", "=", "None", ")", ":", "await", "async_setup_reload_service", "(", "hass", ",", "DOMAIN", ",", "PLATFORMS", ")", "name", "=", "config", ".", "...
[ 91, 0 ]
[ 132, 5 ]
python
en
['en', 'da', 'en']
True
GenericThermostat.__init__
( self, name, heater_entity_id, sensor_entity_id, min_temp, max_temp, target_temp, ac_mode, min_cycle_duration, cold_tolerance, hot_tolerance, keep_alive, initial_hvac_mode, away_temp, precision, ...
Initialize the thermostat.
Initialize the thermostat.
def __init__( self, name, heater_entity_id, sensor_entity_id, min_temp, max_temp, target_temp, ac_mode, min_cycle_duration, cold_tolerance, hot_tolerance, keep_alive, initial_hvac_mode, away_temp, pre...
[ "def", "__init__", "(", "self", ",", "name", ",", "heater_entity_id", ",", "sensor_entity_id", ",", "min_temp", ",", "max_temp", ",", "target_temp", ",", "ac_mode", ",", "min_cycle_duration", ",", "cold_tolerance", ",", "hot_tolerance", ",", "keep_alive", ",", "...
[ 138, 4 ]
[ 183, 29 ]
python
en
['en', 'en', 'en']
True
GenericThermostat.async_added_to_hass
(self)
Run when entity about to be added.
Run when entity about to be added.
async def async_added_to_hass(self): """Run when entity about to be added.""" await super().async_added_to_hass() # Add listener self.async_on_remove( async_track_state_change_event( self.hass, [self.sensor_entity_id], self._async_sensor_changed )...
[ "async", "def", "async_added_to_hass", "(", "self", ")", ":", "await", "super", "(", ")", ".", "async_added_to_hass", "(", ")", "# Add listener", "self", ".", "async_on_remove", "(", "async_track_state_change_event", "(", "self", ".", "hass", ",", "[", "self", ...
[ 185, 4 ]
[ 255, 43 ]
python
en
['en', 'en', 'en']
True
GenericThermostat.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" ]
[ 258, 4 ]
[ 260, 20 ]
python
en
['en', 'en', 'en']
True
GenericThermostat.name
(self)
Return the name of the thermostat.
Return the name of the thermostat.
def name(self): """Return the name of the thermostat.""" return self._name
[ "def", "name", "(", "self", ")", ":", "return", "self", ".", "_name" ]
[ 263, 4 ]
[ 265, 25 ]
python
en
['en', 'en', 'en']
True
GenericThermostat.precision
(self)
Return the precision of the system.
Return the precision of the system.
def precision(self): """Return the precision of the system.""" if self._temp_precision is not None: return self._temp_precision return super().precision
[ "def", "precision", "(", "self", ")", ":", "if", "self", ".", "_temp_precision", "is", "not", "None", ":", "return", "self", ".", "_temp_precision", "return", "super", "(", ")", ".", "precision" ]
[ 268, 4 ]
[ 272, 32 ]
python
en
['en', 'en', 'en']
True
GenericThermostat.temperature_unit
(self)
Return the unit of measurement.
Return the unit of measurement.
def temperature_unit(self): """Return the unit of measurement.""" return self._unit
[ "def", "temperature_unit", "(", "self", ")", ":", "return", "self", ".", "_unit" ]
[ 275, 4 ]
[ 277, 25 ]
python
en
['en', 'la', 'en']
True
GenericThermostat.current_temperature
(self)
Return the sensor temperature.
Return the sensor temperature.
def current_temperature(self): """Return the sensor temperature.""" return self._cur_temp
[ "def", "current_temperature", "(", "self", ")", ":", "return", "self", ".", "_cur_temp" ]
[ 280, 4 ]
[ 282, 29 ]
python
en
['en', 'la', 'en']
True
GenericThermostat.hvac_mode
(self)
Return current operation.
Return current operation.
def hvac_mode(self): """Return current operation.""" return self._hvac_mode
[ "def", "hvac_mode", "(", "self", ")", ":", "return", "self", ".", "_hvac_mode" ]
[ 285, 4 ]
[ 287, 30 ]
python
bg
['nl', 'bg', 'en']
False
GenericThermostat.hvac_action
(self)
Return the current running hvac operation if supported. Need to be one of CURRENT_HVAC_*.
Return the current running hvac operation if supported.
def hvac_action(self): """Return the current running hvac operation if supported. Need to be one of CURRENT_HVAC_*. """ if self._hvac_mode == HVAC_MODE_OFF: return CURRENT_HVAC_OFF if not self._is_device_active: return CURRENT_HVAC_IDLE if self.ac...
[ "def", "hvac_action", "(", "self", ")", ":", "if", "self", ".", "_hvac_mode", "==", "HVAC_MODE_OFF", ":", "return", "CURRENT_HVAC_OFF", "if", "not", "self", ".", "_is_device_active", ":", "return", "CURRENT_HVAC_IDLE", "if", "self", ".", "ac_mode", ":", "retur...
[ 290, 4 ]
[ 301, 32 ]
python
en
['en', 'en', 'en']
True
GenericThermostat.target_temperature
(self)
Return the temperature we try to reach.
Return the temperature we try to reach.
def target_temperature(self): """Return the temperature we try to reach.""" return self._target_temp
[ "def", "target_temperature", "(", "self", ")", ":", "return", "self", ".", "_target_temp" ]
[ 304, 4 ]
[ 306, 32 ]
python
en
['en', 'en', 'en']
True
GenericThermostat.hvac_modes
(self)
List of available operation modes.
List of available operation modes.
def hvac_modes(self): """List of available operation modes.""" return self._hvac_list
[ "def", "hvac_modes", "(", "self", ")", ":", "return", "self", ".", "_hvac_list" ]
[ 309, 4 ]
[ 311, 30 ]
python
en
['en', 'en', 'en']
True
GenericThermostat.preset_mode
(self)
Return the current preset mode, e.g., home, away, temp.
Return the current preset mode, e.g., home, away, temp.
def preset_mode(self): """Return the current preset mode, e.g., home, away, temp.""" return PRESET_AWAY if self._is_away else PRESET_NONE
[ "def", "preset_mode", "(", "self", ")", ":", "return", "PRESET_AWAY", "if", "self", ".", "_is_away", "else", "PRESET_NONE" ]
[ 314, 4 ]
[ 316, 60 ]
python
en
['en', 'pt', 'en']
True
GenericThermostat.preset_modes
(self)
Return a list of available preset modes or PRESET_NONE if _away_temp is undefined.
Return a list of available preset modes or PRESET_NONE if _away_temp is undefined.
def preset_modes(self): """Return a list of available preset modes or PRESET_NONE if _away_temp is undefined.""" return [PRESET_NONE, PRESET_AWAY] if self._away_temp else PRESET_NONE
[ "def", "preset_modes", "(", "self", ")", ":", "return", "[", "PRESET_NONE", ",", "PRESET_AWAY", "]", "if", "self", ".", "_away_temp", "else", "PRESET_NONE" ]
[ 319, 4 ]
[ 321, 77 ]
python
en
['en', 'en', 'en']
True
GenericThermostat.async_set_hvac_mode
(self, hvac_mode)
Set hvac mode.
Set hvac mode.
async def async_set_hvac_mode(self, hvac_mode): """Set hvac mode.""" if hvac_mode == HVAC_MODE_HEAT: self._hvac_mode = HVAC_MODE_HEAT await self._async_control_heating(force=True) elif hvac_mode == HVAC_MODE_COOL: self._hvac_mode = HVAC_MODE_COOL a...
[ "async", "def", "async_set_hvac_mode", "(", "self", ",", "hvac_mode", ")", ":", "if", "hvac_mode", "==", "HVAC_MODE_HEAT", ":", "self", ".", "_hvac_mode", "=", "HVAC_MODE_HEAT", "await", "self", ".", "_async_control_heating", "(", "force", "=", "True", ")", "e...
[ 323, 4 ]
[ 339, 35 ]
python
da
['da', 'pt', 'ru']
False
GenericThermostat.async_set_temperature
(self, **kwargs)
Set new target temperature.
Set new target temperature.
async def async_set_temperature(self, **kwargs): """Set new target temperature.""" temperature = kwargs.get(ATTR_TEMPERATURE) if temperature is None: return self._target_temp = temperature await self._async_control_heating(force=True) self.async_write_ha_state...
[ "async", "def", "async_set_temperature", "(", "self", ",", "*", "*", "kwargs", ")", ":", "temperature", "=", "kwargs", ".", "get", "(", "ATTR_TEMPERATURE", ")", "if", "temperature", "is", "None", ":", "return", "self", ".", "_target_temp", "=", "temperature"...
[ 341, 4 ]
[ 348, 35 ]
python
en
['en', 'ca', 'en']
True
GenericThermostat.min_temp
(self)
Return the minimum temperature.
Return the minimum temperature.
def min_temp(self): """Return the minimum temperature.""" if self._min_temp is not None: return self._min_temp # get default temp from super class return super().min_temp
[ "def", "min_temp", "(", "self", ")", ":", "if", "self", ".", "_min_temp", "is", "not", "None", ":", "return", "self", ".", "_min_temp", "# get default temp from super class", "return", "super", "(", ")", ".", "min_temp" ]
[ 351, 4 ]
[ 357, 31 ]
python
en
['en', 'la', 'en']
True
GenericThermostat.max_temp
(self)
Return the maximum temperature.
Return the maximum temperature.
def max_temp(self): """Return the maximum temperature.""" if self._max_temp is not None: return self._max_temp # Get default temp from super class return super().max_temp
[ "def", "max_temp", "(", "self", ")", ":", "if", "self", ".", "_max_temp", "is", "not", "None", ":", "return", "self", ".", "_max_temp", "# Get default temp from super class", "return", "super", "(", ")", ".", "max_temp" ]
[ 360, 4 ]
[ 366, 31 ]
python
en
['en', 'la', 'en']
True
GenericThermostat._async_sensor_changed
(self, event)
Handle temperature changes.
Handle temperature changes.
async def _async_sensor_changed(self, event): """Handle temperature changes.""" new_state = event.data.get("new_state") if new_state is None or new_state.state in (STATE_UNAVAILABLE, STATE_UNKNOWN): return self._async_update_temp(new_state) await self._async_control_...
[ "async", "def", "_async_sensor_changed", "(", "self", ",", "event", ")", ":", "new_state", "=", "event", ".", "data", ".", "get", "(", "\"new_state\"", ")", "if", "new_state", "is", "None", "or", "new_state", ".", "state", "in", "(", "STATE_UNAVAILABLE", "...
[ 368, 4 ]
[ 376, 35 ]
python
en
['en', 'fr', 'en']
True
GenericThermostat._async_switch_changed
(self, event)
Handle heater switch state changes.
Handle heater switch state changes.
def _async_switch_changed(self, event): """Handle heater switch state changes.""" new_state = event.data.get("new_state") if new_state is None: return self.async_write_ha_state()
[ "def", "_async_switch_changed", "(", "self", ",", "event", ")", ":", "new_state", "=", "event", ".", "data", ".", "get", "(", "\"new_state\"", ")", "if", "new_state", "is", "None", ":", "return", "self", ".", "async_write_ha_state", "(", ")" ]
[ 379, 4 ]
[ 384, 35 ]
python
en
['en', 'en', 'en']
True
GenericThermostat._async_update_temp
(self, state)
Update thermostat with latest state from sensor.
Update thermostat with latest state from sensor.
def _async_update_temp(self, state): """Update thermostat with latest state from sensor.""" try: self._cur_temp = float(state.state) except ValueError as ex: _LOGGER.error("Unable to update from sensor: %s", ex)
[ "def", "_async_update_temp", "(", "self", ",", "state", ")", ":", "try", ":", "self", ".", "_cur_temp", "=", "float", "(", "state", ".", "state", ")", "except", "ValueError", "as", "ex", ":", "_LOGGER", ".", "error", "(", "\"Unable to update from sensor: %s\...
[ 387, 4 ]
[ 392, 65 ]
python
en
['en', 'en', 'en']
True
GenericThermostat._async_control_heating
(self, time=None, force=False)
Check if we need to turn heating on or off.
Check if we need to turn heating on or off.
async def _async_control_heating(self, time=None, force=False): """Check if we need to turn heating on or off.""" async with self._temp_lock: if not self._active and None not in (self._cur_temp, self._target_temp): self._active = True _LOGGER.info( ...
[ "async", "def", "_async_control_heating", "(", "self", ",", "time", "=", "None", ",", "force", "=", "False", ")", ":", "async", "with", "self", ".", "_temp_lock", ":", "if", "not", "self", ".", "_active", "and", "None", "not", "in", "(", "self", ".", ...
[ 394, 4 ]
[ 450, 55 ]
python
en
['en', 'en', 'en']
True
GenericThermostat._is_device_active
(self)
If the toggleable device is currently active.
If the toggleable device is currently active.
def _is_device_active(self): """If the toggleable device is currently active.""" return self.hass.states.is_state(self.heater_entity_id, STATE_ON)
[ "def", "_is_device_active", "(", "self", ")", ":", "return", "self", ".", "hass", ".", "states", ".", "is_state", "(", "self", ".", "heater_entity_id", ",", "STATE_ON", ")" ]
[ 453, 4 ]
[ 455, 73 ]
python
en
['en', 'en', 'en']
True
GenericThermostat.supported_features
(self)
Return the list of supported features.
Return the list of supported features.
def supported_features(self): """Return the list of supported features.""" return self._support_flags
[ "def", "supported_features", "(", "self", ")", ":", "return", "self", ".", "_support_flags" ]
[ 458, 4 ]
[ 460, 34 ]
python
en
['en', 'en', 'en']
True