CHECKSTYLE:OFF Orginal Apache code
174518
public static byte[] decodeHex(final String data) {

        checkNotNull("data", data);

        final int len = data.length();

        if ((len & 0x01) != 0) {
            throw new RuntimeException("Odd number of characters.");
        }

        final byte[] out = new byte[len >> 1];

        // two characters form the hex value.
        for (int i = 0, j = 0; j < len; i++) {
            int f = toDigit(data.charAt(j), j) << 4;
            j++;
            f = f | toDigit(data.charAt(j), j);
            j++;
            out[i] = (byte) (f & 0xFF);
        }

        return out;
    }
207597
def _sanitize_config(config):
        ''''''
        if 'checks' in config:
            checks = config['checks']
            if 'structural_checks' not in checks:
                checks['structural_checks'] = []
            if 'neuron_checks' not in checks:
                checks['neuron_checks'] = []
        else:
            raise ConfigError('Need to have "checks" in the config')

        if 'options' not in config:
            L.debug('Using default options')
            config['options'] = {}

        if 'color' not in config:
            config['color'] = False

        return config
331780
def clean(all=False, docs=False, dist=False, extra=None):
    """"""

    run('find . -type f -name "*.py[co]" -delete')
    run('find . -type d -name "__pycache__" -delete')

    patterns = ['build', '*.egg-info/']
    if all or docs:
        patterns.append('doc/build/*')
    if all or dist:
        patterns.append('dist')
    if extra:
        patterns.append(extra)
    for pattern in patterns:
        run('rm -rf {}'.format(pattern))
469918
def stop_executing_svc_checks(self):
        
        if self.my_conf.execute_service_checks:
            self.my_conf.modified_attributes |= DICT_MODATTR["MODATTR_ACTIVE_CHECKS_ENABLED"].value
            self.my_conf.execute_service_checks = False
            self.my_conf.explode_global_conf()
            self.daemon.update_program_status()
1007483
function checkStylesheet(i) {
  const start = i;
  let l;

  // Check every token:
  while (i < tokensLength) {
    if (l = checkSC(i) ||
        checkRuleset(i) ||
        checkDeclaration(i) ||
        checkDeclDelim(i) ||
        checkAtrule(i) ||
        checkMixin(i)) i += l;
    else throwError(i);
  }

  return i - start;
}
1290254
function setChecksum(fs, path, checksum, callback) {
  fs.setxattr(path, constants.attributes.checksum, checksum, callback);
}
408519
function sanitizeHtml(html, whitelist) {
        return html.replace(/<[^>]*>?/gi, function(tag) {
            return tag.match(whitelist) ? tag : '';
        });
    }
767141
def remove_formatting_codes(line, irc=False):
    """"""
    if irc:
        line = escape(line)
    new_line = ''
    while len(line) > 0:
        try:
            if line[0] == '$':
                line = line[1:]

                if line[0] == '$':
                    new_line += '$'
                    line = line[1:]

                elif line[0] == 'c':
                    line = line[1:]
                    if line[0].isdigit():
                        line = line[1:]
                        if line[0].isdigit():
                            line = line[1:]
                            if line[0] == ',':
                                line = line[1:]
                                if line[0].isdigit():
                                    line = line[1:]
                                    if line[0].isdigit():
                                        line = line[1:]
                        elif line[0] == ',':
                            line = line[1:]
                            if line[0].isdigit():
                                line = line[1:]
                                if line[0].isdigit():
                                    line = line[1:]
                    if line[0] == '[':
                        while line[0] != ']':
                            line = line[1:]
                        line = line[1:]

                elif line[0] == '{':
                    if line[:3] == '{$}':
                        new_line += '$'
                        line = line[3:]
                        continue
                    while line[0] != '}':
                        line = line[1:]
                    line = line[1:]

                else:
                    line = line[1:]

            else:
                new_line += line[0]
                line = line[1:]
        except IndexError:
            continue
    return new_line
925434
private boolean checkStyle(String style) throws IOException {
		if (CSL.supportsStyle(style)) {
			//style is supported
			return true;
		}

		//style is not supported. look for alternatives.
		String message = "Could not find style in classpath: " + style;
		Set<String> availableStyles = CSL.getSupportedStyles();
		
		//output alternative
		if (!availableStyles.isEmpty()) {
			String dyms = ToolUtils.getDidYouMeanString(availableStyles, style);
			if (dyms != null && !dyms.isEmpty()) {
				message += "\n\n" + dyms;
			}
		}
		
		error(message);
		return false;
	}
490188
def cli(ctx, project_dir):
    """"""
    exit_code = SCons(project_dir).verify()
    ctx.exit(exit_code)
766561
function handleHashChange_() {
  cssTranspiler.getCssWithVars(getUrlCssVars()).then(updatedStyles => {
    iframeManager.setStyle(updatedStyles);
  }).catch(error => {
    // Don't set the styles, log the error
    console.error(error);
  });
}
649479
def check(code):
    """"""
    def safe_lookup(op):
        try:
            return instructions.lookup(op)
        except Exception:
            return op

    for i, a in enumerate(code):
        b = code[i+1] if i+1 < len(code) else None

        # Does instruction exist?
        if not isconstant(a):
            try:
                instructions.lookup(a)
            except KeyError as err:
                # Skip embedded push closures
                if not (len(err.args)==1 and is_embedded_push(err.args[0])):
                    raise CompileError("Instruction at index %d is unknown: %s"
                            % (i, a))

        # Invalid: <str> int
        if isstring(a) and safe_lookup(b) == instructions.cast_int:
            raise CompileError(
                "Cannot convert string to integer (index %d): %s %s" % (i, a,
                    b))

        # Invalid: <int> <binary op>
        boolean_ops = [instructions.boolean_not,
                      instructions.boolean_or,
                      instructions.boolean_and]

        if not isbool(a) and safe_lookup(b) in boolean_ops:
            raise CompileError(
                "Can only use binary operators on booleans (index %d): %s %s" %
                    (i, a, b))
    return code
1044542
function prune(code) {
  var ast = esprima.parse(code);

  estraverse.replace(ast, {
    leave: function leave(node, parent) {
      var ret;

      if ('IfStatement' === node.type) {
        if ('BinaryExpression' !== node.test.type) return;

        if ('self' === node.test.left.argument.name) {
          node.alternate = null;
        } else if ('global' === node.test.left.argument.name) {
          ret = node.alternate;
        }

        return ret;
      }

      if (
          'BlockStatement' === node.type
        && 'FunctionExpression' === parent.type
      ) {
        return node.body[0].alternate.alternate;
      }
    }
  });

  return escodegen.generate(ast, {
    format: {
      indent: { style: '  ' },
      semicolons: false,
      compact: true
    }
  });
}
1334494
private void checkAst(Node externs, Node root) {
    astValidator.validateCodeRoot(externs);
    astValidator.validateCodeRoot(root);
  }
1290111
def clean(ctx, docs=False, bytecode=False, extra=''):
    ''''''
    patterns = ['build', 'dist', 'cover', 'docs/_build', '**/*.pyc', '*.egg-info', '.tox']
    for pattern in patterns:
        print('Removing {0}'.format(pattern))
        with ctx.cd(ROOT):
            ctx.run('rm -rf {0}'.format(pattern))
684204
def action_verify_checksum(self, ids):
        """"""
        try:
            count = 0
            for file_id in ids:
                f = FileInstance.query.filter_by(
                    id=uuid.UUID(file_id)).one_or_none()
                if f is None:
                    raise ValueError(_("Cannot find file instance."))
                verify_checksum.delay(file_id)
                count += 1
            if count > 0:
                flash(_('Fixity check(s) sent to queue.'), 'success')
        except Exception as exc:
            if not self.handle_view_exception(exc):
                raise
            current_app.logger.exception(str(exc))  # pragma: no cover
            flash(_('Failed to run fixity checks.'),
                  'error')
92664
function sanitizeStyle(value) {
	        value = String(value).trim(); // Make sure it's actually a string.
	        if (!value)
	            return '';
	        // Single url(...) values are supported, but only for URLs that sanitize cleanly. See above for
	        // reasoning behind this.
	        var urlMatch = value.match(URL_RE);
	        if ((urlMatch && sanitizeUrl(urlMatch[1]) === urlMatch[1]) ||
	            value.match(SAFE_STYLE_VALUE) && hasBalancedQuotes(value)) {
	            return value; // Safe style values.
	        }
	        if (_angular_core.isDevMode()) {
	            getDOM().log("WARNING: sanitizing unsafe style value " + value + " (see http://g.co/ng/security#xss).");
	        }
	        return 'unsafe';
	    }