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_send_power_off_device_timeout
(hass, discovery, device, mock_now)
Test for sending power off command to the device with a device timeout.
Test for sending power off command to the device with a device timeout.
async def test_send_power_off_device_timeout(hass, discovery, device, mock_now): """Test for sending power off command to the device with a device timeout.""" device().push_state_update.side_effect = DeviceTimeoutError await async_setup_gree(hass) assert await hass.services.async_call( DOMAIN,...
[ "async", "def", "test_send_power_off_device_timeout", "(", "hass", ",", "discovery", ",", "device", ",", "mock_now", ")", ":", "device", "(", ")", ".", "push_state_update", ".", "side_effect", "=", "DeviceTimeoutError", "await", "async_setup_gree", "(", "hass", ")...
[ 363, 0 ]
[ 378, 39 ]
python
en
['en', 'en', 'en']
True
test_send_target_temperature
(hass, discovery, device, units, temperature)
Test for sending target temperature command to the device.
Test for sending target temperature command to the device.
async def test_send_target_temperature(hass, discovery, device, units, temperature): """Test for sending target temperature command to the device.""" hass.config.units.temperature_unit = units fake_device = device() if units == TEMP_FAHRENHEIT: fake_device.temperature_units = 1 await async...
[ "async", "def", "test_send_target_temperature", "(", "hass", ",", "discovery", ",", "device", ",", "units", ",", "temperature", ")", ":", "hass", ".", "config", ".", "units", ".", "temperature_unit", "=", "units", "fake_device", "=", "device", "(", ")", "if"...
[ 384, 0 ]
[ 414, 53 ]
python
en
['en', 'en', 'en']
True
test_send_target_temperature_device_timeout
( hass, discovery, device, units, temperature )
Test for sending target temperature command to the device with a device timeout.
Test for sending target temperature command to the device with a device timeout.
async def test_send_target_temperature_device_timeout( hass, discovery, device, units, temperature ): """Test for sending target temperature command to the device with a device timeout.""" hass.config.units.temperature_unit = units if units == TEMP_FAHRENHEIT: device().temperature_units = 1 ...
[ "async", "def", "test_send_target_temperature_device_timeout", "(", "hass", ",", "discovery", ",", "device", ",", "units", ",", "temperature", ")", ":", "hass", ".", "config", ".", "units", ".", "temperature_unit", "=", "units", "if", "units", "==", "TEMP_FAHREN...
[ 420, 0 ]
[ 443, 53 ]
python
en
['en', 'en', 'en']
True
test_update_target_temperature
(hass, discovery, device, units, temperature)
Test for updating target temperature from the device.
Test for updating target temperature from the device.
async def test_update_target_temperature(hass, discovery, device, units, temperature): """Test for updating target temperature from the device.""" hass.config.units.temperature_unit = units if units == TEMP_FAHRENHEIT: device().temperature_units = 1 device().target_temperature = temperature ...
[ "async", "def", "test_update_target_temperature", "(", "hass", ",", "discovery", ",", "device", ",", "units", ",", "temperature", ")", ":", "hass", ".", "config", ".", "units", ".", "temperature_unit", "=", "units", "if", "units", "==", "TEMP_FAHRENHEIT", ":",...
[ 449, 0 ]
[ 463, 53 ]
python
en
['en', 'en', 'en']
True
test_send_preset_mode
(hass, discovery, device, mock_now, preset)
Test for sending preset mode command to the device.
Test for sending preset mode command to the device.
async def test_send_preset_mode(hass, discovery, device, mock_now, preset): """Test for sending preset mode command to the device.""" await async_setup_gree(hass) assert await hass.services.async_call( DOMAIN, SERVICE_SET_PRESET_MODE, {ATTR_ENTITY_ID: ENTITY_ID, ATTR_PRESET_MODE: pr...
[ "async", "def", "test_send_preset_mode", "(", "hass", ",", "discovery", ",", "device", ",", "mock_now", ",", "preset", ")", ":", "await", "async_setup_gree", "(", "hass", ")", "assert", "await", "hass", ".", "services", ".", "async_call", "(", "DOMAIN", ",",...
[ 469, 0 ]
[ 482, 59 ]
python
en
['en', 'en', 'en']
True
test_send_invalid_preset_mode
(hass, discovery, device, mock_now)
Test for sending preset mode command to the device.
Test for sending preset mode command to the device.
async def test_send_invalid_preset_mode(hass, discovery, device, mock_now): """Test for sending preset mode command to the device.""" await async_setup_gree(hass) with pytest.raises(ValueError): await hass.services.async_call( DOMAIN, SERVICE_SET_PRESET_MODE, {AT...
[ "async", "def", "test_send_invalid_preset_mode", "(", "hass", ",", "discovery", ",", "device", ",", "mock_now", ")", ":", "await", "async_setup_gree", "(", "hass", ")", "with", "pytest", ".", "raises", "(", "ValueError", ")", ":", "await", "hass", ".", "serv...
[ 485, 0 ]
[ 499, 62 ]
python
en
['en', 'en', 'en']
True
test_send_preset_mode_device_timeout
( hass, discovery, device, mock_now, preset )
Test for sending preset mode command to the device with a device timeout.
Test for sending preset mode command to the device with a device timeout.
async def test_send_preset_mode_device_timeout( hass, discovery, device, mock_now, preset ): """Test for sending preset mode command to the device with a device timeout.""" device().push_state_update.side_effect = DeviceTimeoutError await async_setup_gree(hass) assert await hass.services.async_cal...
[ "async", "def", "test_send_preset_mode_device_timeout", "(", "hass", ",", "discovery", ",", "device", ",", "mock_now", ",", "preset", ")", ":", "device", "(", ")", ".", "push_state_update", ".", "side_effect", "=", "DeviceTimeoutError", "await", "async_setup_gree", ...
[ 505, 0 ]
[ 522, 59 ]
python
en
['en', 'en', 'en']
True
test_update_preset_mode
(hass, discovery, device, mock_now, preset)
Test for updating preset mode from the device.
Test for updating preset mode from the device.
async def test_update_preset_mode(hass, discovery, device, mock_now, preset): """Test for updating preset mode from the device.""" device().steady_heat = preset == PRESET_AWAY device().power_save = preset == PRESET_ECO device().sleep = preset == PRESET_SLEEP device().turbo = preset == PRESET_BOOST ...
[ "async", "def", "test_update_preset_mode", "(", "hass", ",", "discovery", ",", "device", ",", "mock_now", ",", "preset", ")", ":", "device", "(", ")", ".", "steady_heat", "=", "preset", "==", "PRESET_AWAY", "device", "(", ")", ".", "power_save", "=", "pres...
[ 528, 0 ]
[ 539, 59 ]
python
en
['en', 'en', 'en']
True
test_send_hvac_mode
(hass, discovery, device, mock_now, hvac_mode)
Test for sending hvac mode command to the device.
Test for sending hvac mode command to the device.
async def test_send_hvac_mode(hass, discovery, device, mock_now, hvac_mode): """Test for sending hvac mode command to the device.""" await async_setup_gree(hass) assert await hass.services.async_call( DOMAIN, SERVICE_SET_HVAC_MODE, {ATTR_ENTITY_ID: ENTITY_ID, ATTR_HVAC_MODE: hvac_mo...
[ "async", "def", "test_send_hvac_mode", "(", "hass", ",", "discovery", ",", "device", ",", "mock_now", ",", "hvac_mode", ")", ":", "await", "async_setup_gree", "(", "hass", ")", "assert", "await", "hass", ".", "services", ".", "async_call", "(", "DOMAIN", ","...
[ 553, 0 ]
[ 566, 35 ]
python
en
['en', 'en', 'en']
True
test_send_hvac_mode_device_timeout
( hass, discovery, device, mock_now, hvac_mode )
Test for sending hvac mode command to the device with a device timeout.
Test for sending hvac mode command to the device with a device timeout.
async def test_send_hvac_mode_device_timeout( hass, discovery, device, mock_now, hvac_mode ): """Test for sending hvac mode command to the device with a device timeout.""" device().push_state_update.side_effect = DeviceTimeoutError await async_setup_gree(hass) assert await hass.services.async_call...
[ "async", "def", "test_send_hvac_mode_device_timeout", "(", "hass", ",", "discovery", ",", "device", ",", "mock_now", ",", "hvac_mode", ")", ":", "device", "(", ")", ".", "push_state_update", ".", "side_effect", "=", "DeviceTimeoutError", "await", "async_setup_gree",...
[ 573, 0 ]
[ 590, 35 ]
python
en
['en', 'en', 'en']
True
test_update_hvac_mode
(hass, discovery, device, mock_now, hvac_mode)
Test for updating hvac mode from the device.
Test for updating hvac mode from the device.
async def test_update_hvac_mode(hass, discovery, device, mock_now, hvac_mode): """Test for updating hvac mode from the device.""" device().power = hvac_mode != HVAC_MODE_OFF device().mode = HVAC_MODES_REVERSE.get(hvac_mode) await async_setup_gree(hass) state = hass.states.get(ENTITY_ID) assert...
[ "async", "def", "test_update_hvac_mode", "(", "hass", ",", "discovery", ",", "device", ",", "mock_now", ",", "hvac_mode", ")", ":", "device", "(", ")", ".", "power", "=", "hvac_mode", "!=", "HVAC_MODE_OFF", "device", "(", ")", ".", "mode", "=", "HVAC_MODES...
[ 604, 0 ]
[ 613, 35 ]
python
en
['en', 'en', 'en']
True
test_send_fan_mode
(hass, discovery, device, mock_now, fan_mode)
Test for sending fan mode command to the device.
Test for sending fan mode command to the device.
async def test_send_fan_mode(hass, discovery, device, mock_now, fan_mode): """Test for sending fan mode command to the device.""" await async_setup_gree(hass) assert await hass.services.async_call( DOMAIN, SERVICE_SET_FAN_MODE, {ATTR_ENTITY_ID: ENTITY_ID, ATTR_FAN_MODE: fan_mode}, ...
[ "async", "def", "test_send_fan_mode", "(", "hass", ",", "discovery", ",", "device", ",", "mock_now", ",", "fan_mode", ")", ":", "await", "async_setup_gree", "(", "hass", ")", "assert", "await", "hass", ".", "services", ".", "async_call", "(", "DOMAIN", ",", ...
[ 620, 0 ]
[ 633, 58 ]
python
en
['en', 'en', 'en']
True
test_send_invalid_fan_mode
(hass, discovery, device, mock_now)
Test for sending fan mode command to the device.
Test for sending fan mode command to the device.
async def test_send_invalid_fan_mode(hass, discovery, device, mock_now): """Test for sending fan mode command to the device.""" await async_setup_gree(hass) with pytest.raises(ValueError): await hass.services.async_call( DOMAIN, SERVICE_SET_FAN_MODE, {ATTR_ENTITY...
[ "async", "def", "test_send_invalid_fan_mode", "(", "hass", ",", "discovery", ",", "device", ",", "mock_now", ")", ":", "await", "async_setup_gree", "(", "hass", ")", "with", "pytest", ".", "raises", "(", "ValueError", ")", ":", "await", "hass", ".", "service...
[ 636, 0 ]
[ 650, 59 ]
python
en
['en', 'en', 'en']
True
test_send_fan_mode_device_timeout
( hass, discovery, device, mock_now, fan_mode )
Test for sending fan mode command to the device with a device timeout.
Test for sending fan mode command to the device with a device timeout.
async def test_send_fan_mode_device_timeout( hass, discovery, device, mock_now, fan_mode ): """Test for sending fan mode command to the device with a device timeout.""" device().push_state_update.side_effect = DeviceTimeoutError await async_setup_gree(hass) assert await hass.services.async_call( ...
[ "async", "def", "test_send_fan_mode_device_timeout", "(", "hass", ",", "discovery", ",", "device", ",", "mock_now", ",", "fan_mode", ")", ":", "device", "(", ")", ".", "push_state_update", ".", "side_effect", "=", "DeviceTimeoutError", "await", "async_setup_gree", ...
[ 657, 0 ]
[ 674, 58 ]
python
en
['en', 'en', 'en']
True
test_update_fan_mode
(hass, discovery, device, mock_now, fan_mode)
Test for updating fan mode from the device.
Test for updating fan mode from the device.
async def test_update_fan_mode(hass, discovery, device, mock_now, fan_mode): """Test for updating fan mode from the device.""" device().fan_speed = FAN_MODES_REVERSE.get(fan_mode) await async_setup_gree(hass) state = hass.states.get(ENTITY_ID) assert state is not None assert state.attributes.g...
[ "async", "def", "test_update_fan_mode", "(", "hass", ",", "discovery", ",", "device", ",", "mock_now", ",", "fan_mode", ")", ":", "device", "(", ")", ".", "fan_speed", "=", "FAN_MODES_REVERSE", ".", "get", "(", "fan_mode", ")", "await", "async_setup_gree", "...
[ 681, 0 ]
[ 689, 58 ]
python
en
['en', 'en', 'en']
True
test_send_swing_mode
(hass, discovery, device, mock_now, swing_mode)
Test for sending swing mode command to the device.
Test for sending swing mode command to the device.
async def test_send_swing_mode(hass, discovery, device, mock_now, swing_mode): """Test for sending swing mode command to the device.""" await async_setup_gree(hass) assert await hass.services.async_call( DOMAIN, SERVICE_SET_SWING_MODE, {ATTR_ENTITY_ID: ENTITY_ID, ATTR_SWING_MODE: sw...
[ "async", "def", "test_send_swing_mode", "(", "hass", ",", "discovery", ",", "device", ",", "mock_now", ",", "swing_mode", ")", ":", "await", "async_setup_gree", "(", "hass", ")", "assert", "await", "hass", ".", "services", ".", "async_call", "(", "DOMAIN", "...
[ 695, 0 ]
[ 708, 62 ]
python
en
['en', 'en', 'en']
True
test_send_invalid_swing_mode
(hass, discovery, device, mock_now)
Test for sending swing mode command to the device.
Test for sending swing mode command to the device.
async def test_send_invalid_swing_mode(hass, discovery, device, mock_now): """Test for sending swing mode command to the device.""" await async_setup_gree(hass) with pytest.raises(ValueError): await hass.services.async_call( DOMAIN, SERVICE_SET_SWING_MODE, {ATTR_...
[ "async", "def", "test_send_invalid_swing_mode", "(", "hass", ",", "discovery", ",", "device", ",", "mock_now", ")", ":", "await", "async_setup_gree", "(", "hass", ")", "with", "pytest", ".", "raises", "(", "ValueError", ")", ":", "await", "hass", ".", "servi...
[ 711, 0 ]
[ 725, 61 ]
python
en
['en', 'en', 'en']
True
test_send_swing_mode_device_timeout
( hass, discovery, device, mock_now, swing_mode )
Test for sending swing mode command to the device with a device timeout.
Test for sending swing mode command to the device with a device timeout.
async def test_send_swing_mode_device_timeout( hass, discovery, device, mock_now, swing_mode ): """Test for sending swing mode command to the device with a device timeout.""" device().push_state_update.side_effect = DeviceTimeoutError await async_setup_gree(hass) assert await hass.services.async_c...
[ "async", "def", "test_send_swing_mode_device_timeout", "(", "hass", ",", "discovery", ",", "device", ",", "mock_now", ",", "swing_mode", ")", ":", "device", "(", ")", ".", "push_state_update", ".", "side_effect", "=", "DeviceTimeoutError", "await", "async_setup_gree...
[ 731, 0 ]
[ 748, 62 ]
python
en
['en', 'en', 'en']
True
test_update_swing_mode
(hass, discovery, device, mock_now, swing_mode)
Test for updating swing mode from the device.
Test for updating swing mode from the device.
async def test_update_swing_mode(hass, discovery, device, mock_now, swing_mode): """Test for updating swing mode from the device.""" device().horizontal_swing = ( HorizontalSwing.FullSwing if swing_mode in (SWING_BOTH, SWING_HORIZONTAL) else HorizontalSwing.Default ) device().ver...
[ "async", "def", "test_update_swing_mode", "(", "hass", ",", "discovery", ",", "device", ",", "mock_now", ",", "swing_mode", ")", ":", "device", "(", ")", ".", "horizontal_swing", "=", "(", "HorizontalSwing", ".", "FullSwing", "if", "swing_mode", "in", "(", "...
[ 754, 0 ]
[ 771, 62 ]
python
en
['en', 'en', 'en']
True
test_name
(hass, discovery, device)
Test for name property.
Test for name property.
async def test_name(hass, discovery, device): """Test for name property.""" await async_setup_gree(hass) state = hass.states.get(ENTITY_ID) assert state.attributes[ATTR_FRIENDLY_NAME] == "fake-device-1"
[ "async", "def", "test_name", "(", "hass", ",", "discovery", ",", "device", ")", ":", "await", "async_setup_gree", "(", "hass", ")", "state", "=", "hass", ".", "states", ".", "get", "(", "ENTITY_ID", ")", "assert", "state", ".", "attributes", "[", "ATTR_F...
[ 774, 0 ]
[ 778, 66 ]
python
en
['en', 'en', 'en']
True
test_supported_features_with_turnon
(hass, discovery, device)
Test for supported_features property.
Test for supported_features property.
async def test_supported_features_with_turnon(hass, discovery, device): """Test for supported_features property.""" await async_setup_gree(hass) state = hass.states.get(ENTITY_ID) assert state.attributes[ATTR_SUPPORTED_FEATURES] == SUPPORTED_FEATURES
[ "async", "def", "test_supported_features_with_turnon", "(", "hass", ",", "discovery", ",", "device", ")", ":", "await", "async_setup_gree", "(", "hass", ")", "state", "=", "hass", ".", "states", ".", "get", "(", "ENTITY_ID", ")", "assert", "state", ".", "att...
[ 781, 0 ]
[ 785, 74 ]
python
en
['en', 'en', 'en']
True
async_setup_platform
(hass, config, async_add_entities, discovery_info=None)
Set up the eight sleep binary sensor.
Set up the eight sleep binary sensor.
async def async_setup_platform(hass, config, async_add_entities, discovery_info=None): """Set up the eight sleep binary sensor.""" if discovery_info is None: return name = "Eight" sensors = discovery_info[CONF_BINARY_SENSORS] eight = hass.data[DATA_EIGHT] all_sensors = [] for sens...
[ "async", "def", "async_setup_platform", "(", "hass", ",", "config", ",", "async_add_entities", ",", "discovery_info", "=", "None", ")", ":", "if", "discovery_info", "is", "None", ":", "return", "name", "=", "\"Eight\"", "sensors", "=", "discovery_info", "[", "...
[ 13, 0 ]
[ 27, 41 ]
python
en
['en', 'ceb', 'en']
True
EightHeatSensor.__init__
(self, name, eight, sensor)
Initialize the sensor.
Initialize the sensor.
def __init__(self, name, eight, sensor): """Initialize the sensor.""" super().__init__(eight) self._sensor = sensor self._mapped_name = NAME_MAP.get(self._sensor, self._sensor) self._state = None self._side = self._sensor.split("_")[0] self._userid = self._eight...
[ "def", "__init__", "(", "self", ",", "name", ",", "eight", ",", "sensor", ")", ":", "super", "(", ")", ".", "__init__", "(", "eight", ")", "self", ".", "_sensor", "=", "sensor", "self", ".", "_mapped_name", "=", "NAME_MAP", ".", "get", "(", "self", ...
[ 33, 4 ]
[ 53, 9 ]
python
en
['en', 'en', 'en']
True
EightHeatSensor.is_on
(self)
Return true if the binary sensor is on.
Return true if the binary sensor is on.
def is_on(self): """Return true if the binary sensor is on.""" return self._state
[ "def", "is_on", "(", "self", ")", ":", "return", "self", ".", "_state" ]
[ 56, 4 ]
[ 58, 26 ]
python
en
['en', 'fy', 'en']
True
EightHeatSensor.async_update
(self)
Retrieve latest state.
Retrieve latest state.
async def async_update(self): """Retrieve latest state.""" self._state = self._usrobj.bed_presence
[ "async", "def", "async_update", "(", "self", ")", ":", "self", ".", "_state", "=", "self", ".", "_usrobj", ".", "bed_presence" ]
[ 60, 4 ]
[ 62, 47 ]
python
en
['es', 'sk', 'en']
False
DiscardUnknownPropertiesTests.test_deserialize_banana_req_do_not_discard_unknown_properties
(self)
deserialize bananaReq with unknown properties. Strict validation is enabled. Simple (non-composed) schema scenario.
deserialize bananaReq with unknown properties. Strict validation is enabled. Simple (non-composed) schema scenario.
def test_deserialize_banana_req_do_not_discard_unknown_properties(self): """ deserialize bananaReq with unknown properties. Strict validation is enabled. Simple (non-composed) schema scenario. """ config = Configuration(discard_unknown_keys=False) api_client = pet...
[ "def", "test_deserialize_banana_req_do_not_discard_unknown_properties", "(", "self", ")", ":", "config", "=", "Configuration", "(", "discard_unknown_keys", "=", "False", ")", "api_client", "=", "petstore_api", ".", "ApiClient", "(", "config", ")", "data", "=", "{", ...
[ 30, 4 ]
[ 53, 63 ]
python
en
['en', 'error', 'th']
False
DiscardUnknownPropertiesTests.test_deserialize_isosceles_triangle_do_not_discard_unknown_properties
(self)
deserialize IsoscelesTriangle with unknown properties. Strict validation is enabled. Composed schema scenario.
deserialize IsoscelesTriangle with unknown properties. Strict validation is enabled. Composed schema scenario.
def test_deserialize_isosceles_triangle_do_not_discard_unknown_properties(self): """ deserialize IsoscelesTriangle with unknown properties. Strict validation is enabled. Composed schema scenario. """ config = Configuration(discard_unknown_keys=False) api_client = ...
[ "def", "test_deserialize_isosceles_triangle_do_not_discard_unknown_properties", "(", "self", ")", ":", "config", "=", "Configuration", "(", "discard_unknown_keys", "=", "False", ")", "api_client", "=", "petstore_api", ".", "ApiClient", "(", "config", ")", "data", "=", ...
[ 56, 4 ]
[ 79, 63 ]
python
en
['en', 'error', 'th']
False
DiscardUnknownPropertiesTests.test_deserialize_banana_req_discard_unknown_properties
(self)
Deserialize bananaReq with unknown properties. Discard unknown properties.
Deserialize bananaReq with unknown properties. Discard unknown properties.
def test_deserialize_banana_req_discard_unknown_properties(self): """ Deserialize bananaReq with unknown properties. Discard unknown properties. """ config = Configuration(discard_unknown_keys=True) api_client = petstore_api.ApiClient(config) data = { ...
[ "def", "test_deserialize_banana_req_discard_unknown_properties", "(", "self", ")", ":", "config", "=", "Configuration", "(", "discard_unknown_keys", "=", "True", ")", "api_client", "=", "petstore_api", ".", "ApiClient", "(", "config", ")", "data", "=", "{", "'length...
[ 82, 4 ]
[ 107, 71 ]
python
en
['en', 'error', 'th']
False
DiscardUnknownPropertiesTests.test_deserialize_cat_do_not_discard_unknown_properties
(self)
Deserialize Cat with unknown properties. Strict validation is enabled.
Deserialize Cat with unknown properties. Strict validation is enabled.
def test_deserialize_cat_do_not_discard_unknown_properties(self): """ Deserialize Cat with unknown properties. Strict validation is enabled. """ config = Configuration(discard_unknown_keys=False) api_client = petstore_api.ApiClient(config) data = { "cl...
[ "def", "test_deserialize_cat_do_not_discard_unknown_properties", "(", "self", ")", ":", "config", "=", "Configuration", "(", "discard_unknown_keys", "=", "False", ")", "api_client", "=", "petstore_api", ".", "ApiClient", "(", "config", ")", "data", "=", "{", "\"clas...
[ 109, 4 ]
[ 130, 56 ]
python
en
['en', 'error', 'th']
False
DiscardUnknownPropertiesTests.test_deserialize_cat_discard_unknown_properties
(self)
Deserialize Cat with unknown properties. Request to discard unknown properties, but Cat is composed schema with one inner schema that has 'additionalProperties' set to true.
Deserialize Cat with unknown properties. Request to discard unknown properties, but Cat is composed schema with one inner schema that has 'additionalProperties' set to true.
def test_deserialize_cat_discard_unknown_properties(self): """ Deserialize Cat with unknown properties. Request to discard unknown properties, but Cat is composed schema with one inner schema that has 'additionalProperties' set to true. """ config = Configuration(discard_...
[ "def", "test_deserialize_cat_discard_unknown_properties", "(", "self", ")", ":", "config", "=", "Configuration", "(", "discard_unknown_keys", "=", "True", ")", "api_client", "=", "petstore_api", ".", "ApiClient", "(", "config", ")", "data", "=", "{", "\"class_name\"...
[ 132, 4 ]
[ 155, 78 ]
python
en
['en', 'error', 'th']
False
test_unload_entry
(hass, mock_account)
Test being able to unload an entry.
Test being able to unload an entry.
async def test_unload_entry(hass, mock_account): """Test being able to unload an entry.""" entry = await setup_integration(hass, mock_account, VACUUM_DOMAIN) vacuum = hass.states.get(VACUUM_ENTITY_ID) assert vacuum assert vacuum.state == STATE_DOCKED await hass.services.async_call( VAC...
[ "async", "def", "test_unload_entry", "(", "hass", ",", "mock_account", ")", ":", "entry", "=", "await", "setup_integration", "(", "hass", ",", "mock_account", ",", "VACUUM_DOMAIN", ")", "vacuum", "=", "hass", ".", "states", ".", "get", "(", "VACUUM_ENTITY_ID",...
[ 21, 0 ]
[ 39, 46 ]
python
en
['en', 'en', 'en']
True
test_entry_not_setup
(hass, side_effect, expected_state)
Test being able to handle config entry not setup.
Test being able to handle config entry not setup.
async def test_entry_not_setup(hass, side_effect, expected_state): """Test being able to handle config entry not setup.""" entry = MockConfigEntry( domain=litterrobot.DOMAIN, data=CONFIG[litterrobot.DOMAIN], ) entry.add_to_hass(hass) with patch( "pylitterbot.Account.connect"...
[ "async", "def", "test_entry_not_setup", "(", "hass", ",", "side_effect", ",", "expected_state", ")", ":", "entry", "=", "MockConfigEntry", "(", "domain", "=", "litterrobot", ".", "DOMAIN", ",", "data", "=", "CONFIG", "[", "litterrobot", ".", "DOMAIN", "]", "...
[ 49, 0 ]
[ 62, 44 ]
python
en
['en', 'en', 'en']
True
async_setup_test_fixture
(hass, mock_get_station, initial_value)
Create a dummy config entry for testing polling.
Create a dummy config entry for testing polling.
async def async_setup_test_fixture(hass, mock_get_station, initial_value): """Create a dummy config entry for testing polling.""" mock_get_station.return_value = initial_value entry = MockConfigEntry( version=1, domain="eafm", entry_id="VikingRecorder1234", data={"station": ...
[ "async", "def", "async_setup_test_fixture", "(", "hass", ",", "mock_get_station", ",", "initial_value", ")", ":", "mock_get_station", ".", "return_value", "=", "initial_value", "entry", "=", "MockConfigEntry", "(", "version", "=", "1", ",", "domain", "=", "\"eafm\...
[ 23, 0 ]
[ 52, 22 ]
python
en
['en', 'en', 'en']
True
test_reading_measures_not_list
(hass, mock_get_station)
Test that a measure can be a dict not a list. E.g. https://environment.data.gov.uk/flood-monitoring/id/stations/751110
Test that a measure can be a dict not a list.
async def test_reading_measures_not_list(hass, mock_get_station): """ Test that a measure can be a dict not a list. E.g. https://environment.data.gov.uk/flood-monitoring/id/stations/751110 """ _ = await async_setup_test_fixture( hass, mock_get_station, { "label":...
[ "async", "def", "test_reading_measures_not_list", "(", "hass", ",", "mock_get_station", ")", ":", "_", "=", "await", "async_setup_test_fixture", "(", "hass", ",", "mock_get_station", ",", "{", "\"label\"", ":", "\"My station\"", ",", "\"measures\"", ":", "{", "\"@...
[ 55, 0 ]
[ 78, 29 ]
python
en
['en', 'error', 'th']
False
test_reading_no_unit
(hass, mock_get_station)
Test that a sensor functions even if its unit is not known. E.g. https://environment.data.gov.uk/flood-monitoring/id/stations/L0410
Test that a sensor functions even if its unit is not known.
async def test_reading_no_unit(hass, mock_get_station): """ Test that a sensor functions even if its unit is not known. E.g. https://environment.data.gov.uk/flood-monitoring/id/stations/L0410 """ _ = await async_setup_test_fixture( hass, mock_get_station, { "labe...
[ "async", "def", "test_reading_no_unit", "(", "hass", ",", "mock_get_station", ")", ":", "_", "=", "await", "async_setup_test_fixture", "(", "hass", ",", "mock_get_station", ",", "{", "\"label\"", ":", "\"My station\"", ",", "\"measures\"", ":", "[", "{", "\"@id\...
[ 81, 0 ]
[ 106, 29 ]
python
en
['en', 'error', 'th']
False
test_ignore_invalid_latest_reading
(hass, mock_get_station)
Test that a sensor functions even if its unit is not known. E.g. https://environment.data.gov.uk/flood-monitoring/id/stations/L0410
Test that a sensor functions even if its unit is not known.
async def test_ignore_invalid_latest_reading(hass, mock_get_station): """ Test that a sensor functions even if its unit is not known. E.g. https://environment.data.gov.uk/flood-monitoring/id/stations/L0410 """ _ = await async_setup_test_fixture( hass, mock_get_station, { ...
[ "async", "def", "test_ignore_invalid_latest_reading", "(", "hass", ",", "mock_get_station", ")", ":", "_", "=", "await", "async_setup_test_fixture", "(", "hass", ",", "mock_get_station", ",", "{", "\"label\"", ":", "\"My station\"", ",", "\"measures\"", ":", "[", ...
[ 109, 0 ]
[ 145, 29 ]
python
en
['en', 'error', 'th']
False
test_reading_unavailable
(hass, mock_get_station, exception)
Test that a sensor is marked as unavailable if there is a connection error.
Test that a sensor is marked as unavailable if there is a connection error.
async def test_reading_unavailable(hass, mock_get_station, exception): """Test that a sensor is marked as unavailable if there is a connection error.""" _, poll = await async_setup_test_fixture( hass, mock_get_station, { "label": "My station", "measures": [ ...
[ "async", "def", "test_reading_unavailable", "(", "hass", ",", "mock_get_station", ",", "exception", ")", ":", "_", ",", "poll", "=", "await", "async_setup_test_fixture", "(", "hass", ",", "mock_get_station", ",", "{", "\"label\"", ":", "\"My station\"", ",", "\"...
[ 149, 0 ]
[ 175, 39 ]
python
en
['en', 'en', 'en']
True
test_recover_from_failure
(hass, mock_get_station, exception)
Test that a sensor recovers from failures.
Test that a sensor recovers from failures.
async def test_recover_from_failure(hass, mock_get_station, exception): """Test that a sensor recovers from failures.""" _, poll = await async_setup_test_fixture( hass, mock_get_station, { "label": "My station", "measures": [ { ...
[ "async", "def", "test_recover_from_failure", "(", "hass", ",", "mock_get_station", ",", "exception", ")", ":", "_", ",", "poll", "=", "await", "async_setup_test_fixture", "(", "hass", ",", "mock_get_station", ",", "{", "\"label\"", ":", "\"My station\"", ",", "\...
[ 179, 0 ]
[ 225, 30 ]
python
en
['en', 'en', 'en']
True
test_reading_is_sampled
(hass, mock_get_station)
Test that a sensor is added and polled.
Test that a sensor is added and polled.
async def test_reading_is_sampled(hass, mock_get_station): """Test that a sensor is added and polled.""" await async_setup_test_fixture( hass, mock_get_station, { "label": "My station", "measures": [ { "@id": "really-long-unique...
[ "async", "def", "test_reading_is_sampled", "(", "hass", ",", "mock_get_station", ")", ":", "await", "async_setup_test_fixture", "(", "hass", ",", "mock_get_station", ",", "{", "\"label\"", ":", "\"My station\"", ",", "\"measures\"", ":", "[", "{", "\"@id\"", ":", ...
[ 228, 0 ]
[ 252, 60 ]
python
en
['en', 'en', 'en']
True
test_multiple_readings_are_sampled
(hass, mock_get_station)
Test that multiple sensors are added and polled.
Test that multiple sensors are added and polled.
async def test_multiple_readings_are_sampled(hass, mock_get_station): """Test that multiple sensors are added and polled.""" await async_setup_test_fixture( hass, mock_get_station, { "label": "My station", "measures": [ { "@id":...
[ "async", "def", "test_multiple_readings_are_sampled", "(", "hass", ",", "mock_get_station", ")", ":", "await", "async_setup_test_fixture", "(", "hass", ",", "mock_get_station", ",", "{", "\"label\"", ":", "\"My station\"", ",", "\"measures\"", ":", "[", "{", "\"@id\...
[ 255, 0 ]
[ 293, 60 ]
python
en
['en', 'en', 'en']
True
test_ignore_no_latest_reading
(hass, mock_get_station)
Test that a measure is ignored if it has no latest reading.
Test that a measure is ignored if it has no latest reading.
async def test_ignore_no_latest_reading(hass, mock_get_station): """Test that a measure is ignored if it has no latest reading.""" await async_setup_test_fixture( hass, mock_get_station, { "label": "My station", "measures": [ { ...
[ "async", "def", "test_ignore_no_latest_reading", "(", "hass", ",", "mock_get_station", ")", ":", "await", "async_setup_test_fixture", "(", "hass", ",", "mock_get_station", ",", "{", "\"label\"", ":", "\"My station\"", ",", "\"measures\"", ":", "[", "{", "\"@id\"", ...
[ 296, 0 ]
[ 332, 24 ]
python
en
['en', 'en', 'en']
True
test_mark_existing_as_unavailable_if_no_latest
(hass, mock_get_station)
Test that a measure is marked as unavailable if it has no latest reading.
Test that a measure is marked as unavailable if it has no latest reading.
async def test_mark_existing_as_unavailable_if_no_latest(hass, mock_get_station): """Test that a measure is marked as unavailable if it has no latest reading.""" _, poll = await async_setup_test_fixture( hass, mock_get_station, { "label": "My station", "measures":...
[ "async", "def", "test_mark_existing_as_unavailable_if_no_latest", "(", "hass", ",", "mock_get_station", ")", ":", "_", ",", "poll", "=", "await", "async_setup_test_fixture", "(", "hass", ",", "mock_get_station", ",", "{", "\"label\"", ":", "\"My station\"", ",", "\"...
[ 335, 0 ]
[ 398, 29 ]
python
en
['en', 'en', 'en']
True
test_unload_entry
(hass, mock_get_station)
Test being able to unload an entry.
Test being able to unload an entry.
async def test_unload_entry(hass, mock_get_station): """Test being able to unload an entry.""" entry, _ = await async_setup_test_fixture( hass, mock_get_station, { "label": "My station", "measures": [ { "@id": "really-long-uniqu...
[ "async", "def", "test_unload_entry", "(", "hass", ",", "mock_get_station", ")", ":", "entry", ",", "_", "=", "await", "async_setup_test_fixture", "(", "hass", ",", "mock_get_station", ",", "{", "\"label\"", ":", "\"My station\"", ",", "\"measures\"", ":", "[", ...
[ 401, 0 ]
[ 433, 5 ]
python
en
['en', 'en', 'en']
True
async_setup_entry
( hass: HomeAssistant, config_entry: ConfigEntry, async_add_entities: AddEntitiesCallback, )
Set up sensors for device.
Set up sensors for device.
async def async_setup_entry( hass: HomeAssistant, config_entry: ConfigEntry, async_add_entities: AddEntitiesCallback, ) -> None: """Set up sensors for device.""" if config_entry.data["sleep_period"]: await async_setup_entry_attribute_entities( hass, config_entry, async_add_entiti...
[ "async", "def", "async_setup_entry", "(", "hass", ":", "HomeAssistant", ",", "config_entry", ":", "ConfigEntry", ",", "async_add_entities", ":", "AddEntitiesCallback", ",", ")", "->", "None", ":", "if", "config_entry", ".", "data", "[", "\"sleep_period\"", "]", ...
[ 229, 0 ]
[ 245, 9 ]
python
en
['en', 'en', 'en']
True
ShellySensor.native_value
(self)
Return value of sensor.
Return value of sensor.
def native_value(self) -> StateType: """Return value of sensor.""" return self.attribute_value
[ "def", "native_value", "(", "self", ")", "->", "StateType", ":", "return", "self", ".", "attribute_value" ]
[ 252, 4 ]
[ 254, 35 ]
python
en
['en', 'no', 'en']
True
ShellySensor.state_class
(self)
State class of sensor.
State class of sensor.
def state_class(self) -> str | None: """State class of sensor.""" return self.description.state_class
[ "def", "state_class", "(", "self", ")", "->", "str", "|", "None", ":", "return", "self", ".", "description", ".", "state_class" ]
[ 257, 4 ]
[ 259, 43 ]
python
en
['en', 'en', 'en']
True
ShellySensor.native_unit_of_measurement
(self)
Return unit of sensor.
Return unit of sensor.
def native_unit_of_measurement(self) -> str | None: """Return unit of sensor.""" return cast(str, self._unit)
[ "def", "native_unit_of_measurement", "(", "self", ")", "->", "str", "|", "None", ":", "return", "cast", "(", "str", ",", "self", ".", "_unit", ")" ]
[ 262, 4 ]
[ 264, 36 ]
python
en
['en', 'bg', 'en']
True
ShellyRestSensor.native_value
(self)
Return value of sensor.
Return value of sensor.
def native_value(self) -> StateType: """Return value of sensor.""" return self.attribute_value
[ "def", "native_value", "(", "self", ")", "->", "StateType", ":", "return", "self", ".", "attribute_value" ]
[ 271, 4 ]
[ 273, 35 ]
python
en
['en', 'no', 'en']
True
ShellyRestSensor.state_class
(self)
State class of sensor.
State class of sensor.
def state_class(self) -> str | None: """State class of sensor.""" return self.description.state_class
[ "def", "state_class", "(", "self", ")", "->", "str", "|", "None", ":", "return", "self", ".", "description", ".", "state_class" ]
[ 276, 4 ]
[ 278, 43 ]
python
en
['en', 'en', 'en']
True
ShellyRestSensor.native_unit_of_measurement
(self)
Return unit of sensor.
Return unit of sensor.
def native_unit_of_measurement(self) -> str | None: """Return unit of sensor.""" return self.description.unit
[ "def", "native_unit_of_measurement", "(", "self", ")", "->", "str", "|", "None", ":", "return", "self", ".", "description", ".", "unit" ]
[ 281, 4 ]
[ 283, 36 ]
python
en
['en', 'bg', 'en']
True
ShellySleepingSensor.native_value
(self)
Return value of sensor.
Return value of sensor.
def native_value(self) -> StateType: """Return value of sensor.""" if self.block is not None: return self.attribute_value return self.last_state
[ "def", "native_value", "(", "self", ")", "->", "StateType", ":", "if", "self", ".", "block", "is", "not", "None", ":", "return", "self", ".", "attribute_value", "return", "self", ".", "last_state" ]
[ 290, 4 ]
[ 295, 30 ]
python
en
['en', 'no', 'en']
True
ShellySleepingSensor.state_class
(self)
State class of sensor.
State class of sensor.
def state_class(self) -> str | None: """State class of sensor.""" return self.description.state_class
[ "def", "state_class", "(", "self", ")", "->", "str", "|", "None", ":", "return", "self", ".", "description", ".", "state_class" ]
[ 298, 4 ]
[ 300, 43 ]
python
en
['en', 'en', 'en']
True
ShellySleepingSensor.native_unit_of_measurement
(self)
Return unit of sensor.
Return unit of sensor.
def native_unit_of_measurement(self) -> str | None: """Return unit of sensor.""" return cast(str, self._unit)
[ "def", "native_unit_of_measurement", "(", "self", ")", "->", "str", "|", "None", ":", "return", "cast", "(", "str", ",", "self", ".", "_unit", ")" ]
[ 303, 4 ]
[ 305, 36 ]
python
en
['en', 'bg', 'en']
True
test_is_media_source_id
()
Test media source validation.
Test media source validation.
async def test_is_media_source_id(): """Test media source validation.""" assert media_source.is_media_source_id(const.URI_SCHEME) assert media_source.is_media_source_id(f"{const.URI_SCHEME}domain") assert media_source.is_media_source_id(f"{const.URI_SCHEME}domain/identifier") assert not media_source...
[ "async", "def", "test_is_media_source_id", "(", ")", ":", "assert", "media_source", ".", "is_media_source_id", "(", "const", ".", "URI_SCHEME", ")", "assert", "media_source", ".", "is_media_source_id", "(", "f\"{const.URI_SCHEME}domain\"", ")", "assert", "media_source",...
[ 14, 0 ]
[ 19, 54 ]
python
en
['fr', 'et', 'en']
False
test_generate_media_source_id
()
Test identifier generation.
Test identifier generation.
async def test_generate_media_source_id(): """Test identifier generation.""" tests = [ (None, None), (None, ""), ("", ""), ("domain", None), ("domain", ""), ("domain", "identifier"), ] for domain, identifier in tests: assert media_source.is_media_...
[ "async", "def", "test_generate_media_source_id", "(", ")", ":", "tests", "=", "[", "(", "None", ",", "None", ")", ",", "(", "None", ",", "\"\"", ")", ",", "(", "\"\"", ",", "\"\"", ")", ",", "(", "\"domain\"", ",", "None", ")", ",", "(", "\"domain\...
[ 22, 0 ]
[ 36, 9 ]
python
de
['de', 'fy', 'en']
False
test_async_browse_media
(hass)
Test browse media.
Test browse media.
async def test_async_browse_media(hass): """Test browse media.""" assert await async_setup_component(hass, const.DOMAIN, {}) await hass.async_block_till_done() # Test non-media ignored (/media has test.mp3 and not_media.txt) media = await media_source.async_browse_media(hass, "") assert isinsta...
[ "async", "def", "test_async_browse_media", "(", "hass", ")", ":", "assert", "await", "async_setup_component", "(", "hass", ",", "const", ".", "DOMAIN", ",", "{", "}", ")", "await", "hass", ".", "async_block_till_done", "(", ")", "# Test non-media ignored (/media h...
[ 39, 0 ]
[ 58, 51 ]
python
en
['en', 'da', 'en']
True
test_async_resolve_media
(hass)
Test browse media.
Test browse media.
async def test_async_resolve_media(hass): """Test browse media.""" assert await async_setup_component(hass, const.DOMAIN, {}) await hass.async_block_till_done() media = await media_source.async_resolve_media( hass, media_source.generate_media_source_id(const.DOMAIN, "local/test.mp3"), ...
[ "async", "def", "test_async_resolve_media", "(", "hass", ")", ":", "assert", "await", "async_setup_component", "(", "hass", ",", "const", ".", "DOMAIN", ",", "{", "}", ")", "await", "hass", ".", "async_block_till_done", "(", ")", "media", "=", "await", "medi...
[ 61, 0 ]
[ 70, 59 ]
python
en
['en', 'da', 'en']
True
test_async_unresolve_media
(hass)
Test browse media.
Test browse media.
async def test_async_unresolve_media(hass): """Test browse media.""" assert await async_setup_component(hass, const.DOMAIN, {}) await hass.async_block_till_done() # Test no media content with pytest.raises(Unresolvable): await media_source.async_resolve_media(hass, "")
[ "async", "def", "test_async_unresolve_media", "(", "hass", ")", ":", "assert", "await", "async_setup_component", "(", "hass", ",", "const", ".", "DOMAIN", ",", "{", "}", ")", "await", "hass", ".", "async_block_till_done", "(", ")", "# Test no media content", "wi...
[ 73, 0 ]
[ 80, 56 ]
python
en
['en', 'da', 'en']
True
test_websocket_browse_media
(hass, hass_ws_client)
Test browse media websocket.
Test browse media websocket.
async def test_websocket_browse_media(hass, hass_ws_client): """Test browse media websocket.""" assert await async_setup_component(hass, const.DOMAIN, {}) await hass.async_block_till_done() client = await hass_ws_client(hass) media = media_source.models.BrowseMediaSource( domain=const.DOMA...
[ "async", "def", "test_websocket_browse_media", "(", "hass", ",", "hass_ws_client", ")", ":", "assert", "await", "async_setup_component", "(", "hass", ",", "const", ".", "DOMAIN", ",", "{", "}", ")", "await", "hass", ".", "async_block_till_done", "(", ")", "cli...
[ 83, 0 ]
[ 133, 44 ]
python
da
['pl', 'da', 'en']
False
test_websocket_resolve_media
(hass, hass_ws_client, filename)
Test browse media websocket.
Test browse media websocket.
async def test_websocket_resolve_media(hass, hass_ws_client, filename): """Test browse media websocket.""" assert await async_setup_component(hass, const.DOMAIN, {}) await hass.async_block_till_done() client = await hass_ws_client(hass) media = media_source.models.PlayMedia(f"/media/local/{filenam...
[ "async", "def", "test_websocket_resolve_media", "(", "hass", ",", "hass_ws_client", ",", "filename", ")", ":", "assert", "await", "async_setup_component", "(", "hass", ",", "const", ".", "DOMAIN", ",", "{", "}", ")", "await", "hass", ".", "async_block_till_done"...
[ 137, 0 ]
[ 181, 44 ]
python
da
['pl', 'da', 'en']
False
train_parser_and_tagger
(train_json_path: str, dev_json_path: str, test_json_path: str, model_output_dir: str, model_path: str = None, ontonotes_path: str = None, ontonotes_tra...
Function to train the spacy parser and tagger from a blank model, with the default, en_core_web_sm vocab. Training setup is mostly copied from the spacy cli train command. @param train_json_path: path to the conll formatted training data @param dev_json_path: path to the conll formatted dev data ...
Function to train the spacy parser and tagger from a blank model, with the default, en_core_web_sm vocab. Training setup is mostly copied from the spacy cli train command.
def train_parser_and_tagger(train_json_path: str, dev_json_path: str, test_json_path: str, model_output_dir: str, model_path: str = None, ontonotes_path: str = None, ...
[ "def", "train_parser_and_tagger", "(", "train_json_path", ":", "str", ",", "dev_json_path", ":", "str", ",", "test_json_path", ":", "str", ",", "model_output_dir", ":", "str", ",", "model_path", ":", "str", "=", "None", ",", "ontonotes_path", ":", "str", "=", ...
[ 20, 0 ]
[ 214, 64 ]
python
en
['en', 'en', 'en']
True
inject_into_urllib3
()
Monkey-patch urllib3 with PyOpenSSL-backed SSL-support.
Monkey-patch urllib3 with PyOpenSSL-backed SSL-support.
def inject_into_urllib3(): "Monkey-patch urllib3 with PyOpenSSL-backed SSL-support." _validate_dependencies_met() util.SSLContext = PyOpenSSLContext util.ssl_.SSLContext = PyOpenSSLContext util.HAS_SNI = HAS_SNI util.ssl_.HAS_SNI = HAS_SNI util.IS_PYOPENSSL = True util.ssl_.IS_PYOPENSS...
[ "def", "inject_into_urllib3", "(", ")", ":", "_validate_dependencies_met", "(", ")", "util", ".", "SSLContext", "=", "PyOpenSSLContext", "util", ".", "ssl_", ".", "SSLContext", "=", "PyOpenSSLContext", "util", ".", "HAS_SNI", "=", "HAS_SNI", "util", ".", "ssl_",...
[ 114, 0 ]
[ 124, 33 ]
python
en
['en', 'en', 'en']
True
extract_from_urllib3
()
Undo monkey-patching by :func:`inject_into_urllib3`.
Undo monkey-patching by :func:`inject_into_urllib3`.
def extract_from_urllib3(): "Undo monkey-patching by :func:`inject_into_urllib3`." util.SSLContext = orig_util_SSLContext util.ssl_.SSLContext = orig_util_SSLContext util.HAS_SNI = orig_util_HAS_SNI util.ssl_.HAS_SNI = orig_util_HAS_SNI util.IS_PYOPENSSL = False util.ssl_.IS_PYOPENSSL = Fal...
[ "def", "extract_from_urllib3", "(", ")", ":", "util", ".", "SSLContext", "=", "orig_util_SSLContext", "util", ".", "ssl_", ".", "SSLContext", "=", "orig_util_SSLContext", "util", ".", "HAS_SNI", "=", "orig_util_HAS_SNI", "util", ".", "ssl_", ".", "HAS_SNI", "=",...
[ 127, 0 ]
[ 135, 34 ]
python
en
['en', 'ny', 'sw']
False
_validate_dependencies_met
()
Verifies that PyOpenSSL's package-level dependencies have been met. Throws `ImportError` if they are not met.
Verifies that PyOpenSSL's package-level dependencies have been met. Throws `ImportError` if they are not met.
def _validate_dependencies_met(): """ Verifies that PyOpenSSL's package-level dependencies have been met. Throws `ImportError` if they are not met. """ # Method added in `cryptography==1.1`; not available in older versions from cryptography.x509.extensions import Extensions if getattr(Exten...
[ "def", "_validate_dependencies_met", "(", ")", ":", "# Method added in `cryptography==1.1`; not available in older versions", "from", "cryptography", ".", "x509", ".", "extensions", "import", "Extensions", "if", "getattr", "(", "Extensions", ",", "\"get_extension_for_class\"", ...
[ 138, 0 ]
[ 161, 9 ]
python
en
['en', 'error', 'th']
False
_dnsname_to_stdlib
(name)
Converts a dNSName SubjectAlternativeName field to the form used by the standard library on the given Python version. Cryptography produces a dNSName as a unicode string that was idna-decoded from ASCII bytes. We need to idna-encode that string to get it back, and then on Python 3 we also need to ...
Converts a dNSName SubjectAlternativeName field to the form used by the standard library on the given Python version.
def _dnsname_to_stdlib(name): """ Converts a dNSName SubjectAlternativeName field to the form used by the standard library on the given Python version. Cryptography produces a dNSName as a unicode string that was idna-decoded from ASCII bytes. We need to idna-encode that string to get it back, and ...
[ "def", "_dnsname_to_stdlib", "(", "name", ")", ":", "def", "idna_encode", "(", "name", ")", ":", "\"\"\"\n Borrowed wholesale from the Python Cryptography Project. It turns out\n that we can't just safely call `idna.encode`: it can explode for\n wildcard names. This avoi...
[ 164, 0 ]
[ 204, 15 ]
python
en
['en', 'error', 'th']
False
get_subj_alt_name
(peer_cert)
Given an PyOpenSSL certificate, provides all the subject alternative names.
Given an PyOpenSSL certificate, provides all the subject alternative names.
def get_subj_alt_name(peer_cert): """ Given an PyOpenSSL certificate, provides all the subject alternative names. """ # Pass the cert to cryptography, which has much better APIs for this. if hasattr(peer_cert, "to_cryptography"): cert = peer_cert.to_cryptography() else: # This is...
[ "def", "get_subj_alt_name", "(", "peer_cert", ")", ":", "# Pass the cert to cryptography, which has much better APIs for this.", "if", "hasattr", "(", "peer_cert", ",", "\"to_cryptography\"", ")", ":", "cert", "=", "peer_cert", ".", "to_cryptography", "(", ")", "else", ...
[ 207, 0 ]
[ 258, 16 ]
python
en
['en', 'error', 'th']
False
async_setup
(hass: HomeAssistant, config: ConfigType)
Set up the Lovelace commands.
Set up the Lovelace commands.
async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool: """Set up the Lovelace commands.""" mode = config[DOMAIN][CONF_MODE] yaml_resources = config[DOMAIN].get(CONF_RESOURCES) frontend.async_register_built_in_panel(hass, DOMAIN, config={"mode": mode}) async def reload_resources_se...
[ "async", "def", "async_setup", "(", "hass", ":", "HomeAssistant", ",", "config", ":", "ConfigType", ")", "->", "bool", ":", "mode", "=", "config", "[", "DOMAIN", "]", "[", "CONF_MODE", "]", "yaml_resources", "=", "config", "[", "DOMAIN", "]", ".", "get",...
[ 69, 0 ]
[ 210, 15 ]
python
en
['en', 'fr', 'en']
True
create_yaml_resource_col
(hass, yaml_resources)
Create yaml resources collection.
Create yaml resources collection.
async def create_yaml_resource_col(hass, yaml_resources): """Create yaml resources collection.""" if yaml_resources is None: default_config = dashboard.LovelaceYAML(hass, None, None) try: ll_conf = await default_config.async_load(False) except HomeAssistantError: ...
[ "async", "def", "create_yaml_resource_col", "(", "hass", ",", "yaml_resources", ")", ":", "if", "yaml_resources", "is", "None", ":", "default_config", "=", "dashboard", ".", "LovelaceYAML", "(", "hass", ",", "None", ",", "None", ")", "try", ":", "ll_conf", "...
[ 213, 0 ]
[ 228, 65 ]
python
en
['tr', 'en', 'en']
True
_register_panel
(hass, url_path, mode, config, update)
Register a panel.
Register a panel.
def _register_panel(hass, url_path, mode, config, update): """Register a panel.""" kwargs = { "frontend_url_path": url_path, "require_admin": config[CONF_REQUIRE_ADMIN], "config": {"mode": mode}, "update": update, } if config[CONF_SHOW_IN_SIDEBAR]: kwargs["sideba...
[ "def", "_register_panel", "(", "hass", ",", "url_path", ",", "mode", ",", "config", ",", "update", ")", ":", "kwargs", "=", "{", "\"frontend_url_path\"", ":", "url_path", ",", "\"require_admin\"", ":", "config", "[", "CONF_REQUIRE_ADMIN", "]", ",", "\"config\"...
[ 232, 0 ]
[ 245, 66 ]
python
en
['en', 'da', 'en']
True
async_setup
(hass, config)
Set up configured Logi Circle component.
Set up configured Logi Circle component.
async def async_setup(hass, config): """Set up configured Logi Circle component.""" if DOMAIN not in config: return True conf = config[DOMAIN] config_flow.register_flow_implementation( hass, DOMAIN, client_id=conf[CONF_CLIENT_ID], client_secret=conf[CONF_CLIENT_...
[ "async", "def", "async_setup", "(", "hass", ",", "config", ")", ":", "if", "DOMAIN", "not", "in", "config", ":", "return", "True", "conf", "=", "config", "[", "DOMAIN", "]", "config_flow", ".", "register_flow_implementation", "(", "hass", ",", "DOMAIN", ",...
[ 101, 0 ]
[ 124, 15 ]
python
en
['en', 'su', 'en']
True
async_setup_entry
(hass, entry)
Set up Logi Circle from a config entry.
Set up Logi Circle from a config entry.
async def async_setup_entry(hass, entry): """Set up Logi Circle from a config entry.""" logi_circle = LogiCircle( client_id=entry.data[CONF_CLIENT_ID], client_secret=entry.data[CONF_CLIENT_SECRET], api_key=entry.data[CONF_API_KEY], redirect_uri=entry.data[CONF_REDIRECT_URI], ...
[ "async", "def", "async_setup_entry", "(", "hass", ",", "entry", ")", ":", "logi_circle", "=", "LogiCircle", "(", "client_id", "=", "entry", ".", "data", "[", "CONF_CLIENT_ID", "]", ",", "client_secret", "=", "entry", ".", "data", "[", "CONF_CLIENT_SECRET", "...
[ 127, 0 ]
[ 225, 15 ]
python
en
['en', 'en', 'en']
True
async_unload_entry
(hass, entry)
Unload a config entry.
Unload a config entry.
async def async_unload_entry(hass, entry): """Unload a config entry.""" unload_ok = await hass.config_entries.async_unload_platforms(entry, PLATFORMS) logi_circle = hass.data.pop(DATA_LOGI) # Tell API wrapper to close all aiohttp sessions, invalidate WS connections # and clear all locally cached t...
[ "async", "def", "async_unload_entry", "(", "hass", ",", "entry", ")", ":", "unload_ok", "=", "await", "hass", ".", "config_entries", ".", "async_unload_platforms", "(", "entry", ",", "PLATFORMS", ")", "logi_circle", "=", "hass", ".", "data", ".", "pop", "(",...
[ 228, 0 ]
[ 238, 20 ]
python
en
['en', 'es', 'en']
True
_only_one_selected
(*args)
Test if only one item is True.
Test if only one item is True.
def _only_one_selected(*args): """Test if only one item is True.""" return sum(args) == 1
[ "def", "_only_one_selected", "(", "*", "args", ")", ":", "return", "sum", "(", "args", ")", "==", "1" ]
[ 57, 0 ]
[ 59, 25 ]
python
en
['en', 'en', 'en']
True
_async_connect
(**kwargs)
Connect to the Insteon modem.
Connect to the Insteon modem.
async def _async_connect(**kwargs): """Connect to the Insteon modem.""" try: await async_connect(**kwargs) _LOGGER.info("Connected to Insteon modem") return True except ConnectionError: _LOGGER.error("Could not connect to Insteon modem") return False
[ "async", "def", "_async_connect", "(", "*", "*", "kwargs", ")", ":", "try", ":", "await", "async_connect", "(", "*", "*", "kwargs", ")", "_LOGGER", ".", "info", "(", "\"Connected to Insteon modem\"", ")", "return", "True", "except", "ConnectionError", ":", "...
[ 62, 0 ]
[ 70, 20 ]
python
en
['en', 'en', 'en']
True
_remove_override
(address, options)
Remove a device override from config.
Remove a device override from config.
def _remove_override(address, options): """Remove a device override from config.""" new_options = {} if options.get(CONF_X10): new_options[CONF_X10] = options.get(CONF_X10) new_overrides = [] for override in options[CONF_OVERRIDE]: if override[CONF_ADDRESS] != address: ne...
[ "def", "_remove_override", "(", "address", ",", "options", ")", ":", "new_options", "=", "{", "}", "if", "options", ".", "get", "(", "CONF_X10", ")", ":", "new_options", "[", "CONF_X10", "]", "=", "options", ".", "get", "(", "CONF_X10", ")", "new_overrid...
[ 73, 0 ]
[ 84, 22 ]
python
en
['en', 'en', 'en']
True
_remove_x10
(device, options)
Remove an X10 device from the config.
Remove an X10 device from the config.
def _remove_x10(device, options): """Remove an X10 device from the config.""" housecode = device[11].lower() unitcode = int(device[24:]) new_options = {} if options.get(CONF_OVERRIDE): new_options[CONF_OVERRIDE] = options.get(CONF_OVERRIDE) new_x10 = [] for existing_device in options...
[ "def", "_remove_x10", "(", "device", ",", "options", ")", ":", "housecode", "=", "device", "[", "11", "]", ".", "lower", "(", ")", "unitcode", "=", "int", "(", "device", "[", "24", ":", "]", ")", "new_options", "=", "{", "}", "if", "options", ".", ...
[ 87, 0 ]
[ 103, 43 ]
python
en
['en', 'en', 'en']
True
InsteonFlowHandler.async_get_options_flow
(config_entry)
Define the config flow to handle options.
Define the config flow to handle options.
def async_get_options_flow(config_entry): """Define the config flow to handle options.""" return InsteonOptionsFlowHandler(config_entry)
[ "def", "async_get_options_flow", "(", "config_entry", ")", ":", "return", "InsteonOptionsFlowHandler", "(", "config_entry", ")" ]
[ 111, 4 ]
[ 113, 54 ]
python
en
['en', 'en', 'en']
True
InsteonFlowHandler.async_step_user
(self, user_input=None)
Init the config flow.
Init the config flow.
async def async_step_user(self, user_input=None): """Init the config flow.""" errors = {} if self._async_current_entries(): return self.async_abort(reason="single_instance_allowed") if user_input is not None: selection = user_input.get(MODEM_TYPE) if ...
[ "async", "def", "async_step_user", "(", "self", ",", "user_input", "=", "None", ")", ":", "errors", "=", "{", "}", "if", "self", ".", "_async_current_entries", "(", ")", ":", "return", "self", ".", "async_abort", "(", "reason", "=", "\"single_instance_allowe...
[ 115, 4 ]
[ 132, 9 ]
python
en
['en', 'en', 'en']
True
InsteonFlowHandler.async_step_plm
(self, user_input=None)
Set up the PLM modem type.
Set up the PLM modem type.
async def async_step_plm(self, user_input=None): """Set up the PLM modem type.""" errors = {} if user_input is not None: if await _async_connect(**user_input): return self.async_create_entry(title="", data=user_input) errors["base"] = "cannot_connect" ...
[ "async", "def", "async_step_plm", "(", "self", ",", "user_input", "=", "None", ")", ":", "errors", "=", "{", "}", "if", "user_input", "is", "not", "None", ":", "if", "await", "_async_connect", "(", "*", "*", "user_input", ")", ":", "return", "self", "....
[ 134, 4 ]
[ 145, 9 ]
python
en
['en', 'yi', 'en']
True
InsteonFlowHandler.async_step_hubv1
(self, user_input=None)
Set up the Hub v1 modem type.
Set up the Hub v1 modem type.
async def async_step_hubv1(self, user_input=None): """Set up the Hub v1 modem type.""" return await self._async_setup_hub(hub_version=1, user_input=user_input)
[ "async", "def", "async_step_hubv1", "(", "self", ",", "user_input", "=", "None", ")", ":", "return", "await", "self", ".", "_async_setup_hub", "(", "hub_version", "=", "1", ",", "user_input", "=", "user_input", ")" ]
[ 147, 4 ]
[ 149, 80 ]
python
en
['en', 'ru-Latn', 'en']
True
InsteonFlowHandler.async_step_hubv2
(self, user_input=None)
Set up the Hub v2 modem type.
Set up the Hub v2 modem type.
async def async_step_hubv2(self, user_input=None): """Set up the Hub v2 modem type.""" return await self._async_setup_hub(hub_version=2, user_input=user_input)
[ "async", "def", "async_step_hubv2", "(", "self", ",", "user_input", "=", "None", ")", ":", "return", "await", "self", ".", "_async_setup_hub", "(", "hub_version", "=", "2", ",", "user_input", "=", "user_input", ")" ]
[ 151, 4 ]
[ 153, 80 ]
python
en
['en', 'ru-Latn', 'en']
True
InsteonFlowHandler._async_setup_hub
(self, hub_version, user_input)
Set up the Hub versions 1 and 2.
Set up the Hub versions 1 and 2.
async def _async_setup_hub(self, hub_version, user_input): """Set up the Hub versions 1 and 2.""" errors = {} if user_input is not None: user_input[CONF_HUB_VERSION] = hub_version if await _async_connect(**user_input): return self.async_create_entry(title=...
[ "async", "def", "_async_setup_hub", "(", "self", ",", "hub_version", ",", "user_input", ")", ":", "errors", "=", "{", "}", "if", "user_input", "is", "not", "None", ":", "user_input", "[", "CONF_HUB_VERSION", "]", "=", "hub_version", "if", "await", "_async_co...
[ 155, 4 ]
[ 169, 9 ]
python
en
['en', 'en', 'en']
True
InsteonFlowHandler.async_step_import
(self, import_info)
Import a yaml entry as a config entry.
Import a yaml entry as a config entry.
async def async_step_import(self, import_info): """Import a yaml entry as a config entry.""" if self._async_current_entries(): return self.async_abort(reason="single_instance_allowed") if not await _async_connect(**import_info): return self.async_abort(reason="cannot_conn...
[ "async", "def", "async_step_import", "(", "self", ",", "import_info", ")", ":", "if", "self", ".", "_async_current_entries", "(", ")", ":", "return", "self", ".", "async_abort", "(", "reason", "=", "\"single_instance_allowed\"", ")", "if", "not", "await", "_as...
[ 171, 4 ]
[ 177, 66 ]
python
en
['en', 'en', 'en']
True
InsteonOptionsFlowHandler.__init__
(self, config_entry)
Init the InsteonOptionsFlowHandler class.
Init the InsteonOptionsFlowHandler class.
def __init__(self, config_entry): """Init the InsteonOptionsFlowHandler class.""" self.config_entry = config_entry
[ "def", "__init__", "(", "self", ",", "config_entry", ")", ":", "self", ".", "config_entry", "=", "config_entry" ]
[ 183, 4 ]
[ 185, 40 ]
python
en
['en', 'en', 'en']
True
InsteonOptionsFlowHandler.async_step_init
(self, user_input=None)
Init the options config flow.
Init the options config flow.
async def async_step_init(self, user_input=None): """Init the options config flow.""" errors = {} if user_input is not None: change_hub_config = user_input.get(STEP_CHANGE_HUB_CONFIG, False) device_override = user_input.get(STEP_ADD_OVERRIDE, False) x10_device...
[ "async", "def", "async_step_init", "(", "self", ",", "user_input", "=", "None", ")", ":", "errors", "=", "{", "}", "if", "user_input", "is", "not", "None", ":", "change_hub_config", "=", "user_input", ".", "get", "(", "STEP_CHANGE_HUB_CONFIG", ",", "False", ...
[ 187, 4 ]
[ 230, 9 ]
python
en
['en', 'en', 'en']
True
InsteonOptionsFlowHandler.async_step_change_hub_config
(self, user_input=None)
Change the Hub configuration.
Change the Hub configuration.
async def async_step_change_hub_config(self, user_input=None): """Change the Hub configuration.""" if user_input is not None: data = { **self.config_entry.data, CONF_HOST: user_input[CONF_HOST], CONF_PORT: user_input[CONF_PORT], } ...
[ "async", "def", "async_step_change_hub_config", "(", "self", ",", "user_input", "=", "None", ")", ":", "if", "user_input", "is", "not", "None", ":", "data", "=", "{", "*", "*", "self", ".", "config_entry", ".", "data", ",", "CONF_HOST", ":", "user_input", ...
[ 232, 4 ]
[ 251, 9 ]
python
en
['en', 'xh', 'en']
True
InsteonOptionsFlowHandler.async_step_add_override
(self, user_input=None)
Add a device override.
Add a device override.
async def async_step_add_override(self, user_input=None): """Add a device override.""" errors = {} if user_input is not None: try: data = add_device_override({**self.config_entry.options}, user_input) async_dispatcher_send(self.hass, SIGNAL_ADD_DEVICE_...
[ "async", "def", "async_step_add_override", "(", "self", ",", "user_input", "=", "None", ")", ":", "errors", "=", "{", "}", "if", "user_input", "is", "not", "None", ":", "try", ":", "data", "=", "add_device_override", "(", "{", "*", "*", "self", ".", "c...
[ 253, 4 ]
[ 267, 9 ]
python
en
['es', 'en', 'en']
True
InsteonOptionsFlowHandler.async_step_add_x10
(self, user_input=None)
Add an X10 device.
Add an X10 device.
async def async_step_add_x10(self, user_input=None): """Add an X10 device.""" errors = {} if user_input is not None: options = add_x10_device({**self.config_entry.options}, user_input) async_dispatcher_send(self.hass, SIGNAL_ADD_X10_DEVICE, user_input) return ...
[ "async", "def", "async_step_add_x10", "(", "self", ",", "user_input", "=", "None", ")", ":", "errors", "=", "{", "}", "if", "user_input", "is", "not", "None", ":", "options", "=", "add_x10_device", "(", "{", "*", "*", "self", ".", "config_entry", ".", ...
[ 269, 4 ]
[ 280, 9 ]
python
en
['en', 'pl', 'en']
True
InsteonOptionsFlowHandler.async_step_remove_override
(self, user_input=None)
Remove a device override.
Remove a device override.
async def async_step_remove_override(self, user_input=None): """Remove a device override.""" errors = {} options = self.config_entry.options if user_input is not None: options = _remove_override(user_input[CONF_ADDRESS], options) async_dispatcher_send( ...
[ "async", "def", "async_step_remove_override", "(", "self", ",", "user_input", "=", "None", ")", ":", "errors", "=", "{", "}", "options", "=", "self", ".", "config_entry", ".", "options", "if", "user_input", "is", "not", "None", ":", "options", "=", "_remov...
[ 282, 4 ]
[ 298, 9 ]
python
en
['es', 'it', 'en']
False
InsteonOptionsFlowHandler.async_step_remove_x10
(self, user_input=None)
Remove an X10 device.
Remove an X10 device.
async def async_step_remove_x10(self, user_input=None): """Remove an X10 device.""" errors = {} options = self.config_entry.options if user_input is not None: options, housecode, unitcode = _remove_x10(user_input[CONF_DEVICE], options) async_dispatcher_send( ...
[ "async", "def", "async_step_remove_x10", "(", "self", ",", "user_input", "=", "None", ")", ":", "errors", "=", "{", "}", "options", "=", "self", ".", "config_entry", ".", "options", "if", "user_input", "is", "not", "None", ":", "options", ",", "housecode",...
[ 300, 4 ]
[ 314, 9 ]
python
en
['en', 'en', 'en']
True
test_load_and_unload
( hass: HomeAssistant, climacell_config_entry_update: pytest.fixture, )
Test loading and unloading entry.
Test loading and unloading entry.
async def test_load_and_unload( hass: HomeAssistant, climacell_config_entry_update: pytest.fixture, ) -> None: """Test loading and unloading entry.""" data = _get_config_schema(hass)(MIN_CONFIG) config_entry = MockConfigEntry( domain=DOMAIN, data=data, unique_id=_get_unique_i...
[ "async", "def", "test_load_and_unload", "(", "hass", ":", "HomeAssistant", ",", "climacell_config_entry_update", ":", "pytest", ".", "fixture", ",", ")", "->", "None", ":", "data", "=", "_get_config_schema", "(", "hass", ")", "(", "MIN_CONFIG", ")", "config_entr...
[ 21, 0 ]
[ 40, 65 ]
python
en
['en', 'en', 'en']
True
test_v3_load_and_unload
( hass: HomeAssistant, climacell_config_entry_update: pytest.fixture, )
Test loading and unloading v3 entry.
Test loading and unloading v3 entry.
async def test_v3_load_and_unload( hass: HomeAssistant, climacell_config_entry_update: pytest.fixture, ) -> None: """Test loading and unloading v3 entry.""" data = _get_config_schema(hass)(API_V3_ENTRY_DATA) config_entry = MockConfigEntry( domain=DOMAIN, data=data, unique_id=...
[ "async", "def", "test_v3_load_and_unload", "(", "hass", ":", "HomeAssistant", ",", "climacell_config_entry_update", ":", "pytest", ".", "fixture", ",", ")", "->", "None", ":", "data", "=", "_get_config_schema", "(", "hass", ")", "(", "API_V3_ENTRY_DATA", ")", "c...
[ 43, 0 ]
[ 62, 65 ]
python
en
['en', 'da', 'en']
True
test_migrate_timestep
( hass: HomeAssistant, climacell_config_entry_update: pytest.fixture, old_timestep: int, new_timestep: int, )
Test migration to standardized timestep.
Test migration to standardized timestep.
async def test_migrate_timestep( hass: HomeAssistant, climacell_config_entry_update: pytest.fixture, old_timestep: int, new_timestep: int, ) -> None: """Test migration to standardized timestep.""" config_entry = MockConfigEntry( domain=DOMAIN, data=V1_ENTRY_DATA, options=...
[ "async", "def", "test_migrate_timestep", "(", "hass", ":", "HomeAssistant", ",", "climacell_config_entry_update", ":", "pytest", ".", "fixture", ",", "old_timestep", ":", "int", ",", "new_timestep", ":", "int", ",", ")", "->", "None", ":", "config_entry", "=", ...
[ 68, 0 ]
[ 90, 62 ]
python
en
['en', 'pl', 'en']
True
mock_google_setup
(hass)
Mock the google set up functions.
Mock the google set up functions.
def mock_google_setup(hass): """Mock the google set up functions.""" p_auth = patch( "homeassistant.components.google.do_authentication", side_effect=google.do_setup ) p_service = patch("homeassistant.components.google.GoogleCalendarService.get") p_discovery = patch("homeassistant.components...
[ "def", "mock_google_setup", "(", "hass", ")", ":", "p_auth", "=", "patch", "(", "\"homeassistant.components.google.do_authentication\"", ",", "side_effect", "=", "google", ".", "do_setup", ")", "p_service", "=", "patch", "(", "\"homeassistant.components.google.GoogleCalen...
[ 11, 0 ]
[ 22, 13 ]
python
en
['en', 'en', 'en']
True
test_setup_component
(hass, google_setup)
Test setup component.
Test setup component.
async def test_setup_component(hass, google_setup): """Test setup component.""" config = {"google": {CONF_CLIENT_ID: "id", CONF_CLIENT_SECRET: "secret"}} assert await async_setup_component(hass, "google", config)
[ "async", "def", "test_setup_component", "(", "hass", ",", "google_setup", ")", ":", "config", "=", "{", "\"google\"", ":", "{", "CONF_CLIENT_ID", ":", "\"id\"", ",", "CONF_CLIENT_SECRET", ":", "\"secret\"", "}", "}", "assert", "await", "async_setup_component", "...
[ 25, 0 ]
[ 29, 62 ]
python
en
['en', 'da', 'en']
True
test_get_calendar_info
(hass, test_calendar)
Test getting the calendar info.
Test getting the calendar info.
async def test_get_calendar_info(hass, test_calendar): """Test getting the calendar info.""" calendar_info = await hass.async_add_executor_job( google.get_calendar_info, hass, test_calendar ) assert calendar_info == { "cal_id": "qwertyuiopasdfghjklzxcvbnm@import.calendar.google.com", ...
[ "async", "def", "test_get_calendar_info", "(", "hass", ",", "test_calendar", ")", ":", "calendar_info", "=", "await", "hass", ".", "async_add_executor_job", "(", "google", ".", "get_calendar_info", ",", "hass", ",", "test_calendar", ")", "assert", "calendar_info", ...
[ 32, 0 ]
[ 47, 5 ]
python
en
['en', 'lb', 'en']
True
test_found_calendar
(hass, google_setup, mock_next_event, test_calendar)
Test when a calendar is found.
Test when a calendar is found.
async def test_found_calendar(hass, google_setup, mock_next_event, test_calendar): """Test when a calendar is found.""" config = { "google": { CONF_CLIENT_ID: "id", CONF_CLIENT_SECRET: "secret", "track_new_calendar": True, } } assert await async_setup_...
[ "async", "def", "test_found_calendar", "(", "hass", ",", "google_setup", ",", "mock_next_event", ",", "test_calendar", ")", ":", "config", "=", "{", "\"google\"", ":", "{", "CONF_CLIENT_ID", ":", "\"id\"", ",", "CONF_CLIENT_SECRET", ":", "\"secret\"", ",", "\"tr...
[ 50, 0 ]
[ 66, 76 ]
python
en
['en', 'de', 'en']
True
validate_options
(value)
Validate options. If set position topic is set then get position topic is set as well.
Validate options.
def validate_options(value): """Validate options. If set position topic is set then get position topic is set as well. """ if CONF_SET_POSITION_TOPIC in value and CONF_GET_POSITION_TOPIC not in value: raise vol.Invalid( f"'{CONF_SET_POSITION_TOPIC}' must be set together with '{CONF_...
[ "def", "validate_options", "(", "value", ")", ":", "if", "CONF_SET_POSITION_TOPIC", "in", "value", "and", "CONF_GET_POSITION_TOPIC", "not", "in", "value", ":", "raise", "vol", ".", "Invalid", "(", "f\"'{CONF_SET_POSITION_TOPIC}' must be set together with '{CONF_GET_POSITION...
[ 111, 0 ]
[ 148, 16 ]
python
en
['en', 'et', 'en']
False
async_setup_platform
( hass: HomeAssistant, config: ConfigType, async_add_entities, discovery_info=None )
Set up MQTT cover through configuration.yaml.
Set up MQTT cover through configuration.yaml.
async def async_setup_platform( hass: HomeAssistant, config: ConfigType, async_add_entities, discovery_info=None ): """Set up MQTT cover through configuration.yaml.""" await async_setup_reload_service(hass, DOMAIN, PLATFORMS) await _async_setup_entity(hass, async_add_entities, config)
[ "async", "def", "async_setup_platform", "(", "hass", ":", "HomeAssistant", ",", "config", ":", "ConfigType", ",", "async_add_entities", ",", "discovery_info", "=", "None", ")", ":", "await", "async_setup_reload_service", "(", "hass", ",", "DOMAIN", ",", "PLATFORMS...
[ 202, 0 ]
[ 207, 63 ]
python
en
['en', 'en', 'en']
True
async_setup_entry
(hass, config_entry, async_add_entities)
Set up MQTT cover dynamically through MQTT discovery.
Set up MQTT cover dynamically through MQTT discovery.
async def async_setup_entry(hass, config_entry, async_add_entities): """Set up MQTT cover dynamically through MQTT discovery.""" setup = functools.partial( _async_setup_entity, hass, async_add_entities, config_entry=config_entry ) await async_setup_entry_helper(hass, cover.DOMAIN, setup, PLATFOR...
[ "async", "def", "async_setup_entry", "(", "hass", ",", "config_entry", ",", "async_add_entities", ")", ":", "setup", "=", "functools", ".", "partial", "(", "_async_setup_entity", ",", "hass", ",", "async_add_entities", ",", "config_entry", "=", "config_entry", ")"...
[ 210, 0 ]
[ 215, 78 ]
python
en
['en', 'en', 'en']
True