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_flow_do_not_unlock
(hass)
Test we do not unlock the device if the user does not want to.
Test we do not unlock the device if the user does not want to.
async def test_flow_do_not_unlock(hass): """Test we do not unlock the device if the user does not want to.""" device = get_device("Living Room") mock_api = device.get_mock_api() mock_api.is_locked = True result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": config_e...
[ "async", "def", "test_flow_do_not_unlock", "(", "hass", ")", ":", "device", "=", "get_device", "(", "\"Living Room\"", ")", "mock_api", "=", "device", ".", "get_mock_api", "(", ")", "mock_api", ".", "is_locked", "=", "True", "result", "=", "await", "hass", "...
[ 513, 0 ]
[ 543, 44 ]
python
en
['en', 'en', 'en']
True
test_flow_import_works
(hass)
Test an import flow.
Test an import flow.
async def test_flow_import_works(hass): """Test an import flow.""" device = get_device("Living Room") mock_api = device.get_mock_api() with patch(DEVICE_DISCOVERY, return_value=[mock_api]) as mock_discover: result = await hass.config_entries.flow.async_init( DOMAIN, cont...
[ "async", "def", "test_flow_import_works", "(", "hass", ")", ":", "device", "=", "get_device", "(", "\"Living Room\"", ")", "mock_api", "=", "device", ".", "get_mock_api", "(", ")", "with", "patch", "(", "DEVICE_DISCOVERY", ",", "return_value", "=", "[", "mock_...
[ 546, 0 ]
[ 574, 40 ]
python
en
['en', 'lb', 'en']
True
test_flow_import_already_in_progress
(hass)
Test we do not import more than one flow per device.
Test we do not import more than one flow per device.
async def test_flow_import_already_in_progress(hass): """Test we do not import more than one flow per device.""" device = get_device("Living Room") data = {"host": device.host} with patch(DEVICE_DISCOVERY, return_value=[device.get_mock_api()]): result = await hass.config_entries.flow.async_init...
[ "async", "def", "test_flow_import_already_in_progress", "(", "hass", ")", ":", "device", "=", "get_device", "(", "\"Living Room\"", ")", "data", "=", "{", "\"host\"", ":", "device", ".", "host", "}", "with", "patch", "(", "DEVICE_DISCOVERY", ",", "return_value",...
[ 577, 0 ]
[ 593, 52 ]
python
en
['en', 'en', 'en']
True
test_flow_import_host_already_configured
(hass)
Test we do not import a host that is already configured.
Test we do not import a host that is already configured.
async def test_flow_import_host_already_configured(hass): """Test we do not import a host that is already configured.""" device = get_device("Living Room") mock_entry = device.get_mock_entry() mock_entry.add_to_hass(hass) mock_api = device.get_mock_api() with patch(DEVICE_DISCOVERY, return_valu...
[ "async", "def", "test_flow_import_host_already_configured", "(", "hass", ")", ":", "device", "=", "get_device", "(", "\"Living Room\"", ")", "mock_entry", "=", "device", ".", "get_mock_entry", "(", ")", "mock_entry", ".", "add_to_hass", "(", "hass", ")", "mock_api...
[ 596, 0 ]
[ 611, 51 ]
python
en
['en', 'en', 'en']
True
test_flow_import_mac_already_configured
(hass)
Test we do not import more than one config entry per device. We need to abort the flow and update the existing entry.
Test we do not import more than one config entry per device.
async def test_flow_import_mac_already_configured(hass): """Test we do not import more than one config entry per device. We need to abort the flow and update the existing entry. """ device = get_device("Living Room") mock_entry = device.get_mock_entry() mock_entry.add_to_hass(hass) device....
[ "async", "def", "test_flow_import_mac_already_configured", "(", "hass", ")", ":", "device", "=", "get_device", "(", "\"Living Room\"", ")", "mock_entry", "=", "device", ".", "get_mock_entry", "(", ")", "mock_entry", ".", "add_to_hass", "(", "hass", ")", "device", ...
[ 614, 0 ]
[ 639, 40 ]
python
en
['en', 'en', 'en']
True
test_flow_import_device_not_found
(hass)
Test we handle a device not found in the import step.
Test we handle a device not found in the import step.
async def test_flow_import_device_not_found(hass): """Test we handle a device not found in the import step.""" with patch(DEVICE_DISCOVERY, return_value=[]): result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": config_entries.SOURCE_IMPORT}, ...
[ "async", "def", "test_flow_import_device_not_found", "(", "hass", ")", ":", "with", "patch", "(", "DEVICE_DISCOVERY", ",", "return_value", "=", "[", "]", ")", ":", "result", "=", "await", "hass", ".", "config_entries", ".", "flow", ".", "async_init", "(", "D...
[ 642, 0 ]
[ 652, 47 ]
python
en
['en', 'en', 'en']
True
test_flow_import_device_not_supported
(hass)
Test we handle a device not supported in the import step.
Test we handle a device not supported in the import step.
async def test_flow_import_device_not_supported(hass): """Test we handle a device not supported in the import step.""" device = get_device("Kitchen") mock_api = device.get_mock_api() with patch(DEVICE_DISCOVERY, return_value=[mock_api]): result = await hass.config_entries.flow.async_init( ...
[ "async", "def", "test_flow_import_device_not_supported", "(", "hass", ")", ":", "device", "=", "get_device", "(", "\"Kitchen\"", ")", "mock_api", "=", "device", ".", "get_mock_api", "(", ")", "with", "patch", "(", "DEVICE_DISCOVERY", ",", "return_value", "=", "[...
[ 655, 0 ]
[ 668, 46 ]
python
en
['en', 'en', 'en']
True
test_flow_import_invalid_ip_address
(hass)
Test we handle an invalid IP address in the import step.
Test we handle an invalid IP address in the import step.
async def test_flow_import_invalid_ip_address(hass): """Test we handle an invalid IP address in the import step.""" with patch(DEVICE_DISCOVERY, side_effect=OSError(errno.EINVAL, None)): result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": config_entries...
[ "async", "def", "test_flow_import_invalid_ip_address", "(", "hass", ")", ":", "with", "patch", "(", "DEVICE_DISCOVERY", ",", "side_effect", "=", "OSError", "(", "errno", ".", "EINVAL", ",", "None", ")", ")", ":", "result", "=", "await", "hass", ".", "config_...
[ 671, 0 ]
[ 681, 45 ]
python
en
['en', 'en', 'en']
True
test_flow_import_invalid_hostname
(hass)
Test we handle an invalid hostname in the import step.
Test we handle an invalid hostname in the import step.
async def test_flow_import_invalid_hostname(hass): """Test we handle an invalid hostname in the import step.""" with patch(DEVICE_DISCOVERY, side_effect=OSError(socket.EAI_NONAME, None)): result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": config_entrie...
[ "async", "def", "test_flow_import_invalid_hostname", "(", "hass", ")", ":", "with", "patch", "(", "DEVICE_DISCOVERY", ",", "side_effect", "=", "OSError", "(", "socket", ".", "EAI_NONAME", ",", "None", ")", ")", ":", "result", "=", "await", "hass", ".", "conf...
[ 684, 0 ]
[ 694, 45 ]
python
en
['en', 'en', 'en']
True
test_flow_import_network_unreachable
(hass)
Test we handle a network unreachable in the import step.
Test we handle a network unreachable in the import step.
async def test_flow_import_network_unreachable(hass): """Test we handle a network unreachable in the import step.""" with patch(DEVICE_DISCOVERY, side_effect=OSError(errno.ENETUNREACH, None)): result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": config_e...
[ "async", "def", "test_flow_import_network_unreachable", "(", "hass", ")", ":", "with", "patch", "(", "DEVICE_DISCOVERY", ",", "side_effect", "=", "OSError", "(", "errno", ".", "ENETUNREACH", ",", "None", ")", ")", ":", "result", "=", "await", "hass", ".", "c...
[ 697, 0 ]
[ 707, 47 ]
python
en
['en', 'en', 'en']
True
test_flow_import_os_error
(hass)
Test we handle an OS error in the import step.
Test we handle an OS error in the import step.
async def test_flow_import_os_error(hass): """Test we handle an OS error in the import step.""" with patch(DEVICE_DISCOVERY, side_effect=OSError()): result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": config_entries.SOURCE_IMPORT}, data={"ho...
[ "async", "def", "test_flow_import_os_error", "(", "hass", ")", ":", "with", "patch", "(", "DEVICE_DISCOVERY", ",", "side_effect", "=", "OSError", "(", ")", ")", ":", "result", "=", "await", "hass", ".", "config_entries", ".", "flow", ".", "async_init", "(", ...
[ 710, 0 ]
[ 720, 40 ]
python
en
['en', 'en', 'en']
True
test_flow_reauth_works
(hass)
Test a reauthentication flow.
Test a reauthentication flow.
async def test_flow_reauth_works(hass): """Test a reauthentication flow.""" device = get_device("Living Room") mock_entry = device.get_mock_entry() mock_entry.add_to_hass(hass) mock_api = device.get_mock_api() mock_api.auth.side_effect = blke.AuthenticationError() data = {"name": device.name...
[ "async", "def", "test_flow_reauth_works", "(", "hass", ")", ":", "device", "=", "get_device", "(", "\"Living Room\"", ")", "mock_entry", "=", "device", ".", "get_mock_entry", "(", ")", "mock_entry", ".", "add_to_hass", "(", "hass", ")", "mock_api", "=", "devic...
[ 723, 0 ]
[ 753, 40 ]
python
en
['en', 'fr', 'en']
True
test_flow_reauth_invalid_host
(hass)
Test we do not accept an invalid host for reauthentication. The MAC address cannot change.
Test we do not accept an invalid host for reauthentication.
async def test_flow_reauth_invalid_host(hass): """Test we do not accept an invalid host for reauthentication. The MAC address cannot change. """ device = get_device("Living Room") mock_entry = device.get_mock_entry() mock_entry.add_to_hass(hass) mock_api = device.get_mock_api() mock_api...
[ "async", "def", "test_flow_reauth_invalid_host", "(", "hass", ")", ":", "device", "=", "get_device", "(", "\"Living Room\"", ")", "mock_entry", "=", "device", ".", "get_mock_entry", "(", ")", "mock_entry", ".", "add_to_hass", "(", "hass", ")", "mock_api", "=", ...
[ 756, 0 ]
[ 787, 40 ]
python
en
['en', 'en', 'en']
True
test_flow_reauth_valid_host
(hass)
Test we accept a valid host for reauthentication. The hostname/IP address may change. We need to update the entry.
Test we accept a valid host for reauthentication.
async def test_flow_reauth_valid_host(hass): """Test we accept a valid host for reauthentication. The hostname/IP address may change. We need to update the entry. """ device = get_device("Living Room") mock_entry = device.get_mock_entry() mock_entry.add_to_hass(hass) mock_api = device.get_m...
[ "async", "def", "test_flow_reauth_valid_host", "(", "hass", ")", ":", "device", "=", "get_device", "(", "\"Living Room\"", ")", "mock_entry", "=", "device", ".", "get_mock_entry", "(", ")", "mock_entry", ".", "add_to_hass", "(", "hass", ")", "mock_api", "=", "...
[ 790, 0 ]
[ 821, 40 ]
python
en
['en', 'en', 'en']
True
setup_platform
(hass, config, add_entities, discovery_info=None)
Set up the ZAMG weather platform.
Set up the ZAMG weather platform.
def setup_platform(hass, config, add_entities, discovery_info=None): """Set up the ZAMG weather platform.""" name = config.get(CONF_NAME) latitude = config.get(CONF_LATITUDE, hass.config.latitude) longitude = config.get(CONF_LONGITUDE, hass.config.longitude) station_id = config.get(CONF_STATION_ID)...
[ "def", "setup_platform", "(", "hass", ",", "config", ",", "add_entities", ",", "discovery_info", "=", "None", ")", ":", "name", "=", "config", ".", "get", "(", "CONF_NAME", ")", "latitude", "=", "config", ".", "get", "(", "CONF_LATITUDE", ",", "hass", "....
[ 42, 0 ]
[ 66, 50 ]
python
en
['en', 'cs', 'en']
True
ZamgWeather.__init__
(self, zamg_data, stationname=None)
Initialise the platform with a data instance and station name.
Initialise the platform with a data instance and station name.
def __init__(self, zamg_data, stationname=None): """Initialise the platform with a data instance and station name.""" self.zamg_data = zamg_data self.stationname = stationname
[ "def", "__init__", "(", "self", ",", "zamg_data", ",", "stationname", "=", "None", ")", ":", "self", ".", "zamg_data", "=", "zamg_data", "self", ".", "stationname", "=", "stationname" ]
[ 72, 4 ]
[ 75, 38 ]
python
en
['en', 'en', 'en']
True
ZamgWeather.name
(self)
Return the name of the sensor.
Return the name of the sensor.
def name(self): """Return the name of the sensor.""" return ( self.stationname or f"ZAMG {self.zamg_data.data.get('Name') or '(unknown station)'}" )
[ "def", "name", "(", "self", ")", ":", "return", "(", "self", ".", "stationname", "or", "f\"ZAMG {self.zamg_data.data.get('Name') or '(unknown station)'}\"", ")" ]
[ 78, 4 ]
[ 83, 9 ]
python
en
['en', 'mi', 'en']
True
ZamgWeather.condition
(self)
Return the current condition.
Return the current condition.
def condition(self): """Return the current condition.""" return None
[ "def", "condition", "(", "self", ")", ":", "return", "None" ]
[ 86, 4 ]
[ 88, 19 ]
python
en
['en', 'en', 'en']
True
ZamgWeather.attribution
(self)
Return the attribution.
Return the attribution.
def attribution(self): """Return the attribution.""" return ATTRIBUTION
[ "def", "attribution", "(", "self", ")", ":", "return", "ATTRIBUTION" ]
[ 91, 4 ]
[ 93, 26 ]
python
en
['en', 'ja', 'en']
True
ZamgWeather.temperature
(self)
Return the platform temperature.
Return the platform temperature.
def temperature(self): """Return the platform temperature.""" return self.zamg_data.get_data(ATTR_WEATHER_TEMPERATURE)
[ "def", "temperature", "(", "self", ")", ":", "return", "self", ".", "zamg_data", ".", "get_data", "(", "ATTR_WEATHER_TEMPERATURE", ")" ]
[ 96, 4 ]
[ 98, 64 ]
python
en
['en', 'la', 'en']
True
ZamgWeather.temperature_unit
(self)
Return the unit of measurement.
Return the unit of measurement.
def temperature_unit(self): """Return the unit of measurement.""" return TEMP_CELSIUS
[ "def", "temperature_unit", "(", "self", ")", ":", "return", "TEMP_CELSIUS" ]
[ 101, 4 ]
[ 103, 27 ]
python
en
['en', 'la', 'en']
True
ZamgWeather.pressure
(self)
Return the pressure.
Return the pressure.
def pressure(self): """Return the pressure.""" return self.zamg_data.get_data(ATTR_WEATHER_PRESSURE)
[ "def", "pressure", "(", "self", ")", ":", "return", "self", ".", "zamg_data", ".", "get_data", "(", "ATTR_WEATHER_PRESSURE", ")" ]
[ 106, 4 ]
[ 108, 61 ]
python
en
['en', 'ig', 'en']
True
ZamgWeather.humidity
(self)
Return the humidity.
Return the humidity.
def humidity(self): """Return the humidity.""" return self.zamg_data.get_data(ATTR_WEATHER_HUMIDITY)
[ "def", "humidity", "(", "self", ")", ":", "return", "self", ".", "zamg_data", ".", "get_data", "(", "ATTR_WEATHER_HUMIDITY", ")" ]
[ 111, 4 ]
[ 113, 61 ]
python
en
['en', 'sw', 'en']
True
ZamgWeather.wind_speed
(self)
Return the wind speed.
Return the wind speed.
def wind_speed(self): """Return the wind speed.""" return self.zamg_data.get_data(ATTR_WEATHER_WIND_SPEED)
[ "def", "wind_speed", "(", "self", ")", ":", "return", "self", ".", "zamg_data", ".", "get_data", "(", "ATTR_WEATHER_WIND_SPEED", ")" ]
[ 116, 4 ]
[ 118, 63 ]
python
en
['en', 'zh', 'en']
True
ZamgWeather.wind_bearing
(self)
Return the wind bearing.
Return the wind bearing.
def wind_bearing(self): """Return the wind bearing.""" return self.zamg_data.get_data(ATTR_WEATHER_WIND_BEARING)
[ "def", "wind_bearing", "(", "self", ")", ":", "return", "self", ".", "zamg_data", ".", "get_data", "(", "ATTR_WEATHER_WIND_BEARING", ")" ]
[ 121, 4 ]
[ 123, 65 ]
python
en
['en', 'ig', 'en']
True
ZamgWeather.update
(self)
Update current conditions.
Update current conditions.
def update(self): """Update current conditions.""" self.zamg_data.update()
[ "def", "update", "(", "self", ")", ":", "self", ".", "zamg_data", ".", "update", "(", ")" ]
[ 125, 4 ]
[ 127, 31 ]
python
en
['en', 'en', 'en']
True
async_setup_entry
(hass, config_entry, async_add_entities)
Set up Z-Wave switch from config entry.
Set up Z-Wave switch from config entry.
async def async_setup_entry(hass, config_entry, async_add_entities): """Set up Z-Wave switch from config entry.""" @callback def async_add_switch(value): """Add Z-Wave Switch.""" switch = ZWaveSwitch(value) async_add_entities([switch]) hass.data[DOMAIN][config_entry.entry_id][...
[ "async", "def", "async_setup_entry", "(", "hass", ",", "config_entry", ",", "async_add_entities", ")", ":", "@", "callback", "def", "async_add_switch", "(", "value", ")", ":", "\"\"\"Add Z-Wave Switch.\"\"\"", "switch", "=", "ZWaveSwitch", "(", "value", ")", "asyn...
[ 9, 0 ]
[ 23, 5 ]
python
en
['en', 'en', 'en']
True
ZWaveSwitch.is_on
(self)
Return a boolean for the state of the switch.
Return a boolean for the state of the switch.
def is_on(self): """Return a boolean for the state of the switch.""" return bool(self.values.primary.value)
[ "def", "is_on", "(", "self", ")", ":", "return", "bool", "(", "self", ".", "values", ".", "primary", ".", "value", ")" ]
[ 30, 4 ]
[ 32, 46 ]
python
en
['en', 'en', 'en']
True
ZWaveSwitch.async_turn_on
(self, **kwargs)
Turn the switch on.
Turn the switch on.
async def async_turn_on(self, **kwargs): """Turn the switch on.""" self.values.primary.send_value(True)
[ "async", "def", "async_turn_on", "(", "self", ",", "*", "*", "kwargs", ")", ":", "self", ".", "values", ".", "primary", ".", "send_value", "(", "True", ")" ]
[ 34, 4 ]
[ 36, 44 ]
python
en
['en', 'en', 'en']
True
ZWaveSwitch.async_turn_off
(self, **kwargs)
Turn the switch off.
Turn the switch off.
async def async_turn_off(self, **kwargs): """Turn the switch off.""" self.values.primary.send_value(False)
[ "async", "def", "async_turn_off", "(", "self", ",", "*", "*", "kwargs", ")", ":", "self", ".", "values", ".", "primary", ".", "send_value", "(", "False", ")" ]
[ 38, 4 ]
[ 40, 45 ]
python
en
['en', 'en', 'en']
True
test_ecobee3_setup
(hass)
Test that a Ecbobee 3 can be correctly setup in HA.
Test that a Ecbobee 3 can be correctly setup in HA.
async def test_ecobee3_setup(hass): """Test that a Ecbobee 3 can be correctly setup in HA.""" accessories = await setup_accessories_from_file(hass, "ecobee3.json") config_entry, pairing = await setup_test_accessories(hass, accessories) entity_registry = await hass.helpers.entity_registry.async_get_regi...
[ "async", "def", "test_ecobee3_setup", "(", "hass", ")", ":", "accessories", "=", "await", "setup_accessories_from_file", "(", "hass", ",", "\"ecobee3.json\"", ")", "config_entry", ",", "pairing", "=", "await", "setup_test_accessories", "(", "hass", ",", "accessories...
[ 26, 0 ]
[ 88, 59 ]
python
en
['en', 'en', 'en']
True
test_ecobee3_setup_from_cache
(hass, hass_storage)
Test that Ecbobee can be correctly setup from its cached entity map.
Test that Ecbobee can be correctly setup from its cached entity map.
async def test_ecobee3_setup_from_cache(hass, hass_storage): """Test that Ecbobee can be correctly setup from its cached entity map.""" accessories = await setup_accessories_from_file(hass, "ecobee3.json") hass_storage["homekit_controller-entity-map"] = { "version": 1, "data": { ...
[ "async", "def", "test_ecobee3_setup_from_cache", "(", "hass", ",", "hass_storage", ")", ":", "accessories", "=", "await", "setup_accessories_from_file", "(", "hass", ",", "\"ecobee3.json\"", ")", "hass_storage", "[", "\"homekit_controller-entity-map\"", "]", "=", "{", ...
[ 91, 0 ]
[ 123, 46 ]
python
en
['en', 'en', 'en']
True
test_ecobee3_setup_connection_failure
(hass)
Test that Ecbobee can be correctly setup from its cached entity map.
Test that Ecbobee can be correctly setup from its cached entity map.
async def test_ecobee3_setup_connection_failure(hass): """Test that Ecbobee can be correctly setup from its cached entity map.""" accessories = await setup_accessories_from_file(hass, "ecobee3.json") entity_registry = await hass.helpers.entity_registry.async_get_registry() # Test that the connection f...
[ "async", "def", "test_ecobee3_setup_connection_failure", "(", "hass", ")", ":", "accessories", "=", "await", "setup_accessories_from_file", "(", "hass", ",", "\"ecobee3.json\"", ")", "entity_registry", "=", "await", "hass", ".", "helpers", ".", "entity_registry", ".",...
[ 126, 0 ]
[ 164, 46 ]
python
en
['en', 'en', 'en']
True
test_ecobee3_add_sensors_at_runtime
(hass)
Test that new sensors are automatically added.
Test that new sensors are automatically added.
async def test_ecobee3_add_sensors_at_runtime(hass): """Test that new sensors are automatically added.""" entity_registry = await hass.helpers.entity_registry.async_get_registry() # Set up a base Ecobee 3 with no additional sensors. # There shouldn't be any entities but climate visible. accessories...
[ "async", "def", "test_ecobee3_add_sensors_at_runtime", "(", "hass", ")", ":", "entity_registry", "=", "await", "hass", ".", "helpers", ".", "entity_registry", ".", "async_get_registry", "(", ")", "# Set up a base Ecobee 3 with no additional sensors.", "# There shouldn't be an...
[ 167, 0 ]
[ 200, 46 ]
python
en
['en', 'en', 'en']
True
test_refresh_access_token
(hass)
Test token refreshes.
Test token refreshes.
async def test_refresh_access_token(hass): """Test token refreshes.""" await _patched_refresh_access_token(hass, "new_token", 5678)
[ "async", "def", "test_refresh_access_token", "(", "hass", ")", ":", "await", "_patched_refresh_access_token", "(", "hass", ",", "\"new_token\"", ",", "5678", ")" ]
[ 10, 0 ]
[ 12, 64 ]
python
de
['nl', 'de', 'en']
False
setup_platform
(hass, config, add_entities, discovery_info=None)
Set up the Vultr subscription (server) binary sensor.
Set up the Vultr subscription (server) binary sensor.
def setup_platform(hass, config, add_entities, discovery_info=None): """Set up the Vultr subscription (server) binary sensor.""" vultr = hass.data[DATA_VULTR] subscription = config.get(CONF_SUBSCRIPTION) name = config.get(CONF_NAME) if subscription not in vultr.data: _LOGGER.error("Subscri...
[ "def", "setup_platform", "(", "hass", ",", "config", ",", "add_entities", ",", "discovery_info", "=", "None", ")", ":", "vultr", "=", "hass", ".", "data", "[", "DATA_VULTR", "]", "subscription", "=", "config", ".", "get", "(", "CONF_SUBSCRIPTION", ")", "na...
[ 39, 0 ]
[ 50, 70 ]
python
en
['en', 'sv', 'en']
True
VultrBinarySensor.__init__
(self, vultr, subscription, name)
Initialize a new Vultr binary sensor.
Initialize a new Vultr binary sensor.
def __init__(self, vultr, subscription, name): """Initialize a new Vultr binary sensor.""" self._vultr = vultr self._name = name self.subscription = subscription self.data = None
[ "def", "__init__", "(", "self", ",", "vultr", ",", "subscription", ",", "name", ")", ":", "self", ".", "_vultr", "=", "vultr", "self", ".", "_name", "=", "name", "self", ".", "subscription", "=", "subscription", "self", ".", "data", "=", "None" ]
[ 56, 4 ]
[ 62, 24 ]
python
en
['en', 'en', 'en']
True
VultrBinarySensor.name
(self)
Return the name of the sensor.
Return the name of the sensor.
def name(self): """Return the name of the sensor.""" try: return self._name.format(self.data["label"]) except (KeyError, TypeError): return self._name
[ "def", "name", "(", "self", ")", ":", "try", ":", "return", "self", ".", "_name", ".", "format", "(", "self", ".", "data", "[", "\"label\"", "]", ")", "except", "(", "KeyError", ",", "TypeError", ")", ":", "return", "self", ".", "_name" ]
[ 65, 4 ]
[ 70, 29 ]
python
en
['en', 'mi', 'en']
True
VultrBinarySensor.icon
(self)
Return the icon of this server.
Return the icon of this server.
def icon(self): """Return the icon of this server.""" return "mdi:server" if self.is_on else "mdi:server-off"
[ "def", "icon", "(", "self", ")", ":", "return", "\"mdi:server\"", "if", "self", ".", "is_on", "else", "\"mdi:server-off\"" ]
[ 73, 4 ]
[ 75, 63 ]
python
en
['en', 'en', 'en']
True
VultrBinarySensor.is_on
(self)
Return true if the binary sensor is on.
Return true if the binary sensor is on.
def is_on(self): """Return true if the binary sensor is on.""" return self.data["power_status"] == "running"
[ "def", "is_on", "(", "self", ")", ":", "return", "self", ".", "data", "[", "\"power_status\"", "]", "==", "\"running\"" ]
[ 78, 4 ]
[ 80, 53 ]
python
en
['en', 'fy', 'en']
True
VultrBinarySensor.device_class
(self)
Return the class of this sensor.
Return the class of this sensor.
def device_class(self): """Return the class of this sensor.""" return DEFAULT_DEVICE_CLASS
[ "def", "device_class", "(", "self", ")", ":", "return", "DEFAULT_DEVICE_CLASS" ]
[ 83, 4 ]
[ 85, 35 ]
python
en
['en', 'en', 'en']
True
VultrBinarySensor.device_state_attributes
(self)
Return the state attributes of the Vultr subscription.
Return the state attributes of the Vultr subscription.
def device_state_attributes(self): """Return the state attributes of the Vultr subscription.""" return { ATTR_ALLOWED_BANDWIDTH: self.data.get("allowed_bandwidth_gb"), ATTR_AUTO_BACKUPS: self.data.get("auto_backups"), ATTR_COST_PER_MONTH: self.data.get("cost_per_month...
[ "def", "device_state_attributes", "(", "self", ")", ":", "return", "{", "ATTR_ALLOWED_BANDWIDTH", ":", "self", ".", "data", ".", "get", "(", "\"allowed_bandwidth_gb\"", ")", ",", "ATTR_AUTO_BACKUPS", ":", "self", ".", "data", ".", "get", "(", "\"auto_backups\"",...
[ 88, 4 ]
[ 104, 9 ]
python
en
['en', 'en', 'en']
True
VultrBinarySensor.update
(self)
Update state of sensor.
Update state of sensor.
def update(self): """Update state of sensor.""" self._vultr.update() self.data = self._vultr.data[self.subscription]
[ "def", "update", "(", "self", ")", ":", "self", ".", "_vultr", ".", "update", "(", ")", "self", ".", "data", "=", "self", ".", "_vultr", ".", "data", "[", "self", ".", "subscription", "]" ]
[ 106, 4 ]
[ 109, 55 ]
python
en
['en', 'co', 'en']
True
test_backward_compatibility_missing_part_spec_list
(ops, missing_spec_list)
Assert.assertEquals("Partition spec should be the default", expected.spec().toString(), metadata.spec().toString()); Assert.assertEquals("Default spec ID should default to TableMetadata.INITIAL_SPEC_ID", TableMetadata.INITIAL_SPEC_ID, metadata.defaultSpecId()); Assert.assertEquals("Partitio...
Assert.assertEquals("Partition spec should be the default", expected.spec().toString(), metadata.spec().toString()); Assert.assertEquals("Default spec ID should default to TableMetadata.INITIAL_SPEC_ID", TableMetadata.INITIAL_SPEC_ID, metadata.defaultSpecId()); Assert.assertEquals("Partitio...
def test_backward_compatibility_missing_part_spec_list(ops, missing_spec_list): as_json = to_json_without_spec_list(missing_spec_list) metadata = TableMetadataParser.from_json(ops, None, as_json) assert metadata.location == missing_spec_list.location assert metadata.last_column_id == missing_spec_list.l...
[ "def", "test_backward_compatibility_missing_part_spec_list", "(", "ops", ",", "missing_spec_list", ")", ":", "as_json", "=", "to_json_without_spec_list", "(", "missing_spec_list", ")", "metadata", "=", "TableMetadataParser", ".", "from_json", "(", "ops", ",", "None", ",...
[ 64, 0 ]
[ 96, 62 ]
python
en
['en', 'error', 'th']
False
async_setup_sdm_platform
(hass, platform, devices={}, structures={})
Set up the platform and prerequisites.
Set up the platform and prerequisites.
async def async_setup_sdm_platform(hass, platform, devices={}, structures={}): """Set up the platform and prerequisites.""" MockConfigEntry(domain=DOMAIN, data=CONFIG_ENTRY_DATA).add_to_hass(hass) device_manager = FakeDeviceManager(devices=devices, structures=structures) subscriber = FakeSubscriber(devi...
[ "async", "def", "async_setup_sdm_platform", "(", "hass", ",", "platform", ",", "devices", "=", "{", "}", ",", "structures", "=", "{", "}", ")", ":", "MockConfigEntry", "(", "domain", "=", "DOMAIN", ",", "data", "=", "CONFIG_ENTRY_DATA", ")", ".", "add_to_h...
[ 86, 0 ]
[ 98, 21 ]
python
en
['en', 'en', 'en']
True
FakeDeviceManager.__init__
(self, devices: dict, structures: dict)
Initialize FakeDeviceManager.
Initialize FakeDeviceManager.
def __init__(self, devices: dict, structures: dict): """Initialize FakeDeviceManager.""" super().__init__() self._devices = devices
[ "def", "__init__", "(", "self", ",", "devices", ":", "dict", ",", "structures", ":", "dict", ")", ":", "super", "(", ")", ".", "__init__", "(", ")", "self", ".", "_devices", "=", "devices" ]
[ 39, 4 ]
[ 42, 31 ]
python
en
['en', 'en', 'it']
False
FakeDeviceManager.structures
(self)
Override structures with fake result.
Override structures with fake result.
def structures(self) -> dict: """Override structures with fake result.""" return self._structures
[ "def", "structures", "(", "self", ")", "->", "dict", ":", "return", "self", ".", "_structures" ]
[ 45, 4 ]
[ 47, 31 ]
python
en
['en', 'en', 'en']
True
FakeDeviceManager.devices
(self)
Override devices with fake result.
Override devices with fake result.
def devices(self) -> dict: """Override devices with fake result.""" return self._devices
[ "def", "devices", "(", "self", ")", "->", "dict", ":", "return", "self", ".", "_devices" ]
[ 50, 4 ]
[ 52, 28 ]
python
en
['en', 'en', 'en']
True
FakeSubscriber.__init__
(self, device_manager: FakeDeviceManager)
Initialize Fake Subscriber.
Initialize Fake Subscriber.
def __init__(self, device_manager: FakeDeviceManager): """Initialize Fake Subscriber.""" self._device_manager = device_manager self._callback = None
[ "def", "__init__", "(", "self", ",", "device_manager", ":", "FakeDeviceManager", ")", ":", "self", ".", "_device_manager", "=", "device_manager", "self", ".", "_callback", "=", "None" ]
[ 58, 4 ]
[ 61, 29 ]
python
en
['en', 'en', 'en']
True
FakeSubscriber.set_update_callback
(self, callback: EventCallback)
Capture the callback set by Home Assistant.
Capture the callback set by Home Assistant.
def set_update_callback(self, callback: EventCallback): """Capture the callback set by Home Assistant.""" self._callback = callback
[ "def", "set_update_callback", "(", "self", ",", "callback", ":", "EventCallback", ")", ":", "self", ".", "_callback", "=", "callback" ]
[ 63, 4 ]
[ 65, 33 ]
python
en
['en', 'en', 'en']
True
FakeSubscriber.start_async
(self)
Return the fake device manager.
Return the fake device manager.
async def start_async(self) -> DeviceManager: """Return the fake device manager.""" return self._device_manager
[ "async", "def", "start_async", "(", "self", ")", "->", "DeviceManager", ":", "return", "self", ".", "_device_manager" ]
[ 67, 4 ]
[ 69, 35 ]
python
en
['en', 'en', 'en']
True
FakeSubscriber.async_get_device_manager
(self)
Return the fake device manager.
Return the fake device manager.
async def async_get_device_manager(self) -> DeviceManager: """Return the fake device manager.""" return self._device_manager
[ "async", "def", "async_get_device_manager", "(", "self", ")", "->", "DeviceManager", ":", "return", "self", ".", "_device_manager" ]
[ 71, 4 ]
[ 73, 35 ]
python
en
['en', 'en', 'en']
True
FakeSubscriber.stop_async
(self)
No-op to stop the subscriber.
No-op to stop the subscriber.
def stop_async(self): """No-op to stop the subscriber.""" return None
[ "def", "stop_async", "(", "self", ")", ":", "return", "None" ]
[ 75, 4 ]
[ 77, 19 ]
python
en
['en', 'en', 'en']
True
FakeSubscriber.receive_event
(self, event_message: EventMessage)
Simulate a received pubsub message, invoked by tests.
Simulate a received pubsub message, invoked by tests.
def receive_event(self, event_message: EventMessage): """Simulate a received pubsub message, invoked by tests.""" # Update device state, then invoke HomeAssistant to refresh self._device_manager.handle_event(event_message) self._callback.handle_event(event_message)
[ "def", "receive_event", "(", "self", ",", "event_message", ":", "EventMessage", ")", ":", "# Update device state, then invoke HomeAssistant to refresh", "self", ".", "_device_manager", ".", "handle_event", "(", "event_message", ")", "self", ".", "_callback", ".", "handl...
[ 79, 4 ]
[ 83, 50 ]
python
en
['en', 'en', 'en']
True
setup
(hass, config)
Set up the Skybell component.
Set up the Skybell component.
def setup(hass, config): """Set up the Skybell component.""" conf = config[DOMAIN] username = conf.get(CONF_USERNAME) password = conf.get(CONF_PASSWORD) try: cache = hass.config.path(DEFAULT_CACHEDB) skybell = Skybell( username=username, password=password, ...
[ "def", "setup", "(", "hass", ",", "config", ")", ":", "conf", "=", "config", "[", "DOMAIN", "]", "username", "=", "conf", ".", "get", "(", "CONF_USERNAME", ")", "password", "=", "conf", ".", "get", "(", "CONF_PASSWORD", ")", "try", ":", "cache", "=",...
[ 42, 0 ]
[ 69, 15 ]
python
en
['en', 'en', 'en']
True
SkybellDevice.__init__
(self, device)
Initialize a sensor for Skybell device.
Initialize a sensor for Skybell device.
def __init__(self, device): """Initialize a sensor for Skybell device.""" self._device = device
[ "def", "__init__", "(", "self", ",", "device", ")", ":", "self", ".", "_device", "=", "device" ]
[ 75, 4 ]
[ 77, 29 ]
python
en
['en', 'en', 'en']
True
SkybellDevice.update
(self)
Update automation state.
Update automation state.
def update(self): """Update automation state.""" self._device.refresh()
[ "def", "update", "(", "self", ")", ":", "self", ".", "_device", ".", "refresh", "(", ")" ]
[ 79, 4 ]
[ 81, 30 ]
python
en
['de', 'en', 'en']
True
SkybellDevice.device_state_attributes
(self)
Return the state attributes.
Return the state attributes.
def device_state_attributes(self): """Return the state attributes.""" return { ATTR_ATTRIBUTION: ATTRIBUTION, "device_id": self._device.device_id, "status": self._device.status, "location": self._device.location, "wifi_ssid": self._device.wifi_...
[ "def", "device_state_attributes", "(", "self", ")", ":", "return", "{", "ATTR_ATTRIBUTION", ":", "ATTRIBUTION", ",", "\"device_id\"", ":", "self", ".", "_device", ".", "device_id", ",", "\"status\"", ":", "self", ".", "_device", ".", "status", ",", "\"location...
[ 84, 4 ]
[ 96, 9 ]
python
en
['en', 'en', 'en']
True
setup_platform
(hass, config, add_entities, discovery_info=None)
Set up the Bizkaibus public transport sensor.
Set up the Bizkaibus public transport sensor.
def setup_platform(hass, config, add_entities, discovery_info=None): """Set up the Bizkaibus public transport sensor.""" name = config[CONF_NAME] stop = config[CONF_STOP_ID] route = config[CONF_ROUTE] data = Bizkaibus(stop, route) add_entities([BizkaibusSensor(data, stop, route, name)], True)
[ "def", "setup_platform", "(", "hass", ",", "config", ",", "add_entities", ",", "discovery_info", "=", "None", ")", ":", "name", "=", "config", "[", "CONF_NAME", "]", "stop", "=", "config", "[", "CONF_STOP_ID", "]", "route", "=", "config", "[", "CONF_ROUTE"...
[ 25, 0 ]
[ 32, 66 ]
python
en
['en', 'sq', 'ur']
False
BizkaibusSensor.__init__
(self, data, stop, route, name)
Initialize the sensor.
Initialize the sensor.
def __init__(self, data, stop, route, name): """Initialize the sensor.""" self.data = data self.stop = stop self.route = route self._name = name self._state = None
[ "def", "__init__", "(", "self", ",", "data", ",", "stop", ",", "route", ",", "name", ")", ":", "self", ".", "data", "=", "data", "self", ".", "stop", "=", "stop", "self", ".", "route", "=", "route", "self", ".", "_name", "=", "name", "self", ".",...
[ 38, 4 ]
[ 44, 26 ]
python
en
['en', 'en', 'en']
True
BizkaibusSensor.name
(self)
Return the name of the sensor.
Return the name of the sensor.
def name(self): """Return the name of the sensor.""" return self._name
[ "def", "name", "(", "self", ")", ":", "return", "self", ".", "_name" ]
[ 47, 4 ]
[ 49, 25 ]
python
en
['en', 'mi', 'en']
True
BizkaibusSensor.state
(self)
Return the state of the sensor.
Return the state of the sensor.
def state(self): """Return the state of the sensor.""" return self._state
[ "def", "state", "(", "self", ")", ":", "return", "self", ".", "_state" ]
[ 52, 4 ]
[ 54, 26 ]
python
en
['en', 'en', 'en']
True
BizkaibusSensor.unit_of_measurement
(self)
Return the unit of measurement of the sensor.
Return the unit of measurement of the sensor.
def unit_of_measurement(self): """Return the unit of measurement of the sensor.""" return TIME_MINUTES
[ "def", "unit_of_measurement", "(", "self", ")", ":", "return", "TIME_MINUTES" ]
[ 57, 4 ]
[ 59, 27 ]
python
en
['en', 'bg', 'en']
True
BizkaibusSensor.update
(self)
Get the latest data from the webservice.
Get the latest data from the webservice.
def update(self): """Get the latest data from the webservice.""" self.data.update() try: self._state = self.data.info[0][ATTR_DUE_IN] except TypeError: pass
[ "def", "update", "(", "self", ")", ":", "self", ".", "data", ".", "update", "(", ")", "try", ":", "self", ".", "_state", "=", "self", ".", "data", ".", "info", "[", "0", "]", "[", "ATTR_DUE_IN", "]", "except", "TypeError", ":", "pass" ]
[ 61, 4 ]
[ 67, 16 ]
python
en
['en', 'en', 'en']
True
Bizkaibus.__init__
(self, stop, route)
Initialize the data object.
Initialize the data object.
def __init__(self, stop, route): """Initialize the data object.""" self.stop = stop self.route = route self.info = None
[ "def", "__init__", "(", "self", ",", "stop", ",", "route", ")", ":", "self", ".", "stop", "=", "stop", "self", ".", "route", "=", "route", "self", ".", "info", "=", "None" ]
[ 73, 4 ]
[ 77, 24 ]
python
en
['en', 'en', 'en']
True
Bizkaibus.update
(self)
Retrieve the information from API.
Retrieve the information from API.
def update(self): """Retrieve the information from API.""" bridge = BizkaibusData(self.stop, self.route) bridge.getNextBus() self.info = bridge.info
[ "def", "update", "(", "self", ")", ":", "bridge", "=", "BizkaibusData", "(", "self", ".", "stop", ",", "self", ".", "route", ")", "bridge", ".", "getNextBus", "(", ")", "self", ".", "info", "=", "bridge", ".", "info" ]
[ 79, 4 ]
[ 83, 31 ]
python
en
['en', 'pt', 'en']
True
test_show_user_form
(hass: HomeAssistant)
Test that the user set up form is served.
Test that the user set up form is served.
async def test_show_user_form(hass: HomeAssistant) -> None: """Test that the user set up form is served.""" result = await hass.config_entries.flow.async_init( config_flow.DOMAIN, context={"source": SOURCE_USER}, ) assert result["step_id"] == "user" assert result["type"] == data_ent...
[ "async", "def", "test_show_user_form", "(", "hass", ":", "HomeAssistant", ")", "->", "None", ":", "result", "=", "await", "hass", ".", "config_entries", ".", "flow", ".", "async_init", "(", "config_flow", ".", "DOMAIN", ",", "context", "=", "{", "\"source\""...
[ 16, 0 ]
[ 24, 61 ]
python
en
['en', 'en', 'en']
True
test_show_zeroconf_confirm_form
(hass: HomeAssistant)
Test that the zeroconf confirmation form is served.
Test that the zeroconf confirmation form is served.
async def test_show_zeroconf_confirm_form(hass: HomeAssistant) -> None: """Test that the zeroconf confirmation form is served.""" flow = config_flow.ElgatoFlowHandler() flow.hass = hass flow.context = {"source": SOURCE_ZEROCONF, CONF_SERIAL_NUMBER: "12345"} result = await flow.async_step_zeroconf_co...
[ "async", "def", "test_show_zeroconf_confirm_form", "(", "hass", ":", "HomeAssistant", ")", "->", "None", ":", "flow", "=", "config_flow", ".", "ElgatoFlowHandler", "(", ")", "flow", ".", "hass", "=", "hass", "flow", ".", "context", "=", "{", "\"source\"", ":...
[ 27, 0 ]
[ 36, 61 ]
python
en
['en', 'en', 'en']
True
test_show_zerconf_form
( hass: HomeAssistant, aioclient_mock: AiohttpClientMocker )
Test that the zeroconf confirmation form is served.
Test that the zeroconf confirmation form is served.
async def test_show_zerconf_form( hass: HomeAssistant, aioclient_mock: AiohttpClientMocker ) -> None: """Test that the zeroconf confirmation form is served.""" aioclient_mock.get( "http://1.2.3.4:9123/elgato/accessory-info", text=load_fixture("elgato/info.json"), headers={"Content-Ty...
[ "async", "def", "test_show_zerconf_form", "(", "hass", ":", "HomeAssistant", ",", "aioclient_mock", ":", "AiohttpClientMocker", ")", "->", "None", ":", "aioclient_mock", ".", "get", "(", "\"http://1.2.3.4:9123/elgato/accessory-info\"", ",", "text", "=", "load_fixture", ...
[ 39, 0 ]
[ 59, 61 ]
python
en
['en', 'en', 'en']
True
test_connection_error
( hass: HomeAssistant, aioclient_mock: AiohttpClientMocker )
Test we show user form on Elgato Key Light connection error.
Test we show user form on Elgato Key Light connection error.
async def test_connection_error( hass: HomeAssistant, aioclient_mock: AiohttpClientMocker ) -> None: """Test we show user form on Elgato Key Light connection error.""" aioclient_mock.get("http://1.2.3.4/elgato/accessory-info", exc=aiohttp.ClientError) result = await hass.config_entries.flow.async_init(...
[ "async", "def", "test_connection_error", "(", "hass", ":", "HomeAssistant", ",", "aioclient_mock", ":", "AiohttpClientMocker", ")", "->", "None", ":", "aioclient_mock", ".", "get", "(", "\"http://1.2.3.4/elgato/accessory-info\"", ",", "exc", "=", "aiohttp", ".", "Cl...
[ 62, 0 ]
[ 76, 61 ]
python
en
['en', 'en', 'en']
True
test_zeroconf_connection_error
( hass: HomeAssistant, aioclient_mock: AiohttpClientMocker )
Test we abort zeroconf flow on Elgato Key Light connection error.
Test we abort zeroconf flow on Elgato Key Light connection error.
async def test_zeroconf_connection_error( hass: HomeAssistant, aioclient_mock: AiohttpClientMocker ) -> None: """Test we abort zeroconf flow on Elgato Key Light connection error.""" aioclient_mock.get("http://1.2.3.4/elgato/accessory-info", exc=aiohttp.ClientError) result = await hass.config_entries.fl...
[ "async", "def", "test_zeroconf_connection_error", "(", "hass", ":", "HomeAssistant", ",", "aioclient_mock", ":", "AiohttpClientMocker", ")", "->", "None", ":", "aioclient_mock", ".", "get", "(", "\"http://1.2.3.4/elgato/accessory-info\"", ",", "exc", "=", "aiohttp", "...
[ 79, 0 ]
[ 92, 62 ]
python
en
['en', 'sr', 'en']
True
test_zeroconf_confirm_connection_error
( hass: HomeAssistant, aioclient_mock: AiohttpClientMocker )
Test we abort zeroconf flow on Elgato Key Light connection error.
Test we abort zeroconf flow on Elgato Key Light connection error.
async def test_zeroconf_confirm_connection_error( hass: HomeAssistant, aioclient_mock: AiohttpClientMocker ) -> None: """Test we abort zeroconf flow on Elgato Key Light connection error.""" aioclient_mock.get("http://1.2.3.4/elgato/accessory-info", exc=aiohttp.ClientError) flow = config_flow.ElgatoFlow...
[ "async", "def", "test_zeroconf_confirm_connection_error", "(", "hass", ":", "HomeAssistant", ",", "aioclient_mock", ":", "AiohttpClientMocker", ")", "->", "None", ":", "aioclient_mock", ".", "get", "(", "\"http://1.2.3.4/elgato/accessory-info\"", ",", "exc", "=", "aioht...
[ 95, 0 ]
[ 113, 62 ]
python
en
['en', 'sr', 'en']
True
test_zeroconf_no_data
( hass: HomeAssistant, aioclient_mock: AiohttpClientMocker )
Test we abort if zeroconf provides no data.
Test we abort if zeroconf provides no data.
async def test_zeroconf_no_data( hass: HomeAssistant, aioclient_mock: AiohttpClientMocker ) -> None: """Test we abort if zeroconf provides no data.""" flow = config_flow.ElgatoFlowHandler() flow.hass = hass result = await flow.async_step_zeroconf() assert result["reason"] == "cannot_connect" ...
[ "async", "def", "test_zeroconf_no_data", "(", "hass", ":", "HomeAssistant", ",", "aioclient_mock", ":", "AiohttpClientMocker", ")", "->", "None", ":", "flow", "=", "config_flow", ".", "ElgatoFlowHandler", "(", ")", "flow", ".", "hass", "=", "hass", "result", "...
[ 116, 0 ]
[ 125, 62 ]
python
de
['pt', 'de', 'en']
False
test_user_device_exists_abort
( hass: HomeAssistant, aioclient_mock: AiohttpClientMocker )
Test we abort zeroconf flow if Elgato Key Light device already configured.
Test we abort zeroconf flow if Elgato Key Light device already configured.
async def test_user_device_exists_abort( hass: HomeAssistant, aioclient_mock: AiohttpClientMocker ) -> None: """Test we abort zeroconf flow if Elgato Key Light device already configured.""" await init_integration(hass, aioclient_mock) result = await hass.config_entries.flow.async_init( config_f...
[ "async", "def", "test_user_device_exists_abort", "(", "hass", ":", "HomeAssistant", ",", "aioclient_mock", ":", "AiohttpClientMocker", ")", "->", "None", ":", "await", "init_integration", "(", "hass", ",", "aioclient_mock", ")", "result", "=", "await", "hass", "."...
[ 128, 0 ]
[ 140, 62 ]
python
de
['de', 'sr', 'en']
False
test_zeroconf_device_exists_abort
( hass: HomeAssistant, aioclient_mock: AiohttpClientMocker )
Test we abort zeroconf flow if Elgato Key Light device already configured.
Test we abort zeroconf flow if Elgato Key Light device already configured.
async def test_zeroconf_device_exists_abort( hass: HomeAssistant, aioclient_mock: AiohttpClientMocker ) -> None: """Test we abort zeroconf flow if Elgato Key Light device already configured.""" await init_integration(hass, aioclient_mock) result = await hass.config_entries.flow.async_init( conf...
[ "async", "def", "test_zeroconf_device_exists_abort", "(", "hass", ":", "HomeAssistant", ",", "aioclient_mock", ":", "AiohttpClientMocker", ")", "->", "None", ":", "await", "init_integration", "(", "hass", ",", "aioclient_mock", ")", "result", "=", "await", "hass", ...
[ 143, 0 ]
[ 168, 50 ]
python
de
['de', 'sr', 'en']
False
test_full_user_flow_implementation
( hass: HomeAssistant, aioclient_mock )
Test the full manual user flow from start to finish.
Test the full manual user flow from start to finish.
async def test_full_user_flow_implementation( hass: HomeAssistant, aioclient_mock ) -> None: """Test the full manual user flow from start to finish.""" aioclient_mock.get( "http://1.2.3.4:9123/elgato/accessory-info", text=load_fixture("elgato/info.json"), headers={"Content-Type": CON...
[ "async", "def", "test_full_user_flow_implementation", "(", "hass", ":", "HomeAssistant", ",", "aioclient_mock", ")", "->", "None", ":", "aioclient_mock", ".", "get", "(", "\"http://1.2.3.4:9123/elgato/accessory-info\"", ",", "text", "=", "load_fixture", "(", "\"elgato/i...
[ 171, 0 ]
[ 200, 49 ]
python
en
['en', 'en', 'en']
True
test_full_zeroconf_flow_implementation
( hass: HomeAssistant, aioclient_mock: AiohttpClientMocker )
Test the full manual user flow from start to finish.
Test the full manual user flow from start to finish.
async def test_full_zeroconf_flow_implementation( hass: HomeAssistant, aioclient_mock: AiohttpClientMocker ) -> None: """Test the full manual user flow from start to finish.""" aioclient_mock.get( "http://1.2.3.4:9123/elgato/accessory-info", text=load_fixture("elgato/info.json"), hea...
[ "async", "def", "test_full_zeroconf_flow_implementation", "(", "hass", ":", "HomeAssistant", ",", "aioclient_mock", ":", "AiohttpClientMocker", ")", "->", "None", ":", "aioclient_mock", ".", "get", "(", "\"http://1.2.3.4:9123/elgato/accessory-info\"", ",", "text", "=", ...
[ 203, 0 ]
[ 230, 69 ]
python
en
['en', 'en', 'en']
True
setup_platform
(hass, config, add_entities, discovery_info=None)
Set up the Nextcloud sensors.
Set up the Nextcloud sensors.
def setup_platform(hass, config, add_entities, discovery_info=None): """Set up the Nextcloud sensors.""" if discovery_info is None: return binary_sensors = [] for name in hass.data[DOMAIN]: if name in BINARY_SENSORS: binary_sensors.append(NextcloudBinarySensor(name)) add_...
[ "def", "setup_platform", "(", "hass", ",", "config", ",", "add_entities", ",", "discovery_info", "=", "None", ")", ":", "if", "discovery_info", "is", "None", ":", "return", "binary_sensors", "=", "[", "]", "for", "name", "in", "hass", ".", "data", "[", "...
[ 6, 0 ]
[ 14, 38 ]
python
en
['en', 'su', 'en']
True
NextcloudBinarySensor.__init__
(self, item)
Initialize the Nextcloud binary sensor.
Initialize the Nextcloud binary sensor.
def __init__(self, item): """Initialize the Nextcloud binary sensor.""" self._name = item self._is_on = None
[ "def", "__init__", "(", "self", ",", "item", ")", ":", "self", ".", "_name", "=", "item", "self", ".", "_is_on", "=", "None" ]
[ 20, 4 ]
[ 23, 26 ]
python
en
['en', 'zh-Latn', 'en']
True
NextcloudBinarySensor.icon
(self)
Return the icon for this binary sensor.
Return the icon for this binary sensor.
def icon(self): """Return the icon for this binary sensor.""" return "mdi:cloud"
[ "def", "icon", "(", "self", ")", ":", "return", "\"mdi:cloud\"" ]
[ 26, 4 ]
[ 28, 26 ]
python
en
['en', 'en', 'en']
True
NextcloudBinarySensor.name
(self)
Return the name for this binary sensor.
Return the name for this binary sensor.
def name(self): """Return the name for this binary sensor.""" return self._name
[ "def", "name", "(", "self", ")", ":", "return", "self", ".", "_name" ]
[ 31, 4 ]
[ 33, 25 ]
python
en
['en', 'ceb', 'en']
True
NextcloudBinarySensor.is_on
(self)
Return true if the binary sensor is on.
Return true if the binary sensor is on.
def is_on(self): """Return true if the binary sensor is on.""" return self._is_on == "yes"
[ "def", "is_on", "(", "self", ")", ":", "return", "self", ".", "_is_on", "==", "\"yes\"" ]
[ 36, 4 ]
[ 38, 35 ]
python
en
['en', 'fy', 'en']
True
NextcloudBinarySensor.unique_id
(self)
Return the unique ID for this binary sensor.
Return the unique ID for this binary sensor.
def unique_id(self): """Return the unique ID for this binary sensor.""" return f"{self.hass.data[DOMAIN]['instance']}#{self._name}"
[ "def", "unique_id", "(", "self", ")", ":", "return", "f\"{self.hass.data[DOMAIN]['instance']}#{self._name}\"" ]
[ 41, 4 ]
[ 43, 67 ]
python
en
['en', 'en', 'en']
True
NextcloudBinarySensor.update
(self)
Update the binary sensor.
Update the binary sensor.
def update(self): """Update the binary sensor.""" self._is_on = self.hass.data[DOMAIN][self._name]
[ "def", "update", "(", "self", ")", ":", "self", ".", "_is_on", "=", "self", ".", "hass", ".", "data", "[", "DOMAIN", "]", "[", "self", ".", "_name", "]" ]
[ 45, 4 ]
[ 47, 56 ]
python
en
['en', 'sn', 'en']
True
vera_component_factory
()
Return a factory for initializing the vera component.
Return a factory for initializing the vera component.
def vera_component_factory(): """Return a factory for initializing the vera component.""" with patch("pyvera.VeraController") as vera_controller_class_mock: yield ComponentFactory(vera_controller_class_mock)
[ "def", "vera_component_factory", "(", ")", ":", "with", "patch", "(", "\"pyvera.VeraController\"", ")", "as", "vera_controller_class_mock", ":", "yield", "ComponentFactory", "(", "vera_controller_class_mock", ")" ]
[ 10, 0 ]
[ 13, 58 ]
python
en
['en', 'en', 'en']
True
TestLiteJetScene.setup_method
(self, method, mock_pylitejet)
Set up things to be run when tests are started.
Set up things to be run when tests are started.
def setup_method(self, method, mock_pylitejet): """Set up things to be run when tests are started.""" self.hass = get_test_home_assistant() self.hass.start() def get_scene_name(number): return f"Mock Scene #{number}" self.mock_lj = mock_pylitejet.return_value ...
[ "def", "setup_method", "(", "self", ",", "method", ",", "mock_pylitejet", ")", ":", "self", ".", "hass", "=", "get_test_home_assistant", "(", ")", "self", ".", "hass", ".", "start", "(", ")", "def", "get_scene_name", "(", "number", ")", ":", "return", "f...
[ 23, 4 ]
[ 43, 35 ]
python
en
['en', 'en', 'en']
True
TestLiteJetScene.teardown_method
(self, method)
Stop everything that was started.
Stop everything that was started.
def teardown_method(self, method): """Stop everything that was started.""" self.hass.stop()
[ "def", "teardown_method", "(", "self", ",", "method", ")", ":", "self", ".", "hass", ".", "stop", "(", ")" ]
[ 45, 4 ]
[ 47, 24 ]
python
en
['en', 'en', 'en']
True
TestLiteJetScene.scene
(self)
Get the current scene.
Get the current scene.
def scene(self): """Get the current scene.""" return self.hass.states.get(ENTITY_SCENE)
[ "def", "scene", "(", "self", ")", ":", "return", "self", ".", "hass", ".", "states", ".", "get", "(", "ENTITY_SCENE", ")" ]
[ 49, 4 ]
[ 51, 49 ]
python
en
['en', 'en', 'en']
True
TestLiteJetScene.other_scene
(self)
Get the other scene.
Get the other scene.
def other_scene(self): """Get the other scene.""" return self.hass.states.get(ENTITY_OTHER_SCENE)
[ "def", "other_scene", "(", "self", ")", ":", "return", "self", ".", "hass", ".", "states", ".", "get", "(", "ENTITY_OTHER_SCENE", ")" ]
[ 53, 4 ]
[ 55, 55 ]
python
en
['en', 'en', 'en']
True
TestLiteJetScene.test_activate
(self)
Test activating the scene.
Test activating the scene.
def test_activate(self): """Test activating the scene.""" common.activate(self.hass, ENTITY_SCENE) self.hass.block_till_done() self.mock_lj.activate_scene.assert_called_once_with(ENTITY_SCENE_NUMBER)
[ "def", "test_activate", "(", "self", ")", ":", "common", ".", "activate", "(", "self", ".", "hass", ",", "ENTITY_SCENE", ")", "self", ".", "hass", ".", "block_till_done", "(", ")", "self", ".", "mock_lj", ".", "activate_scene", ".", "assert_called_once_with"...
[ 57, 4 ]
[ 61, 80 ]
python
en
['en', 'en', 'en']
True
init_integration
(hass)
Set up the Met integration in Home Assistant.
Set up the Met integration in Home Assistant.
async def init_integration(hass) -> MockConfigEntry: """Set up the Met integration in Home Assistant.""" entry_data = { CONF_NAME: "test", CONF_LATITUDE: 0, CONF_LONGITUDE: 0, CONF_ELEVATION: 0, } entry = MockConfigEntry(domain=DOMAIN, data=entry_data) with patch( ...
[ "async", "def", "init_integration", "(", "hass", ")", "->", "MockConfigEntry", ":", "entry_data", "=", "{", "CONF_NAME", ":", "\"test\"", ",", "CONF_LATITUDE", ":", "0", ",", "CONF_LONGITUDE", ":", "0", ",", "CONF_ELEVATION", ":", "0", ",", "}", "entry", "...
[ 8, 0 ]
[ 25, 16 ]
python
en
['en', 'en', 'en']
True
MBartTokenizer.get_special_tokens_mask
( self, token_ids_0: List[int], token_ids_1: Optional[List[int]] = None, already_has_special_tokens: bool = False )
Retrieve sequence ids from a token list that has no special tokens added. This method is called when adding special tokens using the tokenizer ``prepare_for_model`` method. Args: token_ids_0 (:obj:`List[int]`): List of IDs. token_ids_1 (:obj:`List[int]`,...
Retrieve sequence ids from a token list that has no special tokens added. This method is called when adding special tokens using the tokenizer ``prepare_for_model`` method.
def get_special_tokens_mask( self, token_ids_0: List[int], token_ids_1: Optional[List[int]] = None, already_has_special_tokens: bool = False ) -> List[int]: """ Retrieve sequence ids from a token list that has no special tokens added. This method is called when adding special tokens ...
[ "def", "get_special_tokens_mask", "(", "self", ",", "token_ids_0", ":", "List", "[", "int", "]", ",", "token_ids_1", ":", "Optional", "[", "List", "[", "int", "]", "]", "=", "None", ",", "already_has_special_tokens", ":", "bool", "=", "False", ")", "->", ...
[ 131, 4 ]
[ 161, 94 ]
python
en
['en', 'error', 'th']
False
MBartTokenizer.build_inputs_with_special_tokens
( self, token_ids_0: List[int], token_ids_1: Optional[List[int]] = None )
Build model inputs from a sequence or a pair of sequence for sequence classification tasks by concatenating and adding special tokens. An MBART sequence has the following format, where ``X`` represents the sequence: - ``input_ids`` (for encoder) ``X [eos, src_lang_code]`` - ``decoder_i...
Build model inputs from a sequence or a pair of sequence for sequence classification tasks by concatenating and adding special tokens. An MBART sequence has the following format, where ``X`` represents the sequence:
def build_inputs_with_special_tokens( self, token_ids_0: List[int], token_ids_1: Optional[List[int]] = None ) -> List[int]: """ Build model inputs from a sequence or a pair of sequence for sequence classification tasks by concatenating and adding special tokens. An MBART sequence has...
[ "def", "build_inputs_with_special_tokens", "(", "self", ",", "token_ids_0", ":", "List", "[", "int", "]", ",", "token_ids_1", ":", "Optional", "[", "List", "[", "int", "]", "]", "=", "None", ")", "->", "List", "[", "int", "]", ":", "if", "token_ids_1", ...
[ 163, 4 ]
[ 188, 82 ]
python
en
['en', 'error', 'th']
False
MBartTokenizer.as_target_tokenizer
(self)
Temporarily sets the tokenizer for encoding the targets. Useful for tokenizer associated to sequence-to-sequence models that need a slightly different processing for the labels.
Temporarily sets the tokenizer for encoding the targets. Useful for tokenizer associated to sequence-to-sequence models that need a slightly different processing for the labels.
def as_target_tokenizer(self): """ Temporarily sets the tokenizer for encoding the targets. Useful for tokenizer associated to sequence-to-sequence models that need a slightly different processing for the labels. """ self.set_tgt_lang_special_tokens(self.tgt_lang) yield ...
[ "def", "as_target_tokenizer", "(", "self", ")", ":", "self", ".", "set_tgt_lang_special_tokens", "(", "self", ".", "tgt_lang", ")", "yield", "self", ".", "set_src_lang_special_tokens", "(", "self", ".", "src_lang", ")" ]
[ 203, 4 ]
[ 210, 55 ]
python
en
['en', 'error', 'th']
False
MBartTokenizer.set_src_lang_special_tokens
(self, src_lang)
Reset the special tokens to the source lang setting. No prefix and suffix=[eos, src_lang_code].
Reset the special tokens to the source lang setting. No prefix and suffix=[eos, src_lang_code].
def set_src_lang_special_tokens(self, src_lang) -> None: """Reset the special tokens to the source lang setting. No prefix and suffix=[eos, src_lang_code].""" self.cur_lang_code = self.lang_code_to_id[src_lang] self.prefix_tokens = [] self.suffix_tokens = [self.eos_token_id, self.cur_lan...
[ "def", "set_src_lang_special_tokens", "(", "self", ",", "src_lang", ")", "->", "None", ":", "self", ".", "cur_lang_code", "=", "self", ".", "lang_code_to_id", "[", "src_lang", "]", "self", ".", "prefix_tokens", "=", "[", "]", "self", ".", "suffix_tokens", "=...
[ 212, 4 ]
[ 216, 68 ]
python
en
['en', 'en', 'en']
True
MBartTokenizer.set_tgt_lang_special_tokens
(self, lang: str)
Reset the special tokens to the target language setting. No prefix and suffix=[eos, tgt_lang_code].
Reset the special tokens to the target language setting. No prefix and suffix=[eos, tgt_lang_code].
def set_tgt_lang_special_tokens(self, lang: str) -> None: """Reset the special tokens to the target language setting. No prefix and suffix=[eos, tgt_lang_code].""" self.cur_lang_code = self.lang_code_to_id[lang] self.prefix_tokens = [] self.suffix_tokens = [self.eos_token_id, self.cur_la...
[ "def", "set_tgt_lang_special_tokens", "(", "self", ",", "lang", ":", "str", ")", "->", "None", ":", "self", ".", "cur_lang_code", "=", "self", ".", "lang_code_to_id", "[", "lang", "]", "self", ".", "prefix_tokens", "=", "[", "]", "self", ".", "suffix_token...
[ 218, 4 ]
[ 222, 68 ]
python
en
['en', 'en', 'en']
True
async_setup_entry
( hass: HomeAssistant, config_entry: ConfigEntry, async_add_entities )
Set up the Firmata binary sensors.
Set up the Firmata binary sensors.
async def async_setup_entry( hass: HomeAssistant, config_entry: ConfigEntry, async_add_entities ) -> None: """Set up the Firmata binary sensors.""" new_entities = [] board = hass.data[DOMAIN][config_entry.entry_id] for binary_sensor in board.binary_sensors: pin = binary_sensor[CONF_PIN] ...
[ "async", "def", "async_setup_entry", "(", "hass", ":", "HomeAssistant", ",", "config_entry", ":", "ConfigEntry", ",", "async_add_entities", ")", "->", "None", ":", "new_entities", "=", "[", "]", "board", "=", "hass", ".", "data", "[", "DOMAIN", "]", "[", "...
[ 16, 0 ]
[ 41, 40 ]
python
en
['en', 'bg', 'en']
True
FirmataBinarySensor.async_added_to_hass
(self)
Set up a binary sensor.
Set up a binary sensor.
async def async_added_to_hass(self) -> None: """Set up a binary sensor.""" await self._api.start_pin(self.async_write_ha_state)
[ "async", "def", "async_added_to_hass", "(", "self", ")", "->", "None", ":", "await", "self", ".", "_api", ".", "start_pin", "(", "self", ".", "async_write_ha_state", ")" ]
[ 47, 4 ]
[ 49, 60 ]
python
en
['en', 'haw', 'en']
True
FirmataBinarySensor.async_will_remove_from_hass
(self)
Stop reporting a binary sensor.
Stop reporting a binary sensor.
async def async_will_remove_from_hass(self) -> None: """Stop reporting a binary sensor.""" await self._api.stop_pin()
[ "async", "def", "async_will_remove_from_hass", "(", "self", ")", "->", "None", ":", "await", "self", ".", "_api", ".", "stop_pin", "(", ")" ]
[ 51, 4 ]
[ 53, 34 ]
python
en
['en', 'id', 'en']
True
FirmataBinarySensor.is_on
(self)
Return true if binary sensor is on.
Return true if binary sensor is on.
def is_on(self) -> bool: """Return true if binary sensor is on.""" return self._api.is_on
[ "def", "is_on", "(", "self", ")", "->", "bool", ":", "return", "self", ".", "_api", ".", "is_on" ]
[ 56, 4 ]
[ 58, 30 ]
python
en
['en', 'fy', 'en']
True