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
BruntDevice.move_state
(self)
Return current moving state of cover. None is unknown, 0 when stopped, 1 when opening, 2 when closing
Return current moving state of cover.
def move_state(self): """ Return current moving state of cover. None is unknown, 0 when stopped, 1 when opening, 2 when closing """ mov = self._state.get("moveState") return int(mov) if mov else None
[ "def", "move_state", "(", "self", ")", ":", "mov", "=", "self", ".", "_state", ".", "get", "(", "\"moveState\"", ")", "return", "int", "(", "mov", ")", "if", "mov", "else", "None" ]
[ 113, 4 ]
[ 120, 40 ]
python
en
['en', 'error', 'th']
False
BruntDevice.is_opening
(self)
Return if the cover is opening or not.
Return if the cover is opening or not.
def is_opening(self): """Return if the cover is opening or not.""" return self.move_state == 1
[ "def", "is_opening", "(", "self", ")", ":", "return", "self", ".", "move_state", "==", "1" ]
[ 123, 4 ]
[ 125, 35 ]
python
en
['en', 'en', 'en']
True
BruntDevice.is_closing
(self)
Return if the cover is closing or not.
Return if the cover is closing or not.
def is_closing(self): """Return if the cover is closing or not.""" return self.move_state == 2
[ "def", "is_closing", "(", "self", ")", ":", "return", "self", ".", "move_state", "==", "2" ]
[ 128, 4 ]
[ 130, 35 ]
python
en
['en', 'en', 'en']
True
BruntDevice.device_state_attributes
(self)
Return the detailed device state attributes.
Return the detailed device state attributes.
def device_state_attributes(self): """Return the detailed device state attributes.""" return { ATTR_ATTRIBUTION: ATTRIBUTION, ATTR_REQUEST_POSITION: self.request_cover_position, }
[ "def", "device_state_attributes", "(", "self", ")", ":", "return", "{", "ATTR_ATTRIBUTION", ":", "ATTRIBUTION", ",", "ATTR_REQUEST_POSITION", ":", "self", ".", "request_cover_position", ",", "}" ]
[ 133, 4 ]
[ 138, 9 ]
python
en
['en', 'en', 'en']
True
BruntDevice.device_class
(self)
Return the class of this device, from component DEVICE_CLASSES.
Return the class of this device, from component DEVICE_CLASSES.
def device_class(self): """Return the class of this device, from component DEVICE_CLASSES.""" return DEVICE_CLASS_WINDOW
[ "def", "device_class", "(", "self", ")", ":", "return", "DEVICE_CLASS_WINDOW" ]
[ 141, 4 ]
[ 143, 34 ]
python
en
['en', 'en', 'en']
True
BruntDevice.supported_features
(self)
Flag supported features.
Flag supported features.
def supported_features(self): """Flag supported features.""" return COVER_FEATURES
[ "def", "supported_features", "(", "self", ")", ":", "return", "COVER_FEATURES" ]
[ 146, 4 ]
[ 148, 29 ]
python
en
['da', 'en', 'en']
True
BruntDevice.is_closed
(self)
Return true if cover is closed, else False.
Return true if cover is closed, else False.
def is_closed(self): """Return true if cover is closed, else False.""" return self.current_cover_position == CLOSED_POSITION
[ "def", "is_closed", "(", "self", ")", ":", "return", "self", ".", "current_cover_position", "==", "CLOSED_POSITION" ]
[ 151, 4 ]
[ 153, 61 ]
python
en
['en', 'en', 'en']
True
BruntDevice.update
(self)
Poll the current state of the device.
Poll the current state of the device.
def update(self): """Poll the current state of the device.""" try: self._state = self._bapi.getState(thingUri=self._thing_uri).get("thing") self._available = True except (TypeError, KeyError, NameError, ValueError) as ex: _LOGGER.error("%s", ex) se...
[ "def", "update", "(", "self", ")", ":", "try", ":", "self", ".", "_state", "=", "self", ".", "_bapi", ".", "getState", "(", "thingUri", "=", "self", ".", "_thing_uri", ")", ".", "get", "(", "\"thing\"", ")", "self", ".", "_available", "=", "True", ...
[ 155, 4 ]
[ 162, 35 ]
python
en
['en', 'en', 'en']
True
BruntDevice.open_cover
(self, **kwargs)
Set the cover to the open position.
Set the cover to the open position.
def open_cover(self, **kwargs): """Set the cover to the open position.""" self._bapi.changeRequestPosition(OPEN_POSITION, thingUri=self._thing_uri)
[ "def", "open_cover", "(", "self", ",", "*", "*", "kwargs", ")", ":", "self", ".", "_bapi", ".", "changeRequestPosition", "(", "OPEN_POSITION", ",", "thingUri", "=", "self", ".", "_thing_uri", ")" ]
[ 164, 4 ]
[ 166, 81 ]
python
en
['en', 'en', 'en']
True
BruntDevice.close_cover
(self, **kwargs)
Set the cover to the closed position.
Set the cover to the closed position.
def close_cover(self, **kwargs): """Set the cover to the closed position.""" self._bapi.changeRequestPosition(CLOSED_POSITION, thingUri=self._thing_uri)
[ "def", "close_cover", "(", "self", ",", "*", "*", "kwargs", ")", ":", "self", ".", "_bapi", ".", "changeRequestPosition", "(", "CLOSED_POSITION", ",", "thingUri", "=", "self", ".", "_thing_uri", ")" ]
[ 168, 4 ]
[ 170, 83 ]
python
en
['en', 'en', 'en']
True
BruntDevice.set_cover_position
(self, **kwargs)
Set the cover to a specific position.
Set the cover to a specific position.
def set_cover_position(self, **kwargs): """Set the cover to a specific position.""" self._bapi.changeRequestPosition( kwargs[ATTR_POSITION], thingUri=self._thing_uri )
[ "def", "set_cover_position", "(", "self", ",", "*", "*", "kwargs", ")", ":", "self", ".", "_bapi", ".", "changeRequestPosition", "(", "kwargs", "[", "ATTR_POSITION", "]", ",", "thingUri", "=", "self", ".", "_thing_uri", ")" ]
[ 172, 4 ]
[ 176, 9 ]
python
en
['en', 'en', 'en']
True
test_get_request_token
(mocker)
Verify the first step of the authentication process, the retrieval of the Request Token.
Verify the first step of the authentication process, the retrieval of the Request Token.
def test_get_request_token(mocker): """Verify the first step of the authentication process, the retrieval of the Request Token.""" token_value = "1234abcd_-" user = "centos" session_id = "mysession" mock_verify_session_existence(mocker, exists=True) mock_generate_random_token(mocker, token_valu...
[ "def", "test_get_request_token", "(", "mocker", ")", ":", "token_value", "=", "\"1234abcd_-\"", "user", "=", "\"centos\"", "session_id", "=", "\"mysession\"", "mock_verify_session_existence", "(", "mocker", ",", "exists", "=", "True", ")", "mock_generate_random_token", ...
[ 161, 0 ]
[ 179, 61 ]
python
en
['en', 'en', 'en']
True
test_check_auth
(mocker)
Verify the DCVAuthenticator._check_auth method. The method verifies the token validity for the given DCV session id.
Verify the DCVAuthenticator._check_auth method.
def test_check_auth(mocker): """ Verify the DCVAuthenticator._check_auth method. The method verifies the token validity for the given DCV session id. """ token = generate_random_token(256) user = "centos" session_id = "mysession" mock_verify_session_existence(mocker, exists=True) #...
[ "def", "test_check_auth", "(", "mocker", ")", ":", "token", "=", "generate_random_token", "(", "256", ")", "user", "=", "\"centos\"", "session_id", "=", "\"mysession\"", "mock_verify_session_existence", "(", "mocker", ",", "exists", "=", "True", ")", "# valid", ...
[ 206, 0 ]
[ 235, 76 ]
python
en
['en', 'error', 'th']
False
test_get_session_token
(mocker)
Verify the second step of the authentication process, the retrieval of the Session Token.
Verify the second step of the authentication process, the retrieval of the Session Token.
def test_get_session_token(mocker): """Verify the second step of the authentication process, the retrieval of the Session Token.""" request_token = "".join("a" for _ in range(256)) user = "centos" session_id = "mysession" access_file = "access_file" mock_verify_session_existence(mocker, exists=T...
[ "def", "test_get_session_token", "(", "mocker", ")", ":", "request_token", "=", "\"\"", ".", "join", "(", "\"a\"", "for", "_", "in", "range", "(", "256", ")", ")", "user", "=", "\"centos\"", "session_id", "=", "\"mysession\"", "access_file", "=", "\"access_f...
[ 242, 0 ]
[ 300, 5 ]
python
en
['en', 'en', 'en']
True
TestOneTimeTokenHandler.test_token_capacity
()
Test token capacity. Create a token handler with a defined size, add a number of items exceeding the internal capacity and verify the first one is not present.
Test token capacity.
def test_token_capacity(): """ Test token capacity. Create a token handler with a defined size, add a number of items exceeding the internal capacity and verify the first one is not present. """ storage = OneTimeTokenHandler(3) storage.add_token("token1", ("some_...
[ "def", "test_token_capacity", "(", ")", ":", "storage", "=", "OneTimeTokenHandler", "(", "3", ")", "storage", ".", "add_token", "(", "\"token1\"", ",", "(", "\"some_value\"", ",", "1", ",", "15.2", ",", "[", "\"a\"", ",", "2", "]", ")", ")", "storage", ...
[ 33, 4 ]
[ 45, 63 ]
python
en
['en', 'error', 'th']
False
TestOneTimeTokenHandler.test_token_storage
()
Add tokens and their corresponding information in the storage and verify they are correctly stored.
Add tokens and their corresponding information in the storage and verify they are correctly stored.
def test_token_storage(): """Add tokens and their corresponding information in the storage and verify they are correctly stored.""" storage = OneTimeTokenHandler(3) storage.add_token("token1", ("some_value", 1, 15.2, ["a", 2])) storage.add_token("token2", (1, 2)) storage.add_toke...
[ "def", "test_token_storage", "(", ")", ":", "storage", "=", "OneTimeTokenHandler", "(", "3", ")", "storage", ".", "add_token", "(", "\"token1\"", ",", "(", "\"some_value\"", ",", "1", ",", "15.2", ",", "[", "\"a\"", ",", "2", "]", ")", ")", "storage", ...
[ 48, 4 ]
[ 56, 68 ]
python
en
['en', 'en', 'en']
True
TestOneTimeTokenHandler.test_one_time_token
()
Add a token and verify it is correctly removed once used.
Add a token and verify it is correctly removed once used.
def test_one_time_token(): """Add a token and verify it is correctly removed once used.""" storage = OneTimeTokenHandler(5) storage.add_token(1, "some_value") storage.get_token_info(1) assert_that(storage.get_token_info(1)).is_none()
[ "def", "test_one_time_token", "(", ")", ":", "storage", "=", "OneTimeTokenHandler", "(", "5", ")", "storage", ".", "add_token", "(", "1", ",", "\"some_value\"", ")", "storage", ".", "get_token_info", "(", "1", ")", "assert_that", "(", "storage", ".", "get_to...
[ 59, 4 ]
[ 64, 56 ]
python
en
['en', 'en', 'en']
True
async_setup
(hass, hass_config)
Create an Intergas InComfort/Intouch system.
Create an Intergas InComfort/Intouch system.
async def async_setup(hass, hass_config): """Create an Intergas InComfort/Intouch system.""" incomfort_data = hass.data[DOMAIN] = {} credentials = dict(hass_config[DOMAIN]) hostname = credentials.pop(CONF_HOST) client = incomfort_data["client"] = InComfortGateway( hostname, **credentials, ...
[ "async", "def", "async_setup", "(", "hass", ",", "hass_config", ")", ":", "incomfort_data", "=", "hass", ".", "data", "[", "DOMAIN", "]", "=", "{", "}", "credentials", "=", "dict", "(", "hass_config", "[", "DOMAIN", "]", ")", "hostname", "=", "credential...
[ 34, 0 ]
[ 59, 15 ]
python
en
['en', 'en', 'en']
True
IncomfortEntity.__init__
(self)
Initialize the class.
Initialize the class.
def __init__(self) -> None: """Initialize the class.""" self._unique_id = self._name = None
[ "def", "__init__", "(", "self", ")", "->", "None", ":", "self", ".", "_unique_id", "=", "self", ".", "_name", "=", "None" ]
[ 65, 4 ]
[ 67, 43 ]
python
en
['en', 'en', 'en']
True
IncomfortEntity.unique_id
(self)
Return a unique ID.
Return a unique ID.
def unique_id(self) -> Optional[str]: """Return a unique ID.""" return self._unique_id
[ "def", "unique_id", "(", "self", ")", "->", "Optional", "[", "str", "]", ":", "return", "self", ".", "_unique_id" ]
[ 70, 4 ]
[ 72, 30 ]
python
ca
['fr', 'ca', 'en']
False
IncomfortEntity.name
(self)
Return the name of the sensor.
Return the name of the sensor.
def name(self) -> Optional[str]: """Return the name of the sensor.""" return self._name
[ "def", "name", "(", "self", ")", "->", "Optional", "[", "str", "]", ":", "return", "self", ".", "_name" ]
[ 75, 4 ]
[ 77, 25 ]
python
en
['en', 'mi', 'en']
True
IncomfortChild.async_added_to_hass
(self)
Set up a listener when this entity is added to HA.
Set up a listener when this entity is added to HA.
async def async_added_to_hass(self) -> None: """Set up a listener when this entity is added to HA.""" self.async_on_remove(async_dispatcher_connect(self.hass, DOMAIN, self._refresh))
[ "async", "def", "async_added_to_hass", "(", "self", ")", "->", "None", ":", "self", ".", "async_on_remove", "(", "async_dispatcher_connect", "(", "self", ".", "hass", ",", "DOMAIN", ",", "self", ".", "_refresh", ")", ")" ]
[ 83, 4 ]
[ 85, 88 ]
python
en
['en', 'en', 'en']
True
IncomfortChild.should_poll
(self)
Return False as this device should never be polled.
Return False as this device should never be polled.
def should_poll(self) -> bool: """Return False as this device should never be polled.""" return False
[ "def", "should_poll", "(", "self", ")", "->", "bool", ":", "return", "False" ]
[ 92, 4 ]
[ 94, 20 ]
python
en
['en', 'en', 'en']
True
async_add_acmeda_entities
( hass, entity_class, config_entry, current, async_add_entities )
Add any new entities.
Add any new entities.
def async_add_acmeda_entities( hass, entity_class, config_entry, current, async_add_entities ): """Add any new entities.""" hub = hass.data[DOMAIN][config_entry.entry_id] LOGGER.debug("Looking for new %s on: %s", entity_class.__name__, hub.host) api = hub.api.rollers new_items = [] for uni...
[ "def", "async_add_acmeda_entities", "(", "hass", ",", "entity_class", ",", "config_entry", ",", "current", ",", "async_add_entities", ")", ":", "hub", "=", "hass", ".", "data", "[", "DOMAIN", "]", "[", "config_entry", ".", "entry_id", "]", "LOGGER", ".", "de...
[ 8, 0 ]
[ 25, 33 ]
python
en
['en', 'en', 'en']
True
update_devices
(hass, config_entry, api)
Tell hass that device info has been updated.
Tell hass that device info has been updated.
async def update_devices(hass, config_entry, api): """Tell hass that device info has been updated.""" dev_registry = await get_dev_reg(hass) for api_item in api.values(): # Update Device name device = dev_registry.async_get_device( identifiers={(DOMAIN, api_item.id)}, connection...
[ "async", "def", "update_devices", "(", "hass", ",", "config_entry", ",", "api", ")", ":", "dev_registry", "=", "await", "get_dev_reg", "(", "hass", ")", "for", "api_item", "in", "api", ".", "values", "(", ")", ":", "# Update Device name", "device", "=", "d...
[ 28, 0 ]
[ 41, 13 ]
python
en
['en', 'en', 'en']
True
test_setup_platform
(hass, dsmr_connection_fixture)
Test setup of platform.
Test setup of platform.
async def test_setup_platform(hass, dsmr_connection_fixture): """Test setup of platform.""" async_add_entities = MagicMock() entry_data = { "platform": DOMAIN, "port": "/dev/ttyUSB0", "dsmr_version": "2.2", "precision": 4, "reconnect_interval": 30, } serial_...
[ "async", "def", "test_setup_platform", "(", "hass", ",", "dsmr_connection_fixture", ")", ":", "async_add_entities", "=", "MagicMock", "(", ")", "entry_data", "=", "{", "\"platform\"", ":", "DOMAIN", ",", "\"port\"", ":", "\"/dev/ttyUSB0\"", ",", "\"dsmr_version\"", ...
[ 26, 0 ]
[ 61, 54 ]
python
en
['en', 'da', 'en']
True
test_default_setup
(hass, dsmr_connection_fixture)
Test the default setup.
Test the default setup.
async def test_default_setup(hass, dsmr_connection_fixture): """Test the default setup.""" (connection_factory, transport, protocol) = dsmr_connection_fixture from dsmr_parser.obis_references import ( CURRENT_ELECTRICITY_USAGE, ELECTRICITY_ACTIVE_TARIFF, GAS_METER_READING, ) ...
[ "async", "def", "test_default_setup", "(", "hass", ",", "dsmr_connection_fixture", ")", ":", "(", "connection_factory", ",", "transport", ",", "protocol", ")", "=", "dsmr_connection_fixture", "from", "dsmr_parser", ".", "obis_references", "import", "(", "CURRENT_ELECT...
[ 64, 0 ]
[ 147, 87 ]
python
en
['en', 'da', 'en']
True
test_setup_only_energy
(hass, dsmr_connection_fixture)
Test the default setup.
Test the default setup.
async def test_setup_only_energy(hass, dsmr_connection_fixture): """Test the default setup.""" entry_data = { "port": "/dev/ttyUSB0", "dsmr_version": "2.2", "precision": 4, "reconnect_interval": 30, "serial_id": "1234", } mock_entry = MockConfigEntry( dom...
[ "async", "def", "test_setup_only_energy", "(", "hass", ",", "dsmr_connection_fixture", ")", ":", "entry_data", "=", "{", "\"port\"", ":", "\"/dev/ttyUSB0\"", ",", "\"dsmr_version\"", ":", "\"2.2\"", ",", "\"precision\"", ":", "4", ",", "\"reconnect_interval\"", ":",...
[ 150, 0 ]
[ 176, 20 ]
python
en
['en', 'da', 'en']
True
test_derivative
()
Test calculation of derivative value.
Test calculation of derivative value.
async def test_derivative(): """Test calculation of derivative value.""" from dsmr_parser.objects import MBusObject config = {"platform": "dsmr"} entity = DerivativeDSMREntity("test", "test_device", "5678", "1.0.0", config) await entity.async_update() assert entity.state is None, "initial sta...
[ "async", "def", "test_derivative", "(", ")", ":", "from", "dsmr_parser", ".", "objects", "import", "MBusObject", "config", "=", "{", "\"platform\"", ":", "\"dsmr\"", "}", "entity", "=", "DerivativeDSMREntity", "(", "\"test\"", ",", "\"test_device\"", ",", "\"567...
[ 179, 0 ]
[ 216, 79 ]
python
en
['en', 'en', 'en']
True
test_v4_meter
(hass, dsmr_connection_fixture)
Test if v4 meter is correctly parsed.
Test if v4 meter is correctly parsed.
async def test_v4_meter(hass, dsmr_connection_fixture): """Test if v4 meter is correctly parsed.""" (connection_factory, transport, protocol) = dsmr_connection_fixture from dsmr_parser.obis_references import ( ELECTRICITY_ACTIVE_TARIFF, HOURLY_GAS_METER_READING, ) from dsmr_parser.o...
[ "async", "def", "test_v4_meter", "(", "hass", ",", "dsmr_connection_fixture", ")", ":", "(", "connection_factory", ",", "transport", ",", "protocol", ")", "=", "dsmr_connection_fixture", "from", "dsmr_parser", ".", "obis_references", "import", "(", "ELECTRICITY_ACTIVE...
[ 219, 0 ]
[ 276, 87 ]
python
en
['en', 'en', 'en']
True
test_v5_meter
(hass, dsmr_connection_fixture)
Test if v5 meter is correctly parsed.
Test if v5 meter is correctly parsed.
async def test_v5_meter(hass, dsmr_connection_fixture): """Test if v5 meter is correctly parsed.""" (connection_factory, transport, protocol) = dsmr_connection_fixture from dsmr_parser.obis_references import ( ELECTRICITY_ACTIVE_TARIFF, HOURLY_GAS_METER_READING, ) from dsmr_parser.o...
[ "async", "def", "test_v5_meter", "(", "hass", ",", "dsmr_connection_fixture", ")", ":", "(", "connection_factory", ",", "transport", ",", "protocol", ")", "=", "dsmr_connection_fixture", "from", "dsmr_parser", ".", "obis_references", "import", "(", "ELECTRICITY_ACTIVE...
[ 279, 0 ]
[ 336, 87 ]
python
en
['en', 'en', 'en']
True
test_belgian_meter
(hass, dsmr_connection_fixture)
Test if Belgian meter is correctly parsed.
Test if Belgian meter is correctly parsed.
async def test_belgian_meter(hass, dsmr_connection_fixture): """Test if Belgian meter is correctly parsed.""" (connection_factory, transport, protocol) = dsmr_connection_fixture from dsmr_parser.obis_references import ( BELGIUM_HOURLY_GAS_METER_READING, ELECTRICITY_ACTIVE_TARIFF, ) ...
[ "async", "def", "test_belgian_meter", "(", "hass", ",", "dsmr_connection_fixture", ")", ":", "(", "connection_factory", ",", "transport", ",", "protocol", ")", "=", "dsmr_connection_fixture", "from", "dsmr_parser", ".", "obis_references", "import", "(", "BELGIUM_HOURL...
[ 339, 0 ]
[ 396, 87 ]
python
en
['en', 'en', 'en']
True
test_belgian_meter_low
(hass, dsmr_connection_fixture)
Test if Belgian meter is correctly parsed.
Test if Belgian meter is correctly parsed.
async def test_belgian_meter_low(hass, dsmr_connection_fixture): """Test if Belgian meter is correctly parsed.""" (connection_factory, transport, protocol) = dsmr_connection_fixture from dsmr_parser.obis_references import ELECTRICITY_ACTIVE_TARIFF from dsmr_parser.objects import CosemObject entry_...
[ "async", "def", "test_belgian_meter_low", "(", "hass", ",", "dsmr_connection_fixture", ")", ":", "(", "connection_factory", ",", "transport", ",", "protocol", ")", "=", "dsmr_connection_fixture", "from", "dsmr_parser", ".", "obis_references", "import", "ELECTRICITY_ACTI...
[ 399, 0 ]
[ 440, 67 ]
python
en
['en', 'en', 'en']
True
test_tcp
(hass, dsmr_connection_fixture)
If proper config provided TCP connection should be made.
If proper config provided TCP connection should be made.
async def test_tcp(hass, dsmr_connection_fixture): """If proper config provided TCP connection should be made.""" (connection_factory, transport, protocol) = dsmr_connection_fixture entry_data = { "host": "localhost", "port": "1234", "dsmr_version": "2.2", "precision": 4, ...
[ "async", "def", "test_tcp", "(", "hass", ",", "dsmr_connection_fixture", ")", ":", "(", "connection_factory", ",", "transport", ",", "protocol", ")", "=", "dsmr_connection_fixture", "entry_data", "=", "{", "\"host\"", ":", "\"localhost\"", ",", "\"port\"", ":", ...
[ 443, 0 ]
[ 467, 63 ]
python
en
['en', 'en', 'en']
True
test_connection_errors_retry
(hass, dsmr_connection_fixture)
Connection should be retried on error during setup.
Connection should be retried on error during setup.
async def test_connection_errors_retry(hass, dsmr_connection_fixture): """Connection should be retried on error during setup.""" (connection_factory, transport, protocol) = dsmr_connection_fixture entry_data = { "port": "/dev/ttyUSB0", "dsmr_version": "2.2", "precision": 4, ...
[ "async", "def", "test_connection_errors_retry", "(", "hass", ",", "dsmr_connection_fixture", ")", ":", "(", "connection_factory", ",", "transport", ",", "protocol", ")", "=", "dsmr_connection_fixture", "entry_data", "=", "{", "\"port\"", ":", "\"/dev/ttyUSB0\"", ",", ...
[ 470, 0 ]
[ 504, 86 ]
python
en
['en', 'en', 'en']
True
test_reconnect
(hass, dsmr_connection_fixture)
If transport disconnects, the connection should be retried.
If transport disconnects, the connection should be retried.
async def test_reconnect(hass, dsmr_connection_fixture): """If transport disconnects, the connection should be retried.""" (connection_factory, transport, protocol) = dsmr_connection_fixture entry_data = { "port": "/dev/ttyUSB0", "dsmr_version": "2.2", "precision": 4, "recon...
[ "async", "def", "test_reconnect", "(", "hass", ",", "dsmr_connection_fixture", ")", ":", "(", "connection_factory", ",", "transport", ",", "protocol", ")", "=", "dsmr_connection_fixture", "entry_data", "=", "{", "\"port\"", ":", "\"/dev/ttyUSB0\"", ",", "\"dsmr_vers...
[ 507, 0 ]
[ 557, 43 ]
python
en
['en', 'en', 'en']
True
load_tf_weights_in_tapas
(model, config, tf_checkpoint_path)
Load tf checkpoints in a PyTorch model. This is an adaptation from load_tf_weights_in_bert - add cell selection and aggregation heads - take into account additional token type embedding layers
Load tf checkpoints in a PyTorch model. This is an adaptation from load_tf_weights_in_bert
def load_tf_weights_in_tapas(model, config, tf_checkpoint_path): """ Load tf checkpoints in a PyTorch model. This is an adaptation from load_tf_weights_in_bert - add cell selection and aggregation heads - take into account additional token type embedding layers """ try: import re ...
[ "def", "load_tf_weights_in_tapas", "(", "model", ",", "config", ",", "tf_checkpoint_path", ")", ":", "try", ":", "import", "re", "import", "numpy", "as", "np", "import", "tensorflow", "as", "tf", "except", "ImportError", ":", "logger", ".", "error", "(", "\"...
[ 125, 0 ]
[ 249, 16 ]
python
en
['en', 'error', 'th']
False
gather
(values, index, name="segmented_gather")
Gathers from `values` using the index map. For each element in the domain of the index map this operation looks up a value for that index in `values`. Two elements from the same segment always get assigned the same value. Args: values (:obj:`torch.Tensor` of shape (B1, ..., Bn, num_segments, V1, ....
Gathers from `values` using the index map. For each element in the domain of the index map this operation looks up a value for that index in `values`. Two elements from the same segment always get assigned the same value.
def gather(values, index, name="segmented_gather"): """ Gathers from `values` using the index map. For each element in the domain of the index map this operation looks up a value for that index in `values`. Two elements from the same segment always get assigned the same value. Args: values (:ob...
[ "def", "gather", "(", "values", ",", "index", ",", "name", "=", "\"segmented_gather\"", ")", ":", "indices", "=", "index", ".", "indices", "# first, check whether the indices of the index represent scalar values (i.e. not vectorized)", "if", "len", "(", "values", ".", "...
[ 1566, 0 ]
[ 1596, 62 ]
python
en
['en', 'error', 'th']
False
flatten
(index, name="segmented_flatten")
Flattens a batched index map (which is typically of shape batch_size, seq_length) to a 1d index map. This operation relabels the segments to keep batch elements distinct. The k-th batch element will have indices shifted by `num_segments` * (k - 1). The result is a tensor with `num_segments` multiplied by t...
Flattens a batched index map (which is typically of shape batch_size, seq_length) to a 1d index map. This operation relabels the segments to keep batch elements distinct. The k-th batch element will have indices shifted by `num_segments` * (k - 1). The result is a tensor with `num_segments` multiplied by t...
def flatten(index, name="segmented_flatten"): """ Flattens a batched index map (which is typically of shape batch_size, seq_length) to a 1d index map. This operation relabels the segments to keep batch elements distinct. The k-th batch element will have indices shifted by `num_segments` * (k - 1). The r...
[ "def", "flatten", "(", "index", ",", "name", "=", "\"segmented_flatten\"", ")", ":", "# first, get batch_size as scalar tensor", "batch_size", "=", "torch", ".", "prod", "(", "torch", ".", "tensor", "(", "list", "(", "index", ".", "batch_shape", "(", ")", ")",...
[ 1599, 0 ]
[ 1625, 105 ]
python
en
['en', 'error', 'th']
False
range_index_map
(batch_shape, num_segments, name="range_index_map")
Constructs an index map equal to range(num_segments). Args: batch_shape (:obj:`torch.Size`): Batch shape num_segments (:obj:`int`): Number of segments name (:obj:`str`, `optional`, defaults to 'range_index_map'): Name for the operation. Currently not...
Constructs an index map equal to range(num_segments).
def range_index_map(batch_shape, num_segments, name="range_index_map"): """ Constructs an index map equal to range(num_segments). Args: batch_shape (:obj:`torch.Size`): Batch shape num_segments (:obj:`int`): Number of segments name (:obj:`str`, `optional`, de...
[ "def", "range_index_map", "(", "batch_shape", ",", "num_segments", ",", "name", "=", "\"range_index_map\"", ")", ":", "batch_shape", "=", "torch", ".", "as_tensor", "(", "batch_shape", ",", "dtype", "=", "torch", ".", "long", ")", "# create a rank 1 tensor vector ...
[ 1628, 0 ]
[ 1666, 103 ]
python
en
['en', 'error', 'th']
False
_segment_reduce
(values, index, segment_reduce_fn, name)
Applies a segment reduction segment-wise. Args: values (:obj:`torch.Tensor`): Tensor with segment values. index (:obj:`IndexMap`): IndexMap. segment_reduce_fn (:obj:`str`): Name for the reduce operation. One of "sum", "mean", "max" or "min". ...
Applies a segment reduction segment-wise.
def _segment_reduce(values, index, segment_reduce_fn, name): """ Applies a segment reduction segment-wise. Args: values (:obj:`torch.Tensor`): Tensor with segment values. index (:obj:`IndexMap`): IndexMap. segment_reduce_fn (:obj:`str`): Name for ...
[ "def", "_segment_reduce", "(", "values", ",", "index", ",", "segment_reduce_fn", ",", "name", ")", ":", "# Flatten the batch dimensions, as segments ops (scatter) do not support batching.", "# However if `values` has extra dimensions to the right keep them", "# unflattened. Segmented ops...
[ 1669, 0 ]
[ 1717, 38 ]
python
en
['en', 'error', 'th']
False
reduce_sum
(values, index, name="segmented_reduce_sum")
Sums a tensor over its segments. Outputs 0 for empty segments. This operations computes the sum over segments, with support for: - Batching using the first dimensions [B1, B2, ..., Bn]. Each element in a batch can have different indices. - Vectorization using the last dimension [V1, V2, ...
Sums a tensor over its segments.
def reduce_sum(values, index, name="segmented_reduce_sum"): """ Sums a tensor over its segments. Outputs 0 for empty segments. This operations computes the sum over segments, with support for: - Batching using the first dimensions [B1, B2, ..., Bn]. Each element in a batch can have different ...
[ "def", "reduce_sum", "(", "values", ",", "index", ",", "name", "=", "\"segmented_reduce_sum\"", ")", ":", "return", "_segment_reduce", "(", "values", ",", "index", ",", "\"sum\"", ",", "name", ")" ]
[ 1720, 0 ]
[ 1744, 54 ]
python
en
['en', 'error', 'th']
False
reduce_mean
(values, index, name="segmented_reduce_mean")
Averages a tensor over its segments. Outputs 0 for empty segments. This operations computes the mean over segments, with support for: - Batching using the first dimensions [B1, B2, ..., Bn]. Each element in a batch can have different indices. - Vectorization using the last dimension [V1,...
Averages a tensor over its segments.
def reduce_mean(values, index, name="segmented_reduce_mean"): """ Averages a tensor over its segments. Outputs 0 for empty segments. This operations computes the mean over segments, with support for: - Batching using the first dimensions [B1, B2, ..., Bn]. Each element in a batch can have dif...
[ "def", "reduce_mean", "(", "values", ",", "index", ",", "name", "=", "\"segmented_reduce_mean\"", ")", ":", "return", "_segment_reduce", "(", "values", ",", "index", ",", "\"mean\"", ",", "name", ")" ]
[ 1747, 0 ]
[ 1773, 55 ]
python
en
['en', 'error', 'th']
False
reduce_max
(values, index, name="segmented_reduce_max")
Computes the maximum over segments. This operation computes the maximum over segments, with support for: - Batching using the first dimensions [B1, B2, ..., Bn]. Each element in a batch can have different indices. - Vectorization using the last dimension [V1, V2, ...]. If they are present, th...
Computes the maximum over segments.
def reduce_max(values, index, name="segmented_reduce_max"): """ Computes the maximum over segments. This operation computes the maximum over segments, with support for: - Batching using the first dimensions [B1, B2, ..., Bn]. Each element in a batch can have different indices. - Vectorizat...
[ "def", "reduce_max", "(", "values", ",", "index", ",", "name", "=", "\"segmented_reduce_max\"", ")", ":", "return", "_segment_reduce", "(", "values", ",", "index", ",", "\"max\"", ",", "name", ")" ]
[ 1776, 0 ]
[ 1800, 54 ]
python
en
['en', 'error', 'th']
False
reduce_min
(values, index, name="segmented_reduce_min")
Computes the minimum over segments. This operations computes the minimum over segments, with support for: - Batching using the first dimensions [B1, B2, ..., Bn]. Each element in a batch can have different indices. - Vectorization using the last dimension [V1, V2, ...]. If they are present, t...
Computes the minimum over segments.
def reduce_min(values, index, name="segmented_reduce_min"): """ Computes the minimum over segments. This operations computes the minimum over segments, with support for: - Batching using the first dimensions [B1, B2, ..., Bn]. Each element in a batch can have different indices. - Vectoriza...
[ "def", "reduce_min", "(", "values", ",", "index", ",", "name", "=", "\"segmented_reduce_min\"", ")", ":", "return", "_segment_reduce", "(", "values", ",", "index", ",", "\"min\"", ",", "name", ")" ]
[ 1803, 0 ]
[ 1827, 54 ]
python
en
['en', 'error', 'th']
False
compute_column_logits
( sequence_output, column_output_weights, column_output_bias, cell_index, cell_mask, allow_empty_column_selection )
Computes the column logits. Args: sequence_output (:obj:`torch.FloatTensor` of shape :obj:`(batch_size, sequence_length, hidden_size)`): Also known as last_hidden_state. Sequence of hidden-states at the output of the last layer of the model. column_output_weights (:obj:`torch.Float...
Computes the column logits.
def compute_column_logits( sequence_output, column_output_weights, column_output_bias, cell_index, cell_mask, allow_empty_column_selection ): """ Computes the column logits. Args: sequence_output (:obj:`torch.FloatTensor` of shape :obj:`(batch_size, sequence_length, hidden_size)`): ...
[ "def", "compute_column_logits", "(", "sequence_output", ",", "column_output_weights", ",", "column_output_bias", ",", "cell_index", ",", "cell_mask", ",", "allow_empty_column_selection", ")", ":", "# First, compute the token logits (batch_size, seq_len) - without temperature", "tok...
[ 1833, 0 ]
[ 1882, 24 ]
python
en
['en', 'error', 'th']
False
_single_column_cell_selection_loss
(token_logits, column_logits, labels, cell_index, col_index, cell_mask)
Computes the loss for cell selection constrained to a single column. The loss is a hierarchical log-likelihood. The model first predicts a column and then selects cells within that column (conditioned on the column). Cells outside the selected column are never selected. Args: token_logits (:ob...
Computes the loss for cell selection constrained to a single column. The loss is a hierarchical log-likelihood. The model first predicts a column and then selects cells within that column (conditioned on the column). Cells outside the selected column are never selected.
def _single_column_cell_selection_loss(token_logits, column_logits, labels, cell_index, col_index, cell_mask): """ Computes the loss for cell selection constrained to a single column. The loss is a hierarchical log-likelihood. The model first predicts a column and then selects cells within that column (cond...
[ "def", "_single_column_cell_selection_loss", "(", "token_logits", ",", "column_logits", ",", "labels", ",", "cell_index", ",", "col_index", ",", "cell_mask", ")", ":", "# Part 1: column loss", "# First find the column we should select. We use the column with maximum number of selec...
[ 1885, 0 ]
[ 1989, 45 ]
python
en
['en', 'error', 'th']
False
compute_token_logits
(sequence_output, temperature, output_weights, output_bias)
Computes logits per token Args: sequence_output (:obj:`torch.FloatTensor` of shape :obj:`(batch_size, sequence_length, hidden_size)`): Also known as last_hidden_state. Sequence of hidden-states at the output of the last layer of the model. temperature (:obj:`float`): Te...
Computes logits per token
def compute_token_logits(sequence_output, temperature, output_weights, output_bias): """ Computes logits per token Args: sequence_output (:obj:`torch.FloatTensor` of shape :obj:`(batch_size, sequence_length, hidden_size)`): Also known as last_hidden_state. Sequence of hidden-states at t...
[ "def", "compute_token_logits", "(", "sequence_output", ",", "temperature", ",", "output_weights", ",", "output_bias", ")", ":", "logits", "=", "(", "torch", ".", "einsum", "(", "\"bsj,j->bs\"", ",", "sequence_output", ",", "output_weights", ")", "+", "output_bias"...
[ 1992, 0 ]
[ 2011, 17 ]
python
en
['en', 'error', 'th']
False
_calculate_aggregate_mask
(answer, pooled_output, cell_selection_preference, labels, aggregation_classifier)
Finds examples where the model should select cells with no aggregation. Returns a mask that determines for which examples should the model select answers directly from the table, without any aggregation function. If the answer is a piece of text the case is unambiguous as aggregation functions only ap...
Finds examples where the model should select cells with no aggregation.
def _calculate_aggregate_mask(answer, pooled_output, cell_selection_preference, labels, aggregation_classifier): """ Finds examples where the model should select cells with no aggregation. Returns a mask that determines for which examples should the model select answers directly from the table, without ...
[ "def", "_calculate_aggregate_mask", "(", "answer", ",", "pooled_output", ",", "cell_selection_preference", ",", "labels", ",", "aggregation_classifier", ")", ":", "# torch.FloatTensor(batch_size,)", "aggregate_mask_init", "=", "torch", ".", "logical_not", "(", "torch", "....
[ 2014, 0 ]
[ 2062, 25 ]
python
en
['en', 'error', 'th']
False
_calculate_aggregation_loss_known
( logits_aggregation, aggregate_mask, aggregation_labels, use_answer_as_supervision, num_aggregation_labels )
Calculates aggregation loss when its type is known during training. In the weakly supervised setting, the only known information is that for cell selection examples, "no aggregation" should be predicted. For other examples (those that require aggregation), no loss is accumulated. In the setting where ...
Calculates aggregation loss when its type is known during training.
def _calculate_aggregation_loss_known( logits_aggregation, aggregate_mask, aggregation_labels, use_answer_as_supervision, num_aggregation_labels ): """ Calculates aggregation loss when its type is known during training. In the weakly supervised setting, the only known information is that for cell selec...
[ "def", "_calculate_aggregation_loss_known", "(", "logits_aggregation", ",", "aggregate_mask", ",", "aggregation_labels", ",", "use_answer_as_supervision", ",", "num_aggregation_labels", ")", ":", "if", "use_answer_as_supervision", ":", "# Prepare \"no aggregation\" targets for cell...
[ 2065, 0 ]
[ 2110, 51 ]
python
en
['en', 'error', 'th']
False
_calculate_aggregation_loss_unknown
(logits_aggregation, aggregate_mask)
Calculates aggregation loss in the case of answer supervision. Args: logits_aggregation (:obj:`torch.FloatTensor` of shape :obj:`(batch_size, num_aggregation_labels)`): Logits per aggregation operation. aggregate_mask (:obj:`torch.FloatTensor` of shape :obj:`(batch_size, )`): ...
Calculates aggregation loss in the case of answer supervision.
def _calculate_aggregation_loss_unknown(logits_aggregation, aggregate_mask): """ Calculates aggregation loss in the case of answer supervision. Args: logits_aggregation (:obj:`torch.FloatTensor` of shape :obj:`(batch_size, num_aggregation_labels)`): Logits per aggregation operation. ...
[ "def", "_calculate_aggregation_loss_unknown", "(", "logits_aggregation", ",", "aggregate_mask", ")", ":", "dist_aggregation", "=", "torch", ".", "distributions", ".", "categorical", ".", "Categorical", "(", "logits", "=", "logits_aggregation", ")", "# Index 0 correponds t...
[ 2113, 0 ]
[ 2134, 66 ]
python
en
['en', 'error', 'th']
False
_calculate_aggregation_loss
( logits_aggregation, aggregate_mask, aggregation_labels, use_answer_as_supervision, num_aggregation_labels, aggregation_loss_weight, )
Calculates the aggregation loss per example. Args: logits_aggregation (:obj:`torch.FloatTensor` of shape :obj:`(batch_size, num_aggregation_labels)`): Logits per aggregation operation. aggregate_mask (:obj:`torch.FloatTensor` of shape :obj:`(batch_size, )`): A mask set ...
Calculates the aggregation loss per example.
def _calculate_aggregation_loss( logits_aggregation, aggregate_mask, aggregation_labels, use_answer_as_supervision, num_aggregation_labels, aggregation_loss_weight, ): """ Calculates the aggregation loss per example. Args: logits_aggregation (:obj:`torch.FloatTensor` of shap...
[ "def", "_calculate_aggregation_loss", "(", "logits_aggregation", ",", "aggregate_mask", ",", "aggregation_labels", ",", "use_answer_as_supervision", ",", "num_aggregation_labels", ",", "aggregation_loss_weight", ",", ")", ":", "per_example_aggregation_loss", "=", "_calculate_ag...
[ 2137, 0 ]
[ 2172, 65 ]
python
en
['en', 'error', 'th']
False
TapasPreTrainedModel._init_weights
(self, module)
Initialize the weights
Initialize the weights
def _init_weights(self, module): """ Initialize the weights """ if isinstance(module, nn.Linear): # Slightly different from the TF version which uses truncated_normal for initialization # cf https://github.com/pytorch/pytorch/pull/5617 module.weight.data.normal_(mean=...
[ "def", "_init_weights", "(", "self", ",", "module", ")", ":", "if", "isinstance", "(", "module", ",", "nn", ".", "Linear", ")", ":", "# Slightly different from the TF version which uses truncated_normal for initialization", "# cf https://github.com/pytorch/pytorch/pull/5617", ...
[ 700, 4 ]
[ 714, 41 ]
python
en
['en', 'en', 'en']
True
IndexMap.__init__
(self, indices, num_segments, batch_dims=0)
Creates an index Args: indices (:obj:`torch.LongTensor`, same shape as a `values` Tensor to which the indices refer): Tensor containing the indices. num_segments (:obj:`torch.LongTensor`): Scalar tensor, the number of segments. All elements in a ...
Creates an index
def __init__(self, indices, num_segments, batch_dims=0): """ Creates an index Args: indices (:obj:`torch.LongTensor`, same shape as a `values` Tensor to which the indices refer): Tensor containing the indices. num_segments (:obj:`torch.LongTensor`): ...
[ "def", "__init__", "(", "self", ",", "indices", ",", "num_segments", ",", "batch_dims", "=", "0", ")", ":", "self", ".", "indices", "=", "torch", ".", "as_tensor", "(", "indices", ")", "self", ".", "num_segments", "=", "torch", ".", "as_tensor", "(", "...
[ 1495, 4 ]
[ 1512, 36 ]
python
en
['en', 'error', 'th']
False
ProductIndexMap.__init__
(self, outer_index, inner_index)
Combines indices i and j into pairs (i, j). The result is an index where each segment (i, j) is the intersection of segments i and j. For example if the inputs represent table cells indexed by respectively rows and columns the output will be a table indexed by (row, column) pairs, i.e. by cell....
Combines indices i and j into pairs (i, j). The result is an index where each segment (i, j) is the intersection of segments i and j. For example if the inputs represent table cells indexed by respectively rows and columns the output will be a table indexed by (row, column) pairs, i.e. by cell....
def __init__(self, outer_index, inner_index): """ Combines indices i and j into pairs (i, j). The result is an index where each segment (i, j) is the intersection of segments i and j. For example if the inputs represent table cells indexed by respectively rows and columns the output will...
[ "def", "__init__", "(", "self", ",", "outer_index", ",", "inner_index", ")", ":", "if", "outer_index", ".", "batch_dims", "!=", "inner_index", ".", "batch_dims", ":", "raise", "ValueError", "(", "\"outer_index.batch_dims and inner_index.batch_dims must be the same.\"", ...
[ 1521, 4 ]
[ 1544, 38 ]
python
en
['en', 'error', 'th']
False
ProductIndexMap.project_outer
(self, index)
Projects an index with the same index set onto the outer components.
Projects an index with the same index set onto the outer components.
def project_outer(self, index): """Projects an index with the same index set onto the outer components.""" return IndexMap( indices=(index.indices // self.inner_index.num_segments).type(torch.float).floor().type(torch.long), num_segments=self.outer_index.num_segments, ...
[ "def", "project_outer", "(", "self", ",", "index", ")", ":", "return", "IndexMap", "(", "indices", "=", "(", "index", ".", "indices", "//", "self", ".", "inner_index", ".", "num_segments", ")", ".", "type", "(", "torch", ".", "float", ")", ".", "floor"...
[ 1546, 4 ]
[ 1552, 9 ]
python
en
['en', 'en', 'en']
True
ProductIndexMap.project_inner
(self, index)
Projects an index with the same index set onto the inner components.
Projects an index with the same index set onto the inner components.
def project_inner(self, index): """Projects an index with the same index set onto the inner components.""" return IndexMap( indices=torch.fmod(index.indices, self.inner_index.num_segments) .type(torch.float) .floor() .type(torch.long), num_segm...
[ "def", "project_inner", "(", "self", ",", "index", ")", ":", "return", "IndexMap", "(", "indices", "=", "torch", ".", "fmod", "(", "index", ".", "indices", ",", "self", ".", "inner_index", ".", "num_segments", ")", ".", "type", "(", "torch", ".", "floa...
[ 1554, 4 ]
[ 1563, 9 ]
python
en
['en', 'en', 'en']
True
parse_redis_connection_string
(connection_string)
parse a redis connection string, for example: redis://[password]@host:port rediss://[password]@host:port :param connection_string: :return:
parse a redis connection string, for example: redis://[password]
def parse_redis_connection_string(connection_string): """ parse a redis connection string, for example: redis://[password]@host:port rediss://[password]@host:port :param connection_string: :return: """ result = re.match('rediss?:\/\/(.*?)@(.*?):(\d+)', connection_string) return resul...
[ "def", "parse_redis_connection_string", "(", "connection_string", ")", ":", "result", "=", "re", ".", "match", "(", "'rediss?:\\/\\/(.*?)@(.*?):(\\d+)'", ",", "connection_string", ")", "return", "result", ".", "group", "(", "2", ")", ",", "int", "(", "result", "...
[ 2, 0 ]
[ 12, 38 ]
python
en
['en', 'error', 'th']
False
test_create_binary_sensors
(hass)
Test creation of binary_sensors.
Test creation of binary_sensors.
async def test_create_binary_sensors(hass): """Test creation of binary_sensors.""" await async_init_integration(hass) state = hass.states.get("binary_sensor.happy_place_myq_gateway") assert state.state == STATE_ON expected_attributes = {"device_class": "connectivity"} # Only test for a subset ...
[ "async", "def", "test_create_binary_sensors", "(", "hass", ")", ":", "await", "async_init_integration", "(", "hass", ")", "state", "=", "hass", ".", "states", ".", "get", "(", "\"binary_sensor.happy_place_myq_gateway\"", ")", "assert", "state", ".", "state", "==",...
[ 7, 0 ]
[ 19, 5 ]
python
en
['en', 'tg', 'en']
True
setup_platform
(hass, config, add_entities, discovery_info=None)
Set up Eufy bulbs.
Set up Eufy bulbs.
def setup_platform(hass, config, add_entities, discovery_info=None): """Set up Eufy bulbs.""" if discovery_info is None: return add_entities([EufyLight(discovery_info)], True)
[ "def", "setup_platform", "(", "hass", ",", "config", ",", "add_entities", ",", "discovery_info", "=", "None", ")", ":", "if", "discovery_info", "is", "None", ":", "return", "add_entities", "(", "[", "EufyLight", "(", "discovery_info", ")", "]", ",", "True", ...
[ 22, 0 ]
[ 26, 51 ]
python
en
['en', 'ga', 'en']
True
EufyLight.__init__
(self, device)
Initialize the light.
Initialize the light.
def __init__(self, device): """Initialize the light.""" self._temp = None self._brightness = None self._hs = None self._state = None self._name = device["name"] self._address = device["address"] self._code = device["code"] self._type = device["typ...
[ "def", "__init__", "(", "self", ",", "device", ")", ":", "self", ".", "_temp", "=", "None", "self", ".", "_brightness", "=", "None", "self", ".", "_hs", "=", "None", "self", ".", "_state", "=", "None", "self", ".", "_name", "=", "device", "[", "\"n...
[ 32, 4 ]
[ 51, 28 ]
python
en
['en', 'en', 'en']
True
EufyLight.update
(self)
Synchronise state from the bulb.
Synchronise state from the bulb.
def update(self): """Synchronise state from the bulb.""" self._bulb.update() if self._bulb.power: self._brightness = self._bulb.brightness self._temp = self._bulb.temperature if self._bulb.colors: self._colormode = True self._hs...
[ "def", "update", "(", "self", ")", ":", "self", ".", "_bulb", ".", "update", "(", ")", "if", "self", ".", "_bulb", ".", "power", ":", "self", ".", "_brightness", "=", "self", ".", "_bulb", ".", "brightness", "self", ".", "_temp", "=", "self", ".", ...
[ 53, 4 ]
[ 64, 38 ]
python
en
['en', 'en', 'en']
True
EufyLight.unique_id
(self)
Return the ID of this light.
Return the ID of this light.
def unique_id(self): """Return the ID of this light.""" return self._address
[ "def", "unique_id", "(", "self", ")", ":", "return", "self", ".", "_address" ]
[ 67, 4 ]
[ 69, 28 ]
python
en
['en', 'en', 'en']
True
EufyLight.name
(self)
Return the name of the device if any.
Return the name of the device if any.
def name(self): """Return the name of the device if any.""" return self._name
[ "def", "name", "(", "self", ")", ":", "return", "self", ".", "_name" ]
[ 72, 4 ]
[ 74, 25 ]
python
en
['en', 'en', 'en']
True
EufyLight.is_on
(self)
Return true if device is on.
Return true if device is on.
def is_on(self): """Return true if device is on.""" return self._state
[ "def", "is_on", "(", "self", ")", ":", "return", "self", ".", "_state" ]
[ 77, 4 ]
[ 79, 26 ]
python
en
['en', 'fy', 'en']
True
EufyLight.brightness
(self)
Return the brightness of this light between 0..255.
Return the brightness of this light between 0..255.
def brightness(self): """Return the brightness of this light between 0..255.""" return int(self._brightness * 255 / 100)
[ "def", "brightness", "(", "self", ")", ":", "return", "int", "(", "self", ".", "_brightness", "*", "255", "/", "100", ")" ]
[ 82, 4 ]
[ 84, 48 ]
python
en
['en', 'en', 'en']
True
EufyLight.min_mireds
(self)
Return minimum supported color temperature.
Return minimum supported color temperature.
def min_mireds(self): """Return minimum supported color temperature.""" return kelvin_to_mired(EUFY_MAX_KELVIN)
[ "def", "min_mireds", "(", "self", ")", ":", "return", "kelvin_to_mired", "(", "EUFY_MAX_KELVIN", ")" ]
[ 87, 4 ]
[ 89, 47 ]
python
en
['ro', 'la', 'en']
False
EufyLight.max_mireds
(self)
Return maximu supported color temperature.
Return maximu supported color temperature.
def max_mireds(self): """Return maximu supported color temperature.""" return kelvin_to_mired(EUFY_MIN_KELVIN)
[ "def", "max_mireds", "(", "self", ")", ":", "return", "kelvin_to_mired", "(", "EUFY_MIN_KELVIN", ")" ]
[ 92, 4 ]
[ 94, 47 ]
python
en
['en', 'it', 'en']
True
EufyLight.color_temp
(self)
Return the color temperature of this light.
Return the color temperature of this light.
def color_temp(self): """Return the color temperature of this light.""" temp_in_k = int( EUFY_MIN_KELVIN + (self._temp * (EUFY_MAX_KELVIN - EUFY_MIN_KELVIN) / 100) ) return kelvin_to_mired(temp_in_k)
[ "def", "color_temp", "(", "self", ")", ":", "temp_in_k", "=", "int", "(", "EUFY_MIN_KELVIN", "+", "(", "self", ".", "_temp", "*", "(", "EUFY_MAX_KELVIN", "-", "EUFY_MIN_KELVIN", ")", "/", "100", ")", ")", "return", "kelvin_to_mired", "(", "temp_in_k", ")" ...
[ 97, 4 ]
[ 102, 41 ]
python
en
['en', 'en', 'en']
True
EufyLight.hs_color
(self)
Return the color of this light.
Return the color of this light.
def hs_color(self): """Return the color of this light.""" if not self._colormode: return None return self._hs
[ "def", "hs_color", "(", "self", ")", ":", "if", "not", "self", ".", "_colormode", ":", "return", "None", "return", "self", ".", "_hs" ]
[ 105, 4 ]
[ 109, 23 ]
python
en
['en', 'en', 'en']
True
EufyLight.supported_features
(self)
Flag supported features.
Flag supported features.
def supported_features(self): """Flag supported features.""" return self._features
[ "def", "supported_features", "(", "self", ")", ":", "return", "self", ".", "_features" ]
[ 112, 4 ]
[ 114, 29 ]
python
en
['da', 'en', 'en']
True
EufyLight.turn_on
(self, **kwargs)
Turn the specified light on.
Turn the specified light on.
def turn_on(self, **kwargs): """Turn the specified light on.""" brightness = kwargs.get(ATTR_BRIGHTNESS) colortemp = kwargs.get(ATTR_COLOR_TEMP) # pylint: disable=invalid-name hs = kwargs.get(ATTR_HS_COLOR) if brightness is not None: brightness = int(brightne...
[ "def", "turn_on", "(", "self", ",", "*", "*", "kwargs", ")", ":", "brightness", "=", "kwargs", ".", "get", "(", "ATTR_BRIGHTNESS", ")", "colortemp", "=", "kwargs", ".", "get", "(", "ATTR_COLOR_TEMP", ")", "# pylint: disable=invalid-name", "hs", "=", "kwargs"...
[ 116, 4 ]
[ 156, 13 ]
python
en
['en', 'en', 'en']
True
EufyLight.turn_off
(self, **kwargs)
Turn the specified light off.
Turn the specified light off.
def turn_off(self, **kwargs): """Turn the specified light off.""" try: self._bulb.set_state(power=False) except BrokenPipeError: self._bulb.connect() self._bulb.set_state(power=False)
[ "def", "turn_off", "(", "self", ",", "*", "*", "kwargs", ")", ":", "try", ":", "self", ".", "_bulb", ".", "set_state", "(", "power", "=", "False", ")", "except", "BrokenPipeError", ":", "self", ".", "_bulb", ".", "connect", "(", ")", "self", ".", "...
[ 158, 4 ]
[ 164, 45 ]
python
en
['en', 'en', 'en']
True
setup
(request)
Set up patches for pytradfri methods.
Set up patches for pytradfri methods.
def setup(request): """Set up patches for pytradfri methods.""" p_1 = patch( "pytradfri.device.LightControl.raw", new_callable=PropertyMock, return_value=[{"mock": "mock"}], ) p_2 = patch("pytradfri.device.LightControl.lights") p_1.start() p_2.start() def teardown():...
[ "def", "setup", "(", "request", ")", ":", "p_1", "=", "patch", "(", "\"pytradfri.device.LightControl.raw\"", ",", "new_callable", "=", "PropertyMock", ",", "return_value", "=", "[", "{", "\"mock\"", ":", "\"mock\"", "}", "]", ",", ")", "p_2", "=", "patch", ...
[ 78, 0 ]
[ 94, 34 ]
python
en
['en', 'en', 'en']
True
setup_integration
(hass)
Load the Tradfri platform with a mock gateway.
Load the Tradfri platform with a mock gateway.
async def setup_integration(hass): """Load the Tradfri platform with a mock gateway.""" entry = MockConfigEntry( domain=tradfri.DOMAIN, data={ "host": "mock-host", "identity": "mock-identity", "key": "mock-key", "import_groups": True, "...
[ "async", "def", "setup_integration", "(", "hass", ")", ":", "entry", "=", "MockConfigEntry", "(", "domain", "=", "tradfri", ".", "DOMAIN", ",", "data", "=", "{", "\"host\"", ":", "\"mock-host\"", ",", "\"identity\"", ":", "\"mock-identity\"", ",", "\"key\"", ...
[ 102, 0 ]
[ 117, 38 ]
python
en
['en', 'cy', 'en']
True
mock_light
(test_features=None, test_state=None, light_number=0)
Mock a tradfri light.
Mock a tradfri light.
def mock_light(test_features=None, test_state=None, light_number=0): """Mock a tradfri light.""" if test_features is None: test_features = {} if test_state is None: test_state = {} mock_light_data = Mock(**test_state) dev_info_mock = MagicMock() dev_info_mock.manufacturer = "man...
[ "def", "mock_light", "(", "test_features", "=", "None", ",", "test_state", "=", "None", ",", "light_number", "=", "0", ")", ":", "if", "test_features", "is", "None", ":", "test_features", "=", "{", "}", "if", "test_state", "is", "None", ":", "test_state", ...
[ 120, 0 ]
[ 152, 22 ]
python
en
['en', 'mt', 'en']
True
test_light
(hass, mock_gateway, api_factory)
Test that lights are correctly added.
Test that lights are correctly added.
async def test_light(hass, mock_gateway, api_factory): """Test that lights are correctly added.""" features = {"can_set_dimmer": True, "can_set_color": True, "can_set_temp": True} state = { "state": True, "dimmer": 100, "color_temp": 250, "hsb_xy_color": (100, 100, 100, 100,...
[ "async", "def", "test_light", "(", "hass", ",", "mock_gateway", ",", "api_factory", ")", ":", "features", "=", "{", "\"can_set_dimmer\"", ":", "True", ",", "\"can_set_color\"", ":", "True", ",", "\"can_set_temp\"", ":", "True", "}", "state", "=", "{", "\"sta...
[ 155, 0 ]
[ 175, 58 ]
python
en
['en', 'en', 'en']
True
test_light_observed
(hass, mock_gateway, api_factory)
Test that lights are correctly observed.
Test that lights are correctly observed.
async def test_light_observed(hass, mock_gateway, api_factory): """Test that lights are correctly observed.""" light = mock_light() mock_gateway.mock_devices.append(light) await setup_integration(hass) assert len(light.observe.mock_calls) > 0
[ "async", "def", "test_light_observed", "(", "hass", ",", "mock_gateway", ",", "api_factory", ")", ":", "light", "=", "mock_light", "(", ")", "mock_gateway", ".", "mock_devices", ".", "append", "(", "light", ")", "await", "setup_integration", "(", "hass", ")", ...
[ 178, 0 ]
[ 183, 44 ]
python
en
['en', 'en', 'en']
True
test_light_available
(hass, mock_gateway, api_factory)
Test light available property.
Test light available property.
async def test_light_available(hass, mock_gateway, api_factory): """Test light available property.""" light = mock_light({"state": True}, light_number=1) light.reachable = True light2 = mock_light({"state": True}, light_number=2) light2.reachable = False mock_gateway.mock_devices.append(light)...
[ "async", "def", "test_light_available", "(", "hass", ",", "mock_gateway", ",", "api_factory", ")", ":", "light", "=", "mock_light", "(", "{", "\"state\"", ":", "True", "}", ",", "light_number", "=", "1", ")", "light", ".", "reachable", "=", "True", "light2...
[ 186, 0 ]
[ 200, 74 ]
python
en
['fr', 'en', 'en']
True
create_all_turn_on_cases
()
Create all turn on test cases.
Create all turn on test cases.
def create_all_turn_on_cases(): """Create all turn on test cases.""" # Combine TURN_ON_TEST_CASES and TRANSITION_CASES_FOR_TESTS all_turn_on_test_cases = [ ["test_features", "test_data", "expected_result", "device_id"], [], ] index = 1 for test_case in TURN_ON_TEST_CASES: ...
[ "def", "create_all_turn_on_cases", "(", ")", ":", "# Combine TURN_ON_TEST_CASES and TRANSITION_CASES_FOR_TESTS", "all_turn_on_test_cases", "=", "[", "[", "\"test_features\"", ",", "\"test_data\"", ",", "\"expected_result\"", ",", "\"device_id\"", "]", ",", "[", "]", ",", ...
[ 203, 0 ]
[ 220, 33 ]
python
en
['en', 'en', 'en']
True
test_turn_on
( hass, mock_gateway, api_factory, test_features, test_data, expected_result, device_id, )
Test turning on a light.
Test turning on a light.
async def test_turn_on( hass, mock_gateway, api_factory, test_features, test_data, expected_result, device_id, ): """Test turning on a light.""" # Note pytradfri style, not hass. Values not really important. initial_state = { "state": False, "dimmer": 0, "...
[ "async", "def", "test_turn_on", "(", "hass", ",", "mock_gateway", ",", "api_factory", ",", "test_features", ",", "test_data", ",", "expected_result", ",", "device_id", ",", ")", ":", "# Note pytradfri style, not hass. Values not really important.", "initial_state", "=", ...
[ 224, 0 ]
[ 287, 78 ]
python
en
['en', 'en', 'en']
True
test_turn_off
(hass, mock_gateway, api_factory)
Test turning off a light.
Test turning off a light.
async def test_turn_off(hass, mock_gateway, api_factory): """Test turning off a light.""" state = {"state": True, "dimmer": 100} light = mock_light(test_state=state) mock_gateway.mock_devices.append(light) await setup_integration(hass) # Use the turn_off service call to change the light state....
[ "async", "def", "test_turn_off", "(", "hass", ",", "mock_gateway", ",", "api_factory", ")", ":", "state", "=", "{", "\"state\"", ":", "True", ",", "\"dimmer\"", ":", "100", "}", "light", "=", "mock_light", "(", "test_state", "=", "state", ")", "mock_gatewa...
[ 290, 0 ]
[ 327, 32 ]
python
en
['en', 'en', 'en']
True
mock_group
(test_state=None, group_number=0)
Mock a Tradfri group.
Mock a Tradfri group.
def mock_group(test_state=None, group_number=0): """Mock a Tradfri group.""" if test_state is None: test_state = {} default_state = {"state": False, "dimmer": 0} state = {**default_state, **test_state} _mock_group = Mock(member_ids=[], observe=Mock(), **state) _mock_group.name = f"trad...
[ "def", "mock_group", "(", "test_state", "=", "None", ",", "group_number", "=", "0", ")", ":", "if", "test_state", "is", "None", ":", "test_state", "=", "{", "}", "default_state", "=", "{", "\"state\"", ":", "False", ",", "\"dimmer\"", ":", "0", "}", "s...
[ 330, 0 ]
[ 340, 22 ]
python
en
['en', 'ny', 'en']
True
test_group
(hass, mock_gateway, api_factory)
Test that groups are correctly added.
Test that groups are correctly added.
async def test_group(hass, mock_gateway, api_factory): """Test that groups are correctly added.""" mock_gateway.mock_groups.append(mock_group()) state = {"state": True, "dimmer": 100} mock_gateway.mock_groups.append(mock_group(state, 1)) await setup_integration(hass) group = hass.states.get("li...
[ "async", "def", "test_group", "(", "hass", ",", "mock_gateway", ",", "api_factory", ")", ":", "mock_gateway", ".", "mock_groups", ".", "append", "(", "mock_group", "(", ")", ")", "state", "=", "{", "\"state\"", ":", "True", ",", "\"dimmer\"", ":", "100", ...
[ 343, 0 ]
[ 357, 48 ]
python
en
['en', 'en', 'en']
True
test_group_turn_on
(hass, mock_gateway, api_factory)
Test turning on a group.
Test turning on a group.
async def test_group_turn_on(hass, mock_gateway, api_factory): """Test turning on a group.""" group = mock_group() group2 = mock_group(group_number=1) group3 = mock_group(group_number=2) mock_gateway.mock_groups.append(group) mock_gateway.mock_groups.append(group2) mock_gateway.mock_groups.a...
[ "async", "def", "test_group_turn_on", "(", "hass", ",", "mock_gateway", ",", "api_factory", ")", ":", "group", "=", "mock_group", "(", ")", "group2", "=", "mock_group", "(", "group_number", "=", "1", ")", "group3", "=", "mock_group", "(", "group_number", "="...
[ 360, 0 ]
[ 390, 65 ]
python
en
['en', 'en', 'en']
True
test_group_turn_off
(hass, mock_gateway, api_factory)
Test turning off a group.
Test turning off a group.
async def test_group_turn_off(hass, mock_gateway, api_factory): """Test turning off a group.""" group = mock_group({"state": True}) mock_gateway.mock_groups.append(group) await setup_integration(hass) # Use the turn_off service call to change the light state. await hass.services.async_call( ...
[ "async", "def", "test_group_turn_off", "(", "hass", ",", "mock_gateway", ",", "api_factory", ")", ":", "group", "=", "mock_group", "(", "{", "\"state\"", ":", "True", "}", ")", "mock_gateway", ".", "mock_groups", ".", "append", "(", "group", ")", "await", ...
[ 393, 0 ]
[ 405, 41 ]
python
en
['en', 'en', 'en']
True
async_setup_platform
(hass, config, async_add_entities, discovery_info=None)
Set up the openSenseMap air quality platform.
Set up the openSenseMap air quality platform.
async def async_setup_platform(hass, config, async_add_entities, discovery_info=None): """Set up the openSenseMap air quality platform.""" name = config.get(CONF_NAME) station_id = config[CONF_STATION_ID] session = async_get_clientsession(hass) osm_api = OpenSenseMapData(OpenSenseMap(station_id, h...
[ "async", "def", "async_setup_platform", "(", "hass", ",", "config", ",", "async_add_entities", ",", "discovery_info", "=", "None", ")", ":", "name", "=", "config", ".", "get", "(", "CONF_NAME", ")", "station_id", "=", "config", "[", "CONF_STATION_ID", "]", "...
[ 28, 0 ]
[ 45, 74 ]
python
en
['en', 'lb', 'en']
True
OpenSenseMapQuality.__init__
(self, name, osm)
Initialize the air quality entity.
Initialize the air quality entity.
def __init__(self, name, osm): """Initialize the air quality entity.""" self._name = name self._osm = osm
[ "def", "__init__", "(", "self", ",", "name", ",", "osm", ")", ":", "self", ".", "_name", "=", "name", "self", ".", "_osm", "=", "osm" ]
[ 51, 4 ]
[ 54, 23 ]
python
en
['en', 'en', 'en']
True
OpenSenseMapQuality.name
(self)
Return the name of the air quality entity.
Return the name of the air quality entity.
def name(self): """Return the name of the air quality entity.""" return self._name
[ "def", "name", "(", "self", ")", ":", "return", "self", ".", "_name" ]
[ 57, 4 ]
[ 59, 25 ]
python
en
['en', 'en', 'en']
True
OpenSenseMapQuality.particulate_matter_2_5
(self)
Return the particulate matter 2.5 level.
Return the particulate matter 2.5 level.
def particulate_matter_2_5(self): """Return the particulate matter 2.5 level.""" return self._osm.api.pm2_5
[ "def", "particulate_matter_2_5", "(", "self", ")", ":", "return", "self", ".", "_osm", ".", "api", ".", "pm2_5" ]
[ 62, 4 ]
[ 64, 34 ]
python
en
['en', 'en', 'en']
True
OpenSenseMapQuality.particulate_matter_10
(self)
Return the particulate matter 10 level.
Return the particulate matter 10 level.
def particulate_matter_10(self): """Return the particulate matter 10 level.""" return self._osm.api.pm10
[ "def", "particulate_matter_10", "(", "self", ")", ":", "return", "self", ".", "_osm", ".", "api", ".", "pm10" ]
[ 67, 4 ]
[ 69, 33 ]
python
en
['en', 'en', 'en']
True
OpenSenseMapQuality.attribution
(self)
Return the attribution.
Return the attribution.
def attribution(self): """Return the attribution.""" return ATTRIBUTION
[ "def", "attribution", "(", "self", ")", ":", "return", "ATTRIBUTION" ]
[ 72, 4 ]
[ 74, 26 ]
python
en
['en', 'ja', 'en']
True
OpenSenseMapQuality.async_update
(self)
Get the latest data from the openSenseMap API.
Get the latest data from the openSenseMap API.
async def async_update(self): """Get the latest data from the openSenseMap API.""" await self._osm.async_update()
[ "async", "def", "async_update", "(", "self", ")", ":", "await", "self", ".", "_osm", ".", "async_update", "(", ")" ]
[ 76, 4 ]
[ 78, 38 ]
python
en
['en', 'en', 'en']
True
OpenSenseMapData.__init__
(self, api)
Initialize the data object.
Initialize the data object.
def __init__(self, api): """Initialize the data object.""" self.api = api
[ "def", "__init__", "(", "self", ",", "api", ")", ":", "self", ".", "api", "=", "api" ]
[ 84, 4 ]
[ 86, 22 ]
python
en
['en', 'en', 'en']
True
OpenSenseMapData.async_update
(self)
Get the latest data from the Pi-hole.
Get the latest data from the Pi-hole.
async def async_update(self): """Get the latest data from the Pi-hole.""" try: await self.api.get_data() except OpenSenseMapError as err: _LOGGER.error("Unable to fetch data: %s", err)
[ "async", "def", "async_update", "(", "self", ")", ":", "try", ":", "await", "self", ".", "api", ".", "get_data", "(", ")", "except", "OpenSenseMapError", "as", "err", ":", "_LOGGER", ".", "error", "(", "\"Unable to fetch data: %s\"", ",", "err", ")" ]
[ 89, 4 ]
[ 95, 58 ]
python
en
['en', 'en', 'en']
True
entities
(hass)
Initialize the test switch.
Initialize the test switch.
def entities(hass): """Initialize the test switch.""" platform = getattr(hass.components, "test.switch") platform.init() yield platform.ENTITIES
[ "def", "entities", "(", "hass", ")", ":", "platform", "=", "getattr", "(", "hass", ".", "components", ",", "\"test.switch\"", ")", "platform", ".", "init", "(", ")", "yield", "platform", ".", "ENTITIES" ]
[ 12, 0 ]
[ 16, 27 ]
python
en
['en', 'en', 'en']
True
test_methods
(hass, entities)
Test is_on, turn_on, turn_off methods.
Test is_on, turn_on, turn_off methods.
async def test_methods(hass, entities): """Test is_on, turn_on, turn_off methods.""" switch_1, switch_2, switch_3 = entities assert await async_setup_component( hass, switch.DOMAIN, {switch.DOMAIN: {CONF_PLATFORM: "test"}} ) await hass.async_block_till_done() assert switch.is_on(hass, sw...
[ "async", "def", "test_methods", "(", "hass", ",", "entities", ")", ":", "switch_1", ",", "switch_2", ",", "switch_3", "=", "entities", "assert", "await", "async_setup_component", "(", "hass", ",", "switch", ".", "DOMAIN", ",", "{", "switch", ".", "DOMAIN", ...
[ 19, 0 ]
[ 48, 49 ]
python
en
['en', 'et', 'en']
True
test_switch_context
(hass, entities, hass_admin_user)
Test that switch context works.
Test that switch context works.
async def test_switch_context(hass, entities, hass_admin_user): """Test that switch context works.""" assert await async_setup_component(hass, "switch", {"switch": {"platform": "test"}}) await hass.async_block_till_done() state = hass.states.get("switch.ac") assert state is not None await has...
[ "async", "def", "test_switch_context", "(", "hass", ",", "entities", ",", "hass_admin_user", ")", ":", "assert", "await", "async_setup_component", "(", "hass", ",", "\"switch\"", ",", "{", "\"switch\"", ":", "{", "\"platform\"", ":", "\"test\"", "}", "}", ")",...
[ 51, 0 ]
[ 71, 55 ]
python
en
['en', 'en', 'en']
True
test_deprecated_base_class
(caplog)
Test deprecated base class.
Test deprecated base class.
def test_deprecated_base_class(caplog): """Test deprecated base class.""" class CustomSwitch(switch.SwitchDevice): pass CustomSwitch() assert "SwitchDevice is deprecated, modify CustomSwitch" in caplog.text
[ "def", "test_deprecated_base_class", "(", "caplog", ")", ":", "class", "CustomSwitch", "(", "switch", ".", "SwitchDevice", ")", ":", "pass", "CustomSwitch", "(", ")", "assert", "\"SwitchDevice is deprecated, modify CustomSwitch\"", "in", "caplog", ".", "text" ]
[ 74, 0 ]
[ 81, 75 ]
python
en
['en', 'en', 'en']
True
async_setup_platform
(hass, config, async_add_entities, discovery_info=None)
Set up the scenes stored in the LIFX Cloud.
Set up the scenes stored in the LIFX Cloud.
async def async_setup_platform(hass, config, async_add_entities, discovery_info=None): """Set up the scenes stored in the LIFX Cloud.""" token = config.get(CONF_TOKEN) timeout = config.get(CONF_TIMEOUT) headers = {AUTHORIZATION: f"Bearer {token}"} url = "https://api.lifx.com/v1/scenes" try: ...
[ "async", "def", "async_setup_platform", "(", "hass", ",", "config", ",", "async_add_entities", ",", "discovery_info", "=", "None", ")", ":", "token", "=", "config", ".", "get", "(", "CONF_TOKEN", ")", "timeout", "=", "config", ".", "get", "(", "CONF_TIMEOUT"...
[ 34, 0 ]
[ 63, 16 ]
python
en
['en', 'en', 'en']
True