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

All Samples(4)  |  Call(4)  |  Derive(0)  |  Import(0)
Ensures that generator has min amount of items left.

    >>> def yrange(n): # Note that xrange doesn't work, requires next()
    ...     for i in range(n):
    ...         yield i
    ... 
    >>> genmin(yrange(5), min=4) #doctest: +ELLIPSIS
    <generator object join_iterators at ...>
    >>> genmin(yrange(5), min=5) #doctest: +ELLIPSIS
    <generator object join_iterators at ...>(more...)

        def genmin(generator, min):
    """Ensures that generator has min amount of items left.
    
        >>> def yrange(n): # Note that xrange doesn't work, requires next()
        ...     for i in range(n):
        ...         yield i
        ... 
        >>> genmin(yrange(5), min=4) #doctest: +ELLIPSIS
        
        >>> genmin(yrange(5), min=5) #doctest: +ELLIPSIS
        
        >>> genmin(yrange(5), min=6)
        Traceback (most recent call last):
          ...
        ValueError: Minimum amount not met.
        >>> 
        
    :param generator: Generator to be ensured.
    :type generator: generator
    
    :param min: Minimum amount of items in generator.
    :type min: int
    
    :raise ValueError: Raised when minimum is not met.

    """
    cache = []
    for index in range(min): #@UnusedVariable
        try:
            cache.append(generator.next())
        except StopIteration:
            raise ValueError('Minimum amount not met.')

    return join_iterators(cache, generator)
        


src/m/p/mpeg1audio-0.5.2/src/mpeg1audio/__init__.py   mpeg1audio(Download)
 
        try:
            return utils.genmin(MPEGAudioFrame.find_and_parse(file=self._file,
                                            max_frames=3,
                                            chunk_size=16384,
        try:
            return utils.genmin(\
                     MPEGAudioFrame.find_and_parse(file=self._file,
                                              max_frames=max_frames,
                                              begin_frame_search=begin_offset),

src/m/p/mpeg1audio-HEAD/src/mpeg1audio/__init__.py   mpeg1audio(Download)
 
        try:
            return utils.genmin(MPEGAudioFrame.find_and_parse(file=self._file,
                                            max_frames=3,
                                            chunk_size=16384,
        try:
            return utils.genmin(\
                     MPEGAudioFrame.find_and_parse(file=self._file,
                                              max_frames=max_frames,
                                              begin_frame_search=begin_offset),