B
    ÀÔx[‰  ã               @   s   d Z G dd„ deƒZdS )z7
A buffer for the input stream from sockets. Iterable.
c               @   s@   e Zd ZdZdd„ Zdd„ Zdd„ Zdd	„ Zd
d„ Zdd„ Z	dS )ÚBufferzE
    Represents an iterable buffer that returns completed lines.
    c             C   s
   d| _ d S )NÚ )Úbuffer)Úself© r   ú%/home/sam/code/Infobot/core/buffer.pyÚ__init__
   s    zBuffer.__init__c             C   s   | S )Nr   )r   r   r   r   Ú__iter__   s    zBuffer.__iter__c             C   s4   d| j krt‚n t| j  dd¡ƒ\}| _ | ¡ S d S )NÚ
é   )r   ÚStopIterationÚtupleÚsplitÚrstrip)r   Údatar   r   r   Ú__next__   s    
zBuffer.__next__c             C   s   |   ¡ S )z Next in Py3K )r   )r   r   r   r   Únext   s    zBuffer.nextc             C   s   |  j |7  _ |S )z Append data to the buffer )r   )r   r   r   r   r   Úappend   s    zBuffer.appendc             C   s   t | jƒ dS )z Make pylint shut up N)Úprintr   )r   r   r   r   Ú
get_buffer#   s    zBuffer.get_bufferN)
Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r   r   r   r   r   r   r   r   r   r      s   
r   N)r   Úobjectr   r   r   r   r   Ú<module>   s   