Current File : //proc/self/root/kunden/lib/python3.9/site-packages/pymysql/__pycache__/_socketio.cpython-39.pyc
a

B��Z��@sJdZddlTddlZddlZdgZejZejejfZGdd�dej	�Z
dS)z}
SocketIO imported from socket module in Python 3.

Copyright (c) 2001-2013 Python Software Foundation; All Rights Reserved.
�)�*N�SocketIOcspeZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Z�fdd
�Z	dd�Z
edd��Zedd��Z
dd�Z�ZS)rz�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.
    cCsZ|dvrtd|��tj�|�||_d|vr6|d7}||_d|v|_d|v|_d|_dS)N)�r�w�rw�rb�wbZrwbzinvalid mode: %r�brrF)	�
ValueError�io�	RawIOBase�__init__�_sock�_mode�_reading�_writing�_timeout_occurred)�selfZsock�mode�r�5/usr/lib/python3.9/site-packages/pymysql/_socketio.pyr
!s

zSocketIO.__init__c
Cs�|��|��|jrtd��z|j�|�WStyFd|_�Yqty�}zB|jd}|t	krrWYd}~q|t
vr�WYd}~dS�WYd}~qd}~00qdS)a3Read 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 objectTrN)�_checkClosed�_checkReadabler�IOErrorrZ	recv_into�timeout�error�args�EINTR�_blocking_errnos)rr	�e�nrrr�readinto-s 
zSocketIO.readintoc
Csf|��|��z|j�|�WSty`}z*|jdtvrJWYd}~dS�WYd}~n
d}~00dS)aWrite the given bytes or bytearray object *b* to the socket
        and return the number of bytes written.  This can be less than
        len(b) if not all data could be written.  If the socket is
        non-blocking and no bytes could be written None is returned.
        rN)r�_checkWritabler�sendrrr)rr	rrrr�writeGszSocketIO.writecCs|jrtd��|jS)z2True if the SocketIO is open for reading.
        �I/O operation on closed socket.)�closedr
r�rrrr�readableWszSocketIO.readablecCs|jrtd��|jS)z2True if the SocketIO is open for writing.
        r%)r&r
rr'rrr�writable^szSocketIO.writablecs|jrtd��t���S)z2True if the SocketIO is open for seeking.
        r%)r&r
�super�seekabler'��	__class__rrr+eszSocketIO.seekablecCs|��|j��S)z=Return the file descriptor of the underlying socket.
        )rr�filenor'rrrr.lszSocketIO.filenocCs|js|��SdSdS)N���)r&r.r'rrr�namersz
SocketIO.namecCs|jS)N)rr'rrrrysz
SocketIO.modecCs*|jr
dStj�|�|j��d|_dS)z�Close the SocketIO object.  This doesn't close the underlying
        socket, except if all references to it have disappeared.
        N)r&rr�closerZ_decref_socketiosr'rrrr1}s

zSocketIO.close)�__name__�
__module__�__qualname__�__doc__r
r!r$r(r)r+r.�propertyr0rr1�
__classcell__rrr,rrs

)r5Zsocketr�errno�__all__rZEAGAINZEWOULDBLOCKrrrrrrr�<module>s