Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(2)  |  Call(2)  |  Derive(0)  |  Import(0)
Limit generator *item count* between min and max.

:param generator: Generator
:type generator: generator

:param min: Minimum amount of items in generator.
:type min: int, or None

:param max: Maximum amount of items.
:type max: int, or None(more...)

        def genlimit(generator, min, max):
    """Limit generator *item count* between min and max.
    
    :param generator: Generator
    :type generator: generator

    :param min: Minimum amount of items in generator.
    :type min: int, or None
    
    :param max: Maximum amount of items.
    :type max: int, or None
    
    :note: If both are ``None`` this returns the same generator.
    :raise ValueError: Raised when minimum is not met.
    
    """
    if (min is None) and (max is None):
        return generator

    if min is not None:
        generator = genmin(generator, min)

    if max is not None:
        generator = genmax(generator, max)

    return generator
        


src/m/p/mpeg1audio-0.5.2/src/mpeg1audio/__init__.py   mpeg1audio(Download)
                                                     consecutive_chunks)
                try:
                    return utils.genlimit(frames, lazily_after + 1, max_frames)
                except ValueError:
                    pass

src/m/p/mpeg1audio-HEAD/src/mpeg1audio/__init__.py   mpeg1audio(Download)
                                                     consecutive_chunks)
                try:
                    return utils.genlimit(frames, lazily_after + 1, max_frames)
                except ValueError:
                    pass