Generate boolean operator checking function.
489676
def boolean_operator_query(boolean_operator):
    """"""
    def _boolean_operator_query(expressions):
        """Apply boolean operator to expressions."""
        def _apply_boolean_operator(query_function, expressions=expressions):
            """Return if expressions with boolean operator are satisfied."""
            compiled_expressions = [compile_query(e) for e in expressions]
            return reduce(
                boolean_operator,
                [e(query_function) for e in compiled_expressions]
            )

        return _apply_boolean_operator
    return _boolean_operator_query
665689
def __convert_bool(node):
    """"""
    converted = __convert_node(node, default_value='true')

    # Check for a switch for reversing the value
    reverse_switch = __get_attribute(node, 'ReverseSwitch')

    if reverse_switch:
        converted_reverse = copy.deepcopy(converted)

        converted_reverse['switch'] = reverse_switch
        converted_reverse['value'] = 'false'

        return [converted_reverse, converted]

    # Modify flags when there is an argument child
    __with_argument(node, converted)

    return __check_for_flag(converted)
223067
def less_strict_bool(x):
    """"""
    if x is None:
        return False
    elif x is True or x is False:
        return x
    else:
        return strict_bool(x)
1142623
def _check_bool(result, func, args):  # pylint: disable=unused-argument
    

    if not result:
        raise ctypes.WinError(ctypes.get_last_error())
    return args
1323121
def convert_boolean(value, parameter, default=False):
    '''
    
    '''
    value = _check_default(value, parameter, ( '', '-', None ))
    if isinstance(value, bool):
        return value
    if isinstance(value, str) and len(value) > 0:
        value = value[0]
    return value not in ( 'f', 'F', '0', False, None )
22894
def _convert_simple_value_boolean_query_to_and_boolean_queries(tree, keyword):
    """"""

    def _create_operator_node(value_node):
        """Creates a KeywordOp or a ValueOp node."""
        base_node = value_node.op if isinstance(value_node, NotOp) else value_node
        updated_base_node = KeywordOp(keyword, base_node) if keyword else ValueOp(base_node)

        return NotOp(updated_base_node) if isinstance(value_node, NotOp) else updated_base_node

    def _get_bool_op_type(bool_op):
        return AndOp if isinstance(bool_op, And) else OrOp

    new_tree_root = _get_bool_op_type(tree.bool_op)(None, None)
    current_tree = new_tree_root
    previous_tree = tree

    while True:  # Walk down the tree while building the new AndOp queries subtree.
        current_tree.left = _create_operator_node(previous_tree.left)

        if not isinstance(previous_tree.right, SimpleValueBooleanQuery):
            current_tree.right = _create_operator_node(previous_tree.right)
            break

        previous_tree = previous_tree.right
        current_tree.right = _get_bool_op_type(previous_tree.bool_op)(None, None)
        current_tree = current_tree.right

    return new_tree_root
500068
def isbool(*args):
    """"""
    true_or_false = [instructions.lookup(instructions.true_),
                     instructions.lookup(instructions.false_)]
    return all(map(lambda c: isinstance(c, bool) or c in true_or_false, args))
358471
def to_bool(value):
        """"""
        bool_value = False
        if str(value).lower() in ['1', 'true']:
            bool_value = True
        return bool_value
1207078
def bool_input(message):
    '''
    
    '''

    while True:
        suffix = ' (true or false): '
        inp = input(message + suffix)
        if inp.lower() == 'true':
            return True
        elif inp.lower() == 'false':
            return False
        else:
            print(colored('Must be either true or false, try again!', 'red'))
828781
def make_boolop(exprs, op_types):
    
    if len(op_types) > 1:
        return ast.BoolOp(
            op=op_types.popleft(),
            values=[exprs.popleft(), make_boolop(exprs, op_types)],
        )

    assert len(exprs) == 2
    return ast.BoolOp(op=op_types.popleft(), values=list(exprs))
1092439
function (input) {
    debug('booleanTextFilter(%s)', input);
    var retv = module.exports.booleanFilter(input);
    return (retv === undefined
      ? undefined
      : (retv === false
        ? 'false'
        : 'true'));
  }
371124
def validate_boolean_or_string(option, value):
    """"""
    if isinstance(value, string_type):
        if value not in ('true', 'false'):
            raise ValueError("The value of %s must be "
                             "'true' or 'false'" % (option,))
        return value == 'true'
    return validate_boolean(option, value)
990725
def convert_to_bool(x: Any, default: bool = None) -> bool:
    
    if isinstance(x, bool):
        return x

    if not x:  # None, zero, blank string...
        return default

    try:
        return int(x) != 0
    except (TypeError, ValueError):
        pass

    try:
        return float(x) != 0
    except (TypeError, ValueError):
        pass

    if not isinstance(x, str):
        raise Exception("Unknown thing being converted to bool: {!r}".format(x))

    x = x.upper()
    if x in ["Y", "YES", "T", "TRUE"]:
        return True
    if x in ["N", "NO", "F", "FALSE"]:
        return False

    raise Exception("Unknown thing being converted to bool: {!r}".format(x))
1228808
static public BooleanExpression NOT(BooleanExpression operand){
		BooleanExpression result = new BooleanExpression(OPERATOR_NOT);
		result.addOperand(operand);
		return result;
	}
135449
def as_bool(s):
    
    if s in (False, True): return s
    # Assume string
    s = s.lower()
    if s in ("yes", "true"):
        return True
    elif s in ("no", "false"):
        return False
    else:
        raise ValueError("Don't know how to convert type %s: %s into a boolean" % (type(s), s))
1099722
def generate_checker(value):
    """"""
    @property
    @wraps(can_be_)
    def checker(self):
        return self.can_be_(value)

    return checker
1365257
def to_bool(x):
    """""""
    if isinstance(x, bool):
        return x
    elif isinstance(x, str):
        return False if x.lower() in _FALSES else True
    else:
        return bool(x)