Your IP : 13.59.91.59


Current Path : /opt/alt/python310/lib64/python3.10/__pycache__/
Upload File :
Current File : //opt/alt/python310/lib64/python3.10/__pycache__/socket.cpython-310.opt-2.pyc

o

6��f���@sV	ddlZddlTddlZddlZddlZddlZddlmZmZzddlZWne	y2dZYnwe
edd�Ze
edd�Ze
edd�Z
gd	�Ze�e�e��e�d
edd��e�d
edd��e�dedd��e�dedd��dZdZdd�Zej���d��r	iZded<ded<ded<ded<d ed!<d"ed#<d$ed%<d&ed'<d(ed)<d*ed+<d,ed-<d.ed/<d0ed1<d2ed3<d4ed5<d6ed7<d8ed9<d:ed;<d<ed=<d>ed?<d@edA<dBedC<dDedE<dFedG<dHedI<dJedK<dLedM<dNedO<dPedQ<dRedS<dTedU<dVedW<dXedY<dZed[<d\ed]<d^ed_<d`eda<dbedc<ddede<dfedg<dhedi<djedk<dledm<dnedo<dpedq<dreds<dtedu<dvedw<dxedy<dzed{<d|ed}<d~ed<d�ed�<d�ed�<d�ed�<d�ed�<d�ed�<d�ed�<d�ed�<d�ed�<d�ed�<d�ed�<d�ed�<d�ed�<d�ed�<d�ed�<d�ed�<d�ed�<d�ed�<d�ed�<d�ed�<d�ed�<d�ed�<d�ed�<d�ed�<d�ed�<d�ed�<d�ed�<d�ed�<d�ed�<d�ed�<d�ed�<d�ed�<d�ed�<d�ed�<d�ed�<d�ed�<d�ed�<d�ed�<d�ed�<d�ed�<d�ed�<d�ed�<d�ed�<d�ed�<e�dԡGd�dքd�e�ZGd�d؄d�ej�Zd�d�dڄZeejdۃ�r4ddl Z d�d�d݄Z!e�dݡeejdރ�rIddl Z d�d�d�Z"e�d�eejd��rYd�d�Z#e�d�e$e%dfd�d�Z&eed��rpde%dfd�d�Z'ne&Z'e�d�d�e'_(ee
hZ)Gd�d�d�ej*�Z+d�d�d�Z,e-�Z.e.dfd�d�Z/d�d�Z0e$dd�d�d�d�d��Z1d�d�d��Z2dS)��N)�*)�IntEnum�IntFlag�EBADF�	�EAGAIN��EWOULDBLOCK)�fromfd�getfqdn�create_connection�
create_server�has_dualstack_ipv6�
AddressFamily�
SocketKindrcC�|��o|�d�S)NZAF_��isupper�
startswith��C�r�-/opt/alt/python310/lib64/python3.10/socket.py�<lambda>N�rrcCr)NZSOCK_rrrrrrSrZMsgFlagcCr)NZMSG_rrrrrrXrZAddressInfocCr)NZAI_rrrrrr]rz	127.0.0.1z::1cCs$	z||�WSty|YSw�N)�
ValueError)�valueZ
enum_klassrrr�_intenum_convertercs
�r�winz)Specified event object handle is invalid.�zInsufficient memory available.�z#One or more parameters are invalid.�WzOverlapped operation aborted.i�z2Overlapped I/O event object not in signaled state.i�z)Overlapped operation will complete later.i�zThe 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&'zToo many open files.i('z The socket operation would blocki3'z,A blocking operation is already in progress.i4'zOperation already in progress.i5'zSocket operation on nonsocket.i6'zDestination address required.i7'zMessage too long.i8'zProtocol wrong type for socket.i9'zBad protocol option.i:'zProtocol not supported.i;'zSocket type not supported.i<'zOperation not supported.i='zProtocol family not supported.i>'z0Address family not supported by protocol family.i?'zThe network address is in use.i@'z Cannot assign requested address.iA'zNetwork is down.iB'zNetwork is unreachable.iC'z$Network dropped connection on reset.iD'z!Software caused connection abort.iE'zThe connection has been reset.iF'zNo buffer space available.iG'zSocket is already connected.iH'zSocket is not connected.iI'zThe network has been shut down.iJ'zToo many references.iK'zThe operation timed out.iL'zConnection refused.iM'zCannot translate name.iN'zThe name is too long.iO'zThe host is down.iP'zThe host is unreachable.iQ'zDirectory not empty.iR'zToo many processes.iS'zUser quota exceeded.iT'zDisk quota exceeded.iU'zStale file handle reference.iV'zItem is remote.iW'z!Network subsystem is unavailable.ik'z!Winsock.dll version out of range.il'z(Successful WSAStartup not yet performed.im'zGraceful shutdown in progress.iu'z*No more results from WSALookupServiceNext.iv'zCall has been canceled.iw'z Procedure call table is invalid.ix'zService provider is invalid.iy'z&Service provider failed to initialize.iz'zSystem call failure.i{'zService not found.i|'zClass type not found.i}'i~'zCall was canceled.i'zDatabase query was refused.i�'zHost not found.i�*z Nonauthoritative host not found.i�*zThis is a nonrecoverable error.i�*z*Valid name, no data record requested type.i�*zQoS receivers.i�*zQoS senders.i�*zNo QoS senders.i�*zQoS no receivers.i+zQoS request confirmed.i+zQoS admission error.i+zQoS policy failure.i+zQoS bad style.i+zQoS bad object.i+zQoS traffic control error.i+zQoS generic error.i+zQoS service type error.i+zQoS flowspec error.i	+zInvalid QoS provider buffer.i
+zInvalid QoS filter style.i+i+zIncorrect QoS filter count.i
+zInvalid QoS object length.i+zIncorrect QoS flow count.i+zUnrecognized QoS object.i+zInvalid QoS policy object.i+zInvalid QoS flow descriptor.i+z'Invalid QoS provider-specific flowspec.i+z)Invalid QoS provider-specific filterspec.i+z&Invalid QoS shape discard mode object.i+z Invalid QoS shaping rate object.i+z!Reserved policy QoS element type.i+�errorTabc@seZdZdS)�_GiveupOnSendfileN)�__name__�
__module__�__qualname__rrrrr$�sr$cs&eZdZ	gd�Zd6dd�Zdd�Zdd	�Zd
d�Zdd
�Zdd�Z	dd�Z
d7dddd�dd�Zee
d�r;d8dd�Znd8dd�Zd8dd�Zdd�Zd8dd �Zd!d"�Zejfd#d$�Zd%d&�Z�fd'd(�Ze�fd)d*��Ze�fd+d,��Ze
jd-kr�d.d/�Zd0d1�Znd2d/�Zd3d1�Zd4e_d5e_�ZS)9�socket)�__weakref__�_io_refs�_closed���NcCsP|dur|dkr
t}|dkrt}|dkrd}tj�|||||�d|_d|_dS)Nr,rF)�AF_INET�SOCK_STREAM�_socketr(�__init__r*r+)�self�family�type�proto�filenorrrr0�s
zsocket.__init__cCs|Srr�r1rrr�	__enter__�szsocket.__enter__cGs|js	|��dSdSr)r+�close)r1�argsrrr�__exit__�s�zsocket.__exit__cCs�	t|dd�}d|jj|jj|rdnd|��|j|j|jf}|sUz|��}|r0|dt	|�7}Wn	t
y:Ynwz|��}|rJ|dt	|�7}Wn	t
yTYnw|d7}|S)	Nr+Fz,<%s.%s%s fd=%i, family=%s, type=%s, proto=%iz	 [closed]�z
, laddr=%sz
, raddr=%s�>)�getattr�	__class__r&r'r5r2r3r4�getsockname�str�error�getpeername)r1�closed�sZladdrZraddrrrr�__repr__�s>
������zsocket.__repr__cCstd|jj�d���)Nzcannot pickle z object)�	TypeErrorr>r%r6rrr�__getstate__�zsocket.__getstate__cCs8	t|���}|j|j|j|j|d�}|�|���|S)N�r5)�dupr5r>r2r3r4�
settimeout�
gettimeout)r1�fd�sockrrrrJs
z
socket.dupcCsH	|��\}}t|j|j|j|d�}t�dur |��r |�d�||fS)NrIT)Z_acceptr(r2r3r4ZgetdefaulttimeoutrL�setblocking)r1rM�addrrNrrr�accepts
z
socket.accept�r)�encoding�errors�newlinec
Cs	t|�hd�kstd|f��d|v}d|vp|}d|v}d}	|r'|	d7}	|r-|	d7}	t||	�}
|jd7_|dur?d}|d	krFtj}|d	krR|sPtd
��|
S|r^|r^t�|
|
|�}n|rgt�|
|�}nt�|
|�}|rq|St�	|�}t�
||||�}||_|S)N>�w�brRz&invalid mode %r (only r, w, b allowed)rVrRrWr;�r,rz!unbuffered streams must be binary)�setr�SocketIOr*�io�DEFAULT_BUFFER_SIZE�BufferedRWPair�BufferedReader�BufferedWriter�
text_encoding�
TextIOWrapper�mode)
r1rb�	bufferingrSrTrUZwritingZreadingZbinaryZrawmode�raw�buffer�textrrr�makefile.s@

zsocket.makefile�sendfilerc
Cs�|�|||�|��}z|��}Wnttjfy$}zt|��d}~wwzt�|�j}Wnt	y=}zt|��d}~ww|sBdSt
|pF|d�}|��}	|	dkrUtd��t
td�r_t��}
nt��}
|
�|tj�d}|
j}tj}
ze	|	r~||	�s~td��|r�||}|dkr�n<z	|
||||�}Wn$ty�|	s�|�Yqst	y�}z|dkr�t|��|d�d}~ww|dkr�n	||7}||7}qt|W|dkr�t
|d�r�|�|�SSS|dkr�t
|d�r�|�|�www)Nri@�&non-blocking sockets are not supported�PollSelectorTz	timed out�seek)�_check_sendfile_paramsr5�AttributeErrorr[�UnsupportedOperationr$�os�fstat�st_size�OSError�minrLr�hasattr�	selectorsrjZSelectSelector�registerZEVENT_WRITEZselectrh�TimeoutError�BlockingIOErrorrk)r1�file�offset�countZsocknor5�errZfsize�	blocksize�timeoutZselector�
total_sentZselector_selectZos_sendfile�sentrrr�_sendfile_use_sendfile[st����

��	���zsocket._sendfile_use_sendfilecCstd��)Nz,os.sendfile() not available on this platform)r$�r1ryrzr{rrrr��s�c

Cs|�|||�|��dkrtd��|r|�|�|rt|d�nd}d}|j}|j}zR	|r9t|||�}|dkr9n.t||��}|sBn%	z||�}	Wn	tyRYqBw||	7}|	t	|�krd||	d�}nnqCq+|W|dkrzt
|d�r{|�||�SSS|dkr�t
|d�r�|�||�www)Nrrii Trk)rlrLrrkrs�read�send�
memoryviewrx�lenrt)
r1ryrzr{r}rZ	file_readZ	sock_send�datar�rrr�_sendfile_use_send�sH
�����zsocket._sendfile_use_sendcCshdt|dd�vrtd��|jt@std��|dur0t|t�s%td�|���|dkr2td�|���dSdS)NrWrbz$file should be opened in binary modez+only SOCK_STREAM type sockets are supportedz+count must be a positive integer (got {!r})r)r=rr3r.�
isinstance�intrF�formatr�rrrrl�s

���zsocket._check_sendfile_paramscCs4	z|�|||�WSty|�|||�YSwr)r�r$r�r�rrrrh�s�zsocket.sendfilecCs.|jdkr|jd8_|jr|��dSdS)NrrX)r*r+r8r6rrr�_decref_socketios�s

�zsocket._decref_socketioscCs|�|�dSr)r8)r1Z_ssrrr�_real_close�szsocket._real_closecCs d|_|jdkr|��dSdS)NTr)r+r*r�r6rrrr8�s
�zsocket.closecs	d|_t���S)NT)r+�super�detachr6�r>rrr��s
z
socket.detachc�	tt�jt�Sr)rr�r2rr6r�rrr2�z
socket.familycr�r)rr�r3rr6r�rrr3r�zsocket.type�ntcC�t�|���Sr)roZget_handle_inheritabler5r6rrr�get_inheritable�zsocket.get_inheritablecC�t�|��|�dSr)roZset_handle_inheritabler5�r1Zinheritablerrr�set_inheritablerHzsocket.set_inheritablecCr�r)ror�r5r6rrrr�r�cCr�r)ror�r5r�rrrr�rHz&Get the inheritable flag of the socketz&Set the inheritable flag of the socket)r,r,r,N)rRN�rN) r%r&r'�	__slots__r0r7r:rErGrJrQrgrtror�r�rlrhr�r/r(r�r8r��propertyr2r3�namer�r��__doc__�
__classcell__rrr�rr(�sD
�
+
A
$




r(cCs	t|�}t||||�Sr)rJr()rMr2r3r4Znfdrrrr
sr
�sendmsgc	Cs"	|�|tjtjt�d|�fg�S�N�i)r�r/�
SOL_SOCKET�
SCM_RIGHTS�array)rNZbuffers�fds�flags�addressrrr�send_fds's
�r��recvmsgcCs�	t�d�}|�|t�||j��\}}}}|D]!\}}	}
|tjkr9|	tjkr9|�|
dt|
�t|
�|j��q|t	|�||fSr�)
r�r�r/ZCMSG_LEN�itemsizer�r�Z	frombytesr��list)rN�bufsizeZmaxfdsr�r��msgZancdatarPZ
cmsg_levelZ	cmsg_typeZ	cmsg_datarrr�recv_fds3s
���r�ZsharecCs	tddd|�S)Nr)r()�inforrr�	fromshareGsr�c
	CsJ|tkrt}n|tkrt}ntd��|tkrtd��|dkr"td��t|||�}zQ|�|df�|��|�	�dd�\}}t|||�}z'|�
d�z	|�||f�Wntt
fy^Ynw|�
d�|��\}}	Wn|���W|��n|��wz|�	�|��ks�|�	�|��kr�td��W||fS|��|���)	Nz?Only AF_INET and AF_INET6 socket address families are supportedz)Only SOCK_STREAM socket type is supportedrzOnly protocol zero is supported�FTzUnexpected peer connection)r-�
_LOCALHOST�AF_INET6�
_LOCALHOST_V6rr.r(�bind�listenr?rO�connectrx�InterruptedErrorrQr8rB�ConnectionError)
r2r3r4�hostZlsockrP�portZcsockZssock�_rrr�_fallback_socketpairSsN
�
��
�r��
socketpaircCsf|durzt}Wntyt}Ynwt�|||�\}}t||||���}t||||���}||fSr)ZAF_UNIX�	NameErrorr-r/r�r(r�)r2r3r4�arWrrrr��s�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.
csneZdZ	dd�Zdd�Zdd�Zdd�Zd	d
�Z�fdd�Zd
d�Z	e
dd��Ze
dd��Zdd�Z
�ZS)rZcCsZ|dvr
td|��tj�|�||_d|vr|d7}||_d|v|_d|v|_d|_dS)N)rRrVZrw�rb�wbZrwbzinvalid mode: %rrWrRrVF)	rr[�	RawIOBaser0�_sock�_mode�_reading�_writing�_timeout_occurred)r1rNrbrrrr0�s


zSocketIO.__init__c
Csx	|��|��|jrtd��	z|j�|�WSty#d|_�ty;}z
|jt	vr6WYd}~dS�d}~ww)Nz!cannot read from timed out objectT)
�_checkClosed�_checkReadabler�rrr�Z	recv_intor~rA�errno�_blocking_errnos�r1rW�errr�readinto�s"
��zSocketIO.readintoc
CsT	|��|��z|j�|�WSty)}z
|jtvr$WYd}~dS�d}~wwr)r��_checkWritabler�r�rAr�r�r�rrr�write�s
��zSocketIO.writecC�	|jrtd��|jS�NzI/O operation on closed socket.)rCrr�r6rrr�readable��zSocketIO.readablecCr�r�)rCrr�r6rrr�writable�r�zSocketIO.writablecs	|jrtd��t���Sr�)rCrr��seekabler6r�rrr��s
zSocketIO.seekablecCs	|��|j��Sr)r�r�r5r6rrrr5�s
zSocketIO.filenocCs|js|��SdS)Nr,)rCr5r6rrrr�sz
SocketIO.namecCs|jSr)r�r6rrrrbsz
SocketIO.modecCs,	|jrdStj�|�|j��d|_dSr)rCr[r�r8r�r�r6rrrr8s

zSocketIO.close)r%r&r'r0r�r�r�r�r�r5r�r�rbr8r�rrr�rrZ�s

rZr;cCsp	|��}|r|dvrt�}z	t|�\}}}Wn
ty!Y|Sw|�d|�|D]	}d|vr3|Sq*|}|S)N)z0.0.0.0z::r�.)�stripZgethostnameZ
gethostbyaddrrA�insert)r�Zhostname�aliasesZipaddrsrrrrs$	��rcCs�	|\}}d}t||dt�D]I}|\}}}	}
}d}z"t|||	�}|tur)|�|�|r0|�|�|�|�d}|WStyW}
z|
}|durM|��WYd}
~
qd}
~
ww|durbz|�d}wtd��)Nrz!getaddrinfo returns an empty list)	�getaddrinfor.r(�_GLOBAL_DEFAULT_TIMEOUTrKr�r�rAr8)r�r~Zsource_addressr�r�r|�res�af�socktyper4�	canonname�sarNr�rrrr4s4



��rcCsx	tr
ttd�r
ttd�sdSz"ttt��}|�ttd�	Wd�WdS1s*wYWdSt	y;YdSw)N�IPPROTO_IPV6�IPV6_V6ONLYFrT)
�has_ipv6rtr/r(r�r.�
setsockoptr�r�rA)rNrrrras��(��rF)r2�backlog�
reuse_port�dualstack_ipv6c
CsV	|rttd�std��|rt�std��|tkrtd��t|t�}z|tjdvr@ttd�r@z	|�	t
td�Wn	ty?Ynw|rI|�	t
t
d�trj|tkrj|rY|�	ttd�nttd	�rjttd
�rj|�	ttd�z|�|�Wnty�}zd|j|f}t|j|�d�d}~ww|dur�|��|WS|�|�|WSty�|���w)N�SO_REUSEPORTz+SO_REUSEPORT not supported on this platformz-dualstack_ipv6 not supported on this platformz'dualstack_ipv6 requires AF_INET6 family)r��cygwin�SO_REUSEADDRrXrr�r�z+%s (while attempting to bind on address %r))rtr/rrr�r(r.ror�r�r�r�rAr�r�r�r�r��strerrorr�r�r8)r�r2r�r�r�rNr|r�rrrr
qsZ


��
����
��r
cCsR	g}t�||||||�D]}|\}}	}}
}|�t|t�t|	t�||
|f�q
|Sr)r/r��appendrrr)r�r�r2r3r4r�Zaddrlistr�r�r�r�r�rrrr��s�r�)rr�)r;)rrrr)3r/ro�sysr[ru�enumrrr��ImportErrorr=rrr	�__all__�extend�_get_exports_list�	_convert_r%r�r�r�platform�lowerrr#r��	Exceptionr$r(r
rtr�r�r�r�r-r.r�r�r�r�r�rZr�objectr�rrr
r�rrrr�<module>sT/ �����

G	




6

u
�-�E

?>