Helper to validate a candidate print maximum
770383
function validatePrintMax(candidate, lowerBound, label) {
  if (typeof candidate !== 'number' || Number.isNaN(candidate)) {
    throw new Error('"' + label + '" must be a number');
  } else if (candidate < lowerBound) {
    throw new Error('"' + label + '" too small');
  }
}
507196
function ruleMax($max, $error_message = null) {
        if (!is_numeric($max)) {
            throw new \Exception('Incorrect parameter MAX in rule max');
        }

        return $this->_rule('max:' . $max, $error_message);
    }
1255117
function intValidatorWithErrors( n, min, max, caller, name ) {
            if ( n < min || n > max || n != truncate(n) ) {
                raise( caller, ( name || 'decimal places' ) +
                  ( n < min || n > max ? ' out of range' : ' not an integer' ), n );
            }

            return true;
        }
556659
def print_(rows, limit=15, sort='size', order='descending'):
    
    localrows = []
    for row in rows:
        localrows.append(list(row))
    # input validation
    sortby = ['type', '#', 'size']
    if sort not in sortby:
        raise ValueError("invalid sort, should be one of" + str(sortby))
    orders = ['ascending', 'descending']
    if order not in orders:
        raise ValueError("invalid order, should be one of" + str(orders))
    # sort rows
    if sortby.index(sort) == 0:
        if order == "ascending":
            localrows.sort(key=lambda x: _repr(x[0]))
        elif order == "descending":
            localrows.sort(key=lambda x: _repr(x[0]), reverse=True)
    else:
        if order == "ascending":
            localrows.sort(key=lambda x: x[sortby.index(sort)])
        elif order == "descending":
            localrows.sort(key=lambda x: x[sortby.index(sort)], reverse=True)
    # limit rows
    localrows = localrows[0:limit]
    for row in localrows:
        row[2] = stringutils.pp(row[2])
    # print rows
    localrows.insert(0,["types", "# objects", "total size"])
    _print_table(localrows)
88160
def _maxlength(X):
    
    return np.fromiter((map(lambda x: len(x), X)), dtype=int).max()
1306518
def validate_candidate(candidate, freq_set, k):
    
    for subcand in combinations(candidate, k-1):
        if subcand not in freq_set:
            return False
    return True
892619
def validate(self, value: int):
        '''  '''
        if not isinstance(value, int):
            raise ValueError('value is not an integer')

        if self.minimum > value or self.maximum < value:
            msg = (
                '{} is outside the valide range [{},{}]'
            ).format(value, self.minimum, self.maximum)
            raise ValueError(msg)
597329
def validate(self, value):
        
        try:
            length = len(value)
        except TypeError:
            length = 0

        if self.min_length is not None:
            min_length = self.min_length() if callable(self.min_length) else self.min_length
            if length < min_length:
                raise exceptions.ValidationError(self.min_err.format(min_length))

        if self.max_length is not None:
            max_length = self.max_length() if callable(self.max_length) else self.max_length
            if length > max_length:
                raise exceptions.ValidationError(self.max_err.format(max_length))
697609
def validate_minimum(value, minimum, is_exclusive, **kwargs):
    
    if is_exclusive:
        comparison_text = "greater than"
        compare_fn = operator.gt
    else:
        comparison_text = "greater than or equal to"
        compare_fn = operator.ge

    if not compare_fn(value, minimum):
        raise ValidationError(
            MESSAGES['minimum']['invalid'].format(value, comparison_text, minimum),
        )
1300971
def _prnt_min_max_val(var, text, verb):
    """
    if var.size > 3:
        print(text, _strvar(var.min()), "-", _strvar(var.max()),
              ":", _strvar(var.size), " [min-max; #]")
        if verb > 3:
            print("                   : ", _strvar(var))
    else:
        print(text, _strvar(np.atleast_1d(var)))
1157788
def candidate_limit(uuid)
      [
        friendly_id_config.slug_limit - uuid.size - friendly_id_config.sequence_separator.size,
        0
      ].max
    end
248763
def max(self, axis=None, skipna=True):
        """"""
        nv.validate_minmax_axis(axis)
        return self._minmax('max')
586460
def _max(ctx, *number):
    
    if len(number) == 0:
        raise ValueError("Wrong number of arguments")

    result = conversions.to_decimal(number[0], ctx)
    for arg in number[1:]:
        arg = conversions.to_decimal(arg, ctx)
        if arg > result:
            result = arg
    return result
1056241
def validate(self, value):
        """"""
        if self.type is not None:
            value = coerce(self.type, value)

        if self.min is not None and value < self.min:
            raise ValueError('%s=%s is less than %s' % (self.name, value,
                                                        self.min))
        if self.max is not None and value > self.max:
            raise ValueError('%s=%s is greater than %s' % (
                self.name, value, self.max))
        if self.allowed is not None and value not in self.allowed:
            raise ValueError('%s=%s is not one of the allowed values: %s' % (
                self.name, value, ','.join(map(str, self.allowed))))

        return value
35633
def _maybe_print(something_to_print, end=None, min_=1, max_=99, verbose=0):
    """"""
    if min_ <= verbose <= max_:
        import sys
        print(something_to_print, end=end)
        sys.stdout.flush()
1174247
def dbg_repr(self, max_display=10):
        

        s = repr(self) + "\n"

        if len(self.chosen_statements) > max_display:
            s += "%d SimRuns in program slice, displaying %d.\n" % (len(self.chosen_statements), max_display)
        else:
            s += "%d SimRuns in program slice.\n" % len(self.chosen_statements)

        # Pretty-print the first `max_display` basic blocks
        if max_display is None:
            # Output all
            run_addrs = sorted(self.chosen_statements.keys())

        else:
            # Only output the first "max_display" ones
            run_addrs = sorted(self.chosen_statements.keys())[ : max_display]

        for run_addr in run_addrs:
            s += self.dbg_repr_run(run_addr) + "\n"

        return s
650219
def max_len(iterable, minimum=0):
    
    try:
        result = max(map(len, iterable))
    except ValueError:
        result = minimum
    return minimum if result < minimum else result