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
store
(hass)
Mock store.
Mock store.
def store(hass): """Mock store.""" return auth_store.AuthStore(hass)
[ "def", "store", "(", "hass", ")", ":", "return", "auth_store", ".", "AuthStore", "(", "hass", ")" ]
[ 12, 0 ]
[ 14, 37 ]
python
en
['en', 'fy', 'en']
False
provider
(hass, store)
Mock provider.
Mock provider.
def provider(hass, store): """Mock provider.""" return tn_auth.TrustedNetworksAuthProvider( hass, store, tn_auth.CONFIG_SCHEMA( { "type": "trusted_networks", "trusted_networks": [ "192.168.0.1", "192.168....
[ "def", "provider", "(", "hass", ",", "store", ")", ":", "return", "tn_auth", ".", "TrustedNetworksAuthProvider", "(", "hass", ",", "store", ",", "tn_auth", ".", "CONFIG_SCHEMA", "(", "{", "\"type\"", ":", "\"trusted_networks\"", ",", "\"trusted_networks\"", ":",...
[ 18, 0 ]
[ 34, 5 ]
python
en
['en', 'sv', 'en']
False
provider_with_user
(hass, store)
Mock provider with trusted users config.
Mock provider with trusted users config.
def provider_with_user(hass, store): """Mock provider with trusted users config.""" return tn_auth.TrustedNetworksAuthProvider( hass, store, tn_auth.CONFIG_SCHEMA( { "type": "trusted_networks", "trusted_networks": [ "192.168...
[ "def", "provider_with_user", "(", "hass", ",", "store", ")", ":", "return", "tn_auth", ".", "TrustedNetworksAuthProvider", "(", "hass", ",", "store", ",", "tn_auth", ".", "CONFIG_SCHEMA", "(", "{", "\"type\"", ":", "\"trusted_networks\"", ",", "\"trusted_networks\...
[ 38, 0 ]
[ 60, 5 ]
python
en
['en', 'en', 'en']
True
provider_bypass_login
(hass, store)
Mock provider with allow_bypass_login config.
Mock provider with allow_bypass_login config.
def provider_bypass_login(hass, store): """Mock provider with allow_bypass_login config.""" return tn_auth.TrustedNetworksAuthProvider( hass, store, tn_auth.CONFIG_SCHEMA( { "type": "trusted_networks", "trusted_networks": [ ...
[ "def", "provider_bypass_login", "(", "hass", ",", "store", ")", ":", "return", "tn_auth", ".", "TrustedNetworksAuthProvider", "(", "hass", ",", "store", ",", "tn_auth", ".", "CONFIG_SCHEMA", "(", "{", "\"type\"", ":", "\"trusted_networks\"", ",", "\"trusted_networ...
[ 64, 0 ]
[ 81, 5 ]
python
en
['en', 'en', 'en']
True
manager
(hass, store, provider)
Mock manager.
Mock manager.
def manager(hass, store, provider): """Mock manager.""" return auth.AuthManager(hass, store, {(provider.type, provider.id): provider}, {})
[ "def", "manager", "(", "hass", ",", "store", ",", "provider", ")", ":", "return", "auth", ".", "AuthManager", "(", "hass", ",", "store", ",", "{", "(", "provider", ".", "type", ",", "provider", ".", "id", ")", ":", "provider", "}", ",", "{", "}", ...
[ 85, 0 ]
[ 87, 86 ]
python
da
['id', 'da', 'en']
False
manager_with_user
(hass, store, provider_with_user)
Mock manager with trusted user.
Mock manager with trusted user.
def manager_with_user(hass, store, provider_with_user): """Mock manager with trusted user.""" return auth.AuthManager( hass, store, {(provider_with_user.type, provider_with_user.id): provider_with_user}, {}, )
[ "def", "manager_with_user", "(", "hass", ",", "store", ",", "provider_with_user", ")", ":", "return", "auth", ".", "AuthManager", "(", "hass", ",", "store", ",", "{", "(", "provider_with_user", ".", "type", ",", "provider_with_user", ".", "id", ")", ":", "...
[ 91, 0 ]
[ 98, 5 ]
python
en
['en', 'en', 'en']
True
manager_bypass_login
(hass, store, provider_bypass_login)
Mock manager with allow bypass login.
Mock manager with allow bypass login.
def manager_bypass_login(hass, store, provider_bypass_login): """Mock manager with allow bypass login.""" return auth.AuthManager( hass, store, {(provider_bypass_login.type, provider_bypass_login.id): provider_bypass_login}, {}, )
[ "def", "manager_bypass_login", "(", "hass", ",", "store", ",", "provider_bypass_login", ")", ":", "return", "auth", ".", "AuthManager", "(", "hass", ",", "store", ",", "{", "(", "provider_bypass_login", ".", "type", ",", "provider_bypass_login", ".", "id", ")"...
[ 102, 0 ]
[ 109, 5 ]
python
en
['en', 'en', 'en']
True
test_trusted_networks_credentials
(manager, provider)
Test trusted_networks credentials related functions.
Test trusted_networks credentials related functions.
async def test_trusted_networks_credentials(manager, provider): """Test trusted_networks credentials related functions.""" owner = await manager.async_create_user("test-owner") tn_owner_cred = await provider.async_get_or_create_credentials({"user": owner.id}) assert tn_owner_cred.is_new is False ass...
[ "async", "def", "test_trusted_networks_credentials", "(", "manager", ",", "provider", ")", ":", "owner", "=", "await", "manager", ".", "async_create_user", "(", "\"test-owner\"", ")", "tn_owner_cred", "=", "await", "provider", ".", "async_get_or_create_credentials", "...
[ 112, 0 ]
[ 126, 80 ]
python
en
['en', 'en', 'en']
True
test_validate_access
(provider)
Test validate access from trusted networks.
Test validate access from trusted networks.
async def test_validate_access(provider): """Test validate access from trusted networks.""" provider.async_validate_access(ip_address("192.168.0.1")) provider.async_validate_access(ip_address("192.168.128.10")) provider.async_validate_access(ip_address("::1")) provider.async_validate_access(ip_addre...
[ "async", "def", "test_validate_access", "(", "provider", ")", ":", "provider", ".", "async_validate_access", "(", "ip_address", "(", "\"192.168.0.1\"", ")", ")", "provider", ".", "async_validate_access", "(", "ip_address", "(", "\"192.168.128.10\"", ")", ")", "provi...
[ 129, 0 ]
[ 141, 76 ]
python
en
['en', 'en', 'en']
True
test_login_flow
(manager, provider)
Test login flow.
Test login flow.
async def test_login_flow(manager, provider): """Test login flow.""" owner = await manager.async_create_user("test-owner") user = await manager.async_create_user("test-user") # not from trusted network flow = await provider.async_login_flow({"ip_address": ip_address("127.0.0.1")}) step = await ...
[ "async", "def", "test_login_flow", "(", "manager", ",", "provider", ")", ":", "owner", "=", "await", "manager", ".", "async_create_user", "(", "\"test-owner\"", ")", "user", "=", "await", "manager", ".", "async_create_user", "(", "\"test-user\"", ")", "# not fro...
[ 144, 0 ]
[ 168, 42 ]
python
en
['en', 'fy', 'en']
True
test_trusted_users_login
(manager_with_user, provider_with_user)
Test available user list changed per different IP.
Test available user list changed per different IP.
async def test_trusted_users_login(manager_with_user, provider_with_user): """Test available user list changed per different IP.""" owner = await manager_with_user.async_create_user("test-owner") sys_user = await manager_with_user.async_create_system_user( "test-sys-user" ) # system user will n...
[ "async", "def", "test_trusted_users_login", "(", "manager_with_user", ",", "provider_with_user", ")", ":", "owner", "=", "await", "manager_with_user", ".", "async_create_user", "(", "\"test-owner\"", ")", "sys_user", "=", "await", "manager_with_user", ".", "async_create...
[ 171, 0 ]
[ 248, 44 ]
python
en
['no', 'en', 'en']
True
test_trusted_group_login
(manager_with_user, provider_with_user)
Test config trusted_user with group_id.
Test config trusted_user with group_id.
async def test_trusted_group_login(manager_with_user, provider_with_user): """Test config trusted_user with group_id.""" owner = await manager_with_user.async_create_user("test-owner") # create a user in user group user = await manager_with_user.async_create_user("test-user") await manager_with_user...
[ "async", "def", "test_trusted_group_login", "(", "manager_with_user", ",", "provider_with_user", ")", ":", "owner", "=", "await", "manager_with_user", ".", "async_create_user", "(", "\"test-owner\"", ")", "# create a user in user group", "user", "=", "await", "manager_wit...
[ 251, 0 ]
[ 302, 36 ]
python
en
['en', 'en', 'en']
True
test_bypass_login_flow
(manager_bypass_login, provider_bypass_login)
Test login flow can be bypass if only one user available.
Test login flow can be bypass if only one user available.
async def test_bypass_login_flow(manager_bypass_login, provider_bypass_login): """Test login flow can be bypass if only one user available.""" owner = await manager_bypass_login.async_create_user("test-owner") # not from trusted network flow = await provider_bypass_login.async_login_flow( {"ip_...
[ "async", "def", "test_bypass_login_flow", "(", "manager_bypass_login", ",", "provider_bypass_login", ")", ":", "owner", "=", "await", "manager_bypass_login", ".", "async_create_user", "(", "\"test-owner\"", ")", "# not from trusted network", "flow", "=", "await", "provide...
[ 305, 0 ]
[ 335, 36 ]
python
en
['en', 'en', 'en']
True
async_setup
(hass: HomeAssistant, config: dict)
Set up the PoolSense component.
Set up the PoolSense component.
async def async_setup(hass: HomeAssistant, config: dict): """Set up the PoolSense component.""" # Make sure coordinator is initialized. hass.data.setdefault(DOMAIN, {}) return True
[ "async", "def", "async_setup", "(", "hass", ":", "HomeAssistant", ",", "config", ":", "dict", ")", ":", "# Make sure coordinator is initialized.", "hass", ".", "data", ".", "setdefault", "(", "DOMAIN", ",", "{", "}", ")", "return", "True" ]
[ 28, 0 ]
[ 32, 15 ]
python
en
['en', 'en', 'en']
True
async_setup_entry
(hass: HomeAssistant, entry: ConfigEntry)
Set up PoolSense from a config entry.
Set up PoolSense from a config entry.
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry): """Set up PoolSense from a config entry.""" poolsense = PoolSense( aiohttp_client.async_get_clientsession(hass), entry.data[CONF_EMAIL], entry.data[CONF_PASSWORD], ) auth_valid = await poolsense.test_poolsense...
[ "async", "def", "async_setup_entry", "(", "hass", ":", "HomeAssistant", ",", "entry", ":", "ConfigEntry", ")", ":", "poolsense", "=", "PoolSense", "(", "aiohttp_client", ".", "async_get_clientsession", "(", "hass", ")", ",", "entry", ".", "data", "[", "CONF_EM...
[ 35, 0 ]
[ 63, 15 ]
python
en
['en', 'en', 'en']
True
async_unload_entry
(hass: HomeAssistant, entry: ConfigEntry)
Unload a config entry.
Unload a config entry.
async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry): """Unload a config entry.""" unload_ok = all( await asyncio.gather( *[ hass.config_entries.async_forward_entry_unload(entry, component) for component in PLATFORMS ] ) ...
[ "async", "def", "async_unload_entry", "(", "hass", ":", "HomeAssistant", ",", "entry", ":", "ConfigEntry", ")", ":", "unload_ok", "=", "all", "(", "await", "asyncio", ".", "gather", "(", "*", "[", "hass", ".", "config_entries", ".", "async_forward_entry_unload...
[ 66, 0 ]
[ 80, 20 ]
python
en
['en', 'es', 'en']
True
PoolSenseEntity.__init__
(self, coordinator, email, info_type)
Initialize poolsense sensor.
Initialize poolsense sensor.
def __init__(self, coordinator, email, info_type): """Initialize poolsense sensor.""" super().__init__(coordinator) self._unique_id = f"{email}-{info_type}" self.info_type = info_type
[ "def", "__init__", "(", "self", ",", "coordinator", ",", "email", ",", "info_type", ")", ":", "super", "(", ")", ".", "__init__", "(", "coordinator", ")", "self", ".", "_unique_id", "=", "f\"{email}-{info_type}\"", "self", ".", "info_type", "=", "info_type" ...
[ 86, 4 ]
[ 90, 34 ]
python
en
['en', 'sq', 'en']
True
PoolSenseEntity.unique_id
(self)
Return a unique id.
Return a unique id.
def unique_id(self): """Return a unique id.""" return self._unique_id
[ "def", "unique_id", "(", "self", ")", ":", "return", "self", ".", "_unique_id" ]
[ 93, 4 ]
[ 95, 30 ]
python
ca
['fr', 'ca', 'en']
False
PoolSenseDataUpdateCoordinator.__init__
(self, hass, entry)
Initialize.
Initialize.
def __init__(self, hass, entry): """Initialize.""" self.poolsense = PoolSense( aiohttp_client.async_get_clientsession(hass), entry.data[CONF_EMAIL], entry.data[CONF_PASSWORD], ) self.hass = hass self.entry = entry super().__init__(hass...
[ "def", "__init__", "(", "self", ",", "hass", ",", "entry", ")", ":", "self", ".", "poolsense", "=", "PoolSense", "(", "aiohttp_client", ".", "async_get_clientsession", "(", "hass", ")", ",", "entry", ".", "data", "[", "CONF_EMAIL", "]", ",", "entry", "."...
[ 101, 4 ]
[ 111, 88 ]
python
en
['en', 'en', 'it']
False
PoolSenseDataUpdateCoordinator._async_update_data
(self)
Update data via library.
Update data via library.
async def _async_update_data(self): """Update data via library.""" data = {} with async_timeout.timeout(10): try: data = await self.poolsense.get_poolsense_data() except (PoolSenseError) as error: _LOGGER.error("PoolSense query did not comp...
[ "async", "def", "_async_update_data", "(", "self", ")", ":", "data", "=", "{", "}", "with", "async_timeout", ".", "timeout", "(", "10", ")", ":", "try", ":", "data", "=", "await", "self", ".", "poolsense", ".", "get_poolsense_data", "(", ")", "except", ...
[ 113, 4 ]
[ 123, 19 ]
python
en
['fr', 'en', 'en']
True
senkin
(soln, atm, T0, X0, if_half=True, dir_raw=None, if_fine=False)
find the ignition process :param mech: mechanism :param p: pressure (Pa) :param T0: temperature (K) of the inlet flow :param T: initial temperature (K) of the reactor :param tau: residence time (s) of the reactor :return reactor:
find the ignition process
def senkin(soln, atm, T0, X0, if_half=True, dir_raw=None, if_fine=False): print 'if_half = '+str(if_half) #if soln.n_species > 100: # verbose=True #else: # verbose=False dT_ign = 400 # if_half=True verbose=True cpu0 = time.time() print '>'*30 print 'senkin for ['+ X0 + '] at '+ str(atm)+'atm' ...
[ "def", "senkin", "(", "soln", ",", "atm", ",", "T0", ",", "X0", ",", "if_half", "=", "True", ",", "dir_raw", "=", "None", ",", "if_fine", "=", "False", ")", ":", "print", "'if_half = '", "+", "str", "(", "if_half", ")", "#if soln.n_species > 100:", "# ...
[ 13, 0 ]
[ 172, 11 ]
python
en
['en', 'error', 'th']
False
JSONEncoder.default
(self, o: Any)
Convert Home Assistant objects. Hand other objects to the original method.
Convert Home Assistant objects.
def default(self, o: Any) -> Any: """Convert Home Assistant objects. Hand other objects to the original method. """ if isinstance(o, datetime): return o.isoformat() if isinstance(o, set): return list(o) if hasattr(o, "as_dict"): return...
[ "def", "default", "(", "self", ",", "o", ":", "Any", ")", "->", "Any", ":", "if", "isinstance", "(", "o", ",", "datetime", ")", ":", "return", "o", ".", "isoformat", "(", ")", "if", "isinstance", "(", "o", ",", "set", ")", ":", "return", "list", ...
[ 9, 4 ]
[ 21, 48 ]
python
en
['fr', 'en', 'en']
True
AttrDict.__setattr__
(self, name, value)
Set attribute.
Set attribute.
def __setattr__(self, name, value): """Set attribute.""" self[name] = value
[ "def", "__setattr__", "(", "self", ",", "name", ",", "value", ")", ":", "self", "[", "name", "]", "=", "value" ]
[ 27, 4 ]
[ 29, 26 ]
python
en
['en', 'la', 'en']
False
AttrDict.__getattr__
(self, item)
Get attribute.
Get attribute.
def __getattr__(self, item): """Get attribute.""" return self[item]
[ "def", "__getattr__", "(", "self", ",", "item", ")", ":", "return", "self", "[", "item", "]" ]
[ 31, 4 ]
[ 33, 25 ]
python
en
['en', 'de', 'en']
False
MockBlackbird.__init__
(self)
Init mock object.
Init mock object.
def __init__(self): """Init mock object.""" self.zones = defaultdict(lambda: AttrDict(power=True, av=1))
[ "def", "__init__", "(", "self", ")", ":", "self", ".", "zones", "=", "defaultdict", "(", "lambda", ":", "AttrDict", "(", "power", "=", "True", ",", "av", "=", "1", ")", ")" ]
[ 39, 4 ]
[ 41, 68 ]
python
en
['pl', 'fy', 'en']
False
MockBlackbird.zone_status
(self, zone_id)
Get zone status.
Get zone status.
def zone_status(self, zone_id): """Get zone status.""" status = self.zones[zone_id] status.zone = zone_id return AttrDict(status)
[ "def", "zone_status", "(", "self", ",", "zone_id", ")", ":", "status", "=", "self", ".", "zones", "[", "zone_id", "]", "status", ".", "zone", "=", "zone_id", "return", "AttrDict", "(", "status", ")" ]
[ 43, 4 ]
[ 47, 31 ]
python
en
['pl', 'la', 'en']
False
MockBlackbird.set_zone_source
(self, zone_id, source_idx)
Set source for zone.
Set source for zone.
def set_zone_source(self, zone_id, source_idx): """Set source for zone.""" self.zones[zone_id].av = source_idx
[ "def", "set_zone_source", "(", "self", ",", "zone_id", ",", "source_idx", ")", ":", "self", ".", "zones", "[", "zone_id", "]", ".", "av", "=", "source_idx" ]
[ 49, 4 ]
[ 51, 43 ]
python
en
['en', 'en', 'en']
True
MockBlackbird.set_zone_power
(self, zone_id, power)
Turn zone on/off.
Turn zone on/off.
def set_zone_power(self, zone_id, power): """Turn zone on/off.""" self.zones[zone_id].power = power
[ "def", "set_zone_power", "(", "self", ",", "zone_id", ",", "power", ")", ":", "self", ".", "zones", "[", "zone_id", "]", ".", "power", "=", "power" ]
[ 53, 4 ]
[ 55, 41 ]
python
en
['nl', 'en', 'en']
True
MockBlackbird.set_all_zone_source
(self, source_idx)
Set source for all zones.
Set source for all zones.
def set_all_zone_source(self, source_idx): """Set source for all zones.""" self.zones[3].av = source_idx
[ "def", "set_all_zone_source", "(", "self", ",", "source_idx", ")", ":", "self", ".", "zones", "[", "3", "]", ".", "av", "=", "source_idx" ]
[ 57, 4 ]
[ 59, 37 ]
python
en
['en', 'en', 'en']
True
TestBlackbirdSchema.test_valid_serial_schema
(self)
Test valid schema.
Test valid schema.
def test_valid_serial_schema(self): """Test valid schema.""" valid_schema = { "platform": "blackbird", "port": "/dev/ttyUSB0", "zones": { 1: {"name": "a"}, 2: {"name": "a"}, 3: {"name": "a"}, 4: {"name": ...
[ "def", "test_valid_serial_schema", "(", "self", ")", ":", "valid_schema", "=", "{", "\"platform\"", ":", "\"blackbird\"", ",", "\"port\"", ":", "\"/dev/ttyUSB0\"", ",", "\"zones\"", ":", "{", "1", ":", "{", "\"name\"", ":", "\"a\"", "}", ",", "2", ":", "{"...
[ 65, 4 ]
[ 91, 37 ]
python
de
['nl', 'de', 'it']
False
TestBlackbirdSchema.test_valid_socket_schema
(self)
Test valid schema.
Test valid schema.
def test_valid_socket_schema(self): """Test valid schema.""" valid_schema = { "platform": "blackbird", "host": "192.168.1.50", "zones": { 1: {"name": "a"}, 2: {"name": "a"}, 3: {"name": "a"}, 4: {"name": ...
[ "def", "test_valid_socket_schema", "(", "self", ")", ":", "valid_schema", "=", "{", "\"platform\"", ":", "\"blackbird\"", ",", "\"host\"", ":", "\"192.168.1.50\"", ",", "\"zones\"", ":", "{", "1", ":", "{", "\"name\"", ":", "\"a\"", "}", ",", "2", ":", "{"...
[ 93, 4 ]
[ 112, 37 ]
python
de
['nl', 'de', 'it']
False
TestBlackbirdSchema.test_invalid_schemas
(self)
Test invalid schemas.
Test invalid schemas.
def test_invalid_schemas(self): """Test invalid schemas.""" schemas = ( {}, # Empty None, # None # Port and host used concurrently { "platform": "blackbird", "port": "/dev/ttyUSB0", "host": "192.168.1.50", ...
[ "def", "test_invalid_schemas", "(", "self", ")", ":", "schemas", "=", "(", "{", "}", ",", "# Empty", "None", ",", "# None", "# Port and host used concurrently", "{", "\"platform\"", ":", "\"blackbird\"", ",", "\"port\"", ":", "\"/dev/ttyUSB0\"", ",", "\"host\"", ...
[ 114, 4 ]
[ 170, 38 ]
python
de
['nl', 'de', 'en']
False
TestBlackbirdMediaPlayer.setUp
(self)
Set up the test case.
Set up the test case.
def setUp(self): """Set up the test case.""" self.blackbird = MockBlackbird() self.hass = tests.common.get_test_home_assistant() self.hass.start() # Note, source dictionary is unsorted! with mock.patch( "homeassistant.components.blackbird.media_player.get_blac...
[ "def", "setUp", "(", "self", ")", ":", "self", ".", "blackbird", "=", "MockBlackbird", "(", ")", "self", ".", "hass", "=", "tests", ".", "common", ".", "get_test_home_assistant", "(", ")", "self", ".", "hass", ".", "start", "(", ")", "# Note, source dict...
[ 176, 4 ]
[ 205, 47 ]
python
en
['en', 'da', 'en']
True
TestBlackbirdMediaPlayer.tear_down_cleanup
(self)
Tear down the test case.
Tear down the test case.
def tear_down_cleanup(self): """Tear down the test case.""" self.hass.stop()
[ "def", "tear_down_cleanup", "(", "self", ")", ":", "self", ".", "hass", ".", "stop", "(", ")" ]
[ 207, 4 ]
[ 209, 24 ]
python
en
['en', 'en', 'en']
True
TestBlackbirdMediaPlayer.test_setup_platform
(self, *args)
Test setting up platform.
Test setting up platform.
def test_setup_platform(self, *args): """Test setting up platform.""" # One service must be registered assert self.hass.services.has_service(DOMAIN, SERVICE_SETALLZONES) assert len(self.hass.data[DATA_BLACKBIRD]) == 1 assert self.hass.data[DATA_BLACKBIRD]["/dev/ttyUSB0-3"].name =...
[ "def", "test_setup_platform", "(", "self", ",", "*", "args", ")", ":", "# One service must be registered", "assert", "self", ".", "hass", ".", "services", ".", "has_service", "(", "DOMAIN", ",", "SERVICE_SETALLZONES", ")", "assert", "len", "(", "self", ".", "h...
[ 211, 4 ]
[ 216, 83 ]
python
en
['en', 'da', 'en']
True
TestBlackbirdMediaPlayer.test_setallzones_service_call_with_entity_id
(self)
Test set all zone source service call with entity id.
Test set all zone source service call with entity id.
def test_setallzones_service_call_with_entity_id(self): """Test set all zone source service call with entity id.""" self.media_player.update() assert "Zone name" == self.media_player.name assert STATE_ON == self.media_player.state assert "one" == self.media_player.source ...
[ "def", "test_setallzones_service_call_with_entity_id", "(", "self", ")", ":", "self", ".", "media_player", ".", "update", "(", ")", "assert", "\"Zone name\"", "==", "self", ".", "media_player", ".", "name", "assert", "STATE_ON", "==", "self", ".", "media_player", ...
[ 218, 4 ]
[ 236, 50 ]
python
en
['en', 'en', 'en']
True
TestBlackbirdMediaPlayer.test_setallzones_service_call_without_entity_id
(self)
Test set all zone source service call without entity id.
Test set all zone source service call without entity id.
def test_setallzones_service_call_without_entity_id(self): """Test set all zone source service call without entity id.""" self.media_player.update() assert "Zone name" == self.media_player.name assert STATE_ON == self.media_player.state assert "one" == self.media_player.source ...
[ "def", "test_setallzones_service_call_without_entity_id", "(", "self", ")", ":", "self", ".", "media_player", ".", "update", "(", ")", "assert", "\"Zone name\"", "==", "self", ".", "media_player", ".", "name", "assert", "STATE_ON", "==", "self", ".", "media_player...
[ 238, 4 ]
[ 253, 50 ]
python
en
['en', 'en', 'en']
True
TestBlackbirdMediaPlayer.test_update
(self)
Test updating values from blackbird.
Test updating values from blackbird.
def test_update(self): """Test updating values from blackbird.""" assert self.media_player.state is None assert self.media_player.source is None self.media_player.update() assert STATE_ON == self.media_player.state assert "one" == self.media_player.source
[ "def", "test_update", "(", "self", ")", ":", "assert", "self", ".", "media_player", ".", "state", "is", "None", "assert", "self", ".", "media_player", ".", "source", "is", "None", "self", ".", "media_player", ".", "update", "(", ")", "assert", "STATE_ON", ...
[ 255, 4 ]
[ 263, 48 ]
python
en
['en', 'en', 'en']
True
TestBlackbirdMediaPlayer.test_name
(self)
Test name property.
Test name property.
def test_name(self): """Test name property.""" assert "Zone name" == self.media_player.name
[ "def", "test_name", "(", "self", ")", ":", "assert", "\"Zone name\"", "==", "self", ".", "media_player", ".", "name" ]
[ 265, 4 ]
[ 267, 52 ]
python
en
['en', 'en', 'en']
True
TestBlackbirdMediaPlayer.test_state
(self)
Test state property.
Test state property.
def test_state(self): """Test state property.""" assert self.media_player.state is None self.media_player.update() assert STATE_ON == self.media_player.state self.blackbird.zones[3].power = False self.media_player.update() assert STATE_OFF == self.media_player.s...
[ "def", "test_state", "(", "self", ")", ":", "assert", "self", ".", "media_player", ".", "state", "is", "None", "self", ".", "media_player", ".", "update", "(", ")", "assert", "STATE_ON", "==", "self", ".", "media_player", ".", "state", "self", ".", "blac...
[ 269, 4 ]
[ 278, 51 ]
python
en
['en', 'en', 'en']
True
TestBlackbirdMediaPlayer.test_supported_features
(self)
Test supported features property.
Test supported features property.
def test_supported_features(self): """Test supported features property.""" assert ( SUPPORT_TURN_ON | SUPPORT_TURN_OFF | SUPPORT_SELECT_SOURCE == self.media_player.supported_features )
[ "def", "test_supported_features", "(", "self", ")", ":", "assert", "(", "SUPPORT_TURN_ON", "|", "SUPPORT_TURN_OFF", "|", "SUPPORT_SELECT_SOURCE", "==", "self", ".", "media_player", ".", "supported_features", ")" ]
[ 280, 4 ]
[ 285, 9 ]
python
en
['en', 'en', 'en']
True
TestBlackbirdMediaPlayer.test_source
(self)
Test source property.
Test source property.
def test_source(self): """Test source property.""" assert self.media_player.source is None self.media_player.update() assert "one" == self.media_player.source
[ "def", "test_source", "(", "self", ")", ":", "assert", "self", ".", "media_player", ".", "source", "is", "None", "self", ".", "media_player", ".", "update", "(", ")", "assert", "\"one\"", "==", "self", ".", "media_player", ".", "source" ]
[ 287, 4 ]
[ 291, 48 ]
python
en
['fr', 'en', 'en']
True
TestBlackbirdMediaPlayer.test_media_title
(self)
Test media title property.
Test media title property.
def test_media_title(self): """Test media title property.""" assert self.media_player.media_title is None self.media_player.update() assert "one" == self.media_player.media_title
[ "def", "test_media_title", "(", "self", ")", ":", "assert", "self", ".", "media_player", ".", "media_title", "is", "None", "self", ".", "media_player", ".", "update", "(", ")", "assert", "\"one\"", "==", "self", ".", "media_player", ".", "media_title" ]
[ 293, 4 ]
[ 297, 53 ]
python
da
['fr', 'da', 'en']
False
TestBlackbirdMediaPlayer.test_source_list
(self)
Test source list property.
Test source list property.
def test_source_list(self): """Test source list property.""" # Note, the list is sorted! assert ["one", "two", "three"] == self.media_player.source_list
[ "def", "test_source_list", "(", "self", ")", ":", "# Note, the list is sorted!", "assert", "[", "\"one\"", ",", "\"two\"", ",", "\"three\"", "]", "==", "self", ".", "media_player", ".", "source_list" ]
[ 299, 4 ]
[ 302, 71 ]
python
en
['fr', 'en', 'en']
True
TestBlackbirdMediaPlayer.test_select_source
(self)
Test source selection methods.
Test source selection methods.
def test_select_source(self): """Test source selection methods.""" self.media_player.update() assert "one" == self.media_player.source self.media_player.select_source("two") assert 2 == self.blackbird.zones[3].av self.media_player.update() assert "two" == self.m...
[ "def", "test_select_source", "(", "self", ")", ":", "self", ".", "media_player", ".", "update", "(", ")", "assert", "\"one\"", "==", "self", ".", "media_player", ".", "source", "self", ".", "media_player", ".", "select_source", "(", "\"two\"", ")", "assert",...
[ 304, 4 ]
[ 319, 48 ]
python
en
['fr', 'en', 'en']
True
TestBlackbirdMediaPlayer.test_turn_on
(self)
Testing turning on the zone.
Testing turning on the zone.
def test_turn_on(self): """Testing turning on the zone.""" self.blackbird.zones[3].power = False self.media_player.update() assert STATE_OFF == self.media_player.state self.media_player.turn_on() assert self.blackbird.zones[3].power self.media_player.update() ...
[ "def", "test_turn_on", "(", "self", ")", ":", "self", ".", "blackbird", ".", "zones", "[", "3", "]", ".", "power", "=", "False", "self", ".", "media_player", ".", "update", "(", ")", "assert", "STATE_OFF", "==", "self", ".", "media_player", ".", "state...
[ 321, 4 ]
[ 330, 50 ]
python
en
['en', 'en', 'en']
True
TestBlackbirdMediaPlayer.test_turn_off
(self)
Testing turning off the zone.
Testing turning off the zone.
def test_turn_off(self): """Testing turning off the zone.""" self.blackbird.zones[3].power = True self.media_player.update() assert STATE_ON == self.media_player.state self.media_player.turn_off() assert not self.blackbird.zones[3].power self.media_player.update(...
[ "def", "test_turn_off", "(", "self", ")", ":", "self", ".", "blackbird", ".", "zones", "[", "3", "]", ".", "power", "=", "True", "self", ".", "media_player", ".", "update", "(", ")", "assert", "STATE_ON", "==", "self", ".", "media_player", ".", "state"...
[ 332, 4 ]
[ 341, 51 ]
python
en
['en', 'en', 'en']
True
test_form
(hass)
Test we get the form.
Test we get the form.
async def test_form(hass): """Test we get the form.""" await setup.async_setup_component(hass, "persistent_notification", {}) result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": config_entries.SOURCE_USER} ) assert result["type"] == "form" assert result["errors...
[ "async", "def", "test_form", "(", "hass", ")", ":", "await", "setup", ".", "async_setup_component", "(", "hass", ",", "\"persistent_notification\"", ",", "{", "}", ")", "result", "=", "await", "hass", ".", "config_entries", ".", "flow", ".", "async_init", "(...
[ 15, 0 ]
[ 43, 41 ]
python
en
['en', 'en', 'en']
True
test_form_error
(hass: HomeAssistant, exc: Exception, base_error: str)
Test form errors.
Test form errors.
async def test_form_error(hass: HomeAssistant, exc: Exception, base_error: str): """Test form errors.""" result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": config_entries.SOURCE_USER} ) with patch.object(AylaApi, "async_sign_in", side_effect=exc): result2 = a...
[ "async", "def", "test_form_error", "(", "hass", ":", "HomeAssistant", ",", "exc", ":", "Exception", ",", "base_error", ":", "str", ")", ":", "result", "=", "await", "hass", ".", "config_entries", ".", "flow", ".", "async_init", "(", "DOMAIN", ",", "context...
[ 54, 0 ]
[ 67, 54 ]
python
de
['de', 'ko', 'en']
False
test_reauth_success
(hass: HomeAssistant)
Test reauth flow.
Test reauth flow.
async def test_reauth_success(hass: HomeAssistant): """Test reauth flow.""" with patch("sharkiqpy.AylaApi.async_sign_in", return_value=True): mock_config = MockConfigEntry(domain=DOMAIN, unique_id=UNIQUE_ID, data=CONFIG) mock_config.add_to_hass(hass) result = await hass.config_entries.f...
[ "async", "def", "test_reauth_success", "(", "hass", ":", "HomeAssistant", ")", ":", "with", "patch", "(", "\"sharkiqpy.AylaApi.async_sign_in\"", ",", "return_value", "=", "True", ")", ":", "mock_config", "=", "MockConfigEntry", "(", "domain", "=", "DOMAIN", ",", ...
[ 70, 0 ]
[ 81, 54 ]
python
en
['en', 'fr', 'en']
True
test_reauth
( hass: HomeAssistant, side_effect: Exception, result_type: str, msg_field: str, msg: str, )
Test reauth failures.
Test reauth failures.
async def test_reauth( hass: HomeAssistant, side_effect: Exception, result_type: str, msg_field: str, msg: str, ): """Test reauth failures.""" with patch("sharkiqpy.AylaApi.async_sign_in", side_effect=side_effect): result = await hass.config_entries.flow.async_init( DOMAI...
[ "async", "def", "test_reauth", "(", "hass", ":", "HomeAssistant", ",", "side_effect", ":", "Exception", ",", "result_type", ":", "str", ",", "msg_field", ":", "str", ",", "msg", ":", "str", ",", ")", ":", "with", "patch", "(", "\"sharkiqpy.AylaApi.async_sign...
[ 92, 0 ]
[ 112, 31 ]
python
en
['ms', 'gd', 'en']
False
async_setup_entry_base
( hass: HomeAssistant, config_entry: ConfigEntry, async_add_entities: Callable, platform: str, entity_from_device: Callable, )
Record the async_add_entities function to add them later when received from Dynalite.
Record the async_add_entities function to add them later when received from Dynalite.
def async_setup_entry_base( hass: HomeAssistant, config_entry: ConfigEntry, async_add_entities: Callable, platform: str, entity_from_device: Callable, ) -> None: """Record the async_add_entities function to add them later when received from Dynalite.""" LOGGER.debug("Setting up %s entry = %s...
[ "def", "async_setup_entry_base", "(", "hass", ":", "HomeAssistant", ",", "config_entry", ":", "ConfigEntry", ",", "async_add_entities", ":", "Callable", ",", "platform", ":", "str", ",", "entity_from_device", ":", "Callable", ",", ")", "->", "None", ":", "LOGGER...
[ 12, 0 ]
[ 32, 70 ]
python
en
['en', 'en', 'en']
True
DynaliteBase.__init__
(self, device: Any, bridge: DynaliteBridge)
Initialize the base class.
Initialize the base class.
def __init__(self, device: Any, bridge: DynaliteBridge) -> None: """Initialize the base class.""" self._device = device self._bridge = bridge self._unsub_dispatchers = []
[ "def", "__init__", "(", "self", ",", "device", ":", "Any", ",", "bridge", ":", "DynaliteBridge", ")", "->", "None", ":", "self", ".", "_device", "=", "device", "self", ".", "_bridge", "=", "bridge", "self", ".", "_unsub_dispatchers", "=", "[", "]" ]
[ 38, 4 ]
[ 42, 36 ]
python
en
['en', 'en', 'en']
True
DynaliteBase.name
(self)
Return the name of the entity.
Return the name of the entity.
def name(self) -> str: """Return the name of the entity.""" return self._device.name
[ "def", "name", "(", "self", ")", "->", "str", ":", "return", "self", ".", "_device", ".", "name" ]
[ 45, 4 ]
[ 47, 32 ]
python
en
['en', 'en', 'en']
True
DynaliteBase.unique_id
(self)
Return the unique ID of the entity.
Return the unique ID of the entity.
def unique_id(self) -> str: """Return the unique ID of the entity.""" return self._device.unique_id
[ "def", "unique_id", "(", "self", ")", "->", "str", ":", "return", "self", ".", "_device", ".", "unique_id" ]
[ 50, 4 ]
[ 52, 37 ]
python
en
['en', 'en', 'en']
True
DynaliteBase.available
(self)
Return if entity is available.
Return if entity is available.
def available(self) -> bool: """Return if entity is available.""" return self._device.available
[ "def", "available", "(", "self", ")", "->", "bool", ":", "return", "self", ".", "_device", ".", "available" ]
[ 55, 4 ]
[ 57, 37 ]
python
en
['en', 'en', 'en']
True
DynaliteBase.device_info
(self)
Device info for this entity.
Device info for this entity.
def device_info(self) -> Dict[str, Any]: """Device info for this entity.""" return { "identifiers": {(DOMAIN, self._device.unique_id)}, "name": self.name, "manufacturer": "Dynalite", }
[ "def", "device_info", "(", "self", ")", "->", "Dict", "[", "str", ",", "Any", "]", ":", "return", "{", "\"identifiers\"", ":", "{", "(", "DOMAIN", ",", "self", ".", "_device", ".", "unique_id", ")", "}", ",", "\"name\"", ":", "self", ".", "name", "...
[ 60, 4 ]
[ 66, 9 ]
python
en
['en', 'en', 'en']
True
DynaliteBase.async_added_to_hass
(self)
Added to hass so need to register to dispatch.
Added to hass so need to register to dispatch.
async def async_added_to_hass(self) -> None: """Added to hass so need to register to dispatch.""" # register for device specific update self._unsub_dispatchers.append( async_dispatcher_connect( self.hass, self._bridge.update_signal(self._device), ...
[ "async", "def", "async_added_to_hass", "(", "self", ")", "->", "None", ":", "# register for device specific update", "self", ".", "_unsub_dispatchers", ".", "append", "(", "async_dispatcher_connect", "(", "self", ".", "hass", ",", "self", ".", "_bridge", ".", "upd...
[ 68, 4 ]
[ 85, 9 ]
python
en
['en', 'en', 'en']
True
DynaliteBase.async_will_remove_from_hass
(self)
Unregister signal dispatch listeners when being removed.
Unregister signal dispatch listeners when being removed.
async def async_will_remove_from_hass(self) -> None: """Unregister signal dispatch listeners when being removed.""" for unsub in self._unsub_dispatchers: unsub() self._unsub_dispatchers = []
[ "async", "def", "async_will_remove_from_hass", "(", "self", ")", "->", "None", ":", "for", "unsub", "in", "self", ".", "_unsub_dispatchers", ":", "unsub", "(", ")", "self", ".", "_unsub_dispatchers", "=", "[", "]" ]
[ 87, 4 ]
[ 91, 36 ]
python
en
['en', 'en', 'en']
True
SequenceFeatureExtractor.pad
( self, processed_features: Union[ BatchFeature, List[BatchFeature], Dict[str, BatchFeature], Dict[str, List[BatchFeature]], List[Dict[str, BatchFeature]], ], padding: Union[bool, str, PaddingStrategy] = True, max_length...
Pad input values / input vectors or a batch of input values / input vectors up to predefined length or to the max sequence length in the batch. Padding side (left/right) padding values are defined at the feature extractor level (with ``self.padding_side``, ``self.padding_value``) ...
Pad input values / input vectors or a batch of input values / input vectors up to predefined length or to the max sequence length in the batch.
def pad( self, processed_features: Union[ BatchFeature, List[BatchFeature], Dict[str, BatchFeature], Dict[str, List[BatchFeature]], List[Dict[str, BatchFeature]], ], padding: Union[bool, str, PaddingStrategy] = True, max...
[ "def", "pad", "(", "self", ",", "processed_features", ":", "Union", "[", "BatchFeature", ",", "List", "[", "BatchFeature", "]", ",", "Dict", "[", "str", ",", "BatchFeature", "]", ",", "Dict", "[", "str", ",", "List", "[", "BatchFeature", "]", "]", ",",...
[ 66, 4 ]
[ 224, 70 ]
python
en
['en', 'error', 'th']
False
SequenceFeatureExtractor._pad
( self, processed_features: Union[Dict[str, List[float]], BatchFeature], max_length: Optional[int] = None, padding_strategy: PaddingStrategy = PaddingStrategy.DO_NOT_PAD, pad_to_multiple_of: Optional[int] = None, return_attention_mask: Optional[bool] = None, )
Pad inputs (on left/right and up to predefined length or max length in the batch) Args: processed_features: Dictionary of input values (`List[float]`) / input vectors (`List[List[float]]`) or batch of inputs values (`List[List[int]]`) / input vectors (`List[List[List[int]]]`) m...
Pad inputs (on left/right and up to predefined length or max length in the batch)
def _pad( self, processed_features: Union[Dict[str, List[float]], BatchFeature], max_length: Optional[int] = None, padding_strategy: PaddingStrategy = PaddingStrategy.DO_NOT_PAD, pad_to_multiple_of: Optional[int] = None, return_attention_mask: Optional[bool] = None, )...
[ "def", "_pad", "(", "self", ",", "processed_features", ":", "Union", "[", "Dict", "[", "str", ",", "List", "[", "float", "]", "]", ",", "BatchFeature", "]", ",", "max_length", ":", "Optional", "[", "int", "]", "=", "None", ",", "padding_strategy", ":",...
[ 226, 4 ]
[ 284, 33 ]
python
en
['en', 'error', 'th']
False
SequenceFeatureExtractor._get_padding_strategies
(self, padding=False, max_length=None, pad_to_multiple_of=None, **kwargs)
Find the correct padding strategy
Find the correct padding strategy
def _get_padding_strategies(self, padding=False, max_length=None, pad_to_multiple_of=None, **kwargs): """ Find the correct padding strategy """ # Get padding strategy if padding is not False: if padding is True: padding_strategy = PaddingStrategy.LONG...
[ "def", "_get_padding_strategies", "(", "self", ",", "padding", "=", "False", ",", "max_length", "=", "None", ",", "pad_to_multiple_of", "=", "None", ",", "*", "*", "kwargs", ")", ":", "# Get padding strategy", "if", "padding", "is", "not", "False", ":", "if"...
[ 286, 4 ]
[ 316, 51 ]
python
en
['en', 'error', 'th']
False
setup_platform
(hass, config, add_entities, discovery_info=None)
Set up the Touchline devices.
Set up the Touchline devices.
def setup_platform(hass, config, add_entities, discovery_info=None): """Set up the Touchline devices.""" host = config[CONF_HOST] py_touchline = PyTouchline() number_of_devices = int(py_touchline.get_number_of_devices(host)) devices = [] for device_id in range(0, number_of_devices): dev...
[ "def", "setup_platform", "(", "hass", ",", "config", ",", "add_entities", ",", "discovery_info", "=", "None", ")", ":", "host", "=", "config", "[", "CONF_HOST", "]", "py_touchline", "=", "PyTouchline", "(", ")", "number_of_devices", "=", "int", "(", "py_touc...
[ 32, 0 ]
[ 41, 31 ]
python
en
['en', 'en', 'en']
True
Touchline.__init__
(self, touchline_thermostat)
Initialize the Touchline device.
Initialize the Touchline device.
def __init__(self, touchline_thermostat): """Initialize the Touchline device.""" self.unit = touchline_thermostat self._name = None self._current_temperature = None self._target_temperature = None self._current_operation_mode = None self._preset_mode = None
[ "def", "__init__", "(", "self", ",", "touchline_thermostat", ")", ":", "self", ".", "unit", "=", "touchline_thermostat", "self", ".", "_name", "=", "None", "self", ".", "_current_temperature", "=", "None", "self", ".", "_target_temperature", "=", "None", "self...
[ 47, 4 ]
[ 54, 32 ]
python
en
['en', 'en', 'en']
True
Touchline.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.""" return SUPPORT_FLAGS
[ "def", "supported_features", "(", "self", ")", ":", "return", "SUPPORT_FLAGS" ]
[ 57, 4 ]
[ 59, 28 ]
python
en
['en', 'en', 'en']
True
Touchline.update
(self)
Update thermostat attributes.
Update thermostat attributes.
def update(self): """Update thermostat attributes.""" self.unit.update() self._name = self.unit.get_name() self._current_temperature = self.unit.get_current_temperature() self._target_temperature = self.unit.get_target_temperature() self._preset_mode = TOUCHLINE_HA_PRESET...
[ "def", "update", "(", "self", ")", ":", "self", ".", "unit", ".", "update", "(", ")", "self", ".", "_name", "=", "self", ".", "unit", ".", "get_name", "(", ")", "self", ".", "_current_temperature", "=", "self", ".", "unit", ".", "get_current_temperatur...
[ 61, 4 ]
[ 69, 9 ]
python
en
['en', 'en', 'en']
True
Touchline.hvac_mode
(self)
Return current HVAC mode. Need to be one of HVAC_MODE_*.
Return current HVAC mode.
def hvac_mode(self): """Return current HVAC mode. Need to be one of HVAC_MODE_*. """ return HVAC_MODE_HEAT
[ "def", "hvac_mode", "(", "self", ")", ":", "return", "HVAC_MODE_HEAT" ]
[ 72, 4 ]
[ 77, 29 ]
python
en
['en', 'co', 'en']
True
Touchline.hvac_modes
(self)
Return list of possible operation modes.
Return list of possible operation modes.
def hvac_modes(self): """Return list of possible operation modes.""" return [HVAC_MODE_HEAT]
[ "def", "hvac_modes", "(", "self", ")", ":", "return", "[", "HVAC_MODE_HEAT", "]" ]
[ 80, 4 ]
[ 82, 31 ]
python
en
['en', 'en', 'en']
True
Touchline.should_poll
(self)
Return the polling state.
Return the polling state.
def should_poll(self): """Return the polling state.""" return True
[ "def", "should_poll", "(", "self", ")", ":", "return", "True" ]
[ 85, 4 ]
[ 87, 19 ]
python
en
['en', 'en', 'en']
True
Touchline.name
(self)
Return the name of the climate device.
Return the name of the climate device.
def name(self): """Return the name of the climate device.""" return self._name
[ "def", "name", "(", "self", ")", ":", "return", "self", ".", "_name" ]
[ 90, 4 ]
[ 92, 25 ]
python
en
['en', 'en', 'en']
True
Touchline.temperature_unit
(self)
Return the unit of measurement.
Return the unit of measurement.
def temperature_unit(self): """Return the unit of measurement.""" return TEMP_CELSIUS
[ "def", "temperature_unit", "(", "self", ")", ":", "return", "TEMP_CELSIUS" ]
[ 95, 4 ]
[ 97, 27 ]
python
en
['en', 'la', 'en']
True
Touchline.current_temperature
(self)
Return the current temperature.
Return the current temperature.
def current_temperature(self): """Return the current temperature.""" return self._current_temperature
[ "def", "current_temperature", "(", "self", ")", ":", "return", "self", ".", "_current_temperature" ]
[ 100, 4 ]
[ 102, 40 ]
python
en
['en', 'la', 'en']
True
Touchline.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._target_temperature
[ "def", "target_temperature", "(", "self", ")", ":", "return", "self", ".", "_target_temperature" ]
[ 105, 4 ]
[ 107, 39 ]
python
en
['en', 'en', 'en']
True
Touchline.preset_mode
(self)
Return the current preset mode.
Return the current preset mode.
def preset_mode(self): """Return the current preset mode.""" return self._preset_mode
[ "def", "preset_mode", "(", "self", ")", ":", "return", "self", ".", "_preset_mode" ]
[ 110, 4 ]
[ 112, 32 ]
python
en
['en', 'en', 'en']
True
Touchline.preset_modes
(self)
Return available preset modes.
Return available preset modes.
def preset_modes(self): """Return available preset modes.""" return list(PRESET_MODES)
[ "def", "preset_modes", "(", "self", ")", ":", "return", "list", "(", "PRESET_MODES", ")" ]
[ 115, 4 ]
[ 117, 33 ]
python
en
['fr', 'en', 'en']
True
Touchline.set_preset_mode
(self, preset_mode)
Set new target preset mode.
Set new target preset mode.
def set_preset_mode(self, preset_mode): """Set new target preset mode.""" self.unit.set_operation_mode(PRESET_MODES[preset_mode]["mode"]) self.unit.set_week_program(PRESET_MODES[preset_mode]["program"])
[ "def", "set_preset_mode", "(", "self", ",", "preset_mode", ")", ":", "self", ".", "unit", ".", "set_operation_mode", "(", "PRESET_MODES", "[", "preset_mode", "]", "[", "\"mode\"", "]", ")", "self", ".", "unit", ".", "set_week_program", "(", "PRESET_MODES", "...
[ 119, 4 ]
[ 122, 72 ]
python
de
['de', 'su', 'en']
False
Touchline.set_hvac_mode
(self, hvac_mode)
Set new target hvac mode.
Set new target hvac mode.
def set_hvac_mode(self, hvac_mode): """Set new target hvac mode.""" self._current_operation_mode = HVAC_MODE_HEAT
[ "def", "set_hvac_mode", "(", "self", ",", "hvac_mode", ")", ":", "self", ".", "_current_operation_mode", "=", "HVAC_MODE_HEAT" ]
[ 124, 4 ]
[ 126, 53 ]
python
da
['da', 'su', 'en']
False
Touchline.set_temperature
(self, **kwargs)
Set new target temperature.
Set new target temperature.
def set_temperature(self, **kwargs): """Set new target temperature.""" if kwargs.get(ATTR_TEMPERATURE) is not None: self._target_temperature = kwargs.get(ATTR_TEMPERATURE) self.unit.set_target_temperature(self._target_temperature)
[ "def", "set_temperature", "(", "self", ",", "*", "*", "kwargs", ")", ":", "if", "kwargs", ".", "get", "(", "ATTR_TEMPERATURE", ")", "is", "not", "None", ":", "self", ".", "_target_temperature", "=", "kwargs", ".", "get", "(", "ATTR_TEMPERATURE", ")", "se...
[ 128, 4 ]
[ 132, 66 ]
python
en
['en', 'ca', 'en']
True
_close_enough
(actual_rgb, testing_rgb)
Validate the given RGB value is in acceptable tolerance.
Validate the given RGB value is in acceptable tolerance.
def _close_enough(actual_rgb, testing_rgb): """Validate the given RGB value is in acceptable tolerance.""" # Convert the given RGB values to hue / saturation and then back again # as it wasn't reading the same RGB value set against it. actual_hs = color_util.color_RGB_to_hs(*actual_rgb) actual_rgb =...
[ "def", "_close_enough", "(", "actual_rgb", ",", "testing_rgb", ")", ":", "# Convert the given RGB values to hue / saturation and then back again", "# as it wasn't reading the same RGB value set against it.", "actual_hs", "=", "color_util", ".", "color_RGB_to_hs", "(", "*", "actual_...
[ 32, 0 ]
[ 53, 5 ]
python
en
['en', 'en', 'en']
True
setup_light
(hass)
Configure our light component to work against for testing.
Configure our light component to work against for testing.
async def setup_light(hass): """Configure our light component to work against for testing.""" assert await async_setup_component( hass, LIGHT_DOMAIN, {LIGHT_DOMAIN: {"platform": "demo"}} ) await hass.async_block_till_done() state = hass.states.get(LIGHT_ENTITY) assert state # Valid...
[ "async", "def", "setup_light", "(", "hass", ")", ":", "assert", "await", "async_setup_component", "(", "hass", ",", "LIGHT_DOMAIN", ",", "{", "LIGHT_DOMAIN", ":", "{", "\"platform\"", ":", "\"demo\"", "}", "}", ")", "await", "hass", ".", "async_block_till_done...
[ 57, 0 ]
[ 83, 35 ]
python
en
['en', 'en', 'en']
True
test_missing_url_and_path
(hass)
Test that nothing happens when url and path are missing.
Test that nothing happens when url and path are missing.
async def test_missing_url_and_path(hass): """Test that nothing happens when url and path are missing.""" # Load our color_extractor component await async_setup_component( hass, DOMAIN, {}, ) await hass.async_block_till_done() # Validate pre service call state = hass...
[ "async", "def", "test_missing_url_and_path", "(", "hass", ")", ":", "# Load our color_extractor component", "await", "async_setup_component", "(", "hass", ",", "DOMAIN", ",", "{", "}", ",", ")", "await", "hass", ".", "async_block_till_done", "(", ")", "# Validate pr...
[ 86, 0 ]
[ 115, 35 ]
python
en
['en', 'en', 'en']
True
test_url_success
(hass, aioclient_mock)
Test that a successful image GET translate to light RGB.
Test that a successful image GET translate to light RGB.
async def test_url_success(hass, aioclient_mock): """Test that a successful image GET translate to light RGB.""" service_data = { ATTR_URL: "http://example.com/images/logo.png", ATTR_ENTITY_ID: LIGHT_ENTITY, # Standard light service data which we pass ATTR_BRIGHTNESS_PCT: 50, ...
[ "async", "def", "test_url_success", "(", "hass", ",", "aioclient_mock", ")", ":", "service_data", "=", "{", "ATTR_URL", ":", "\"http://example.com/images/logo.png\"", ",", "ATTR_ENTITY_ID", ":", "LIGHT_ENTITY", ",", "# Standard light service data which we pass", "ATTR_BRIGH...
[ 140, 0 ]
[ 170, 74 ]
python
en
['en', 'en', 'en']
True
test_url_not_allowed
(hass, aioclient_mock)
Test that a not allowed external URL fails to turn light on.
Test that a not allowed external URL fails to turn light on.
async def test_url_not_allowed(hass, aioclient_mock): """Test that a not allowed external URL fails to turn light on.""" service_data = { ATTR_URL: "http://denied.com/images/logo.png", ATTR_ENTITY_ID: LIGHT_ENTITY, } await _async_load_color_extractor_url(hass, service_data) # Light...
[ "async", "def", "test_url_not_allowed", "(", "hass", ",", "aioclient_mock", ")", ":", "service_data", "=", "{", "ATTR_URL", ":", "\"http://denied.com/images/logo.png\"", ",", "ATTR_ENTITY_ID", ":", "LIGHT_ENTITY", ",", "}", "await", "_async_load_color_extractor_url", "(...
[ 173, 0 ]
[ 185, 35 ]
python
en
['en', 'lb', 'en']
True
test_url_exception
(hass, aioclient_mock)
Test that a HTTPError fails to turn light on.
Test that a HTTPError fails to turn light on.
async def test_url_exception(hass, aioclient_mock): """Test that a HTTPError fails to turn light on.""" service_data = { ATTR_URL: "http://example.com/images/logo.png", ATTR_ENTITY_ID: LIGHT_ENTITY, } # Don't let the URL not being allowed sway our exception test hass.config.allowlis...
[ "async", "def", "test_url_exception", "(", "hass", ",", "aioclient_mock", ")", ":", "service_data", "=", "{", "ATTR_URL", ":", "\"http://example.com/images/logo.png\"", ",", "ATTR_ENTITY_ID", ":", "LIGHT_ENTITY", ",", "}", "# Don't let the URL not being allowed sway our exc...
[ 188, 0 ]
[ 206, 35 ]
python
en
['en', 'en', 'en']
True
test_url_error
(hass, aioclient_mock)
Test that a HTTP Error (non 200) doesn't turn light on.
Test that a HTTP Error (non 200) doesn't turn light on.
async def test_url_error(hass, aioclient_mock): """Test that a HTTP Error (non 200) doesn't turn light on.""" service_data = { ATTR_URL: "http://example.com/images/logo.png", ATTR_ENTITY_ID: LIGHT_ENTITY, } # Don't let the URL not being allowed sway our exception test hass.config.al...
[ "async", "def", "test_url_error", "(", "hass", ",", "aioclient_mock", ")", ":", "service_data", "=", "{", "ATTR_URL", ":", "\"http://example.com/images/logo.png\"", ",", "ATTR_ENTITY_ID", ":", "LIGHT_ENTITY", ",", "}", "# Don't let the URL not being allowed sway our excepti...
[ 209, 0 ]
[ 227, 35 ]
python
en
['en', 'en', 'en']
True
_get_file_mock
(file_path)
Convert file to BytesIO for testing due to PIL UnidentifiedImageError.
Convert file to BytesIO for testing due to PIL UnidentifiedImageError.
def _get_file_mock(file_path): """Convert file to BytesIO for testing due to PIL UnidentifiedImageError.""" _file = None with open(file_path) as file_handler: _file = io.BytesIO(file_handler.read()) _file.name = "color_extractor.jpg" _file.seek(0) return _file
[ "def", "_get_file_mock", "(", "file_path", ")", ":", "_file", "=", "None", "with", "open", "(", "file_path", ")", "as", "file_handler", ":", "_file", "=", "io", ".", "BytesIO", "(", "file_handler", ".", "read", "(", ")", ")", "_file", ".", "name", "=",...
[ 235, 0 ]
[ 245, 16 ]
python
en
['en', 'en', 'en']
True
test_file
(hass)
Test that the file only service reads a file and translates to light RGB.
Test that the file only service reads a file and translates to light RGB.
async def test_file(hass): """Test that the file only service reads a file and translates to light RGB.""" service_data = { ATTR_PATH: "/opt/image.png", ATTR_ENTITY_ID: LIGHT_ENTITY, # Standard light service data which we pass ATTR_BRIGHTNESS_PCT: 100, } # Add our /opt/ ...
[ "async", "def", "test_file", "(", "hass", ")", ":", "service_data", "=", "{", "ATTR_PATH", ":", "\"/opt/image.png\"", ",", "ATTR_ENTITY_ID", ":", "LIGHT_ENTITY", ",", "# Standard light service data which we pass", "ATTR_BRIGHTNESS_PCT", ":", "100", ",", "}", "# Add ou...
[ 250, 0 ]
[ 286, 73 ]
python
en
['en', 'en', 'en']
True
test_file_denied_dir
(hass)
Test that the file only service fails to read an image in a dir not explicitly allowed.
Test that the file only service fails to read an image in a dir not explicitly allowed.
async def test_file_denied_dir(hass): """Test that the file only service fails to read an image in a dir not explicitly allowed.""" service_data = { ATTR_PATH: "/path/to/a/dir/not/allowed/image.png", ATTR_ENTITY_ID: LIGHT_ENTITY, # Standard light service data which we pass ATTR_B...
[ "async", "def", "test_file_denied_dir", "(", "hass", ")", ":", "service_data", "=", "{", "ATTR_PATH", ":", "\"/path/to/a/dir/not/allowed/image.png\"", ",", "ATTR_ENTITY_ID", ":", "LIGHT_ENTITY", ",", "# Standard light service data which we pass", "ATTR_BRIGHTNESS_PCT", ":", ...
[ 291, 0 ]
[ 318, 35 ]
python
en
['en', 'en', 'en']
True
mock_controller_login
()
Mock a successful login.
Mock a successful login.
def mock_controller_login(): """Mock a successful login.""" with patch("homeassistant.components.neato.config_flow.Account", return_value=True): yield
[ "def", "mock_controller_login", "(", ")", ":", "with", "patch", "(", "\"homeassistant.components.neato.config_flow.Account\"", ",", "return_value", "=", "True", ")", ":", "yield" ]
[ 20, 0 ]
[ 23, 13 ]
python
en
['en', 'co', 'en']
True
init_config_flow
(hass)
Init a configuration flow.
Init a configuration flow.
def init_config_flow(hass): """Init a configuration flow.""" flow = config_flow.NeatoConfigFlow() flow.hass = hass return flow
[ "def", "init_config_flow", "(", "hass", ")", ":", "flow", "=", "config_flow", ".", "NeatoConfigFlow", "(", ")", "flow", ".", "hass", "=", "hass", "return", "flow" ]
[ 26, 0 ]
[ 30, 15 ]
python
en
['es', 'fr', 'en']
False
test_user
(hass, account)
Test user config.
Test user config.
async def test_user(hass, account): """Test user config.""" flow = init_config_flow(hass) result = await flow.async_step_user() assert result["type"] == data_entry_flow.RESULT_TYPE_FORM assert result["step_id"] == "user" result = await flow.async_step_user( {CONF_USERNAME: USERNAME, CO...
[ "async", "def", "test_user", "(", "hass", ",", "account", ")", ":", "flow", "=", "init_config_flow", "(", "hass", ")", "result", "=", "await", "flow", ".", "async_step_user", "(", ")", "assert", "result", "[", "\"type\"", "]", "==", "data_entry_flow", ".",...
[ 33, 0 ]
[ 59, 56 ]
python
en
['en', 'da', 'en']
True
test_import
(hass, account)
Test import step.
Test import step.
async def test_import(hass, account): """Test import step.""" flow = init_config_flow(hass) result = await flow.async_step_import( {CONF_USERNAME: USERNAME, CONF_PASSWORD: PASSWORD, CONF_VENDOR: VENDOR_NEATO} ) assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY assert re...
[ "async", "def", "test_import", "(", "hass", ",", "account", ")", ":", "flow", "=", "init_config_flow", "(", "hass", ")", "result", "=", "await", "flow", ".", "async_step_import", "(", "{", "CONF_USERNAME", ":", "USERNAME", ",", "CONF_PASSWORD", ":", "PASSWOR...
[ 62, 0 ]
[ 74, 54 ]
python
de
['de', 'sd', 'en']
False
test_abort_if_already_setup
(hass, account)
Test we abort if Neato is already setup.
Test we abort if Neato is already setup.
async def test_abort_if_already_setup(hass, account): """Test we abort if Neato is already setup.""" flow = init_config_flow(hass) MockConfigEntry( domain=NEATO_DOMAIN, data={ CONF_USERNAME: USERNAME, CONF_PASSWORD: PASSWORD, CONF_VENDOR: VENDOR_NEATO, ...
[ "async", "def", "test_abort_if_already_setup", "(", "hass", ",", "account", ")", ":", "flow", "=", "init_config_flow", "(", "hass", ")", "MockConfigEntry", "(", "domain", "=", "NEATO_DOMAIN", ",", "data", "=", "{", "CONF_USERNAME", ":", "USERNAME", ",", "CONF_...
[ 77, 0 ]
[ 101, 51 ]
python
en
['en', 'en', 'en']
True
test_abort_on_invalid_credentials
(hass)
Test when we have invalid credentials.
Test when we have invalid credentials.
async def test_abort_on_invalid_credentials(hass): """Test when we have invalid credentials.""" flow = init_config_flow(hass) with patch( "homeassistant.components.neato.config_flow.Account", side_effect=NeatoLoginException(), ): result = await flow.async_step_user( ...
[ "async", "def", "test_abort_on_invalid_credentials", "(", "hass", ")", ":", "flow", "=", "init_config_flow", "(", "hass", ")", "with", "patch", "(", "\"homeassistant.components.neato.config_flow.Account\"", ",", "side_effect", "=", "NeatoLoginException", "(", ")", ",", ...
[ 104, 0 ]
[ 130, 49 ]
python
en
['en', 'en', 'en']
True
test_abort_on_unexpected_error
(hass)
Test when we have an unexpected error.
Test when we have an unexpected error.
async def test_abort_on_unexpected_error(hass): """Test when we have an unexpected error.""" flow = init_config_flow(hass) with patch( "homeassistant.components.neato.config_flow.Account", side_effect=NeatoRobotException(), ): result = await flow.async_step_user( { ...
[ "async", "def", "test_abort_on_unexpected_error", "(", "hass", ")", ":", "flow", "=", "init_config_flow", "(", "hass", ")", "with", "patch", "(", "\"homeassistant.components.neato.config_flow.Account\"", ",", "side_effect", "=", "NeatoRobotException", "(", ")", ",", "...
[ 133, 0 ]
[ 159, 44 ]
python
en
['en', 'en', 'en']
True
init_integration
(hass)
Set up the Kodi integration in Home Assistant.
Set up the Kodi integration in Home Assistant.
async def init_integration(hass) -> MockConfigEntry: """Set up the Kodi integration in Home Assistant.""" entry_data = { CONF_NAME: "name", CONF_HOST: "1.1.1.1", CONF_PORT: 8080, CONF_WS_PORT: 9090, CONF_USERNAME: "user", CONF_PASSWORD: "pass", CONF_SSL: F...
[ "async", "def", "init_integration", "(", "hass", ")", "->", "MockConfigEntry", ":", "entry_data", "=", "{", "CONF_NAME", ":", "\"name\"", ",", "CONF_HOST", ":", "\"1.1.1.1\"", ",", "CONF_PORT", ":", "8080", ",", "CONF_WS_PORT", ":", "9090", ",", "CONF_USERNAME...
[ 17, 0 ]
[ 41, 16 ]
python
en
['en', 'en', 'en']
True
test_hmip_load_all_supported_devices
(hass, default_mock_hap_factory)
Ensure that all supported devices could be loaded.
Ensure that all supported devices could be loaded.
async def test_hmip_load_all_supported_devices(hass, default_mock_hap_factory): """Ensure that all supported devices could be loaded.""" mock_hap = await default_mock_hap_factory.async_get_mock_hap( test_devices=None, test_groups=None ) assert len(mock_hap.hmip_device_by_entity_id) == 233
[ "async", "def", "test_hmip_load_all_supported_devices", "(", "hass", ",", "default_mock_hap_factory", ")", ":", "mock_hap", "=", "await", "default_mock_hap_factory", ".", "async_get_mock_hap", "(", "test_devices", "=", "None", ",", "test_groups", "=", "None", ")", "as...
[ 18, 0 ]
[ 24, 56 ]
python
en
['en', 'en', 'en']
True
test_hmip_remove_device
(hass, default_mock_hap_factory)
Test Remove of hmip device.
Test Remove of hmip device.
async def test_hmip_remove_device(hass, default_mock_hap_factory): """Test Remove of hmip device.""" entity_id = "light.treppe_ch" entity_name = "Treppe CH" device_model = "HmIP-BSL" mock_hap = await default_mock_hap_factory.async_get_mock_hap( test_devices=["Treppe"] ) ha_state, hm...
[ "async", "def", "test_hmip_remove_device", "(", "hass", ",", "default_mock_hap_factory", ")", ":", "entity_id", "=", "\"light.treppe_ch\"", "entity_name", "=", "\"Treppe CH\"", "device_model", "=", "\"HmIP-BSL\"", "mock_hap", "=", "await", "default_mock_hap_factory", ".",...
[ 27, 0 ]
[ 56, 74 ]
python
en
['en', 'en', 'en']
True
test_hmip_add_device
(hass, default_mock_hap_factory, hmip_config_entry)
Test Remove of hmip device.
Test Remove of hmip device.
async def test_hmip_add_device(hass, default_mock_hap_factory, hmip_config_entry): """Test Remove of hmip device.""" entity_id = "light.treppe_ch" entity_name = "Treppe CH" device_model = "HmIP-BSL" mock_hap = await default_mock_hap_factory.async_get_mock_hap( test_devices=["Treppe"] ) ...
[ "async", "def", "test_hmip_add_device", "(", "hass", ",", "default_mock_hap_factory", ",", "hmip_config_entry", ")", ":", "entity_id", "=", "\"light.treppe_ch\"", "entity_name", "=", "\"Treppe CH\"", "device_model", "=", "\"HmIP-BSL\"", "mock_hap", "=", "await", "defaul...
[ 59, 0 ]
[ 104, 69 ]
python
en
['en', 'en', 'en']
True
test_hmip_remove_group
(hass, default_mock_hap_factory)
Test Remove of hmip group.
Test Remove of hmip group.
async def test_hmip_remove_group(hass, default_mock_hap_factory): """Test Remove of hmip group.""" entity_id = "switch.strom_group" entity_name = "Strom Group" device_model = None mock_hap = await default_mock_hap_factory.async_get_mock_hap(test_groups=["Strom"]) ha_state, hmip_device = get_and...
[ "async", "def", "test_hmip_remove_group", "(", "hass", ",", "default_mock_hap_factory", ")", ":", "entity_id", "=", "\"switch.strom_group\"", "entity_name", "=", "\"Strom Group\"", "device_model", "=", "None", "mock_hap", "=", "await", "default_mock_hap_factory", ".", "...
[ 107, 0 ]
[ 133, 74 ]
python
en
['en', 'en', 'en']
True