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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
fetch_image_url | (item, key="images") | Fetch image url. | Fetch image url. | def fetch_image_url(item, key="images"):
"""Fetch image url."""
try:
return item.get(key, [])[0].get("url")
except IndexError:
return None | [
"def",
"fetch_image_url",
"(",
"item",
",",
"key",
"=",
"\"images\"",
")",
":",
"try",
":",
"return",
"item",
".",
"get",
"(",
"key",
",",
"[",
"]",
")",
"[",
"0",
"]",
".",
"get",
"(",
"\"url\"",
")",
"except",
"IndexError",
":",
"return",
"None"
... | [
710,
0
] | [
715,
19
] | python | en | ['en', 'cy', 'en'] | True |
SpotifyMediaPlayer.__init__ | (
self,
session: OAuth2Session,
spotify: Spotify,
me: dict,
user_id: str,
name: str,
) | Initialize. | Initialize. | def __init__(
self,
session: OAuth2Session,
spotify: Spotify,
me: dict,
user_id: str,
name: str,
):
"""Initialize."""
self._id = user_id
self._me = me
self._name = f"Spotify {name}"
self._session = session
self._spotify ... | [
"def",
"__init__",
"(",
"self",
",",
"session",
":",
"OAuth2Session",
",",
"spotify",
":",
"Spotify",
",",
"me",
":",
"dict",
",",
"user_id",
":",
"str",
",",
"name",
":",
"str",
",",
")",
":",
"self",
".",
"_id",
"=",
"user_id",
"self",
".",
"_me"... | [
206,
4
] | [
229,
37
] | python | en | ['en', 'en', 'it'] | False |
SpotifyMediaPlayer.name | (self) | Return the name. | Return the name. | def name(self) -> str:
"""Return the name."""
return self._name | [
"def",
"name",
"(",
"self",
")",
"->",
"str",
":",
"return",
"self",
".",
"_name"
] | [
232,
4
] | [
234,
25
] | python | en | ['en', 'ig', 'en'] | True |
SpotifyMediaPlayer.icon | (self) | Return the icon. | Return the icon. | def icon(self) -> str:
"""Return the icon."""
return ICON | [
"def",
"icon",
"(",
"self",
")",
"->",
"str",
":",
"return",
"ICON"
] | [
237,
4
] | [
239,
19
] | python | en | ['en', 'sr', 'en'] | True |
SpotifyMediaPlayer.available | (self) | Return True if entity is available. | Return True if entity is available. | def available(self) -> bool:
"""Return True if entity is available."""
return self.player_available | [
"def",
"available",
"(",
"self",
")",
"->",
"bool",
":",
"return",
"self",
".",
"player_available"
] | [
242,
4
] | [
244,
36
] | python | en | ['en', 'en', 'en'] | True |
SpotifyMediaPlayer.unique_id | (self) | Return the unique ID. | Return the unique ID. | def unique_id(self) -> str:
"""Return the unique ID."""
return self._id | [
"def",
"unique_id",
"(",
"self",
")",
"->",
"str",
":",
"return",
"self",
".",
"_id"
] | [
247,
4
] | [
249,
23
] | python | en | ['en', 'la', 'en'] | True |
SpotifyMediaPlayer.device_info | (self) | Return device information about this entity. | Return device information about this entity. | def device_info(self) -> Dict[str, Any]:
"""Return device information about this entity."""
if self._me is not None:
model = self._me["product"]
return {
"identifiers": {(DOMAIN, self._id)},
"manufacturer": "Spotify AB",
"model": f"Spotify {model}... | [
"def",
"device_info",
"(",
"self",
")",
"->",
"Dict",
"[",
"str",
",",
"Any",
"]",
":",
"if",
"self",
".",
"_me",
"is",
"not",
"None",
":",
"model",
"=",
"self",
".",
"_me",
"[",
"\"product\"",
"]",
"return",
"{",
"\"identifiers\"",
":",
"{",
"(",
... | [
252,
4
] | [
262,
9
] | python | en | ['en', 'en', 'en'] | True |
SpotifyMediaPlayer.state | (self) | Return the playback state. | Return the playback state. | def state(self) -> Optional[str]:
"""Return the playback state."""
if not self._currently_playing:
return STATE_IDLE
if self._currently_playing["is_playing"]:
return STATE_PLAYING
return STATE_PAUSED | [
"def",
"state",
"(",
"self",
")",
"->",
"Optional",
"[",
"str",
"]",
":",
"if",
"not",
"self",
".",
"_currently_playing",
":",
"return",
"STATE_IDLE",
"if",
"self",
".",
"_currently_playing",
"[",
"\"is_playing\"",
"]",
":",
"return",
"STATE_PLAYING",
"retur... | [
265,
4
] | [
271,
27
] | python | en | ['en', 'en', 'en'] | True |
SpotifyMediaPlayer.volume_level | (self) | Return the device volume. | Return the device volume. | def volume_level(self) -> Optional[float]:
"""Return the device volume."""
return self._currently_playing.get("device", {}).get("volume_percent", 0) / 100 | [
"def",
"volume_level",
"(",
"self",
")",
"->",
"Optional",
"[",
"float",
"]",
":",
"return",
"self",
".",
"_currently_playing",
".",
"get",
"(",
"\"device\"",
",",
"{",
"}",
")",
".",
"get",
"(",
"\"volume_percent\"",
",",
"0",
")",
"/",
"100"
] | [
274,
4
] | [
276,
87
] | python | en | ['en', 'ko', 'en'] | True |
SpotifyMediaPlayer.media_content_id | (self) | Return the media URL. | Return the media URL. | def media_content_id(self) -> Optional[str]:
"""Return the media URL."""
item = self._currently_playing.get("item") or {}
return item.get("uri") | [
"def",
"media_content_id",
"(",
"self",
")",
"->",
"Optional",
"[",
"str",
"]",
":",
"item",
"=",
"self",
".",
"_currently_playing",
".",
"get",
"(",
"\"item\"",
")",
"or",
"{",
"}",
"return",
"item",
".",
"get",
"(",
"\"uri\"",
")"
] | [
279,
4
] | [
282,
30
] | python | en | ['en', 'no', 'en'] | True |
SpotifyMediaPlayer.media_content_type | (self) | Return the media type. | Return the media type. | def media_content_type(self) -> Optional[str]:
"""Return the media type."""
return MEDIA_TYPE_MUSIC | [
"def",
"media_content_type",
"(",
"self",
")",
"->",
"Optional",
"[",
"str",
"]",
":",
"return",
"MEDIA_TYPE_MUSIC"
] | [
285,
4
] | [
287,
31
] | python | en | ['en', 'no', 'en'] | True |
SpotifyMediaPlayer.media_duration | (self) | Duration of current playing media in seconds. | Duration of current playing media in seconds. | def media_duration(self) -> Optional[int]:
"""Duration of current playing media in seconds."""
if self._currently_playing.get("item") is None:
return None
return self._currently_playing["item"]["duration_ms"] / 1000 | [
"def",
"media_duration",
"(",
"self",
")",
"->",
"Optional",
"[",
"int",
"]",
":",
"if",
"self",
".",
"_currently_playing",
".",
"get",
"(",
"\"item\"",
")",
"is",
"None",
":",
"return",
"None",
"return",
"self",
".",
"_currently_playing",
"[",
"\"item\"",... | [
290,
4
] | [
294,
68
] | python | en | ['en', 'en', 'en'] | True |
SpotifyMediaPlayer.media_position | (self) | Position of current playing media in seconds. | Position of current playing media in seconds. | def media_position(self) -> Optional[str]:
"""Position of current playing media in seconds."""
if not self._currently_playing:
return None
return self._currently_playing["progress_ms"] / 1000 | [
"def",
"media_position",
"(",
"self",
")",
"->",
"Optional",
"[",
"str",
"]",
":",
"if",
"not",
"self",
".",
"_currently_playing",
":",
"return",
"None",
"return",
"self",
".",
"_currently_playing",
"[",
"\"progress_ms\"",
"]",
"/",
"1000"
] | [
297,
4
] | [
301,
60
] | python | en | ['en', 'en', 'en'] | True |
SpotifyMediaPlayer.media_position_updated_at | (self) | When was the position of the current playing media valid. | When was the position of the current playing media valid. | def media_position_updated_at(self) -> Optional[dt.datetime]:
"""When was the position of the current playing media valid."""
if not self._currently_playing:
return None
return utc_from_timestamp(self._currently_playing["timestamp"] / 1000) | [
"def",
"media_position_updated_at",
"(",
"self",
")",
"->",
"Optional",
"[",
"dt",
".",
"datetime",
"]",
":",
"if",
"not",
"self",
".",
"_currently_playing",
":",
"return",
"None",
"return",
"utc_from_timestamp",
"(",
"self",
".",
"_currently_playing",
"[",
"\... | [
304,
4
] | [
308,
78
] | python | en | ['en', 'en', 'en'] | True |
SpotifyMediaPlayer.media_image_url | (self) | Return the media image URL. | Return the media image URL. | def media_image_url(self) -> Optional[str]:
"""Return the media image URL."""
if (
self._currently_playing.get("item") is None
or not self._currently_playing["item"]["album"]["images"]
):
return None
return fetch_image_url(self._currently_playing["item... | [
"def",
"media_image_url",
"(",
"self",
")",
"->",
"Optional",
"[",
"str",
"]",
":",
"if",
"(",
"self",
".",
"_currently_playing",
".",
"get",
"(",
"\"item\"",
")",
"is",
"None",
"or",
"not",
"self",
".",
"_currently_playing",
"[",
"\"item\"",
"]",
"[",
... | [
311,
4
] | [
318,
72
] | python | en | ['en', 'et', 'en'] | True |
SpotifyMediaPlayer.media_image_remotely_accessible | (self) | If the image url is remotely accessible. | If the image url is remotely accessible. | def media_image_remotely_accessible(self) -> bool:
"""If the image url is remotely accessible."""
return False | [
"def",
"media_image_remotely_accessible",
"(",
"self",
")",
"->",
"bool",
":",
"return",
"False"
] | [
321,
4
] | [
323,
20
] | python | en | ['en', 'en', 'en'] | True |
SpotifyMediaPlayer.media_title | (self) | Return the media title. | Return the media title. | def media_title(self) -> Optional[str]:
"""Return the media title."""
item = self._currently_playing.get("item") or {}
return item.get("name") | [
"def",
"media_title",
"(",
"self",
")",
"->",
"Optional",
"[",
"str",
"]",
":",
"item",
"=",
"self",
".",
"_currently_playing",
".",
"get",
"(",
"\"item\"",
")",
"or",
"{",
"}",
"return",
"item",
".",
"get",
"(",
"\"name\"",
")"
] | [
326,
4
] | [
329,
31
] | python | en | ['en', 'sq', 'en'] | True |
SpotifyMediaPlayer.media_artist | (self) | Return the media artist. | Return the media artist. | def media_artist(self) -> Optional[str]:
"""Return the media artist."""
if self._currently_playing.get("item") is None:
return None
return ", ".join(
[artist["name"] for artist in self._currently_playing["item"]["artists"]]
) | [
"def",
"media_artist",
"(",
"self",
")",
"->",
"Optional",
"[",
"str",
"]",
":",
"if",
"self",
".",
"_currently_playing",
".",
"get",
"(",
"\"item\"",
")",
"is",
"None",
":",
"return",
"None",
"return",
"\", \"",
".",
"join",
"(",
"[",
"artist",
"[",
... | [
332,
4
] | [
338,
9
] | python | en | ['en', 'no', 'en'] | True |
SpotifyMediaPlayer.media_album_name | (self) | Return the media album. | Return the media album. | def media_album_name(self) -> Optional[str]:
"""Return the media album."""
if self._currently_playing.get("item") is None:
return None
return self._currently_playing["item"]["album"]["name"] | [
"def",
"media_album_name",
"(",
"self",
")",
"->",
"Optional",
"[",
"str",
"]",
":",
"if",
"self",
".",
"_currently_playing",
".",
"get",
"(",
"\"item\"",
")",
"is",
"None",
":",
"return",
"None",
"return",
"self",
".",
"_currently_playing",
"[",
"\"item\"... | [
341,
4
] | [
345,
63
] | python | en | ['en', 'la', 'en'] | True |
SpotifyMediaPlayer.media_track | (self) | Track number of current playing media, music track only. | Track number of current playing media, music track only. | def media_track(self) -> Optional[int]:
"""Track number of current playing media, music track only."""
item = self._currently_playing.get("item") or {}
return item.get("track_number") | [
"def",
"media_track",
"(",
"self",
")",
"->",
"Optional",
"[",
"int",
"]",
":",
"item",
"=",
"self",
".",
"_currently_playing",
".",
"get",
"(",
"\"item\"",
")",
"or",
"{",
"}",
"return",
"item",
".",
"get",
"(",
"\"track_number\"",
")"
] | [
348,
4
] | [
351,
39
] | python | en | ['en', 'en', 'en'] | True |
SpotifyMediaPlayer.media_playlist | (self) | Title of Playlist currently playing. | Title of Playlist currently playing. | def media_playlist(self):
"""Title of Playlist currently playing."""
if self._playlist is None:
return None
return self._playlist["name"] | [
"def",
"media_playlist",
"(",
"self",
")",
":",
"if",
"self",
".",
"_playlist",
"is",
"None",
":",
"return",
"None",
"return",
"self",
".",
"_playlist",
"[",
"\"name\"",
"]"
] | [
354,
4
] | [
358,
37
] | python | en | ['en', 'en', 'en'] | True |
SpotifyMediaPlayer.source | (self) | Return the current playback device. | Return the current playback device. | def source(self) -> Optional[str]:
"""Return the current playback device."""
return self._currently_playing.get("device", {}).get("name") | [
"def",
"source",
"(",
"self",
")",
"->",
"Optional",
"[",
"str",
"]",
":",
"return",
"self",
".",
"_currently_playing",
".",
"get",
"(",
"\"device\"",
",",
"{",
"}",
")",
".",
"get",
"(",
"\"name\"",
")"
] | [
361,
4
] | [
363,
68
] | python | en | ['en', 'en', 'en'] | True |
SpotifyMediaPlayer.source_list | (self) | Return a list of source devices. | Return a list of source devices. | def source_list(self) -> Optional[List[str]]:
"""Return a list of source devices."""
if not self._devices:
return None
return [device["name"] for device in self._devices] | [
"def",
"source_list",
"(",
"self",
")",
"->",
"Optional",
"[",
"List",
"[",
"str",
"]",
"]",
":",
"if",
"not",
"self",
".",
"_devices",
":",
"return",
"None",
"return",
"[",
"device",
"[",
"\"name\"",
"]",
"for",
"device",
"in",
"self",
".",
"_device... | [
366,
4
] | [
370,
59
] | python | en | ['en', 'en', 'en'] | True |
SpotifyMediaPlayer.shuffle | (self) | Shuffling state. | Shuffling state. | def shuffle(self) -> bool:
"""Shuffling state."""
return bool(self._currently_playing.get("shuffle_state")) | [
"def",
"shuffle",
"(",
"self",
")",
"->",
"bool",
":",
"return",
"bool",
"(",
"self",
".",
"_currently_playing",
".",
"get",
"(",
"\"shuffle_state\"",
")",
")"
] | [
373,
4
] | [
375,
65
] | python | de | ['de', 'jv', 'en'] | False |
SpotifyMediaPlayer.supported_features | (self) | Return the media player features that are supported. | Return the media player features that are supported. | def supported_features(self) -> int:
"""Return the media player features that are supported."""
if self._me["product"] != "premium":
return 0
return SUPPORT_SPOTIFY | [
"def",
"supported_features",
"(",
"self",
")",
"->",
"int",
":",
"if",
"self",
".",
"_me",
"[",
"\"product\"",
"]",
"!=",
"\"premium\"",
":",
"return",
"0",
"return",
"SUPPORT_SPOTIFY"
] | [
378,
4
] | [
382,
30
] | python | en | ['en', 'en', 'en'] | True |
SpotifyMediaPlayer.set_volume_level | (self, volume: int) | Set the volume level. | Set the volume level. | def set_volume_level(self, volume: int) -> None:
"""Set the volume level."""
self._spotify.volume(int(volume * 100)) | [
"def",
"set_volume_level",
"(",
"self",
",",
"volume",
":",
"int",
")",
"->",
"None",
":",
"self",
".",
"_spotify",
".",
"volume",
"(",
"int",
"(",
"volume",
"*",
"100",
")",
")"
] | [
385,
4
] | [
387,
47
] | python | en | ['en', 'sr', 'en'] | True |
SpotifyMediaPlayer.media_play | (self) | Start or resume playback. | Start or resume playback. | def media_play(self) -> None:
"""Start or resume playback."""
self._spotify.start_playback() | [
"def",
"media_play",
"(",
"self",
")",
"->",
"None",
":",
"self",
".",
"_spotify",
".",
"start_playback",
"(",
")"
] | [
390,
4
] | [
392,
38
] | python | en | ['en', 'jv', 'en'] | True |
SpotifyMediaPlayer.media_pause | (self) | Pause playback. | Pause playback. | def media_pause(self) -> None:
"""Pause playback."""
self._spotify.pause_playback() | [
"def",
"media_pause",
"(",
"self",
")",
"->",
"None",
":",
"self",
".",
"_spotify",
".",
"pause_playback",
"(",
")"
] | [
395,
4
] | [
397,
38
] | python | de | ['de', 'lt', 'en'] | False |
SpotifyMediaPlayer.media_previous_track | (self) | Skip to previous track. | Skip to previous track. | def media_previous_track(self) -> None:
"""Skip to previous track."""
self._spotify.previous_track() | [
"def",
"media_previous_track",
"(",
"self",
")",
"->",
"None",
":",
"self",
".",
"_spotify",
".",
"previous_track",
"(",
")"
] | [
400,
4
] | [
402,
38
] | python | en | ['en', 'en', 'en'] | True |
SpotifyMediaPlayer.media_next_track | (self) | Skip to next track. | Skip to next track. | def media_next_track(self) -> None:
"""Skip to next track."""
self._spotify.next_track() | [
"def",
"media_next_track",
"(",
"self",
")",
"->",
"None",
":",
"self",
".",
"_spotify",
".",
"next_track",
"(",
")"
] | [
405,
4
] | [
407,
34
] | python | en | ['en', 'bg-Latn', 'en'] | True |
SpotifyMediaPlayer.media_seek | (self, position) | Send seek command. | Send seek command. | def media_seek(self, position):
"""Send seek command."""
self._spotify.seek_track(int(position * 1000)) | [
"def",
"media_seek",
"(",
"self",
",",
"position",
")",
":",
"self",
".",
"_spotify",
".",
"seek_track",
"(",
"int",
"(",
"position",
"*",
"1000",
")",
")"
] | [
410,
4
] | [
412,
54
] | python | en | ['en', 'ig', 'en'] | True |
SpotifyMediaPlayer.play_media | (self, media_type: str, media_id: str, **kwargs) | Play media. | Play media. | def play_media(self, media_type: str, media_id: str, **kwargs) -> None:
"""Play media."""
kwargs = {}
# Spotify can't handle URI's with query strings or anchors
# Yet, they do generate those types of URI in their official clients.
media_id = str(URL(media_id).with_query(None).wi... | [
"def",
"play_media",
"(",
"self",
",",
"media_type",
":",
"str",
",",
"media_id",
":",
"str",
",",
"*",
"*",
"kwargs",
")",
"->",
"None",
":",
"kwargs",
"=",
"{",
"}",
"# Spotify can't handle URI's with query strings or anchors",
"# Yet, they do generate those types... | [
415,
4
] | [
434,
46
] | python | en | ['en', 'sv', 'en'] | False |
SpotifyMediaPlayer.select_source | (self, source: str) | Select playback device. | Select playback device. | def select_source(self, source: str) -> None:
"""Select playback device."""
for device in self._devices:
if device["name"] == source:
self._spotify.transfer_playback(
device["id"], self.state == STATE_PLAYING
)
return | [
"def",
"select_source",
"(",
"self",
",",
"source",
":",
"str",
")",
"->",
"None",
":",
"for",
"device",
"in",
"self",
".",
"_devices",
":",
"if",
"device",
"[",
"\"name\"",
"]",
"==",
"source",
":",
"self",
".",
"_spotify",
".",
"transfer_playback",
"... | [
437,
4
] | [
444,
22
] | python | en | ['es', 'en', 'en'] | True |
SpotifyMediaPlayer.set_shuffle | (self, shuffle: bool) | Enable/Disable shuffle mode. | Enable/Disable shuffle mode. | def set_shuffle(self, shuffle: bool) -> None:
"""Enable/Disable shuffle mode."""
self._spotify.shuffle(shuffle) | [
"def",
"set_shuffle",
"(",
"self",
",",
"shuffle",
":",
"bool",
")",
"->",
"None",
":",
"self",
".",
"_spotify",
".",
"shuffle",
"(",
"shuffle",
")"
] | [
447,
4
] | [
449,
38
] | python | en | ['en', 'st', 'en'] | True |
SpotifyMediaPlayer.update | (self) | Update state and attributes. | Update state and attributes. | def update(self) -> None:
"""Update state and attributes."""
if not self.enabled:
return
if not self._session.valid_token or self._spotify is None:
run_coroutine_threadsafe(
self._session.async_ensure_token_valid(), self.hass.loop
).result()
... | [
"def",
"update",
"(",
"self",
")",
"->",
"None",
":",
"if",
"not",
"self",
".",
"enabled",
":",
"return",
"if",
"not",
"self",
".",
"_session",
".",
"valid_token",
"or",
"self",
".",
"_spotify",
"is",
"None",
":",
"run_coroutine_threadsafe",
"(",
"self",... | [
452,
4
] | [
472,
50
] | python | en | ['en', 'en', 'en'] | True |
SpotifyMediaPlayer.async_browse_media | (self, media_content_type=None, media_content_id=None) | Implement the websocket media browsing helper. | Implement the websocket media browsing helper. | async def async_browse_media(self, media_content_type=None, media_content_id=None):
"""Implement the websocket media browsing helper."""
if not self._scope_ok:
_LOGGER.debug(
"Spotify scopes are not set correctly, this can impact features such as media browsing"
... | [
"async",
"def",
"async_browse_media",
"(",
"self",
",",
"media_content_type",
"=",
"None",
",",
"media_content_id",
"=",
"None",
")",
":",
"if",
"not",
"self",
".",
"_scope_ok",
":",
"_LOGGER",
".",
"debug",
"(",
"\"Spotify scopes are not set correctly, this can imp... | [
474,
4
] | [
497,
23
] | python | en | ['en', 'af', 'en'] | True |
async_setup_platform | (hass, config, async_add_entities, discovery_info=None) | Set up the BME280 sensor. | Set up the BME280 sensor. | async def async_setup_platform(hass, config, async_add_entities, discovery_info=None):
"""Set up the BME280 sensor."""
SENSOR_TYPES[SENSOR_TEMP][1] = hass.config.units.temperature_unit
name = config[CONF_NAME]
i2c_address = config[CONF_I2C_ADDRESS]
bus = smbus.SMBus(config[CONF_I2C_BUS])
senso... | [
"async",
"def",
"async_setup_platform",
"(",
"hass",
",",
"config",
",",
"async_add_entities",
",",
"discovery_info",
"=",
"None",
")",
":",
"SENSOR_TYPES",
"[",
"SENSOR_TEMP",
"]",
"[",
"1",
"]",
"=",
"hass",
".",
"config",
".",
"units",
".",
"temperature_u... | [
83,
0
] | [
121,
33
] | python | en | ['en', 'da', 'en'] | True |
BME280Handler.__init__ | (self, sensor) | Initialize the sensor handler. | Initialize the sensor handler. | def __init__(self, sensor):
"""Initialize the sensor handler."""
self.sensor = sensor
self.update(True) | [
"def",
"__init__",
"(",
"self",
",",
"sensor",
")",
":",
"self",
".",
"sensor",
"=",
"sensor",
"self",
".",
"update",
"(",
"True",
")"
] | [
127,
4
] | [
130,
25
] | python | en | ['en', 'pt', 'en'] | True |
BME280Handler.update | (self, first_reading=False) | Read sensor data. | Read sensor data. | def update(self, first_reading=False):
"""Read sensor data."""
self.sensor.update(first_reading) | [
"def",
"update",
"(",
"self",
",",
"first_reading",
"=",
"False",
")",
":",
"self",
".",
"sensor",
".",
"update",
"(",
"first_reading",
")"
] | [
133,
4
] | [
135,
41
] | python | ca | ['nl', 'ca', 'en'] | False |
BME280Sensor.__init__ | (self, bme280_client, sensor_type, temp_unit, name) | Initialize the sensor. | Initialize the sensor. | def __init__(self, bme280_client, sensor_type, temp_unit, name):
"""Initialize the sensor."""
self.client_name = name
self._name = SENSOR_TYPES[sensor_type][0]
self.bme280_client = bme280_client
self.temp_unit = temp_unit
self.type = sensor_type
self._state = None... | [
"def",
"__init__",
"(",
"self",
",",
"bme280_client",
",",
"sensor_type",
",",
"temp_unit",
",",
"name",
")",
":",
"self",
".",
"client_name",
"=",
"name",
"self",
".",
"_name",
"=",
"SENSOR_TYPES",
"[",
"sensor_type",
"]",
"[",
"0",
"]",
"self",
".",
... | [
141,
4
] | [
149,
64
] | python | en | ['en', 'en', 'en'] | True |
BME280Sensor.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"{self.client_name} {self._name}" | [
"def",
"name",
"(",
"self",
")",
":",
"return",
"f\"{self.client_name} {self._name}\""
] | [
152,
4
] | [
154,
49
] | python | en | ['en', 'mi', 'en'] | True |
BME280Sensor.state | (self) | Return the state of the sensor. | Return the state of the sensor. | def state(self):
"""Return the state of the sensor."""
return self._state | [
"def",
"state",
"(",
"self",
")",
":",
"return",
"self",
".",
"_state"
] | [
157,
4
] | [
159,
26
] | python | en | ['en', 'en', 'en'] | True |
BME280Sensor.unit_of_measurement | (self) | Return the unit of measurement of the sensor. | Return the unit of measurement of the sensor. | def unit_of_measurement(self):
"""Return the unit of measurement of the sensor."""
return self._unit_of_measurement | [
"def",
"unit_of_measurement",
"(",
"self",
")",
":",
"return",
"self",
".",
"_unit_of_measurement"
] | [
162,
4
] | [
164,
40
] | python | en | ['en', 'bg', 'en'] | True |
BME280Sensor.async_update | (self) | Get the latest data from the BME280 and update the states. | Get the latest data from the BME280 and update the states. | async def async_update(self):
"""Get the latest data from the BME280 and update the states."""
await self.hass.async_add_executor_job(self.bme280_client.update)
if self.bme280_client.sensor.sample_ok:
if self.type == SENSOR_TEMP:
temperature = round(self.bme280_client... | [
"async",
"def",
"async_update",
"(",
"self",
")",
":",
"await",
"self",
".",
"hass",
".",
"async_add_executor_job",
"(",
"self",
".",
"bme280_client",
".",
"update",
")",
"if",
"self",
".",
"bme280_client",
".",
"sensor",
".",
"sample_ok",
":",
"if",
"self... | [
166,
4
] | [
180,
65
] | python | en | ['en', 'en', 'en'] | True |
convert_pl_to_hf | (pl_ckpt_path: str, hf_src_model_dir: str, save_path: str) | Cleanup a pytorch-lightning .ckpt file or experiment dir and save a huggingface model with that state dict.
Silently allows extra pl keys (like teacher.) Puts all ckpt models into CPU RAM at once!
Args:
pl_ckpt_path (:obj:`str`): Path to a .ckpt file saved by pytorch_lightning or dir containing ckpt fi... | Cleanup a pytorch-lightning .ckpt file or experiment dir and save a huggingface model with that state dict.
Silently allows extra pl keys (like teacher.) Puts all ckpt models into CPU RAM at once! | def convert_pl_to_hf(pl_ckpt_path: str, hf_src_model_dir: str, save_path: str) -> None:
"""Cleanup a pytorch-lightning .ckpt file or experiment dir and save a huggingface model with that state dict.
Silently allows extra pl keys (like teacher.) Puts all ckpt models into CPU RAM at once!
Args:
pl_ck... | [
"def",
"convert_pl_to_hf",
"(",
"pl_ckpt_path",
":",
"str",
",",
"hf_src_model_dir",
":",
"str",
",",
"save_path",
":",
"str",
")",
"->",
"None",
":",
"hf_model",
"=",
"AutoModelForSeq2SeqLM",
".",
"from_pretrained",
"(",
"hf_src_model_dir",
")",
"if",
"os",
"... | [
36,
0
] | [
68,
12
] | python | en | ['en', 'en', 'en'] | True |
mock_storage | (hass_storage) | Autouse hass_storage for the TestCase tests. | Autouse hass_storage for the TestCase tests. | def mock_storage(hass_storage):
"""Autouse hass_storage for the TestCase tests.""" | [
"def",
"mock_storage",
"(",
"hass_storage",
")",
":"
] | [
28,
0
] | [
29,
54
] | python | en | ['en', 'en', 'en'] | True |
zwave_setup | (hass) | Zwave setup. | Zwave setup. | async def zwave_setup(hass):
"""Zwave setup."""
await async_setup_component(hass, "zwave", {"zwave": {}})
await hass.async_block_till_done() | [
"async",
"def",
"zwave_setup",
"(",
"hass",
")",
":",
"await",
"async_setup_component",
"(",
"hass",
",",
"\"zwave\"",
",",
"{",
"\"zwave\"",
":",
"{",
"}",
"}",
")",
"await",
"hass",
".",
"async_block_till_done",
"(",
")"
] | [
33,
0
] | [
36,
38
] | python | en | ['en', 'bs', 'en'] | False |
zwave_setup_ready | (hass, zwave_setup) | Zwave setup and set network to ready. | Zwave setup and set network to ready. | async def zwave_setup_ready(hass, zwave_setup):
"""Zwave setup and set network to ready."""
zwave_network = hass.data[DATA_NETWORK]
zwave_network.state = MockNetwork.STATE_READY
await hass.async_start() | [
"async",
"def",
"zwave_setup_ready",
"(",
"hass",
",",
"zwave_setup",
")",
":",
"zwave_network",
"=",
"hass",
".",
"data",
"[",
"DATA_NETWORK",
"]",
"zwave_network",
".",
"state",
"=",
"MockNetwork",
".",
"STATE_READY",
"await",
"hass",
".",
"async_start",
"("... | [
40,
0
] | [
45,
28
] | python | en | ['en', 'en', 'en'] | True |
test_valid_device_config | (hass, mock_openzwave) | Test valid device config. | Test valid device config. | async def test_valid_device_config(hass, mock_openzwave):
"""Test valid device config."""
device_config = {"light.kitchen": {"ignored": "true"}}
result = await async_setup_component(
hass, "zwave", {"zwave": {"device_config": device_config}}
)
await hass.async_block_till_done()
assert r... | [
"async",
"def",
"test_valid_device_config",
"(",
"hass",
",",
"mock_openzwave",
")",
":",
"device_config",
"=",
"{",
"\"light.kitchen\"",
":",
"{",
"\"ignored\"",
":",
"\"true\"",
"}",
"}",
"result",
"=",
"await",
"async_setup_component",
"(",
"hass",
",",
"\"zw... | [
48,
0
] | [
56,
17
] | python | en | ['nl', 'en', 'en'] | True |
test_invalid_device_config | (hass, mock_openzwave) | Test invalid device config. | Test invalid device config. | async def test_invalid_device_config(hass, mock_openzwave):
"""Test invalid device config."""
device_config = {"light.kitchen": {"some_ignored": "true"}}
result = await async_setup_component(
hass, "zwave", {"zwave": {"device_config": device_config}}
)
await hass.async_block_till_done()
... | [
"async",
"def",
"test_invalid_device_config",
"(",
"hass",
",",
"mock_openzwave",
")",
":",
"device_config",
"=",
"{",
"\"light.kitchen\"",
":",
"{",
"\"some_ignored\"",
":",
"\"true\"",
"}",
"}",
"result",
"=",
"await",
"async_setup_component",
"(",
"hass",
",",
... | [
59,
0
] | [
67,
21
] | python | en | ['fr', 'en', 'en'] | True |
test_config_access_error | () | Test threading error accessing config values. | Test threading error accessing config values. | def test_config_access_error():
"""Test threading error accessing config values."""
node = MagicMock()
def side_effect():
raise RuntimeError
node.values.values.side_effect = side_effect
result = zwave.get_config_value(node, 1)
assert result is None | [
"def",
"test_config_access_error",
"(",
")",
":",
"node",
"=",
"MagicMock",
"(",
")",
"def",
"side_effect",
"(",
")",
":",
"raise",
"RuntimeError",
"node",
".",
"values",
".",
"values",
".",
"side_effect",
"=",
"side_effect",
"result",
"=",
"zwave",
".",
"... | [
70,
0
] | [
79,
25
] | python | en | ['en', 'la', 'en'] | True |
test_network_options | (hass, mock_openzwave) | Test network options. | Test network options. | async def test_network_options(hass, mock_openzwave):
"""Test network options."""
result = await async_setup_component(
hass,
"zwave",
{"zwave": {"usb_path": "mock_usb_path", "config_path": "mock_config_path"}},
)
await hass.async_block_till_done()
assert result
network... | [
"async",
"def",
"test_network_options",
"(",
"hass",
",",
"mock_openzwave",
")",
":",
"result",
"=",
"await",
"async_setup_component",
"(",
"hass",
",",
"\"zwave\"",
",",
"{",
"\"zwave\"",
":",
"{",
"\"usb_path\"",
":",
"\"mock_usb_path\"",
",",
"\"config_path\"",... | [
82,
0
] | [
95,
60
] | python | en | ['en', 'en', 'en'] | True |
test_network_key_validation | (hass, mock_openzwave) | Test network key validation. | Test network key validation. | async def test_network_key_validation(hass, mock_openzwave):
"""Test network key validation."""
test_values = [
(
"0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, "
"0x0C, 0x0D, 0x0E, 0x0F, 0x10"
),
(
"0x01,0x02,0x03,0x04,0x05,0x06,0x... | [
"async",
"def",
"test_network_key_validation",
"(",
"hass",
",",
"mock_openzwave",
")",
":",
"test_values",
"=",
"[",
"(",
"\"0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, \"",
"\"0x0C, 0x0D, 0x0E, 0x0F, 0x10\"",
")",
",",
"(",
"\"0x01,0x02,0x03,0x04,0x05,0x06... | [
98,
0
] | [
112,
54
] | python | en | ['en', 'ru-Latn', 'en'] | True |
test_erronous_network_key_fails_validation | (hass, mock_openzwave) | Test failing erroneous network key validation. | Test failing erroneous network key validation. | async def test_erronous_network_key_fails_validation(hass, mock_openzwave):
"""Test failing erroneous network key validation."""
test_values = [
(
"0x 01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, "
"0x0C, 0x0D, 0x0E, 0x0F, 0x10"
),
(
... | [
"async",
"def",
"test_erronous_network_key_fails_validation",
"(",
"hass",
",",
"mock_openzwave",
")",
":",
"test_values",
"=",
"[",
"(",
"\"0x 01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, \"",
"\"0x0C, 0x0D, 0x0E, 0x0F, 0x10\"",
")",
",",
"(",
"\"0X01,0X02,0X0... | [
115,
0
] | [
132,
66
] | python | en | ['en', 'zu', 'en'] | True |
test_auto_heal_midnight | (hass, mock_openzwave, legacy_patchable_time) | Test network auto-heal at midnight. | Test network auto-heal at midnight. | async def test_auto_heal_midnight(hass, mock_openzwave, legacy_patchable_time):
"""Test network auto-heal at midnight."""
await async_setup_component(hass, "zwave", {"zwave": {"autoheal": True}})
await hass.async_block_till_done()
network = hass.data[zwave.DATA_NETWORK]
assert not network.heal.call... | [
"async",
"def",
"test_auto_heal_midnight",
"(",
"hass",
",",
"mock_openzwave",
",",
"legacy_patchable_time",
")",
":",
"await",
"async_setup_component",
"(",
"hass",
",",
"\"zwave\"",
",",
"{",
"\"zwave\"",
":",
"{",
"\"autoheal\"",
":",
"True",
"}",
"}",
")",
... | [
135,
0
] | [
148,
44
] | python | en | ['da', 'en', 'en'] | True |
test_auto_heal_disabled | (hass, mock_openzwave) | Test network auto-heal disabled. | Test network auto-heal disabled. | async def test_auto_heal_disabled(hass, mock_openzwave):
"""Test network auto-heal disabled."""
await async_setup_component(hass, "zwave", {"zwave": {"autoheal": False}})
await hass.async_block_till_done()
network = hass.data[zwave.DATA_NETWORK]
assert not network.heal.called
time = utc.locali... | [
"async",
"def",
"test_auto_heal_disabled",
"(",
"hass",
",",
"mock_openzwave",
")",
":",
"await",
"async_setup_component",
"(",
"hass",
",",
"\"zwave\"",
",",
"{",
"\"zwave\"",
":",
"{",
"\"autoheal\"",
":",
"False",
"}",
"}",
")",
"await",
"hass",
".",
"asy... | [
151,
0
] | [
162,
34
] | python | en | ['es', 'en', 'en'] | True |
test_setup_platform | (hass, mock_openzwave) | Test invalid device config. | Test invalid device config. | async def test_setup_platform(hass, mock_openzwave):
"""Test invalid device config."""
mock_device = MagicMock()
hass.data[DATA_NETWORK] = MagicMock()
hass.data[zwave.DATA_DEVICES] = {456: mock_device}
async_add_entities = MagicMock()
result = await zwave.async_setup_platform(hass, None, async_... | [
"async",
"def",
"test_setup_platform",
"(",
"hass",
",",
"mock_openzwave",
")",
":",
"mock_device",
"=",
"MagicMock",
"(",
")",
"hass",
".",
"data",
"[",
"DATA_NETWORK",
"]",
"=",
"MagicMock",
"(",
")",
"hass",
".",
"data",
"[",
"zwave",
".",
"DATA_DEVICES... | [
165,
0
] | [
188,
66
] | python | en | ['fr', 'en', 'en'] | True |
test_zwave_ready_wait | (hass, mock_openzwave, zwave_setup) | Test that zwave continues after waiting for network ready. | Test that zwave continues after waiting for network ready. | async def test_zwave_ready_wait(hass, mock_openzwave, zwave_setup):
"""Test that zwave continues after waiting for network ready."""
sleeps = []
def utcnow():
return datetime.fromtimestamp(len(sleeps))
asyncio_sleep = asyncio.sleep
async def sleep(duration, loop=None):
if duration... | [
"async",
"def",
"test_zwave_ready_wait",
"(",
"hass",
",",
"mock_openzwave",
",",
"zwave_setup",
")",
":",
"sleeps",
"=",
"[",
"]",
"def",
"utcnow",
"(",
")",
":",
"return",
"datetime",
".",
"fromtimestamp",
"(",
"len",
"(",
"sleeps",
")",
")",
"asyncio_sl... | [
191,
0
] | [
218,
17
] | python | en | ['en', 'en', 'en'] | True |
test_device_entity | (hass, mock_openzwave) | Test device entity base class. | Test device entity base class. | async def test_device_entity(hass, mock_openzwave):
"""Test device entity base class."""
node = MockNode(node_id="10", name="Mock Node")
value = MockValue(
data=False,
node=node,
instance=2,
object_id="11",
label="Sensor",
command_class=const.COMMAND_CLASS_SEN... | [
"async",
"def",
"test_device_entity",
"(",
"hass",
",",
"mock_openzwave",
")",
":",
"node",
"=",
"MockNode",
"(",
"node_id",
"=",
"\"10\"",
",",
"name",
"=",
"\"Mock Node\"",
")",
"value",
"=",
"MockValue",
"(",
"data",
"=",
"False",
",",
"node",
"=",
"n... | [
221,
0
] | [
245,
69
] | python | en | ['en', 'en', 'en'] | True |
test_node_removed | (hass, mock_openzwave) | Test node removed in base class. | Test node removed in base class. | async def test_node_removed(hass, mock_openzwave):
"""Test node removed in base class."""
# Create a mock node & node entity
node = MockNode(node_id="10", name="Mock Node")
value = MockValue(
data=False,
node=node,
instance=2,
object_id="11",
label="Sensor",
... | [
"async",
"def",
"test_node_removed",
"(",
"hass",
",",
"mock_openzwave",
")",
":",
"# Create a mock node & node entity",
"node",
"=",
"MockNode",
"(",
"node_id",
"=",
"\"10\"",
",",
"name",
"=",
"\"Mock Node\"",
")",
"value",
"=",
"MockValue",
"(",
"data",
"=",
... | [
248,
0
] | [
292,
61
] | python | en | ['en', 'en', 'en'] | True |
test_node_discovery | (hass, mock_openzwave) | Test discovery of a node. | Test discovery of a node. | async def test_node_discovery(hass, mock_openzwave):
"""Test discovery of a node."""
mock_receivers = []
def mock_connect(receiver, signal, *args, **kwargs):
if signal == MockNetwork.SIGNAL_NODE_ADDED:
mock_receivers.append(receiver)
with patch("pydispatch.dispatcher.connect", new=... | [
"async",
"def",
"test_node_discovery",
"(",
"hass",
",",
"mock_openzwave",
")",
":",
"mock_receivers",
"=",
"[",
"]",
"def",
"mock_connect",
"(",
"receiver",
",",
"signal",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"signal",
"==",
"MockN... | [
295,
0
] | [
313,
64
] | python | en | ['en', 'en', 'en'] | True |
test_unparsed_node_discovery | (hass, mock_openzwave) | Test discovery of a node. | Test discovery of a node. | async def test_unparsed_node_discovery(hass, mock_openzwave):
"""Test discovery of a node."""
mock_receivers = []
def mock_connect(receiver, signal, *args, **kwargs):
if signal == MockNetwork.SIGNAL_NODE_ADDED:
mock_receivers.append(receiver)
with patch("pydispatch.dispatcher.conne... | [
"async",
"def",
"test_unparsed_node_discovery",
"(",
"hass",
",",
"mock_openzwave",
")",
":",
"mock_receivers",
"=",
"[",
"]",
"def",
"mock_connect",
"(",
"receiver",
",",
"signal",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"signal",
"==",... | [
316,
0
] | [
357,
70
] | python | en | ['en', 'en', 'en'] | True |
test_node_ignored | (hass, mock_openzwave) | Test discovery of a node. | Test discovery of a node. | async def test_node_ignored(hass, mock_openzwave):
"""Test discovery of a node."""
mock_receivers = []
def mock_connect(receiver, signal, *args, **kwargs):
if signal == MockNetwork.SIGNAL_NODE_ADDED:
mock_receivers.append(receiver)
with patch("pydispatch.dispatcher.connect", new=mo... | [
"async",
"def",
"test_node_ignored",
"(",
"hass",
",",
"mock_openzwave",
")",
":",
"mock_receivers",
"=",
"[",
"]",
"def",
"mock_connect",
"(",
"receiver",
",",
"signal",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"signal",
"==",
"MockNet... | [
360,
0
] | [
382,
53
] | python | en | ['en', 'en', 'en'] | True |
test_value_discovery | (hass, mock_openzwave) | Test discovery of a node. | Test discovery of a node. | async def test_value_discovery(hass, mock_openzwave):
"""Test discovery of a node."""
mock_receivers = []
def mock_connect(receiver, signal, *args, **kwargs):
if signal == MockNetwork.SIGNAL_VALUE_ADDED:
mock_receivers.append(receiver)
with patch("pydispatch.dispatcher.connect", ne... | [
"async",
"def",
"test_value_discovery",
"(",
"hass",
",",
"mock_openzwave",
")",
":",
"mock_receivers",
"=",
"[",
"]",
"def",
"mock_connect",
"(",
"receiver",
",",
"signal",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"signal",
"==",
"Mock... | [
385,
0
] | [
412,
79
] | python | en | ['en', 'en', 'en'] | True |
test_value_entities | (hass, mock_openzwave) | Test discovery of a node. | Test discovery of a node. | async def test_value_entities(hass, mock_openzwave):
"""Test discovery of a node."""
mock_receivers = {}
def mock_connect(receiver, signal, *args, **kwargs):
mock_receivers[signal] = receiver
with patch("pydispatch.dispatcher.connect", new=mock_connect):
await async_setup_component(has... | [
"async",
"def",
"test_value_entities",
"(",
"hass",
",",
"mock_openzwave",
")",
":",
"mock_receivers",
"=",
"{",
"}",
"def",
"mock_connect",
"(",
"receiver",
",",
"signal",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"mock_receivers",
"[",
"signal... | [
415,
0
] | [
577,
65
] | python | en | ['en', 'en', 'en'] | True |
test_value_discovery_existing_entity | (hass, mock_openzwave) | Test discovery of a node. | Test discovery of a node. | async def test_value_discovery_existing_entity(hass, mock_openzwave):
"""Test discovery of a node."""
mock_receivers = []
def mock_connect(receiver, signal, *args, **kwargs):
if signal == MockNetwork.SIGNAL_VALUE_ADDED:
mock_receivers.append(receiver)
with patch("pydispatch.dispatc... | [
"async",
"def",
"test_value_discovery_existing_entity",
"(",
"hass",
",",
"mock_openzwave",
")",
":",
"mock_receivers",
"=",
"[",
"]",
"def",
"mock_connect",
"(",
"receiver",
",",
"signal",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"signal",... | [
580,
0
] | [
660,
5
] | python | en | ['en', 'en', 'en'] | True |
test_value_discovery_legacy_thermostat | (hass, mock_openzwave) | Test discovery of a node. Special case for legacy thermostats. | Test discovery of a node. Special case for legacy thermostats. | async def test_value_discovery_legacy_thermostat(hass, mock_openzwave):
"""Test discovery of a node. Special case for legacy thermostats."""
mock_receivers = []
def mock_connect(receiver, signal, *args, **kwargs):
if signal == MockNetwork.SIGNAL_VALUE_ADDED:
mock_receivers.append(receiv... | [
"async",
"def",
"test_value_discovery_legacy_thermostat",
"(",
"hass",
",",
"mock_openzwave",
")",
":",
"mock_receivers",
"=",
"[",
"]",
"def",
"mock_connect",
"(",
"receiver",
",",
"signal",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"signal... | [
663,
0
] | [
696,
5
] | python | en | ['en', 'en', 'en'] | True |
test_power_schemes | (hass, mock_openzwave) | Test power attribute. | Test power attribute. | async def test_power_schemes(hass, mock_openzwave):
"""Test power attribute."""
mock_receivers = []
def mock_connect(receiver, signal, *args, **kwargs):
if signal == MockNetwork.SIGNAL_VALUE_ADDED:
mock_receivers.append(receiver)
with patch("pydispatch.dispatcher.connect", new=mock... | [
"async",
"def",
"test_power_schemes",
"(",
"hass",
",",
"mock_openzwave",
")",
":",
"mock_receivers",
"=",
"[",
"]",
"def",
"mock_connect",
"(",
"receiver",
",",
"signal",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"signal",
"==",
"MockNe... | [
699,
0
] | [
753,
5
] | python | en | ['en', 'de', 'en'] | True |
test_network_ready | (hass, mock_openzwave) | Test Node network ready event. | Test Node network ready event. | async def test_network_ready(hass, mock_openzwave):
"""Test Node network ready event."""
mock_receivers = []
def mock_connect(receiver, signal, *args, **kwargs):
if signal == MockNetwork.SIGNAL_ALL_NODES_QUERIED:
mock_receivers.append(receiver)
with patch("pydispatch.dispatcher.con... | [
"async",
"def",
"test_network_ready",
"(",
"hass",
",",
"mock_openzwave",
")",
":",
"mock_receivers",
"=",
"[",
"]",
"def",
"mock_connect",
"(",
"receiver",
",",
"signal",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"signal",
"==",
"MockNe... | [
756,
0
] | [
780,
27
] | python | en | ['en', 'lb', 'en'] | True |
test_network_complete | (hass, mock_openzwave) | Test Node network complete event. | Test Node network complete event. | async def test_network_complete(hass, mock_openzwave):
"""Test Node network complete event."""
mock_receivers = []
def mock_connect(receiver, signal, *args, **kwargs):
if signal == MockNetwork.SIGNAL_AWAKE_NODES_QUERIED:
mock_receivers.append(receiver)
with patch("pydispatch.dispat... | [
"async",
"def",
"test_network_complete",
"(",
"hass",
",",
"mock_openzwave",
")",
":",
"mock_receivers",
"=",
"[",
"]",
"def",
"mock_connect",
"(",
"receiver",
",",
"signal",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"signal",
"==",
"Moc... | [
783,
0
] | [
807,
27
] | python | da | ['et', 'da', 'en'] | False |
test_network_complete_some_dead | (hass, mock_openzwave) | Test Node network complete some dead event. | Test Node network complete some dead event. | async def test_network_complete_some_dead(hass, mock_openzwave):
"""Test Node network complete some dead event."""
mock_receivers = []
def mock_connect(receiver, signal, *args, **kwargs):
if signal == MockNetwork.SIGNAL_ALL_NODES_QUERIED_SOME_DEAD:
mock_receivers.append(receiver)
w... | [
"async",
"def",
"test_network_complete_some_dead",
"(",
"hass",
",",
"mock_openzwave",
")",
":",
"mock_receivers",
"=",
"[",
"]",
"def",
"mock_connect",
"(",
"receiver",
",",
"signal",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"signal",
"=... | [
810,
0
] | [
834,
27
] | python | en | ['no', 'en', 'en'] | True |
test_entity_discovery | (
hass, mock_discovery, mock_import_module, mock_values, mock_openzwave, zwave_setup
) | Test the creation of a new entity. | Test the creation of a new entity. | async def test_entity_discovery(
hass, mock_discovery, mock_import_module, mock_values, mock_openzwave, zwave_setup
):
"""Test the creation of a new entity."""
(node, value_class, mock_schema) = mock_values
registry = mock_registry(hass)
entity_id = "mock_component.mock_node_mock_value"
zwave_... | [
"async",
"def",
"test_entity_discovery",
"(",
"hass",
",",
"mock_discovery",
",",
"mock_import_module",
",",
"mock_values",
",",
"mock_openzwave",
",",
"zwave_setup",
")",
":",
"(",
"node",
",",
"value_class",
",",
"mock_schema",
")",
"=",
"mock_values",
"registry... | [
837,
0
] | [
913,
60
] | python | en | ['en', 'en', 'en'] | True |
test_entity_existing_values | (
hass, mock_discovery, mock_import_module, mock_values, mock_openzwave, zwave_setup
) | Test the loading of already discovered values. | Test the loading of already discovered values. | async def test_entity_existing_values(
hass, mock_discovery, mock_import_module, mock_values, mock_openzwave, zwave_setup
):
"""Test the loading of already discovered values."""
(node, value_class, mock_schema) = mock_values
registry = mock_registry(hass)
entity_id = "mock_component.mock_node_mock... | [
"async",
"def",
"test_entity_existing_values",
"(",
"hass",
",",
"mock_discovery",
",",
"mock_import_module",
",",
"mock_values",
",",
"mock_openzwave",
",",
"zwave_setup",
")",
":",
"(",
"node",
",",
"value_class",
",",
"mock_schema",
")",
"=",
"mock_values",
"re... | [
916,
0
] | [
967,
5
] | python | en | ['en', 'en', 'en'] | True |
test_node_schema_mismatch | (
hass, mock_discovery, mock_import_module, mock_values, mock_openzwave, zwave_setup
) | Test node schema mismatch. | Test node schema mismatch. | async def test_node_schema_mismatch(
hass, mock_discovery, mock_import_module, mock_values, mock_openzwave, zwave_setup
):
"""Test node schema mismatch."""
(node, value_class, mock_schema) = mock_values
registry = mock_registry(hass)
entity_id = "mock_component.mock_node_mock_value"
zwave_conf... | [
"async",
"def",
"test_node_schema_mismatch",
"(",
"hass",
",",
"mock_discovery",
",",
"mock_import_module",
",",
"mock_values",
",",
"mock_openzwave",
",",
"zwave_setup",
")",
":",
"(",
"node",
",",
"value_class",
",",
"mock_schema",
")",
"=",
"mock_values",
"regi... | [
970,
0
] | [
1003,
60
] | python | de | ['nl', 'de', 'en'] | False |
test_entity_workaround_component | (
hass, mock_discovery, mock_import_module, mock_values, mock_openzwave, zwave_setup
) | Test component workaround. | Test component workaround. | async def test_entity_workaround_component(
hass, mock_discovery, mock_import_module, mock_values, mock_openzwave, zwave_setup
):
"""Test component workaround."""
(node, value_class, mock_schema) = mock_values
registry = mock_registry(hass)
node.manufacturer_id = "010f"
node.product_type = "0b... | [
"async",
"def",
"test_entity_workaround_component",
"(",
"hass",
",",
"mock_discovery",
",",
"mock_import_module",
",",
"mock_values",
",",
"mock_openzwave",
",",
"zwave_setup",
")",
":",
"(",
"node",
",",
"value_class",
",",
"mock_schema",
")",
"=",
"mock_values",
... | [
1006,
0
] | [
1053,
51
] | python | de | ['nl', 'de', 'en'] | False |
test_entity_workaround_ignore | (
hass, mock_discovery, mock_import_module, mock_values, mock_openzwave, zwave_setup
) | Test ignore workaround. | Test ignore workaround. | async def test_entity_workaround_ignore(
hass, mock_discovery, mock_import_module, mock_values, mock_openzwave, zwave_setup
):
"""Test ignore workaround."""
(node, value_class, mock_schema) = mock_values
registry = mock_registry(hass)
entity_id = "mock_component.mock_node_mock_value"
zwave_con... | [
"async",
"def",
"test_entity_workaround_ignore",
"(",
"hass",
",",
"mock_discovery",
",",
"mock_import_module",
",",
"mock_values",
",",
"mock_openzwave",
",",
"zwave_setup",
")",
":",
"(",
"node",
",",
"value_class",
",",
"mock_schema",
")",
"=",
"mock_values",
"... | [
1056,
0
] | [
1095,
60
] | python | en | ['en', 'de', 'en'] | True |
test_entity_config_ignore | (
hass, mock_discovery, mock_import_module, mock_values, mock_openzwave, zwave_setup
) | Test ignore config. | Test ignore config. | async def test_entity_config_ignore(
hass, mock_discovery, mock_import_module, mock_values, mock_openzwave, zwave_setup
):
"""Test ignore config."""
(node, value_class, mock_schema) = mock_values
registry = mock_registry(hass)
entity_id = "mock_component.mock_node_mock_value"
zwave_config = {"... | [
"async",
"def",
"test_entity_config_ignore",
"(",
"hass",
",",
"mock_discovery",
",",
"mock_import_module",
",",
"mock_values",
",",
"mock_openzwave",
",",
"zwave_setup",
")",
":",
"(",
"node",
",",
"value_class",
",",
"mock_schema",
")",
"=",
"mock_values",
"regi... | [
1098,
0
] | [
1130,
60
] | python | en | ['en', 'la', 'en'] | True |
test_entity_config_ignore_with_registry | (
hass, mock_discovery, mock_import_module, mock_values, mock_openzwave, zwave_setup
) | Test ignore config.
The case when the device is in entity registry.
| Test ignore config. | async def test_entity_config_ignore_with_registry(
hass, mock_discovery, mock_import_module, mock_values, mock_openzwave, zwave_setup
):
"""Test ignore config.
The case when the device is in entity registry.
"""
(node, value_class, mock_schema) = mock_values
registry = mock_registry(hass)
... | [
"async",
"def",
"test_entity_config_ignore_with_registry",
"(",
"hass",
",",
"mock_discovery",
",",
"mock_import_module",
",",
"mock_values",
",",
"mock_openzwave",
",",
"zwave_setup",
")",
":",
"(",
"node",
",",
"value_class",
",",
"mock_schema",
")",
"=",
"mock_va... | [
1133,
0
] | [
1174,
60
] | python | en | ['en', 'la', 'en'] | True |
test_entity_platform_ignore | (
hass, mock_discovery, mock_import_module, mock_values, mock_openzwave, zwave_setup
) | Test platform ignore device. | Test platform ignore device. | async def test_entity_platform_ignore(
hass, mock_discovery, mock_import_module, mock_values, mock_openzwave, zwave_setup
):
"""Test platform ignore device."""
(node, value_class, mock_schema) = mock_values
registry = mock_registry(hass)
entity_id = "mock_component.mock_node_mock_value"
zwave_... | [
"async",
"def",
"test_entity_platform_ignore",
"(",
"hass",
",",
"mock_discovery",
",",
"mock_import_module",
",",
"mock_values",
",",
"mock_openzwave",
",",
"zwave_setup",
")",
":",
"(",
"node",
",",
"value_class",
",",
"mock_schema",
")",
"=",
"mock_values",
"re... | [
1177,
0
] | [
1212,
60
] | python | de | ['it', 'de', 'en'] | False |
test_config_polling_intensity | (
hass, mock_discovery, mock_import_module, mock_values, mock_openzwave, zwave_setup
) | Test polling intensity. | Test polling intensity. | async def test_config_polling_intensity(
hass, mock_discovery, mock_import_module, mock_values, mock_openzwave, zwave_setup
):
"""Test polling intensity."""
(node, value_class, mock_schema) = mock_values
registry = mock_registry(hass)
entity_id = "mock_component.mock_node_mock_value"
zwave_con... | [
"async",
"def",
"test_config_polling_intensity",
"(",
"hass",
",",
"mock_discovery",
",",
"mock_import_module",
",",
"mock_values",
",",
"mock_openzwave",
",",
"zwave_setup",
")",
":",
"(",
"node",
",",
"value_class",
",",
"mock_schema",
")",
"=",
"mock_values",
"... | [
1215,
0
] | [
1251,
69
] | python | en | ['en', 'jv', 'en'] | True |
test_device_config_glob_is_ordered | () | Test that device_config_glob preserves order. | Test that device_config_glob preserves order. | async def test_device_config_glob_is_ordered():
"""Test that device_config_glob preserves order."""
conf = CONFIG_SCHEMA({"zwave": {CONF_DEVICE_CONFIG_GLOB: OrderedDict()}})
assert isinstance(conf["zwave"][CONF_DEVICE_CONFIG_GLOB], OrderedDict) | [
"async",
"def",
"test_device_config_glob_is_ordered",
"(",
")",
":",
"conf",
"=",
"CONFIG_SCHEMA",
"(",
"{",
"\"zwave\"",
":",
"{",
"CONF_DEVICE_CONFIG_GLOB",
":",
"OrderedDict",
"(",
")",
"}",
"}",
")",
"assert",
"isinstance",
"(",
"conf",
"[",
"\"zwave\"",
"... | [
1254,
0
] | [
1257,
74
] | python | en | ['en', 'en', 'en'] | True |
test_add_node | (hass, mock_openzwave, zwave_setup_ready) | Test zwave add_node service. | Test zwave add_node service. | async def test_add_node(hass, mock_openzwave, zwave_setup_ready):
"""Test zwave add_node service."""
zwave_network = hass.data[DATA_NETWORK]
await hass.services.async_call("zwave", "add_node", {})
await hass.async_block_till_done()
assert zwave_network.controller.add_node.called
assert len(zwa... | [
"async",
"def",
"test_add_node",
"(",
"hass",
",",
"mock_openzwave",
",",
"zwave_setup_ready",
")",
":",
"zwave_network",
"=",
"hass",
".",
"data",
"[",
"DATA_NETWORK",
"]",
"await",
"hass",
".",
"services",
".",
"async_call",
"(",
"\"zwave\"",
",",
"\"add_nod... | [
1260,
0
] | [
1269,
71
] | python | de | ['pl', 'de', 'sw'] | False |
test_add_node_secure | (hass, mock_openzwave, zwave_setup_ready) | Test zwave add_node_secure service. | Test zwave add_node_secure service. | async def test_add_node_secure(hass, mock_openzwave, zwave_setup_ready):
"""Test zwave add_node_secure service."""
zwave_network = hass.data[DATA_NETWORK]
await hass.services.async_call("zwave", "add_node_secure", {})
await hass.async_block_till_done()
assert zwave_network.controller.add_node.call... | [
"async",
"def",
"test_add_node_secure",
"(",
"hass",
",",
"mock_openzwave",
",",
"zwave_setup_ready",
")",
":",
"zwave_network",
"=",
"hass",
".",
"data",
"[",
"DATA_NETWORK",
"]",
"await",
"hass",
".",
"services",
".",
"async_call",
"(",
"\"zwave\"",
",",
"\"... | [
1272,
0
] | [
1281,
72
] | python | da | ['pl', 'da', 'en'] | False |
test_remove_node | (hass, mock_openzwave, zwave_setup_ready) | Test zwave remove_node service. | Test zwave remove_node service. | async def test_remove_node(hass, mock_openzwave, zwave_setup_ready):
"""Test zwave remove_node service."""
zwave_network = hass.data[DATA_NETWORK]
await hass.services.async_call("zwave", "remove_node", {})
await hass.async_block_till_done()
assert zwave_network.controller.remove_node.called
as... | [
"async",
"def",
"test_remove_node",
"(",
"hass",
",",
"mock_openzwave",
",",
"zwave_setup_ready",
")",
":",
"zwave_network",
"=",
"hass",
".",
"data",
"[",
"DATA_NETWORK",
"]",
"await",
"hass",
".",
"services",
".",
"async_call",
"(",
"\"zwave\"",
",",
"\"remo... | [
1284,
0
] | [
1292,
68
] | python | de | ['pl', 'de', 'sw'] | False |
test_cancel_command | (hass, mock_openzwave, zwave_setup_ready) | Test zwave cancel_command service. | Test zwave cancel_command service. | async def test_cancel_command(hass, mock_openzwave, zwave_setup_ready):
"""Test zwave cancel_command service."""
zwave_network = hass.data[DATA_NETWORK]
await hass.services.async_call("zwave", "cancel_command", {})
await hass.async_block_till_done()
assert zwave_network.controller.cancel_command.c... | [
"async",
"def",
"test_cancel_command",
"(",
"hass",
",",
"mock_openzwave",
",",
"zwave_setup_ready",
")",
":",
"zwave_network",
"=",
"hass",
".",
"data",
"[",
"DATA_NETWORK",
"]",
"await",
"hass",
".",
"services",
".",
"async_call",
"(",
"\"zwave\"",
",",
"\"c... | [
1295,
0
] | [
1303,
71
] | python | de | ['de', 'de', 'en'] | True |
test_heal_network | (hass, mock_openzwave, zwave_setup_ready) | Test zwave heal_network service. | Test zwave heal_network service. | async def test_heal_network(hass, mock_openzwave, zwave_setup_ready):
"""Test zwave heal_network service."""
zwave_network = hass.data[DATA_NETWORK]
await hass.services.async_call("zwave", "heal_network", {})
await hass.async_block_till_done()
assert zwave_network.heal.called
assert len(zwave_... | [
"async",
"def",
"test_heal_network",
"(",
"hass",
",",
"mock_openzwave",
",",
"zwave_setup_ready",
")",
":",
"zwave_network",
"=",
"hass",
".",
"data",
"[",
"DATA_NETWORK",
"]",
"await",
"hass",
".",
"services",
".",
"async_call",
"(",
"\"zwave\"",
",",
"\"hea... | [
1306,
0
] | [
1314,
50
] | python | de | ['pl', 'de', 'it'] | False |
test_soft_reset | (hass, mock_openzwave, zwave_setup_ready) | Test zwave soft_reset service. | Test zwave soft_reset service. | async def test_soft_reset(hass, mock_openzwave, zwave_setup_ready):
"""Test zwave soft_reset service."""
zwave_network = hass.data[DATA_NETWORK]
await hass.services.async_call("zwave", "soft_reset", {})
await hass.async_block_till_done()
assert zwave_network.controller.soft_reset.called
assert... | [
"async",
"def",
"test_soft_reset",
"(",
"hass",
",",
"mock_openzwave",
",",
"zwave_setup_ready",
")",
":",
"zwave_network",
"=",
"hass",
".",
"data",
"[",
"DATA_NETWORK",
"]",
"await",
"hass",
".",
"services",
".",
"async_call",
"(",
"\"zwave\"",
",",
"\"soft_... | [
1317,
0
] | [
1325,
67
] | python | de | ['de', 'de', 'it'] | True |
test_test_network | (hass, mock_openzwave, zwave_setup_ready) | Test zwave test_network service. | Test zwave test_network service. | async def test_test_network(hass, mock_openzwave, zwave_setup_ready):
"""Test zwave test_network service."""
zwave_network = hass.data[DATA_NETWORK]
await hass.services.async_call("zwave", "test_network", {})
await hass.async_block_till_done()
assert zwave_network.test.called
assert len(zwave_... | [
"async",
"def",
"test_test_network",
"(",
"hass",
",",
"mock_openzwave",
",",
"zwave_setup_ready",
")",
":",
"zwave_network",
"=",
"hass",
".",
"data",
"[",
"DATA_NETWORK",
"]",
"await",
"hass",
".",
"services",
".",
"async_call",
"(",
"\"zwave\"",
",",
"\"tes... | [
1328,
0
] | [
1336,
50
] | python | de | ['pl', 'de', 'it'] | False |
test_stop_network | (hass, mock_openzwave, zwave_setup_ready) | Test zwave stop_network service. | Test zwave stop_network service. | async def test_stop_network(hass, mock_openzwave, zwave_setup_ready):
"""Test zwave stop_network service."""
zwave_network = hass.data[DATA_NETWORK]
with patch.object(hass.bus, "fire") as mock_fire:
await hass.services.async_call("zwave", "stop_network", {})
await hass.async_block_till_done... | [
"async",
"def",
"test_stop_network",
"(",
"hass",
",",
"mock_openzwave",
",",
"zwave_setup_ready",
")",
":",
"zwave_network",
"=",
"hass",
".",
"data",
"[",
"DATA_NETWORK",
"]",
"with",
"patch",
".",
"object",
"(",
"hass",
".",
"bus",
",",
"\"fire\"",
")",
... | [
1339,
0
] | [
1351,
72
] | python | de | ['pl', 'de', 'it'] | False |
test_rename_node | (hass, mock_openzwave, zwave_setup_ready) | Test zwave rename_node service. | Test zwave rename_node service. | async def test_rename_node(hass, mock_openzwave, zwave_setup_ready):
"""Test zwave rename_node service."""
zwave_network = hass.data[DATA_NETWORK]
zwave_network.nodes = {11: MagicMock()}
await hass.services.async_call(
"zwave",
"rename_node",
{const.ATTR_NODE_ID: 11, const.ATTR_... | [
"async",
"def",
"test_rename_node",
"(",
"hass",
",",
"mock_openzwave",
",",
"zwave_setup_ready",
")",
":",
"zwave_network",
"=",
"hass",
".",
"data",
"[",
"DATA_NETWORK",
"]",
"zwave_network",
".",
"nodes",
"=",
"{",
"11",
":",
"MagicMock",
"(",
")",
"}",
... | [
1354,
0
] | [
1366,
54
] | python | da | ['pl', 'da', 'sw'] | False |
test_rename_value | (hass, mock_openzwave, zwave_setup_ready) | Test zwave rename_value service. | Test zwave rename_value service. | async def test_rename_value(hass, mock_openzwave, zwave_setup_ready):
"""Test zwave rename_value service."""
zwave_network = hass.data[DATA_NETWORK]
node = MockNode(node_id=14)
value = MockValue(index=12, value_id=123456, label="Old Label")
node.values = {123456: value}
zwave_network.nodes = {1... | [
"async",
"def",
"test_rename_value",
"(",
"hass",
",",
"mock_openzwave",
",",
"zwave_setup_ready",
")",
":",
"zwave_network",
"=",
"hass",
".",
"data",
"[",
"DATA_NETWORK",
"]",
"node",
"=",
"MockNode",
"(",
"node_id",
"=",
"14",
")",
"value",
"=",
"MockValu... | [
1369,
0
] | [
1390,
37
] | python | da | ['pl', 'da', 'en'] | False |
test_set_poll_intensity_enable | (hass, mock_openzwave, zwave_setup_ready) | Test zwave set_poll_intensity service, successful set. | Test zwave set_poll_intensity service, successful set. | async def test_set_poll_intensity_enable(hass, mock_openzwave, zwave_setup_ready):
"""Test zwave set_poll_intensity service, successful set."""
zwave_network = hass.data[DATA_NETWORK]
node = MockNode(node_id=14)
value = MockValue(index=12, value_id=123456, poll_intensity=0)
node.values = {123456: v... | [
"async",
"def",
"test_set_poll_intensity_enable",
"(",
"hass",
",",
"mock_openzwave",
",",
"zwave_setup_ready",
")",
":",
"zwave_network",
"=",
"hass",
".",
"data",
"[",
"DATA_NETWORK",
"]",
"node",
"=",
"MockNode",
"(",
"node_id",
"=",
"14",
")",
"value",
"="... | [
1393,
0
] | [
1417,
47
] | python | de | ['pl', 'de', 'en'] | False |
test_set_poll_intensity_enable_failed | (
hass, mock_openzwave, zwave_setup_ready
) | Test zwave set_poll_intensity service, failed set. | Test zwave set_poll_intensity service, failed set. | async def test_set_poll_intensity_enable_failed(
hass, mock_openzwave, zwave_setup_ready
):
"""Test zwave set_poll_intensity service, failed set."""
zwave_network = hass.data[DATA_NETWORK]
node = MockNode(node_id=14)
value = MockValue(index=12, value_id=123456, poll_intensity=0)
value.enable_po... | [
"async",
"def",
"test_set_poll_intensity_enable_failed",
"(",
"hass",
",",
"mock_openzwave",
",",
"zwave_setup_ready",
")",
":",
"zwave_network",
"=",
"hass",
".",
"data",
"[",
"DATA_NETWORK",
"]",
"node",
"=",
"MockNode",
"(",
"node_id",
"=",
"14",
")",
"value"... | [
1420,
0
] | [
1446,
43
] | python | en | ['en', 'lb', 'en'] | True |
test_set_poll_intensity_disable | (hass, mock_openzwave, zwave_setup_ready) | Test zwave set_poll_intensity service, successful disable. | Test zwave set_poll_intensity service, successful disable. | async def test_set_poll_intensity_disable(hass, mock_openzwave, zwave_setup_ready):
"""Test zwave set_poll_intensity service, successful disable."""
zwave_network = hass.data[DATA_NETWORK]
node = MockNode(node_id=14)
value = MockValue(index=12, value_id=123456, poll_intensity=4)
node.values = {1234... | [
"async",
"def",
"test_set_poll_intensity_disable",
"(",
"hass",
",",
"mock_openzwave",
",",
"zwave_setup_ready",
")",
":",
"zwave_network",
"=",
"hass",
".",
"data",
"[",
"DATA_NETWORK",
"]",
"node",
"=",
"MockNode",
"(",
"node_id",
"=",
"14",
")",
"value",
"=... | [
1449,
0
] | [
1472,
44
] | python | en | ['en', 'en', 'en'] | True |
test_set_poll_intensity_disable_failed | (
hass, mock_openzwave, zwave_setup_ready
) | Test zwave set_poll_intensity service, failed disable. | Test zwave set_poll_intensity service, failed disable. | async def test_set_poll_intensity_disable_failed(
hass, mock_openzwave, zwave_setup_ready
):
"""Test zwave set_poll_intensity service, failed disable."""
zwave_network = hass.data[DATA_NETWORK]
node = MockNode(node_id=14)
value = MockValue(index=12, value_id=123456, poll_intensity=4)
value.disa... | [
"async",
"def",
"test_set_poll_intensity_disable_failed",
"(",
"hass",
",",
"mock_openzwave",
",",
"zwave_setup_ready",
")",
":",
"zwave_network",
"=",
"hass",
".",
"data",
"[",
"DATA_NETWORK",
"]",
"node",
"=",
"MockNode",
"(",
"node_id",
"=",
"14",
")",
"value... | [
1475,
0
] | [
1501,
44
] | python | en | ['en', 'en', 'en'] | True |
test_remove_failed_node | (hass, mock_openzwave, zwave_setup_ready) | Test zwave remove_failed_node service. | Test zwave remove_failed_node service. | async def test_remove_failed_node(hass, mock_openzwave, zwave_setup_ready):
"""Test zwave remove_failed_node service."""
zwave_network = hass.data[DATA_NETWORK]
await hass.services.async_call(
"zwave", "remove_failed_node", {const.ATTR_NODE_ID: 12}
)
await hass.async_block_till_done()
... | [
"async",
"def",
"test_remove_failed_node",
"(",
"hass",
",",
"mock_openzwave",
",",
"zwave_setup_ready",
")",
":",
"zwave_network",
"=",
"hass",
".",
"data",
"[",
"DATA_NETWORK",
"]",
"await",
"hass",
".",
"services",
".",
"async_call",
"(",
"\"zwave\"",
",",
... | [
1504,
0
] | [
1516,
55
] | python | de | ['de', 'fr', 'en'] | False |
test_replace_failed_node | (hass, mock_openzwave, zwave_setup_ready) | Test zwave replace_failed_node service. | Test zwave replace_failed_node service. | async def test_replace_failed_node(hass, mock_openzwave, zwave_setup_ready):
"""Test zwave replace_failed_node service."""
zwave_network = hass.data[DATA_NETWORK]
await hass.services.async_call(
"zwave", "replace_failed_node", {const.ATTR_NODE_ID: 13}
)
await hass.async_block_till_done()
... | [
"async",
"def",
"test_replace_failed_node",
"(",
"hass",
",",
"mock_openzwave",
",",
"zwave_setup_ready",
")",
":",
"zwave_network",
"=",
"hass",
".",
"data",
"[",
"DATA_NETWORK",
"]",
"await",
"hass",
".",
"services",
".",
"async_call",
"(",
"\"zwave\"",
",",
... | [
1519,
0
] | [
1531,
56
] | python | en | ['de', 'en', 'en'] | True |
test_set_config_parameter | (hass, mock_openzwave, zwave_setup_ready) | Test zwave set_config_parameter service. | Test zwave set_config_parameter service. | async def test_set_config_parameter(hass, mock_openzwave, zwave_setup_ready):
"""Test zwave set_config_parameter service."""
zwave_network = hass.data[DATA_NETWORK]
value_byte = MockValue(
index=12,
command_class=const.COMMAND_CLASS_CONFIGURATION,
type=const.TYPE_BYTE,
)
val... | [
"async",
"def",
"test_set_config_parameter",
"(",
"hass",
",",
"mock_openzwave",
",",
"zwave_setup_ready",
")",
":",
"zwave_network",
"=",
"hass",
".",
"data",
"[",
"DATA_NETWORK",
"]",
"value_byte",
"=",
"MockValue",
"(",
"index",
"=",
"12",
",",
"command_class... | [
1534,
0
] | [
1678,
38
] | python | da | ['de', 'da', 'en'] | False |
test_print_config_parameter | (hass, mock_openzwave, zwave_setup_ready, caplog) | Test zwave print_config_parameter service. | Test zwave print_config_parameter service. | async def test_print_config_parameter(hass, mock_openzwave, zwave_setup_ready, caplog):
"""Test zwave print_config_parameter service."""
zwave_network = hass.data[DATA_NETWORK]
value1 = MockValue(
index=12, command_class=const.COMMAND_CLASS_CONFIGURATION, data=1234
)
value2 = MockValue(
... | [
"async",
"def",
"test_print_config_parameter",
"(",
"hass",
",",
"mock_openzwave",
",",
"zwave_setup_ready",
",",
"caplog",
")",
":",
"zwave_network",
"=",
"hass",
".",
"data",
"[",
"DATA_NETWORK",
"]",
"value1",
"=",
"MockValue",
"(",
"index",
"=",
"12",
",",... | [
1681,
0
] | [
1704,
64
] | python | da | ['de', 'da', 'en'] | False |
test_print_node | (hass, mock_openzwave, zwave_setup_ready) | Test zwave print_node_parameter service. | Test zwave print_node_parameter service. | async def test_print_node(hass, mock_openzwave, zwave_setup_ready):
"""Test zwave print_node_parameter service."""
zwave_network = hass.data[DATA_NETWORK]
node = MockNode(node_id=14)
zwave_network.nodes = {14: node}
with patch.object(zwave, "_LOGGER") as mock_logger:
await hass.services.a... | [
"async",
"def",
"test_print_node",
"(",
"hass",
",",
"mock_openzwave",
",",
"zwave_setup_ready",
")",
":",
"zwave_network",
"=",
"hass",
".",
"data",
"[",
"DATA_NETWORK",
"]",
"node",
"=",
"MockNode",
"(",
"node_id",
"=",
"14",
")",
"zwave_network",
".",
"no... | [
1707,
0
] | [
1719,
68
] | python | de | ['de', 'lb', 'it'] | False |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.