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
Unauthorized.__init__
( self, context: Optional["Context"] = None, user_id: Optional[str] = None, entity_id: Optional[str] = None, config_entry_id: Optional[str] = None, perm_category: Optional[str] = None, permission: Optional[str] = None, )
Unauthorized error.
Unauthorized error.
def __init__( self, context: Optional["Context"] = None, user_id: Optional[str] = None, entity_id: Optional[str] = None, config_entry_id: Optional[str] = None, perm_category: Optional[str] = None, permission: Optional[str] = None, ) -> None: """Unautho...
[ "def", "__init__", "(", "self", ",", "context", ":", "Optional", "[", "\"Context\"", "]", "=", "None", ",", "user_id", ":", "Optional", "[", "str", "]", "=", "None", ",", "entity_id", ":", "Optional", "[", "str", "]", "=", "None", ",", "config_entry_id...
[ 42, 4 ]
[ 64, 36 ]
python
de
['de', 'sr', 'it']
False
ServiceNotFound.__init__
(self, domain: str, service: str)
Initialize error.
Initialize error.
def __init__(self, domain: str, service: str) -> None: """Initialize error.""" super().__init__(self, f"Service {domain}.{service} not found") self.domain = domain self.service = service
[ "def", "__init__", "(", "self", ",", "domain", ":", "str", ",", "service", ":", "str", ")", "->", "None", ":", "super", "(", ")", ".", "__init__", "(", "self", ",", "f\"Service {domain}.{service} not found\"", ")", "self", ".", "domain", "=", "domain", "...
[ 74, 4 ]
[ 78, 30 ]
python
da
['da', 'la', 'it']
False
ServiceNotFound.__str__
(self)
Return string representation.
Return string representation.
def __str__(self) -> str: """Return string representation.""" return f"Unable to find service {self.domain}/{self.service}"
[ "def", "__str__", "(", "self", ")", "->", "str", ":", "return", "f\"Unable to find service {self.domain}/{self.service}\"" ]
[ 80, 4 ]
[ 82, 69 ]
python
en
['en', 'no', 'en']
True
run
(args)
Handle keyring script.
Handle keyring script.
def run(args): """Handle keyring script.""" parser = argparse.ArgumentParser( description=( "Modify Home Assistant secrets in the default keyring. " "Use the secrets in configuration files with: " "!secret <name>" ) ) parser.add_argument("--script", ch...
[ "def", "run", "(", "args", ")", ":", "parser", "=", "argparse", ".", "ArgumentParser", "(", "description", "=", "(", "\"Modify Home Assistant secrets in the default keyring. \"", "\"Use the secrets in configuration files with: \"", "\"!secret <name>\"", ")", ")", "parser", ...
[ 11, 0 ]
[ 61, 50 ]
python
en
['en', 'af', 'en']
True
websocket_client
(hass, hass_ws_client)
Create a websocket client.
Create a websocket client.
async def websocket_client(hass, hass_ws_client): """Create a websocket client.""" return await hass_ws_client(hass)
[ "async", "def", "websocket_client", "(", "hass", ",", "hass_ws_client", ")", ":", "return", "await", "hass_ws_client", "(", "hass", ")" ]
[ 9, 0 ]
[ 11, 37 ]
python
en
['en', 'lb', 'en']
True
no_auth_websocket_client
(hass, aiohttp_client)
Websocket connection that requires authentication.
Websocket connection that requires authentication.
async def no_auth_websocket_client(hass, aiohttp_client): """Websocket connection that requires authentication.""" assert await async_setup_component(hass, "websocket_api", {}) await hass.async_block_till_done() client = await aiohttp_client(hass.http.app) ws = await client.ws_connect(URL) aut...
[ "async", "def", "no_auth_websocket_client", "(", "hass", ",", "aiohttp_client", ")", ":", "assert", "await", "async_setup_component", "(", "hass", ",", "\"websocket_api\"", ",", "{", "}", ")", "await", "hass", ".", "async_block_till_done", "(", ")", "client", "=...
[ 15, 0 ]
[ 30, 24 ]
python
en
['en', 'en', 'en']
True
setup_platform
(hass, config, add_entities, discovery_info=None)
Set up the Deutsche Bahn Sensor.
Set up the Deutsche Bahn Sensor.
def setup_platform(hass, config, add_entities, discovery_info=None): """Set up the Deutsche Bahn Sensor.""" start = config.get(CONF_START) destination = config[CONF_DESTINATION] offset = config[CONF_OFFSET] only_direct = config[CONF_ONLY_DIRECT] add_entities([DeutscheBahnSensor(start, destinati...
[ "def", "setup_platform", "(", "hass", ",", "config", ",", "add_entities", ",", "discovery_info", "=", "None", ")", ":", "start", "=", "config", ".", "get", "(", "CONF_START", ")", "destination", "=", "config", "[", "CONF_DESTINATION", "]", "offset", "=", "...
[ 32, 0 ]
[ 39, 85 ]
python
de
['de', 'nl', 'de']
True
DeutscheBahnSensor.__init__
(self, start, goal, offset, only_direct)
Initialize the sensor.
Initialize the sensor.
def __init__(self, start, goal, offset, only_direct): """Initialize the sensor.""" self._name = f"{start} to {goal}" self.data = SchieneData(start, goal, offset, only_direct) self._state = None
[ "def", "__init__", "(", "self", ",", "start", ",", "goal", ",", "offset", ",", "only_direct", ")", ":", "self", ".", "_name", "=", "f\"{start} to {goal}\"", "self", ".", "data", "=", "SchieneData", "(", "start", ",", "goal", ",", "offset", ",", "only_dir...
[ 45, 4 ]
[ 49, 26 ]
python
en
['en', 'en', 'en']
True
DeutscheBahnSensor.name
(self)
Return the name of the sensor.
Return the name of the sensor.
def name(self): """Return the name of the sensor.""" return self._name
[ "def", "name", "(", "self", ")", ":", "return", "self", ".", "_name" ]
[ 52, 4 ]
[ 54, 25 ]
python
en
['en', 'mi', 'en']
True
DeutscheBahnSensor.icon
(self)
Return the icon for the frontend.
Return the icon for the frontend.
def icon(self): """Return the icon for the frontend.""" return ICON
[ "def", "icon", "(", "self", ")", ":", "return", "ICON" ]
[ 57, 4 ]
[ 59, 19 ]
python
en
['en', 'en', 'en']
True
DeutscheBahnSensor.state
(self)
Return the departure time of the next train.
Return the departure time of the next train.
def state(self): """Return the departure time of the next train.""" return self._state
[ "def", "state", "(", "self", ")", ":", "return", "self", ".", "_state" ]
[ 62, 4 ]
[ 64, 26 ]
python
en
['en', 'en', 'en']
True
DeutscheBahnSensor.device_state_attributes
(self)
Return the state attributes.
Return the state attributes.
def device_state_attributes(self): """Return the state attributes.""" connections = self.data.connections[0] if len(self.data.connections) > 1: connections["next"] = self.data.connections[1]["departure"] if len(self.data.connections) > 2: connections["next_on"] = ...
[ "def", "device_state_attributes", "(", "self", ")", ":", "connections", "=", "self", ".", "data", ".", "connections", "[", "0", "]", "if", "len", "(", "self", ".", "data", ".", "connections", ")", ">", "1", ":", "connections", "[", "\"next\"", "]", "="...
[ 67, 4 ]
[ 74, 26 ]
python
en
['en', 'en', 'en']
True
DeutscheBahnSensor.update
(self)
Get the latest delay from bahn.de and updates the state.
Get the latest delay from bahn.de and updates the state.
def update(self): """Get the latest delay from bahn.de and updates the state.""" self.data.update() self._state = self.data.connections[0].get("departure", "Unknown") if self.data.connections[0].get("delay", 0) != 0: self._state += f" + {self.data.connections[0]['delay']}"
[ "def", "update", "(", "self", ")", ":", "self", ".", "data", ".", "update", "(", ")", "self", ".", "_state", "=", "self", ".", "data", ".", "connections", "[", "0", "]", ".", "get", "(", "\"departure\"", ",", "\"Unknown\"", ")", "if", "self", ".", ...
[ 76, 4 ]
[ 81, 68 ]
python
en
['en', 'en', 'en']
True
SchieneData.__init__
(self, start, goal, offset, only_direct)
Initialize the sensor.
Initialize the sensor.
def __init__(self, start, goal, offset, only_direct): """Initialize the sensor.""" self.start = start self.goal = goal self.offset = offset self.only_direct = only_direct self.schiene = schiene.Schiene() self.connections = [{}]
[ "def", "__init__", "(", "self", ",", "start", ",", "goal", ",", "offset", ",", "only_direct", ")", ":", "self", ".", "start", "=", "start", "self", ".", "goal", "=", "goal", "self", ".", "offset", "=", "offset", "self", ".", "only_direct", "=", "only...
[ 87, 4 ]
[ 95, 31 ]
python
en
['en', 'en', 'en']
True
SchieneData.update
(self)
Update the connection data.
Update the connection data.
def update(self): """Update the connection data.""" self.connections = self.schiene.connections( self.start, self.goal, dt_util.as_local(dt_util.utcnow() + self.offset), self.only_direct, ) if not self.connections: self.connect...
[ "def", "update", "(", "self", ")", ":", "self", ".", "connections", "=", "self", ".", "schiene", ".", "connections", "(", "self", ".", "start", ",", "self", ".", "goal", ",", "dt_util", ".", "as_local", "(", "dt_util", ".", "utcnow", "(", ")", "+", ...
[ 97, 4 ]
[ 117, 56 ]
python
en
['en', 'en', 'en']
True
async_get_device_config
(hass, config_entry)
Initiate the connection and services.
Initiate the connection and services.
async def async_get_device_config(hass, config_entry): """Initiate the connection and services.""" # Make a copy of addresses due to edge case where the list of devices could change during status update # Cannot be done concurrently due to issues with the underlying protocol. for address in list(devices...
[ "async", "def", "async_get_device_config", "(", "hass", ",", "config_entry", ")", ":", "# Make a copy of addresses due to edge case where the list of devices could change during status update", "# Cannot be done concurrently due to issues with the underlying protocol.", "for", "address", "...
[ 34, 0 ]
[ 62, 60 ]
python
en
['en', 'en', 'en']
True
close_insteon_connection
(*args)
Close the Insteon connection.
Close the Insteon connection.
async def close_insteon_connection(*args): """Close the Insteon connection.""" await async_close()
[ "async", "def", "close_insteon_connection", "(", "*", "args", ")", ":", "await", "async_close", "(", ")" ]
[ 65, 0 ]
[ 67, 23 ]
python
en
['en', 'en', 'en']
True
async_setup
(hass, config)
Set up the Insteon platform.
Set up the Insteon platform.
async def async_setup(hass, config): """Set up the Insteon platform.""" if DOMAIN not in config: return True conf = config[DOMAIN] data, options = convert_yaml_to_config_flow(conf) if options: hass.data[DOMAIN] = {} hass.data[DOMAIN][OPTIONS] = options # Create a config ...
[ "async", "def", "async_setup", "(", "hass", ",", "config", ")", ":", "if", "DOMAIN", "not", "in", "config", ":", "return", "True", "conf", "=", "config", "[", "DOMAIN", "]", "data", ",", "options", "=", "convert_yaml_to_config_flow", "(", "conf", ")", "i...
[ 70, 0 ]
[ 86, 15 ]
python
en
['en', 'da', 'en']
True
async_setup_entry
(hass, entry)
Set up an Insteon entry.
Set up an Insteon entry.
async def async_setup_entry(hass, entry): """Set up an Insteon entry.""" if not devices.modem: try: await async_connect(**entry.data) except ConnectionError as exception: _LOGGER.error("Could not connect to Insteon modem") raise ConfigEntryNotReady from excep...
[ "async", "def", "async_setup_entry", "(", "hass", ",", "entry", ")", ":", "if", "not", "devices", ".", "modem", ":", "try", ":", "await", "async_connect", "(", "*", "*", "entry", ".", "data", ")", "except", "ConnectionError", "as", "exception", ":", "_LO...
[ 89, 0 ]
[ 167, 15 ]
python
en
['en', 'en', 'en']
True
async_check_ha_config_file
(hass: HomeAssistant)
Load and check if Home Assistant configuration file is valid. This method is a coroutine.
Load and check if Home Assistant configuration file is valid.
async def async_check_ha_config_file(hass: HomeAssistant) -> HomeAssistantConfig: """Load and check if Home Assistant configuration file is valid. This method is a coroutine. """ result = HomeAssistantConfig() def _pack_error( package: str, component: str, config: ConfigType, message: str ...
[ "async", "def", "async_check_ha_config_file", "(", "hass", ":", "HomeAssistant", ")", "->", "HomeAssistantConfig", ":", "result", "=", "HomeAssistantConfig", "(", ")", "def", "_pack_error", "(", "package", ":", "str", ",", "component", ":", "str", ",", "config",...
[ 60, 0 ]
[ 214, 17 ]
python
en
['en', 'en', 'en']
True
empty_value
(value: Any)
Test if the user has the default config value from adding "zone:".
Test if the user has the default config value from adding "zone:".
def empty_value(value: Any) -> Any: """Test if the user has the default config value from adding "zone:".""" if isinstance(value, dict) and len(value) == 0: return [] raise vol.Invalid("Not a default value")
[ "def", "empty_value", "(", "value", ":", "Any", ")", "->", "Any", ":", "if", "isinstance", "(", "value", ",", "dict", ")", "and", "len", "(", "value", ")", "==", "0", ":", "return", "[", "]", "raise", "vol", ".", "Invalid", "(", "\"Not a default valu...
[ 67, 0 ]
[ 72, 44 ]
python
en
['en', 'en', 'en']
True
async_active_zone
( hass: HomeAssistant, latitude: float, longitude: float, radius: int = 0 )
Find the active zone for given latitude, longitude. This method must be run in the event loop.
Find the active zone for given latitude, longitude.
def async_active_zone( hass: HomeAssistant, latitude: float, longitude: float, radius: int = 0 ) -> Optional[State]: """Find the active zone for given latitude, longitude. This method must be run in the event loop. """ # Sort entity IDs so that we are deterministic if equal distance to 2 zones ...
[ "def", "async_active_zone", "(", "hass", ":", "HomeAssistant", ",", "latitude", ":", "float", ",", "longitude", ":", "float", ",", "radius", ":", "int", "=", "0", ")", "->", "Optional", "[", "State", "]", ":", "# Sort entity IDs so that we are deterministic if e...
[ 91, 0 ]
[ 133, 18 ]
python
en
['en', 'en', 'en']
True
in_zone
(zone: State, latitude: float, longitude: float, radius: float = 0)
Test if given latitude, longitude is in given zone. Async friendly.
Test if given latitude, longitude is in given zone.
def in_zone(zone: State, latitude: float, longitude: float, radius: float = 0) -> bool: """Test if given latitude, longitude is in given zone. Async friendly. """ if zone.state == STATE_UNAVAILABLE: return False zone_dist = distance( latitude, longitude, zone.attrib...
[ "def", "in_zone", "(", "zone", ":", "State", ",", "latitude", ":", "float", ",", "longitude", ":", "float", ",", "radius", ":", "float", "=", "0", ")", "->", "bool", ":", "if", "zone", ".", "state", "==", "STATE_UNAVAILABLE", ":", "return", "False", ...
[ 136, 0 ]
[ 153, 73 ]
python
en
['nl', 'en', 'en']
True
async_setup
(hass: HomeAssistant, config: Dict)
Set up configured zones as well as Home Assistant zone if necessary.
Set up configured zones as well as Home Assistant zone if necessary.
async def async_setup(hass: HomeAssistant, config: Dict) -> bool: """Set up configured zones as well as Home Assistant zone if necessary.""" component = entity_component.EntityComponent(_LOGGER, DOMAIN, hass) id_manager = collection.IDManager() yaml_collection = collection.IDLessCollection( log...
[ "async", "def", "async_setup", "(", "hass", ":", "HomeAssistant", ",", "config", ":", "Dict", ")", "->", "bool", ":", "component", "=", "entity_component", ".", "EntityComponent", "(", "_LOGGER", ",", "DOMAIN", ",", "hass", ")", "id_manager", "=", "collectio...
[ 177, 0 ]
[ 252, 15 ]
python
en
['en', 'en', 'en']
True
_home_conf
(hass: HomeAssistant)
Return the home zone config.
Return the home zone config.
def _home_conf(hass: HomeAssistant) -> Dict: """Return the home zone config.""" return { CONF_NAME: hass.config.location_name, CONF_LATITUDE: hass.config.latitude, CONF_LONGITUDE: hass.config.longitude, CONF_RADIUS: DEFAULT_RADIUS, CONF_ICON: ICON_HOME, CONF_PASSI...
[ "def", "_home_conf", "(", "hass", ":", "HomeAssistant", ")", "->", "Dict", ":", "return", "{", "CONF_NAME", ":", "hass", ".", "config", ".", "location_name", ",", "CONF_LATITUDE", ":", "hass", ".", "config", ".", "latitude", ",", "CONF_LONGITUDE", ":", "ha...
[ 256, 0 ]
[ 265, 5 ]
python
en
['en', 'en', 'en']
True
async_setup_entry
( hass: HomeAssistant, config_entry: config_entries.ConfigEntry )
Set up zone as config entry.
Set up zone as config entry.
async def async_setup_entry( hass: HomeAssistant, config_entry: config_entries.ConfigEntry ) -> bool: """Set up zone as config entry.""" storage_collection = cast(ZoneStorageCollection, hass.data[DOMAIN]) data = dict(config_entry.data) data.setdefault(CONF_PASSIVE, DEFAULT_PASSIVE) data.setdefa...
[ "async", "def", "async_setup_entry", "(", "hass", ":", "HomeAssistant", ",", "config_entry", ":", "config_entries", ".", "ConfigEntry", ")", "->", "bool", ":", "storage_collection", "=", "cast", "(", "ZoneStorageCollection", ",", "hass", ".", "data", "[", "DOMAI...
[ 268, 0 ]
[ 282, 15 ]
python
en
['en', 'en', 'en']
True
async_unload_entry
( hass: HomeAssistant, config_entry: config_entries.ConfigEntry )
Will be called once we remove it.
Will be called once we remove it.
async def async_unload_entry( hass: HomeAssistant, config_entry: config_entries.ConfigEntry ) -> bool: """Will be called once we remove it.""" return True
[ "async", "def", "async_unload_entry", "(", "hass", ":", "HomeAssistant", ",", "config_entry", ":", "config_entries", ".", "ConfigEntry", ")", "->", "bool", ":", "return", "True" ]
[ 285, 0 ]
[ 289, 15 ]
python
en
['en', 'en', 'en']
True
ZoneStorageCollection._process_create_data
(self, data: Dict)
Validate the config is valid.
Validate the config is valid.
async def _process_create_data(self, data: Dict) -> Dict: """Validate the config is valid.""" return cast(Dict, self.CREATE_SCHEMA(data))
[ "async", "def", "_process_create_data", "(", "self", ",", "data", ":", "Dict", ")", "->", "Dict", ":", "return", "cast", "(", "Dict", ",", "self", ".", "CREATE_SCHEMA", "(", "data", ")", ")" ]
[ 162, 4 ]
[ 164, 51 ]
python
en
['en', 'en', 'en']
True
ZoneStorageCollection._get_suggested_id
(self, info: Dict)
Suggest an ID based on the config.
Suggest an ID based on the config.
def _get_suggested_id(self, info: Dict) -> str: """Suggest an ID based on the config.""" return cast(str, info[CONF_NAME])
[ "def", "_get_suggested_id", "(", "self", ",", "info", ":", "Dict", ")", "->", "str", ":", "return", "cast", "(", "str", ",", "info", "[", "CONF_NAME", "]", ")" ]
[ 167, 4 ]
[ 169, 41 ]
python
en
['en', 'en', 'en']
True
ZoneStorageCollection._update_data
(self, data: dict, update_data: Dict)
Return a new updated data object.
Return a new updated data object.
async def _update_data(self, data: dict, update_data: Dict) -> Dict: """Return a new updated data object.""" update_data = self.UPDATE_SCHEMA(update_data) return {**data, **update_data}
[ "async", "def", "_update_data", "(", "self", ",", "data", ":", "dict", ",", "update_data", ":", "Dict", ")", "->", "Dict", ":", "update_data", "=", "self", ".", "UPDATE_SCHEMA", "(", "update_data", ")", "return", "{", "*", "*", "data", ",", "*", "*", ...
[ 171, 4 ]
[ 174, 38 ]
python
en
['en', 'en', 'en']
True
Zone.__init__
(self, config: Dict, editable: bool)
Initialize the zone.
Initialize the zone.
def __init__(self, config: Dict, editable: bool): """Initialize the zone.""" self._config = config self._editable = editable self._attrs: Optional[Dict] = None self._generate_attrs()
[ "def", "__init__", "(", "self", ",", "config", ":", "Dict", ",", "editable", ":", "bool", ")", ":", "self", ".", "_config", "=", "config", "self", ".", "_editable", "=", "editable", "self", ".", "_attrs", ":", "Optional", "[", "Dict", "]", "=", "None...
[ 295, 4 ]
[ 300, 30 ]
python
en
['en', 'en', 'en']
True
Zone.state
(self)
Return the state property really does nothing for a zone.
Return the state property really does nothing for a zone.
def state(self) -> str: """Return the state property really does nothing for a zone.""" return "zoning"
[ "def", "state", "(", "self", ")", "->", "str", ":", "return", "\"zoning\"" ]
[ 303, 4 ]
[ 305, 23 ]
python
en
['en', 'en', 'en']
True
Zone.name
(self)
Return name.
Return name.
def name(self) -> str: """Return name.""" return cast(str, self._config[CONF_NAME])
[ "def", "name", "(", "self", ")", "->", "str", ":", "return", "cast", "(", "str", ",", "self", ".", "_config", "[", "CONF_NAME", "]", ")" ]
[ 308, 4 ]
[ 310, 49 ]
python
en
['en', 'ig', 'en']
False
Zone.unique_id
(self)
Return unique ID.
Return unique ID.
def unique_id(self) -> Optional[str]: """Return unique ID.""" return self._config.get(CONF_ID)
[ "def", "unique_id", "(", "self", ")", "->", "Optional", "[", "str", "]", ":", "return", "self", ".", "_config", ".", "get", "(", "CONF_ID", ")" ]
[ 313, 4 ]
[ 315, 40 ]
python
en
['fr', 'la', 'en']
False
Zone.icon
(self)
Return the icon if any.
Return the icon if any.
def icon(self) -> Optional[str]: """Return the icon if any.""" return self._config.get(CONF_ICON)
[ "def", "icon", "(", "self", ")", "->", "Optional", "[", "str", "]", ":", "return", "self", ".", "_config", ".", "get", "(", "CONF_ICON", ")" ]
[ 318, 4 ]
[ 320, 42 ]
python
en
['en', 'en', 'en']
True
Zone.state_attributes
(self)
Return the state attributes of the zone.
Return the state attributes of the zone.
def state_attributes(self) -> Optional[Dict]: """Return the state attributes of the zone.""" return self._attrs
[ "def", "state_attributes", "(", "self", ")", "->", "Optional", "[", "Dict", "]", ":", "return", "self", ".", "_attrs" ]
[ 323, 4 ]
[ 325, 26 ]
python
en
['en', 'en', 'en']
True
Zone.should_poll
(self)
Zone does not poll.
Zone does not poll.
def should_poll(self) -> bool: """Zone does not poll.""" return False
[ "def", "should_poll", "(", "self", ")", "->", "bool", ":", "return", "False" ]
[ 328, 4 ]
[ 330, 20 ]
python
en
['it', 'en', 'en']
True
Zone.async_update_config
(self, config: Dict)
Handle when the config is updated.
Handle when the config is updated.
async def async_update_config(self, config: Dict) -> None: """Handle when the config is updated.""" if self._config == config: return self._config = config self._generate_attrs() self.async_write_ha_state()
[ "async", "def", "async_update_config", "(", "self", ",", "config", ":", "Dict", ")", "->", "None", ":", "if", "self", ".", "_config", "==", "config", ":", "return", "self", ".", "_config", "=", "config", "self", ".", "_generate_attrs", "(", ")", "self", ...
[ 332, 4 ]
[ 338, 35 ]
python
en
['en', 'en', 'en']
True
Zone._generate_attrs
(self)
Generate new attrs based on config.
Generate new attrs based on config.
def _generate_attrs(self) -> None: """Generate new attrs based on config.""" self._attrs = { ATTR_LATITUDE: self._config[CONF_LATITUDE], ATTR_LONGITUDE: self._config[CONF_LONGITUDE], ATTR_RADIUS: self._config[CONF_RADIUS], ATTR_PASSIVE: self._config[CONF_P...
[ "def", "_generate_attrs", "(", "self", ")", "->", "None", ":", "self", ".", "_attrs", "=", "{", "ATTR_LATITUDE", ":", "self", ".", "_config", "[", "CONF_LATITUDE", "]", ",", "ATTR_LONGITUDE", ":", "self", ".", "_config", "[", "CONF_LONGITUDE", "]", ",", ...
[ 341, 4 ]
[ 349, 9 ]
python
en
['en', 'en', 'en']
True
Compressor.__init__
(self, model, config_list, optimizer=None)
Record necessary info in class members Parameters ---------- model : pytorch model the model user wants to compress config_list : list the configurations that users specify for compression optimizer: pytorch optimizer optimizer used t...
Record necessary info in class members
def __init__(self, model, config_list, optimizer=None): """ Record necessary info in class members Parameters ---------- model : pytorch model the model user wants to compress config_list : list the configurations that users specify for compressio...
[ "def", "__init__", "(", "self", ",", "model", ",", "config_list", ",", "optimizer", "=", "None", ")", ":", "assert", "isinstance", "(", "model", ",", "torch", ".", "nn", ".", "Module", ")", "self", ".", "validate_config", "(", "model", ",", "config_list"...
[ 27, 4 ]
[ 57, 105 ]
python
en
['en', 'error', 'th']
False
Compressor.validate_config
(self, model, config_list)
subclass can optionally implement this method to check if config_list if valid
subclass can optionally implement this method to check if config_list if valid
def validate_config(self, model, config_list): """ subclass can optionally implement this method to check if config_list if valid """ pass
[ "def", "validate_config", "(", "self", ",", "model", ",", "config_list", ")", ":", "pass" ]
[ 59, 4 ]
[ 63, 12 ]
python
en
['en', 'error', 'th']
False
Compressor.reset
(self, checkpoint=None)
reset model state dict and model wrapper
reset model state dict and model wrapper
def reset(self, checkpoint=None): """ reset model state dict and model wrapper """ self._unwrap_model() if checkpoint is not None: self.bound_model.load_state_dict(checkpoint) self.modules_to_compress = None self.modules_wrapper = [] for laye...
[ "def", "reset", "(", "self", ",", "checkpoint", "=", "None", ")", ":", "self", ".", "_unwrap_model", "(", ")", "if", "checkpoint", "is", "not", "None", ":", "self", ".", "bound_model", ".", "load_state_dict", "(", "checkpoint", ")", "self", ".", "modules...
[ 65, 4 ]
[ 80, 26 ]
python
en
['en', 'error', 'th']
False
Compressor._detect_modules_to_compress
(self)
detect all modules should be compressed, and save the result in `self.modules_to_compress`. The model will be instrumented and user should never edit it after calling this method.
detect all modules should be compressed, and save the result in `self.modules_to_compress`. The model will be instrumented and user should never edit it after calling this method.
def _detect_modules_to_compress(self): """ detect all modules should be compressed, and save the result in `self.modules_to_compress`. The model will be instrumented and user should never edit it after calling this method. """ if self.modules_to_compress is None: self...
[ "def", "_detect_modules_to_compress", "(", "self", ")", ":", "if", "self", ".", "modules_to_compress", "is", "None", ":", "self", ".", "modules_to_compress", "=", "[", "]", "for", "name", ",", "module", "in", "self", ".", "bound_model", ".", "named_modules", ...
[ 82, 4 ]
[ 96, 39 ]
python
en
['en', 'error', 'th']
False
Compressor._wrap_model
(self)
wrap all modules that needed to be compressed
wrap all modules that needed to be compressed
def _wrap_model(self): """ wrap all modules that needed to be compressed """ for wrapper in reversed(self.get_modules_wrapper()): _setattr(self.bound_model, wrapper.name, wrapper) self.is_wrapped = True
[ "def", "_wrap_model", "(", "self", ")", ":", "for", "wrapper", "in", "reversed", "(", "self", ".", "get_modules_wrapper", "(", ")", ")", ":", "_setattr", "(", "self", ".", "bound_model", ",", "wrapper", ".", "name", ",", "wrapper", ")", "self", ".", "i...
[ 98, 4 ]
[ 105, 30 ]
python
en
['en', 'error', 'th']
False
Compressor._unwrap_model
(self)
unwrap all modules that needed to be compressed
unwrap all modules that needed to be compressed
def _unwrap_model(self): """ unwrap all modules that needed to be compressed """ for wrapper in self.get_modules_wrapper(): _setattr(self.bound_model, wrapper.name, wrapper.module) self.is_wrapped = False
[ "def", "_unwrap_model", "(", "self", ")", ":", "for", "wrapper", "in", "self", ".", "get_modules_wrapper", "(", ")", ":", "_setattr", "(", "self", ".", "bound_model", ",", "wrapper", ".", "name", ",", "wrapper", ".", "module", ")", "self", ".", "is_wrapp...
[ 107, 4 ]
[ 114, 31 ]
python
en
['en', 'error', 'th']
False
Compressor.compress
(self)
Compress the model with algorithm implemented by subclass. The model will be instrumented and user should never edit it after calling this method. `self.modules_to_compress` records all the to-be-compressed layers Returns ------- torch.nn.Module model with ...
Compress the model with algorithm implemented by subclass.
def compress(self): """ Compress the model with algorithm implemented by subclass. The model will be instrumented and user should never edit it after calling this method. `self.modules_to_compress` records all the to-be-compressed layers Returns ------- torch.nn...
[ "def", "compress", "(", "self", ")", ":", "return", "self", ".", "bound_model" ]
[ 116, 4 ]
[ 128, 31 ]
python
en
['en', 'error', 'th']
False
Compressor.set_wrappers_attribute
(self, name, value)
To register attributes used in wrapped module's forward method. If the type of the value is Torch.tensor, then this value is registered as a buffer in wrapper, which will be saved by model.state_dict. Otherwise, this value is just a regular variable in wrapper. Parameters -----...
To register attributes used in wrapped module's forward method. If the type of the value is Torch.tensor, then this value is registered as a buffer in wrapper, which will be saved by model.state_dict. Otherwise, this value is just a regular variable in wrapper.
def set_wrappers_attribute(self, name, value): """ To register attributes used in wrapped module's forward method. If the type of the value is Torch.tensor, then this value is registered as a buffer in wrapper, which will be saved by model.state_dict. Otherwise, this value is just a regu...
[ "def", "set_wrappers_attribute", "(", "self", ",", "name", ",", "value", ")", ":", "for", "wrapper", "in", "self", ".", "get_modules_wrapper", "(", ")", ":", "if", "isinstance", "(", "value", ",", "torch", ".", "Tensor", ")", ":", "wrapper", ".", "regist...
[ 130, 4 ]
[ 147, 45 ]
python
en
['en', 'error', 'th']
False
Compressor.get_modules_to_compress
(self)
To obtain all the to-be-compressed modules. Returns ------- list a list of the layers, each of which is a tuple (`layer`, `config`), `layer` is `LayerInfo`, `config` is a `dict`
To obtain all the to-be-compressed modules.
def get_modules_to_compress(self): """ To obtain all the to-be-compressed modules. Returns ------- list a list of the layers, each of which is a tuple (`layer`, `config`), `layer` is `LayerInfo`, `config` is a `dict` """ return self.module...
[ "def", "get_modules_to_compress", "(", "self", ")", ":", "return", "self", ".", "modules_to_compress" ]
[ 149, 4 ]
[ 159, 39 ]
python
en
['en', 'error', 'th']
False
Compressor.get_modules_wrapper
(self)
To obtain all the wrapped modules. Returns ------- list a list of the wrapped modules
To obtain all the wrapped modules.
def get_modules_wrapper(self): """ To obtain all the wrapped modules. Returns ------- list a list of the wrapped modules """ return self.modules_wrapper
[ "def", "get_modules_wrapper", "(", "self", ")", ":", "return", "self", ".", "modules_wrapper" ]
[ 161, 4 ]
[ 170, 35 ]
python
en
['en', 'error', 'th']
False
Compressor.select_config
(self, layer)
Find the configuration for `layer` by parsing `self.config_list` Parameters ---------- layer : LayerInfo one layer Returns ------- config or None the retrieved configuration for this layer, if None, this layer should not be c...
Find the configuration for `layer` by parsing `self.config_list`
def select_config(self, layer): """ Find the configuration for `layer` by parsing `self.config_list` Parameters ---------- layer : LayerInfo one layer Returns ------- config or None the retrieved configuration for this layer, if N...
[ "def", "select_config", "(", "self", ",", "layer", ")", ":", "ret", "=", "None", "for", "config", "in", "self", ".", "config_list", ":", "config", "=", "config", ".", "copy", "(", ")", "# expand config if key `default` is in config['op_types']", "if", "'op_types...
[ 172, 4 ]
[ 209, 18 ]
python
en
['en', 'error', 'th']
False
Compressor.update_epoch
(self, epoch)
If user want to update model every epoch, user can override this method. This method should be called at the beginning of each epoch Parameters ---------- epoch : num the current epoch number
If user want to update model every epoch, user can override this method. This method should be called at the beginning of each epoch
def update_epoch(self, epoch): """ If user want to update model every epoch, user can override this method. This method should be called at the beginning of each epoch Parameters ---------- epoch : num the current epoch number """ pass
[ "def", "update_epoch", "(", "self", ",", "epoch", ")", ":", "pass" ]
[ 211, 4 ]
[ 221, 12 ]
python
en
['en', 'error', 'th']
False
Compressor._wrap_modules
(self, layer, config)
This method is implemented in the subclasses, i.e., `Pruner` and `Quantizer` Parameters ---------- layer : LayerInfo the layer to instrument the compression operation config : dict the configuration for compressing this layer
This method is implemented in the subclasses, i.e., `Pruner` and `Quantizer`
def _wrap_modules(self, layer, config): """ This method is implemented in the subclasses, i.e., `Pruner` and `Quantizer` Parameters ---------- layer : LayerInfo the layer to instrument the compression operation config : dict the configuration for ...
[ "def", "_wrap_modules", "(", "self", ",", "layer", ",", "config", ")", ":", "raise", "NotImplementedError", "(", ")" ]
[ 223, 4 ]
[ 234, 35 ]
python
en
['en', 'error', 'th']
False
PrunerModuleWrapper.__init__
(self, module, module_name, module_type, config, pruner)
Wrap an module to enable data parallel, forward method customization and buffer registeration. Parameters ---------- module : pytorch module the module user wants to compress config : dict the configurations that users specify for compression mod...
Wrap an module to enable data parallel, forward method customization and buffer registeration.
def __init__(self, module, module_name, module_type, config, pruner): """ Wrap an module to enable data parallel, forward method customization and buffer registeration. Parameters ---------- module : pytorch module the module user wants to compress config : d...
[ "def", "__init__", "(", "self", ",", "module", ",", "module_name", ",", "module_type", ",", "config", ",", "pruner", ")", ":", "super", "(", ")", ".", "__init__", "(", ")", "# origin layer information", "self", ".", "module", "=", "module", "self", ".", ...
[ 277, 4 ]
[ 308, 51 ]
python
en
['en', 'error', 'th']
False
Pruner.calc_mask
(self, wrapper, **kwargs)
Pruners should overload this method to provide mask for weight tensors. The mask must have the same shape and type comparing to the weight. It will be applied with `mul()` operation on the weight. This method is effectively hooked to `forward()` method of the model. Parameters ...
Pruners should overload this method to provide mask for weight tensors. The mask must have the same shape and type comparing to the weight. It will be applied with `mul()` operation on the weight. This method is effectively hooked to `forward()` method of the model.
def calc_mask(self, wrapper, **kwargs): """ Pruners should overload this method to provide mask for weight tensors. The mask must have the same shape and type comparing to the weight. It will be applied with `mul()` operation on the weight. This method is effectively hooked to `f...
[ "def", "calc_mask", "(", "self", ",", "wrapper", ",", "*", "*", "kwargs", ")", ":", "raise", "NotImplementedError", "(", "\"Pruners must overload calc_mask()\"", ")" ]
[ 344, 4 ]
[ 356, 70 ]
python
en
['en', 'error', 'th']
False
Pruner._wrap_modules
(self, layer, config)
Create a wrapper module to replace the original one. Parameters ---------- layer : LayerInfo the layer to instrument the mask config : dict the configuration for generating the mask
Create a wrapper module to replace the original one.
def _wrap_modules(self, layer, config): """ Create a wrapper module to replace the original one. Parameters ---------- layer : LayerInfo the layer to instrument the mask config : dict the configuration for generating the mask """ _...
[ "def", "_wrap_modules", "(", "self", ",", "layer", ",", "config", ")", ":", "_logger", ".", "debug", "(", "\"Module detected to compress : %s.\"", ",", "layer", ".", "name", ")", "wrapper", "=", "PrunerModuleWrapper", "(", "layer", ".", "module", ",", "layer",...
[ 358, 4 ]
[ 374, 22 ]
python
en
['en', 'error', 'th']
False
Pruner.export_model
(self, model_path, mask_path=None, onnx_path=None, input_shape=None, device=None)
Export pruned model weights, masks and onnx model(optional) Parameters ---------- model_path : str path to save pruned model state_dict mask_path : str (optional) path to save mask dict onnx_path : str (optional) path to save onnx mod...
Export pruned model weights, masks and onnx model(optional)
def export_model(self, model_path, mask_path=None, onnx_path=None, input_shape=None, device=None): """ Export pruned model weights, masks and onnx model(optional) Parameters ---------- model_path : str path to save pruned model state_dict mask_path : str ...
[ "def", "export_model", "(", "self", ",", "model_path", ",", "mask_path", "=", "None", ",", "onnx_path", "=", "None", ",", "input_shape", "=", "None", ",", "device", "=", "None", ")", ":", "assert", "model_path", "is", "not", "None", ",", "'model_path must ...
[ 376, 4 ]
[ 425, 26 ]
python
en
['en', 'error', 'th']
False
Pruner.load_model_state_dict
(self, model_state)
Load the state dict saved from unwrapped model. Parameters ---------- model_state : dict state dict saved from unwrapped model
Load the state dict saved from unwrapped model.
def load_model_state_dict(self, model_state): """ Load the state dict saved from unwrapped model. Parameters ---------- model_state : dict state dict saved from unwrapped model """ if self.is_wrapped: self._unwrap_model() self....
[ "def", "load_model_state_dict", "(", "self", ",", "model_state", ")", ":", "if", "self", ".", "is_wrapped", ":", "self", ".", "_unwrap_model", "(", ")", "self", ".", "bound_model", ".", "load_state_dict", "(", "model_state", ")", "self", ".", "_wrap_model", ...
[ 427, 4 ]
[ 441, 57 ]
python
en
['en', 'error', 'th']
False
Pruner.get_pruned_weights
(self, dim=0)
Log the simulated prune sparsity. Parameters ---------- dim : int the pruned dim.
Log the simulated prune sparsity.
def get_pruned_weights(self, dim=0): """ Log the simulated prune sparsity. Parameters ---------- dim : int the pruned dim. """ for _, wrapper in enumerate(self.get_modules_wrapper()): weight_mask = wrapper.weight_mask mask_size...
[ "def", "get_pruned_weights", "(", "self", ",", "dim", "=", "0", ")", ":", "for", "_", ",", "wrapper", "in", "enumerate", "(", "self", ".", "get_modules_wrapper", "(", ")", ")", ":", "weight_mask", "=", "wrapper", ".", "weight_mask", "mask_size", "=", "we...
[ 443, 4 ]
[ 461, 110 ]
python
en
['en', 'error', 'th']
False
QuantizerModuleWrapper.__init__
(self, module, module_name, module_type, config, quantizer)
Wrap an module to enable data parallel, forward method customization and buffer registeration. Parameters ---------- module : pytorch module the module user wants to compress config : dict the configurations that users specify for compression mod...
Wrap an module to enable data parallel, forward method customization and buffer registeration.
def __init__(self, module, module_name, module_type, config, quantizer): """ Wrap an module to enable data parallel, forward method customization and buffer registeration. Parameters ---------- module : pytorch module the module user wants to compress config ...
[ "def", "__init__", "(", "self", ",", "module", ",", "module_name", ",", "module_type", ",", "config", ",", "quantizer", ")", ":", "super", "(", ")", ".", "__init__", "(", ")", "# origin layer information", "self", ".", "module", "=", "module", "self", ".",...
[ 465, 4 ]
[ 501, 77 ]
python
en
['en', 'error', 'th']
False
Quantizer.quantize_weight
(self, wrapper, **kwargs)
quantize should overload this method to quantize weight. This method is effectively hooked to :meth:`forward` of the model. Parameters ---------- wrapper : QuantizerModuleWrapper the wrapper for origin module
quantize should overload this method to quantize weight. This method is effectively hooked to :meth:`forward` of the model. Parameters ---------- wrapper : QuantizerModuleWrapper the wrapper for origin module
def quantize_weight(self, wrapper, **kwargs): """ quantize should overload this method to quantize weight. This method is effectively hooked to :meth:`forward` of the model. Parameters ---------- wrapper : QuantizerModuleWrapper the wrapper for origin module ...
[ "def", "quantize_weight", "(", "self", ",", "wrapper", ",", "*", "*", "kwargs", ")", ":", "raise", "NotImplementedError", "(", "'Quantizer must overload quantize_weight()'", ")" ]
[ 543, 4 ]
[ 552, 78 ]
python
en
['en', 'error', 'th']
False
Quantizer.quantize_output
(self, output, wrapper, **kwargs)
quantize should overload this method to quantize output. This method is effectively hooked to :meth:`forward` of the model. Parameters ---------- output : Tensor output that needs to be quantized wrapper : QuantizerModuleWrapper the wrapper for or...
quantize should overload this method to quantize output. This method is effectively hooked to :meth:`forward` of the model. Parameters ---------- output : Tensor output that needs to be quantized wrapper : QuantizerModuleWrapper the wrapper for or...
def quantize_output(self, output, wrapper, **kwargs): """ quantize should overload this method to quantize output. This method is effectively hooked to :meth:`forward` of the model. Parameters ---------- output : Tensor output that needs to be quantized ...
[ "def", "quantize_output", "(", "self", ",", "output", ",", "wrapper", ",", "*", "*", "kwargs", ")", ":", "raise", "NotImplementedError", "(", "'Quantizer must overload quantize_output()'", ")" ]
[ 554, 4 ]
[ 565, 78 ]
python
en
['en', 'error', 'th']
False
Quantizer.quantize_input
(self, *inputs, wrapper, **kwargs)
quantize should overload this method to quantize input. This method is effectively hooked to :meth:`forward` of the model. Parameters ---------- inputs : Tensor inputs that needs to be quantized wrapper : QuantizerModuleWrapper the wrapper for ori...
quantize should overload this method to quantize input. This method is effectively hooked to :meth:`forward` of the model. Parameters ---------- inputs : Tensor inputs that needs to be quantized wrapper : QuantizerModuleWrapper the wrapper for ori...
def quantize_input(self, *inputs, wrapper, **kwargs): """ quantize should overload this method to quantize input. This method is effectively hooked to :meth:`forward` of the model. Parameters ---------- inputs : Tensor inputs that needs to be quantized ...
[ "def", "quantize_input", "(", "self", ",", "*", "inputs", ",", "wrapper", ",", "*", "*", "kwargs", ")", ":", "raise", "NotImplementedError", "(", "'Quantizer must overload quantize_input()'", ")" ]
[ 567, 4 ]
[ 578, 77 ]
python
en
['en', 'error', 'th']
False
Quantizer._wrap_modules
(self, layer, config)
Create a wrapper forward function to replace the original one. Parameters ---------- layer : LayerInfo the layer to instrument the mask config : dict the configuration for quantization
Create a wrapper forward function to replace the original one. Parameters ---------- layer : LayerInfo the layer to instrument the mask config : dict the configuration for quantization
def _wrap_modules(self, layer, config): """ Create a wrapper forward function to replace the original one. Parameters ---------- layer : LayerInfo the layer to instrument the mask config : dict the configuration for quantization """ ...
[ "def", "_wrap_modules", "(", "self", ",", "layer", ",", "config", ")", ":", "assert", "'quant_types'", "in", "config", ",", "'must provide quant_types in config'", "assert", "isinstance", "(", "config", "[", "'quant_types'", "]", ",", "list", ")", ",", "'quant_t...
[ 580, 4 ]
[ 599, 89 ]
python
en
['en', 'error', 'th']
False
Quantizer.export_model_save
(self, model, model_path, calibration_config=None, calibration_path=None, onnx_path=None, input_shape=None, device=None)
This method helps save pytorch model, calibration config, onnx model in quantizer. Parameters ---------- model : pytorch model pytorch model to be saved model_path : str path to save pytorch calibration_config: dict (optional) config ...
This method helps save pytorch model, calibration config, onnx model in quantizer.
def export_model_save(self, model, model_path, calibration_config=None, calibration_path=None, onnx_path=None, input_shape=None, device=None): """ This method helps save pytorch model, calibration config, onnx model in quantizer. Parameters ---------- m...
[ "def", "export_model_save", "(", "self", ",", "model", ",", "model_path", ",", "calibration_config", "=", "None", ",", "calibration_path", "=", "None", ",", "onnx_path", "=", "None", ",", "input_shape", "=", "None", ",", "device", "=", "None", ")", ":", "t...
[ 601, 4 ]
[ 636, 102 ]
python
en
['en', 'error', 'th']
False
Quantizer.export_model
(self, model_path, calibration_path=None, onnx_path=None, input_shape=None, device=None)
Export quantized model weights and calibration parameters Parameters ---------- model_path : str path to save quantized model weight calibration_path : str (optional) path to save quantize parameters after calibration onnx_path : str ...
Export quantized model weights and calibration parameters
def export_model(self, model_path, calibration_path=None, onnx_path=None, input_shape=None, device=None): """ Export quantized model weights and calibration parameters Parameters ---------- model_path : str path to save quantized model weight calibration_path...
[ "def", "export_model", "(", "self", ",", "model_path", ",", "calibration_path", "=", "None", ",", "onnx_path", "=", "None", ",", "input_shape", "=", "None", ",", "device", "=", "None", ")", ":", "raise", "NotImplementedError", "(", "'Quantizer must overload expo...
[ 638, 4 ]
[ 660, 75 ]
python
en
['en', 'error', 'th']
False
QuantGrad._quantize
(cls, x, scale, zero_point)
Reference function for quantizing x -- non-clamped. Parameters ---------- x : Tensor tensor to be quantized scale : Tensor scale for quantizing x zero_point : Tensor zero_point for quantizing x Returns ------- t...
Reference function for quantizing x -- non-clamped. Parameters ---------- x : Tensor tensor to be quantized scale : Tensor scale for quantizing x zero_point : Tensor zero_point for quantizing x Returns ------- t...
def _quantize(cls, x, scale, zero_point): """ Reference function for quantizing x -- non-clamped. Parameters ---------- x : Tensor tensor to be quantized scale : Tensor scale for quantizing x zero_point : Tensor zero_point for q...
[ "def", "_quantize", "(", "cls", ",", "x", ",", "scale", ",", "zero_point", ")", ":", "return", "(", "(", "x", "/", "scale", ")", "+", "zero_point", ")", ".", "round", "(", ")" ]
[ 684, 4 ]
[ 700, 49 ]
python
en
['en', 'error', 'th']
False
QuantGrad.get_bits_length
(cls, config, quant_type)
Get bit for quantize config Parameters ---------- config : Dict the configuration for quantization quant_type : str quant type Returns ------- int n-bits for quantization configuration
Get bit for quantize config Parameters ---------- config : Dict the configuration for quantization quant_type : str quant type Returns ------- int n-bits for quantization configuration
def get_bits_length(cls, config, quant_type): """ Get bit for quantize config Parameters ---------- config : Dict the configuration for quantization quant_type : str quant type Returns ------- int n-bits for quan...
[ "def", "get_bits_length", "(", "cls", ",", "config", ",", "quant_type", ")", ":", "if", "isinstance", "(", "config", "[", "\"quant_bits\"", "]", ",", "int", ")", ":", "return", "config", "[", "\"quant_bits\"", "]", "else", ":", "return", "config", "[", "...
[ 703, 4 ]
[ 720, 55 ]
python
en
['en', 'error', 'th']
False
QuantGrad.quant_backward
(tensor, grad_output, quant_type, scale, zero_point, qmin, qmax)
This method should be overrided by subclass to provide customized backward function, default implementation is Straight-Through Estimator Parameters ---------- tensor : Tensor input of quantization operation grad_output : Tensor gradient of the ou...
This method should be overrided by subclass to provide customized backward function, default implementation is Straight-Through Estimator Parameters ---------- tensor : Tensor input of quantization operation grad_output : Tensor gradient of the ou...
def quant_backward(tensor, grad_output, quant_type, scale, zero_point, qmin, qmax): """ This method should be overrided by subclass to provide customized backward function, default implementation is Straight-Through Estimator Parameters ---------- tensor : Tensor ...
[ "def", "quant_backward", "(", "tensor", ",", "grad_output", ",", "quant_type", ",", "scale", ",", "zero_point", ",", "qmin", ",", "qmax", ")", ":", "return", "grad_output" ]
[ 723, 4 ]
[ 747, 26 ]
python
en
['en', 'error', 'th']
False
test_platform_manually_configured
(hass)
Test that nothing happens when platform is manually configured.
Test that nothing happens when platform is manually configured.
async def test_platform_manually_configured(hass): """Test that nothing happens when platform is manually configured.""" assert ( await async_setup_component( hass, CAMERA_DOMAIN, {CAMERA_DOMAIN: {"platform": AXIS_DOMAIN}} ) is True ) assert AXIS_DOMAIN not in hass.d...
[ "async", "def", "test_platform_manually_configured", "(", "hass", ")", ":", "assert", "(", "await", "async_setup_component", "(", "hass", ",", "CAMERA_DOMAIN", ",", "{", "CAMERA_DOMAIN", ":", "{", "\"platform\"", ":", "AXIS_DOMAIN", "}", "}", ")", "is", "True", ...
[ 16, 0 ]
[ 25, 39 ]
python
en
['en', 'en', 'en']
True
test_camera
(hass)
Test that Axis camera platform is loaded properly.
Test that Axis camera platform is loaded properly.
async def test_camera(hass): """Test that Axis camera platform is loaded properly.""" await setup_axis_integration(hass) assert len(hass.states.async_entity_ids(CAMERA_DOMAIN)) == 1 entity_id = f"{CAMERA_DOMAIN}.{NAME}" cam = hass.states.get(entity_id) assert cam.state == STATE_IDLE asser...
[ "async", "def", "test_camera", "(", "hass", ")", ":", "await", "setup_axis_integration", "(", "hass", ")", "assert", "len", "(", "hass", ".", "states", ".", "async_entity_ids", "(", "CAMERA_DOMAIN", ")", ")", "==", "1", "entity_id", "=", "f\"{CAMERA_DOMAIN}.{N...
[ 28, 0 ]
[ 46, 5 ]
python
en
['en', 'en', 'en']
True
test_camera_with_stream_profile
(hass)
Test that Axis camera entity is using the correct path with stream profike.
Test that Axis camera entity is using the correct path with stream profike.
async def test_camera_with_stream_profile(hass): """Test that Axis camera entity is using the correct path with stream profike.""" with patch.dict(ENTRY_OPTIONS, {CONF_STREAM_PROFILE: "profile_1"}): await setup_axis_integration(hass) assert len(hass.states.async_entity_ids(CAMERA_DOMAIN)) == 1 ...
[ "async", "def", "test_camera_with_stream_profile", "(", "hass", ")", ":", "with", "patch", ".", "dict", "(", "ENTRY_OPTIONS", ",", "{", "CONF_STREAM_PROFILE", ":", "\"profile_1\"", "}", ")", ":", "await", "setup_axis_integration", "(", "hass", ")", "assert", "le...
[ 49, 0 ]
[ 71, 5 ]
python
en
['en', 'en', 'en']
True
test_camera_disabled
(hass)
Test that Axis camera platform is loaded properly but does not create camera entity.
Test that Axis camera platform is loaded properly but does not create camera entity.
async def test_camera_disabled(hass): """Test that Axis camera platform is loaded properly but does not create camera entity.""" with patch("axis.vapix.Params.image_format", new=None): await setup_axis_integration(hass) assert len(hass.states.async_entity_ids(CAMERA_DOMAIN)) == 0
[ "async", "def", "test_camera_disabled", "(", "hass", ")", ":", "with", "patch", "(", "\"axis.vapix.Params.image_format\"", ",", "new", "=", "None", ")", ":", "await", "setup_axis_integration", "(", "hass", ")", "assert", "len", "(", "hass", ".", "states", ".",...
[ 74, 0 ]
[ 79, 64 ]
python
en
['en', 'en', 'en']
True
infer_framework_from_model
(model, model_classes: Optional[Dict[str, type]] = None, revision: Optional[str] = None)
Select framework (TensorFlow or PyTorch) to use from the :obj:`model` passed. Returns a tuple (framework, model). If :obj:`model` is instantiated, this function will just infer the framework from the model class. Otherwise :obj:`model` is actually a checkpoint name and this method will try to instantiate ...
Select framework (TensorFlow or PyTorch) to use from the :obj:`model` passed. Returns a tuple (framework, model).
def infer_framework_from_model(model, model_classes: Optional[Dict[str, type]] = None, revision: Optional[str] = None): """ Select framework (TensorFlow or PyTorch) to use from the :obj:`model` passed. Returns a tuple (framework, model). If :obj:`model` is instantiated, this function will just infer the fr...
[ "def", "infer_framework_from_model", "(", "model", ",", "model_classes", ":", "Optional", "[", "Dict", "[", "str", ",", "type", "]", "]", "=", "None", ",", "revision", ":", "Optional", "[", "str", "]", "=", "None", ")", ":", "if", "not", "is_tf_available...
[ 49, 0 ]
[ 95, 27 ]
python
en
['en', 'error', 'th']
False
get_framework
(model, revision: Optional[str] = None)
Select framework (TensorFlow or PyTorch) to use. Args: model (:obj:`str`, :class:`~transformers.PreTrainedModel` or :class:`~transformers.TFPreTrainedModel`): If both frameworks are installed, picks the one corresponding to the model passed (either a model class or the model na...
Select framework (TensorFlow or PyTorch) to use.
def get_framework(model, revision: Optional[str] = None): """ Select framework (TensorFlow or PyTorch) to use. Args: model (:obj:`str`, :class:`~transformers.PreTrainedModel` or :class:`~transformers.TFPreTrainedModel`): If both frameworks are installed, picks the one corresponding to t...
[ "def", "get_framework", "(", "model", ",", "revision", ":", "Optional", "[", "str", "]", "=", "None", ")", ":", "warnings", ".", "warn", "(", "\"`get_framework` is deprecated and will be removed in v5, use `infer_framework_from_model` instead.\"", ",", "FutureWarning", ",...
[ 98, 0 ]
[ 129, 20 ]
python
en
['en', 'error', 'th']
False
get_default_model
(targeted_task: Dict, framework: Optional[str], task_options: Optional[Any])
Select a default model to use for a given task. Defaults to pytorch if ambiguous. Args: targeted_task (:obj:`Dict` ): Dictionary representing the given task, that should contain default models framework (:obj:`str`, None) "pt", "tf" or None, representing a specific frame...
Select a default model to use for a given task. Defaults to pytorch if ambiguous.
def get_default_model(targeted_task: Dict, framework: Optional[str], task_options: Optional[Any]) -> str: """ Select a default model to use for a given task. Defaults to pytorch if ambiguous. Args: targeted_task (:obj:`Dict` ): Dictionary representing the given task, that should contain ...
[ "def", "get_default_model", "(", "targeted_task", ":", "Dict", ",", "framework", ":", "Optional", "[", "str", "]", ",", "task_options", ":", "Optional", "[", "Any", "]", ")", "->", "str", ":", "if", "is_torch_available", "(", ")", "and", "not", "is_tf_avai...
[ 132, 0 ]
[ 171, 36 ]
python
en
['en', 'error', 'th']
False
PipelineDataFormat.save
(self, data: Union[dict, List[dict]])
Save the provided data object with the representation for the current :class:`~transformers.pipelines.PipelineDataFormat`. Args: data (:obj:`dict` or list of :obj:`dict`): The data to store.
Save the provided data object with the representation for the current :class:`~transformers.pipelines.PipelineDataFormat`.
def save(self, data: Union[dict, List[dict]]): """ Save the provided data object with the representation for the current :class:`~transformers.pipelines.PipelineDataFormat`. Args: data (:obj:`dict` or list of :obj:`dict`): The data to store. """ raise NotImpl...
[ "def", "save", "(", "self", ",", "data", ":", "Union", "[", "dict", ",", "List", "[", "dict", "]", "]", ")", ":", "raise", "NotImplementedError", "(", ")" ]
[ 251, 4 ]
[ 259, 35 ]
python
en
['en', 'error', 'th']
False
PipelineDataFormat.save_binary
(self, data: Union[dict, List[dict]])
Save the provided data object as a pickle-formatted binary data on the disk. Args: data (:obj:`dict` or list of :obj:`dict`): The data to store. Returns: :obj:`str`: Path where the data has been saved.
Save the provided data object as a pickle-formatted binary data on the disk.
def save_binary(self, data: Union[dict, List[dict]]) -> str: """ Save the provided data object as a pickle-formatted binary data on the disk. Args: data (:obj:`dict` or list of :obj:`dict`): The data to store. Returns: :obj:`str`: Path where the data has been sa...
[ "def", "save_binary", "(", "self", ",", "data", ":", "Union", "[", "dict", ",", "List", "[", "dict", "]", "]", ")", "->", "str", ":", "path", ",", "_", "=", "os", ".", "path", ".", "splitext", "(", "self", ".", "output_path", ")", "binary_path", ...
[ 261, 4 ]
[ 277, 26 ]
python
en
['en', 'error', 'th']
False
PipelineDataFormat.from_str
( format: str, output_path: Optional[str], input_path: Optional[str], column: Optional[str], overwrite=False, )
Creates an instance of the right subclass of :class:`~transformers.pipelines.PipelineDataFormat` depending on :obj:`format`. Args: format: (:obj:`str`): The format of the desired pipeline. Acceptable values are :obj:`"json"`, :obj:`"csv"` or :obj:`"pipe"`. ...
Creates an instance of the right subclass of :class:`~transformers.pipelines.PipelineDataFormat` depending on :obj:`format`.
def from_str( format: str, output_path: Optional[str], input_path: Optional[str], column: Optional[str], overwrite=False, ) -> "PipelineDataFormat": """ Creates an instance of the right subclass of :class:`~transformers.pipelines.PipelineDataFormat` depending ...
[ "def", "from_str", "(", "format", ":", "str", ",", "output_path", ":", "Optional", "[", "str", "]", ",", "input_path", ":", "Optional", "[", "str", "]", ",", "column", ":", "Optional", "[", "str", "]", ",", "overwrite", "=", "False", ",", ")", "->", ...
[ 280, 4 ]
[ 313, 99 ]
python
en
['en', 'error', 'th']
False
CsvPipelineDataFormat.save
(self, data: List[dict])
Save the provided data object with the representation for the current :class:`~transformers.pipelines.PipelineDataFormat`. Args: data (:obj:`List[dict]`): The data to store.
Save the provided data object with the representation for the current :class:`~transformers.pipelines.PipelineDataFormat`.
def save(self, data: List[dict]): """ Save the provided data object with the representation for the current :class:`~transformers.pipelines.PipelineDataFormat`. Args: data (:obj:`List[dict]`): The data to store. """ with open(self.output_path, "w") as f: ...
[ "def", "save", "(", "self", ",", "data", ":", "List", "[", "dict", "]", ")", ":", "with", "open", "(", "self", ".", "output_path", ",", "\"w\"", ")", "as", "f", ":", "if", "len", "(", "data", ")", ">", "0", ":", "writer", "=", "csv", ".", "Di...
[ 346, 4 ]
[ 358, 38 ]
python
en
['en', 'error', 'th']
False
JsonPipelineDataFormat.save
(self, data: dict)
Save the provided data object in a json file. Args: data (:obj:`dict`): The data to store.
Save the provided data object in a json file.
def save(self, data: dict): """ Save the provided data object in a json file. Args: data (:obj:`dict`): The data to store. """ with open(self.output_path, "w") as f: json.dump(data, f)
[ "def", "save", "(", "self", ",", "data", ":", "dict", ")", ":", "with", "open", "(", "self", ".", "output_path", ",", "\"w\"", ")", "as", "f", ":", "json", ".", "dump", "(", "data", ",", "f", ")" ]
[ 392, 4 ]
[ 400, 30 ]
python
en
['en', 'error', 'th']
False
PipedPipelineDataFormat.save
(self, data: dict)
Print the data. Args: data (:obj:`dict`): The data to store.
Print the data.
def save(self, data: dict): """ Print the data. Args: data (:obj:`dict`): The data to store. """ print(data)
[ "def", "save", "(", "self", ",", "data", ":", "dict", ")", ":", "print", "(", "data", ")" ]
[ 433, 4 ]
[ 440, 19 ]
python
en
['en', 'error', 'th']
False
async_setup
(hass)
Set up the Automation config API.
Set up the Automation config API.
async def async_setup(hass): """Set up the Automation config API.""" async def hook(action, config_key): """post_write_hook for Config View that reloads automations.""" await hass.services.async_call(DOMAIN, SERVICE_RELOAD) if action != ACTION_DELETE: return ent_re...
[ "async", "def", "async_setup", "(", "hass", ")", ":", "async", "def", "hook", "(", "action", ",", "config_key", ")", ":", "\"\"\"post_write_hook for Config View that reloads automations.\"\"\"", "await", "hass", ".", "services", ".", "async_call", "(", "DOMAIN", ","...
[ 16, 0 ]
[ 46, 15 ]
python
en
['en', 'en', 'en']
True
async_describe_on_off_states
( hass: HomeAssistantType, registry: GroupIntegrationRegistry )
Describe group on off states.
Describe group on off states.
def async_describe_on_off_states( hass: HomeAssistantType, registry: GroupIntegrationRegistry ) -> None: """Describe group on off states.""" registry.on_off_states( {STATE_CLEANING, STATE_ON, STATE_RETURNING, STATE_ERROR}, STATE_OFF )
[ "def", "async_describe_on_off_states", "(", "hass", ":", "HomeAssistantType", ",", "registry", ":", "GroupIntegrationRegistry", ")", "->", "None", ":", "registry", ".", "on_off_states", "(", "{", "STATE_CLEANING", ",", "STATE_ON", ",", "STATE_RETURNING", ",", "STATE...
[ 12, 0 ]
[ 18, 5 ]
python
en
['en', 'en', 'en']
True
RoonServer.__init__
(self, hass, config_entry)
Initialize the system.
Initialize the system.
def __init__(self, hass, config_entry): """Initialize the system.""" self.config_entry = config_entry self.hass = hass self.roonapi = None self.all_player_ids = set() self.all_playlists = [] self.offline_devices = set() self._exit = False self._roo...
[ "def", "__init__", "(", "self", ",", "hass", ",", "config_entry", ")", ":", "self", ".", "config_entry", "=", "config_entry", "self", ".", "hass", "=", "hass", "self", ".", "roonapi", "=", "None", "self", ".", "all_player_ids", "=", "set", "(", ")", "s...
[ 19, 4 ]
[ 28, 34 ]
python
en
['en', 'en', 'en']
True
RoonServer.host
(self)
Return the host of this server.
Return the host of this server.
def host(self): """Return the host of this server.""" return self.config_entry.data[CONF_HOST]
[ "def", "host", "(", "self", ")", ":", "return", "self", ".", "config_entry", ".", "data", "[", "CONF_HOST", "]" ]
[ 31, 4 ]
[ 33, 48 ]
python
en
['en', 'en', 'en']
True
RoonServer.async_setup
(self, tries=0)
Set up a roon server based on host parameter.
Set up a roon server based on host parameter.
async def async_setup(self, tries=0): """Set up a roon server based on host parameter.""" host = self.host hass = self.hass token = self.config_entry.data[CONF_API_KEY] _LOGGER.debug("async_setup: %s %s", token, host) self.roonapi = RoonApi(ROON_APPINFO, token, host, bloc...
[ "async", "def", "async_setup", "(", "self", ",", "tries", "=", "0", ")", ":", "host", "=", "self", ".", "host", "hass", "=", "self", ".", "hass", "token", "=", "self", ".", "config_entry", ".", "data", "[", "CONF_API_KEY", "]", "_LOGGER", ".", "debug...
[ 35, 4 ]
[ 56, 19 ]
python
en
['en', 'da', 'en']
True
RoonServer.async_reset
(self)
Reset this connection to default state. Will cancel any scheduled setup retry and will unload the config entry.
Reset this connection to default state.
async def async_reset(self): """Reset this connection to default state. Will cancel any scheduled setup retry and will unload the config entry. """ self.stop_roon() return True
[ "async", "def", "async_reset", "(", "self", ")", ":", "self", ".", "stop_roon", "(", ")", "return", "True" ]
[ 58, 4 ]
[ 65, 19 ]
python
en
['en', 'en', 'en']
True
RoonServer.zones
(self)
Return list of zones.
Return list of zones.
def zones(self): """Return list of zones.""" return self.roonapi.zones
[ "def", "zones", "(", "self", ")", ":", "return", "self", ".", "roonapi", ".", "zones" ]
[ 68, 4 ]
[ 70, 33 ]
python
en
['en', 'nl', 'en']
True
RoonServer.add_player_id
(self, entity_id, roon_name)
Register a roon player.
Register a roon player.
def add_player_id(self, entity_id, roon_name): """Register a roon player.""" self._roon_name_by_id[entity_id] = roon_name
[ "def", "add_player_id", "(", "self", ",", "entity_id", ",", "roon_name", ")", ":", "self", ".", "_roon_name_by_id", "[", "entity_id", "]", "=", "roon_name" ]
[ 72, 4 ]
[ 74, 52 ]
python
en
['en', 'en', 'en']
True
RoonServer.roon_name
(self, entity_id)
Get the name of the roon player from entity_id.
Get the name of the roon player from entity_id.
def roon_name(self, entity_id): """Get the name of the roon player from entity_id.""" return self._roon_name_by_id.get(entity_id)
[ "def", "roon_name", "(", "self", ",", "entity_id", ")", ":", "return", "self", ".", "_roon_name_by_id", ".", "get", "(", "entity_id", ")" ]
[ 76, 4 ]
[ 78, 51 ]
python
en
['en', 'en', 'en']
True
RoonServer.stop_roon
(self)
Stop background worker.
Stop background worker.
def stop_roon(self): """Stop background worker.""" self.roonapi.stop() self._exit = True
[ "def", "stop_roon", "(", "self", ")", ":", "self", ".", "roonapi", ".", "stop", "(", ")", "self", ".", "_exit", "=", "True" ]
[ 80, 4 ]
[ 83, 25 ]
python
en
['en', 'en', 'en']
True
RoonServer.roonapi_state_callback
(self, event, changed_zones)
Callbacks from the roon api websockets.
Callbacks from the roon api websockets.
def roonapi_state_callback(self, event, changed_zones): """Callbacks from the roon api websockets.""" self.hass.add_job(self.async_update_changed_players(changed_zones))
[ "def", "roonapi_state_callback", "(", "self", ",", "event", ",", "changed_zones", ")", ":", "self", ".", "hass", ".", "add_job", "(", "self", ".", "async_update_changed_players", "(", "changed_zones", ")", ")" ]
[ 85, 4 ]
[ 87, 75 ]
python
en
['en', 'mg', 'en']
True
RoonServer.async_do_loop
(self)
Background work loop.
Background work loop.
async def async_do_loop(self): """Background work loop.""" self._exit = False while not self._exit: await self.async_update_players() # await self.async_update_playlists() await asyncio.sleep(FULL_SYNC_INTERVAL)
[ "async", "def", "async_do_loop", "(", "self", ")", ":", "self", ".", "_exit", "=", "False", "while", "not", "self", ".", "_exit", ":", "await", "self", ".", "async_update_players", "(", ")", "# await self.async_update_playlists()", "await", "asyncio", ".", "sl...
[ 89, 4 ]
[ 95, 51 ]
python
en
['en', 'af', 'en']
True
RoonServer.async_update_changed_players
(self, changed_zones_ids)
Update the players which were reported as changed by the Roon API.
Update the players which were reported as changed by the Roon API.
async def async_update_changed_players(self, changed_zones_ids): """Update the players which were reported as changed by the Roon API.""" for zone_id in changed_zones_ids: if zone_id not in self.roonapi.zones: # device was removed ? continue zone =...
[ "async", "def", "async_update_changed_players", "(", "self", ",", "changed_zones_ids", ")", ":", "for", "zone_id", "in", "changed_zones_ids", ":", "if", "zone_id", "not", "in", "self", ".", "roonapi", ".", "zones", ":", "# device was removed ?", "continue", "zone"...
[ 97, 4 ]
[ 116, 47 ]
python
en
['en', 'en', 'en']
True
RoonServer.async_update_players
(self)
Periodic full scan of all devices.
Periodic full scan of all devices.
async def async_update_players(self): """Periodic full scan of all devices.""" zone_ids = self.roonapi.zones.keys() await self.async_update_changed_players(zone_ids) # check for any removed devices all_devs = {} for zone in self.roonapi.zones.values(): for dev...
[ "async", "def", "async_update_players", "(", "self", ")", ":", "zone_ids", "=", "self", ".", "roonapi", ".", "zones", ".", "keys", "(", ")", "await", "self", ".", "async_update_changed_players", "(", "zone_ids", ")", "# check for any removed devices", "all_devs", ...
[ 118, 4 ]
[ 136, 44 ]
python
en
['en', 'en', 'en']
True
RoonServer.async_update_playlists
(self)
Store lists in memory with all playlists - could be used by a custom lovelace card.
Store lists in memory with all playlists - could be used by a custom lovelace card.
async def async_update_playlists(self): """Store lists in memory with all playlists - could be used by a custom lovelace card.""" all_playlists = [] roon_playlists = self.roonapi.playlists() if roon_playlists and "items" in roon_playlists: all_playlists += [item["title"] for ...
[ "async", "def", "async_update_playlists", "(", "self", ")", ":", "all_playlists", "=", "[", "]", "roon_playlists", "=", "self", ".", "roonapi", ".", "playlists", "(", ")", "if", "roon_playlists", "and", "\"items\"", "in", "roon_playlists", ":", "all_playlists", ...
[ 138, 4 ]
[ 147, 42 ]
python
en
['en', 'en', 'en']
True
RoonServer.async_create_player_data
(self, zone, output)
Create player object dict by combining zone with output.
Create player object dict by combining zone with output.
async def async_create_player_data(self, zone, output): """Create player object dict by combining zone with output.""" new_dict = zone.copy() new_dict.update(output) new_dict.pop("outputs") new_dict["host"] = self.host new_dict["is_synced"] = len(zone["outputs"]) > 1 ...
[ "async", "def", "async_create_player_data", "(", "self", ",", "zone", ",", "output", ")", ":", "new_dict", "=", "zone", ".", "copy", "(", ")", "new_dict", ".", "update", "(", "output", ")", "new_dict", ".", "pop", "(", "\"outputs\"", ")", "new_dict", "["...
[ 149, 4 ]
[ 161, 23 ]
python
en
['en', 'en', 'en']
True
_generate_mock_feed_entry
( external_id, title, alert_level, distance_to_home, coordinates, attribution=None, activity=None, hazards=None, )
Construct a mock feed entry for testing purposes.
Construct a mock feed entry for testing purposes.
def _generate_mock_feed_entry( external_id, title, alert_level, distance_to_home, coordinates, attribution=None, activity=None, hazards=None, ): """Construct a mock feed entry for testing purposes.""" feed_entry = MagicMock() feed_entry.external_id = external_id feed_entr...
[ "def", "_generate_mock_feed_entry", "(", "external_id", ",", "title", ",", "alert_level", ",", "distance_to_home", ",", "coordinates", ",", "attribution", "=", "None", ",", "activity", "=", "None", ",", "hazards", "=", "None", ",", ")", ":", "feed_entry", "=",...
[ 4, 0 ]
[ 24, 21 ]
python
en
['en', 'en', 'en']
True
async_setup
(hass, config)
Set up the ProgettiHWSW Automation component.
Set up the ProgettiHWSW Automation component.
async def async_setup(hass, config): """Set up the ProgettiHWSW Automation component.""" hass.data[DOMAIN] = {} return True
[ "async", "def", "async_setup", "(", "hass", ",", "config", ")", ":", "hass", ".", "data", "[", "DOMAIN", "]", "=", "{", "}", "return", "True" ]
[ 15, 0 ]
[ 19, 15 ]
python
en
['en', 'en', 'en']
True
async_setup_entry
(hass: HomeAssistant, entry: ConfigEntry)
Set up ProgettiHWSW Automation from a config entry.
Set up ProgettiHWSW Automation from a config entry.
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry): """Set up ProgettiHWSW Automation from a config entry.""" hass.data[DOMAIN][entry.entry_id] = ProgettiHWSWAPI( f'{entry.data["host"]}:{entry.data["port"]}' ) # Check board validation again to load new values to API. awai...
[ "async", "def", "async_setup_entry", "(", "hass", ":", "HomeAssistant", ",", "entry", ":", "ConfigEntry", ")", ":", "hass", ".", "data", "[", "DOMAIN", "]", "[", "entry", ".", "entry_id", "]", "=", "ProgettiHWSWAPI", "(", "f'{entry.data[\"host\"]}:{entry.data[\"...
[ 22, 0 ]
[ 37, 15 ]
python
en
['en', 'en', 'en']
True