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
ZWaveDeviceEntity.available
(self)
Return entity availability.
Return entity availability.
def available(self) -> bool: """Return entity availability.""" # Use OZW Daemon status for availability. instance_status = self.values.primary.ozw_instance.get_status() return instance_status and instance_status.status in OZW_READY_STATES_VALUES
[ "def", "available", "(", "self", ")", "->", "bool", ":", "# Use OZW Daemon status for availability.", "instance_status", "=", "self", ".", "values", ".", "primary", ".", "ozw_instance", ".", "get_status", "(", ")", "return", "instance_status", "and", "instance_statu...
[ 227, 4 ]
[ 231, 84 ]
python
en
['en', 'ga', 'en']
True
ZWaveDeviceEntity._value_changed
(self, value)
Call when a value from ZWaveDeviceEntityValues is changed. Should not be overridden by subclasses.
Call when a value from ZWaveDeviceEntityValues is changed.
def _value_changed(self, value): """Call when a value from ZWaveDeviceEntityValues is changed. Should not be overridden by subclasses. """ if value.value_id_key in (v.value_id_key for v in self.values if v): self.on_value_update() self.async_write_ha_state()
[ "def", "_value_changed", "(", "self", ",", "value", ")", ":", "if", "value", ".", "value_id_key", "in", "(", "v", ".", "value_id_key", "for", "v", "in", "self", ".", "values", "if", "v", ")", ":", "self", ".", "on_value_update", "(", ")", "self", "."...
[ 234, 4 ]
[ 241, 39 ]
python
en
['en', 'en', 'en']
True
ZWaveDeviceEntity._value_added
(self)
Call when a value from ZWaveDeviceEntityValues is added. Should not be overridden by subclasses.
Call when a value from ZWaveDeviceEntityValues is added.
def _value_added(self): """Call when a value from ZWaveDeviceEntityValues is added. Should not be overridden by subclasses. """ self.on_value_update()
[ "def", "_value_added", "(", "self", ")", ":", "self", ".", "on_value_update", "(", ")" ]
[ 244, 4 ]
[ 249, 30 ]
python
en
['en', 'en', 'en']
True
ZWaveDeviceEntity._instance_updated
(self, new_status)
Call when the instance status changes. Should not be overridden by subclasses.
Call when the instance status changes.
def _instance_updated(self, new_status): """Call when the instance status changes. Should not be overridden by subclasses. """ self.on_value_update() self.async_write_ha_state()
[ "def", "_instance_updated", "(", "self", ",", "new_status", ")", ":", "self", ".", "on_value_update", "(", ")", "self", ".", "async_write_ha_state", "(", ")" ]
[ 252, 4 ]
[ 258, 35 ]
python
en
['en', 'en', 'en']
True
ZWaveDeviceEntity.should_poll
(self)
No polling needed.
No polling needed.
def should_poll(self): """No polling needed.""" return False
[ "def", "should_poll", "(", "self", ")", ":", "return", "False" ]
[ 261, 4 ]
[ 263, 20 ]
python
en
['en', 'en', 'en']
True
ZWaveDeviceEntity._delete_callback
(self, values_id)
Remove this entity.
Remove this entity.
async def _delete_callback(self, values_id): """Remove this entity.""" if not self.values: return # race condition: delete already requested if values_id == self.values.values_id: await self.async_remove()
[ "async", "def", "_delete_callback", "(", "self", ",", "values_id", ")", ":", "if", "not", "self", ".", "values", ":", "return", "# race condition: delete already requested", "if", "values_id", "==", "self", ".", "values", ".", "values_id", ":", "await", "self", ...
[ 265, 4 ]
[ 270, 37 ]
python
en
['en', 'en', 'en']
True
send
(command, data)
Send command to Training Service. command: CommandType object. data: string payload.
Send command to Training Service. command: CommandType object. data: string payload.
def send(command, data): """Send command to Training Service. command: CommandType object. data: string payload. """ global _lock try: _lock.acquire() data = data.encode('utf8') msg = b'%b%014d%b' % (command.value, len(data), data) _logger.debug('Sending command, ...
[ "def", "send", "(", "command", ",", "data", ")", ":", "global", "_lock", "try", ":", "_lock", ".", "acquire", "(", ")", "data", "=", "data", ".", "encode", "(", "'utf8'", ")", "msg", "=", "b'%b%014d%b'", "%", "(", "command", ".", "value", ",", "len...
[ 39, 0 ]
[ 53, 23 ]
python
en
['en', 'en', 'en']
True
receive
()
Receive a command from Training Service. Returns a tuple of command (CommandType) and payload (str)
Receive a command from Training Service. Returns a tuple of command (CommandType) and payload (str)
def receive(): """Receive a command from Training Service. Returns a tuple of command (CommandType) and payload (str) """ header = _in_file.read(16) _logger.debug('Received command, header: [%s]', header) if header is None or len(header) < 16: # Pipe EOF encountered _logger.debug...
[ "def", "receive", "(", ")", ":", "header", "=", "_in_file", ".", "read", "(", "16", ")", "_logger", ".", "debug", "(", "'Received command, header: [%s]'", ",", "header", ")", "if", "header", "is", "None", "or", "len", "(", "header", ")", "<", "16", ":"...
[ 56, 0 ]
[ 71, 24 ]
python
en
['en', 'en', 'en']
True
test_entity_and_device_attributes
(hass, device_factory)
Test the attributes of the entity are correct.
Test the attributes of the entity are correct.
async def test_entity_and_device_attributes(hass, device_factory): """Test the attributes of the entity are correct.""" # Arrange device = device_factory( "Garage", [Capability.garage_door_control], {Attribute.door: "open"} ) entity_registry = await hass.helpers.entity_registry.async_get_reg...
[ "async", "def", "test_entity_and_device_attributes", "(", "hass", ",", "device_factory", ")", ":", "# Arrange", "device", "=", "device_factory", "(", "\"Garage\"", ",", "[", "Capability", ".", "garage_door_control", "]", ",", "{", "Attribute", ".", "door", ":", ...
[ 27, 0 ]
[ 46, 46 ]
python
en
['en', 'en', 'en']
True
test_open
(hass, device_factory)
Test the cover opens doors, garages, and shades successfully.
Test the cover opens doors, garages, and shades successfully.
async def test_open(hass, device_factory): """Test the cover opens doors, garages, and shades successfully.""" # Arrange devices = { device_factory("Door", [Capability.door_control], {Attribute.door: "closed"}), device_factory( "Garage", [Capability.garage_door_control], {Attribu...
[ "async", "def", "test_open", "(", "hass", ",", "device_factory", ")", ":", "# Arrange", "devices", "=", "{", "device_factory", "(", "\"Door\"", ",", "[", "Capability", ".", "door_control", "]", ",", "{", "Attribute", ".", "door", ":", "\"closed\"", "}", ")...
[ 49, 0 ]
[ 71, 43 ]
python
en
['en', 'en', 'en']
True
test_close
(hass, device_factory)
Test the cover closes doors, garages, and shades successfully.
Test the cover closes doors, garages, and shades successfully.
async def test_close(hass, device_factory): """Test the cover closes doors, garages, and shades successfully.""" # Arrange devices = { device_factory("Door", [Capability.door_control], {Attribute.door: "open"}), device_factory( "Garage", [Capability.garage_door_control], {Attribu...
[ "async", "def", "test_close", "(", "hass", ",", "device_factory", ")", ":", "# Arrange", "devices", "=", "{", "device_factory", "(", "\"Door\"", ",", "[", "Capability", ".", "door_control", "]", ",", "{", "Attribute", ".", "door", ":", "\"open\"", "}", ")"...
[ 74, 0 ]
[ 96, 43 ]
python
en
['en', 'en', 'en']
True
test_set_cover_position
(hass, device_factory)
Test the cover sets to the specific position.
Test the cover sets to the specific position.
async def test_set_cover_position(hass, device_factory): """Test the cover sets to the specific position.""" # Arrange device = device_factory( "Shade", [Capability.window_shade, Capability.battery, Capability.switch_level], {Attribute.window_shade: "opening", Attribute.battery: 95, ...
[ "async", "def", "test_set_cover_position", "(", "hass", ",", "device_factory", ")", ":", "# Arrange", "device", "=", "device_factory", "(", "\"Shade\"", ",", "[", "Capability", ".", "window_shade", ",", "Capability", ".", "battery", ",", "Capability", ".", "swit...
[ 99, 0 ]
[ 123, 58 ]
python
en
['en', 'en', 'en']
True
test_set_cover_position_unsupported
(hass, device_factory)
Test set position does nothing when not supported by device.
Test set position does nothing when not supported by device.
async def test_set_cover_position_unsupported(hass, device_factory): """Test set position does nothing when not supported by device.""" # Arrange device = device_factory( "Shade", [Capability.window_shade], {Attribute.window_shade: "opening"} ) await setup_platform(hass, COVER_DOMAIN, device...
[ "async", "def", "test_set_cover_position_unsupported", "(", "hass", ",", "device_factory", ")", ":", "# Arrange", "device", "=", "device_factory", "(", "\"Shade\"", ",", "[", "Capability", ".", "window_shade", "]", ",", "{", "Attribute", ".", "window_shade", ":", ...
[ 126, 0 ]
[ 146, 58 ]
python
en
['en', 'en', 'en']
True
test_update_to_open_from_signal
(hass, device_factory)
Test the cover updates to open when receiving a signal.
Test the cover updates to open when receiving a signal.
async def test_update_to_open_from_signal(hass, device_factory): """Test the cover updates to open when receiving a signal.""" # Arrange device = device_factory( "Garage", [Capability.garage_door_control], {Attribute.door: "opening"} ) await setup_platform(hass, COVER_DOMAIN, devices=[device...
[ "async", "def", "test_update_to_open_from_signal", "(", "hass", ",", "device_factory", ")", ":", "# Arrange", "device", "=", "device_factory", "(", "\"Garage\"", ",", "[", "Capability", ".", "garage_door_control", "]", ",", "{", "Attribute", ".", "door", ":", "\...
[ 149, 0 ]
[ 164, 36 ]
python
en
['en', 'en', 'en']
True
test_update_to_closed_from_signal
(hass, device_factory)
Test the cover updates to closed when receiving a signal.
Test the cover updates to closed when receiving a signal.
async def test_update_to_closed_from_signal(hass, device_factory): """Test the cover updates to closed when receiving a signal.""" # Arrange device = device_factory( "Garage", [Capability.garage_door_control], {Attribute.door: "closing"} ) await setup_platform(hass, COVER_DOMAIN, devices=[de...
[ "async", "def", "test_update_to_closed_from_signal", "(", "hass", ",", "device_factory", ")", ":", "# Arrange", "device", "=", "device_factory", "(", "\"Garage\"", ",", "[", "Capability", ".", "garage_door_control", "]", ",", "{", "Attribute", ".", "door", ":", ...
[ 167, 0 ]
[ 182, 38 ]
python
en
['en', 'en', 'en']
True
test_unload_config_entry
(hass, device_factory)
Test the lock is removed when the config entry is unloaded.
Test the lock is removed when the config entry is unloaded.
async def test_unload_config_entry(hass, device_factory): """Test the lock is removed when the config entry is unloaded.""" # Arrange device = device_factory( "Garage", [Capability.garage_door_control], {Attribute.door: "open"} ) config_entry = await setup_platform(hass, COVER_DOMAIN, device...
[ "async", "def", "test_unload_config_entry", "(", "hass", ",", "device_factory", ")", ":", "# Arrange", "device", "=", "device_factory", "(", "\"Garage\"", ",", "[", "Capability", ".", "garage_door_control", "]", ",", "{", "Attribute", ".", "door", ":", "\"open\"...
[ 185, 0 ]
[ 195, 46 ]
python
en
['en', 'en', 'en']
True
async_setup_platform
(hass, config, async_add_entities, discovery_info=None)
Set up the device.
Set up the device.
async def async_setup_platform(hass, config, async_add_entities, discovery_info=None): """Set up the device.""" host = config[CONF_HOST] mac_address = config[CONF_MAC] device_name = config.get(CONF_NAME) if not hass.data.get(DATA_RSN): hass.data[DATA_RSN] = RSNetwork() job = hass.d...
[ "async", "def", "async_setup_platform", "(", "hass", ",", "config", ",", "async_add_entities", ",", "discovery_info", "=", "None", ")", ":", "host", "=", "config", "[", "CONF_HOST", "]", "mac_address", "=", "config", "[", "CONF_MAC", "]", "device_name", "=", ...
[ 26, 0 ]
[ 39, 75 ]
python
en
['en', 'en', 'en']
True
RecSwitchSwitch.__init__
(self, device, device_name, mac_address)
Initialize a recswitch device.
Initialize a recswitch device.
def __init__(self, device, device_name, mac_address): """Initialize a recswitch device.""" self.gpio_state = False self.device = device self.device_name = device_name self.mac_address = mac_address if not self.device_name: self.device_name = DEFAULT_NAME.forma...
[ "def", "__init__", "(", "self", ",", "device", ",", "device_name", ",", "mac_address", ")", ":", "self", ".", "gpio_state", "=", "False", "self", ".", "device", "=", "device", "self", ".", "device_name", "=", "device_name", "self", ".", "mac_address", "=",...
[ 45, 4 ]
[ 52, 68 ]
python
en
['en', 'en', 'en']
True
RecSwitchSwitch.unique_id
(self)
Return the switch unique ID.
Return the switch unique ID.
def unique_id(self): """Return the switch unique ID.""" return self.mac_address
[ "def", "unique_id", "(", "self", ")", ":", "return", "self", ".", "mac_address" ]
[ 55, 4 ]
[ 57, 31 ]
python
en
['en', 'en', 'en']
True
RecSwitchSwitch.name
(self)
Return the switch name.
Return the switch name.
def name(self): """Return the switch name.""" return self.device_name
[ "def", "name", "(", "self", ")", ":", "return", "self", ".", "device_name" ]
[ 60, 4 ]
[ 62, 31 ]
python
en
['en', 'en', 'en']
True
RecSwitchSwitch.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.gpio_state
[ "def", "is_on", "(", "self", ")", ":", "return", "self", ".", "gpio_state" ]
[ 65, 4 ]
[ 67, 30 ]
python
en
['en', 'fy', 'en']
True
RecSwitchSwitch.async_turn_on
(self, **kwargs)
Turn on the switch.
Turn on the switch.
async def async_turn_on(self, **kwargs): """Turn on the switch.""" await self.async_set_gpio_status(True)
[ "async", "def", "async_turn_on", "(", "self", ",", "*", "*", "kwargs", ")", ":", "await", "self", ".", "async_set_gpio_status", "(", "True", ")" ]
[ 69, 4 ]
[ 71, 46 ]
python
en
['en', 'en', 'en']
True
RecSwitchSwitch.async_turn_off
(self, **kwargs)
Turn off the switch.
Turn off the switch.
async def async_turn_off(self, **kwargs): """Turn off the switch.""" await self.async_set_gpio_status(False)
[ "async", "def", "async_turn_off", "(", "self", ",", "*", "*", "kwargs", ")", ":", "await", "self", ".", "async_set_gpio_status", "(", "False", ")" ]
[ 73, 4 ]
[ 75, 47 ]
python
en
['en', 'en', 'en']
True
RecSwitchSwitch.async_set_gpio_status
(self, status)
Set the switch status.
Set the switch status.
async def async_set_gpio_status(self, status): """Set the switch status.""" try: ret = await self.device.set_gpio_status(status) self.gpio_state = ret.state except RSNetworkError as error: _LOGGER.error("Setting status to %s: %r", self.name, error)
[ "async", "def", "async_set_gpio_status", "(", "self", ",", "status", ")", ":", "try", ":", "ret", "=", "await", "self", ".", "device", ".", "set_gpio_status", "(", "status", ")", "self", ".", "gpio_state", "=", "ret", ".", "state", "except", "RSNetworkErro...
[ 77, 4 ]
[ 84, 71 ]
python
en
['en', 'ja', 'en']
True
RecSwitchSwitch.async_update
(self)
Update the current switch status.
Update the current switch status.
async def async_update(self): """Update the current switch status.""" try: ret = await self.device.get_gpio_status() self.gpio_state = ret.state except RSNetworkError as error: _LOGGER.error("Reading status from %s: %r", self.name, error)
[ "async", "def", "async_update", "(", "self", ")", ":", "try", ":", "ret", "=", "await", "self", ".", "device", ".", "get_gpio_status", "(", ")", "self", ".", "gpio_state", "=", "ret", ".", "state", "except", "RSNetworkError", "as", "error", ":", "_LOGGER...
[ 86, 4 ]
[ 93, 73 ]
python
en
['en', 'en', 'en']
True
async_register
(hass, domain, name, webhook_id, handler)
Register a webhook.
Register a webhook.
def async_register(hass, domain, name, webhook_id, handler): """Register a webhook.""" handlers = hass.data.setdefault(DOMAIN, {}) if webhook_id in handlers: raise ValueError("Handler is already defined!") handlers[webhook_id] = {"domain": domain, "name": name, "handler": handler}
[ "def", "async_register", "(", "hass", ",", "domain", ",", "name", ",", "webhook_id", ",", "handler", ")", ":", "handlers", "=", "hass", ".", "data", ".", "setdefault", "(", "DOMAIN", ",", "{", "}", ")", "if", "webhook_id", "in", "handlers", ":", "raise...
[ 30, 0 ]
[ 37, 79 ]
python
en
['en', 'lb', 'en']
True
async_unregister
(hass, webhook_id)
Remove a webhook.
Remove a webhook.
def async_unregister(hass, webhook_id): """Remove a webhook.""" handlers = hass.data.setdefault(DOMAIN, {}) handlers.pop(webhook_id, None)
[ "def", "async_unregister", "(", "hass", ",", "webhook_id", ")", ":", "handlers", "=", "hass", ".", "data", ".", "setdefault", "(", "DOMAIN", ",", "{", "}", ")", "handlers", ".", "pop", "(", "webhook_id", ",", "None", ")" ]
[ 42, 0 ]
[ 45, 34 ]
python
en
['en', 'hu', 'en']
True
async_generate_id
()
Generate a webhook_id.
Generate a webhook_id.
def async_generate_id(): """Generate a webhook_id.""" return secrets.token_hex(32)
[ "def", "async_generate_id", "(", ")", ":", "return", "secrets", ".", "token_hex", "(", "32", ")" ]
[ 49, 0 ]
[ 51, 32 ]
python
en
['en', 'en', 'it']
True
async_generate_url
(hass, webhook_id)
Generate the full URL for a webhook_id.
Generate the full URL for a webhook_id.
def async_generate_url(hass, webhook_id): """Generate the full URL for a webhook_id.""" return "{}{}".format( get_url(hass, prefer_external=True, allow_cloud=False), async_generate_path(webhook_id), )
[ "def", "async_generate_url", "(", "hass", ",", "webhook_id", ")", ":", "return", "\"{}{}\"", ".", "format", "(", "get_url", "(", "hass", ",", "prefer_external", "=", "True", ",", "allow_cloud", "=", "False", ")", ",", "async_generate_path", "(", "webhook_id", ...
[ 56, 0 ]
[ 61, 5 ]
python
en
['en', 'en', 'en']
True
async_generate_path
(webhook_id)
Generate the path component for a webhook_id.
Generate the path component for a webhook_id.
def async_generate_path(webhook_id): """Generate the path component for a webhook_id.""" return URL_WEBHOOK_PATH.format(webhook_id=webhook_id)
[ "def", "async_generate_path", "(", "webhook_id", ")", ":", "return", "URL_WEBHOOK_PATH", ".", "format", "(", "webhook_id", "=", "webhook_id", ")" ]
[ 65, 0 ]
[ 67, 57 ]
python
en
['en', 'en', 'en']
True
async_handle_webhook
(hass, webhook_id, request)
Handle a webhook.
Handle a webhook.
async def async_handle_webhook(hass, webhook_id, request): """Handle a webhook.""" handlers = hass.data.setdefault(DOMAIN, {}) webhook = handlers.get(webhook_id) # Always respond successfully to not give away if a hook exists or not. if webhook is None: if isinstance(request, MockRequest): ...
[ "async", "def", "async_handle_webhook", "(", "hass", ",", "webhook_id", ",", "request", ")", ":", "handlers", "=", "hass", ".", "data", ".", "setdefault", "(", "DOMAIN", ",", "{", "}", ")", "webhook", "=", "handlers", ".", "get", "(", "webhook_id", ")", ...
[ 71, 0 ]
[ 101, 39 ]
python
en
['en', 'hu', 'pt']
False
async_setup
(hass, config)
Initialize the webhook component.
Initialize the webhook component.
async def async_setup(hass, config): """Initialize the webhook component.""" hass.http.register_view(WebhookView) hass.components.websocket_api.async_register_command( WS_TYPE_LIST, websocket_list, SCHEMA_WS_LIST ) return True
[ "async", "def", "async_setup", "(", "hass", ",", "config", ")", ":", "hass", ".", "http", ".", "register_view", "(", "WebhookView", ")", "hass", ".", "components", ".", "websocket_api", ".", "async_register_command", "(", "WS_TYPE_LIST", ",", "websocket_list", ...
[ 104, 0 ]
[ 110, 15 ]
python
en
['en', 'en', 'en']
True
websocket_list
(hass, connection, msg)
Return a list of webhooks.
Return a list of webhooks.
def websocket_list(hass, connection, msg): """Return a list of webhooks.""" handlers = hass.data.setdefault(DOMAIN, {}) result = [ {"webhook_id": webhook_id, "domain": info["domain"], "name": info["name"]} for webhook_id, info in handlers.items() ] connection.send_message(websocket_...
[ "def", "websocket_list", "(", "hass", ",", "connection", ",", "msg", ")", ":", "handlers", "=", "hass", ".", "data", ".", "setdefault", "(", "DOMAIN", ",", "{", "}", ")", "result", "=", "[", "{", "\"webhook_id\"", ":", "webhook_id", ",", "\"domain\"", ...
[ 133, 0 ]
[ 141, 76 ]
python
en
['en', 'et', 'en']
True
WebhookView._handle
(self, request: Request, webhook_id)
Handle webhook call.
Handle webhook call.
async def _handle(self, request: Request, webhook_id): """Handle webhook call.""" _LOGGER.debug("Handling webhook %s payload for %s", request.method, webhook_id) hass = request.app["hass"] return await async_handle_webhook(hass, webhook_id, request)
[ "async", "def", "_handle", "(", "self", ",", "request", ":", "Request", ",", "webhook_id", ")", ":", "_LOGGER", ".", "debug", "(", "\"Handling webhook %s payload for %s\"", ",", "request", ".", "method", ",", "webhook_id", ")", "hass", "=", "request", ".", "...
[ 121, 4 ]
[ 125, 68 ]
python
en
['en', 'xh', 'en']
True
async_setup
(hass, config)
Set up the sky_hub component.
Set up the sky_hub component.
async def async_setup(hass, config): """Set up the sky_hub component.""" return True
[ "async", "def", "async_setup", "(", "hass", ",", "config", ")", ":", "return", "True" ]
[ 3, 0 ]
[ 5, 15 ]
python
en
['en', 'haw', 'en']
True
NetworkDescriptor.add_skip_connection
(self, u, v, connection_type)
Add a skip-connection to the descriptor. Args: u: Number of convolutional layers before the starting point. v: Number of convolutional layers before the ending point. connection_type: Must be either CONCAT_CONNECT or ADD_CONNECT.
Add a skip-connection to the descriptor. Args: u: Number of convolutional layers before the starting point. v: Number of convolutional layers before the ending point. connection_type: Must be either CONCAT_CONNECT or ADD_CONNECT.
def add_skip_connection(self, u, v, connection_type): """ Add a skip-connection to the descriptor. Args: u: Number of convolutional layers before the starting point. v: Number of convolutional layers before the ending point. connection_type: Must be either CONCAT_CONN...
[ "def", "add_skip_connection", "(", "self", ",", "u", ",", "v", ",", "connection_type", ")", ":", "if", "connection_type", "not", "in", "[", "self", ".", "CONCAT_CONNECT", ",", "self", ".", "ADD_CONNECT", "]", ":", "raise", "ValueError", "(", "\"connection_ty...
[ 57, 4 ]
[ 69, 61 ]
python
en
['en', 'en', 'en']
True
NetworkDescriptor.to_json
(self)
NetworkDescriptor to json representation
NetworkDescriptor to json representation
def to_json(self): ''' NetworkDescriptor to json representation ''' skip_list = [] for u, v, connection_type in self.skip_connections: skip_list.append({"from": u, "to": v, "type": connection_type}) return {"node_list": self.layers, "skip_list": skip_list}
[ "def", "to_json", "(", "self", ")", ":", "skip_list", "=", "[", "]", "for", "u", ",", "v", ",", "connection_type", "in", "self", ".", "skip_connections", ":", "skip_list", ".", "append", "(", "{", "\"from\"", ":", "u", ",", "\"to\"", ":", "v", ",", ...
[ 71, 4 ]
[ 78, 65 ]
python
en
['en', 'gl', 'en']
True
NetworkDescriptor.add_layer
(self, layer)
add one layer
add one layer
def add_layer(self, layer): ''' add one layer ''' self.layers.append(layer)
[ "def", "add_layer", "(", "self", ",", "layer", ")", ":", "self", ".", "layers", ".", "append", "(", "layer", ")" ]
[ 80, 4 ]
[ 84, 33 ]
python
en
['en', 'ne', 'en']
True
Graph.__init__
(self, input_shape, weighted=True)
Initializer for Graph.
Initializer for Graph.
def __init__(self, input_shape, weighted=True): """Initializer for Graph. """ self.input_shape = input_shape self.weighted = weighted self.node_list = [] self.layer_list = [] # node id start with 0 self.node_to_id = {} self.layer_to_id = {} ...
[ "def", "__init__", "(", "self", ",", "input_shape", ",", "weighted", "=", "True", ")", ":", "self", ".", "input_shape", "=", "input_shape", "self", ".", "weighted", "=", "weighted", "self", ".", "node_list", "=", "[", "]", "self", ".", "layer_list", "=",...
[ 125, 4 ]
[ 145, 41 ]
python
en
['en', 'en', 'en']
True
Graph.add_layer
(self, layer, input_node_id)
Add a layer to the Graph. Args: layer: An instance of the subclasses of StubLayer in layers.py. input_node_id: An integer. The ID of the input node of the layer. Returns: output_node_id: An integer. The ID of the output node of the layer.
Add a layer to the Graph. Args: layer: An instance of the subclasses of StubLayer in layers.py. input_node_id: An integer. The ID of the input node of the layer. Returns: output_node_id: An integer. The ID of the output node of the layer.
def add_layer(self, layer, input_node_id): """Add a layer to the Graph. Args: layer: An instance of the subclasses of StubLayer in layers.py. input_node_id: An integer. The ID of the input node of the layer. Returns: output_node_id: An integer. The ID of the o...
[ "def", "add_layer", "(", "self", ",", "layer", ",", "input_node_id", ")", ":", "if", "isinstance", "(", "input_node_id", ",", "Iterable", ")", ":", "layer", ".", "input", "=", "list", "(", "map", "(", "lambda", "x", ":", "self", ".", "node_list", "[", ...
[ 147, 4 ]
[ 167, 29 ]
python
en
['en', 'en', 'en']
True
Graph.n_nodes
(self)
Return the number of nodes in the model.
Return the number of nodes in the model.
def n_nodes(self): """Return the number of nodes in the model.""" return len(self.node_list)
[ "def", "n_nodes", "(", "self", ")", ":", "return", "len", "(", "self", ".", "node_list", ")" ]
[ 173, 4 ]
[ 175, 34 ]
python
en
['en', 'en', 'en']
True
Graph.n_layers
(self)
Return the number of layers in the model.
Return the number of layers in the model.
def n_layers(self): """Return the number of layers in the model.""" return len(self.layer_list)
[ "def", "n_layers", "(", "self", ")", ":", "return", "len", "(", "self", ".", "layer_list", ")" ]
[ 178, 4 ]
[ 180, 35 ]
python
en
['en', 'en', 'en']
True
Graph._add_node
(self, node)
Add a new node to node_list and give the node an ID. Args: node: An instance of Node. Returns: node_id: An integer.
Add a new node to node_list and give the node an ID. Args: node: An instance of Node. Returns: node_id: An integer.
def _add_node(self, node): """Add a new node to node_list and give the node an ID. Args: node: An instance of Node. Returns: node_id: An integer. """ node_id = len(self.node_list) self.node_to_id[node] = node_id self.node_list.append(node) ...
[ "def", "_add_node", "(", "self", ",", "node", ")", ":", "node_id", "=", "len", "(", "self", ".", "node_list", ")", "self", ".", "node_to_id", "[", "node", "]", "=", "node_id", "self", ".", "node_list", ".", "append", "(", "node", ")", "self", ".", ...
[ 182, 4 ]
[ 194, 22 ]
python
en
['en', 'en', 'en']
True
Graph._add_edge
(self, layer, input_id, output_id)
Add a new layer to the graph. The nodes should be created in advance.
Add a new layer to the graph. The nodes should be created in advance.
def _add_edge(self, layer, input_id, output_id): """Add a new layer to the graph. The nodes should be created in advance.""" if layer in self.layer_to_id: layer_id = self.layer_to_id[layer] if input_id not in self.layer_id_to_input_node_ids[layer_id]: self.layer_...
[ "def", "_add_edge", "(", "self", ",", "layer", ",", "input_id", ",", "output_id", ")", ":", "if", "layer", "in", "self", ".", "layer_to_id", ":", "layer_id", "=", "self", ".", "layer_to_id", "[", "layer", "]", "if", "input_id", "not", "in", "self", "."...
[ 196, 4 ]
[ 213, 69 ]
python
en
['en', 'en', 'en']
True
Graph._redirect_edge
(self, u_id, v_id, new_v_id)
Redirect the layer to a new node. Change the edge originally from `u_id` to `v_id` into an edge from `u_id` to `new_v_id` while keeping all other property of the edge the same.
Redirect the layer to a new node. Change the edge originally from `u_id` to `v_id` into an edge from `u_id` to `new_v_id` while keeping all other property of the edge the same.
def _redirect_edge(self, u_id, v_id, new_v_id): """Redirect the layer to a new node. Change the edge originally from `u_id` to `v_id` into an edge from `u_id` to `new_v_id` while keeping all other property of the edge the same. """ layer_id = None for index, edge_tuple in...
[ "def", "_redirect_edge", "(", "self", ",", "u_id", ",", "v_id", ",", "new_v_id", ")", ":", "layer_id", "=", "None", "for", "index", ",", "edge_tuple", "in", "enumerate", "(", "self", ".", "adj_list", "[", "u_id", "]", ")", ":", "if", "edge_tuple", "[",...
[ 215, 4 ]
[ 238, 21 ]
python
en
['en', 'en', 'en']
True
Graph._replace_layer
(self, layer_id, new_layer)
Replace the layer with a new layer.
Replace the layer with a new layer.
def _replace_layer(self, layer_id, new_layer): """Replace the layer with a new layer.""" old_layer = self.layer_list[layer_id] new_layer.input = old_layer.input new_layer.output = old_layer.output new_layer.output.shape = new_layer.output_shape self.layer_list[layer_id] =...
[ "def", "_replace_layer", "(", "self", ",", "layer_id", ",", "new_layer", ")", ":", "old_layer", "=", "self", ".", "layer_list", "[", "layer_id", "]", "new_layer", ".", "input", "=", "old_layer", ".", "input", "new_layer", ".", "output", "=", "old_layer", "...
[ 240, 4 ]
[ 248, 39 ]
python
en
['en', 'en', 'en']
True
Graph.topological_order
(self)
Return the topological order of the node IDs from the input node to the output node.
Return the topological order of the node IDs from the input node to the output node.
def topological_order(self): """Return the topological order of the node IDs from the input node to the output node.""" q = Queue() in_degree = {} for i in range(self.n_nodes): in_degree[i] = 0 for u in range(self.n_nodes): for v, _ in self.adj_list[u]: ...
[ "def", "topological_order", "(", "self", ")", ":", "q", "=", "Queue", "(", ")", "in_degree", "=", "{", "}", "for", "i", "in", "range", "(", "self", ".", "n_nodes", ")", ":", "in_degree", "[", "i", "]", "=", "0", "for", "u", "in", "range", "(", ...
[ 251, 4 ]
[ 272, 25 ]
python
en
['en', 'en', 'en']
True
Graph._get_pooling_layers
(self, start_node_id, end_node_id)
Given two node IDs, return all the pooling layers between them.
Given two node IDs, return all the pooling layers between them.
def _get_pooling_layers(self, start_node_id, end_node_id): """Given two node IDs, return all the pooling layers between them.""" layer_list = [] node_list = [start_node_id] assert self._depth_first_search(end_node_id, layer_list, node_list) ret = [] for layer_id in layer_...
[ "def", "_get_pooling_layers", "(", "self", ",", "start_node_id", ",", "end_node_id", ")", ":", "layer_list", "=", "[", "]", "node_list", "=", "[", "start_node_id", "]", "assert", "self", ".", "_depth_first_search", "(", "end_node_id", ",", "layer_list", ",", "...
[ 274, 4 ]
[ 286, 18 ]
python
en
['en', 'en', 'en']
True
Graph._depth_first_search
(self, target_id, layer_id_list, node_list)
Search for all the layers and nodes down the path. A recursive function to search all the layers and nodes between the node in the node_list and the node with target_id.
Search for all the layers and nodes down the path. A recursive function to search all the layers and nodes between the node in the node_list and the node with target_id.
def _depth_first_search(self, target_id, layer_id_list, node_list): """Search for all the layers and nodes down the path. A recursive function to search all the layers and nodes between the node in the node_list and the node with target_id.""" assert len(node_list) <= self.n_nodes ...
[ "def", "_depth_first_search", "(", "self", ",", "target_id", ",", "layer_id_list", ",", "node_list", ")", ":", "assert", "len", "(", "node_list", ")", "<=", "self", ".", "n_nodes", "u", "=", "node_list", "[", "-", "1", "]", "if", "u", "==", "target_id", ...
[ 288, 4 ]
[ 305, 20 ]
python
en
['en', 'en', 'en']
True
Graph._search
(self, u, start_dim, total_dim, n_add)
Search the graph for all the layers to be widened caused by an operation. It is an recursive function with duplication check to avoid deadlock. It searches from a starting node u until the corresponding layers has been widened. Args: u: The starting node ID. start_dim: Th...
Search the graph for all the layers to be widened caused by an operation. It is an recursive function with duplication check to avoid deadlock. It searches from a starting node u until the corresponding layers has been widened. Args: u: The starting node ID. start_dim: Th...
def _search(self, u, start_dim, total_dim, n_add): """Search the graph for all the layers to be widened caused by an operation. It is an recursive function with duplication check to avoid deadlock. It searches from a starting node u until the corresponding layers has been widened. Args: ...
[ "def", "_search", "(", "self", ",", "u", ",", "start_dim", ",", "total_dim", ",", "n_add", ")", ":", "if", "(", "u", ",", "start_dim", ",", "total_dim", ",", "n_add", ")", "in", "self", ".", "vis", ":", "return", "self", ".", "vis", "[", "(", "u"...
[ 307, 4 ]
[ 371, 60 ]
python
en
['en', 'en', 'en']
True
Graph.to_deeper_model
(self, target_id, new_layer)
Insert a relu-conv-bn block after the target block. Args: target_id: A convolutional layer ID. The new block should be inserted after the block. new_layer: An instance of StubLayer subclasses.
Insert a relu-conv-bn block after the target block. Args: target_id: A convolutional layer ID. The new block should be inserted after the block. new_layer: An instance of StubLayer subclasses.
def to_deeper_model(self, target_id, new_layer): """Insert a relu-conv-bn block after the target block. Args: target_id: A convolutional layer ID. The new block should be inserted after the block. new_layer: An instance of StubLayer subclasses. """ self.operation_...
[ "def", "to_deeper_model", "(", "self", ",", "target_id", ",", "new_layer", ")", ":", "self", ".", "operation_history", ".", "append", "(", "(", "\"to_deeper_model\"", ",", "target_id", ",", "new_layer", ")", ")", "input_id", "=", "self", ".", "layer_id_to_inpu...
[ 386, 4 ]
[ 404, 65 ]
python
en
['en', 'lb', 'en']
True
Graph.to_wider_model
(self, pre_layer_id, n_add)
Widen the last dimension of the output of the pre_layer. Args: pre_layer_id: The ID of a convolutional layer or dense layer. n_add: The number of dimensions to add.
Widen the last dimension of the output of the pre_layer. Args: pre_layer_id: The ID of a convolutional layer or dense layer. n_add: The number of dimensions to add.
def to_wider_model(self, pre_layer_id, n_add): """Widen the last dimension of the output of the pre_layer. Args: pre_layer_id: The ID of a convolutional layer or dense layer. n_add: The number of dimensions to add. """ self.operation_history.append(("to_wider_mode...
[ "def", "to_wider_model", "(", "self", ",", "pre_layer_id", ",", "n_add", ")", ":", "self", ".", "operation_history", ".", "append", "(", "(", "\"to_wider_model\"", ",", "pre_layer_id", ",", "n_add", ")", ")", "pre_layer", "=", "self", ".", "layer_list", "[",...
[ 406, 4 ]
[ 421, 80 ]
python
en
['en', 'en', 'en']
True
Graph._insert_new_layers
(self, new_layers, start_node_id, end_node_id)
Insert the new_layers after the node with start_node_id.
Insert the new_layers after the node with start_node_id.
def _insert_new_layers(self, new_layers, start_node_id, end_node_id): """Insert the new_layers after the node with start_node_id.""" new_node_id = self._add_node(deepcopy(self.node_list[end_node_id])) temp_output_id = new_node_id for layer in new_layers[:-1]: temp_output_id =...
[ "def", "_insert_new_layers", "(", "self", ",", "new_layers", ",", "start_node_id", ",", "end_node_id", ")", ":", "new_node_id", "=", "self", ".", "_add_node", "(", "deepcopy", "(", "self", ".", "node_list", "[", "end_node_id", "]", ")", ")", "temp_output_id", ...
[ 423, 4 ]
[ 433, 68 ]
python
en
['en', 'en', 'en']
True
Graph._conv_block_end_node
(self, layer_id)
Get the input node ID of the last layer in the block by layer ID. Return the input node ID of the last layer in the convolutional block. Args: layer_id: the convolutional layer ID.
Get the input node ID of the last layer in the block by layer ID. Return the input node ID of the last layer in the convolutional block. Args: layer_id: the convolutional layer ID.
def _conv_block_end_node(self, layer_id): """Get the input node ID of the last layer in the block by layer ID. Return the input node ID of the last layer in the convolutional block. Args: layer_id: the convolutional layer ID. """ return self._block_end_node(layer_...
[ "def", "_conv_block_end_node", "(", "self", ",", "layer_id", ")", ":", "return", "self", ".", "_block_end_node", "(", "layer_id", ",", "Constant", ".", "CONV_BLOCK_DISTANCE", ")" ]
[ 444, 4 ]
[ 450, 75 ]
python
en
['en', 'en', 'en']
True
Graph.to_add_skip_model
(self, start_id, end_id)
Add a weighted add skip-connection from after start node to end node. Args: start_id: The convolutional layer ID, after which to start the skip-connection. end_id: The convolutional layer ID, after which to end the skip-connection.
Add a weighted add skip-connection from after start node to end node. Args: start_id: The convolutional layer ID, after which to start the skip-connection. end_id: The convolutional layer ID, after which to end the skip-connection.
def to_add_skip_model(self, start_id, end_id): """Add a weighted add skip-connection from after start node to end node. Args: start_id: The convolutional layer ID, after which to start the skip-connection. end_id: The convolutional layer ID, after which to end the skip-connection...
[ "def", "to_add_skip_model", "(", "self", ",", "start_id", ",", "end_id", ")", ":", "self", ".", "operation_history", ".", "append", "(", "(", "\"to_add_skip_model\"", ",", "start_id", ",", "end_id", ")", ")", "filters_end", "=", "self", ".", "layer_list", "[...
[ 452, 4 ]
[ 500, 13 ]
python
en
['en', 'en', 'en']
True
Graph.to_concat_skip_model
(self, start_id, end_id)
Add a weighted add concatenate connection from after start node to end node. Args: start_id: The convolutional layer ID, after which to start the skip-connection. end_id: The convolutional layer ID, after which to end the skip-connection.
Add a weighted add concatenate connection from after start node to end node. Args: start_id: The convolutional layer ID, after which to start the skip-connection. end_id: The convolutional layer ID, after which to end the skip-connection.
def to_concat_skip_model(self, start_id, end_id): """Add a weighted add concatenate connection from after start node to end node. Args: start_id: The convolutional layer ID, after which to start the skip-connection. end_id: The convolutional layer ID, after which to end the skip-...
[ "def", "to_concat_skip_model", "(", "self", ",", "start_id", ",", "end_id", ")", ":", "self", ".", "operation_history", ".", "append", "(", "(", "\"to_concat_skip_model\"", ",", "start_id", ",", "end_id", ")", ")", "filters_end", "=", "self", ".", "layer_list"...
[ 502, 4 ]
[ 562, 13 ]
python
en
['en', 'en', 'en']
True
Graph.extract_descriptor
(self)
Extract the the description of the Graph as an instance of NetworkDescriptor.
Extract the the description of the Graph as an instance of NetworkDescriptor.
def extract_descriptor(self): """Extract the the description of the Graph as an instance of NetworkDescriptor.""" main_chain = self.get_main_chain() index_in_main_chain = {} for index, u in enumerate(main_chain): index_in_main_chain[u] = index ret = NetworkDescriptor...
[ "def", "extract_descriptor", "(", "self", ")", ":", "main_chain", "=", "self", ".", "get_main_chain", "(", ")", "index_in_main_chain", "=", "{", "}", "for", "index", ",", "u", "in", "enumerate", "(", "main_chain", ")", ":", "index_in_main_chain", "[", "u", ...
[ 580, 4 ]
[ 627, 18 ]
python
en
['en', 'en', 'en']
True
Graph.clear_weights
(self)
clear weights of the graph
clear weights of the graph
def clear_weights(self): ''' clear weights of the graph ''' self.weighted = False for layer in self.layer_list: layer.weights = None
[ "def", "clear_weights", "(", "self", ")", ":", "self", ".", "weighted", "=", "False", "for", "layer", "in", "self", ".", "layer_list", ":", "layer", ".", "weights", "=", "None" ]
[ 629, 4 ]
[ 634, 32 ]
python
en
['en', 'en', 'en']
True
Graph.produce_torch_model
(self)
Build a new Torch model based on the current graph.
Build a new Torch model based on the current graph.
def produce_torch_model(self): """Build a new Torch model based on the current graph.""" return TorchModel(self)
[ "def", "produce_torch_model", "(", "self", ")", ":", "return", "TorchModel", "(", "self", ")" ]
[ 636, 4 ]
[ 638, 31 ]
python
en
['en', 'en', 'en']
True
Graph.produce_keras_model
(self)
Build a new keras model based on the current graph.
Build a new keras model based on the current graph.
def produce_keras_model(self): """Build a new keras model based on the current graph.""" return KerasModel(self).model
[ "def", "produce_keras_model", "(", "self", ")", ":", "return", "KerasModel", "(", "self", ")", ".", "model" ]
[ 640, 4 ]
[ 642, 37 ]
python
en
['en', 'en', 'en']
True
Graph.produce_onnx_model
(self)
Build a new ONNX model based on the current graph.
Build a new ONNX model based on the current graph.
def produce_onnx_model(self): """Build a new ONNX model based on the current graph.""" return ONNXModel(self)
[ "def", "produce_onnx_model", "(", "self", ")", ":", "return", "ONNXModel", "(", "self", ")" ]
[ 644, 4 ]
[ 646, 30 ]
python
en
['en', 'en', 'en']
True
Graph.parsing_onnx_model
(self, onnx_model)
to do in the future to use the onnx model
to do in the future to use the onnx model
def parsing_onnx_model(self, onnx_model): '''to do in the future to use the onnx model ''' return ONNXModel(onnx_model)
[ "def", "parsing_onnx_model", "(", "self", ",", "onnx_model", ")", ":", "return", "ONNXModel", "(", "onnx_model", ")" ]
[ 648, 4 ]
[ 651, 36 ]
python
en
['en', 'en', 'en']
True
Graph.produce_json_model
(self)
Build a new Json model based on the current graph.
Build a new Json model based on the current graph.
def produce_json_model(self): """Build a new Json model based on the current graph.""" return JSONModel(self).data
[ "def", "produce_json_model", "(", "self", ")", ":", "return", "JSONModel", "(", "self", ")", ".", "data" ]
[ 653, 4 ]
[ 655, 35 ]
python
en
['en', 'en', 'en']
True
Graph.parsing_json_model
(cls, json_model)
build a graph from json
build a graph from json
def parsing_json_model(cls, json_model): '''build a graph from json ''' return json_to_graph(json_model)
[ "def", "parsing_json_model", "(", "cls", ",", "json_model", ")", ":", "return", "json_to_graph", "(", "json_model", ")" ]
[ 658, 4 ]
[ 661, 40 ]
python
en
['en', 'en', 'en']
True
Graph.get_main_chain_layers
(self)
Return a list of layer IDs in the main chain.
Return a list of layer IDs in the main chain.
def get_main_chain_layers(self): """Return a list of layer IDs in the main chain.""" main_chain = self.get_main_chain() ret = [] for u in main_chain: for v, layer_id in self.adj_list[u]: if v in main_chain and u in main_chain: ret.append(la...
[ "def", "get_main_chain_layers", "(", "self", ")", ":", "main_chain", "=", "self", ".", "get_main_chain", "(", ")", "ret", "=", "[", "]", "for", "u", "in", "main_chain", ":", "for", "v", ",", "layer_id", "in", "self", ".", "adj_list", "[", "u", "]", "...
[ 682, 4 ]
[ 690, 18 ]
python
en
['en', 'en', 'en']
True
Graph.get_main_chain
(self)
Returns the main chain node ID list.
Returns the main chain node ID list.
def get_main_chain(self): """Returns the main chain node ID list.""" pre_node = {} distance = {} for i in range(self.n_nodes): distance[i] = 0 pre_node[i] = i for i in range(self.n_nodes - 1): for u in range(self.n_nodes): for v...
[ "def", "get_main_chain", "(", "self", ")", ":", "pre_node", "=", "{", "}", "distance", "=", "{", "}", "for", "i", "in", "range", "(", "self", ".", "n_nodes", ")", ":", "distance", "[", "i", "]", "=", "0", "pre_node", "[", "i", "]", "=", "i", "f...
[ 726, 4 ]
[ 751, 18 ]
python
en
['en', 'gd', 'en']
True
async_setup_entry
(hass, config_entry, async_add_entities)
Set up Z-Wave Climate device from Config Entry.
Set up Z-Wave Climate device from Config Entry.
async def async_setup_entry(hass, config_entry, async_add_entities): """Set up Z-Wave Climate device from Config Entry.""" @callback def async_add_climate(climate): """Add Z-Wave Climate Device.""" async_add_entities([climate]) async_dispatcher_connect(hass, "zwave_new_climate", async_...
[ "async", "def", "async_setup_entry", "(", "hass", ",", "config_entry", ",", "async_add_entities", ")", ":", "@", "callback", "def", "async_add_climate", "(", "climate", ")", ":", "\"\"\"Add Z-Wave Climate Device.\"\"\"", "async_add_entities", "(", "[", "climate", "]",...
[ 130, 0 ]
[ 138, 74 ]
python
en
['en', 'en', 'en']
True
get_device
(hass, values, **kwargs)
Create Z-Wave entity device.
Create Z-Wave entity device.
def get_device(hass, values, **kwargs): """Create Z-Wave entity device.""" temp_unit = hass.config.units.temperature_unit if values.primary.command_class == const.COMMAND_CLASS_THERMOSTAT_SETPOINT: return ZWaveClimateSingleSetpoint(values, temp_unit) if values.primary.command_class == const.COMM...
[ "def", "get_device", "(", "hass", ",", "values", ",", "*", "*", "kwargs", ")", ":", "temp_unit", "=", "hass", ".", "config", ".", "units", ".", "temperature_unit", "if", "values", ".", "primary", ".", "command_class", "==", "const", ".", "COMMAND_CLASS_THE...
[ 141, 0 ]
[ 148, 15 ]
python
en
['en', 'pl', 'en']
True
ZWaveClimateBase.__init__
(self, values, temp_unit)
Initialize the Z-Wave climate device.
Initialize the Z-Wave climate device.
def __init__(self, values, temp_unit): """Initialize the Z-Wave climate device.""" ZWaveDeviceEntity.__init__(self, values, DOMAIN) self._target_temperature = None self._target_temperature_range = (None, None) self._current_temperature = None self._hvac_action = None ...
[ "def", "__init__", "(", "self", ",", "values", ",", "temp_unit", ")", ":", "ZWaveDeviceEntity", ".", "__init__", "(", "self", ",", "values", ",", "DOMAIN", ")", "self", ".", "_target_temperature", "=", "None", "self", ".", "_target_temperature_range", "=", "...
[ 154, 4 ]
[ 187, 32 ]
python
en
['en', 'en', 'en']
True
ZWaveClimateBase._mode
(self)
Return thermostat mode Z-Wave value.
Return thermostat mode Z-Wave value.
def _mode(self) -> None: """Return thermostat mode Z-Wave value.""" raise NotImplementedError()
[ "def", "_mode", "(", "self", ")", "->", "None", ":", "raise", "NotImplementedError", "(", ")" ]
[ 189, 4 ]
[ 191, 35 ]
python
en
['en', 'cs', 'en']
True
ZWaveClimateBase._current_mode_setpoints
(self)
Return a tuple of current setpoint Z-Wave value(s).
Return a tuple of current setpoint Z-Wave value(s).
def _current_mode_setpoints(self) -> Tuple: """Return a tuple of current setpoint Z-Wave value(s).""" raise NotImplementedError()
[ "def", "_current_mode_setpoints", "(", "self", ")", "->", "Tuple", ":", "raise", "NotImplementedError", "(", ")" ]
[ 193, 4 ]
[ 195, 35 ]
python
en
['en', 'en', 'en']
True
ZWaveClimateBase.supported_features
(self)
Return the list of supported features.
Return the list of supported features.
def supported_features(self): """Return the list of supported features.""" support = SUPPORT_TARGET_TEMPERATURE if self._hvac_list and HVAC_MODE_HEAT_COOL in self._hvac_list: support |= SUPPORT_TARGET_TEMPERATURE_RANGE if self._preset_list and PRESET_AWAY in self._preset_list...
[ "def", "supported_features", "(", "self", ")", ":", "support", "=", "SUPPORT_TARGET_TEMPERATURE", "if", "self", ".", "_hvac_list", "and", "HVAC_MODE_HEAT_COOL", "in", "self", ".", "_hvac_list", ":", "support", "|=", "SUPPORT_TARGET_TEMPERATURE_RANGE", "if", "self", ...
[ 198, 4 ]
[ 214, 22 ]
python
en
['en', 'en', 'en']
True
ZWaveClimateBase.update_properties
(self)
Handle the data changes for node values.
Handle the data changes for node values.
def update_properties(self): """Handle the data changes for node values.""" # Operation Mode self._update_operation_mode() # Current Temp self._update_current_temp() # Fan Mode self._update_fan_mode() # Swing mode self._update_swing_mode() ...
[ "def", "update_properties", "(", "self", ")", ":", "# Operation Mode", "self", ".", "_update_operation_mode", "(", ")", "# Current Temp", "self", ".", "_update_current_temp", "(", ")", "# Fan Mode", "self", ".", "_update_fan_mode", "(", ")", "# Swing mode", "self", ...
[ 216, 4 ]
[ 237, 32 ]
python
en
['en', 'en', 'en']
True
ZWaveClimateBase._update_operation_mode
(self)
Update hvac and preset modes.
Update hvac and preset modes.
def _update_operation_mode(self): """Update hvac and preset modes.""" if self._mode(): self._hvac_list = [] self._hvac_mapping = {} self._preset_list = [] self._preset_mapping = {} mode_list = self._mode().data_items if mode_list: ...
[ "def", "_update_operation_mode", "(", "self", ")", ":", "if", "self", ".", "_mode", "(", ")", ":", "self", ".", "_hvac_list", "=", "[", "]", "self", ".", "_hvac_mapping", "=", "{", "}", "self", ".", "_preset_list", "=", "[", "]", "self", ".", "_prese...
[ 239, 4 ]
[ 327, 64 ]
python
en
['en', 'en', 'en']
True
ZWaveClimateBase._update_current_temp
(self)
Update current temperature.
Update current temperature.
def _update_current_temp(self): """Update current temperature.""" if self.values.temperature: self._current_temperature = self.values.temperature.data device_unit = self.values.temperature.units if device_unit is not None: self._unit = device_unit
[ "def", "_update_current_temp", "(", "self", ")", ":", "if", "self", ".", "values", ".", "temperature", ":", "self", ".", "_current_temperature", "=", "self", ".", "values", ".", "temperature", ".", "data", "device_unit", "=", "self", ".", "values", ".", "t...
[ 329, 4 ]
[ 335, 40 ]
python
en
['ro', 'la', 'en']
False
ZWaveClimateBase._update_fan_mode
(self)
Update fan mode.
Update fan mode.
def _update_fan_mode(self): """Update fan mode.""" if self.values.fan_mode: self._current_fan_mode = self.values.fan_mode.data fan_modes = self.values.fan_mode.data_items if fan_modes: self._fan_modes = list(fan_modes) _LOGGER.debug("self._fan...
[ "def", "_update_fan_mode", "(", "self", ")", ":", "if", "self", ".", "values", ".", "fan_mode", ":", "self", ".", "_current_fan_mode", "=", "self", ".", "values", ".", "fan_mode", ".", "data", "fan_modes", "=", "self", ".", "values", ".", "fan_mode", "."...
[ 337, 4 ]
[ 346, 74 ]
python
fy
['id', 'fy', 'ur']
False
ZWaveClimateBase._update_swing_mode
(self)
Update swing mode.
Update swing mode.
def _update_swing_mode(self): """Update swing mode.""" if self._zxt_120 == 1: if self.values.zxt_120_swing_mode: self._current_swing_mode = self.values.zxt_120_swing_mode.data swing_modes = self.values.zxt_120_swing_mode.data_items if swing_mod...
[ "def", "_update_swing_mode", "(", "self", ")", ":", "if", "self", ".", "_zxt_120", "==", "1", ":", "if", "self", ".", "values", ".", "zxt_120_swing_mode", ":", "self", ".", "_current_swing_mode", "=", "self", ".", "values", ".", "zxt_120_swing_mode", ".", ...
[ 348, 4 ]
[ 357, 82 ]
python
en
['en', 'fy', 'en']
True
ZWaveClimateBase._update_target_temp
(self)
Update target temperature.
Update target temperature.
def _update_target_temp(self): """Update target temperature.""" current_setpoints = self._current_mode_setpoints() self._target_temperature = None self._target_temperature_range = (None, None) if len(current_setpoints) == 1: (setpoint,) = current_setpoints ...
[ "def", "_update_target_temp", "(", "self", ")", ":", "current_setpoints", "=", "self", ".", "_current_mode_setpoints", "(", ")", "self", ".", "_target_temperature", "=", "None", "self", ".", "_target_temperature_range", "=", "(", "None", ",", "None", ")", "if", ...
[ 359, 4 ]
[ 375, 70 ]
python
en
['en', 'la', 'en']
True
ZWaveClimateBase._update_operating_state
(self)
Update operating state.
Update operating state.
def _update_operating_state(self): """Update operating state.""" if self.values.operating_state: mode = self.values.operating_state.data self._hvac_action = HVAC_CURRENT_MAPPINGS.get(str(mode).lower(), mode)
[ "def", "_update_operating_state", "(", "self", ")", ":", "if", "self", ".", "values", ".", "operating_state", ":", "mode", "=", "self", ".", "values", ".", "operating_state", ".", "data", "self", ".", "_hvac_action", "=", "HVAC_CURRENT_MAPPINGS", ".", "get", ...
[ 377, 4 ]
[ 381, 82 ]
python
en
['en', 'en', 'en']
True
ZWaveClimateBase._update_fan_state
(self)
Update fan state.
Update fan state.
def _update_fan_state(self): """Update fan state.""" if self.values.fan_action: self._fan_action = self.values.fan_action.data
[ "def", "_update_fan_state", "(", "self", ")", ":", "if", "self", ".", "values", ".", "fan_action", ":", "self", ".", "_fan_action", "=", "self", ".", "values", ".", "fan_action", ".", "data" ]
[ 383, 4 ]
[ 386, 58 ]
python
en
['en', 'fy', 'en']
True
ZWaveClimateBase.fan_mode
(self)
Return the fan speed set.
Return the fan speed set.
def fan_mode(self): """Return the fan speed set.""" return self._current_fan_mode
[ "def", "fan_mode", "(", "self", ")", ":", "return", "self", ".", "_current_fan_mode" ]
[ 389, 4 ]
[ 391, 37 ]
python
en
['en', 'fy', 'en']
True
ZWaveClimateBase.fan_modes
(self)
Return a list of available fan modes.
Return a list of available fan modes.
def fan_modes(self): """Return a list of available fan modes.""" return self._fan_modes
[ "def", "fan_modes", "(", "self", ")", ":", "return", "self", ".", "_fan_modes" ]
[ 394, 4 ]
[ 396, 30 ]
python
en
['en', 'en', 'en']
True
ZWaveClimateBase.swing_mode
(self)
Return the swing mode set.
Return the swing mode set.
def swing_mode(self): """Return the swing mode set.""" return self._current_swing_mode
[ "def", "swing_mode", "(", "self", ")", ":", "return", "self", ".", "_current_swing_mode" ]
[ 399, 4 ]
[ 401, 39 ]
python
en
['en', 'no', 'en']
True
ZWaveClimateBase.swing_modes
(self)
Return a list of available swing modes.
Return a list of available swing modes.
def swing_modes(self): """Return a list of available swing modes.""" return self._swing_modes
[ "def", "swing_modes", "(", "self", ")", ":", "return", "self", ".", "_swing_modes" ]
[ 404, 4 ]
[ 406, 32 ]
python
en
['en', 'en', 'en']
True
ZWaveClimateBase.temperature_unit
(self)
Return the unit of measurement.
Return the unit of measurement.
def temperature_unit(self): """Return the unit of measurement.""" if self._unit == "C": return TEMP_CELSIUS if self._unit == "F": return TEMP_FAHRENHEIT return self._unit
[ "def", "temperature_unit", "(", "self", ")", ":", "if", "self", ".", "_unit", "==", "\"C\"", ":", "return", "TEMP_CELSIUS", "if", "self", ".", "_unit", "==", "\"F\"", ":", "return", "TEMP_FAHRENHEIT", "return", "self", ".", "_unit" ]
[ 409, 4 ]
[ 415, 25 ]
python
en
['en', 'la', 'en']
True
ZWaveClimateBase.current_temperature
(self)
Return the current temperature.
Return the current temperature.
def current_temperature(self): """Return the current temperature.""" return self._current_temperature
[ "def", "current_temperature", "(", "self", ")", ":", "return", "self", ".", "_current_temperature" ]
[ 418, 4 ]
[ 420, 40 ]
python
en
['en', 'la', 'en']
True
ZWaveClimateBase.hvac_mode
(self)
Return hvac operation ie. heat, cool mode. Need to be one of HVAC_MODE_*.
Return hvac operation ie. heat, cool mode.
def hvac_mode(self): """Return hvac operation ie. heat, cool mode. Need to be one of HVAC_MODE_*. """ if self._mode(): return self._hvac_mode return self._default_hvac_mode
[ "def", "hvac_mode", "(", "self", ")", ":", "if", "self", ".", "_mode", "(", ")", ":", "return", "self", ".", "_hvac_mode", "return", "self", ".", "_default_hvac_mode" ]
[ 423, 4 ]
[ 430, 38 ]
python
bg
['en', 'bg', 'bg']
True
ZWaveClimateBase.hvac_modes
(self)
Return the list of available hvac operation modes. Need to be a subset of HVAC_MODES.
Return the list of available hvac operation modes.
def hvac_modes(self): """Return the list of available hvac operation modes. Need to be a subset of HVAC_MODES. """ if self._mode(): return self._hvac_list return []
[ "def", "hvac_modes", "(", "self", ")", ":", "if", "self", ".", "_mode", "(", ")", ":", "return", "self", ".", "_hvac_list", "return", "[", "]" ]
[ 433, 4 ]
[ 440, 17 ]
python
en
['en', 'en', 'en']
True
ZWaveClimateBase.hvac_action
(self)
Return the current running hvac operation if supported. Need to be one of CURRENT_HVAC_*.
Return the current running hvac operation if supported.
def hvac_action(self): """Return the current running hvac operation if supported. Need to be one of CURRENT_HVAC_*. """ return self._hvac_action
[ "def", "hvac_action", "(", "self", ")", ":", "return", "self", ".", "_hvac_action" ]
[ 443, 4 ]
[ 448, 32 ]
python
en
['en', 'en', 'en']
True
ZWaveClimateBase.is_aux_heat
(self)
Return true if aux heater.
Return true if aux heater.
def is_aux_heat(self): """Return true if aux heater.""" if not self._aux_heat: return None if self._mode().data == AUX_HEAT_ZWAVE_MODE: return True return False
[ "def", "is_aux_heat", "(", "self", ")", ":", "if", "not", "self", ".", "_aux_heat", ":", "return", "None", "if", "self", ".", "_mode", "(", ")", ".", "data", "==", "AUX_HEAT_ZWAVE_MODE", ":", "return", "True", "return", "False" ]
[ 451, 4 ]
[ 457, 20 ]
python
fr
['fr', 'co', 'fr']
True
ZWaveClimateBase.preset_mode
(self)
Return preset operation ie. eco, away. Need to be one of PRESET_*.
Return preset operation ie. eco, away.
def preset_mode(self): """Return preset operation ie. eco, away. Need to be one of PRESET_*. """ if self._mode(): return self._preset_mode return PRESET_NONE
[ "def", "preset_mode", "(", "self", ")", ":", "if", "self", ".", "_mode", "(", ")", ":", "return", "self", ".", "_preset_mode", "return", "PRESET_NONE" ]
[ 460, 4 ]
[ 467, 26 ]
python
en
['nl', 'sr', 'en']
False
ZWaveClimateBase.preset_modes
(self)
Return the list of available preset operation modes. Need to be a subset of PRESET_MODES.
Return the list of available preset operation modes.
def preset_modes(self): """Return the list of available preset operation modes. Need to be a subset of PRESET_MODES. """ if self._mode(): return self._preset_list return []
[ "def", "preset_modes", "(", "self", ")", ":", "if", "self", ".", "_mode", "(", ")", ":", "return", "self", ".", "_preset_list", "return", "[", "]" ]
[ 470, 4 ]
[ 477, 17 ]
python
en
['en', 'en', 'en']
True
ZWaveClimateBase.target_temperature
(self)
Return the temperature we try to reach.
Return the temperature we try to reach.
def target_temperature(self): """Return the temperature we try to reach.""" return self._target_temperature
[ "def", "target_temperature", "(", "self", ")", ":", "return", "self", ".", "_target_temperature" ]
[ 480, 4 ]
[ 482, 39 ]
python
en
['en', 'en', 'en']
True
ZWaveClimateBase.target_temperature_low
(self)
Return the lowbound target temperature we try to reach.
Return the lowbound target temperature we try to reach.
def target_temperature_low(self) -> Optional[float]: """Return the lowbound target temperature we try to reach.""" return self._target_temperature_range[0]
[ "def", "target_temperature_low", "(", "self", ")", "->", "Optional", "[", "float", "]", ":", "return", "self", ".", "_target_temperature_range", "[", "0", "]" ]
[ 485, 4 ]
[ 487, 48 ]
python
en
['en', 'en', 'en']
True
ZWaveClimateBase.target_temperature_high
(self)
Return the highbound target temperature we try to reach.
Return the highbound target temperature we try to reach.
def target_temperature_high(self) -> Optional[float]: """Return the highbound target temperature we try to reach.""" return self._target_temperature_range[1]
[ "def", "target_temperature_high", "(", "self", ")", "->", "Optional", "[", "float", "]", ":", "return", "self", ".", "_target_temperature_range", "[", "1", "]" ]
[ 490, 4 ]
[ 492, 48 ]
python
en
['en', 'en', 'en']
True
ZWaveClimateBase.set_temperature
(self, **kwargs)
Set new target temperature.
Set new target temperature.
def set_temperature(self, **kwargs): """Set new target temperature.""" current_setpoints = self._current_mode_setpoints() if len(current_setpoints) == 1: (setpoint,) = current_setpoints target_temp = kwargs.get(ATTR_TEMPERATURE) if setpoint is not None and tar...
[ "def", "set_temperature", "(", "self", ",", "*", "*", "kwargs", ")", ":", "current_setpoints", "=", "self", ".", "_current_mode_setpoints", "(", ")", "if", "len", "(", "current_setpoints", ")", "==", "1", ":", "(", "setpoint", ",", ")", "=", "current_setpo...
[ 494, 4 ]
[ 512, 53 ]
python
en
['en', 'ca', 'en']
True
ZWaveClimateBase.set_fan_mode
(self, fan_mode)
Set new target fan mode.
Set new target fan mode.
def set_fan_mode(self, fan_mode): """Set new target fan mode.""" _LOGGER.debug("Set fan mode to %s", fan_mode) if not self.values.fan_mode: return self.values.fan_mode.data = fan_mode
[ "def", "set_fan_mode", "(", "self", ",", "fan_mode", ")", ":", "_LOGGER", ".", "debug", "(", "\"Set fan mode to %s\"", ",", "fan_mode", ")", "if", "not", "self", ".", "values", ".", "fan_mode", ":", "return", "self", ".", "values", ".", "fan_mode", ".", ...
[ 514, 4 ]
[ 519, 44 ]
python
en
['sv', 'fy', 'en']
False
ZWaveClimateBase.set_hvac_mode
(self, hvac_mode)
Set new target hvac mode.
Set new target hvac mode.
def set_hvac_mode(self, hvac_mode): """Set new target hvac mode.""" _LOGGER.debug("Set hvac_mode to %s", hvac_mode) if not self._mode(): return operation_mode = self._hvac_mapping.get(hvac_mode) _LOGGER.debug("Set operation_mode to %s", operation_mode) self._m...
[ "def", "set_hvac_mode", "(", "self", ",", "hvac_mode", ")", ":", "_LOGGER", ".", "debug", "(", "\"Set hvac_mode to %s\"", ",", "hvac_mode", ")", "if", "not", "self", ".", "_mode", "(", ")", ":", "return", "operation_mode", "=", "self", ".", "_hvac_mapping", ...
[ 521, 4 ]
[ 528, 42 ]
python
da
['da', 'su', 'en']
False
ZWaveClimateBase.turn_aux_heat_on
(self)
Turn auxiliary heater on.
Turn auxiliary heater on.
def turn_aux_heat_on(self): """Turn auxiliary heater on.""" if not self._aux_heat: return operation_mode = AUX_HEAT_ZWAVE_MODE _LOGGER.debug("Aux heat on. Set operation mode to %s", operation_mode) self._mode().data = operation_mode
[ "def", "turn_aux_heat_on", "(", "self", ")", ":", "if", "not", "self", ".", "_aux_heat", ":", "return", "operation_mode", "=", "AUX_HEAT_ZWAVE_MODE", "_LOGGER", ".", "debug", "(", "\"Aux heat on. Set operation mode to %s\"", ",", "operation_mode", ")", "self", ".", ...
[ 530, 4 ]
[ 536, 42 ]
python
en
['fr', 'fi', 'en']
False
ZWaveClimateBase.turn_aux_heat_off
(self)
Turn auxiliary heater off.
Turn auxiliary heater off.
def turn_aux_heat_off(self): """Turn auxiliary heater off.""" if not self._aux_heat: return if HVAC_MODE_HEAT in self._hvac_mapping: operation_mode = self._hvac_mapping.get(HVAC_MODE_HEAT) else: operation_mode = self._hvac_mapping.get(HVAC_MODE_OFF) ...
[ "def", "turn_aux_heat_off", "(", "self", ")", ":", "if", "not", "self", ".", "_aux_heat", ":", "return", "if", "HVAC_MODE_HEAT", "in", "self", ".", "_hvac_mapping", ":", "operation_mode", "=", "self", ".", "_hvac_mapping", ".", "get", "(", "HVAC_MODE_HEAT", ...
[ 538, 4 ]
[ 547, 42 ]
python
en
['en', 'en', 'en']
True