AlkantarClanX12

Your IP : 3.138.124.28


Current Path : /opt/alt/python35/lib64/python3.5/__pycache__/
Upload File :
Current File : //opt/alt/python35/lib64/python3.5/__pycache__/socket.cpython-35.opt-2.pyc



���]�i�@sddlZddlTddlZddlZddlZddlZddlmZyddlZWnek
r�dZYnXe	edd�Z
e	edd�Ze	edd�Zd	d
ddd
gZ
e
jeje��ejdedd��ejd
edd��dZdZdd�ZeZejj�jd�r�iZded<ded<ded<ded<ded<d ed!<d"ed#<d$ed%<d&ed'<d(ed)<d*ed+<d,ed-<d.ed/<d0ed1<d2ed3<e
jd4�Gd5d6�d6e�ZGd7d8�d8ej�Zdd9d	�Zeejd:�r\d;d<�Z e
jd<�eed=�r�de!dd>d=�Z"n"e#e!dd?d=�Z"e
jd=�d@e"_$eehZ%GdAdB�dBej&�Z'dCdDd
�Z(e)�Z*e*ddEd�Z+dddddFdG�Z,dS)H�N)�*)�IntEnum�EBADF�	�EAGAIN��EWOULDBLOCK�fromfd�getfqdn�create_connection�
AddressFamily�
SocketKindcCs|j�o|jd�S)NZAF_)�isupper�
startswith)�C�r�+/opt/alt/python35/lib64/python3.5/socket.py�<lambda>LsrcCs|j�o|jd�S)NZSOCK_)rr)rrrrrQsz	127.0.0.1z::1cCs+y||�SWntk
r&|SYnXdS)N)�
ValueError)�value�
enum_klassrrr�_intenum_converterWs
r�winzThe operation was interrupted.i'zA bad file handle was passed.i'zPermission denied.i'z!A fault occurred on the network??i'z#An invalid operation was attempted.i&'z The socket operation would blocki3'z,A blocking operation is already in progress.i4'zThe network address is in use.i@'zThe connection has been reset.iF'zThe network has been shut down.iJ'zThe operation timed out.iL'zConnection refused.iM'zThe name is too long.iO'zThe host is down.iP'zThe host is unreachable.iQ'�errorTabc@seZdZdS)�_GiveupOnSendfileN)�__name__�
__module__�__qualname__rrrrrxsrc
s�eZdZdddgZeedddd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dd�Zdd�Zdddddddddd�Z
eed�r�dddd�Zndddd�Zdddd�Zd d!�Zddd"d#�Zd$d%�Zejd&d'�Zd(d)�Z�fd*d+�Ze�fd,d-��Ze�fd.d/��Zejd0kr�d1d2�Zd3d4�Znd5d2�Zd6d4�Zd7e_ d8e_ �S)9�socket�__weakref__�_io_refs�_closedrNcCs2tjj|||||�d|_d|_dS)NrF)�_socketr�__init__r r!)�self�family�type�proto�filenorrrr#�s	zsocket.__init__cCs|S)Nr)r$rrr�	__enter__�szsocket.__enter__cGs|js|j�dS)N)r!�close)r$�argsrrr�__exit__�s	zsocket.__exit__cCs�t|dd�}d|jj|jj|r3dnd|j�|j|j|jf}|s�y*|j�}|r�|dt	|�7}Wnt
k
r�YnXy*|j�}|r�|dt	|�7}Wnt
k
r�YnX|d7}|S)	Nr!Fz,<%s.%s%s fd=%i, family=%s, type=%s, proto=%iz	 [closed]�z
, laddr=%sz
, raddr=%s�>)�getattr�	__class__rrr(r%r&r'�getsockname�str�error�getpeername)r$�closed�s�laddr�raddrrrr�__repr__�s0			



zsocket.__repr__cCstd��dS)NzCannot serialize socket object)�	TypeError)r$rrr�__getstate__�szsocket.__getstate__cCsMt|j��}|j|j|j|jd|�}|j|j��|S)Nr()�dupr(r0r%r&r'�
settimeout�
gettimeout)r$�fd�sockrrrr<�s$z
socket.dupcCs|j�\}}|jt�jdd�@}t|j||jd|�}t�dkru|j�ru|j	d�||fS)N�
SOCK_NONBLOCKrr(T)
�_acceptr&�globals�getrr%r'�getdefaulttimeoutr>�setblocking)r$r?�addrr&r@rrr�accept�s
z
socket.accept�r�encoding�errors�newlinec
Csft|�dddhks.td|f��d|k}d|kpJ|}d|k}d}	|ro|	d7}	|r|	d7}	t||	�}
|jd7_|dkr�d	}|dkr�tj}|dkr�|s�td��|
S|r
|r
tj|
|
|�}n-|r%tj|
|�}ntj|
|�}|rA|Stj	||||�}||_
|S)
NrI�w�bz&invalid mode %r (only r, w, b allowed)r-�rz!unbuffered streams must be binary���)�setr�SocketIOr �io�DEFAULT_BUFFER_SIZE�BufferedRWPair�BufferedReader�BufferedWriter�
TextIOWrapper�mode)
r$rY�	bufferingrJrKrL�writing�reading�binary�rawmode�raw�buffer�textrrr�makefile�s<

		zsocket.makefile�sendfilec2Csm|j|||�|j�}y|j�}Wn:ttjfk
rk}zt|��WYdd}~XnXytj|�j}Wn1t	k
r�}zt|��WYdd}~XnX|s�dS|s�|n|}|j
�}	|	dkr�td��tt
d�rt
j�}
nt
j�}
|
j|t
j�d}|
j}tj}
z�x�|	rs||	�rstjd��|r�||}|dkr�Py|
||||�}Wngtk
r�|	s�|�wQYqQt	k
r}z&|dkr�t|��|d�WYdd}~XqQX|dkr P||7}||7}qQW|SWd|dkrht|d�rh|j|�XdS)Nrz&non-blocking sockets are not supported�PollSelectorz	timed out�seek)�_check_sendfile_paramsr(�AttributeErrorrS�UnsupportedOperationr�os�fstat�st_size�OSErrorr>r�hasattr�	selectorsrd�SelectSelector�register�EVENT_WRITE�selectrcr"�timeout�BlockingIOErrorre)r$�file�offset�count�socknor(�err�fsize�	blocksizers�selector�
total_sent�selector_select�os_sendfile�sentrrr�_sendfile_use_sendfile�s`		


zsocket._sendfile_use_sendfilecCstd��dS)Nz,os.sendfile() not available on this platform)r)r$rurvrwrrrr�=sc
CsX|j|||�|j�dkr1td��|rD|j|�|rYt|d�nd}d}|j}|j}z�x�|r�t|||�}|dkr�Pt||��}|s�Px\y||�}	Wntk
r�w�Yq�X||	7}|	t	|�kr||	d�}q�Pq�Wq}W|SWd|dkrSt
|d�rS|j||�XdS)Nrz&non-blocking sockets are not supportedi re)rfr>rre�min�read�send�
memoryviewrt�lenrm)
r$rurvrwr{r}�	file_read�	sock_send�datar�rrr�_sendfile_use_sendAs<
		

	zsocket._sendfile_use_sendcCs�dt|dd�kr$td��|jt@s=td��|dk	r�t|t�smtdj|���|dkr�tdj|���dS)NrNrYz$file should be opened in binary modez+only SOCK_STREAM type sockets are supportedz+count must be a positive integer (got {!r})r)r/rr&�SOCK_STREAM�
isinstance�intr:�format)r$rurvrwrrrrfes
zsocket._check_sendfile_paramscCsCy|j|||�SWn%tk
r>|j|||�SYnXdS)N)r�rr�)r$rurvrwrrrrcrs
zsocket.sendfilecCs5|jdkr|jd8_|jr1|j�dS)NrrO)r r!r*)r$rrr�_decref_socketios�s	zsocket._decref_socketioscCs|j|�dS)N)r*)r$�_ssrrr�_real_close�szsocket._real_closecCs&d|_|jdkr"|j�dS)NTr)r!r r�)r$rrrr*�s	zsocket.closecsd|_t�j�S)NT)r!�super�detach)r$)r0rrr��s	z
socket.detachcstt�jt�S)N)rr�r%r)r$)r0rrr%�sz
socket.familycstt�jt�S)N)rr�r&r
)r$)r0rrr&�szsocket.type�ntcCstj|j��S)N)riZget_handle_inheritabler()r$rrr�get_inheritable�szsocket.get_inheritablecCstj|j�|�dS)N)riZset_handle_inheritabler()r$�inheritablerrr�set_inheritable�szsocket.set_inheritablecCstj|j��S)N)rir�r()r$rrrr��scCstj|j�|�dS)N)rir�r()r$r�rrrr��sz&Get the inheritable flag of the socketz&Set the inheritable flag of the socket)!rrr�	__slots__�AF_INETr�r#r)r,r9r;r<rHrbrmrir�r�rfrcr�r"rr�r*r��propertyr%r&�namer�r��__doc__rr)r0rr{s:		)A$

	rcCst|�}t||||�S)N)r<r)r?r%r&r'�nfdrrrr	�sZsharecCstddd|�S)Nr)r)�inforrr�	fromshare�sr��
socketpairc
Cs�|dkr1y
t}Wntk
r0t}YnXtj|||�\}}t||||j��}t||||j��}||fS)N)�AF_UNIX�	NameErrorr�r"r�rr�)r%r&r'�arNrrrr��s

c
CsY|tkrt}n!|tkr*t}ntd��|tkrNtd��|dkrftd��t|||�}z�|j|df�|j�|j	�dd�\}}t|||�}yb|j
d�y|j||f�Wntt
fk
rYnX|j
d�|j�\}}	Wn|j��YnXWd|j�X||fS)Nz?Only AF_INET and AF_INET6 socket address families are supportedz)Only SOCK_STREAM socket type is supportedrzOnly protocol zero is supported�FT)r��
_LOCALHOST�AF_INET6�
_LOCALHOST_V6rr�r�bind�listenr1rF�connectrt�InterruptedErrorrHr*)
r%r&r'�hostZlsockrG�portZcsockZssock�_rrrr��s8		



a8socketpair([family[, type[, proto]]]) -> (socket object, socket object)
Create a pair of socket objects from the sockets returned by the platform
socketpair() function.
The arguments are the same as for socket() except the default family is AF_UNIX
if defined on the platform; otherwise, the default is AF_INET.
cs�eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Z�fdd�Zd
d�Z	e
dd��Ze
dd��Zdd�Z
�S)rRcCs|d
krtd|��tjj|�||_d|krK|d7}||_d|k|_d|k|_d	|_dS)NrIrM�rw�rb�wb�rwbzinvalid mode: %rrNF)rIrMr�r�r�r�)	rrS�	RawIOBaser#�_sock�_mode�_reading�_writing�_timeout_occurred)r$r@rYrrrr#&s	
	zSocketIO.__init__cCs�|j�|j�|jr)td��xwy|jj|�SWq,tk
r`d|_�Yq,tk
r�}z|jdt	kr�dS�WYdd}~Xq,Xq,WdS)Nz!cannot read from timed out objectTr)
�_checkClosed�_checkReadabler�rlr��	recv_intorsr3r+�_blocking_errnos)r$rN�errr�readinto2s

	
	zSocketIO.readintocCsn|j�|j�y|jj|�SWn?tk
ri}z|jdtkrTdS�WYdd}~XnXdS)Nr)r��_checkWritabler�r�r3r+r�)r$rNr�rrr�writeIs

zSocketIO.writecCs|jrtd��|jS)NzI/O operation on closed socket.)r5rr�)r$rrr�readableYs	zSocketIO.readablecCs|jrtd��|jS)NzI/O operation on closed socket.)r5rr�)r$rrr�writable`s	zSocketIO.writablecs"|jrtd��t�j�S)NzI/O operation on closed socket.)r5rr��seekable)r$)r0rrr�gs	zSocketIO.seekablecCs|j�|jj�S)N)r�r�r()r$rrrr(ns
zSocketIO.filenocCs|js|j�SdSdS)NrOrP)r5r()r$rrrr�ts	
z
SocketIO.namecCs|jS)N)r�)r$rrrrY{sz
SocketIO.modecCs7|jr
dStjj|�|jj�d|_dS)N)r5rSr�r*r�r�)r$rrrr*s
	
zSocketIO.close)rrrr#r�r�r�r�r�r(r�r�rYr*rr)r0rrRsrRr-cCs�|j�}|s|dkr(t�}yt|�\}}}Wntk
rUYn5X|jd|�x!|D]}d|krmPqmW|}|S)Nz0.0.0.0r�.)�strip�gethostname�
gethostbyaddrr3�insert)r��hostname�aliases�ipaddrsrrrr
�s		

cCs	|\}}d}x�t||dt�D]�}|\}}}	}
}d}ySt|||	�}|tk	rw|j|�|r�|j|�|j|�|SWq(tk
r�}
z!|
}|dk	r�|j�WYdd}
~
Xq(Xq(W|dk	r�|�ntd��dS)Nrz!getaddrinfo returns an empty list)	�getaddrinfor�r�_GLOBAL_DEFAULT_TIMEOUTr=r�r�r3r*)�addressrs�source_addressr�r�ry�res�af�socktyper'�	canonname�sar@r�rrrr�s(


!	cCsvg}xitj||||||�D]I}|\}}	}}
}|jt|t�t|	t�||
|f�q%W|S)N)r"r��appendrrr
)r�r�r%r&r'�flags�addrlistr�r�r�r�r�rrrr��s%r�)-r"ri�sysrSrn�enumr�errno�ImportErrorr/rrr�__all__�extend�_get_exports_list�_convertrr�r�rr�_realsocket�platform�lowerrrr��	Exceptionrr	rmr�r�r�r�r�r�r�rRr
�objectr�rr�rrrr�<module>1s|
0
	


















�B	
$
	u	%