ok

Mini Shell

Direktori : /lib64/python3.6/__pycache__/
Upload File :
Current File : //lib64/python3.6/__pycache__/socket.cpython-36.opt-2.pyc

3


 \3k�
@slddlZddlTddlZddlZddlZddlZddlmZmZyddlZWne	k
rddZYnXe
edd�Ze
edd�Ze
edd�Z
d	d
ddd
gZejeje��ejdedd��ejd
edd��ejdedd��ejdedd��dZdZdd�ZeZejj�jd��r�iZded<ded<ded<d ed!<d"ed#<d$ed%<d&ed'<d(ed)<d*ed+<d,ed-<d.ed/<d0ed1<d2ed3<d4ed5<d6ed7<ejd8�Gd9d:�d:e�ZGd;d<�d<ej�ZdLd=d	�Ze ejd>��r�d?d@�Z!ejd@�e edA��rde"dfdBdA�Z#ne$e"dfdCdA�Z#ejdA�dDe#_%ee
hZ&GdEdF�dFej'�Z(dMdHd
�Z)e*�Z+e+dfdId�Z,dNdJdK�Z-dS)O�N)�*)�IntEnum�IntFlag�EBADF�	�EAGAIN��EWOULDBLOCK�fromfd�getfqdn�create_connection�
AddressFamily�
SocketKindcCs|j�o|jd�S)NZAF_)�isupper�
startswith)�C�r�/usr/lib64/python3.6/socket.py�<lambda>LsrcCs|j�o|jd�S)NZSOCK_)rr)rrrrrQsZMsgFlagcCs|j�o|jd�S)NZMSG_)rr)rrrrrVsZAddressInfocCs|j�o|jd�S)NZAI_)rr)rrrrr[sz	127.0.0.1z::1cCs"y||�Stk
r|SXdS)N)�
ValueError)�valueZ
enum_klassrrr�_intenum_converterasr�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@seZdZdS)�_GiveupOnSendfileN)�__name__�
__module__�__qualname__rrrrr�srcs0eZdZdddgZeeddfdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dd�Zdd�Zd7dddd�dd�Z
eed�r~d8dd�Zn
d9dd�Zd:dd�Zdd�Zd;d d!�Zd"d#�Zejfd$d%�Zd&d'�Z�fd(d)�Ze�fd*d+��Ze�fd,d-��Zejd.k�rd/d0�Zd1d2�Znd3d0�Zd4d2�Zd5e_ d6e_ �Z!S)<�socket�__weakref__�_io_refs�_closedrNcCs$tjj|||||�d|_d|_dS)NrF)�_socketr�__init__r r!)�self�family�type�proto�filenorrrr#�szsocket.__init__cCs|S)Nr)r$rrr�	__enter__�szsocket.__enter__cGs|js|j�dS)N)r!�close)r$�argsrrr�__exit__�szsocket.__exit__cCs�t|dd�}d|jj|jj|r"dnd|j�|j|j|jf}|s�y |j�}|r^|dt	|�7}Wnt
k
rtYnXy |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�errorZgetpeername)r$�closed�sZladdrZraddrrrr�__repr__�s0

zsocket.__repr__cCstd��dS)NzCannot serialize socket object)�	TypeError)r$rrr�__getstate__�szsocket.__getstate__cCs6t|j��}|j|j|j|j|d�}|j|j��|S)N)r()�dupr(r0r%r&r'�
settimeout�
gettimeout)r$�fd�sockrrrr9�sz
socket.dupcCsZ|j�\}}|jt�jdd�@}t|j||j|d�}t�dkrR|j�rR|j	d�||fS)NZ
SOCK_NONBLOCKr)r(T)
Z_acceptr&�globals�getrr%r'Zgetdefaulttimeoutr;�setblocking)r$r<�addrr&r=rrr�accept�s
z
socket.accept�r)�encoding�errors�newlinec
Cs�t|�dddhks td|f��d|k}d|kp4|}d|k}d}	|rN|	d7}	|rZ|	d7}	t||	�}
|jd7_|dkr~d	}|dkr�tj}|dkr�|s�td��|
S|r�|r�tj|
|
|�}n|r�tj|
|�}ntj|
|�}|r�|Stj	||||�}||_
|S)
NrC�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$rS�	bufferingrDrErFZwritingZreadingZbinaryZrawmode�raw�buffer�textrrr�makefile�s<
zsocket.makefile�sendfilec2Cs�|j|||�|j�}y|j�}Wn0ttjfk
rR}zt|��WYdd}~XnXytj|�j}Wn*t	k
r�}zt|��WYdd}~XnX|s�dS|s�|n|}|j
�}	|	dkr�td��tt
d�r�t
j�}
nt
j�}
|
j|t
j�d}|
j}tj}
z�x�|	�r||	��rtjd��|�r0||}|dk�r0Py|
||||�}Wn^tk
�rf|	�s`|�w�Yq�t	k
�r�}z|dk�r�t|��|d�WYdd}~Xq�X|dk�r�P||7}||7}q�W|S|dk�r�t|d��r�|j|�XdS)Nrz&non-blocking sockets are not supported�PollSelectorz	timed out�seek)�_check_sendfile_paramsr(�AttributeErrorrM�UnsupportedOperationr�os�fstat�st_size�OSErrorr;r�hasattr�	selectorsrZZSelectSelector�registerZEVENT_WRITEZselectrYr"�timeout�BlockingIOErrorr[)r$�file�offset�countZsocknor(�errZfsize�	blocksizerfZselector�
total_sentZselector_selectZos_sendfile�sentrrr�_sendfile_use_sendfiles`





zsocket._sendfile_use_sendfilecCstd��dS)Nz,os.sendfile() not available on this platform)r)r$rhrirjrrrroGsc
Cs|j|||�|j�dkr"td��|r0|j|�|r>t|d�nd}d}|j}|j}z�x�|rrt|||�}|dkrrPt||��}|s�PxLy||�}	Wntk
r�w�Yq�X||	7}|	t	|�kr�||	d�}q�Pq�WqVW|S|dko�t
|d��r�|j||�XdS)Nrz&non-blocking sockets are not supportedi r[)r\r;rr[�min�read�send�
memoryviewrg�lenrc)
r$rhrirjrlrmZ	file_readZ	sock_send�datarnrrr�_sendfile_use_sendKs<

zsocket._sendfile_use_sendcCsddt|dd�krtd��|jt@s*td��|dk	r`t|t�sJtdj|���|dkr`tdj|���dS)NrHrSz$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�intr7�format)r$rhrirjrrrr\os

zsocket._check_sendfile_paramscCs2y|j|||�Stk
r,|j|||�SXdS)N)rorrv)r$rhrirjrrrrY|szsocket.sendfilecCs*|jdkr|jd8_|jr&|j�dS)NrrI)r r!r*)r$rrr�_decref_socketios�s
zsocket._decref_socketioscCs|j|�dS)N)r*)r$Z_ssrrr�_real_close�szsocket._real_closecCsd|_|jdkr|j�dS)NTr)r!r r|)r$rrrr*�s
zsocket.closecsd|_t�j�S)NT)r!�super�detach)r$)r0rrr~�sz
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)r_Zget_handle_inheritabler()r$rrr�get_inheritable�szsocket.get_inheritablecCstj|j�|�dS)N)r_Zset_handle_inheritabler()r$�inheritablerrr�set_inheritable�szsocket.set_inheritablecCstj|j��S)N)r_r�r()r$rrrr��scCstj|j�|�dS)N)r_r�r()r$r�rrrr��sz&Get the inheritable flag of the socketz&Set the inheritable flag of the socket)rCN)rN)rN)rN)rN)"rrr�	__slots__�AF_INETrwr#r)r,r6r8r9rBrXrcr_rorvr\rYr{r"rr|r*r~�propertyr%r&�namer�r��__doc__�
__classcell__rr)r0rr�s:
	)
A

$


rcCst|�}t||||�S)N)r9r)r<r%r&r'Znfdrrrr
�sZsharecCstddd|�S)Nr)r)�inforrr�	fromshare�sr��
socketpairc
Csh|dkr*yt}Wntk
r(t}YnXtj|||�\}}t||||j��}t||||j��}||fS)N)ZAF_UNIX�	NameErrorr�r"r�rr~)r%r&r'�arHrrrr��s
c
Cs|tkrt}n|tkrt}ntd��|tkr4td��|dkrDtd��t|||�}z�|j|df�|j�|j	�dd�\}}t|||�}yP|j
d�y|j||f�Wntt
fk
r�YnX|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��
_LOCALHOSTZAF_INET6�
_LOCALHOST_V6rrwr�bindZlistenr1r@�connectrg�InterruptedErrorrBr*)
r%r&r'�hostZlsockrA�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.
csleZdZdd�Zdd�Zdd�Zdd�Zd	d
�Z�fdd�Zd
d�Z	e
dd��Ze
dd��Zdd�Z
�ZS)rLcCsZ|d
krtd|��tjj|�||_d|kr6|d7}||_d|k|_d|k|_d	|_dS)NrCrG�rw�rb�wb�rwbzinvalid mode: %rrHF)rCrGr�r�r�r�)	rrM�	RawIOBaser#�_sock�_mode�_reading�_writing�_timeout_occurred)r$r=rSrrrr#0s

zSocketIO.__init__cCs�|j�|j�|jrtd��xby|jj|�Stk
rHd|_�Yq tk
r|}z|jdt	krjdS�WYdd}~Xq Xq WdS)Nz!cannot read from timed out objectTr)
�_checkClosed�_checkReadabler�rbr�Z	recv_intorfr3r+�_blocking_errnos)r$rH�errr�readinto<szSocketIO.readintocCsX|j�|j�y|jj|�Stk
rR}z|jdtkr@dS�WYdd}~XnXdS)Nr)r��_checkWritabler�rrr3r+r�)r$rHr�rrr�writeSszSocketIO.writecCs|jrtd��|jS)NzI/O operation on closed socket.)r4rr�)r$rrr�readablecszSocketIO.readablecCs|jrtd��|jS)NzI/O operation on closed socket.)r4rr�)r$rrr�writablejszSocketIO.writablecs|jrtd��t�j�S)NzI/O operation on closed socket.)r4rr}�seekable)r$)r0rrr�qszSocketIO.seekablecCs|j�|jj�S)N)r�r�r()r$rrrr(xszSocketIO.filenocCs|js|j�SdSdS)NrIrJ)r4r()r$rrrr�~sz
SocketIO.namecCs|jS)N)r�)r$rrrrS�sz
SocketIO.modecCs*|jr
dStjj|�|jj�d|_dS)N)r4rMr�r*r�r{)r$rrrr*�s

zSocketIO.close)rrrr#r�r�r�r�r�r(r�r�rSr*r�rr)r0rrLsrLr-cCsp|j�}|s|dkrt�}yt|�\}}}Wntk
rBYn*X|jd|�x|D]}d|krVPqVW|}|S)Nz0.0.0.0r�.)�stripZgethostnameZ
gethostbyaddrr3�insert)r�Zhostname�aliasesZipaddrsrrrr�s	
cCs�|\}}d}x�t||dt�D]�}|\}}}	}
}d}y>t|||	�}|tk	rR|j|�|r`|j|�|j|�d}|Stk
r�}
z|
}|dk	r�|j�WYdd}
~
XqXqW|dk	r�|�ntd��dS)Nrz!getaddrinfo returns an empty list)	�getaddrinforwr�_GLOBAL_DEFAULT_TIMEOUTr:r�r�r3r*)ZaddressrfZsource_addressr�r�rk�res�af�socktyper'�	canonname�sar=r�rrrr�s*


cCsTg}xJtj||||||�D]2}|\}}	}}
}|jt|t�t|	t�||
|f�qW|S)N)r"r��appendrr
r)r�r�r%r&r'�flagsZaddrlistr�r�r�r�r�rrrr��sr�)r)r-)rrrr).r"r_�sysrMrd�enumrr�errno�ImportErrorr/rrr	�__all__�extend�_get_exports_list�_convertrr�r�rrZ_realsocket�platform�lowerrrr��	Exceptionrr
rcr�rwr�r�r�r�r�rLr�objectr�rr�rrrr�<module>1s� 






C
	
$
u
'

Zerion Mini Shell 1.0