Generator function returning a callable for maximum value validation.
328448
def generate_maximum_validator(maximum, exclusiveMaximum=False, **kwargs):
    
    return functools.partial(validate_maximum, maximum=maximum, is_exclusive=exclusiveMaximum)
420864
def max(self):
        """"""
        if "max" not in self.attrs.keys():

            def f(dataset, s):
                return np.nanmax(dataset[s])

            self.attrs["max"] = np.nanmax(list(self.chunkwise(f).values()))
        return self.attrs["max"]
216525
def _generic_callable(group_idx, a, size, fill_value, dtype=None,
                      func=lambda g: g, **kwargs):
    """"""
    groups = _array(group_idx, a, size, ())
    ret = np.full(size, fill_value, dtype=dtype or np.float64)

    for i, grp in enumerate(groups):
        if np.ndim(grp) == 1 and len(grp) > 0:
            ret[i] = func(grp)
    return ret
1341595
def one_of(*generators):
    

    class OneOfGenerators(ArbitraryInterface):
        """
        A closure class around the generators specified above, which
        generates one of the generators.
        """

        @classmethod
        def arbitrary(cls):
            """
            Generate one of the enclosed generators.
            """
            return arbitrary(random.choice(generators))

    OneOfGenerators.__name__ = ''.join([
        'one_of(', ', '.join(generator.__name__ for generator in generators),
        ')'
    ])
    return OneOfGenerators
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
758226
def generate_minimum_validator(minimum, exclusiveMinimum=False, **kwargs):
    
    return functools.partial(validate_minimum, minimum=minimum, is_exclusive=exclusiveMinimum)
488400
function generator(seed) {
    // Note: the generator didn't work with negative seed values, so here we
    // transform our original seed into a new (positive) seed value with which we
    // create a new generator.
    if (seed < 0) {
        var gen = generator(Math.abs(seed));
        for (var i = 0; i < 23; i += 1) {
            gen();
        }
        return generator(gen(0, 10000));
    }

    // Based on random number generator from
    // http://indiegamr.com/generate-repeatable-random-numbers-in-js/
    return function (min, max) {
        min = min || 0;
        max = max || 1;
        seed = (seed * 9301 + 49297) % 233280;
        var v = seed / 233280;
        return min + v * (max - min);
    };
}
650219
def max_len(iterable, minimum=0):
    
    try:
        result = max(map(len, iterable))
    except ValueError:
        result = minimum
    return minimum if result < minimum else result
681629
def validate_max_items(value, maximum, **kwargs):
    
    if len(value) > maximum:
        raise ValidationError(
            MESSAGES['max_items']['invalid'].format(
                maximum, len(value),
            ),
        )
39861
private static function apply(/* iterable */ $previous, callable $func): \Generator
    {
        foreach ($previous as $value) {
            $result = $func($value);
            if ($result instanceof \Generator) {
                yield from $result;
            } else {
                // Case of a plain old mapping function
                yield $result;
            }
        }
    }
622920
def visit_GeneratorExp(self, node: AST, dfltChaining: bool = True) -> str:
        """"""
        return f"({self.visit(node.elt)} " \
               f"{' '.join(self.visit(gen) for gen in node.generators)})"
1360080
def genfirstvalues(cursor: Cursor, arraysize: int = 1000) \
        -> Generator[Any, None, None]:
    
    return (row[0] for row in genrows(cursor, arraysize))
619579
function generatorToPromise(fn) {
    if (typeof fn !== 'function') {
        throw Error('fn is not a function');
    }
    if (!isGenerator(fn)) {
        // assume it's Promise-based
        return fn;
    }
    return co.wrap(fn);
}
970334
def _ha_gen_method(func):
        '''  '''
        def wrapped(self, *args, **kw):
            self._reset_retries()
            while(True): # switch between all namenodes
                try:
                    results = func(self, *args, **kw)
                    while(True): # yield all results
                        yield results.next()
                except RequestError as e:
                    self.__handle_request_error(e)
                except socket.error as e:
                    self.__handle_socket_error(e)
        return wrapped
58643
def _validate_max(self, proposal):
        """"""
        max = proposal['value']
        if max < self.min:
            raise TraitError('setting max < min')
        if max < self.value:
            self.value = max
        return max
95770
public static <T, V extends Comparable<? super V>> T maxBy(Iterable<T> iterable, Function<? super T, ? extends V> function)
    {
        if (iterable instanceof RichIterable)
        {
            return ((RichIterable<T>) iterable).maxBy(function);
        }
        if (iterable instanceof RandomAccess)
        {
            return RandomAccessListIterate.maxBy((List<T>) iterable, function);
        }
        if (iterable != null)
        {
            return IterableIterate.maxBy(iterable, function);
        }
        throw new IllegalArgumentException("Cannot perform a maxBy on null");
    }
340400
def validate_maximum(value, maximum, is_exclusive, **kwargs):
    
    if is_exclusive:
        comparison_text = "less than"
        compare_fn = operator.lt
    else:
        comparison_text = "less than or equal to"
        compare_fn = operator.le

    if not compare_fn(value, maximum):
        raise ValidationError(
            MESSAGES['maximum']['invalid'].format(value, comparison_text, maximum),
        )