Tell if the expr param is contained within an xsl:param.
967696
protected boolean isParam(ExpressionNode expr)
  {
  	while(null != expr)
  	{
  		if(expr instanceof ElemTemplateElement)
  			break;
  		expr = expr.exprGetParent();
  	}
  	if(null != expr)
  	{
  		ElemTemplateElement ete = (ElemTemplateElement)expr;
  		while(null != ete)
  		{
  			int type = ete.getXSLToken();
  			switch(type)
  			{
  				case Constants.ELEMNAME_PARAMVARIABLE:
  					return true;
  				case Constants.ELEMNAME_TEMPLATE:
  				case Constants.ELEMNAME_STYLESHEET:
  					return false;
  			}
  			ete = ete.getParentElem();
  		}
  	}
  	return false;
  	
  }
1183251
def _checkParam(param, value, paramlimits, paramtypes):
    
    assert param in paramlimits, "Invalid param: {0}".format(param)
    (lowlim, highlim) = paramlimits[param]
    paramtype = paramtypes[param]
    if isinstance(paramtype, tuple):
        (paramtype, paramshape) = paramtype
        if not (isinstance(value, paramtype)):
            raise ValueError("{0} must be {1}, not {2}".format(
                    param, paramtype, type(param)))
        if value.shape != paramshape:
            raise ValueError("{0} must have shape {1}, not {2}".format(
                    param, paramshape, value.shape))
        if value.dtype != 'float':
            raise ValueError("{0} must have dtype float, not {1}".format(
                    param, value.dtype))
        if not ((lowlim <= value).all() and (value <= highlim).all()):
            raise ValueError("{0} must be >= {1} and <= {2}, not {3}".format(
                    param, lowlim, highlim, value))
    else:
        if not isinstance(value, paramtype):
            raise ValueError("{0} must be a {1}, not a {2}".format(
                    param, paramtype, type(value)))
        if not (lowlim <= value <= highlim):
            raise ValueError("{0} must be >= {1} and <= {2}, not {3}".format(
                    param, lowlim, highlim, value))
139059
def __xml_scan(node, env, path, arg):
    
    # Does the node exist yet?
    if not os.path.isfile(str(node)):
        return []
    
    if env.get('DOCBOOK_SCANENT',''):
        # Use simple pattern matching for system entities..., no support 
        # for recursion yet.
        contents = node.get_text_contents()
        return sentity_re.findall(contents)

    xsl_file = os.path.join(scriptpath,'utils','xmldepend.xsl')
    if not has_libxml2 or prefer_xsltproc:
        if has_lxml and not prefer_xsltproc:
            
            from lxml import etree
            
            xsl_tree = etree.parse(xsl_file)
            doc = etree.parse(str(node))
            result = doc.xslt(xsl_tree)

            depfiles = [x.strip() for x in str(result).splitlines() if x.strip() != "" and not x.startswith("<?xml ")]
            return depfiles
        else:
            # Try to call xsltproc
            xsltproc = env.subst("$DOCBOOK_XSLTPROC")
            if xsltproc and xsltproc.endswith('xsltproc'):
                result = env.backtick(' '.join([xsltproc, xsl_file, str(node)]))
                depfiles = [x.strip() for x in str(result).splitlines() if x.strip() != "" and not x.startswith("<?xml ")]
                return depfiles
            else:
                # Use simple pattern matching, there is currently no support
                # for xi:includes...
                contents = node.get_text_contents()
                return include_re.findall(contents)

    styledoc = libxml2.parseFile(xsl_file)
    style = libxslt.parseStylesheetDoc(styledoc)
    doc = libxml2.readFile(str(node), None, libxml2.XML_PARSE_NOENT)
    result = style.applyStylesheet(doc, None)

    depfiles = []
    for x in str(result).splitlines():
        if x.strip() != "" and not x.startswith("<?xml "):
            depfiles.extend(x.strip().split())
    
    style.freeStylesheet()
    doc.freeDoc()
    result.freeDoc()

    return depfiles
1032211
def verify(expr, params=None):
    
    try:
        compile(expr, params=params)
        return True
    except com.TranslationError:
        return False
1311633
def each_by_param(param_name)
      REXML::XPath.each(self, lookup_param(param_name).path) { |e| yield e }
    end
88081
public static boolean hasQueryParam(String param, ContainerRequestContext ctx) {
		return ctx.getUriInfo().getQueryParameters().containsKey(param);
	}
615004
public boolean is(ComparisonExpression expr) {
		try {
			if (expr != null) {
				return expr.evaluate(node);
			}
		} catch (MissingNodeException e) {
			return false;
		}

		return false;
	}
432817
def visit_expr(self, node, parent):
        """"""
        newnode = nodes.Expr(node.lineno, node.col_offset, parent)
        newnode.postinit(self.visit(node.value, newnode))
        return newnode
76894
def get_param(xmldoc, name):
	
	params = getParamsByName(xmldoc, name)
	if len(params) != 1:
		raise ValueError("document must contain exactly one %s param" % StripParamName(name))
	return params[0]
768100
def is_in(self, expr):
    """"""
    if expr == self:
      return True
    is_in_left = is_in_expr(self.left, expr)
    is_in_right = is_in_expr(self.right, expr)
    return is_in_left or is_in_right
447846
def fromxml(node):
        """"""
        if not isinstance(node,ElementTree._Element): #pylint: disable=protected-access
            node = parsexmlstring(node)
        assert node.tag.lower() == 'action'

        kwargs = {}
        args = []
        if 'id' in node.attrib:
            kwargs['id'] = node.attrib['id']
        elif 'name' in node.attrib:
            kwargs['name'] = node.attrib['name']
        elif 'description' in node.attrib:
            kwargs['description'] = node.attrib['description']
        elif 'method' in node.attrib:
            kwargs['method'] = node.attrib['method']
        elif 'mimetype' in node.attrib:
            kwargs['mimetype'] = node.attrib['mimetype']
        elif 'allowanonymous' in node.attrib:
            if node.attrib['allowanonymous'] == "yes":
                kwargs['allowanonymous'] = True

        found = False
        for subnode in node:
            if subnode.tag.lower() == 'parametercondition':
                kwargs[node.tag] = ParameterCondition.fromxml(subnode)
            elif subnode.tag in vars(clam.common.parameters):
                args.append(vars(clam.common.parameters)[subnode.tag].fromxml(subnode))
        if not found:
            raise Exception("No condition found in ParameterCondition!")
        return Action(*args, **kwargs)
1045309
function xpathDomEval(expr, node) {
    var expr1 = xpathParse(expr);
    return expr1.evaluate(new ExprContext(node));
}
919430
def has_param(param):
    
    def has_param_closure(element):
        """
        Look for `param` in `element`.
        """
        if element.params.get(param, "").strip():
            return True

        return False

    return has_param_closure
52661
def is_in_expr(expr, find):
  """"""
  return expr == find or (isinstance(expr, ExprNode) and expr.is_in(find))
664058
function isProbExpr (node) {
  return typeof(node) === 'object' && node.type === 'cond'
    && node.test.length === 1 && typeof(node.test[0]) === 'object' && node.test[0].type === 'function' && node.test[0].funcname === 'lt' && node.test[0].args.length === 2
    && typeof(node.test[0].args[0]) === 'object' && node.test[0].args[0].type === 'function' && node.test[0].args[0].funcname === 'random' && node.test[0].args[0].args.length === 1
    && typeof(node.test[0].args[0].args[0]) === 'string' && node.test[0].args[0].args[0] === '1'
}
1366258
public boolean isXmlDeclaration() {
        String data = getData();
        return (data.length() > 1 && (data.startsWith("!") || data.startsWith("?")));
    }
348177
public String getRawXPath(String xPathExpr, Object... params) {
        return getRawXPath(getResponse(), xPathExpr, params);
    }