anycall/bytequeue.py
def peek(self, n):
        """
        Return the first `n` characters from the queue without
        removing them.
        Throws an error if there are less than `n` characters in the queue.
        
        Equivalent to::
        
            s = queue[:n]
            
        if `queue` where a regular string.
        """
        if self._len < n:
            raise ValueError("Not enough bytes in the queue")
        
        def part_generator(n):
            """
            Returns the requested bytes in parts
            """
            
            remaining = n
            
            for part in self._parts:
                if len(part) <= remaining:
                    yield part
                    remaining -= len(part)
                else:
                    yield part[:remaining]
                    remaining = 0 
                if remaining == 0:
                    break
                    
        return "".join(part_generator(n))
def peek(self, n):
        """
        Return the first `n` characters from the queue without
        removing them.
        Throws an error if there are less than `n` characters in the queue.
        
        Equivalent to::
        
            s = queue[:n]
            
        if `queue` where a regular string.
        """
        if self._len < n:
            raise ValueError("Not enough bytes in the queue")
        
        def part_generator(n):
            """
            Returns the requested bytes in parts
            """
            
            remaining = n
            
            for part in self._parts:
                if len(part) <= remaining:
                    yield part
                    remaining -= len(part)
                else:
                    yield part[:remaining]
                    remaining = 0 
                if remaining == 0:
                    break
                    
        return "".join(part_generator(n))
def peek ( self , n ) : if self . _len < n : raise ValueError ( "Not enough bytes in the queue" ) def part_generator ( n ) : """
            Returns the requested bytes in parts
            """ remaining = n for part in self . _parts : if len ( part ) <= remaining : yield part remaining -= len ( part ) else : yield part [ : remaining ] remaining = 0 if remaining == 0 : break return "" . join ( part_generator ( n ) )
Return the first `n` characters from the queue without
        removing them.
        Throws an error if there are less than `n` characters in the queue.
        
        Equivalent to::
        
            s = queue[:n]
            
        if `queue` where a regular string.
Return the first n characters from the queue without removing them . Throws an error if there are less than n characters in the queue . Equivalent to :: s = queue [ : n ] if queue where a regular string .