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
DemoClimate.async_set_swing_mode
(self, swing_mode)
Set new swing mode.
Set new swing mode.
async def async_set_swing_mode(self, swing_mode): """Set new swing mode.""" self._current_swing_mode = swing_mode self.async_write_ha_state()
[ "async", "def", "async_set_swing_mode", "(", "self", ",", "swing_mode", ")", ":", "self", ".", "_current_swing_mode", "=", "swing_mode", "self", ".", "async_write_ha_state", "(", ")" ]
[ 288, 4 ]
[ 291, 35 ]
python
en
['en', 'no', 'en']
True
DemoClimate.async_set_fan_mode
(self, fan_mode)
Set new fan mode.
Set new fan mode.
async def async_set_fan_mode(self, fan_mode): """Set new fan mode.""" self._current_fan_mode = fan_mode self.async_write_ha_state()
[ "async", "def", "async_set_fan_mode", "(", "self", ",", "fan_mode", ")", ":", "self", ".", "_current_fan_mode", "=", "fan_mode", "self", ".", "async_write_ha_state", "(", ")" ]
[ 293, 4 ]
[ 296, 35 ]
python
en
['id', 'fy', 'en']
False
DemoClimate.async_set_hvac_mode
(self, hvac_mode)
Set new operation mode.
Set new operation mode.
async def async_set_hvac_mode(self, hvac_mode): """Set new operation mode.""" self._hvac_mode = hvac_mode self.async_write_ha_state()
[ "async", "def", "async_set_hvac_mode", "(", "self", ",", "hvac_mode", ")", ":", "self", ".", "_hvac_mode", "=", "hvac_mode", "self", ".", "async_write_ha_state", "(", ")" ]
[ 298, 4 ]
[ 301, 35 ]
python
en
['en', 'ny', 'en']
True
DemoClimate.async_set_preset_mode
(self, preset_mode)
Update preset_mode on.
Update preset_mode on.
async def async_set_preset_mode(self, preset_mode): """Update preset_mode on.""" self._preset = preset_mode self.async_write_ha_state()
[ "async", "def", "async_set_preset_mode", "(", "self", ",", "preset_mode", ")", ":", "self", ".", "_preset", "=", "preset_mode", "self", ".", "async_write_ha_state", "(", ")" ]
[ 303, 4 ]
[ 306, 35 ]
python
de
['de', 'nl', 'en']
False
DemoClimate.async_turn_aux_heat_on
(self)
Turn auxiliary heater on.
Turn auxiliary heater on.
async def async_turn_aux_heat_on(self): """Turn auxiliary heater on.""" self._aux = True self.async_write_ha_state()
[ "async", "def", "async_turn_aux_heat_on", "(", "self", ")", ":", "self", ".", "_aux", "=", "True", "self", ".", "async_write_ha_state", "(", ")" ]
[ 308, 4 ]
[ 311, 35 ]
python
en
['fr', 'fi', 'en']
False
DemoClimate.async_turn_aux_heat_off
(self)
Turn auxiliary heater off.
Turn auxiliary heater off.
async def async_turn_aux_heat_off(self): """Turn auxiliary heater off.""" self._aux = False self.async_write_ha_state()
[ "async", "def", "async_turn_aux_heat_off", "(", "self", ")", ":", "self", ".", "_aux", "=", "False", "self", ".", "async_write_ha_state", "(", ")" ]
[ 313, 4 ]
[ 316, 35 ]
python
en
['en', 'en', 'en']
True
ElgatoFlowHandler.async_step_user
( self, user_input: Optional[ConfigType] = None )
Handle a flow initiated by the user.
Handle a flow initiated by the user.
async def async_step_user( self, user_input: Optional[ConfigType] = None ) -> Dict[str, Any]: """Handle a flow initiated by the user.""" if user_input is None: return self._show_setup_form() try: info = await self._get_elgato_info( user_input[...
[ "async", "def", "async_step_user", "(", "self", ",", "user_input", ":", "Optional", "[", "ConfigType", "]", "=", "None", ")", "->", "Dict", "[", "str", ",", "Any", "]", ":", "if", "user_input", "is", "None", ":", "return", "self", ".", "_show_setup_form"...
[ 20, 4 ]
[ 45, 9 ]
python
en
['en', 'en', 'en']
True
ElgatoFlowHandler.async_step_zeroconf
( self, user_input: Optional[ConfigType] = None )
Handle zeroconf discovery.
Handle zeroconf discovery.
async def async_step_zeroconf( self, user_input: Optional[ConfigType] = None ) -> Dict[str, Any]: """Handle zeroconf discovery.""" if user_input is None: return self.async_abort(reason="cannot_connect") try: info = await self._get_elgato_info( ...
[ "async", "def", "async_step_zeroconf", "(", "self", ",", "user_input", ":", "Optional", "[", "ConfigType", "]", "=", "None", ")", "->", "Dict", "[", "str", ",", "Any", "]", ":", "if", "user_input", "is", "None", ":", "return", "self", ".", "async_abort",...
[ 47, 4 ]
[ 76, 42 ]
python
de
['de', 'sr', 'en']
False
ElgatoFlowHandler.async_step_zeroconf_confirm
( self, user_input: ConfigType = None )
Handle a flow initiated by zeroconf.
Handle a flow initiated by zeroconf.
async def async_step_zeroconf_confirm( self, user_input: ConfigType = None ) -> Dict[str, Any]: """Handle a flow initiated by zeroconf.""" if user_input is None: return self._show_confirm_dialog() try: info = await self._get_elgato_info( self....
[ "async", "def", "async_step_zeroconf_confirm", "(", "self", ",", "user_input", ":", "ConfigType", "=", "None", ")", "->", "Dict", "[", "str", ",", "Any", "]", ":", "if", "user_input", "is", "None", ":", "return", "self", ".", "_show_confirm_dialog", "(", "...
[ 79, 4 ]
[ 104, 9 ]
python
en
['en', 'en', 'en']
True
ElgatoFlowHandler._show_setup_form
(self, errors: Optional[Dict] = None)
Show the setup form to the user.
Show the setup form to the user.
def _show_setup_form(self, errors: Optional[Dict] = None) -> Dict[str, Any]: """Show the setup form to the user.""" return self.async_show_form( step_id="user", data_schema=vol.Schema( { vol.Required(CONF_HOST): str, vol.Opt...
[ "def", "_show_setup_form", "(", "self", ",", "errors", ":", "Optional", "[", "Dict", "]", "=", "None", ")", "->", "Dict", "[", "str", ",", "Any", "]", ":", "return", "self", ".", "async_show_form", "(", "step_id", "=", "\"user\"", ",", "data_schema", "...
[ 106, 4 ]
[ 117, 9 ]
python
en
['en', 'en', 'en']
True
ElgatoFlowHandler._show_confirm_dialog
(self)
Show the confirm dialog to the user.
Show the confirm dialog to the user.
def _show_confirm_dialog(self) -> Dict[str, Any]: """Show the confirm dialog to the user.""" # pylint: disable=no-member # https://github.com/PyCQA/pylint/issues/3167 serial_number = self.context.get(CONF_SERIAL_NUMBER) return self.async_show_form( step_id="zeroconf_confirm",...
[ "def", "_show_confirm_dialog", "(", "self", ")", "->", "Dict", "[", "str", ",", "Any", "]", ":", "# pylint: disable=no-member # https://github.com/PyCQA/pylint/issues/3167", "serial_number", "=", "self", ".", "context", ".", "get", "(", "CONF_SERIAL_NUMBER", ")", "ret...
[ 119, 4 ]
[ 126, 9 ]
python
en
['en', 'en', 'en']
True
ElgatoFlowHandler._get_elgato_info
(self, host: str, port: int)
Get device information from an Elgato Key Light device.
Get device information from an Elgato Key Light device.
async def _get_elgato_info(self, host: str, port: int) -> Info: """Get device information from an Elgato Key Light device.""" session = async_get_clientsession(self.hass) elgato = Elgato( host, port=port, session=session, ) return await elgato....
[ "async", "def", "_get_elgato_info", "(", "self", ",", "host", ":", "str", ",", "port", ":", "int", ")", "->", "Info", ":", "session", "=", "async_get_clientsession", "(", "self", ".", "hass", ")", "elgato", "=", "Elgato", "(", "host", ",", "port", "=",...
[ 128, 4 ]
[ 136, 34 ]
python
en
['en', 'en', 'en']
True
setup_platform
(hass, config, add_entities, discovery_info=None)
Set up the IOTA sensor.
Set up the IOTA sensor.
def setup_platform(hass, config, add_entities, discovery_info=None): """Set up the IOTA sensor.""" iota_config = discovery_info sensors = [ IotaBalanceSensor(wallet, iota_config) for wallet in iota_config[CONF_WALLETS] ] sensors.append(IotaNodeSensor(iota_config=iota_config)) add_entit...
[ "def", "setup_platform", "(", "hass", ",", "config", ",", "add_entities", ",", "discovery_info", "=", "None", ")", ":", "iota_config", "=", "discovery_info", "sensors", "=", "[", "IotaBalanceSensor", "(", "wallet", ",", "iota_config", ")", "for", "wallet", "in...
[ 17, 0 ]
[ 26, 25 ]
python
en
['en', 'bs', 'en']
True
IotaBalanceSensor.__init__
(self, wallet_config, iota_config)
Initialize the sensor.
Initialize the sensor.
def __init__(self, wallet_config, iota_config): """Initialize the sensor.""" super().__init__( name=wallet_config[CONF_NAME], seed=wallet_config[CONF_SEED], iri=iota_config[CONF_IRI], is_testnet=iota_config[CONF_TESTNET], ) self._state = No...
[ "def", "__init__", "(", "self", ",", "wallet_config", ",", "iota_config", ")", ":", "super", "(", ")", ".", "__init__", "(", "name", "=", "wallet_config", "[", "CONF_NAME", "]", ",", "seed", "=", "wallet_config", "[", "CONF_SEED", "]", ",", "iri", "=", ...
[ 32, 4 ]
[ 40, 26 ]
python
en
['en', 'en', 'en']
True
IotaBalanceSensor.name
(self)
Return the name of the sensor.
Return the name of the sensor.
def name(self): """Return the name of the sensor.""" return f"{self._name} Balance"
[ "def", "name", "(", "self", ")", ":", "return", "f\"{self._name} Balance\"" ]
[ 43, 4 ]
[ 45, 38 ]
python
en
['en', 'mi', 'en']
True
IotaBalanceSensor.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" ]
[ 48, 4 ]
[ 50, 26 ]
python
en
['en', 'en', 'en']
True
IotaBalanceSensor.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 "IOTA"
[ "def", "unit_of_measurement", "(", "self", ")", ":", "return", "\"IOTA\"" ]
[ 53, 4 ]
[ 55, 21 ]
python
en
['en', 'la', 'en']
True
IotaBalanceSensor.update
(self)
Fetch new balance from IRI.
Fetch new balance from IRI.
def update(self): """Fetch new balance from IRI.""" self._state = self.api.get_inputs()["totalBalance"]
[ "def", "update", "(", "self", ")", ":", "self", ".", "_state", "=", "self", ".", "api", ".", "get_inputs", "(", ")", "[", "\"totalBalance\"", "]" ]
[ 57, 4 ]
[ 59, 59 ]
python
en
['en', 'ny', 'en']
True
IotaNodeSensor.__init__
(self, iota_config)
Initialize the sensor.
Initialize the sensor.
def __init__(self, iota_config): """Initialize the sensor.""" super().__init__( name="Node Info", seed=None, iri=iota_config[CONF_IRI], is_testnet=iota_config[CONF_TESTNET], ) self._state = None self._attr = {ATTR_URL: self.iri, ATT...
[ "def", "__init__", "(", "self", ",", "iota_config", ")", ":", "super", "(", ")", ".", "__init__", "(", "name", "=", "\"Node Info\"", ",", "seed", "=", "None", ",", "iri", "=", "iota_config", "[", "CONF_IRI", "]", ",", "is_testnet", "=", "iota_config", ...
[ 65, 4 ]
[ 74, 72 ]
python
en
['en', 'en', 'en']
True
IotaNodeSensor.name
(self)
Return the name of the sensor.
Return the name of the sensor.
def name(self): """Return the name of the sensor.""" return "IOTA Node"
[ "def", "name", "(", "self", ")", ":", "return", "\"IOTA Node\"" ]
[ 77, 4 ]
[ 79, 26 ]
python
en
['en', 'mi', 'en']
True
IotaNodeSensor.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" ]
[ 82, 4 ]
[ 84, 26 ]
python
en
['en', 'en', 'en']
True
IotaNodeSensor.device_state_attributes
(self)
Return the state attributes of the device.
Return the state attributes of the device.
def device_state_attributes(self): """Return the state attributes of the device.""" return self._attr
[ "def", "device_state_attributes", "(", "self", ")", ":", "return", "self", ".", "_attr" ]
[ 87, 4 ]
[ 89, 25 ]
python
en
['en', 'en', 'en']
True
IotaNodeSensor.update
(self)
Fetch new attributes IRI node.
Fetch new attributes IRI node.
def update(self): """Fetch new attributes IRI node.""" node_info = self.api.get_node_info() self._state = node_info.get("appVersion") # convert values to raw string formats self._attr.update({k: str(v) for k, v in node_info.items()})
[ "def", "update", "(", "self", ")", ":", "node_info", "=", "self", ".", "api", ".", "get_node_info", "(", ")", "self", ".", "_state", "=", "node_info", ".", "get", "(", "\"appVersion\"", ")", "# convert values to raw string formats", "self", ".", "_attr", "."...
[ 91, 4 ]
[ 97, 68 ]
python
en
['en', 'co', 'en']
True
get_departuresMock
(_stop_id, route, destination, api_key)
Mock TransportNSW departures loading.
Mock TransportNSW departures loading.
def get_departuresMock(_stop_id, route, destination, api_key): """Mock TransportNSW departures loading.""" data = { "stop_id": "209516", "route": "199", "due": 16, "delay": 6, "real_time": "y", "destination": "Palm Beach", "mode": "Bus", } return d...
[ "def", "get_departuresMock", "(", "_stop_id", ",", "route", ",", "destination", ",", "api_key", ")", ":", "data", "=", "{", "\"stop_id\"", ":", "\"209516\"", ",", "\"route\"", ":", "\"199\"", ",", "\"due\"", ":", "16", ",", "\"delay\"", ":", "6", ",", "\...
[ 16, 0 ]
[ 27, 15 ]
python
da
['fr', 'da', 'en']
False
test_transportnsw_config
(mocked_get_departures, hass)
Test minimal TransportNSW configuration.
Test minimal TransportNSW configuration.
async def test_transportnsw_config(mocked_get_departures, hass): """Test minimal TransportNSW configuration.""" assert await async_setup_component(hass, "sensor", VALID_CONFIG) await hass.async_block_till_done() state = hass.states.get("sensor.next_bus") assert state.state == "16" assert state.a...
[ "async", "def", "test_transportnsw_config", "(", "mocked_get_departures", ",", "hass", ")", ":", "assert", "await", "async_setup_component", "(", "hass", ",", "\"sensor\"", ",", "VALID_CONFIG", ")", "await", "hass", ".", "async_block_till_done", "(", ")", "state", ...
[ 31, 0 ]
[ 42, 44 ]
python
en
['en', 'zu', 'en']
True
Talk2Car.__init__
(self, image_set, root_path, data_path, boxes='gt', proposal_source='official', transform=None, test_mode=False, zip_mode=False, cache_mode=False, cache_db=False, ignore_db_cache=True, tokenizer=None, pretrained_model_name=None, add_image_as_a_box=Fals...
Talk2Car+ Dataset :param image_set: image folder name :param root_path: root path to cache database loaded from annotation file :param data_path: path to dataset :param boxes: boxes to use, 'gt' or 'proposal' :param transform: transform :param test_mode: test mo...
Talk2Car+ Dataset
def __init__(self, image_set, root_path, data_path, boxes='gt', proposal_source='official', transform=None, test_mode=False, zip_mode=False, cache_mode=False, cache_db=False, ignore_db_cache=True, tokenizer=None, pretrained_model_name=None, add_image_a...
[ "def", "__init__", "(", "self", ",", "image_set", ",", "root_path", ",", "data_path", ",", "boxes", "=", "'gt'", ",", "proposal_source", "=", "'official'", ",", "transform", "=", "None", ",", "test_mode", "=", "False", ",", "zip_mode", "=", "False", ",", ...
[ 23, 4 ]
[ 127, 61 ]
python
en
['en', 'error', 'th']
False
create_valid_feature_mock
(path="homeassistant.components.blebox.Products")
Return a valid, complete BleBox feature mock.
Return a valid, complete BleBox feature mock.
def create_valid_feature_mock(path="homeassistant.components.blebox.Products"): """Return a valid, complete BleBox feature mock.""" feature = mock_only_feature( blebox_uniapi.cover.Cover, unique_id="BleBox-gateBox-1afe34db9437-0.position", full_name="gateBox-0.position", device_c...
[ "def", "create_valid_feature_mock", "(", "path", "=", "\"homeassistant.components.blebox.Products\"", ")", ":", "feature", "=", "mock_only_feature", "(", "blebox_uniapi", ".", "cover", ".", "Cover", ",", "unique_id", "=", "\"BleBox-gateBox-1afe34db9437-0.position\"", ",", ...
[ 14, 0 ]
[ 35, 18 ]
python
en
['en', 'en', 'en']
True
valid_feature_mock_fixture
()
Return a valid, complete BleBox feature mock.
Return a valid, complete BleBox feature mock.
def valid_feature_mock_fixture(): """Return a valid, complete BleBox feature mock.""" return create_valid_feature_mock()
[ "def", "valid_feature_mock_fixture", "(", ")", ":", "return", "create_valid_feature_mock", "(", ")" ]
[ 39, 0 ]
[ 41, 38 ]
python
en
['en', 'en', 'en']
True
flow_feature_mock_fixture
()
Return a mocked user flow feature.
Return a mocked user flow feature.
def flow_feature_mock_fixture(): """Return a mocked user flow feature.""" return create_valid_feature_mock( "homeassistant.components.blebox.config_flow.Products" )
[ "def", "flow_feature_mock_fixture", "(", ")", ":", "return", "create_valid_feature_mock", "(", "\"homeassistant.components.blebox.config_flow.Products\"", ")" ]
[ 45, 0 ]
[ 49, 5 ]
python
en
['en', 'en', 'en']
True
test_flow_works
(hass, valid_feature_mock, flow_feature_mock)
Test that config flow works.
Test that config flow works.
async def test_flow_works(hass, valid_feature_mock, flow_feature_mock): """Test that config flow works.""" result = await hass.config_entries.flow.async_init( config_flow.DOMAIN, context={"source": config_entries.SOURCE_USER} ) assert result["type"] == "form" assert result["step_id"] == "u...
[ "async", "def", "test_flow_works", "(", "hass", ",", "valid_feature_mock", ",", "flow_feature_mock", ")", ":", "result", "=", "await", "hass", ".", "config_entries", ".", "flow", ".", "async_init", "(", "config_flow", ".", "DOMAIN", ",", "context", "=", "{", ...
[ 52, 0 ]
[ 73, 5 ]
python
en
['en', 'en', 'en']
True
product_class_mock_fixture
()
Return a mocked feature.
Return a mocked feature.
def product_class_mock_fixture(): """Return a mocked feature.""" path = "homeassistant.components.blebox.config_flow.Products" patcher = patch(path, DEFAULT, blebox_uniapi.products.Products, True, True) yield patcher
[ "def", "product_class_mock_fixture", "(", ")", ":", "path", "=", "\"homeassistant.components.blebox.config_flow.Products\"", "patcher", "=", "patch", "(", "path", ",", "DEFAULT", ",", "blebox_uniapi", ".", "products", ".", "Products", ",", "True", ",", "True", ")", ...
[ 77, 0 ]
[ 81, 17 ]
python
en
['en', 'en', 'en']
True
test_flow_with_connection_failure
(hass, product_class_mock)
Test that config flow works.
Test that config flow works.
async def test_flow_with_connection_failure(hass, product_class_mock): """Test that config flow works.""" with product_class_mock as products_class: products_class.async_from_host = AsyncMock( side_effect=blebox_uniapi.error.ConnectionError ) result = await hass.config_entri...
[ "async", "def", "test_flow_with_connection_failure", "(", "hass", ",", "product_class_mock", ")", ":", "with", "product_class_mock", "as", "products_class", ":", "products_class", ".", "async_from_host", "=", "AsyncMock", "(", "side_effect", "=", "blebox_uniapi", ".", ...
[ 84, 0 ]
[ 96, 61 ]
python
en
['en', 'en', 'en']
True
test_flow_with_api_failure
(hass, product_class_mock)
Test that config flow works.
Test that config flow works.
async def test_flow_with_api_failure(hass, product_class_mock): """Test that config flow works.""" with product_class_mock as products_class: products_class.async_from_host = AsyncMock( side_effect=blebox_uniapi.error.Error ) result = await hass.config_entries.flow.async_ini...
[ "async", "def", "test_flow_with_api_failure", "(", "hass", ",", "product_class_mock", ")", ":", "with", "product_class_mock", "as", "products_class", ":", "products_class", ".", "async_from_host", "=", "AsyncMock", "(", "side_effect", "=", "blebox_uniapi", ".", "error...
[ 99, 0 ]
[ 111, 61 ]
python
en
['en', 'en', 'en']
True
test_flow_with_unknown_failure
(hass, product_class_mock)
Test that config flow works.
Test that config flow works.
async def test_flow_with_unknown_failure(hass, product_class_mock): """Test that config flow works.""" with product_class_mock as products_class: products_class.async_from_host = AsyncMock(side_effect=RuntimeError) result = await hass.config_entries.flow.async_init( config_flow.DOMAI...
[ "async", "def", "test_flow_with_unknown_failure", "(", "hass", ",", "product_class_mock", ")", ":", "with", "product_class_mock", "as", "products_class", ":", "products_class", ".", "async_from_host", "=", "AsyncMock", "(", "side_effect", "=", "RuntimeError", ")", "re...
[ 114, 0 ]
[ 123, 54 ]
python
en
['en', 'en', 'en']
True
test_flow_with_unsupported_version
(hass, product_class_mock)
Test that config flow works.
Test that config flow works.
async def test_flow_with_unsupported_version(hass, product_class_mock): """Test that config flow works.""" with product_class_mock as products_class: products_class.async_from_host = AsyncMock( side_effect=blebox_uniapi.error.UnsupportedBoxVersion ) result = await hass.confi...
[ "async", "def", "test_flow_with_unsupported_version", "(", "hass", ",", "product_class_mock", ")", ":", "with", "product_class_mock", "as", "products_class", ":", "products_class", ".", "async_from_host", "=", "AsyncMock", "(", "side_effect", "=", "blebox_uniapi", ".", ...
[ 126, 0 ]
[ 138, 66 ]
python
en
['en', 'en', 'en']
True
test_async_setup
(hass)
Test async_setup (for coverage).
Test async_setup (for coverage).
async def test_async_setup(hass): """Test async_setup (for coverage).""" assert await async_setup_component(hass, "blebox", {"host": "172.2.3.4"}) await hass.async_block_till_done()
[ "async", "def", "test_async_setup", "(", "hass", ")", ":", "assert", "await", "async_setup_component", "(", "hass", ",", "\"blebox\"", ",", "{", "\"host\"", ":", "\"172.2.3.4\"", "}", ")", "await", "hass", ".", "async_block_till_done", "(", ")" ]
[ 141, 0 ]
[ 144, 38 ]
python
en
['en', 'en', 'en']
True
test_already_configured
(hass, valid_feature_mock)
Test that same device cannot be added twice.
Test that same device cannot be added twice.
async def test_already_configured(hass, valid_feature_mock): """Test that same device cannot be added twice.""" config = mock_config("172.2.3.4") config.add_to_hass(hass) await hass.config_entries.async_setup(config.entry_id) await hass.async_block_till_done() result = await hass.config_entri...
[ "async", "def", "test_already_configured", "(", "hass", ",", "valid_feature_mock", ")", ":", "config", "=", "mock_config", "(", "\"172.2.3.4\"", ")", "config", ".", "add_to_hass", "(", "hass", ")", "await", "hass", ".", "config_entries", ".", "async_setup", "(",...
[ 147, 0 ]
[ 162, 59 ]
python
en
['en', 'en', 'en']
True
test_async_setup_entry
(hass, valid_feature_mock)
Test async_setup_entry (for coverage).
Test async_setup_entry (for coverage).
async def test_async_setup_entry(hass, valid_feature_mock): """Test async_setup_entry (for coverage).""" config = mock_config() config.add_to_hass(hass) assert await hass.config_entries.async_setup(config.entry_id) await hass.async_block_till_done() assert hass.config_entries.async_entries() ...
[ "async", "def", "test_async_setup_entry", "(", "hass", ",", "valid_feature_mock", ")", ":", "config", "=", "mock_config", "(", ")", "config", ".", "add_to_hass", "(", "hass", ")", "assert", "await", "hass", ".", "config_entries", ".", "async_setup", "(", "conf...
[ 165, 0 ]
[ 175, 60 ]
python
en
['en', 'en', 'en']
True
test_async_remove_entry
(hass, valid_feature_mock)
Test async_setup_entry (for coverage).
Test async_setup_entry (for coverage).
async def test_async_remove_entry(hass, valid_feature_mock): """Test async_setup_entry (for coverage).""" config = mock_config() config.add_to_hass(hass) assert await hass.config_entries.async_setup(config.entry_id) await hass.async_block_till_done() assert await hass.config_entries.async_rem...
[ "async", "def", "test_async_remove_entry", "(", "hass", ",", "valid_feature_mock", ")", ":", "config", "=", "mock_config", "(", ")", "config", ".", "add_to_hass", "(", "hass", ")", "assert", "await", "hass", ".", "config_entries", ".", "async_setup", "(", "con...
[ 178, 0 ]
[ 191, 64 ]
python
en
['en', 'en', 'en']
True
test_adam_climate_sensor_entities
(hass, mock_smile_adam)
Test creation of climate related sensor entities.
Test creation of climate related sensor entities.
async def test_adam_climate_sensor_entities(hass, mock_smile_adam): """Test creation of climate related sensor entities.""" entry = await async_init_integration(hass, mock_smile_adam) assert entry.state == ENTRY_STATE_LOADED state = hass.states.get("sensor.adam_outdoor_temperature") assert float(st...
[ "async", "def", "test_adam_climate_sensor_entities", "(", "hass", ",", "mock_smile_adam", ")", ":", "entry", "=", "await", "async_init_integration", "(", "hass", ",", "mock_smile_adam", ")", "assert", "entry", ".", "state", "==", "ENTRY_STATE_LOADED", "state", "=", ...
[ 8, 0 ]
[ 30, 33 ]
python
en
['en', 'en', 'en']
True
test_anna_as_smt_climate_sensor_entities
(hass, mock_smile_anna)
Test creation of climate related sensor entities.
Test creation of climate related sensor entities.
async def test_anna_as_smt_climate_sensor_entities(hass, mock_smile_anna): """Test creation of climate related sensor entities.""" entry = await async_init_integration(hass, mock_smile_anna) assert entry.state == ENTRY_STATE_LOADED state = hass.states.get("sensor.auxiliary_outdoor_temperature") ass...
[ "async", "def", "test_anna_as_smt_climate_sensor_entities", "(", "hass", ",", "mock_smile_anna", ")", ":", "entry", "=", "await", "async_init_integration", "(", "hass", ",", "mock_smile_anna", ")", "assert", "entry", ".", "state", "==", "ENTRY_STATE_LOADED", "state", ...
[ 33, 0 ]
[ 45, 37 ]
python
en
['en', 'en', 'en']
True
test_anna_climate_sensor_entities
(hass, mock_smile_anna)
Test creation of climate related sensor entities as single master thermostat.
Test creation of climate related sensor entities as single master thermostat.
async def test_anna_climate_sensor_entities(hass, mock_smile_anna): """Test creation of climate related sensor entities as single master thermostat.""" mock_smile_anna.single_master_thermostat.side_effect = Mock(return_value=False) entry = await async_init_integration(hass, mock_smile_anna) assert entry...
[ "async", "def", "test_anna_climate_sensor_entities", "(", "hass", ",", "mock_smile_anna", ")", ":", "mock_smile_anna", ".", "single_master_thermostat", ".", "side_effect", "=", "Mock", "(", "return_value", "=", "False", ")", "entry", "=", "await", "async_init_integrat...
[ 48, 0 ]
[ 55, 37 ]
python
en
['en', 'en', 'en']
True
test_p1_dsmr_sensor_entities
(hass, mock_smile_p1)
Test creation of power related sensor entities.
Test creation of power related sensor entities.
async def test_p1_dsmr_sensor_entities(hass, mock_smile_p1): """Test creation of power related sensor entities.""" entry = await async_init_integration(hass, mock_smile_p1) assert entry.state == ENTRY_STATE_LOADED state = hass.states.get("sensor.p1_net_electricity_point") assert float(state.state) ...
[ "async", "def", "test_p1_dsmr_sensor_entities", "(", "hass", ",", "mock_smile_p1", ")", ":", "entry", "=", "await", "async_init_integration", "(", "hass", ",", "mock_smile_p1", ")", "assert", "entry", ".", "state", "==", "ENTRY_STATE_LOADED", "state", "=", "hass",...
[ 58, 0 ]
[ 76, 39 ]
python
en
['en', 'en', 'en']
True
test_stretch_sensor_entities
(hass, mock_stretch)
Test creation of power related sensor entities.
Test creation of power related sensor entities.
async def test_stretch_sensor_entities(hass, mock_stretch): """Test creation of power related sensor entities.""" entry = await async_init_integration(hass, mock_stretch) assert entry.state == ENTRY_STATE_LOADED state = hass.states.get("sensor.koelkast_92c4a_electricity_consumed") assert float(stat...
[ "async", "def", "test_stretch_sensor_entities", "(", "hass", ",", "mock_stretch", ")", ":", "entry", "=", "await", "async_init_integration", "(", "hass", ",", "mock_stretch", ")", "assert", "entry", ".", "state", "==", "ENTRY_STATE_LOADED", "state", "=", "hass", ...
[ 79, 0 ]
[ 88, 37 ]
python
en
['en', 'en', 'en']
True
UniFiBase.__init__
(self, item, controller)
Set up UniFi entity base. Register mac to controller entities to cover disabled entities.
Set up UniFi entity base.
def __init__(self, item, controller) -> None: """Set up UniFi entity base. Register mac to controller entities to cover disabled entities. """ self._item = item self.controller = controller self.controller.entities[self.DOMAIN][self.TYPE].add(self.key)
[ "def", "__init__", "(", "self", ",", "item", ",", "controller", ")", "->", "None", ":", "self", ".", "_item", "=", "item", "self", ".", "controller", "=", "controller", "self", ".", "controller", ".", "entities", "[", "self", ".", "DOMAIN", "]", "[", ...
[ 18, 4 ]
[ 25, 70 ]
python
en
['en', 'zu', 'en']
True
UniFiBase.key
(self)
Return item key.
Return item key.
def key(self) -> Any: """Return item key.""" return self._item.mac
[ "def", "key", "(", "self", ")", "->", "Any", ":", "return", "self", ".", "_item", ".", "mac" ]
[ 28, 4 ]
[ 30, 29 ]
python
en
['en', 'hi-Latn', 'en']
True
UniFiBase.async_added_to_hass
(self)
Entity created.
Entity created.
async def async_added_to_hass(self) -> None: """Entity created.""" _LOGGER.debug( "New %s entity %s (%s)", self.TYPE, self.entity_id, self.key, ) for signal, method in ( (self.controller.signal_reachable, self.async_update_callb...
[ "async", "def", "async_added_to_hass", "(", "self", ")", "->", "None", ":", "_LOGGER", ".", "debug", "(", "\"New %s entity %s (%s)\"", ",", "self", ".", "TYPE", ",", "self", ".", "entity_id", ",", "self", ".", "key", ",", ")", "for", "signal", ",", "meth...
[ 32, 4 ]
[ 46, 64 ]
python
en
['en', 'sm', 'en']
False
UniFiBase.async_will_remove_from_hass
(self)
Disconnect object when removed.
Disconnect object when removed.
async def async_will_remove_from_hass(self) -> None: """Disconnect object when removed.""" _LOGGER.debug( "Removing %s entity %s (%s)", self.TYPE, self.entity_id, self.key, ) self._item.remove_callback(self.async_update_callback) se...
[ "async", "def", "async_will_remove_from_hass", "(", "self", ")", "->", "None", ":", "_LOGGER", ".", "debug", "(", "\"Removing %s entity %s (%s)\"", ",", "self", ".", "TYPE", ",", "self", ".", "entity_id", ",", "self", ".", "key", ",", ")", "self", ".", "_i...
[ 48, 4 ]
[ 57, 73 ]
python
en
['en', 'en', 'en']
True
UniFiBase.async_update_callback
(self)
Update the entity's state.
Update the entity's state.
def async_update_callback(self) -> None: """Update the entity's state.""" _LOGGER.debug( "Updating %s entity %s (%s)", self.TYPE, self.entity_id, self.key, ) self.async_write_ha_state()
[ "def", "async_update_callback", "(", "self", ")", "->", "None", ":", "_LOGGER", ".", "debug", "(", "\"Updating %s entity %s (%s)\"", ",", "self", ".", "TYPE", ",", "self", ".", "entity_id", ",", "self", ".", "key", ",", ")", "self", ".", "async_write_ha_stat...
[ 60, 4 ]
[ 68, 35 ]
python
en
['en', 'en', 'en']
True
UniFiBase.options_updated
(self)
Config entry options are updated, remove entity if option is disabled.
Config entry options are updated, remove entity if option is disabled.
async def options_updated(self) -> None: """Config entry options are updated, remove entity if option is disabled.""" raise NotImplementedError
[ "async", "def", "options_updated", "(", "self", ")", "->", "None", ":", "raise", "NotImplementedError" ]
[ 70, 4 ]
[ 72, 33 ]
python
en
['en', 'en', 'en']
True
UniFiBase.remove_item
(self, keys: set)
Remove entity if key is part of set. Remove entity if no entry in entity registry exist. Remove entity registry entry if no entry in device registry exist. Remove device registry entry if there is only one linked entity (this entity). Remove entity registry entry if there are more than ...
Remove entity if key is part of set.
async def remove_item(self, keys: set) -> None: """Remove entity if key is part of set. Remove entity if no entry in entity registry exist. Remove entity registry entry if no entry in device registry exist. Remove device registry entry if there is only one linked entity (this entity). ...
[ "async", "def", "remove_item", "(", "self", ",", "keys", ":", "set", ")", "->", "None", ":", "if", "self", ".", "key", "not", "in", "keys", ":", "return", "entity_registry", "=", "await", "self", ".", "hass", ".", "helpers", ".", "entity_registry", "."...
[ 74, 4 ]
[ 101, 52 ]
python
en
['en', 'en', 'en']
True
UniFiBase.should_poll
(self)
No polling needed.
No polling needed.
def should_poll(self) -> bool: """No polling needed.""" return False
[ "def", "should_poll", "(", "self", ")", "->", "bool", ":", "return", "False" ]
[ 104, 4 ]
[ 106, 20 ]
python
en
['en', 'en', 'en']
True
setup_platform
(hass, config, add_entities, discovery_info=None)
Set up the LiteJet switch platform.
Set up the LiteJet switch platform.
def setup_platform(hass, config, add_entities, discovery_info=None): """Set up the LiteJet switch platform.""" litejet_ = hass.data["litejet_system"] devices = [] for i in litejet_.button_switches(): name = litejet_.get_switch_name(i) if not litejet.is_ignored(hass, name): d...
[ "def", "setup_platform", "(", "hass", ",", "config", ",", "add_entities", ",", "discovery_info", "=", "None", ")", ":", "litejet_", "=", "hass", ".", "data", "[", "\"litejet_system\"", "]", "devices", "=", "[", "]", "for", "i", "in", "litejet_", ".", "bu...
[ 11, 0 ]
[ 20, 31 ]
python
en
['en', 'da', 'en']
True
LiteJetSwitch.__init__
(self, hass, lj, i, name)
Initialize a LiteJet switch.
Initialize a LiteJet switch.
def __init__(self, hass, lj, i, name): """Initialize a LiteJet switch.""" self._hass = hass self._lj = lj self._index = i self._state = False self._name = name lj.on_switch_pressed(i, self._on_switch_pressed) lj.on_switch_released(i, self._on_switch_relea...
[ "def", "__init__", "(", "self", ",", "hass", ",", "lj", ",", "i", ",", "name", ")", ":", "self", ".", "_hass", "=", "hass", "self", ".", "_lj", "=", "lj", "self", ".", "_index", "=", "i", "self", ".", "_state", "=", "False", "self", ".", "_name...
[ 26, 4 ]
[ 35, 58 ]
python
en
['en', 'pl', 'en']
True
LiteJetSwitch.name
(self)
Return the name of the switch.
Return the name of the switch.
def name(self): """Return the name of the switch.""" return self._name
[ "def", "name", "(", "self", ")", ":", "return", "self", ".", "_name" ]
[ 48, 4 ]
[ 50, 25 ]
python
en
['en', 'en', 'en']
True
LiteJetSwitch.is_on
(self)
Return if the switch is pressed.
Return if the switch is pressed.
def is_on(self): """Return if the switch is pressed.""" return self._state
[ "def", "is_on", "(", "self", ")", ":", "return", "self", ".", "_state" ]
[ 53, 4 ]
[ 55, 26 ]
python
en
['en', 'en', 'en']
True
LiteJetSwitch.should_poll
(self)
Return that polling is not necessary.
Return that polling is not necessary.
def should_poll(self): """Return that polling is not necessary.""" return False
[ "def", "should_poll", "(", "self", ")", ":", "return", "False" ]
[ 58, 4 ]
[ 60, 20 ]
python
en
['en', 'en', 'en']
True
LiteJetSwitch.device_state_attributes
(self)
Return the device-specific state attributes.
Return the device-specific state attributes.
def device_state_attributes(self): """Return the device-specific state attributes.""" return {ATTR_NUMBER: self._index}
[ "def", "device_state_attributes", "(", "self", ")", ":", "return", "{", "ATTR_NUMBER", ":", "self", ".", "_index", "}" ]
[ 63, 4 ]
[ 65, 41 ]
python
en
['en', 'en', 'en']
True
LiteJetSwitch.turn_on
(self, **kwargs)
Press the switch.
Press the switch.
def turn_on(self, **kwargs): """Press the switch.""" self._lj.press_switch(self._index)
[ "def", "turn_on", "(", "self", ",", "*", "*", "kwargs", ")", ":", "self", ".", "_lj", ".", "press_switch", "(", "self", ".", "_index", ")" ]
[ 67, 4 ]
[ 69, 42 ]
python
en
['en', 'en', 'en']
True
LiteJetSwitch.turn_off
(self, **kwargs)
Release the switch.
Release the switch.
def turn_off(self, **kwargs): """Release the switch.""" self._lj.release_switch(self._index)
[ "def", "turn_off", "(", "self", ",", "*", "*", "kwargs", ")", ":", "self", ".", "_lj", ".", "release_switch", "(", "self", ".", "_index", ")" ]
[ 71, 4 ]
[ 73, 44 ]
python
en
['en', 'en', 'en']
True
problem2_4
()
Make a list of 10 random reals between 30 and 35
Make a list of 10 random reals between 30 and 35
def problem2_4(): """ Make a list of 10 random reals between 30 and 35 """ random.seed(70) my_list = [] for i in range(10): my_list.append(random.random()*5+30) print(my_list)
[ "def", "problem2_4", "(", ")", ":", "random", ".", "seed", "(", "70", ")", "my_list", "=", "[", "]", "for", "i", "in", "range", "(", "10", ")", ":", "my_list", ".", "append", "(", "random", ".", "random", "(", ")", "*", "5", "+", "30", ")", "...
[ 14, 0 ]
[ 20, 18 ]
python
en
['en', 'ca', 'en']
True
chemkin_to_raw
(path_csv, path_npz, soln)
convert Chemkin output file (.csv) to raw file (.npz)
convert Chemkin output file (.csv) to raw file (.npz)
def chemkin_to_raw(path_csv, path_npz, soln): """ convert Chemkin output file (.csv) to raw file (.npz) """ df = pd.read_csv(path_csv, delimiter=',') basics = { "Distance (cm)": ("axis0", 0.01), "Net_heat_production_from_gas-phase_reactions (erg/cm3-sec)": ("heat_release_rate", 0.1), "Pressure (atm)": ("press...
[ "def", "chemkin_to_raw", "(", "path_csv", ",", "path_npz", ",", "soln", ")", ":", "df", "=", "pd", ".", "read_csv", "(", "path_csv", ",", "delimiter", "=", "','", ")", "basics", "=", "{", "\"Distance (cm)\"", ":", "(", "\"axis0\"", ",", "0.01", ")", ",...
[ 18, 0 ]
[ 54, 26 ]
python
en
['en', 'ny', 'it']
False
async_setup_entry
(hass, config_entry, async_add_entities)
Set up Z-Wave Climate from Config Entry.
Set up Z-Wave Climate from Config Entry.
async def async_setup_entry(hass, config_entry, async_add_entities): """Set up Z-Wave Climate from Config Entry.""" @callback def async_add_climate(values): """Add Z-Wave Climate.""" async_add_entities([ZWaveClimateEntity(values)]) hass.data[DOMAIN][config_entry.entry_id][DATA_UNSUBSCR...
[ "async", "def", "async_setup_entry", "(", "hass", ",", "config_entry", ",", "async_add_entities", ")", ":", "@", "callback", "def", "async_add_climate", "(", "values", ")", ":", "\"\"\"Add Z-Wave Climate.\"\"\"", "async_add_entities", "(", "[", "ZWaveClimateEntity", "...
[ 141, 0 ]
[ 153, 5 ]
python
en
['en', 'en', 'en']
True
_get_list_id
(value_lst, value_lbl)
Return the id for the value in the list.
Return the id for the value in the list.
def _get_list_id(value_lst, value_lbl): """Return the id for the value in the list.""" return next( (val[VALUE_ID] for val in value_lst if val[VALUE_LABEL] == value_lbl), None )
[ "def", "_get_list_id", "(", "value_lst", ",", "value_lbl", ")", ":", "return", "next", "(", "(", "val", "[", "VALUE_ID", "]", "for", "val", "in", "value_lst", "if", "val", "[", "VALUE_LABEL", "]", "==", "value_lbl", ")", ",", "None", ")" ]
[ 370, 0 ]
[ 374, 5 ]
python
en
['en', 'en', 'en']
True
ZWaveClimateEntity.__init__
(self, values)
Initialize the entity.
Initialize the entity.
def __init__(self, values): """Initialize the entity.""" super().__init__(values) self._hvac_modes = {} self._hvac_presets = {} self.on_value_update()
[ "def", "__init__", "(", "self", ",", "values", ")", ":", "super", "(", ")", ".", "__init__", "(", "values", ")", "self", ".", "_hvac_modes", "=", "{", "}", "self", ".", "_hvac_presets", "=", "{", "}", "self", ".", "on_value_update", "(", ")" ]
[ 159, 4 ]
[ 164, 30 ]
python
en
['en', 'en', 'en']
True
ZWaveClimateEntity.on_value_update
(self)
Call when the underlying values object changes.
Call when the underlying values object changes.
def on_value_update(self): """Call when the underlying values object changes.""" self._current_mode_setpoint_values = self._get_current_mode_setpoint_values() if not self._hvac_modes: self._set_modes_and_presets()
[ "def", "on_value_update", "(", "self", ")", ":", "self", ".", "_current_mode_setpoint_values", "=", "self", ".", "_get_current_mode_setpoint_values", "(", ")", "if", "not", "self", ".", "_hvac_modes", ":", "self", ".", "_set_modes_and_presets", "(", ")" ]
[ 167, 4 ]
[ 171, 41 ]
python
en
['en', 'en', 'en']
True
ZWaveClimateEntity.hvac_mode
(self)
Return hvac operation ie. heat, cool mode.
Return hvac operation ie. heat, cool mode.
def hvac_mode(self): """Return hvac operation ie. heat, cool mode.""" if not self.values.mode: # Thermostat(valve) with no support for setting a mode is considered heating-only return HVAC_MODE_HEAT return ZW_HVAC_MODE_MAPPINGS.get( self.values.mode.value[VALU...
[ "def", "hvac_mode", "(", "self", ")", ":", "if", "not", "self", ".", "values", ".", "mode", ":", "# Thermostat(valve) with no support for setting a mode is considered heating-only", "return", "HVAC_MODE_HEAT", "return", "ZW_HVAC_MODE_MAPPINGS", ".", "get", "(", "self", ...
[ 174, 4 ]
[ 181, 9 ]
python
bg
['en', 'bg', 'bg']
True
ZWaveClimateEntity.hvac_modes
(self)
Return the list of available hvac operation modes.
Return the list of available hvac operation modes.
def hvac_modes(self): """Return the list of available hvac operation modes.""" return list(self._hvac_modes)
[ "def", "hvac_modes", "(", "self", ")", ":", "return", "list", "(", "self", ".", "_hvac_modes", ")" ]
[ 184, 4 ]
[ 186, 37 ]
python
en
['en', 'en', 'en']
True
ZWaveClimateEntity.fan_mode
(self)
Return the fan speed set.
Return the fan speed set.
def fan_mode(self): """Return the fan speed set.""" return self.values.fan_mode.value[VALUE_SELECTED_LABEL]
[ "def", "fan_mode", "(", "self", ")", ":", "return", "self", ".", "values", ".", "fan_mode", ".", "value", "[", "VALUE_SELECTED_LABEL", "]" ]
[ 189, 4 ]
[ 191, 63 ]
python
en
['en', 'fy', 'en']
True
ZWaveClimateEntity.fan_modes
(self)
Return a list of available fan modes.
Return a list of available fan modes.
def fan_modes(self): """Return a list of available fan modes.""" return [entry[VALUE_LABEL] for entry in self.values.fan_mode.value[VALUE_LIST]]
[ "def", "fan_modes", "(", "self", ")", ":", "return", "[", "entry", "[", "VALUE_LABEL", "]", "for", "entry", "in", "self", ".", "values", ".", "fan_mode", ".", "value", "[", "VALUE_LIST", "]", "]" ]
[ 194, 4 ]
[ 196, 87 ]
python
en
['en', 'en', 'en']
True
ZWaveClimateEntity.temperature_unit
(self)
Return the unit of measurement.
Return the unit of measurement.
def temperature_unit(self): """Return the unit of measurement.""" if self.values.temperature is not None and self.values.temperature.units == "F": return TEMP_FAHRENHEIT return TEMP_CELSIUS
[ "def", "temperature_unit", "(", "self", ")", ":", "if", "self", ".", "values", ".", "temperature", "is", "not", "None", "and", "self", ".", "values", ".", "temperature", ".", "units", "==", "\"F\"", ":", "return", "TEMP_FAHRENHEIT", "return", "TEMP_CELSIUS" ...
[ 199, 4 ]
[ 203, 27 ]
python
en
['en', 'la', 'en']
True
ZWaveClimateEntity.current_temperature
(self)
Return the current temperature.
Return the current temperature.
def current_temperature(self): """Return the current temperature.""" if not self.values.temperature: return None return self.values.temperature.value
[ "def", "current_temperature", "(", "self", ")", ":", "if", "not", "self", ".", "values", ".", "temperature", ":", "return", "None", "return", "self", ".", "values", ".", "temperature", ".", "value" ]
[ 206, 4 ]
[ 210, 44 ]
python
en
['en', 'la', 'en']
True
ZWaveClimateEntity.hvac_action
(self)
Return the current running hvac operation if supported.
Return the current running hvac operation if supported.
def hvac_action(self): """Return the current running hvac operation if supported.""" if not self.values.operating_state: return None cur_state = self.values.operating_state.value.lower() return HVAC_CURRENT_MAPPINGS.get(cur_state)
[ "def", "hvac_action", "(", "self", ")", ":", "if", "not", "self", ".", "values", ".", "operating_state", ":", "return", "None", "cur_state", "=", "self", ".", "values", ".", "operating_state", ".", "value", ".", "lower", "(", ")", "return", "HVAC_CURRENT_M...
[ 213, 4 ]
[ 218, 51 ]
python
en
['en', 'en', 'en']
True
ZWaveClimateEntity.preset_mode
(self)
Return preset operation ie. eco, away.
Return preset operation ie. eco, away.
def preset_mode(self): """Return preset operation ie. eco, away.""" # A Zwave mode that can not be translated to a hass mode is considered a preset if not self.values.mode: return None if self.values.mode.value[VALUE_SELECTED_ID] not in MODES_LIST: return self.val...
[ "def", "preset_mode", "(", "self", ")", ":", "# A Zwave mode that can not be translated to a hass mode is considered a preset", "if", "not", "self", ".", "values", ".", "mode", ":", "return", "None", "if", "self", ".", "values", ".", "mode", ".", "value", "[", "VA...
[ 221, 4 ]
[ 228, 26 ]
python
en
['nl', 'sr', 'en']
False
ZWaveClimateEntity.preset_modes
(self)
Return the list of available preset operation modes.
Return the list of available preset operation modes.
def preset_modes(self): """Return the list of available preset operation modes.""" return list(self._hvac_presets)
[ "def", "preset_modes", "(", "self", ")", ":", "return", "list", "(", "self", ".", "_hvac_presets", ")" ]
[ 231, 4 ]
[ 233, 39 ]
python
en
['en', 'en', 'en']
True
ZWaveClimateEntity.target_temperature
(self)
Return the temperature we try to reach.
Return the temperature we try to reach.
def target_temperature(self): """Return the temperature we try to reach.""" return self._current_mode_setpoint_values[0].value
[ "def", "target_temperature", "(", "self", ")", ":", "return", "self", ".", "_current_mode_setpoint_values", "[", "0", "]", ".", "value" ]
[ 236, 4 ]
[ 238, 58 ]
python
en
['en', 'en', 'en']
True
ZWaveClimateEntity.target_temperature_low
(self)
Return the lowbound target temperature we try to reach.
Return the lowbound target temperature we try to reach.
def target_temperature_low(self) -> Optional[float]: """Return the lowbound target temperature we try to reach.""" return self._current_mode_setpoint_values[0].value
[ "def", "target_temperature_low", "(", "self", ")", "->", "Optional", "[", "float", "]", ":", "return", "self", ".", "_current_mode_setpoint_values", "[", "0", "]", ".", "value" ]
[ 241, 4 ]
[ 243, 58 ]
python
en
['en', 'en', 'en']
True
ZWaveClimateEntity.target_temperature_high
(self)
Return the highbound target temperature we try to reach.
Return the highbound target temperature we try to reach.
def target_temperature_high(self) -> Optional[float]: """Return the highbound target temperature we try to reach.""" return self._current_mode_setpoint_values[1].value
[ "def", "target_temperature_high", "(", "self", ")", "->", "Optional", "[", "float", "]", ":", "return", "self", ".", "_current_mode_setpoint_values", "[", "1", "]", ".", "value" ]
[ 246, 4 ]
[ 248, 58 ]
python
en
['en', 'en', 'en']
True
ZWaveClimateEntity.async_set_temperature
(self, **kwargs)
Set new target temperature. Must know if single or double setpoint.
Set new target temperature.
async def async_set_temperature(self, **kwargs): """Set new target temperature. Must know if single or double setpoint. """ hvac_mode = kwargs.get(ATTR_HVAC_MODE) if hvac_mode is not None: await self.async_set_hvac_mode(hvac_mode) if len(self._current_mode_...
[ "async", "def", "async_set_temperature", "(", "self", ",", "*", "*", "kwargs", ")", ":", "hvac_mode", "=", "kwargs", ".", "get", "(", "ATTR_HVAC_MODE", ")", "if", "hvac_mode", "is", "not", "None", ":", "await", "self", ".", "async_set_hvac_mode", "(", "hva...
[ 250, 4 ]
[ 272, 58 ]
python
en
['en', 'ca', 'en']
True
ZWaveClimateEntity.async_set_fan_mode
(self, fan_mode)
Set new target fan mode.
Set new target fan mode.
async def async_set_fan_mode(self, fan_mode): """Set new target fan mode.""" # get id for this fan_mode fan_mode_value = _get_list_id(self.values.fan_mode.value[VALUE_LIST], fan_mode) if fan_mode_value is None: _LOGGER.warning("Received an invalid fan mode: %s", fan_mode) ...
[ "async", "def", "async_set_fan_mode", "(", "self", ",", "fan_mode", ")", ":", "# get id for this fan_mode", "fan_mode_value", "=", "_get_list_id", "(", "self", ".", "values", ".", "fan_mode", ".", "value", "[", "VALUE_LIST", "]", ",", "fan_mode", ")", "if", "f...
[ 274, 4 ]
[ 281, 55 ]
python
en
['sv', 'fy', 'en']
False
ZWaveClimateEntity.async_set_hvac_mode
(self, hvac_mode)
Set new target hvac mode.
Set new target hvac mode.
async def async_set_hvac_mode(self, hvac_mode): """Set new target hvac mode.""" if not self.values.mode: # Thermostat(valve) with no support for setting a mode _LOGGER.warning( "Thermostat %s does not support setting a mode", self.entity_id ) ...
[ "async", "def", "async_set_hvac_mode", "(", "self", ",", "hvac_mode", ")", ":", "if", "not", "self", ".", "values", ".", "mode", ":", "# Thermostat(valve) with no support for setting a mode", "_LOGGER", ".", "warning", "(", "\"Thermostat %s does not support setting a mode...
[ 283, 4 ]
[ 295, 52 ]
python
da
['da', 'su', 'en']
False
ZWaveClimateEntity.async_set_preset_mode
(self, preset_mode)
Set new target preset mode.
Set new target preset mode.
async def async_set_preset_mode(self, preset_mode): """Set new target preset mode.""" if preset_mode == PRESET_NONE: # try to restore to the (translated) main hvac mode await self.async_set_hvac_mode(self.hvac_mode) return preset_mode_value = self._hvac_preset...
[ "async", "def", "async_set_preset_mode", "(", "self", ",", "preset_mode", ")", ":", "if", "preset_mode", "==", "PRESET_NONE", ":", "# try to restore to the (translated) main hvac mode", "await", "self", ".", "async_set_hvac_mode", "(", "self", ".", "hvac_mode", ")", "...
[ 297, 4 ]
[ 307, 54 ]
python
de
['de', 'su', 'en']
False
ZWaveClimateEntity.device_state_attributes
(self)
Return the optional state attributes.
Return the optional state attributes.
def device_state_attributes(self): """Return the optional state attributes.""" data = super().device_state_attributes if self.values.fan_action: data[ATTR_FAN_ACTION] = self.values.fan_action.value if self.values.valve_position: data[ ATTR_VALVE_PO...
[ "def", "device_state_attributes", "(", "self", ")", ":", "data", "=", "super", "(", ")", ".", "device_state_attributes", "if", "self", ".", "values", ".", "fan_action", ":", "data", "[", "ATTR_FAN_ACTION", "]", "=", "self", ".", "values", ".", "fan_action", ...
[ 310, 4 ]
[ 319, 19 ]
python
en
['en', 'en', 'en']
True
ZWaveClimateEntity.supported_features
(self)
Return the list of supported features.
Return the list of supported features.
def supported_features(self): """Return the list of supported features.""" support = 0 if len(self._current_mode_setpoint_values) == 1: support |= SUPPORT_TARGET_TEMPERATURE if len(self._current_mode_setpoint_values) > 1: support |= SUPPORT_TARGET_TEMPERATURE_RANG...
[ "def", "supported_features", "(", "self", ")", ":", "support", "=", "0", "if", "len", "(", "self", ".", "_current_mode_setpoint_values", ")", "==", "1", ":", "support", "|=", "SUPPORT_TARGET_TEMPERATURE", "if", "len", "(", "self", ".", "_current_mode_setpoint_va...
[ 322, 4 ]
[ 333, 22 ]
python
en
['en', 'en', 'en']
True
ZWaveClimateEntity._get_current_mode_setpoint_values
(self)
Return a tuple of current setpoint Z-Wave value(s).
Return a tuple of current setpoint Z-Wave value(s).
def _get_current_mode_setpoint_values(self) -> Tuple: """Return a tuple of current setpoint Z-Wave value(s).""" if not self.values.mode: setpoint_names = ("setpoint_heating",) else: current_mode = self.values.mode.value[VALUE_SELECTED_ID] setpoint_names = MODE...
[ "def", "_get_current_mode_setpoint_values", "(", "self", ")", "->", "Tuple", ":", "if", "not", "self", ".", "values", ".", "mode", ":", "setpoint_names", "=", "(", "\"setpoint_heating\"", ",", ")", "else", ":", "current_mode", "=", "self", ".", "values", "."...
[ 335, 4 ]
[ 347, 9 ]
python
en
['en', 'en', 'en']
True
ZWaveClimateEntity._set_modes_and_presets
(self)
Convert Z-Wave Thermostat modes into Home Assistant modes and presets.
Convert Z-Wave Thermostat modes into Home Assistant modes and presets.
def _set_modes_and_presets(self): """Convert Z-Wave Thermostat modes into Home Assistant modes and presets.""" all_modes = {} all_presets = {PRESET_NONE: None} if self.values.mode: # Z-Wave uses one list for both modes and presets. # Iterate over all Z-Wave Thermo...
[ "def", "_set_modes_and_presets", "(", "self", ")", ":", "all_modes", "=", "{", "}", "all_presets", "=", "{", "PRESET_NONE", ":", "None", "}", "if", "self", ".", "values", ".", "mode", ":", "# Z-Wave uses one list for both modes and presets.", "# Iterate over all Z-W...
[ 349, 4 ]
[ 367, 40 ]
python
en
['en', 'en', 'en']
True
configured_sensors
(hass)
Return a set of configured Luftdaten sensors.
Return a set of configured Luftdaten sensors.
def configured_sensors(hass): """Return a set of configured Luftdaten sensors.""" return { entry.data[CONF_SENSOR_ID] for entry in hass.config_entries.async_entries(DOMAIN) }
[ "def", "configured_sensors", "(", "hass", ")", ":", "return", "{", "entry", ".", "data", "[", "CONF_SENSOR_ID", "]", "for", "entry", "in", "hass", ".", "config_entries", ".", "async_entries", "(", "DOMAIN", ")", "}" ]
[ 22, 0 ]
[ 27, 5 ]
python
en
['en', 'da', 'en']
True
duplicate_stations
(hass)
Return a set of duplicate configured Luftdaten stations.
Return a set of duplicate configured Luftdaten stations.
def duplicate_stations(hass): """Return a set of duplicate configured Luftdaten stations.""" stations = [ int(entry.data[CONF_SENSOR_ID]) for entry in hass.config_entries.async_entries(DOMAIN) ] return {x for x in stations if stations.count(x) > 1}
[ "def", "duplicate_stations", "(", "hass", ")", ":", "stations", "=", "[", "int", "(", "entry", ".", "data", "[", "CONF_SENSOR_ID", "]", ")", "for", "entry", "in", "hass", ".", "config_entries", ".", "async_entries", "(", "DOMAIN", ")", "]", "return", "{"...
[ 31, 0 ]
[ 37, 57 ]
python
en
['en', 'da', 'en']
True
async_setup_platform
(hass, config, async_add_entities, discovery_info=None)
Set up the integration sensor.
Set up the integration sensor.
async def async_setup_platform(hass, config, async_add_entities, discovery_info=None): """Set up the integration sensor.""" integral = IntegrationSensor( config[CONF_SOURCE_SENSOR], config.get(CONF_NAME), config[CONF_ROUND_DIGITS], config[CONF_UNIT_PREFIX], config[CONF_UN...
[ "async", "def", "async_setup_platform", "(", "hass", ",", "config", ",", "async_add_entities", ",", "discovery_info", "=", "None", ")", ":", "integral", "=", "IntegrationSensor", "(", "config", "[", "CONF_SOURCE_SENSOR", "]", ",", "config", ".", "get", "(", "C...
[ 70, 0 ]
[ 82, 34 ]
python
en
['en', 'da', 'en']
True
IntegrationSensor.__init__
( self, source_entity, name, round_digits, unit_prefix, unit_time, unit_of_measurement, integration_method, )
Initialize the integration sensor.
Initialize the integration sensor.
def __init__( self, source_entity, name, round_digits, unit_prefix, unit_time, unit_of_measurement, integration_method, ): """Initialize the integration sensor.""" self._sensor_source_id = source_entity self._round_digits = roun...
[ "def", "__init__", "(", "self", ",", "source_entity", ",", "name", ",", "round_digits", ",", "unit_prefix", ",", "unit_time", ",", "unit_of_measurement", ",", "integration_method", ",", ")", ":", "self", ".", "_sensor_source_id", "=", "source_entity", "self", "....
[ 88, 4 ]
[ 116, 46 ]
python
en
['en', 'pt', 'en']
True
IntegrationSensor.async_added_to_hass
(self)
Handle entity which will be added.
Handle entity which will be added.
async def async_added_to_hass(self): """Handle entity which will be added.""" await super().async_added_to_hass() state = await self.async_get_last_state() if state: try: self._state = Decimal(state.state) except ValueError as err: ...
[ "async", "def", "async_added_to_hass", "(", "self", ")", ":", "await", "super", "(", ")", ".", "async_added_to_hass", "(", ")", "state", "=", "await", "self", ".", "async_get_last_state", "(", ")", "if", "state", ":", "try", ":", "self", ".", "_state", "...
[ 118, 4 ]
[ 180, 9 ]
python
en
['en', 'en', 'en']
True
IntegrationSensor.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" ]
[ 183, 4 ]
[ 185, 25 ]
python
en
['en', 'mi', 'en']
True
IntegrationSensor.state
(self)
Return the state of the sensor.
Return the state of the sensor.
def state(self): """Return the state of the sensor.""" return round(self._state, self._round_digits)
[ "def", "state", "(", "self", ")", ":", "return", "round", "(", "self", ".", "_state", ",", "self", ".", "_round_digits", ")" ]
[ 188, 4 ]
[ 190, 53 ]
python
en
['en', 'en', 'en']
True
IntegrationSensor.unit_of_measurement
(self)
Return the unit the value is expressed in.
Return the unit the value is expressed in.
def unit_of_measurement(self): """Return the unit the value is expressed in.""" return self._unit_of_measurement
[ "def", "unit_of_measurement", "(", "self", ")", ":", "return", "self", ".", "_unit_of_measurement" ]
[ 193, 4 ]
[ 195, 40 ]
python
en
['en', 'en', 'en']
True
IntegrationSensor.should_poll
(self)
No polling needed.
No polling needed.
def should_poll(self): """No polling needed.""" return False
[ "def", "should_poll", "(", "self", ")", ":", "return", "False" ]
[ 198, 4 ]
[ 200, 20 ]
python
en
['en', 'en', 'en']
True
IntegrationSensor.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 {ATTR_SOURCE_ID: self._sensor_source_id}
[ "def", "device_state_attributes", "(", "self", ")", ":", "return", "{", "ATTR_SOURCE_ID", ":", "self", ".", "_sensor_source_id", "}" ]
[ 203, 4 ]
[ 205, 55 ]
python
en
['en', 'en', 'en']
True
IntegrationSensor.icon
(self)
Return the icon to use in the frontend.
Return the icon to use in the frontend.
def icon(self): """Return the icon to use in the frontend.""" return ICON
[ "def", "icon", "(", "self", ")", ":", "return", "ICON" ]
[ 208, 4 ]
[ 210, 19 ]
python
en
['en', 'en', 'en']
True
get_scanner
(hass, config)
Initialize Scanner.
Initialize Scanner.
def get_scanner(hass, config): """Initialize Scanner.""" data = { "server": config[DOMAIN][CONF_HOST], "grant_type": GRANT_TYPE, "secret": config[DOMAIN][CONF_API_KEY], "client": config[DOMAIN][CONF_CLIENT_ID], } cppm = ClearPass(data) if cppm.access_token is None: ...
[ "def", "get_scanner", "(", "hass", ",", "config", ")", ":", "data", "=", "{", "\"server\"", ":", "config", "[", "DOMAIN", "]", "[", "CONF_HOST", "]", ",", "\"grant_type\"", ":", "GRANT_TYPE", ",", "\"secret\"", ":", "config", "[", "DOMAIN", "]", "[", "...
[ 30, 0 ]
[ 43, 34 ]
python
en
['en', 'en', 'it']
False
CPPMDeviceScanner.__init__
(self, cppm)
Initialize class.
Initialize class.
def __init__(self, cppm): """Initialize class.""" self._cppm = cppm self.results = None
[ "def", "__init__", "(", "self", ",", "cppm", ")", ":", "self", ".", "_cppm", "=", "cppm", "self", ".", "results", "=", "None" ]
[ 49, 4 ]
[ 52, 27 ]
python
en
['en', 'co', 'en']
False
CPPMDeviceScanner.scan_devices
(self)
Initialize scanner.
Initialize scanner.
def scan_devices(self): """Initialize scanner.""" self.get_cppm_data() return [device["mac"] for device in self.results]
[ "def", "scan_devices", "(", "self", ")", ":", "self", ".", "get_cppm_data", "(", ")", "return", "[", "device", "[", "\"mac\"", "]", "for", "device", "in", "self", ".", "results", "]" ]
[ 54, 4 ]
[ 57, 57 ]
python
en
['en', 'en', 'it']
False