check platforms/web/util/attrs.js acceptValue
348102
function shouldUpdateValue (elm, checkVal) {
  return (!elm.composing && (
    elm.tagName === 'OPTION' ||
    isNotInFocusAndDirty(elm, checkVal) ||
    isDirtyWithModifiers(elm, checkVal)
  ))
}
215286
function (browser) {
    var isValid = this.platforms.reduce(function (previousValue, platform) {
      if (previousValue === browser.platform || platform === browser.platform) {
        return browser.platform;
      }
    });

    return isValid || this.desiredCapabilities.platform;
  }
473256
function(attr, value) {
    value = value.toString();

    switch(attr) {
      case 'phone':
        return value.replace(/[^\d]/g, '');
      break;

      case 'cost':
      case 'amount':
      case 'shippingCost':
        return parseFloat(value).toFixed(2);
      break;

      default:
        return value;
      break;
    }
  }
928951
function(attr, options) {
      if (!(attr in this.attributes)) return this;
      options || (options = {});
      var value = this.attributes[attr];

      // Run validation.
      var validObj = {};
      validObj[attr] = void 0;
      if (!options.silent && this.validate && !this._performValidation(validObj, options)) return false;

      // Remove the attribute.
      delete this.attributes[attr];
      delete this._escapedAttributes[attr];
      if (attr == this.idAttribute) delete this.id;
      this._changed = true;
      if (!options.silent) {
        this.trigger('change:' + attr, this, void 0, options);
        this.change(options);
      }
      return this;
    }
1869
def checkattr(metacls, attr, value):
        
        if not isinstance(value, (
                types.MethodType,
                types.FunctionType,
                classmethod,
                staticmethod,
                property)):
            if attr in dir(type('dummy', (object,), {})) + \
                    ['__metaclass__', '__qualname__']:
                return
            if attr.startswith('_'):
                raise SyntaxError(
                    "TreeModel attribute `{0}` "
                    "must not start with `_`".format(attr))
            if not inspect.isclass(value):
                if not isinstance(value, Column):
                    raise TypeError(
                        "TreeModel attribute `{0}` "
                        "must be an instance of "
                        "`rootpy.tree.treetypes.Column`".format(attr))
                return
            if not issubclass(value, (ROOT.TObject, ROOT.ObjectProxy)):
                raise TypeError(
                    "TreeModel attribute `{0}` must inherit "
                    "from `ROOT.TObject` or `ROOT.ObjectProxy`".format(
                        attr))
413433
def _validateAttrs(self, keys):
        """"""
        badAttrsMsg = ""
        for k in keys:
            if k not in self.attrs:
                badAttrsMsg += "Attribute key '%s' is not a valid attribute"%(k)
        if badAttrsMsg:
            raise ValueError("Encountered invalid attributes.  ALLOWED: %s%s%s"\
                %(list(self.attrs), os.linesep, badAttrsMsg))
314691
function checkPlatformSupported(version, platform) {
  const url = `${base}/${version}`;

  if (platform === 'darwin') {
    platform = 'osx64';
  }

  return new Promise((resolve, reject) => {
    https.get(url, (res) => {
      let body = '';

      res.on('error', reject);
      res.on('data', (d) => body += d.toString());
      res.on('end', () => {
        if (res.statusCode !== 200) {
          return reject(new Error(body));
        }

        let $ = cheerio.load(body);
        let links = [];

        $('a[href]').each((i, link) => links.push(link.attribs.href));

        for (let link of links) {
          if (link.includes(platform)) {
            return resolve(true);
          }
        }

        resolve(false);
      });
    }).on('error', reject);
  });
}
527649
function resolveAttributeValue(value, part) {
  if (isDirective(value)) {
    value = resolveDirectiveValue(value, part);
  }

  if (value === nothingString) {
    return value;
  }

  if (isTemplateResult(value)) {
    value = value.read();
  }

  if (isPrimitive(value)) {
    const string = typeof value !== 'string' ? String(value) : value;
    // Escape if not prefixed with unsafePrefixString, otherwise strip prefix
    return Buffer.from(
      string.indexOf(unsafePrefixString) === 0 ? string.slice(33) : escapeHTML(string)
    );
  } else if (Buffer.isBuffer(value)) {
    return value;
  } else if (isPromise(value)) {
    return value.then((value) => resolveAttributeValue(value, part));
  } else if (isSyncIterator(value)) {
    if (!Array.isArray(value)) {
      value = Array.from(value);
    }
    return Buffer.concat(
      value.reduce((values, value) => {
        value = resolveAttributeValue(value, part);
        // Flatten
        if (Array.isArray(value)) {
          return values.concat(value);
        }
        values.push(value);
        return values;
      }, [])
    );
  } else {
    throw Error('unknown AttributPart value', value);
  }
}
825176
AttributeValue get_last_attr_value() throws DevFailed
	{
		RingElt	record = get_last_element();
		if (record.except == null)
			return record.attr_value;
		else
			throw record.except;
	}
1099471
private String checkConflict(Element elem, String oldAttrValue, String attr)
			throws JspCoreException {

		String result = oldAttrValue;
		String attrValue = null; 
		if (elem.getAttributeNode(attr) != null ) {
			attrValue = elem.getAttributeNode(attr).getValue();
		}
		if (attrValue != null) {
			if (oldAttrValue != null && !oldAttrValue.equals(attrValue)) {
	            throw new JspTranslationException(
	                    elem,
	                    "jsp.error.tag.conflict.attr",
	                    new Object[] { attr, oldAttrValue, attrValue });
			}
			result = attrValue;
		}
		return result;
	}
320529
private AttributesImpl validateScope(final Attributes atts, final AttributesImpl modified) {
        AttributesImpl res = modified;
        final String scope = atts.getValue(ATTRIBUTE_NAME_SCOPE);
        final URI href = toURI(atts.getValue(ATTRIBUTE_NAME_HREF));
        if (scope == null && href != null && href.isAbsolute()) {
            final boolean sameScheme = Objects.equals(currentFile.getScheme(), href.getScheme());
            final boolean sameAuthority = Objects.equals(currentFile.getRawAuthority(), href.getRawAuthority());
            if (!(sameScheme && sameAuthority)) {
                switch (processingMode) {
                    case LAX:
                        if (res == null) {
                            res = new AttributesImpl(atts);
                        }
                        addOrSetAttribute(res, ATTRIBUTE_NAME_SCOPE, ATTR_SCOPE_VALUE_EXTERNAL);
                        logger.warn(MessageUtils.getMessage("DOTJ075W", href.toString()).setLocation(locator).toString());
                        break;
                    default:
                        logger.warn(MessageUtils.getMessage("DOTJ076W", href.toString()).setLocation(locator) + ", using invalid value.");
                        break;
                }
            }
        }
        return res;
    }
641844
def check_valid(var, key, expected):
    """

    att = getattr(var, key, None)
    if att is None:
        e = 'Variable does not have a `{}` attribute.'.format(key)
        warn(e)
    elif att != expected:
        e = 'Variable has a non-conforming {}. Got `{}`, expected `{}`'.format(key, att, expected)
        warn(e)
1225494
function watchAttributes() {
      attr.$observe('value', function(value) {
        var percentValue = clamp(value);
        element.attr('aria-valuenow', percentValue);

        if (mode() != MODE_QUERY) animateIndicator(bar2, percentValue);
      });

      attr.$observe('mdBufferValue', function(value) {
        animateIndicator(bar1, clamp(value));
      });

      attr.$observe('disabled', function(value) {
        if (value === true || value === false) {
          isDisabled = !!value;
        } else {
          isDisabled = angular.isDefined(value);
        }

        element.toggleClass(DISABLED_CLASS, isDisabled);
        container.toggleClass(lastMode, !isDisabled);
      });

      attr.$observe('mdMode', function(mode) {
        if (lastMode) container.removeClass(lastMode);

        switch (mode) {
          case MODE_QUERY:
          case MODE_BUFFER:
          case MODE_DETERMINATE:
          case MODE_INDETERMINATE:
            container.addClass(lastMode = "md-mode-" + mode);
            break;
          default:
            container.addClass(lastMode = "md-mode-" + MODE_INDETERMINATE);
            break;
        }
      });
    }
121860
def _is_allowed(attr, *args):
    
    for backend in _get_backends():
        try:
            if getattr(backend, attr)(*args):
                return True
        except AttributeError:
            raise NotImplementedError("%s.%s.%s() not implemented" % (
                backend.__class__.__module__, backend.__class__.__name__, attr)
            )
    return False
30898
def value_attr(attr_name):
    

    def value_attr(value, context, **_params):
        value = getattr(value, attr_name)
        return _attr(value)

    return value_attr
941220
function accept(req, res, cb) {
	var u = url.parse(req.url, true),
		path = u.pathname

	if(/^\/api\/?$/.test(path)) {
		messageInit({cb:(cb || nop), req:req, res:res, path:path, query:u.query, u:u})
		return;
	}

	if(req.method == "OPTIONS") {
		res.writeHead(200, {
			"Access-Control-Allow-Origin": "*",	// to support cross-domain script execution of our api
			"Access-Control-Max-Age": "0",
		})
		res.end()
		return;
	}

	www(req, res)					// everything else handled by paperboy
}
133709
def accept(handlers, default=None, error='The requested content type does not match any of those allowed'):
    
    def output_type(data, request, response):
        accept = request.accept
        if accept in ('', '*', '/'):
            handler = default or handlers and next(iter(handlers.values()))
        else:
            handler = default
            accepted = [accept_quality(accept_type) for accept_type in accept.split(',')]
            accepted.sort(key=itemgetter(0))
            for quality, accepted_content_type in reversed(accepted):
                if accepted_content_type in handlers:
                    handler = handlers[accepted_content_type]
                    break

        if not handler:
            raise falcon.HTTPNotAcceptable(error)

        response.content_type = handler.content_type
        return handler(data, request=request, response=response)
    output_type.__doc__ = 'Supports any of the following formats: {0}'.format(', '.join(function.__doc__ for function in
                                                                                        handlers.values()))
    output_type.content_type = ', '.join(handlers.keys())
    return output_type