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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
RaspyRFMSwitch.is_on | (self) | Return true if switch is on. | Return true if switch is on. | def is_on(self):
"""Return true if switch is on."""
return self._state | [
"def",
"is_on",
"(",
"self",
")",
":",
"return",
"self",
".",
"_state"
] | [
114,
4
] | [
116,
26
] | python | en | ['en', 'fy', 'en'] | True |
RaspyRFMSwitch.turn_on | (self, **kwargs) | Turn the switch on. | Turn the switch on. | def turn_on(self, **kwargs):
"""Turn the switch on."""
self._raspyrfm_client.send(self._gateway, self._controlunit, Action.ON)
self._state = True
self.schedule_update_ha_state() | [
"def",
"turn_on",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"_raspyrfm_client",
".",
"send",
"(",
"self",
".",
"_gateway",
",",
"self",
".",
"_controlunit",
",",
"Action",
".",
"ON",
")",
"self",
".",
"_state",
"=",
"True",
"self",... | [
118,
4
] | [
123,
39
] | python | en | ['en', 'en', 'en'] | True |
RaspyRFMSwitch.turn_off | (self, **kwargs) | Turn the switch off. | Turn the switch off. | def turn_off(self, **kwargs):
"""Turn the switch off."""
if Action.OFF in self._controlunit.get_supported_actions():
self._raspyrfm_client.send(self._gateway, self._controlunit, Action.OFF)
else:
self._raspyrfm_client.send(self._gateway, self._controlunit, Action.ON)
... | [
"def",
"turn_off",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"Action",
".",
"OFF",
"in",
"self",
".",
"_controlunit",
".",
"get_supported_actions",
"(",
")",
":",
"self",
".",
"_raspyrfm_client",
".",
"send",
"(",
"self",
".",
"_gateway",
"... | [
125,
4
] | [
134,
39
] | python | en | ['en', 'en', 'en'] | True |
async_setup_entry | (hass, entry, async_add_entities) | Set up the StarLine lock. | Set up the StarLine lock. | async def async_setup_entry(hass, entry, async_add_entities):
"""Set up the StarLine lock."""
account: StarlineAccount = hass.data[DOMAIN][entry.entry_id]
entities = []
for device in account.api.devices.values():
if device.support_state:
lock = StarlineLock(account, device)
... | [
"async",
"def",
"async_setup_entry",
"(",
"hass",
",",
"entry",
",",
"async_add_entities",
")",
":",
"account",
":",
"StarlineAccount",
"=",
"hass",
".",
"data",
"[",
"DOMAIN",
"]",
"[",
"entry",
".",
"entry_id",
"]",
"entities",
"=",
"[",
"]",
"for",
"d... | [
8,
0
] | [
18,
32
] | python | en | ['en', 'ja', 'en'] | True |
StarlineLock.__init__ | (self, account: StarlineAccount, device: StarlineDevice) | Initialize the lock. | Initialize the lock. | def __init__(self, account: StarlineAccount, device: StarlineDevice):
"""Initialize the lock."""
super().__init__(account, device, "lock", "Security") | [
"def",
"__init__",
"(",
"self",
",",
"account",
":",
"StarlineAccount",
",",
"device",
":",
"StarlineDevice",
")",
":",
"super",
"(",
")",
".",
"__init__",
"(",
"account",
",",
"device",
",",
"\"lock\"",
",",
"\"Security\"",
")"
] | [
24,
4
] | [
26,
61
] | python | en | ['en', 'en', 'en'] | True |
StarlineLock.available | (self) | Return True if entity is available. | Return True if entity is available. | def available(self):
"""Return True if entity is available."""
return super().available and self._device.online | [
"def",
"available",
"(",
"self",
")",
":",
"return",
"super",
"(",
")",
".",
"available",
"and",
"self",
".",
"_device",
".",
"online"
] | [
29,
4
] | [
31,
56
] | python | en | ['en', 'en', 'en'] | True |
StarlineLock.device_state_attributes | (self) | Return the state attributes of the lock.
Possible dictionary keys:
add_h - Additional sensor alarm status (high level)
add_l - Additional channel alarm status (low level)
door - Doors alarm status
hbrake - Hand brake alarm status
hijack - Hijack mode status
hood ... | Return the state attributes of the lock. | def device_state_attributes(self):
"""Return the state attributes of the lock.
Possible dictionary keys:
add_h - Additional sensor alarm status (high level)
add_l - Additional channel alarm status (low level)
door - Doors alarm status
hbrake - Hand brake alarm status
... | [
"def",
"device_state_attributes",
"(",
"self",
")",
":",
"return",
"self",
".",
"_device",
".",
"alarm_state"
] | [
34,
4
] | [
52,
39
] | python | en | ['en', 'en', 'en'] | True |
StarlineLock.icon | (self) | Icon to use in the frontend, if any. | Icon to use in the frontend, if any. | def icon(self):
"""Icon to use in the frontend, if any."""
return (
"mdi:shield-check-outline" if self.is_locked else "mdi:shield-alert-outline"
) | [
"def",
"icon",
"(",
"self",
")",
":",
"return",
"(",
"\"mdi:shield-check-outline\"",
"if",
"self",
".",
"is_locked",
"else",
"\"mdi:shield-alert-outline\"",
")"
] | [
55,
4
] | [
59,
9
] | python | en | ['en', 'en', 'en'] | True |
StarlineLock.is_locked | (self) | Return true if lock is locked. | Return true if lock is locked. | def is_locked(self):
"""Return true if lock is locked."""
return self._device.car_state.get("arm") | [
"def",
"is_locked",
"(",
"self",
")",
":",
"return",
"self",
".",
"_device",
".",
"car_state",
".",
"get",
"(",
"\"arm\"",
")"
] | [
62,
4
] | [
64,
48
] | python | en | ['en', 'mt', 'en'] | True |
StarlineLock.lock | (self, **kwargs) | Lock the car. | Lock the car. | def lock(self, **kwargs):
"""Lock the car."""
self._account.api.set_car_state(self._device.device_id, "arm", True) | [
"def",
"lock",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"_account",
".",
"api",
".",
"set_car_state",
"(",
"self",
".",
"_device",
".",
"device_id",
",",
"\"arm\"",
",",
"True",
")"
] | [
66,
4
] | [
68,
76
] | python | en | ['en', 'ms', 'en'] | True |
StarlineLock.unlock | (self, **kwargs) | Unlock the car. | Unlock the car. | def unlock(self, **kwargs):
"""Unlock the car."""
self._account.api.set_car_state(self._device.device_id, "arm", False) | [
"def",
"unlock",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"_account",
".",
"api",
".",
"set_car_state",
"(",
"self",
".",
"_device",
".",
"device_id",
",",
"\"arm\"",
",",
"False",
")"
] | [
70,
4
] | [
72,
77
] | python | en | ['en', 'ms', 'en'] | True |
setup_platform | (hass, config, add_entities, discovery_info=None) | Set up the Nest binary sensors.
No longer used.
| Set up the Nest binary sensors. | def setup_platform(hass, config, add_entities, discovery_info=None):
"""Set up the Nest binary sensors.
No longer used.
""" | [
"def",
"setup_platform",
"(",
"hass",
",",
"config",
",",
"add_entities",
",",
"discovery_info",
"=",
"None",
")",
":"
] | [
55,
0
] | [
59,
7
] | python | en | ['en', 'cs', 'en'] | True |
async_setup_entry | (hass, entry, async_add_entities) | Set up a Nest binary sensor based on a config entry. | Set up a Nest binary sensor based on a config entry. | async def async_setup_entry(hass, entry, async_add_entities):
"""Set up a Nest binary sensor based on a config entry."""
nest = hass.data[DATA_NEST]
discovery_info = hass.data.get(DATA_NEST_CONFIG, {}).get(CONF_BINARY_SENSORS, {})
# Add all available binary sensors if no Nest binary sensor config is s... | [
"async",
"def",
"async_setup_entry",
"(",
"hass",
",",
"entry",
",",
"async_add_entities",
")",
":",
"nest",
"=",
"hass",
".",
"data",
"[",
"DATA_NEST",
"]",
"discovery_info",
"=",
"hass",
".",
"data",
".",
"get",
"(",
"DATA_NEST_CONFIG",
",",
"{",
"}",
... | [
62,
0
] | [
119,
83
] | python | en | ['en', 'en', 'en'] | True |
NestBinarySensor.is_on | (self) | Return true if the binary sensor is on. | Return true if the binary sensor is on. | def is_on(self):
"""Return true if the binary sensor is on."""
return self._state | [
"def",
"is_on",
"(",
"self",
")",
":",
"return",
"self",
".",
"_state"
] | [
126,
4
] | [
128,
26
] | python | en | ['en', 'fy', 'en'] | True |
NestBinarySensor.device_class | (self) | Return the device class of the binary sensor. | Return the device class of the binary sensor. | def device_class(self):
"""Return the device class of the binary sensor."""
return _VALID_BINARY_SENSOR_TYPES.get(self.variable) | [
"def",
"device_class",
"(",
"self",
")",
":",
"return",
"_VALID_BINARY_SENSOR_TYPES",
".",
"get",
"(",
"self",
".",
"variable",
")"
] | [
131,
4
] | [
133,
60
] | python | en | ['en', 'tg', 'en'] | True |
NestBinarySensor.update | (self) | Retrieve latest state. | Retrieve latest state. | def update(self):
"""Retrieve latest state."""
value = getattr(self.device, self.variable)
if self.variable in STRUCTURE_BINARY_TYPES:
self._state = bool(STRUCTURE_BINARY_STATE_MAP[self.variable].get(value))
else:
self._state = bool(value) | [
"def",
"update",
"(",
"self",
")",
":",
"value",
"=",
"getattr",
"(",
"self",
".",
"device",
",",
"self",
".",
"variable",
")",
"if",
"self",
".",
"variable",
"in",
"STRUCTURE_BINARY_TYPES",
":",
"self",
".",
"_state",
"=",
"bool",
"(",
"STRUCTURE_BINARY... | [
135,
4
] | [
141,
37
] | python | en | ['es', 'sk', 'en'] | False |
NestActivityZoneSensor.__init__ | (self, structure, device, zone) | Initialize the sensor. | Initialize the sensor. | def __init__(self, structure, device, zone):
"""Initialize the sensor."""
super().__init__(structure, device, "")
self.zone = zone
self._name = f"{self._name} {self.zone.name} activity" | [
"def",
"__init__",
"(",
"self",
",",
"structure",
",",
"device",
",",
"zone",
")",
":",
"super",
"(",
")",
".",
"__init__",
"(",
"structure",
",",
"device",
",",
"\"\"",
")",
"self",
".",
"zone",
"=",
"zone",
"self",
".",
"_name",
"=",
"f\"{self._nam... | [
147,
4
] | [
151,
62
] | python | en | ['en', 'en', 'en'] | True |
NestActivityZoneSensor.unique_id | (self) | Return unique id based on camera serial and zone id. | Return unique id based on camera serial and zone id. | def unique_id(self):
"""Return unique id based on camera serial and zone id."""
return f"{self.device.serial}-{self.zone.zone_id}" | [
"def",
"unique_id",
"(",
"self",
")",
":",
"return",
"f\"{self.device.serial}-{self.zone.zone_id}\""
] | [
154,
4
] | [
156,
58
] | python | en | ['en', 'en', 'en'] | True |
NestActivityZoneSensor.device_class | (self) | Return the device class of the binary sensor. | Return the device class of the binary sensor. | def device_class(self):
"""Return the device class of the binary sensor."""
return DEVICE_CLASS_MOTION | [
"def",
"device_class",
"(",
"self",
")",
":",
"return",
"DEVICE_CLASS_MOTION"
] | [
159,
4
] | [
161,
34
] | python | en | ['en', 'tg', 'en'] | True |
NestActivityZoneSensor.update | (self) | Retrieve latest state. | Retrieve latest state. | def update(self):
"""Retrieve latest state."""
self._state = self.device.has_ongoing_motion_in_zone(self.zone.zone_id) | [
"def",
"update",
"(",
"self",
")",
":",
"self",
".",
"_state",
"=",
"self",
".",
"device",
".",
"has_ongoing_motion_in_zone",
"(",
"self",
".",
"zone",
".",
"zone_id",
")"
] | [
163,
4
] | [
165,
79
] | python | en | ['es', 'sk', 'en'] | False |
browse_media | (
entity_id, plex_server, media_content_type=None, media_content_id=None
) | Implement the websocket media browsing helper. | Implement the websocket media browsing helper. | def browse_media(
entity_id, plex_server, media_content_type=None, media_content_id=None
):
"""Implement the websocket media browsing helper."""
def build_item_response(payload):
"""Create response payload for the provided media query."""
media = plex_server.lookup_media(**payload)
... | [
"def",
"browse_media",
"(",
"entity_id",
",",
"plex_server",
",",
"media_content_type",
"=",
"None",
",",
"media_content_id",
"=",
"None",
")",
":",
"def",
"build_item_response",
"(",
"payload",
")",
":",
"\"\"\"Create response payload for the provided media query.\"\"\""... | [
54,
0
] | [
155,
19
] | python | en | ['en', 'af', 'en'] | True |
item_payload | (item) | Create response payload for a single media item. | Create response payload for a single media item. | def item_payload(item):
"""Create response payload for a single media item."""
try:
media_class = ITEM_TYPE_MEDIA_CLASS[item.type]
except KeyError as err:
_LOGGER.debug("Unknown type received: %s", item.type)
raise UnknownMediaType from err
payload = {
"title": item.title... | [
"def",
"item_payload",
"(",
"item",
")",
":",
"try",
":",
"media_class",
"=",
"ITEM_TYPE_MEDIA_CLASS",
"[",
"item",
".",
"type",
"]",
"except",
"KeyError",
"as",
"err",
":",
"_LOGGER",
".",
"debug",
"(",
"\"Unknown type received: %s\"",
",",
"item",
".",
"ty... | [
158,
0
] | [
176,
33
] | python | en | ['en', 'en', 'en'] | True |
library_section_payload | (section) | Create response payload for a single library section. | Create response payload for a single library section. | def library_section_payload(section):
"""Create response payload for a single library section."""
try:
children_media_class = ITEM_TYPE_MEDIA_CLASS[section.TYPE]
except KeyError as err:
_LOGGER.debug("Unknown type received: %s", section.TYPE)
raise UnknownMediaType from err
retur... | [
"def",
"library_section_payload",
"(",
"section",
")",
":",
"try",
":",
"children_media_class",
"=",
"ITEM_TYPE_MEDIA_CLASS",
"[",
"section",
".",
"TYPE",
"]",
"except",
"KeyError",
"as",
"err",
":",
"_LOGGER",
".",
"debug",
"(",
"\"Unknown type received: %s\"",
"... | [
179,
0
] | [
194,
5
] | python | en | ['en', 'en', 'en'] | True |
special_library_payload | (parent_payload, special_type) | Create response payload for special library folders. | Create response payload for special library folders. | def special_library_payload(parent_payload, special_type):
"""Create response payload for special library folders."""
title = f"{special_type} ({parent_payload.title})"
return BrowseMedia(
title=title,
media_class=parent_payload.media_class,
media_content_id=f"{parent_payload.media_c... | [
"def",
"special_library_payload",
"(",
"parent_payload",
",",
"special_type",
")",
":",
"title",
"=",
"f\"{special_type} ({parent_payload.title})\"",
"return",
"BrowseMedia",
"(",
"title",
"=",
"title",
",",
"media_class",
"=",
"parent_payload",
".",
"media_class",
",",... | [
197,
0
] | [
208,
5
] | python | en | ['en', 'en', 'en'] | True |
server_payload | (plex_server) | Create response payload to describe libraries of the Plex server. | Create response payload to describe libraries of the Plex server. | def server_payload(plex_server):
"""Create response payload to describe libraries of the Plex server."""
server_info = BrowseMedia(
title=plex_server.friendly_name,
media_class=MEDIA_CLASS_DIRECTORY,
media_content_id=plex_server.machine_identifier,
media_content_type="server",
... | [
"def",
"server_payload",
"(",
"plex_server",
")",
":",
"server_info",
"=",
"BrowseMedia",
"(",
"title",
"=",
"plex_server",
".",
"friendly_name",
",",
"media_class",
"=",
"MEDIA_CLASS_DIRECTORY",
",",
"media_content_id",
"=",
"plex_server",
".",
"machine_identifier",
... | [
211,
0
] | [
230,
22
] | python | en | ['en', 'en', 'en'] | True |
library_payload | (plex_server, library_id) | Create response payload to describe contents of a specific library. | Create response payload to describe contents of a specific library. | def library_payload(plex_server, library_id):
"""Create response payload to describe contents of a specific library."""
library = plex_server.library.sectionByID(library_id)
library_info = library_section_payload(library)
library_info.children = []
library_info.children.append(special_library_payloa... | [
"def",
"library_payload",
"(",
"plex_server",
",",
"library_id",
")",
":",
"library",
"=",
"plex_server",
".",
"library",
".",
"sectionByID",
"(",
"library_id",
")",
"library_info",
"=",
"library_section_payload",
"(",
"library",
")",
"library_info",
".",
"childre... | [
233,
0
] | [
247,
23
] | python | en | ['en', 'en', 'en'] | True |
playlists_payload | (plex_server) | Create response payload for all available playlists. | Create response payload for all available playlists. | def playlists_payload(plex_server):
"""Create response payload for all available playlists."""
playlists_info = {**PLAYLISTS_BROWSE_PAYLOAD, "children": []}
for playlist in plex_server.playlists():
try:
playlists_info["children"].append(item_payload(playlist))
except UnknownMedia... | [
"def",
"playlists_payload",
"(",
"plex_server",
")",
":",
"playlists_info",
"=",
"{",
"*",
"*",
"PLAYLISTS_BROWSE_PAYLOAD",
",",
"\"children\"",
":",
"[",
"]",
"}",
"for",
"playlist",
"in",
"plex_server",
".",
"playlists",
"(",
")",
":",
"try",
":",
"playlis... | [
250,
0
] | [
260,
19
] | python | en | ['en', 'en', 'en'] | True |
MedianstopAssessor._update_data | (self, trial_job_id, trial_history) | update data
Parameters
----------
trial_job_id : int
trial job id
trial_history : list
The history performance matrix of each trial
| update data | def _update_data(self, trial_job_id, trial_history):
"""update data
Parameters
----------
trial_job_id : int
trial job id
trial_history : list
The history performance matrix of each trial
"""
if trial_job_id not in self._running_history:
... | [
"def",
"_update_data",
"(",
"self",
",",
"trial_job_id",
",",
"trial_history",
")",
":",
"if",
"trial_job_id",
"not",
"in",
"self",
".",
"_running_history",
":",
"self",
".",
"_running_history",
"[",
"trial_job_id",
"]",
"=",
"[",
"]",
"self",
".",
"_running... | [
43,
4
] | [
55,
108
] | python | co | ['fr', 'co', 'sw'] | False |
MedianstopAssessor.trial_end | (self, trial_job_id, success) | trial_end
Parameters
----------
trial_job_id : int
trial job id
success : bool
True if succssfully finish the experiment, False otherwise
| trial_end | def trial_end(self, trial_job_id, success):
"""trial_end
Parameters
----------
trial_job_id : int
trial job id
success : bool
True if succssfully finish the experiment, False otherwise
"""
if trial_job_id in self._running_history:
... | [
"def",
"trial_end",
"(",
"self",
",",
"trial_job_id",
",",
"success",
")",
":",
"if",
"trial_job_id",
"in",
"self",
".",
"_running_history",
":",
"if",
"success",
":",
"cnt",
"=",
"0",
"history_sum",
"=",
"0",
"self",
".",
"_completed_avg_history",
"[",
"t... | [
57,
4
] | [
78,
87
] | python | en | ['en', 'en', 'en'] | False |
MedianstopAssessor.assess_trial | (self, trial_job_id, trial_history) | assess_trial
Parameters
----------
trial_job_id : int
trial job id
trial_history : list
The history performance matrix of each trial
Returns
-------
bool
AssessResult.Good or AssessResult.Bad
Raises
------
... | assess_trial | def assess_trial(self, trial_job_id, trial_history):
"""assess_trial
Parameters
----------
trial_job_id : int
trial job id
trial_history : list
The history performance matrix of each trial
Returns
-------
bool
AssessRe... | [
"def",
"assess_trial",
"(",
"self",
",",
"trial_job_id",
",",
"trial_history",
")",
":",
"curr_step",
"=",
"len",
"(",
"trial_history",
")",
"if",
"curr_step",
"<",
"self",
".",
"_start_step",
":",
"return",
"AssessResult",
".",
"Good",
"scalar_trial_history",
... | [
80,
4
] | [
124,
36
] | python | en | ['en', 'lb', 'en'] | False |
async_setup | (hass: HomeAssistant, config: dict) | Initialize basic config of ozw component. | Initialize basic config of ozw component. | async def async_setup(hass: HomeAssistant, config: dict):
"""Initialize basic config of ozw component."""
if "mqtt" not in hass.config.components:
_LOGGER.error("MQTT integration is not set up")
return False
hass.data[DOMAIN] = {}
return True | [
"async",
"def",
"async_setup",
"(",
"hass",
":",
"HomeAssistant",
",",
"config",
":",
"dict",
")",
":",
"if",
"\"mqtt\"",
"not",
"in",
"hass",
".",
"config",
".",
"components",
":",
"_LOGGER",
".",
"error",
"(",
"\"MQTT integration is not set up\"",
")",
"re... | [
54,
0
] | [
60,
15
] | python | en | ['en', 'en', 'en'] | True |
async_setup_entry | (hass: HomeAssistant, entry: ConfigEntry) | Set up ozw from a config entry. | Set up ozw from a config entry. | async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry):
"""Set up ozw from a config entry."""
ozw_data = hass.data[DOMAIN][entry.entry_id] = {}
ozw_data[DATA_UNSUBSCRIBE] = []
data_nodes = {}
data_values = {}
removed_nodes = []
@callback
def send_message(topic, payload):
... | [
"async",
"def",
"async_setup_entry",
"(",
"hass",
":",
"HomeAssistant",
",",
"entry",
":",
"ConfigEntry",
")",
":",
"ozw_data",
"=",
"hass",
".",
"data",
"[",
"DOMAIN",
"]",
"[",
"entry",
".",
"entry_id",
"]",
"=",
"{",
"}",
"ozw_data",
"[",
"DATA_UNSUBS... | [
63,
0
] | [
244,
15
] | python | en | ['en', 'en', 'en'] | True |
async_unload_entry | (hass: HomeAssistant, entry: ConfigEntry) | Unload a config entry. | Unload a config entry. | async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry):
"""Unload a config entry."""
# cleanup platforms
unload_ok = all(
await asyncio.gather(
*[
hass.config_entries.async_forward_entry_unload(entry, component)
for component in PLATFORMS
... | [
"async",
"def",
"async_unload_entry",
"(",
"hass",
":",
"HomeAssistant",
",",
"entry",
":",
"ConfigEntry",
")",
":",
"# cleanup platforms",
"unload_ok",
"=",
"all",
"(",
"await",
"asyncio",
".",
"gather",
"(",
"*",
"[",
"hass",
".",
"config_entries",
".",
"a... | [
247,
0
] | [
266,
15
] | python | en | ['en', 'es', 'en'] | True |
async_remove_entry | (hass: HomeAssistant, entry: ConfigEntry) | Remove a config entry. | Remove a config entry. | async def async_remove_entry(hass: HomeAssistant, entry: ConfigEntry) -> None:
"""Remove a config entry."""
if not entry.data.get(CONF_INTEGRATION_CREATED_ADDON):
return
try:
await hass.components.hassio.async_stop_addon("core_zwave")
except HassioAPIError as err:
_LOGGER.error(... | [
"async",
"def",
"async_remove_entry",
"(",
"hass",
":",
"HomeAssistant",
",",
"entry",
":",
"ConfigEntry",
")",
"->",
"None",
":",
"if",
"not",
"entry",
".",
"data",
".",
"get",
"(",
"CONF_INTEGRATION_CREATED_ADDON",
")",
":",
"return",
"try",
":",
"await",
... | [
269,
0
] | [
282,
74
] | python | en | ['en', 'gl', 'en'] | True |
async_handle_remove_node | (hass: HomeAssistant, node: OZWNode) | Handle the removal of a Z-Wave node, removing all traces in device/entity registry. | Handle the removal of a Z-Wave node, removing all traces in device/entity registry. | async def async_handle_remove_node(hass: HomeAssistant, node: OZWNode):
"""Handle the removal of a Z-Wave node, removing all traces in device/entity registry."""
dev_registry = await get_dev_reg(hass)
# grab device in device registry attached to this node
dev_id = create_device_id(node)
device = dev... | [
"async",
"def",
"async_handle_remove_node",
"(",
"hass",
":",
"HomeAssistant",
",",
"node",
":",
"OZWNode",
")",
":",
"dev_registry",
"=",
"await",
"get_dev_reg",
"(",
"hass",
")",
"# grab device in device registry attached to this node",
"dev_id",
"=",
"create_device_i... | [
285,
0
] | [
301,
48
] | python | en | ['en', 'en', 'en'] | True |
async_handle_node_update | (hass: HomeAssistant, node: OZWNode) |
Handle a node updated event from OZW.
Meaning some of the basic info like name/model is updated.
We want these changes to be pushed to the device registry.
|
Handle a node updated event from OZW. | async def async_handle_node_update(hass: HomeAssistant, node: OZWNode):
"""
Handle a node updated event from OZW.
Meaning some of the basic info like name/model is updated.
We want these changes to be pushed to the device registry.
"""
dev_registry = await get_dev_reg(hass)
# grab device in... | [
"async",
"def",
"async_handle_node_update",
"(",
"hass",
":",
"HomeAssistant",
",",
"node",
":",
"OZWNode",
")",
":",
"dev_registry",
"=",
"await",
"get_dev_reg",
"(",
"hass",
")",
"# grab device in device registry attached to this node",
"dev_id",
"=",
"create_device_i... | [
304,
0
] | [
327,
9
] | python | en | ['en', 'error', 'th'] | False |
async_handle_scene_activated | (hass: HomeAssistant, scene_value: OZWValue) | Handle a (central) scene activation message. | Handle a (central) scene activation message. | def async_handle_scene_activated(hass: HomeAssistant, scene_value: OZWValue):
"""Handle a (central) scene activation message."""
node_id = scene_value.node.id
scene_id = scene_value.index
scene_label = scene_value.label
if scene_value.command_class == CommandClass.SCENE_ACTIVATION:
# legacy/... | [
"def",
"async_handle_scene_activated",
"(",
"hass",
":",
"HomeAssistant",
",",
"scene_value",
":",
"OZWValue",
")",
":",
"node_id",
"=",
"scene_value",
".",
"node",
".",
"id",
"scene_id",
"=",
"scene_value",
".",
"index",
"scene_label",
"=",
"scene_value",
".",
... | [
331,
0
] | [
363,
5
] | python | en | ['it', 'en', 'en'] | True |
split_text_in_lines | (text, max_len, prefix="", min_indent=None) |
Split `text` in the biggest lines possible with the constraint of `max_len` using `prefix` on the first line and
then indenting with the same length as `prefix`.
|
Split `text` in the biggest lines possible with the constraint of `max_len` using `prefix` on the first line and
then indenting with the same length as `prefix`.
| def split_text_in_lines(text, max_len, prefix="", min_indent=None):
"""
Split `text` in the biggest lines possible with the constraint of `max_len` using `prefix` on the first line and
then indenting with the same length as `prefix`.
"""
text = re.sub(r"\s+", " ", text)
indent = " " * len(prefix... | [
"def",
"split_text_in_lines",
"(",
"text",
",",
"max_len",
",",
"prefix",
"=",
"\"\"",
",",
"min_indent",
"=",
"None",
")",
":",
"text",
"=",
"re",
".",
"sub",
"(",
"r\"\\s+\"",
",",
"\" \"",
",",
"text",
")",
"indent",
"=",
"\" \"",
"*",
"len",
"(",... | [
73,
0
] | [
96,
31
] | python | en | ['en', 'error', 'th'] | False |
get_indent | (line) | Get the indentation of `line`. | Get the indentation of `line`. | def get_indent(line):
"""Get the indentation of `line`."""
indent_search = _re_indent.search(line)
return indent_search.groups()[0] if indent_search is not None else "" | [
"def",
"get_indent",
"(",
"line",
")",
":",
"indent_search",
"=",
"_re_indent",
".",
"search",
"(",
"line",
")",
"return",
"indent_search",
".",
"groups",
"(",
")",
"[",
"0",
"]",
"if",
"indent_search",
"is",
"not",
"None",
"else",
"\"\""
] | [
99,
0
] | [
102,
73
] | python | en | ['en', 'da', 'en'] | True |
_add_new_lines_before_list | (text) | Add a new empty line before a list begins. | Add a new empty line before a list begins. | def _add_new_lines_before_list(text):
"""Add a new empty line before a list begins."""
lines = text.split("\n")
new_lines = []
in_list = False
for idx, line in enumerate(lines):
# Detect if the line is the start of a new list.
if _re_list.search(line) is not None and not in_list:
... | [
"def",
"_add_new_lines_before_list",
"(",
"text",
")",
":",
"lines",
"=",
"text",
".",
"split",
"(",
"\"\\n\"",
")",
"new_lines",
"=",
"[",
"]",
"in_list",
"=",
"False",
"for",
"idx",
",",
"line",
"in",
"enumerate",
"(",
"lines",
")",
":",
"# Detect if t... | [
376,
0
] | [
393,
31
] | python | en | ['en', 'en', 'en'] | True |
style_rst_file | (doc_file, max_len=119, check_only=False) | Style one rst file `doc_file` to `max_len`. | Style one rst file `doc_file` to `max_len`. | def style_rst_file(doc_file, max_len=119, check_only=False):
""" Style one rst file `doc_file` to `max_len`."""
with open(doc_file, "r", encoding="utf-8", newline="\n") as f:
doc = f.read()
# Add missing new lines before lists
clean_doc = _add_new_lines_before_list(doc)
# Style
clean_do... | [
"def",
"style_rst_file",
"(",
"doc_file",
",",
"max_len",
"=",
"119",
",",
"check_only",
"=",
"False",
")",
":",
"with",
"open",
"(",
"doc_file",
",",
"\"r\"",
",",
"encoding",
"=",
"\"utf-8\"",
",",
"newline",
"=",
"\"\\n\"",
")",
"as",
"f",
":",
"doc... | [
409,
0
] | [
425,
15
] | python | en | ['en', 'en', 'ur'] | True |
style_docstring | (docstring, max_len=119) | Style `docstring` to `max_len`. | Style `docstring` to `max_len`. | def style_docstring(docstring, max_len=119):
"""Style `docstring` to `max_len`."""
# One-line docstring that are not too long are left as is.
if len(docstring) < max_len and "\n" not in docstring:
return docstring
# Grab the indent from the last line
last_line = docstring.split("\n")[-1]
... | [
"def",
"style_docstring",
"(",
"docstring",
",",
"max_len",
"=",
"119",
")",
":",
"# One-line docstring that are not too long are left as is.",
"if",
"len",
"(",
"docstring",
")",
"<",
"max_len",
"and",
"\"\\n\"",
"not",
"in",
"docstring",
":",
"return",
"docstring"... | [
428,
0
] | [
459,
30
] | python | en | ['en', 'en', 'en'] | True |
style_file_docstrings | (code_file, max_len=119, check_only=False) | Style all docstrings in `code_file` to `max_len`. | Style all docstrings in `code_file` to `max_len`. | def style_file_docstrings(code_file, max_len=119, check_only=False):
"""Style all docstrings in `code_file` to `max_len`."""
with open(code_file, "r", encoding="utf-8", newline="\n") as f:
code = f.read()
splits = code.split('"""')
splits = [
(s if i % 2 == 0 or _re_doc_ignore.search(spl... | [
"def",
"style_file_docstrings",
"(",
"code_file",
",",
"max_len",
"=",
"119",
",",
"check_only",
"=",
"False",
")",
":",
"with",
"open",
"(",
"code_file",
",",
"\"r\"",
",",
"encoding",
"=",
"\"utf-8\"",
",",
"newline",
"=",
"\"\\n\"",
")",
"as",
"f",
":... | [
462,
0
] | [
479,
15
] | python | en | ['en', 'en', 'nl'] | True |
style_doc_files | (*files, max_len=119, check_only=False) |
Style all `files` to `max_len` and fixes mistakes if not `check_only`, otherwise raises an error if styling should
be done.
|
Style all `files` to `max_len` and fixes mistakes if not `check_only`, otherwise raises an error if styling should
be done.
| def style_doc_files(*files, max_len=119, check_only=False):
"""
Style all `files` to `max_len` and fixes mistakes if not `check_only`, otherwise raises an error if styling should
be done.
"""
changed = []
for file in files:
# Treat folders
if os.path.isdir(file):
file... | [
"def",
"style_doc_files",
"(",
"*",
"files",
",",
"max_len",
"=",
"119",
",",
"check_only",
"=",
"False",
")",
":",
"changed",
"=",
"[",
"]",
"for",
"file",
"in",
"files",
":",
"# Treat folders",
"if",
"os",
".",
"path",
".",
"isdir",
"(",
"file",
")... | [
482,
0
] | [
504,
18
] | python | en | ['en', 'error', 'th'] | False |
CodeStyler.is_no_style_block | (self, line) | Whether or not `line` introduces a block where styling should be ignore | Whether or not `line` introduces a block where styling should be ignore | def is_no_style_block(self, line):
"""Whether or not `line` introduces a block where styling should be ignore"""
if _re_code_block.search(line) is not None:
return True
if _re_textual_blocks.search(line) is not None:
return False
return _re_ignore.search(line) is ... | [
"def",
"is_no_style_block",
"(",
"self",
",",
"line",
")",
":",
"if",
"_re_code_block",
".",
"search",
"(",
"line",
")",
"is",
"not",
"None",
":",
"return",
"True",
"if",
"_re_textual_blocks",
".",
"search",
"(",
"line",
")",
"is",
"not",
"None",
":",
... | [
108,
4
] | [
114,
50
] | python | en | ['en', 'en', 'en'] | True |
CodeStyler.is_comment_or_textual_block | (self, line) | Whether or not `line` introduces a block where styling should not be ignored (note, warnings...) | Whether or not `line` introduces a block where styling should not be ignored (note, warnings...) | def is_comment_or_textual_block(self, line):
"""Whether or not `line` introduces a block where styling should not be ignored (note, warnings...)"""
if _re_comment.search(line):
return True
return _re_textual_blocks.search(line) is not None | [
"def",
"is_comment_or_textual_block",
"(",
"self",
",",
"line",
")",
":",
"if",
"_re_comment",
".",
"search",
"(",
"line",
")",
":",
"return",
"True",
"return",
"_re_textual_blocks",
".",
"search",
"(",
"line",
")",
"is",
"not",
"None"
] | [
116,
4
] | [
120,
58
] | python | en | ['en', 'en', 'en'] | True |
CodeStyler.is_special_block | (self, line) | Whether or not `line` introduces a special block. | Whether or not `line` introduces a special block. | def is_special_block(self, line):
"""Whether or not `line` introduces a special block."""
if self.is_no_style_block(line):
self.in_block = SpecialBlock.NO_STYLE
return True
return False | [
"def",
"is_special_block",
"(",
"self",
",",
"line",
")",
":",
"if",
"self",
".",
"is_no_style_block",
"(",
"line",
")",
":",
"self",
".",
"in_block",
"=",
"SpecialBlock",
".",
"NO_STYLE",
"return",
"True",
"return",
"False"
] | [
122,
4
] | [
127,
20
] | python | en | ['en', 'en', 'en'] | True |
CodeStyler.init_in_block | (self, text) |
Returns the initial value for `self.in_block`.
Useful for some docstrings beginning inside an argument declaration block (all models).
|
Returns the initial value for `self.in_block`. | def init_in_block(self, text):
"""
Returns the initial value for `self.in_block`.
Useful for some docstrings beginning inside an argument declaration block (all models).
"""
return SpecialBlock.NOT_SPECIAL | [
"def",
"init_in_block",
"(",
"self",
",",
"text",
")",
":",
"return",
"SpecialBlock",
".",
"NOT_SPECIAL"
] | [
129,
4
] | [
135,
39
] | python | en | ['en', 'error', 'th'] | False |
CodeStyler.end_of_special_style | (self, line) |
Sets back the `in_block` attribute to `NOT_SPECIAL`.
Useful for some docstrings where we may have to go back to `ARG_LIST` instead.
|
Sets back the `in_block` attribute to `NOT_SPECIAL`. | def end_of_special_style(self, line):
"""
Sets back the `in_block` attribute to `NOT_SPECIAL`.
Useful for some docstrings where we may have to go back to `ARG_LIST` instead.
"""
self.in_block = SpecialBlock.NOT_SPECIAL | [
"def",
"end_of_special_style",
"(",
"self",
",",
"line",
")",
":",
"self",
".",
"in_block",
"=",
"SpecialBlock",
".",
"NOT_SPECIAL"
] | [
137,
4
] | [
143,
48
] | python | en | ['en', 'error', 'th'] | False |
CodeStyler.style_paragraph | (self, paragraph, max_len, no_style=False, min_indent=None) |
Style `paragraph` (a list of lines) by making sure no line goes over `max_len`, except if the `no_style` flag
is passed.
|
Style `paragraph` (a list of lines) by making sure no line goes over `max_len`, except if the `no_style` flag
is passed.
| def style_paragraph(self, paragraph, max_len, no_style=False, min_indent=None):
"""
Style `paragraph` (a list of lines) by making sure no line goes over `max_len`, except if the `no_style` flag
is passed.
"""
if len(paragraph) == 0:
return ""
if no_style or se... | [
"def",
"style_paragraph",
"(",
"self",
",",
"paragraph",
",",
"max_len",
",",
"no_style",
"=",
"False",
",",
"min_indent",
"=",
"None",
")",
":",
"if",
"len",
"(",
"paragraph",
")",
"==",
"0",
":",
"return",
"\"\"",
"if",
"no_style",
"or",
"self",
".",... | [
145,
4
] | [
223,
80
] | python | en | ['en', 'error', 'th'] | False |
CodeStyler.style | (self, text, max_len=119, min_indent=None) | Style `text` to `max_len`. | Style `text` to `max_len`. | def style(self, text, max_len=119, min_indent=None):
"""Style `text` to `max_len`."""
new_lines = []
paragraph = []
self.current_indent = ""
self.previous_indent = None
# If one of those is True, the paragraph should not be touched (code samples, lists...)
no_styl... | [
"def",
"style",
"(",
"self",
",",
"text",
",",
"max_len",
"=",
"119",
",",
"min_indent",
"=",
"None",
")",
":",
"new_lines",
"=",
"[",
"]",
"paragraph",
"=",
"[",
"]",
"self",
".",
"current_indent",
"=",
"\"\"",
"self",
".",
"previous_indent",
"=",
"... | [
225,
4
] | [
316,
35
] | python | en | ['en', 'en', 'en'] | True |
test_show_form | (hass: HomeAssistant) | Test that the setup form is served. | Test that the setup form is served. | async def test_show_form(hass: HomeAssistant) -> None:
"""Test that the setup form is served."""
result = await hass.config_entries.flow.async_init(
DOMAIN, context={"source": config_entries.SOURCE_USER}
)
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
assert result["step_id"] ==... | [
"async",
"def",
"test_show_form",
"(",
"hass",
":",
"HomeAssistant",
")",
"->",
"None",
":",
"result",
"=",
"await",
"hass",
".",
"config_entries",
".",
"flow",
".",
"async_init",
"(",
"DOMAIN",
",",
"context",
"=",
"{",
"\"source\"",
":",
"config_entries",
... | [
13,
0
] | [
20,
38
] | python | en | ['en', 'en', 'en'] | True |
test_authorization_error | (hass: HomeAssistant) | Test we show user form on connection error. | Test we show user form on connection error. | async def test_authorization_error(hass: HomeAssistant) -> None:
"""Test we show user form on connection error."""
result = await hass.config_entries.flow.async_init(
DOMAIN, context={"source": config_entries.SOURCE_USER}
)
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
assert re... | [
"async",
"def",
"test_authorization_error",
"(",
"hass",
":",
"HomeAssistant",
")",
"->",
"None",
":",
"result",
"=",
"await",
"hass",
".",
"config_entries",
".",
"flow",
".",
"async_init",
"(",
"DOMAIN",
",",
"context",
"=",
"{",
"\"source\"",
":",
"config_... | [
23,
0
] | [
43,
56
] | python | en | ['en', 'en', 'en'] | True |
test_connection_error | (hass: HomeAssistant) | Test we show user form on connection error. | Test we show user form on connection error. | async def test_connection_error(hass: HomeAssistant) -> None:
"""Test we show user form on connection error."""
result = await hass.config_entries.flow.async_init(
DOMAIN, context={"source": config_entries.SOURCE_USER}
)
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
assert resul... | [
"async",
"def",
"test_connection_error",
"(",
"hass",
":",
"HomeAssistant",
")",
"->",
"None",
":",
"result",
"=",
"await",
"hass",
".",
"config_entries",
".",
"flow",
".",
"async_init",
"(",
"DOMAIN",
",",
"context",
"=",
"{",
"\"source\"",
":",
"config_ent... | [
46,
0
] | [
66,
58
] | python | en | ['en', 'en', 'en'] | True |
test_full_flow_implementation | (hass: HomeAssistant) | Test registering an integration and finishing flow works. | Test registering an integration and finishing flow works. | async def test_full_flow_implementation(hass: HomeAssistant) -> None:
"""Test registering an integration and finishing flow works."""
result = await hass.config_entries.flow.async_init(
DOMAIN, context={"source": config_entries.SOURCE_USER}
)
assert result["type"] == data_entry_flow.RESULT_TYPE... | [
"async",
"def",
"test_full_flow_implementation",
"(",
"hass",
":",
"HomeAssistant",
")",
"->",
"None",
":",
"result",
"=",
"await",
"hass",
".",
"config_entries",
".",
"flow",
".",
"async_init",
"(",
"DOMAIN",
",",
"context",
"=",
"{",
"\"source\"",
":",
"co... | [
69,
0
] | [
95,
78
] | python | en | ['en', 'en', 'en'] | True |
async_setup_entry | (
hass, config_entry, async_add_entities, discovery_info=None
) | Set up the Agent cameras. | Set up the Agent cameras. | async def async_setup_entry(
hass, config_entry, async_add_entities, discovery_info=None
):
"""Set up the Agent cameras."""
filter_urllib3_logging()
cameras = []
server = hass.data[AGENT_DOMAIN][config_entry.entry_id][CONNECTION]
if not server.devices:
_LOGGER.warning("Could not fetch c... | [
"async",
"def",
"async_setup_entry",
"(",
"hass",
",",
"config_entry",
",",
"async_add_entities",
",",
"discovery_info",
"=",
"None",
")",
":",
"filter_urllib3_logging",
"(",
")",
"cameras",
"=",
"[",
"]",
"server",
"=",
"hass",
".",
"data",
"[",
"AGENT_DOMAIN... | [
42,
0
] | [
63,
67
] | python | en | ['en', 'pt', 'en'] | True |
AgentCamera.__init__ | (self, device) | Initialize as a subclass of MjpegCamera. | Initialize as a subclass of MjpegCamera. | def __init__(self, device):
"""Initialize as a subclass of MjpegCamera."""
self._servername = device.client.name
self.server_url = device.client._server_url
device_info = {
CONF_NAME: device.name,
CONF_MJPEG_URL: f"{self.server_url}{device.mjpeg_image_url}&size={... | [
"def",
"__init__",
"(",
"self",
",",
"device",
")",
":",
"self",
".",
"_servername",
"=",
"device",
".",
"client",
".",
"name",
"self",
".",
"server_url",
"=",
"device",
".",
"client",
".",
"_server_url",
"device_info",
"=",
"{",
"CONF_NAME",
":",
"devic... | [
69,
4
] | [
83,
37
] | python | en | ['en', 'en', 'en'] | True |
AgentCamera.device_info | (self) | Return the device info for adding the entity to the agent object. | Return the device info for adding the entity to the agent object. | def device_info(self):
"""Return the device info for adding the entity to the agent object."""
return {
"identifiers": {(AGENT_DOMAIN, self._unique_id)},
"name": self._name,
"manufacturer": "Agent",
"model": "Camera",
"sw_version": self.device.... | [
"def",
"device_info",
"(",
"self",
")",
":",
"return",
"{",
"\"identifiers\"",
":",
"{",
"(",
"AGENT_DOMAIN",
",",
"self",
".",
"_unique_id",
")",
"}",
",",
"\"name\"",
":",
"self",
".",
"_name",
",",
"\"manufacturer\"",
":",
"\"Agent\"",
",",
"\"model\"",... | [
86,
4
] | [
94,
9
] | python | en | ['en', 'en', 'en'] | True |
AgentCamera.async_update | (self) | Update our state from the Agent API. | Update our state from the Agent API. | async def async_update(self):
"""Update our state from the Agent API."""
try:
await self.device.update()
if self._removed:
_LOGGER.debug("%s reacquired", self._name)
self._removed = False
except AgentError:
if self.device.client.is_... | [
"async",
"def",
"async_update",
"(",
"self",
")",
":",
"try",
":",
"await",
"self",
".",
"device",
".",
"update",
"(",
")",
"if",
"self",
".",
"_removed",
":",
"_LOGGER",
".",
"debug",
"(",
"\"%s reacquired\"",
",",
"self",
".",
"_name",
")",
"self",
... | [
96,
4
] | [
107,
40
] | python | en | ['en', 'en', 'en'] | True |
AgentCamera.device_state_attributes | (self) | Return the Agent DVR camera state attributes. | Return the Agent DVR camera state attributes. | def device_state_attributes(self):
"""Return the Agent DVR camera state attributes."""
return {
ATTR_ATTRIBUTION: ATTRIBUTION,
"editable": False,
"enabled": self.is_on,
"connected": self.connected,
"detected": self.is_detected,
"ale... | [
"def",
"device_state_attributes",
"(",
"self",
")",
":",
"return",
"{",
"ATTR_ATTRIBUTION",
":",
"ATTRIBUTION",
",",
"\"editable\"",
":",
"False",
",",
"\"enabled\"",
":",
"self",
".",
"is_on",
",",
"\"connected\"",
":",
"self",
".",
"connected",
",",
"\"detec... | [
110,
4
] | [
121,
9
] | python | en | ['en', 'en', 'en'] | True |
AgentCamera.should_poll | (self) | Update the state periodically. | Update the state periodically. | def should_poll(self) -> bool:
"""Update the state periodically."""
return True | [
"def",
"should_poll",
"(",
"self",
")",
"->",
"bool",
":",
"return",
"True"
] | [
124,
4
] | [
126,
19
] | python | en | ['en', 'en', 'en'] | True |
AgentCamera.is_recording | (self) | Return whether the monitor is recording. | Return whether the monitor is recording. | def is_recording(self) -> bool:
"""Return whether the monitor is recording."""
return self.device.recording | [
"def",
"is_recording",
"(",
"self",
")",
"->",
"bool",
":",
"return",
"self",
".",
"device",
".",
"recording"
] | [
129,
4
] | [
131,
36
] | python | en | ['en', 'en', 'en'] | True |
AgentCamera.is_alerted | (self) | Return whether the monitor has alerted. | Return whether the monitor has alerted. | def is_alerted(self) -> bool:
"""Return whether the monitor has alerted."""
return self.device.alerted | [
"def",
"is_alerted",
"(",
"self",
")",
"->",
"bool",
":",
"return",
"self",
".",
"device",
".",
"alerted"
] | [
134,
4
] | [
136,
34
] | python | en | ['en', 'en', 'en'] | True |
AgentCamera.is_detected | (self) | Return whether the monitor has alerted. | Return whether the monitor has alerted. | def is_detected(self) -> bool:
"""Return whether the monitor has alerted."""
return self.device.detected | [
"def",
"is_detected",
"(",
"self",
")",
"->",
"bool",
":",
"return",
"self",
".",
"device",
".",
"detected"
] | [
139,
4
] | [
141,
35
] | python | en | ['en', 'en', 'en'] | True |
AgentCamera.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.device.client.is_available | [
"def",
"available",
"(",
"self",
")",
"->",
"bool",
":",
"return",
"self",
".",
"device",
".",
"client",
".",
"is_available"
] | [
144,
4
] | [
146,
46
] | python | en | ['en', 'en', 'en'] | True |
AgentCamera.connected | (self) | Return True if entity is connected. | Return True if entity is connected. | def connected(self) -> bool:
"""Return True if entity is connected."""
return self.device.connected | [
"def",
"connected",
"(",
"self",
")",
"->",
"bool",
":",
"return",
"self",
".",
"device",
".",
"connected"
] | [
149,
4
] | [
151,
36
] | python | en | ['en', 'en', 'en'] | True |
AgentCamera.supported_features | (self) | Return supported features. | Return supported features. | def supported_features(self) -> int:
"""Return supported features."""
return SUPPORT_ON_OFF | [
"def",
"supported_features",
"(",
"self",
")",
"->",
"int",
":",
"return",
"SUPPORT_ON_OFF"
] | [
154,
4
] | [
156,
29
] | python | en | ['en', 'en', 'en'] | True |
AgentCamera.is_on | (self) | Return true if on. | Return true if on. | def is_on(self) -> bool:
"""Return true if on."""
return self.device.online | [
"def",
"is_on",
"(",
"self",
")",
"->",
"bool",
":",
"return",
"self",
".",
"device",
".",
"online"
] | [
159,
4
] | [
161,
33
] | python | en | ['en', 'mt', 'en'] | True |
AgentCamera.icon | (self) | Return the icon to use in the frontend, if any. | Return the icon to use in the frontend, if any. | def icon(self):
"""Return the icon to use in the frontend, if any."""
if self.is_on:
return "mdi:camcorder"
return "mdi:camcorder-off" | [
"def",
"icon",
"(",
"self",
")",
":",
"if",
"self",
".",
"is_on",
":",
"return",
"\"mdi:camcorder\"",
"return",
"\"mdi:camcorder-off\""
] | [
164,
4
] | [
168,
34
] | python | en | ['en', 'en', 'en'] | True |
AgentCamera.motion_detection_enabled | (self) | Return the camera motion detection status. | Return the camera motion detection status. | def motion_detection_enabled(self):
"""Return the camera motion detection status."""
return self.device.detector_active | [
"def",
"motion_detection_enabled",
"(",
"self",
")",
":",
"return",
"self",
".",
"device",
".",
"detector_active"
] | [
171,
4
] | [
173,
42
] | python | en | ['en', 'en', 'en'] | True |
AgentCamera.unique_id | (self) | Return a unique identifier for this agent object. | Return a unique identifier for this agent object. | def unique_id(self) -> str:
"""Return a unique identifier for this agent object."""
return self._unique_id | [
"def",
"unique_id",
"(",
"self",
")",
"->",
"str",
":",
"return",
"self",
".",
"_unique_id"
] | [
176,
4
] | [
178,
30
] | python | en | ['en', 'en', 'en'] | True |
AgentCamera.async_enable_alerts | (self) | Enable alerts. | Enable alerts. | async def async_enable_alerts(self):
"""Enable alerts."""
await self.device.alerts_on() | [
"async",
"def",
"async_enable_alerts",
"(",
"self",
")",
":",
"await",
"self",
".",
"device",
".",
"alerts_on",
"(",
")"
] | [
180,
4
] | [
182,
37
] | python | en | ['sk', 'en', 'en'] | False |
AgentCamera.async_disable_alerts | (self) | Disable alerts. | Disable alerts. | async def async_disable_alerts(self):
"""Disable alerts."""
await self.device.alerts_off() | [
"async",
"def",
"async_disable_alerts",
"(",
"self",
")",
":",
"await",
"self",
".",
"device",
".",
"alerts_off",
"(",
")"
] | [
184,
4
] | [
186,
38
] | python | en | ['sk', 'fr', 'en'] | False |
AgentCamera.async_enable_motion_detection | (self) | Enable motion detection. | Enable motion detection. | async def async_enable_motion_detection(self):
"""Enable motion detection."""
await self.device.detector_on() | [
"async",
"def",
"async_enable_motion_detection",
"(",
"self",
")",
":",
"await",
"self",
".",
"device",
".",
"detector_on",
"(",
")"
] | [
188,
4
] | [
190,
39
] | python | en | ['fr', 'en', 'en'] | True |
AgentCamera.async_disable_motion_detection | (self) | Disable motion detection. | Disable motion detection. | async def async_disable_motion_detection(self):
"""Disable motion detection."""
await self.device.detector_off() | [
"async",
"def",
"async_disable_motion_detection",
"(",
"self",
")",
":",
"await",
"self",
".",
"device",
".",
"detector_off",
"(",
")"
] | [
192,
4
] | [
194,
40
] | python | en | ['fr', 'en', 'en'] | True |
AgentCamera.async_start_recording | (self) | Start recording. | Start recording. | async def async_start_recording(self):
"""Start recording."""
await self.device.record() | [
"async",
"def",
"async_start_recording",
"(",
"self",
")",
":",
"await",
"self",
".",
"device",
".",
"record",
"(",
")"
] | [
196,
4
] | [
198,
34
] | python | en | ['en', 'zh', 'en'] | False |
AgentCamera.async_stop_recording | (self) | Stop recording. | Stop recording. | async def async_stop_recording(self):
"""Stop recording."""
await self.device.record_stop() | [
"async",
"def",
"async_stop_recording",
"(",
"self",
")",
":",
"await",
"self",
".",
"device",
".",
"record_stop",
"(",
")"
] | [
200,
4
] | [
202,
39
] | python | en | ['en', 'sr', 'en'] | False |
AgentCamera.async_turn_on | (self) | Enable the camera. | Enable the camera. | async def async_turn_on(self):
"""Enable the camera."""
await self.device.enable() | [
"async",
"def",
"async_turn_on",
"(",
"self",
")",
":",
"await",
"self",
".",
"device",
".",
"enable",
"(",
")"
] | [
204,
4
] | [
206,
34
] | python | en | ['en', 'en', 'en'] | True |
AgentCamera.async_snapshot | (self) | Take a snapshot. | Take a snapshot. | async def async_snapshot(self):
"""Take a snapshot."""
await self.device.snapshot() | [
"async",
"def",
"async_snapshot",
"(",
"self",
")",
":",
"await",
"self",
".",
"device",
".",
"snapshot",
"(",
")"
] | [
208,
4
] | [
210,
36
] | python | en | ['en', 'jv', 'en'] | True |
AgentCamera.async_turn_off | (self) | Disable the camera. | Disable the camera. | async def async_turn_off(self):
"""Disable the camera."""
await self.device.disable() | [
"async",
"def",
"async_turn_off",
"(",
"self",
")",
":",
"await",
"self",
".",
"device",
".",
"disable",
"(",
")"
] | [
212,
4
] | [
214,
35
] | python | en | ['en', 'en', 'en'] | True |
restore_logging_class | () | Restore logging class. | Restore logging class. | def restore_logging_class():
"""Restore logging class."""
klass = logging.getLoggerClass()
yield
logging.setLoggerClass(klass) | [
"def",
"restore_logging_class",
"(",
")",
":",
"klass",
"=",
"logging",
".",
"getLoggerClass",
"(",
")",
"yield",
"logging",
".",
"setLoggerClass",
"(",
"klass",
")"
] | [
21,
0
] | [
25,
33
] | python | co | ['it', 'co', 'en'] | False |
test_setting_level | (hass) | Test we set log levels. | Test we set log levels. | async def test_setting_level(hass):
"""Test we set log levels."""
mocks = defaultdict(Mock)
with patch("logging.getLogger", mocks.__getitem__):
assert await async_setup_component(
hass,
"logger",
{
"logger": {
"default": "warni... | [
"async",
"def",
"test_setting_level",
"(",
"hass",
")",
":",
"mocks",
"=",
"defaultdict",
"(",
"Mock",
")",
"with",
"patch",
"(",
"\"logging.getLogger\"",
",",
"mocks",
".",
"__getitem__",
")",
":",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",... | [
28,
0
] | [
90,
5
] | python | en | ['en', 'bg', 'en'] | True |
test_can_set_level | (hass) | Test logger propagation. | Test logger propagation. | async def test_can_set_level(hass):
"""Test logger propagation."""
assert await async_setup_component(
hass,
"logger",
{
"logger": {
"logs": {
CONFIGED_NS: "warning",
f"{CONFIGED_NS}.info": "info",
f... | [
"async",
"def",
"test_can_set_level",
"(",
"hass",
")",
":",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"\"logger\"",
",",
"{",
"\"logger\"",
":",
"{",
"\"logs\"",
":",
"{",
"CONFIGED_NS",
":",
"\"warning\"",
",",
"f\"{CONFIGED_NS}.info\"",
":... | [
93,
0
] | [
189,
50
] | python | en | ['en', 'ja', 'en'] | True |
setup | (hass, config) | Register the SpaceAPI with the HTTP interface. | Register the SpaceAPI with the HTTP interface. | def setup(hass, config):
"""Register the SpaceAPI with the HTTP interface."""
hass.data[DATA_SPACEAPI] = config[DOMAIN]
hass.http.register_view(APISpaceApiView)
return True | [
"def",
"setup",
"(",
"hass",
",",
"config",
")",
":",
"hass",
".",
"data",
"[",
"DATA_SPACEAPI",
"]",
"=",
"config",
"[",
"DOMAIN",
"]",
"hass",
".",
"http",
".",
"register_view",
"(",
"APISpaceApiView",
")",
"return",
"True"
] | [
232,
0
] | [
237,
15
] | python | en | ['en', 'en', 'en'] | True |
APISpaceApiView.get_sensor_data | (hass, spaceapi, sensor) | Get data from a sensor. | Get data from a sensor. | def get_sensor_data(hass, spaceapi, sensor):
"""Get data from a sensor."""
sensor_state = hass.states.get(sensor)
if not sensor_state:
return None
sensor_data = {ATTR_NAME: sensor_state.name, ATTR_VALUE: sensor_state.state}
if ATTR_SENSOR_LOCATION in sensor_state.attr... | [
"def",
"get_sensor_data",
"(",
"hass",
",",
"spaceapi",
",",
"sensor",
")",
":",
"sensor_state",
"=",
"hass",
".",
"states",
".",
"get",
"(",
"sensor",
")",
"if",
"not",
"sensor_state",
":",
"return",
"None",
"sensor_data",
"=",
"{",
"ATTR_NAME",
":",
"s... | [
247,
4
] | [
260,
26
] | python | en | ['en', 'lb', 'en'] | True |
APISpaceApiView.get | (self, request) | Get SpaceAPI data. | Get SpaceAPI data. | def get(self, request):
"""Get SpaceAPI data."""
hass = request.app["hass"]
spaceapi = dict(hass.data[DATA_SPACEAPI])
is_sensors = spaceapi.get("sensors")
location = {ATTR_LAT: hass.config.latitude, ATTR_LON: hass.config.longitude}
try:
location[ATTR_ADDRESS... | [
"def",
"get",
"(",
"self",
",",
"request",
")",
":",
"hass",
"=",
"request",
".",
"app",
"[",
"\"hass\"",
"]",
"spaceapi",
"=",
"dict",
"(",
"hass",
".",
"data",
"[",
"DATA_SPACEAPI",
"]",
")",
"is_sensors",
"=",
"spaceapi",
".",
"get",
"(",
"\"senso... | [
263,
4
] | [
352,
30
] | python | en | ['en', 'la', 'en'] | True |
_int64_feature | (value) | Wrapper for inserting int64 features into Example proto. | Wrapper for inserting int64 features into Example proto. | def _int64_feature(value):
"""Wrapper for inserting int64 features into Example proto."""
if not isinstance(value, list):
value = [value]
return tf.train.Feature(int64_list=tf.train.Int64List(value=value)) | [
"def",
"_int64_feature",
"(",
"value",
")",
":",
"if",
"not",
"isinstance",
"(",
"value",
",",
"list",
")",
":",
"value",
"=",
"[",
"value",
"]",
"return",
"tf",
".",
"train",
".",
"Feature",
"(",
"int64_list",
"=",
"tf",
".",
"train",
".",
"Int64Lis... | [
158,
0
] | [
162,
69
] | python | en | ['en', 'en', 'en'] | True |
_float_feature | (value) | Wrapper for inserting float features into Example proto. | Wrapper for inserting float features into Example proto. | def _float_feature(value):
"""Wrapper for inserting float features into Example proto."""
if not isinstance(value, list):
value = [value]
return tf.train.Feature(float_list=tf.train.FloatList(value=value)) | [
"def",
"_float_feature",
"(",
"value",
")",
":",
"if",
"not",
"isinstance",
"(",
"value",
",",
"list",
")",
":",
"value",
"=",
"[",
"value",
"]",
"return",
"tf",
".",
"train",
".",
"Feature",
"(",
"float_list",
"=",
"tf",
".",
"train",
".",
"FloatLis... | [
165,
0
] | [
169,
69
] | python | en | ['en', 'en', 'en'] | True |
_bytes_feature | (value) | Wrapper for inserting bytes features into Example proto. | Wrapper for inserting bytes features into Example proto. | def _bytes_feature(value):
"""Wrapper for inserting bytes features into Example proto."""
return tf.train.Feature(bytes_list=tf.train.BytesList(value=[value])) | [
"def",
"_bytes_feature",
"(",
"value",
")",
":",
"return",
"tf",
".",
"train",
".",
"Feature",
"(",
"bytes_list",
"=",
"tf",
".",
"train",
".",
"BytesList",
"(",
"value",
"=",
"[",
"value",
"]",
")",
")"
] | [
172,
0
] | [
174,
71
] | python | en | ['en', 'en', 'en'] | True |
_convert_to_example | (filename, image_buffer, label, synset, human, bbox,
height, width) | Build an Example proto for an example.
Args:
filename: string, path to an image file, e.g., '/path/to/example.JPG'
image_buffer: string, JPEG encoding of RGB image
label: integer, identifier for the ground truth for the network
synset: string, unique WordNet ID specifying the label, e.g., 'n02323233'... | Build an Example proto for an example. | def _convert_to_example(filename, image_buffer, label, synset, human, bbox,
height, width):
"""Build an Example proto for an example.
Args:
filename: string, path to an image file, e.g., '/path/to/example.JPG'
image_buffer: string, JPEG encoding of RGB image
label: integer, iden... | [
"def",
"_convert_to_example",
"(",
"filename",
",",
"image_buffer",
",",
"label",
",",
"synset",
",",
"human",
",",
"bbox",
",",
"height",
",",
"width",
")",
":",
"xmin",
"=",
"[",
"]",
"ymin",
"=",
"[",
"]",
"xmax",
"=",
"[",
"]",
"ymax",
"=",
"["... | [
177,
0
] | [
225,
16
] | python | en | ['en', 'en', 'en'] | True |
_is_png | (filename) | Determine if a file contains a PNG format image.
Args:
filename: string, path of the image file.
Returns:
boolean indicating if the image is a PNG.
| Determine if a file contains a PNG format image. | def _is_png(filename):
"""Determine if a file contains a PNG format image.
Args:
filename: string, path of the image file.
Returns:
boolean indicating if the image is a PNG.
"""
# File list from:
# https://groups.google.com/forum/embed/?place=forum/torch7#!topic/torch7/fOSTXHIESSU
return 'n02105... | [
"def",
"_is_png",
"(",
"filename",
")",
":",
"# File list from:",
"# https://groups.google.com/forum/embed/?place=forum/torch7#!topic/torch7/fOSTXHIESSU",
"return",
"'n02105855_2933.JPEG'",
"in",
"filename"
] | [
265,
0
] | [
276,
42
] | python | en | ['en', 'en', 'en'] | True |
_is_cmyk | (filename) | Determine if file contains a CMYK JPEG format image.
Args:
filename: string, path of the image file.
Returns:
boolean indicating if the image is a JPEG encoded with CMYK color space.
| Determine if file contains a CMYK JPEG format image. | def _is_cmyk(filename):
"""Determine if file contains a CMYK JPEG format image.
Args:
filename: string, path of the image file.
Returns:
boolean indicating if the image is a JPEG encoded with CMYK color space.
"""
# File list from:
# https://github.com/cytsai/ilsvrc-cmyk-image-list
blacklist = [... | [
"def",
"_is_cmyk",
"(",
"filename",
")",
":",
"# File list from:",
"# https://github.com/cytsai/ilsvrc-cmyk-image-list",
"blacklist",
"=",
"[",
"'n01739381_1309.JPEG'",
",",
"'n02077923_14822.JPEG'",
",",
"'n02447366_23489.JPEG'",
",",
"'n02492035_15739.JPEG'",
",",
"'n02747177... | [
279,
0
] | [
301,
45
] | python | en | ['en', 'en', 'en'] | True |
_process_image | (filename, coder) | Process a single image file.
Args:
filename: string, path to an image file e.g., '/path/to/example.JPG'.
coder: instance of ImageCoder to provide TensorFlow image coding utils.
Returns:
image_buffer: string, JPEG encoding of RGB image.
height: integer, image height in pixels.
width: integer, im... | Process a single image file. | def _process_image(filename, coder):
"""Process a single image file.
Args:
filename: string, path to an image file e.g., '/path/to/example.JPG'.
coder: instance of ImageCoder to provide TensorFlow image coding utils.
Returns:
image_buffer: string, JPEG encoding of RGB image.
height: integer, imag... | [
"def",
"_process_image",
"(",
"filename",
",",
"coder",
")",
":",
"# Read the image file.",
"image_data",
"=",
"tf",
".",
"gfile",
".",
"GFile",
"(",
"filename",
",",
"'r'",
")",
".",
"read",
"(",
")",
"# Clean the dirty data.",
"if",
"_is_png",
"(",
"filena... | [
304,
0
] | [
337,
34
] | python | en | ['en', 'ny', 'en'] | True |
_process_image_files_batch | (coder, thread_index, ranges, name, filenames,
synsets, labels, humans, bboxes, num_shards) | Processes and saves list of images as TFRecord in 1 thread.
Args:
coder: instance of ImageCoder to provide TensorFlow image coding utils.
thread_index: integer, unique batch to run index is within [0, len(ranges)).
ranges: list of pairs of integers specifying ranges of each batches to
analyze in pa... | Processes and saves list of images as TFRecord in 1 thread. | def _process_image_files_batch(coder, thread_index, ranges, name, filenames,
synsets, labels, humans, bboxes, num_shards):
"""Processes and saves list of images as TFRecord in 1 thread.
Args:
coder: instance of ImageCoder to provide TensorFlow image coding utils.
thread_index... | [
"def",
"_process_image_files_batch",
"(",
"coder",
",",
"thread_index",
",",
"ranges",
",",
"name",
",",
"filenames",
",",
"synsets",
",",
"labels",
",",
"humans",
",",
"bboxes",
",",
"num_shards",
")",
":",
"# Each thread produces N shards where N = int(num_shards / ... | [
340,
0
] | [
409,
20
] | python | en | ['en', 'en', 'en'] | True |
_process_image_files | (name, filenames, synsets, labels, humans,
bboxes, num_shards) | Process and save list of images as TFRecord of Example protos.
Args:
name: string, unique identifier specifying the data set
filenames: list of strings; each string is a path to an image file
synsets: list of strings; each string is a unique WordNet ID
labels: list of integer; each integer identifies... | Process and save list of images as TFRecord of Example protos. | def _process_image_files(name, filenames, synsets, labels, humans,
bboxes, num_shards):
"""Process and save list of images as TFRecord of Example protos.
Args:
name: string, unique identifier specifying the data set
filenames: list of strings; each string is a path to an image file... | [
"def",
"_process_image_files",
"(",
"name",
",",
"filenames",
",",
"synsets",
",",
"labels",
",",
"humans",
",",
"bboxes",
",",
"num_shards",
")",
":",
"assert",
"len",
"(",
"filenames",
")",
"==",
"len",
"(",
"synsets",
")",
"assert",
"len",
"(",
"filen... | [
412,
0
] | [
461,
20
] | python | en | ['en', 'en', 'en'] | True |
_find_image_files | (data_dir, labels_file) | Build a list of all images files and labels in the data set.
Args:
data_dir: string, path to the root directory of images.
Assumes that the ImageNet data set resides in JPEG files located in
the following directory structure.
data_dir/n01440764/ILSVRC2012_val_00000293.JPEG
data_dir/... | Build a list of all images files and labels in the data set. | def _find_image_files(data_dir, labels_file):
"""Build a list of all images files and labels in the data set.
Args:
data_dir: string, path to the root directory of images.
Assumes that the ImageNet data set resides in JPEG files located in
the following directory structure.
data_dir/n0144... | [
"def",
"_find_image_files",
"(",
"data_dir",
",",
"labels_file",
")",
":",
"print",
"(",
"'Determining list of input files and labels from %s.'",
"%",
"data_dir",
")",
"challenge_synsets",
"=",
"[",
"l",
".",
"strip",
"(",
")",
"for",
"l",
"in",
"tf",
".",
"gfil... | [
464,
0
] | [
537,
35
] | python | en | ['en', 'en', 'en'] | True |
_find_human_readable_labels | (synsets, synset_to_human) | Build a list of human-readable labels.
Args:
synsets: list of strings; each string is a unique WordNet ID.
synset_to_human: dict of synset to human labels, e.g.,
'n02119022' --> 'red fox, Vulpes vulpes'
Returns:
List of human-readable strings corresponding to each synset.
| Build a list of human-readable labels. | def _find_human_readable_labels(synsets, synset_to_human):
"""Build a list of human-readable labels.
Args:
synsets: list of strings; each string is a unique WordNet ID.
synset_to_human: dict of synset to human labels, e.g.,
'n02119022' --> 'red fox, Vulpes vulpes'
Returns:
List of human-readab... | [
"def",
"_find_human_readable_labels",
"(",
"synsets",
",",
"synset_to_human",
")",
":",
"humans",
"=",
"[",
"]",
"for",
"s",
"in",
"synsets",
":",
"assert",
"s",
"in",
"synset_to_human",
",",
"(",
"'Failed to find: %s'",
"%",
"s",
")",
"humans",
".",
"append... | [
540,
0
] | [
555,
15
] | python | en | ['en', 'en', 'en'] | True |
_find_image_bounding_boxes | (filenames, image_to_bboxes) | Find the bounding boxes for a given image file.
Args:
filenames: list of strings; each string is a path to an image file.
image_to_bboxes: dictionary mapping image file names to a list of
bounding boxes. This list contains 0+ bounding boxes.
Returns:
List of bounding boxes for each image. Note th... | Find the bounding boxes for a given image file. | def _find_image_bounding_boxes(filenames, image_to_bboxes):
"""Find the bounding boxes for a given image file.
Args:
filenames: list of strings; each string is a path to an image file.
image_to_bboxes: dictionary mapping image file names to a list of
bounding boxes. This list contains 0+ bounding box... | [
"def",
"_find_image_bounding_boxes",
"(",
"filenames",
",",
"image_to_bboxes",
")",
":",
"num_image_bbox",
"=",
"0",
"bboxes",
"=",
"[",
"]",
"for",
"f",
"in",
"filenames",
":",
"basename",
"=",
"os",
".",
"path",
".",
"basename",
"(",
"f",
")",
"if",
"b... | [
558,
0
] | [
581,
15
] | python | en | ['en', 'en', 'en'] | True |
_process_dataset | (name, directory, num_shards, synset_to_human,
image_to_bboxes) | Process a complete data set and save it as a TFRecord.
Args:
name: string, unique identifier specifying the data set.
directory: string, root path to the data set.
num_shards: integer number of shards for this data set.
synset_to_human: dict of synset to human labels, e.g.,
'n02119022' --> 'red... | Process a complete data set and save it as a TFRecord. | def _process_dataset(name, directory, num_shards, synset_to_human,
image_to_bboxes):
"""Process a complete data set and save it as a TFRecord.
Args:
name: string, unique identifier specifying the data set.
directory: string, root path to the data set.
num_shards: integer number of ... | [
"def",
"_process_dataset",
"(",
"name",
",",
"directory",
",",
"num_shards",
",",
"synset_to_human",
",",
"image_to_bboxes",
")",
":",
"filenames",
",",
"synsets",
",",
"labels",
"=",
"_find_image_files",
"(",
"directory",
",",
"FLAGS",
".",
"labels_file",
")",
... | [
584,
0
] | [
601,
50
] | python | en | ['en', 'en', 'en'] | True |
_build_synset_lookup | (imagenet_metadata_file) | Build lookup for synset to human-readable label.
Args:
imagenet_metadata_file: string, path to file containing mapping from
synset to human-readable label.
Assumes each line of the file looks like:
n02119247 black fox
n02119359 silver fox
n02119477 red fox, Vulpes f... | Build lookup for synset to human-readable label. | def _build_synset_lookup(imagenet_metadata_file):
"""Build lookup for synset to human-readable label.
Args:
imagenet_metadata_file: string, path to file containing mapping from
synset to human-readable label.
Assumes each line of the file looks like:
n02119247 black fox
n021193... | [
"def",
"_build_synset_lookup",
"(",
"imagenet_metadata_file",
")",
":",
"lines",
"=",
"tf",
".",
"gfile",
".",
"GFile",
"(",
"imagenet_metadata_file",
",",
"'r'",
")",
".",
"readlines",
"(",
")",
"synset_to_human",
"=",
"{",
"}",
"for",
"l",
"in",
"lines",
... | [
604,
0
] | [
633,
24
] | python | en | ['en', 'en', 'en'] | True |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.