File: //usr/lib/python3.6/site-packages/pymysql/__pycache__/_socketio.cpython-36.pyc
3
B��Z� � @ sJ d Z ddlT ddlZddlZdgZejZejejfZG dd� dej �Z
dS )z}
SocketIO imported from socket module in Python 3.
Copyright (c) 2001-2013 Python Software Foundation; All Rights Reserved.
� )�*N�SocketIOc sp e Zd ZdZdd� Zdd� Zdd� Zdd � Zd
d� Z� fdd
�Z dd� Z
edd� �Zedd� �Z
dd� Z� ZS )r z�Raw I/O implementation for stream sockets.
This class supports the makefile() method on sockets. It provides
the raw I/O interface on top of a socket object.
c C sZ |d
krt d| ��tjj| � || _d|kr6|d7 }|| _d|k| _d|k| _d | _d S )N�r�w�rw�rb�wb�rwbzinvalid mode: %r�bF)r r r r r r ) �
ValueError�io� RawIOBase�__init__�_sock�_mode�_reading�_writing�_timeout_occurred)�selfZsock�mode� r �/usr/lib/python3.6/_socketio.pyr ! s
zSocketIO.__init__c C s� | j � | j� | jrtd��xpy| jj|�S tk
rH d| _� Y q tk
r� } z(|jd }|t krlw |t
krxdS � W Y dd}~X q X q W dS )a3 Read up to len(b) bytes into the writable buffer *b* and return
the number of bytes read. If the socket is non-blocking and no bytes
are available, None is returned.
If *b* is non-empty, a 0 return value indicates that the connection
was shutdown at the other end.
z!cannot read from timed out objectTr N)�_checkClosed�_checkReadabler �IOErrorr Z recv_intoZtimeout�error�args�EINTR�_blocking_errnos)r r
�e�nr r r �readinto- s"