/snap/core24/1643/usr/lib/python3.12/test/support/__pycache__
Edit: /snap/core24/1643/usr/lib/python3.12/test/support/__pycache__/asyncore.cpython-312.pyc (24987B)
ЦiO d Z ddlZddlZddlZddlZddlZddlZddlmZm Z m
Z
mZmZm
Z
mZmZmZmZmZmZmZ eee
eeeeh Z e d Z G d de ZeeefZd Zd Z d Z!d
Z"ddZ#ddZ$e$Z%dd
Z& G d d Z' G d de' Z(d Z)ddZ*ejV dk( r G d d Z, G d de' Z-yy# e$ r i ZY xw xY w)a Basic infrastructure for asynchronous socket service clients and servers.
There are only two ways to have a program on a single processor do "more
than one thing at a time". Multi-threaded programming is the simplest and
most popular way to do it, but there is another very different technique,
that lets you have nearly all the advantages of multi-threading, without
actually using multiple threads. it's really only practical if your program
is largely I/O bound. If your program is CPU bound, then pre-emptive
scheduled threads are probably what you really need. Network servers are
rarely CPU-bound, however.
If your operating system supports the select() system call in its I/O
library (and nearly all do), then you can use it to juggle multiple
communication channels at once; doing other work while your I/O is taking
place in the "background." Although this strategy can seem strange and
complex, especially at first, it is in many ways easier to understand and
control than multi-threaded programming. The module documented here solves
many of the difficult problems for you, making the task of building
sophisticated high-performance network servers and clients a snap.
N)
EALREADYEINPROGRESSEWOULDBLOCK
ECONNRESETEINVALENOTCONN ESHUTDOWNEISCONNEBADFECONNABORTEDEPIPEEAGAIN errorcodec t j | S # t t t f$ r | t
v rt
| cY S d| z cY S w xY w)NzUnknown error %s)osstrerror
ValueError
OverflowError NameErrorr )errs ,/usr/lib/python3.12/test/support/asyncore.py _strerrorr J sI '{{3
y1 ')S>!!3&&'s %AAAc e Zd Zy)ExitNowN)__name__
__module____qualname__ r r r R s r r c f | j y # t $ r | j Y y xY wN)handle_read_event_reraised_exceptionshandle_errorobjs r readr' W 1
0c f | j y # t $ r | j Y y xY wr! )handle_write_eventr# r$ r% s r writer, _ s1
r) c f | j y # t $ r | j Y y xY wr! )handle_expt_eventr# r$ r% s r
_exceptionr/ g r( r) c 6 |t j z r| j |t j z r| j |t j
z r| j
|t j t j z t j z z r| j y y # t $ rB}|j t vr| j n| j Y d }~y Y d }~y d }~wt $ r | j Y y xY wr! )selectPOLLINr" POLLOUTr+ POLLPRIr. POLLHUPPOLLERRPOLLNVALhandle_closeOSErrorerrno
_DISCONNECTEDr$ r# )r&