Search is not available for this dataset
identifier
stringlengths
1
155
parameters
stringlengths
2
6.09k
docstring
stringlengths
11
63.4k
docstring_summary
stringlengths
0
63.4k
function
stringlengths
29
99.8k
function_tokens
list
start_point
list
end_point
list
language
stringclasses
1 value
docstring_language
stringlengths
2
7
docstring_language_predictions
stringlengths
18
23
is_langid_reliable
stringclasses
2 values
test_sending_non_templated_notification
(hass, mock_notifier)
Test notifications.
Test notifications.
async def test_sending_non_templated_notification(hass, mock_notifier): """Test notifications.""" assert await async_setup_component(hass, alert.DOMAIN, TEST_CONFIG) hass.states.async_set(TEST_ENTITY, STATE_ON) await hass.async_block_till_done() assert len(mock_notifier) == 1 last_event = mock_...
[ "async", "def", "test_sending_non_templated_notification", "(", "hass", ",", "mock_notifier", ")", ":", "assert", "await", "async_setup_component", "(", "hass", ",", "alert", ".", "DOMAIN", ",", "TEST_CONFIG", ")", "hass", ".", "states", ".", "async_set", "(", "...
[ 226, 0 ]
[ 234, 55 ]
python
en
['en', 'en', 'en']
False
test_sending_templated_notification
(hass, mock_notifier)
Test templated notification.
Test templated notification.
async def test_sending_templated_notification(hass, mock_notifier): """Test templated notification.""" config = deepcopy(TEST_CONFIG) config[alert.DOMAIN][NAME][alert.CONF_ALERT_MESSAGE] = TEMPLATE assert await async_setup_component(hass, alert.DOMAIN, config) hass.states.async_set(TEST_ENTITY, STA...
[ "async", "def", "test_sending_templated_notification", "(", "hass", ",", "mock_notifier", ")", ":", "config", "=", "deepcopy", "(", "TEST_CONFIG", ")", "config", "[", "alert", ".", "DOMAIN", "]", "[", "NAME", "]", "[", "alert", ".", "CONF_ALERT_MESSAGE", "]", ...
[ 237, 0 ]
[ 247, 62 ]
python
en
['en', 'en', 'en']
True
test_sending_templated_done_notification
(hass, mock_notifier)
Test templated notification.
Test templated notification.
async def test_sending_templated_done_notification(hass, mock_notifier): """Test templated notification.""" config = deepcopy(TEST_CONFIG) config[alert.DOMAIN][NAME][alert.CONF_DONE_MESSAGE] = TEMPLATE assert await async_setup_component(hass, alert.DOMAIN, config) hass.states.async_set(TEST_ENTITY,...
[ "async", "def", "test_sending_templated_done_notification", "(", "hass", ",", "mock_notifier", ")", ":", "config", "=", "deepcopy", "(", "TEST_CONFIG", ")", "config", "[", "alert", ".", "DOMAIN", "]", "[", "NAME", "]", "[", "alert", ".", "CONF_DONE_MESSAGE", "...
[ 250, 0 ]
[ 262, 62 ]
python
en
['en', 'en', 'en']
True
test_sending_titled_notification
(hass, mock_notifier)
Test notifications.
Test notifications.
async def test_sending_titled_notification(hass, mock_notifier): """Test notifications.""" config = deepcopy(TEST_CONFIG) config[alert.DOMAIN][NAME][alert.CONF_TITLE] = TITLE assert await async_setup_component(hass, alert.DOMAIN, config) hass.states.async_set(TEST_ENTITY, STATE_ON) await hass.a...
[ "async", "def", "test_sending_titled_notification", "(", "hass", ",", "mock_notifier", ")", ":", "config", "=", "deepcopy", "(", "TEST_CONFIG", ")", "config", "[", "alert", ".", "DOMAIN", "]", "[", "NAME", "]", "[", "alert", ".", "CONF_TITLE", "]", "=", "T...
[ 265, 0 ]
[ 275, 59 ]
python
en
['en', 'en', 'en']
False
test_sending_data_notification
(hass, mock_notifier)
Test notifications.
Test notifications.
async def test_sending_data_notification(hass, mock_notifier): """Test notifications.""" config = deepcopy(TEST_CONFIG) config[alert.DOMAIN][NAME][alert.CONF_DATA] = TEST_DATA assert await async_setup_component(hass, alert.DOMAIN, config) hass.states.async_set(TEST_ENTITY, STATE_ON) await hass....
[ "async", "def", "test_sending_data_notification", "(", "hass", ",", "mock_notifier", ")", ":", "config", "=", "deepcopy", "(", "TEST_CONFIG", ")", "config", "[", "alert", ".", "DOMAIN", "]", "[", "NAME", "]", "[", "alert", ".", "CONF_DATA", "]", "=", "TEST...
[ 278, 0 ]
[ 288, 57 ]
python
en
['en', 'en', 'en']
False
test_skipfirst
(hass)
Test skipping first notification.
Test skipping first notification.
async def test_skipfirst(hass): """Test skipping first notification.""" config = deepcopy(TEST_CONFIG) config[alert.DOMAIN][NAME][alert.CONF_SKIP_FIRST] = True events = [] @callback def record_event(event): """Add recorded event to set.""" events.append(event) hass.services...
[ "async", "def", "test_skipfirst", "(", "hass", ")", ":", "config", "=", "deepcopy", "(", "TEST_CONFIG", ")", "config", "[", "alert", ".", "DOMAIN", "]", "[", "NAME", "]", "[", "alert", ".", "CONF_SKIP_FIRST", "]", "=", "True", "events", "=", "[", "]", ...
[ 291, 0 ]
[ 309, 27 ]
python
en
['sv', 'en', 'en']
True
test_noack
(hass)
Test no ack feature.
Test no ack feature.
async def test_noack(hass): """Test no ack feature.""" entity = alert.Alert(hass, *TEST_NOACK) hass.async_add_job(entity.begin_alerting) await hass.async_block_till_done()
[ "async", "def", "test_noack", "(", "hass", ")", ":", "entity", "=", "alert", ".", "Alert", "(", "hass", ",", "*", "TEST_NOACK", ")", "hass", ".", "async_add_job", "(", "entity", ".", "begin_alerting", ")", "await", "hass", ".", "async_block_till_done", "("...
[ 312, 0 ]
[ 316, 38 ]
python
en
['pt', 'en', 'en']
True
test_done_message_state_tracker_reset_on_cancel
(hass)
Test that the done message is reset when canceled.
Test that the done message is reset when canceled.
async def test_done_message_state_tracker_reset_on_cancel(hass): """Test that the done message is reset when canceled.""" entity = alert.Alert(hass, *TEST_NOACK) entity._cancel = lambda *args: None assert entity._send_done_message is False entity._send_done_message = True hass.async_add_job(enti...
[ "async", "def", "test_done_message_state_tracker_reset_on_cancel", "(", "hass", ")", ":", "entity", "=", "alert", ".", "Alert", "(", "hass", ",", "*", "TEST_NOACK", ")", "entity", ".", "_cancel", "=", "lambda", "*", "args", ":", "None", "assert", "entity", "...
[ 319, 0 ]
[ 327, 45 ]
python
en
['en', 'en', 'en']
True
ResourceInfo.get_static_info
()
Get static resource information about local environment. Returns: Tuple[int, list]: (total cpu number, [cpu usage per core])
Get static resource information about local environment.
def get_static_info() -> dict: """ Get static resource information about local environment. Returns: Tuple[int, list]: (total cpu number, [cpu usage per core]) """ static_info = {} static_info["cpu"] = psutil.cpu_count() memory = psutil.virtual_memory() ...
[ "def", "get_static_info", "(", ")", "->", "dict", ":", "static_info", "=", "{", "}", "static_info", "[", "\"cpu\"", "]", "=", "psutil", ".", "cpu_count", "(", ")", "memory", "=", "psutil", ".", "virtual_memory", "(", ")", "static_info", "[", "\"total_memor...
[ 20, 4 ]
[ 47, 26 ]
python
en
['en', 'en', 'en']
True
ResourceInfo.get_dynamic_info
(interval: int = None)
Get dynamic resource information about local environment. Returns: Tuple[float]: (total memory, free memory, used memory, memory usage)
Get dynamic resource information about local environment.
def get_dynamic_info(interval: int = None) -> dict: """ Get dynamic resource information about local environment. Returns: Tuple[float]: (total memory, free memory, used memory, memory usage) """ dynamic_info = {} dynamic_info["cpu_usage_per_core"] = psutil.cpu_perce...
[ "def", "get_dynamic_info", "(", "interval", ":", "int", "=", "None", ")", "->", "dict", ":", "dynamic_info", "=", "{", "}", "dynamic_info", "[", "\"cpu_usage_per_core\"", "]", "=", "psutil", ".", "cpu_percent", "(", "interval", "=", "interval", ",", "percpu"...
[ 50, 4 ]
[ 72, 27 ]
python
en
['en', 'en', 'en']
True
test_websocket_api
(hass, generic_data, hass_ws_client)
Test the ozw websocket api.
Test the ozw websocket api.
async def test_websocket_api(hass, generic_data, hass_ws_client): """Test the ozw websocket api.""" await setup_ozw(hass, fixture=generic_data) client = await hass_ws_client(hass) # Test instance list await client.send_json({ID: 4, TYPE: "ozw/get_instances"}) msg = await client.receive_json() ...
[ "async", "def", "test_websocket_api", "(", "hass", ",", "generic_data", ",", "hass_ws_client", ")", ":", "await", "setup_ozw", "(", "hass", ",", "fixture", "=", "generic_data", ")", "client", "=", "await", "hass_ws_client", "(", "hass", ")", "# Test instance lis...
[ 45, 0 ]
[ 280, 42 ]
python
en
['en', 'hu', 'it']
False
test_ws_locks
(hass, lock_data, hass_ws_client)
Test lock websocket apis.
Test lock websocket apis.
async def test_ws_locks(hass, lock_data, hass_ws_client): """Test lock websocket apis.""" await setup_ozw(hass, fixture=lock_data) client = await hass_ws_client(hass) await client.send_json( { ID: 1, TYPE: "ozw/get_code_slots", NODE_ID: 10, } ) ...
[ "async", "def", "test_ws_locks", "(", "hass", ",", "lock_data", ",", "hass_ws_client", ")", ":", "await", "setup_ozw", "(", "hass", ",", "fixture", "=", "lock_data", ")", "client", "=", "await", "hass_ws_client", "(", "hass", ")", "await", "client", ".", "...
[ 283, 0 ]
[ 319, 25 ]
python
en
['en', 'fy', 'en']
True
test_refresh_node
(hass, generic_data, sent_messages, hass_ws_client)
Test the ozw refresh node api.
Test the ozw refresh node api.
async def test_refresh_node(hass, generic_data, sent_messages, hass_ws_client): """Test the ozw refresh node api.""" receive_message = await setup_ozw(hass, fixture=generic_data) client = await hass_ws_client(hass) # Send the refresh_node_info command await client.send_json({ID: 9, TYPE: "ozw/refre...
[ "async", "def", "test_refresh_node", "(", "hass", ",", "generic_data", ",", "sent_messages", ",", "hass_ws_client", ")", ":", "receive_message", "=", "await", "setup_ozw", "(", "hass", ",", "fixture", "=", "generic_data", ")", "client", "=", "await", "hass_ws_cl...
[ 322, 0 ]
[ 368, 51 ]
python
en
['en', 'pt', 'en']
True
test_refresh_node_unsubscribe
(hass, generic_data, hass_ws_client)
Test unsubscribing the ozw refresh node api.
Test unsubscribing the ozw refresh node api.
async def test_refresh_node_unsubscribe(hass, generic_data, hass_ws_client): """Test unsubscribing the ozw refresh node api.""" await setup_ozw(hass, fixture=generic_data) client = await hass_ws_client(hass) with patch("openzwavemqtt.OZWOptions.listen") as mock_listen: # Send the refresh_node_i...
[ "async", "def", "test_refresh_node_unsubscribe", "(", "hass", ",", "generic_data", ",", "hass_ws_client", ")", ":", "await", "setup_ozw", "(", "hass", ",", "fixture", "=", "generic_data", ")", "client", "=", "await", "hass_ws_client", "(", "hass", ")", "with", ...
[ 371, 0 ]
[ 385, 46 ]
python
en
['en', 'en', 'en']
True
mock_bridge_fixture
()
Fixture for mocking aioswitcher.bridge.SwitcherV2Bridge.
Fixture for mocking aioswitcher.bridge.SwitcherV2Bridge.
def mock_bridge_fixture() -> Generator[None, Any, None]: """Fixture for mocking aioswitcher.bridge.SwitcherV2Bridge.""" queue = Queue() async def mock_queue(): """Mock asyncio's Queue.""" await queue.put(MockSwitcherV2Device()) return await queue.get() mock_bridge = AsyncMock()...
[ "def", "mock_bridge_fixture", "(", ")", "->", "Generator", "[", "None", ",", "Any", ",", "None", "]", ":", "queue", "=", "Queue", "(", ")", "async", "def", "mock_queue", "(", ")", ":", "\"\"\"Mock asyncio's Queue.\"\"\"", "await", "queue", ".", "put", "(",...
[ 94, 0 ]
[ 130, 22 ]
python
en
['en', 'sr', 'en']
True
mock_failed_bridge_fixture
()
Fixture for mocking aioswitcher.bridge.SwitcherV2Bridge.
Fixture for mocking aioswitcher.bridge.SwitcherV2Bridge.
def mock_failed_bridge_fixture() -> Generator[None, Any, None]: """Fixture for mocking aioswitcher.bridge.SwitcherV2Bridge.""" async def mock_queue(): """Mock asyncio's Queue.""" raise RuntimeError patchers = [ patch( "homeassistant.components.switcher_kis.SwitcherV2Bri...
[ "def", "mock_failed_bridge_fixture", "(", ")", "->", "Generator", "[", "None", ",", "Any", ",", "None", "]", ":", "async", "def", "mock_queue", "(", ")", ":", "\"\"\"Mock asyncio's Queue.\"\"\"", "raise", "RuntimeError", "patchers", "=", "[", "patch", "(", "\"...
[ 134, 0 ]
[ 162, 22 ]
python
en
['en', 'sr', 'en']
True
mock_api_fixture
()
Fixture for mocking aioswitcher.api.SwitcherV2Api.
Fixture for mocking aioswitcher.api.SwitcherV2Api.
def mock_api_fixture() -> Generator[AsyncMock, Any, None]: """Fixture for mocking aioswitcher.api.SwitcherV2Api.""" mock_api = AsyncMock() patchers = [ patch( "homeassistant.components.switcher_kis.SwitcherV2Api.connect", new=mock_api ), patch( "homeassistant...
[ "def", "mock_api_fixture", "(", ")", "->", "Generator", "[", "AsyncMock", ",", "Any", ",", "None", "]", ":", "mock_api", "=", "AsyncMock", "(", ")", "patchers", "=", "[", "patch", "(", "\"homeassistant.components.switcher_kis.SwitcherV2Api.connect\"", ",", "new", ...
[ 166, 0 ]
[ 186, 22 ]
python
en
['en', 'pl', 'en']
True
entropy
(x)
Calculate entropy of a pre-softmax logit Tensor
Calculate entropy of a pre-softmax logit Tensor
def entropy(x): """Calculate entropy of a pre-softmax logit Tensor""" exp_x = torch.exp(x) A = torch.sum(exp_x, dim=1) # sum of exp(x_i) B = torch.sum(x * exp_x, dim=1) # sum of x_i * exp(x_i) return torch.log(A) - B / A
[ "def", "entropy", "(", "x", ")", ":", "exp_x", "=", "torch", ".", "exp", "(", "x", ")", "A", "=", "torch", ".", "sum", "(", "exp_x", ",", "dim", "=", "1", ")", "# sum of exp(x_i)", "B", "=", "torch", ".", "sum", "(", "x", "*", "exp_x", ",", "...
[ 15, 0 ]
[ 20, 31 ]
python
en
['en', 'en', 'en']
True
SuperNetBuilder.__call__
(self, in_chs, model_block_args)
Build the blocks Args: in_chs: Number of input-channels passed to first block model_block_args: A list of lists, outer list defines stages, inner list contains strings defining block configuration(s) Return: List of block stacks (each stack wrapped i...
Build the blocks Args: in_chs: Number of input-channels passed to first block model_block_args: A list of lists, outer list defines stages, inner list contains strings defining block configuration(s) Return: List of block stacks (each stack wrapped i...
def __call__(self, in_chs, model_block_args): """ Build the blocks Args: in_chs: Number of input-channels passed to first block model_block_args: A list of lists, outer list defines stages, inner list contains strings defining block configuration(s) Return...
[ "def", "__call__", "(", "self", ",", "in_chs", ",", "model_block_args", ")", ":", "if", "self", ".", "verbose", ":", "logging", ".", "info", "(", "'Building model trunk with %d stages...'", "%", "len", "(", "model_block_args", ")", ")", "self", ".", "in_chs", ...
[ 115, 4 ]
[ 213, 21 ]
python
en
['en', 'la', 'en']
True
async_setup
(hass, config)
Set up the Unify Circuit component.
Set up the Unify Circuit component.
async def async_setup(hass, config): """Set up the Unify Circuit component.""" webhooks = config[DOMAIN][CONF_WEBHOOK] for webhook_conf in webhooks: hass.async_create_task( discovery.async_load_platform(hass, "notify", DOMAIN, webhook_conf, config) ) return True
[ "async", "def", "async_setup", "(", "hass", ",", "config", ")", ":", "webhooks", "=", "config", "[", "DOMAIN", "]", "[", "CONF_WEBHOOK", "]", "for", "webhook_conf", "in", "webhooks", ":", "hass", ".", "async_create_task", "(", "discovery", ".", "async_load_p...
[ 23, 0 ]
[ 32, 15 ]
python
en
['en', 'en', 'en']
True
merge_versions
(old: OurVersionJSON, new: OurVersionJSON)
Copies already-known hashes from version.json to avoid having to re-fetch.
Copies already-known hashes from version.json to avoid having to re-fetch.
def merge_versions(old: OurVersionJSON, new: OurVersionJSON) -> OurVersionJSON: """Copies already-known hashes from version.json to avoid having to re-fetch.""" def _merge_version(system_name: str, release_type_name: str, release_channel_name: str, release: Dict[str, str]) -> Dict[str, str]: old_system ...
[ "def", "merge_versions", "(", "old", ":", "OurVersionJSON", ",", "new", ":", "OurVersionJSON", ")", "->", "OurVersionJSON", ":", "def", "_merge_version", "(", "system_name", ":", "str", ",", "release_type_name", ":", "str", ",", "release_channel_name", ":", "str...
[ 112, 0 ]
[ 126, 44 ]
python
en
['en', 'en', 'en']
True
fill_in_hash
(versions: OurVersionJSON)
Fill in sha256 hashes for anything missing them.
Fill in sha256 hashes for anything missing them.
def fill_in_hash(versions: OurVersionJSON) -> OurVersionJSON: """Fill in sha256 hashes for anything missing them.""" urls_to_hash = {} def _fill_in_hash(system_name: str, release_type_name: str, release_channel_name: str, release: Dict[str, str]) -> Dict[str, str]: if "sha256" in release: ...
[ "def", "fill_in_hash", "(", "versions", ":", "OurVersionJSON", ")", "->", "OurVersionJSON", ":", "urls_to_hash", "=", "{", "}", "def", "_fill_in_hash", "(", "system_name", ":", "str", ",", "release_type_name", ":", "str", ",", "release_channel_name", ":", "str",...
[ 136, 0 ]
[ 156, 48 ]
python
en
['en', 'en', 'en']
True
create_thermostat_service
(accessory)
Define thermostat characteristics.
Define thermostat characteristics.
def create_thermostat_service(accessory): """Define thermostat characteristics.""" service = accessory.add_service(ServicesTypes.THERMOSTAT) char = service.add_char(CharacteristicsTypes.HEATING_COOLING_TARGET) char.value = 0 char = service.add_char(CharacteristicsTypes.HEATING_COOLING_CURRENT) ...
[ "def", "create_thermostat_service", "(", "accessory", ")", ":", "service", "=", "accessory", ".", "add_service", "(", "ServicesTypes", ".", "THERMOSTAT", ")", "char", "=", "service", ".", "add_char", "(", "CharacteristicsTypes", ".", "HEATING_COOLING_TARGET", ")", ...
[ 34, 0 ]
[ 56, 18 ]
python
en
['en', 'mt', 'en']
True
create_thermostat_service_min_max
(accessory)
Define thermostat characteristics.
Define thermostat characteristics.
def create_thermostat_service_min_max(accessory): """Define thermostat characteristics.""" service = accessory.add_service(ServicesTypes.THERMOSTAT) char = service.add_char(CharacteristicsTypes.HEATING_COOLING_TARGET) char.value = 0 char.minValue = 0 char.maxValue = 1
[ "def", "create_thermostat_service_min_max", "(", "accessory", ")", ":", "service", "=", "accessory", ".", "add_service", "(", "ServicesTypes", ".", "THERMOSTAT", ")", "char", "=", "service", ".", "add_char", "(", "CharacteristicsTypes", ".", "HEATING_COOLING_TARGET", ...
[ 59, 0 ]
[ 65, 21 ]
python
en
['en', 'mt', 'en']
True
test_climate_respect_supported_op_modes_1
(hass, utcnow)
Test that climate respects minValue/maxValue hints.
Test that climate respects minValue/maxValue hints.
async def test_climate_respect_supported_op_modes_1(hass, utcnow): """Test that climate respects minValue/maxValue hints.""" helper = await setup_test_component(hass, create_thermostat_service_min_max) state = await helper.poll_and_get_state() assert state.attributes["hvac_modes"] == ["off", "heat"]
[ "async", "def", "test_climate_respect_supported_op_modes_1", "(", "hass", ",", "utcnow", ")", ":", "helper", "=", "await", "setup_test_component", "(", "hass", ",", "create_thermostat_service_min_max", ")", "state", "=", "await", "helper", ".", "poll_and_get_state", "...
[ 68, 0 ]
[ 72, 60 ]
python
en
['en', 'en', 'en']
True
create_thermostat_service_valid_vals
(accessory)
Define thermostat characteristics.
Define thermostat characteristics.
def create_thermostat_service_valid_vals(accessory): """Define thermostat characteristics.""" service = accessory.add_service(ServicesTypes.THERMOSTAT) char = service.add_char(CharacteristicsTypes.HEATING_COOLING_TARGET) char.value = 0 char.valid_values = [0, 1, 2]
[ "def", "create_thermostat_service_valid_vals", "(", "accessory", ")", ":", "service", "=", "accessory", ".", "add_service", "(", "ServicesTypes", ".", "THERMOSTAT", ")", "char", "=", "service", ".", "add_char", "(", "CharacteristicsTypes", ".", "HEATING_COOLING_TARGET...
[ 75, 0 ]
[ 80, 33 ]
python
en
['en', 'mt', 'en']
True
test_climate_respect_supported_op_modes_2
(hass, utcnow)
Test that climate respects validValue hints.
Test that climate respects validValue hints.
async def test_climate_respect_supported_op_modes_2(hass, utcnow): """Test that climate respects validValue hints.""" helper = await setup_test_component(hass, create_thermostat_service_valid_vals) state = await helper.poll_and_get_state() assert state.attributes["hvac_modes"] == ["off", "heat", "cool"]
[ "async", "def", "test_climate_respect_supported_op_modes_2", "(", "hass", ",", "utcnow", ")", ":", "helper", "=", "await", "setup_test_component", "(", "hass", ",", "create_thermostat_service_valid_vals", ")", "state", "=", "await", "helper", ".", "poll_and_get_state", ...
[ 83, 0 ]
[ 87, 68 ]
python
en
['en', 'en', 'en']
True
test_climate_change_thermostat_state
(hass, utcnow)
Test that we can turn a HomeKit thermostat on and off again.
Test that we can turn a HomeKit thermostat on and off again.
async def test_climate_change_thermostat_state(hass, utcnow): """Test that we can turn a HomeKit thermostat on and off again.""" helper = await setup_test_component(hass, create_thermostat_service) await hass.services.async_call( DOMAIN, SERVICE_SET_HVAC_MODE, {"entity_id": "climate...
[ "async", "def", "test_climate_change_thermostat_state", "(", "hass", ",", "utcnow", ")", ":", "helper", "=", "await", "setup_test_component", "(", "hass", ",", "create_thermostat_service", ")", "await", "hass", ".", "services", ".", "async_call", "(", "DOMAIN", ",...
[ 90, 0 ]
[ 125, 68 ]
python
en
['en', 'en', 'en']
True
test_climate_change_thermostat_temperature
(hass, utcnow)
Test that we can turn a HomeKit thermostat on and off again.
Test that we can turn a HomeKit thermostat on and off again.
async def test_climate_change_thermostat_temperature(hass, utcnow): """Test that we can turn a HomeKit thermostat on and off again.""" helper = await setup_test_component(hass, create_thermostat_service) await hass.services.async_call( DOMAIN, SERVICE_SET_TEMPERATURE, {"entity_id": ...
[ "async", "def", "test_climate_change_thermostat_temperature", "(", "hass", ",", "utcnow", ")", ":", "helper", "=", "await", "setup_test_component", "(", "hass", ",", "create_thermostat_service", ")", "await", "hass", ".", "services", ".", "async_call", "(", "DOMAIN"...
[ 128, 0 ]
[ 146, 65 ]
python
en
['en', 'en', 'en']
True
test_climate_change_thermostat_humidity
(hass, utcnow)
Test that we can turn a HomeKit thermostat on and off again.
Test that we can turn a HomeKit thermostat on and off again.
async def test_climate_change_thermostat_humidity(hass, utcnow): """Test that we can turn a HomeKit thermostat on and off again.""" helper = await setup_test_component(hass, create_thermostat_service) await hass.services.async_call( DOMAIN, SERVICE_SET_HUMIDITY, {"entity_id": "clima...
[ "async", "def", "test_climate_change_thermostat_humidity", "(", "hass", ",", "utcnow", ")", ":", "helper", "=", "await", "setup_test_component", "(", "hass", ",", "create_thermostat_service", ")", "await", "hass", ".", "services", ".", "async_call", "(", "DOMAIN", ...
[ 149, 0 ]
[ 167, 62 ]
python
en
['en', 'en', 'en']
True
test_climate_read_thermostat_state
(hass, utcnow)
Test that we can read the state of a HomeKit thermostat accessory.
Test that we can read the state of a HomeKit thermostat accessory.
async def test_climate_read_thermostat_state(hass, utcnow): """Test that we can read the state of a HomeKit thermostat accessory.""" helper = await setup_test_component(hass, create_thermostat_service) # Simulate that heating is on helper.characteristics[TEMPERATURE_CURRENT].value = 19 helper.chara...
[ "async", "def", "test_climate_read_thermostat_state", "(", "hass", ",", "utcnow", ")", ":", "helper", "=", "await", "setup_test_component", "(", "hass", ",", "create_thermostat_service", ")", "# Simulate that heating is on", "helper", ".", "characteristics", "[", "TEMPE...
[ 170, 0 ]
[ 209, 45 ]
python
en
['en', 'en', 'en']
True
test_hvac_mode_vs_hvac_action
(hass, utcnow)
Check that we haven't conflated hvac_mode and hvac_action.
Check that we haven't conflated hvac_mode and hvac_action.
async def test_hvac_mode_vs_hvac_action(hass, utcnow): """Check that we haven't conflated hvac_mode and hvac_action.""" helper = await setup_test_component(hass, create_thermostat_service) # Simulate that current temperature is above target temp # Heating might be on, but hvac_action currently 'off' ...
[ "async", "def", "test_hvac_mode_vs_hvac_action", "(", "hass", ",", "utcnow", ")", ":", "helper", "=", "await", "setup_test_component", "(", "hass", ",", "create_thermostat_service", ")", "# Simulate that current temperature is above target temp", "# Heating might be on, but hva...
[ 212, 0 ]
[ 236, 55 ]
python
en
['en', 'en', 'en']
True
create_heater_cooler_service
(accessory)
Define thermostat characteristics.
Define thermostat characteristics.
def create_heater_cooler_service(accessory): """Define thermostat characteristics.""" service = accessory.add_service(ServicesTypes.HEATER_COOLER) char = service.add_char(CharacteristicsTypes.TARGET_HEATER_COOLER_STATE) char.value = 0 char = service.add_char(CharacteristicsTypes.CURRENT_HEATER_COO...
[ "def", "create_heater_cooler_service", "(", "accessory", ")", ":", "service", "=", "accessory", ".", "add_service", "(", "ServicesTypes", ".", "HEATER_COOLER", ")", "char", "=", "service", ".", "add_char", "(", "CharacteristicsTypes", ".", "TARGET_HEATER_COOLER_STATE"...
[ 248, 0 ]
[ 275, 18 ]
python
en
['en', 'mt', 'en']
True
create_heater_cooler_service_min_max
(accessory)
Define thermostat characteristics.
Define thermostat characteristics.
def create_heater_cooler_service_min_max(accessory): """Define thermostat characteristics.""" service = accessory.add_service(ServicesTypes.HEATER_COOLER) char = service.add_char(CharacteristicsTypes.TARGET_HEATER_COOLER_STATE) char.value = 1 char.minValue = 1 char.maxValue = 2
[ "def", "create_heater_cooler_service_min_max", "(", "accessory", ")", ":", "service", "=", "accessory", ".", "add_service", "(", "ServicesTypes", ".", "HEATER_COOLER", ")", "char", "=", "service", ".", "add_char", "(", "CharacteristicsTypes", ".", "TARGET_HEATER_COOLE...
[ 279, 0 ]
[ 285, 21 ]
python
en
['en', 'mt', 'en']
True
test_heater_cooler_respect_supported_op_modes_1
(hass, utcnow)
Test that climate respects minValue/maxValue hints.
Test that climate respects minValue/maxValue hints.
async def test_heater_cooler_respect_supported_op_modes_1(hass, utcnow): """Test that climate respects minValue/maxValue hints.""" helper = await setup_test_component(hass, create_heater_cooler_service_min_max) state = await helper.poll_and_get_state() assert state.attributes["hvac_modes"] == ["heat", "...
[ "async", "def", "test_heater_cooler_respect_supported_op_modes_1", "(", "hass", ",", "utcnow", ")", ":", "helper", "=", "await", "setup_test_component", "(", "hass", ",", "create_heater_cooler_service_min_max", ")", "state", "=", "await", "helper", ".", "poll_and_get_st...
[ 288, 0 ]
[ 292, 68 ]
python
en
['en', 'en', 'en']
True
create_theater_cooler_service_valid_vals
(accessory)
Define heater-cooler characteristics.
Define heater-cooler characteristics.
def create_theater_cooler_service_valid_vals(accessory): """Define heater-cooler characteristics.""" service = accessory.add_service(ServicesTypes.HEATER_COOLER) char = service.add_char(CharacteristicsTypes.TARGET_HEATER_COOLER_STATE) char.value = 1 char.valid_values = [1, 2]
[ "def", "create_theater_cooler_service_valid_vals", "(", "accessory", ")", ":", "service", "=", "accessory", ".", "add_service", "(", "ServicesTypes", ".", "HEATER_COOLER", ")", "char", "=", "service", ".", "add_char", "(", "CharacteristicsTypes", ".", "TARGET_HEATER_C...
[ 295, 0 ]
[ 300, 30 ]
python
en
['sv', 'ro', 'en']
False
test_heater_cooler_respect_supported_op_modes_2
(hass, utcnow)
Test that climate respects validValue hints.
Test that climate respects validValue hints.
async def test_heater_cooler_respect_supported_op_modes_2(hass, utcnow): """Test that climate respects validValue hints.""" helper = await setup_test_component(hass, create_theater_cooler_service_valid_vals) state = await helper.poll_and_get_state() assert state.attributes["hvac_modes"] == ["heat", "coo...
[ "async", "def", "test_heater_cooler_respect_supported_op_modes_2", "(", "hass", ",", "utcnow", ")", ":", "helper", "=", "await", "setup_test_component", "(", "hass", ",", "create_theater_cooler_service_valid_vals", ")", "state", "=", "await", "helper", ".", "poll_and_ge...
[ 303, 0 ]
[ 307, 68 ]
python
en
['en', 'en', 'en']
True
test_heater_cooler_change_thermostat_state
(hass, utcnow)
Test that we can change the operational mode.
Test that we can change the operational mode.
async def test_heater_cooler_change_thermostat_state(hass, utcnow): """Test that we can change the operational mode.""" helper = await setup_test_component(hass, create_heater_cooler_service) await hass.services.async_call( DOMAIN, SERVICE_SET_HVAC_MODE, {"entity_id": "climate.testd...
[ "async", "def", "test_heater_cooler_change_thermostat_state", "(", "hass", ",", "utcnow", ")", ":", "helper", "=", "await", "setup_test_component", "(", "hass", ",", "create_heater_cooler_service", ")", "await", "hass", ".", "services", ".", "async_call", "(", "DOMA...
[ 310, 0 ]
[ 357, 5 ]
python
en
['en', 'en', 'en']
True
test_heater_cooler_change_thermostat_temperature
(hass, utcnow)
Test that we can change the target temperature.
Test that we can change the target temperature.
async def test_heater_cooler_change_thermostat_temperature(hass, utcnow): """Test that we can change the target temperature.""" helper = await setup_test_component(hass, create_heater_cooler_service) await hass.services.async_call( DOMAIN, SERVICE_SET_HVAC_MODE, {"entity_id": "clima...
[ "async", "def", "test_heater_cooler_change_thermostat_temperature", "(", "hass", ",", "utcnow", ")", ":", "helper", "=", "await", "setup_test_component", "(", "hass", ",", "create_heater_cooler_service", ")", "await", "hass", ".", "services", ".", "async_call", "(", ...
[ 360, 0 ]
[ 390, 76 ]
python
en
['en', 'en', 'en']
True
test_heater_cooler_read_thermostat_state
(hass, utcnow)
Test that we can read the state of a HomeKit thermostat accessory.
Test that we can read the state of a HomeKit thermostat accessory.
async def test_heater_cooler_read_thermostat_state(hass, utcnow): """Test that we can read the state of a HomeKit thermostat accessory.""" helper = await setup_test_component(hass, create_heater_cooler_service) # Simulate that heating is on helper.characteristics[HEATER_COOLER_TEMPERATURE_CURRENT].valu...
[ "async", "def", "test_heater_cooler_read_thermostat_state", "(", "hass", ",", "utcnow", ")", ":", "helper", "=", "await", "setup_test_component", "(", "hass", ",", "create_heater_cooler_service", ")", "# Simulate that heating is on", "helper", ".", "characteristics", "[",...
[ 393, 0 ]
[ 441, 45 ]
python
en
['en', 'en', 'en']
True
test_heater_cooler_hvac_mode_vs_hvac_action
(hass, utcnow)
Check that we haven't conflated hvac_mode and hvac_action.
Check that we haven't conflated hvac_mode and hvac_action.
async def test_heater_cooler_hvac_mode_vs_hvac_action(hass, utcnow): """Check that we haven't conflated hvac_mode and hvac_action.""" helper = await setup_test_component(hass, create_heater_cooler_service) # Simulate that current temperature is above target temp # Heating might be on, but hvac_action c...
[ "async", "def", "test_heater_cooler_hvac_mode_vs_hvac_action", "(", "hass", ",", "utcnow", ")", ":", "helper", "=", "await", "setup_test_component", "(", "hass", ",", "create_heater_cooler_service", ")", "# Simulate that current temperature is above target temp", "# Heating mig...
[ 444, 0 ]
[ 473, 55 ]
python
en
['en', 'en', 'en']
True
test_heater_cooler_change_swing_mode
(hass, utcnow)
Test that we can change the swing mode.
Test that we can change the swing mode.
async def test_heater_cooler_change_swing_mode(hass, utcnow): """Test that we can change the swing mode.""" helper = await setup_test_component(hass, create_heater_cooler_service) await hass.services.async_call( DOMAIN, SERVICE_SET_SWING_MODE, {"entity_id": "climate.testdevice", "sw...
[ "async", "def", "test_heater_cooler_change_swing_mode", "(", "hass", ",", "utcnow", ")", ":", "helper", "=", "await", "setup_test_component", "(", "hass", ",", "create_heater_cooler_service", ")", "await", "hass", ".", "services", ".", "async_call", "(", "DOMAIN", ...
[ 476, 0 ]
[ 494, 79 ]
python
en
['en', 'en', 'en']
True
test_heater_cooler_turn_off
(hass, utcnow)
Test that both hvac_action and hvac_mode return "off" when turned off.
Test that both hvac_action and hvac_mode return "off" when turned off.
async def test_heater_cooler_turn_off(hass, utcnow): """Test that both hvac_action and hvac_mode return "off" when turned off.""" helper = await setup_test_component(hass, create_heater_cooler_service) # Simulate that the device is turned off but CURRENT_HEATER_COOLER_STATE still returns HEATING/COOLING ...
[ "async", "def", "test_heater_cooler_turn_off", "(", "hass", ",", "utcnow", ")", ":", "helper", "=", "await", "setup_test_component", "(", "hass", ",", "create_heater_cooler_service", ")", "# Simulate that the device is turned off but CURRENT_HEATER_COOLER_STATE still returns HEAT...
[ 497, 0 ]
[ 510, 51 ]
python
en
['en', 'en', 'en']
True
async_setup_entry
( hass: HomeAssistantType, config_entry: ConfigEntry, async_add_entities: Callable[[List[Entity], bool], None], )
Set up from config entry.
Set up from config entry.
async def async_setup_entry( hass: HomeAssistantType, config_entry: ConfigEntry, async_add_entities: Callable[[List[Entity], bool], None], ) -> None: """Set up from config entry.""" router = hass.data[DOMAIN].routers[config_entry.data[CONF_URL]] sensors: List[Entity] = [] for key in SENSOR_K...
[ "async", "def", "async_setup_entry", "(", "hass", ":", "HomeAssistantType", ",", "config_entry", ":", "ConfigEntry", ",", "async_add_entities", ":", "Callable", "[", "[", "List", "[", "Entity", "]", ",", "bool", "]", ",", "None", "]", ",", ")", "->", "None...
[ 328, 0 ]
[ 353, 37 ]
python
en
['en', 'en', 'en']
True
format_default
(value: StateType)
Format value.
Format value.
def format_default(value: StateType) -> Tuple[StateType, Optional[str]]: """Format value.""" unit = None if value is not None: # Clean up value and infer unit, e.g. -71dBm, 15 dB match = re.match( r"([>=<]*)(?P<value>.+?)\s*(?P<unit>[a-zA-Z]+)\s*$", str(value) ) i...
[ "def", "format_default", "(", "value", ":", "StateType", ")", "->", "Tuple", "[", "StateType", ",", "Optional", "[", "str", "]", "]", ":", "unit", "=", "None", "if", "value", "is", "not", "None", ":", "# Clean up value and infer unit, e.g. -71dBm, 15 dB", "mat...
[ 356, 0 ]
[ 370, 22 ]
python
en
['nl', 'sv', 'en']
False
get_scanner
(hass, config)
Return a BT Smart Hub scanner if successful.
Return a BT Smart Hub scanner if successful.
def get_scanner(hass, config): """Return a BT Smart Hub scanner if successful.""" info = config[DOMAIN] smarthub_client = BTSmartHub( router_ip=info[CONF_HOST], smarthub_model=info.get(CONF_SMARTHUB_MODEL) ) scanner = BTSmartHubScanner(smarthub_client) return scanner if scanner.success...
[ "def", "get_scanner", "(", "hass", ",", "config", ")", ":", "info", "=", "config", "[", "DOMAIN", "]", "smarthub_client", "=", "BTSmartHub", "(", "router_ip", "=", "info", "[", "CONF_HOST", "]", ",", "smarthub_model", "=", "info", ".", "get", "(", "CONF_...
[ 27, 0 ]
[ 36, 52 ]
python
en
['en', 'co', 'en']
True
BTSmartHubScanner.__init__
(self, smarthub_client)
Initialise the scanner.
Initialise the scanner.
def __init__(self, smarthub_client): """Initialise the scanner.""" self.smarthub = smarthub_client self.last_results = {} self.success_init = False # Test the router is accessible data = self.get_bt_smarthub_data() if data: self.success_init = True ...
[ "def", "__init__", "(", "self", ",", "smarthub_client", ")", ":", "self", ".", "smarthub", "=", "smarthub_client", "self", ".", "last_results", "=", "{", "}", "self", ".", "success_init", "=", "False", "# Test the router is accessible", "data", "=", "self", "....
[ 42, 4 ]
[ 53, 76 ]
python
en
['en', 'en', 'en']
True
BTSmartHubScanner.scan_devices
(self)
Scan for new devices and return a list with found device IDs.
Scan for new devices and return a list with found device IDs.
def scan_devices(self): """Scan for new devices and return a list with found device IDs.""" self._update_info() return [client["mac"] for client in self.last_results]
[ "def", "scan_devices", "(", "self", ")", ":", "self", ".", "_update_info", "(", ")", "return", "[", "client", "[", "\"mac\"", "]", "for", "client", "in", "self", ".", "last_results", "]" ]
[ 55, 4 ]
[ 58, 62 ]
python
en
['en', 'en', 'en']
True
BTSmartHubScanner.get_device_name
(self, device)
Return the name of the given device or None if we don't know.
Return the name of the given device or None if we don't know.
def get_device_name(self, device): """Return the name of the given device or None if we don't know.""" if not self.last_results: return None for client in self.last_results: if client["mac"] == device: return client["host"] return None
[ "def", "get_device_name", "(", "self", ",", "device", ")", ":", "if", "not", "self", ".", "last_results", ":", "return", "None", "for", "client", "in", "self", ".", "last_results", ":", "if", "client", "[", "\"mac\"", "]", "==", "device", ":", "return", ...
[ 60, 4 ]
[ 67, 19 ]
python
en
['en', 'en', 'en']
True
BTSmartHubScanner._update_info
(self)
Ensure the information from the BT Smart Hub is up to date.
Ensure the information from the BT Smart Hub is up to date.
def _update_info(self): """Ensure the information from the BT Smart Hub is up to date.""" if not self.success_init: return _LOGGER.info("Scanning") data = self.get_bt_smarthub_data() if not data: _LOGGER.warning("Error scanning devices") retur...
[ "def", "_update_info", "(", "self", ")", ":", "if", "not", "self", ".", "success_init", ":", "return", "_LOGGER", ".", "info", "(", "\"Scanning\"", ")", "data", "=", "self", ".", "get_bt_smarthub_data", "(", ")", "if", "not", "data", ":", "_LOGGER", ".",...
[ 69, 4 ]
[ 81, 35 ]
python
en
['en', 'en', 'en']
True
BTSmartHubScanner.get_bt_smarthub_data
(self)
Retrieve data from BT Smart Hub and return parsed result.
Retrieve data from BT Smart Hub and return parsed result.
def get_bt_smarthub_data(self): """Retrieve data from BT Smart Hub and return parsed result.""" # Request data from bt smarthub into a list of dicts. data = self.smarthub.get_devicelist(only_active_devices=True) # Renaming keys from parsed result. devices = {} for devic...
[ "def", "get_bt_smarthub_data", "(", "self", ")", ":", "# Request data from bt smarthub into a list of dicts.", "data", "=", "self", ".", "smarthub", ".", "get_devicelist", "(", "only_active_devices", "=", "True", ")", "# Renaming keys from parsed result.", "devices", "=", ...
[ 83, 4 ]
[ 101, 22 ]
python
en
['en', 'en', 'en']
True
async_setup_entry
( hass: HomeAssistantType, entry: ConfigEntry, async_add_entities: Callable[[list], None], )
Set up the ISY994 fan platform.
Set up the ISY994 fan platform.
async def async_setup_entry( hass: HomeAssistantType, entry: ConfigEntry, async_add_entities: Callable[[list], None], ) -> bool: """Set up the ISY994 fan platform.""" hass_isy_data = hass.data[ISY994_DOMAIN][entry.entry_id] devices = [] for node in hass_isy_data[ISY994_NODES][FAN]: ...
[ "async", "def", "async_setup_entry", "(", "hass", ":", "HomeAssistantType", ",", "entry", ":", "ConfigEntry", ",", "async_add_entities", ":", "Callable", "[", "[", "list", "]", ",", "None", "]", ",", ")", "->", "bool", ":", "hass_isy_data", "=", "hass", "....
[ 35, 0 ]
[ 51, 31 ]
python
en
['en', 'cs', 'en']
True
ISYFanEntity.speed
(self)
Return the current speed.
Return the current speed.
def speed(self) -> str: """Return the current speed.""" return VALUE_TO_STATE.get(self._node.status)
[ "def", "speed", "(", "self", ")", "->", "str", ":", "return", "VALUE_TO_STATE", ".", "get", "(", "self", ".", "_node", ".", "status", ")" ]
[ 58, 4 ]
[ 60, 52 ]
python
en
['en', 'en', 'en']
True
ISYFanEntity.is_on
(self)
Get if the fan is on.
Get if the fan is on.
def is_on(self) -> bool: """Get if the fan is on.""" if self._node.status == ISY_VALUE_UNKNOWN: return None return self._node.status != 0
[ "def", "is_on", "(", "self", ")", "->", "bool", ":", "if", "self", ".", "_node", ".", "status", "==", "ISY_VALUE_UNKNOWN", ":", "return", "None", "return", "self", ".", "_node", ".", "status", "!=", "0" ]
[ 63, 4 ]
[ 67, 37 ]
python
en
['en', 'fy', 'en']
True
ISYFanEntity.set_speed
(self, speed: str)
Send the set speed command to the ISY994 fan device.
Send the set speed command to the ISY994 fan device.
def set_speed(self, speed: str) -> None: """Send the set speed command to the ISY994 fan device.""" self._node.turn_on(val=STATE_TO_VALUE.get(speed, 255))
[ "def", "set_speed", "(", "self", ",", "speed", ":", "str", ")", "->", "None", ":", "self", ".", "_node", ".", "turn_on", "(", "val", "=", "STATE_TO_VALUE", ".", "get", "(", "speed", ",", "255", ")", ")" ]
[ 69, 4 ]
[ 71, 62 ]
python
en
['en', 'en', 'en']
True
ISYFanEntity.turn_on
(self, speed: str = None, **kwargs)
Send the turn on command to the ISY994 fan device.
Send the turn on command to the ISY994 fan device.
def turn_on(self, speed: str = None, **kwargs) -> None: """Send the turn on command to the ISY994 fan device.""" self.set_speed(speed)
[ "def", "turn_on", "(", "self", ",", "speed", ":", "str", "=", "None", ",", "*", "*", "kwargs", ")", "->", "None", ":", "self", ".", "set_speed", "(", "speed", ")" ]
[ 73, 4 ]
[ 75, 29 ]
python
en
['en', 'en', 'en']
True
ISYFanEntity.turn_off
(self, **kwargs)
Send the turn off command to the ISY994 fan device.
Send the turn off command to the ISY994 fan device.
def turn_off(self, **kwargs) -> None: """Send the turn off command to the ISY994 fan device.""" self._node.turn_off()
[ "def", "turn_off", "(", "self", ",", "*", "*", "kwargs", ")", "->", "None", ":", "self", ".", "_node", ".", "turn_off", "(", ")" ]
[ 77, 4 ]
[ 79, 29 ]
python
en
['en', 'en', 'en']
True
ISYFanEntity.speed_list
(self)
Get the list of available speeds.
Get the list of available speeds.
def speed_list(self) -> list: """Get the list of available speeds.""" return [SPEED_OFF, SPEED_LOW, SPEED_MEDIUM, SPEED_HIGH]
[ "def", "speed_list", "(", "self", ")", "->", "list", ":", "return", "[", "SPEED_OFF", ",", "SPEED_LOW", ",", "SPEED_MEDIUM", ",", "SPEED_HIGH", "]" ]
[ 82, 4 ]
[ 84, 63 ]
python
en
['en', 'en', 'en']
True
ISYFanEntity.supported_features
(self)
Flag supported features.
Flag supported features.
def supported_features(self) -> int: """Flag supported features.""" return SUPPORT_SET_SPEED
[ "def", "supported_features", "(", "self", ")", "->", "int", ":", "return", "SUPPORT_SET_SPEED" ]
[ 87, 4 ]
[ 89, 32 ]
python
en
['da', 'en', 'en']
True
ISYFanProgramEntity.speed
(self)
Return the current speed.
Return the current speed.
def speed(self) -> str: """Return the current speed.""" return VALUE_TO_STATE.get(self._node.status)
[ "def", "speed", "(", "self", ")", "->", "str", ":", "return", "VALUE_TO_STATE", ".", "get", "(", "self", ".", "_node", ".", "status", ")" ]
[ 96, 4 ]
[ 98, 52 ]
python
en
['en', 'en', 'en']
True
ISYFanProgramEntity.is_on
(self)
Get if the fan is on.
Get if the fan is on.
def is_on(self) -> bool: """Get if the fan is on.""" return self._node.status != 0
[ "def", "is_on", "(", "self", ")", "->", "bool", ":", "return", "self", ".", "_node", ".", "status", "!=", "0" ]
[ 101, 4 ]
[ 103, 37 ]
python
en
['en', 'fy', 'en']
True
ISYFanProgramEntity.turn_off
(self, **kwargs)
Send the turn on command to ISY994 fan program.
Send the turn on command to ISY994 fan program.
def turn_off(self, **kwargs) -> None: """Send the turn on command to ISY994 fan program.""" if not self._actions.run_then(): _LOGGER.error("Unable to turn off the fan")
[ "def", "turn_off", "(", "self", ",", "*", "*", "kwargs", ")", "->", "None", ":", "if", "not", "self", ".", "_actions", ".", "run_then", "(", ")", ":", "_LOGGER", ".", "error", "(", "\"Unable to turn off the fan\"", ")" ]
[ 105, 4 ]
[ 108, 55 ]
python
en
['en', 'fy', 'en']
True
ISYFanProgramEntity.turn_on
(self, speed: str = None, **kwargs)
Send the turn off command to ISY994 fan program.
Send the turn off command to ISY994 fan program.
def turn_on(self, speed: str = None, **kwargs) -> None: """Send the turn off command to ISY994 fan program.""" if not self._actions.run_else(): _LOGGER.error("Unable to turn on the fan")
[ "def", "turn_on", "(", "self", ",", "speed", ":", "str", "=", "None", ",", "*", "*", "kwargs", ")", "->", "None", ":", "if", "not", "self", ".", "_actions", ".", "run_else", "(", ")", ":", "_LOGGER", ".", "error", "(", "\"Unable to turn on the fan\"", ...
[ 110, 4 ]
[ 113, 54 ]
python
en
['en', 'fy', 'en']
True
NetworkMorphismTuner.__init__
( self, task="cv", input_width=32, input_channel=3, n_output_node=10, algorithm_name="Bayesian", optimize_mode="maximize", path="model_path", verbose=True, beta=Constant.BETA, t_min=Consta...
initilizer of the NetworkMorphismTuner.
initilizer of the NetworkMorphismTuner.
def __init__( self, task="cv", input_width=32, input_channel=3, n_output_node=10, algorithm_name="Bayesian", optimize_mode="maximize", path="model_path", verbose=True, beta=Constant.BETA, ...
[ "def", "__init__", "(", "self", ",", "task", "=", "\"cv\"", ",", "input_width", "=", "32", ",", "input_channel", "=", "3", ",", "n_output_node", "=", "10", ",", "algorithm_name", "=", "\"Bayesian\"", ",", "optimize_mode", "=", "\"maximize\"", ",", "path", ...
[ 61, 4 ]
[ 114, 34 ]
python
en
['en', 'error', 'th']
False
NetworkMorphismTuner.update_search_space
(self, search_space)
Update search space definition in tuner by search_space in neural architecture.
Update search space definition in tuner by search_space in neural architecture.
def update_search_space(self, search_space): """ Update search space definition in tuner by search_space in neural architecture. """ self.search_space = search_space
[ "def", "update_search_space", "(", "self", ",", "search_space", ")", ":", "self", ".", "search_space", "=", "search_space" ]
[ 117, 4 ]
[ 121, 40 ]
python
en
['en', 'error', 'th']
False
NetworkMorphismTuner.generate_parameters
(self, parameter_id, **kwargs)
Returns a set of trial neural architecture, as a serializable object. Parameters ---------- parameter_id : int
Returns a set of trial neural architecture, as a serializable object.
def generate_parameters(self, parameter_id, **kwargs): """ Returns a set of trial neural architecture, as a serializable object. Parameters ---------- parameter_id : int """ if not self.history: self.init_search() new_father_id = None ...
[ "def", "generate_parameters", "(", "self", ",", "parameter_id", ",", "*", "*", "kwargs", ")", ":", "if", "not", "self", ".", "history", ":", "self", ".", "init_search", "(", ")", "new_father_id", "=", "None", "generated_graph", "=", "None", "if", "not", ...
[ 123, 4 ]
[ 151, 23 ]
python
en
['en', 'error', 'th']
False
NetworkMorphismTuner.receive_trial_result
(self, parameter_id, parameters, value, **kwargs)
Record an observation of the objective function. Parameters ---------- parameter_id : int the id of a group of paramters that generated by nni manager. parameters : dict A group of parameters. value : dict/float if value is dict, it s...
Record an observation of the objective function.
def receive_trial_result(self, parameter_id, parameters, value, **kwargs): """ Record an observation of the objective function. Parameters ---------- parameter_id : int the id of a group of paramters that generated by nni manager. parameters : dict ...
[ "def", "receive_trial_result", "(", "self", ",", "parameter_id", ",", "parameters", ",", "value", ",", "*", "*", "kwargs", ")", ":", "reward", "=", "extract_scalar_reward", "(", "value", ")", "if", "parameter_id", "not", "in", "self", ".", "total_data", ":",...
[ 153, 4 ]
[ 177, 55 ]
python
en
['en', 'error', 'th']
False
NetworkMorphismTuner.init_search
(self)
Call the generators to generate the initial architectures for the search.
Call the generators to generate the initial architectures for the search.
def init_search(self): """ Call the generators to generate the initial architectures for the search. """ if self.verbose: logger.info("Initializing search.") for generator in self.generators: graph = generator(self.n_classes, self.input_shape).generate( ...
[ "def", "init_search", "(", "self", ")", ":", "if", "self", ".", "verbose", ":", "logger", ".", "info", "(", "\"Initializing search.\"", ")", "for", "generator", "in", "self", ".", "generators", ":", "graph", "=", "generator", "(", "self", ".", "n_classes",...
[ 180, 4 ]
[ 196, 51 ]
python
en
['en', 'error', 'th']
False
NetworkMorphismTuner.generate
(self)
Generate the next neural architecture. Returns ------- other_info : any object Anything to be saved in the training queue together with the architecture. generated_graph : Graph An instance of Graph.
Generate the next neural architecture.
def generate(self): """ Generate the next neural architecture. Returns ------- other_info : any object Anything to be saved in the training queue together with the architecture. generated_graph : Graph An instance of Graph. """ gen...
[ "def", "generate", "(", "self", ")", ":", "generated_graph", ",", "new_father_id", "=", "self", ".", "bo", ".", "generate", "(", "self", ".", "descriptors", ")", "if", "new_father_id", "is", "None", ":", "new_father_id", "=", "0", "generated_graph", "=", "...
[ 199, 4 ]
[ 217, 45 ]
python
en
['en', 'error', 'th']
False
NetworkMorphismTuner.update
(self, other_info, graph, metric_value, model_id)
Update the controller with evaluation result of a neural architecture. Parameters ---------- other_info: any object In our case it is the father ID in the search tree. graph: graph.Graph An instance of Graph. The trained neural architecture. metr...
Update the controller with evaluation result of a neural architecture.
def update(self, other_info, graph, metric_value, model_id): """ Update the controller with evaluation result of a neural architecture. Parameters ---------- other_info: any object In our case it is the father ID in the search tree. graph: graph.Graph ...
[ "def", "update", "(", "self", ",", "other_info", ",", "graph", ",", "metric_value", ",", "model_id", ")", ":", "father_id", "=", "other_info", "self", ".", "bo", ".", "fit", "(", "[", "graph", ".", "extract_descriptor", "(", ")", "]", ",", "[", "metric...
[ 219, 4 ]
[ 235, 46 ]
python
en
['en', 'error', 'th']
False
NetworkMorphismTuner.add_model
(self, metric_value, model_id)
Add model to the history, x_queue and y_queue Parameters ---------- metric_value : float graph : dict model_id : int Returns ------- model : dict
Add model to the history, x_queue and y_queue
def add_model(self, metric_value, model_id): """ Add model to the history, x_queue and y_queue Parameters ---------- metric_value : float graph : dict model_id : int Returns ------- model : dict """ if self.verbose: ...
[ "def", "add_model", "(", "self", ",", "metric_value", ",", "model_id", ")", ":", "if", "self", ".", "verbose", ":", "logger", ".", "info", "(", "\"Saving model.\"", ")", "# Update best_model text file", "ret", "=", "{", "\"model_id\"", ":", "model_id", ",", ...
[ 237, 4 ]
[ 261, 18 ]
python
en
['en', 'error', 'th']
False
NetworkMorphismTuner.get_best_model_id
(self)
Get the best model_id from history using the metric value
Get the best model_id from history using the metric value
def get_best_model_id(self): """ Get the best model_id from history using the metric value """ if self.optimize_mode is OptimizeMode.Maximize: return max(self.history, key=lambda x: x["metric_value"])[ "model_id"] return min(self.history, key=lambda x...
[ "def", "get_best_model_id", "(", "self", ")", ":", "if", "self", ".", "optimize_mode", "is", "OptimizeMode", ".", "Maximize", ":", "return", "max", "(", "self", ".", "history", ",", "key", "=", "lambda", "x", ":", "x", "[", "\"metric_value\"", "]", ")", ...
[ 264, 4 ]
[ 272, 77 ]
python
en
['en', 'error', 'th']
False
NetworkMorphismTuner.load_model_by_id
(self, model_id)
Get the model by model_id Parameters ---------- model_id : int model index Returns ------- load_model : graph.Graph the model graph representation
Get the model by model_id
def load_model_by_id(self, model_id): """ Get the model by model_id Parameters ---------- model_id : int model index Returns ------- load_model : graph.Graph the model graph representation """ with open(os.path.jo...
[ "def", "load_model_by_id", "(", "self", ",", "model_id", ")", ":", "with", "open", "(", "os", ".", "path", ".", "join", "(", "self", ".", "path", ",", "str", "(", "model_id", ")", "+", "\".json\"", ")", ")", "as", "fin", ":", "json_str", "=", "fin"...
[ 275, 4 ]
[ 294, 25 ]
python
en
['en', 'error', 'th']
False
NetworkMorphismTuner.load_best_model
(self)
Get the best model by model id Returns ------- load_model : graph.Graph the model graph representation
Get the best model by model id
def load_best_model(self): """ Get the best model by model id Returns ------- load_model : graph.Graph the model graph representation """ return self.load_model_by_id(self.get_best_model_id())
[ "def", "load_best_model", "(", "self", ")", ":", "return", "self", ".", "load_model_by_id", "(", "self", ".", "get_best_model_id", "(", ")", ")" ]
[ 296, 4 ]
[ 305, 62 ]
python
en
['en', 'error', 'th']
False
NetworkMorphismTuner.get_metric_value_by_id
(self, model_id)
Get the model metric valud by its model_id Parameters ---------- model_id : int model index Returns ------- float the model metric
Get the model metric valud by its model_id
def get_metric_value_by_id(self, model_id): """ Get the model metric valud by its model_id Parameters ---------- model_id : int model index Returns ------- float the model metric """ for item in self.history: ...
[ "def", "get_metric_value_by_id", "(", "self", ",", "model_id", ")", ":", "for", "item", "in", "self", ".", "history", ":", "if", "item", "[", "\"model_id\"", "]", "==", "model_id", ":", "return", "item", "[", "\"metric_value\"", "]", "return", "None" ]
[ 307, 4 ]
[ 324, 19 ]
python
en
['en', 'error', 'th']
False
async_validate_config_item
(hass, config, full_config=None)
Validate config item.
Validate config item.
async def async_validate_config_item(hass, config, full_config=None): """Validate config item.""" config = SCRIPT_ENTRY_SCHEMA(config) config[CONF_SEQUENCE] = await asyncio.gather( *[ async_validate_action_config(hass, action) for action in config[CONF_SEQUENCE] ] ...
[ "async", "def", "async_validate_config_item", "(", "hass", ",", "config", ",", "full_config", "=", "None", ")", ":", "config", "=", "SCRIPT_ENTRY_SCHEMA", "(", "config", ")", "config", "[", "CONF_SEQUENCE", "]", "=", "await", "asyncio", ".", "gather", "(", "...
[ 14, 0 ]
[ 24, 17 ]
python
en
['en', 'la', 'en']
True
_try_async_validate_config_item
(hass, object_id, config, full_config=None)
Validate config item.
Validate config item.
async def _try_async_validate_config_item(hass, object_id, config, full_config=None): """Validate config item.""" try: cv.slug(object_id) config = await async_validate_config_item(hass, config, full_config) except (vol.Invalid, HomeAssistantError) as ex: async_log_exception(ex, DOMAI...
[ "async", "def", "_try_async_validate_config_item", "(", "hass", ",", "object_id", ",", "config", ",", "full_config", "=", "None", ")", ":", "try", ":", "cv", ".", "slug", "(", "object_id", ")", "config", "=", "await", "async_validate_config_item", "(", "hass",...
[ 27, 0 ]
[ 36, 17 ]
python
en
['en', 'la', 'en']
True
async_validate_config
(hass, config)
Validate config.
Validate config.
async def async_validate_config(hass, config): """Validate config.""" if DOMAIN in config: validated_config = {} for object_id, cfg in config[DOMAIN].items(): cfg = await _try_async_validate_config_item(hass, object_id, cfg, config) if cfg is not None: val...
[ "async", "def", "async_validate_config", "(", "hass", ",", "config", ")", ":", "if", "DOMAIN", "in", "config", ":", "validated_config", "=", "{", "}", "for", "object_id", ",", "cfg", "in", "config", "[", "DOMAIN", "]", ".", "items", "(", ")", ":", "cfg...
[ 39, 0 ]
[ 49, 17 ]
python
en
['en', 'la', 'it']
False
TestLiteJet.setup_method
(self, method)
Set up things to be run when tests are started.
Set up things to be run when tests are started.
def setup_method(self, method): """Set up things to be run when tests are started.""" self.hass = get_test_home_assistant() self.hass.start() self.hass.block_till_done()
[ "def", "setup_method", "(", "self", ",", "method", ")", ":", "self", ".", "hass", "=", "get_test_home_assistant", "(", ")", "self", ".", "hass", ".", "start", "(", ")", "self", ".", "hass", ".", "block_till_done", "(", ")" ]
[ 14, 4 ]
[ 18, 35 ]
python
en
['en', 'en', 'en']
True
TestLiteJet.teardown_method
(self, method)
Stop everything that was started.
Stop everything that was started.
def teardown_method(self, method): """Stop everything that was started.""" self.hass.stop()
[ "def", "teardown_method", "(", "self", ",", "method", ")", ":", "self", ".", "hass", ".", "stop", "(", ")" ]
[ 20, 4 ]
[ 22, 24 ]
python
en
['en', 'en', 'en']
True
TestLiteJet.test_is_ignored_unspecified
(self)
Ensure it is ignored when unspecified.
Ensure it is ignored when unspecified.
def test_is_ignored_unspecified(self): """Ensure it is ignored when unspecified.""" self.hass.data["litejet_config"] = {} assert not litejet.is_ignored(self.hass, "Test")
[ "def", "test_is_ignored_unspecified", "(", "self", ")", ":", "self", ".", "hass", ".", "data", "[", "\"litejet_config\"", "]", "=", "{", "}", "assert", "not", "litejet", ".", "is_ignored", "(", "self", ".", "hass", ",", "\"Test\"", ")" ]
[ 24, 4 ]
[ 27, 56 ]
python
en
['en', 'en', 'en']
True
TestLiteJet.test_is_ignored_empty
(self)
Ensure it is ignored when empty.
Ensure it is ignored when empty.
def test_is_ignored_empty(self): """Ensure it is ignored when empty.""" self.hass.data["litejet_config"] = {litejet.CONF_EXCLUDE_NAMES: []} assert not litejet.is_ignored(self.hass, "Test")
[ "def", "test_is_ignored_empty", "(", "self", ")", ":", "self", ".", "hass", ".", "data", "[", "\"litejet_config\"", "]", "=", "{", "litejet", ".", "CONF_EXCLUDE_NAMES", ":", "[", "]", "}", "assert", "not", "litejet", ".", "is_ignored", "(", "self", ".", ...
[ 29, 4 ]
[ 32, 56 ]
python
en
['en', 'fy', 'en']
True
TestLiteJet.test_is_ignored_normal
(self)
Test if usually ignored.
Test if usually ignored.
def test_is_ignored_normal(self): """Test if usually ignored.""" self.hass.data["litejet_config"] = { litejet.CONF_EXCLUDE_NAMES: ["Test", "Other One"] } assert litejet.is_ignored(self.hass, "Test") assert not litejet.is_ignored(self.hass, "Other one") assert ...
[ "def", "test_is_ignored_normal", "(", "self", ")", ":", "self", ".", "hass", ".", "data", "[", "\"litejet_config\"", "]", "=", "{", "litejet", ".", "CONF_EXCLUDE_NAMES", ":", "[", "\"Test\"", ",", "\"Other One\"", "]", "}", "assert", "litejet", ".", "is_igno...
[ 34, 4 ]
[ 43, 57 ]
python
en
['en', 'en', 'en']
True
async_get_actions
(hass: HomeAssistant, device_id: str)
List device actions for NEW_NAME devices.
List device actions for NEW_NAME devices.
async def async_get_actions(hass: HomeAssistant, device_id: str) -> List[dict]: """List device actions for NEW_NAME devices.""" registry = await entity_registry.async_get_registry(hass) actions = [] # TODO Read this comment and remove it. # This example shows how to iterate over the entities of thi...
[ "async", "def", "async_get_actions", "(", "hass", ":", "HomeAssistant", ",", "device_id", ":", "str", ")", "->", "List", "[", "dict", "]", ":", "registry", "=", "await", "entity_registry", ".", "async_get_registry", "(", "hass", ")", "actions", "=", "[", "...
[ 31, 0 ]
[ 67, 18 ]
python
en
['fr', 'en', 'en']
True
async_call_action_from_config
( hass: HomeAssistant, config: dict, variables: dict, context: Optional[Context] )
Execute a device action.
Execute a device action.
async def async_call_action_from_config( hass: HomeAssistant, config: dict, variables: dict, context: Optional[Context] ) -> None: """Execute a device action.""" config = ACTION_SCHEMA(config) service_data = {ATTR_ENTITY_ID: config[CONF_ENTITY_ID]} if config[CONF_TYPE] == "turn_on": servic...
[ "async", "def", "async_call_action_from_config", "(", "hass", ":", "HomeAssistant", ",", "config", ":", "dict", ",", "variables", ":", "dict", ",", "context", ":", "Optional", "[", "Context", "]", ")", "->", "None", ":", "config", "=", "ACTION_SCHEMA", "(", ...
[ 70, 0 ]
[ 85, 5 ]
python
en
['ro', 'en', 'en']
True
_build_mock_url
(origin, destination, modes, api_key, departure=None, arrival=None)
Construct a url for HERE.
Construct a url for HERE.
def _build_mock_url(origin, destination, modes, api_key, departure=None, arrival=None): """Construct a url for HERE.""" base_url = "https://route.ls.hereapi.com/routing/7.2/calculateroute.json?" parameters = { "waypoint0": f"geo!{origin}", "waypoint1": f"geo!{destination}", "mode": "...
[ "def", "_build_mock_url", "(", "origin", ",", "destination", ",", "modes", ",", "api_key", ",", "departure", "=", "None", ",", "arrival", "=", "None", ")", ":", "base_url", "=", "\"https://route.ls.hereapi.com/routing/7.2/calculateroute.json?\"", "parameters", "=", ...
[ 69, 0 ]
[ 86, 14 ]
python
en
['en', 'en', 'en']
True
_assert_truck_sensor
(sensor)
Assert that states and attributes are correct for truck_response.
Assert that states and attributes are correct for truck_response.
def _assert_truck_sensor(sensor): """Assert that states and attributes are correct for truck_response.""" assert sensor.state == "14" assert sensor.attributes.get("unit_of_measurement") == TIME_MINUTES assert sensor.attributes.get(ATTR_ATTRIBUTION) is None assert sensor.attributes.get(ATTR_DURATION...
[ "def", "_assert_truck_sensor", "(", "sensor", ")", ":", "assert", "sensor", ".", "state", "==", "\"14\"", "assert", "sensor", ".", "attributes", ".", "get", "(", "\"unit_of_measurement\"", ")", "==", "TIME_MINUTES", "assert", "sensor", ".", "attributes", ".", ...
[ 89, 0 ]
[ 114, 57 ]
python
en
['en', 'en', 'en']
True
requests_mock_credentials_check
(requests_mock)
Add the url used in the api validation to all requests mock.
Add the url used in the api validation to all requests mock.
def requests_mock_credentials_check(requests_mock): """Add the url used in the api validation to all requests mock.""" modes = [ROUTE_MODE_FASTEST, TRAVEL_MODE_CAR, TRAFFIC_MODE_DISABLED] response_url = _build_mock_url( ",".join([CAR_ORIGIN_LATITUDE, CAR_ORIGIN_LONGITUDE]), ",".join([CAR_DES...
[ "def", "requests_mock_credentials_check", "(", "requests_mock", ")", ":", "modes", "=", "[", "ROUTE_MODE_FASTEST", ",", "TRAVEL_MODE_CAR", ",", "TRAFFIC_MODE_DISABLED", "]", "response_url", "=", "_build_mock_url", "(", "\",\"", ".", "join", "(", "[", "CAR_ORIGIN_LATIT...
[ 118, 0 ]
[ 130, 24 ]
python
en
['en', 'en', 'en']
True
requests_mock_truck_response
(requests_mock_credentials_check)
Return a requests_mock for truck respones.
Return a requests_mock for truck respones.
def requests_mock_truck_response(requests_mock_credentials_check): """Return a requests_mock for truck respones.""" modes = [ROUTE_MODE_FASTEST, TRAVEL_MODE_TRUCK, TRAFFIC_MODE_DISABLED] response_url = _build_mock_url( ",".join([TRUCK_ORIGIN_LATITUDE, TRUCK_ORIGIN_LONGITUDE]), ",".join([TRUC...
[ "def", "requests_mock_truck_response", "(", "requests_mock_credentials_check", ")", ":", "modes", "=", "[", "ROUTE_MODE_FASTEST", ",", "TRAVEL_MODE_TRUCK", ",", "TRAFFIC_MODE_DISABLED", "]", "response_url", "=", "_build_mock_url", "(", "\",\"", ".", "join", "(", "[", ...
[ 134, 0 ]
[ 145, 5 ]
python
en
['en', 'en', 'en']
True
requests_mock_car_disabled_response
(requests_mock_credentials_check)
Return a requests_mock for truck respones.
Return a requests_mock for truck respones.
def requests_mock_car_disabled_response(requests_mock_credentials_check): """Return a requests_mock for truck respones.""" modes = [ROUTE_MODE_FASTEST, TRAVEL_MODE_CAR, TRAFFIC_MODE_DISABLED] response_url = _build_mock_url( ",".join([CAR_ORIGIN_LATITUDE, CAR_ORIGIN_LONGITUDE]), ",".join([CAR...
[ "def", "requests_mock_car_disabled_response", "(", "requests_mock_credentials_check", ")", ":", "modes", "=", "[", "ROUTE_MODE_FASTEST", ",", "TRAVEL_MODE_CAR", ",", "TRAFFIC_MODE_DISABLED", "]", "response_url", "=", "_build_mock_url", "(", "\",\"", ".", "join", "(", "[...
[ 149, 0 ]
[ 160, 5 ]
python
en
['en', 'en', 'en']
True
test_car
(hass, requests_mock_car_disabled_response)
Test that car works.
Test that car works.
async def test_car(hass, requests_mock_car_disabled_response): """Test that car works.""" config = { DOMAIN: { "platform": PLATFORM, "name": "test", "origin_latitude": CAR_ORIGIN_LATITUDE, "origin_longitude": CAR_ORIGIN_LONGITUDE, "destination_...
[ "async", "def", "test_car", "(", "hass", ",", "requests_mock_car_disabled_response", ")", ":", "config", "=", "{", "DOMAIN", ":", "{", "\"platform\"", ":", "PLATFORM", ",", "\"name\"", ":", "\"test\"", ",", "\"origin_latitude\"", ":", "CAR_ORIGIN_LATITUDE", ",", ...
[ 163, 0 ]
[ 210, 5 ]
python
en
['en', 'cy', 'en']
True
test_traffic_mode_enabled
(hass, requests_mock_credentials_check)
Test that traffic mode enabled works.
Test that traffic mode enabled works.
async def test_traffic_mode_enabled(hass, requests_mock_credentials_check): """Test that traffic mode enabled works.""" modes = [ROUTE_MODE_FASTEST, TRAVEL_MODE_CAR, TRAFFIC_MODE_ENABLED] response_url = _build_mock_url( ",".join([CAR_ORIGIN_LATITUDE, CAR_ORIGIN_LONGITUDE]), ",".join([CAR_DES...
[ "async", "def", "test_traffic_mode_enabled", "(", "hass", ",", "requests_mock_credentials_check", ")", ":", "modes", "=", "[", "ROUTE_MODE_FASTEST", ",", "TRAVEL_MODE_CAR", ",", "TRAFFIC_MODE_ENABLED", "]", "response_url", "=", "_build_mock_url", "(", "\",\"", ".", "j...
[ 213, 0 ]
[ 248, 5 ]
python
en
['en', 'en', 'en']
True
test_imperial
(hass, requests_mock_car_disabled_response)
Test that imperial units work.
Test that imperial units work.
async def test_imperial(hass, requests_mock_car_disabled_response): """Test that imperial units work.""" config = { DOMAIN: { "platform": PLATFORM, "name": "test", "origin_latitude": CAR_ORIGIN_LATITUDE, "origin_longitude": CAR_ORIGIN_LONGITUDE, ...
[ "async", "def", "test_imperial", "(", "hass", ",", "requests_mock_car_disabled_response", ")", ":", "config", "=", "{", "DOMAIN", ":", "{", "\"platform\"", ":", "PLATFORM", ",", "\"name\"", ":", "\"test\"", ",", "\"origin_latitude\"", ":", "CAR_ORIGIN_LATITUDE", "...
[ 251, 0 ]
[ 272, 69 ]
python
en
['en', 'en', 'en']
True
test_route_mode_shortest
(hass, requests_mock_credentials_check)
Test that route mode shortest works.
Test that route mode shortest works.
async def test_route_mode_shortest(hass, requests_mock_credentials_check): """Test that route mode shortest works.""" origin = "38.902981,-77.048338" destination = "39.042158,-77.119116" modes = [ROUTE_MODE_SHORTEST, TRAVEL_MODE_CAR, TRAFFIC_MODE_DISABLED] response_url = _build_mock_url(origin, dest...
[ "async", "def", "test_route_mode_shortest", "(", "hass", ",", "requests_mock_credentials_check", ")", ":", "origin", "=", "\"38.902981,-77.048338\"", "destination", "=", "\"39.042158,-77.119116\"", "modes", "=", "[", "ROUTE_MODE_SHORTEST", ",", "TRAVEL_MODE_CAR", ",", "TR...
[ 275, 0 ]
[ 304, 57 ]
python
en
['en', 'en', 'en']
True
test_route_mode_fastest
(hass, requests_mock_credentials_check)
Test that route mode fastest works.
Test that route mode fastest works.
async def test_route_mode_fastest(hass, requests_mock_credentials_check): """Test that route mode fastest works.""" origin = "38.902981,-77.048338" destination = "39.042158,-77.119116" modes = [ROUTE_MODE_FASTEST, TRAVEL_MODE_CAR, TRAFFIC_MODE_ENABLED] response_url = _build_mock_url(origin, destinat...
[ "async", "def", "test_route_mode_fastest", "(", "hass", ",", "requests_mock_credentials_check", ")", ":", "origin", "=", "\"38.902981,-77.048338\"", "destination", "=", "\"39.042158,-77.119116\"", "modes", "=", "[", "ROUTE_MODE_FASTEST", ",", "TRAVEL_MODE_CAR", ",", "TRAF...
[ 307, 0 ]
[ 336, 57 ]
python
en
['en', 'en', 'en']
True
test_truck
(hass, requests_mock_truck_response)
Test that truck works.
Test that truck works.
async def test_truck(hass, requests_mock_truck_response): """Test that truck works.""" config = { DOMAIN: { "platform": PLATFORM, "name": "test", "origin_latitude": TRUCK_ORIGIN_LATITUDE, "origin_longitude": TRUCK_ORIGIN_LONGITUDE, "destination...
[ "async", "def", "test_truck", "(", "hass", ",", "requests_mock_truck_response", ")", ":", "config", "=", "{", "DOMAIN", ":", "{", "\"platform\"", ":", "PLATFORM", ",", "\"name\"", ":", "\"test\"", ",", "\"origin_latitude\"", ":", "TRUCK_ORIGIN_LATITUDE", ",", "\...
[ 339, 0 ]
[ 360, 32 ]
python
en
['en', 'en', 'en']
True
test_public_transport
(hass, requests_mock_credentials_check)
Test that publicTransport works.
Test that publicTransport works.
async def test_public_transport(hass, requests_mock_credentials_check): """Test that publicTransport works.""" origin = "41.9798,-87.8801" destination = "41.9043,-87.9216" modes = [ROUTE_MODE_FASTEST, TRAVEL_MODE_PUBLIC, TRAFFIC_MODE_DISABLED] response_url = _build_mock_url(origin, destination, mode...
[ "async", "def", "test_public_transport", "(", "hass", ",", "requests_mock_credentials_check", ")", ":", "origin", "=", "\"41.9798,-87.8801\"", "destination", "=", "\"41.9043,-87.9216\"", "modes", "=", "[", "ROUTE_MODE_FASTEST", ",", "TRAVEL_MODE_PUBLIC", ",", "TRAFFIC_MOD...
[ 363, 0 ]
[ 410, 58 ]
python
en
['en', 'da', 'en']
True
test_public_transport_time_table
(hass, requests_mock_credentials_check)
Test that publicTransportTimeTable works.
Test that publicTransportTimeTable works.
async def test_public_transport_time_table(hass, requests_mock_credentials_check): """Test that publicTransportTimeTable works.""" origin = "41.9798,-87.8801" destination = "41.9043,-87.9216" modes = [ROUTE_MODE_FASTEST, TRAVEL_MODE_PUBLIC_TIME_TABLE, TRAFFIC_MODE_DISABLED] response_url = _build_moc...
[ "async", "def", "test_public_transport_time_table", "(", "hass", ",", "requests_mock_credentials_check", ")", ":", "origin", "=", "\"41.9798,-87.8801\"", "destination", "=", "\"41.9043,-87.9216\"", "modes", "=", "[", "ROUTE_MODE_FASTEST", ",", "TRAVEL_MODE_PUBLIC_TIME_TABLE",...
[ 413, 0 ]
[ 461, 58 ]
python
en
['en', 'da', 'en']
True
test_pedestrian
(hass, requests_mock_credentials_check)
Test that pedestrian works.
Test that pedestrian works.
async def test_pedestrian(hass, requests_mock_credentials_check): """Test that pedestrian works.""" origin = "41.9798,-87.8801" destination = "41.9043,-87.9216" modes = [ROUTE_MODE_FASTEST, TRAVEL_MODE_PEDESTRIAN, TRAFFIC_MODE_DISABLED] response_url = _build_mock_url(origin, destination, modes, API_...
[ "async", "def", "test_pedestrian", "(", "hass", ",", "requests_mock_credentials_check", ")", ":", "origin", "=", "\"41.9798,-87.8801\"", "destination", "=", "\"41.9043,-87.9216\"", "modes", "=", "[", "ROUTE_MODE_FASTEST", ",", "TRAVEL_MODE_PEDESTRIAN", ",", "TRAFFIC_MODE_...
[ 464, 0 ]
[ 514, 62 ]
python
en
['en', 'de', 'en']
True
test_bicycle
(hass, requests_mock_credentials_check)
Test that bicycle works.
Test that bicycle works.
async def test_bicycle(hass, requests_mock_credentials_check): """Test that bicycle works.""" origin = "41.9798,-87.8801" destination = "41.9043,-87.9216" modes = [ROUTE_MODE_FASTEST, TRAVEL_MODE_BICYCLE, TRAFFIC_MODE_DISABLED] response_url = _build_mock_url(origin, destination, modes, API_KEY) ...
[ "async", "def", "test_bicycle", "(", "hass", ",", "requests_mock_credentials_check", ")", ":", "origin", "=", "\"41.9798,-87.8801\"", "destination", "=", "\"41.9043,-87.9216\"", "modes", "=", "[", "ROUTE_MODE_FASTEST", ",", "TRAVEL_MODE_BICYCLE", ",", "TRAFFIC_MODE_DISABL...
[ 517, 0 ]
[ 566, 59 ]
python
en
['en', 'en', 'en']
True