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_preset_setting
(hass, device_climate_sinope)
Test preset setting.
Test preset setting.
async def test_preset_setting(hass, device_climate_sinope): """Test preset setting.""" entity_id = await find_entity_id(DOMAIN, device_climate_sinope, hass) thrm_cluster = device_climate_sinope.device.endpoints[1].thermostat state = hass.states.get(entity_id) assert state.attributes[ATTR_PRESET_MO...
[ "async", "def", "test_preset_setting", "(", "hass", ",", "device_climate_sinope", ")", ":", "entity_id", "=", "await", "find_entity_id", "(", "DOMAIN", ",", "device_climate_sinope", ",", "hass", ")", "thrm_cluster", "=", "device_climate_sinope", ".", "device", ".", ...
[ 588, 0 ]
[ 663, 80 ]
python
en
['en', 'ko', 'en']
True
test_preset_setting_invalid
(hass, device_climate_sinope)
Test invalid preset setting.
Test invalid preset setting.
async def test_preset_setting_invalid(hass, device_climate_sinope): """Test invalid preset setting.""" entity_id = await find_entity_id(DOMAIN, device_climate_sinope, hass) thrm_cluster = device_climate_sinope.device.endpoints[1].thermostat state = hass.states.get(entity_id) assert state.attribute...
[ "async", "def", "test_preset_setting_invalid", "(", "hass", ",", "device_climate_sinope", ")", ":", "entity_id", "=", "await", "find_entity_id", "(", "DOMAIN", ",", "device_climate_sinope", ",", "hass", ")", "thrm_cluster", "=", "device_climate_sinope", ".", "device",...
[ 666, 0 ]
[ 684, 56 ]
python
en
['en', 'et', 'en']
True
test_set_temperature_hvac_mode
(hass, device_climate)
Test setting HVAC mode in temperature service call.
Test setting HVAC mode in temperature service call.
async def test_set_temperature_hvac_mode(hass, device_climate): """Test setting HVAC mode in temperature service call.""" entity_id = await find_entity_id(DOMAIN, device_climate, hass) thrm_cluster = device_climate.device.endpoints[1].thermostat state = hass.states.get(entity_id) assert state.stat...
[ "async", "def", "test_set_temperature_hvac_mode", "(", "hass", ",", "device_climate", ")", ":", "entity_id", "=", "await", "find_entity_id", "(", "DOMAIN", ",", "device_climate", ",", "hass", ")", "thrm_cluster", "=", "device_climate", ".", "device", ".", "endpoin...
[ 687, 0 ]
[ 712, 5 ]
python
en
['en', 'co', 'en']
True
test_set_temperature_heat_cool
(hass, device_climate_mock)
Test setting temperature service call in heating/cooling HVAC mode.
Test setting temperature service call in heating/cooling HVAC mode.
async def test_set_temperature_heat_cool(hass, device_climate_mock): """Test setting temperature service call in heating/cooling HVAC mode.""" with patch.object( zigpy.zcl.clusters.manufacturer_specific.ManufacturerSpecificCluster, "ep_attribute", "sinope_manufacturer_specific", ): ...
[ "async", "def", "test_set_temperature_heat_cool", "(", "hass", ",", "device_climate_mock", ")", ":", "with", "patch", ".", "object", "(", "zigpy", ".", "zcl", ".", "clusters", ".", "manufacturer_specific", ".", "ManufacturerSpecificCluster", ",", "\"ep_attribute\"", ...
[ 715, 0 ]
[ 802, 5 ]
python
en
['en', 'en', 'en']
True
test_set_temperature_heat
(hass, device_climate_mock)
Test setting temperature service call in heating HVAC mode.
Test setting temperature service call in heating HVAC mode.
async def test_set_temperature_heat(hass, device_climate_mock): """Test setting temperature service call in heating HVAC mode.""" with patch.object( zigpy.zcl.clusters.manufacturer_specific.ManufacturerSpecificCluster, "ep_attribute", "sinope_manufacturer_specific", ): devic...
[ "async", "def", "test_set_temperature_heat", "(", "hass", ",", "device_climate_mock", ")", ":", "with", "patch", ".", "object", "(", "zigpy", ".", "zcl", ".", "clusters", ".", "manufacturer_specific", ".", "ManufacturerSpecificCluster", ",", "\"ep_attribute\"", ",",...
[ 805, 0 ]
[ 885, 5 ]
python
en
['en', 'en', 'en']
True
test_set_temperature_cool
(hass, device_climate_mock)
Test setting temperature service call in cooling HVAC mode.
Test setting temperature service call in cooling HVAC mode.
async def test_set_temperature_cool(hass, device_climate_mock): """Test setting temperature service call in cooling HVAC mode.""" with patch.object( zigpy.zcl.clusters.manufacturer_specific.ManufacturerSpecificCluster, "ep_attribute", "sinope_manufacturer_specific", ): devic...
[ "async", "def", "test_set_temperature_cool", "(", "hass", ",", "device_climate_mock", ")", ":", "with", "patch", ".", "object", "(", "zigpy", ".", "zcl", ".", "clusters", ".", "manufacturer_specific", ".", "ManufacturerSpecificCluster", ",", "\"ep_attribute\"", ",",...
[ 888, 0 ]
[ 968, 5 ]
python
en
['en', 'en', 'en']
True
test_set_temperature_wrong_mode
(hass, device_climate_mock)
Test setting temperature service call for wrong HVAC mode.
Test setting temperature service call for wrong HVAC mode.
async def test_set_temperature_wrong_mode(hass, device_climate_mock): """Test setting temperature service call for wrong HVAC mode.""" with patch.object( zigpy.zcl.clusters.manufacturer_specific.ManufacturerSpecificCluster, "ep_attribute", "sinope_manufacturer_specific", ): ...
[ "async", "def", "test_set_temperature_wrong_mode", "(", "hass", ",", "device_climate_mock", ")", ":", "with", "patch", ".", "object", "(", "zigpy", ".", "zcl", ".", "clusters", ".", "manufacturer_specific", ".", "ManufacturerSpecificCluster", ",", "\"ep_attribute\"", ...
[ 971, 0 ]
[ 1007, 57 ]
python
en
['en', 'en', 'en']
True
test_occupancy_reset
(hass, device_climate_sinope)
Test away preset reset.
Test away preset reset.
async def test_occupancy_reset(hass, device_climate_sinope): """Test away preset reset.""" entity_id = await find_entity_id(DOMAIN, device_climate_sinope, hass) thrm_cluster = device_climate_sinope.device.endpoints[1].thermostat state = hass.states.get(entity_id) assert state.attributes[ATTR_PRESE...
[ "async", "def", "test_occupancy_reset", "(", "hass", ",", "device_climate_sinope", ")", ":", "entity_id", "=", "await", "find_entity_id", "(", "DOMAIN", ",", "device_climate_sinope", ",", "hass", ")", "thrm_cluster", "=", "device_climate_sinope", ".", "device", ".",...
[ 1010, 0 ]
[ 1034, 60 ]
python
de
['de', 'su', 'en']
False
test_fan_mode
(hass, device_climate_fan)
Test fan mode.
Test fan mode.
async def test_fan_mode(hass, device_climate_fan): """Test fan mode.""" entity_id = await find_entity_id(DOMAIN, device_climate_fan, hass) thrm_cluster = device_climate_fan.device.endpoints[1].thermostat state = hass.states.get(entity_id) assert set(state.attributes[ATTR_FAN_MODES]) == {FAN_AUTO, ...
[ "async", "def", "test_fan_mode", "(", "hass", ",", "device_climate_fan", ")", ":", "entity_id", "=", "await", "find_entity_id", "(", "DOMAIN", ",", "device_climate_fan", ",", "hass", ")", "thrm_cluster", "=", "device_climate_fan", ".", "device", ".", "endpoints", ...
[ 1037, 0 ]
[ 1063, 52 ]
python
fy
['id', 'fy', 'nl']
False
test_set_fan_mode_not_supported
(hass, device_climate_fan)
Test fan setting unsupported mode.
Test fan setting unsupported mode.
async def test_set_fan_mode_not_supported(hass, device_climate_fan): """Test fan setting unsupported mode.""" entity_id = await find_entity_id(DOMAIN, device_climate_fan, hass) fan_cluster = device_climate_fan.device.endpoints[1].fan await hass.services.async_call( DOMAIN, SERVICE_SET_...
[ "async", "def", "test_set_fan_mode_not_supported", "(", "hass", ",", "device_climate_fan", ")", ":", "entity_id", "=", "await", "find_entity_id", "(", "DOMAIN", ",", "device_climate_fan", ",", "hass", ")", "fan_cluster", "=", "device_climate_fan", ".", "device", "."...
[ 1066, 0 ]
[ 1078, 56 ]
python
en
['de', 'en', 'en']
True
test_set_fan_mode
(hass, device_climate_fan)
Test fan mode setting.
Test fan mode setting.
async def test_set_fan_mode(hass, device_climate_fan): """Test fan mode setting.""" entity_id = await find_entity_id(DOMAIN, device_climate_fan, hass) fan_cluster = device_climate_fan.device.endpoints[1].fan state = hass.states.get(entity_id) assert state.attributes[ATTR_FAN_MODE] == FAN_AUTO ...
[ "async", "def", "test_set_fan_mode", "(", "hass", ",", "device_climate_fan", ")", ":", "entity_id", "=", "await", "find_entity_id", "(", "DOMAIN", ",", "device_climate_fan", ",", "hass", ")", "fan_cluster", "=", "device_climate_fan", ".", "device", ".", "endpoints...
[ 1081, 0 ]
[ 1107, 74 ]
python
en
['id', 'fy', 'en']
False
requests_mock_fixture
(requests_mock)
Fixture to provide a requests mocker.
Fixture to provide a requests mocker.
def requests_mock_fixture(requests_mock): """Fixture to provide a requests mocker.""" # Mocks the login response for abodepy. requests_mock.post(CONST.LOGIN_URL, text=load_fixture("abode_login.json")) # Mocks the logout response for abodepy. requests_mock.post(CONST.LOGOUT_URL, text=load_fixture("ab...
[ "def", "requests_mock_fixture", "(", "requests_mock", ")", ":", "# Mocks the login response for abodepy.", "requests_mock", ".", "post", "(", "CONST", ".", "LOGIN_URL", ",", "text", "=", "load_fixture", "(", "\"abode_login.json\"", ")", ")", "# Mocks the logout response f...
[ 9, 0 ]
[ 24, 81 ]
python
en
['en', 'en', 'en']
True
async_setup_platform
(hass, config, async_add_entities, discovery_info=None)
Import the platform into a config entry.
Import the platform into a config entry.
async def async_setup_platform(hass, config, async_add_entities, discovery_info=None): """Import the platform into a config entry.""" hass.async_create_task( hass.config_entries.flow.async_init( DOMAIN, context={"source": SOURCE_IMPORT}, data=config ) )
[ "async", "def", "async_setup_platform", "(", "hass", ",", "config", ",", "async_add_entities", ",", "discovery_info", "=", "None", ")", ":", "hass", ".", "async_create_task", "(", "hass", ".", "config_entries", ".", "flow", ".", "async_init", "(", "DOMAIN", ",...
[ 64, 0 ]
[ 70, 5 ]
python
en
['en', 'en', 'en']
True
async_setup_entry
( hass: HomeAssistantType, entry: ConfigEntry, async_add_entities )
Set up the DSMR sensor.
Set up the DSMR sensor.
async def async_setup_entry( hass: HomeAssistantType, entry: ConfigEntry, async_add_entities ) -> None: """Set up the DSMR sensor.""" config = entry.data options = entry.options dsmr_version = config[CONF_DSMR_VERSION] # Define list of name,obis mappings to generate entities obis_mapping =...
[ "async", "def", "async_setup_entry", "(", "hass", ":", "HomeAssistantType", ",", "entry", ":", "ConfigEntry", ",", "async_add_entities", ")", "->", "None", ":", "config", "=", "entry", ".", "data", "options", "=", "entry", ".", "options", "dsmr_version", "=", ...
[ 73, 0 ]
[ 233, 55 ]
python
en
['en', 'bs', 'en']
True
DSMREntity.__init__
(self, name, device_name, device_serial, obis, config)
Initialize entity.
Initialize entity.
def __init__(self, name, device_name, device_serial, obis, config): """Initialize entity.""" self._name = name self._obis = obis self._config = config self.telegram = {} self._device_name = device_name self._device_serial = device_serial self._unique_id =...
[ "def", "__init__", "(", "self", ",", "name", ",", "device_name", ",", "device_serial", ",", "obis", ",", "config", ")", ":", "self", ".", "_name", "=", "name", "self", ".", "_obis", "=", "obis", "self", ".", "_config", "=", "config", "self", ".", "te...
[ 239, 4 ]
[ 248, 69 ]
python
es
['es', 'pl', 'it']
False
DSMREntity.update_data
(self, telegram)
Update data.
Update data.
def update_data(self, telegram): """Update data.""" self.telegram = telegram if self.hass and self._obis in self.telegram: self.async_write_ha_state()
[ "def", "update_data", "(", "self", ",", "telegram", ")", ":", "self", ".", "telegram", "=", "telegram", "if", "self", ".", "hass", "and", "self", ".", "_obis", "in", "self", ".", "telegram", ":", "self", ".", "async_write_ha_state", "(", ")" ]
[ 251, 4 ]
[ 255, 39 ]
python
co
['fr', 'co', 'en']
False
DSMREntity.get_dsmr_object_attr
(self, attribute)
Read attribute from last received telegram for this DSMR object.
Read attribute from last received telegram for this DSMR object.
def get_dsmr_object_attr(self, attribute): """Read attribute from last received telegram for this DSMR object.""" # Make sure telegram contains an object for this entities obis if self._obis not in self.telegram: return None # Get the attribute value if the object has it ...
[ "def", "get_dsmr_object_attr", "(", "self", ",", "attribute", ")", ":", "# Make sure telegram contains an object for this entities obis", "if", "self", ".", "_obis", "not", "in", "self", ".", "telegram", ":", "return", "None", "# Get the attribute value if the object has it...
[ 257, 4 ]
[ 265, 52 ]
python
en
['en', 'en', 'en']
True
DSMREntity.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" ]
[ 268, 4 ]
[ 270, 25 ]
python
en
['en', 'mi', 'en']
True
DSMREntity.icon
(self)
Icon to use in the frontend, if any.
Icon to use in the frontend, if any.
def icon(self): """Icon to use in the frontend, if any.""" if "Sags" in self._name or "Swells" in self.name: return ICON_SWELL_SAG if "Failure" in self._name: return ICON_POWER_FAILURE if "Power" in self._name: return ICON_POWER if "Gas" in sel...
[ "def", "icon", "(", "self", ")", ":", "if", "\"Sags\"", "in", "self", ".", "_name", "or", "\"Swells\"", "in", "self", ".", "name", ":", "return", "ICON_SWELL_SAG", "if", "\"Failure\"", "in", "self", ".", "_name", ":", "return", "ICON_POWER_FAILURE", "if", ...
[ 273, 4 ]
[ 282, 27 ]
python
en
['en', 'en', 'en']
True
DSMREntity.state
(self)
Return the state of sensor, if available, translate if needed.
Return the state of sensor, if available, translate if needed.
def state(self): """Return the state of sensor, if available, translate if needed.""" value = self.get_dsmr_object_attr("value") if self._obis == obis_ref.ELECTRICITY_ACTIVE_TARIFF: return self.translate_tariff(value, self._config[CONF_DSMR_VERSION]) try: value ...
[ "def", "state", "(", "self", ")", ":", "value", "=", "self", ".", "get_dsmr_object_attr", "(", "\"value\"", ")", "if", "self", ".", "_obis", "==", "obis_ref", ".", "ELECTRICITY_ACTIVE_TARIFF", ":", "return", "self", ".", "translate_tariff", "(", "value", ","...
[ 285, 4 ]
[ 300, 19 ]
python
en
['en', 'en', 'en']
True
DSMREntity.unit_of_measurement
(self)
Return the unit of measurement of this entity, if any.
Return the unit of measurement of this entity, if any.
def unit_of_measurement(self): """Return the unit of measurement of this entity, if any.""" return self.get_dsmr_object_attr("unit")
[ "def", "unit_of_measurement", "(", "self", ")", ":", "return", "self", ".", "get_dsmr_object_attr", "(", "\"unit\"", ")" ]
[ 303, 4 ]
[ 305, 48 ]
python
en
['en', 'en', 'en']
True
DSMREntity.unique_id
(self)
Return a unique ID.
Return a unique ID.
def unique_id(self) -> str: """Return a unique ID.""" return self._unique_id
[ "def", "unique_id", "(", "self", ")", "->", "str", ":", "return", "self", ".", "_unique_id" ]
[ 308, 4 ]
[ 310, 30 ]
python
ca
['fr', 'ca', 'en']
False
DSMREntity.device_info
(self)
Return the device information.
Return the device information.
def device_info(self) -> Dict[str, any]: """Return the device information.""" return { "identifiers": {(DOMAIN, self._device_serial)}, "name": self._device_name, }
[ "def", "device_info", "(", "self", ")", "->", "Dict", "[", "str", ",", "any", "]", ":", "return", "{", "\"identifiers\"", ":", "{", "(", "DOMAIN", ",", "self", ".", "_device_serial", ")", "}", ",", "\"name\"", ":", "self", ".", "_device_name", ",", "...
[ 313, 4 ]
[ 318, 9 ]
python
en
['en', 'en', 'en']
True
DSMREntity.force_update
(self)
Force update.
Force update.
def force_update(self): """Force update.""" return True
[ "def", "force_update", "(", "self", ")", ":", "return", "True" ]
[ 321, 4 ]
[ 323, 19 ]
python
en
['en', 'en', 'en']
False
DSMREntity.should_poll
(self)
Disable polling.
Disable polling.
def should_poll(self): """Disable polling.""" return False
[ "def", "should_poll", "(", "self", ")", ":", "return", "False" ]
[ 326, 4 ]
[ 328, 20 ]
python
en
['fr', 'en', 'en']
False
DSMREntity.translate_tariff
(value, dsmr_version)
Convert 2/1 to normal/low depending on DSMR version.
Convert 2/1 to normal/low depending on DSMR version.
def translate_tariff(value, dsmr_version): """Convert 2/1 to normal/low depending on DSMR version.""" # DSMR V5B: Note: In Belgium values are swapped: # Rate code 2 is used for low rate and rate code 1 is used for normal rate. if dsmr_version in ("5B",): if value == "0001": ...
[ "def", "translate_tariff", "(", "value", ",", "dsmr_version", ")", ":", "# DSMR V5B: Note: In Belgium values are swapped:", "# Rate code 2 is used for low rate and rate code 1 is used for normal rate.", "if", "dsmr_version", "in", "(", "\"5B\"", ",", ")", ":", "if", "value", ...
[ 331, 4 ]
[ 347, 19 ]
python
en
['en', 'nl', 'en']
True
DerivativeDSMREntity.state
(self)
Return the calculated current hourly rate.
Return the calculated current hourly rate.
def state(self): """Return the calculated current hourly rate.""" return self._state
[ "def", "state", "(", "self", ")", ":", "return", "self", ".", "_state" ]
[ 363, 4 ]
[ 365, 26 ]
python
en
['en', 'en', 'en']
True
DerivativeDSMREntity.force_update
(self)
Disable force update.
Disable force update.
def force_update(self): """Disable force update.""" return False
[ "def", "force_update", "(", "self", ")", ":", "return", "False" ]
[ 368, 4 ]
[ 370, 20 ]
python
en
['en', 'en', 'en']
True
DerivativeDSMREntity.should_poll
(self)
Enable polling.
Enable polling.
def should_poll(self): """Enable polling.""" return True
[ "def", "should_poll", "(", "self", ")", ":", "return", "True" ]
[ 373, 4 ]
[ 375, 19 ]
python
en
['fr', 'en', 'en']
False
DerivativeDSMREntity.async_update
(self)
Recalculate hourly rate if timestamp has changed. DSMR updates gas meter reading every hour. Along with the new value a timestamp is provided for the reading. Test if the last known timestamp differs from the current one then calculate a new rate for the previous hour.
Recalculate hourly rate if timestamp has changed.
async def async_update(self): """Recalculate hourly rate if timestamp has changed. DSMR updates gas meter reading every hour. Along with the new value a timestamp is provided for the reading. Test if the last known timestamp differs from the current one then calculate a new rate...
[ "async", "def", "async_update", "(", "self", ")", ":", "# check if the timestamp for the object differs from the previous one", "timestamp", "=", "self", ".", "get_dsmr_object_attr", "(", "\"datetime\"", ")", "if", "timestamp", "and", "timestamp", "!=", "self", ".", "_p...
[ 377, 4 ]
[ 403, 48 ]
python
en
['en', 'en', 'en']
True
DerivativeDSMREntity.unit_of_measurement
(self)
Return the unit of measurement of this entity, per hour, if any.
Return the unit of measurement of this entity, per hour, if any.
def unit_of_measurement(self): """Return the unit of measurement of this entity, per hour, if any.""" unit = self.get_dsmr_object_attr("unit") if unit: return f"{unit}/{TIME_HOURS}"
[ "def", "unit_of_measurement", "(", "self", ")", ":", "unit", "=", "self", ".", "get_dsmr_object_attr", "(", "\"unit\"", ")", "if", "unit", ":", "return", "f\"{unit}/{TIME_HOURS}\"" ]
[ 406, 4 ]
[ 410, 41 ]
python
en
['en', 'en', 'en']
True
test_merging_permissions_true_rules_dict
()
Test merging policy with two entities.
Test merging policy with two entities.
def test_merging_permissions_true_rules_dict(): """Test merging policy with two entities.""" policy1 = { "something_else": True, "entities": {"entity_ids": {"light.kitchen": True}}, } policy2 = {"entities": {"entity_ids": True}} assert merge_policies([policy1, policy2]) == { ...
[ "def", "test_merging_permissions_true_rules_dict", "(", ")", ":", "policy1", "=", "{", "\"something_else\"", ":", "True", ",", "\"entities\"", ":", "{", "\"entity_ids\"", ":", "{", "\"light.kitchen\"", ":", "True", "}", "}", ",", "}", "policy2", "=", "{", "\"e...
[ 4, 0 ]
[ 14, 5 ]
python
en
['en', 'en', 'en']
True
test_merging_permissions_multiple_subcategories
()
Test merging policy with two entities.
Test merging policy with two entities.
def test_merging_permissions_multiple_subcategories(): """Test merging policy with two entities.""" policy1 = {"entities": None} policy2 = {"entities": {"entity_ids": True}} policy3 = {"entities": True} assert merge_policies([policy1, policy2]) == policy2 assert merge_policies([policy1, policy3]...
[ "def", "test_merging_permissions_multiple_subcategories", "(", ")", ":", "policy1", "=", "{", "\"entities\"", ":", "None", "}", "policy2", "=", "{", "\"entities\"", ":", "{", "\"entity_ids\"", ":", "True", "}", "}", "policy3", "=", "{", "\"entities\"", ":", "T...
[ 17, 0 ]
[ 25, 56 ]
python
en
['en', 'en', 'en']
True
async_setup
(hass, config)
Set up the Sonos component.
Set up the Sonos component.
async def async_setup(hass, config): """Set up the Sonos component.""" conf = config.get(DOMAIN) hass.data[DOMAIN] = conf or {} if conf is not None: hass.async_create_task( hass.config_entries.flow.async_init( DOMAIN, context={"source": config_entries.SOURCE_IMPORT}...
[ "async", "def", "async_setup", "(", "hass", ",", "config", ")", ":", "conf", "=", "config", ".", "get", "(", "DOMAIN", ")", "hass", ".", "data", "[", "DOMAIN", "]", "=", "conf", "or", "{", "}", "if", "conf", "is", "not", "None", ":", "hass", ".",...
[ 35, 0 ]
[ 48, 15 ]
python
en
['en', 'en', 'en']
True
async_setup_entry
(hass, entry)
Set up Sonos from a config entry.
Set up Sonos from a config entry.
async def async_setup_entry(hass, entry): """Set up Sonos from a config entry.""" hass.async_create_task( hass.config_entries.async_forward_entry_setup(entry, MP_DOMAIN) ) return True
[ "async", "def", "async_setup_entry", "(", "hass", ",", "entry", ")", ":", "hass", ".", "async_create_task", "(", "hass", ".", "config_entries", ".", "async_forward_entry_setup", "(", "entry", ",", "MP_DOMAIN", ")", ")", "return", "True" ]
[ 51, 0 ]
[ 56, 15 ]
python
en
['en', 'en', 'en']
True
get_coordinator_name
(hass, entity_id)
Obtain the room/name of a device's coordinator. Used by the Plex integration. This function is safe to run inside the event loop.
Obtain the room/name of a device's coordinator.
def get_coordinator_name(hass, entity_id): """Obtain the room/name of a device's coordinator. Used by the Plex integration. This function is safe to run inside the event loop. """ if DATA_SONOS not in hass.data: raise HomeAssistantError("Sonos integration not set up") device = next( ...
[ "def", "get_coordinator_name", "(", "hass", ",", "entity_id", ")", ":", "if", "DATA_SONOS", "not", "in", "hass", ".", "data", ":", "raise", "HomeAssistantError", "(", "\"Sonos integration not set up\"", ")", "device", "=", "next", "(", "(", "x", "for", "x", ...
[ 60, 0 ]
[ 76, 34 ]
python
en
['en', 'en', 'en']
True
CitibikeBusinessEngine.frame
(self)
FrameBase: Current frame.
FrameBase: Current frame.
def frame(self) -> FrameBase: """FrameBase: Current frame.""" return self._frame
[ "def", "frame", "(", "self", ")", "->", "FrameBase", ":", "return", "self", ".", "_frame" ]
[ 75, 4 ]
[ 77, 26 ]
python
en
['en', 'no', 'en']
True
CitibikeBusinessEngine.snapshots
(self)
SnapshotList: Current snapshot list.
SnapshotList: Current snapshot list.
def snapshots(self) -> SnapshotList: """SnapshotList: Current snapshot list.""" return self._snapshots
[ "def", "snapshots", "(", "self", ")", "->", "SnapshotList", ":", "return", "self", ".", "_snapshots" ]
[ 80, 4 ]
[ 82, 30 ]
python
en
['en', 'de', 'en']
True
CitibikeBusinessEngine.configs
(self)
dict: Current configuration.
dict: Current configuration.
def configs(self) -> dict: """dict: Current configuration.""" return self._conf
[ "def", "configs", "(", "self", ")", "->", "dict", ":", "return", "self", ".", "_conf" ]
[ 85, 4 ]
[ 87, 25 ]
python
en
['en', 'la', 'en']
True
CitibikeBusinessEngine.step
(self, tick: int)
Push business engine to next step. Args: tick (int): Current tick to process.
Push business engine to next step.
def step(self, tick: int): """Push business engine to next step. Args: tick (int): Current tick to process. """ # If we do not set auto event, then we need to push it manually. for trip in self._item_picker.items(tick): # Generate a trip event, to dispatc...
[ "def", "step", "(", "self", ",", "tick", ":", "int", ")", ":", "# If we do not set auto event, then we need to push it manually.", "for", "trip", "in", "self", ".", "_item_picker", ".", "items", "(", "tick", ")", ":", "# Generate a trip event, to dispatch to related cal...
[ 89, 4 ]
[ 111, 49 ]
python
en
['en', 'en', 'en']
True
CitibikeBusinessEngine.get_node_mapping
(self)
dict: Node mapping of current stations.
dict: Node mapping of current stations.
def get_node_mapping(self) -> dict: """dict: Node mapping of current stations.""" node_mapping = {} for station in self._stations: node_mapping[station.index] = station.id return node_mapping
[ "def", "get_node_mapping", "(", "self", ")", "->", "dict", ":", "node_mapping", "=", "{", "}", "for", "station", "in", "self", ".", "_stations", ":", "node_mapping", "[", "station", ".", "index", "]", "=", "station", ".", "id", "return", "node_mapping" ]
[ 132, 4 ]
[ 137, 27 ]
python
en
['en', 'en', 'en']
True
CitibikeBusinessEngine.get_event_payload_detail
(self)
dict: Event payload details of current scenario.
dict: Event payload details of current scenario.
def get_event_payload_detail(self) -> dict: """dict: Event payload details of current scenario.""" return { CitiBikeEvents.RequireBike.name: list(self._trip_reader.meta.columns.keys()), CitiBikeEvents.ReturnBike.name: BikeReturnPayload.summary_key, CitiBikeEvents.Reba...
[ "def", "get_event_payload_detail", "(", "self", ")", "->", "dict", ":", "return", "{", "CitiBikeEvents", ".", "RequireBike", ".", "name", ":", "list", "(", "self", ".", "_trip_reader", ".", "meta", ".", "columns", ".", "keys", "(", ")", ")", ",", "CitiBi...
[ 139, 4 ]
[ 146, 9 ]
python
en
['en', 'en', 'en']
True
CitibikeBusinessEngine.reset
(self)
Reset internal states for episode.
Reset internal states for episode.
def reset(self): """Reset internal states for episode.""" self._total_trips = 0 self._total_operate_num = 0 self._total_shortages = 0 self._frame.reset() self._snapshots.reset() self._trip_reader.reset() self._item_picker = self._trip_reader.items_tick...
[ "def", "reset", "(", "self", ")", ":", "self", ".", "_total_trips", "=", "0", "self", ".", "_total_operate_num", "=", "0", "self", ".", "_total_shortages", "=", "0", "self", ".", "_frame", ".", "reset", "(", ")", "self", ".", "_snapshots", ".", "reset"...
[ 148, 4 ]
[ 170, 30 ]
python
en
['en', 'en', 'en']
True
CitibikeBusinessEngine.get_agent_idx_list
(self)
Get a list of agent index. Returns: list: List of agent index.
Get a list of agent index.
def get_agent_idx_list(self) -> List[int]: """Get a list of agent index. Returns: list: List of agent index. """ return [station.index for station in self._stations]
[ "def", "get_agent_idx_list", "(", "self", ")", "->", "List", "[", "int", "]", ":", "return", "[", "station", ".", "index", "for", "station", "in", "self", ".", "_stations", "]" ]
[ 172, 4 ]
[ 178, 60 ]
python
en
['en', 'en', 'en']
True
CitibikeBusinessEngine.get_metrics
(self)
Get current metrics information. Note: Call this method at different time will get different result. Returns: dict: Metrics information.
Get current metrics information.
def get_metrics(self) -> dict: """Get current metrics information. Note: Call this method at different time will get different result. Returns: dict: Metrics information. """ return DocableDict( metrics_desc, trip_requirements=sel...
[ "def", "get_metrics", "(", "self", ")", "->", "dict", ":", "return", "DocableDict", "(", "metrics_desc", ",", "trip_requirements", "=", "self", ".", "_total_trips", ",", "bike_shortage", "=", "self", ".", "_total_shortages", ",", "operation_number", "=", "self",...
[ 180, 4 ]
[ 194, 9 ]
python
en
['en', 'nl', 'en']
True
CitibikeBusinessEngine.__del__
(self)
Collect resource by order.
Collect resource by order.
def __del__(self): """Collect resource by order.""" self._item_picker = None if self._trip_reader: # Close binary reader first, so that we can clean it correctly. self._trip_reader.close()
[ "def", "__del__", "(", "self", ")", ":", "self", ".", "_item_picker", "=", "None", "if", "self", ".", "_trip_reader", ":", "# Close binary reader first, so that we can clean it correctly.", "self", ".", "_trip_reader", ".", "close", "(", ")" ]
[ 196, 4 ]
[ 203, 37 ]
python
en
['en', 'en', 'en']
True
CitibikeBusinessEngine._load_configs
(self)
Load configurations
Load configurations
def _load_configs(self): """Load configurations""" with open(os.path.join(self._config_path, "config.yml")) as fp: self._conf = safe_load(fp)
[ "def", "_load_configs", "(", "self", ")", ":", "with", "open", "(", "os", ".", "path", ".", "join", "(", "self", ".", "_config_path", ",", "\"config.yml\"", ")", ")", "as", "fp", ":", "self", ".", "_conf", "=", "safe_load", "(", "fp", ")" ]
[ 257, 4 ]
[ 260, 38 ]
python
en
['en', 'ca', 'en']
False
CitibikeBusinessEngine._update_station_extra_features
(self, tick: int)
Update features that not related to trips.
Update features that not related to trips.
def _update_station_extra_features(self, tick: int): """Update features that not related to trips.""" cur_datetime = self._tick_2_date(tick) if self._last_date == cur_datetime: return self._last_date = cur_datetime weather_info = self._weather_lut[cur_datetime] ...
[ "def", "_update_station_extra_features", "(", "self", ",", "tick", ":", "int", ")", ":", "cur_datetime", "=", "self", ".", "_tick_2_date", "(", "tick", ")", "if", "self", ".", "_last_date", "==", "cur_datetime", ":", "return", "self", ".", "_last_date", "=",...
[ 319, 4 ]
[ 345, 45 ]
python
en
['en', 'en', 'en']
True
CitibikeBusinessEngine._on_required_bike
(self, evt: AtomEvent)
Callback when there is a trip requirement generated.
Callback when there is a trip requirement generated.
def _on_required_bike(self, evt: AtomEvent): """Callback when there is a trip requirement generated.""" trip = evt.payload station_idx: int = trip.src_station station: Station = self._stations[station_idx] station_bikes = station.bikes # Update trip count, each item onl...
[ "def", "_on_required_bike", "(", "self", ",", "evt", ":", "AtomEvent", ")", ":", "trip", "=", "evt", ".", "payload", "station_idx", ":", "int", "=", "trip", ".", "src_station", "station", ":", "Station", "=", "self", ".", "_stations", "[", "station_idx", ...
[ 347, 4 ]
[ 381, 60 ]
python
en
['en', 'en', 'en']
True
CitibikeBusinessEngine._on_bike_returned
(self, evt: AtomEvent)
Callback when there is a bike returned to a station.
Callback when there is a bike returned to a station.
def _on_bike_returned(self, evt: AtomEvent): """Callback when there is a bike returned to a station.""" payload: BikeReturnPayload = evt.payload station: Station = self._stations[payload.to_station_idx] station_bikes = station.bikes return_number = payload.number empty...
[ "def", "_on_bike_returned", "(", "self", ",", "evt", ":", "AtomEvent", ")", ":", "payload", ":", "BikeReturnPayload", "=", "evt", ".", "payload", "station", ":", "Station", "=", "self", ".", "_stations", "[", "payload", ".", "to_station_idx", "]", "station_b...
[ 383, 4 ]
[ 407, 57 ]
python
en
['en', 'en', 'en']
True
CitibikeBusinessEngine._on_rebalance_bikes
(self, evt: AtomEvent)
Callback when need to check if we should send decision event to agent.
Callback when need to check if we should send decision event to agent.
def _on_rebalance_bikes(self, evt: AtomEvent): """Callback when need to check if we should send decision event to agent.""" # Get stations that need an action. stations_need_decision = self._decision_strategy.get_stations_need_decision( evt.tick) if len(stations_need_decisi...
[ "def", "_on_rebalance_bikes", "(", "self", ",", "evt", ":", "AtomEvent", ")", ":", "# Get stations that need an action.", "stations_need_decision", "=", "self", ".", "_decision_strategy", ".", "get_stations_need_decision", "(", "evt", ".", "tick", ")", "if", "len", ...
[ 409, 4 ]
[ 428, 61 ]
python
en
['en', 'en', 'en']
True
CitibikeBusinessEngine._on_bike_deliver
(self, evt: AtomEvent)
Callback when our transferred bikes reach the destination.
Callback when our transferred bikes reach the destination.
def _on_bike_deliver(self, evt: AtomEvent): """Callback when our transferred bikes reach the destination.""" payload: BikeTransferPayload = evt.payload station: Station = self._stations[payload.to_station_idx] station_bikes = station.bikes transfered_number = payload.number ...
[ "def", "_on_bike_deliver", "(", "self", ",", "evt", ":", "AtomEvent", ")", ":", "payload", ":", "BikeTransferPayload", "=", "evt", ".", "payload", "station", ":", "Station", "=", "self", ".", "_stations", "[", "payload", ".", "to_station_idx", "]", "station_...
[ 430, 4 ]
[ 452, 57 ]
python
en
['en', 'it', 'en']
True
CitibikeBusinessEngine._on_action_received
(self, evt: AtomEvent)
Callback when we get an action from agent.
Callback when we get an action from agent.
def _on_action_received(self, evt: AtomEvent): """Callback when we get an action from agent.""" action = None if evt is None or evt.payload is None: return for action in evt.payload: from_station_idx: int = action.from_station_idx to_station_idx: int...
[ "def", "_on_action_received", "(", "self", ",", "evt", ":", "AtomEvent", ")", ":", "action", "=", "None", "if", "evt", "is", "None", "or", "evt", ".", "payload", "is", "None", ":", "return", "for", "action", "in", "evt", ".", "payload", ":", "from_stat...
[ 454, 4 ]
[ 486, 61 ]
python
en
['en', 'en', 'en']
True
CitibikeBusinessEngine._build_temp_data
(self)
Build temporary data for predefined environment.
Build temporary data for predefined environment.
def _build_temp_data(self): """Build temporary data for predefined environment.""" logger.warning_yellow( f"Binary data files for scenario: citi_bike topology: {self._topology} not found.") citi_bike_process = CitiBikeProcess(is_temp=True) if self._topology in citi_bike_proce...
[ "def", "_build_temp_data", "(", "self", ")", ":", "logger", ".", "warning_yellow", "(", "f\"Binary data files for scenario: citi_bike topology: {self._topology} not found.\"", ")", "citi_bike_process", "=", "CitiBikeProcess", "(", "is_temp", "=", "True", ")", "if", "self", ...
[ 488, 4 ]
[ 518, 13 ]
python
en
['en', 'en', 'en']
True
match_val_type
(vals, vals_bounds, vals_types)
Update values in the array, to match their corresponding type
Update values in the array, to match their corresponding type
def match_val_type(vals, vals_bounds, vals_types): ''' Update values in the array, to match their corresponding type ''' vals_new = [] for i, _ in enumerate(vals_types): if vals_types[i] == "discrete_int": # Find the closest integer in the array, vals_bounds # pylint...
[ "def", "match_val_type", "(", "vals", ",", "vals_bounds", ",", "vals_types", ")", ":", "vals_new", "=", "[", "]", "for", "i", ",", "_", "in", "enumerate", "(", "vals_types", ")", ":", "if", "vals_types", "[", "i", "]", "==", "\"discrete_int\"", ":", "#...
[ 7, 0 ]
[ 27, 19 ]
python
en
['en', 'error', 'th']
False
rand
(x_bounds, x_types)
Random generate variable value within their bounds
Random generate variable value within their bounds
def rand(x_bounds, x_types): ''' Random generate variable value within their bounds ''' outputs = [] for i, _ in enumerate(x_bounds): if x_types[i] == "discrete_int": temp = x_bounds[i][random.randint(0, len(x_bounds[i]) - 1)] outputs.append(temp) elif x_type...
[ "def", "rand", "(", "x_bounds", ",", "x_types", ")", ":", "outputs", "=", "[", "]", "for", "i", ",", "_", "in", "enumerate", "(", "x_bounds", ")", ":", "if", "x_types", "[", "i", "]", "==", "\"discrete_int\"", ":", "temp", "=", "x_bounds", "[", "i"...
[ 30, 0 ]
[ 49, 18 ]
python
en
['en', 'error', 'th']
False
setup_platform
(hass, config, add_entities, discovery_info=None)
Set up the Binary Sensor platform for EnOcean.
Set up the Binary Sensor platform for EnOcean.
def setup_platform(hass, config, add_entities, discovery_info=None): """Set up the Binary Sensor platform for EnOcean.""" dev_id = config.get(CONF_ID) dev_name = config.get(CONF_NAME) device_class = config.get(CONF_DEVICE_CLASS) add_entities([EnOceanBinarySensor(dev_id, dev_name, device_class)])
[ "def", "setup_platform", "(", "hass", ",", "config", ",", "add_entities", ",", "discovery_info", "=", "None", ")", ":", "dev_id", "=", "config", ".", "get", "(", "CONF_ID", ")", "dev_name", "=", "config", ".", "get", "(", "CONF_NAME", ")", "device_class", ...
[ 26, 0 ]
[ 32, 71 ]
python
en
['en', 'da', 'en']
True
EnOceanBinarySensor.__init__
(self, dev_id, dev_name, device_class)
Initialize the EnOcean binary sensor.
Initialize the EnOcean binary sensor.
def __init__(self, dev_id, dev_name, device_class): """Initialize the EnOcean binary sensor.""" super().__init__(dev_id, dev_name) self._device_class = device_class self.which = -1 self.onoff = -1
[ "def", "__init__", "(", "self", ",", "dev_id", ",", "dev_name", ",", "device_class", ")", ":", "super", "(", ")", ".", "__init__", "(", "dev_id", ",", "dev_name", ")", "self", ".", "_device_class", "=", "device_class", "self", ".", "which", "=", "-", "...
[ 43, 4 ]
[ 48, 23 ]
python
en
['en', 'zh-Latn', 'en']
True
EnOceanBinarySensor.name
(self)
Return the default name for the binary sensor.
Return the default name for the binary sensor.
def name(self): """Return the default name for the binary sensor.""" return self.dev_name
[ "def", "name", "(", "self", ")", ":", "return", "self", ".", "dev_name" ]
[ 51, 4 ]
[ 53, 28 ]
python
en
['en', 'no', 'en']
True
EnOceanBinarySensor.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 self._device_class
[ "def", "device_class", "(", "self", ")", ":", "return", "self", ".", "_device_class" ]
[ 56, 4 ]
[ 58, 33 ]
python
en
['en', 'en', 'en']
True
EnOceanBinarySensor.value_changed
(self, packet)
Fire an event with the data that have changed. This method is called when there is an incoming packet associated with this platform. Example packet data: - 2nd button pressed ['0xf6', '0x10', '0x00', '0x2d', '0xcf', '0x45', '0x30'] - button released ['0x...
Fire an event with the data that have changed.
def value_changed(self, packet): """Fire an event with the data that have changed. This method is called when there is an incoming packet associated with this platform. Example packet data: - 2nd button pressed ['0xf6', '0x10', '0x00', '0x2d', '0xcf', '0x45', '0x30'...
[ "def", "value_changed", "(", "self", ",", "packet", ")", ":", "# Energy Bow", "pushed", "=", "None", "if", "packet", ".", "data", "[", "6", "]", "==", "0x30", ":", "pushed", "=", "1", "elif", "packet", ".", "data", "[", "6", "]", "==", "0x20", ":",...
[ 60, 4 ]
[ 109, 9 ]
python
en
['en', 'en', 'en']
True
remote_fixture
()
Patch the samsungctl Remote.
Patch the samsungctl Remote.
def remote_fixture(): """Patch the samsungctl Remote.""" with patch( "homeassistant.components.samsungtv.bridge.Remote" ) as remote_class, patch( "homeassistant.components.samsungtv.config_flow.socket" ) as socket1, patch( "homeassistant.components.samsungtv.socket" ) as sock...
[ "def", "remote_fixture", "(", ")", ":", "with", "patch", "(", "\"homeassistant.components.samsungtv.bridge.Remote\"", ")", "as", "remote_class", ",", "patch", "(", "\"homeassistant.components.samsungtv.config_flow.socket\"", ")", "as", "socket1", ",", "patch", "(", "\"hom...
[ 112, 0 ]
[ 127, 20 ]
python
en
['en', 'en', 'en']
True
remotews_fixture
()
Patch the samsungtvws SamsungTVWS.
Patch the samsungtvws SamsungTVWS.
def remotews_fixture(): """Patch the samsungtvws SamsungTVWS.""" with patch( "homeassistant.components.samsungtv.bridge.SamsungTVWS" ) as remote_class, patch( "homeassistant.components.samsungtv.config_flow.socket" ) as socket1, patch( "homeassistant.components.samsungtv.socket" ...
[ "def", "remotews_fixture", "(", ")", ":", "with", "patch", "(", "\"homeassistant.components.samsungtv.bridge.SamsungTVWS\"", ")", "as", "remote_class", ",", "patch", "(", "\"homeassistant.components.samsungtv.config_flow.socket\"", ")", "as", "socket1", ",", "patch", "(", ...
[ 131, 0 ]
[ 147, 20 ]
python
en
['en', 'sk', 'en']
True
delay_fixture
()
Patch the delay script function.
Patch the delay script function.
def delay_fixture(): """Patch the delay script function.""" with patch( "homeassistant.components.samsungtv.media_player.Script.async_run" ) as delay: yield delay
[ "def", "delay_fixture", "(", ")", ":", "with", "patch", "(", "\"homeassistant.components.samsungtv.media_player.Script.async_run\"", ")", "as", "delay", ":", "yield", "delay" ]
[ 151, 0 ]
[ 156, 19 ]
python
en
['en', 'en', 'en']
True
mock_now
()
Fixture for dtutil.now.
Fixture for dtutil.now.
def mock_now(): """Fixture for dtutil.now.""" return dt_util.utcnow()
[ "def", "mock_now", "(", ")", ":", "return", "dt_util", ".", "utcnow", "(", ")" ]
[ 160, 0 ]
[ 162, 27 ]
python
da
['da', 'da', 'en']
True
setup_samsungtv
(hass, config)
Set up mock Samsung TV.
Set up mock Samsung TV.
async def setup_samsungtv(hass, config): """Set up mock Samsung TV.""" await async_setup_component(hass, SAMSUNGTV_DOMAIN, config) await hass.async_block_till_done()
[ "async", "def", "setup_samsungtv", "(", "hass", ",", "config", ")", ":", "await", "async_setup_component", "(", "hass", ",", "SAMSUNGTV_DOMAIN", ",", "config", ")", "await", "hass", ".", "async_block_till_done", "(", ")" ]
[ 165, 0 ]
[ 168, 38 ]
python
en
['en', 'da', 'en']
True
test_setup_with_turnon
(hass, remote)
Test setup of platform.
Test setup of platform.
async def test_setup_with_turnon(hass, remote): """Test setup of platform.""" await setup_samsungtv(hass, MOCK_CONFIG) assert hass.states.get(ENTITY_ID)
[ "async", "def", "test_setup_with_turnon", "(", "hass", ",", "remote", ")", ":", "await", "setup_samsungtv", "(", "hass", ",", "MOCK_CONFIG", ")", "assert", "hass", ".", "states", ".", "get", "(", "ENTITY_ID", ")" ]
[ 171, 0 ]
[ 174, 37 ]
python
en
['en', 'da', 'en']
True
test_setup_without_turnon
(hass, remote)
Test setup of platform.
Test setup of platform.
async def test_setup_without_turnon(hass, remote): """Test setup of platform.""" await setup_samsungtv(hass, MOCK_CONFIG_NOTURNON) assert hass.states.get(ENTITY_ID_NOTURNON)
[ "async", "def", "test_setup_without_turnon", "(", "hass", ",", "remote", ")", ":", "await", "setup_samsungtv", "(", "hass", ",", "MOCK_CONFIG_NOTURNON", ")", "assert", "hass", ".", "states", ".", "get", "(", "ENTITY_ID_NOTURNON", ")" ]
[ 177, 0 ]
[ 180, 46 ]
python
en
['en', 'da', 'en']
True
test_setup_websocket
(hass, remotews, mock_now)
Test setup of platform.
Test setup of platform.
async def test_setup_websocket(hass, remotews, mock_now): """Test setup of platform.""" with patch("homeassistant.components.samsungtv.bridge.SamsungTVWS") as remote_class: enter = Mock() type(enter).token = PropertyMock(return_value="987654321") remote = Mock() remote.__enter__ ...
[ "async", "def", "test_setup_websocket", "(", "hass", ",", "remotews", ",", "mock_now", ")", ":", "with", "patch", "(", "\"homeassistant.components.samsungtv.bridge.SamsungTVWS\"", ")", "as", "remote_class", ":", "enter", "=", "Mock", "(", ")", "type", "(", "enter"...
[ 183, 0 ]
[ 197, 41 ]
python
en
['en', 'da', 'en']
True
test_setup_websocket_2
(hass, mock_now)
Test setup of platform from config entry.
Test setup of platform from config entry.
async def test_setup_websocket_2(hass, mock_now): """Test setup of platform from config entry.""" entity_id = f"{DOMAIN}.fake" entry = MockConfigEntry( domain=SAMSUNGTV_DOMAIN, data=MOCK_ENTRY_WS, unique_id=entity_id, ) entry.add_to_hass(hass) config_entries = hass.conf...
[ "async", "def", "test_setup_websocket_2", "(", "hass", ",", "mock_now", ")", ":", "entity_id", "=", "f\"{DOMAIN}.fake\"", "entry", "=", "MockConfigEntry", "(", "domain", "=", "SAMSUNGTV_DOMAIN", ",", "data", "=", "MOCK_ENTRY_WS", ",", "unique_id", "=", "entity_id"...
[ 200, 0 ]
[ 228, 65 ]
python
en
['en', 'da', 'en']
True
test_update_on
(hass, remote, mock_now)
Testing update tv on.
Testing update tv on.
async def test_update_on(hass, remote, mock_now): """Testing update tv on.""" await setup_samsungtv(hass, MOCK_CONFIG) next_update = mock_now + timedelta(minutes=5) with patch("homeassistant.util.dt.utcnow", return_value=next_update): async_fire_time_changed(hass, next_update) await has...
[ "async", "def", "test_update_on", "(", "hass", ",", "remote", ",", "mock_now", ")", ":", "await", "setup_samsungtv", "(", "hass", ",", "MOCK_CONFIG", ")", "next_update", "=", "mock_now", "+", "timedelta", "(", "minutes", "=", "5", ")", "with", "patch", "("...
[ 231, 0 ]
[ 241, 34 ]
python
en
['sv', 'en', 'en']
True
test_update_off
(hass, remote, mock_now)
Testing update tv off.
Testing update tv off.
async def test_update_off(hass, remote, mock_now): """Testing update tv off.""" await setup_samsungtv(hass, MOCK_CONFIG) with patch( "homeassistant.components.samsungtv.bridge.Remote", side_effect=[OSError("Boom"), DEFAULT_MOCK], ): next_update = mock_now + timedelta(minutes=5)...
[ "async", "def", "test_update_off", "(", "hass", ",", "remote", ",", "mock_now", ")", ":", "await", "setup_samsungtv", "(", "hass", ",", "MOCK_CONFIG", ")", "with", "patch", "(", "\"homeassistant.components.samsungtv.bridge.Remote\"", ",", "side_effect", "=", "[", ...
[ 244, 0 ]
[ 259, 39 ]
python
en
['en', 'co', 'en']
True
test_update_access_denied
(hass, remote, mock_now)
Testing update tv access denied exception.
Testing update tv access denied exception.
async def test_update_access_denied(hass, remote, mock_now): """Testing update tv access denied exception.""" await setup_samsungtv(hass, MOCK_CONFIG) with patch( "homeassistant.components.samsungtv.bridge.Remote", side_effect=exceptions.AccessDenied("Boom"), ): next_update = mo...
[ "async", "def", "test_update_access_denied", "(", "hass", ",", "remote", ",", "mock_now", ")", ":", "await", "setup_samsungtv", "(", "hass", ",", "MOCK_CONFIG", ")", "with", "patch", "(", "\"homeassistant.components.samsungtv.bridge.Remote\"", ",", "side_effect", "=",...
[ 262, 0 ]
[ 279, 5 ]
python
en
['da', 'en', 'en']
True
test_update_connection_failure
(hass, remotews, mock_now)
Testing update tv connection failure exception.
Testing update tv connection failure exception.
async def test_update_connection_failure(hass, remotews, mock_now): """Testing update tv connection failure exception.""" with patch( "homeassistant.components.samsungtv.bridge.Remote", side_effect=[OSError("Boom"), DEFAULT_MOCK], ): await setup_samsungtv(hass, MOCK_CONFIGWS) ...
[ "async", "def", "test_update_connection_failure", "(", "hass", ",", "remotews", ",", "mock_now", ")", ":", "with", "patch", "(", "\"homeassistant.components.samsungtv.bridge.Remote\"", ",", "side_effect", "=", "[", "OSError", "(", "\"Boom\"", ")", ",", "DEFAULT_MOCK",...
[ 282, 0 ]
[ 303, 5 ]
python
en
['fr', 'en', 'en']
True
test_update_unhandled_response
(hass, remote, mock_now)
Testing update tv unhandled response exception.
Testing update tv unhandled response exception.
async def test_update_unhandled_response(hass, remote, mock_now): """Testing update tv unhandled response exception.""" await setup_samsungtv(hass, MOCK_CONFIG) with patch( "homeassistant.components.samsungtv.bridge.Remote", side_effect=[exceptions.UnhandledResponse("Boom"), DEFAULT_MOCK], ...
[ "async", "def", "test_update_unhandled_response", "(", "hass", ",", "remote", ",", "mock_now", ")", ":", "await", "setup_samsungtv", "(", "hass", ",", "MOCK_CONFIG", ")", "with", "patch", "(", "\"homeassistant.components.samsungtv.bridge.Remote\"", ",", "side_effect", ...
[ 306, 0 ]
[ 321, 38 ]
python
en
['en', 'en', 'en']
True
test_send_key
(hass, remote)
Test for send key.
Test for send key.
async def test_send_key(hass, remote): """Test for send key.""" await setup_samsungtv(hass, MOCK_CONFIG) assert await hass.services.async_call( DOMAIN, SERVICE_VOLUME_UP, {ATTR_ENTITY_ID: ENTITY_ID}, True ) state = hass.states.get(ENTITY_ID) # key and update called assert remote.cont...
[ "async", "def", "test_send_key", "(", "hass", ",", "remote", ")", ":", "await", "setup_samsungtv", "(", "hass", ",", "MOCK_CONFIG", ")", "assert", "await", "hass", ".", "services", ".", "async_call", "(", "DOMAIN", ",", "SERVICE_VOLUME_UP", ",", "{", "ATTR_E...
[ 324, 0 ]
[ 336, 34 ]
python
en
['en', 'cy', 'en']
True
test_send_key_broken_pipe
(hass, remote)
Testing broken pipe Exception.
Testing broken pipe Exception.
async def test_send_key_broken_pipe(hass, remote): """Testing broken pipe Exception.""" await setup_samsungtv(hass, MOCK_CONFIG) remote.control = Mock(side_effect=BrokenPipeError("Boom")) assert await hass.services.async_call( DOMAIN, SERVICE_VOLUME_UP, {ATTR_ENTITY_ID: ENTITY_ID}, True ) ...
[ "async", "def", "test_send_key_broken_pipe", "(", "hass", ",", "remote", ")", ":", "await", "setup_samsungtv", "(", "hass", ",", "MOCK_CONFIG", ")", "remote", ".", "control", "=", "Mock", "(", "side_effect", "=", "BrokenPipeError", "(", "\"Boom\"", ")", ")", ...
[ 339, 0 ]
[ 347, 34 ]
python
en
['nl', 'en', 'en']
True
test_send_key_connection_closed_retry_succeed
(hass, remote)
Test retry on connection closed.
Test retry on connection closed.
async def test_send_key_connection_closed_retry_succeed(hass, remote): """Test retry on connection closed.""" await setup_samsungtv(hass, MOCK_CONFIG) remote.control = Mock( side_effect=[exceptions.ConnectionClosed("Boom"), DEFAULT_MOCK, DEFAULT_MOCK] ) assert await hass.services.async_call(...
[ "async", "def", "test_send_key_connection_closed_retry_succeed", "(", "hass", ",", "remote", ")", ":", "await", "setup_samsungtv", "(", "hass", ",", "MOCK_CONFIG", ")", "remote", ".", "control", "=", "Mock", "(", "side_effect", "=", "[", "exceptions", ".", "Conn...
[ 350, 0 ]
[ 368, 34 ]
python
en
['en', 'en', 'en']
True
test_send_key_unhandled_response
(hass, remote)
Testing unhandled response exception.
Testing unhandled response exception.
async def test_send_key_unhandled_response(hass, remote): """Testing unhandled response exception.""" await setup_samsungtv(hass, MOCK_CONFIG) remote.control = Mock(side_effect=exceptions.UnhandledResponse("Boom")) assert await hass.services.async_call( DOMAIN, SERVICE_VOLUME_UP, {ATTR_ENTITY_ID...
[ "async", "def", "test_send_key_unhandled_response", "(", "hass", ",", "remote", ")", ":", "await", "setup_samsungtv", "(", "hass", ",", "MOCK_CONFIG", ")", "remote", ".", "control", "=", "Mock", "(", "side_effect", "=", "exceptions", ".", "UnhandledResponse", "(...
[ 371, 0 ]
[ 379, 34 ]
python
en
['en', 'en', 'en']
True
test_send_key_websocketexception
(hass, remote)
Testing unhandled response exception.
Testing unhandled response exception.
async def test_send_key_websocketexception(hass, remote): """Testing unhandled response exception.""" await setup_samsungtv(hass, MOCK_CONFIG) remote.control = Mock(side_effect=WebSocketException("Boom")) assert await hass.services.async_call( DOMAIN, SERVICE_VOLUME_UP, {ATTR_ENTITY_ID: ENTITY_I...
[ "async", "def", "test_send_key_websocketexception", "(", "hass", ",", "remote", ")", ":", "await", "setup_samsungtv", "(", "hass", ",", "MOCK_CONFIG", ")", "remote", ".", "control", "=", "Mock", "(", "side_effect", "=", "WebSocketException", "(", "\"Boom\"", ")"...
[ 382, 0 ]
[ 390, 34 ]
python
en
['en', 'en', 'en']
True
test_send_key_os_error
(hass, remote)
Testing broken pipe Exception.
Testing broken pipe Exception.
async def test_send_key_os_error(hass, remote): """Testing broken pipe Exception.""" await setup_samsungtv(hass, MOCK_CONFIG) remote.control = Mock(side_effect=OSError("Boom")) assert await hass.services.async_call( DOMAIN, SERVICE_VOLUME_UP, {ATTR_ENTITY_ID: ENTITY_ID}, True ) state = h...
[ "async", "def", "test_send_key_os_error", "(", "hass", ",", "remote", ")", ":", "await", "setup_samsungtv", "(", "hass", ",", "MOCK_CONFIG", ")", "remote", ".", "control", "=", "Mock", "(", "side_effect", "=", "OSError", "(", "\"Boom\"", ")", ")", "assert", ...
[ 393, 0 ]
[ 401, 34 ]
python
en
['nl', 'en', 'en']
True
test_name
(hass, remote)
Test for name property.
Test for name property.
async def test_name(hass, remote): """Test for name property.""" await setup_samsungtv(hass, MOCK_CONFIG) state = hass.states.get(ENTITY_ID) assert state.attributes[ATTR_FRIENDLY_NAME] == "fake"
[ "async", "def", "test_name", "(", "hass", ",", "remote", ")", ":", "await", "setup_samsungtv", "(", "hass", ",", "MOCK_CONFIG", ")", "state", "=", "hass", ".", "states", ".", "get", "(", "ENTITY_ID", ")", "assert", "state", ".", "attributes", "[", "ATTR_...
[ 404, 0 ]
[ 408, 57 ]
python
en
['en', 'en', 'en']
True
test_state_with_turnon
(hass, remote, delay)
Test for state property.
Test for state property.
async def test_state_with_turnon(hass, remote, delay): """Test for state property.""" await setup_samsungtv(hass, MOCK_CONFIG) assert await hass.services.async_call( DOMAIN, SERVICE_TURN_ON, {ATTR_ENTITY_ID: ENTITY_ID}, True ) state = hass.states.get(ENTITY_ID) assert state.state == STAT...
[ "async", "def", "test_state_with_turnon", "(", "hass", ",", "remote", ",", "delay", ")", ":", "await", "setup_samsungtv", "(", "hass", ",", "MOCK_CONFIG", ")", "assert", "await", "hass", ".", "services", ".", "async_call", "(", "DOMAIN", ",", "SERVICE_TURN_ON"...
[ 411, 0 ]
[ 425, 35 ]
python
en
['en', 'en', 'en']
True
test_state_without_turnon
(hass, remote)
Test for state property.
Test for state property.
async def test_state_without_turnon(hass, remote): """Test for state property.""" await setup_samsungtv(hass, MOCK_CONFIG_NOTURNON) assert await hass.services.async_call( DOMAIN, SERVICE_VOLUME_UP, {ATTR_ENTITY_ID: ENTITY_ID_NOTURNON}, True ) state = hass.states.get(ENTITY_ID_NOTURNON) a...
[ "async", "def", "test_state_without_turnon", "(", "hass", ",", "remote", ")", ":", "await", "setup_samsungtv", "(", "hass", ",", "MOCK_CONFIG_NOTURNON", ")", "assert", "await", "hass", ".", "services", ".", "async_call", "(", "DOMAIN", ",", "SERVICE_VOLUME_UP", ...
[ 428, 0 ]
[ 440, 35 ]
python
en
['en', 'en', 'en']
True
test_supported_features_with_turnon
(hass, remote)
Test for supported_features property.
Test for supported_features property.
async def test_supported_features_with_turnon(hass, remote): """Test for supported_features property.""" await setup_samsungtv(hass, MOCK_CONFIG) state = hass.states.get(ENTITY_ID) assert ( state.attributes[ATTR_SUPPORTED_FEATURES] == SUPPORT_SAMSUNGTV | SUPPORT_TURN_ON )
[ "async", "def", "test_supported_features_with_turnon", "(", "hass", ",", "remote", ")", ":", "await", "setup_samsungtv", "(", "hass", ",", "MOCK_CONFIG", ")", "state", "=", "hass", ".", "states", ".", "get", "(", "ENTITY_ID", ")", "assert", "(", "state", "."...
[ 443, 0 ]
[ 449, 5 ]
python
en
['en', 'en', 'en']
True
test_supported_features_without_turnon
(hass, remote)
Test for supported_features property.
Test for supported_features property.
async def test_supported_features_without_turnon(hass, remote): """Test for supported_features property.""" await setup_samsungtv(hass, MOCK_CONFIG_NOTURNON) state = hass.states.get(ENTITY_ID_NOTURNON) assert state.attributes[ATTR_SUPPORTED_FEATURES] == SUPPORT_SAMSUNGTV
[ "async", "def", "test_supported_features_without_turnon", "(", "hass", ",", "remote", ")", ":", "await", "setup_samsungtv", "(", "hass", ",", "MOCK_CONFIG_NOTURNON", ")", "state", "=", "hass", ".", "states", ".", "get", "(", "ENTITY_ID_NOTURNON", ")", "assert", ...
[ 452, 0 ]
[ 456, 73 ]
python
en
['en', 'en', 'en']
True
test_device_class
(hass, remote)
Test for device_class property.
Test for device_class property.
async def test_device_class(hass, remote): """Test for device_class property.""" await setup_samsungtv(hass, MOCK_CONFIG) state = hass.states.get(ENTITY_ID) assert state.attributes[ATTR_DEVICE_CLASS] == DEVICE_CLASS_TV
[ "async", "def", "test_device_class", "(", "hass", ",", "remote", ")", ":", "await", "setup_samsungtv", "(", "hass", ",", "MOCK_CONFIG", ")", "state", "=", "hass", ".", "states", ".", "get", "(", "ENTITY_ID", ")", "assert", "state", ".", "attributes", "[", ...
[ 459, 0 ]
[ 463, 65 ]
python
en
['da', 'en', 'en']
True
test_turn_off_websocket
(hass, remotews)
Test for turn_off.
Test for turn_off.
async def test_turn_off_websocket(hass, remotews): """Test for turn_off.""" with patch( "homeassistant.components.samsungtv.bridge.Remote", side_effect=[OSError("Boom"), DEFAULT_MOCK], ): await setup_samsungtv(hass, MOCK_CONFIGWS) assert await hass.services.async_call( ...
[ "async", "def", "test_turn_off_websocket", "(", "hass", ",", "remotews", ")", ":", "with", "patch", "(", "\"homeassistant.components.samsungtv.bridge.Remote\"", ",", "side_effect", "=", "[", "OSError", "(", "\"Boom\"", ")", ",", "DEFAULT_MOCK", "]", ",", ")", ":",...
[ 466, 0 ]
[ 478, 70 ]
python
en
['en', 'en', 'en']
True
test_turn_off_legacy
(hass, remote)
Test for turn_off.
Test for turn_off.
async def test_turn_off_legacy(hass, remote): """Test for turn_off.""" await setup_samsungtv(hass, MOCK_CONFIG_NOTURNON) assert await hass.services.async_call( DOMAIN, SERVICE_TURN_OFF, {ATTR_ENTITY_ID: ENTITY_ID_NOTURNON}, True ) # key called assert remote.control.call_count == 1 as...
[ "async", "def", "test_turn_off_legacy", "(", "hass", ",", "remote", ")", ":", "await", "setup_samsungtv", "(", "hass", ",", "MOCK_CONFIG_NOTURNON", ")", "assert", "await", "hass", ".", "services", ".", "async_call", "(", "DOMAIN", ",", "SERVICE_TURN_OFF", ",", ...
[ 481, 0 ]
[ 489, 66 ]
python
en
['en', 'en', 'en']
True
test_turn_off_os_error
(hass, remote, caplog)
Test for turn_off with OSError.
Test for turn_off with OSError.
async def test_turn_off_os_error(hass, remote, caplog): """Test for turn_off with OSError.""" caplog.set_level(logging.DEBUG) await setup_samsungtv(hass, MOCK_CONFIG) remote.close = Mock(side_effect=OSError("BOOM")) assert await hass.services.async_call( DOMAIN, SERVICE_TURN_OFF, {ATTR_ENTIT...
[ "async", "def", "test_turn_off_os_error", "(", "hass", ",", "remote", ",", "caplog", ")", ":", "caplog", ".", "set_level", "(", "logging", ".", "DEBUG", ")", "await", "setup_samsungtv", "(", "hass", ",", "MOCK_CONFIG", ")", "remote", ".", "close", "=", "Mo...
[ 492, 0 ]
[ 500, 58 ]
python
en
['en', 'en', 'en']
True
test_volume_up
(hass, remote)
Test for volume_up.
Test for volume_up.
async def test_volume_up(hass, remote): """Test for volume_up.""" await setup_samsungtv(hass, MOCK_CONFIG) assert await hass.services.async_call( DOMAIN, SERVICE_VOLUME_UP, {ATTR_ENTITY_ID: ENTITY_ID}, True ) # key and update called assert remote.control.call_count == 1 assert remote...
[ "async", "def", "test_volume_up", "(", "hass", ",", "remote", ")", ":", "await", "setup_samsungtv", "(", "hass", ",", "MOCK_CONFIG", ")", "assert", "await", "hass", ".", "services", ".", "async_call", "(", "DOMAIN", ",", "SERVICE_VOLUME_UP", ",", "{", "ATTR_...
[ 503, 0 ]
[ 513, 50 ]
python
en
['nl', 'en', 'en']
True
test_volume_down
(hass, remote)
Test for volume_down.
Test for volume_down.
async def test_volume_down(hass, remote): """Test for volume_down.""" await setup_samsungtv(hass, MOCK_CONFIG) assert await hass.services.async_call( DOMAIN, SERVICE_VOLUME_DOWN, {ATTR_ENTITY_ID: ENTITY_ID}, True ) # key and update called assert remote.control.call_count == 1 assert ...
[ "async", "def", "test_volume_down", "(", "hass", ",", "remote", ")", ":", "await", "setup_samsungtv", "(", "hass", ",", "MOCK_CONFIG", ")", "assert", "await", "hass", ".", "services", ".", "async_call", "(", "DOMAIN", ",", "SERVICE_VOLUME_DOWN", ",", "{", "A...
[ 516, 0 ]
[ 526, 50 ]
python
en
['nl', 'en', 'en']
True
test_mute_volume
(hass, remote)
Test for mute_volume.
Test for mute_volume.
async def test_mute_volume(hass, remote): """Test for mute_volume.""" await setup_samsungtv(hass, MOCK_CONFIG) assert await hass.services.async_call( DOMAIN, SERVICE_VOLUME_MUTE, {ATTR_ENTITY_ID: ENTITY_ID, ATTR_MEDIA_VOLUME_MUTED: True}, True, ) # key and update call...
[ "async", "def", "test_mute_volume", "(", "hass", ",", "remote", ")", ":", "await", "setup_samsungtv", "(", "hass", ",", "MOCK_CONFIG", ")", "assert", "await", "hass", ".", "services", ".", "async_call", "(", "DOMAIN", ",", "SERVICE_VOLUME_MUTE", ",", "{", "A...
[ 529, 0 ]
[ 542, 50 ]
python
en
['en', 'en', 'en']
True
test_media_play
(hass, remote)
Test for media_play.
Test for media_play.
async def test_media_play(hass, remote): """Test for media_play.""" await setup_samsungtv(hass, MOCK_CONFIG) assert await hass.services.async_call( DOMAIN, SERVICE_MEDIA_PLAY, {ATTR_ENTITY_ID: ENTITY_ID}, True ) # key and update called assert remote.control.call_count == 1 assert rem...
[ "async", "def", "test_media_play", "(", "hass", ",", "remote", ")", ":", "await", "setup_samsungtv", "(", "hass", ",", "MOCK_CONFIG", ")", "assert", "await", "hass", ".", "services", ".", "async_call", "(", "DOMAIN", ",", "SERVICE_MEDIA_PLAY", ",", "{", "ATT...
[ 545, 0 ]
[ 555, 50 ]
python
en
['en', 'en', 'en']
True
test_media_pause
(hass, remote)
Test for media_pause.
Test for media_pause.
async def test_media_pause(hass, remote): """Test for media_pause.""" await setup_samsungtv(hass, MOCK_CONFIG) assert await hass.services.async_call( DOMAIN, SERVICE_MEDIA_PAUSE, {ATTR_ENTITY_ID: ENTITY_ID}, True ) # key and update called assert remote.control.call_count == 1 assert ...
[ "async", "def", "test_media_pause", "(", "hass", ",", "remote", ")", ":", "await", "setup_samsungtv", "(", "hass", ",", "MOCK_CONFIG", ")", "assert", "await", "hass", ".", "services", ".", "async_call", "(", "DOMAIN", ",", "SERVICE_MEDIA_PAUSE", ",", "{", "A...
[ 558, 0 ]
[ 568, 50 ]
python
en
['en', 'en', 'en']
True
test_media_next_track
(hass, remote)
Test for media_next_track.
Test for media_next_track.
async def test_media_next_track(hass, remote): """Test for media_next_track.""" await setup_samsungtv(hass, MOCK_CONFIG) assert await hass.services.async_call( DOMAIN, SERVICE_MEDIA_NEXT_TRACK, {ATTR_ENTITY_ID: ENTITY_ID}, True ) # key and update called assert remote.control.call_count =...
[ "async", "def", "test_media_next_track", "(", "hass", ",", "remote", ")", ":", "await", "setup_samsungtv", "(", "hass", ",", "MOCK_CONFIG", ")", "assert", "await", "hass", ".", "services", ".", "async_call", "(", "DOMAIN", ",", "SERVICE_MEDIA_NEXT_TRACK", ",", ...
[ 571, 0 ]
[ 581, 50 ]
python
en
['en', 'no', 'en']
True
test_media_previous_track
(hass, remote)
Test for media_previous_track.
Test for media_previous_track.
async def test_media_previous_track(hass, remote): """Test for media_previous_track.""" await setup_samsungtv(hass, MOCK_CONFIG) assert await hass.services.async_call( DOMAIN, SERVICE_MEDIA_PREVIOUS_TRACK, {ATTR_ENTITY_ID: ENTITY_ID}, True ) # key and update called assert remote.control....
[ "async", "def", "test_media_previous_track", "(", "hass", ",", "remote", ")", ":", "await", "setup_samsungtv", "(", "hass", ",", "MOCK_CONFIG", ")", "assert", "await", "hass", ".", "services", ".", "async_call", "(", "DOMAIN", ",", "SERVICE_MEDIA_PREVIOUS_TRACK", ...
[ 584, 0 ]
[ 594, 50 ]
python
en
['en', 'en', 'en']
True
test_turn_on_with_turnon
(hass, remote, delay)
Test turn on.
Test turn on.
async def test_turn_on_with_turnon(hass, remote, delay): """Test turn on.""" await setup_samsungtv(hass, MOCK_CONFIG) assert await hass.services.async_call( DOMAIN, SERVICE_TURN_ON, {ATTR_ENTITY_ID: ENTITY_ID}, True ) assert delay.call_count == 1
[ "async", "def", "test_turn_on_with_turnon", "(", "hass", ",", "remote", ",", "delay", ")", ":", "await", "setup_samsungtv", "(", "hass", ",", "MOCK_CONFIG", ")", "assert", "await", "hass", ".", "services", ".", "async_call", "(", "DOMAIN", ",", "SERVICE_TURN_O...
[ 597, 0 ]
[ 603, 32 ]
python
en
['en', 'et', 'en']
True
test_turn_on_without_turnon
(hass, remote)
Test turn on.
Test turn on.
async def test_turn_on_without_turnon(hass, remote): """Test turn on.""" await setup_samsungtv(hass, MOCK_CONFIG_NOTURNON) assert await hass.services.async_call( DOMAIN, SERVICE_TURN_ON, {ATTR_ENTITY_ID: ENTITY_ID_NOTURNON}, True ) # nothing called as not supported feature assert remote....
[ "async", "def", "test_turn_on_without_turnon", "(", "hass", ",", "remote", ")", ":", "await", "setup_samsungtv", "(", "hass", ",", "MOCK_CONFIG_NOTURNON", ")", "assert", "await", "hass", ".", "services", ".", "async_call", "(", "DOMAIN", ",", "SERVICE_TURN_ON", ...
[ 606, 0 ]
[ 613, 41 ]
python
en
['en', 'et', 'en']
True
test_play_media
(hass, remote)
Test for play_media.
Test for play_media.
async def test_play_media(hass, remote): """Test for play_media.""" asyncio_sleep = asyncio.sleep sleeps = [] async def sleep(duration, loop): sleeps.append(duration) await asyncio_sleep(0, loop=loop) await setup_samsungtv(hass, MOCK_CONFIG) with patch("asyncio.sleep", new=slee...
[ "async", "def", "test_play_media", "(", "hass", ",", "remote", ")", ":", "asyncio_sleep", "=", "asyncio", ".", "sleep", "sleeps", "=", "[", "]", "async", "def", "sleep", "(", "duration", ",", "loop", ")", ":", "sleeps", ".", "append", "(", "duration", ...
[ 616, 0 ]
[ 647, 31 ]
python
en
['en', 'en', 'en']
True