Register an attribute override for a device.
178888
def add_override(self, addr, key, value):
        """"""
        address = Address(str(addr)).id
        _LOGGER.debug('New override for %s %s is %s', address, key, value)
        device_override = self._overrides.get(address, {})
        device_override[key] = value
        self._overrides[address] = device_override
958195
def register(cls, attr_name, attr_cls):
        
        if not cls.INSERT_AFTER_FIELD:
            raise ValueError('Class %s is missing INSERT_AFTER_FIELD value' % cls)
        try:
            cls.get_field_by_fieldname(attr_name)
        except InvalidField:
            pass
        else:
            raise ValueError("'%s' is already registered" % attr_name)
        if not issubclass(attr_cls, ExtendedProperty):
            raise ValueError("%r must be a subclass of ExtendedProperty" % attr_cls)
        # Check if class attributes are properly defined
        attr_cls.validate_cls()
        # ExtendedProperty is not a real field, but a placeholder in the fields list. See
        #   https://msdn.microsoft.com/en-us/library/office/aa580790(v=exchg.150).aspx
        #
        # Find the correct index for the new extended property, and insert.
        field = ExtendedPropertyField(attr_name, value_cls=attr_cls)
        cls.add_field(field, insert_after=cls.INSERT_AFTER_FIELD)
178793
def set_attribute(self, name, value):
        """"""
        self.attribute_name = name
        self.attribute = value
513217
protected function registerSupports()
    {
        do_action("before_theme_add_supports");

        foreach ($this->getConfig("supports") as $feature => $enabled):
            if (!$enabled):
                continue;
            endif;
            add_theme_support($feature);
        endforeach;

        do_action("after_theme_add_supports");
    }
711246
protected void registerCommonAttributes() {
        addAttributeProcessor(new ActionLmlAttribute(), "action", "onShow");
        addAttributeProcessor(new ColorAlphaLmlAttribute(), "alpha", "a"); // Actor
        addAttributeProcessor(new ColorBlueLmlAttribute(), "blue", "b");
        addAttributeProcessor(new ColorGreenLmlAttribute(), "green", "g");
        addAttributeProcessor(new ColorLmlAttribute(), "color");
        addAttributeProcessor(new ColorRedLmlAttribute(), "red", "r");
        addAttributeProcessor(new DebugLmlAttribute(), "debug");
        addAttributeProcessor(new IdLmlAttribute(), "id");
        addAttributeProcessor(new MultilineLmlAttribute(), "multiline");
        addAttributeProcessor(new OnChangeLmlAttribute(), "onChange", "change");
        addAttributeProcessor(new OnClickLmlAttribute(), "onClick", "click");
        addAttributeProcessor(new OnCloseLmlAttribute(), "onClose", "close", "onTagClose", "tagClose");
        addAttributeProcessor(new OnCreateLmlAttribute(), "onCreate", "create", "onInit", "init");
        addAttributeProcessor(new RotationLmlAttribute(), "rotation", "angle");
        addAttributeProcessor(new ScaleLmlAttribute(), "scale");
        addAttributeProcessor(new ScaleXLmlAttribute(), "scaleX");
        addAttributeProcessor(new ScaleYLmlAttribute(), "scaleY");
        addAttributeProcessor(new TooltipLmlAttribute(), "tooltip");
        addAttributeProcessor(new TouchableLmlAttribute(), "touchable");
        addAttributeProcessor(new TreeNodeLmlAttribute(), "node");
        addAttributeProcessor(new VisibleLmlAttribute(), "visible");
        addAttributeProcessor(new XLmlAttribute(), "x");
        addAttributeProcessor(new YLmlAttribute(), "y");

        addAttributeProcessor(new TransformLmlAttribute(), "transform"); // Group
        addAttributeProcessor(new DebugRecursivelyLmlAttribute(), "debugRecursively");

        // Since Layout is an interface and interfaces listing is not supported on GWT, widgets can be mapped only to
        // their superclasses. This requires Layout-based attributes to be registered to a class that can apply to any
        // Layout-implementing widget.
        addAttributeProcessor(new FillParentLmlAttribute(), "fillParent"); // Layout
        addAttributeProcessor(new LayoutEnabledLmlAttribute(), "layout", "layoutEnabled");
        addAttributeProcessor(new PackLmlAttribute(), "pack");

        // Same goes for Disableable. Fails if the widget does not implement the interface.
        addAttributeProcessor(new DisabledLmlAttribute(), "disabled", "disable"); // Disableable
    }
541135
def register_device(self, dev_name):
        """"""
        if dev_name not in self.devices:
            self.devices.append(dev_name)
        group_name = self.system.__dict__[dev_name]._group
        if group_name not in self.group.keys():
            self.group[group_name] = {}
432239
def register(self, provider):
        ''''''
        if isinstance(provider,type):
            provider = provider()
        self[provider.code] = provider
1125502
def register(self, device, callback):
        
        if not device:
            logger.error("Received an invalid device: %r", device)
            return

        logger.debug("Subscribing to events for %s", device.name)
        self._devices[device.vera_device_id].append(device)
        self._callbacks[device].append(callback)
1361836
def _override_data(self, overrides):
        
        if overrides is not None:
            for name, val in overrides.items():
                self.log.debug('Trying to override initial data (%s=%s)', name, val)
                if name not in dir(self):
                    raise AttributeError(
                        'Can not override non-existing attribute'
                        '\'{}\' of class \'{}\'.'.format(name, type(self).__name__))

                setattr(self, name, val)
524670
def commit_config(self):
        """"""
        self.device.cu.commit(ignore_warning=self.ignore_warning)
        if not self.config_lock:
            self._unlock()
684588
def device_set(self, device):
		

		if device['id'].startswith('0x'):
			self.device_id = device['id'][2:]
		elif device['id'].startswith('ios:'):
			self.device_id = device['id'].replace(':', '')
		else:
			self.device_id = device['id']
820846
public void put_device_attribute_property(Database database, String deviceName, DbAttribute attr)
            throws DevFailed {
        DbAttribute[] da = new DbAttribute[1];
        da[0] = attr;
        put_device_attribute_property(database, deviceName, da);
    }
1223105
public void set_attribute_info(final DeviceProxy deviceProxy, final AttributeInfoEx[] attr)
	    throws DevFailed {
	checkIfTango(deviceProxy, "set_attribute_config");

	build_connection(deviceProxy);

        if (deviceProxy.access == TangoConst.ACCESS_READ) {
            throwNotAuthorizedException(deviceProxy.devname +
                    ".set_attribute_info()", "DeviceProxy.set_attribute_info()");
        }
        try {
            if (deviceProxy.device_5 != null) {
                final AttributeConfig_5[] config = new AttributeConfig_5[attr.length];
                for (int i = 0; i < attr.length; i++) {
                    config[i] = attr[i].get_attribute_config_obj_5();
                }
                deviceProxy.device_5.set_attribute_config_5(config,
                        DevLockManager.getInstance().getClntIdent());
            }
            else if (deviceProxy.device_4 != null) {
                final AttributeConfig_3[] config = new AttributeConfig_3[attr.length];
                for (int i = 0; i < attr.length; i++) {
                    config[i] = attr[i].get_attribute_config_obj_3();
                }
                deviceProxy.device_4.set_attribute_config_4(config,
                        DevLockManager.getInstance().getClntIdent());
            }
            else if (deviceProxy.device_3 != null) {
                final AttributeConfig_3[] config = new AttributeConfig_3[attr.length];
                for (int i = 0; i < attr.length; i++) {
                    config[i] = attr[i].get_attribute_config_obj_3();
                }
                deviceProxy.device_3.set_attribute_config_3(config);
            }
            else {
                final AttributeConfig[] config = new AttributeConfig[attr.length];
                for (int i = 0; i < attr.length; i++) {
                    config[i] = attr[i].get_attribute_config_obj();
                }
                deviceProxy.device.set_attribute_config(config);
            }
        } catch (final DevFailed e) {
            throw e;
        } catch (final Exception e) {
            ApiUtilDAODefaultImpl.removePendingRepliesOfDevice(deviceProxy);
            throw_dev_failed(deviceProxy, e, "set_attribute_info", true);
        }
    }
519368
def use_device(cls, device):
        """"""
        if device == cls.ops.device:
            yield
        else:
            curr_Ops, curr_ops = (cls.Ops, cls.ops)
            cls.Ops = get_ops(device)
            cls.ops = cls.Ops()
            yield
            cls.Ops = curr_Ops
            cls.ops = curr_ops
1247720
public void set_attribute_info(final DeviceProxy deviceProxy, final AttributeInfo[] attr)
	    throws DevFailed {
        checkIfTango(deviceProxy, "set_attribute_config");

        build_connection(deviceProxy);

        try {
            final AttributeConfig[] config = new AttributeConfig[attr.length];
            for (int i = 0; i < attr.length; i++) {
            config[i] = attr[i].get_attribute_config_obj();
            }
            deviceProxy.device.set_attribute_config(config);
        } catch (final DevFailed e) {
            throw e;
        } catch (final Exception e) {
            ApiUtilDAODefaultImpl.removePendingRepliesOfDevice(deviceProxy);
            throw_dev_failed(deviceProxy, e, "set_attribute_info", true);
        }
    }
433343
public void addAttribute(final IAttributeBehavior behavior) throws DevFailed {
        final AttributeConfiguration configuration = behavior.getConfiguration();
        final String attributeName = configuration.getName();
        xlogger.entry("adding dynamic attribute {}", attributeName);
        if (behavior instanceof ForwardedAttribute) {
            // init attribute with either the attribute property value, or the value defined in its constructor
            final ForwardedAttribute att = (ForwardedAttribute) behavior;
            final String deviceName = deviceImpl.getName();
            final String rootAttributeName = behavior.getConfiguration().getAttributeProperties()
                    .loadAttributeRootName(deviceName, attributeName);
            if (rootAttributeName == null || rootAttributeName.isEmpty()
                    || rootAttributeName.equalsIgnoreCase(Constants.NOT_SPECIFIED)) {
                att.init(deviceName);
                // persist root attribute name in tango db
                behavior.getConfiguration().getAttributeProperties()
                        .persistAttributeRootName(deviceName, attributeName);
            } else {
                // use attribute property
                att.init(deviceName, rootAttributeName);
            }
            // check if this attribute is already created
            final String lower = att.getRootName().toLowerCase(Locale.ENGLISH);
            if (forwardedAttributes.contains(lower)) {
                throw DevFailedUtils.newDevFailed(ExceptionMessages.FWD_DOUBLE_USED,
                        "root attribute already used in this device");
            } else {
                forwardedAttributes.add(lower);
            }
        } else {
            // set default properties
            final AttributePropertiesImpl prop = configuration.getAttributeProperties();
            if (prop.getLabel().isEmpty()) {
                prop.setLabel(configuration.getName());
            }
            if (prop.getFormat().equals(Constants.NOT_SPECIFIED)) {
                prop.setDefaultFormat(configuration.getScalarType());
            }
        }
        final AttributeImpl attrImpl = new AttributeImpl(behavior, deviceImpl.getName());
        attrImpl.setStateMachine(behavior.getStateMachine());
        deviceImpl.addAttribute(attrImpl);
        dynamicAttributes.put(attributeName.toLowerCase(Locale.ENGLISH), attrImpl);
        deviceImpl.pushInterfaceChangeEvent(false);
        if (configuration.isPolled() && configuration.getPollingPeriod() > 0) {
            deviceImpl.addAttributePolling(attributeName, configuration.getPollingPeriod());
        }
        xlogger.exit();
    }
1318277
def register_view(self, view):
        """"""
        super(DataPortListController, self).register_view(view)

        view['name_col'].add_attribute(view['name_text'], 'text', self.NAME_STORAGE_ID)
        view['data_type_col'].add_attribute(view['data_type_text'], 'text', self.DATA_TYPE_NAME_STORAGE_ID)
        if not isinstance(self.model.state, LibraryState) and self.model.state.get_next_upper_library_root_state() is None:
            view['name_text'].set_property("editable", True)
            view['data_type_text'].set_property("editable", True)

        # in the linkage overview the the default value is not shown
        if isinstance(view, InputPortsListView) or isinstance(view, OutputPortsListView):
            view['default_value_col'].add_attribute(view['default_value_text'], 'text', self.DEFAULT_VALUE_STORAGE_ID)
            self._apply_value_on_edited_and_focus_out(view['default_value_text'], self._apply_new_data_port_default_value)
            view['default_value_col'].set_cell_data_func(view['default_value_text'],
                                                         self._default_value_cell_data_func)
            if isinstance(self.model.state, LibraryState):
                view['default_value_col'].set_title("Used value")
            if self.model.state.get_next_upper_library_root_state() is None:  # never enabled means it is disabled
                view['default_value_text'].set_property("editable", True)

        self._apply_value_on_edited_and_focus_out(view['name_text'], self._apply_new_data_port_name)
        self._apply_value_on_edited_and_focus_out(view['data_type_text'], self._apply_new_data_port_type)

        if isinstance(self.model.state, LibraryState):
            view['use_runtime_value_toggle'] = Gtk.CellRendererToggle()
            view['use_runtime_value_col'] = Gtk.TreeViewColumn("Use Runtime Value")
            view['use_runtime_value_col'].set_property("sizing", Gtk.TreeViewColumnSizing.AUTOSIZE)
            view.get_top_widget().append_column(view['use_runtime_value_col'])
            view['use_runtime_value_col'].pack_start(view['use_runtime_value_toggle'], True)
            view['use_runtime_value_col'].add_attribute(view['use_runtime_value_toggle'], 'active',
                                                        self.USE_RUNTIME_VALUE_STORAGE_ID)
            if self.model.state.get_next_upper_library_root_state() is None:
                view['use_runtime_value_toggle'].set_property("activatable", True)
                view['use_runtime_value_toggle'].connect("toggled", self.on_use_runtime_value_toggled)

        self._reload_data_port_list_store()