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_step_geography_by_name
(hass)
Test setting up a geopgraphy entry by city/state/country.
Test setting up a geopgraphy entry by city/state/country.
async def test_step_geography_by_name(hass): """Test setting up a geopgraphy entry by city/state/country.""" conf = { CONF_API_KEY: "abcde12345", CONF_CITY: "Beijing", CONF_STATE: "Beijing", CONF_COUNTRY: "China", } with patch( "homeassistant.components.airvisual...
[ "async", "def", "test_step_geography_by_name", "(", "hass", ")", ":", "conf", "=", "{", "CONF_API_KEY", ":", "\"abcde12345\"", ",", "CONF_CITY", ":", "\"Beijing\"", ",", "CONF_STATE", ":", "\"Beijing\"", ",", "CONF_COUNTRY", ":", "\"China\"", ",", "}", "with", ...
[ 279, 0 ]
[ 308, 9 ]
python
en
['en', 'en', 'en']
True
test_step_node_pro
(hass)
Test the Node/Pro step.
Test the Node/Pro step.
async def test_step_node_pro(hass): """Test the Node/Pro step.""" conf = {CONF_IP_ADDRESS: "192.168.1.100", CONF_PASSWORD: "my_password"} with patch( "homeassistant.components.airvisual.async_setup_entry", return_value=True ), patch("pyairvisual.node.NodeSamba.async_connect"), patch( "p...
[ "async", "def", "test_step_node_pro", "(", "hass", ")", ":", "conf", "=", "{", "CONF_IP_ADDRESS", ":", "\"192.168.1.100\"", ",", "CONF_PASSWORD", ":", "\"my_password\"", "}", "with", "patch", "(", "\"homeassistant.components.airvisual.async_setup_entry\"", ",", "return_...
[ 311, 0 ]
[ 334, 9 ]
python
en
['en', 'en', 'en']
True
test_step_reauth
(hass)
Test that the reauth step works.
Test that the reauth step works.
async def test_step_reauth(hass): """Test that the reauth step works.""" entry_data = { CONF_API_KEY: "abcde12345", CONF_LATITUDE: 51.528308, CONF_LONGITUDE: -0.3817765, CONF_INTEGRATION_TYPE: INTEGRATION_TYPE_GEOGRAPHY_COORDS, } MockConfigEntry( domain=DOMAIN, u...
[ "async", "def", "test_step_reauth", "(", "hass", ")", ":", "entry_data", "=", "{", "CONF_API_KEY", ":", "\"abcde12345\"", ",", "CONF_LATITUDE", ":", "51.528308", ",", "CONF_LONGITUDE", ":", "-", "0.3817765", ",", "CONF_INTEGRATION_TYPE", ":", "INTEGRATION_TYPE_GEOGR...
[ 337, 0 ]
[ 368, 56 ]
python
en
['en', 'en', 'en']
True
test_step_user
(hass)
Test the user ("pick the integration type") step.
Test the user ("pick the integration type") step.
async def test_step_user(hass): """Test the user ("pick the integration type") step.""" result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": SOURCE_USER} ) assert result["type"] == data_entry_flow.RESULT_TYPE_FORM assert result["step_id"] == "user" result = aw...
[ "async", "def", "test_step_user", "(", "hass", ")", ":", "result", "=", "await", "hass", ".", "config_entries", ".", "flow", ".", "async_init", "(", "DOMAIN", ",", "context", "=", "{", "\"source\"", ":", "SOURCE_USER", "}", ")", "assert", "result", "[", ...
[ 371, 0 ]
[ 405, 42 ]
python
en
['en', 'en', 'en']
True
async_setup
(hass, config)
Set up the MQTT state feed.
Set up the MQTT state feed.
async def async_setup(hass, config): """Set up the MQTT state feed.""" conf = config.get(DOMAIN) publish_filter = convert_include_exclude_filter(conf) base_topic = conf.get(CONF_BASE_TOPIC) publish_attributes = conf.get(CONF_PUBLISH_ATTRIBUTES) publish_timestamps = conf.get(CONF_PUBLISH_TIMESTAM...
[ "async", "def", "async_setup", "(", "hass", ",", "config", ")", ":", "conf", "=", "config", ".", "get", "(", "DOMAIN", ")", "publish_filter", "=", "convert_include_exclude_filter", "(", "conf", ")", "base_topic", "=", "conf", ".", "get", "(", "CONF_BASE_TOPI...
[ 36, 0 ]
[ 75, 15 ]
python
en
['en', 'en', 'en']
True
async_setup_entry
(hass: HomeAssistant, entry: ConfigEntry)
Set up syncthing from a config entry.
Set up syncthing from a config entry.
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: """Set up syncthing from a config entry.""" data = entry.data if DOMAIN not in hass.data: hass.data[DOMAIN] = {} client = aiosyncthing.Syncthing( data[CONF_TOKEN], url=data[CONF_URL], verify_s...
[ "async", "def", "async_setup_entry", "(", "hass", ":", "HomeAssistant", ",", "entry", ":", "ConfigEntry", ")", "->", "bool", ":", "data", "=", "entry", ".", "data", "if", "DOMAIN", "not", "in", "hass", ".", "data", ":", "hass", ".", "data", "[", "DOMAI...
[ 30, 0 ]
[ 64, 15 ]
python
en
['en', 'en', 'en']
True
async_unload_entry
(hass: HomeAssistant, entry: ConfigEntry)
Unload a config entry.
Unload a config entry.
async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: """Unload a config entry.""" unload_ok = await hass.config_entries.async_unload_platforms(entry, PLATFORMS) if unload_ok: syncthing = hass.data[DOMAIN].pop(entry.entry_id) await syncthing.unsubscribe() return...
[ "async", "def", "async_unload_entry", "(", "hass", ":", "HomeAssistant", ",", "entry", ":", "ConfigEntry", ")", "->", "bool", ":", "unload_ok", "=", "await", "hass", ".", "config_entries", ".", "async_unload_platforms", "(", "entry", ",", "PLATFORMS", ")", "if...
[ 67, 0 ]
[ 74, 20 ]
python
en
['en', 'es', 'en']
True
SyncthingClient.__init__
(self, hass, client, server_id)
Initialize the client.
Initialize the client.
def __init__(self, hass, client, server_id): """Initialize the client.""" self._hass = hass self._client = client self._server_id = server_id self._listen_task = None
[ "def", "__init__", "(", "self", ",", "hass", ",", "client", ",", "server_id", ")", ":", "self", ".", "_hass", "=", "hass", "self", ".", "_client", "=", "client", "self", ".", "_server_id", "=", "server_id", "self", ".", "_listen_task", "=", "None" ]
[ 80, 4 ]
[ 85, 32 ]
python
en
['en', 'en', 'en']
True
SyncthingClient.server_id
(self)
Get server id.
Get server id.
def server_id(self): """Get server id.""" return self._server_id
[ "def", "server_id", "(", "self", ")", ":", "return", "self", ".", "_server_id" ]
[ 88, 4 ]
[ 90, 30 ]
python
en
['en', 'ko', 'en']
True
SyncthingClient.url
(self)
Get server URL.
Get server URL.
def url(self): """Get server URL.""" return self._client.url
[ "def", "url", "(", "self", ")", ":", "return", "self", ".", "_client", ".", "url" ]
[ 93, 4 ]
[ 95, 31 ]
python
en
['en', 'pt', 'en']
True
SyncthingClient.database
(self)
Get database namespace client.
Get database namespace client.
def database(self): """Get database namespace client.""" return self._client.database
[ "def", "database", "(", "self", ")", ":", "return", "self", ".", "_client", ".", "database" ]
[ 98, 4 ]
[ 100, 36 ]
python
en
['fr', 'en', 'en']
True
SyncthingClient.system
(self)
Get system namespace client.
Get system namespace client.
def system(self): """Get system namespace client.""" return self._client.system
[ "def", "system", "(", "self", ")", ":", "return", "self", ".", "_client", ".", "system" ]
[ 103, 4 ]
[ 105, 34 ]
python
en
['cs', 'en', 'en']
True
SyncthingClient.subscribe
(self)
Start event listener coroutine.
Start event listener coroutine.
def subscribe(self): """Start event listener coroutine.""" self._listen_task = asyncio.create_task(self._listen())
[ "def", "subscribe", "(", "self", ")", ":", "self", ".", "_listen_task", "=", "asyncio", ".", "create_task", "(", "self", ".", "_listen", "(", ")", ")" ]
[ 107, 4 ]
[ 109, 63 ]
python
de
['fr', 'de', 'it']
False
SyncthingClient.unsubscribe
(self)
Stop event listener coroutine.
Stop event listener coroutine.
async def unsubscribe(self): """Stop event listener coroutine.""" if self._listen_task: self._listen_task.cancel() await self._client.close()
[ "async", "def", "unsubscribe", "(", "self", ")", ":", "if", "self", ".", "_listen_task", ":", "self", ".", "_listen_task", ".", "cancel", "(", ")", "await", "self", ".", "_client", ".", "close", "(", ")" ]
[ 111, 4 ]
[ 115, 34 ]
python
en
['en', 'sr', 'it']
False
SyncthingClient._listen
(self)
Listen to Syncthing events.
Listen to Syncthing events.
async def _listen(self): """Listen to Syncthing events.""" events = self._client.events server_was_unavailable = False while True: if await self._server_available(): if server_was_unavailable: _LOGGER.info( "The sync...
[ "async", "def", "_listen", "(", "self", ")", ":", "events", "=", "self", ".", "_client", ".", "events", "server_was_unavailable", "=", "False", "while", "True", ":", "if", "await", "self", ".", "_server_available", "(", ")", ":", "if", "server_was_unavailabl...
[ 117, 4 ]
[ 163, 24 ]
python
en
['en', 'en', 'en']
True
test_full_flow
(hass: HomeAssistant)
Check setup.
Check setup.
async def test_full_flow(hass: HomeAssistant) -> None: """Check setup.""" result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": SOURCE_USER} ) assert result.get("type") == RESULT_TYPE_FORM assert result.get("errors") == {} assert result.get("step_id") == SOURCE_...
[ "async", "def", "test_full_flow", "(", "hass", ":", "HomeAssistant", ")", "->", "None", ":", "result", "=", "await", "hass", ".", "config_entries", ".", "flow", ".", "async_init", "(", "DOMAIN", ",", "context", "=", "{", "\"source\"", ":", "SOURCE_USER", "...
[ 21, 0 ]
[ 46, 46 ]
python
en
['en', 'ceb', 'en']
False
test_not_found
(hass: HomeAssistant)
Check setup.
Check setup.
async def test_not_found(hass: HomeAssistant) -> None: """Check setup.""" result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": SOURCE_USER} ) assert result.get("type") == RESULT_TYPE_FORM assert result.get("errors") == {} assert result.get("step_id") == SOURCE_...
[ "async", "def", "test_not_found", "(", "hass", ":", "HomeAssistant", ")", "->", "None", ":", "result", "=", "await", "hass", ".", "config_entries", ".", "flow", ".", "async_init", "(", "DOMAIN", ",", "context", "=", "{", "\"source\"", ":", "SOURCE_USER", "...
[ 49, 0 ]
[ 71, 46 ]
python
en
['en', 'ceb', 'en']
False
patch_hyphen
(srcdir, dstdir, copy_unchanged=True)
Add hyphen-minus glyphs to fonts that need it. This is to enable languages to be hyphenated properly, since Minikin's itemizer currently shows tofus if an automatically hyphenated word is displated in a font that has neither HYPHEN nor HYPHEN-MINUS. The list of font names comes from LANG_TO_SCRIPT in tool...
Add hyphen-minus glyphs to fonts that need it.
def patch_hyphen(srcdir, dstdir, copy_unchanged=True): """Add hyphen-minus glyphs to fonts that need it. This is to enable languages to be hyphenated properly, since Minikin's itemizer currently shows tofus if an automatically hyphenated word is displated in a font that has neither HYPHEN nor HYPHEN-MINUS....
[ "def", "patch_hyphen", "(", "srcdir", ",", "dstdir", ",", "copy_unchanged", "=", "True", ")", ":", "# Names of fonts for which Android requires a hyphen.", "# This list omits Japanese and Korean.", "script_names", "=", "[", "\"Armenian\"", ",", "\"Ethiopic\"", ",", "\"Benga...
[ 38, 0 ]
[ 103, 63 ]
python
en
['en', 'en', 'en']
True
_remove_cjk_emoji
(cjk_font_names, srcdir, dstdir)
Remove default emoji characters from CJK fonts. Twenty-six characters that Unicode Technical Report #51 "Unicode Emoji" defines as defaulting to emoji styles used to be displayed as black and white ("text" style) before this. This patch removes those characters from Noto CJK fonts, so they get displayed as ...
Remove default emoji characters from CJK fonts.
def _remove_cjk_emoji(cjk_font_names, srcdir, dstdir): """ Remove default emoji characters from CJK fonts. Twenty-six characters that Unicode Technical Report #51 "Unicode Emoji" defines as defaulting to emoji styles used to be displayed as black and white ("text" style) before this. This patch removes tho...
[ "def", "_remove_cjk_emoji", "(", "cjk_font_names", ",", "srcdir", ",", "dstdir", ")", ":", "# Since subsetting changes tables in a way that would prevent a compact", "# .ttc file, this simply removes entries from the cmap table. This", "# does not affect other tables in the font. There are...
[ 106, 0 ]
[ 187, 9 ]
python
en
['en', 'error', 'th']
False
patch_cjk_ttc
(ttc_srcfile, ttc_dstfile)
Take the source ttc, break it apart, remove the cjk emoji from each file, then repackage them into a new ttc.
Take the source ttc, break it apart, remove the cjk emoji from each file, then repackage them into a new ttc.
def patch_cjk_ttc(ttc_srcfile, ttc_dstfile): """Take the source ttc, break it apart, remove the cjk emoji from each file, then repackage them into a new ttc.""" tmp_dir = tempfile.mkdtemp() font_names = ttc_utils.ttcfile_extract(ttc_srcfile, tmp_dir) tmp_patched_dir = path.join(tmp_dir, "patched") ...
[ "def", "patch_cjk_ttc", "(", "ttc_srcfile", ",", "ttc_dstfile", ")", ":", "tmp_dir", "=", "tempfile", ".", "mkdtemp", "(", ")", "font_names", "=", "ttc_utils", ".", "ttcfile_extract", "(", "ttc_srcfile", ",", "tmp_dir", ")", "tmp_patched_dir", "=", "path", "."...
[ 190, 0 ]
[ 202, 26 ]
python
en
['en', 'mt', 'en']
True
patch_cjk_ttcs
(srcdir, dstdir)
Call patch_cjk_ttc for each ttc file in srcdir, writing the result to dstdir using the same name.
Call patch_cjk_ttc for each ttc file in srcdir, writing the result to dstdir using the same name.
def patch_cjk_ttcs(srcdir, dstdir): """Call patch_cjk_ttc for each ttc file in srcdir, writing the result to dstdir using the same name.""" if not path.isdir(srcdir): print("%s is not a directory" % srcdir) return ttc_files = [f for f in os.listdir(srcdir) if f.endswith(".ttc")] if n...
[ "def", "patch_cjk_ttcs", "(", "srcdir", ",", "dstdir", ")", ":", "if", "not", "path", ".", "isdir", "(", "srcdir", ")", ":", "print", "(", "\"%s is not a directory\"", "%", "srcdir", ")", "return", "ttc_files", "=", "[", "f", "for", "f", "in", "os", "....
[ 205, 0 ]
[ 220, 65 ]
python
en
['en', 'en', 'en']
True
subset_symbols
(srcdir, dstdir)
Subset Noto Sans Symbols in a curated way. Noto Sans Symbols is now subsetted in a curated way. Changes include: * Currency symbols now included in Roboto are removed. * All combining marks for symbols (except for combining keycap) are added, to combine with other symbols if needed. * Characters in symb...
Subset Noto Sans Symbols in a curated way.
def subset_symbols(srcdir, dstdir): """Subset Noto Sans Symbols in a curated way. Noto Sans Symbols is now subsetted in a curated way. Changes include: * Currency symbols now included in Roboto are removed. * All combining marks for symbols (except for combining keycap) are added, to combine with other...
[ "def", "subset_symbols", "(", "srcdir", ",", "dstdir", ")", ":", "# TODO see if we need to change this subset based on Noto Serif coverage", "# (so the serif fallback chain would support them)", "target_coverage", "=", "set", "(", ")", "# Add all characters in BLOCKS_TO_INCLUDE", "fo...
[ 348, 0 ]
[ 411, 72 ]
python
en
['en', 'en', 'en']
True
patch_post_table
(srcdir, dstdir)
Replace post table version 2.0 with version 3.0
Replace post table version 2.0 with version 3.0
def patch_post_table(srcdir, dstdir): """Replace post table version 2.0 with version 3.0""" # Leave alone OTF for font_file in glob.glob(path.join(srcdir, "*.ttf")): print("change post table to 3.0", font_file) out_file = path.join(dstdir, path.basename(font_file)) if path.isfile(ou...
[ "def", "patch_post_table", "(", "srcdir", ",", "dstdir", ")", ":", "# Leave alone OTF", "for", "font_file", "in", "glob", ".", "glob", "(", "path", ".", "join", "(", "srcdir", ",", "\"*.ttf\"", ")", ")", ":", "print", "(", "\"change post table to 3.0\"", ","...
[ 414, 0 ]
[ 426, 27 ]
python
en
['en', 'en', 'en']
True
patch_fonts
(srcdir, dstdir)
Remove dstdir and repopulate with patched contents of srcdir (and its 'cjk' subdirectory if it exists).
Remove dstdir and repopulate with patched contents of srcdir (and its 'cjk' subdirectory if it exists).
def patch_fonts(srcdir, dstdir): """Remove dstdir and repopulate with patched contents of srcdir (and its 'cjk' subdirectory if it exists).""" srcdir = tool_utils.resolve_path(srcdir) dstdir = tool_utils.resolve_path(dstdir) tool_utils.ensure_dir_exists(dstdir, clean=True) patch_hyphen(srcdir, ...
[ "def", "patch_fonts", "(", "srcdir", ",", "dstdir", ")", ":", "srcdir", "=", "tool_utils", ".", "resolve_path", "(", "srcdir", ")", "dstdir", "=", "tool_utils", ".", "resolve_path", "(", "dstdir", ")", "tool_utils", ".", "ensure_dir_exists", "(", "dstdir", "...
[ 429, 0 ]
[ 441, 36 ]
python
en
['en', 'en', 'en']
True
async_setup_entry
(hass: HomeAssistant, entry: ConfigEntry)
Set up buienradar from a config entry.
Set up buienradar from a config entry.
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: """Set up buienradar from a config entry.""" hass.data.setdefault(DOMAIN, {}) hass.config_entries.async_setup_platforms(entry, PLATFORMS) entry.async_on_unload(entry.add_update_listener(async_update_options)) return True
[ "async", "def", "async_setup_entry", "(", "hass", ":", "HomeAssistant", ",", "entry", ":", "ConfigEntry", ")", "->", "bool", ":", "hass", ".", "data", ".", "setdefault", "(", "DOMAIN", ",", "{", "}", ")", "hass", ".", "config_entries", ".", "async_setup_pl...
[ 11, 0 ]
[ 16, 15 ]
python
en
['en', 'en', 'en']
True
async_unload_entry
(hass: HomeAssistant, entry: ConfigEntry)
Unload a config entry.
Unload a config entry.
async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: """Unload a config entry.""" unload_ok = await hass.config_entries.async_unload_platforms(entry, PLATFORMS) return unload_ok
[ "async", "def", "async_unload_entry", "(", "hass", ":", "HomeAssistant", ",", "entry", ":", "ConfigEntry", ")", "->", "bool", ":", "unload_ok", "=", "await", "hass", ".", "config_entries", ".", "async_unload_platforms", "(", "entry", ",", "PLATFORMS", ")", "re...
[ 19, 0 ]
[ 23, 20 ]
python
en
['en', 'es', 'en']
True
async_update_options
(hass: HomeAssistant, config_entry: ConfigEntry)
Update options.
Update options.
async def async_update_options(hass: HomeAssistant, config_entry: ConfigEntry) -> None: """Update options.""" await hass.config_entries.async_reload(config_entry.entry_id)
[ "async", "def", "async_update_options", "(", "hass", ":", "HomeAssistant", ",", "config_entry", ":", "ConfigEntry", ")", "->", "None", ":", "await", "hass", ".", "config_entries", ".", "async_reload", "(", "config_entry", ".", "entry_id", ")" ]
[ 26, 0 ]
[ 28, 65 ]
python
en
['en', 'en', 'en']
False
Analytics.__init__
(self, hass: HomeAssistant)
Initialize the Analytics class.
Initialize the Analytics class.
def __init__(self, hass: HomeAssistant) -> None: """Initialize the Analytics class.""" self.hass: HomeAssistant = hass self.session = async_get_clientsession(hass) self._data: dict = { ATTR_PREFERENCES: {}, ATTR_ONBOARDED: False, ATTR_UUID: None, ...
[ "def", "__init__", "(", "self", ",", "hass", ":", "HomeAssistant", ")", "->", "None", ":", "self", ".", "hass", ":", "HomeAssistant", "=", "hass", "self", ".", "session", "=", "async_get_clientsession", "(", "hass", ")", "self", ".", "_data", ":", "dict"...
[ 63, 4 ]
[ 72, 85 ]
python
en
['en', 'en', 'en']
True
Analytics.preferences
(self)
Return the current active preferences.
Return the current active preferences.
def preferences(self) -> dict: """Return the current active preferences.""" preferences = self._data[ATTR_PREFERENCES] return { ATTR_BASE: preferences.get(ATTR_BASE, False), ATTR_DIAGNOSTICS: preferences.get(ATTR_DIAGNOSTICS, False), ATTR_USAGE: preferences.ge...
[ "def", "preferences", "(", "self", ")", "->", "dict", ":", "preferences", "=", "self", ".", "_data", "[", "ATTR_PREFERENCES", "]", "return", "{", "ATTR_BASE", ":", "preferences", ".", "get", "(", "ATTR_BASE", ",", "False", ")", ",", "ATTR_DIAGNOSTICS", ":"...
[ 75, 4 ]
[ 83, 9 ]
python
en
['en', 'en', 'en']
True
Analytics.onboarded
(self)
Return bool if the user has made a choice.
Return bool if the user has made a choice.
def onboarded(self) -> bool: """Return bool if the user has made a choice.""" return self._data[ATTR_ONBOARDED]
[ "def", "onboarded", "(", "self", ")", "->", "bool", ":", "return", "self", ".", "_data", "[", "ATTR_ONBOARDED", "]" ]
[ 86, 4 ]
[ 88, 41 ]
python
en
['en', 'en', 'en']
True
Analytics.uuid
(self)
Return the uuid for the analytics integration.
Return the uuid for the analytics integration.
def uuid(self) -> bool: """Return the uuid for the analytics integration.""" return self._data[ATTR_UUID]
[ "def", "uuid", "(", "self", ")", "->", "bool", ":", "return", "self", ".", "_data", "[", "ATTR_UUID", "]" ]
[ 91, 4 ]
[ 93, 36 ]
python
en
['en', 'en', 'en']
True
Analytics.endpoint
(self)
Return the endpoint that will receive the payload.
Return the endpoint that will receive the payload.
def endpoint(self) -> str: """Return the endpoint that will receive the payload.""" if HA_VERSION.endswith("0.dev0"): # dev installations will contact the dev analytics environment return ANALYTICS_ENDPOINT_URL_DEV return ANALYTICS_ENDPOINT_URL
[ "def", "endpoint", "(", "self", ")", "->", "str", ":", "if", "HA_VERSION", ".", "endswith", "(", "\"0.dev0\"", ")", ":", "# dev installations will contact the dev analytics environment", "return", "ANALYTICS_ENDPOINT_URL_DEV", "return", "ANALYTICS_ENDPOINT_URL" ]
[ 96, 4 ]
[ 101, 37 ]
python
en
['en', 'en', 'en']
True
Analytics.supervisor
(self)
Return bool if a supervisor is present.
Return bool if a supervisor is present.
def supervisor(self) -> bool: """Return bool if a supervisor is present.""" return hassio.is_hassio(self.hass)
[ "def", "supervisor", "(", "self", ")", "->", "bool", ":", "return", "hassio", ".", "is_hassio", "(", "self", ".", "hass", ")" ]
[ 104, 4 ]
[ 106, 42 ]
python
en
['en', 'en', 'en']
True
Analytics.load
(self)
Load preferences.
Load preferences.
async def load(self) -> None: """Load preferences.""" stored = cast(dict, await self._store.async_load()) if stored: self._data = stored if self.supervisor: supervisor_info = hassio.get_supervisor_info(self.hass) if not self.onboarded: ...
[ "async", "def", "load", "(", "self", ")", "->", "None", ":", "stored", "=", "cast", "(", "dict", ",", "await", "self", ".", "_store", ".", "async_load", "(", ")", ")", "if", "stored", ":", "self", ".", "_data", "=", "stored", "if", "self", ".", "...
[ 108, 4 ]
[ 125, 74 ]
python
en
['en', 'da', 'en']
False
Analytics.save_preferences
(self, preferences: dict)
Save preferences.
Save preferences.
async def save_preferences(self, preferences: dict) -> None: """Save preferences.""" preferences = PREFERENCE_SCHEMA(preferences) self._data[ATTR_PREFERENCES].update(preferences) self._data[ATTR_ONBOARDED] = True await self._store.async_save(self._data) if self.supervis...
[ "async", "def", "save_preferences", "(", "self", ",", "preferences", ":", "dict", ")", "->", "None", ":", "preferences", "=", "PREFERENCE_SCHEMA", "(", "preferences", ")", "self", ".", "_data", "[", "ATTR_PREFERENCES", "]", ".", "update", "(", "preferences", ...
[ 127, 4 ]
[ 138, 13 ]
python
en
['en', 'ceb', 'en']
False
Analytics.send_analytics
(self, _=None)
Send analytics.
Send analytics.
async def send_analytics(self, _=None) -> None: """Send analytics.""" supervisor_info = None operating_system_info = {} if not self.onboarded or not self.preferences.get(ATTR_BASE, False): LOGGER.debug("Nothing to submit") return if self._data.get(ATTR_U...
[ "async", "def", "send_analytics", "(", "self", ",", "_", "=", "None", ")", "->", "None", ":", "supervisor_info", "=", "None", "operating_system_info", "=", "{", "}", "if", "not", "self", ".", "onboarded", "or", "not", "self", ".", "preferences", ".", "ge...
[ 140, 4 ]
[ 278, 13 ]
python
en
['en', 'ky', 'en']
False
async_get_media_source
(hass: HomeAssistant)
Set up Netatmo media source.
Set up Netatmo media source.
async def async_get_media_source(hass: HomeAssistant) -> NetatmoSource: """Set up Netatmo media source.""" return NetatmoSource(hass)
[ "async", "def", "async_get_media_source", "(", "hass", ":", "HomeAssistant", ")", "->", "NetatmoSource", ":", "return", "NetatmoSource", "(", "hass", ")" ]
[ 32, 0 ]
[ 34, 30 ]
python
en
['en', 'bg', 'en']
True
remove_html_tags
(text: str)
Remove html tags from string.
Remove html tags from string.
def remove_html_tags(text: str) -> str: """Remove html tags from string.""" clean = re.compile("<.*?>") return re.sub(clean, "", text)
[ "def", "remove_html_tags", "(", "text", ":", "str", ")", "->", "str", ":", "clean", "=", "re", ".", "compile", "(", "\"<.*?>\"", ")", "return", "re", ".", "sub", "(", "clean", ",", "\"\"", ",", "text", ")" ]
[ 151, 0 ]
[ 154, 34 ]
python
en
['en', 'en', 'en']
True
async_parse_identifier
( item: MediaSourceItem, )
Parse identifier.
Parse identifier.
def async_parse_identifier( item: MediaSourceItem, ) -> tuple[str, str, int | None]: """Parse identifier.""" if not item.identifier or "/" not in item.identifier: return "events", "", None source, path = item.identifier.lstrip("/").split("/", 1) if source != "events": raise Unresol...
[ "def", "async_parse_identifier", "(", "item", ":", "MediaSourceItem", ",", ")", "->", "tuple", "[", "str", ",", "str", ",", "int", "|", "None", "]", ":", "if", "not", "item", ".", "identifier", "or", "\"/\"", "not", "in", "item", ".", "identifier", ":"...
[ 158, 0 ]
[ 174, 29 ]
python
de
['en', 'de', 'hi']
False
NetatmoSource.__init__
(self, hass: HomeAssistant)
Initialize Netatmo source.
Initialize Netatmo source.
def __init__(self, hass: HomeAssistant) -> None: """Initialize Netatmo source.""" super().__init__(DOMAIN) self.hass = hass self.events = self.hass.data[DOMAIN][DATA_EVENTS]
[ "def", "__init__", "(", "self", ",", "hass", ":", "HomeAssistant", ")", "->", "None", ":", "super", "(", ")", ".", "__init__", "(", "DOMAIN", ")", "self", ".", "hass", "=", "hass", "self", ".", "events", "=", "self", ".", "hass", ".", "data", "[", ...
[ 42, 4 ]
[ 46, 57 ]
python
it
['lt', 'pl', 'it']
False
NetatmoSource.async_resolve_media
(self, item: MediaSourceItem)
Resolve media to a url.
Resolve media to a url.
async def async_resolve_media(self, item: MediaSourceItem) -> PlayMedia: """Resolve media to a url.""" _, camera_id, event_id = async_parse_identifier(item) url = self.events[camera_id][event_id]["media_url"] return PlayMedia(url, MIME_TYPE)
[ "async", "def", "async_resolve_media", "(", "self", ",", "item", ":", "MediaSourceItem", ")", "->", "PlayMedia", ":", "_", ",", "camera_id", ",", "event_id", "=", "async_parse_identifier", "(", "item", ")", "url", "=", "self", ".", "events", "[", "camera_id"...
[ 48, 4 ]
[ 52, 40 ]
python
en
['en', 'en', 'en']
True
NetatmoSource.async_browse_media
( self, item: MediaSourceItem, media_types: tuple[str] = ("video",), )
Return media.
Return media.
async def async_browse_media( self, item: MediaSourceItem, media_types: tuple[str] = ("video",), ) -> BrowseMediaSource: """Return media.""" try: source, camera_id, event_id = async_parse_identifier(item) except Unresolvable as err: raise Brows...
[ "async", "def", "async_browse_media", "(", "self", ",", "item", ":", "MediaSourceItem", ",", "media_types", ":", "tuple", "[", "str", "]", "=", "(", "\"video\"", ",", ")", ",", ")", "->", "BrowseMediaSource", ":", "try", ":", "source", ",", "camera_id", ...
[ 54, 4 ]
[ 65, 62 ]
python
en
['en', 'no', 'en']
False
NetatmoSource._browse_media
( self, source: str, camera_id: str, event_id: int | None )
Browse media.
Browse media.
def _browse_media( self, source: str, camera_id: str, event_id: int | None ) -> BrowseMediaSource: """Browse media.""" if camera_id and camera_id not in self.events: raise BrowseError("Camera does not exist.") if event_id and event_id not in self.events[camera_id]: ...
[ "def", "_browse_media", "(", "self", ",", "source", ":", "str", ",", "camera_id", ":", "str", ",", "event_id", ":", "int", "|", "None", ")", "->", "BrowseMediaSource", ":", "if", "camera_id", "and", "camera_id", "not", "in", "self", ".", "events", ":", ...
[ 67, 4 ]
[ 77, 69 ]
python
en
['en', 'en', 'en']
False
setup
(hass, config)
Set up the Dyson parent component.
Set up the Dyson parent component.
def setup(hass, config): """Set up the Dyson parent component.""" _LOGGER.info("Creating new Dyson component") if DYSON_DEVICES not in hass.data: hass.data[DYSON_DEVICES] = [] dyson_account = DysonAccount( config[DOMAIN].get(CONF_USERNAME), config[DOMAIN].get(CONF_PASSWORD), ...
[ "def", "setup", "(", "hass", ",", "config", ")", ":", "_LOGGER", ".", "info", "(", "\"Creating new Dyson component\"", ")", "if", "DYSON_DEVICES", "not", "in", "hass", ".", "data", ":", "hass", ".", "data", "[", "DYSON_DEVICES", "]", "=", "[", "]", "dyso...
[ 40, 0 ]
[ 110, 15 ]
python
en
['en', 'fr', 'en']
True
DysonEntity.__init__
(self, device, state_type)
Initialize the entity.
Initialize the entity.
def __init__(self, device, state_type): """Initialize the entity.""" self._device = device self._state_type = state_type
[ "def", "__init__", "(", "self", ",", "device", ",", "state_type", ")", ":", "self", ".", "_device", "=", "device", "self", ".", "_state_type", "=", "state_type" ]
[ 116, 4 ]
[ 119, 37 ]
python
en
['en', 'en', 'en']
True
DysonEntity.async_added_to_hass
(self)
Call when entity is added to hass.
Call when entity is added to hass.
async def async_added_to_hass(self): """Call when entity is added to hass.""" self._device.add_message_listener(self.on_message_filter)
[ "async", "def", "async_added_to_hass", "(", "self", ")", ":", "self", ".", "_device", ".", "add_message_listener", "(", "self", ".", "on_message_filter", ")" ]
[ 121, 4 ]
[ 123, 65 ]
python
en
['en', 'en', 'en']
True
DysonEntity.on_message_filter
(self, message)
Filter new messages received.
Filter new messages received.
def on_message_filter(self, message): """Filter new messages received.""" if self._state_type is None or isinstance(message, self._state_type): _LOGGER.debug( "Message received for device %s : %s", self.name, message, ) ...
[ "def", "on_message_filter", "(", "self", ",", "message", ")", ":", "if", "self", ".", "_state_type", "is", "None", "or", "isinstance", "(", "message", ",", "self", ".", "_state_type", ")", ":", "_LOGGER", ".", "debug", "(", "\"Message received for device %s : ...
[ 125, 4 ]
[ 133, 36 ]
python
en
['en', 'en', 'en']
True
DysonEntity.on_message
(self, message)
Handle new messages received.
Handle new messages received.
def on_message(self, message): """Handle new messages received.""" self.schedule_update_ha_state()
[ "def", "on_message", "(", "self", ",", "message", ")", ":", "self", ".", "schedule_update_ha_state", "(", ")" ]
[ 135, 4 ]
[ 137, 39 ]
python
en
['en', 'en', 'en']
True
DysonEntity.should_poll
(self)
No polling needed.
No polling needed.
def should_poll(self): """No polling needed.""" return False
[ "def", "should_poll", "(", "self", ")", ":", "return", "False" ]
[ 140, 4 ]
[ 142, 20 ]
python
en
['en', 'en', 'en']
True
DysonEntity.name
(self)
Return the name of the Dyson sensor.
Return the name of the Dyson sensor.
def name(self): """Return the name of the Dyson sensor.""" return self._device.name
[ "def", "name", "(", "self", ")", ":", "return", "self", ".", "_device", ".", "name" ]
[ 145, 4 ]
[ 147, 32 ]
python
en
['en', 'sq', 'en']
True
DysonEntity.unique_id
(self)
Return the sensor's unique id.
Return the sensor's unique id.
def unique_id(self): """Return the sensor's unique id.""" return self._device.serial
[ "def", "unique_id", "(", "self", ")", ":", "return", "self", ".", "_device", ".", "serial" ]
[ 150, 4 ]
[ 152, 34 ]
python
en
['en', 'ca', 'en']
True
test_select_dpt_2_simple
(hass: HomeAssistant, knx: KNXTestKit)
Test simple KNX select.
Test simple KNX select.
async def test_select_dpt_2_simple(hass: HomeAssistant, knx: KNXTestKit): """Test simple KNX select.""" _options = [ {SelectSchema.CONF_PAYLOAD: 0b00, SelectSchema.CONF_OPTION: "No control"}, {SelectSchema.CONF_PAYLOAD: 0b10, SelectSchema.CONF_OPTION: "Control - Off"}, {SelectSchema.CONF...
[ "async", "def", "test_select_dpt_2_simple", "(", "hass", ":", "HomeAssistant", ",", "knx", ":", "KNXTestKit", ")", ":", "_options", "=", "[", "{", "SelectSchema", ".", "CONF_PAYLOAD", ":", "0b00", ",", "SelectSchema", ".", "CONF_OPTION", ":", "\"No control\"", ...
[ 18, 0 ]
[ 85, 34 ]
python
en
['en', 'en', 'en']
True
test_select_dpt_2_restore
(hass: HomeAssistant, knx: KNXTestKit)
Test KNX select with passive_address and respond_to_read restoring state.
Test KNX select with passive_address and respond_to_read restoring state.
async def test_select_dpt_2_restore(hass: HomeAssistant, knx: KNXTestKit): """Test KNX select with passive_address and respond_to_read restoring state.""" _options = [ {SelectSchema.CONF_PAYLOAD: 0b00, SelectSchema.CONF_OPTION: "No control"}, {SelectSchema.CONF_PAYLOAD: 0b10, SelectSchema.CONF_O...
[ "async", "def", "test_select_dpt_2_restore", "(", "hass", ":", "HomeAssistant", ",", "knx", ":", "KNXTestKit", ")", ":", "_options", "=", "[", "{", "SelectSchema", ".", "CONF_PAYLOAD", ":", "0b00", ",", "SelectSchema", ".", "CONF_OPTION", ":", "\"No control\"", ...
[ 88, 0 ]
[ 125, 34 ]
python
en
['en', 'en', 'en']
True
test_select_dpt_20_103_all_options
(hass: HomeAssistant, knx: KNXTestKit)
Test KNX select with state_address, passive_address and respond_to_read.
Test KNX select with state_address, passive_address and respond_to_read.
async def test_select_dpt_20_103_all_options(hass: HomeAssistant, knx: KNXTestKit): """Test KNX select with state_address, passive_address and respond_to_read.""" _options = [ {SelectSchema.CONF_PAYLOAD: 0, SelectSchema.CONF_OPTION: "Auto"}, {SelectSchema.CONF_PAYLOAD: 1, SelectSchema.CONF_OPTIO...
[ "async", "def", "test_select_dpt_20_103_all_options", "(", "hass", ":", "HomeAssistant", ",", "knx", ":", "KNXTestKit", ")", ":", "_options", "=", "[", "{", "SelectSchema", ".", "CONF_PAYLOAD", ":", "0", ",", "SelectSchema", ".", "CONF_OPTION", ":", "\"Auto\"", ...
[ 128, 0 ]
[ 186, 31 ]
python
en
['en', 'en', 'en']
True
async_setup_entry
(hass, config_entry, async_add_entities)
Set up myq lights.
Set up myq lights.
async def async_setup_entry(hass, config_entry, async_add_entities): """Set up myq lights.""" data = hass.data[DOMAIN][config_entry.entry_id] myq = data[MYQ_GATEWAY] coordinator = data[MYQ_COORDINATOR] async_add_entities( [MyQLight(coordinator, device) for device in myq.lamps.values()], Tru...
[ "async", "def", "async_setup_entry", "(", "hass", ",", "config_entry", ",", "async_add_entities", ")", ":", "data", "=", "hass", ".", "data", "[", "DOMAIN", "]", "[", "config_entry", ".", "entry_id", "]", "myq", "=", "data", "[", "MYQ_GATEWAY", "]", "coord...
[ 15, 0 ]
[ 23, 5 ]
python
en
['en', 'lb', 'en']
True
MyQLight.is_on
(self)
Return true if the light is on, else False.
Return true if the light is on, else False.
def is_on(self): """Return true if the light is on, else False.""" return MYQ_TO_HASS.get(self._device.state) == STATE_ON
[ "def", "is_on", "(", "self", ")", ":", "return", "MYQ_TO_HASS", ".", "get", "(", "self", ".", "_device", ".", "state", ")", "==", "STATE_ON" ]
[ 32, 4 ]
[ 34, 62 ]
python
en
['en', 'no', 'en']
True
MyQLight.is_off
(self)
Return true if the light is off, else False.
Return true if the light is off, else False.
def is_off(self): """Return true if the light is off, else False.""" return MYQ_TO_HASS.get(self._device.state) == STATE_OFF
[ "def", "is_off", "(", "self", ")", ":", "return", "MYQ_TO_HASS", ".", "get", "(", "self", ".", "_device", ".", "state", ")", "==", "STATE_OFF" ]
[ 37, 4 ]
[ 39, 63 ]
python
en
['en', 'da', 'en']
True
MyQLight.async_turn_on
(self, **kwargs)
Issue on command to light.
Issue on command to light.
async def async_turn_on(self, **kwargs): """Issue on command to light.""" if self.is_on: return try: await self._device.turnon(wait_for_state=True) except MyQError as err: raise HomeAssistantError( f"Turning light {self._device.name} o...
[ "async", "def", "async_turn_on", "(", "self", ",", "*", "*", "kwargs", ")", ":", "if", "self", ".", "is_on", ":", "return", "try", ":", "await", "self", ".", "_device", ".", "turnon", "(", "wait_for_state", "=", "True", ")", "except", "MyQError", "as",...
[ 41, 4 ]
[ 54, 35 ]
python
en
['en', 'en', 'en']
True
MyQLight.async_turn_off
(self, **kwargs)
Issue off command to light.
Issue off command to light.
async def async_turn_off(self, **kwargs): """Issue off command to light.""" if self.is_off: return try: await self._device.turnoff(wait_for_state=True) except MyQError as err: raise HomeAssistantError( f"Turning light {self._device.nam...
[ "async", "def", "async_turn_off", "(", "self", ",", "*", "*", "kwargs", ")", ":", "if", "self", ".", "is_off", ":", "return", "try", ":", "await", "self", ".", "_device", ".", "turnoff", "(", "wait_for_state", "=", "True", ")", "except", "MyQError", "a...
[ 56, 4 ]
[ 69, 35 ]
python
en
['en', 'en', 'en']
True
test_user_form
(hass)
Test we get the user form.
Test we get the user form.
async def test_user_form(hass): """Test we get the user form.""" await setup.async_setup_component(hass, "persistent_notification", {}) result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": config_entries.SOURCE_USER} ) assert result["type"] == "form" assert resu...
[ "async", "def", "test_user_form", "(", "hass", ")", ":", "await", "setup", ".", "async_setup_component", "(", "hass", ",", "\"persistent_notification\"", ",", "{", "}", ")", "result", "=", "await", "hass", ".", "config_entries", ".", "flow", ".", "async_init",...
[ 19, 0 ]
[ 45, 48 ]
python
en
['en', 'da', 'en']
True
test_form_ssdp
(hass)
Test we get the form with ssdp source.
Test we get the form with ssdp source.
async def test_form_ssdp(hass): """Test we get the form with ssdp source.""" await setup.async_setup_component(hass, "persistent_notification", {}) harmonyapi = _get_mock_harmonyapi(connect=True) with patch( "homeassistant.components.harmony.util.HarmonyAPI", return_value=harmonyapi, ...
[ "async", "def", "test_form_ssdp", "(", "hass", ")", ":", "await", "setup", ".", "async_setup_component", "(", "hass", ",", "\"persistent_notification\"", ",", "{", "}", ")", "harmonyapi", "=", "_get_mock_harmonyapi", "(", "connect", "=", "True", ")", "with", "...
[ 48, 0 ]
[ 94, 48 ]
python
en
['en', 'en', 'en']
True
test_form_ssdp_aborts_before_checking_remoteid_if_host_known
(hass)
Test we abort without connecting if the host is already known.
Test we abort without connecting if the host is already known.
async def test_form_ssdp_aborts_before_checking_remoteid_if_host_known(hass): """Test we abort without connecting if the host is already known.""" await setup.async_setup_component(hass, "persistent_notification", {}) config_entry = MockConfigEntry( domain=DOMAIN, data={"host": "2.2.2.2", "n...
[ "async", "def", "test_form_ssdp_aborts_before_checking_remoteid_if_host_known", "(", "hass", ")", ":", "await", "setup", ".", "async_setup_component", "(", "hass", ",", "\"persistent_notification\"", ",", "{", "}", ")", "config_entry", "=", "MockConfigEntry", "(", "doma...
[ 97, 0 ]
[ 126, 36 ]
python
en
['en', 'en', 'en']
True
test_form_cannot_connect
(hass)
Test we handle cannot connect error.
Test we handle cannot connect error.
async def test_form_cannot_connect(hass): """Test we handle cannot connect error.""" result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": config_entries.SOURCE_USER} ) with patch( "homeassistant.components.harmony.util.HarmonyAPI", side_effect=CannotCon...
[ "async", "def", "test_form_cannot_connect", "(", "hass", ")", ":", "result", "=", "await", "hass", ".", "config_entries", ".", "flow", ".", "async_init", "(", "DOMAIN", ",", "context", "=", "{", "\"source\"", ":", "config_entries", ".", "SOURCE_USER", "}", "...
[ 129, 0 ]
[ 150, 58 ]
python
en
['en', 'en', 'en']
True
test_options_flow
(hass, mock_hc, mock_write_config)
Test config flow options.
Test config flow options.
async def test_options_flow(hass, mock_hc, mock_write_config): """Test config flow options.""" config_entry = MockConfigEntry( domain=DOMAIN, unique_id="abcde12345", data={CONF_HOST: "1.2.3.4", CONF_NAME: "Guest Room"}, options={"activity": "Watch TV", "delay_secs": 0.5}, ) ...
[ "async", "def", "test_options_flow", "(", "hass", ",", "mock_hc", ",", "mock_write_config", ")", ":", "config_entry", "=", "MockConfigEntry", "(", "domain", "=", "DOMAIN", ",", "unique_id", "=", "\"abcde12345\"", ",", "data", "=", "{", "CONF_HOST", ":", "\"1.2...
[ 153, 0 ]
[ 182, 5 ]
python
en
['en', 'fr', 'en']
True
parse
(file, namespaces=True, forbid_dtd=False, forbid_entities=True, forbid_external=True)
Parse a document, returning the resulting Document node. 'file' may be either a file name or an open file object.
Parse a document, returning the resulting Document node.
def parse(file, namespaces=True, forbid_dtd=False, forbid_entities=True, forbid_external=True): """Parse a document, returning the resulting Document node. 'file' may be either a file name or an open file object. """ if namespaces: build_builder = DefusedExpatBuilderNS else: ...
[ "def", "parse", "(", "file", ",", "namespaces", "=", "True", ",", "forbid_dtd", "=", "False", ",", "forbid_entities", "=", "True", ",", "forbid_external", "=", "True", ")", ":", "if", "namespaces", ":", "build_builder", "=", "DefusedExpatBuilderNS", "else", ...
[ 72, 0 ]
[ 94, 17 ]
python
en
['en', 'en', 'en']
True
parseString
(string, namespaces=True, forbid_dtd=False, forbid_entities=True, forbid_external=True)
Parse a document from a string, returning the resulting Document node.
Parse a document from a string, returning the resulting Document node.
def parseString(string, namespaces=True, forbid_dtd=False, forbid_entities=True, forbid_external=True): """Parse a document from a string, returning the resulting Document node. """ if namespaces: build_builder = DefusedExpatBuilderNS else: build_builder = DefusedExpa...
[ "def", "parseString", "(", "string", ",", "namespaces", "=", "True", ",", "forbid_dtd", "=", "False", ",", "forbid_entities", "=", "True", ",", "forbid_external", "=", "True", ")", ":", "if", "namespaces", ":", "build_builder", "=", "DefusedExpatBuilderNS", "e...
[ 97, 0 ]
[ 109, 38 ]
python
en
['en', 'en', 'en']
True
get_all_home_ids
(home_data: pyatmo.HomeData | None)
Get all the home ids returned by NetAtmo API.
Get all the home ids returned by NetAtmo API.
def get_all_home_ids(home_data: pyatmo.HomeData | None) -> list[str]: """Get all the home ids returned by NetAtmo API.""" if home_data is None: return [] return [ home_data.homes[home_id]["id"] for home_id in home_data.homes if "modules" in home_data.homes[home_id] ]
[ "def", "get_all_home_ids", "(", "home_data", ":", "pyatmo", ".", "HomeData", "|", "None", ")", "->", "list", "[", "str", "]", ":", "if", "home_data", "is", "None", ":", "return", "[", "]", "return", "[", "home_data", ".", "homes", "[", "home_id", "]", ...
[ 23, 0 ]
[ 31, 5 ]
python
en
['en', 'haw', 'en']
True
update_climate_schedules
(home_ids: list[str], schedules: dict)
Get updated list of all climate schedules.
Get updated list of all climate schedules.
def update_climate_schedules(home_ids: list[str], schedules: dict) -> dict: """Get updated list of all climate schedules.""" return { home_id: { schedule_id: schedule_data.get("name") for schedule_id, schedule_data in schedules[home_id].items() } for home_id in ho...
[ "def", "update_climate_schedules", "(", "home_ids", ":", "list", "[", "str", "]", ",", "schedules", ":", "dict", ")", "->", "dict", ":", "return", "{", "home_id", ":", "{", "schedule_id", ":", "schedule_data", ".", "get", "(", "\"name\"", ")", "for", "sc...
[ 34, 0 ]
[ 42, 5 ]
python
en
['en', 'en', 'en']
True
test_form
(hass)
Test we get the form.
Test we get the form.
async def test_form(hass): """Test we get the form.""" await setup.async_setup_component(hass, "persistent_notification", {}) result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": config_entries.SOURCE_USER} ) assert result["type"] == "form" assert result["errors...
[ "async", "def", "test_form", "(", "hass", ")", ":", "await", "setup", ".", "async_setup_component", "(", "hass", ",", "\"persistent_notification\"", ",", "{", "}", ")", "result", "=", "await", "hass", ".", "config_entries", ".", "flow", ".", "async_init", "(...
[ 18, 0 ]
[ 43, 48 ]
python
en
['en', 'en', 'en']
True
test_form_cannot_connect
(hass)
Test if invalid response or no connection returned from the API.
Test if invalid response or no connection returned from the API.
async def test_form_cannot_connect(hass): """Test if invalid response or no connection returned from the API.""" await setup.async_setup_component(hass, "persistent_notification", {}) result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": config_entries.SOURCE_USER} ) ...
[ "async", "def", "test_form_cannot_connect", "(", "hass", ")", ":", "await", "setup", ".", "async_setup_component", "(", "hass", ",", "\"persistent_notification\"", ",", "{", "}", ")", "result", "=", "await", "hass", ".", "config_entries", ".", "flow", ".", "as...
[ 46, 0 ]
[ 65, 57 ]
python
en
['en', 'en', 'en']
True
test_with_unknown_error
(hass)
Test with unknown error response from the API.
Test with unknown error response from the API.
async def test_with_unknown_error(hass): """Test with unknown error response from the API.""" await setup.async_setup_component(hass, "persistent_notification", {}) result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": config_entries.SOURCE_USER} ) with patch( ...
[ "async", "def", "test_with_unknown_error", "(", "hass", ")", ":", "await", "setup", ".", "async_setup_component", "(", "hass", ",", "\"persistent_notification\"", ",", "{", "}", ")", "result", "=", "await", "hass", ".", "config_entries", ".", "flow", ".", "asy...
[ 68, 0 ]
[ 86, 50 ]
python
en
['en', 'en', 'en']
True
test_option_flow
(hass)
Test option flow.
Test option flow.
async def test_option_flow(hass): """Test option flow.""" entry = MockConfigEntry(domain=DOMAIN, data=DATA) entry.add_to_hass(hass) assert not entry.options with patch("homeassistant.components.aurora.async_setup_entry", return_value=True): await hass.config_entries.async_setup(entry.entry...
[ "async", "def", "test_option_flow", "(", "hass", ")", ":", "entry", "=", "MockConfigEntry", "(", "domain", "=", "DOMAIN", ",", "data", "=", "DATA", ")", "entry", ".", "add_to_hass", "(", "hass", ")", "assert", "not", "entry", ".", "options", "with", "pat...
[ 89, 0 ]
[ 114, 53 ]
python
da
['nl', 'da', 'en']
False
test_user_owserver
(hass)
Test OWServer user flow.
Test OWServer user flow.
async def test_user_owserver(hass): """Test OWServer user flow.""" result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": SOURCE_USER} ) assert result["type"] == RESULT_TYPE_FORM assert not result["errors"] result = await hass.config_entries.flow.async_configure(...
[ "async", "def", "test_user_owserver", "(", "hass", ")", ":", "result", "=", "await", "hass", ".", "config_entries", ".", "flow", ".", "async_init", "(", "DOMAIN", ",", "context", "=", "{", "\"source\"", ":", "SOURCE_USER", "}", ")", "assert", "result", "["...
[ 23, 0 ]
[ 72, 48 ]
python
da
['da', 'da', 'en']
True
test_user_owserver_duplicate
(hass)
Test OWServer flow.
Test OWServer flow.
async def test_user_owserver_duplicate(hass): """Test OWServer flow.""" with patch( "homeassistant.components.onewire.async_setup_entry", return_value=True, ) as mock_setup_entry: await setup_onewire_owserver_integration(hass) assert len(hass.config_entries.async_entries(DOMA...
[ "async", "def", "test_user_owserver_duplicate", "(", "hass", ")", ":", "with", "patch", "(", "\"homeassistant.components.onewire.async_setup_entry\"", ",", "return_value", "=", "True", ",", ")", "as", "mock_setup_entry", ":", "await", "setup_onewire_owserver_integration", ...
[ 75, 0 ]
[ 107, 48 ]
python
en
['en', 'da', 'en']
True
test_user_sysbus
(hass)
Test SysBus flow.
Test SysBus flow.
async def test_user_sysbus(hass): """Test SysBus flow.""" result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": SOURCE_USER} ) assert result["type"] == RESULT_TYPE_FORM assert not result["errors"] result = await hass.config_entries.flow.async_configure( ...
[ "async", "def", "test_user_sysbus", "(", "hass", ")", ":", "result", "=", "await", "hass", ".", "config_entries", ".", "flow", ".", "async_init", "(", "DOMAIN", ",", "context", "=", "{", "\"source\"", ":", "SOURCE_USER", "}", ")", "assert", "result", "[", ...
[ 110, 0 ]
[ 161, 48 ]
python
en
['en', 'el-Latn', 'en']
True
test_user_sysbus_duplicate
(hass)
Test SysBus duplicate flow.
Test SysBus duplicate flow.
async def test_user_sysbus_duplicate(hass): """Test SysBus duplicate flow.""" with patch( "homeassistant.components.onewire.async_setup_entry", return_value=True, ) as mock_setup_entry: await setup_onewire_sysbus_integration(hass) assert len(hass.config_entries.async_entries(...
[ "async", "def", "test_user_sysbus_duplicate", "(", "hass", ")", ":", "with", "patch", "(", "\"homeassistant.components.onewire.async_setup_entry\"", ",", "return_value", "=", "True", ",", ")", "as", "mock_setup_entry", ":", "await", "setup_onewire_sysbus_integration", "("...
[ 164, 0 ]
[ 201, 48 ]
python
en
['fr', 'jv', 'en']
False
handle_kill
(irc, numeric, command, args)
Tracks kills against PyLink clients. If too many are received, automatically disconnects from the network.
Tracks kills against PyLink clients. If too many are received, automatically disconnects from the network.
def handle_kill(irc, numeric, command, args): """ Tracks kills against PyLink clients. If too many are received, automatically disconnects from the network. """ if (args['userdata'] and irc.is_internal_server(args['userdata'].server)) or irc.is_internal_client(args['target']): with lock: ...
[ "def", "handle_kill", "(", "irc", ",", "numeric", ",", "command", ",", "args", ")", ":", "if", "(", "args", "[", "'userdata'", "]", "and", "irc", ".", "is_internal_server", "(", "args", "[", "'userdata'", "]", ".", "server", ")", ")", "or", "irc", "....
[ 25, 0 ]
[ 38, 36 ]
python
en
['en', 'error', 'th']
False
handle_save
(irc, numeric, command, args)
Tracks SAVEs (nick collision) against PyLink clients. If too many are received, automatically disconnects from the network.
Tracks SAVEs (nick collision) against PyLink clients. If too many are received, automatically disconnects from the network.
def handle_save(irc, numeric, command, args): """ Tracks SAVEs (nick collision) against PyLink clients. If too many are received, automatically disconnects from the network. """ if irc.is_internal_client(args['target']): with lock: if savecache.setdefault(irc.name, 0) >= length: ...
[ "def", "handle_save", "(", "irc", ",", "numeric", ",", "command", ",", "args", ")", ":", "if", "irc", ".", "is_internal_client", "(", "args", "[", "'target'", "]", ")", ":", "with", "lock", ":", "if", "savecache", ".", "setdefault", "(", "irc", ".", ...
[ 42, 0 ]
[ 54, 36 ]
python
en
['en', 'error', 'th']
False
merge_chars_from_bank
(orig_font, bank_font, target_font, chars)
Merge glyphs from a bank font to another font. Only the glyphs themselves, the horizontal metrics, and the cmaps will be copied.
Merge glyphs from a bank font to another font. Only the glyphs themselves, the horizontal metrics, and the cmaps will be copied.
def merge_chars_from_bank(orig_font, bank_font, target_font, chars): """Merge glyphs from a bank font to another font. Only the glyphs themselves, the horizontal metrics, and the cmaps will be copied. """ bank_font = ttLib.TTFont(bank_font) orig_font = ttLib.TTFont(orig_font) bank_cmap...
[ "def", "merge_chars_from_bank", "(", "orig_font", ",", "bank_font", ",", "target_font", ",", "chars", ")", ":", "bank_font", "=", "ttLib", ".", "TTFont", "(", "bank_font", ")", "orig_font", "=", "ttLib", ".", "TTFont", "(", "orig_font", ")", "bank_cmap", "="...
[ 30, 0 ]
[ 49, 31 ]
python
en
['en', 'en', 'en']
True
main
(argv)
Fix all the fonts given in the command line. If they are Lao fonts, make sure they have ZWSP and dotted circle. If they are Khmer fonts, make sure they have ZWSP, joiners, and dotted circle.
Fix all the fonts given in the command line. If they are Lao fonts, make sure they have ZWSP and dotted circle. If they are Khmer fonts, make sure they have ZWSP, joiners, and dotted circle.
def main(argv): """Fix all the fonts given in the command line. If they are Lao fonts, make sure they have ZWSP and dotted circle. If they are Khmer fonts, make sure they have ZWSP, joiners, and dotted circle.""" for font_name in argv[1:]: if "Khmer" in font_name: script = "Khm...
[ "def", "main", "(", "argv", ")", ":", "for", "font_name", "in", "argv", "[", "1", ":", "]", ":", "if", "\"Khmer\"", "in", "font_name", ":", "script", "=", "\"Khmr\"", "elif", "\"Lao\"", "in", "font_name", ":", "script", "=", "\"Laoo\"", "needed_chars", ...
[ 59, 0 ]
[ 85, 13 ]
python
en
['en', 'en', 'en']
True
_generate_mock_feed_entry
( external_id, title, distance_to_home, coordinates, category=None, location=None, attribution=None, publication_date=None, council_area=None, status=None, entry_type=None, fire=True, size=None, responsible_agency=None, )
Construct a mock feed entry for testing purposes.
Construct a mock feed entry for testing purposes.
def _generate_mock_feed_entry( external_id, title, distance_to_home, coordinates, category=None, location=None, attribution=None, publication_date=None, council_area=None, status=None, entry_type=None, fire=True, size=None, responsible_agency=None, ): """Const...
[ "def", "_generate_mock_feed_entry", "(", "external_id", ",", "title", ",", "distance_to_home", ",", "coordinates", ",", "category", "=", "None", ",", "location", "=", "None", ",", "attribution", "=", "None", ",", "publication_date", "=", "None", ",", "council_ar...
[ 56, 0 ]
[ 88, 21 ]
python
en
['en', 'en', 'en']
True
test_setup
(hass)
Test the general setup of the platform.
Test the general setup of the platform.
async def test_setup(hass): """Test the general setup of the platform.""" # Set up some mock feed entries for this test. mock_entry_1 = _generate_mock_feed_entry( "1234", "Title 1", 15.5, (-31.0, 150.0), category="Category 1", location="Location 1", at...
[ "async", "def", "test_setup", "(", "hass", ")", ":", "# Set up some mock feed entries for this test.", "mock_entry_1", "=", "_generate_mock_feed_entry", "(", "\"1234\"", ",", "\"Title 1\"", ",", "15.5", ",", "(", "-", "31.0", ",", "150.0", ")", ",", "category", "=...
[ 91, 0 ]
[ 225, 46 ]
python
en
['en', 'da', 'en']
True
test_setup_with_custom_location
(hass)
Test the setup with a custom location.
Test the setup with a custom location.
async def test_setup_with_custom_location(hass): """Test the setup with a custom location.""" # Set up some mock feed entries for this test. mock_entry_1 = _generate_mock_feed_entry("1234", "Title 1", 20.5, (-31.1, 150.1)) with patch( "aio_geojson_nsw_rfs_incidents.feed_manager.NswRuralFireServ...
[ "async", "def", "test_setup_with_custom_location", "(", "hass", ")", ":", "# Set up some mock feed entries for this test.", "mock_entry_1", "=", "_generate_mock_feed_entry", "(", "\"1234\"", ",", "\"Title 1\"", ",", "20.5", ",", "(", "-", "31.1", ",", "150.1", ")", ")...
[ 228, 0 ]
[ 257, 13 ]
python
en
['en', 'en', 'en']
True
async_setup_entry
(hass, config_entry, async_add_entities)
Set up Abode cover devices.
Set up Abode cover devices.
async def async_setup_entry(hass, config_entry, async_add_entities): """Set up Abode cover devices.""" data = hass.data[DOMAIN] entities = [] for device in data.abode.get_devices(generic_type=CONST.TYPE_COVER): entities.append(AbodeCover(data, device)) async_add_entities(entities)
[ "async", "def", "async_setup_entry", "(", "hass", ",", "config_entry", ",", "async_add_entities", ")", ":", "data", "=", "hass", ".", "data", "[", "DOMAIN", "]", "entities", "=", "[", "]", "for", "device", "in", "data", ".", "abode", ".", "get_devices", ...
[ 9, 0 ]
[ 18, 32 ]
python
en
['fr', 'en', 'en']
True
AbodeCover.is_closed
(self)
Return true if cover is closed, else False.
Return true if cover is closed, else False.
def is_closed(self): """Return true if cover is closed, else False.""" return not self._device.is_open
[ "def", "is_closed", "(", "self", ")", ":", "return", "not", "self", ".", "_device", ".", "is_open" ]
[ 25, 4 ]
[ 27, 39 ]
python
en
['en', 'en', 'en']
True
AbodeCover.close_cover
(self, **kwargs)
Issue close command to cover.
Issue close command to cover.
def close_cover(self, **kwargs): """Issue close command to cover.""" self._device.close_cover()
[ "def", "close_cover", "(", "self", ",", "*", "*", "kwargs", ")", ":", "self", ".", "_device", ".", "close_cover", "(", ")" ]
[ 29, 4 ]
[ 31, 34 ]
python
en
['en', 'en', 'en']
True
AbodeCover.open_cover
(self, **kwargs)
Issue open command to cover.
Issue open command to cover.
def open_cover(self, **kwargs): """Issue open command to cover.""" self._device.open_cover()
[ "def", "open_cover", "(", "self", ",", "*", "*", "kwargs", ")", ":", "self", ".", "_device", ".", "open_cover", "(", ")" ]
[ 33, 4 ]
[ 35, 33 ]
python
en
['en', 'en', 'en']
True
mock_now
()
Fixture for dtutil.now.
Fixture for dtutil.now.
def mock_now(): """Fixture for dtutil.now.""" return dt_util.utcnow()
[ "def", "mock_now", "(", ")", ":", "return", "dt_util", ".", "utcnow", "(", ")" ]
[ 72, 0 ]
[ 74, 27 ]
python
da
['da', 'da', 'en']
True
async_setup_gree
(hass)
Set up the gree platform.
Set up the gree platform.
async def async_setup_gree(hass): """Set up the gree platform.""" MockConfigEntry(domain=GREE_DOMAIN).add_to_hass(hass) await async_setup_component(hass, GREE_DOMAIN, {GREE_DOMAIN: {"climate": {}}}) await hass.async_block_till_done()
[ "async", "def", "async_setup_gree", "(", "hass", ")", ":", "MockConfigEntry", "(", "domain", "=", "GREE_DOMAIN", ")", ".", "add_to_hass", "(", "hass", ")", "await", "async_setup_component", "(", "hass", ",", "GREE_DOMAIN", ",", "{", "GREE_DOMAIN", ":", "{", ...
[ 77, 0 ]
[ 81, 38 ]
python
en
['en', 'da', 'en']
True
test_discovery_called_once
(hass, discovery, device)
Test discovery is only ever called once.
Test discovery is only ever called once.
async def test_discovery_called_once(hass, discovery, device): """Test discovery is only ever called once.""" await async_setup_gree(hass) assert discovery.call_count == 1 await async_setup_gree(hass) assert discovery.call_count == 1
[ "async", "def", "test_discovery_called_once", "(", "hass", ",", "discovery", ",", "device", ")", ":", "await", "async_setup_gree", "(", "hass", ")", "assert", "discovery", ".", "call_count", "==", "1", "await", "async_setup_gree", "(", "hass", ")", "assert", "...
[ 84, 0 ]
[ 90, 36 ]
python
en
['en', 'en', 'en']
True
test_discovery_setup
(hass, discovery, device)
Test setup of platform.
Test setup of platform.
async def test_discovery_setup(hass, discovery, device): """Test setup of platform.""" MockDevice1 = build_device_mock( name="fake-device-1", ipAddress="1.1.1.1", mac="aabbcc112233" ) MockDevice2 = build_device_mock( name="fake-device-2", ipAddress="2.2.2.2", mac="bbccdd223344" ) ...
[ "async", "def", "test_discovery_setup", "(", "hass", ",", "discovery", ",", "device", ")", ":", "MockDevice1", "=", "build_device_mock", "(", "name", "=", "\"fake-device-1\"", ",", "ipAddress", "=", "\"1.1.1.1\"", ",", "mac", "=", "\"aabbcc112233\"", ")", "MockD...
[ 93, 0 ]
[ 108, 50 ]
python
en
['en', 'da', 'en']
True
test_discovery_setup_connection_error
(hass, discovery, device, mock_now)
Test gree integration is setup.
Test gree integration is setup.
async def test_discovery_setup_connection_error(hass, discovery, device, mock_now): """Test gree integration is setup.""" MockDevice1 = build_device_mock( name="fake-device-1", ipAddress="1.1.1.1", mac="aabbcc112233" ) MockDevice1.bind = AsyncMock(side_effect=DeviceNotBoundError) MockDevice1...
[ "async", "def", "test_discovery_setup_connection_error", "(", "hass", ",", "discovery", ",", "device", ",", "mock_now", ")", ":", "MockDevice1", "=", "build_device_mock", "(", "name", "=", "\"fake-device-1\"", ",", "ipAddress", "=", "\"1.1.1.1\"", ",", "mac", "=",...
[ 111, 0 ]
[ 128, 43 ]
python
en
['en', 'da', 'en']
True
test_discovery_after_setup
(hass, discovery, device, mock_now)
Test gree devices don't change after multiple discoveries.
Test gree devices don't change after multiple discoveries.
async def test_discovery_after_setup(hass, discovery, device, mock_now): """Test gree devices don't change after multiple discoveries.""" MockDevice1 = build_device_mock( name="fake-device-1", ipAddress="1.1.1.1", mac="aabbcc112233" ) MockDevice1.bind = AsyncMock(side_effect=DeviceNotBoundError)...
[ "async", "def", "test_discovery_after_setup", "(", "hass", ",", "discovery", ",", "device", ",", "mock_now", ")", ":", "MockDevice1", "=", "build_device_mock", "(", "name", "=", "\"fake-device-1\"", ",", "ipAddress", "=", "\"1.1.1.1\"", ",", "mac", "=", "\"aabbc...
[ 131, 0 ]
[ 162, 50 ]
python
en
['da', 'en', 'en']
True
test_discovery_add_device_after_setup
(hass, discovery, device, mock_now)
Test gree devices can be added after initial setup.
Test gree devices can be added after initial setup.
async def test_discovery_add_device_after_setup(hass, discovery, device, mock_now): """Test gree devices can be added after initial setup.""" MockDevice1 = build_device_mock( name="fake-device-1", ipAddress="1.1.1.1", mac="aabbcc112233" ) MockDevice1.bind = AsyncMock(side_effect=DeviceNotBoundEr...
[ "async", "def", "test_discovery_add_device_after_setup", "(", "hass", ",", "discovery", ",", "device", ",", "mock_now", ")", ":", "MockDevice1", "=", "build_device_mock", "(", "name", "=", "\"fake-device-1\"", ",", "ipAddress", "=", "\"1.1.1.1\"", ",", "mac", "=",...
[ 165, 0 ]
[ 196, 50 ]
python
en
['en', 'en', 'en']
True
test_discovery_device_bind_after_setup
(hass, discovery, device, mock_now)
Test gree devices can be added after a late device bind.
Test gree devices can be added after a late device bind.
async def test_discovery_device_bind_after_setup(hass, discovery, device, mock_now): """Test gree devices can be added after a late device bind.""" MockDevice1 = build_device_mock( name="fake-device-1", ipAddress="1.1.1.1", mac="aabbcc112233" ) MockDevice1.bind = AsyncMock(side_effect=DeviceNotB...
[ "async", "def", "test_discovery_device_bind_after_setup", "(", "hass", ",", "discovery", ",", "device", ",", "mock_now", ")", ":", "MockDevice1", "=", "build_device_mock", "(", "name", "=", "\"fake-device-1\"", ",", "ipAddress", "=", "\"1.1.1.1\"", ",", "mac", "="...
[ 199, 0 ]
[ 228, 43 ]
python
en
['en', 'en', 'en']
True
test_update_connection_failure
(hass, device, mock_now)
Testing update hvac connection failure exception.
Testing update hvac connection failure exception.
async def test_update_connection_failure(hass, device, mock_now): """Testing update hvac connection failure exception.""" device().update_state.side_effect = [ DEFAULT_MOCK, DeviceTimeoutError, DeviceTimeoutError, ] await async_setup_gree(hass) next_update = mock_now + time...
[ "async", "def", "test_update_connection_failure", "(", "hass", ",", "device", ",", "mock_now", ")", ":", "device", "(", ")", ".", "update_state", ".", "side_effect", "=", "[", "DEFAULT_MOCK", ",", "DeviceTimeoutError", ",", "DeviceTimeoutError", ",", "]", "await...
[ 231, 0 ]
[ 264, 43 ]
python
en
['en', 'en', 'en']
True
test_update_connection_failure_recovery
(hass, discovery, device, mock_now)
Testing update hvac connection failure recovery.
Testing update hvac connection failure recovery.
async def test_update_connection_failure_recovery(hass, discovery, device, mock_now): """Testing update hvac connection failure recovery.""" device().update_state.side_effect = [ DeviceTimeoutError, DeviceTimeoutError, DEFAULT_MOCK, ] await async_setup_gree(hass) # First up...
[ "async", "def", "test_update_connection_failure_recovery", "(", "hass", ",", "discovery", ",", "device", ",", "mock_now", ")", ":", "device", "(", ")", ".", "update_state", ".", "side_effect", "=", "[", "DeviceTimeoutError", ",", "DeviceTimeoutError", ",", "DEFAUL...
[ 267, 0 ]
[ 295, 43 ]
python
en
['en', 'en', 'en']
True
test_update_unhandled_exception
(hass, discovery, device, mock_now)
Testing update hvac connection unhandled response exception.
Testing update hvac connection unhandled response exception.
async def test_update_unhandled_exception(hass, discovery, device, mock_now): """Testing update hvac connection unhandled response exception.""" device().update_state.side_effect = [DEFAULT_MOCK, Exception] await async_setup_gree(hass) state = hass.states.get(ENTITY_ID) assert state.name == "fake-...
[ "async", "def", "test_update_unhandled_exception", "(", "hass", ",", "discovery", ",", "device", ",", "mock_now", ")", ":", "device", "(", ")", ".", "update_state", ".", "side_effect", "=", "[", "DEFAULT_MOCK", ",", "Exception", "]", "await", "async_setup_gree",...
[ 298, 0 ]
[ 315, 43 ]
python
en
['en', 'en', 'en']
True
test_send_command_device_timeout
(hass, discovery, device, mock_now)
Test for sending power on command to the device with a device timeout.
Test for sending power on command to the device with a device timeout.
async def test_send_command_device_timeout(hass, discovery, device, mock_now): """Test for sending power on command to the device with a device timeout.""" await async_setup_gree(hass) # First update to make the device available next_update = mock_now + timedelta(minutes=5) with patch("homeassistan...
[ "async", "def", "test_send_command_device_timeout", "(", "hass", ",", "discovery", ",", "device", ",", "mock_now", ")", ":", "await", "async_setup_gree", "(", "hass", ")", "# First update to make the device available", "next_update", "=", "mock_now", "+", "timedelta", ...
[ 318, 0 ]
[ 344, 43 ]
python
en
['en', 'en', 'en']
True
test_send_power_on
(hass, discovery, device, mock_now)
Test for sending power on command to the device.
Test for sending power on command to the device.
async def test_send_power_on(hass, discovery, device, mock_now): """Test for sending power on command to the device.""" await async_setup_gree(hass) assert await hass.services.async_call( DOMAIN, SERVICE_TURN_OFF, {ATTR_ENTITY_ID: ENTITY_ID}, blocking=True, ) state ...
[ "async", "def", "test_send_power_on", "(", "hass", ",", "discovery", ",", "device", ",", "mock_now", ")", ":", "await", "async_setup_gree", "(", "hass", ")", "assert", "await", "hass", ".", "services", ".", "async_call", "(", "DOMAIN", ",", "SERVICE_TURN_OFF",...
[ 347, 0 ]
[ 360, 39 ]
python
en
['en', 'en', 'en']
True