/snap/core18/2979/usr/lib/python3.6/__pycache__
NameSizeModeActions
abc.cpython-36.pyc75150644editdlrm
aifc.cpython-36.pyc259430644editdlrm
antigravity.cpython-36.pyc7790644editdlrm
argparse.cpython-36.pyc604560644editdlrm
ast.cpython-36.pyc117040644editdlrm
asynchat.cpython-36.pyc68150644editdlrm
asyncore.cpython-36.pyc158380644editdlrm
base64.cpython-36.pyc170590644editdlrm
bdb.cpython-36.pyc170330644editdlrm
binhex.cpython-36.pyc120860644editdlrm
bisect.cpython-36.pyc26760644editdlrm
bz2.cpython-36.pyc112820644editdlrm
calendar.cpython-36.pyc258820644editdlrm
cgi.cpython-36.pyc284160644editdlrm
cgitb.cpython-36.pyc100800644editdlrm
chunk.cpython-36.pyc49000644editdlrm
cmd.cpython-36.pyc125750644editdlrm
code.cpython-36.pyc98360644editdlrm
codecs.cpython-36.pyc339000644editdlrm
codeop.cpython-36.pyc62700644editdlrm
colorsys.cpython-36.pyc33110644editdlrm
compileall.cpython-36.pyc82780644editdlrm
configparser.cpython-36.pyc452440644editdlrm
contextlib.cpython-36.pyc111580644editdlrm
copy.cpython-36.pyc70790644editdlrm
copyreg.cpython-36.pyc42440644editdlrm
cProfile.cpython-36.pyc42940644editdlrm
crypt.cpython-36.pyc22420644editdlrm
csv.cpython-36.pyc118550644editdlrm
datetime.cpython-36.pyc545110644editdlrm
decimal.cpython-36.pyc3510644editdlrm
difflib.cpython-36.pyc596420644editdlrm
dis.cpython-36.pyc141810644editdlrm
doctest.cpython-36.pyc755890644editdlrm
dummy_threading.cpython-36.pyc11020644editdlrm
enum.cpython-36.pyc234530644editdlrm
filecmp.cpython-36.pyc83050644editdlrm
fileinput.cpython-36.pyc131520644editdlrm
fnmatch.cpython-36.pyc28740644editdlrm
formatter.cpython-36.pyc175790644editdlrm
fractions.cpython-36.pyc184260644editdlrm
ftplib.cpython-36.pyc283570644editdlrm
functools.cpython-36.pyc240620644editdlrm
genericpath.cpython-36.pyc37260644editdlrm
getopt.cpython-36.pyc62170644editdlrm
getpass.cpython-36.pyc41770644editdlrm
gettext.cpython-36.pyc143060644editdlrm
glob.cpython-36.pyc42590644editdlrm
gzip.cpython-36.pyc162260644editdlrm
hashlib.cpython-36.pyc66920644editdlrm
heapq.cpython-36.pyc142920644editdlrm
hmac.cpython-36.pyc48360644editdlrm
imaplib.cpython-36.pyc421380644editdlrm
imghdr.cpython-36.pyc41500644editdlrm
imp.cpython-36.pyc96960644editdlrm
inspect.cpython-36.pyc797390644editdlrm
io.cpython-36.pyc33870644editdlrm
ipaddress.cpython-36.pyc623860644editdlrm
keyword.cpython-36.pyc17650644editdlrm
linecache.cpython-36.pyc37780644editdlrm
locale.cpython-36.pyc340300644editdlrm
lzma.cpython-36.pyc119920644editdlrm
macpath.cpython-36.pyc56410644editdlrm
macurl2path.cpython-36.pyc18670644editdlrm
mailbox.cpython-36.pyc637520644editdlrm
mailcap.cpython-36.pyc72090644editdlrm
mimetypes.cpython-36.pyc155530644editdlrm
modulefinder.cpython-36.pyc153660644editdlrm
netrc.cpython-36.pyc38360644editdlrm
nntplib.cpython-36.pyc337800644editdlrm
ntpath.cpython-36.pyc131900644editdlrm
nturl2path.cpython-36.pyc14990644editdlrm
numbers.cpython-36.pyc121420644editdlrm
opcode.cpython-36.pyc54130644editdlrm
operator.cpython-36.pyc139130644editdlrm
optparse.cpython-36.pyc480540644editdlrm
os.cpython-36.pyc296280644editdlrm
pathlib.cpython-36.pyc420070644editdlrm
pdb.cpython-36.pyc460940644editdlrm
pickle.cpython-36.pyc426910644editdlrm
pickletools.cpython-36.pyc660200644editdlrm
pipes.cpython-36.pyc78080644editdlrm
pkgutil.cpython-36.pyc162610644editdlrm
platform.cpython-36.pyc291970644editdlrm
plistlib.cpython-36.pyc280550644editdlrm
poplib.cpython-36.pyc133290644editdlrm
posixpath.cpython-36.pyc104560644editdlrm
pprint.cpython-36.pyc158240644editdlrm
profile.cpython-36.pyc139010644editdlrm
pstats.cpython-36.pyc218570644editdlrm
pty.cpython-36.pyc38610644editdlrm
pyclbr.cpython-36.pyc83650644editdlrm
pydoc.cpython-36.pyc837750644editdlrm
py_compile.cpython-36.pyc65440644editdlrm
queue.cpython-36.pyc87550644editdlrm
quopri.cpython-36.pyc57730644editdlrm
random.cpython-36.pyc193300644editdlrm
re.cpython-36.pyc140580644editdlrm
reprlib.cpython-36.pyc54000644editdlrm
rlcompleter.cpython-36.pyc57800644editdlrm
runpy.cpython-36.pyc79820644editdlrm
sched.cpython-36.pyc65640644editdlrm
secrets.cpython-36.pyc21620644editdlrm
selectors.cpython-36.pyc176970644editdlrm
shelve.cpython-36.pyc94580644editdlrm
shlex.cpython-36.pyc69700644editdlrm
shutil.cpython-36.pyc307040644editdlrm
signal.cpython-36.pyc25150644editdlrm
site.cpython-36.pyc165600644editdlrm
sitecustomize.cpython-36.pyc2120644editdlrm
smtpd.cpython-36.pyc266830644editdlrm
smtplib.cpython-36.pyc353400644editdlrm
sndhdr.cpython-36.pyc69130644editdlrm
socket.cpython-36.pyc220130644editdlrm
socketserver.cpython-36.pyc242500644editdlrm
sre_compile.cpython-36.pyc102780644editdlrm
sre_constants.cpython-36.pyc59720644editdlrm
sre_parse.cpython-36.pyc203580644editdlrm
ssl.cpython-36.pyc369390644editdlrm
stat.cpython-36.pyc38510644editdlrm
statistics.cpython-36.pyc181740644editdlrm
string.cpython-36.pyc79640644editdlrm
stringprep.cpython-36.pyc100300644editdlrm
struct.cpython-36.pyc3120644editdlrm
subprocess.cpython-36.pyc354850644editdlrm
sunau.cpython-36.pyc169380644editdlrm
symbol.cpython-36.pyc25170644editdlrm
symtable.cpython-36.pyc104280644editdlrm
sysconfig.cpython-36.pyc159160644editdlrm
tabnanny.cpython-36.pyc69750644editdlrm
tarfile.cpython-36.pyc630850644editdlrm
telnetlib.cpython-36.pyc180970644editdlrm
tempfile.cpython-36.pyc253090644editdlrm
textwrap.cpython-36.pyc136840644editdlrm
this.cpython-36.pyc12650644editdlrm
threading.cpython-36.pyc372340644editdlrm
timeit.cpython-36.pyc116030644editdlrm
token.cpython-36.pyc33200644editdlrm
tokenize.cpython-36.pyc186470644editdlrm
trace.cpython-36.pyc194950644editdlrm
traceback.cpython-36.pyc196460644editdlrm
tracemalloc.cpython-36.pyc172290644editdlrm
tty.cpython-36.pyc10720644editdlrm
turtle.cpython-36.pyc1317510644editdlrm
types.cpython-36.pyc82010644editdlrm
typing.cpython-36.pyc733060644editdlrm
uu.cpython-36.pyc34980644editdlrm
uuid.cpython-36.pyc209180644editdlrm
warnings.cpython-36.pyc132580644editdlrm
wave.cpython-36.pyc178850644editdlrm
weakref.cpython-36.pyc191430644editdlrm
webbrowser.cpython-36.pyc157970644editdlrm
xdrlib.cpython-36.pyc83020644editdlrm
zipapp.cpython-36.pyc55340644editdlrm
zipfile.cpython-36.pyc497280644editdlrm
_bootlocale.cpython-36.pyc9800644editdlrm
_collections_abc.cpython-36.pyc287970644editdlrm
_compat_pickle.cpython-36.pyc65660644editdlrm
_compression.cpython-36.pyc41040644editdlrm
_dummy_thread.cpython-36.pyc48510644editdlrm
_markupbase.cpython-36.pyc79910644editdlrm
_osx_support.cpython-36.pyc96840644editdlrm
_pydecimal.cpython-36.pyc1634020644editdlrm
_pyio.cpython-36.pyc713860644editdlrm
_sitebuiltins.cpython-36.pyc34350644editdlrm
_strptime.cpython-36.pyc159630644editdlrm
_sysconfigdata_m_linux_x86_64-linux-gnu.cpython-36.pyc187790644editdlrm
_threading_local.cpython-36.pyc64250644editdlrm
_weakrefset.cpython-36.pyc78280644editdlrm
__future__.cpython-36.pyc41670644editdlrm
__phello__.foo.cpython-36.pyc1190644editdlrm
Edit: /snap/core18/2979/usr/lib/python3.6/__pycache__/asyncore.cpython-36.pyc (15838B)
3 NqiN @shdZddlZddlZddlZddlZddlZddlZddlmZm Z m Z m Z m Z m Z mZmZmZmZmZmZmZee e eeeehZyeWnek riZYnXddZGdddeZeeefZdd Zd d Z d d Z!ddZ"d&ddZ#d'ddZ$e$Z%d(ddZ&GdddZ'Gddde'Z(ddZ)d)dd Z*ej+d!krdGd"d#d#Z,Gd$d%d%e'Z-dS)*aBasic 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) EALREADY EINPROGRESS EWOULDBLOCK ECONNRESETEINVALENOTCONN ESHUTDOWNEISCONNEBADF ECONNABORTEDEPIPEEAGAIN errorcodec Cs>y tj|Stttfk r8|tkr0t|Sd|SXdS)NzUnknown error %s)osstrerror ValueError OverflowError NameErrorr)errr/usr/lib/python3.6/asyncore.py _strerrorDs  rc@s eZdZdS)ExitNowN)__name__ __module__ __qualname__rrrrrLsrc Cs:y |jWn(tk r"Yn|jYnXdS)N)handle_read_event_reraised_exceptions handle_error)objrrrreadQs  r c Cs:y |jWn(tk r"Yn|jYnXdS)N)handle_write_eventrr)rrrrwriteYs  r"c Cs:y |jWn(tk r"Yn|jYnXdS)N)handle_expt_eventrr)rrrr _exceptionas  r$cCsyX|tj@r|j|tj@r&|j|tj@r8|j|tjtjBtj B@rV|j Wnht k r}z&|j dt kr|jn|j WYdd}~Xn(tk rYn|jYnXdS)Nr)selectPOLLINrPOLLOUTr!POLLPRIr#ZPOLLHUPZPOLLERRZPOLLNVAL handle_closeOSErrorargs _DISCONNECTEDrr)rflagserrr readwriteis"     r/c CsN|dkr t}|rJg}g}g}x^t|jD]N\}}|j}|j}|rR|j||rh|j rh|j||sp|r,|j|q,Wg|ko|ko|knrtj|dSt j ||||\}}}x(|D] }|j |}|dkrqt |qWx*|D]"}|j |}|dkrqt |qWx.|D]&}|j |}|dkr<q t |q WdS)N) socket_maplistitemsreadablewritableappend acceptingtimeZsleepr%getr r"r$) timeoutmaprwr.fdrZis_rZis_wrrrpoll}sD   "           r?cCs|dkr t}|dk r t|d}tj}|rx^t|jD]N\}}d}|jr^|tjtjBO}|j rx|j rx|tj O}|r:|j ||q:W|j|}x.|D]&\}}|j |}|dkrqt||qWdS)Nir)r1intr%r?r2r3r4r&r(r5r7r'registerr9r/)r:r;Zpollsterr>rr-r<rrrpoll2s(    rB>@FcCsj|dkr t}|r ttdr t}nt}|dkrBx8|r>|||q.Wn$x"|rd|dkrd||||d}qDWdS)Nr?r)r1hasattrr%rBr?)r:Zuse_pollr;countZpoll_funrrrloops rGc@s6eZdZdZdZdZdZdZdZe dhZ dAddZ ddZ e Z dBdd ZdCd d Zejejfd d ZdDddZddZddZddZddZddZddZddZddZd d!Zd"d#Zd$d%ZdEd'd(Z d)d*Z!d+d,Z"d-d.Z#d/d0Z$d1d2Z%d3d4Z&d5d6Z'd7d8Z(d9d:Z)d;d<Z*d=d>Z+d?d@Z,dS)F dispatcherFNwarningcCs|dkrt|_n||_d|_|r|jd|j||d|_y|j|_Wqtk r}z,|j dt t fkrvd|_n |j |WYdd}~XqXnd|_ dS)NrTF)r1_map_fileno setblocking set_socket connectedZ getpeernameaddrr*r+rr del_channelsocket)selfsockr;rrrr__init__s    zdispatcher.__init__c Cs|jjd|jjg}|jr.|jr.|jdn|jr>|jd|jdk ry|jd|jWn$tk r|jt|jYnXddj |t |fS)N.Z listeningrNz%s:%dz <%s at %#x> ) __class__rrr7rOr6rN TypeErrorreprjoinid)rRZstatusrrr__repr__s    zdispatcher.__repr__cCs|dkr|j}|||j<dS)N)rJrK)rRr;rrr add_channel szdispatcher.add_channelcCs,|j}|dkr|j}||kr"||=d|_dS)N)rKrJ)rRr;r>rrrrPs zdispatcher.del_channelcCs.||f|_tj||}|jd|j|dS)Nr)Zfamily_and_typerQrLrM)rRZfamilytyperSrrr create_sockets   zdispatcher.create_socketcCs||_|j|_|j|dS)N)rQfilenorKr])rRrSr;rrrrM s zdispatcher.set_socketc CsDy*|jjtjtj|jjtjtjdBWntk r>YnXdS)NrD)rQZ setsockopt SOL_SOCKETZ SO_REUSEADDR getsockoptr*)rRrrrset_reuse_addr&s zdispatcher.set_reuse_addrcCsdS)NTr)rRrrrr47szdispatcher.readablecCsdS)NTr)rRrrrr5:szdispatcher.writablecCs(d|_tjdkr|dkrd}|jj|S)NTnt)r7rnamerQlisten)rRZnumrrrrgAszdispatcher.listencCs||_|jj|S)N)rOrQbind)rRrOrrrrhGszdispatcher.bindcCspd|_d|_|jj|}|tttfks8|tkrBtj dkrB||_ dS|dt fkr^||_ |j nt |t|dS)NFTrdr)rN connectingrQZ connect_exrrrrrrfrOr handle_connect_eventr*r)rRZaddressrrrrconnectKs   zdispatcher.connectcCsny|jj\}}WnNtk r&dStk r`}z |jdtttfkrNdSWYdd}~Xn X||fSdS)Nr)rQacceptrXr*r+rr r )rRZconnrOwhyrrrrlYszdispatcher.acceptcCsfy|jj|}|Stk r`}z4|jdtkr4dS|jdtkrN|jdSWYdd}~XnXdS)Nr)rQsendr*r+rr,r))rRdataresultrmrrrrngs zdispatcher.sendcCshy$|jj|}|s|jdS|SWn>tk rb}z"|jdtkrP|jdSWYdd}~XnXdS)Nr)rQrecvr)r*r+r,)rR buffer_sizerormrrrrrts zdispatcher.recvcCsnd|_d|_d|_|j|jdk rjy|jjWn6tk rh}z|jdtt fkrXWYdd}~XnXdS)NFr) rNr7rirPrQcloser*r+rr )rRrmrrrrts zdispatcher.closecCstjjdt|dS)Nzlog: %s )sysstderrr"str)rRmessagerrrlogszdispatcher.loginfocCs||jkrtd||fdS)Nz%s: %s)ignore_log_typesprint)rRrxr^rrrlog_infos zdispatcher.log_infocCs:|jr|jn&|js.|jr$|j|jn|jdS)N)r7 handle_acceptrNrirj handle_read)rRrrrrs  zdispatcher.handle_read_eventcCs@|jjtjtj}|dkr(t|t||jd|_d|_dS)NrTF) rQrbraSO_ERRORr*rhandle_connectrNri)rRrrrrrjs zdispatcher.handle_connect_eventcCs*|jr dS|js|jr|j|jdS)N)r7rNrirj handle_write)rRrrrr!s zdispatcher.handle_write_eventcCs0|jjtjtj}|dkr$|jn|jdS)Nr)rQrbrarr) handle_expt)rRrrrrr#s zdispatcher.handle_expt_eventc CsXt\}}}}y t|}Wndt|}YnX|jd||||fd|jdS)Nz)<__repr__(self) failed for object at %0x>z:uncaptured python exception, closing channel %s (%s:%s %s)error)compact_tracebackrYr[r}r))rRZniltvtbinfoZ self_reprrrrrs zdispatcher.handle_errorcCs|jdddS)Nz!unhandled incoming priority eventrI)r})rRrrrrszdispatcher.handle_exptcCs|jdddS)Nzunhandled read eventrI)r})rRrrrrszdispatcher.handle_readcCs|jdddS)Nzunhandled write eventrI)r})rRrrrrszdispatcher.handle_writecCs|jdddS)Nzunhandled connect eventrI)r})rRrrrrszdispatcher.handle_connectcCs|j}|dk r|j|dS)N)rlhandle_accepted)rRZpairrrrr~szdispatcher.handle_acceptcCs|j|jdddS)Nzunhandled accepted eventrI)rtr})rRrSrOrrrrszdispatcher.handle_acceptedcCs|jdd|jdS)Nzunhandled close eventrI)r}rt)rRrrrr)s zdispatcher.handle_close)NN)N)N)N)rz)-rrrdebugrNr7riclosingrO frozensetr{rTr\__str__r]rPrQZAF_INETZ SOCK_STREAMr_rMrcr4r5rgrhrkrlrnrrrtryr}rrjr!r#rrrrrr~rr)rrrrrHsL          rHc@s6eZdZd ddZddZddZdd Zd d ZdS) dispatcher_with_sendNcCstj|||d|_dS)Nrq)rHrT out_buffer)rRrSr;rrrrTszdispatcher_with_send.__init__cCs.d}tj||jdd}|j|d|_dS)Nri)rHrnr)rRZnum_sentrrr initiate_sendsz"dispatcher_with_send.initiate_sendcCs |jdS)N)r)rRrrrrsz!dispatcher_with_send.handle_writecCs|j pt|jS)N)rNlenr)rRrrrr5 szdispatcher_with_send.writablecCs0|jr|jdt||j||_|jdS)Nz sending %s)rr}rYrr)rRrorrrrns zdispatcher_with_send.send)NN)rrrrTrrr5rnrrrrrs  rcCstj\}}}g}|stdx0|rN|j|jjj|jjjt|j f|j }q W~|d\}}}dj dd|D}|||f|||fS)Nztraceback does not existrDrVcSsg|] }d|qS)z [%s|%s|%s]r).0xrrr )sz%compact_traceback..) ruexc_infoAssertionErrorr6tb_framef_code co_filenameco_namerw tb_linenotb_nextrZ)rrtbrfileZfunctionlinerzrrrrs rcCs|dkr t}x~t|jD]n}y |jWqtk rb}z|jdtkrLn|sRWYdd}~Xqtk rvYq|sYqXqW|jdS)Nr) r1r2valuesrtr*r+r rclear)r;Z ignore_allrrrr close_all,s   rposixc@sNeZdZddZddZddZddZdd d ZeZeZ d d Z ddZ d S) file_wrappercCstj||_dS)N)rdupr>)rRr>rrrrTQszfile_wrapper.__init__cCs*|jdkrtjd|t|d|jdS)Nrzunclosed file %r)source)r>warningswarnResourceWarningrt)rRrrr__del__Ts  zfile_wrapper.__del__cGstj|jf|S)N)rr r>)rRr+rrrrrZszfile_wrapper.recvcGstj|jf|S)N)rr"r>)rRr+rrrrn]szfile_wrapper.sendNcCs*|tjkr|tjkr| rdStddS)Nrz-Only asyncore specific behaviour implemented.)rQrarNotImplementedError)rRlevelZoptnameZbuflenrrrrb`s   zfile_wrapper.getsockoptcCs(|jdkrdS|j}d|_tj|dS)NrrDr)r>rrt)rRr>rrrrtks  zfile_wrapper.closecCs|jS)N)r>)rRrrrr`rszfile_wrapper.fileno)N) rrrrTrrrrnrbr r"rtr`rrrrrLs rc@seZdZdddZddZdS)file_dispatcherNc CsPtj|d|d|_y |j}Wntk r4YnX|j|tj|ddS)NTF)rHrTrNr`AttributeErrorset_filer set_blocking)rRr>r;rrrrTws  zfile_dispatcher.__init__cCs"t||_|jj|_|jdS)N)rrQr`rKr])rRr>rrrrs  zfile_dispatcher.set_file)N)rrrrTrrrrrrus r)r0N)r0N)rCFNN)NF).__doc__r%rQrur8rrerrnorrrrrrrr r r r r rrr,r1rr ExceptionrKeyboardInterrupt SystemExitrr r"r$r/r?rBZpoll3rGrHrrrrfrrrrrr/sB<    '  -  )