Add a resource to the stack and optionally set its attributes
189591
def add(name, resource, attributes = {})
      resources[name] = resource
      resource.update_attributes(attributes) if attributes.any?
      resource
    end
355460
def add(name, options)
      @properties[name.to_sym] = Property.new(name.to_sym, options[:type], options[:default])
    end
1009081
function(resource_object) {

		for (var name in resource_object) {
			if (resource_object[name].type == 'container_stack') {

				resource_object[name] = {
					type: 'container',
					value: this._mergeRootContainerStack(resource_object[name].value)
				}

			}
		}

	}
497975
def _get_or_create_stack(name):
  """"""
  stack = getattr(_LOCAL_STACKS, name, None)
  if stack is None:
    stack = []
    setattr(_LOCAL_STACKS, name, stack)
  return stack
593078
def push(self, style={}):
        """"""
        _style = {}
        for attr in style:
            if attr in self.cmds and not style[attr] in self.cmds[attr]:
                print 'WARNING: ESC/POS PRINTING: ignoring invalid value: '+utfstr(style[attr])+' for style: '+utfstr(attr)
            else:
                _style[attr] = self.enforce_type(attr, style[attr])
        self.stack.append(_style)
817141
def attach_method(self, resource_id):
        """"""
        try:
            _response = self.client.put_method(
                restApiId=self.api_id,
                resourceId=resource_id,
                httpMethod=self.trigger_settings['method'],
                authorizationType="NONE",
                apiKeyRequired=False, )
            self.log.debug('Response for resource (%s) push authorization: %s', resource_id, _response)
            _response = self.client.put_method_response(
                restApiId=self.api_id,
                resourceId=resource_id,
                httpMethod=self.trigger_settings['method'],
                statusCode='200')
            self.log.debug('Response for resource (%s) no authorization: %s', resource_id, _response)

            self.log.info("Successfully attached method: %s", self.trigger_settings['method'])
        except botocore.exceptions.ClientError:
            self.log.info("Method %s already exists", self.trigger_settings['method'])
147975
def add_resources(self, resources):
    
    new_resources = self._build_resource_dictionary(resources)

    for key in new_resources:
      self._resources[key] = new_resources[key]
    self._dirty_attributes.add(u'resources')
637049
function(widget_config, unknown_attributes, resource_name) {

		var value = {
				type: 'container_stack',
				value: []
			},
			operations_stack = value.value;

		if (!widget_config.resources) {

			widget_config.resources = {};

		}

		if (!widget_config.resources['default']) {

			widget_config.resources['default'] = {};

		}

		if ('class' in unknown_attributes) {

			operations_stack.push({
				name: 'add_classes',
				value: unknown_attributes['class'].trim().split(/\s+/)
			});
			delete unknown_attributes['class'];

		}

		if ('style' in unknown_attributes) {

			operations_stack.push({
				name: 'add_styles',
				value: Lava.parsers.Common.parseStyleAttribute(unknown_attributes.style)
			});
			delete  unknown_attributes.style;

		}

		if (!Firestorm.Object.isEmpty(unknown_attributes)) {

			operations_stack.push({
				name: 'add_properties',
				value: Firestorm.Object.copy(unknown_attributes) // copying to reduce possible slowdowns (object may contain deleted values)
			});

		}

		Lava.resources.putResourceValue(widget_config.resources['default'], resource_name, value);

	}
870731
def add_resource(mt_file, ref, cache):
    """"""

    if isinstance(mt_file, MetapackDoc):
        doc = mt_file
    else:
        doc = MetapackDoc(mt_file)

    if not 'Resources' in doc:
        doc.new_section('Resources')

    doc['Resources'].args = [e for e in set(doc['Resources'].args + ['Name', 'StartLine', 'HeaderLines', 'Encoding']) if
                             e]

    seen_names = set()

    u = parse_app_url(ref)

    # The web and file URLs don't list the same.

    if u.proto == 'file':
        entries = u.list()
    else:
        entries = [ssu for su in u.list() for ssu in su.list()]

    errors = []

    for e in entries:
        if not add_single_resource(doc, e, cache=cache, seen_names=seen_names):
            errors.append(e)

    if errors:
        prt()
        warn("Found, but failed to add these urls:")
        for e in errors:
            print('    ', e)

    write_doc(doc, mt_file)
1036195
def _add_to_stack(self, item, value):
        
        p_value = (item, value)
        if p_value not in self.stack:
            self.stack.append(p_value)
1118749
def add_attribute(name, value, options={})
      new_representor_hash = RepresentorHash.new(deep_dup(@representor_hash.to_h))
      new_representor_hash.attributes[name] = options.merge({value: value})
      RepresentorBuilder.new(new_representor_hash)
    end
580432
def __push_params(self, tid, params):
        
        stack = self.__paramStack.get( tid, [] )
        stack.append(params)
        self.__paramStack[tid] = stack
919353
def add_attr(self, name, value):
        """"""
        setattr(self, name, value)
        self.attrs.append(name)
820678
def modify_stack(target_status, failure_message, &block)
      if wait?
        status = modify_stack_synchronously(&block)
        raise StackUpdateError, failure_message unless target_status === status
        status
      else
        modify_stack_asynchronously(&block)
      end
    end
111719
def add_static(self, prefix: str, path: PathLike, *,
                   name: Optional[str]=None,
                   expect_handler: Optional[_ExpectHandler]=None,
                   chunk_size: int=256 * 1024,
                   show_index: bool=False, follow_symlinks: bool=False,
                   append_version: bool=False) -> AbstractResource:
        
        assert prefix.startswith('/')
        if prefix.endswith('/'):
            prefix = prefix[:-1]
        resource = StaticResource(prefix, path,
                                  name=name,
                                  expect_handler=expect_handler,
                                  chunk_size=chunk_size,
                                  show_index=show_index,
                                  follow_symlinks=follow_symlinks,
                                  append_version=append_version)
        self.register_resource(resource)
        return resource
759028
function _set_common(stack_name, thing){
	var ret = null;
	if( stack_name == 'css_libs' ||
	    stack_name == 'js_libs' ||
	    stack_name == 'js_vars' ){
	    _add_permanently_to(stack_name, thing);
	    ret = thing;
	}
	//console.log('added ' + thing.length + ' to ' + stack_name);

	return ret;
    }
911924
def add_resource_attribute(resource_type, resource_id, attr_id, is_var, error_on_duplicate=True, **kwargs):
    

    attr = db.DBSession.query(Attr).filter(Attr.id==attr_id).first()

    if attr is None:
        raise ResourceNotFoundError("Attribute with ID %s does not exist."%attr_id)

    resource_i = _get_resource(resource_type, resource_id)

    resourceattr_qry = db.DBSession.query(ResourceAttr).filter(ResourceAttr.ref_key==resource_type)

    if resource_type == 'NETWORK':
        resourceattr_qry = resourceattr_qry.filter(ResourceAttr.network_id==resource_id)
    elif resource_type == 'NODE':
        resourceattr_qry = resourceattr_qry.filter(ResourceAttr.node_id==resource_id)
    elif resource_type == 'LINK':
        resourceattr_qry = resourceattr_qry.filter(ResourceAttr.link_id==resource_id)
    elif resource_type == 'GROUP':
        resourceattr_qry = resourceattr_qry.filter(ResourceAttr.group_id==resource_id)
    elif resource_type == 'PROJECT':
        resourceattr_qry = resourceattr_qry.filter(ResourceAttr.project_id==resource_id)
    else:
        raise HydraError('Resource type "{}" not recognised.'.format(resource_type))
    resource_attrs = resourceattr_qry.all()

    for ra in resource_attrs:
        if ra.attr_id == attr_id:
            if not error_on_duplicate:
                return ra

            raise HydraError("Duplicate attribute. %s %s already has attribute %s"
                             %(resource_type, resource_i.get_name(), attr.name))

    attr_is_var = 'Y' if is_var == 'Y' else 'N'

    new_ra = resource_i.add_attribute(attr_id, attr_is_var)
    db.DBSession.flush()

    return new_ra