Evaluate the condition, returning if matches (true) or no (false)
437286
public function condition_matches() {
        $match = false; // By default no match
        $param = $this->procconditionparam;
        if ($param instanceof base_atom && $param->is_set()) {
            $match = ($param->get_value() == $this->conditionvalue); // blame $DB for not having === !
        } else {
            $match = ($param == $this->conditionvalue);
        }
        return $match;
    }
312553
def _parse_boolean(value, default=False):
    
    if value is None:
        return default
    try:
        return bool(value)
    except ValueError:
        return default
359090
def visit_Boolean(self, node):
        """"""
        if node.value == 'true':
            return Bool(True)
        elif node.value == 'false':
            return Bool(False)
1118999
def evaluate(self, parameters):
        """"""
        if self.match(parameters):
            if isinstance(self.then, ParameterCondition):
                #recursive parametercondition
                return self.then.evaluate(parameters)
            else:
                return self.then
        elif self.otherwise:
            if isinstance(self.otherwise, ParameterCondition):
                #recursive else
                return self.otherwise.evaluate(parameters)
            else:
                return self.otherwise
        return False
1353105
def eval_bool(self, expr):
        
        result = expr.eval(self)
        iterator = iter(result)
        try:
            next(iterator)
        except StopIteration:
            return False
        else:
            return True
        finally:
            if hasattr(iterator, "close"):
                iterator.close()
768206
def _check_valid_condition(self, get_params):
        
        try:
            variable = get_params(self.variable)
        except:  # noqa e722
            variable = None
        value = self.value

        # if None, return oppositely
        if variable is None:
            return not self.default

        # convert the value to a correct type
        if isinstance(variable, bool):
            value = bool(self.value)
        elif isinstance(variable, Number):
            try:
                value = int(self.value)
            except:  # noqa e722
                try:
                    value = float(self.value)
                except:  # noqa e722
                    # could not parse
                    return not self.default

        # compare and return the result
        if self.condition == "=":
            return (variable == value) == self.default
        elif self.condition == ">":
            return (variable > value) == self.default
        elif self.condition == "<":
            return (variable < value) == self.default
275464
def eval_condition(self, event):
        
        condition = self.get_condition()
        if condition is True:   # shortcut for unconditional breakpoints
            return True
        if callable(condition):
            try:
                return bool( condition(event) )
            except Exception:
                e = sys.exc_info()[1]
                msg = ("Breakpoint condition callback %r"
                       " raised an exception: %s")
                msg = msg % (condition, traceback.format_exc(e))
                warnings.warn(msg, BreakpointCallbackWarning)
                return False
        return bool( condition )
1099951
def __one_equals_true(value):
        '''
        
        '''
        if isinstance(value, six.integer_types) and value == 1:
            return True
        elif (isinstance(value, six.string_types) and
              re.match(r'\d+', value, flags=re.IGNORECASE + re.UNICODE) is not None and
              six.text_type(value) == '1'):
            return True
        return False
1140357
def __evaluation_error(self, result, condition, throw):
        """"""
        self.log.error("Result does not match condition, dropping item. "
                       "Result %s; Condition: %s; Throw: %s",
                       result, condition, throw)
        return False
1371248
def istrue(self, *args):
        
        def is_true(val):
            if val is True:
                return True
            val = str(val).lower().strip()
            return val in ('true', 'yes', '1')
        return all(self._arg_factory(is_true, args))
133335
def condition2checker(condition):
    """"""
    if isinstance(condition, string_types):
        def smatcher(info):
            return fnmatch.fnmatch(info.filename, condition)

        return smatcher
    elif isinstance(condition, (list, tuple)) and isinstance(condition[0],
                                                             integer_types):
        def imatcher(info):
            return info.index in condition

        return imatcher
    elif callable(condition):
        return condition
    else:
        raise TypeError
800815
def evaluate_code(self, code):
        

        if not code:
            return False

        LOGGER.debug("> Evaluating given code.")

        code = code.endswith("\n") and code or "{0}\n".format(code)

        code = code.split("\n", 3)
        for i, line in enumerate(code[:-2]):
            if "coding" in line:
                code[i] = line.replace("=", "\=").replace(":", "\:")
                break
        code = "\n".join(code)

        sys.stdout.write(code)
        self.__console.runcode(code)
        return True
120486
def evaluate(self, data, env):
        
        bool_idx = self.predicate_expr.evaluate(data, env)
        true_value = self.true_value_expr.evaluate(data, env)
        false_value = self.false_value_expr.evaluate(data, env)
        true_idx = np.where(bool_idx)[0]
        false_idx = np.where(~bool_idx)[0]
        result = np.repeat(None, len(data))
        result[true_idx] = self.nice_value(true_value, true_idx)
        result[false_idx] = self.nice_value(false_value, false_idx)
        return np.array(list(result))
493738
def evaluate(actual)
      warn "any is deprecated; please use asserts.empty or denies.empty instead"
      any?(actual) ? pass("has items") : fail(expected_message(actual).to_have_items)
    end
602628
def p_If(p):
    '''
    
    '''
    if len(p) == 2:
        p[0] = If(p[1], None, None)
    else:
        p[0] = If(p[1], p[5], p[4])
100873
def boolean(flag):
    
    s = flag.lower()
    if s in ('1', 'yes', 'true'):
        return True
    elif s in ('0', 'no', 'false'):
        return False
    raise ValueError('Unknown flag %r' % s)
34548
protected function evaluate ()
  {
    $prop = $this->props;
    $np   = Parser::NAMELESS_PROP;
    $v    = isset ($prop->$np) ? $prop->$np : $prop->get ('value');
    $not  = $prop->not;

    if (exists ($prop->matches))
      return (bool)preg_match ("%$prop->matches%", $v) xor $not;

    if ($prop->case) {
      foreach ($prop->case as $param) {
        if ($v == $param->props->get ('is')) // Note that we use the loose comparison operator == here.
          return true;
      }
      return false;
    }

    return strToBool ($v) xor $not;
  }