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
BMWConnectedDriveSensor.state
(self)
Return the state of the sensor. The return type of this call depends on the attribute that is configured.
Return the state of the sensor.
def state(self): """Return the state of the sensor. The return type of this call depends on the attribute that is configured. """ return self._state
[ "def", "state", "(", "self", ")", ":", "return", "self", ".", "_state" ]
[ 116, 4 ]
[ 122, 26 ]
python
en
['en', 'en', 'en']
True
BMWConnectedDriveSensor.unit_of_measurement
(self)
Get the unit of measurement.
Get the unit of measurement.
def unit_of_measurement(self) -> str: """Get the unit of measurement.""" _, unit = self._attribute_info.get(self._attribute, [None, None]) return unit
[ "def", "unit_of_measurement", "(", "self", ")", "->", "str", ":", "_", ",", "unit", "=", "self", ".", "_attribute_info", ".", "get", "(", "self", ".", "_attribute", ",", "[", "None", ",", "None", "]", ")", "return", "unit" ]
[ 125, 4 ]
[ 128, 19 ]
python
en
['en', 'fr', 'en']
True
BMWConnectedDriveSensor.device_state_attributes
(self)
Return the state attributes of the sensor.
Return the state attributes of the sensor.
def device_state_attributes(self): """Return the state attributes of the sensor.""" return { "car": self._vehicle.name, ATTR_ATTRIBUTION: ATTRIBUTION, }
[ "def", "device_state_attributes", "(", "self", ")", ":", "return", "{", "\"car\"", ":", "self", ".", "_vehicle", ".", "name", ",", "ATTR_ATTRIBUTION", ":", "ATTRIBUTION", ",", "}" ]
[ 131, 4 ]
[ 136, 9 ]
python
en
['en', 'en', 'en']
True
BMWConnectedDriveSensor.update
(self)
Read new state data from the library.
Read new state data from the library.
def update(self) -> None: """Read new state data from the library.""" _LOGGER.debug("Updating %s", self._vehicle.name) vehicle_state = self._vehicle.state if self._attribute == "charging_status": self._state = getattr(vehicle_state, self._attribute).value elif self.un...
[ "def", "update", "(", "self", ")", "->", "None", ":", "_LOGGER", ".", "debug", "(", "\"Updating %s\"", ",", "self", ".", "_vehicle", ".", "name", ")", "vehicle_state", "=", "self", ".", "_vehicle", ".", "state", "if", "self", ".", "_attribute", "==", "...
[ 138, 4 ]
[ 153, 65 ]
python
en
['en', 'en', 'en']
True
BMWConnectedDriveSensor.update_callback
(self)
Schedule a state update.
Schedule a state update.
def update_callback(self): """Schedule a state update.""" self.schedule_update_ha_state(True)
[ "def", "update_callback", "(", "self", ")", ":", "self", ".", "schedule_update_ha_state", "(", "True", ")" ]
[ 155, 4 ]
[ 157, 43 ]
python
en
['en', 'co', 'en']
True
BMWConnectedDriveSensor.async_added_to_hass
(self)
Add callback after being added to hass. Show latest data after startup.
Add callback after being added to hass.
async def async_added_to_hass(self): """Add callback after being added to hass. Show latest data after startup. """ self._account.add_update_listener(self.update_callback)
[ "async", "def", "async_added_to_hass", "(", "self", ")", ":", "self", ".", "_account", ".", "add_update_listener", "(", "self", ".", "update_callback", ")" ]
[ 159, 4 ]
[ 164, 63 ]
python
en
['en', 'en', 'en']
True
filter_non_english
(_, pretrained_name: str)
Filter all the model for non-english language
Filter all the model for non-english language
def filter_non_english(_, pretrained_name: str): """ Filter all the model for non-english language """ return not any([lang in pretrained_name for lang in NON_ENGLISH_TAGS])
[ "def", "filter_non_english", "(", "_", ",", "pretrained_name", ":", "str", ")", ":", "return", "not", "any", "(", "[", "lang", "in", "pretrained_name", "for", "lang", "in", "NON_ENGLISH_TAGS", "]", ")" ]
[ 51, 0 ]
[ 53, 74 ]
python
en
['en', 'en', 'en']
True
TokenizerTesterMixin.test_pickle_tokenizer
(self)
Google pickle __getstate__ __setstate__ if you are struggling with this.
Google pickle __getstate__ __setstate__ if you are struggling with this.
def test_pickle_tokenizer(self): """Google pickle __getstate__ __setstate__ if you are struggling with this.""" tokenizers = self.get_tokenizers() for tokenizer in tokenizers: with self.subTest(f"{tokenizer.__class__.__name__}"): self.assertIsNotNone(tokenizer) ...
[ "def", "test_pickle_tokenizer", "(", "self", ")", ":", "tokenizers", "=", "self", ".", "get_tokenizers", "(", ")", "for", "tokenizer", "in", "tokenizers", ":", "with", "self", ".", "subTest", "(", "f\"{tokenizer.__class__.__name__}\"", ")", ":", "self", ".", "...
[ 395, 4 ]
[ 414, 63 ]
python
en
['en', 'en', 'en']
True
TokenizerTesterMixin.test_padding_to_max_length
(self)
We keep this test for backward compatibility but it should be remove when `pad_to_max_length` will e deprecated
We keep this test for backward compatibility but it should be remove when `pad_to_max_length` will e deprecated
def test_padding_to_max_length(self): """We keep this test for backward compatibility but it should be remove when `pad_to_max_length` will e deprecated""" tokenizers = self.get_tokenizers(do_lower_case=False) for tokenizer in tokenizers: with self.subTest(f"{tokenizer.__class__.__na...
[ "def", "test_padding_to_max_length", "(", "self", ")", ":", "tokenizers", "=", "self", ".", "get_tokenizers", "(", "do_lower_case", "=", "False", ")", "for", "tokenizer", "in", "tokenizers", ":", "with", "self", ".", "subTest", "(", "f\"{tokenizer.__class__.__name...
[ 1173, 4 ]
[ 1206, 64 ]
python
en
['en', 'en', 'en']
True
_get_ha_power_state
(vizio_power_state: Optional[bool])
Return HA power state given Vizio power state.
Return HA power state given Vizio power state.
def _get_ha_power_state(vizio_power_state: Optional[bool]) -> str: """Return HA power state given Vizio power state.""" if vizio_power_state: return STATE_ON if vizio_power_state is False: return STATE_OFF return STATE_UNAVAILABLE
[ "def", "_get_ha_power_state", "(", "vizio_power_state", ":", "Optional", "[", "bool", "]", ")", "->", "str", ":", "if", "vizio_power_state", ":", "return", "STATE_ON", "if", "vizio_power_state", "is", "False", ":", "return", "STATE_OFF", "return", "STATE_UNAVAILAB...
[ 88, 0 ]
[ 96, 28 ]
python
en
['it', 'en', 'en']
True
_assert_sources_and_volume
(attr: Dict[str, Any], vizio_device_class: str)
Assert source list, source, and volume level based on attr dict and device class.
Assert source list, source, and volume level based on attr dict and device class.
def _assert_sources_and_volume(attr: Dict[str, Any], vizio_device_class: str) -> None: """Assert source list, source, and volume level based on attr dict and device class.""" assert attr["source_list"] == INPUT_LIST assert attr["source"] == CURRENT_INPUT assert ( attr["volume_level"] == ...
[ "def", "_assert_sources_and_volume", "(", "attr", ":", "Dict", "[", "str", ",", "Any", "]", ",", "vizio_device_class", ":", "str", ")", "->", "None", ":", "assert", "attr", "[", "\"source_list\"", "]", "==", "INPUT_LIST", "assert", "attr", "[", "\"source\"",...
[ 99, 0 ]
[ 107, 5 ]
python
en
['en', 'en', 'en']
True
_get_attr_and_assert_base_attr
( hass: HomeAssistantType, device_class: str, power_state: str )
Return entity attributes after asserting name, device class, and power state.
Return entity attributes after asserting name, device class, and power state.
def _get_attr_and_assert_base_attr( hass: HomeAssistantType, device_class: str, power_state: str ) -> Dict[str, Any]: """Return entity attributes after asserting name, device class, and power state.""" attr = hass.states.get(ENTITY_ID).attributes assert attr["friendly_name"] == NAME assert attr["de...
[ "def", "_get_attr_and_assert_base_attr", "(", "hass", ":", "HomeAssistantType", ",", "device_class", ":", "str", ",", "power_state", ":", "str", ")", "->", "Dict", "[", "str", ",", "Any", "]", ":", "attr", "=", "hass", ".", "states", ".", "get", "(", "EN...
[ 110, 0 ]
[ 119, 15 ]
python
en
['en', 'en', 'en']
True
_cm_for_test_setup_without_apps
( all_settings: Dict[str, Any], vizio_power_state: Optional[bool] )
Context manager to setup test for Vizio devices without including app specific patches.
Context manager to setup test for Vizio devices without including app specific patches.
async def _cm_for_test_setup_without_apps( all_settings: Dict[str, Any], vizio_power_state: Optional[bool] ) -> None: """Context manager to setup test for Vizio devices without including app specific patches.""" with patch( "homeassistant.components.vizio.media_player.VizioAsync.get_all_settings", ...
[ "async", "def", "_cm_for_test_setup_without_apps", "(", "all_settings", ":", "Dict", "[", "str", ",", "Any", "]", ",", "vizio_power_state", ":", "Optional", "[", "bool", "]", ")", "->", "None", ":", "with", "patch", "(", "\"homeassistant.components.vizio.media_pla...
[ 123, 0 ]
[ 137, 13 ]
python
en
['en', 'en', 'en']
True
_test_setup_tv
( hass: HomeAssistantType, vizio_power_state: Optional[bool] )
Test Vizio TV entity setup.
Test Vizio TV entity setup.
async def _test_setup_tv( hass: HomeAssistantType, vizio_power_state: Optional[bool] ) -> None: """Test Vizio TV entity setup.""" ha_power_state = _get_ha_power_state(vizio_power_state) config_entry = MockConfigEntry( domain=DOMAIN, data=vol.Schema(VIZIO_SCHEMA)(MOCK_USER_VALID_TV_CONFI...
[ "async", "def", "_test_setup_tv", "(", "hass", ":", "HomeAssistantType", ",", "vizio_power_state", ":", "Optional", "[", "bool", "]", ")", "->", "None", ":", "ha_power_state", "=", "_get_ha_power_state", "(", "vizio_power_state", ")", "config_entry", "=", "MockCon...
[ 140, 0 ]
[ 161, 43 ]
python
it
['it', 'eo', 'it']
True
_test_setup_speaker
( hass: HomeAssistantType, vizio_power_state: Optional[bool] )
Test Vizio Speaker entity setup.
Test Vizio Speaker entity setup.
async def _test_setup_speaker( hass: HomeAssistantType, vizio_power_state: Optional[bool] ) -> None: """Test Vizio Speaker entity setup.""" ha_power_state = _get_ha_power_state(vizio_power_state) config_entry = MockConfigEntry( domain=DOMAIN, data=vol.Schema(VIZIO_SCHEMA)(MOCK_SPEAKER_C...
[ "async", "def", "_test_setup_speaker", "(", "hass", ":", "HomeAssistantType", ",", "vizio_power_state", ":", "Optional", "[", "bool", "]", ")", "->", "None", ":", "ha_power_state", "=", "_get_ha_power_state", "(", "vizio_power_state", ")", "config_entry", "=", "Mo...
[ 164, 0 ]
[ 197, 43 ]
python
en
['en', 'ru-Latn', 'it']
False
_cm_for_test_setup_tv_with_apps
( hass: HomeAssistantType, device_config: Dict[str, Any], app_config: Dict[str, Any] )
Context manager to setup test for Vizio TV with support for apps.
Context manager to setup test for Vizio TV with support for apps.
async def _cm_for_test_setup_tv_with_apps( hass: HomeAssistantType, device_config: Dict[str, Any], app_config: Dict[str, Any] ) -> None: """Context manager to setup test for Vizio TV with support for apps.""" config_entry = MockConfigEntry( domain=DOMAIN, data=vol.Schema(VIZIO_SCHEMA)(device_config)...
[ "async", "def", "_cm_for_test_setup_tv_with_apps", "(", "hass", ":", "HomeAssistantType", ",", "device_config", ":", "Dict", "[", "str", ",", "Any", "]", ",", "app_config", ":", "Dict", "[", "str", ",", "Any", "]", ")", "->", "None", ":", "config_entry", "...
[ 201, 0 ]
[ 226, 17 ]
python
en
['en', 'en', 'en']
True
_assert_source_list_with_apps
( list_to_test: List[str], attr: Dict[str, Any] )
Assert source list matches list_to_test after removing INPUT_APPS from list.
Assert source list matches list_to_test after removing INPUT_APPS from list.
def _assert_source_list_with_apps( list_to_test: List[str], attr: Dict[str, Any] ) -> None: """Assert source list matches list_to_test after removing INPUT_APPS from list.""" for app_to_remove in INPUT_APPS: if app_to_remove in list_to_test: list_to_test.remove(app_to_remove) assert...
[ "def", "_assert_source_list_with_apps", "(", "list_to_test", ":", "List", "[", "str", "]", ",", "attr", ":", "Dict", "[", "str", ",", "Any", "]", ")", "->", "None", ":", "for", "app_to_remove", "in", "INPUT_APPS", ":", "if", "app_to_remove", "in", "list_to...
[ 229, 0 ]
[ 237, 46 ]
python
en
['en', 'en', 'en']
True
_test_setup_failure
(hass: HomeAssistantType, config: str)
Test generic Vizio entity setup failure.
Test generic Vizio entity setup failure.
async def _test_setup_failure(hass: HomeAssistantType, config: str) -> None: """Test generic Vizio entity setup failure.""" with patch( "homeassistant.components.vizio.media_player.VizioAsync.can_connect_with_auth_check", return_value=False, ): config_entry = MockConfigEntry(domain=D...
[ "async", "def", "_test_setup_failure", "(", "hass", ":", "HomeAssistantType", ",", "config", ":", "str", ")", "->", "None", ":", "with", "patch", "(", "\"homeassistant.components.vizio.media_player.VizioAsync.can_connect_with_auth_check\"", ",", "return_value", "=", "Fals...
[ 240, 0 ]
[ 248, 64 ]
python
en
['en', 'sm', 'en']
True
_test_service
( hass: HomeAssistantType, domain: str, vizio_func_name: str, ha_service_name: str, additional_service_data: Optional[Dict[str, Any]], *args, **kwargs, )
Test generic Vizio media player entity service.
Test generic Vizio media player entity service.
async def _test_service( hass: HomeAssistantType, domain: str, vizio_func_name: str, ha_service_name: str, additional_service_data: Optional[Dict[str, Any]], *args, **kwargs, ) -> None: """Test generic Vizio media player entity service.""" service_data = {ATTR_ENTITY_ID: ENTITY_ID} ...
[ "async", "def", "_test_service", "(", "hass", ":", "HomeAssistantType", ",", "domain", ":", "str", ",", "vizio_func_name", ":", "str", ",", "ha_service_name", ":", "str", ",", "additional_service_data", ":", "Optional", "[", "Dict", "[", "str", ",", "Any", "...
[ 251, 0 ]
[ 277, 66 ]
python
it
['en', 'it', 'it']
True
test_speaker_on
( hass: HomeAssistantType, vizio_connect: pytest.fixture, vizio_update: pytest.fixture, )
Test Vizio Speaker entity setup when on.
Test Vizio Speaker entity setup when on.
async def test_speaker_on( hass: HomeAssistantType, vizio_connect: pytest.fixture, vizio_update: pytest.fixture, ) -> None: """Test Vizio Speaker entity setup when on.""" await _test_setup_speaker(hass, True)
[ "async", "def", "test_speaker_on", "(", "hass", ":", "HomeAssistantType", ",", "vizio_connect", ":", "pytest", ".", "fixture", ",", "vizio_update", ":", "pytest", ".", "fixture", ",", ")", "->", "None", ":", "await", "_test_setup_speaker", "(", "hass", ",", ...
[ 280, 0 ]
[ 286, 41 ]
python
en
['en', 'el-Latn', 'en']
True
test_speaker_off
( hass: HomeAssistantType, vizio_connect: pytest.fixture, vizio_update: pytest.fixture, )
Test Vizio Speaker entity setup when off.
Test Vizio Speaker entity setup when off.
async def test_speaker_off( hass: HomeAssistantType, vizio_connect: pytest.fixture, vizio_update: pytest.fixture, ) -> None: """Test Vizio Speaker entity setup when off.""" await _test_setup_speaker(hass, False)
[ "async", "def", "test_speaker_off", "(", "hass", ":", "HomeAssistantType", ",", "vizio_connect", ":", "pytest", ".", "fixture", ",", "vizio_update", ":", "pytest", ".", "fixture", ",", ")", "->", "None", ":", "await", "_test_setup_speaker", "(", "hass", ",", ...
[ 289, 0 ]
[ 295, 42 ]
python
en
['en', 'bg-Latn', 'en']
True
test_speaker_unavailable
( hass: HomeAssistantType, vizio_connect: pytest.fixture, vizio_update: pytest.fixture, )
Test Vizio Speaker entity setup when unavailable.
Test Vizio Speaker entity setup when unavailable.
async def test_speaker_unavailable( hass: HomeAssistantType, vizio_connect: pytest.fixture, vizio_update: pytest.fixture, ) -> None: """Test Vizio Speaker entity setup when unavailable.""" await _test_setup_speaker(hass, None)
[ "async", "def", "test_speaker_unavailable", "(", "hass", ":", "HomeAssistantType", ",", "vizio_connect", ":", "pytest", ".", "fixture", ",", "vizio_update", ":", "pytest", ".", "fixture", ",", ")", "->", "None", ":", "await", "_test_setup_speaker", "(", "hass", ...
[ 298, 0 ]
[ 304, 41 ]
python
en
['en', 'fr', 'it']
False
test_init_tv_on
( hass: HomeAssistantType, vizio_connect: pytest.fixture, vizio_update: pytest.fixture, )
Test Vizio TV entity setup when on.
Test Vizio TV entity setup when on.
async def test_init_tv_on( hass: HomeAssistantType, vizio_connect: pytest.fixture, vizio_update: pytest.fixture, ) -> None: """Test Vizio TV entity setup when on.""" await _test_setup_tv(hass, True)
[ "async", "def", "test_init_tv_on", "(", "hass", ":", "HomeAssistantType", ",", "vizio_connect", ":", "pytest", ".", "fixture", ",", "vizio_update", ":", "pytest", ".", "fixture", ",", ")", "->", "None", ":", "await", "_test_setup_tv", "(", "hass", ",", "True...
[ 307, 0 ]
[ 313, 36 ]
python
en
['en', 'el-Latn', 'en']
True
test_init_tv_off
( hass: HomeAssistantType, vizio_connect: pytest.fixture, vizio_update: pytest.fixture, )
Test Vizio TV entity setup when off.
Test Vizio TV entity setup when off.
async def test_init_tv_off( hass: HomeAssistantType, vizio_connect: pytest.fixture, vizio_update: pytest.fixture, ) -> None: """Test Vizio TV entity setup when off.""" await _test_setup_tv(hass, False)
[ "async", "def", "test_init_tv_off", "(", "hass", ":", "HomeAssistantType", ",", "vizio_connect", ":", "pytest", ".", "fixture", ",", "vizio_update", ":", "pytest", ".", "fixture", ",", ")", "->", "None", ":", "await", "_test_setup_tv", "(", "hass", ",", "Fal...
[ 316, 0 ]
[ 322, 37 ]
python
en
['en', 'it', 'en']
True
test_init_tv_unavailable
( hass: HomeAssistantType, vizio_connect: pytest.fixture, vizio_update: pytest.fixture, )
Test Vizio TV entity setup when unavailable.
Test Vizio TV entity setup when unavailable.
async def test_init_tv_unavailable( hass: HomeAssistantType, vizio_connect: pytest.fixture, vizio_update: pytest.fixture, ) -> None: """Test Vizio TV entity setup when unavailable.""" await _test_setup_tv(hass, None)
[ "async", "def", "test_init_tv_unavailable", "(", "hass", ":", "HomeAssistantType", ",", "vizio_connect", ":", "pytest", ".", "fixture", ",", "vizio_update", ":", "pytest", ".", "fixture", ",", ")", "->", "None", ":", "await", "_test_setup_tv", "(", "hass", ","...
[ 325, 0 ]
[ 331, 36 ]
python
en
['en', 'fr', 'it']
False
test_setup_failure_speaker
( hass: HomeAssistantType, vizio_connect: pytest.fixture )
Test speaker entity setup failure.
Test speaker entity setup failure.
async def test_setup_failure_speaker( hass: HomeAssistantType, vizio_connect: pytest.fixture ) -> None: """Test speaker entity setup failure.""" await _test_setup_failure(hass, MOCK_SPEAKER_CONFIG)
[ "async", "def", "test_setup_failure_speaker", "(", "hass", ":", "HomeAssistantType", ",", "vizio_connect", ":", "pytest", ".", "fixture", ")", "->", "None", ":", "await", "_test_setup_failure", "(", "hass", ",", "MOCK_SPEAKER_CONFIG", ")" ]
[ 334, 0 ]
[ 338, 56 ]
python
en
['en', 'et', 'en']
True
test_setup_failure_tv
( hass: HomeAssistantType, vizio_connect: pytest.fixture )
Test TV entity setup failure.
Test TV entity setup failure.
async def test_setup_failure_tv( hass: HomeAssistantType, vizio_connect: pytest.fixture ) -> None: """Test TV entity setup failure.""" await _test_setup_failure(hass, MOCK_USER_VALID_TV_CONFIG)
[ "async", "def", "test_setup_failure_tv", "(", "hass", ":", "HomeAssistantType", ",", "vizio_connect", ":", "pytest", ".", "fixture", ")", "->", "None", ":", "await", "_test_setup_failure", "(", "hass", ",", "MOCK_USER_VALID_TV_CONFIG", ")" ]
[ 341, 0 ]
[ 345, 62 ]
python
en
['en', 'sm', 'en']
True
test_services
( hass: HomeAssistantType, vizio_connect: pytest.fixture, vizio_update: pytest.fixture, )
Test all Vizio media player entity services.
Test all Vizio media player entity services.
async def test_services( hass: HomeAssistantType, vizio_connect: pytest.fixture, vizio_update: pytest.fixture, ) -> None: """Test all Vizio media player entity services.""" await _test_setup_tv(hass, True) await _test_service(hass, MP_DOMAIN, "pow_on", SERVICE_TURN_ON, None) await _test_ser...
[ "async", "def", "test_services", "(", "hass", ":", "HomeAssistantType", ",", "vizio_connect", ":", "pytest", ".", "fixture", ",", "vizio_update", ":", "pytest", ".", "fixture", ",", ")", "->", "None", ":", "await", "_test_setup_tv", "(", "hass", ",", "True",...
[ 348, 0 ]
[ 417, 5 ]
python
it
['en', 'it', 'it']
True
test_options_update
( hass: HomeAssistantType, vizio_connect: pytest.fixture, vizio_update: pytest.fixture, )
Test when config entry update event fires.
Test when config entry update event fires.
async def test_options_update( hass: HomeAssistantType, vizio_connect: pytest.fixture, vizio_update: pytest.fixture, ) -> None: """Test when config entry update event fires.""" await _test_setup_speaker(hass, True) config_entry = hass.config_entries.async_entries(DOMAIN)[0] assert config_ent...
[ "async", "def", "test_options_update", "(", "hass", ":", "HomeAssistantType", ",", "vizio_connect", ":", "pytest", ".", "fixture", ",", "vizio_update", ":", "pytest", ".", "fixture", ",", ")", "->", "None", ":", "await", "_test_setup_speaker", "(", "hass", ","...
[ 420, 0 ]
[ 439, 5 ]
python
en
['en', 'en', 'en']
True
test_update_unavailable_to_available
( hass: HomeAssistantType, vizio_connect: pytest.fixture, vizio_update: pytest.fixture, caplog: pytest.fixture, )
Test device becomes available after being unavailable.
Test device becomes available after being unavailable.
async def test_update_unavailable_to_available( hass: HomeAssistantType, vizio_connect: pytest.fixture, vizio_update: pytest.fixture, caplog: pytest.fixture, ) -> None: """Test device becomes available after being unavailable.""" await _test_update_availability_switch(hass, None, True, caplog)
[ "async", "def", "test_update_unavailable_to_available", "(", "hass", ":", "HomeAssistantType", ",", "vizio_connect", ":", "pytest", ".", "fixture", ",", "vizio_update", ":", "pytest", ".", "fixture", ",", "caplog", ":", "pytest", ".", "fixture", ",", ")", "->", ...
[ 485, 0 ]
[ 492, 68 ]
python
en
['en', 'en', 'en']
True
test_update_available_to_unavailable
( hass: HomeAssistantType, vizio_connect: pytest.fixture, vizio_update: pytest.fixture, caplog: pytest.fixture, )
Test device becomes unavailable after being available.
Test device becomes unavailable after being available.
async def test_update_available_to_unavailable( hass: HomeAssistantType, vizio_connect: pytest.fixture, vizio_update: pytest.fixture, caplog: pytest.fixture, ) -> None: """Test device becomes unavailable after being available.""" await _test_update_availability_switch(hass, True, None, caplog)
[ "async", "def", "test_update_available_to_unavailable", "(", "hass", ":", "HomeAssistantType", ",", "vizio_connect", ":", "pytest", ".", "fixture", ",", "vizio_update", ":", "pytest", ".", "fixture", ",", "caplog", ":", "pytest", ".", "fixture", ",", ")", "->", ...
[ 495, 0 ]
[ 502, 68 ]
python
en
['en', 'en', 'en']
True
test_setup_with_apps
( hass: HomeAssistantType, vizio_connect: pytest.fixture, vizio_update_with_apps: pytest.fixture, caplog: pytest.fixture, )
Test device setup with apps.
Test device setup with apps.
async def test_setup_with_apps( hass: HomeAssistantType, vizio_connect: pytest.fixture, vizio_update_with_apps: pytest.fixture, caplog: pytest.fixture, ) -> None: """Test device setup with apps.""" async with _cm_for_test_setup_tv_with_apps( hass, MOCK_USER_VALID_TV_CONFIG, CURRENT_APP_C...
[ "async", "def", "test_setup_with_apps", "(", "hass", ":", "HomeAssistantType", ",", "vizio_connect", ":", "pytest", ".", "fixture", ",", "vizio_update_with_apps", ":", "pytest", ".", "fixture", ",", "caplog", ":", "pytest", ".", "fixture", ",", ")", "->", "Non...
[ 505, 0 ]
[ 530, 5 ]
python
en
['en', 'en', 'en']
True
test_setup_with_apps_include
( hass: HomeAssistantType, vizio_connect: pytest.fixture, vizio_update_with_apps: pytest.fixture, caplog: pytest.fixture, )
Test device setup with apps and apps["include"] in config.
Test device setup with apps and apps["include"] in config.
async def test_setup_with_apps_include( hass: HomeAssistantType, vizio_connect: pytest.fixture, vizio_update_with_apps: pytest.fixture, caplog: pytest.fixture, ) -> None: """Test device setup with apps and apps["include"] in config.""" async with _cm_for_test_setup_tv_with_apps( hass, MO...
[ "async", "def", "test_setup_with_apps_include", "(", "hass", ":", "HomeAssistantType", ",", "vizio_connect", ":", "pytest", ".", "fixture", ",", "vizio_update_with_apps", ":", "pytest", ".", "fixture", ",", "caplog", ":", "pytest", ".", "fixture", ",", ")", "->"...
[ 533, 0 ]
[ 548, 35 ]
python
en
['en', 'en', 'en']
True
test_setup_with_apps_exclude
( hass: HomeAssistantType, vizio_connect: pytest.fixture, vizio_update_with_apps: pytest.fixture, caplog: pytest.fixture, )
Test device setup with apps and apps["exclude"] in config.
Test device setup with apps and apps["exclude"] in config.
async def test_setup_with_apps_exclude( hass: HomeAssistantType, vizio_connect: pytest.fixture, vizio_update_with_apps: pytest.fixture, caplog: pytest.fixture, ) -> None: """Test device setup with apps and apps["exclude"] in config.""" async with _cm_for_test_setup_tv_with_apps( hass, MO...
[ "async", "def", "test_setup_with_apps_exclude", "(", "hass", ":", "HomeAssistantType", ",", "vizio_connect", ":", "pytest", ".", "fixture", ",", "vizio_update_with_apps", ":", "pytest", ".", "fixture", ",", "caplog", ":", "pytest", ".", "fixture", ",", ")", "->"...
[ 551, 0 ]
[ 566, 35 ]
python
en
['en', 'en', 'en']
True
test_setup_with_apps_additional_apps_config
( hass: HomeAssistantType, vizio_connect: pytest.fixture, vizio_update_with_apps: pytest.fixture, caplog: pytest.fixture, )
Test device setup with apps and apps["additional_configs"] in config.
Test device setup with apps and apps["additional_configs"] in config.
async def test_setup_with_apps_additional_apps_config( hass: HomeAssistantType, vizio_connect: pytest.fixture, vizio_update_with_apps: pytest.fixture, caplog: pytest.fixture, ) -> None: """Test device setup with apps and apps["additional_configs"] in config.""" async with _cm_for_test_setup_tv_w...
[ "async", "def", "test_setup_with_apps_additional_apps_config", "(", "hass", ":", "HomeAssistantType", ",", "vizio_connect", ":", "pytest", ".", "fixture", ",", "vizio_update_with_apps", ":", "pytest", ".", "fixture", ",", "caplog", ":", "pytest", ".", "fixture", ","...
[ 569, 0 ]
[ 633, 39 ]
python
en
['en', 'en', 'en']
True
test_invalid_apps_config
(hass: HomeAssistantType)
Test that schema validation fails on certain conditions.
Test that schema validation fails on certain conditions.
def test_invalid_apps_config(hass: HomeAssistantType): """Test that schema validation fails on certain conditions.""" with raises(vol.Invalid): vol.Schema(vol.All(VIZIO_SCHEMA, validate_apps))(MOCK_TV_APPS_FAILURE) with raises(vol.Invalid): vol.Schema(vol.All(VIZIO_SCHEMA, validate_apps))(M...
[ "def", "test_invalid_apps_config", "(", "hass", ":", "HomeAssistantType", ")", ":", "with", "raises", "(", "vol", ".", "Invalid", ")", ":", "vol", ".", "Schema", "(", "vol", ".", "All", "(", "VIZIO_SCHEMA", ",", "validate_apps", ")", ")", "(", "MOCK_TV_APP...
[ 636, 0 ]
[ 642, 83 ]
python
en
['en', 'en', 'en']
True
test_setup_with_unknown_app_config
( hass: HomeAssistantType, vizio_connect: pytest.fixture, vizio_update_with_apps: pytest.fixture, caplog: pytest.fixture, )
Test device setup with apps where app config returned is unknown.
Test device setup with apps where app config returned is unknown.
async def test_setup_with_unknown_app_config( hass: HomeAssistantType, vizio_connect: pytest.fixture, vizio_update_with_apps: pytest.fixture, caplog: pytest.fixture, ) -> None: """Test device setup with apps where app config returned is unknown.""" async with _cm_for_test_setup_tv_with_apps( ...
[ "async", "def", "test_setup_with_unknown_app_config", "(", "hass", ":", "HomeAssistantType", ",", "vizio_connect", ":", "pytest", ".", "fixture", ",", "vizio_update_with_apps", ":", "pytest", ".", "fixture", ",", "caplog", ":", "pytest", ".", "fixture", ",", ")", ...
[ 645, 0 ]
[ 659, 51 ]
python
en
['en', 'en', 'en']
True
test_setup_with_no_running_app
( hass: HomeAssistantType, vizio_connect: pytest.fixture, vizio_update_with_apps: pytest.fixture, caplog: pytest.fixture, )
Test device setup with apps where no app is running.
Test device setup with apps where no app is running.
async def test_setup_with_no_running_app( hass: HomeAssistantType, vizio_connect: pytest.fixture, vizio_update_with_apps: pytest.fixture, caplog: pytest.fixture, ) -> None: """Test device setup with apps where no app is running.""" async with _cm_for_test_setup_tv_with_apps( hass, MOCK_U...
[ "async", "def", "test_setup_with_no_running_app", "(", "hass", ":", "HomeAssistantType", ",", "vizio_connect", ":", "pytest", ".", "fixture", ",", "vizio_update_with_apps", ":", "pytest", ".", "fixture", ",", "caplog", ":", "pytest", ".", "fixture", ",", ")", "-...
[ 662, 0 ]
[ 676, 37 ]
python
en
['en', 'en', 'en']
True
test_setup_tv_without_mute
( hass: HomeAssistantType, vizio_connect: pytest.fixture, vizio_update: pytest.fixture, )
Test Vizio TV entity setup when mute property isn't returned by Vizio API.
Test Vizio TV entity setup when mute property isn't returned by Vizio API.
async def test_setup_tv_without_mute( hass: HomeAssistantType, vizio_connect: pytest.fixture, vizio_update: pytest.fixture, ) -> None: """Test Vizio TV entity setup when mute property isn't returned by Vizio API.""" config_entry = MockConfigEntry( domain=DOMAIN, data=vol.Schema(VIZIO...
[ "async", "def", "test_setup_tv_without_mute", "(", "hass", ":", "HomeAssistantType", ",", "vizio_connect", ":", "pytest", ".", "fixture", ",", "vizio_update", ":", "pytest", ".", "fixture", ",", ")", "->", "None", ":", "config_entry", "=", "MockConfigEntry", "("...
[ 679, 0 ]
[ 700, 44 ]
python
en
['en', 'ht', 'en']
True
test_apps_update
( hass: HomeAssistantType, vizio_connect: pytest.fixture, vizio_update_with_apps: pytest.fixture, caplog: pytest.fixture, )
Test device setup with apps where no app is running.
Test device setup with apps where no app is running.
async def test_apps_update( hass: HomeAssistantType, vizio_connect: pytest.fixture, vizio_update_with_apps: pytest.fixture, caplog: pytest.fixture, ) -> None: """Test device setup with apps where no app is running.""" with patch( "homeassistant.components.vizio.gen_apps_list_from_url", ...
[ "async", "def", "test_apps_update", "(", "hass", ":", "HomeAssistantType", ",", "vizio_connect", ":", "pytest", ".", "fixture", ",", "vizio_update_with_apps", ":", "pytest", ".", "fixture", ",", "caplog", ":", "pytest", ".", "fixture", ",", ")", "->", "None", ...
[ 703, 0 ]
[ 733, 49 ]
python
en
['en', 'en', 'en']
True
hwtest
(cloud_id, install_code, ip_address)
Try API call 'get_network_info' to see if target device is Legacy or Eagle-200.
Try API call 'get_network_info' to see if target device is Legacy or Eagle-200.
def hwtest(cloud_id, install_code, ip_address): """Try API call 'get_network_info' to see if target device is Legacy or Eagle-200.""" reader = LeagleReader(cloud_id, install_code, ip_address) response = reader.get_network_info() # Branch to test if target is Legacy Model if "NetworkInfo" in respons...
[ "def", "hwtest", "(", "cloud_id", ",", "install_code", ",", "ip_address", ")", ":", "reader", "=", "LeagleReader", "(", "cloud_id", ",", "install_code", ",", "ip_address", ")", "response", "=", "reader", ".", "get_network_info", "(", ")", "# Branch to test if ta...
[ 52, 0 ]
[ 68, 56 ]
python
en
['en', 'en', 'en']
True
setup_platform
(hass, config, add_entities, discovery_info=None)
Create the Eagle-200 sensor.
Create the Eagle-200 sensor.
def setup_platform(hass, config, add_entities, discovery_info=None): """Create the Eagle-200 sensor.""" ip_address = config[CONF_IP_ADDRESS] cloud_id = config[CONF_CLOUD_ID] install_code = config[CONF_INSTALL_CODE] try: eagle_reader = hwtest(cloud_id, install_code, ip_address) except (C...
[ "def", "setup_platform", "(", "hass", ",", "config", ",", "add_entities", ",", "discovery_info", "=", "None", ")", ":", "ip_address", "=", "config", "[", "CONF_IP_ADDRESS", "]", "cloud_id", "=", "config", "[", "CONF_CLOUD_ID", "]", "install_code", "=", "config...
[ 71, 0 ]
[ 94, 25 ]
python
en
['en', 'sm', 'en']
True
EagleSensor.__init__
(self, eagle_data, sensor_type, name, unit)
Initialize the sensor.
Initialize the sensor.
def __init__(self, eagle_data, sensor_type, name, unit): """Initialize the sensor.""" self.eagle_data = eagle_data self._type = sensor_type self._name = name self._unit_of_measurement = unit self._state = None
[ "def", "__init__", "(", "self", ",", "eagle_data", ",", "sensor_type", ",", "name", ",", "unit", ")", ":", "self", ".", "eagle_data", "=", "eagle_data", "self", ".", "_type", "=", "sensor_type", "self", ".", "_name", "=", "name", "self", ".", "_unit_of_m...
[ 100, 4 ]
[ 106, 26 ]
python
en
['en', 'en', 'en']
True
EagleSensor.device_class
(self)
Return the power device class for the instantanous_demand sensor.
Return the power device class for the instantanous_demand sensor.
def device_class(self): """Return the power device class for the instantanous_demand sensor.""" if self._type == "instantanous_demand": return DEVICE_CLASS_POWER return None
[ "def", "device_class", "(", "self", ")", ":", "if", "self", ".", "_type", "==", "\"instantanous_demand\"", ":", "return", "DEVICE_CLASS_POWER", "return", "None" ]
[ 109, 4 ]
[ 114, 19 ]
python
en
['en', 'en', 'en']
True
EagleSensor.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" ]
[ 117, 4 ]
[ 119, 25 ]
python
en
['en', 'mi', 'en']
True
EagleSensor.state
(self)
Return the state of the sensor.
Return the state of the sensor.
def state(self): """Return the state of the sensor.""" return self._state
[ "def", "state", "(", "self", ")", ":", "return", "self", ".", "_state" ]
[ 122, 4 ]
[ 124, 26 ]
python
en
['en', 'en', 'en']
True
EagleSensor.unit_of_measurement
(self)
Return the unit of measurement.
Return the unit of measurement.
def unit_of_measurement(self): """Return the unit of measurement.""" return self._unit_of_measurement
[ "def", "unit_of_measurement", "(", "self", ")", ":", "return", "self", ".", "_unit_of_measurement" ]
[ 127, 4 ]
[ 129, 40 ]
python
en
['en', 'la', 'en']
True
EagleSensor.update
(self)
Get the energy information from the Rainforest Eagle.
Get the energy information from the Rainforest Eagle.
def update(self): """Get the energy information from the Rainforest Eagle.""" self.eagle_data.update() self._state = self.eagle_data.get_state(self._type)
[ "def", "update", "(", "self", ")", ":", "self", ".", "eagle_data", ".", "update", "(", ")", "self", ".", "_state", "=", "self", ".", "eagle_data", ".", "get_state", "(", "self", ".", "_type", ")" ]
[ 131, 4 ]
[ 134, 59 ]
python
en
['en', 'en', 'en']
True
EagleData.__init__
(self, eagle_reader)
Initialize the data object.
Initialize the data object.
def __init__(self, eagle_reader): """Initialize the data object.""" self._eagle_reader = eagle_reader self.data = {}
[ "def", "__init__", "(", "self", ",", "eagle_reader", ")", ":", "self", ".", "_eagle_reader", "=", "eagle_reader", "self", ".", "data", "=", "{", "}" ]
[ 140, 4 ]
[ 143, 22 ]
python
en
['en', 'en', 'en']
True
EagleData.update
(self)
Get the latest data from the Eagle-200 device.
Get the latest data from the Eagle-200 device.
def update(self): """Get the latest data from the Eagle-200 device.""" try: self.data = self._eagle_reader.update() _LOGGER.debug("API data: %s", self.data) except (ConnectError, HTTPError, Timeout, ValueError) as error: _LOGGER.error("Unable to connect during...
[ "def", "update", "(", "self", ")", ":", "try", ":", "self", ".", "data", "=", "self", ".", "_eagle_reader", ".", "update", "(", ")", "_LOGGER", ".", "debug", "(", "\"API data: %s\"", ",", "self", ".", "data", ")", "except", "(", "ConnectError", ",", ...
[ 146, 4 ]
[ 153, 26 ]
python
en
['en', 'en', 'en']
True
EagleData.get_state
(self, sensor_type)
Get the sensor value from the dictionary.
Get the sensor value from the dictionary.
def get_state(self, sensor_type): """Get the sensor value from the dictionary.""" state = self.data.get(sensor_type) _LOGGER.debug("Updating: %s - %s", sensor_type, state) return state
[ "def", "get_state", "(", "self", ",", "sensor_type", ")", ":", "state", "=", "self", ".", "data", ".", "get", "(", "sensor_type", ")", "_LOGGER", ".", "debug", "(", "\"Updating: %s - %s\"", ",", "sensor_type", ",", "state", ")", "return", "state" ]
[ 155, 4 ]
[ 159, 20 ]
python
en
['en', 'en', 'en']
True
LeagleReader.update
(self)
Fetch and return the four sensor values in a dict.
Fetch and return the four sensor values in a dict.
def update(self): """Fetch and return the four sensor values in a dict.""" out = {} resp = self.get_instantaneous_demand()["InstantaneousDemand"] out["instantanous_demand"] = resp["Demand"] resp = self.get_current_summation()["CurrentSummation"] out["summation_delivered...
[ "def", "update", "(", "self", ")", ":", "out", "=", "{", "}", "resp", "=", "self", ".", "get_instantaneous_demand", "(", ")", "[", "\"InstantaneousDemand\"", "]", "out", "[", "\"instantanous_demand\"", "]", "=", "resp", "[", "\"Demand\"", "]", "resp", "=",...
[ 165, 4 ]
[ 177, 18 ]
python
en
['en', 'en', 'en']
True
setup
(hass, config)
Set up the LiteJet component.
Set up the LiteJet component.
def setup(hass, config): """Set up the LiteJet component.""" url = config[DOMAIN].get(CONF_PORT) hass.data["litejet_system"] = LiteJet(url) hass.data["litejet_config"] = config[DOMAIN] discovery.load_platform(hass, "light", DOMAIN, {}, config) if config[DOMAIN].get(CONF_INCLUDE_SWITCHES): ...
[ "def", "setup", "(", "hass", ",", "config", ")", ":", "url", "=", "config", "[", "DOMAIN", "]", ".", "get", "(", "CONF_PORT", ")", "hass", ".", "data", "[", "\"litejet_system\"", "]", "=", "LiteJet", "(", "url", ")", "hass", ".", "data", "[", "\"li...
[ 27, 0 ]
[ 40, 15 ]
python
en
['en', 'da', 'en']
True
is_ignored
(hass, name)
Determine if a load, switch, or scene should be ignored.
Determine if a load, switch, or scene should be ignored.
def is_ignored(hass, name): """Determine if a load, switch, or scene should be ignored.""" for prefix in hass.data["litejet_config"].get(CONF_EXCLUDE_NAMES, []): if name.startswith(prefix): return True return False
[ "def", "is_ignored", "(", "hass", ",", "name", ")", ":", "for", "prefix", "in", "hass", ".", "data", "[", "\"litejet_config\"", "]", ".", "get", "(", "CONF_EXCLUDE_NAMES", ",", "[", "]", ")", ":", "if", "name", ".", "startswith", "(", "prefix", ")", ...
[ 43, 0 ]
[ 48, 16 ]
python
en
['en', 'en', 'en']
True
test_flow_ssdp_discovery
(hass: HomeAssistantType)
Test config flow: discovered + configured through ssdp.
Test config flow: discovered + configured through ssdp.
async def test_flow_ssdp_discovery(hass: HomeAssistantType): """Test config flow: discovered + configured through ssdp.""" udn = "uuid:device_1" mock_device = MockDevice(udn) discovery_infos = [ { DISCOVERY_ST: mock_device.device_type, DISCOVERY_UDN: mock_device.udn, ...
[ "async", "def", "test_flow_ssdp_discovery", "(", "hass", ":", "HomeAssistantType", ")", ":", "udn", "=", "\"uuid:device_1\"", "mock_device", "=", "MockDevice", "(", "udn", ")", "discovery_infos", "=", "[", "{", "DISCOVERY_ST", ":", "mock_device", ".", "device_type...
[ 27, 0 ]
[ 65, 9 ]
python
en
['en', 'en', 'en']
True
test_flow_ssdp_discovery_incomplete
(hass: HomeAssistantType)
Test config flow: incomplete discovery through ssdp.
Test config flow: incomplete discovery through ssdp.
async def test_flow_ssdp_discovery_incomplete(hass: HomeAssistantType): """Test config flow: incomplete discovery through ssdp.""" udn = "uuid:device_1" mock_device = MockDevice(udn) discovery_infos = [ { DISCOVERY_ST: mock_device.device_type, DISCOVERY_UDN: mock_device.u...
[ "async", "def", "test_flow_ssdp_discovery_incomplete", "(", "hass", ":", "HomeAssistantType", ")", ":", "udn", "=", "\"uuid:device_1\"", "mock_device", "=", "MockDevice", "(", "udn", ")", "discovery_infos", "=", "[", "{", "DISCOVERY_ST", ":", "mock_device", ".", "...
[ 68, 0 ]
[ 93, 57 ]
python
en
['en', 'en', 'en']
True
test_flow_user
(hass: HomeAssistantType)
Test config flow: discovered + configured through user.
Test config flow: discovered + configured through user.
async def test_flow_user(hass: HomeAssistantType): """Test config flow: discovered + configured through user.""" udn = "uuid:device_1" mock_device = MockDevice(udn) discovery_infos = [ { DISCOVERY_USN: mock_device.unique_id, DISCOVERY_ST: mock_device.device_type, ...
[ "async", "def", "test_flow_user", "(", "hass", ":", "HomeAssistantType", ")", ":", "udn", "=", "\"uuid:device_1\"", "mock_device", "=", "MockDevice", "(", "udn", ")", "discovery_infos", "=", "[", "{", "DISCOVERY_USN", ":", "mock_device", ".", "unique_id", ",", ...
[ 96, 0 ]
[ 130, 9 ]
python
en
['en', 'en', 'en']
True
test_flow_import
(hass: HomeAssistantType)
Test config flow: discovered + configured through configuration.yaml.
Test config flow: discovered + configured through configuration.yaml.
async def test_flow_import(hass: HomeAssistantType): """Test config flow: discovered + configured through configuration.yaml.""" udn = "uuid:device_1" mock_device = MockDevice(udn) discovery_infos = [ { DISCOVERY_USN: mock_device.unique_id, DISCOVERY_ST: mock_device.devic...
[ "async", "def", "test_flow_import", "(", "hass", ":", "HomeAssistantType", ")", ":", "udn", "=", "\"uuid:device_1\"", "mock_device", "=", "MockDevice", "(", "udn", ")", "discovery_infos", "=", "[", "{", "DISCOVERY_USN", ":", "mock_device", ".", "unique_id", ",",...
[ 133, 0 ]
[ 159, 9 ]
python
en
['en', 'en', 'en']
True
test_flow_import_duplicate
(hass: HomeAssistantType)
Test config flow: discovered, but already configured.
Test config flow: discovered, but already configured.
async def test_flow_import_duplicate(hass: HomeAssistantType): """Test config flow: discovered, but already configured.""" udn = "uuid:device_1" mock_device = MockDevice(udn) discovery_infos = [ { DISCOVERY_USN: mock_device.unique_id, DISCOVERY_ST: mock_device.device_type...
[ "async", "def", "test_flow_import_duplicate", "(", "hass", ":", "HomeAssistantType", ")", ":", "udn", "=", "\"uuid:device_1\"", "mock_device", "=", "MockDevice", "(", "udn", ")", "discovery_infos", "=", "[", "{", "DISCOVERY_USN", ":", "mock_device", ".", "unique_i...
[ 162, 0 ]
[ 195, 55 ]
python
en
['en', 'en', 'en']
True
test_flow_import_incomplete
(hass: HomeAssistantType)
Test config flow: incomplete discovery, configured through configuration.yaml.
Test config flow: incomplete discovery, configured through configuration.yaml.
async def test_flow_import_incomplete(hass: HomeAssistantType): """Test config flow: incomplete discovery, configured through configuration.yaml.""" udn = "uuid:device_1" mock_device = MockDevice(udn) discovery_infos = [ { DISCOVERY_ST: mock_device.device_type, DISCOVERY_...
[ "async", "def", "test_flow_import_incomplete", "(", "hass", ":", "HomeAssistantType", ")", ":", "udn", "=", "\"uuid:device_1\"", "mock_device", "=", "MockDevice", "(", "udn", ")", "discovery_infos", "=", "[", "{", "DISCOVERY_ST", ":", "mock_device", ".", "device_t...
[ 198, 0 ]
[ 219, 57 ]
python
en
['en', 'en', 'en']
True
test_options_flow
(hass: HomeAssistantType)
Test options flow.
Test options flow.
async def test_options_flow(hass: HomeAssistantType): """Test options flow.""" # Set up config entry. udn = "uuid:device_1" mock_device = MockDevice(udn) discovery_infos = [ { DISCOVERY_UDN: mock_device.udn, DISCOVERY_ST: mock_device.device_type, DISCOVERY...
[ "async", "def", "test_options_flow", "(", "hass", ":", "HomeAssistantType", ")", ":", "# Set up config entry.", "udn", "=", "\"uuid:device_1\"", "mock_device", "=", "MockDevice", "(", "udn", ")", "discovery_infos", "=", "[", "{", "DISCOVERY_UDN", ":", "mock_device",...
[ 222, 0 ]
[ 276, 67 ]
python
en
['en', 'fr', 'en']
True
async_setup_entry
(hass, config_entry, async_add_entities)
Set up the Zigbee Home Automation fan from config entry.
Set up the Zigbee Home Automation fan from config entry.
async def async_setup_entry(hass, config_entry, async_add_entities): """Set up the Zigbee Home Automation fan from config entry.""" entities_to_create = hass.data[DATA_ZHA][DOMAIN] unsub = async_dispatcher_connect( hass, SIGNAL_ADD_ENTITIES, functools.partial( discovery....
[ "async", "def", "async_setup_entry", "(", "hass", ",", "config_entry", ",", "async_add_entities", ")", ":", "entities_to_create", "=", "hass", ".", "data", "[", "DATA_ZHA", "]", "[", "DOMAIN", "]", "unsub", "=", "async_dispatcher_connect", "(", "hass", ",", "S...
[ 56, 0 ]
[ 67, 59 ]
python
en
['en', 'en', 'en']
True
BaseFan.__init__
(self, *args, **kwargs)
Initialize the fan.
Initialize the fan.
def __init__(self, *args, **kwargs): """Initialize the fan.""" super().__init__(*args, **kwargs) self._state = None self._fan_channel = None
[ "def", "__init__", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "super", "(", ")", ".", "__init__", "(", "*", "args", ",", "*", "*", "kwargs", ")", "self", ".", "_state", "=", "None", "self", ".", "_fan_channel", "=", "None" ...
[ 73, 4 ]
[ 77, 32 ]
python
en
['en', 'fy', 'en']
True
BaseFan.speed_list
(self)
Get the list of available speeds.
Get the list of available speeds.
def speed_list(self) -> list: """Get the list of available speeds.""" return SPEED_LIST
[ "def", "speed_list", "(", "self", ")", "->", "list", ":", "return", "SPEED_LIST" ]
[ 80, 4 ]
[ 82, 25 ]
python
en
['en', 'en', 'en']
True
BaseFan.speed
(self)
Return the current speed.
Return the current speed.
def speed(self) -> str: """Return the current speed.""" return self._state
[ "def", "speed", "(", "self", ")", "->", "str", ":", "return", "self", ".", "_state" ]
[ 85, 4 ]
[ 87, 26 ]
python
en
['en', 'en', 'en']
True
BaseFan.is_on
(self)
Return true if entity is on.
Return true if entity is on.
def is_on(self) -> bool: """Return true if entity is on.""" if self._state is None: return False return self._state != SPEED_OFF
[ "def", "is_on", "(", "self", ")", "->", "bool", ":", "if", "self", ".", "_state", "is", "None", ":", "return", "False", "return", "self", ".", "_state", "!=", "SPEED_OFF" ]
[ 90, 4 ]
[ 94, 39 ]
python
en
['en', 'cy', 'en']
True
BaseFan.supported_features
(self)
Flag supported features.
Flag supported features.
def supported_features(self) -> int: """Flag supported features.""" return SUPPORT_SET_SPEED
[ "def", "supported_features", "(", "self", ")", "->", "int", ":", "return", "SUPPORT_SET_SPEED" ]
[ 97, 4 ]
[ 99, 32 ]
python
en
['da', 'en', 'en']
True
BaseFan.async_turn_on
(self, speed: str = None, **kwargs)
Turn the entity on.
Turn the entity on.
async def async_turn_on(self, speed: str = None, **kwargs) -> None: """Turn the entity on.""" if speed is None: speed = SPEED_MEDIUM await self.async_set_speed(speed)
[ "async", "def", "async_turn_on", "(", "self", ",", "speed", ":", "str", "=", "None", ",", "*", "*", "kwargs", ")", "->", "None", ":", "if", "speed", "is", "None", ":", "speed", "=", "SPEED_MEDIUM", "await", "self", ".", "async_set_speed", "(", "speed",...
[ 101, 4 ]
[ 106, 41 ]
python
en
['en', 'en', 'en']
True
BaseFan.async_turn_off
(self, **kwargs)
Turn the entity off.
Turn the entity off.
async def async_turn_off(self, **kwargs) -> None: """Turn the entity off.""" await self.async_set_speed(SPEED_OFF)
[ "async", "def", "async_turn_off", "(", "self", ",", "*", "*", "kwargs", ")", "->", "None", ":", "await", "self", ".", "async_set_speed", "(", "SPEED_OFF", ")" ]
[ 108, 4 ]
[ 110, 45 ]
python
en
['en', 'en', 'en']
True
BaseFan.async_set_speed
(self, speed: str)
Set the speed of the fan.
Set the speed of the fan.
async def async_set_speed(self, speed: str) -> None: """Set the speed of the fan.""" await self._fan_channel.async_set_speed(SPEED_TO_VALUE[speed]) self.async_set_state(0, "fan_mode", speed)
[ "async", "def", "async_set_speed", "(", "self", ",", "speed", ":", "str", ")", "->", "None", ":", "await", "self", ".", "_fan_channel", ".", "async_set_speed", "(", "SPEED_TO_VALUE", "[", "speed", "]", ")", "self", ".", "async_set_state", "(", "0", ",", ...
[ 112, 4 ]
[ 115, 50 ]
python
en
['en', 'en', 'en']
True
BaseFan.async_set_state
(self, attr_id, attr_name, value)
Handle state update from channel.
Handle state update from channel.
def async_set_state(self, attr_id, attr_name, value): """Handle state update from channel."""
[ "def", "async_set_state", "(", "self", ",", "attr_id", ",", "attr_name", ",", "value", ")", ":" ]
[ 118, 4 ]
[ 119, 47 ]
python
en
['en', 'en', 'en']
True
get_links
(paper, event_folder, title, previous_link)
Encontrar o link e realizar o download do PDF.
Encontrar o link e realizar o download do PDF.
def get_links(paper, event_folder, title, previous_link): """Encontrar o link e realizar o download do PDF.""" try: link_pdf = paper.find('a',href=re.compile(r'(.pdf)')) link = link_pdf['href'] if not link in previous_link: previous_link = link if link.startswith(...
[ "def", "get_links", "(", "paper", ",", "event_folder", ",", "title", ",", "previous_link", ")", ":", "try", ":", "link_pdf", "=", "paper", ".", "find", "(", "'a'", ",", "href", "=", "re", ".", "compile", "(", "r'(.pdf)'", ")", ")", "link", "=", "link...
[ 5, 0 ]
[ 35, 59 ]
python
pt
['gl', 'pt', 'pt']
True
get_infos
(paper_boxes, base_url, final_list, event_folder, previous_link)
Raspa as informações de cada paper.
Raspa as informações de cada paper.
def get_infos(paper_boxes, base_url, final_list, event_folder, previous_link): """Raspa as informações de cada paper.""" for paper in paper_boxes: title = paper.h2.text title = title.strip().lower().replace('/','-') infos = paper.find_all('dt') tipo = "" event = "" ...
[ "def", "get_infos", "(", "paper_boxes", ",", "base_url", ",", "final_list", ",", "event_folder", ",", "previous_link", ")", ":", "for", "paper", "in", "paper_boxes", ":", "title", "=", "paper", ".", "h2", ".", "text", "title", "=", "title", ".", "strip", ...
[ 38, 0 ]
[ 77, 60 ]
python
pt
['pt', 'pt', 'pt']
True
find_yy
(soln, dir_raw, parent, fig_opt, sub_opt, tp)
.8888b oo dP 88 " 88 88aaa dP 88d888b. .d888b88 dP dP dP dP 88 88 88' `88 88' `88 88 88 88 88 88 88 88 88 88. .88 88. .88 88. .88 dP dP dP...
def find_yy(soln, dir_raw, parent, fig_opt, sub_opt, tp): # tp is type """ .8888b oo dP 88 " 88 88aaa dP 88d888b. .d888b88 dP dP dP dP 88 88 88' `88 88' `88 88 88 88 ...
[ "def", "find_yy", "(", "soln", ",", "dir_raw", ",", "parent", ",", "fig_opt", ",", "sub_opt", ",", "tp", ")", ":", "# tp is type ", "#dnR = load_dR(path_R_npz, soln)", "path_raw", "=", "os", ".", "path", ".", "join", "(", "dir_raw", ",", "'raw.npz'", ")", ...
[ 191, 0 ]
[ 319, 36 ]
python
en
['en', 'error', 'th']
False
painter
(parent, fig_opt, sub_opt, ax, tp)
oo dP 88 88d888b. .d8888b. dP 88d888b. d8888P 88' `88 88' `88 88 88' `88 88 88. .88 88. .88 88 88 88 88 88Y888P' `88888P8 dP dP dP dP 88 ...
def painter(parent, fig_opt, sub_opt, ax, tp): """ oo dP 88 88d888b. .d8888b. dP 88d888b. d8888P 88' `88 88' `88 88 88' `88 88 88. .88 88. .88 88 88 88 88 ...
[ "def", "painter", "(", "parent", ",", "fig_opt", ",", "sub_opt", ",", "ax", ",", "tp", ")", ":", "print", "'@'", "*", "20", "print", "'plotting '", "+", "str", "(", "sub_opt", "[", "'name'", "]", ")", "dir_public", "=", "parent", ".", "project", "[",...
[ 424, 0 ]
[ 867, 12 ]
python
en
['en', 'error', 'th']
False
BatchFeature.__getitem__
(self, item: str)
If the key is a string, returns the value of the dict associated to :obj:`key` ('input_values', 'attention_mask', etc.).
If the key is a string, returns the value of the dict associated to :obj:`key` ('input_values', 'attention_mask', etc.).
def __getitem__(self, item: str) -> Union[Any]: """ If the key is a string, returns the value of the dict associated to :obj:`key` ('input_values', 'attention_mask', etc.). """ if isinstance(item, str): return self.data[item] else: raise KeyError("...
[ "def", "__getitem__", "(", "self", ",", "item", ":", "str", ")", "->", "Union", "[", "Any", "]", ":", "if", "isinstance", "(", "item", ",", "str", ")", ":", "return", "self", ".", "data", "[", "item", "]", "else", ":", "raise", "KeyError", "(", "...
[ 74, 4 ]
[ 82, 112 ]
python
en
['en', 'error', 'th']
False
BatchFeature.convert_to_tensors
(self, tensor_type: Optional[Union[str, TensorType]] = None)
Convert the inner content to tensors. Args: tensor_type (:obj:`str` or :class:`~transformers.file_utils.TensorType`, `optional`): The type of tensors to use. If :obj:`str`, should be one of the values of the enum :class:`~transformers.file_utils.TensorType`....
Convert the inner content to tensors.
def convert_to_tensors(self, tensor_type: Optional[Union[str, TensorType]] = None): """ Convert the inner content to tensors. Args: tensor_type (:obj:`str` or :class:`~transformers.file_utils.TensorType`, `optional`): The type of tensors to use. If :obj:`str`, should...
[ "def", "convert_to_tensors", "(", "self", ",", "tensor_type", ":", "Optional", "[", "Union", "[", "str", ",", "TensorType", "]", "]", "=", "None", ")", ":", "if", "tensor_type", "is", "None", ":", "return", "self", "# Convert to TensorType", "if", "not", "...
[ 109, 4 ]
[ 168, 19 ]
python
en
['en', 'error', 'th']
False
BatchFeature.to
(self, device: Union[str, "torch.device"])
Send all values to device by calling :obj:`v.to(device)` (PyTorch only). Args: device (:obj:`str` or :obj:`torch.device`): The device to put the tensors on. Returns: :class:`~transformers.BatchFeature`: The same instance after modification.
Send all values to device by calling :obj:`v.to(device)` (PyTorch only).
def to(self, device: Union[str, "torch.device"]) -> "BatchFeature": """ Send all values to device by calling :obj:`v.to(device)` (PyTorch only). Args: device (:obj:`str` or :obj:`torch.device`): The device to put the tensors on. Returns: :class:`~transformers.Ba...
[ "def", "to", "(", "self", ",", "device", ":", "Union", "[", "str", ",", "\"torch.device\"", "]", ")", "->", "\"BatchFeature\"", ":", "# This check catches things like APEX blindly calling \"to\" on all inputs to a module", "# Otherwise it passes the casts down and casts the LongT...
[ 172, 4 ]
[ 190, 19 ]
python
en
['en', 'error', 'th']
False
FeatureExtractionMixin.from_pretrained
( cls, pretrained_model_name_or_path: Union[str, os.PathLike], **kwargs )
r""" Instantiate a type of :class:`~transformers.feature_extraction_utils.FeatureExtractionMixin` from a feature extractor, *e.g.* a derived class of :class:`~transformers.SequenceFeatureExtractor`. Args: pretrained_model_name_or_path (:obj:`str` or :obj:`os.PathLike`): ...
r""" Instantiate a type of :class:`~transformers.feature_extraction_utils.FeatureExtractionMixin` from a feature extractor, *e.g.* a derived class of :class:`~transformers.SequenceFeatureExtractor`.
def from_pretrained( cls, pretrained_model_name_or_path: Union[str, os.PathLike], **kwargs ) -> PreTrainedFeatureExtractor: r""" Instantiate a type of :class:`~transformers.feature_extraction_utils.FeatureExtractionMixin` from a feature extractor, *e.g.* a derived class of :class:`~t...
[ "def", "from_pretrained", "(", "cls", ",", "pretrained_model_name_or_path", ":", "Union", "[", "str", ",", "os", ".", "PathLike", "]", ",", "*", "*", "kwargs", ")", "->", "PreTrainedFeatureExtractor", ":", "feature_extractor_dict", ",", "kwargs", "=", "cls", "...
[ 200, 4 ]
[ 272, 62 ]
python
cy
['en', 'cy', 'hi']
False
FeatureExtractionMixin.save_pretrained
(self, save_directory: Union[str, os.PathLike])
Save a feature_extractor object to the directory ``save_directory``, so that it can be re-loaded using the :func:`~transformers.feature_extraction_utils.FeatureExtractionMixin.from_pretrained` class method. Args: save_directory (:obj:`str` or :obj:`os.PathLike`): Di...
Save a feature_extractor object to the directory ``save_directory``, so that it can be re-loaded using the :func:`~transformers.feature_extraction_utils.FeatureExtractionMixin.from_pretrained` class method.
def save_pretrained(self, save_directory: Union[str, os.PathLike]): """ Save a feature_extractor object to the directory ``save_directory``, so that it can be re-loaded using the :func:`~transformers.feature_extraction_utils.FeatureExtractionMixin.from_pretrained` class method. Args: ...
[ "def", "save_pretrained", "(", "self", ",", "save_directory", ":", "Union", "[", "str", ",", "os", ".", "PathLike", "]", ")", ":", "if", "os", ".", "path", ".", "isfile", "(", "save_directory", ")", ":", "raise", "AssertionError", "(", "f\"Provided path ({...
[ 274, 4 ]
[ 290, 78 ]
python
en
['en', 'error', 'th']
False
FeatureExtractionMixin.get_feature_extractor_dict
( cls, pretrained_model_name_or_path: Union[str, os.PathLike], **kwargs )
From a ``pretrained_model_name_or_path``, resolve to a dictionary of parameters, to be used for instantiating a feature extractor of type :class:`~transformers.feature_extraction_utils.FeatureExtractionMixin` using ``from_dict``. Parameters: pretrained_model_name_or_path (:...
From a ``pretrained_model_name_or_path``, resolve to a dictionary of parameters, to be used for instantiating a feature extractor of type :class:`~transformers.feature_extraction_utils.FeatureExtractionMixin` using ``from_dict``.
def get_feature_extractor_dict( cls, pretrained_model_name_or_path: Union[str, os.PathLike], **kwargs ) -> Tuple[Dict[str, Any], Dict[str, Any]]: """ From a ``pretrained_model_name_or_path``, resolve to a dictionary of parameters, to be used for instantiating a feature extractor of t...
[ "def", "get_feature_extractor_dict", "(", "cls", ",", "pretrained_model_name_or_path", ":", "Union", "[", "str", ",", "os", ".", "PathLike", "]", ",", "*", "*", "kwargs", ")", "->", "Tuple", "[", "Dict", "[", "str", ",", "Any", "]", ",", "Dict", "[", "...
[ 293, 4 ]
[ 371, 45 ]
python
en
['en', 'error', 'th']
False
FeatureExtractionMixin.from_dict
(cls, feature_extractor_dict: Dict[str, Any], **kwargs)
Instantiates a type of :class:`~transformers.feature_extraction_utils.FeatureExtractionMixin` from a Python dictionary of parameters. Args: feature_extractor_dict (:obj:`Dict[str, Any]`): Dictionary that will be used to instantiate the feature extractor object. Such...
Instantiates a type of :class:`~transformers.feature_extraction_utils.FeatureExtractionMixin` from a Python dictionary of parameters.
def from_dict(cls, feature_extractor_dict: Dict[str, Any], **kwargs) -> PreTrainedFeatureExtractor: """ Instantiates a type of :class:`~transformers.feature_extraction_utils.FeatureExtractionMixin` from a Python dictionary of parameters. Args: feature_extractor_dict (:obj:`D...
[ "def", "from_dict", "(", "cls", ",", "feature_extractor_dict", ":", "Dict", "[", "str", ",", "Any", "]", ",", "*", "*", "kwargs", ")", "->", "PreTrainedFeatureExtractor", ":", "return_unused_kwargs", "=", "kwargs", ".", "pop", "(", "\"return_unused_kwargs\"", ...
[ 374, 4 ]
[ 408, 36 ]
python
en
['en', 'error', 'th']
False
FeatureExtractionMixin.to_dict
(self)
Serializes this instance to a Python dictionary. Returns: :obj:`Dict[str, Any]`: Dictionary of all the attributes that make up this feature extractor instance.
Serializes this instance to a Python dictionary.
def to_dict(self) -> Dict[str, Any]: """ Serializes this instance to a Python dictionary. Returns: :obj:`Dict[str, Any]`: Dictionary of all the attributes that make up this feature extractor instance. """ output = copy.deepcopy(self.__dict__) return output
[ "def", "to_dict", "(", "self", ")", "->", "Dict", "[", "str", ",", "Any", "]", ":", "output", "=", "copy", ".", "deepcopy", "(", "self", ".", "__dict__", ")", "return", "output" ]
[ 410, 4 ]
[ 419, 21 ]
python
en
['en', 'error', 'th']
False
FeatureExtractionMixin.from_json_file
(cls, json_file: Union[str, os.PathLike])
Instantiates a feature extractor of type :class:`~transformers.feature_extraction_utils.FeatureExtractionMixin` from the path to a JSON file of parameters. Args: json_file (:obj:`str` or :obj:`os.PathLike`): Path to the JSON file containing the parameters. ...
Instantiates a feature extractor of type :class:`~transformers.feature_extraction_utils.FeatureExtractionMixin` from the path to a JSON file of parameters.
def from_json_file(cls, json_file: Union[str, os.PathLike]) -> PreTrainedFeatureExtractor: """ Instantiates a feature extractor of type :class:`~transformers.feature_extraction_utils.FeatureExtractionMixin` from the path to a JSON file of parameters. Args: json_file (:obj:`s...
[ "def", "from_json_file", "(", "cls", ",", "json_file", ":", "Union", "[", "str", ",", "os", ".", "PathLike", "]", ")", "->", "PreTrainedFeatureExtractor", ":", "with", "open", "(", "json_file", ",", "\"r\"", ",", "encoding", "=", "\"utf-8\"", ")", "as", ...
[ 422, 4 ]
[ 438, 44 ]
python
en
['en', 'error', 'th']
False
FeatureExtractionMixin.to_json_string
(self)
Serializes this instance to a JSON string. Returns: :obj:`str`: String containing all the attributes that make up this feature_extractor instance in JSON format.
Serializes this instance to a JSON string.
def to_json_string(self) -> str: """ Serializes this instance to a JSON string. Returns: :obj:`str`: String containing all the attributes that make up this feature_extractor instance in JSON format. """ return json.dumps(self.to_dict(), indent=2, sort_key...
[ "def", "to_json_string", "(", "self", ")", "->", "str", ":", "return", "json", ".", "dumps", "(", "self", ".", "to_dict", "(", ")", ",", "indent", "=", "2", ",", "sort_keys", "=", "True", ")", "+", "\"\\n\"" ]
[ 440, 4 ]
[ 448, 74 ]
python
en
['en', 'error', 'th']
False
FeatureExtractionMixin.to_json_file
(self, json_file_path: Union[str, os.PathLike])
Save this instance to a JSON file. Args: json_file_path (:obj:`str` or :obj:`os.PathLike`): Path to the JSON file in which this feature_extractor instance's parameters will be saved.
Save this instance to a JSON file.
def to_json_file(self, json_file_path: Union[str, os.PathLike]): """ Save this instance to a JSON file. Args: json_file_path (:obj:`str` or :obj:`os.PathLike`): Path to the JSON file in which this feature_extractor instance's parameters will be saved. """ ...
[ "def", "to_json_file", "(", "self", ",", "json_file_path", ":", "Union", "[", "str", ",", "os", ".", "PathLike", "]", ")", ":", "with", "open", "(", "json_file_path", ",", "\"w\"", ",", "encoding", "=", "\"utf-8\"", ")", "as", "writer", ":", "writer", ...
[ 450, 4 ]
[ 459, 47 ]
python
en
['en', 'error', 'th']
False
async_get_conditions
( hass: HomeAssistant, device_id: str )
List device conditions.
List device conditions.
async def async_get_conditions( hass: HomeAssistant, device_id: str ) -> List[Dict[str, str]]: """List device conditions.""" conditions: List[Dict[str, str]] = [] entity_registry = await async_get_registry(hass) entries = [ entry for entry in async_entries_for_device(entity_registry,...
[ "async", "def", "async_get_conditions", "(", "hass", ":", "HomeAssistant", ",", "device_id", ":", "str", ")", "->", "List", "[", "Dict", "[", "str", ",", "str", "]", "]", ":", "conditions", ":", "List", "[", "Dict", "[", "str", ",", "str", "]", "]", ...
[ 205, 0 ]
[ 238, 21 ]
python
en
['fr', 'en', 'en']
True
async_condition_from_config
( config: ConfigType, config_validation: bool )
Evaluate state based on configuration.
Evaluate state based on configuration.
def async_condition_from_config( config: ConfigType, config_validation: bool ) -> condition.ConditionCheckerType: """Evaluate state based on configuration.""" if config_validation: config = CONDITION_SCHEMA(config) condition_type = config[CONF_TYPE] if condition_type in IS_ON: stat =...
[ "def", "async_condition_from_config", "(", "config", ":", "ConfigType", ",", "config_validation", ":", "bool", ")", "->", "condition", ".", "ConditionCheckerType", ":", "if", "config_validation", ":", "config", "=", "CONDITION_SCHEMA", "(", "config", ")", "condition...
[ 242, 0 ]
[ 261, 52 ]
python
en
['en', 'en', 'en']
True
async_get_condition_capabilities
(hass: HomeAssistant, config: dict)
List condition capabilities.
List condition capabilities.
async def async_get_condition_capabilities(hass: HomeAssistant, config: dict) -> dict: """List condition capabilities.""" return { "extra_fields": vol.Schema( {vol.Optional(CONF_FOR): cv.positive_time_period_dict} ) }
[ "async", "def", "async_get_condition_capabilities", "(", "hass", ":", "HomeAssistant", ",", "config", ":", "dict", ")", "->", "dict", ":", "return", "{", "\"extra_fields\"", ":", "vol", ".", "Schema", "(", "{", "vol", ".", "Optional", "(", "CONF_FOR", ")", ...
[ 264, 0 ]
[ 270, 5 ]
python
en
['ro', 'sr', 'en']
False
conv3x3
(in_planes, out_planes, stride=1)
3x3 convolution with padding
3x3 convolution with padding
def conv3x3(in_planes, out_planes, stride=1): " 3x3 convolution with padding " return nn.Conv2d(in_planes, out_planes, kernel_size=3, stride=stride, padding=1, bias=False)
[ "def", "conv3x3", "(", "in_planes", ",", "out_planes", ",", "stride", "=", "1", ")", ":", "return", "nn", ".", "Conv2d", "(", "in_planes", ",", "out_planes", ",", "kernel_size", "=", "3", ",", "stride", "=", "stride", ",", "padding", "=", "1", ",", "...
[ 14, 0 ]
[ 16, 96 ]
python
en
['en', 'ja', 'en']
True
async_setup_platform
(hass, config, async_add_entities, discovery_info=None)
Set up the Demo sensors.
Set up the Demo sensors.
async def async_setup_platform(hass, config, async_add_entities, discovery_info=None): """Set up the Demo sensors.""" async_add_entities( [ DemoSensor( "sensor_1", "Outside Temperature", 15.6, DEVICE_CLASS_TEMPERATURE, ...
[ "async", "def", "async_setup_platform", "(", "hass", ",", "config", ",", "async_add_entities", ",", "discovery_info", "=", "None", ")", ":", "async_add_entities", "(", "[", "DemoSensor", "(", "\"sensor_1\"", ",", "\"Outside Temperature\"", ",", "15.6", ",", "DEVIC...
[ 13, 0 ]
[ 34, 5 ]
python
en
['en', 'ca', 'en']
True
async_setup_entry
(hass, config_entry, async_add_entities)
Set up the Demo config entry.
Set up the Demo config entry.
async def async_setup_entry(hass, config_entry, async_add_entities): """Set up the Demo config entry.""" await async_setup_platform(hass, {}, async_add_entities)
[ "async", "def", "async_setup_entry", "(", "hass", ",", "config_entry", ",", "async_add_entities", ")", ":", "await", "async_setup_platform", "(", "hass", ",", "{", "}", ",", "async_add_entities", ")" ]
[ 37, 0 ]
[ 39, 60 ]
python
en
['en', 'en', 'en']
True
DemoSensor.__init__
( self, unique_id, name, state, device_class, unit_of_measurement, battery )
Initialize the sensor.
Initialize the sensor.
def __init__( self, unique_id, name, state, device_class, unit_of_measurement, battery ): """Initialize the sensor.""" self._unique_id = unique_id self._name = name self._state = state self._device_class = device_class self._unit_of_measurement = unit_of_measu...
[ "def", "__init__", "(", "self", ",", "unique_id", ",", "name", ",", "state", ",", "device_class", ",", "unit_of_measurement", ",", "battery", ")", ":", "self", ".", "_unique_id", "=", "unique_id", "self", ".", "_name", "=", "name", "self", ".", "_state", ...
[ 45, 4 ]
[ 54, 31 ]
python
en
['en', 'en', 'en']
True
DemoSensor.device_info
(self)
Return device info.
Return device info.
def device_info(self): """Return device info.""" return { "identifiers": { # Serial numbers are unique identifiers within a specific domain (DOMAIN, self.unique_id) }, "name": self.name, }
[ "def", "device_info", "(", "self", ")", ":", "return", "{", "\"identifiers\"", ":", "{", "# Serial numbers are unique identifiers within a specific domain", "(", "DOMAIN", ",", "self", ".", "unique_id", ")", "}", ",", "\"name\"", ":", "self", ".", "name", ",", "...
[ 57, 4 ]
[ 65, 9 ]
python
en
['es', 'hr', 'en']
False
DemoSensor.unique_id
(self)
Return the unique id.
Return the unique id.
def unique_id(self): """Return the unique id.""" return self._unique_id
[ "def", "unique_id", "(", "self", ")", ":", "return", "self", ".", "_unique_id" ]
[ 68, 4 ]
[ 70, 30 ]
python
en
['en', 'la', 'en']
True
DemoSensor.should_poll
(self)
No polling needed for a demo sensor.
No polling needed for a demo sensor.
def should_poll(self): """No polling needed for a demo sensor.""" return False
[ "def", "should_poll", "(", "self", ")", ":", "return", "False" ]
[ 73, 4 ]
[ 75, 20 ]
python
en
['en', 'pt', 'en']
True
DemoSensor.device_class
(self)
Return the device class of the sensor.
Return the device class of the sensor.
def device_class(self): """Return the device class of the sensor.""" return self._device_class
[ "def", "device_class", "(", "self", ")", ":", "return", "self", ".", "_device_class" ]
[ 78, 4 ]
[ 80, 33 ]
python
en
['en', 'en', 'en']
True
DemoSensor.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" ]
[ 83, 4 ]
[ 85, 25 ]
python
en
['en', 'mi', 'en']
True
DemoSensor.state
(self)
Return the state of the sensor.
Return the state of the sensor.
def state(self): """Return the state of the sensor.""" return self._state
[ "def", "state", "(", "self", ")", ":", "return", "self", ".", "_state" ]
[ 88, 4 ]
[ 90, 26 ]
python
en
['en', 'en', 'en']
True
DemoSensor.unit_of_measurement
(self)
Return the unit this state is expressed in.
Return the unit this state is expressed in.
def unit_of_measurement(self): """Return the unit this state is expressed in.""" return self._unit_of_measurement
[ "def", "unit_of_measurement", "(", "self", ")", ":", "return", "self", ".", "_unit_of_measurement" ]
[ 93, 4 ]
[ 95, 40 ]
python
en
['en', 'en', 'en']
True