Function to calculate the current "predicate" in the current context.

    Returns a tuple of information: (predicate, pred_set).
    The value pred_set is a set([ (predicate, bool), ... ]) as described in
    the _reset_conditional_state
195329
def _current_select():
    

    # helper to create the conjuction of predicates
    def and_with_possible_none(a, b):
        assert(a is not None or b is not None)
        if a is None:
            return b
        if b is None:
            return a
        return a & b

    def between_otherwise_and_current(predlist):
        lastother = None
        for i, p in enumerate(predlist[:-1]):
            if p is otherwise:
                lastother = i
        if lastother is None:
            return predlist[:-1]
        else:
            return predlist[lastother+1:-1]

    select = None
    pred_set = set()

    # for all conditions except the current children (which should be [])
    for predlist in _conditions_list_stack[:-1]:
        # negate all of the predicates between "otherwise" and the current one
        for predicate in between_otherwise_and_current(predlist):
            select = and_with_possible_none(select, ~predicate)
            pred_set.add((predicate, True))
        # include the predicate for the current one (not negated)
        if predlist[-1] is not otherwise:
            predicate = predlist[-1]
            select = and_with_possible_none(select, predicate)
            pred_set.add((predicate, False))

    if select is None:
        raise PyrtlError('problem with conditional assignment')
    if len(select) != 1:
        raise PyrtlInternalError('conditional predicate with length greater than 1')

    return select, pred_set
1293257
function AndOrPredicate(op, preds) {
      this.op = this._resolveOp(op);
      if (preds.length == 1 && Array.isArray(preds[0])) {
        preds = preds[0];
      }
      this.preds = preds.filter(function (pred) {
        return pred != null;
      }).map(function (pred) {
        return Predicate(pred);
      });
      if (this.preds.length == 0) {
        // marker for an empty predicate
        this.op = null;
      }
      if (this.preds.length == 1) {
        return this.preds[0];
      }
    }
540313
def <<(statement)
      # ActiveTriples::Resource expects: RDF::Statement, Hash, or Array
      statement = RDF::Statement.from(statement) unless statement.is_a? RDF::Statement

      # Only push statement if the statement's predicate is defined on the class
      field_name = field_from_predicate(statement.predicate)
      return unless field_name

      objects = statement.object.is_a?(RDF::Node) && block_given? ? yield : statement.object

      update_field(field_name, *objects) if fields[field_name]
      update_relation(field_name, *objects) if relations[field_name]
    end
188329
def p_if_statement_2(self, p):
        """"""
        p[0] = self.asttypes.If(
            predicate=p[3], consequent=p[5], alternative=p[7])
        p[0].setpos(p)
384896
def current_set(self):
        
        assert self.model.KEY_FIELDS != (), "Just use model.current() if there are no KEY_FIELDS"
        return self.get_queryset().filter(
            pk__in=self._current_ids_subquery()
        ).annotate(
            is_active=models.Value(1, output_field=models.IntegerField())
        )
660348
def visitPredicate(self, ctx: ShExDocParser.PredicateContext):
        
        self.expression.predicate = self.context.predicate_to_IRI(ctx)
995300
private Set<Predicate> copyPredicatesSet() {
    Set<Predicate> predicatesCopy = Sets.newLinkedHashSet();
    for (Predicate predicate : this.predicates) {
      Predicate copyPredicate = new Predicate();
      copyPredicate.setField(predicate.getField());
      copyPredicate.setOperator(predicate.getOperator());
      copyPredicate.setValues(Arrays.copyOf(predicate.getValues(), predicate.getValues().length));
      predicatesCopy.add(copyPredicate);
    }
    return predicatesCopy;
  }
997767
def _DoPredicates(args, context, callback, trace):
    
    block = args
    value = context.Lookup('@')
    for (predicate, args, func_type), statements in block.clauses:
        if func_type == ENHANCED_FUNC:
            do_clause = predicate(value, context, args)
        else:
            do_clause = predicate(value)
        
        if do_clause:
            if trace: trace.Push(predicate)
            _Execute(statements, context, callback, trace)
            if trace: trace.Pop()
            break
1215863
def predicates(predicate, collection, klass, column_name, value)
      case predicate
      when :between
        klass.arel_table[column_name].between(value.first..value.last)
      when :does_not_match
        klass.arel_table[column_name].does_not_match("%#{value}%")
      when :does_not_match_all
        klass.arel_table[column_name].does_not_match_all(value)
      when :does_not_match_any
        klass.arel_table[column_name].does_not_match_any(value)
      when :eq
        klass.arel_table[column_name].eq(value)
      when :eq_all
        klass.arel_table[column_name].eq_all(value)
      when :eq_any
        klass.arel_table[column_name].eq_any(value)
      when :gt
        klass.arel_table[column_name].gt(value)
      when :gt_all
        klass.arel_table[column_name].gt_all(value)
      when :gt_any
        klass.arel_table[column_name].gt_any(value)
      when :gteq
        klass.arel_table[column_name].gteq(value)
      when :gteq_all
        klass.arel_table[column_name].gteq_all(value)
      when :gteq_any
        klass.arel_table[column_name].gteq_any(value)
      when :in
        klass.arel_table[column_name].in(value)
      when :in_all
        klass.arel_table[column_name].in_all(value)
      when :in_any
        klass.arel_table[column_name].in_any(value)
      when :lt
        klass.arel_table[column_name].lt(value)
      when :lt_all
        klass.arel_table[column_name].lt_all(value)
      when :lt_any
        klass.arel_table[column_name].lt_any(value)
      when :lteq
        klass.arel_table[column_name].lteq(value)
      when :lteq_all
        klass.arel_table[column_name].lteq_all(value)
      when :lteq_any
        klass.arel_table[column_name].lteq_any(value)
      when :ilike
        klass.arel_table[column_name].matches("%#{value}%")
      when :matches
        klass.arel_table[column_name].matches(value)
      when :matches_all
        klass.arel_table[column_name].matches_all(value)
      when :matches_any
        klass.arel_table[column_name].matches_any(value)
      when :not_between
        klass.arel_table[column_name].not_between(value.first..value.last)
      when :not_eq
        klass.arel_table[column_name].not_eq(value)
      when :not_eq_all
        klass.arel_table[column_name].not_eq_all(value)
      when :not_eq_any
        klass.arel_table[column_name].not_eq_any(value)
      when :not_in
        klass.arel_table[column_name].not_in(value)
      when :not_in_all
        klass.arel_table[column_name].not_in_all(value)
      when :not_in_any
        klass.arel_table[column_name].not_in_any(value)
      else
        unless predicate.respond_to?(:call)
          raise ArgumentError,
                "unsupported predicate `#{predicate}`"
        end

        predicate.call(collection, value)
      end
    end
1299782
def state(self):
        
        self._state, value = self.get_attr_set(self._state, 'state')
        return value
379853
async def prev(self, count=None):
        
        if self._prev_uri is None:
            return self[:0]  # An empty slice of `self`.
        else:
            return self._fetch(self._prev_uri, count)
888064
function find (c, predicate) {
        for (var i = 0; i < c.length; i++) {
            if (predicate(c[i]))
                return c[i];
        }
        return null;
    }
1127865
def currentValue(self):
        
        enum  = self.enum()
        if ( self.isCheckable() ):
            value = 0
            for i in self.checkedIndexes():
                value |= enum[nativestring(self.itemText(i))]
            return value
        else:
            try:
                return enum[nativestring(self.itemText(self.currentIndex()))]
            except KeyError:
                return 0
349431
def p_conditional_expr(self, p):
        
        if len(p) == 2:
            p[0] = p[1]
        else:
            p[0] = ast.Conditional(
                predicate=p[1], consequent=p[3], alternative=p[5])
717932
def _process_filter_block(query_metadata_table, block):
    """"""
    # For a given Filter block with BinaryComposition predicate expression X,
    # let L be the set of all Locations referenced in any TernaryConditional
    # predicate expression enclosed in X.
    # For each location l in L, we construct a tautological expression that looks like:
    #     ((l IS NULL) OR (l IS NOT NULL))
    # and then join the original BinaryComposition X with all such expressions with ANDs.
    # We set this new BinaryComposition expression as the predicate of the Filter block.
    base_predicate = block.predicate

    # These variables are used by the visitor functions below.
    ternary_conditionals = []
    # "problematic_locations" is a list and not a set,
    # to preserve ordering and generate a deterministic order of added clauses.
    # We expect the maximum size of this list to be a small constant number,
    # so the linear "in" operator is really not a concern.
    problematic_locations = []

    def find_ternary_conditionals(expression):
        """Visitor function that extracts all enclosed TernaryConditional expressions."""
        if isinstance(expression, TernaryConditional):
            ternary_conditionals.append(expression)
        return expression

    def extract_locations_visitor(expression):
        """Visitor function that extracts all the problematic locations."""
        if isinstance(expression, (ContextField, ContextFieldExistence)):
            # We get the location at the vertex, ignoring property fields.
            # The vertex-level location is sufficient to work around the OrientDB bug,
            # and we want as few location as possible overall.
            location_at_vertex = expression.location.at_vertex()
            if location_at_vertex not in problematic_locations:
                problematic_locations.append(location_at_vertex)

        return expression

    # We aren't modifying the base predicate itself, just traversing it.
    # The returned "updated" value must be the exact same as the original.
    return_value = base_predicate.visit_and_update(find_ternary_conditionals)
    if return_value is not base_predicate:
        raise AssertionError(u'Read-only visitor function "find_ternary_conditionals" '
                             u'caused state to change: '
                             u'{} {}'.format(base_predicate, return_value))

    for ternary in ternary_conditionals:
        # We aren't modifying the ternary itself, just traversing it.
        # The returned "updated" value must be the exact same as the original.
        return_value = ternary.visit_and_update(extract_locations_visitor)
        if return_value is not ternary:
            raise AssertionError(u'Read-only visitor function "extract_locations_visitor" '
                                 u'caused state to change: '
                                 u'{} {}'.format(ternary, return_value))

    tautologies = [
        _create_tautological_expression_for_location(query_metadata_table, location)
        for location in problematic_locations
    ]

    if not tautologies:
        return block

    final_predicate = base_predicate
    for tautology in tautologies:
        final_predicate = BinaryComposition(u'&&', final_predicate, tautology)
    return Filter(final_predicate)
1191326
def precondition(self):
        """"""
        return self.tlang.nplurals == self.slang.nplurals and \
                super(PrintfValidator, self).precondition()
143967
function baseStatePredicate(state, full) {
    if (full) {
        return this.extract(state);
    }

    // Cache a state predicate function
    const fn = getPredicateFunction(state);

    return this.flatten(node => {
        // Never include removed nodes unless specifically requested
        if (state !== 'removed' && node.removed()) {
            return false;
        }

        return fn(node);
    });
}