o bc}@sR ddlZddlTddlZddlZddlZddlZddlmZmZzddlZWn e y2dZYnwe eddZ e eddZ e eddZ gd Zeeeed ed d ed edd ededd ededd dZdZddZejdr 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;<ded?<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<ded<ded<ded<ded<ded<ded<ded<ded<ded<ded<ded<ded<ded<ded<ded<ded<ded<ded<ded<ded<ded<ded<ded<ded<ded<ded<ded<ded<ded<ded<ded<ded<ded<ded<ded<ded<ded<ded<ded<ded<ded<ded<ded<edԡGddքdeZGdd؄dejZdddڄZeejdۃr4ddl Z ddd݄Z!edݡeejdރrIddl Z dddZ"edeejdrYddZ#edeedrhde$dfddZ%n e&e$dfddZ%edde%_'e e hZ(Gdddej)Z*dddZ+e,Z-e-dfddZ.ddZ/e&ddddddZ0dddZ1dS)N)*)IntEnumIntFlagEBADF EAGAIN EWOULDBLOCK)fromfdgetfqdncreate_connection create_serverhas_dualstack_ipv6 AddressFamily SocketKindrcC|o|dS)NZAF_isupper startswithCrg/home/lily/lilypond-2.24.1/release/binaries/dependencies/install/Python-3.10.8/lib/python3.10/socket.pyNrrcCr)NZSOCK_rrrrrrSrZMsgFlagcCr)NZMSG_rrrrrrXrZ AddressInfocCr)NZAI_rrrrrr]rz 127.0.0.1z::1cCs$ z||WSty|YSwN) ValueError)value enum_klassrrr_intenum_convertercs   rwinz)Specified event object handle is invalid.zInsufficient memory available.z#One or more parameters are invalid.WzOverlapped operation aborted.iz2Overlapped I/O event object not in signaled state.iz)Overlapped operation will complete later.izThe 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 gdZd6ddZddZdd Zd d Zd d ZddZ ddZ d7ddddddZ e e dr;d8ddZnd8ddZd8ddZddZd8dd Zd!d"Zejfd#d$Zd%d&Zfd'd(Zefd)d*Zefd+d,Ze jd-krd.d/Zd0d1Znd2d/Zd3d1Zd4e_d5e_ZS)9socket) __weakref___io_refs_closedNcCsP|dur|dkr t}|dkrt}|dkrd}tj|||||d|_d|_dS)Nr-rF)AF_INET SOCK_STREAM_socketr)__init__r+r,)selffamilytypeprotofilenorrrr1s zsocket.__init__cCs|Srrr2rrr __enter__szsocket.__enter__cGs|js |dSdSr)r,close)r2argsrrr__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(r6r3r4r5 getsocknamestrerrorZ getpeername)r2closedsZladdrZraddrrrr__repr__s>    zsocket.__repr__cCstd|jjd)Nzcannot pickle z object) TypeErrorr?r&r7rrr __getstate__zsocket.__getstate__cCs8 t|}|j|j|j|j|d}|||S)Nr6)dupr6r?r3r4r5 settimeout gettimeout)r2fdsockrrrrJs  z socket.dupcCsH |\}}t|j|j|j|d}tdur |r |d||fS)NrIT)Z_acceptr)r3r4r5ZgetdefaulttimeoutrL setblocking)r2rMaddrrNrrraccepts   z socket.acceptr)encodingerrorsnewlinec Cs t|hdkstd|fd|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>brRwz&invalid mode %r (only r, w, b allowed)rWrRrVr<r-rz!unbuffered streams must be binary) setrSocketIOr+ioDEFAULT_BUFFER_SIZEBufferedRWPairBufferedReaderBufferedWriter text_encoding TextIOWrappermode) r2rb bufferingrSrTrUZwritingZreadingZbinaryZrawmoderawbuffertextrrrmakefile.s@   zsocket.makefilesendfilerc Cs|||||}z|}Wnttjfy$}zt|d}~wwzt|j}Wnt y=}zt|d}~ww|sBdSt |pF|d}| } | dkrUt dt tdr_t} nt} | |tjd} | j} tj} ze | r~| | s~td|r|| }|dkrnrr4r/ isinstanceintrFformatrrrrrls  zsocket._check_sendfile_paramscCs4 z||||WSty||||YSwr)rr%rrrrrrhs  zsocket.sendfilecCs.|jdkr |jd8_|jr|dSdS)NrrX)r+r,r9r7rrr_decref_socketioss  zsocket._decref_socketioscCs||dSr)r9)r2Z_ssrrr _real_closeszsocket._real_closecCs d|_|jdkr|dSdS)NTr)r,r+rr7rrrr9s  z socket.closecs d|_tS)NT)r,superdetachr7r?rrrs z socket.detachc ttjtSr)rrr3rr7rrrr3z socket.familycrr)rrr4rr7rrrr4rz socket.typentcCt|Sr)roZget_handle_inheritabler6r7rrrget_inheritablezsocket.get_inheritablecCt||dSr)roZset_handle_inheritabler6r2 inheritablerrrset_inheritablerHzsocket.set_inheritablecCrr)rorr6r7rrrrrcCrr)rorr6rrrrrrHz&Get the inheritable flag of the socketz&Set the inheritable flag of the socket)r-r-r-N)rRNrN) r&r'r( __slots__r1r8r;rErGrJrQrgrtrorrrlrhrr0r)rr9rpropertyr3r4namerr__doc__ __classcell__rrrrr)sD   +  A $     r)cCs t|}t||||Sr)rJr))rMr3r4r5Znfdrrrr sr sendmsgc Cs" ||tjtjtd|fgSNi)rr0 SOL_SOCKET SCM_RIGHTSarray)rNbuffersfdsflagsaddressrrrsend_fds's rrecvmsgc Cs td}||t||j\}}}}|D]!\}} } |tjkr9| tjkr9|| dt| t| |jq|t |||fSr) rrr0CMSG_LENitemsizerr frombytesrlist) rNbufsizeZmaxfdsrrmsgancdatarP cmsg_level cmsg_type cmsg_datarrrrecv_fds3s  rZsharecCs tddd|S)Nr)r))inforrr fromshareGsr socketpaircCsh |durzt}Wn tyt}Ynwt|||\}}t||||}t||||}||fSr)AF_UNIX NameErrorr.r0rr)r)r3r4r5arVrrrrRs c Cs|tkrt}n |tkrt}ntd|tkrtd|dkr"tdt|||}zT||df|| dd\}}t|||}z'| dz | ||fWn t t fy^Ynw| d|\}} Wn|W|||fS|w)Nz?Only AF_INET and AF_INET6 socket address families are supportedz)Only SOCK_STREAM socket type is supportedrzOnly protocol zero is supportedFT)r. _LOCALHOSTAF_INET6 _LOCALHOST_V6rr/r)bindlistenr@rOconnectrxInterruptedErrorrQr9) r3r4r5hostZlsockrPportZcsockZssock_rrrrgs>     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 ddZddZddZddZd d Zfd d Zd dZ e ddZ e ddZ ddZ ZS)rZcCsZ|dvr td|tj|||_d|vr|d7}||_d|v|_d|v|_d|_dS)N)rRrWrwrbwbZrwbzinvalid mode: %rrVrRrWF) rr[ RawIOBaser1_sock_mode_reading_writing_timeout_occurred)r2rNrbrrrr1s     zSocketIO.__init__c Csx |||jrtd z|j|WSty#d|_ty;}z |jt vr6WYd}~dSd}~ww)Nz!cannot read from timed out objectT) _checkClosed_checkReadablerrrrZ recv_intor~rBerrno_blocking_errnosr2rVerrrreadintos"  zSocketIO.readintoc CsT ||z|j|WSty)}z |jtvr$WYd}~dSd}~wwr)r_checkWritablerrrBrrrrrrwrites zSocketIO.writecC |jrtd|jSNzI/O operation on closed socket.)rCrrr7rrrreadablezSocketIO.readablecCrr)rCrrr7rrrwritablerzSocketIO.writablecs |jrtdtSr)rCrrseekabler7rrrrs zSocketIO.seekablecCs ||jSr)rrr6r7rrrr6s zSocketIO.filenocCs|js|SdS)Nr-)rCr6r7rrrrsz SocketIO.namecCs|jSr)rr7rrrrbsz SocketIO.modecCs, |jrdStj||jd|_dSr)rCr[rr9rrr7rrrr9s    zSocketIO.close)r&r'r(r1rrrrrr6rrrbr9rrrrrrZs    rZr<cCsp |}|r |dkrt}z t|\}}}Wn ty!Y|Sw|d||D] }d|vr3|Sq*|}|S)Nz0.0.0.0r.)stripZ gethostnameZ gethostbyaddrrBinsert)rhostnamealiasesZipaddrsrrrr s$   r c Cs |\}}d}t||dtD]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_TIMEOUTrKrrrBr9)rr~Zsource_addressrrr|resafsocktyper5 canonnamesarNrrrrr (s4      r cCsx tr ttdr ttdsdSz"ttt}|ttd WdWdS1s*wYWdSt y;YdSw)N IPPROTO_IPV6 IPV6_V6ONLYFrT) has_ipv6rtr0r)rr/ setsockoptrrrB)rNrrrrUs ( rF)r3backlog reuse_portdualstack_ipv6c CsV |r ttds td|rtstd|tkrtdt|t}z|tjdvr@ttdr@z | t t dWn t y?Ynw|rI| t t dtrj|tkrj|rY| ttdnttd rjttd rj| ttdz||Wnt y}zd |j|f}t |j|dd}~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)rcygwin SO_REUSEADDRrXrrrz+%s (while attempting to bind on address %r))rtr0rrrr)r/rorrrrrBrrrrrstrerrorrrr9)rr3rrrrNr|rrrrr esZ       r c CsR g}t||||||D]}|\}} }} } |t|tt| t|| | fq |Sr)r0rappendrrr) rrr3r4r5rZaddrlistrrrrrrrrrs r)rr)r<)rrrr)2r0rosysr[ruenumrrr ImportErrorr>rrr __all__extend_get_exports_list _convert_r&rrrplatformlowerrr$r Exceptionr%r)r rtrrrrr/rr.rrrrZr objectrr rr rrrrrsR/         G        $ u - E