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_entity_availability
(hass: HomeAssistantType)
Test handling of connection status.
Test handling of connection status.
async def test_entity_availability(hass: HomeAssistantType): """Test handling of connection status.""" entity_id = "media_player.speaker" info = get_fake_chromecast_info() chromecast = await async_setup_media_player_cast(hass, info) _, conn_status_cb, _ = get_status_callbacks(chromecast) state...
[ "async", "def", "test_entity_availability", "(", "hass", ":", "HomeAssistantType", ")", ":", "entity_id", "=", "\"media_player.speaker\"", "info", "=", "get_fake_chromecast_info", "(", ")", "chromecast", "=", "await", "async_setup_media_player_cast", "(", "hass", ",", ...
[ 389, 0 ]
[ 412, 39 ]
python
en
['en', 'en', 'en']
True
test_entity_cast_status
(hass: HomeAssistantType)
Test handling of cast status.
Test handling of cast status.
async def test_entity_cast_status(hass: HomeAssistantType): """Test handling of cast status.""" entity_id = "media_player.speaker" reg = await hass.helpers.entity_registry.async_get_registry() info = get_fake_chromecast_info() full_info = attr.evolve( info, model_name="google home", friendl...
[ "async", "def", "test_entity_cast_status", "(", "hass", ":", "HomeAssistantType", ")", ":", "entity_id", "=", "\"media_player.speaker\"", "reg", "=", "await", "hass", ".", "helpers", ".", "entity_registry", ".", "async_get_registry", "(", ")", "info", "=", "get_fa...
[ 415, 0 ]
[ 455, 50 ]
python
en
['en', 'ja', 'en']
True
test_entity_play_media
(hass: HomeAssistantType)
Test playing media.
Test playing media.
async def test_entity_play_media(hass: HomeAssistantType): """Test playing media.""" entity_id = "media_player.speaker" reg = await hass.helpers.entity_registry.async_get_registry() info = get_fake_chromecast_info() full_info = attr.evolve( info, model_name="google home", friendly_name="Spe...
[ "async", "def", "test_entity_play_media", "(", "hass", ":", "HomeAssistantType", ")", ":", "entity_id", "=", "\"media_player.speaker\"", "reg", "=", "await", "hass", ".", "helpers", ".", "entity_registry", ".", "async_get_registry", "(", ")", "info", "=", "get_fak...
[ 458, 0 ]
[ 484, 87 ]
python
en
['en', 'en', 'en']
True
test_entity_play_media_cast
(hass: HomeAssistantType, quick_play_mock)
Test playing media with cast special features.
Test playing media with cast special features.
async def test_entity_play_media_cast(hass: HomeAssistantType, quick_play_mock): """Test playing media with cast special features.""" entity_id = "media_player.speaker" reg = await hass.helpers.entity_registry.async_get_registry() info = get_fake_chromecast_info() full_info = attr.evolve( i...
[ "async", "def", "test_entity_play_media_cast", "(", "hass", ":", "HomeAssistantType", ",", "quick_play_mock", ")", ":", "entity_id", "=", "\"media_player.speaker\"", "reg", "=", "await", "hass", ".", "helpers", ".", "entity_registry", ".", "async_get_registry", "(", ...
[ 487, 0 ]
[ 517, 63 ]
python
en
['en', 'en', 'en']
True
test_entity_play_media_cast_invalid
(hass, caplog, quick_play_mock)
Test playing media.
Test playing media.
async def test_entity_play_media_cast_invalid(hass, caplog, quick_play_mock): """Test playing media.""" entity_id = "media_player.speaker" reg = await hass.helpers.entity_registry.async_get_registry() info = get_fake_chromecast_info() full_info = attr.evolve( info, model_name="google home",...
[ "async", "def", "test_entity_play_media_cast_invalid", "(", "hass", ",", "caplog", ",", "quick_play_mock", ")", ":", "entity_id", "=", "\"media_player.speaker\"", "reg", "=", "await", "hass", ".", "helpers", ".", "entity_registry", ".", "async_get_registry", "(", ")...
[ 520, 0 ]
[ 563, 53 ]
python
en
['en', 'en', 'en']
True
test_entity_play_media_sign_URL
(hass: HomeAssistantType)
Test playing media.
Test playing media.
async def test_entity_play_media_sign_URL(hass: HomeAssistantType): """Test playing media.""" entity_id = "media_player.speaker" await async_process_ha_core_config( hass, {"external_url": "http://example.com:8123"}, ) info = get_fake_chromecast_info() chromecast = await async_...
[ "async", "def", "test_entity_play_media_sign_URL", "(", "hass", ":", "HomeAssistantType", ")", ":", "entity_id", "=", "\"media_player.speaker\"", "await", "async_process_ha_core_config", "(", "hass", ",", "{", "\"external_url\"", ":", "\"http://example.com:8123\"", "}", "...
[ 566, 0 ]
[ 590, 5 ]
python
en
['en', 'en', 'en']
True
test_entity_media_content_type
(hass: HomeAssistantType)
Test various content types.
Test various content types.
async def test_entity_media_content_type(hass: HomeAssistantType): """Test various content types.""" entity_id = "media_player.speaker" reg = await hass.helpers.entity_registry.async_get_registry() info = get_fake_chromecast_info() full_info = attr.evolve( info, model_name="google home", fr...
[ "async", "def", "test_entity_media_content_type", "(", "hass", ":", "HomeAssistantType", ")", ":", "entity_id", "=", "\"media_player.speaker\"", "reg", "=", "await", "hass", ".", "helpers", ".", "entity_registry", ".", "async_get_registry", "(", ")", "info", "=", ...
[ 593, 0 ]
[ 644, 64 ]
python
en
['en', 'en', 'en']
True
test_entity_control
(hass: HomeAssistantType)
Test various device and media controls.
Test various device and media controls.
async def test_entity_control(hass: HomeAssistantType): """Test various device and media controls.""" entity_id = "media_player.speaker" reg = await hass.helpers.entity_registry.async_get_registry() info = get_fake_chromecast_info() full_info = attr.evolve( info, model_name="google home", f...
[ "async", "def", "test_entity_control", "(", "hass", ":", "HomeAssistantType", ")", ":", "entity_id", "=", "\"media_player.speaker\"", "reg", "=", "await", "hass", ".", "helpers", ".", "entity_registry", ".", "async_get_registry", "(", ")", "info", "=", "get_fake_c...
[ 647, 0 ]
[ 727, 65 ]
python
en
['en', 'en', 'en']
True
test_entity_media_states
(hass: HomeAssistantType)
Test various entity media states.
Test various entity media states.
async def test_entity_media_states(hass: HomeAssistantType): """Test various entity media states.""" entity_id = "media_player.speaker" reg = await hass.helpers.entity_registry.async_get_registry() info = get_fake_chromecast_info() full_info = attr.evolve( info, model_name="google home", fr...
[ "async", "def", "test_entity_media_states", "(", "hass", ":", "HomeAssistantType", ")", ":", "entity_id", "=", "\"media_player.speaker\"", "reg", "=", "await", "hass", ".", "helpers", ".", "entity_registry", ".", "async_get_registry", "(", ")", "info", "=", "get_f...
[ 730, 0 ]
[ 786, 35 ]
python
en
['en', 'el-Latn', 'en']
True
test_url_replace
(hass: HomeAssistantType)
Test functionality of replacing URL for HTTPS.
Test functionality of replacing URL for HTTPS.
async def test_url_replace(hass: HomeAssistantType): """Test functionality of replacing URL for HTTPS.""" entity_id = "media_player.speaker" reg = await hass.helpers.entity_registry.async_get_registry() info = get_fake_chromecast_info() full_info = attr.evolve( info, model_name="google home...
[ "async", "def", "test_url_replace", "(", "hass", ":", "HomeAssistantType", ")", ":", "entity_id", "=", "\"media_player.speaker\"", "reg", "=", "await", "hass", ".", "helpers", ".", "entity_registry", ".", "async_get_registry", "(", ")", "info", "=", "get_fake_chro...
[ 789, 0 ]
[ 830, 83 ]
python
en
['en', 'en', 'en']
True
test_group_media_states
(hass, mz_mock)
Test media states are read from group if entity has no state.
Test media states are read from group if entity has no state.
async def test_group_media_states(hass, mz_mock): """Test media states are read from group if entity has no state.""" entity_id = "media_player.speaker" reg = await hass.helpers.entity_registry.async_get_registry() info = get_fake_chromecast_info() full_info = attr.evolve( info, model_name=...
[ "async", "def", "test_group_media_states", "(", "hass", ",", "mz_mock", ")", ":", "entity_id", "=", "\"media_player.speaker\"", "reg", "=", "await", "hass", ".", "helpers", ".", "entity_registry", ".", "async_get_registry", "(", ")", "info", "=", "get_fake_chromec...
[ 833, 0 ]
[ 883, 35 ]
python
en
['en', 'en', 'en']
True
test_group_media_control
(hass, mz_mock)
Test media states are read from group if entity has no state.
Test media states are read from group if entity has no state.
async def test_group_media_control(hass, mz_mock): """Test media states are read from group if entity has no state.""" entity_id = "media_player.speaker" reg = await hass.helpers.entity_registry.async_get_registry() info = get_fake_chromecast_info() full_info = attr.evolve( info, model_name...
[ "async", "def", "test_group_media_control", "(", "hass", ",", "mz_mock", ")", ":", "entity_id", "=", "\"media_player.speaker\"", "reg", "=", "await", "hass", ".", "helpers", ".", "entity_registry", ".", "async_get_registry", "(", ")", "info", "=", "get_fake_chrome...
[ 886, 0 ]
[ 944, 56 ]
python
en
['en', 'en', 'en']
True
test_failed_cast_on_idle
(hass, caplog)
Test no warning when unless player went idle with reason "ERROR".
Test no warning when unless player went idle with reason "ERROR".
async def test_failed_cast_on_idle(hass, caplog): """Test no warning when unless player went idle with reason "ERROR".""" info = get_fake_chromecast_info() chromecast = await async_setup_media_player_cast(hass, info) _, _, media_status_cb = get_status_callbacks(chromecast) media_status = MagicMock(...
[ "async", "def", "test_failed_cast_on_idle", "(", "hass", ",", "caplog", ")", ":", "info", "=", "get_fake_chromecast_info", "(", ")", "chromecast", "=", "await", "async_setup_media_player_cast", "(", "hass", ",", "info", ")", "_", ",", "_", ",", "media_status_cb"...
[ 947, 0 ]
[ 972, 81 ]
python
en
['en', 'en', 'en']
True
test_failed_cast_other_url
(hass, caplog)
Test warning when casting from internal_url fails.
Test warning when casting from internal_url fails.
async def test_failed_cast_other_url(hass, caplog): """Test warning when casting from internal_url fails.""" with assert_setup_component(1, tts.DOMAIN): assert await async_setup_component( hass, tts.DOMAIN, {tts.DOMAIN: {"platform": "demo", "base_url": "http://example...
[ "async", "def", "test_failed_cast_other_url", "(", "hass", ",", "caplog", ")", ":", "with", "assert_setup_component", "(", "1", ",", "tts", ".", "DOMAIN", ")", ":", "assert", "await", "async_setup_component", "(", "hass", ",", "tts", ".", "DOMAIN", ",", "{",...
[ 975, 0 ]
[ 993, 81 ]
python
en
['en', 'en', 'en']
True
test_failed_cast_internal_url
(hass, caplog)
Test warning when casting from internal_url fails.
Test warning when casting from internal_url fails.
async def test_failed_cast_internal_url(hass, caplog): """Test warning when casting from internal_url fails.""" await async_process_ha_core_config( hass, {"internal_url": "http://example.local:8123"}, ) with assert_setup_component(1, tts.DOMAIN): assert await async_setup_componen...
[ "async", "def", "test_failed_cast_internal_url", "(", "hass", ",", "caplog", ")", ":", "await", "async_process_ha_core_config", "(", "hass", ",", "{", "\"internal_url\"", ":", "\"http://example.local:8123\"", "}", ",", ")", "with", "assert_setup_component", "(", "1", ...
[ 996, 0 ]
[ 1019, 5 ]
python
en
['en', 'en', 'en']
True
test_failed_cast_external_url
(hass, caplog)
Test warning when casting from external_url fails.
Test warning when casting from external_url fails.
async def test_failed_cast_external_url(hass, caplog): """Test warning when casting from external_url fails.""" await async_process_ha_core_config( hass, {"external_url": "http://example.com:8123"}, ) with assert_setup_component(1, tts.DOMAIN): assert await async_setup_component(...
[ "async", "def", "test_failed_cast_external_url", "(", "hass", ",", "caplog", ")", ":", "await", "async_process_ha_core_config", "(", "hass", ",", "{", "\"external_url\"", ":", "\"http://example.com:8123\"", "}", ",", ")", "with", "assert_setup_component", "(", "1", ...
[ 1022, 0 ]
[ 1047, 5 ]
python
en
['en', 'en', 'en']
True
test_failed_cast_tts_base_url
(hass, caplog)
Test warning when casting from tts.base_url fails.
Test warning when casting from tts.base_url fails.
async def test_failed_cast_tts_base_url(hass, caplog): """Test warning when casting from tts.base_url fails.""" with assert_setup_component(1, tts.DOMAIN): assert await async_setup_component( hass, tts.DOMAIN, {tts.DOMAIN: {"platform": "demo", "base_url": "http://exam...
[ "async", "def", "test_failed_cast_tts_base_url", "(", "hass", ",", "caplog", ")", ":", "with", "assert_setup_component", "(", "1", ",", "tts", ".", "DOMAIN", ")", ":", "assert", "await", "async_setup_component", "(", "hass", ",", "tts", ".", "DOMAIN", ",", "...
[ 1050, 0 ]
[ 1071, 5 ]
python
en
['en', 'en', 'en']
True
test_disconnect_on_stop
(hass: HomeAssistantType)
Test cast device disconnects socket on stop.
Test cast device disconnects socket on stop.
async def test_disconnect_on_stop(hass: HomeAssistantType): """Test cast device disconnects socket on stop.""" info = get_fake_chromecast_info() chromecast = await async_setup_media_player_cast(hass, info) hass.bus.async_fire(EVENT_HOMEASSISTANT_STOP) await hass.async_block_till_done() assert ...
[ "async", "def", "test_disconnect_on_stop", "(", "hass", ":", "HomeAssistantType", ")", ":", "info", "=", "get_fake_chromecast_info", "(", ")", "chromecast", "=", "await", "async_setup_media_player_cast", "(", "hass", ",", "info", ")", "hass", ".", "bus", ".", "a...
[ 1074, 0 ]
[ 1082, 48 ]
python
en
['wa', 'en', 'en']
True
test_entry_setup_no_config
(hass: HomeAssistantType)
Test setting up entry with no config..
Test setting up entry with no config..
async def test_entry_setup_no_config(hass: HomeAssistantType): """Test setting up entry with no config..""" await async_setup_component(hass, "cast", {}) await hass.async_block_till_done() with patch( "homeassistant.components.cast.media_player._async_setup_platform", ) as mock_setup: ...
[ "async", "def", "test_entry_setup_no_config", "(", "hass", ":", "HomeAssistantType", ")", ":", "await", "async_setup_component", "(", "hass", ",", "\"cast\"", ",", "{", "}", ")", "await", "hass", ".", "async_block_till_done", "(", ")", "with", "patch", "(", "\...
[ 1085, 0 ]
[ 1096, 47 ]
python
en
['en', 'en', 'en']
True
test_entry_setup_single_config
(hass: HomeAssistantType)
Test setting up entry and having a single config option.
Test setting up entry and having a single config option.
async def test_entry_setup_single_config(hass: HomeAssistantType): """Test setting up entry and having a single config option.""" await async_setup_component( hass, "cast", {"cast": {"media_player": {"uuid": "bla"}}} ) await hass.async_block_till_done() with patch( "homeassistant.co...
[ "async", "def", "test_entry_setup_single_config", "(", "hass", ":", "HomeAssistantType", ")", ":", "await", "async_setup_component", "(", "hass", ",", "\"cast\"", ",", "{", "\"cast\"", ":", "{", "\"media_player\"", ":", "{", "\"uuid\"", ":", "\"bla\"", "}", "}",...
[ 1099, 0 ]
[ 1112, 60 ]
python
en
['en', 'en', 'en']
True
test_entry_setup_list_config
(hass: HomeAssistantType)
Test setting up entry and having multiple config options.
Test setting up entry and having multiple config options.
async def test_entry_setup_list_config(hass: HomeAssistantType): """Test setting up entry and having multiple config options.""" await async_setup_component( hass, "cast", {"cast": {"media_player": [{"uuid": "bla"}, {"uuid": "blu"}]}} ) await hass.async_block_till_done() with patch( ...
[ "async", "def", "test_entry_setup_list_config", "(", "hass", ":", "HomeAssistantType", ")", ":", "await", "async_setup_component", "(", "hass", ",", "\"cast\"", ",", "{", "\"cast\"", ":", "{", "\"media_player\"", ":", "[", "{", "\"uuid\"", ":", "\"bla\"", "}", ...
[ 1115, 0 ]
[ 1129, 60 ]
python
en
['en', 'en', 'en']
True
test_entry_setup_platform_not_ready
(hass: HomeAssistantType)
Test failed setting up entry will raise PlatformNotReady.
Test failed setting up entry will raise PlatformNotReady.
async def test_entry_setup_platform_not_ready(hass: HomeAssistantType): """Test failed setting up entry will raise PlatformNotReady.""" await async_setup_component( hass, "cast", {"cast": {"media_player": {"uuid": "bla"}}} ) await hass.async_block_till_done() with patch( "homeassist...
[ "async", "def", "test_entry_setup_platform_not_ready", "(", "hass", ":", "HomeAssistantType", ")", ":", "await", "async_setup_component", "(", "hass", ",", "\"cast\"", ",", "{", "\"cast\"", ":", "{", "\"media_player\"", ":", "{", "\"uuid\"", ":", "\"bla\"", "}", ...
[ 1132, 0 ]
[ 1147, 60 ]
python
en
['en', 'mg', 'en']
True
Subprocess.run
(command: str, timeout: int = None)
Run one-time command with subprocess.run(). Args: command (str): command to be executed. timeout (int): timeout in seconds. Returns: str: return stdout of the command.
Run one-time command with subprocess.run().
def run(command: str, timeout: int = None) -> None: """Run one-time command with subprocess.run(). Args: command (str): command to be executed. timeout (int): timeout in seconds. Returns: str: return stdout of the command. """ # TODO: Windows...
[ "def", "run", "(", "command", ":", "str", ",", "timeout", ":", "int", "=", "None", ")", "->", "None", ":", "# TODO: Windows node", "completed_process", "=", "subprocess", ".", "run", "(", "command", ",", "shell", "=", "True", ",", "executable", "=", "\"/...
[ 76, 4 ]
[ 98, 50 ]
python
en
['en', 'en', 'en']
True
async_describe_events
(hass, async_describe_event)
Describe logbook events.
Describe logbook events.
def async_describe_events(hass, async_describe_event): """Describe logbook events.""" @callback def async_describe_logbook_event(event): """Describe a logbook event.""" data = event.data entity_id = data.get(ATTR_ENTITY_ID) value = data.get(ATTR_VALUE) value_msg = f...
[ "def", "async_describe_events", "(", "hass", ",", "async_describe_event", ")", ":", "@", "callback", "def", "async_describe_logbook_event", "(", "event", ")", ":", "\"\"\"Describe a logbook event.\"\"\"", "data", "=", "event", ".", "data", "entity_id", "=", "data", ...
[ 8, 0 ]
[ 27, 85 ]
python
en
['en', 'es', 'en']
True
get_api
(authorization=None)
Create Life360 api object.
Create Life360 api object.
def get_api(authorization=None): """Create Life360 api object.""" return Life360(timeout=3.05, max_retries=2, authorization=authorization)
[ "def", "get_api", "(", "authorization", "=", "None", ")", ":", "return", "Life360", "(", "timeout", "=", "3.05", ",", "max_retries", "=", "2", ",", "authorization", "=", "authorization", ")" ]
[ 4, 0 ]
[ 6, 76 ]
python
en
['en', 'sm', 'en']
True
setup
(hass, config)
Set up the Thingspeak environment.
Set up the Thingspeak environment.
def setup(hass, config): """Set up the Thingspeak environment.""" conf = config[DOMAIN] api_key = conf.get(CONF_API_KEY) channel_id = conf.get(CONF_ID) entity = conf.get(CONF_WHITELIST) try: channel = thingspeak.Channel(channel_id, api_key=api_key, timeout=TIMEOUT) channel.get()...
[ "def", "setup", "(", "hass", ",", "config", ")", ":", "conf", "=", "config", "[", "DOMAIN", "]", "api_key", "=", "conf", ".", "get", "(", "CONF_API_KEY", ")", "channel_id", "=", "conf", ".", "get", "(", "CONF_ID", ")", "entity", "=", "conf", ".", "...
[ 37, 0 ]
[ 75, 15 ]
python
en
['en', 'no', 'en']
True
RagPyTorchDistributedRetriever.init_retrieval
(self, distributed_port: int)
Retriever initialization function, needs to be called from the training process. The function sets some common parameters and environment variables. On top of that, (only) the main process in the process group loads the index into memory. Args: distributed_port (:obj:`int`): ...
Retriever initialization function, needs to be called from the training process. The function sets some common parameters and environment variables. On top of that, (only) the main process in the process group loads the index into memory.
def init_retrieval(self, distributed_port: int): """ Retriever initialization function, needs to be called from the training process. The function sets some common parameters and environment variables. On top of that, (only) the main process in the process group loads the index into memory. ...
[ "def", "init_retrieval", "(", "self", ",", "distributed_port", ":", "int", ")", ":", "logger", ".", "info", "(", "\"initializing retrieval\"", ")", "# initializing a separate process group for retrieval as the default", "# nccl backend doesn't support gather/scatter operations whil...
[ 43, 4 ]
[ 74, 63 ]
python
en
['en', 'error', 'th']
False
RagPyTorchDistributedRetriever.retrieve
(self, question_hidden_states: np.ndarray, n_docs: int)
Retrieves documents for specified ``question_hidden_states``. The main process, which has the access to the index stored in memory, gathers queries from all the processes in the main training process group, performs the retrieval and scatters back the results. Args: question_hidden...
Retrieves documents for specified ``question_hidden_states``. The main process, which has the access to the index stored in memory, gathers queries from all the processes in the main training process group, performs the retrieval and scatters back the results.
def retrieve(self, question_hidden_states: np.ndarray, n_docs: int) -> Tuple[np.ndarray, List[dict]]: """ Retrieves documents for specified ``question_hidden_states``. The main process, which has the access to the index stored in memory, gathers queries from all the processes in the main trainin...
[ "def", "retrieve", "(", "self", ",", "question_hidden_states", ":", "np", ".", "ndarray", ",", "n_docs", ":", "int", ")", "->", "Tuple", "[", "np", ".", "ndarray", ",", "List", "[", "dict", "]", "]", ":", "# single GPU training", "if", "not", "dist", "...
[ 90, 4 ]
[ 137, 95 ]
python
en
['en', 'error', 'th']
False
run
(argv=None)
The main function which creates the pipeline and runs it.
The main function which creates the pipeline and runs it.
def run(argv=None): """The main function which creates the pipeline and runs it.""" parser = argparse.ArgumentParser() # Here we add some specific command line arguments we expect. # Specifically we have the input file to read and the output table to write. # This is the final stage of the pipelin...
[ "def", "run", "(", "argv", "=", "None", ")", ":", "parser", "=", "argparse", ".", "ArgumentParser", "(", ")", "# Here we add some specific command line arguments we expect.", "# Specifically we have the input file to read and the output table to write.", "# This is the final stage ...
[ 61, 0 ]
[ 128, 31 ]
python
en
['en', 'en', 'en']
True
DataIngestion.parse_method
(self, string_input)
This method translates a single line of comma separated values to a dictionary which can be loaded into BigQuery. Args: string_input: A comma separated list of values in the form of state_abbreviation,gender,year,name,count_of_babies,dataset_created_date Exam...
This method translates a single line of comma separated values to a dictionary which can be loaded into BigQuery.
def parse_method(self, string_input): """This method translates a single line of comma separated values to a dictionary which can be loaded into BigQuery. Args: string_input: A comma separated list of values in the form of state_abbreviation,gender,year,name,count_of...
[ "def", "parse_method", "(", "self", ",", "string_input", ")", ":", "# Strip out carriage return, newline and quote characters.", "values", "=", "re", ".", "split", "(", "\",\"", ",", "re", ".", "sub", "(", "'\\r\\n'", ",", "''", ",", "re", ".", "sub", "(", "...
[ 29, 4 ]
[ 58, 18 ]
python
en
['en', 'en', 'en']
True
async_setup_entry
(hass, config_entry, async_add_entities)
Perform the setup for Xiaomi devices.
Perform the setup for Xiaomi devices.
async def async_setup_entry(hass, config_entry, async_add_entities): """Perform the setup for Xiaomi devices.""" entities = [] gateway = hass.data[DOMAIN][GATEWAYS_KEY][config_entry.entry_id] for device in gateway.devices["cover"]: model = device["model"] if model in ["curtain", "curtain...
[ "async", "def", "async_setup_entry", "(", "hass", ",", "config_entry", ",", "async_add_entities", ")", ":", "entities", "=", "[", "]", "gateway", "=", "hass", ".", "data", "[", "DOMAIN", "]", "[", "GATEWAYS_KEY", "]", "[", "config_entry", ".", "entry_id", ...
[ 12, 0 ]
[ 26, 32 ]
python
en
['en', 'en', 'en']
True
XiaomiGenericCover.__init__
(self, device, name, data_key, xiaomi_hub, config_entry)
Initialize the XiaomiGenericCover.
Initialize the XiaomiGenericCover.
def __init__(self, device, name, data_key, xiaomi_hub, config_entry): """Initialize the XiaomiGenericCover.""" self._data_key = data_key self._pos = 0 super().__init__(device, name, xiaomi_hub, config_entry)
[ "def", "__init__", "(", "self", ",", "device", ",", "name", ",", "data_key", ",", "xiaomi_hub", ",", "config_entry", ")", ":", "self", ".", "_data_key", "=", "data_key", "self", ".", "_pos", "=", "0", "super", "(", ")", ".", "__init__", "(", "device", ...
[ 32, 4 ]
[ 36, 64 ]
python
en
['en', 'en', 'en']
True
XiaomiGenericCover.current_cover_position
(self)
Return the current position of the cover.
Return the current position of the cover.
def current_cover_position(self): """Return the current position of the cover.""" return self._pos
[ "def", "current_cover_position", "(", "self", ")", ":", "return", "self", ".", "_pos" ]
[ 39, 4 ]
[ 41, 24 ]
python
en
['en', 'en', 'en']
True
XiaomiGenericCover.is_closed
(self)
Return if the cover is closed.
Return if the cover is closed.
def is_closed(self): """Return if the cover is closed.""" return self.current_cover_position <= 0
[ "def", "is_closed", "(", "self", ")", ":", "return", "self", ".", "current_cover_position", "<=", "0" ]
[ 44, 4 ]
[ 46, 47 ]
python
en
['en', 'en', 'en']
True
XiaomiGenericCover.close_cover
(self, **kwargs)
Close the cover.
Close the cover.
def close_cover(self, **kwargs): """Close the cover.""" self._write_to_hub(self._sid, **{self._data_key: "close"})
[ "def", "close_cover", "(", "self", ",", "*", "*", "kwargs", ")", ":", "self", ".", "_write_to_hub", "(", "self", ".", "_sid", ",", "*", "*", "{", "self", ".", "_data_key", ":", "\"close\"", "}", ")" ]
[ 48, 4 ]
[ 50, 66 ]
python
en
['en', 'en', 'en']
True
XiaomiGenericCover.open_cover
(self, **kwargs)
Open the cover.
Open the cover.
def open_cover(self, **kwargs): """Open the cover.""" self._write_to_hub(self._sid, **{self._data_key: "open"})
[ "def", "open_cover", "(", "self", ",", "*", "*", "kwargs", ")", ":", "self", ".", "_write_to_hub", "(", "self", ".", "_sid", ",", "*", "*", "{", "self", ".", "_data_key", ":", "\"open\"", "}", ")" ]
[ 52, 4 ]
[ 54, 65 ]
python
en
['en', 'en', 'en']
True
XiaomiGenericCover.stop_cover
(self, **kwargs)
Stop the cover.
Stop the cover.
def stop_cover(self, **kwargs): """Stop the cover.""" self._write_to_hub(self._sid, **{self._data_key: "stop"})
[ "def", "stop_cover", "(", "self", ",", "*", "*", "kwargs", ")", ":", "self", ".", "_write_to_hub", "(", "self", ".", "_sid", ",", "*", "*", "{", "self", ".", "_data_key", ":", "\"stop\"", "}", ")" ]
[ 56, 4 ]
[ 58, 65 ]
python
en
['en', 'en', 'en']
True
XiaomiGenericCover.set_cover_position
(self, **kwargs)
Move the cover to a specific position.
Move the cover to a specific position.
def set_cover_position(self, **kwargs): """Move the cover to a specific position.""" position = kwargs.get(ATTR_POSITION) if self._data_key == DATA_KEY_PROTO_V2: self._write_to_hub(self._sid, **{ATTR_CURTAIN_LEVEL: position}) else: self._write_to_hub(self._sid, **...
[ "def", "set_cover_position", "(", "self", ",", "*", "*", "kwargs", ")", ":", "position", "=", "kwargs", ".", "get", "(", "ATTR_POSITION", ")", "if", "self", ".", "_data_key", "==", "DATA_KEY_PROTO_V2", ":", "self", ".", "_write_to_hub", "(", "self", ".", ...
[ 60, 4 ]
[ 66, 80 ]
python
en
['en', 'en', 'en']
True
XiaomiGenericCover.parse_data
(self, data, raw_data)
Parse data sent by gateway.
Parse data sent by gateway.
def parse_data(self, data, raw_data): """Parse data sent by gateway.""" if ATTR_CURTAIN_LEVEL in data: self._pos = int(data[ATTR_CURTAIN_LEVEL]) return True return False
[ "def", "parse_data", "(", "self", ",", "data", ",", "raw_data", ")", ":", "if", "ATTR_CURTAIN_LEVEL", "in", "data", ":", "self", ".", "_pos", "=", "int", "(", "data", "[", "ATTR_CURTAIN_LEVEL", "]", ")", "return", "True", "return", "False" ]
[ 68, 4 ]
[ 73, 20 ]
python
en
['en', 'de', 'en']
True
async_handle_message
(hass, config, request, context=None, enabled=True)
Handle incoming API messages. If enabled is False, the response to all messagess will be a BRIDGE_UNREACHABLE error. This can be used if the API has been disabled in configuration.
Handle incoming API messages.
async def async_handle_message(hass, config, request, context=None, enabled=True): """Handle incoming API messages. If enabled is False, the response to all messagess will be a BRIDGE_UNREACHABLE error. This can be used if the API has been disabled in configuration. """ assert request[API_DIREC...
[ "async", "def", "async_handle_message", "(", "hass", ",", "config", ",", "request", ",", "context", "=", "None", ",", "enabled", "=", "True", ")", ":", "assert", "request", "[", "API_DIRECTIVE", "]", "[", "API_HEADER", "]", "[", "\"payloadVersion\"", "]", ...
[ 13, 0 ]
[ 65, 31 ]
python
en
['en', 'en', 'en']
True
_get_github_import_url
(url: str)
Convert a GitHub url to the raw content. Async friendly.
Convert a GitHub url to the raw content.
def _get_github_import_url(url: str) -> str: """Convert a GitHub url to the raw content. Async friendly. """ match = GITHUB_RAW_FILE_PATTERN.match(url) if match is not None: return url match = GITHUB_FILE_PATTERN.match(url) if match is None: raise ValueError("Not a GitHub ...
[ "def", "_get_github_import_url", "(", "url", ":", "str", ")", "->", "str", ":", "match", "=", "GITHUB_RAW_FILE_PATTERN", ".", "match", "(", "url", ")", "if", "match", "is", "not", "None", ":", "return", "url", "match", "=", "GITHUB_FILE_PATTERN", ".", "mat...
[ 49, 0 ]
[ 65, 61 ]
python
en
['en', 'en', 'en']
True
_get_community_post_import_url
(url: str)
Convert a forum post url to an import url. Async friendly.
Convert a forum post url to an import url.
def _get_community_post_import_url(url: str) -> str: """Convert a forum post url to an import url. Async friendly. """ match = COMMUNITY_TOPIC_PATTERN.match(url) if match is None: raise ValueError("Not a topic url") _topic, post = match.groups() json_url = url if post is not ...
[ "def", "_get_community_post_import_url", "(", "url", ":", "str", ")", "->", "str", ":", "match", "=", "COMMUNITY_TOPIC_PATTERN", ".", "match", "(", "url", ")", "if", "match", "is", "None", ":", "raise", "ValueError", "(", "\"Not a topic url\"", ")", "_topic", ...
[ 68, 0 ]
[ 87, 19 ]
python
en
['en', 'lb', 'en']
True
_extract_blueprint_from_community_topic
( url: str, topic: dict, )
Extract a blueprint from a community post JSON. Async friendly.
Extract a blueprint from a community post JSON.
def _extract_blueprint_from_community_topic( url: str, topic: dict, ) -> Optional[ImportedBlueprint]: """Extract a blueprint from a community post JSON. Async friendly. """ block_content = None blueprint = None post = topic["post_stream"]["posts"][0] for match in COMMUNITY_CODE_BLO...
[ "def", "_extract_blueprint_from_community_topic", "(", "url", ":", "str", ",", "topic", ":", "dict", ",", ")", "->", "Optional", "[", "ImportedBlueprint", "]", ":", "block_content", "=", "None", "blueprint", "=", "None", "post", "=", "topic", "[", "\"post_stre...
[ 90, 0 ]
[ 127, 74 ]
python
en
['en', 'en', 'en']
True
fetch_blueprint_from_community_post
( hass: HomeAssistant, url: str )
Get blueprints from a community post url. Method can raise aiohttp client exceptions, vol.Invalid. Caller needs to implement own timeout.
Get blueprints from a community post url.
async def fetch_blueprint_from_community_post( hass: HomeAssistant, url: str ) -> Optional[ImportedBlueprint]: """Get blueprints from a community post url. Method can raise aiohttp client exceptions, vol.Invalid. Caller needs to implement own timeout. """ import_url = _get_community_post_impor...
[ "async", "def", "fetch_blueprint_from_community_post", "(", "hass", ":", "HomeAssistant", ",", "url", ":", "str", ")", "->", "Optional", "[", "ImportedBlueprint", "]", ":", "import_url", "=", "_get_community_post_import_url", "(", "url", ")", "session", "=", "aioh...
[ 130, 0 ]
[ 145, 66 ]
python
en
['en', 'en', 'en']
True
fetch_blueprint_from_github_url
( hass: HomeAssistant, url: str )
Get a blueprint from a github url.
Get a blueprint from a github url.
async def fetch_blueprint_from_github_url( hass: HomeAssistant, url: str ) -> ImportedBlueprint: """Get a blueprint from a github url.""" import_url = _get_github_import_url(url) session = aiohttp_client.async_get_clientsession(hass) resp = await session.get(import_url, raise_for_status=True) r...
[ "async", "def", "fetch_blueprint_from_github_url", "(", "hass", ":", "HomeAssistant", ",", "url", ":", "str", ")", "->", "ImportedBlueprint", ":", "import_url", "=", "_get_github_import_url", "(", "url", ")", "session", "=", "aiohttp_client", ".", "async_get_clients...
[ 148, 0 ]
[ 165, 74 ]
python
en
['en', 'en', 'en']
True
fetch_blueprint_from_url
(hass: HomeAssistant, url: str)
Get a blueprint from a url.
Get a blueprint from a url.
async def fetch_blueprint_from_url(hass: HomeAssistant, url: str) -> ImportedBlueprint: """Get a blueprint from a url.""" for func in (fetch_blueprint_from_community_post, fetch_blueprint_from_github_url): try: return await func(hass, url) except ValueError: pass rai...
[ "async", "def", "fetch_blueprint_from_url", "(", "hass", ":", "HomeAssistant", ",", "url", ":", "str", ")", "->", "ImportedBlueprint", ":", "for", "func", "in", "(", "fetch_blueprint_from_community_post", ",", "fetch_blueprint_from_github_url", ")", ":", "try", ":",...
[ 168, 0 ]
[ 176, 47 ]
python
en
['en', 'lb', 'en']
True
ModelSpeedup.__init__
(self, model, dummy_input, masks_file, map_location=None)
Parameters ---------- model : pytorch model The model user wants to speed up dummy_input : pytorch tensor The dummy input for ```jit.trace```, users should put it on right device before pass in masks_file : str The path of user provided mask f...
Parameters ---------- model : pytorch model The model user wants to speed up dummy_input : pytorch tensor The dummy input for ```jit.trace```, users should put it on right device before pass in masks_file : str The path of user provided mask f...
def __init__(self, model, dummy_input, masks_file, map_location=None): """ Parameters ---------- model : pytorch model The model user wants to speed up dummy_input : pytorch tensor The dummy input for ```jit.trace```, users should put it on right device be...
[ "def", "__init__", "(", "self", ",", "model", ",", "dummy_input", ",", "masks_file", ",", "map_location", "=", "None", ")", ":", "from", "nni", ".", "common", ".", "graph_utils", "import", "build_module_graph", "self", ".", "bound_model", "=", "model", "self...
[ 18, 4 ]
[ 37, 65 ]
python
en
['en', 'error', 'th']
False
ModelSpeedup.infer_module_mask
(self, module_name, last_module, mask=None, in_shape=None, out_shape=None)
Infer input shape / output shape based on the module's weight mask / input shape / output shape. For a module: Infer its input and output shape from its weight mask Infer its output shape from its input shape Infer its input shape from its output shape If i...
Infer input shape / output shape based on the module's weight mask / input shape / output shape.
def infer_module_mask(self, module_name, last_module, mask=None, in_shape=None, out_shape=None): """ Infer input shape / output shape based on the module's weight mask / input shape / output shape. For a module: Infer its input and output shape from its weight mask Infer...
[ "def", "infer_module_mask", "(", "self", ",", "module_name", ",", "last_module", ",", "mask", "=", "None", ",", "in_shape", "=", "None", ",", "out_shape", "=", "None", ")", ":", "input_cmask", "=", "output_cmask", "=", "None", "if", "module_name", "in", "s...
[ 39, 4 ]
[ 123, 88 ]
python
en
['en', 'error', 'th']
False
ModelSpeedup.infer_modules_masks
(self)
Do shape inference of involved modules, including the shape of weights, inputs, output
Do shape inference of involved modules, including the shape of weights, inputs, output
def infer_modules_masks(self): """ Do shape inference of involved modules, including the shape of weights, inputs, output """ for module_name, mask in self.masks.items(): _logger.debug('Start mask inference from %s', module_name) if module_name not in self.torch_g...
[ "def", "infer_modules_masks", "(", "self", ")", ":", "for", "module_name", ",", "mask", "in", "self", ".", "masks", ".", "items", "(", ")", ":", "_logger", ".", "debug", "(", "'Start mask inference from %s'", ",", "module_name", ")", "if", "module_name", "no...
[ 125, 4 ]
[ 139, 64 ]
python
en
['en', 'error', 'th']
False
ModelSpeedup.replace_compressed_modules
(self)
Replace all the modules that have changed (weights/inputs/output) shape. The new module is created using the same arguments of the to-be-replaced module, and correctly inherits its weights. NOTE: ```func``` type cannot be replaced as it is not a module, thus, one limitation is ...
Replace all the modules that have changed (weights/inputs/output) shape. The new module is created using the same arguments of the to-be-replaced module, and correctly inherits its weights.
def replace_compressed_modules(self): """ Replace all the modules that have changed (weights/inputs/output) shape. The new module is created using the same arguments of the to-be-replaced module, and correctly inherits its weights. NOTE: ```func``` type cannot be replaced as it ...
[ "def", "replace_compressed_modules", "(", "self", ")", ":", "for", "module_name", "in", "self", ".", "inferred_masks", ":", "g_node", "=", "self", ".", "torch_graph", ".", "name_to_node", "[", "module_name", "]", "_logger", ".", "debug", "(", "\"replace %s, in %...
[ 141, 4 ]
[ 166, 83 ]
python
en
['en', 'error', 'th']
False
ModelSpeedup.speedup_model
(self)
There are basically two steps: first, do mask/shape inference, second, replace modules
There are basically two steps: first, do mask/shape inference, second, replace modules
def speedup_model(self): """ There are basically two steps: first, do mask/shape inference, second, replace modules """ training = self.bound_model.training _logger.info("start to speed up the model") _logger.info("fix the mask conflict of the interdepend...
[ "def", "speedup_model", "(", "self", ")", ":", "training", "=", "self", ".", "bound_model", ".", "training", "_logger", ".", "info", "(", "\"start to speed up the model\"", ")", "_logger", ".", "info", "(", "\"fix the mask conflict of the interdependent layers\"", ")"...
[ 168, 4 ]
[ 186, 36 ]
python
en
['en', 'error', 'th']
False
mock_client
(hass, hass_client)
Start the Home Assistant HTTP component.
Start the Home Assistant HTTP component.
def mock_client(hass, hass_client): """Start the Home Assistant HTTP component.""" with patch("homeassistant.components.spaceapi", return_value=mock_coro(True)): hass.loop.run_until_complete(async_setup_component(hass, "spaceapi", CONFIG)) hass.states.async_set( "test.temp1", 25, attributes...
[ "def", "mock_client", "(", "hass", ",", "hass_client", ")", ":", "with", "patch", "(", "\"homeassistant.components.spaceapi\"", ",", "return_value", "=", "mock_coro", "(", "True", ")", ")", ":", "hass", ".", "loop", ".", "run_until_complete", "(", "async_setup_c...
[ 72, 0 ]
[ 87, 54 ]
python
en
['en', 'en', 'en']
True
test_spaceapi_get
(hass, mock_client)
Test response after start-up Home Assistant.
Test response after start-up Home Assistant.
async def test_spaceapi_get(hass, mock_client): """Test response after start-up Home Assistant.""" resp = await mock_client.get(URL_API_SPACEAPI) assert resp.status == 200 data = await resp.json() assert data["api"] == SPACEAPI_VERSION assert data["space"] == "Home" assert data["contact"][...
[ "async", "def", "test_spaceapi_get", "(", "hass", ",", "mock_client", ")", ":", "resp", "=", "await", "mock_client", ".", "get", "(", "URL_API_SPACEAPI", ")", "assert", "resp", ".", "status", "==", "200", "data", "=", "await", "resp", ".", "json", "(", "...
[ 90, 0 ]
[ 131, 62 ]
python
en
['da', 'en', 'en']
True
test_spaceapi_state_get
(hass, mock_client)
Test response if the state entity was set.
Test response if the state entity was set.
async def test_spaceapi_state_get(hass, mock_client): """Test response if the state entity was set.""" hass.states.async_set("test.test_door", True) resp = await mock_client.get(URL_API_SPACEAPI) assert resp.status == 200 data = await resp.json() assert data["state"]["open"] == bool(1)
[ "async", "def", "test_spaceapi_state_get", "(", "hass", ",", "mock_client", ")", ":", "hass", ".", "states", ".", "async_set", "(", "\"test.test_door\"", ",", "True", ")", "resp", "=", "await", "mock_client", ".", "get", "(", "URL_API_SPACEAPI", ")", "assert",...
[ 134, 0 ]
[ 142, 43 ]
python
en
['en', 'en', 'en']
True
test_spaceapi_sensors_get
(hass, mock_client)
Test the response for the sensors.
Test the response for the sensors.
async def test_spaceapi_sensors_get(hass, mock_client): """Test the response for the sensors.""" resp = await mock_client.get(URL_API_SPACEAPI) assert resp.status == 200 data = await resp.json() assert data["sensors"] == SENSOR_OUTPUT
[ "async", "def", "test_spaceapi_sensors_get", "(", "hass", ",", "mock_client", ")", ":", "resp", "=", "await", "mock_client", ".", "get", "(", "URL_API_SPACEAPI", ")", "assert", "resp", ".", "status", "==", "200", "data", "=", "await", "resp", ".", "json", ...
[ 145, 0 ]
[ 151, 43 ]
python
en
['en', 'en', 'en']
True
camera_client_fixture
(hass, hass_client)
Fixture to fetch camera streams.
Fixture to fetch camera streams.
def camera_client_fixture(hass, hass_client): """Fixture to fetch camera streams.""" assert hass.loop.run_until_complete( async_setup_component( hass, "camera", { "camera": { "name": "config_test", "platform": "m...
[ "def", "camera_client_fixture", "(", "hass", ",", "hass_client", ")", ":", "assert", "hass", ".", "loop", ".", "run_until_complete", "(", "async_setup_component", "(", "hass", ",", "\"camera\"", ",", "{", "\"camera\"", ":", "{", "\"name\"", ":", "\"config_test\"...
[ 14, 0 ]
[ 31, 53 ]
python
en
['en', 'es', 'en']
True
test_get_clientsession_with_ssl
(hass)
Test init clientsession with ssl.
Test init clientsession with ssl.
async def test_get_clientsession_with_ssl(hass): """Test init clientsession with ssl.""" client.async_get_clientsession(hass) assert isinstance(hass.data[client.DATA_CLIENTSESSION], aiohttp.ClientSession) assert isinstance(hass.data[client.DATA_CONNECTOR], aiohttp.TCPConnector)
[ "async", "def", "test_get_clientsession_with_ssl", "(", "hass", ")", ":", "client", ".", "async_get_clientsession", "(", "hass", ")", "assert", "isinstance", "(", "hass", ".", "data", "[", "client", ".", "DATA_CLIENTSESSION", "]", ",", "aiohttp", ".", "ClientSes...
[ 34, 0 ]
[ 39, 77 ]
python
en
['en', 'en', 'en']
True
test_get_clientsession_without_ssl
(hass)
Test init clientsession without ssl.
Test init clientsession without ssl.
async def test_get_clientsession_without_ssl(hass): """Test init clientsession without ssl.""" client.async_get_clientsession(hass, verify_ssl=False) assert isinstance( hass.data[client.DATA_CLIENTSESSION_NOTVERIFY], aiohttp.ClientSession ) assert isinstance(hass.data[client.DATA_CONNECTOR_...
[ "async", "def", "test_get_clientsession_without_ssl", "(", "hass", ")", ":", "client", ".", "async_get_clientsession", "(", "hass", ",", "verify_ssl", "=", "False", ")", "assert", "isinstance", "(", "hass", ".", "data", "[", "client", ".", "DATA_CLIENTSESSION_NOTV...
[ 42, 0 ]
[ 49, 87 ]
python
en
['en', 'en', 'en']
True
test_create_clientsession_with_ssl_and_cookies
(hass)
Test create clientsession with ssl.
Test create clientsession with ssl.
async def test_create_clientsession_with_ssl_and_cookies(hass): """Test create clientsession with ssl.""" session = client.async_create_clientsession(hass, cookies={"bla": True}) assert isinstance(session, aiohttp.ClientSession) assert isinstance(hass.data[client.DATA_CONNECTOR], aiohttp.TCPConnector)
[ "async", "def", "test_create_clientsession_with_ssl_and_cookies", "(", "hass", ")", ":", "session", "=", "client", ".", "async_create_clientsession", "(", "hass", ",", "cookies", "=", "{", "\"bla\"", ":", "True", "}", ")", "assert", "isinstance", "(", "session", ...
[ 52, 0 ]
[ 56, 77 ]
python
en
['en', 'en', 'en']
True
test_create_clientsession_without_ssl_and_cookies
(hass)
Test create clientsession without ssl.
Test create clientsession without ssl.
async def test_create_clientsession_without_ssl_and_cookies(hass): """Test create clientsession without ssl.""" session = client.async_create_clientsession(hass, False, cookies={"bla": True}) assert isinstance(session, aiohttp.ClientSession) assert isinstance(hass.data[client.DATA_CONNECTOR_NOTVERIFY], ...
[ "async", "def", "test_create_clientsession_without_ssl_and_cookies", "(", "hass", ")", ":", "session", "=", "client", ".", "async_create_clientsession", "(", "hass", ",", "False", ",", "cookies", "=", "{", "\"bla\"", ":", "True", "}", ")", "assert", "isinstance", ...
[ 59, 0 ]
[ 63, 87 ]
python
en
['en', 'en', 'en']
True
test_get_clientsession_cleanup
(hass)
Test init clientsession with ssl.
Test init clientsession with ssl.
async def test_get_clientsession_cleanup(hass): """Test init clientsession with ssl.""" client.async_get_clientsession(hass) assert isinstance(hass.data[client.DATA_CLIENTSESSION], aiohttp.ClientSession) assert isinstance(hass.data[client.DATA_CONNECTOR], aiohttp.TCPConnector) hass.bus.async_fire(...
[ "async", "def", "test_get_clientsession_cleanup", "(", "hass", ")", ":", "client", ".", "async_get_clientsession", "(", "hass", ")", "assert", "isinstance", "(", "hass", ".", "data", "[", "client", ".", "DATA_CLIENTSESSION", "]", ",", "aiohttp", ".", "ClientSess...
[ 66, 0 ]
[ 77, 50 ]
python
en
['en', 'en', 'en']
True
test_get_clientsession_cleanup_without_ssl
(hass)
Test init clientsession with ssl.
Test init clientsession with ssl.
async def test_get_clientsession_cleanup_without_ssl(hass): """Test init clientsession with ssl.""" client.async_get_clientsession(hass, verify_ssl=False) assert isinstance( hass.data[client.DATA_CLIENTSESSION_NOTVERIFY], aiohttp.ClientSession ) assert isinstance(hass.data[client.DATA_CONNE...
[ "async", "def", "test_get_clientsession_cleanup_without_ssl", "(", "hass", ")", ":", "client", ".", "async_get_clientsession", "(", "hass", ",", "verify_ssl", "=", "False", ")", "assert", "isinstance", "(", "hass", ".", "data", "[", "client", ".", "DATA_CLIENTSESS...
[ 80, 0 ]
[ 93, 60 ]
python
en
['en', 'en', 'en']
True
test_get_clientsession_patched_close
(hass)
Test closing clientsession does not work.
Test closing clientsession does not work.
async def test_get_clientsession_patched_close(hass): """Test closing clientsession does not work.""" with patch("aiohttp.ClientSession.close") as mock_close: session = client.async_get_clientsession(hass) assert isinstance(hass.data[client.DATA_CLIENTSESSION], aiohttp.ClientSession) as...
[ "async", "def", "test_get_clientsession_patched_close", "(", "hass", ")", ":", "with", "patch", "(", "\"aiohttp.ClientSession.close\"", ")", "as", "mock_close", ":", "session", "=", "client", ".", "async_get_clientsession", "(", "hass", ")", "assert", "isinstance", ...
[ 96, 0 ]
[ 107, 41 ]
python
en
['en', 'en', 'en']
True
test_warning_close_session_integration
(hass, caplog)
Test log warning message when closing the session from integration context.
Test log warning message when closing the session from integration context.
async def test_warning_close_session_integration(hass, caplog): """Test log warning message when closing the session from integration context.""" with patch( "homeassistant.helpers.frame.extract_stack", return_value=[ Mock( filename="/home/paulus/homeassistant/core.py...
[ "async", "def", "test_warning_close_session_integration", "(", "hass", ",", "caplog", ")", ":", "with", "patch", "(", "\"homeassistant.helpers.frame.extract_stack\"", ",", "return_value", "=", "[", "Mock", "(", "filename", "=", "\"/home/paulus/homeassistant/core.py\"", ",...
[ 110, 0 ]
[ 138, 20 ]
python
en
['en', 'en', 'en']
True
test_warning_close_session_custom
(hass, caplog)
Test log warning message when closing the session from custom context.
Test log warning message when closing the session from custom context.
async def test_warning_close_session_custom(hass, caplog): """Test log warning message when closing the session from custom context.""" with patch( "homeassistant.helpers.frame.extract_stack", return_value=[ Mock( filename="/home/paulus/homeassistant/core.py", ...
[ "async", "def", "test_warning_close_session_custom", "(", "hass", ",", "caplog", ")", ":", "with", "patch", "(", "\"homeassistant.helpers.frame.extract_stack\"", ",", "return_value", "=", "[", "Mock", "(", "filename", "=", "\"/home/paulus/homeassistant/core.py\"", ",", ...
[ 141, 0 ]
[ 169, 5 ]
python
en
['en', 'en', 'en']
True
test_async_aiohttp_proxy_stream
(aioclient_mock, camera_client)
Test that it fetches the given url.
Test that it fetches the given url.
async def test_async_aiohttp_proxy_stream(aioclient_mock, camera_client): """Test that it fetches the given url.""" aioclient_mock.get("http://example.com/mjpeg_stream", content=b"Frame1Frame2Frame3") resp = await camera_client.get("/api/camera_proxy_stream/camera.config_test") assert resp.status == 2...
[ "async", "def", "test_async_aiohttp_proxy_stream", "(", "aioclient_mock", ",", "camera_client", ")", ":", "aioclient_mock", ".", "get", "(", "\"http://example.com/mjpeg_stream\"", ",", "content", "=", "b\"Frame1Frame2Frame3\"", ")", "resp", "=", "await", "camera_client", ...
[ 172, 0 ]
[ 181, 39 ]
python
en
['en', 'en', 'en']
True
test_async_aiohttp_proxy_stream_timeout
(aioclient_mock, camera_client)
Test that it fetches the given url.
Test that it fetches the given url.
async def test_async_aiohttp_proxy_stream_timeout(aioclient_mock, camera_client): """Test that it fetches the given url.""" aioclient_mock.get("http://example.com/mjpeg_stream", exc=asyncio.TimeoutError()) resp = await camera_client.get("/api/camera_proxy_stream/camera.config_test") assert resp.status ...
[ "async", "def", "test_async_aiohttp_proxy_stream_timeout", "(", "aioclient_mock", ",", "camera_client", ")", ":", "aioclient_mock", ".", "get", "(", "\"http://example.com/mjpeg_stream\"", ",", "exc", "=", "asyncio", ".", "TimeoutError", "(", ")", ")", "resp", "=", "...
[ 184, 0 ]
[ 189, 29 ]
python
en
['en', 'en', 'en']
True
test_async_aiohttp_proxy_stream_client_err
(aioclient_mock, camera_client)
Test that it fetches the given url.
Test that it fetches the given url.
async def test_async_aiohttp_proxy_stream_client_err(aioclient_mock, camera_client): """Test that it fetches the given url.""" aioclient_mock.get("http://example.com/mjpeg_stream", exc=aiohttp.ClientError()) resp = await camera_client.get("/api/camera_proxy_stream/camera.config_test") assert resp.statu...
[ "async", "def", "test_async_aiohttp_proxy_stream_client_err", "(", "aioclient_mock", ",", "camera_client", ")", ":", "aioclient_mock", ".", "get", "(", "\"http://example.com/mjpeg_stream\"", ",", "exc", "=", "aiohttp", ".", "ClientError", "(", ")", ")", "resp", "=", ...
[ 192, 0 ]
[ 197, 29 ]
python
en
['en', 'en', 'en']
True
setup_platform
(hass, config, add_entities, discovery_info=None)
Set up the HaveIBeenPwned sensor.
Set up the HaveIBeenPwned sensor.
def setup_platform(hass, config, add_entities, discovery_info=None): """Set up the HaveIBeenPwned sensor.""" emails = config.get(CONF_EMAIL) api_key = config[CONF_API_KEY] data = HaveIBeenPwnedData(emails, api_key) devices = [] for email in emails: devices.append(HaveIBeenPwnedSensor(da...
[ "def", "setup_platform", "(", "hass", ",", "config", ",", "add_entities", ",", "discovery_info", "=", "None", ")", ":", "emails", "=", "config", ".", "get", "(", "CONF_EMAIL", ")", "api_key", "=", "config", "[", "CONF_API_KEY", "]", "data", "=", "HaveIBeen...
[ 43, 0 ]
[ 53, 25 ]
python
en
['en', 'zu', 'en']
True
HaveIBeenPwnedSensor.__init__
(self, data, email)
Initialize the HaveIBeenPwned sensor.
Initialize the HaveIBeenPwned sensor.
def __init__(self, data, email): """Initialize the HaveIBeenPwned sensor.""" self._state = None self._data = data self._email = email self._unit_of_measurement = "Breaches"
[ "def", "__init__", "(", "self", ",", "data", ",", "email", ")", ":", "self", ".", "_state", "=", "None", "self", ".", "_data", "=", "data", "self", ".", "_email", "=", "email", "self", ".", "_unit_of_measurement", "=", "\"Breaches\"" ]
[ 59, 4 ]
[ 64, 46 ]
python
en
['en', 'zu', 'en']
True
HaveIBeenPwnedSensor.name
(self)
Return the name of the sensor.
Return the name of the sensor.
def name(self): """Return the name of the sensor.""" return f"Breaches {self._email}"
[ "def", "name", "(", "self", ")", ":", "return", "f\"Breaches {self._email}\"" ]
[ 67, 4 ]
[ 69, 40 ]
python
en
['en', 'mi', 'en']
True
HaveIBeenPwnedSensor.unit_of_measurement
(self)
Return the unit the value is expressed in.
Return the unit the value is expressed in.
def unit_of_measurement(self): """Return the unit the value is expressed in.""" return self._unit_of_measurement
[ "def", "unit_of_measurement", "(", "self", ")", ":", "return", "self", ".", "_unit_of_measurement" ]
[ 72, 4 ]
[ 74, 40 ]
python
en
['en', 'en', 'en']
True
HaveIBeenPwnedSensor.state
(self)
Return the state of the device.
Return the state of the device.
def state(self): """Return the state of the device.""" return self._state
[ "def", "state", "(", "self", ")", ":", "return", "self", ".", "_state" ]
[ 77, 4 ]
[ 79, 26 ]
python
en
['en', 'en', 'en']
True
HaveIBeenPwnedSensor.device_state_attributes
(self)
Return the attributes of the sensor.
Return the attributes of the sensor.
def device_state_attributes(self): """Return the attributes of the sensor.""" val = {ATTR_ATTRIBUTION: ATTRIBUTION} if self._email not in self._data.data: return val for idx, value in enumerate(self._data.data[self._email]): tmpname = f"breach {idx + 1}" ...
[ "def", "device_state_attributes", "(", "self", ")", ":", "val", "=", "{", "ATTR_ATTRIBUTION", ":", "ATTRIBUTION", "}", "if", "self", ".", "_email", "not", "in", "self", ".", "_data", ".", "data", ":", "return", "val", "for", "idx", ",", "value", "in", ...
[ 82, 4 ]
[ 96, 18 ]
python
en
['en', 'en', 'en']
True
HaveIBeenPwnedSensor.async_added_to_hass
(self)
Get initial data.
Get initial data.
async def async_added_to_hass(self): """Get initial data.""" # To make sure we get initial data for the sensors ignoring the normal # throttle of 15 minutes but using an update throttle of 5 seconds self.hass.async_add_executor_job(self.update_nothrottle)
[ "async", "def", "async_added_to_hass", "(", "self", ")", ":", "# To make sure we get initial data for the sensors ignoring the normal", "# throttle of 15 minutes but using an update throttle of 5 seconds", "self", ".", "hass", ".", "async_add_executor_job", "(", "self", ".", "updat...
[ 98, 4 ]
[ 102, 64 ]
python
da
['da', 'id', 'en']
False
HaveIBeenPwnedSensor.update_nothrottle
(self, dummy=None)
Update sensor without throttle.
Update sensor without throttle.
def update_nothrottle(self, dummy=None): """Update sensor without throttle.""" self._data.update_no_throttle() # Schedule a forced update 5 seconds in the future if the update above # returned no data for this sensors email. This is mainly to make sure # that we don't get HTTP E...
[ "def", "update_nothrottle", "(", "self", ",", "dummy", "=", "None", ")", ":", "self", ".", "_data", ".", "update_no_throttle", "(", ")", "# Schedule a forced update 5 seconds in the future if the update above", "# returned no data for this sensors email. This is mainly to make su...
[ 104, 4 ]
[ 122, 39 ]
python
en
['en', 'en', 'en']
True
HaveIBeenPwnedSensor.update
(self)
Update data and see if it contains data for our email.
Update data and see if it contains data for our email.
def update(self): """Update data and see if it contains data for our email.""" self._data.update() if self._email in self._data.data: self._state = len(self._data.data[self._email])
[ "def", "update", "(", "self", ")", ":", "self", ".", "_data", ".", "update", "(", ")", "if", "self", ".", "_email", "in", "self", ".", "_data", ".", "data", ":", "self", ".", "_state", "=", "len", "(", "self", ".", "_data", ".", "data", "[", "s...
[ 124, 4 ]
[ 129, 59 ]
python
en
['en', 'en', 'en']
True
HaveIBeenPwnedData.__init__
(self, emails, api_key)
Initialize the data object.
Initialize the data object.
def __init__(self, emails, api_key): """Initialize the data object.""" self._email_count = len(emails) self._current_index = 0 self.data = {} self._email = emails[0] self._emails = emails self._api_key = api_key
[ "def", "__init__", "(", "self", ",", "emails", ",", "api_key", ")", ":", "self", ".", "_email_count", "=", "len", "(", "emails", ")", "self", ".", "_current_index", "=", "0", "self", ".", "data", "=", "{", "}", "self", ".", "_email", "=", "emails", ...
[ 135, 4 ]
[ 142, 31 ]
python
en
['en', 'en', 'en']
True
HaveIBeenPwnedData.set_next_email
(self)
Set the next email to be looked up.
Set the next email to be looked up.
def set_next_email(self): """Set the next email to be looked up.""" self._current_index = (self._current_index + 1) % self._email_count self._email = self._emails[self._current_index]
[ "def", "set_next_email", "(", "self", ")", ":", "self", ".", "_current_index", "=", "(", "self", ".", "_current_index", "+", "1", ")", "%", "self", ".", "_email_count", "self", ".", "_email", "=", "self", ".", "_emails", "[", "self", ".", "_current_index...
[ 144, 4 ]
[ 147, 55 ]
python
en
['en', 'en', 'en']
True
HaveIBeenPwnedData.update_no_throttle
(self)
Get the data for a specific email.
Get the data for a specific email.
def update_no_throttle(self): """Get the data for a specific email.""" self.update(no_throttle=True)
[ "def", "update_no_throttle", "(", "self", ")", ":", "self", ".", "update", "(", "no_throttle", "=", "True", ")" ]
[ 149, 4 ]
[ 151, 37 ]
python
en
['en', 'en', 'en']
True
HaveIBeenPwnedData.update
(self, **kwargs)
Get the latest data for current email from REST service.
Get the latest data for current email from REST service.
def update(self, **kwargs): """Get the latest data for current email from REST service.""" try: url = f"{URL}{self._email}?truncateResponse=false" header = {USER_AGENT: HA_USER_AGENT, "hibp-api-key": self._api_key} _LOGGER.debug("Checking for breaches for email: %s", ...
[ "def", "update", "(", "self", ",", "*", "*", "kwargs", ")", ":", "try", ":", "url", "=", "f\"{URL}{self._email}?truncateResponse=false\"", "header", "=", "{", "USER_AGENT", ":", "HA_USER_AGENT", ",", "\"hibp-api-key\"", ":", "self", ".", "_api_key", "}", "_LOG...
[ 154, 4 ]
[ 187, 13 ]
python
en
['en', 'en', 'en']
True
GenerateConfig
(context)
Generate YAML resource configuration.
Generate YAML resource configuration.
def GenerateConfig(context): """Generate YAML resource configuration.""" # Pull the region out of the zone region = context.properties['zone'][:context.properties['zone'].rfind('-')] name = context.env['name'] resources = [{ 'name': name, 'type': 'container_instance_template.py', 'properti...
[ "def", "GenerateConfig", "(", "context", ")", ":", "# Pull the region out of the zone", "region", "=", "context", ".", "properties", "[", "'zone'", "]", "[", ":", "context", ".", "properties", "[", "'zone'", "]", ".", "rfind", "(", "'-'", ")", "]", "name", ...
[ 17, 0 ]
[ 76, 33 ]
python
en
['en', 'ny', 'it']
False
setup_platform
(hass, config, add_entities, discovery_info=None)
Set up the available OctoPrint binary sensors.
Set up the available OctoPrint binary sensors.
def setup_platform(hass, config, add_entities, discovery_info=None): """Set up the available OctoPrint binary sensors.""" if discovery_info is None: return name = discovery_info["name"] base_url = discovery_info["base_url"] monitored_conditions = discovery_info["sensors"] octoprint_api ...
[ "def", "setup_platform", "(", "hass", ",", "config", ",", "add_entities", ",", "discovery_info", "=", "None", ")", ":", "if", "discovery_info", "is", "None", ":", "return", "name", "=", "discovery_info", "[", "\"name\"", "]", "base_url", "=", "discovery_info",...
[ 12, 0 ]
[ 35, 31 ]
python
en
['en', 'en', 'en']
True
OctoPrintBinarySensor.__init__
( self, api, condition, sensor_type, sensor_name, unit, endpoint, group, tool=None )
Initialize a new OctoPrint sensor.
Initialize a new OctoPrint sensor.
def __init__( self, api, condition, sensor_type, sensor_name, unit, endpoint, group, tool=None ): """Initialize a new OctoPrint sensor.""" self.sensor_name = sensor_name if tool is None: self._name = f"{sensor_name} {condition}" else: self._name = f"{s...
[ "def", "__init__", "(", "self", ",", "api", ",", "condition", ",", "sensor_type", ",", "sensor_name", ",", "unit", ",", "endpoint", ",", "group", ",", "tool", "=", "None", ")", ":", "self", ".", "sensor_name", "=", "sensor_name", "if", "tool", "is", "N...
[ 41, 4 ]
[ 57, 65 ]
python
en
['en', 'lb', 'en']
True
OctoPrintBinarySensor.name
(self)
Return the name of the sensor.
Return the name of the sensor.
def name(self): """Return the name of the sensor.""" return self._name
[ "def", "name", "(", "self", ")", ":", "return", "self", ".", "_name" ]
[ 60, 4 ]
[ 62, 25 ]
python
en
['en', 'mi', 'en']
True
OctoPrintBinarySensor.is_on
(self)
Return true if binary sensor is on.
Return true if binary sensor is on.
def is_on(self): """Return true if binary sensor is on.""" return bool(self._state)
[ "def", "is_on", "(", "self", ")", ":", "return", "bool", "(", "self", ".", "_state", ")" ]
[ 65, 4 ]
[ 67, 32 ]
python
en
['en', 'fy', 'en']
True
OctoPrintBinarySensor.device_class
(self)
Return the class of this sensor, from DEVICE_CLASSES.
Return the class of this sensor, from DEVICE_CLASSES.
def device_class(self): """Return the class of this sensor, from DEVICE_CLASSES.""" return None
[ "def", "device_class", "(", "self", ")", ":", "return", "None" ]
[ 70, 4 ]
[ 72, 19 ]
python
en
['en', 'en', 'en']
True
OctoPrintBinarySensor.update
(self)
Update state of sensor.
Update state of sensor.
def update(self): """Update state of sensor.""" try: self._state = self.api.update( self.sensor_type, self.api_endpoint, self.api_group, self.api_tool ) except requests.exceptions.ConnectionError: # Error calling the api, already logged in api....
[ "def", "update", "(", "self", ")", ":", "try", ":", "self", ".", "_state", "=", "self", ".", "api", ".", "update", "(", "self", ".", "sensor_type", ",", "self", ".", "api_endpoint", ",", "self", ".", "api_group", ",", "self", ".", "api_tool", ")", ...
[ 74, 4 ]
[ 82, 18 ]
python
en
['en', 'co', 'en']
True
get_engine
(hass, config, discovery_info=None)
Set up MaryTTS speech component.
Set up MaryTTS speech component.
def get_engine(hass, config, discovery_info=None): """Set up MaryTTS speech component.""" return MaryTTSProvider(hass, config)
[ "def", "get_engine", "(", "hass", ",", "config", ",", "discovery_info", "=", "None", ")", ":", "return", "MaryTTSProvider", "(", "hass", ",", "config", ")" ]
[ 39, 0 ]
[ 41, 40 ]
python
en
['en', 'lb', 'en']
True
MaryTTSProvider.__init__
(self, hass, conf)
Init MaryTTS TTS service.
Init MaryTTS TTS service.
def __init__(self, hass, conf): """Init MaryTTS TTS service.""" self.hass = hass self._mary = MaryTTS( conf.get(CONF_HOST), conf.get(CONF_PORT), conf.get(CONF_CODEC), conf.get(CONF_LANG), conf.get(CONF_VOICE), ) self._ef...
[ "def", "__init__", "(", "self", ",", "hass", ",", "conf", ")", ":", "self", ".", "hass", "=", "hass", "self", ".", "_mary", "=", "MaryTTS", "(", "conf", ".", "get", "(", "CONF_HOST", ")", ",", "conf", ".", "get", "(", "CONF_PORT", ")", ",", "conf...
[ 47, 4 ]
[ 58, 29 ]
python
en
['en', 'hu', 'en']
True
MaryTTSProvider.default_language
(self)
Return the default language.
Return the default language.
def default_language(self): """Return the default language.""" return self._mary.locale
[ "def", "default_language", "(", "self", ")", ":", "return", "self", ".", "_mary", ".", "locale" ]
[ 61, 4 ]
[ 63, 32 ]
python
en
['en', 'et', 'en']
True
MaryTTSProvider.supported_languages
(self)
Return list of supported languages.
Return list of supported languages.
def supported_languages(self): """Return list of supported languages.""" return SUPPORT_LANGUAGES
[ "def", "supported_languages", "(", "self", ")", ":", "return", "SUPPORT_LANGUAGES" ]
[ 66, 4 ]
[ 68, 32 ]
python
en
['en', 'en', 'en']
True
MaryTTSProvider.default_options
(self)
Return dict include default options.
Return dict include default options.
def default_options(self): """Return dict include default options.""" return {CONF_EFFECT: self._effects}
[ "def", "default_options", "(", "self", ")", ":", "return", "{", "CONF_EFFECT", ":", "self", ".", "_effects", "}" ]
[ 71, 4 ]
[ 73, 43 ]
python
en
['nl', 'en', 'en']
True
MaryTTSProvider.supported_options
(self)
Return a list of supported options.
Return a list of supported options.
def supported_options(self): """Return a list of supported options.""" return SUPPORT_OPTIONS
[ "def", "supported_options", "(", "self", ")", ":", "return", "SUPPORT_OPTIONS" ]
[ 76, 4 ]
[ 78, 30 ]
python
en
['en', 'en', 'en']
True
MaryTTSProvider.get_tts_audio
(self, message, language, options=None)
Load TTS from MaryTTS.
Load TTS from MaryTTS.
def get_tts_audio(self, message, language, options=None): """Load TTS from MaryTTS.""" effects = options[CONF_EFFECT] data = self._mary.speak(message, effects) audiotype = MAP_MARYTTS_CODEC[self._mary.codec] return audiotype, data
[ "def", "get_tts_audio", "(", "self", ",", "message", ",", "language", ",", "options", "=", "None", ")", ":", "effects", "=", "options", "[", "CONF_EFFECT", "]", "data", "=", "self", ".", "_mary", ".", "speak", "(", "message", ",", "effects", ")", "audi...
[ 80, 4 ]
[ 87, 30 ]
python
en
['en', 'en', 'en']
True
_async_loop_exception_handler
(_: Any, context: Dict)
Handle all exception inside the core loop.
Handle all exception inside the core loop.
def _async_loop_exception_handler(_: Any, context: Dict) -> None: """Handle all exception inside the core loop.""" kwargs = {} exception = context.get("exception") if exception: kwargs["exc_info"] = (type(exception), exception, exception.__traceback__) logging.getLogger(__package__).error( ...
[ "def", "_async_loop_exception_handler", "(", "_", ":", "Any", ",", "context", ":", "Dict", ")", "->", "None", ":", "kwargs", "=", "{", "}", "exception", "=", "context", ".", "get", "(", "\"exception\"", ")", "if", "exception", ":", "kwargs", "[", "\"exc_...
[ 91, 0 ]
[ 100, 5 ]
python
en
['en', 'en', 'en']
True
setup_and_run_hass
(runtime_config: RuntimeConfig)
Set up Home Assistant and run.
Set up Home Assistant and run.
async def setup_and_run_hass(runtime_config: RuntimeConfig) -> int: """Set up Home Assistant and run.""" hass = await bootstrap.async_setup_hass(runtime_config) if hass is None: return 1 return await hass.async_run()
[ "async", "def", "setup_and_run_hass", "(", "runtime_config", ":", "RuntimeConfig", ")", "->", "int", ":", "hass", "=", "await", "bootstrap", ".", "async_setup_hass", "(", "runtime_config", ")", "if", "hass", "is", "None", ":", "return", "1", "return", "await",...
[ 103, 0 ]
[ 110, 33 ]
python
en
['en', 'en', 'en']
True
run
(runtime_config: RuntimeConfig)
Run Home Assistant.
Run Home Assistant.
def run(runtime_config: RuntimeConfig) -> int: """Run Home Assistant.""" asyncio.set_event_loop_policy(HassEventLoopPolicy(runtime_config.debug)) return asyncio.run(setup_and_run_hass(runtime_config))
[ "def", "run", "(", "runtime_config", ":", "RuntimeConfig", ")", "->", "int", ":", "asyncio", ".", "set_event_loop_policy", "(", "HassEventLoopPolicy", "(", "runtime_config", ".", "debug", ")", ")", "return", "asyncio", ".", "run", "(", "setup_and_run_hass", "(",...
[ 113, 0 ]
[ 116, 58 ]
python
en
['fr', 'en', 'en']
True
HassEventLoopPolicy.__init__
(self, debug: bool)
Init the event loop policy.
Init the event loop policy.
def __init__(self, debug: bool) -> None: """Init the event loop policy.""" super().__init__() self.debug = debug
[ "def", "__init__", "(", "self", ",", "debug", ":", "bool", ")", "->", "None", ":", "super", "(", ")", ".", "__init__", "(", ")", "self", ".", "debug", "=", "debug" ]
[ 53, 4 ]
[ 56, 26 ]
python
en
['en', 'en', 'en']
True
HassEventLoopPolicy.loop_name
(self)
Return name of the loop.
Return name of the loop.
def loop_name(self) -> str: """Return name of the loop.""" return self._loop_factory.__name__
[ "def", "loop_name", "(", "self", ")", "->", "str", ":", "return", "self", ".", "_loop_factory", ".", "__name__" ]
[ 59, 4 ]
[ 61, 42 ]
python
en
['en', 'af', 'en']
True