/snap/core22/2437/usr/lib/python3.10/__pycache__
NameSizeModeActions
abc.cpython-310.pyc67510644editdlrm
aifc.cpython-310.pyc246850644editdlrm
antigravity.cpython-310.pyc8220644editdlrm
argparse.cpython-310.pyc635390644editdlrm
ast.cpython-310.pyc557390644editdlrm
asynchat.cpython-310.pyc70250644editdlrm
asyncore.cpython-310.pyc160020644editdlrm
base64.cpython-310.pyc171620644editdlrm
bdb.cpython-310.pyc258320644editdlrm
binhex.cpython-310.pyc128700644editdlrm
bisect.cpython-310.pyc25880644editdlrm
bz2.cpython-310.pyc108700644editdlrm
calendar.cpython-310.pyc263030644editdlrm
cgi.cpython-310.pyc267230644editdlrm
cgitb.cpython-310.pyc99980644editdlrm
chunk.cpython-310.pyc48600644editdlrm
cmd.cpython-310.pyc127070644editdlrm
code.cpython-310.pyc99570644editdlrm
codecs.cpython-310.pyc332190644editdlrm
codeop.cpython-310.pyc55950644editdlrm
colorsys.cpython-310.pyc32650644editdlrm
compileall.cpython-310.pyc127330644editdlrm
configparser.cpython-310.pyc454580644editdlrm
contextlib.cpython-310.pyc208950644editdlrm
contextvars.cpython-310.pyc2460644editdlrm
copy.cpython-310.pyc69960644editdlrm
copyreg.cpython-310.pyc46830644editdlrm
cProfile.cpython-310.pyc51130644editdlrm
crypt.cpython-310.pyc35500644editdlrm
csv.cpython-310.pyc117980644editdlrm
dataclasses.cpython-310.pyc265780644editdlrm
datetime.cpython-310.pyc565330644editdlrm
decimal.cpython-310.pyc3620644editdlrm
difflib.cpython-310.pyc589050644editdlrm
dis.cpython-310.pyc156560644editdlrm
doctest.cpython-310.pyc761750644editdlrm
enum.cpython-310.pyc260630644editdlrm
filecmp.cpython-310.pyc87490644editdlrm
fileinput.cpython-310.pyc140720644editdlrm
fnmatch.cpython-310.pyc42440644editdlrm
fractions.cpython-310.pyc186000644editdlrm
ftplib.cpython-310.pyc289770644editdlrm
functools.cpython-310.pyc283350644editdlrm
genericpath.cpython-310.pyc39070644editdlrm
getopt.cpython-310.pyc63390644editdlrm
getpass.cpython-310.pyc42100644editdlrm
gettext.cpython-310.pyc182210644editdlrm
glob.cpython-310.pyc58520644editdlrm
graphlib.cpython-310.pyc76160644editdlrm
gzip.cpython-310.pyc185460644editdlrm
hashlib.cpython-310.pyc68450644editdlrm
heapq.cpython-310.pyc138650644editdlrm
hmac.cpython-310.pyc69730644editdlrm
imaplib.cpython-310.pyc423120644editdlrm
imghdr.cpython-310.pyc39050644editdlrm
imp.cpython-310.pyc97860644editdlrm
inspect.cpython-310.pyc851530644editdlrm
io.cpython-310.pyc36630644editdlrm
ipaddress.cpython-310.pyc626700644editdlrm
keyword.cpython-310.pyc9270644editdlrm
linecache.cpython-310.pyc41420644editdlrm
locale.cpython-310.pyc461540644editdlrm
lzma.cpython-310.pyc121000644editdlrm
mailbox.cpython-310.pyc600910644editdlrm
mailcap.cpython-310.pyc73200644editdlrm
mimetypes.cpython-310.pyc176190644editdlrm
modulefinder.cpython-310.pyc161660644editdlrm
netrc.cpython-310.pyc39330644editdlrm
nntplib.cpython-310.pyc316230644editdlrm
ntpath.cpython-310.pyc147040644editdlrm
nturl2path.cpython-310.pyc17470644editdlrm
numbers.cpython-310.pyc118660644editdlrm
opcode.cpython-310.pyc54470644editdlrm
operator.cpython-310.pyc135080644editdlrm
optparse.cpython-310.pyc477540644editdlrm
os.cpython-310.pyc315990644editdlrm
pathlib.cpython-310.pyc420520644editdlrm
pdb.cpython-310.pyc474400644editdlrm
pickle.cpython-310.pyc468820644editdlrm
pickletools.cpython-310.pyc677600644editdlrm
pipes.cpython-310.pyc77690644editdlrm
pkgutil.cpython-310.pyc183610644editdlrm
platform.cpython-310.pyc274290644editdlrm
plistlib.cpython-310.pyc237650644editdlrm
poplib.cpython-310.pyc135730644editdlrm
posixpath.cpython-310.pyc105600644editdlrm
pprint.cpython-310.pyc178750644editdlrm
profile.cpython-310.pyc143910644editdlrm
pstats.cpython-310.pyc236210644editdlrm
pty.cpython-310.pyc41430644editdlrm
pyclbr.cpython-310.pyc97750644editdlrm
pydoc.cpython-310.pyc856450644editdlrm
py_compile.cpython-310.pyc73390644editdlrm
queue.cpython-310.pyc107920644editdlrm
quopri.cpython-310.pyc57940644editdlrm
random.cpython-310.pyc227480644editdlrm
re.cpython-310.pyc142270644editdlrm
reprlib.cpython-310.pyc52500644editdlrm
rlcompleter.cpython-310.pyc59540644editdlrm
runpy.cpython-310.pyc94110644editdlrm
sched.cpython-310.pyc61150644editdlrm
secrets.cpython-310.pyc21750644editdlrm
selectors.cpython-310.pyc171050644editdlrm
shelve.cpython-310.pyc94920644editdlrm
shlex.cpython-310.pyc77820644editdlrm
shutil.cpython-310.pyc385360644editdlrm
signal.cpython-310.pyc29350644editdlrm
site.cpython-310.pyc179220644editdlrm
sitecustomize.cpython-310.pyc2250644editdlrm
smtpd.cpython-310.pyc261470644editdlrm
smtplib.cpython-310.pyc357660644editdlrm
sndhdr.cpython-310.pyc69620644editdlrm
socket.cpython-310.pyc289630644editdlrm
socketserver.cpython-310.pyc253470644editdlrm
sre_compile.cpython-310.pyc151940644editdlrm
sre_constants.cpython-310.pyc63570644editdlrm
sre_parse.cpython-310.pyc217550644editdlrm
ssl.cpython-310.pyc452710644editdlrm
stat.cpython-310.pyc42730644editdlrm
statistics.cpython-310.pyc370510644editdlrm
string.cpython-310.pyc71020644editdlrm
stringprep.cpython-310.pyc170750644editdlrm
struct.cpython-310.pyc3070644editdlrm
subprocess.cpython-310.pyc447410644editdlrm
sunau.cpython-310.pyc164820644editdlrm
symtable.cpython-310.pyc128350644editdlrm
sysconfig.cpython-310.pyc181510644editdlrm
tabnanny.cpython-310.pyc69500644editdlrm
tarfile.cpython-310.pyc706740644editdlrm
telnetlib.cpython-310.pyc185060644editdlrm
tempfile.cpython-310.pyc273390644editdlrm
textwrap.cpython-310.pyc138120644editdlrm
this.cpython-310.pyc12640644editdlrm
threading.cpython-310.pyc449690644editdlrm
timeit.cpython-310.pyc117690644editdlrm
token.cpython-310.pyc27380644editdlrm
tokenize.cpython-310.pyc171940644editdlrm
trace.cpython-310.pyc198700644editdlrm
traceback.cpython-310.pyc217120644editdlrm
tracemalloc.cpython-310.pyc175250644editdlrm
tty.cpython-310.pyc10790644editdlrm
turtle.cpython-310.pyc1288570644editdlrm
types.cpython-310.pyc95250644editdlrm
typing.cpython-310.pyc852770644editdlrm
uu.cpython-310.pyc38670644editdlrm
uuid.cpython-310.pyc224980644editdlrm
warnings.cpython-310.pyc136460644editdlrm
wave.cpython-310.pyc175940644editdlrm
weakref.cpython-310.pyc203430644editdlrm
webbrowser.cpython-310.pyc170000644editdlrm
xdrlib.cpython-310.pyc78800644editdlrm
zipapp.cpython-310.pyc60130644editdlrm
zipfile.cpython-310.pyc618450644editdlrm
zipimport.cpython-310.pyc170330644editdlrm
_aix_support.cpython-310.pyc28790644editdlrm
_bootsubprocess.cpython-310.pyc22940644editdlrm
_collections_abc.cpython-310.pyc329250644editdlrm
_compat_pickle.cpython-310.pyc58720644editdlrm
_compression.cpython-310.pyc45120644editdlrm
_distutils_system_mod.cpython-310.pyc54220644editdlrm
_markupbase.cpython-310.pyc75720644editdlrm
_osx_support.cpython-310.pyc115350644editdlrm
_pydecimal.cpython-310.pyc1577360644editdlrm
_pyio.cpython-310.pyc736540644editdlrm
_py_abc.cpython-310.pyc46830644editdlrm
_sitebuiltins.cpython-310.pyc35470644editdlrm
_strptime.cpython-310.pyc159450644editdlrm
_sysconfigdata__linux_x86_64-linux-gnu.cpython-310.pyc353850644editdlrm
_sysconfigdata__x86_64-linux-gnu.cpython-310.pyc353790644editdlrm
_threading_local.cpython-310.pyc65390644editdlrm
_weakrefset.cpython-310.pyc76080644editdlrm
__future__.cpython-310.pyc41310644editdlrm
__phello__.foo.cpython-310.pyc1300644editdlrm
Edit: /snap/core22/2437/usr/lib/python3.10/__pycache__/socket.cpython-310.pyc (28963B)
o p̦i@sTdZddlZddlTddlZddlZddlZddlZddlmZmZzddl Z Wn e y3dZ Ynwe e ddZ e e ddZ e e d dZgd Zeeeed ed d ededd ededd ededd dZdZddZejdr iZded<ded<ded<ded <d!ed"<d#ed$<d%ed&<d'ed(<d)ed*<d+ed,<d-ed.<d/ed0<d1ed2<d3ed4<d5ed6<d7ed8<d9ed:<d;ed<<d=ed><d?ed@<dAedB<dCedD<dEedF<dGedH<dIedJ<dKedL<dMedN<dOedP<dQedR<dSedT<dUedV<dWedX<dYedZ<d[ed\<d]ed^<d_ed`<daedb<dcedd<deedf<dgedh<diedj<dkedl<dmedn<doedp<dqedr<dsedt<duedv<dwedx<dyedz<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<ded<edաGddׄdeZGddلdejZdddۄZe ejd܃r5ddl!Z!dddބZ"edޡe ejd߃rJddl!Z!dddZ#ede ejdrZddZ$ede edride%dfddZ&n e'e%dfddZ&edde&_e ehZ(Gdddej)Z*dddZ+e,Z-e-dfddZ.ddZ/e'ddddddZ0dddZ1dS)aThis module provides socket operations and some related functions. On Unix, it supports IP (Internet Protocol) and Unix domain sockets. On other systems, it only supports IP. Functions specific for a socket are available as methods of the socket object. Functions: socket() -- create a new socket object socketpair() -- create a pair of new socket objects [*] fromfd() -- create a socket object from an open file descriptor [*] send_fds() -- Send file descriptor to the socket. recv_fds() -- Recieve file descriptors from the socket. fromshare() -- create a socket object from data received from socket.share() [*] gethostname() -- return the current hostname gethostbyname() -- map a hostname to its IP number gethostbyaddr() -- map an IP number or hostname to DNS info getservbyname() -- map a service name and a protocol name to a port number getprotobyname() -- map a protocol name (e.g. 'tcp') to a number ntohs(), ntohl() -- convert 16, 32 bit int from network to host byte order htons(), htonl() -- convert 16, 32 bit int from host to network byte order inet_aton() -- convert IP addr string (123.45.67.89) to 32-bit packed format inet_ntoa() -- convert 32-bit packed format IP to string (123.45.67.89) socket.getdefaulttimeout() -- get the default timeout value socket.setdefaulttimeout() -- set the default timeout value create_connection() -- connects to an address, with an optional timeout and optional source address. [*] not available on all platforms! Special objects: SocketType -- type object for socket objects error -- exception raised for I/O errors has_ipv6 -- boolean value indicating if IPv6 is supported IntEnum constants: AF_INET, AF_UNIX -- socket domains (first argument to socket() call) SOCK_STREAM, SOCK_DGRAM, SOCK_RAW -- socket types (second argument) Integer constants: Many other constants may be defined; these may be used in calls to the setsockopt() and getsockopt() methods. N)*)IntEnumIntFlagEBADF EAGAIN EWOULDBLOCK)fromfdgetfqdncreate_connection create_serverhas_dualstack_ipv6 AddressFamily SocketKindrcC|o|dS)NAF_isupper startswithCr/usr/lib/python3.10/socket.pyNrrcCr)NSOCK_rrrrrrSrMsgFlagcCr)NMSG_rrrrrrXr AddressInfocCr)NAI_rrrrrr]rz 127.0.0.1z::1cCs"z||WSty|YSw)z{Convert a numeric family value to an IntEnum member. If it's not a known member, return the numeric value itself. ) ValueError)value 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.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(eZdZdZgdZd7ddZddZd d Zd d Zd dZ ddZ ddZ d8ddddddZ e edr) getattr __class__r,r-r;r8r9r: getsocknamestrerror getpeername)r7closedsladdrraddrrrr__repr__s<    zsocket.__repr__cCstd|jjd)Nzcannot pickle z object) TypeErrorrEr+r=rrr __getstate__zsocket.__getstate__cCs6t|}|j|j|j|j|d}|||S)zdup() -> socket object Duplicate the socket. Return a new socket object connected to the same system resource. The new socket is non-inheritable. r;)dupr;rEr8r9r: settimeout gettimeout)r7fdsockrrrrSs z socket.dupcCsF|\}}t|j|j|j|d}tdur|r|d||fS)zaccept() -> (socket object, address info) Wait for an incoming connection. Return a new socket representing the connection, and the address of the client. For IP sockets, the address info is a pair (hostaddr, port). rRNT)_acceptr.r8r9r:getdefaulttimeoutrU setblocking)r7rVaddrrWrrraccepts  z socket.acceptr)encodingerrorsnewlinec Cst|hdkstd|fd|v}d|vp| }|s |s Jd|v}d} |r,| d7} |r2| d7} t|| } |jd7_|durDd }|d krKtj}|d krW|sUtd | S|rc|rct| | |} n|rlt| |} n |spJt| |} |rz| St |}t | |||} || _ | S) zmakefile(...) -> an I/O stream connected to the socket The arguments are as for io.open() after the filename, except the only supported mode values are 'r' (default), 'w' and 'b'. >br]wz&invalid mode %r (only r, w, b allowed)rbr]rarBNr2rz!unbuffered streams must be binary) setr!SocketIOr0ioDEFAULT_BUFFER_SIZEBufferedRWPairBufferedReaderBufferedWriter text_encoding TextIOWrappermode) r7rm bufferingr^r_r`writingreadingbinaryrawmoderawbuffertextrrrmakefile.sB    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|| }|dkrn sent Send a file until EOF is reached by using high-performance os.sendfile() and return the total number of bytes which were sent. *file* must be a regular file object opened in binary mode. If os.sendfile() is not available (e.g. Windows) or file is not a regular file socket.send() will be used instead. *offset* tells from where to start reading the file. If specified, *count* is the total number of bytes to transmit as opposed to sending the file until EOF is reached. File position is updated on return or also in case of error in which case file.tell() can be used to figure out the number of bytes which were sent. The socket must be of SOCK_STREAM type. Non-blocking sockets are not supported. )rr*rrrrrrws  zsocket.sendfilecCs.|jdkr |jd8_|jr|dSdS)Nrrc)r0r1r?r=rrr_decref_socketioss  zsocket._decref_socketioscCs||dSr<)r?)r7_ssrrr _real_closeszsocket._real_closecCs d|_|jdkr|dSdS)NTr)r1r0rr=rrrr?s  z socket.closecsd|_tS)a detach() -> file descriptor Close the socket object without closing the underlying file descriptor. The object cannot be used after this call, but the file descriptor can be reused for other purposes. The file descriptor is returned. T)r1superdetachr=rErrrs z socket.detachcttjtS)z@Read-only access to the address family for this socket. )r$rr8rr=rrrr8z socket.familycr)z-Read-only access to the socket type. )r$rr9rr=rrrr9rz socket.typentcCt|Sr<)r~get_handle_inheritabler;r=rrrget_inheritablezsocket.get_inheritablecCt||dSr<)r~set_handle_inheritabler;r7 inheritablerrrset_inheritablerQzsocket.set_inheritablecCrr<)r~rr;r=rrrrrcCrr<)r~rr;rrrrrrQz&Get the inheritable flag of the socketz&Set the inheritable flag of the socket)r2r2r2N)r]NrN) r+r,r-__doc__ __slots__r6r>rArNrPrSr\rvrr~rrr{rwrr5r.rr?rpropertyr8r9namerr __classcell__rrrrr.sD   +  A $     r.cCst|}t||||S)z fromfd(fd, family, type[, proto]) -> socket object Create a socket object from a duplicate of the given file descriptor. The remaining arguments are the same as for socket(). )rSr.)rVr8r9r:nfdrrrr sr sendmsgc Cs ||tjtjtd|fgS)z send_fds(sock, buffers, fds[, flags[, address]]) -> integer Send the list of file descriptors fds over an AF_UNIX socket. i)rr5 SOL_SOCKET SCM_RIGHTSarray)rWbuffersfdsflagsaddressrrrsend_fds's rrecvmsgc Cstd}||t||j\}}}}|D]!\}} } |tjkr8| tjkr8|| dt| t| |jq|t |||fS)z recv_fds(sock, bufsize, maxfds[, flags]) -> (data, list of file descriptors, msg_flags, address) Receive up to maxfds file descriptors returning the message data and a list containing the descriptors. rN) rrr5CMSG_LENitemsizerr frombytesrlist) rWbufsizemaxfdsrrmsgancdatar[ cmsg_level cmsg_type cmsg_datarrrrecv_fds3s  rsharecCstddd|S)z fromshare(info) -> socket object Create a socket object from the bytes object returned by socket.share(pid). r)r.)inforrr fromshareGsr socketpaircCsf|durzt}Wn tyt}Ynwt|||\}}t||||}t||||}||fS)aasocketpair([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. N)AF_UNIX NameErrorr3r5rr.r)r8r9r:ararrrrRs 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)r3 _LOCALHOSTAF_INET6 _LOCALHOST_V6r!r4r.bindlistenrFrZconnectrInterruptedErrorr\r?) r8r9r:hostlsockr[portcsockssock_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. cspeZdZdZddZddZddZdd Zd d Zfd d Z ddZ e ddZ e ddZ ddZZS)rezRaw 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|dvr td|tj|||_d|vr|d7}||_d|v|_d|v|_d|_dS)N)r]rbrwrbwbrwbzinvalid mode: %rrar]rbF) r!rf RawIOBaser6_sock_mode_reading_writing_timeout_occurred)r7rWrmrrrr6s     zSocketIO.__init__c Csv|||jrtd z|j|WSty"d|_ty:}z |jt vr5WYd}~dSd}~ww)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 objectTN) _checkClosed_checkReadablerrr recv_intorrHerrno_blocking_errnosr7raerrrreadintos   zSocketIO.readintoc CsR||z|j|WSty(}z |jtvr#WYd}~dSd}~ww)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. N)r_checkWritablerrrHrrrrrrwrites zSocketIO.writecC|jrtd|jS)z2True if the SocketIO is open for reading. I/O operation on closed socket.)rJr!rr=rrrreadablezSocketIO.readablecCr)z2True if the SocketIO is open for writing. r)rJr!rr=rrrwritablerzSocketIO.writablecs|jrtdtS)z2True if the SocketIO is open for seeking. r)rJr!rseekabler=rrrrs zSocketIO.seekablecCs||jS)z=Return the file descriptor of the underlying socket. )rrr;r=rrrr;s zSocketIO.filenocCs|js|SdS)Nr2)rJr;r=rrrrsz SocketIO.namecCs|jSr<)rr=rrrrmsz SocketIO.modecCs*|jrdStj||jd|_dS)zClose the SocketIO object. This doesn't close the underlying socket, except if all references to it have disappeared. N)rJrfrr?rrr=rrrr?s    zSocketIO.close)r+r,r-rr6rrrrrr;rrrmr?rrrrrres    rerBcCsn|}|r |dvr t}z t|\}}}Wn ty Y|Sw|d||D] }d|vr2|Sq)|}|S)azGet fully qualified domain name from name. An empty argument is interpreted as meaning the local host. First the hostname returned by gethostbyaddr() is checked, then possibly existing aliases. In case no FQDN is available and `name` was given, it is returned unchanged. If `name` was empty, '0.0.0.0' or '::', hostname from gethostname() is returned. )z0.0.0.0z::r.)strip gethostname gethostbyaddrrHinsert)rhostnamealiasesipaddrsrrrr s"   r c Cs|\}}d}t||dtD]I}|\}}} } } d} z"t||| } |tur(| ||r/| || | d}| WStyV} z| }| durL| WYd} ~ q d} ~ ww|duraz|d}wtd)acConnect to *address* and return the socket object. Convenience function. Connect to *address* (a 2-tuple ``(host, port)``) and return the socket object. Passing the optional *timeout* parameter will set the timeout on the socket instance before attempting to connect. If no *timeout* is supplied, the global default timeout setting returned by :func:`getdefaulttimeout` is used. If *source_address* is set it must be a tuple of (host, port) for the socket to bind as a source address before making the connection. A host of '' or port 0 tells the OS to use the default. Nrz!getaddrinfo returns an empty list) getaddrinfor4r._GLOBAL_DEFAULT_TIMEOUTrTrrrHr?)rrsource_addressrrrresafsocktyper: canonnamesarWrrrrr (s2     r cCsvtr ttdr ttdsdSz"ttt}|ttd WdWdS1s)wYWdSt y:YdSw)zReturn True if the platform supports creating a SOCK_STREAM socket which can handle both AF_INET and AF_INET6 (IPv4 / IPv6) connections. IPPROTO_IPV6 IPV6_V6ONLYFrNT) has_ipv6rr5r.rr4 setsockoptrrrH)rWrrrrUs ( rF)r8backlog reuse_portdualstack_ipv6c CsT|r ttds td|rtstd|tkrtdt|t}z|tjdvr?ttdr?z | t t dWn t y>Ynw|rH| t t dtri|tkri|rX| ttdnttd rittd ri| ttdz||Wnt y}zd |j|f}t |j|d d }~ww|d ur||WS|||WSt y|w) aConvenience function which creates a SOCK_STREAM type socket bound to *address* (a 2-tuple (host, port)) and return the socket object. *family* should be either AF_INET or AF_INET6. *backlog* is the queue size passed to socket.listen(). *reuse_port* dictates whether to use the SO_REUSEPORT socket option. *dualstack_ipv6*: if true and the platform supports it, it will create an AF_INET6 socket able to accept both IPv4 or IPv6 connections. When false it will explicitly disable this option on platforms that enable it by default (e.g. Linux). >>> with create_server(('', 8000)) as server: ... while True: ... conn, addr = server.accept() ... # handle new connection SO_REUSEPORTz+SO_REUSEPORT not supported on this platformz-dualstack_ipv6 not supported on this platformz'dualstack_ipv6 requires AF_INET6 family)rcygwin SO_REUSEADDRrcrrrz+%s (while attempting to bind on address %r)N)rr5r!rrr.r4r~rrrrrHrrrrrstrerrorrrr?)rr8rrrrWrrrrrr esX       r c CsPg}t||||||D]}|\}} }} } |t|tt| t|| | fq |S)aResolve host and port into list of address info entries. Translate the host/port argument into a sequence of 5-tuples that contain all the necessary arguments for creating a socket connected to that service. host is a domain name, a string representation of an IPv4/v6 address or None. port is a string service name such as 'http', a numeric port number or None. By passing None as the value of host and port, you can pass NULL to the underlying C API. The family, type and proto arguments can be optionally specified in order to narrow the list of addresses returned. Passing zero as a value for each of these arguments selects the full range of results. )r5r appendr$rr) rrr8r9r:raddrlistrrrrrrrrr s r )rr)rB)rrrr)2rr5r~sysrfrenumrrr ImportErrorrDrrr __all__extend_get_exports_list _convert_r+rrr$platformlowerrr)r Exceptionr*r.r rrrrrr4rr3rrrer objectr r rr r rrrrsR/         G        $ u - E