Apply attribute conditions
339745
protected function applyElementConditions()
    {
        if ($this->element !== null) {
            $this->andWhere(Db::parseParam('elementId', $this->parseElementValue($this->element)));
        }
    }
651712
def condition_from_code(condcode):
    """"""
    if condcode in __BRCONDITIONS:
        cond_data = __BRCONDITIONS[condcode]

        return {CONDCODE: condcode,
                CONDITION: cond_data[0],
                DETAILED: cond_data[1],
                EXACT: cond_data[2],
                EXACTNL: cond_data[3],
                }
    return None
1350452
private void parseAttributes(Context context, AttributeSet attrs, int defStyle){
        int defaultColor = context.getResources().getColor(R.color.black26);
        final TypedArray a = context.obtainStyledAttributes(attrs,
                R.styleable.EmptyView, defStyle, 0);
        if (a == null) {
            mEmptyMessageColor = defaultColor;
            mEmptyActionColor = defaultColor;
            mEmptyMessageTextSize = (int) SizeUtils.dpToPx(context, 18);
            mEmptyActionTextSize = (int) SizeUtils.dpToPx(context, 14);
            mEmptyMessageTypeface = Face.ROBOTO_REGULAR;
            mEmptyIconPadding = getResources().getDimensionPixelSize(R.dimen.activity_padding);
            return;
        }

        // Parse attributes
        mEmptyIcon = a.getResourceId(R.styleable.EmptyView_emptyIcon, -1);
        mEmptyIconSize = a.getDimensionPixelSize(R.styleable.EmptyView_emptyIconSize, -1);
        mEmptyIconColor = a.getColor(R.styleable.EmptyView_emptyIconColor, defaultColor);
        mEmptyIconPadding = a.getDimensionPixelSize(R.styleable.EmptyView_emptyIconPadding, getResources().getDimensionPixelSize(R.dimen.activity_padding));

        mEmptyMessage = a.getString(R.styleable.EmptyView_emptyMessage);
        mEmptyMessageColor = a.getColor(R.styleable.EmptyView_emptyMessageColor, defaultColor);
        int typeface = a.getInt(R.styleable.EmptyView_emptyMessageTypeface, 0);
        mEmptyMessageTypeface = MessageTypeface.from(typeface).getTypeface();
        mEmptyMessageTextSize = a.getDimensionPixelSize(R.styleable.EmptyView_emptyMessageTextSize,
                (int) SizeUtils.dpToPx(context, 18));

        mEmptyActionColor = a.getColor(R.styleable.EmptyView_emptyActionColor, defaultColor);
        mEmptyActionText = a.getString(R.styleable.EmptyView_emptyActionText);
        mEmptyActionTextSize = a.getDimensionPixelSize(R.styleable.EmptyView_emptyActionTextSize,
                (int) SizeUtils.dpToPx(context, 14));

        mState = a.getInt(R.styleable.EmptyView_emptyState, STATE_EMPTY);

        a.recycle();
    }
506960
protected function applyFieldConditions()
    {
        if ($this->field !== null) {
            $this->andWhere(Db::parseParam('fieldId', $this->parseFieldValue($this->field)));
        }
    }
464045
def attribute(*args)
      node = Nodes::Attribute.new

      if args.first.is_a?(Hash)
        args.first.each_pair { |k, v| node[v] = k }
      else
        options = args.extract_options!
        args.each { |name|
          key = options[:as] || name
          node[key] = name
        }
        node.condition = options[:if]
      end

      @template.add_node node
    end
203606
function _setAttributes(el, attrs) {
  Object.keys(attrs).forEach((key) => {
    el.setAttribute(key, attrs[key]);
  });
}
1235538
def _set_condition(self, condition):
        """"""
        assert isinstance(condition, CodeExpression.TYPES)
        self.condition = condition
468371
function parseAttributes(attributes) {
  for (const prop in attributes) {
    // Parse boolean values
    if (attributes[prop] === '') {
      attributes[prop] = true;
    }
  }

  return attributes;
}
524816
def attribute(*args)
      if args.first.is_a?(Hash) # :foo => :bar, :bar => :baz
        attr_aliases  = args.first.except(:if, :unless)
        conditions    = args.first.slice(:if, :unless)

        attr_aliases.each do |key, as|
          attribute(key, conditions.merge(:as => as))
        end
      else # array of attributes i.e :foo, :bar, :baz
        options = args.extract_options!
        args.each do |name|
          @_settings[:attributes] << { :name => name, :options => options }
        end
      end
    end
1371146
def set_attrs(self, **attrs):
        """"""
        commands = tuple(self.values())
        for name, value in attrs.items():
            for command in commands:
                setattr(command, name, value)
1083862
def _checkAttribs(self, strict):
        """"""
        if self.choice:
            warning("Choice values not allowed for real-type parameter " +
                    self.name, strict)
            self.choice = None
510562
private void setRestrictedAttributes(Map<String, String> attributes) {

        // Translate disabled attribute
        getModel().setDisabled("true".equals(attributes.get(DISABLED_ATTRIBUTE_NAME)));

    }
580654
def has_attribute(self, name, alias=False):
        """"""
        prop_dict = merge_dicts(self.__attributes__,
                                self.__fields__,
                                self.__relations__)
        if alias:
            prop_dict.update({v.alias : v for v in prop_dict.values() if v.alias is not None})
        
        return name in prop_dict
690372
public void applyAttributeFilter(AttributeScorer filter, int rank) {
		if (filter == null)
			return;
		if (rank >= this.getAttributesNum())
			return;
		// get the threshold
		double threshold = filter.getValueForRank(rank);
		// iterate on the attributes
		// and remove them if their LLR score is below the threshold
		Iterator termIter = this.tokenForm2index.keySet().iterator();
		List terms2remove = new ArrayList();
		while (termIter.hasNext()) {
			String term = (String) termIter.next();
			int[] index = this.tokenForm2index.get(term);
			// get the score
			// TODO what if we are getting -1
			if (filter.getScore(index[0]) < threshold)
				terms2remove.add(term);
		}
		for (int i = 0; i < terms2remove.size(); i++) {
			String term = (String) terms2remove.get(i);
			int[] index = this.tokenForm2index.remove(term);
			this.index2docfreq.remove(Integer.valueOf(index[0]));
		}
	}
405564
function _applyAttrs(context, attrs) {
    for (var attr in attrs) {
      if (attrs.hasOwnProperty(attr)) {
        context.setAttribute(attr, attrs[attr]);
      }
    }
  }
216921
def set_attribute(self, aid, attrib, val, idx='*'):
        
        if aid in self.__attrib_ids:
            elems = self.__attrib_ids[aid]
            if idx == '*':
                for elem in elems:
                    self.__set_attribute(elem, attrib, val)
            elif idx < len(elems):
                elem = elems[idx]
                self.__set_attribute(elem, attrib, val)
542829
def apply(self):
        ''' 
        '''
        bus = self.case.buses[int(self.bus_lb.curselection()[0])]

        for attr in [a for a in BUS_ATTRS if a not in self.excluded+['mode']]:
            value = getattr(self.bus_params, attr).get()
            setattr(bus, attr, value)