ÿØÿà JFIF    ÿÛ „ ( %!1!%*+...983,7(-.- PKΠ]{__init__.cpython-38.opt-2.pycnu[U e5d@s.dddddddddd d d d d dddddgZdS)ZbuildZbuild_pyZ build_extZ build_clibZ build_scriptsZcleanZinstallZ install_libZinstall_headersZinstall_scriptsZ install_dataZsdistregisterZbdistZ bdist_dumbZ bdist_rpmZ bdist_wininstZcheckZuploadN)__all__rr2/usr/lib64/python3.8/distutils/command/__init__.pys&PKΠ];[ddclient.cpython-38.opt-2.pycnu[U e5d@sbddlZddlZddlZddlZddlZddlZddlZddl m Z ddddddd d d d d dddddddgZ dZ dZ dZdZdZdZeejjddejjDZdZdZedjZed jZed!Zed"Z d#d$d%hZ!dAd'd(Z"Gd)d*d*ej#j$Z%d+d,Z&e%fd-d.Z'Gd/ddej(Z)Gd0ddZ*z ddl+Z+Wne,k r\YnXGd1d2d2e*Z-e .d2Gd3dde/Z0Gd4dde0Z1Gd5d d e0Z2Gd6dde0Z3Gd7dde0Z4Gd8d d e0Z5Gd9d d e0Z6Gd:d d e0Z7Gd;d d e7Z8Gddde0Z;Gd?dde0Ze0Z?dS)BN)urlsplit HTTPResponseHTTPConnection HTTPException NotConnectedUnknownProtocolUnknownTransferEncodingUnimplementedFileModeIncompleteRead InvalidURLImproperConnectionStateCannotSendRequestCannotSendHeaderResponseNotReady BadStatusLine LineTooLongRemoteDisconnectederror responsesPiZUNKNOWNZIdlezRequest-startedz Request-sentcCsi|] }||jqS)phrase).0vrr#/usr/lib64/python3.8/http/client.py jsrids[^:\s][^:\r\n]*s\n(?![ \t])|\r(?![ \t\n])z[- ]z[-]ZPATCHZPOSTZPUTdatac Cshz |dWStk rb}z8t|j|j|j|jd|||j|j|fdW5d}~XYnXdS)Nlatin-1z`%s (%.20r) is not valid Latin-1. Use %s.encode('utf-8') if you want to send it encoded in UTF-8.)encodeUnicodeEncodeErrorencodingobjectstartendtitle)rnameerrrrr_encodes r(c@seZdZddZdS) HTTPMessagecCsj|d}t|}g}d}|D]@}|d||krBd}n|ddsVd}|r$||q$|S)N:r)lowerlenkeysisspaceappend)selfr&nZlstZhitlinerrrgetallmatchingheaderss   z!HTTPMessage.getallmatchingheadersN)__name__ __module__ __qualname__r4rrrrr)sr)cCsXg}|td}t|tkr&td||t|tkrHtdt|dkrqTq|S)Nr+ header linezgot more than %d headers  )readline_MAXLINEr-rr0 _MAXHEADERSr)fpheadersr3rrr _read_headerss    rBcCs,t|}d|d}tjj|d|S)Nr< iso-8859-1)_class)rBjoindecodeemailparserZParserZparsestr)r@rDrAZhstringrrr parse_headerss rIcseZdZd@ddZddZddZd d Zd d Zfd dZfddZ ddZ ddZ dAddZ ddZ ddZddZddZdd Zd!d"Zd#d$Zd%d&ZdBd(d)ZdCd*d+ZdDfd,d- Zd.d/Zd0d1Zd2d3ZdEd4d5Zd6d7Zd8d9Zd:d;Zdd?Z Z!S)FrrNcCsR|d|_||_||_d|_|_t|_t|_t|_ t|_ t|_ t|_ t|_ dS)Nrb)Zmakefiler@ debuglevel_methodrAmsg_UNKNOWNversionstatusreasonchunked chunk_leftlength will_close)r1sockrKmethodurlrrr__init__s  zHTTPResponse.__init__c Cst|jtdd}t|tkr*td|jdkrBtdt||sNt dz| dd\}}}WnFt k rz| dd\}}d}Wnt k rd}YnXYnX| d s| t|z$t|}|d ks|d krt|Wnt k rt|YnX|||fS) Nr+rCz status linerzreply:z-Remote end closed connection without responsezHTTP/ri)strr@r=r>r-rrKprintreprrsplit ValueError startswith _close_connrint)r1r3rOrPrQrrr _read_statuss2    zHTTPResponse._read_statusc Cs|jdk rdS|\}}}|tkr&qHt|j}|jdkrDtd|~q||_|_| |_ |dkrnd|_ n| drd|_ nt |t|j|_|_|jdkr|jD]\}}td|d|q|jd }|r|d krd |_d|_nd |_||_d|_|jd }|rb|jsbzt||_Wntk rLd|_YnX|jdkrhd|_nd|_|tks|tksd|krdksn|jdkrd|_|js|js|jdkrd |_dS)Nrzheaders:)zHTTP/1.0zHTTP/0.9 zHTTP/1. header:r*transfer-encodingrRTFcontent-lengthrHEAD)rArdZCONTINUErBr@rKr]coderPstriprQrOrarrIrMitemsgetr,rRrS _check_closerUrTrcr`Z NO_CONTENTZ NOT_MODIFIEDrL) r1rOrPrQZskipped_headershdrvalZtr_encrTrrrbegin5sf               zHTTPResponse.begincCsv|jd}|jdkr.|r*d|kr*dSdS|jdr>dS|rRd|krRdS|jd}|rrd|krrdSdS)NZ connectionrfcloseTFz keep-alivezproxy-connection)rArorOr,)r1ZconnZpconnrrrrp}s    zHTTPResponse._check_closecCs|j}d|_|dSN)r@rt)r1r@rrrrbszHTTPResponse._close_conncs$ztW5|jr|XdSru)r@rbsuperrtr1 __class__rrrtszHTTPResponse.closecst|jr|jdSru)rvflushr@rwrxrrrzs zHTTPResponse.flushcCsdS)NTrrwrrrreadableszHTTPResponse.readablecCs |jdkSru)r@rwrrrisclosedszHTTPResponse.isclosedcCs|jdkrdS|jdkr$|dS|dk rRt|}||}t|d|S|jr`|S|j dkrv|j }n6z| |j }Wnt k r|YnXd|_ ||SdS)Nr<rkr) r@rLrb bytearrayreadinto memoryviewtobytesrR_readall_chunkedrTread _safe_readr )r1amtbr2srrrrs*     zHTTPResponse.readcCs|jdkrdS|jdkr$|dS|jr4||S|jdk r^t||jkr^t|d|j}|j|}|s||r||n&|jdk r|j|8_|js||S)Nrrk) r@rLrbrR_readinto_chunkedrTr-rr~)r1rr2rrrr~s$       zHTTPResponse.readintocCsr|jtd}t|tkr$td|d}|dkrB|d|}z t|dWStk rl|YnXdS)Nr+z chunk size;r) r@r=r>r-rfindrcr`rb)r1r3irrr_read_next_chunk_sizes    z"HTTPResponse._read_next_chunk_sizecCs:|jtd}t|tkr$td|s*q6|dkrq6qdS)Nr+z trailer liner9)r@r=r>r-rr1r3rrr_read_and_discard_trailers z&HTTPResponse._read_and_discard_trailercCsl|j}|sh|dk r|dz |}Wntk rDtdYnX|dkrb||d}||_|S)NrZr<r)rSrrr`r rrb)r1rSrrr_get_chunk_left s  zHTTPResponse._get_chunk_leftcCsbg}z6|}|dkrq0|||d|_qd|WStk r\td|YnXdSNrr<)rr0rrSrEr )r1valuerSrrrr8s zHTTPResponse._readall_chunkedcCsd}t|}zv|}|dkr$|WSt||krN||}|||_||WS|d|}||}||d}||7}d|_qWn(tk rtt|d|YnXdS)Nr)rrr-_safe_readintorSr bytes)r1rZ total_bytesZmvbrSr2Ztemp_mvbrrrrFs"        zHTTPResponse._readinto_chunkedcCs.|j|}t||kr*t||t||Sru)r@rr-r )r1rrrrrr^s  zHTTPResponse._safe_readcCs:t|}|j|}||kr6tt|d||||Sru)r-r@r~r r)r1rrr2rrrrjs  zHTTPResponse._safe_readintocCs|jdks|jdkrdS|jr(||S|jdk rJ|dksD||jkrJ|j}|j|}|sh|rh|n|jdk r|jt|8_|SNrkr<r)r@rLrR_read1_chunkedrTread1rbr-)r1r2resultrrrrrs    zHTTPResponse.read1cCs4|jdks|jdkrdS|jr(||S|j|S)Nrkr<)r@rLrR _peek_chunkedpeek)r1r2rrrrs  zHTTPResponse.peekcs|jdks|jdkrdS|jr*t|S|jdk rL|dksF||jkrL|j}|j|}|sj|rj|n|jdk r|jt|8_|Sr)r@rLrRrvr=rTrbr-)r1limitrrxrrr=s    zHTTPResponse.readlinecCsd|}|dks|dkrdSd|kr0|ks6n|}|j|}|jt|8_|s`td|Sr)rr@rrSr-r )r1r2rSrrrrrs zHTTPResponse._read1_chunkedcCsDz |}Wntk r"YdSX|dkr0dS|j|d|S)Nr<)rr r@r)r1r2rSrrrrs zHTTPResponse._peek_chunkedcCs |jSru)r@filenorwrrrrszHTTPResponse.filenocCsF|jdkrt|j|p|}t|ts4t|ds8|Sd|SdS)N__iter__z, )rArZget_all isinstancer\hasattrrE)r1r&defaultrArrr getheaders zHTTPResponse.getheadercCs|jdkrtt|jSru)rArlistrnrwrrr getheaderss zHTTPResponse.getheaderscCs|SrurrwrrrrszHTTPResponse.__iter__cCs|jSru)rArwrrrinfoszHTTPResponse.infocCs|jSru)rXrwrrrgeturls zHTTPResponse.geturlcCs|jSru)rPrwrrrgetcodeszHTTPResponse.getcode)rNN)N)r)r)r)N)"r5r6r7rYrdrsrprbrtrzr{r|rr~rrrrrrrrrr=rrrrrrrrr __classcell__rrrxrrs< !H  "      c@s eZdZdZdZeZeZdZ dZ e ddZ e ddZ d ejd d fd d Zd7d dZddZddZddZddZddZddZddZddZd8d d!Zd9d"d#Zd$d%Zd&d'Zd(d)Zd*d+Zd,d-Z d:dd.d/d0Z!d ifdd.d1d2Z"d3d4Z#d5d6Z$d S);rrfzHTTP/1.1r+rcCs t|tjSru)rio TextIOBase)streamrrr _is_textIOszHTTPConnection._is_textIOcCsf|dkr|tkrdSdSt|dr*dSzt|}|jWStk rNYnXt|trbt|SdS)Nrr) upper_METHODS_EXPECTING_BODYrrnbytes TypeErrorrr\r-)bodyrWZmvrrr_get_content_lengths   z"HTTPConnection._get_content_lengthN cCsn||_||_||_d|_g|_d|_t|_d|_d|_ d|_ i|_ | ||\|_ |_||j tj|_dSru)timeoutsource_address blocksizerV_buffer_HTTPConnection__response_CS_IDLE_HTTPConnection__staterL _tunnel_host _tunnel_port_tunnel_headers _get_hostporthostport_validate_hostsocketZcreate_connection_create_connection)r1rrrrrrrrrY4s zHTTPConnection.__init__cCs<|jrtd|||\|_|_|r.||_n |jdS)Nz.Can't set up tunnel for established connection)rV RuntimeErrorrrrrclear)r1rrrArrr set_tunnelJs zHTTPConnection.set_tunnelcCs|dkr|d}|d}||krzt||dd}WnHtk r||dddkrh|j}ntd||ddYnX|d|}n|j}|r|ddkr|ddkr|dd}||fS) Nr*]r+r[znonnumeric port: '%s'r[r)rfindrcr` default_portr )r1rrrjrrrrbs   zHTTPConnection._get_hostportcCs ||_dSru)rK)r1levelrrrset_debuglevelvszHTTPConnection.set_debuglevelc Csd|j|jf}|d}|||jD](\}}d||f}|d}||q.|d|j|j|jd}| \}} } | t j j kr| td| | f|jtd} t| tkrtd | sq| d krq|jd krtd | qdS) NzCONNECT %s:%d HTTP/1.0 asciiz%s: %s rr:rWzTunnel connection failed: %d %sr+r8r9rrg)rrrsendrrnresponse_classrVrLrdhttp HTTPStatusZOKrtOSErrorrmr@r=r>r-rrKr]rF) r1Z connect_strZ connect_bytesheaderrZ header_strZ header_bytesresponserOrlmessager3rrr_tunnelys4         zHTTPConnection._tunnelcCsB||j|jf|j|j|_|jtjtj d|j r>| dS)Nr+) rrrrrrVZ setsockoptrZ IPPROTO_TCPZ TCP_NODELAYrrrwrrrconnects zHTTPConnection.connectcCsBt|_z|j}|r d|_|W5|j}|rsz/HTTPConnection._send_request..rr+rzaccept-encodingrrirhFrzUnable to determine size of %rTzTransfer-EncodingrRzContent-Lengthrr) frozensetrrrKr]rr\rnrr(r) r1rWrXrrArZ header_namesZskipsZcontent_lengthrqrrrrr s0      zHTTPConnection._send_requestcCs|jr|jrd|_|jtks&|jr0t|j|jdkrR|j|j|j|jd}n|j|j|jd}zNz | Wnt k r| YnXt |_|j r| n||_|WS| YnXdS)Nrr)rr|rrrrKrrVrLrsConnectionErrorrtrrU)r1rrrr getresponses.     zHTTPConnection.getresponse)NN)NF)FF)N)%r5r6r7rrrr HTTP_PORTrrrK staticmethodrrr_GLOBAL_DEFAULT_TIMEOUTrYrrrrrrtrrrrrrrrrrrrr rrrrrrsL     & 6    .csDeZdZeZdddejdfddddfdd ZfddZZ S)HTTPSConnectionNr)contextcheck_hostnamerc stt|j||||| d|dk s2|dk s2|dk rHddl} | dtd||_||_|dkrtt }|j dk rtd|_ |j tj k} |dkr|j }|r| std|s|r||||j dk rd|_ ||_|dk r||j_ dS)N)rrzTkey_file, cert_file and check_hostname are deprecated, use a custom context instead.rZTzMcheck_hostname needs a SSL context with either CERT_OPTIONAL or CERT_REQUIRED)rvrrYwarningswarnDeprecationWarningkey_file cert_filesslZ_create_default_https_contextZpost_handshake_authZ verify_modeZ CERT_NONErr`Zload_cert_chain_context) r1rrrrrrrrrrZ will_verifyrxrrrYcs<    zHTTPSConnection.__init__cs6t|jr|j}n|j}|jj|j|d|_dS)N)server_hostname)rvrrrrZ wrap_socketrV)r1rrxrrrs  zHTTPSConnection.connect) r5r6r7 HTTPS_PORTrrrrYrrrrrxrr\s$rc@s eZdZdS)rNr5r6r7rrrrrsc@s eZdZdS)rNrrrrrrsc@s eZdZdS)r Nrrrrrr sc@seZdZddZdS)rcCs|f|_||_dSru)argsrO)r1rOrrrrYszUnknownProtocol.__init__Nr5r6r7rYrrrrrsc@s eZdZdS)rNrrrrrrsc@s eZdZdS)r Nrrrrrr sc@s$eZdZdddZddZejZdS)r NcCs|f|_||_||_dSru)rpartialexpected)r1r!r"rrrrYszIncompleteRead.__init__cCs2|jdk rd|j}nd}d|jjt|j|fS)Nz, %i more expectedr[z%s(%i bytes read%s))r"ryr5r-r!)r1errr__repr__s  zIncompleteRead.__repr__)N)r5r6r7rYr$r"__str__rrrrr s c@s eZdZdS)r Nrrrrrr sc@s eZdZdS)r Nrrrrrr sc@s eZdZdS)rNrrrrrrsc@s eZdZdS)rNrrrrrrsc@seZdZddZdS)rcCs|s t|}|f|_||_dSru)r^rr3rrrrrYszBadStatusLine.__init__Nr rrrrrsc@seZdZddZdS)rcCst|dt|fdS)Nz&got more than %d bytes when reading %s)rrYr>)r1Z line_typerrrrYszLineTooLong.__init__Nr rrrrrsc@seZdZddZdS)rcOs"t|dtj|f||dS)Nr[)rrYConnectionResetError)r1poskwrrrrYs zRemoteDisconnected.__init__Nr rrrrrs)r)@Z email.parserrGZ email.messagerrrerZcollections.abcrZ urllib.parser__all__rrrNrrrglobalsupdater __members__rrr>r?compile fullmatchrrrrrrr(rZMessager)rBrIBufferedIOBaserrr ImportErrorrr0 Exceptionrrr rrr r r r rrrrr&rrrrrrGs        W 8 PKΠ]9__init__.cpython-38.pycnu[U L_?@sddlmZmZdZdS))where old_wherez 2018.04.16N)corerr __version__rrA/opt/alt/python38/lib/python3.8/site-packages/certifi/__init__.pysPKΠ]I*I*cookies.cpython-38.opt-2.pycnu[U e5dO @spddlZddlZdddgZdjZdjZdjZGdddeZej ej d Z e d Z d d e ed e eee DZeeddeddiedee jZddZedZedZddZdddddddgZdd d!d"d#d$d%d&d'd(d)d*d+g Zdeefd,d-ZGd.d/d/eZd0Z e d1Z!ed2e d3e!d4ej"ej#BZ$Gd5ddeZ%Gd6dde%Z&dS)7N CookieError BaseCookie SimpleCookiez;  c@s eZdZdS)rN)__name__ __module__ __qualname__r r $/usr/lib64/python3.8/http/cookies.pyrsz!#$%&'*+-.^_`|~:z ()/<=>?@[]{}cCsi|]}|d|qS)z\%03or ).0nr r r sr"\"\z\\z[%s]+cCs*|dkst|r|Sd|tdSdS)Nr) _is_legal_key translate _Translatorstrr r r _quotesrz\\[0-3][0-7][0-7]z[\\].cCsN|dkst|dkr|S|ddks0|ddkr4|S|dd}d}t|}g}d|krf|krFnnt||}t||}|s|s|||dqFd}}|r|d}|r|d}|r|r||kr|||||||d|d}qP|||||tt||d|dd|d}qPt|S)Nrr) len _OctalPattsearch _QuotePattappendstartchrint _nulljoin)rir resZo_matchZq_matchjkr r r _unquotes6      $ r+ZMonZTueZWedZThuZFriZSatZSunZJanZFebZMarZAprZMayZJunZJulZAugZSepZOctZNovZDecc CsRddlm}m}|}|||\ }}}} } } } } }d|| ||||| | | fS)Nr)gmtimetimez#%s, %02d %3s %4d %02d:%02d:%02d GMT)r-r,)ZfutureZ weekdaynameZ monthnamer,r-ZnowZyearZmonthZdayZhhZmmZssZwdyzr r r _getdates r0c @seZdZddddddddd d Zd d hZd dZeddZeddZeddZ ddZ d1ddZ ddZ e jZddZddZd d!Zd"d#Zd$d%Zd&d'Zd2d)d*ZeZd+d,Zd3d-d.Zd4d/d0ZdS)5MorselexpiresPathCommentZDomainzMax-AgeZSecureZHttpOnlyZVersionZSameSite) r2pathcommentZdomainmax-agesecurehttponlyversionZsamesiter8r9cCs0d|_|_|_|jD]}t||dqdS)Nr)_key_value _coded_value _reserveddict __setitem__)selfkeyr r r __init__ s zMorsel.__init__cCs|jSN)r;rAr r r rB(sz Morsel.keycCs|jSrD)r<rEr r r value,sz Morsel.valuecCs|jSrD)r=rEr r r coded_value0szMorsel.coded_valuecCs2|}||jkr td|ft|||dSNzInvalid attribute %r)lowerr>rr?r@)rAKVr r r r@4s zMorsel.__setitem__NcCs.|}||jkr td|ft|||SrH)rIr>rr? setdefault)rArBvalr r r rL:s zMorsel.setdefaultcCs>t|tstSt||o<|j|jko<|j|jko<|j|jkSrD) isinstancer1NotImplementedr?__eq__r<r;r=rAZmorselr r r rP@s     z Morsel.__eq__cCs$t}t|||j|j|SrD)r1r?update__dict__rQr r r copyJs z Morsel.copycCsRi}t|D]0\}}|}||jkr8td|f|||<qt||dSrH)r?itemsrIr>rrR)rAvaluesdatarBrMr r r rRPs  z Morsel.updatecCs||jkSrD)rIr>)rArJr r r isReservedKeyYszMorsel.isReservedKeycCsH||jkrtd|ft|s2td|f||_||_||_dS)Nz Attempt to set a reserved key %rzIllegal key %r)rIr>rrr;r<r=)rArBrMZ coded_valr r r set\sz Morsel.setcCs|j|j|jdS)N)rBrFrGr;r<r=rEr r r __getstate__gszMorsel.__getstate__cCs"|d|_|d|_|d|_dS)NrBrFrGrZ)rAstater r r __setstate__ns  zMorsel.__setstate__ Set-Cookie:cCsd|||fS)Nz%s %s) OutputString)rAattrsheaderr r r outputssz Morsel.outputcCsd|jj|fS)N<%s: %s>) __class__rr_rEr r r __repr__xszMorsel.__repr__cCsd||ddS)Nz rr)r_replace)rAr`r r r js_output{szMorsel.js_outputcCs$g}|j}|d|j|jf|dkr,|j}t|}|D]\}}|dkrNq<||krXq<|dkrt|tr|d|j|t|fq<|dkrt|tr|d|j||fq<|dkrt|t r|d|j|t |fq<||j kr|r|t |j|q<|d|j||fqsortedrUrNr%r0rr_flags_semispacejoin)rAr`resultr"rUrBrFr r r r_s,   zMorsel.OutputString)N)Nr^)N)N)rrr r>rjrCpropertyrBrFrGr@rLrPobject__ne__rTrRrXrYr[r]rb__str__rergr_r r r r r1sB         r1z,\w\d!#%&'~_`><@,:/\$\*\+\-\.\^\|\)\(\?\}\{\=z\[\]z \s* # Optional whitespace at start of cookie (?P # Start of group 'key' [a ]+? # Any word of at least one letter ) # End of group 'key' ( # Optional group: there may not be a value. \s*=\s* # Equal Sign (?P # Start of group 'val' "(?:[^\\"]|\\.)*" # Any doublequoted string | # or \w{3},\s[\w\d\s-]{9,11}\s[\d:]{8}\sGMT # Special case for "expires" attr | # or [a-]* # Any word or empty string ) # End of group 'val' )? # End of optional value group \s* # Any number of spaces. (\s+|;|$) # Ending either at space, semicolon, or EOS. c@sjeZdZddZddZdddZdd Zd d ZdddZeZ ddZ dddZ ddZ e fddZdS)rcCs||fSrDr rArMr r r value_decodeszBaseCookie.value_decodecCst|}||fSrDrrArMZstrvalr r r value_encodeszBaseCookie.value_encodeNcCs|r||dSrD)load)rAinputr r r rCszBaseCookie.__init__cCs.||t}||||t|||dSrD)getr1rYr?r@)rArBZ real_valuerGMr r r Z__setszBaseCookie.__setcCs:t|trt|||n||\}}||||dSrD)rNr1r?r@rt_BaseCookie__set)rArBrFrvalcvalr r r r@s zBaseCookie.__setitem__r^ cCs:g}t|}|D]\}}||||q||SrD)rirUr"rbjoin)rAr`raseprlrUrBrFr r r rbs   zBaseCookie.outputcCsJg}t|}|D] \}}|d|t|jfqd|jjt|fS)Nrhrc)rirUr"reprrFrdr _spacejoin)rAlrUrBrFr r r res   zBaseCookie.__repr__cCs6g}t|}|D]\}}|||qt|SrD)rirUr"rgr&)rAr`rlrUrBrFr r r rgs   zBaseCookie.js_outputcCs4t|tr||n|D]\}}|||<qdSrD)rNr_BaseCookie__parse_stringrU)rAZrawdatarBrFr r r ru s    zBaseCookie.loadcCshd}t|}g}d}d}d}d|kr2|krnn|||} | sJq| d| d} } | d}| ddkr|s|q||| dd| fq| tjkr|sdS| dkr| tjkr||| dfqdSn||| t | fq| dk r||| | | fd}qdSqd} |D]>\} } } | |krB| | | <n| \}}| | |||| } q$dS) NrFrrrBrM$T) rmatchgroupendr"rIr1r>rjr+rrry)rArZpattr'r Z parsed_itemsZ morsel_seenZTYPE_ATTRIBUTEZ TYPE_KEYVALUErrBrFrxtprzr{r r r Z__parse_stringsF      zBaseCookie.__parse_string)N)Nr^r|)N)rrr rrrtrCryr@rbrprergru_CookiePatternrr r r r rs    c@seZdZddZddZdS)rcCs t||fSrD)r+rqr r r rr\szSimpleCookie.value_decodecCst|}|t|fSrD)rrrsr r r rt_szSimpleCookie.value_encodeN)rrr rrrtr r r r rUs)'restring__all__r}r&rkr ExceptionrZ ascii_lettersZdigitsZ _LegalCharsZ_UnescapedCharsrYrangemapordrrRcompileescape fullmatchrrrr!r+Z _weekdaynameZ _monthnamer0r?r1Z_LegalKeyCharsZ_LegalValueCharsASCIIVERBOSErrrr r r r sp   24    PKΠ]CQcookiejar.cpython-38.opt-2.pycnu[U e5d#, @sddddddddgZdd lZdd lZdd lZdd lZdd lZdd lZdd lZdd l Z dd l Z dd l mZd Zd ad d Zee jjZdZddZdZddZdddddddgZdddddd d!d"d#d$d%d&g ZgZeD]Zeeqdtd'd(Z dud)d*Z!d d d d d+Z"e#d,ej$Z%d-d.Z&d/d0Z'e#d1ej$Z(e#d2ej)ej$BZ*e#d3ej+ej$BZ,d4d5Z-e#d6ej+ej$BZ.d7d8Z/d9d:Z0e#d;Z1e#d<Z2e#d=Z3e#d>Z4d?d@Z5e#dAZ6dBdCZ7dDdEZ8dFdGZ9e#dHej$Z:dIdJZ;dKdLZe#dQej$Z?dRdSZ@dTdUZAdVdWZBdXdYZCdZZDe#d[ZEd\d]ZFd^d_ZGd`daZHdbdcZIGddddZJGdeddZKGdfddeKZLdgdhZMdidjZNGdkdldlZOGdmddZPGdnddeQZRGdoddePZSdpdqZTGdrddeSZUGdsddeSZVd S)vCookie CookieJar CookiePolicyDefaultCookiePolicy FileCookieJar LWPCookieJar LoadErrorMozillaCookieJarN)timegmFcGs(tsdStsddl}|datj|S)Nr zhttp.cookiejar)debugloggerloggingZ getLogger)argsr r&/usr/lib64/python3.8/http/cookiejar.py_debug,s  rzQa filename was not supplied (nor was the CookieJar instance initialised with one)cCsJddl}ddl}ddl}|}|d||}|jd|dddS)Nr zhttp.cookiejar bug! %s) stacklevel)iowarnings tracebackStringIO print_excgetvaluewarn)rrrfmsgrrr_warn_unhandled_exception:s  ricCs|dd\}}}}}}|tkrd|kr4dkrnnhd|krLdkrnnPd|krddkrnn8d|kr|dkrnn d|krdkrnnt|SdSdS) N r ;=) EPOCH_YEARr )ttyearmonthZmdayhourminsecrrr_timegmIs&8   r,ZMonZTueZWedZThuZFriZSatZSunZJanZFebZMarZAprZMayZJunZJulZAugZSepZOctZNovZDeccCs@|dkrtj}n tj|}d|j|j|j|j|j|jfS)Nz%04d-%02d-%02d %02d:%02d:%02dZ) datetimeutcnowutcfromtimestampr'r(dayr)minutesecondtZdtrrr time2isozWs   r5cCsR|dkrtj}n tj|}dt||jt|jd|j|j |j |j fS)Nz#%s, %02d-%s-%04d %02d:%02d:%02d GMTr) r-r.r/DAYSZweekdayr0MONTHSr(r'r)r1r2r3rrr time2netscapejs     r8)ZGMTUTCZUTZz^([-+])?(\d\d?):?(\d\d)?$cCsjd}|tkrd}nTt|}|rfdt|d}|drR|dt|d}|ddkrf| }|S)Nr ir<r-) UTC_ZONES TIMEZONE_REsearchintgroup)tzoffsetmrrroffset_from_tz_strings  rFc Cst|}|tjkrdSzt|d}Wn^tk rz t|}Wntk r`YYdSXd|krvdkrnn|}nYdSYnX|dkrd}|dkrd}|dkrd}t|}t|}t|}t|}|dkr6ttd}|d} |} ||| }| | } t | dkr6| dkr.|d}n|d}t |||||||f} | dk r|dkrdd}| }t |} | dkrdS| | } | S)Nrr r id2r9) rAr-ZMAXYEAR MONTHS_LOWERindexlower ValueErrortime localtimeabsr,upperrF) r0monyrhrr*r+rCZimonZcur_yrrEZtmpr4rDrrr _str2timesV          rTzV^[SMTWF][a-z][a-z], (\d\d) ([JFMASOND][a-z][a-z]) (\d\d\d\d) (\d\d):(\d\d):(\d\d) GMT$z+^(?:Sun|Mon|Tue|Wed|Thu|Fri|Sat)[a-z]*,?\s*a^ (\d\d?) # day (?:\s+|[-\/]) (\w+) # month (?:\s+|[-\/]) (\d+) # year (?: (?:\s+|:) # separator before clock (\d\d?):(\d\d) # hour:min (?::(\d\d))? # optional seconds )? # optional clock \s* (?: ([-+]?\d{2,4}|(?![APap][Mm]\b)[A-Za-z]+) # timezone \s* )? (?: \(\w+\) # ASCII representation of timezone in parens. \s* )?$c Cst|}|rl|}t|dd}t|d|t|dt|dt|dt|df}t|S| }t d|d}dgd\}}}}}} } t |}|dk r|\}}}}}} } ndSt |||||| | S) Nrrr r;)STRICT_DATE_REr@groupsrIrJrKrAfloatr,lstrip WEEKDAY_REsubLOOSE_HTTP_DATE_RErT) textrEgrQr&r0rRrSr*r+rCrrr http2times$   rba^ (\d{4}) # year [-\/]? (\d\d?) # numerical month [-\/]? (\d\d?) # day (?: (?:\s+|[-:Tt]) # separator before clock (\d\d?):?(\d\d) # hour:min (?::?(\d\d(?:\.\d*)?))? # optional seconds (and fractional) )? # optional clock \s* (?: ([-+]?\d\d?:?(:?\d\d)? |Z|z) # timezone (Z is "zero meridian", i.e. GMT) \s* )?$c Csd|}dgd\}}}}}}}t|}|dk rL|\}}}}}}}} ndSt|||||||S)NrX)r\ ISO_DATE_REr@rZrT) r`r0rQrRrSr*r+rCrE_rrriso2time+s  recCs*|d\}}|jd||j|dS)Nr )spanstring)matchstartendrrr unmatchedLsrkz^\s*([^=\s;,]+)z&^\s*=\s*\"([^\"\\]*(?:\\.[^\"\\]*)*)\"z^\s*=\s*([^\s;,]*)z\\(.)c Csg}|D]}|}g}|rt|}|rt|}|d}t|}|rft|}|d}td|}n.t|}|rt|}|d}|}nd}| ||fq| dr| dd}|r| |g}qt dd|\}} |}q|r| |q|S)Nrz\1,z^[=\s;]*rW)HEADER_TOKEN_REr@rkrBHEADER_QUOTED_VALUE_REHEADER_ESCAPE_REr^HEADER_VALUE_RErstripappendr\ startswithresubn) Z header_valuesresultr`Z orig_textpairsrEnamevalueZnon_junkZ nr_junk_charsrrrsplit_header_wordsUs>.         rz([\"\\])cCs|g}|D]h}g}|D]F\}}|dk rPtd|sDtd|}d|}d||f}||q|r|d|qd|S)Nz^\w+$\\\1z"%s"%s=%s; , )rtr@HEADER_JOIN_ESCAPE_REr^rrjoin)Zlistsheadersrwattrkvrrrjoin_header_wordss      rcCs0|dr|dd}|dr,|dd}|S)N"r)rsendswithr`rrr strip_quotess     rc Csd}g}|D]}g}d}t|dD]\}}|}|d\}} } |}|sb|dkr&qnq&| rn| nd} |dkr|} | |kr| }|dkr| dk rt| } d}n|dkr| dk rtt| } ||| fq&|r |s|d ||q |S) N)expiresdomainpathsecureversionportmax-ageF;=r rTr)r0) enumeratesplitstrip partitionrKrrbrr) Z ns_headersZ known_attrsrvZ ns_headerrw version_setZiiZparamkeysepvallcrrrparse_ns_headerss>   rz\.\d+$cCs:t|rdS|dkrdS|ddks2|ddkr6dSdS)NFrWr .rTIPV4_REr@rrrris_HDNs rcCsl|}|}||krdSt|s(dS||}|dksB|dkrFdS|dsTdSt|ddshdSdS)NTFrr rr)rKrrfindrs)ABirrr domain_matchs  rcCst|rdSdSNFTrrrrrliberal_is_HDNFs rcCs`|}|}t|r t|s0||kr,dSdS|d}|rL||rLdS|s\||kr\dSdS)NTFr)rKrrsr)rr initial_dotrrruser_domain_matchPs  rz:\d+$cCsB|}tj|d}|dkr,|dd}td|d}|S)NrrWZHost) get_full_urlurllibparseZurlparseZ get_header cut_port_rer^rK)requesturlhostrrr request_hostes  rcCs4t|}}|ddkr,t|s,|d}||fS)Nrr.local)rfindrr@)rerhnreq_hostrrreff_request_hostus rcCs4|}tj|}t|j}|ds0d|}|S)N/)rrrZurlsplit escape_pathrrs)rrpartsrrrr request_paths    rcCs`|j}|d}|dkrX||dd}z t|Wq\tk rTtd|YdSXnt}|S)N:r rznonnumeric port: '%s')rrrArLrDEFAULT_HTTP_PORT)rrrrrrr request_ports    rz%/;:@&=+$,!~*'()z%([0-9a-fA-F][0-9a-fA-F])cCsd|dS)Nz%%%sr)rBrP)rhrrruppercase_escaped_charsrcCstj|t}tt|}|SN)rrZquoteHTTP_PATH_SAFEESCAPED_CHAR_REr^r)rrrrrs  rcCsP|d}|dkrL||dd}|d}t|rL|dksD|dkrLd|S|S)Nrr rZlocal)rr)hrbrrrreachs  rcCs$t|}t|t|jsdSdSdSNTF)rrrZorigin_req_host)rrrrris_third_partys rc@sJeZdZdddZddZdddZd d Zdd d Zd dZddZ dS)rFcCs|dk rt|}| dk r$tt| } |dkr<|dkr)rrrryrx)rplimitZ namevaluerrr__str__)s   zCookie.__str__cCslg}dD]$}t||}|d|t|fq|dt|j|dt|jd|jjd|fS)N)rrxryrrrrrrrrrrrrr}zrest=%sz rfc2109=%sz%s(%s)r)getattrrrreprrr __class____name__r)rrrxrrrr__repr__3s zCookie.__repr__)F)N)N) r __module__ __qualname__rrrrrrrrrrrrs *   c@s,eZdZddZddZddZddZd S) rcCs tdSrNotImplementedErrorrcookierrrrset_okKszCookiePolicy.set_okcCs tdSrrrrrr return_okTszCookiePolicy.return_okcCsdSNTr)rrrrrrdomain_return_okXszCookiePolicy.domain_return_okcCsdSrr)rrrrrrpath_return_ok]szCookiePolicy.path_return_okN)rrrrrrrrrrrrBs  c @seZdZdZdZdZdZeeBZdddddddddedddf d d Zd d Z d dZ ddZ ddZ ddZ ddZddZddZddZddZdd Zd!d"Zd#d$Zd%d&Zd'd(Zd)d*Zd+d,Zd-d.Zd/d0Zd1d2Zd3d4Zd5d6ZdS)7rrrrUr NTF)ZhttpsZwsscCsv||_||_||_||_||_||_| |_| |_| |_| |_ | |_ |dk rVt ||_ nd|_ |dk rlt |}||_ dS)Nr)netscaperfc2965rfc2109_as_netscape hide_cookie2 strict_domainstrict_rfc2965_unverifiablestrict_ns_unverifiablestrict_ns_domainstrict_ns_set_initial_dollarstrict_ns_set_pathsecure_protocolstuple_blocked_domains_allowed_domains)rblocked_domainsallowed_domainsrrrrrrrrrrrrrrrms" zDefaultCookiePolicy.__init__cCs|jSr)rrrrrrsz#DefaultCookiePolicy.blocked_domainscCst||_dSr)rr)rrrrrset_blocked_domainssz'DefaultCookiePolicy.set_blocked_domainscCs |jD]}t||rdSqdSr)rr)rrZblocked_domainrrr is_blockeds  zDefaultCookiePolicy.is_blockedcCs|jSr)rrrrrrsz#DefaultCookiePolicy.allowed_domainscCs|dk rt|}||_dSr)rr)rrrrrset_allowed_domainssz'DefaultCookiePolicy.set_allowed_domainscCs.|jdkrdS|jD]}t||rdSqdSr)rr)rrZallowed_domainrrris_not_alloweds    z"DefaultCookiePolicy.is_not_allowedcCs@td|j|jdD]&}d|}t||}|||sdSqdS)N - checking cookie %s=%s)r verifiabilityrxrrrZset_ok_FTrrxryrrrrnZfn_namefnrrrrs  zDefaultCookiePolicy.set_okcCsZ|jdkrtd|j|jdS|jdkr:|js:tddS|jdkrV|jsVtddSdS)Nz0 Set-Cookie2 without version attribute (%s=%s)Fr $ RFC 2965 cookies are switched off$ Netscape cookies are switched offT)rrrxryrrrrrrset_ok_versions z"DefaultCookiePolicy.set_ok_versioncCsJ|jrFt|rF|jdkr*|jr*tddS|jdkrF|jrFtddSdSNr z> third-party RFC 2965 cookie during unverifiable transactionFz> third-party Netscape cookie during unverifiable transactionTZ unverifiablerrrrrrrrrset_ok_verifiabilitysz(DefaultCookiePolicy.set_ok_verifiabilitycCs0|jdkr,|jr,|jdr,td|jdSdS)Nr $z' illegal name (starts with '$'): '%s'FT)rrrxrsrrrrr set_ok_names   zDefaultCookiePolicy.set_ok_namecCsL|jrHt|}|jdks(|jdkrH|jrH||j|sHtd|j|dSdS)Nr z7 path attribute %s is not a prefix of request path %sFT)rrrrrrr)rrrreq_pathrrr set_ok_paths  zDefaultCookiePolicy.set_ok_pathc Cs||jrtd|jdS||jr8td|jdS|jrt|\}}|j}|jr|ddkr|d}|dd|}|dkr||dd}||d|} | dkrt |dkrtd |dS| dr|dd} n|} | ddk} | s|d krtd |dS|j dkrX||sX| dsXd||sXtd ||dS|j dksr|j|j@rt||std ||dS|j dks|j|j@r|dt | } | ddkrt|std| |dSdS)N" domain %s is in user block-listF& domain %s is not in user allow-listrrr r)coZacZcomZeduZorgZnetZgovZmilrAZaeroZbizcatZcoopinfoZjobsZmobiZmuseumrxZproZtravelZeuz& country-code second level domain %srz/ non-local domain %s contains no embedded dotzO effective request-host %s (even with added initial dot) does not end with %sz5 effective request-host %s does not domain-match %sz. host prefix %s for domain %s contains a dotT)rrrrrrrcountrrKlenrsrrrrDomainRFC2965MatchrDomainStrictNoDotsrr@) rrrrrrrjZtldZsldZundotted_domainZ embedded_dotsZ host_prefixrrr set_ok_domains|                  z!DefaultCookiePolicy.set_ok_domainc Cs|jrt|}|dkrd}nt|}|jdD]@}z t|Wn"tk rbtd|YdSX||kr0qq0td||jdSdS)N80rlz bad port %s (not numeric)Fz$ request port (%s) not found in %sT)rrstrrrrArLrrrrZreq_portrrrr set_ok_port+s&   zDefaultCookiePolicy.set_ok_portcCs@td|j|jdD]&}d|}t||}|||sdSqdS)Nr)rrrrrrZ return_ok_FTr r rrrr@s   zDefaultCookiePolicy.return_okcCs<|jdkr|jstddS|jdkr8|js8tddSdS)Nr r FrT)rrrrrrrrreturn_ok_versionRsz%DefaultCookiePolicy.return_ok_versioncCsJ|jrFt|rF|jdkr*|jr*tddS|jdkrF|jrFtddSdSrrrrrrreturn_ok_verifiability[sz+DefaultCookiePolicy.return_ok_verifiabilitycCs"|jr|j|jkrtddSdS)Nz( secure cookie with non-secure requestFT)rtyperrrrrrreturn_ok_securegsz$DefaultCookiePolicy.return_ok_securecCs||jrtddSdS)Nz cookie expiredFT)r_nowrrrrrreturn_ok_expiresms z%DefaultCookiePolicy.return_ok_expirescCsN|jrJt|}|dkrd}|jdD]}||kr&qJq&td||jdSdS)Nr"rlz0 request port %s does not match cookie port %sFT)rrrrr$rrrreturn_ok_portssz"DefaultCookiePolicy.return_ok_portcCst|\}}|j}|r*|ds*d|}n|}|jdkr^|j|j@r^|js^||kr^tddS|jdkrt||std||dS|jdkrd| |std||dSdS)Nrr zQ cookie with unspecified domain does not string-compare equal to request domainFzQ effective request-host name %s does not domain-match RFC 2965 cookie domain %sz; request-host %s does not match Netscape cookie domain %sT) rrrsrrDomainStrictNonDomainrrrr)rrrrrr dotdomainrrrreturn_ok_domains6    z$DefaultCookiePolicy.return_ok_domaincCst|\}}|dsd|}|ds0d|}|rH|dsHd|}n|}||sd||sddS||r|td|dS||rtd|dSdS)NrFrrT)rrsrrrr)rrrrrr.rrrrs"        z$DefaultCookiePolicy.domain_return_okcCsbtd|t|}t|}||kr&dS||rR|dsN|||ddkrRdStd||dS)Nz- checking cookie path=%sTrrz %s does not path-match %sF)rrrrsr)rrrrZpathlenrrrrs   z"DefaultCookiePolicy.path_return_ok)rrrrr-rZ DomainLiberalZ DomainStrictrrrrrrrrrrrrr!r%rr&r'r)r+r,r/rrrrrrrcsR #   ;  cCst|}t|j|Sr)sortedkeysmapr)Zadictr1rrrvals_sorted_by_keys r3c csVt|}|D]D}d}z |jWntk r2YnXd}t|EdH|s |Vq dSr)r3itemsAttributeError deepvalues)mappingvaluesobjrrrr6s r6c@s eZdZdS)AbsentNrrrrrrrr:sr:c@seZdZedZedZedZedZedZ edej Z d2dd Z d d Z d d ZddZddZddZddZddZddZddZddZddZd d!Zd"d#Zd3d$d%Zd&d'Zd(d)Zd*d+Zd,d-Zd.d/Zd0d1Z dS)4rz\Wr{z\.?[^.]*z[^.]*z^\.+z^\#LWP-Cookies-(\d+\.\d+)NcCs(|dkrt}||_t|_i|_dSr)r_policy _threadingRLock _cookies_lock_cookiesrpolicyrrrrs  zCookieJar.__init__cCs ||_dSr)r<rArrr set_policyszCookieJar.set_policycCsg}|j||sgStd||j|}|D]T}|j||sFq2||}|D].}|j||srtdqVtd||qVq2|S)Nz!Checking %s for cookies to returnz not returning cookiez it's a match) r<rrr@r1rr8rrr)rrrcookiesZcookies_by_pathrZcookies_by_namerrrr_cookies_for_domains     zCookieJar._cookies_for_domaincCs*g}|jD]}||||q|Sr)r@r1extendrE)rrrDrrrr_cookies_for_requestszCookieJar._cookies_for_requestc Cs<|jddddd}g}|D]}|j}|sHd}|dkrH|d||jdk rz|j|jrz|dkrz|jd|j}n|j}|jdkr||jn|d |j|f|dkr|j r|d |j |j d r|j }|j s| d r|d d}|d ||jdk rd}|jr,|d|j}||q|S)NcSs t|jSr)rr)arrrz)CookieJar._cookie_attrs..T)rreverseFr z $Version=%sr|r}z $Path="%s"rrz $Domain="%s"z$Portz="%s")sortrrrry non_word_rer@quote_rer^rxrrrrsrrr) rrDrattrsrrryrrrrr _cookie_attrssF        zCookieJar._cookie_attrscCstd|jztt|j_|_||}| |}|r^| ds^| dd ||jj r|jjs| ds|D]}|jdkr|| ddqq|W5|jX|dS)Nadd_cookie_headerrr~ZCookie2rz $Version="1")rr?acquirereleaserArMr<r*rGrPZ has_headerZadd_unredirected_headerrrrrclear_expired_cookies)rrrDrOrrrrrQIs*        zCookieJar.add_cookie_headerc Csg}d}d}|D]z}|d\}}d}d} i} i} |ddD]0\} } | }||ks`||krd|} | |krx| dkrxd} | | krq>| dkr| dkrtdd} qr| } | d kr|rq>| dkrtd q>| d kr d}z t| } Wn*tk rtd d} YqrYnXd } |j| } | |ks4| |krh| dkr^| d kr^td| d} qr| | | <q>| | | <q>| rzq|||| | fq|S)N)rr)rrrrrrr commenturlr FrTrz% missing value for domain attributerzM missing or invalid value for expires attribute: treating as session cookierz? missing or invalid (non-numeric) value for max-age attribute)rrrUz! missing value for %s attribute)rKrrArLr*rr)r attrs_set cookie_tuples boolean_attrs value_attrsZ cookie_attrsrxryZ max_age_setZ bad_cookiestandardrrrrrrr_normalized_cookie_tuplesjsh          z#CookieJar._normalized_cookie_tuplescCs&|\}}}}|dt}|dt}|dt} |dt} |dd} | dk rtz t| } Wntk rrYdSX|dd} |dd} |d d}|d d}|tk r|d krd }t|}nXd}t|}|d }|dkr| dkr|d|}n|d|d}t|dkrd }|tk }d}|r:t| d}|tkrVt |\}}|}n| dsjd|}d}| tk r| dkrt |} nd }t dd | } nd} | tkrd} d } nH| |jkrz||||Wntk rYnXtd|||dSt| ||| ||||||| | | |||S)NrrrrrrFrrrUrWTrrr rrz\s+z2Expiring cookie, domain='%s', path='%s', name='%s')rr:rArLrrrrboolrsrrrtr^r*clearKeyErrorrr)rtuprrxryrZrrrrrrrrrrrrrrrrrrrr_cookie_from_cookie_tuples                      z#CookieJar._cookie_from_cookie_tuplecCs6||}g}|D]}|||}|r||q|Sr)r[r`rr)rrVrrWrDr_rrrr_cookies_from_attrs_set's   z!CookieJar._cookies_from_attrs_setcCsHt|jdd}|dkr |jj }|D]}|jdkr$d|_|r$d|_q$dS)NrrTr )rr<rrr)rrDZ rfc2109_as_nsrrrr_process_rfc2109_cookies0s  z"CookieJar._process_rfc2109_cookiesc Cs:|}|dg}|dg}tt|j_|_|jj}|jj}|sN|rf|sV|rf|s^|rf|sj|sjgSz|t ||}Wnt k rt g}YnX|r6|r6z|t ||} Wnt k rt g} YnX| | |r&i} |D]} d| | j| j| jf<q| fdd} t| | } | r6|| |S)Nz Set-Cookie2z Set-CookiecSs|j|j|jf}||kSr)rrrx)Z ns_cookielookuprrrrno_matching_rfc2965isz3CookieJar.make_cookies..no_matching_rfc2965)rZget_allrArMr<r*rrrarz ExceptionrrrbrrrxfilterrF) rresponserrZ rfc2965_hdrsZns_hdrsrrrDZ ns_cookiesrcrrdrrr make_cookies<s^         zCookieJar.make_cookiescCsN|jz2tt|j_|_|j||r:||W5|jXdSr) r?rRrSrArMr<r*r set_cookierrrrset_cookie_if_okss  zCookieJar.set_cookie_if_okcCsl|j}|jzJ|j|kr&i||j<||j}|j|krDi||j<||j}|||j<W5|jXdSr)r@r?rRrSrrrx)rrcZc2Zc3rrrris     zCookieJar.set_cookiecCsbtd||jz8|||D]&}|j||r&td|||q&W5|jXdS)Nzextract_cookies: %sz setting cookie: %s) rrr?rRrSrhr<rri)rrgrrrrrextract_cookiess  zCookieJar.extract_cookiescCst|dk r2|dks|dkr td|j|||=n>|dk rX|dkrJtd|j||=n|dk rj|j|=ni|_dS)Nz8domain and path must be given to remove a cookie by namez.domain must be given to remove cookies by path)rLr@)rrrrxrrrr]s  zCookieJar.clearcCsD|jz(|D]}|jr||j|j|jqW5|jXdSr)r?rRrSrr]rrrx)rrrrrclear_session_cookiess  zCookieJar.clear_session_cookiescCsP|jz4t}|D]"}||r||j|j|jqW5|jXdSr) r?rRrSrMrr]rrrx)rrrrrrrTs  zCookieJar.clear_expired_cookiescCs t|jSr)r6r@rrrr__iter__szCookieJar.__iter__cCsd}|D] }|d}q|S)Nr rr)rrrrrr__len__s zCookieJar.__len__cCs2g}|D]}|t|qd|jjd|fSNz<%s[%s]>r)rrrrrrrrrrrrrszCookieJar.__repr__cCs2g}|D]}|t|qd|jjd|fSrp)rrr#rrrrqrrrrszCookieJar.__str__)N)NNN)!rrrrtcompilerMrNZstrict_domain_reZ domain_reZdots_reASCIImagic_rerrCrErGrPrQr[r`rarbrhrjrirlr]rmrTrnrorrrrrrrs6      ;!a\  7   c@s eZdZdS)rNr;rrrrrsc@s4eZdZd ddZd ddZd ddZdd d ZdS)rNFcCs2t|||dk rt|}||_t||_dSr)rrosfspathfilenamer\ delayload)rrxryrBrrrrs   zFileCookieJar.__init__cCs tdSrr)rrxignore_discardignore_expiresrrrsaveszFileCookieJar.savec CsJ|dkr"|jdk r|j}nttt|}|||||W5QRXdSr)rxrLMISSING_FILENAME_TEXTopen _really_loadrrxrzr{rrrrloads   zFileCookieJar.loadcCs|dkr"|jdk r|j}ntt|jzFt|j}i|_z| |||Wnt k rn||_YnXW5|jXdSr) rxrLr}r?rRrSrZdeepcopyr@rOSError)rrxrzr{Z old_staterrrrevert s    zFileCookieJar.revert)NFN)NFF)NFF)NFF)rrrrr|rrrrrrrs  cCs |j|jfd|jfd|jfg}|jdk r8|d|jf|jrH|d|jrX|d|jrh|d|j rx|d|j r|dt t |j f|j r|d |jr|d |jf|jr|d |jft|j}|D]}||t|j|fq|d t|jft|gS) Nrrr) path_specN) port_specN) domain_dotN)rNr)rNrrUr)rxryrrrrrrrrrrr5r[rrrr0rr1r#rr)rrr1rrrrlwp_cookie_str$s:        rc@s(eZdZd ddZd ddZdd ZdS) rTcCsTt}g}|D]2}|s |jr q|s0||r0q|dt|qd|dgS)NzSet-Cookie3: %s rW)rMrrrrrr)rrzr{rrrrrrr as_lwp_strMs zLWPCookieJar.as_lwp_strNFc CsX|dkr"|jdk r|j}nttt|d"}|d||||W5QRXdS)Nwz#LWP-Cookies-2.0 )rxrLr}r~writerrrrrr|]s   zLWPCookieJar.savecCs0|}|j|s$d|}t|t}d}d} d} z|} | dkrPq| |s\q<| t|d} t| gD]f} | d\} }i}i}| D] }d||<q| ddD]n\}}|dk r| }nd}|| ks|| kr|}|| kr|dkrd }|||<q|| kr|||<q|||<q|j }|d }|d }|dk rJt |}|dkrXd }|d }|d }t |d| ||d|d|||d|d|d|d|||d|d|}|s|j rqz|s||rqz||qzqq|drT|dd}|ds*|dkrpq*|d\}} } } } } }| dk} | dk} | dkr|} d}|d}d }| dkrd} d }t d | |dd || || d | | |ddi}|s|j rq*|s | |r q*| |q*WnBt k r2Yn,tk r\ttd ||fYnXdS) Nz4%r does not look like a Netscape format cookies filerWrr)#r TRUErFTr z+invalid Netscape format cookies file %r: %r)rMrrur@rrrrsrrrrrirrer)rrrxrzr{rrrrrrrrrxryrrrkrrrrsr     zMozillaCookieJar._really_loadNFc Cs|dkr"|jdk r|j}nttt|d}||jt}|D]}|sV|jrVqF|sf||rfqF|j rrd}nd}|j drd}nd}|j dk rt |j } nd} |jdkrd} |j} n |j} |j} |d|j ||j|| | | gdqFW5QRXdS)NrrZFALSErrWrr)rxrLr}r~rrrMrrrrrsrr#ryrxrr) rrxrzr{rrrrrrrxryrrrr| sH        zMozillaCookieJar.save)NFF) rrrrtrsrurrr|rrrrrs A)N)N)W__all__rvrr-rtrMZ urllib.parserZurllib.requestZ threadingr=Z http.clientZhttpZcalendarr r r rr#ZclientZ HTTP_PORTrr}rr%r,r6r7rIr(rrrKr5r8r>rsrtr?rFrTrYIr]Xr_rbrcrerkrmrnrprorzrrrrrrrrrrrrrrrrrrrrrrrr3r6r:rrrrrrrrrrrs     8  8 !    U D'    #b!b7xPKΠ]~!AAserver.cpython-38.opt-1.pycnu[U e5d@s dZdZdddddgZddlZddlZddlZddlZddlZ ddl Z ddl Z ddl Z ddl Z ddlZddlZddlZddlZddlZddlZddlZddlZddlZdd lmZdd l mZd Zd ZGd ddejZGdddejeZ Gdddej!Z"Gddde"Z#ddZ$da%ddZ&ddZ'Gddde#Z(ddZ)e"e dddfddZ*e+dkrddl,Z,e,-Z.e.j/dd d!d"e.j/d#d$d%d&d'e.j/d(d)e 0d*d+e.j/d,d-de1d.d/d0e.2Z3e3j4re(Z5nee#e3j6d1Z5Gd2d3d3e Z7e*e5e7e3j8e3j9d4dS)5a@HTTP server classes. Note: BaseHTTPRequestHandler doesn't implement any HTTP request; see SimpleHTTPRequestHandler for simple implementations of GET, HEAD and POST, and CGIHTTPRequestHandler for CGI scripts. It does, however, optionally implement HTTP/1.1 persistent connections, as of version 0.3. Notes on CGIHTTPRequestHandler ------------------------------ This class implements GET and POST requests to cgi-bin scripts. If the os.fork() function is not present (e.g. on Windows), subprocess.Popen() is used as a fallback, with slightly altered semantics. In all cases, the implementation is intentionally naive -- all requests are executed synchronously. SECURITY WARNING: DON'T USE THIS CODE UNLESS YOU ARE INSIDE A FIREWALL -- it may execute arbitrary Python code or external programs. Note that status code 200 is sent prior to execution of a CGI script, so scripts cannot send other status codes such as 302 (redirect). XXX To do: - log requests even later (to capture byte count) - log user-agent header and other interesting goodies - send error log to separate file z0.6 HTTPServerThreadingHTTPServerBaseHTTPRequestHandlerSimpleHTTPRequestHandlerCGIHTTPRequestHandlerN)partial) HTTPStatusa Error response

Error response

Error code: %(code)d

Message: %(message)s.

Error code explanation: %(code)s - %(explain)s.

ztext/html;charset=utf-8c@seZdZdZddZdS)rcCs4tj||jdd\}}t||_||_dS)z.Override server_bind to store the server name.N) socketserver TCPServer server_bindZserver_addresssocketZgetfqdn server_name server_port)selfhostportr#/usr/lib64/python3.8/http/server.pyr s  zHTTPServer.server_bindN)__name__ __module__ __qualname__Zallow_reuse_addressr rrrrrsc@seZdZdZdS)rTN)rrrZdaemon_threadsrrrrrsc @sJeZdZdZdejdZdeZ e Z e Z dZddZdd Zd d Zd d ZdFddZdGddZdHddZddZddZddZdIddZddZed d!eed"ed#d$DZ d%e e!d&<d'd(Z"d)d*Z#dJd+d,Z$d-d.Z%d/d0d1d2d3d4d5gZ&dd6d7d8d9d:d;dd?d@dAg Z'dBdCZ(dDZ)e*j+j,Z-dEd!e.j/0DZ1dS)KraHTTP request handler base class. The following explanation of HTTP serves to guide you through the code as well as to expose any misunderstandings I may have about HTTP (so you don't need to read the code to figure out I'm wrong :-). HTTP (HyperText Transfer Protocol) is an extensible protocol on top of a reliable stream transport (e.g. TCP/IP). The protocol recognizes three parts to a request: 1. One line identifying the request type and path 2. An optional set of RFC-822-style headers 3. An optional data part The headers and data are separated by a blank line. The first line of the request has the form where is a (case-sensitive) keyword such as GET or POST, is a string containing path information for the request, and should be the string "HTTP/1.0" or "HTTP/1.1". is encoded using the URL encoding scheme (using %xx to signify the ASCII character with hex code xx). The specification specifies that lines are separated by CRLF but for compatibility with the widest range of clients recommends servers also handle LF. Similarly, whitespace in the request line is treated sensibly (allowing multiple spaces between components and allowing trailing whitespace). Similarly, for output, lines ought to be separated by CRLF pairs but most clients grok LF characters just fine. If the first line of the request has the form (i.e. is left out) then this is assumed to be an HTTP 0.9 request; this form has no optional headers and data part and the reply consists of just the data. The reply form of the HTTP 1.x protocol again has three parts: 1. One line giving the response code 2. An optional set of RFC-822-style headers 3. The data Again, the headers and data are separated by a blank line. The response code line has the form where is the protocol version ("HTTP/1.0" or "HTTP/1.1"), is a 3-digit response code indicating success or failure of the request, and is an optional human-readable string explaining what the response code means. This server parses the request and the headers, and then calls a function specific to the request type (). Specifically, a request SPAM will be handled by a method do_SPAM(). If no such method exists the server sends an error response to the client. If it exists, it is called with no arguments: do_SPAM() Note that the request name is case sensitive (i.e. SPAM and spam are different requests). The various request details are stored in instance variables: - client_address is the client IP address in the form (host, port); - command, path and version are the broken-down request line; - headers is an instance of email.message.Message (or a derived class) containing the header information; - rfile is a file object open for reading positioned at the start of the optional input data part; - wfile is a file object open for writing. IT IS IMPORTANT TO ADHERE TO THE PROTOCOL FOR WRITING! The first thing to be written must be the response line. Then follow 0 or more header lines, then a blank line, and then the actual data (if any). The meaning of the header lines depends on the command executed by the server; in most cases, when data is returned, there should be at least one header line of the form Content-type: / where and should be registered MIME types, e.g. "text/html" or "text/plain". zPython/rz BaseHTTP/HTTP/0.9c Csd|_|j|_}d|_t|jd}|d}||_|}t |dkrLdSt |dkr&|d}zT| d srt |d d d }|d }t |d krt t |dt |d f}Wn,t t fk r|tjd|YdSX|dkr|jdkrd|_|dkr |tjd|dS||_d t |krBdksZn|tjd|dS|dd \}}t |d krd|_|dkr|tjd|dS|||_|_|j drd |jd |_ztjj|j|jd|_Wntjjk r(}z|tjdt|WYdSd}~XYnBtjjk rh}z|tjdt|WYdSd}~XYnX|jdd} | dkrd|_n | dkr|jdkrd|_|jdd} | dkr|jdkr|jdkr| sdSdS) aHParse a request (internal). The request should be stored in self.raw_requestline; the results are in self.command, self.path, self.request_version and self.headers. Return True for success, False for failure; on failure, any relevant error response has already been sent back. NTz iso-8859-1z rFzHTTP//r .r zBad request version (%r))r r zHTTP/1.1)r rzInvalid HTTP version (%s)zBad request syntax (%r)ZGETzBad HTTP/0.9 request type (%r)z//)Z_classz Line too longzToo many headers Connectionclose keep-aliveZExpectz 100-continue)!commanddefault_request_versionrequest_versionclose_connectionstrraw_requestlinerstrip requestlinesplitlen startswith ValueErrorint IndexError send_errorrZ BAD_REQUESTprotocol_versionZHTTP_VERSION_NOT_SUPPORTEDpathlstriphttpclientZ parse_headersrfile MessageClassheadersZ LineTooLongZREQUEST_HEADER_FIELDS_TOO_LARGEZ HTTPExceptiongetlowerhandle_expect_100) rversionr)wordsZbase_version_numberZversion_numberr"r2errZconntypeZexpectrrr parse_requests             z$BaseHTTPRequestHandler.parse_requestcCs|tj|dS)a7Decide what to do with an "Expect: 100-continue" header. If the client is expecting a 100 Continue response, we must respond with either a 100 Continue or a final response before waiting for the request body. The default is to always respond with a 100 Continue. You can behave differently (for example, reject unauthorized requests) by overriding this method. This method should either return True (possibly after sending a 100 Continue response) or send an error response and return False. T)send_response_onlyrZCONTINUE end_headersrrrrr;xs z(BaseHTTPRequestHandler.handle_expect_100c Csz|jd|_t|jdkrBd|_d|_d|_|tj WdS|jsTd|_ WdS| sbWdSd|j}t ||s|tj d|jWdSt||}||jWn<tjk r}z|d|d|_ WYdSd}~XYnXdS) zHandle a single HTTP request. You normally don't need to override this method; see the class __doc__ string for information on how to handle specific HTTP commands such as GET and POST. iirNTZdo_zUnsupported method (%r)zRequest timed out: %r)r6readliner'r+r)r$r"r0rZREQUEST_URI_TOO_LONGr%r?hasattrNOT_IMPLEMENTEDgetattrwfileflushrZtimeout log_error)rZmnamemethoderrrhandle_one_requests6     z)BaseHTTPRequestHandler.handle_one_requestcCs"d|_||js|qdS)z&Handle multiple requests if necessary.TN)r%rLrBrrrhandleszBaseHTTPRequestHandler.handleNcCs z|j|\}}Wntk r.d\}}YnX|dkr<|}|dkrH|}|d||||||ddd}|dkr|tjtjtjfkr|j |t j |ddt j |ddd }| d d }|d |j |d tt|||jdkr|r|j|dS)akSend and log an error reply. Arguments are * code: an HTTP error code 3 digits * message: a simple optional 1 line reason phrase. *( HTAB / SP / VCHAR / %x80-FF ) defaults to short entry matching the response code * explain: a detailed message defaults to the long entry matching the response code. This sends an error response (so it must be called before any output has been generated), logs the error, and finally sends a piece of HTML explaining the error to the user. )???rNNzcode %d, message %srr Fquote)codemessageexplainzUTF-8replacez Content-TypeContent-LengthZHEAD) responsesKeyErrorrI send_response send_headerrZ NO_CONTENTZ RESET_CONTENT NOT_MODIFIEDerror_message_formathtmlescapeencodeerror_content_typer&r+rAr"rGwrite)rrRrSrTZshortmsgZlongmsgZbodyZcontentrrrr0s:     z!BaseHTTPRequestHandler.send_errorcCs:||||||d||d|dS)zAdd the response header to the headers buffer and log the response code. Also send two standard headers with the server software version and the current date. ZServerZDateN) log_requestr@rZversion_stringdate_time_stringrrRrSrrrrYs  z$BaseHTTPRequestHandler.send_responsecCsd|jdkr`|dkr0||jkr,|j|d}nd}t|ds@g|_|jd|j||fdddS) zSend the response header only.rNrr_headers_bufferz %s %d %s latin-1strict)r$rWrDrfappendr1r_rerrrr@s    z)BaseHTTPRequestHandler.send_response_onlycCsl|jdkr6t|dsg|_|jd||fdd|dkrh|dkrVd|_n|d krhd |_d S) z)Send a MIME header to the headers buffer.rrfz%s: %s rgrhZ connectionr Tr!FN)r$rDrfrir_r:r%)rkeywordvaluerrrrZs     z"BaseHTTPRequestHandler.send_headercCs"|jdkr|jd|dS)z,Send the blank line ending the MIME headers.rs N)r$rfri flush_headersrBrrrrAs  z"BaseHTTPRequestHandler.end_headerscCs(t|dr$|jd|jg|_dS)Nrf)rDrGrajoinrfrBrrrrls z$BaseHTTPRequestHandler.flush_headers-cCs.t|tr|j}|d|jt|t|dS)zNLog an accepted request. This is called by send_response(). z "%s" %s %sN) isinstancerrk log_messager)r&)rrRsizerrrrb s z"BaseHTTPRequestHandler.log_requestcGs|j|f|dS)zLog an error. This is called when a request cannot be fulfilled. By default it passes the message on to log_message(). Arguments are the same as for log_message(). XXX This should go to the separate error log. N)rq)rformatargsrrrrI+s z BaseHTTPRequestHandler.log_errorcCsi|]}|d|dqS)z\xZ02xr).0crrr ;sz!BaseHTTPRequestHandler. z\\\cGs2||}tjd||||jfdS)aZLog an arbitrary message. This is used by all other logging functions. Override it if you have specific logging wishes. The first argument, FORMAT, is a format string for the message to be logged. If the format string contains any % escapes requiring parameters, they should be specified as subsequent arguments (it's just like printf!). The client ip and current date/time are prefixed to every message. Unicode control characters are replaced with escaped hex before writing the output to stderr. z%s - - [%s] %s N)sysstderrraaddress_stringlog_date_time_string translate_control_char_table)rrsrtrSrrrrq>s z"BaseHTTPRequestHandler.log_messagecCs|jd|jS)z*Return the server software version string. )server_version sys_versionrBrrrrcXsz%BaseHTTPRequestHandler.version_stringcCs |dkrt}tjj|ddS)z@Return the current date and time formatted for a message header.NT)Zusegmt)timeemailutilsZ formatdate)rZ timestamprrrrd\sz'BaseHTTPRequestHandler.date_time_stringc CsBt}t|\ }}}}}}}} } d||j|||||f} | S)z.Return the current time formatted for logging.z%02d/%3s/%04d %02d:%02d:%02d)r localtime monthname) rZnowZyearZmonthZdayZhhZmmZssxyzsrrrrbsz+BaseHTTPRequestHandler.log_date_time_stringZMonZTueZWedZThuZFriZSatZSunZJanZFebZMarZAprZMayZJunZJulZAugZSepZOctZNovZDeccCs |jdS)zReturn the client address.r)client_addressrBrrrr~psz%BaseHTTPRequestHandler.address_stringHTTP/1.0cCsi|]}||j|jfqSr)phraseZ description)ruvrrrrws)NN)N)N)roro)N)2rrr__doc__r|r<r*r __version__rDEFAULT_ERROR_MESSAGEr\DEFAULT_ERROR_CONTENT_TYPEr`r#r?r;rLrMr0rYr@rZrArlrbrIr& maketrans itertoolschainrangerordrqrcrdrZ weekdaynamerr~r1r4r5Z HTTPMessager7r __members__valuesrWrrrrrs^gj% 5     cseZdZdZdeZddfdd ZddZd d Zd d Z d dZ ddZ ddZ ddZ ejsleejZedddddZS)raWSimple HTTP request handler with GET and HEAD commands. This serves files from the current directory and any of its subdirectories. The MIME type for files is determined by calling the .guess_type() method. The GET and HEAD requests are identical except that the HEAD request omits the actual contents of the file. z SimpleHTTP/N directorycs(|dkrt}||_tj||dSN)osgetcwdrsuper__init__)rrrtkwargs __class__rrrsz!SimpleHTTPRequestHandler.__init__cCs.|}|r*z|||jW5|XdS)zServe a GET request.N) send_headr copyfilerGrfrrrdo_GETs zSimpleHTTPRequestHandler.do_GETcCs|}|r|dS)zServe a HEAD request.N)rr rrrrdo_HEADsz SimpleHTTPRequestHandler.do_HEADc Cs^||j}d}tj|rtj|j}|jds|t j |d|d|dd|d|df}tj |}| d|| dSd D]&}tj||}tj|r|}qq||S||}|dr|t jd dSzt|d }Wn&tk r|t jd YdSXz"t|}d |jkrd |jkrztj|jd } Wnttttfk r|YnzX| j dkr| j!t"j#j$d} | j t"j#j$krt"j"%|j&t"j#j$} | j!dd} | | kr|t j'| |(WdS|t j)| d|| dt*|d| d|+|j&| |WS|(YnXdS)a{Common code for GET and HEAD commands. This sends the response code and MIME headers. Return value is either a file object (which has to be copied to the outputfile by the caller unless the command was HEAD, and must be closed by the caller under all circumstances), or None, in which case the caller has nothing further to do. Nrrr r rZLocation)z index.htmlz index.htmzFile not foundrbzIf-Modified-Sincez If-None-Match)tzinfo)Z microsecond Content-typerVz Last-Modified),translate_pathr2risdirurllibparseZurlsplitendswithrYrZMOVED_PERMANENTLYZ urlunsplitrZrArnexistslist_directory guess_typer0 NOT_FOUNDopenOSErrorfstatfilenor8rrZparsedate_to_datetime TypeErrorr/ OverflowErrorr-rrUdatetimetimezoneZutcZ fromtimestampst_mtimer[r OKr&rd) rr2rpartsZ new_partsZnew_urlindexZctypeZfsZimsZ last_modifrrrrs                  z"SimpleHTTPRequestHandler.send_headc Cszt|}Wn$tk r2|tjdYdSX|jdddg}ztjj |j dd}Wn"t k rtj |j }YnXt j |dd }t}d |}|d |d |d ||d||d||d|D]v}tj ||}|} } tj |r$|d} |d} tj |r:|d} |dtjj| ddt j | dd fq|dd||d} t} | | | d|tj|dd||dtt| || S)zHelper to produce a directory listing (absent index.html). Return value is either a file object, or None (indicating an error). In either case, the headers are sent, making the interface the same as for send_head(). zNo permission to list directoryNcSs|Sr)r:)arrrrmz9SimpleHTTPRequestHandler.list_directory..)key surrogatepasserrorsFrPzDirectory listing for %szZz z@z%s z

%s

z
    r@z
  • %s
  • z

 surrogateescaperrztext/html; charset=%srV) rlistdirrr0rrsortrrunquoter2UnicodeDecodeErrorr]r^r|getfilesystemencodingrirnrislinkrQr_ioBytesIOraseekrYrrZr&r+rA) rr2listrZ displaypathenctitlenamefullnameZ displaynameZlinknameZencodedrrrrrsh          z'SimpleHTTPRequestHandler.list_directorycCs|ddd}|ddd}|d}ztjj|dd}Wn tk rbtj|}YnXt|}|d}t d|}|j }|D]0}t j |s|t jt jfkrqt j ||}q|r|d7}|S) zTranslate a /-separated PATH to the local filename syntax. Components that mean special things to the local file system (e.g. drive or directory names) are ignored. (XXX They should probably be diagnosed.) ?r r#rrrN)r*r(rrrrr posixpathnormpathfilterrrr2dirnamecurdirpardirrn)rr2Ztrailing_slashr=Zwordrrrr:s$    z'SimpleHTTPRequestHandler.translate_pathcCst||dS)aCopy all data between two file objects. The SOURCE argument is a file object open for reading (or anything with a read() method) and the DESTINATION argument is a file object open for writing (or anything with a write() method). The only reason for overriding this would be to change the block size or perhaps to replace newlines by CRLF -- note however that this the default server uses this to copy binary data as well. N)shutilZ copyfileobj)rsourceZ outputfilerrrrXsz!SimpleHTTPRequestHandler.copyfilecCsLt|\}}||jkr"|j|S|}||jkr>|j|S|jdSdS)aGuess the type of a file. Argument is a PATH (a filename). Return value is a string of the form type/subtype, usable for a MIME Content-type header. The default implementation looks the file's extension up in the table self.extensions_map, using application/octet-stream as a default; however it would be permissible (if slow) to look inside the data to make a better guess. rN)rsplitextextensions_mapr:)rr2baseZextrrrrhs    z#SimpleHTTPRequestHandler.guess_typezapplication/octet-streamz text/plain)r.pyz.cz.h)rrrrrrrrrrrrrr mimetypesZinitedZinitZ types_mapcopyrupdate __classcell__rrrrrs&  W: c Cs|d\}}}tj|}|d}g}|ddD],}|dkrL|q6|r6|dkr6||q6|r|}|r|dkr|d}q|dkrd}nd}|rd||f}dd||f}d|}|S)a Given a URL path, remove extra '/'s and '.' path elements and collapse any '..' references and returns a collapsed path. Implements something akin to RFC-2396 5.2 step 6 to parse relative paths. The utility of this function is limited to is_cgi method and helps preventing some security attacks. Returns: The reconstituted URL, which will always start with a '/'. Raises: IndexError if too many '..' occur within the path. rrNrz..rr) partitionrrrr*poprirn) r2_query path_partsZ head_partspartZ tail_partZ splitpathcollapsed_pathrrr_url_collapse_paths.      rcCsrtrtSz ddl}Wntk r*YdSXz|ddaWn.tk rldtdd|DaYnXtS) z$Internal routine to get nobody's uidrNrnobodyr r css|]}|dVqdS)r Nr)rurrrr sznobody_uid..)rpwd ImportErrorgetpwnamrXmaxZgetpwall)rrrr nobody_uids  rcCst|tjS)zTest for executable file.)raccessX_OK)r2rrr executablesrc@sVeZdZdZeedZdZddZddZ dd Z d d gZ d d Z ddZ ddZdS)rzComplete HTTP server with GET, HEAD and POST commands. GET and HEAD also support running CGI scripts. The POST command is *only* implemented for CGI scripts. forkrcCs$|r|n|tjddS)zRServe a POST request. This is only implemented for CGI scripts. zCan only POST to CGI scriptsN)is_cgirun_cgir0rrErBrrrdo_POSTs  zCGIHTTPRequestHandler.do_POSTcCs|r|St|SdS)z-Version of send_head that support CGI scriptsN)rrrrrBrrrrszCGIHTTPRequestHandler.send_headcCsPt|j}|dd}|d|||dd}}||jkrL||f|_dSdS)a3Test whether self.path corresponds to a CGI script. Returns True and updates the cgi_info attribute to the tuple (dir, rest) if self.path requires running a CGI script. Returns False otherwise. If any exception is raised, the caller should assume that self.path was rejected as invalid and act accordingly. The default implementation tests whether the normalized url path begins with one of the strings in self.cgi_directories (and the next character is a '/' or the end of the string). rr NTF)rr2findcgi_directoriescgi_info)rrZdir_sepheadtailrrrrs    zCGIHTTPRequestHandler.is_cgiz/cgi-binz/htbincCst|S)z1Test whether argument path is an executable file.)r)rr2rrr is_executablesz#CGIHTTPRequestHandler.is_executablecCstj|\}}|dkS)z.Test whether argument path is a Python script.)rz.pyw)rr2rr:)rr2r r rrr is_pythonszCGIHTTPRequestHandler.is_pythonc) Cs|j\}}|d|}|dt|d}|dkr|d|}||dd}||}tj|r||}}|dt|d}q*qq*|d\}}} |d}|dkr|d|||d} }n |d} }|d| } || } tj| s | t j d| dStj | s.| t j d| dS|| } |jsF| sh|| sh| t j d | dSttj}||d <|jj|d <d |d <|j|d<t|jj|d<|j|d<tj|}||d<|||d<| |d<| r| |d<|jd|d<|j d}|r|!}t|dkrddl"}ddl#}|d|d<|d$dkrz"|d%d}|&|'d}Wn|j(t)fk rYn&X|!d}t|dkr|d|d<|j ddkr|j*|d<n|jd|d<|j d}|r||d <|j d!}|r||d"<g}|j+d#D]>}|ddd$krR|,|-n||d%d!d&}q,d&.||d'<|j d(}|r||d)<t/d|j0d*g}d+.|}|r||d,<d-D]}|1|dq|2t j3d.|4| 5d/d0}|jr| g}d1|kr|,|t6}|j78t9}|dkrt:|d\}}t;;|jd2|dSz\zt?|Wnt@k rYnXtA|j|jq |$T|%\}&}'|j7U|&|'rj|>d;|'|$jVW|$jXW|$jY}(|(r|>d2|(n |Kd<dS)=zExecute a CGI script.rr rNrrzNo such CGI script (%r)z#CGI script is not a plain file (%r)z!CGI script is not executable (%r)ZSERVER_SOFTWAREZ SERVER_NAMEzCGI/1.1ZGATEWAY_INTERFACEZSERVER_PROTOCOLZ SERVER_PORTZREQUEST_METHODZ PATH_INFOZPATH_TRANSLATEDZ SCRIPT_NAME QUERY_STRINGZ REMOTE_ADDR authorizationr Z AUTH_TYPEZbasicascii:Z REMOTE_USERz content-typeZ CONTENT_TYPEzcontent-lengthCONTENT_LENGTHreferer HTTP_REFERERacceptz ,Z HTTP_ACCEPTz user-agentHTTP_USER_AGENTZcookiez, HTTP_COOKIE)rZ REMOTE_HOSTrrrrzScript output follows+r=zCGI script exit status %#xryzw.exez-uz command: %s)stdinstdoutr}envZpostz%szCGI script exited OK)Zr rr+rrr2rrrr0rrisfileZ FORBIDDENr  have_forkr rZdeepcopyenvironrcZserverrr1r&rr"rrrrr8r9r*base64binasciir:r_Z decodebytesdecodeError UnicodeErrorZget_content_typeZgetallmatchingheadersristriprnrZget_all setdefaultrYrrlrUrrGrHrwaitpidselectr6readrIsetuidrdup2rexecveZ handle_errorZrequest_exit subprocessr|rrrqZ list2cmdliner.rr-PopenPIPEZ_sockZrecvZ communicaterar}r r returncode))rdirrestr2iZnextdirZnextrestZ scriptdirrrZscriptZ scriptnameZ scriptfileZispyr Zuqrestrr$r%ZlengthrrlineZuacoZ cookie_strkZ decoded_queryrtrpidstsr2ZcmdlineZinterpnbytespdatarr}Zstatusrrrrs<                                           zCGIHTTPRequestHandler.run_cgiN)rrrrrDrr"Zrbufsizerrrrr r rrrrrrs cGs4tj|tjtjd}tt|\}}}}}||fS)N)typeflags)rZ getaddrinfoZ SOCK_STREAMZ AI_PASSIVEnextiter)ZaddressZinfosZfamilyrAprotoZ canonnameZsockaddrrrr_get_best_familysrFri@c Cst||\|_}||_|||}|jdd\}}d|krLd|dn|}td|d|d|d|d z |Wn&tk rtd t d YnXW5QRXdS) zmTest the HTTP request handler class. This runs an HTTP server on port 8000 (or the port argument). Nr r[]zServing HTTP on z port z (http://z/) ...z& Keyboard interrupt received, exiting.r) rFZaddress_familyr1rZ getsocknameprintZ serve_foreverKeyboardInterruptr|exit) HandlerClass ServerClassZprotocolrbindZaddrZhttpdrZurl_hostrrrtests  rO__main__z--cgi store_truezRun as CGI Server)actionhelpz--bindz-bZADDRESSz8Specify alternate bind address [default: all interfaces])metavarrSz --directoryz-dz9Specify alternative directory [default:current directory])defaultrSrZstorerz&Specify alternate port [default: 8000])rRrUrAnargsrSrcseZdZfddZZS)DualStackServerc s4tt|jtjtjdW5QRXtS)Nr) contextlibsuppress ExceptionrZ setsockoptZ IPPROTO_IPV6Z IPV6_V6ONLYrr rBrrrr s zDualStackServer.server_bind)rrrr rrrrrrWsrW)rLrMrrN):rr__all__rrZ email.utilsrr]Z http.clientr4rrrrrr,rrr r|rZ urllib.parserrX functoolsrrrrr rZThreadingMixInrZStreamRequestHandlerrrrrrrrrFrOrargparseArgumentParserparser add_argumentrr. parse_argsrtZcgiZ handler_classrrWrrNrrrrsR   s 0     PKΠ]2uI2Y2Yserver.cpython-38.opt-2.pycnu[U e5d@sdZdddddgZddlZddlZddlZddlZddlZddl Z ddl Z ddl Z ddl Z ddl Z ddlZddlZddlZddlZddlZddlZddlZddlZddlmZdd lmZd Zd ZGd ddejZGd ddejeZGdddej Z!Gddde!Z"ddZ#da$ddZ%ddZ&Gddde"Z'ddZ(e!edddfddZ)e*dkrddl+Z+e+,Z-e-j.ddd d!e-j.d"d#d$d%d&e-j.d'd(e /d)d*e-j.d+d,de0d-d.d/e-1Z2e2j3re'Z4nee"e2j5d0Z4Gd1d2d2eZ6e)e4e6e2j7e2j8d3dS)4z0.6 HTTPServerThreadingHTTPServerBaseHTTPRequestHandlerSimpleHTTPRequestHandlerCGIHTTPRequestHandlerN)partial) HTTPStatusa Error response

Error response

Error code: %(code)d

Message: %(message)s.

Error code explanation: %(code)s - %(explain)s.

ztext/html;charset=utf-8c@seZdZdZddZdS)rcCs4tj||jdd\}}t||_||_dS)N) socketserver TCPServer server_bindZserver_addresssocketZgetfqdn server_name server_port)selfhostportr#/usr/lib64/python3.8/http/server.pyr s  zHTTPServer.server_bindN)__name__ __module__ __qualname__Zallow_reuse_addressr rrrrrsc@seZdZdZdS)rTN)rrrZdaemon_threadsrrrrrsc @sFeZdZdejdZdeZe Z e Z dZ ddZddZd d Zd d ZdEddZdFddZdGddZddZddZddZdHddZddZedd eed!ed"d#DZd$ee d%<d&d'Z!d(d)Z"dId*d+Z#d,d-Z$d.d/d0d1d2d3d4gZ%d d5d6d7d8d9d:d;dd?d@g Z&dAdBZ'dCZ(e)j*j+Z,dDd e-j./DZ0d S)JrzPython/rz BaseHTTP/HTTP/0.9c Csd|_|j|_}d|_t|jd}|d}||_|}t |dkrLdSt |dkr&|d}zT| dsrt |d d d }|d }t |d krt t |dt |d f}Wn,t t fk r|tjd |YdSX|dkr|jdkrd|_|dkr |tjd|dS||_d t |krBdksZn|tjd|dS|dd \}}t |d krd|_|dkr|tjd|dS|||_|_|j drd |jd |_ztjj|j|jd|_Wntjjk r(}z|tjdt|WYdSd}~XYnBtjjk rh}z|tjdt|WYdSd}~XYnX|jdd} | dkrd|_n | dkr|jdkrd|_|jdd} | dkr|jdkr|jdkr| sdSdS)NTz iso-8859-1z rFzHTTP//r .r zBad request version (%r))r r zHTTP/1.1)r rzInvalid HTTP version (%s)zBad request syntax (%r)ZGETzBad HTTP/0.9 request type (%r)z//)Z_classz Line too longzToo many headers Connectionclose keep-aliveZExpectz 100-continue)!commanddefault_request_versionrequest_versionclose_connectionstrraw_requestlinerstrip requestlinesplitlen startswith ValueErrorint IndexError send_errorrZ BAD_REQUESTprotocol_versionZHTTP_VERSION_NOT_SUPPORTEDpathlstriphttpclientZ parse_headersrfile MessageClassheadersZ LineTooLongZREQUEST_HEADER_FIELDS_TOO_LARGEZ HTTPExceptiongetlowerhandle_expect_100) rversionr)wordsZbase_version_numberZversion_numberr"r2errZconntypeZexpectrrr parse_requests             z$BaseHTTPRequestHandler.parse_requestcCs|tj|dSNT)send_response_onlyrZCONTINUE end_headersrrrrr;xs z(BaseHTTPRequestHandler.handle_expect_100c Csz|jd|_t|jdkrBd|_d|_d|_|tj WdS|jsTd|_ WdS| sbWdSd|j}t ||s|tj d|jWdSt||}||jWn<tjk r}z|d|d|_ WYdSd}~XYnXdS)NiirTZdo_zUnsupported method (%r)zRequest timed out: %r)r6readliner'r+r)r$r"r0rZREQUEST_URI_TOO_LONGr%r?hasattrNOT_IMPLEMENTEDgetattrwfileflushrZtimeout log_error)rZmnamemethoderrrhandle_one_requests6     z)BaseHTTPRequestHandler.handle_one_requestcCs"d|_||js|qdSr@)r%rMrCrrrhandleszBaseHTTPRequestHandler.handleNcCs z|j|\}}Wntk r.d\}}YnX|dkr<|}|dkrH|}|d||||||ddd}|dkr|tjtjtjfkr|j |t j |ddt j |ddd}| d d }|d |j |d tt|||jd kr|r|j|dS)N)???rOzcode %d, message %srr Fquote)codemessageexplainzUTF-8replacez Content-TypeContent-LengthZHEAD) responsesKeyErrorrJ send_response send_headerrZ NO_CONTENTZ RESET_CONTENT NOT_MODIFIEDerror_message_formathtmlescapeencodeerror_content_typer&r+rBr"rHwrite)rrSrTrUZshortmsgZlongmsgZbodyZcontentrrrr0s:     z!BaseHTTPRequestHandler.send_errorcCs:||||||d||d|dS)NZServerZDate) log_requestrAr[version_stringdate_time_stringrrSrTrrrrZs  z$BaseHTTPRequestHandler.send_responsecCsd|jdkr`|dkr0||jkr,|j|d}nd}t|ds@g|_|jd|j||fdddS)Nrrr_headers_bufferz %s %d %s latin-1strict)r$rXrErgappendr1r`rfrrrrAs    z)BaseHTTPRequestHandler.send_response_onlycCsl|jdkr6t|dsg|_|jd||fdd|dkrh|dkrVd|_n|d krhd |_dS) Nrrgz%s: %s rhriZ connectionr Tr!F)r$rErgrjr`r:r%)rkeywordvaluerrrr[s     z"BaseHTTPRequestHandler.send_headercCs"|jdkr|jd|dS)Nrs )r$rgrj flush_headersrCrrrrBs  z"BaseHTTPRequestHandler.end_headerscCs(t|dr$|jd|jg|_dS)Nrg)rErHrbjoinrgrCrrrrms z$BaseHTTPRequestHandler.flush_headers-cCs.t|tr|j}|d|jt|t|dS)Nz "%s" %s %s) isinstancerrl log_messager)r&)rrSsizerrrrc s z"BaseHTTPRequestHandler.log_requestcGs|j|f|dSN)rr)rformatargsrrrrJ+s z BaseHTTPRequestHandler.log_errorcCsi|]}|d|dqS)z\xZ02xr).0crrr ;sz!BaseHTTPRequestHandler. z\\\cGs2||}tjd||||jfdS)Nz%s - - [%s] %s )sysstderrrbaddress_stringlog_date_time_string translate_control_char_table)rrurvrTrrrrr>s z"BaseHTTPRequestHandler.log_messagecCs|jd|jS)N )server_version sys_versionrCrrrrdXsz%BaseHTTPRequestHandler.version_stringcCs |dkrt}tjj|ddS)NT)Zusegmt)timeemailutilsZ formatdate)rZ timestamprrrre\sz'BaseHTTPRequestHandler.date_time_stringc CsBt}t|\ }}}}}}}} } d||j|||||f} | S)Nz%02d/%3s/%04d %02d:%02d:%02d)r localtime monthname) rZnowZyearZmonthZdayZhhZmmZssxyzsrrrrbsz+BaseHTTPRequestHandler.log_date_time_stringZMonZTueZWedZThuZFriZSatZSunZJanZFebZMarZAprZMayZJunZJulZAugZSepZOctZNovZDeccCs |jdSNr)client_addressrCrrrrpsz%BaseHTTPRequestHandler.address_stringHTTP/1.0cCsi|]}||j|jfqSr)phraseZ description)rwvrrrrys)NN)N)N)rprp)N)1rrrr~r<r*r __version__rDEFAULT_ERROR_MESSAGEr]DEFAULT_ERROR_CONTENT_TYPErar#r?r;rMrNr0rZrAr[rBrmrcrJr& maketrans itertoolschainrangerordrrrdrerZ weekdaynamerrr1r4r5Z HTTPMessager7r __members__valuesrXrrrrrs\ij% 5     cseZdZdeZddfdd ZddZdd Zd d Zd d Z ddZ ddZ ddZ e jshe e jZedddddZS)rz SimpleHTTP/N directorycs(|dkrt}||_tj||dSrt)osgetcwdrsuper__init__)rrrvkwargs __class__rrrsz!SimpleHTTPRequestHandler.__init__cCs.|}|r*z|||jW5|XdSrt) send_headr copyfilerHrfrrrdo_GETs zSimpleHTTPRequestHandler.do_GETcCs|}|r|dSrt)rr rrrrdo_HEADsz SimpleHTTPRequestHandler.do_HEADc Cs^||j}d}tj|rtj|j}|jds|t j |d|d|dd|d|df}tj |}| d|| dSdD]&}tj||}tj|r|}qq||S||}|dr|t jd dSzt|d }Wn&tk r|t jd YdSXz"t|}d |jkrd |jkrztj|jd } Wnttttfk r|YnzX| j dkr| j!t"j#j$d } | j t"j#j$krt"j"%|j&t"j#j$} | j!dd} | | kr|t j'| |(WdS|t j)| d|| dt*|d| d|+|j&| |WS|(YnXdS)Nrrr r rZLocation)z index.htmlz index.htmzFile not foundrbzIf-Modified-Sincez If-None-Match)tzinfo)Z microsecond Content-typerWz Last-Modified),translate_pathr2risdirurllibparseZurlsplitendswithrZrZMOVED_PERMANENTLYZ urlunsplitr[rBroexistslist_directory guess_typer0 NOT_FOUNDopenOSErrorfstatfilenor8rrZparsedate_to_datetime TypeErrorr/ OverflowErrorr-rrVdatetimetimezoneZutcZ fromtimestampst_mtimer\r OKr&re) rr2rpartsZ new_partsZnew_urlindexZctypeZfsZimsZ last_modifrrrrs                  z"SimpleHTTPRequestHandler.send_headc Cszt|}Wn$tk r2|tjdYdSX|jdddg}ztjj |j dd}Wn"t k rtj |j }YnXt j |dd}t}d |}|d |d |d ||d ||d||d|D]v}tj ||}|} } tj |r$|d} |d} tj |r:|d} |dtjj| ddt j | ddfq|dd||d} t} | | | d|tj|dd||dtt| || S)NzNo permission to list directorycSs|Srt)r:)arrrrnz9SimpleHTTPRequestHandler.list_directory..)key surrogatepasserrorsFrQzDirectory listing for %szZz z@z%s z

%s

z
    r@z
  • %s
  • z

 surrogateescaperrztext/html; charset=%srW) rlistdirrr0rrsortrrunquoter2UnicodeDecodeErrorr^r_r~getfilesystemencodingrjrorislinkrRr`ioBytesIOrbseekrZrr[r&r+rB) rr2listrZ displaypathenctitlenamefullnameZ displaynameZlinknameZencodedrrrrrsh          z'SimpleHTTPRequestHandler.list_directorycCs|ddd}|ddd}|d}ztjj|dd}Wn tk rbtj|}YnXt|}|d}t d|}|j }|D]0}t j |s|t jt jfkrqt j ||}q|r|d7}|S)N?r r#rrr)r*r(rrrrr posixpathnormpathfilterrrr2dirnamecurdirpardirro)rr2Ztrailing_slashr=Zwordrrrr:s$    z'SimpleHTTPRequestHandler.translate_pathcCst||dSrt)shutilZ copyfileobj)rsourceZ outputfilerrrrXsz!SimpleHTTPRequestHandler.copyfilecCsLt|\}}||jkr"|j|S|}||jkr>|j|S|jdSdS)Nr)rsplitextextensions_mapr:)rr2baseZextrrrrhs    z#SimpleHTTPRequestHandler.guess_typezapplication/octet-streamz text/plain)r.pyz.cz.h)rrrrrrrrrrrrr mimetypesZinitedZinitZ types_mapcopyrupdate __classcell__rrrrrs$  W: c Cs|d\}}}tj|}|d}g}|ddD],}|dkrL|q6|r6|dkr6||q6|r|}|r|dkr|d}q|dkrd}nd}|rd||f}dd||f}d|}|S)Nrrrz..rr) partitionrrrr*poprjro) r2_query path_partsZ head_partspartZ tail_partZ splitpathcollapsed_pathrrr_url_collapse_paths.      rcCsrtrtSz ddl}Wntk r*YdSXz|ddaWn.tk rldtdd|DaYnXtS)Nrrnobodyr r css|]}|dVqdS)r Nr)rwrrrr sznobody_uid..)rpwd ImportErrorgetpwnamrYmaxZgetpwall)rrrr nobody_uids  rcCst|tjSrt)raccessX_OK)r2rrr executablesrc@sReZdZeedZdZddZddZddZ d d gZ d d Z d dZ ddZ dS)rforkrcCs$|r|n|tjddS)NzCan only POST to CGI scripts)is_cgirun_cgir0rrFrCrrrdo_POSTs  zCGIHTTPRequestHandler.do_POSTcCs|r|St|SdSrt)rrrrrCrrrrszCGIHTTPRequestHandler.send_headcCsPt|j}|dd}|d|||dd}}||jkrL||f|_dSdS)Nrr TF)rr2findcgi_directoriescgi_info)rrZdir_sepheadtailrrrrs    zCGIHTTPRequestHandler.is_cgiz/cgi-binz/htbincCst|Srt)r)rr2rrr is_executablesz#CGIHTTPRequestHandler.is_executablecCstj|\}}|dkS)N)rz.pyw)rr2rr:)rr2r r rrr is_pythonszCGIHTTPRequestHandler.is_pythonc) Cs|j\}}|d|}|dt|d}|dkr|d|}||dd}||}tj|r||}}|dt|d}q*qq*|d\}}} |d}|dkr|d|||d} }n |d} }|d| } || } tj| s | t j d| dStj | s.| t j d| dS|| } |jsF| sh|| sh| t j d| dSttj}||d <|jj|d <d |d <|j|d <t|jj|d<|j|d<tj|}||d<|||d<| |d<| r| |d<|jd|d<|j d}|r|!}t|dkrddl"}ddl#}|d|d<|d$dkrz"|d%d}|&|'d}Wn|j(t)fk rYn&X|!d}t|dkr|d|d<|j ddkr|j*|d<n|jd|d<|j d}|r||d<|j d }|r||d!<g}|j+d"D]>}|ddd#krR|,|-n||d$d!d%}q,d%.||d&<|j d'}|r||d(<t/d|j0d)g}d*.|}|r||d+<d,D]}|1|dq|2t j3d-|4| 5d.d/}|jr| g}d0|kr|,|t6}|j78t9}|dkrt:|d\}}t;;|jd1|dSz\zt?|Wnt@k rYnXtA|j|jq |$T|%\}&}'|j7U|&|'rj|>d:|'|$jVW|$jXW|$jY}(|(r|>d1|(n |Kd;dS)Ss   s 0     PKΠ]b:client.cpython-38.opt-1.pycnu[U e5d@sfdZddlZddlZddlZddlZddlZddlZddlZ ddl m Z dddddd d d d d ddddddddgZ dZ dZdZdZdZdZeejjddejjDZdZdZed jZed!jZed"Z ed#Z!d$d%d&hZ"dBd(d)Z#Gd*d+d+ej$j%Z&d,d-Z'e&fd.d/Z(Gd0ddej)Z*Gd1ddZ+z ddl,Z,Wne-k r`YnXGd2d3d3e+Z.e /d3Gd4dde0Z1Gd5dde1Z2Gd6d d e1Z3Gd7dde1Z4Gd8d d e1Z5Gd9d d e1Z6Gd:d d e1Z7Gd;d d e1Z8Gddde8Z;Gd?dde1Ze<Z?e1Z@dS)Ca HTTP/1.1 client library HTTPConnection goes through a number of "states", which define when a client may legally make another request or fetch the response for a particular request. This diagram details these state transitions: (null) | | HTTPConnection() v Idle | | putrequest() v Request-started | | ( putheader() )* endheaders() v Request-sent |\_____________________________ | | getresponse() raises | response = getresponse() | ConnectionError v v Unread-response Idle [Response-headers-read] |\____________________ | | | response.read() | putrequest() v v Idle Req-started-unread-response ______/| / | response.read() | | ( putheader() )* endheaders() v v Request-started Req-sent-unread-response | | response.read() v Request-sent This diagram presents the following rules: -- a second request may not be started until {response-headers-read} -- a response [object] cannot be retrieved until {request-sent} -- there is no differentiation between an unread response body and a partially read response body Note: this enforcement is applied by the HTTPConnection class. The HTTPResponse class does not enforce this state machine, which implies sophisticated clients may accelerate the request/response pipeline. Caution should be taken, though: accelerating the states beyond the above pattern may imply knowledge of the server's connection-close behavior for certain requests. For example, it is impossible to tell whether the server will close the connection UNTIL the response headers have been read; this means that further requests cannot be placed into the pipeline until it is known that the server will NOT be closing the connection. Logical State __state __response ------------- ------- ---------- Idle _CS_IDLE None Request-started _CS_REQ_STARTED None Request-sent _CS_REQ_SENT None Unread-response _CS_IDLE Req-started-unread-response _CS_REQ_STARTED Req-sent-unread-response _CS_REQ_SENT N)urlsplit HTTPResponseHTTPConnection HTTPException NotConnectedUnknownProtocolUnknownTransferEncodingUnimplementedFileModeIncompleteRead InvalidURLImproperConnectionStateCannotSendRequestCannotSendHeaderResponseNotReady BadStatusLine LineTooLongRemoteDisconnectederror responsesPiZUNKNOWNZIdlezRequest-startedz Request-sentcCsi|] }||jqS)phrase).0vrr#/usr/lib64/python3.8/http/client.py jsrids[^:\s][^:\r\n]*s\n(?![ \t])|\r(?![ \t\n])z[- ]z[-]ZPATCHZPOSTZPUTdatac Cshz |dWStk rb}z8t|j|j|j|jd|||j|j|fdW5d}~XYnXdS)zd?Z Z!S)FrrNcCsR|d|_||_||_d|_|_t|_t|_t|_ t|_ t|_ t|_ t|_ dS)Nrb)Zmakefiler@ debuglevel_methodrAmsg_UNKNOWNversionstatusreasonchunked chunk_leftlength will_close)r1sockrKmethodurlrrr__init__s  zHTTPResponse.__init__c Cst|jtdd}t|tkr*td|jdkrBtdt||sNt dz| dd\}}}WnFt k rz| dd\}}d}Wnt k rd}YnXYnX| d s| t|z$t|}|d ks|d krt|Wnt k rt|YnX|||fS) Nr+rCz status linerzreply:z-Remote end closed connection without responsezHTTP/ri)strr@r=r>r-rrKprintreprrsplit ValueError startswith _close_connrint)r1r3rOrPrQrrr _read_statuss2    zHTTPResponse._read_statusc Cs|jdk rdS|\}}}|tkr&qHt|j}|jdkrDtd|~q||_|_| |_ |dkrnd|_ n| drd|_ nt |t|j|_|_|jdkr|jD]\}}td|d|q|jd }|r|d krd |_d|_nd |_||_d|_|jd }|rb|jsbzt||_Wntk rLd|_YnX|jdkrhd|_nd|_|tks|tksd|krdksn|jdkrd|_|js|js|jdkrd |_dS)Nrzheaders:)zHTTP/1.0zHTTP/0.9 zHTTP/1. header:r*transfer-encodingrRTFcontent-lengthrHEAD)rArdZCONTINUErBr@rKr]coderPstriprQrOrarrIrMitemsgetr,rRrS _check_closerUrTrcr`Z NO_CONTENTZ NOT_MODIFIEDrL) r1rOrPrQZskipped_headershdrvalZtr_encrTrrrbegin5sf               zHTTPResponse.begincCsv|jd}|jdkr.|r*d|kr*dSdS|jdr>dS|rRd|krRdS|jd}|rrd|krrdSdS)NZ connectionrfcloseTFz keep-alivezproxy-connection)rArorOr,)r1ZconnZpconnrrrrp}s    zHTTPResponse._check_closecCs|j}d|_|dSN)r@rt)r1r@rrrrbszHTTPResponse._close_conncs$ztW5|jr|XdSru)r@rbsuperrtr1 __class__rrrtszHTTPResponse.closecst|jr|jdSru)rvflushr@rwrxrrrzs zHTTPResponse.flushcCsdS)zAlways returns TrueTrrwrrrreadableszHTTPResponse.readablecCs |jdkS)z!True if the connection is closed.N)r@rwrrrisclosedszHTTPResponse.isclosedcCs|jdkrdS|jdkr$|dS|dk rRt|}||}t|d|S|jr`|S|j dkrv|j }n6z| |j }Wnt k r|YnXd|_ ||SdS)Nr<rkr) r@rLrb bytearrayreadinto memoryviewtobytesrR_readall_chunkedrTread _safe_readr )r1amtbr2srrrrs*     zHTTPResponse.readcCs|jdkrdS|jdkr$|dS|jr4||S|jdk r^t||jkr^t|d|j}|j|}|s||r||n&|jdk r|j|8_|js||S)z^Read up to len(b) bytes into bytearray b and return the number of bytes read. Nrrk) r@rLrbrR_readinto_chunkedrTr-rr~)r1rr2rrrr~s$       zHTTPResponse.readintocCsr|jtd}t|tkr$td|d}|dkrB|d|}z t|dWStk rl|YnXdS)Nr+z chunk size;r) r@r=r>r-rfindrcr`rb)r1r3irrr_read_next_chunk_sizes    z"HTTPResponse._read_next_chunk_sizecCs:|jtd}t|tkr$td|s*q6|dkrq6qdS)Nr+z trailer liner9)r@r=r>r-rr1r3rrr_read_and_discard_trailers z&HTTPResponse._read_and_discard_trailercCsl|j}|sh|dk r|dz |}Wntk rDtdYnX|dkrb||d}||_|S)NrZr<r)rSrrr`r rrb)r1rSrrr_get_chunk_left s  zHTTPResponse._get_chunk_leftcCsbg}z6|}|dkrq0|||d|_qd|WStk r\td|YnXdSNrr<)rr0rrSrEr )r1valuerSrrrr8s zHTTPResponse._readall_chunkedcCsd}t|}zv|}|dkr$|WSt||krN||}|||_||WS|d|}||}||d}||7}d|_qWn(tk rtt|d|YnXdS)Nr)rrr-_safe_readintorSr bytes)r1rZ total_bytesZmvbrSr2Ztemp_mvbrrrrFs"        zHTTPResponse._readinto_chunkedcCs.|j|}t||kr*t||t||S)a Read the number of bytes requested. This function should be used when bytes "should" be present for reading. If the bytes are truly not available (due to EOF), then the IncompleteRead exception can be used to detect the problem. )r@rr-r )r1rrrrrr^s  zHTTPResponse._safe_readcCs:t|}|j|}||kr6tt|d||||S)z2Same as _safe_read, but for reading into a buffer.N)r-r@r~r r)r1rrr2rrrrjs  zHTTPResponse._safe_readintocCs|jdks|jdkrdS|jr(||S|jdk rJ|dksD||jkrJ|j}|j|}|sh|rh|n|jdk r|jt|8_|S)zvRead with at most one underlying system call. If at least one byte is buffered, return that instead. Nrkr<r)r@rLrR_read1_chunkedrTread1rbr-)r1r2resultrrrrrs    zHTTPResponse.read1cCs4|jdks|jdkrdS|jr(||S|j|S)Nrkr<)r@rLrR _peek_chunkedpeek)r1r2rrrrs  zHTTPResponse.peekcs|jdks|jdkrdS|jr*t|S|jdk rL|dksF||jkrL|j}|j|}|sj|rj|n|jdk r|jt|8_|S)Nrkr<r)r@rLrRrvr=rTrbr-)r1limitrrxrrr=s    zHTTPResponse.readlinecCsd|}|dks|dkrdSd|kr0|ks6n|}|j|}|jt|8_|s`td|Sr)rr@rrSr-r )r1r2rSrrrrrs zHTTPResponse._read1_chunkedcCsDz |}Wntk r"YdSX|dkr0dS|j|d|S)Nr<)rr r@r)r1r2rSrrrrs zHTTPResponse._peek_chunkedcCs |jSru)r@filenorwrrrrszHTTPResponse.filenocCsF|jdkrt|j|p|}t|ts4t|ds8|Sd|SdS)axReturns the value of the header matching *name*. If there are multiple matching headers, the values are combined into a single string separated by commas and spaces. If no matching header is found, returns *default* or None if the *default* is not specified. If the headers are unknown, raises http.client.ResponseNotReady. N__iter__z, )rArZget_all isinstancer\hasattrrE)r1r&defaultrArrr getheaders zHTTPResponse.getheadercCs|jdkrtt|jS)z&Return list of (header, value) tuples.N)rArlistrnrwrrr getheaderss zHTTPResponse.getheaderscCs|SrurrwrrrrszHTTPResponse.__iter__cCs|jS)ajReturns an instance of the class mimetools.Message containing meta-information associated with the URL. When the method is HTTP, these headers are those returned by the server at the head of the retrieved HTML page (including Content-Length and Content-Type). When the method is FTP, a Content-Length header will be present if (as is now usual) the server passed back a file length in response to the FTP retrieval request. A Content-Type header will be present if the MIME type can be guessed. When the method is local-file, returned headers will include a Date representing the file's last-modified time, a Content-Length giving file size, and a Content-Type containing a guess at the file's type. See also the description of the mimetools module. )rArwrrrinfoszHTTPResponse.infocCs|jS)aZReturn the real URL of the page. In some cases, the HTTP server redirects a client to another URL. The urlopen() function handles this transparently, but in some cases the caller needs to know which URL the client was redirected to. The geturl() method can be used to get at this redirected URL. )rXrwrrrgeturls zHTTPResponse.geturlcCs|jS)zuReturn the HTTP status code that was sent with the response, or None if the URL is not an HTTP URL. )rPrwrrrgetcodeszHTTPResponse.getcode)rNN)N)r)r)r)N)"r5r6r7rYrdrsrprbrtrzr{r|rr~rrrrrrrrrr=rrrrrrrrr __classcell__rrrxrrs< !H  "      c@s eZdZdZdZeZeZdZ dZ e ddZ e ddZ d ejd d fd d Zd7d dZddZddZddZddZddZddZddZddZd8d d!Zd9d"d#Zd$d%Zd&d'Zd(d)Zd*d+Zd,d-Z d:dd.d/d0Z!d ifdd.d1d2Z"d3d4Z#d5d6Z$d S);rrfzHTTP/1.1r+rcCs t|tjS)zFTest whether a file-like object is a text or a binary stream. )rio TextIOBase)streamrrr _is_textIOszHTTPConnection._is_textIOcCsf|dkr|tkrdSdSt|dr*dSzt|}|jWStk rNYnXt|trbt|SdS)aGet the content-length based on the body. If the body is None, we set Content-Length: 0 for methods that expect a body (RFC 7230, Section 3.3.2). We also set the Content-Length for any method if the body is a str or bytes-like object and not a file. Nrr) upper_METHODS_EXPECTING_BODYrrnbytes TypeErrorrr\r-)bodyrWZmvrrr_get_content_lengths   z"HTTPConnection._get_content_lengthN cCsn||_||_||_d|_g|_d|_t|_d|_d|_ d|_ i|_ | ||\|_ |_||j tj|_dSru)timeoutsource_address blocksizerV_buffer_HTTPConnection__response_CS_IDLE_HTTPConnection__staterL _tunnel_host _tunnel_port_tunnel_headers _get_hostporthostport_validate_hostsocketZcreate_connection_create_connection)r1rrrrrrrrrY4s zHTTPConnection.__init__cCs<|jrtd|||\|_|_|r.||_n |jdS)aDSet up host and port for HTTP CONNECT tunnelling. In a connection that uses HTTP CONNECT tunneling, the host passed to the constructor is used as a proxy server that relays all communication to the endpoint passed to `set_tunnel`. This done by sending an HTTP CONNECT request to the proxy server when the connection is established. This method must be called before the HTTP connection has been established. The headers argument should be a mapping of extra HTTP headers to send with the CONNECT request. z.Can't set up tunnel for established connectionN)rV RuntimeErrorrrrrclear)r1rrrArrr set_tunnelJs zHTTPConnection.set_tunnelcCs|dkr|d}|d}||krzt||dd}WnHtk r||dddkrh|j}ntd||ddYnX|d|}n|j}|r|ddkr|ddkr|dd}||fS) Nr*]r+r[znonnumeric port: '%s'r[r)rfindrcr` default_portr )r1rrrjrrrrbs   zHTTPConnection._get_hostportcCs ||_dSru)rK)r1levelrrrset_debuglevelvszHTTPConnection.set_debuglevelc Csd|j|jf}|d}|||jD](\}}d||f}|d}||q.|d|j|j|jd}| \}} } | t j j kr| td| | f|jtd} t| tkrtd | sq| d krq|jd krtd | qdS) NzCONNECT %s:%d HTTP/1.0 asciiz%s: %s rr:rWzTunnel connection failed: %d %sr+r8r9rrg)rrrsendrrnresponse_classrVrLrdhttp HTTPStatusZOKrtOSErrorrmr@r=r>r-rrKr]rF) r1Z connect_strZ connect_bytesheaderrZ header_strZ header_bytesresponserOrlmessager3rrr_tunnelys4         zHTTPConnection._tunnelcCsB||j|jf|j|j|_|jtjtj d|j r>| dS)z3Connect to the host and port specified in __init__.r+N) rrrrrrVZ setsockoptrZ IPPROTO_TCPZ TCP_NODELAYrrrwrrrconnects zHTTPConnection.connectcCsBt|_z|j}|r d|_|W5|j}|rsz/HTTPConnection._send_request..rr+rzaccept-encodingrrirhFrzUnable to determine size of %rTzTransfer-EncodingrRzContent-Lengthrr) frozensetrrrKr]rr\rnrr(r) r1rWrXrrArZ header_namesZskipsZcontent_lengthrqrrrrrs0      zHTTPConnection._send_requestcCs|jr|jrd|_|jtks&|jr0t|j|jdkrR|j|j|j|jd}n|j|j|jd}zNz | Wnt k r| YnXt |_|j r| n||_|WS| YnXdS)a)Get the response from the server. If the HTTPConnection is in the correct state, returns an instance of HTTPResponse or of whatever object is returned by the response_class variable. If a request has not been sent or if a previous response has not be handled, ResponseNotReady is raised. If the HTTP response indicates that the connection should be closed, then it will be closed before the response is returned. When the connection is closed, the underlying socket is closed. Nrr)rr|rrrrKrrVrLrsConnectionErrorrtrrU)r1rrrr getresponses.     zHTTPConnection.getresponse)NN)NF)FF)N)%r5r6r7rrrr HTTP_PORTrrrK staticmethodrrr_GLOBAL_DEFAULT_TIMEOUTrYrrrrrrtrrrrrrrrrrrrrr rrrrrsL     & 6    .csHeZdZdZeZdddejdfddddfdd ZfddZ Z S) HTTPSConnectionz(This class allows communication via SSL.Nr)contextcheck_hostnamerc stt|j||||| d|dk s2|dk s2|dk rHddl} | dtd||_||_|dkrtt }|j dk rtd|_ |j tj k} |dkr|j }|r| std|s|r||||j dk rd|_ ||_|dk r||j_ dS)N)rrzTkey_file, cert_file and check_hostname are deprecated, use a custom context instead.rZTzMcheck_hostname needs a SSL context with either CERT_OPTIONAL or CERT_REQUIRED)rvrrYwarningswarnDeprecationWarningkey_file cert_filesslZ_create_default_https_contextZpost_handshake_authZ verify_modeZ CERT_NONErr`Zload_cert_chain_context) r1rrrrrrrrrrZ will_verifyrxrrrYcs<    zHTTPSConnection.__init__cs6t|jr|j}n|j}|jj|j|d|_dS)z(Connect to a host on a given (SSL) port.)server_hostnameN)rvrrrrZ wrap_socketrV)r1rrxrrrs  zHTTPSConnection.connect) r5r6r7__doc__ HTTPS_PORTrrrrYrrrrrxrr\s$rc@s eZdZdS)rNr5r6r7rrrrrsc@s eZdZdS)rNrrrrrrsc@s eZdZdS)r Nrrrrrr sc@seZdZddZdS)rcCs|f|_||_dSru)argsrO)r1rOrrrrYszUnknownProtocol.__init__Nr5r6r7rYrrrrrsc@s eZdZdS)rNrrrrrrsc@s eZdZdS)r Nrrrrrr sc@s$eZdZdddZddZejZdS)r NcCs|f|_||_||_dSru)rpartialexpected)r1r!r"rrrrYszIncompleteRead.__init__cCs2|jdk rd|j}nd}d|jjt|j|fS)Nz, %i more expectedr[z%s(%i bytes read%s))r"ryr5r-r!)r1errr__repr__s  zIncompleteRead.__repr__)N)r5r6r7rYr$r"__str__rrrrr s c@s eZdZdS)r Nrrrrrr sc@s eZdZdS)r Nrrrrrr sc@s eZdZdS)rNrrrrrrsc@s eZdZdS)rNrrrrrrsc@seZdZddZdS)rcCs|s t|}|f|_||_dSru)r^rr3rrrrrYszBadStatusLine.__init__Nr rrrrrsc@seZdZddZdS)rcCst|dt|fdS)Nz&got more than %d bytes when reading %s)rrYr>)r1Z line_typerrrrYszLineTooLong.__init__Nr rrrrrsc@seZdZddZdS)rcOs"t|dtj|f||dS)Nr[)rrYConnectionResetError)r1poskwrrrrYs zRemoteDisconnected.__init__Nr rrrrrs)r)ArZ email.parserrGZ email.messagerrrerZcollections.abcrZ urllib.parser__all__rrrNrrrglobalsupdater __members__rrr>r?compile fullmatchrrrrrrr(rZMessager)rBrIBufferedIOBaserrr ImportErrorrr0 Exceptionrrr rrr r r r rrrrr&rrrrrrsF        W 8 PKΠ]70]]client.cpython-38.pycnu[U e5d@sfdZddlZddlZddlZddlZddlZddlZddlZ ddl m Z dddddd d d d d ddddddddgZ dZ dZdZdZdZdZeejjddejjDZdZdZed jZed!jZed"Z ed#Z!d$d%d&hZ"dBd(d)Z#Gd*d+d+ej$j%Z&d,d-Z'e&fd.d/Z(Gd0ddej)Z*Gd1ddZ+z ddl,Z,Wne-k r`YnXGd2d3d3e+Z.e /d3Gd4dde0Z1Gd5dde1Z2Gd6d d e1Z3Gd7dde1Z4Gd8d d e1Z5Gd9d d e1Z6Gd:d d e1Z7Gd;d d e1Z8Gddde8Z;Gd?dde1Ze<Z?e1Z@dS)Ca HTTP/1.1 client library HTTPConnection goes through a number of "states", which define when a client may legally make another request or fetch the response for a particular request. This diagram details these state transitions: (null) | | HTTPConnection() v Idle | | putrequest() v Request-started | | ( putheader() )* endheaders() v Request-sent |\_____________________________ | | getresponse() raises | response = getresponse() | ConnectionError v v Unread-response Idle [Response-headers-read] |\____________________ | | | response.read() | putrequest() v v Idle Req-started-unread-response ______/| / | response.read() | | ( putheader() )* endheaders() v v Request-started Req-sent-unread-response | | response.read() v Request-sent This diagram presents the following rules: -- a second request may not be started until {response-headers-read} -- a response [object] cannot be retrieved until {request-sent} -- there is no differentiation between an unread response body and a partially read response body Note: this enforcement is applied by the HTTPConnection class. The HTTPResponse class does not enforce this state machine, which implies sophisticated clients may accelerate the request/response pipeline. Caution should be taken, though: accelerating the states beyond the above pattern may imply knowledge of the server's connection-close behavior for certain requests. For example, it is impossible to tell whether the server will close the connection UNTIL the response headers have been read; this means that further requests cannot be placed into the pipeline until it is known that the server will NOT be closing the connection. Logical State __state __response ------------- ------- ---------- Idle _CS_IDLE None Request-started _CS_REQ_STARTED None Request-sent _CS_REQ_SENT None Unread-response _CS_IDLE Req-started-unread-response _CS_REQ_STARTED Req-sent-unread-response _CS_REQ_SENT N)urlsplit HTTPResponseHTTPConnection HTTPException NotConnectedUnknownProtocolUnknownTransferEncodingUnimplementedFileModeIncompleteRead InvalidURLImproperConnectionStateCannotSendRequestCannotSendHeaderResponseNotReady BadStatusLine LineTooLongRemoteDisconnectederror responsesPiZUNKNOWNZIdlezRequest-startedz Request-sentcCsi|] }||jqS)phrase).0vrr#/usr/lib64/python3.8/http/client.py jsrids[^:\s][^:\r\n]*s\n(?![ \t])|\r(?![ \t\n])z[- ]z[-]ZPATCHZPOSTZPUTdatac Cshz |dWStk rb}z8t|j|j|j|jd|||j|j|fdW5d}~XYnXdS)zd?Z Z!S)FrrNcCsR|d|_||_||_d|_|_t|_t|_t|_ t|_ t|_ t|_ t|_ dS)Nrb)Zmakefiler@ debuglevel_methodrAmsg_UNKNOWNversionstatusreasonchunked chunk_leftlength will_close)r1sockrKmethodurlrrr__init__s  zHTTPResponse.__init__c Cst|jtdd}t|tkr*td|jdkrBtdt||sNt dz| dd\}}}WnFt k rz| dd\}}d}Wnt k rd}YnXYnX| d s| t|z$t|}|d ks|d krt|Wnt k rt|YnX|||fS) Nr+rCz status linerzreply:z-Remote end closed connection without responsezHTTP/ri)strr@r=r>r-rrKprintreprrsplit ValueError startswith _close_connrint)r1r3rOrPrQrrr _read_statuss2    zHTTPResponse._read_statusc Cs|jdk rdS|\}}}|tkr&qHt|j}|jdkrDtd|~q||_|_| |_ |dkrnd|_ n| drd|_ nt |t|j|_|_|jdkr|jD]\}}td|d|q|jd }|r|d krd |_d|_nd |_||_d|_|jd }|rb|jsbzt||_Wntk rLd|_YnX|jdkrhd|_nd|_|tks|tksd|krdksn|jdkrd|_|js|js|jdkrd |_dS)Nrzheaders:)zHTTP/1.0zHTTP/0.9 zHTTP/1. header:r*transfer-encodingrRTFcontent-lengthrHEAD)rArdZCONTINUErBr@rKr]coderPstriprQrOrarrIrMitemsgetr,rRrS _check_closerUrTrcr`Z NO_CONTENTZ NOT_MODIFIEDrL) r1rOrPrQZskipped_headershdrvalZtr_encrTrrrbegin5sf               zHTTPResponse.begincCsv|jd}|jdkr.|r*d|kr*dSdS|jdr>dS|rRd|krRdS|jd}|rrd|krrdSdS)NZ connectionrfcloseTFz keep-alivezproxy-connection)rArorOr,)r1ZconnZpconnrrrrp}s    zHTTPResponse._check_closecCs|j}d|_|dSN)r@rt)r1r@rrrrbszHTTPResponse._close_conncs$ztW5|jr|XdSru)r@rbsuperrtr1 __class__rrrtszHTTPResponse.closecst|jr|jdSru)rvflushr@rwrxrrrzs zHTTPResponse.flushcCsdS)zAlways returns TrueTrrwrrrreadableszHTTPResponse.readablecCs |jdkS)z!True if the connection is closed.N)r@rwrrrisclosedszHTTPResponse.isclosedcCs|jdkrdS|jdkr$|dS|dk rRt|}||}t|d|S|jr`|S|j dkrv|j }n6z| |j }Wnt k r|YnXd|_ ||SdS)Nr<rkr) r@rLrb bytearrayreadinto memoryviewtobytesrR_readall_chunkedrTread _safe_readr )r1amtbr2srrrrs*     zHTTPResponse.readcCs|jdkrdS|jdkr$|dS|jr4||S|jdk r^t||jkr^t|d|j}|j|}|s||r||n&|jdk r|j|8_|js||S)z^Read up to len(b) bytes into bytearray b and return the number of bytes read. Nrrk) r@rLrbrR_readinto_chunkedrTr-rr~)r1rr2rrrr~s$       zHTTPResponse.readintocCsr|jtd}t|tkr$td|d}|dkrB|d|}z t|dWStk rl|YnXdS)Nr+z chunk size;r) r@r=r>r-rfindrcr`rb)r1r3irrr_read_next_chunk_sizes    z"HTTPResponse._read_next_chunk_sizecCs:|jtd}t|tkr$td|s*q6|dkrq6qdS)Nr+z trailer liner9)r@r=r>r-rr1r3rrr_read_and_discard_trailers z&HTTPResponse._read_and_discard_trailercCsl|j}|sh|dk r|dz |}Wntk rDtdYnX|dkrb||d}||_|S)NrZr<r)rSrrr`r rrb)r1rSrrr_get_chunk_left s  zHTTPResponse._get_chunk_leftcCsp|jtkstg}z6|}|dkr&q>|||d|_qd|WStk rjtd|YnXdSNrr<) rRrNAssertionErrorrr0rrSrEr )r1valuerSrrrr8s zHTTPResponse._readall_chunkedcCs|jtkstd}t|}zv|}|dkr2|WSt||kr\||}|||_||WS|d|}||}||d}||7}d|_qWn(tk rtt |d|YnXdS)Nr) rRrNrrrr-_safe_readintorSr bytes)r1rZ total_bytesZmvbrSr2Ztemp_mvbrrrrFs$        zHTTPResponse._readinto_chunkedcCs.|j|}t||kr*t||t||S)a Read the number of bytes requested. This function should be used when bytes "should" be present for reading. If the bytes are truly not available (due to EOF), then the IncompleteRead exception can be used to detect the problem. )r@rr-r )r1rrrrrr^s  zHTTPResponse._safe_readcCs:t|}|j|}||kr6tt|d||||S)z2Same as _safe_read, but for reading into a buffer.N)r-r@r~r r)r1rrr2rrrrjs  zHTTPResponse._safe_readintocCs|jdks|jdkrdS|jr(||S|jdk rJ|dksD||jkrJ|j}|j|}|sh|rh|n|jdk r|jt|8_|S)zvRead with at most one underlying system call. If at least one byte is buffered, return that instead. Nrkr<r)r@rLrR_read1_chunkedrTread1rbr-)r1r2resultrrrrrs    zHTTPResponse.read1cCs4|jdks|jdkrdS|jr(||S|j|S)Nrkr<)r@rLrR _peek_chunkedpeek)r1r2rrrrs  zHTTPResponse.peekcs|jdks|jdkrdS|jr*t|S|jdk rL|dksF||jkrL|j}|j|}|sj|rj|n|jdk r|jt|8_|S)Nrkr<r)r@rLrRrvr=rTrbr-)r1limitrrxrrr=s    zHTTPResponse.readlinecCsd|}|dks|dkrdSd|kr0|ks6n|}|j|}|jt|8_|s`td|Sr)rr@rrSr-r )r1r2rSrrrrrs zHTTPResponse._read1_chunkedcCsDz |}Wntk r"YdSX|dkr0dS|j|d|S)Nr<)rr r@r)r1r2rSrrrrs zHTTPResponse._peek_chunkedcCs |jSru)r@filenorwrrrrszHTTPResponse.filenocCsF|jdkrt|j|p|}t|ts4t|ds8|Sd|SdS)axReturns the value of the header matching *name*. If there are multiple matching headers, the values are combined into a single string separated by commas and spaces. If no matching header is found, returns *default* or None if the *default* is not specified. If the headers are unknown, raises http.client.ResponseNotReady. N__iter__z, )rArZget_all isinstancer\hasattrrE)r1r&defaultrArrr getheaders zHTTPResponse.getheadercCs|jdkrtt|jS)z&Return list of (header, value) tuples.N)rArlistrnrwrrr getheaderss zHTTPResponse.getheaderscCs|SrurrwrrrrszHTTPResponse.__iter__cCs|jS)ajReturns an instance of the class mimetools.Message containing meta-information associated with the URL. When the method is HTTP, these headers are those returned by the server at the head of the retrieved HTML page (including Content-Length and Content-Type). When the method is FTP, a Content-Length header will be present if (as is now usual) the server passed back a file length in response to the FTP retrieval request. A Content-Type header will be present if the MIME type can be guessed. When the method is local-file, returned headers will include a Date representing the file's last-modified time, a Content-Length giving file size, and a Content-Type containing a guess at the file's type. See also the description of the mimetools module. )rArwrrrinfoszHTTPResponse.infocCs|jS)aZReturn the real URL of the page. In some cases, the HTTP server redirects a client to another URL. The urlopen() function handles this transparently, but in some cases the caller needs to know which URL the client was redirected to. The geturl() method can be used to get at this redirected URL. )rXrwrrrgeturls zHTTPResponse.geturlcCs|jS)zuReturn the HTTP status code that was sent with the response, or None if the URL is not an HTTP URL. )rPrwrrrgetcodeszHTTPResponse.getcode)rNN)N)r)r)r)N)"r5r6r7rYrdrsrprbrtrzr{r|rr~rrrrrrrrrr=rrrrrrrrr __classcell__rrrxrrs< !H  "      c@s eZdZdZdZeZeZdZ dZ e ddZ e ddZ d ejd d fd d Zd7d dZddZddZddZddZddZddZddZddZd8d d!Zd9d"d#Zd$d%Zd&d'Zd(d)Zd*d+Zd,d-Z d:dd.d/d0Z!d ifdd.d1d2Z"d3d4Z#d5d6Z$d S);rrfzHTTP/1.1r+rcCs t|tjS)zFTest whether a file-like object is a text or a binary stream. )rio TextIOBase)streamrrr _is_textIOszHTTPConnection._is_textIOcCsf|dkr|tkrdSdSt|dr*dSzt|}|jWStk rNYnXt|trbt|SdS)aGet the content-length based on the body. If the body is None, we set Content-Length: 0 for methods that expect a body (RFC 7230, Section 3.3.2). We also set the Content-Length for any method if the body is a str or bytes-like object and not a file. Nrr) upper_METHODS_EXPECTING_BODYrrnbytes TypeErrorrr\r-)bodyrWZmvrrr_get_content_lengths   z"HTTPConnection._get_content_lengthN cCsn||_||_||_d|_g|_d|_t|_d|_d|_ d|_ i|_ | ||\|_ |_||j tj|_dSru)timeoutsource_address blocksizerV_buffer_HTTPConnection__response_CS_IDLE_HTTPConnection__staterL _tunnel_host _tunnel_port_tunnel_headers _get_hostporthostport_validate_hostsocketZcreate_connection_create_connection)r1rrrrrrrrrY4s zHTTPConnection.__init__cCs<|jrtd|||\|_|_|r.||_n |jdS)aDSet up host and port for HTTP CONNECT tunnelling. In a connection that uses HTTP CONNECT tunneling, the host passed to the constructor is used as a proxy server that relays all communication to the endpoint passed to `set_tunnel`. This done by sending an HTTP CONNECT request to the proxy server when the connection is established. This method must be called before the HTTP connection has been established. The headers argument should be a mapping of extra HTTP headers to send with the CONNECT request. z.Can't set up tunnel for established connectionN)rV RuntimeErrorrrrrclear)r1rrrArrr set_tunnelJs zHTTPConnection.set_tunnelcCs|dkr|d}|d}||krzt||dd}WnHtk r||dddkrh|j}ntd||ddYnX|d|}n|j}|r|ddkr|ddkr|dd}||fS) Nr*]r+r[znonnumeric port: '%s'r[r)rfindrcr` default_portr )r1rrrjrrrrbs   zHTTPConnection._get_hostportcCs ||_dSru)rK)r1levelrrrset_debuglevelvszHTTPConnection.set_debuglevelc Csd|j|jf}|d}|||jD](\}}d||f}|d}||q.|d|j|j|jd}| \}} } | t j j kr| td| | f|jtd} t| tkrtd | sq| d krq|jd krtd | qdS) NzCONNECT %s:%d HTTP/1.0 asciiz%s: %s rr:rWzTunnel connection failed: %d %sr+r8r9rrg)rrrsendrrnresponse_classrVrLrdhttp HTTPStatusZOKrtOSErrorrmr@r=r>r-rrKr]rF) r1Z connect_strZ connect_bytesheaderrZ header_strZ header_bytesresponserOrlmessager3rrr_tunnelys4         zHTTPConnection._tunnelcCsB||j|jf|j|j|_|jtjtj d|j r>| dS)z3Connect to the host and port specified in __init__.r+N) rrrrrrVZ setsockoptrZ IPPROTO_TCPZ TCP_NODELAYrrrwrrrconnects zHTTPConnection.connectcCsBt|_z|j}|r d|_|W5|j}|rsz/HTTPConnection._send_request..rr+rzaccept-encodingrrirhFrzUnable to determine size of %rTzTransfer-EncodingrRzContent-Lengthrr) frozensetrrrKr]rr\rnrr(r) r1rWrXrrArZ header_namesZskipsZcontent_lengthrqrrrrr s0      zHTTPConnection._send_requestcCs|jr|jrd|_|jtks&|jr0t|j|jdkrR|j|j|j|jd}n|j|j|jd}z\z | Wnt k r| YnX|j t kstt|_|j r| n||_|WS| YnXdS)a)Get the response from the server. If the HTTPConnection is in the correct state, returns an instance of HTTPResponse or of whatever object is returned by the response_class variable. If a request has not been sent or if a previous response has not be handled, ResponseNotReady is raised. If the HTTP response indicates that the connection should be closed, then it will be closed before the response is returned. When the connection is closed, the underlying socket is closed. Nrr)rr|rrrrKrrVrLrsConnectionErrorrtrUrNrr)r1rrrr getresponses0     zHTTPConnection.getresponse)NN)NF)FF)N)%r5r6r7rrrr HTTP_PORTrrrK staticmethodrrr_GLOBAL_DEFAULT_TIMEOUTrYrrrrrrtrrrrrrrrrrrrr rrrrrrsL     & 6    .csHeZdZdZeZdddejdfddddfdd ZfddZ Z S) HTTPSConnectionz(This class allows communication via SSL.Nr)contextcheck_hostnamerc stt|j||||| d|dk s2|dk s2|dk rHddl} | dtd||_||_|dkrtt }|j dk rtd|_ |j tj k} |dkr|j }|r| std|s|r||||j dk rd|_ ||_|dk r||j_ dS)N)rrzTkey_file, cert_file and check_hostname are deprecated, use a custom context instead.rZTzMcheck_hostname needs a SSL context with either CERT_OPTIONAL or CERT_REQUIRED)rvrrYwarningswarnDeprecationWarningkey_file cert_filesslZ_create_default_https_contextZpost_handshake_authZ verify_modeZ CERT_NONErr`Zload_cert_chain_context) r1rrrrrrrrrrZ will_verifyrxrrrYcs<    zHTTPSConnection.__init__cs6t|jr|j}n|j}|jj|j|d|_dS)z(Connect to a host on a given (SSL) port.)server_hostnameN)rvrrrrZ wrap_socketrV)r1rrxrrrs  zHTTPSConnection.connect) r5r6r7__doc__ HTTPS_PORTrrrrYrrrrrxrr\s$rc@s eZdZdS)rNr5r6r7rrrrrsc@s eZdZdS)rNrrrrrrsc@s eZdZdS)r Nrrrrrr sc@seZdZddZdS)rcCs|f|_||_dSru)argsrO)r1rOrrrrYszUnknownProtocol.__init__Nr5r6r7rYrrrrrsc@s eZdZdS)rNrrrrrrsc@s eZdZdS)r Nrrrrrr sc@s$eZdZdddZddZejZdS)r NcCs|f|_||_||_dSru)r partialexpected)r1r"r#rrrrYszIncompleteRead.__init__cCs2|jdk rd|j}nd}d|jjt|j|fS)Nz, %i more expectedr[z%s(%i bytes read%s))r#ryr5r-r")r1errr__repr__s  zIncompleteRead.__repr__)N)r5r6r7rYr%r"__str__rrrrr s c@s eZdZdS)r Nrrrrrr sc@s eZdZdS)r Nrrrrrr sc@s eZdZdS)rNrrrrrrsc@s eZdZdS)rNrrrrrrsc@seZdZddZdS)rcCs|s t|}|f|_||_dSru)r^r r3rrrrrYszBadStatusLine.__init__Nr!rrrrrsc@seZdZddZdS)rcCst|dt|fdS)Nz&got more than %d bytes when reading %s)rrYr>)r1Z line_typerrrrYszLineTooLong.__init__Nr!rrrrrsc@seZdZddZdS)rcOs"t|dtj|f||dS)Nr[)rrYConnectionResetError)r1poskwrrrrYs zRemoteDisconnected.__init__Nr!rrrrrs)r)ArZ email.parserrGZ email.messagerrrerZcollections.abcrZ urllib.parser__all__rrrNrrrglobalsupdater __members__rrr>r?compile fullmatchrrrrrrr(rZMessager)rBrIBufferedIOBaserrr ImportErrorrr0 Exceptionrrr rrr r r r rrrrr'rrrrrrsF        W 8 PKΠ]q5;;cookies.cpython-38.pycnu[U e5dO @stdZddlZddlZdddgZdjZdjZdjZGd ddeZ ej ej d Z e d Z d d eedeeee DZeeddeddiedee jZddZedZedZddZddddddd gZdd!d"d#d$d%d&d'd(d)d*d+d,g Zdeefd-d.ZGd/d0d0eZ d1Z!e!d2Z"ed3e!d4e"d5ej#ej$BZ%Gd6ddeZ&Gd7dde&Z'dS)8a. Here's a sample session to show how to use this module. At the moment, this is the only documentation. The Basics ---------- Importing is easy... >>> from http import cookies Most of the time you start by creating a cookie. >>> C = cookies.SimpleCookie() Once you've created your Cookie, you can add values just as if it were a dictionary. >>> C = cookies.SimpleCookie() >>> C["fig"] = "newton" >>> C["sugar"] = "wafer" >>> C.output() 'Set-Cookie: fig=newton\r\nSet-Cookie: sugar=wafer' Notice that the printable representation of a Cookie is the appropriate format for a Set-Cookie: header. This is the default behavior. You can change the header and printed attributes by using the .output() function >>> C = cookies.SimpleCookie() >>> C["rocky"] = "road" >>> C["rocky"]["path"] = "/cookie" >>> print(C.output(header="Cookie:")) Cookie: rocky=road; Path=/cookie >>> print(C.output(attrs=[], header="Cookie:")) Cookie: rocky=road The load() method of a Cookie extracts cookies from a string. In a CGI script, you would use this method to extract the cookies from the HTTP_COOKIE environment variable. >>> C = cookies.SimpleCookie() >>> C.load("chips=ahoy; vienna=finger") >>> C.output() 'Set-Cookie: chips=ahoy\r\nSet-Cookie: vienna=finger' The load() method is darn-tootin smart about identifying cookies within a string. Escaped quotation marks, nested semicolons, and other such trickeries do not confuse it. >>> C = cookies.SimpleCookie() >>> C.load('keebler="E=everybody; L=\\"Loves\\"; fudge=\\012;";') >>> print(C) Set-Cookie: keebler="E=everybody; L=\"Loves\"; fudge=\012;" Each element of the Cookie also supports all of the RFC 2109 Cookie attributes. Here's an example which sets the Path attribute. >>> C = cookies.SimpleCookie() >>> C["oreo"] = "doublestuff" >>> C["oreo"]["path"] = "/" >>> print(C) Set-Cookie: oreo=doublestuff; Path=/ Each dictionary element has a 'value' attribute, which gives you back the value associated with the key. >>> C = cookies.SimpleCookie() >>> C["twix"] = "none for you" >>> C["twix"].value 'none for you' The SimpleCookie expects that all values should be standard strings. Just to be sure, SimpleCookie invokes the str() builtin to convert the value to a string, when the values are set dictionary-style. >>> C = cookies.SimpleCookie() >>> C["number"] = 7 >>> C["string"] = "seven" >>> C["number"].value '7' >>> C["string"].value 'seven' >>> C.output() 'Set-Cookie: number=7\r\nSet-Cookie: string=seven' Finis. N CookieError BaseCookie SimpleCookiez;  c@s eZdZdS)rN)__name__ __module__ __qualname__r r $/usr/lib64/python3.8/http/cookies.pyrsz!#$%&'*+-.^_`|~:z ()/<=>?@[]{}cCsi|]}|d|qS)z\%03or ).0nr r r sr"\"\z\\z[%s]+cCs*|dkst|r|Sd|tdSdS)zQuote a string for use in a cookie header. If the string does not need to be double-quoted, then just return the string. Otherwise, surround the string in doublequotes and quote (with a \) special characters. Nr) _is_legal_key translate _Translatorstrr r r _quotesrz\\[0-3][0-7][0-7]z[\\].cCsN|dkst|dkr|S|ddks0|ddkr4|S|dd}d}t|}g}d|krf|krFnnt||}t||}|s|s|||dqFd}}|r|d}|r|d}|r|r||kr|||||||d|d}qP|||||tt||d|dd|d}qPt|S)Nrr) len _OctalPattsearch _QuotePattappendstartchrint _nulljoin)rir resZo_matchZq_matchjkr r r _unquotes6      $ r+ZMonZTueZWedZThuZFriZSatZSunZJanZFebZMarZAprZMayZJunZJulZAugZSepZOctZNovZDecc CsRddlm}m}|}|||\ }}}} } } } } }d|| ||||| | | fS)Nr)gmtimetimez#%s, %02d %3s %4d %02d:%02d:%02d GMT)r-r,)ZfutureZ weekdaynameZ monthnamer,r-ZnowZyearZmonthZdayZhhZmmZssZwdyzr r r _getdates r0c @seZdZdZdddddddd d d Zd d hZddZeddZeddZ eddZ ddZ d2ddZ ddZ ejZddZdd Zd!d"Zd#d$Zd%d&Zd'd(Zd3d*d+ZeZd,d-Zd4d.d/Zd5d0d1ZdS)6MorselaCA class to hold ONE (key, value) pair. In a cookie, each such pair may have several attributes, so this class is used to keep the attributes associated with the appropriate key,value pair. This class also includes a coded_value attribute, which is used to hold the network representation of the value. expiresPathCommentZDomainzMax-AgeZSecureZHttpOnlyZVersionZSameSite) r2pathcommentZdomainmax-agesecurehttponlyversionZsamesiter8r9cCs0d|_|_|_|jD]}t||dqdS)Nr)_key_value _coded_value _reserveddict __setitem__)selfkeyr r r __init__ s zMorsel.__init__cCs|jSN)r;rAr r r rB(sz Morsel.keycCs|jSrD)r<rEr r r value,sz Morsel.valuecCs|jSrD)r=rEr r r coded_value0szMorsel.coded_valuecCs2|}||jkr td|ft|||dSNzInvalid attribute %r)lowerr>rr?r@)rAKVr r r r@4s zMorsel.__setitem__NcCs.|}||jkr td|ft|||SrH)rIr>rr? setdefault)rArBvalr r r rL:s zMorsel.setdefaultcCs>t|tstSt||o<|j|jko<|j|jko<|j|jkSrD) isinstancer1NotImplementedr?__eq__r<r;r=rAZmorselr r r rP@s     z Morsel.__eq__cCs$t}t|||j|j|SrD)r1r?update__dict__rQr r r copyJs z Morsel.copycCsRi}t|D]0\}}|}||jkr8td|f|||<qt||dSrH)r?itemsrIr>rrR)rAvaluesdatarBrMr r r rRPs  z Morsel.updatecCs||jkSrD)rIr>)rArJr r r isReservedKeyYszMorsel.isReservedKeycCsH||jkrtd|ft|s2td|f||_||_||_dS)Nz Attempt to set a reserved key %rzIllegal key %r)rIr>rrr;r<r=)rArBrMZ coded_valr r r set\sz Morsel.setcCs|j|j|jdS)N)rBrFrGr;r<r=rEr r r __getstate__gszMorsel.__getstate__cCs"|d|_|d|_|d|_dS)NrBrFrGrZ)rAstater r r __setstate__ns  zMorsel.__setstate__ Set-Cookie:cCsd|||fS)Nz%s %s) OutputString)rAattrsheaderr r r outputssz Morsel.outputcCsd|jj|fS)N<%s: %s>) __class__rr_rEr r r __repr__xszMorsel.__repr__cCsd||ddS)Nz rr)r_replace)rAr`r r r js_output{szMorsel.js_outputcCs$g}|j}|d|j|jf|dkr,|j}t|}|D]\}}|dkrNq<||krXq<|dkrt|tr|d|j|t|fq<|dkrt|tr|d|j||fq<|dkrt|t r|d|j|t |fq<||j kr|r|t |j|q<|d|j||fqsortedrUrNr%r0rr_flags_semispacejoin)rAr`resultr"rUrBrFr r r r_s,   zMorsel.OutputString)N)Nr^)N)N)rrr __doc__r>rjrCpropertyrBrFrGr@rLrPobject__ne__rTrRrXrYr[r]rb__str__rergr_r r r r r1sD         r1z,\w\d!#%&'~_`><@,:/\$\*\+\-\.\^\|\)\(\?\}\{\=z\[\]z \s* # Optional whitespace at start of cookie (?P # Start of group 'key' [a ]+? # Any word of at least one letter ) # End of group 'key' ( # Optional group: there may not be a value. \s*=\s* # Equal Sign (?P # Start of group 'val' "(?:[^\\"]|\\.)*" # Any doublequoted string | # or \w{3},\s[\w\d\s-]{9,11}\s[\d:]{8}\sGMT # Special case for "expires" attr | # or [a-]* # Any word or empty string ) # End of group 'val' )? # End of optional value group \s* # Any number of spaces. (\s+|;|$) # Ending either at space, semicolon, or EOS. c@sneZdZdZddZddZdddZd d Zd d ZdddZ e Z ddZ dddZ ddZ efddZdS)rz'A container class for a set of Morsels.cCs||fS)a real_value, coded_value = value_decode(STRING) Called prior to setting a cookie's value from the network representation. The VALUE is the value read from HTTP header. Override this function to modify the behavior of cookies. r rArMr r r value_decodeszBaseCookie.value_decodecCst|}||fS)zreal_value, coded_value = value_encode(VALUE) Called prior to setting a cookie's value from the dictionary representation. The VALUE is the value being assigned. Override this function to modify the behavior of cookies. rrArMZstrvalr r r value_encodeszBaseCookie.value_encodeNcCs|r||dSrD)load)rAinputr r r rCszBaseCookie.__init__cCs.||t}||||t|||dS)z+Private method for setting a cookie's valueN)getr1rYr?r@)rArBZ real_valuerGMr r r Z__setszBaseCookie.__setcCs:t|trt|||n||\}}||||dS)zDictionary style assignment.N)rNr1r?r@ru_BaseCookie__set)rArBrFrvalcvalr r r r@s zBaseCookie.__setitem__r^ cCs:g}t|}|D]\}}||||q||S)z"Return a string suitable for HTTP.)rirUr"rbjoin)rAr`raseprlrUrBrFr r r rbs   zBaseCookie.outputcCsJg}t|}|D] \}}|d|t|jfqd|jjt|fS)Nrhrc)rirUr"reprrFrdr _spacejoin)rAlrUrBrFr r r res   zBaseCookie.__repr__cCs6g}t|}|D]\}}|||qt|S)z(Return a string suitable for JavaScript.)rirUr"rgr&)rAr`rlrUrBrFr r r rgs   zBaseCookie.js_outputcCs4t|tr||n|D]\}}|||<qdS)zLoad cookies from a string (presumably HTTP_COOKIE) or from a dictionary. Loading cookies from a dictionary 'd' is equivalent to calling: map(Cookie.__setitem__, d.keys(), d.values()) N)rNr_BaseCookie__parse_stringrU)rAZrawdatarBrFr r r rv s    zBaseCookie.loadcCsd}t|}g}d}d}d}d|kr2|krnn|||} | sJq| d| d} } | d}| ddkr|s|q||| dd| fq| tjkr|sdS| dkr| tjkr||| dfqdSn||| t | fq| dk r||| | | fd}qdSqd} |D]Z\} } } | |krP| dk sFt | | | <n,| |ks^t | \}}| | |||| } q$dS) NrFrrrBrM$T) rmatchgroupendr"rIr1r>rjr+rsAssertionErrorrz)rArZpattr'r Z parsed_itemsZ morsel_seenZTYPE_ATTRIBUTEZ TYPE_KEYVALUErrBrFrytpr{r|r r r Z__parse_stringsJ      zBaseCookie.__parse_string)N)Nr^r})N)rrr rmrsrurCrzr@rbrqrergrv_CookiePatternrr r r r rs    c@s eZdZdZddZddZdS)rz SimpleCookie supports strings as cookie values. When setting the value using the dictionary assignment notation, SimpleCookie calls the builtin str() to convert the value to a string. Values received from HTTP are kept as strings. cCs t||fSrD)r+rrr r r rs\szSimpleCookie.value_decodecCst|}|t|fSrD)rrrtr r r ru_szSimpleCookie.value_encodeN)rrr rmrsrur r r r rUs)(rmrestring__all__r~r&rkr ExceptionrZ ascii_lettersZdigitsZ _LegalCharsZ_UnescapedCharsrYrangemapordrrRcompileescape fullmatchrrrr!r+Z _weekdaynameZ _monthnamer0r?r1Z_LegalKeyCharsZ_LegalValueCharsASCIIVERBOSErrrr r r r 'sr]   24    PKΠ]Icookiejar.cpython-38.pycnu[U e5d#, @s dZddddddddgZd d lZd d lZd d lZd d lZd d lZd d lZd d l Zd d l Z d d l Z d d lmZd Zd ad dZee jjZdZddZdZddZdddddddgZddddd d!d"d#d$d%d&d'g ZgZeD]Zee qdud(d)Z!dvd*d+Z"d d d d d,Z#e$d-ej%Z&d.d/Z'd0d1Z(e$d2ej%Z)e$d3ej*ej%BZ+e$d4ej,ej%BZ-d5d6Z.e$d7ej,ej%BZ/d8d9Z0d:d;Z1e$d<Z2e$d=Z3e$d>Z4e$d?Z5d@dAZ6e$dBZ7dCdDZ8dEdFZ9dGdHZ:e$dIej%Z;dJdKZdPdQZ?e$dRej%Z@dSdTZAdUdVZBdWdXZCdYdZZDd[ZEe$d\ZFd]d^ZGd_d`ZHdadbZIdcddZJGdeddZKGdfddZLGdgddeLZMdhdiZNdjdkZOGdldmdmZPGdnddZQGdoddeRZSGdpddeQZTdqdrZUGdsddeTZVGdtddeTZWd S)waHTTP cookie handling for web clients. This module has (now fairly distant) origins in Gisle Aas' Perl module HTTP::Cookies, from the libwww-perl library. Docstrings, comments and debug strings in this code refer to the attributes of the HTTP cookie system as cookie-attributes, to distinguish them clearly from Python attributes. Class diagram (note that BSDDBCookieJar and the MSIE* classes are not distributed with the Python standard library, but are available from http://wwwsearch.sf.net/): CookieJar____ / \ \ FileCookieJar \ \ / | \ \ \ MozillaCookieJar | LWPCookieJar \ \ | | \ | ---MSIEBase | \ | / | | \ | / MSIEDBCookieJar BSDDBCookieJar |/ MSIECookieJar Cookie CookieJar CookiePolicyDefaultCookiePolicy FileCookieJar LWPCookieJar LoadErrorMozillaCookieJarN)timegmFcGs(tsdStsddl}|datj|S)Nr zhttp.cookiejar)debugloggerloggingZ getLogger)argsr r&/usr/lib64/python3.8/http/cookiejar.py_debug,s  rzQa filename was not supplied (nor was the CookieJar instance initialised with one)cCsJddl}ddl}ddl}|}|d||}|jd|dddS)Nr zhttp.cookiejar bug! %s) stacklevel)iowarnings tracebackStringIO print_excgetvaluewarn)rrrfmsgrrr_warn_unhandled_exception:s  ricCs|dd\}}}}}}|tkrd|kr4dkrnnhd|krLdkrnnPd|krddkrnn8d|kr|dkrnn d|krdkrnnt|SdSdS) N r ;=) EPOCH_YEARr )ttyearmonthZmdayhourminsecrrr_timegmIs&8   r,ZMonZTueZWedZThuZFriZSatZSunZJanZFebZMarZAprZMayZJunZJulZAugZSepZOctZNovZDeccCs@|dkrtj}n tj|}d|j|j|j|j|j|jfS)aHReturn a string representing time in seconds since epoch, t. If the function is called without an argument, it will use the current time. The format of the returned string is like "YYYY-MM-DD hh:mm:ssZ", representing Universal Time (UTC, aka GMT). An example of this format is: 1994-11-24 08:49:37Z Nz%04d-%02d-%02d %02d:%02d:%02dZ) datetimeutcnowutcfromtimestampr'r(dayr)minutesecondtZdtrrr time2isozWs   r5cCsR|dkrtj}n tj|}dt||jt|jd|j|j |j |j fS)zReturn a string representing time in seconds since epoch, t. If the function is called without an argument, it will use the current time. The format of the returned string is like this: Wed, DD-Mon-YYYY HH:MM:SS GMT Nz#%s, %02d-%s-%04d %02d:%02d:%02d GMTr) r-r.r/DAYSZweekdayr0MONTHSr(r'r)r1r2r3rrr time2netscapejs     r8)ZGMTUTCZUTZz^([-+])?(\d\d?):?(\d\d)?$cCsjd}|tkrd}nTt|}|rfdt|d}|drR|dt|d}|ddkrf| }|S)Nr ir<r-) UTC_ZONES TIMEZONE_REsearchintgroup)tzoffsetmrrroffset_from_tz_strings  rFc Cst|}|tjkrdSzt|d}Wn^tk rz t|}Wntk r`YYdSXd|krvdkrnn|}nYdSYnX|dkrd}|dkrd}|dkrd}t|}t|}t|}t|}|dkr6ttd}|d} |} ||| }| | } t | dkr6| dkr.|d}n|d}t |||||||f} | dk r|dkrdd}| }t |} | dkrdS| | } | S)Nrr r id2r9) rAr-ZMAXYEAR MONTHS_LOWERindexlower ValueErrortime localtimeabsr,upperrF) r0monyrhrr*r+rCZimonZcur_yrrEZtmpr4rDrrr _str2timesV          rTzV^[SMTWF][a-z][a-z], (\d\d) ([JFMASOND][a-z][a-z]) (\d\d\d\d) (\d\d):(\d\d):(\d\d) GMT$z+^(?:Sun|Mon|Tue|Wed|Thu|Fri|Sat)[a-z]*,?\s*a^ (\d\d?) # day (?:\s+|[-\/]) (\w+) # month (?:\s+|[-\/]) (\d+) # year (?: (?:\s+|:) # separator before clock (\d\d?):(\d\d) # hour:min (?::(\d\d))? # optional seconds )? # optional clock \s* (?: ([-+]?\d{2,4}|(?![APap][Mm]\b)[A-Za-z]+) # timezone \s* )? (?: \(\w+\) # ASCII representation of timezone in parens. \s* )?$c Cst|}|rl|}t|dd}t|d|t|dt|dt|dt|df}t|S| }t d|d}dgd \}}}}}} } t |}|dk r|\}}}}}} } ndSt |||||| | S) aReturns time in seconds since epoch of time represented by a string. Return value is an integer. None is returned if the format of str is unrecognized, the time is outside the representable range, or the timezone string is not recognized. If the string contains no timezone, UTC is assumed. The timezone in the string may be numerical (like "-0800" or "+0100") or a string timezone (like "UTC", "GMT", "BST" or "EST"). Currently, only the timezone strings equivalent to UTC (zero offset) are known to the function. The function loosely parses the following formats: Wed, 09 Feb 1994 22:23:32 GMT -- HTTP format Tuesday, 08-Feb-94 14:15:29 GMT -- old rfc850 HTTP format Tuesday, 08-Feb-1994 14:15:29 GMT -- broken rfc850 HTTP format 09 Feb 1994 22:23:32 GMT -- HTTP format (no weekday) 08-Feb-94 14:15:29 GMT -- rfc850 format (no weekday) 08-Feb-1994 14:15:29 GMT -- broken rfc850 format (no weekday) The parser ignores leading and trailing whitespace. The time may be absent. If the year is given with only 2 digits, the function will select the century that makes the year closest to the current date. rrr r;N)STRICT_DATE_REr@groupsrIrJrKrAfloatr,lstrip WEEKDAY_REsubLOOSE_HTTP_DATE_RErT) textrEgrQr&r0rRrSr*r+rCrrr http2times$   rba^ (\d{4}) # year [-\/]? (\d\d?) # numerical month [-\/]? (\d\d?) # day (?: (?:\s+|[-:Tt]) # separator before clock (\d\d?):?(\d\d) # hour:min (?::?(\d\d(?:\.\d*)?))? # optional seconds (and fractional) )? # optional clock \s* (?: ([-+]?\d\d?:?(:?\d\d)? |Z|z) # timezone (Z is "zero meridian", i.e. GMT) \s* )?$c Csd|}dgd\}}}}}}}t|}|dk rL|\}}}}}}}} ndSt|||||||S)av As for http2time, but parses the ISO 8601 formats: 1994-02-03 14:15:29 -0100 -- ISO 8601 format 1994-02-03 14:15:29 -- zone is optional 1994-02-03 -- only date 1994-02-03T14:15:29 -- Use T as separator 19940203T141529Z -- ISO 8601 compact format 19940203 -- only date NrX)r\ ISO_DATE_REr@rZrT) r`r0rQrRrSr*r+rCrE_rrriso2time+s  recCs*|d\}}|jd||j|dS)z)Return unmatched part of re.Match object.r N)spanstring)matchstartendrrr unmatchedLsrkz^\s*([^=\s;,]+)z&^\s*=\s*\"([^\"\\]*(?:\\.[^\"\\]*)*)\"z^\s*=\s*([^\s;,]*)z\\(.)c Cs0t|trtg}|D]}|}g}|rt|}|rt|}|d}t|}|rxt|}|d}t d|}n.t |}|rt|}|d}| }nd}| ||fq$| dr| dd}|r| |g}q$tdd|\}} | dkstd|||f|}q$|r| |q|S) amParse header values into a list of lists containing key,value pairs. The function knows how to deal with ",", ";" and "=" as well as quoted values after "=". A list of space separated tokens are parsed as if they were separated by ";". If the header_values passed as argument contains multiple values, then they are treated as if they were a single value separated by comma ",". This means that this function is useful for parsing header fields that follow this syntax (BNF as from the HTTP/1.1 specification, but we relax the requirement for tokens). headers = #header header = (token | parameter) *( [";"] (token | parameter)) token = 1* separators = "(" | ")" | "<" | ">" | "@" | "," | ";" | ":" | "\" | <"> | "/" | "[" | "]" | "?" | "=" | "{" | "}" | SP | HT quoted-string = ( <"> *(qdtext | quoted-pair ) <"> ) qdtext = > quoted-pair = "\" CHAR parameter = attribute "=" value attribute = token value = token | quoted-string Each header is represented by a list of key/value pairs. The value for a simple token (not part of a parameter) is None. Syntactically incorrect headers will not necessarily be parsed as you would want. This is easier to describe with some examples: >>> split_header_words(['foo="bar"; port="80,81"; discard, bar=baz']) [[('foo', 'bar'), ('port', '80,81'), ('discard', None)], [('bar', 'baz')]] >>> split_header_words(['text/html; charset="iso-8859-1"']) [[('text/html', None), ('charset', 'iso-8859-1')]] >>> split_header_words([r'Basic realm="\"foo\bar\""']) [[('Basic', None), ('realm', '"foobar"')]] rz\1N,z^[=\s;]*rWr z&split_header_words bug: '%s', '%s', %s) isinstancestrAssertionErrorHEADER_TOKEN_REr@rkrBHEADER_QUOTED_VALUE_REHEADER_ESCAPE_REr^HEADER_VALUE_RErstripappendr\ startswithresubn) Z header_valuesresultr`Z orig_textpairsrEnamevalueZnon_junkZ nr_junk_charsrrrsplit_header_wordsUsJ-           r}([\"\\])cCs|g}|D]h}g}|D]F\}}|dk rPtd|sDtd|}d|}d||f}||q|r|d|qd|S)aDo the inverse (almost) of the conversion done by split_header_words. Takes a list of lists of (key, value) pairs and produces a single header value. Attribute values are quoted if needed. >>> join_header_words([[("text/plain", None), ("charset", "iso-8859-1")]]) 'text/plain; charset="iso-8859-1"' >>> join_header_words([[("text/plain", None)], [("charset", "iso-8859-1")]]) 'text/plain, charset="iso-8859-1"' Nz^\w+$\\\1z"%s"%s=%s; , )rwr@HEADER_JOIN_ESCAPE_REr^rujoin)Zlistsheadersrzattrkvrrrjoin_header_wordss      rcCs0|dr|dd}|dr,|dd}|S)N"r)rvendswithr`rrr strip_quotess     rc Csd}g}|D]}g}d}t|dD]\}}|}|d\}} } |}|sb|dkr&qnq&| rn| nd} |dkr|} | |kr| }|dkr| dk rt| } d}n|d kr| dk rtt| } ||| fq&|r |s|d ||q |S) a5Ad-hoc parser for Netscape protocol cookie-attributes. The old Netscape cookie format for Set-Cookie can for instance contain an unquoted "," in the expires field, so we have to use this ad-hoc parser instead of split_header_words. XXX This may not make the best possible effort to parse all the crap that Netscape Cookie headers contain. Ronald Tschalar's HTTPClient parser is probably better, so could do worse than following that if this ever gives any trouble. Currently, this is also used for parsing RFC 2109 cookies. )expiresdomainpathsecureversionportmax-ageF;=r NrTr)r0) enumeratesplitstrip partitionrKrrbru) Z ns_headersZ known_attrsryZ ns_headerrz version_setZiiZparamkeysepvallcrrrparse_ns_headerss>   rz\.\d+$cCs:t|rdS|dkrdS|ddks2|ddkr6dSdS)z*Return True if text is a host domain name.FrWr .rTIPV4_REr@rrrris_HDNs rcCsl|}|}||krdSt|s(dS||}|dksB|dkrFdS|dsTdSt|ddshdSdS)aReturn True if domain A domain-matches domain B, according to RFC 2965. A and B may be host domain names or IP addresses. RFC 2965, section 1: Host names can be specified either as an IP address or a HDN string. Sometimes we compare one host name with another. (Such comparisons SHALL be case-insensitive.) Host A's name domain-matches host B's if * their host name strings string-compare equal; or * A is a HDN string and has the form NB, where N is a non-empty name string, B has the form .B', and B' is a HDN string. (So, x.y.com domain-matches .Y.com but not Y.com.) Note that domain-match is not a commutative operation: a.b.c.com domain-matches .c.com, but not the reverse. TFrr rrN)rKrrfindrv)ABirrr domain_matchs  rcCst|rdSdS)zdReturn True if text is a sort-of-like a host domain name. For accepting/blocking domains. FTrrrrrliberal_is_HDNFs rcCs`|}|}t|r t|s0||kr,dSdS|d}|rL||rLdS|s\||kr\dSdS)z\For blocking/accepting domains. A and B may be host domain names or IP addresses. TFr)rKrrvr)rr initial_dotrrruser_domain_matchPs  rz:\d+$cCsB|}tj|d}|dkr,|dd}td|d}|S)zReturn request-host, as defined by RFC 2965. Variation from RFC: returned value is lowercased, for convenient comparison. rrWZHost) get_full_urlurllibparseZurlparseZ get_header cut_port_rer^rK)requesturlhostrrr request_hostes  rcCs4t|}}|ddkr,t|s,|d}||fS)zzReturn a tuple (request-host, effective request-host name). As defined by RFC 2965, except both are lowercased. rr.local)rfindrr@)rerhnreq_hostrrreff_request_hostus rcCs4|}tj|}t|j}|ds0d|}|S)z6Path component of request-URI, as defined by RFC 2965./)rrrZurlsplit escape_pathrrv)rrpartsrrrr request_paths    rcCs`|j}|d}|dkrX||dd}z t|Wq\tk rTtd|YdSXnt}|S)N:r rznonnumeric port: '%s')rrrArLrDEFAULT_HTTP_PORT)rrrrrrr request_ports    rz%/;:@&=+$,!~*'()z%([0-9a-fA-F][0-9a-fA-F])cCsd|dS)Nz%%%sr)rBrP)rhrrruppercase_escaped_charsrcCstj|t}tt|}|S)zEEscape any invalid characters in HTTP URL, and uppercase all escapes.)rrZquoteHTTP_PATH_SAFEESCAPED_CHAR_REr^r)rrrrrs  rcCsP|d}|dkrL||dd}|d}t|rL|dksD|dkrLd|S|S)aBReturn reach of host h, as defined by RFC 2965, section 1. The reach R of a host name H is defined as follows: * If - H is the host domain name of a host; and, - H has the form A.B; and - A has no embedded (that is, interior) dots; and - B has at least one embedded dot, or B is the string "local". then the reach of H is .B. * Otherwise, the reach of H is H. >>> reach("www.acme.com") '.acme.com' >>> reach("acme.com") 'acme.com' >>> reach("acme.local") '.local' rr rNZlocal)rr)hrbrrrreachs  rcCs$t|}t|t|jsdSdSdS)z RFC 2965, section 3.3.6: An unverifiable transaction is to a third-party host if its request- host U does not domain-match the reach R of the request-host O in the origin transaction. TFN)rrrZorigin_req_host)rrrrris_third_partys rc@sNeZdZdZdddZddZddd Zd d Zdd d ZddZ ddZ dS)raHTTP Cookie. This class represents both Netscape and RFC 2965 cookies. This is deliberately a very simple class. It just holds attributes. It's possible to construct Cookie instances that don't comply with the cookie standards. CookieJar.make_cookies is the factory function for Cookie objects -- it deals with cookie parsing, supplying defaults, and normalising to the representation used in this class. CookiePolicy is responsible for checking them to see whether they should be accepted from and returned to the server. Note that the port may be present in the headers, but unspecified ("Port" rather than"Port=80", for example); if this is the case, port is None. FcCs|dk rt|}| dk r$tt| } |dkr<|dkr)rrrr|r{)rplimitZ namevaluerrr__str__)s   zCookie.__str__cCslg}dD]$}t||}|d|t|fq|dt|j|dt|jd|jjd|fS)N)rr{r|rrrrrrrrrrrrrzrest=%sz rfc2109=%sz%s(%s)r)getattrrureprrr __class____name__r)rrr{rrrr__repr__3s zCookie.__repr__)F)N)N) r __module__ __qualname____doc__rrrrrrrrrrrrs *   c@s0eZdZdZddZddZddZdd Zd S) ra Defines which cookies get accepted from and returned to server. May also modify cookies, though this is probably a bad idea. The subclass DefaultCookiePolicy defines the standard rules for Netscape and RFC 2965 cookies -- override that if you want a customized policy. cCs tdS)zReturn true if (and only if) cookie should be accepted from server. Currently, pre-expired cookies never get this far -- the CookieJar class deletes such cookies itself. NNotImplementedErrorrcookierrrrset_okKszCookiePolicy.set_okcCs tdS)zAReturn true if (and only if) cookie should be returned to server.Nrrrrr return_okTszCookiePolicy.return_okcCsdS)zMReturn false if cookies should not be returned, given cookie domain. Tr)rrrrrrdomain_return_okXszCookiePolicy.domain_return_okcCsdS)zKReturn false if cookies should not be returned, given cookie path. Tr)rrrrrrpath_return_ok]szCookiePolicy.path_return_okN)rrrrrrrrrrrrrBs  c @seZdZdZdZdZdZdZeeBZdddddddddeddd f d d Z d d Z ddZ ddZ ddZ ddZddZddZddZddZddZd d!Zd"d#Zd$d%Zd&d'Zd(d)Zd*d+Zd,d-Zd.d/Zd0d1Zd2d3Zd4d5Zd6d7ZdS)8rzBImplements the standard rules for accepting and returning cookies.rrrUr NTF)ZhttpsZwsscCsv||_||_||_||_||_||_| |_| |_| |_| |_ | |_ |dk rVt ||_ nd|_ |dk rlt |}||_ dS)zAConstructor arguments should be passed as keyword arguments only.Nr)netscaperfc2965rfc2109_as_netscape hide_cookie2 strict_domainstrict_rfc2965_unverifiablestrict_ns_unverifiablestrict_ns_domainstrict_ns_set_initial_dollarstrict_ns_set_pathsecure_protocolstuple_blocked_domains_allowed_domains)rblocked_domainsallowed_domainsrrrrrrrrrrrrrrrms" zDefaultCookiePolicy.__init__cCs|jS)z4Return the sequence of blocked domains (as a tuple).)rrrrrrsz#DefaultCookiePolicy.blocked_domainscCst||_dS)z$Set the sequence of blocked domains.N)rr)rrrrrset_blocked_domainssz'DefaultCookiePolicy.set_blocked_domainscCs |jD]}t||rdSqdSr)rr)rrZblocked_domainrrr is_blockeds  zDefaultCookiePolicy.is_blockedcCs|jS)z=Return None, or the sequence of allowed domains (as a tuple).)rrrrrrsz#DefaultCookiePolicy.allowed_domainscCs|dk rt|}||_dS)z-Set the sequence of allowed domains, or None.N)rr)rrrrrset_allowed_domainssz'DefaultCookiePolicy.set_allowed_domainscCs.|jdkrdS|jD]}t||rdSqdS)NFT)rr)rrZallowed_domainrrris_not_alloweds    z"DefaultCookiePolicy.is_not_allowedcCsNtd|j|j|jdk stdD]&}d|}t||}|||s"dSq"dS)z If you override .set_ok(), be sure to call this method. If it returns false, so should your subclass (assuming your subclass wants to be more strict about which cookies to accept).  - checking cookie %s=%sN)r verifiabilityr{rrrZset_ok_FT)rr{r|rorrrrnZfn_namefnrrrrs  zDefaultCookiePolicy.set_okcCsZ|jdkrtd|j|jdS|jdkr:|js:tddS|jdkrV|jsVtddSdS)Nz0 Set-Cookie2 without version attribute (%s=%s)Fr $ RFC 2965 cookies are switched off$ Netscape cookies are switched offT)rrr{r|rrrrrrset_ok_versions z"DefaultCookiePolicy.set_ok_versioncCsJ|jrFt|rF|jdkr*|jr*tddS|jdkrF|jrFtddSdSNr z> third-party RFC 2965 cookie during unverifiable transactionFz> third-party Netscape cookie during unverifiable transactionTZ unverifiablerrrrrrrrrset_ok_verifiabilitysz(DefaultCookiePolicy.set_ok_verifiabilitycCs0|jdkr,|jr,|jdr,td|jdSdS)Nr $z' illegal name (starts with '$'): '%s'FT)rrr{rvrrrrr set_ok_names   zDefaultCookiePolicy.set_ok_namecCsL|jrHt|}|jdks(|jdkrH|jrH||j|sHtd|j|dSdS)Nr z7 path attribute %s is not a prefix of request path %sFT)rrrrrrr)rrrreq_pathrrr set_ok_paths  zDefaultCookiePolicy.set_ok_pathc Cs||jrtd|jdS||jr8td|jdS|jrt|\}}|j}|jr|ddkr|d}|dd|}|dkr||dd}||d|} | dkrt |dkrtd |dS| dr|dd} n|} | ddk} | s|d krtd |dS|j dkrX||sX| dsXd||sXtd ||dS|j dksr|j|j@rt||std ||dS|j dks|j|j@r|dt | } | ddkrt|std| |dSdS)N" domain %s is in user block-listF& domain %s is not in user allow-listrrr r)coZacZcomZeduZorgZnetZgovZmilrAZaeroZbizcatZcoopinfoZjobsZmobiZmuseumr{ZproZtravelZeuz& country-code second level domain %srz/ non-local domain %s contains no embedded dotzO effective request-host %s (even with added initial dot) does not end with %sz5 effective request-host %s does not domain-match %sz. host prefix %s for domain %s contains a dotT)rrrrrrrcountrrKlenrvrrrrDomainRFC2965MatchrDomainStrictNoDotsrr@) rrrrrrrjZtldZsldZundotted_domainZ embedded_dotsZ host_prefixrrr set_ok_domains|                  z!DefaultCookiePolicy.set_ok_domainc Cs|jrt|}|dkrd}nt|}|jdD]@}z t|Wn"tk rbtd|YdSX||kr0qq0td||jdSdS)N80rlz bad port %s (not numeric)Fz$ request port (%s) not found in %sT)rrrnrrrArLrrrrZreq_portrrrr set_ok_port+s&   zDefaultCookiePolicy.set_ok_portcCs@td|j|jdD]&}d|}t||}|||sdSqdS)z If you override .return_ok(), be sure to call this method. If it returns false, so should your subclass (assuming your subclass wants to be more strict about which cookies to return). r )rr rrrrZ return_ok_FT)rr{r|rr rrrr@s   zDefaultCookiePolicy.return_okcCs<|jdkr|jstddS|jdkr8|js8tddSdS)Nr rFrT)rrrrrrrrreturn_ok_versionRsz%DefaultCookiePolicy.return_ok_versioncCsJ|jrFt|rF|jdkr*|jr*tddS|jdkrF|jrFtddSdSrrrrrrreturn_ok_verifiability[sz+DefaultCookiePolicy.return_ok_verifiabilitycCs"|jr|j|jkrtddSdS)Nz( secure cookie with non-secure requestFT)rtyperrrrrrreturn_ok_securegsz$DefaultCookiePolicy.return_ok_securecCs||jrtddSdS)Nz cookie expiredFT)r_nowrrrrrreturn_ok_expiresms z%DefaultCookiePolicy.return_ok_expirescCsN|jrJt|}|dkrd}|jdD]}||kr&qJq&td||jdSdS)Nr#rlz0 request port %s does not match cookie port %sFT)rrrrr$rrrreturn_ok_portssz"DefaultCookiePolicy.return_ok_portcCst|\}}|j}|r*|ds*d|}n|}|jdkr^|j|j@r^|js^||kr^tddS|jdkrt||std||dS|jdkrd| |std||dSdS)Nrr zQ cookie with unspecified domain does not string-compare equal to request domainFzQ effective request-host name %s does not domain-match RFC 2965 cookie domain %sz; request-host %s does not match Netscape cookie domain %sT) rrrvrrDomainStrictNonDomainrrrr)rrrrrr dotdomainrrrreturn_ok_domains6    z$DefaultCookiePolicy.return_ok_domaincCst|\}}|dsd|}|ds0d|}|rH|dsHd|}n|}||sd||sddS||r|td|dS||rtd|dSdS)NrFrrT)rrvrrrr)rrrrrr.rrrrs"        z$DefaultCookiePolicy.domain_return_okcCsbtd|t|}t|}||kr&dS||rR|dsN|||ddkrRdStd||dS)Nz- checking cookie path=%sTrrz %s does not path-match %sF)rrrrvr)rrrrZpathlenrrrrs   z"DefaultCookiePolicy.path_return_ok) rrrrr r-rZ DomainLiberalZ DomainStrictrrrrrrrrrrrrr"r%rr&r'r)r+r,r/rrrrrrrcsT #   ;  cCst|}t|j|Sr)sortedkeysmapr)Zadictr1rrrvals_sorted_by_keys r3c csVt|}|D]D}d}z |jWntk r2YnXd}t|EdH|s |Vq dS)zBIterates over nested mapping, depth-first, in sorted order by key.FTN)r3itemsAttributeError deepvalues)mappingvaluesobjrrrr6s r6c@s eZdZdS)AbsentNrrrrrrrr:sr:c@seZdZdZedZedZedZedZ edZ edej Z d3d d Z d d Zd dZddZddZddZddZddZddZddZddZdd Zd!d"Zd#d$Zd4d%d&Zd'd(Zd)d*Zd+d,Zd-d.Zd/d0Z d1d2Z!dS)5rzCollection of HTTP cookies. You may not need to know about this class: try urllib.request.build_opener(HTTPCookieProcessor).open(url). z\Wr~z\.?[^.]*z[^.]*z^\.+z^\#LWP-Cookies-(\d+\.\d+)NcCs(|dkrt}||_t|_i|_dSr)r_policy _threadingRLock _cookies_lock_cookiesrpolicyrrrrs  zCookieJar.__init__cCs ||_dSr)r<rArrr set_policyszCookieJar.set_policycCsg}|j||sgStd||j|}|D]T}|j||sFq2||}|D].}|j||srtdqVtd||qVq2|S)Nz!Checking %s for cookies to returnz not returning cookiez it's a match) r<rrr@r1rr8rru)rrrcookiesZcookies_by_pathrZcookies_by_namerrrr_cookies_for_domains     zCookieJar._cookies_for_domaincCs*g}|jD]}||||q|S)z2Return a list of cookies to be returned to server.)r@r1extendrE)rrrDrrrr_cookies_for_requestszCookieJar._cookies_for_requestc Cs<|jddddd}g}|D]}|j}|sHd}|dkrH|d||jdk rz|j|jrz|dkrz|jd |j}n|j}|jdkr||jn|d |j|f|dkr|j r|d |j |j d r|j }|j s| d r|d d}|d||jdk rd}|jr,|d|j}||q|S)zReturn a list of cookie-attributes to be returned to server. like ['foo="bar"; $Path="/"', ...] The $Version attribute is also added when appropriate (currently only once per request). cSs t|jSr)rr)arrrz)CookieJar._cookie_attrs..T)rreverseFr z $Version=%sNrrz $Path="%s"rrz $Domain="%s"z$Portz="%s")sortrrur| non_word_rer@quote_rer^r{rrrrvrrr) rrDrattrsrrr|rrrrr _cookie_attrssF        zCookieJar._cookie_attrscCstd|jztt|j_|_||}| |}|r^| ds^| dd ||jj r|jjs| ds|D]}|jdkr|| ddqq|W5|jX|dS)zAdd correct Cookie: header to request (urllib.request.Request object). The Cookie2 header is also added unless policy.hide_cookie2 is true. add_cookie_headerrrZCookie2rz $Version="1"N)rr?acquirereleaserArMr<r*rGrPZ has_headerZadd_unredirected_headerrrrrclear_expired_cookies)rrrDrOrrrrrQIs*        zCookieJar.add_cookie_headerc Csg}d}d}|D]z}|d\}}d}d} i} i} |ddD]0\} } | }||ks`||krd|} | |krx| dkrxd} | | krq>| dkr| dkrtd d} qr| } | d kr|rq>| dkrtd q>| d kr d}z t| } Wn*tk rtd d} YqrYnXd } |j| } | |ks4| |krh| dkr^| dkr^td| d} qr| | | <q>| | | <q>| rzq|||| | fq|S)aReturn list of tuples containing normalised cookie information. attrs_set is the list of lists of key,value pairs extracted from the Set-Cookie or Set-Cookie2 headers. Tuples are name, value, standard, rest, where name and value are the cookie name and value, standard is a dictionary containing the standard cookie-attributes (discard, secure, version, expires or max-age, domain, path and port) and rest is a dictionary containing the rest of the cookie-attributes. )rr)rrrrrrr commenturlr FrNTrz% missing value for domain attributerzM missing or invalid value for expires attribute: treating as session cookierz? missing or invalid (non-numeric) value for max-age attribute)rrrUz! missing value for %s attribute)rKrrArLr*ru)r attrs_set cookie_tuples boolean_attrs value_attrsZ cookie_attrsr{r|Z max_age_setZ bad_cookiestandardrrrrrrr_normalized_cookie_tuplesjsh          z#CookieJar._normalized_cookie_tuplescCs&|\}}}}|dt}|dt}|dt} |dt} |dd} | dk rtz t| } Wntk rrYdSX|dd} |dd} |d d}|d d}|tk r|d krd }t|}nXd}t|}|d }|dkr| dkr|d|}n|d|d}t|dkrd }|tk }d}|r:t| d}|tkrVt |\}}|}n| dsjd|}d}| tk r| dkrt |} nd }t dd | } nd} | tkrd} d } nH| |jkrz||||Wntk rYnXtd|||dSt| ||| ||||||| | | |||S)NrrrrrrFrrrUrWTrrr rrz\s+z2Expiring cookie, domain='%s', path='%s', name='%s')rr:rArLrrrrboolrvrrrwr^r*clearKeyErrorrr)rtuprr{r|rZrrrrrrrrrrrrrrrrrrrr_cookie_from_cookie_tuples                      z#CookieJar._cookie_from_cookie_tuplecCs6||}g}|D]}|||}|r||q|Sr)r[r`ru)rrVrrWrDr_rrrr_cookies_from_attrs_set's   z!CookieJar._cookies_from_attrs_setcCsHt|jdd}|dkr |jj }|D]}|jdkr$d|_|r$d|_q$dS)NrrTr )rr<rrr)rrDZ rfc2109_as_nsrrrr_process_rfc2109_cookies0s  z"CookieJar._process_rfc2109_cookiesc Cs:|}|dg}|dg}tt|j_|_|jj}|jj}|sN|rf|sV|rf|s^|rf|sj|sjgSz|t ||}Wnt k rt g}YnX|r6|r6z|t ||} Wnt k rt g} YnX| | |r&i} |D]} d| | j| j| jf<q| fdd} t| | } | r6|| |S)zAReturn sequence of Cookie objects extracted from response object.z Set-Cookie2z Set-CookieNcSs|j|j|jf}||kSr)rrr{)Z ns_cookielookuprrrrno_matching_rfc2965isz3CookieJar.make_cookies..no_matching_rfc2965)rZget_allrArMr<r*rrrar} Exceptionrrrbrrr{filterrF) rresponserrZ rfc2965_hdrsZns_hdrsrrrDZ ns_cookiesrcrrdrrr make_cookies<s^         zCookieJar.make_cookiescCsN|jz2tt|j_|_|j||r:||W5|jXdS)z-Set a cookie if policy says it's OK to do so.N) r?rRrSrArMr<r*r set_cookierrrrset_cookie_if_okss  zCookieJar.set_cookie_if_okcCsl|j}|jzJ|j|kr&i||j<||j}|j|krDi||j<||j}|||j<W5|jXdS)z?Set a cookie, without checking whether or not it should be set.N)r@r?rRrSrrr{)rrcZc2Zc3rrrris     zCookieJar.set_cookiecCsbtd||jz8|||D]&}|j||r&td|||q&W5|jXdS)zAExtract cookies from response, where allowable given the request.zextract_cookies: %sz setting cookie: %sN) rrr?rRrSrhr<rri)rrgrrrrrextract_cookiess  zCookieJar.extract_cookiescCst|dk r2|dks|dkr td|j|||=n>|dk rX|dkrJtd|j||=n|dk rj|j|=ni|_dS)aClear some cookies. Invoking this method without arguments will clear all cookies. If given a single argument, only cookies belonging to that domain will be removed. If given two arguments, cookies belonging to the specified path within that domain are removed. If given three arguments, then the cookie with the specified name, path and domain is removed. Raises KeyError if no matching cookie exists. Nz8domain and path must be given to remove a cookie by namez.domain must be given to remove cookies by path)rLr@)rrrr{rrrr]s  zCookieJar.clearcCsD|jz(|D]}|jr||j|j|jqW5|jXdS)zDiscard all session cookies. Note that the .save() method won't save session cookies anyway, unless you ask otherwise by passing a true ignore_discard argument. N)r?rRrSrr]rrr{)rrrrrclear_session_cookiess  zCookieJar.clear_session_cookiescCsP|jz4t}|D]"}||r||j|j|jqW5|jXdS)aDiscard all expired cookies. You probably don't need to call this method: expired cookies are never sent back to the server (provided you're using DefaultCookiePolicy), this method is called by CookieJar itself every so often, and the .save() method won't save expired cookies anyway (unless you ask otherwise by passing a true ignore_expires argument). N) r?rRrSrMrr]rrr{)rrrrrrrTs  zCookieJar.clear_expired_cookiescCs t|jSr)r6r@rrrr__iter__szCookieJar.__iter__cCsd}|D] }|d}q|S)z#Return number of contained cookies.r rr)rrrrrr__len__s zCookieJar.__len__cCs2g}|D]}|t|qd|jjd|fSNz<%s[%s]>r)rurrrrrrrrrrrszCookieJar.__repr__cCs2g}|D]}|t|qd|jjd|fSrp)rurnrrrrqrrrrszCookieJar.__str__)N)NNN)"rrrrrwcompilerMrNZstrict_domain_reZ domain_reZdots_reASCIImagic_rerrCrErGrPrQr[r`rarbrhrjrirlr]rmrTrnrorrrrrrrs8      ;!a\  7   c@s eZdZdS)rNr;rrrrrsc@s8eZdZdZd ddZd ddZddd Zdd d ZdS)rz6CookieJar that can be loaded from and saved to a file.NFcCs2t|||dk rt|}||_t||_dS)z} Cookies are NOT loaded from the named file until either the .load() or .revert() method is called. N)rrosfspathfilenamer\ delayload)rrxryrBrrrrs   zFileCookieJar.__init__cCs tdS)zSave cookies to a file.Nr)rrxignore_discardignore_expiresrrrsaveszFileCookieJar.savec CsJ|dkr"|jdk r|j}nttt|}|||||W5QRXdS)zLoad cookies from a file.N)rxrLMISSING_FILENAME_TEXTopen _really_loadrrxrzr{rrrrloads   zFileCookieJar.loadcCs|dkr"|jdk r|j}ntt|jzFt|j}i|_z| |||Wnt k rn||_YnXW5|jXdS)zClear all cookies and reload cookies from a saved file. Raises LoadError (or OSError) if reversion is not successful; the object's state will not be altered if this happens. N) rxrLr}r?rRrSrZdeepcopyr@rOSError)rrxrzr{Z old_staterrrrevert s    zFileCookieJar.revert)NFN)NFF)NFF)NFF)rrrrrr|rrrrrrrs  cCs |j|jfd|jfd|jfg}|jdk r8|d|jf|jrH|d|jrX|d|jrh|d|j rx|d|j r|d t t |j f|j r|d |jr|d |jf|jr|d |jft|j}|D]}||t|j|fq|d t|jft|gS)zReturn string representation of Cookie in the LWP cookie file format. Actually, the format is extended a bit -- see module docstring. rrNr) path_specN) port_specN) domain_dotN)rNr)rNrrUr)r{r|rrrrurrrrrr5r[rrrr0rr1rnrr)rrr1rrrrlwp_cookie_str$s:        rc@s,eZdZdZd ddZd ddZd d ZdS) ra[ The LWPCookieJar saves a sequence of "Set-Cookie3" lines. "Set-Cookie3" is the format used by the libwww-perl library, not known to be compatible with any browser, but which is easy to read and doesn't lose information about RFC 2965 cookies. Additional methods as_lwp_str(ignore_discard=True, ignore_expired=True) TcCsTt}g}|D]2}|s |jr q|s0||r0q|dt|qd|dgS)zReturn cookies as a string of "\n"-separated "Set-Cookie3" headers. ignore_discard and ignore_expires: see docstring for FileCookieJar.save zSet-Cookie3: %s rW)rMrrrurr)rrzr{rrrrrrr as_lwp_strMs zLWPCookieJar.as_lwp_strNFc CsX|dkr"|jdk r|j}nttt|d"}|d||||W5QRXdS)Nwz#LWP-Cookies-2.0 )rxrLr}r~writerrrrrr|]s   zLWPCookieJar.savecCs0|}|j|s$d|}t|t}d}d} d} z|} | dkrPq| |s\q<| t|d} t| gD]f} | d\} }i}i}| D] }d||<q| ddD]n\}}|dk r| }nd}|| ks|| kr|}|| kr|dkrd }|||<q|| kr|||<q|||<q|j }|d }|d }|dk rJt |}|dkrXd }|d }|d }t |d| ||d|d|||d|d|d|d|||d|d|}|s|j rqz|s||rqz||qzqrsrtr?rFrTrYIr]Xr_rbrcrerkrprqrsrrr}rrrrrrrrrrrrrrrrrrrrrrrr3r6r:rrrrrrrrrrrs     8  8 !    U D'    #b!b7xPKΠ]|__init__.cpython-38.opt-1.pycnu[U L_?@sddlmZmZdZdS))where old_wherez 2018.04.16N)Zcorerr __version__rrA/opt/alt/python38/lib/python3.8/site-packages/certifi/__init__.pysPKΠ]ߺv;v;cookies.cpython-38.opt-1.pycnu[U e5dO @stdZddlZddlZdddgZdjZdjZdjZGd ddeZ ej ej d Z e d Z d d eedeeee DZeeddeddiedee jZddZedZedZddZddddddd gZdd!d"d#d$d%d&d'd(d)d*d+d,g Zdeefd-d.ZGd/d0d0eZ d1Z!e!d2Z"ed3e!d4e"d5ej#ej$BZ%Gd6ddeZ&Gd7dde&Z'dS)8a. Here's a sample session to show how to use this module. At the moment, this is the only documentation. The Basics ---------- Importing is easy... >>> from http import cookies Most of the time you start by creating a cookie. >>> C = cookies.SimpleCookie() Once you've created your Cookie, you can add values just as if it were a dictionary. >>> C = cookies.SimpleCookie() >>> C["fig"] = "newton" >>> C["sugar"] = "wafer" >>> C.output() 'Set-Cookie: fig=newton\r\nSet-Cookie: sugar=wafer' Notice that the printable representation of a Cookie is the appropriate format for a Set-Cookie: header. This is the default behavior. You can change the header and printed attributes by using the .output() function >>> C = cookies.SimpleCookie() >>> C["rocky"] = "road" >>> C["rocky"]["path"] = "/cookie" >>> print(C.output(header="Cookie:")) Cookie: rocky=road; Path=/cookie >>> print(C.output(attrs=[], header="Cookie:")) Cookie: rocky=road The load() method of a Cookie extracts cookies from a string. In a CGI script, you would use this method to extract the cookies from the HTTP_COOKIE environment variable. >>> C = cookies.SimpleCookie() >>> C.load("chips=ahoy; vienna=finger") >>> C.output() 'Set-Cookie: chips=ahoy\r\nSet-Cookie: vienna=finger' The load() method is darn-tootin smart about identifying cookies within a string. Escaped quotation marks, nested semicolons, and other such trickeries do not confuse it. >>> C = cookies.SimpleCookie() >>> C.load('keebler="E=everybody; L=\\"Loves\\"; fudge=\\012;";') >>> print(C) Set-Cookie: keebler="E=everybody; L=\"Loves\"; fudge=\012;" Each element of the Cookie also supports all of the RFC 2109 Cookie attributes. Here's an example which sets the Path attribute. >>> C = cookies.SimpleCookie() >>> C["oreo"] = "doublestuff" >>> C["oreo"]["path"] = "/" >>> print(C) Set-Cookie: oreo=doublestuff; Path=/ Each dictionary element has a 'value' attribute, which gives you back the value associated with the key. >>> C = cookies.SimpleCookie() >>> C["twix"] = "none for you" >>> C["twix"].value 'none for you' The SimpleCookie expects that all values should be standard strings. Just to be sure, SimpleCookie invokes the str() builtin to convert the value to a string, when the values are set dictionary-style. >>> C = cookies.SimpleCookie() >>> C["number"] = 7 >>> C["string"] = "seven" >>> C["number"].value '7' >>> C["string"].value 'seven' >>> C.output() 'Set-Cookie: number=7\r\nSet-Cookie: string=seven' Finis. N CookieError BaseCookie SimpleCookiez;  c@s eZdZdS)rN)__name__ __module__ __qualname__r r $/usr/lib64/python3.8/http/cookies.pyrsz!#$%&'*+-.^_`|~:z ()/<=>?@[]{}cCsi|]}|d|qS)z\%03or ).0nr r r sr"\"\z\\z[%s]+cCs*|dkst|r|Sd|tdSdS)zQuote a string for use in a cookie header. If the string does not need to be double-quoted, then just return the string. Otherwise, surround the string in doublequotes and quote (with a \) special characters. Nr) _is_legal_key translate _Translatorstrr r r _quotesrz\\[0-3][0-7][0-7]z[\\].cCsN|dkst|dkr|S|ddks0|ddkr4|S|dd}d}t|}g}d|krf|krFnnt||}t||}|s|s|||dqFd}}|r|d}|r|d}|r|r||kr|||||||d|d}qP|||||tt||d|dd|d}qPt|S)Nrr) len _OctalPattsearch _QuotePattappendstartchrint _nulljoin)rir resZo_matchZq_matchjkr r r _unquotes6      $ r+ZMonZTueZWedZThuZFriZSatZSunZJanZFebZMarZAprZMayZJunZJulZAugZSepZOctZNovZDecc CsRddlm}m}|}|||\ }}}} } } } } }d|| ||||| | | fS)Nr)gmtimetimez#%s, %02d %3s %4d %02d:%02d:%02d GMT)r-r,)ZfutureZ weekdaynameZ monthnamer,r-ZnowZyearZmonthZdayZhhZmmZssZwdyzr r r _getdates r0c @seZdZdZdddddddd d d Zd d hZddZeddZeddZ eddZ ddZ d2ddZ ddZ ejZddZdd Zd!d"Zd#d$Zd%d&Zd'd(Zd3d*d+ZeZd,d-Zd4d.d/Zd5d0d1ZdS)6MorselaCA class to hold ONE (key, value) pair. In a cookie, each such pair may have several attributes, so this class is used to keep the attributes associated with the appropriate key,value pair. This class also includes a coded_value attribute, which is used to hold the network representation of the value. expiresPathCommentZDomainzMax-AgeZSecureZHttpOnlyZVersionZSameSite) r2pathcommentZdomainmax-agesecurehttponlyversionZsamesiter8r9cCs0d|_|_|_|jD]}t||dqdS)Nr)_key_value _coded_value _reserveddict __setitem__)selfkeyr r r __init__ s zMorsel.__init__cCs|jSN)r;rAr r r rB(sz Morsel.keycCs|jSrD)r<rEr r r value,sz Morsel.valuecCs|jSrD)r=rEr r r coded_value0szMorsel.coded_valuecCs2|}||jkr td|ft|||dSNzInvalid attribute %r)lowerr>rr?r@)rAKVr r r r@4s zMorsel.__setitem__NcCs.|}||jkr td|ft|||SrH)rIr>rr? setdefault)rArBvalr r r rL:s zMorsel.setdefaultcCs>t|tstSt||o<|j|jko<|j|jko<|j|jkSrD) isinstancer1NotImplementedr?__eq__r<r;r=rAZmorselr r r rP@s     z Morsel.__eq__cCs$t}t|||j|j|SrD)r1r?update__dict__rQr r r copyJs z Morsel.copycCsRi}t|D]0\}}|}||jkr8td|f|||<qt||dSrH)r?itemsrIr>rrR)rAvaluesdatarBrMr r r rRPs  z Morsel.updatecCs||jkSrD)rIr>)rArJr r r isReservedKeyYszMorsel.isReservedKeycCsH||jkrtd|ft|s2td|f||_||_||_dS)Nz Attempt to set a reserved key %rzIllegal key %r)rIr>rrr;r<r=)rArBrMZ coded_valr r r set\sz Morsel.setcCs|j|j|jdS)N)rBrFrGr;r<r=rEr r r __getstate__gszMorsel.__getstate__cCs"|d|_|d|_|d|_dS)NrBrFrGrZ)rAstater r r __setstate__ns  zMorsel.__setstate__ Set-Cookie:cCsd|||fS)Nz%s %s) OutputString)rAattrsheaderr r r outputssz Morsel.outputcCsd|jj|fS)N<%s: %s>) __class__rr_rEr r r __repr__xszMorsel.__repr__cCsd||ddS)Nz rr)r_replace)rAr`r r r js_output{szMorsel.js_outputcCs$g}|j}|d|j|jf|dkr,|j}t|}|D]\}}|dkrNq<||krXq<|dkrt|tr|d|j|t|fq<|dkrt|tr|d|j||fq<|dkrt|t r|d|j|t |fq<||j kr|r|t |j|q<|d|j||fqsortedrUrNr%r0rr_flags_semispacejoin)rAr`resultr"rUrBrFr r r r_s,   zMorsel.OutputString)N)Nr^)N)N)rrr __doc__r>rjrCpropertyrBrFrGr@rLrPobject__ne__rTrRrXrYr[r]rb__str__rergr_r r r r r1sD         r1z,\w\d!#%&'~_`><@,:/\$\*\+\-\.\^\|\)\(\?\}\{\=z\[\]z \s* # Optional whitespace at start of cookie (?P # Start of group 'key' [a ]+? # Any word of at least one letter ) # End of group 'key' ( # Optional group: there may not be a value. \s*=\s* # Equal Sign (?P # Start of group 'val' "(?:[^\\"]|\\.)*" # Any doublequoted string | # or \w{3},\s[\w\d\s-]{9,11}\s[\d:]{8}\sGMT # Special case for "expires" attr | # or [a-]* # Any word or empty string ) # End of group 'val' )? # End of optional value group \s* # Any number of spaces. (\s+|;|$) # Ending either at space, semicolon, or EOS. c@sneZdZdZddZddZdddZd d Zd d ZdddZ e Z ddZ dddZ ddZ efddZdS)rz'A container class for a set of Morsels.cCs||fS)a real_value, coded_value = value_decode(STRING) Called prior to setting a cookie's value from the network representation. The VALUE is the value read from HTTP header. Override this function to modify the behavior of cookies. r rArMr r r value_decodeszBaseCookie.value_decodecCst|}||fS)zreal_value, coded_value = value_encode(VALUE) Called prior to setting a cookie's value from the dictionary representation. The VALUE is the value being assigned. Override this function to modify the behavior of cookies. rrArMZstrvalr r r value_encodeszBaseCookie.value_encodeNcCs|r||dSrD)load)rAinputr r r rCszBaseCookie.__init__cCs.||t}||||t|||dS)z+Private method for setting a cookie's valueN)getr1rYr?r@)rArBZ real_valuerGMr r r Z__setszBaseCookie.__setcCs:t|trt|||n||\}}||||dS)zDictionary style assignment.N)rNr1r?r@ru_BaseCookie__set)rArBrFrvalcvalr r r r@s zBaseCookie.__setitem__r^ cCs:g}t|}|D]\}}||||q||S)z"Return a string suitable for HTTP.)rirUr"rbjoin)rAr`raseprlrUrBrFr r r rbs   zBaseCookie.outputcCsJg}t|}|D] \}}|d|t|jfqd|jjt|fS)Nrhrc)rirUr"reprrFrdr _spacejoin)rAlrUrBrFr r r res   zBaseCookie.__repr__cCs6g}t|}|D]\}}|||qt|S)z(Return a string suitable for JavaScript.)rirUr"rgr&)rAr`rlrUrBrFr r r rgs   zBaseCookie.js_outputcCs4t|tr||n|D]\}}|||<qdS)zLoad cookies from a string (presumably HTTP_COOKIE) or from a dictionary. Loading cookies from a dictionary 'd' is equivalent to calling: map(Cookie.__setitem__, d.keys(), d.values()) N)rNr_BaseCookie__parse_stringrU)rAZrawdatarBrFr r r rv s    zBaseCookie.loadcCshd}t|}g}d}d}d}d|kr2|krnn|||} | sJq| d| d} } | d}| ddkr|s|q||| dd| fq| tjkr|sdS| dkr| tjkr||| dfqdSn||| t | fq| dk r||| | | fd}qdSqd} |D]>\} } } | |krB| | | <n| \}}| | |||| } q$dS) NrFrrrBrM$T) rmatchgroupendr"rIr1r>rjr+rsrz)rArZpattr'r Z parsed_itemsZ morsel_seenZTYPE_ATTRIBUTEZ TYPE_KEYVALUErrBrFrytpr{r|r r r Z__parse_stringsF      zBaseCookie.__parse_string)N)Nr^r})N)rrr rmrsrurCrzr@rbrqrergrv_CookiePatternrr r r r rs    c@s eZdZdZddZddZdS)rz SimpleCookie supports strings as cookie values. When setting the value using the dictionary assignment notation, SimpleCookie calls the builtin str() to convert the value to a string. Values received from HTTP are kept as strings. cCs t||fSrD)r+rrr r r rs\szSimpleCookie.value_decodecCst|}|t|fSrD)rrrtr r r ru_szSimpleCookie.value_encodeN)rrr rmrsrur r r r rUs)(rmrestring__all__r~r&rkr ExceptionrZ ascii_lettersZdigitsZ _LegalCharsZ_UnescapedCharsrYrangemapordrrRcompileescape fullmatchrrrr!r+Z _weekdaynameZ _monthnamer0r?r1Z_LegalKeyCharsZ_LegalValueCharsASCIIVERBOSErrrr r r r 'sr]   24    PKΠ]M31cookiejar.cpython-38.opt-1.pycnu[U e5d#, @s dZddddddddgZd d lZd d lZd d lZd d lZd d lZd d lZd d l Zd d l Z d d l Z d d lmZd Zd ad dZee jjZdZddZdZddZdddddddgZddddd d!d"d#d$d%d&d'g ZgZeD]Zee qdud(d)Z!dvd*d+Z"d d d d d,Z#e$d-ej%Z&d.d/Z'd0d1Z(e$d2ej%Z)e$d3ej*ej%BZ+e$d4ej,ej%BZ-d5d6Z.e$d7ej,ej%BZ/d8d9Z0d:d;Z1e$d<Z2e$d=Z3e$d>Z4e$d?Z5d@dAZ6e$dBZ7dCdDZ8dEdFZ9dGdHZ:e$dIej%Z;dJdKZdPdQZ?e$dRej%Z@dSdTZAdUdVZBdWdXZCdYdZZDd[ZEe$d\ZFd]d^ZGd_d`ZHdadbZIdcddZJGdeddZKGdfddZLGdgddeLZMdhdiZNdjdkZOGdldmdmZPGdnddZQGdoddeRZSGdpddeQZTdqdrZUGdsddeTZVGdtddeTZWd S)waHTTP cookie handling for web clients. This module has (now fairly distant) origins in Gisle Aas' Perl module HTTP::Cookies, from the libwww-perl library. Docstrings, comments and debug strings in this code refer to the attributes of the HTTP cookie system as cookie-attributes, to distinguish them clearly from Python attributes. Class diagram (note that BSDDBCookieJar and the MSIE* classes are not distributed with the Python standard library, but are available from http://wwwsearch.sf.net/): CookieJar____ / \ \ FileCookieJar \ \ / | \ \ \ MozillaCookieJar | LWPCookieJar \ \ | | \ | ---MSIEBase | \ | / | | \ | / MSIEDBCookieJar BSDDBCookieJar |/ MSIECookieJar Cookie CookieJar CookiePolicyDefaultCookiePolicy FileCookieJar LWPCookieJar LoadErrorMozillaCookieJarN)timegmFcGs(tsdStsddl}|datj|S)Nr zhttp.cookiejar)debugloggerloggingZ getLogger)argsr r&/usr/lib64/python3.8/http/cookiejar.py_debug,s  rzQa filename was not supplied (nor was the CookieJar instance initialised with one)cCsJddl}ddl}ddl}|}|d||}|jd|dddS)Nr zhttp.cookiejar bug! %s) stacklevel)iowarnings tracebackStringIO print_excgetvaluewarn)rrrfmsgrrr_warn_unhandled_exception:s  ricCs|dd\}}}}}}|tkrd|kr4dkrnnhd|krLdkrnnPd|krddkrnn8d|kr|dkrnn d|krdkrnnt|SdSdS) N r ;=) EPOCH_YEARr )ttyearmonthZmdayhourminsecrrr_timegmIs&8   r,ZMonZTueZWedZThuZFriZSatZSunZJanZFebZMarZAprZMayZJunZJulZAugZSepZOctZNovZDeccCs@|dkrtj}n tj|}d|j|j|j|j|j|jfS)aHReturn a string representing time in seconds since epoch, t. If the function is called without an argument, it will use the current time. The format of the returned string is like "YYYY-MM-DD hh:mm:ssZ", representing Universal Time (UTC, aka GMT). An example of this format is: 1994-11-24 08:49:37Z Nz%04d-%02d-%02d %02d:%02d:%02dZ) datetimeutcnowutcfromtimestampr'r(dayr)minutesecondtZdtrrr time2isozWs   r5cCsR|dkrtj}n tj|}dt||jt|jd|j|j |j |j fS)zReturn a string representing time in seconds since epoch, t. If the function is called without an argument, it will use the current time. The format of the returned string is like this: Wed, DD-Mon-YYYY HH:MM:SS GMT Nz#%s, %02d-%s-%04d %02d:%02d:%02d GMTr) r-r.r/DAYSZweekdayr0MONTHSr(r'r)r1r2r3rrr time2netscapejs     r8)ZGMTUTCZUTZz^([-+])?(\d\d?):?(\d\d)?$cCsjd}|tkrd}nTt|}|rfdt|d}|drR|dt|d}|ddkrf| }|S)Nr ir<r-) UTC_ZONES TIMEZONE_REsearchintgroup)tzoffsetmrrroffset_from_tz_strings  rFc Cst|}|tjkrdSzt|d}Wn^tk rz t|}Wntk r`YYdSXd|krvdkrnn|}nYdSYnX|dkrd}|dkrd}|dkrd}t|}t|}t|}t|}|dkr6ttd}|d} |} ||| }| | } t | dkr6| dkr.|d}n|d}t |||||||f} | dk r|dkrdd}| }t |} | dkrdS| | } | S)Nrr r id2r9) rAr-ZMAXYEAR MONTHS_LOWERindexlower ValueErrortime localtimeabsr,upperrF) r0monyrhrr*r+rCZimonZcur_yrrEZtmpr4rDrrr _str2timesV          rTzV^[SMTWF][a-z][a-z], (\d\d) ([JFMASOND][a-z][a-z]) (\d\d\d\d) (\d\d):(\d\d):(\d\d) GMT$z+^(?:Sun|Mon|Tue|Wed|Thu|Fri|Sat)[a-z]*,?\s*a^ (\d\d?) # day (?:\s+|[-\/]) (\w+) # month (?:\s+|[-\/]) (\d+) # year (?: (?:\s+|:) # separator before clock (\d\d?):(\d\d) # hour:min (?::(\d\d))? # optional seconds )? # optional clock \s* (?: ([-+]?\d{2,4}|(?![APap][Mm]\b)[A-Za-z]+) # timezone \s* )? (?: \(\w+\) # ASCII representation of timezone in parens. \s* )?$c Cst|}|rl|}t|dd}t|d|t|dt|dt|dt|df}t|S| }t d|d}dgd \}}}}}} } t |}|dk r|\}}}}}} } ndSt |||||| | S) aReturns time in seconds since epoch of time represented by a string. Return value is an integer. None is returned if the format of str is unrecognized, the time is outside the representable range, or the timezone string is not recognized. If the string contains no timezone, UTC is assumed. The timezone in the string may be numerical (like "-0800" or "+0100") or a string timezone (like "UTC", "GMT", "BST" or "EST"). Currently, only the timezone strings equivalent to UTC (zero offset) are known to the function. The function loosely parses the following formats: Wed, 09 Feb 1994 22:23:32 GMT -- HTTP format Tuesday, 08-Feb-94 14:15:29 GMT -- old rfc850 HTTP format Tuesday, 08-Feb-1994 14:15:29 GMT -- broken rfc850 HTTP format 09 Feb 1994 22:23:32 GMT -- HTTP format (no weekday) 08-Feb-94 14:15:29 GMT -- rfc850 format (no weekday) 08-Feb-1994 14:15:29 GMT -- broken rfc850 format (no weekday) The parser ignores leading and trailing whitespace. The time may be absent. If the year is given with only 2 digits, the function will select the century that makes the year closest to the current date. rrr r;N)STRICT_DATE_REr@groupsrIrJrKrAfloatr,lstrip WEEKDAY_REsubLOOSE_HTTP_DATE_RErT) textrEgrQr&r0rRrSr*r+rCrrr http2times$   rba^ (\d{4}) # year [-\/]? (\d\d?) # numerical month [-\/]? (\d\d?) # day (?: (?:\s+|[-:Tt]) # separator before clock (\d\d?):?(\d\d) # hour:min (?::?(\d\d(?:\.\d*)?))? # optional seconds (and fractional) )? # optional clock \s* (?: ([-+]?\d\d?:?(:?\d\d)? |Z|z) # timezone (Z is "zero meridian", i.e. GMT) \s* )?$c Csd|}dgd\}}}}}}}t|}|dk rL|\}}}}}}}} ndSt|||||||S)av As for http2time, but parses the ISO 8601 formats: 1994-02-03 14:15:29 -0100 -- ISO 8601 format 1994-02-03 14:15:29 -- zone is optional 1994-02-03 -- only date 1994-02-03T14:15:29 -- Use T as separator 19940203T141529Z -- ISO 8601 compact format 19940203 -- only date NrX)r\ ISO_DATE_REr@rZrT) r`r0rQrRrSr*r+rCrE_rrriso2time+s  recCs*|d\}}|jd||j|dS)z)Return unmatched part of re.Match object.r N)spanstring)matchstartendrrr unmatchedLsrkz^\s*([^=\s;,]+)z&^\s*=\s*\"([^\"\\]*(?:\\.[^\"\\]*)*)\"z^\s*=\s*([^\s;,]*)z\\(.)c Csg}|D]}|}g}|rt|}|rt|}|d}t|}|rft|}|d}td|}n.t|}|rt|}|d}|}nd}| ||fq| dr| dd}|r| |g}qt dd|\}} |}q|r| |q|S)amParse header values into a list of lists containing key,value pairs. The function knows how to deal with ",", ";" and "=" as well as quoted values after "=". A list of space separated tokens are parsed as if they were separated by ";". If the header_values passed as argument contains multiple values, then they are treated as if they were a single value separated by comma ",". This means that this function is useful for parsing header fields that follow this syntax (BNF as from the HTTP/1.1 specification, but we relax the requirement for tokens). headers = #header header = (token | parameter) *( [";"] (token | parameter)) token = 1* separators = "(" | ")" | "<" | ">" | "@" | "," | ";" | ":" | "\" | <"> | "/" | "[" | "]" | "?" | "=" | "{" | "}" | SP | HT quoted-string = ( <"> *(qdtext | quoted-pair ) <"> ) qdtext = > quoted-pair = "\" CHAR parameter = attribute "=" value attribute = token value = token | quoted-string Each header is represented by a list of key/value pairs. The value for a simple token (not part of a parameter) is None. Syntactically incorrect headers will not necessarily be parsed as you would want. This is easier to describe with some examples: >>> split_header_words(['foo="bar"; port="80,81"; discard, bar=baz']) [[('foo', 'bar'), ('port', '80,81'), ('discard', None)], [('bar', 'baz')]] >>> split_header_words(['text/html; charset="iso-8859-1"']) [[('text/html', None), ('charset', 'iso-8859-1')]] >>> split_header_words([r'Basic realm="\"foo\bar\""']) [[('Basic', None), ('realm', '"foobar"')]] rz\1N,z^[=\s;]*rW)HEADER_TOKEN_REr@rkrBHEADER_QUOTED_VALUE_REHEADER_ESCAPE_REr^HEADER_VALUE_RErstripappendr\ startswithresubn) Z header_valuesresultr`Z orig_textpairsrEnamevalueZnon_junkZ nr_junk_charsrrrsplit_header_wordsUs>.         rz([\"\\])cCs|g}|D]h}g}|D]F\}}|dk rPtd|sDtd|}d|}d||f}||q|r|d|qd|S)aDo the inverse (almost) of the conversion done by split_header_words. Takes a list of lists of (key, value) pairs and produces a single header value. Attribute values are quoted if needed. >>> join_header_words([[("text/plain", None), ("charset", "iso-8859-1")]]) 'text/plain; charset="iso-8859-1"' >>> join_header_words([[("text/plain", None)], [("charset", "iso-8859-1")]]) 'text/plain, charset="iso-8859-1"' Nz^\w+$\\\1z"%s"%s=%s; , )rtr@HEADER_JOIN_ESCAPE_REr^rrjoin)Zlistsheadersrwattrkvrrrjoin_header_wordss      rcCs0|dr|dd}|dr,|dd}|S)N"r)rsendswithr`rrr strip_quotess     rc Csd}g}|D]}g}d}t|dD]\}}|}|d\}} } |}|sb|dkr&qnq&| rn| nd} |dkr|} | |kr| }|dkr| dk rt| } d}n|d kr| dk rtt| } ||| fq&|r |s|d ||q |S) a5Ad-hoc parser for Netscape protocol cookie-attributes. The old Netscape cookie format for Set-Cookie can for instance contain an unquoted "," in the expires field, so we have to use this ad-hoc parser instead of split_header_words. XXX This may not make the best possible effort to parse all the crap that Netscape Cookie headers contain. Ronald Tschalar's HTTPClient parser is probably better, so could do worse than following that if this ever gives any trouble. Currently, this is also used for parsing RFC 2109 cookies. )expiresdomainpathsecureversionportmax-ageF;=r NrTr)r0) enumeratesplitstrip partitionrKrrbrr) Z ns_headersZ known_attrsrvZ ns_headerrw version_setZiiZparamkeysepvallcrrrparse_ns_headerss>   rz\.\d+$cCs:t|rdS|dkrdS|ddks2|ddkr6dSdS)z*Return True if text is a host domain name.FrWr .rTIPV4_REr@rrrris_HDNs rcCsl|}|}||krdSt|s(dS||}|dksB|dkrFdS|dsTdSt|ddshdSdS)aReturn True if domain A domain-matches domain B, according to RFC 2965. A and B may be host domain names or IP addresses. RFC 2965, section 1: Host names can be specified either as an IP address or a HDN string. Sometimes we compare one host name with another. (Such comparisons SHALL be case-insensitive.) Host A's name domain-matches host B's if * their host name strings string-compare equal; or * A is a HDN string and has the form NB, where N is a non-empty name string, B has the form .B', and B' is a HDN string. (So, x.y.com domain-matches .Y.com but not Y.com.) Note that domain-match is not a commutative operation: a.b.c.com domain-matches .c.com, but not the reverse. TFrr rrN)rKrrfindrs)ABirrr domain_matchs  rcCst|rdSdS)zdReturn True if text is a sort-of-like a host domain name. For accepting/blocking domains. FTrrrrrliberal_is_HDNFs rcCs`|}|}t|r t|s0||kr,dSdS|d}|rL||rLdS|s\||kr\dSdS)z\For blocking/accepting domains. A and B may be host domain names or IP addresses. TFr)rKrrsr)rr initial_dotrrruser_domain_matchPs  rz:\d+$cCsB|}tj|d}|dkr,|dd}td|d}|S)zReturn request-host, as defined by RFC 2965. Variation from RFC: returned value is lowercased, for convenient comparison. rrWZHost) get_full_urlurllibparseZurlparseZ get_header cut_port_rer^rK)requesturlhostrrr request_hostes  rcCs4t|}}|ddkr,t|s,|d}||fS)zzReturn a tuple (request-host, effective request-host name). As defined by RFC 2965, except both are lowercased. rr.local)rfindrr@)rerhnreq_hostrrreff_request_hostus rcCs4|}tj|}t|j}|ds0d|}|S)z6Path component of request-URI, as defined by RFC 2965./)rrrZurlsplit escape_pathrrs)rrpartsrrrr request_paths    rcCs`|j}|d}|dkrX||dd}z t|Wq\tk rTtd|YdSXnt}|S)N:r rznonnumeric port: '%s')rrrArLrDEFAULT_HTTP_PORT)rrrrrrr request_ports    rz%/;:@&=+$,!~*'()z%([0-9a-fA-F][0-9a-fA-F])cCsd|dS)Nz%%%sr)rBrP)rhrrruppercase_escaped_charsrcCstj|t}tt|}|S)zEEscape any invalid characters in HTTP URL, and uppercase all escapes.)rrZquoteHTTP_PATH_SAFEESCAPED_CHAR_REr^r)rrrrrs  rcCsP|d}|dkrL||dd}|d}t|rL|dksD|dkrLd|S|S)aBReturn reach of host h, as defined by RFC 2965, section 1. The reach R of a host name H is defined as follows: * If - H is the host domain name of a host; and, - H has the form A.B; and - A has no embedded (that is, interior) dots; and - B has at least one embedded dot, or B is the string "local". then the reach of H is .B. * Otherwise, the reach of H is H. >>> reach("www.acme.com") '.acme.com' >>> reach("acme.com") 'acme.com' >>> reach("acme.local") '.local' rr rNZlocal)rr)hrbrrrreachs  rcCs$t|}t|t|jsdSdSdS)z RFC 2965, section 3.3.6: An unverifiable transaction is to a third-party host if its request- host U does not domain-match the reach R of the request-host O in the origin transaction. TFN)rrrZorigin_req_host)rrrrris_third_partys rc@sNeZdZdZdddZddZddd Zd d Zdd d ZddZ ddZ dS)raHTTP Cookie. This class represents both Netscape and RFC 2965 cookies. This is deliberately a very simple class. It just holds attributes. It's possible to construct Cookie instances that don't comply with the cookie standards. CookieJar.make_cookies is the factory function for Cookie objects -- it deals with cookie parsing, supplying defaults, and normalising to the representation used in this class. CookiePolicy is responsible for checking them to see whether they should be accepted from and returned to the server. Note that the port may be present in the headers, but unspecified ("Port" rather than"Port=80", for example); if this is the case, port is None. FcCs|dk rt|}| dk r$tt| } |dkr<|dkr)rrrryrx)rplimitZ namevaluerrr__str__)s   zCookie.__str__cCslg}dD]$}t||}|d|t|fq|dt|j|dt|jd|jjd|fS)N)rrxryrrrrrrrrrrrrr}zrest=%sz rfc2109=%sz%s(%s)r)getattrrrreprrr __class____name__r)rrrxrrrr__repr__3s zCookie.__repr__)F)N)N) r __module__ __qualname____doc__rrrrrrrrrrrrs *   c@s0eZdZdZddZddZddZdd Zd S) ra Defines which cookies get accepted from and returned to server. May also modify cookies, though this is probably a bad idea. The subclass DefaultCookiePolicy defines the standard rules for Netscape and RFC 2965 cookies -- override that if you want a customized policy. cCs tdS)zReturn true if (and only if) cookie should be accepted from server. Currently, pre-expired cookies never get this far -- the CookieJar class deletes such cookies itself. NNotImplementedErrorrcookierrrrset_okKszCookiePolicy.set_okcCs tdS)zAReturn true if (and only if) cookie should be returned to server.Nrrrrr return_okTszCookiePolicy.return_okcCsdS)zMReturn false if cookies should not be returned, given cookie domain. Tr)rrrrrrdomain_return_okXszCookiePolicy.domain_return_okcCsdS)zKReturn false if cookies should not be returned, given cookie path. Tr)rrrrrrpath_return_ok]szCookiePolicy.path_return_okN)rrrrrrrrrrrrrBs  c @seZdZdZdZdZdZdZeeBZdddddddddeddd f d d Z d d Z ddZ ddZ ddZ ddZddZddZddZddZddZd d!Zd"d#Zd$d%Zd&d'Zd(d)Zd*d+Zd,d-Zd.d/Zd0d1Zd2d3Zd4d5Zd6d7ZdS)8rzBImplements the standard rules for accepting and returning cookies.rrrUr NTF)ZhttpsZwsscCsv||_||_||_||_||_||_| |_| |_| |_| |_ | |_ |dk rVt ||_ nd|_ |dk rlt |}||_ dS)zAConstructor arguments should be passed as keyword arguments only.Nr)netscaperfc2965rfc2109_as_netscape hide_cookie2 strict_domainstrict_rfc2965_unverifiablestrict_ns_unverifiablestrict_ns_domainstrict_ns_set_initial_dollarstrict_ns_set_pathsecure_protocolstuple_blocked_domains_allowed_domains)rblocked_domainsallowed_domainsrrrrrrrrrrrrrrrms" zDefaultCookiePolicy.__init__cCs|jS)z4Return the sequence of blocked domains (as a tuple).)rrrrrrsz#DefaultCookiePolicy.blocked_domainscCst||_dS)z$Set the sequence of blocked domains.N)rr)rrrrrset_blocked_domainssz'DefaultCookiePolicy.set_blocked_domainscCs |jD]}t||rdSqdSr)rr)rrZblocked_domainrrr is_blockeds  zDefaultCookiePolicy.is_blockedcCs|jS)z=Return None, or the sequence of allowed domains (as a tuple).)rrrrrrsz#DefaultCookiePolicy.allowed_domainscCs|dk rt|}||_dS)z-Set the sequence of allowed domains, or None.N)rr)rrrrrset_allowed_domainssz'DefaultCookiePolicy.set_allowed_domainscCs.|jdkrdS|jD]}t||rdSqdS)NFT)rr)rrZallowed_domainrrris_not_alloweds    z"DefaultCookiePolicy.is_not_allowedcCs@td|j|jdD]&}d|}t||}|||sdSqdS)z If you override .set_ok(), be sure to call this method. If it returns false, so should your subclass (assuming your subclass wants to be more strict about which cookies to accept).  - checking cookie %s=%s)r verifiabilityrxrrrZset_ok_FTrrxryrrrrnZfn_namefnrrrrs  zDefaultCookiePolicy.set_okcCsZ|jdkrtd|j|jdS|jdkr:|js:tddS|jdkrV|jsVtddSdS)Nz0 Set-Cookie2 without version attribute (%s=%s)Fr $ RFC 2965 cookies are switched off$ Netscape cookies are switched offT)rrrxryrrrrrrset_ok_versions z"DefaultCookiePolicy.set_ok_versioncCsJ|jrFt|rF|jdkr*|jr*tddS|jdkrF|jrFtddSdSNr z> third-party RFC 2965 cookie during unverifiable transactionFz> third-party Netscape cookie during unverifiable transactionTZ unverifiablerrrrrrrrrset_ok_verifiabilitysz(DefaultCookiePolicy.set_ok_verifiabilitycCs0|jdkr,|jr,|jdr,td|jdSdS)Nr $z' illegal name (starts with '$'): '%s'FT)rrrxrsrrrrr set_ok_names   zDefaultCookiePolicy.set_ok_namecCsL|jrHt|}|jdks(|jdkrH|jrH||j|sHtd|j|dSdS)Nr z7 path attribute %s is not a prefix of request path %sFT)rrrrrrr)rrrreq_pathrrr set_ok_paths  zDefaultCookiePolicy.set_ok_pathc Cs||jrtd|jdS||jr8td|jdS|jrt|\}}|j}|jr|ddkr|d}|dd|}|dkr||dd}||d|} | dkrt |dkrtd |dS| dr|dd} n|} | ddk} | s|d krtd |dS|j dkrX||sX| dsXd||sXtd ||dS|j dksr|j|j@rt||std ||dS|j dks|j|j@r|dt | } | ddkrt|std| |dSdS)N" domain %s is in user block-listF& domain %s is not in user allow-listrrr r)coZacZcomZeduZorgZnetZgovZmilrAZaeroZbizcatZcoopinfoZjobsZmobiZmuseumrxZproZtravelZeuz& country-code second level domain %srz/ non-local domain %s contains no embedded dotzO effective request-host %s (even with added initial dot) does not end with %sz5 effective request-host %s does not domain-match %sz. host prefix %s for domain %s contains a dotT)rrrrrrrcountrrKlenrsrrrrDomainRFC2965MatchrDomainStrictNoDotsrr@) rrrrrrrjZtldZsldZundotted_domainZ embedded_dotsZ host_prefixrrr set_ok_domains|                  z!DefaultCookiePolicy.set_ok_domainc Cs|jrt|}|dkrd}nt|}|jdD]@}z t|Wn"tk rbtd|YdSX||kr0qq0td||jdSdS)N80rlz bad port %s (not numeric)Fz$ request port (%s) not found in %sT)rrstrrrrArLrrrrZreq_portrrrr set_ok_port+s&   zDefaultCookiePolicy.set_ok_portcCs@td|j|jdD]&}d|}t||}|||sdSqdS)z If you override .return_ok(), be sure to call this method. If it returns false, so should your subclass (assuming your subclass wants to be more strict about which cookies to return). r)rrrrrrZ return_ok_FTrr rrrr@s   zDefaultCookiePolicy.return_okcCs<|jdkr|jstddS|jdkr8|js8tddSdS)Nr r Fr T)rrrrrrrrreturn_ok_versionRsz%DefaultCookiePolicy.return_ok_versioncCsJ|jrFt|rF|jdkr*|jr*tddS|jdkrF|jrFtddSdSrrrrrrreturn_ok_verifiability[sz+DefaultCookiePolicy.return_ok_verifiabilitycCs"|jr|j|jkrtddSdS)Nz( secure cookie with non-secure requestFT)rtyperrrrrrreturn_ok_securegsz$DefaultCookiePolicy.return_ok_securecCs||jrtddSdS)Nz cookie expiredFT)r_nowrrrrrreturn_ok_expiresms z%DefaultCookiePolicy.return_ok_expirescCsN|jrJt|}|dkrd}|jdD]}||kr&qJq&td||jdSdS)Nr!rlz0 request port %s does not match cookie port %sFT)rrrrr#rrrreturn_ok_portssz"DefaultCookiePolicy.return_ok_portcCst|\}}|j}|r*|ds*d|}n|}|jdkr^|j|j@r^|js^||kr^tddS|jdkrt||std||dS|jdkrd| |std||dSdS)Nrr zQ cookie with unspecified domain does not string-compare equal to request domainFzQ effective request-host name %s does not domain-match RFC 2965 cookie domain %sz; request-host %s does not match Netscape cookie domain %sT) rrrsrrDomainStrictNonDomainrrrr)rrrrrr dotdomainrrrreturn_ok_domains6    z$DefaultCookiePolicy.return_ok_domaincCst|\}}|dsd|}|ds0d|}|rH|dsHd|}n|}||sd||sddS||r|td|dS||rtd|dSdS)NrFrrT)rrsrrrr)rrrrrr-rrrrs"        z$DefaultCookiePolicy.domain_return_okcCsbtd|t|}t|}||kr&dS||rR|dsN|||ddkrRdStd||dS)Nz- checking cookie path=%sTrrz %s does not path-match %sF)rrrrsr)rrrrZpathlenrrrrs   z"DefaultCookiePolicy.path_return_ok) rrrrrr,rZ DomainLiberalZ DomainStrictrrrrrrrrrrrrr r$rr%r&r(r*r+r.rrrrrrrcsT #   ;  cCst|}t|j|Sr)sortedkeysmapr)Zadictr0rrrvals_sorted_by_keys r2c csVt|}|D]D}d}z |jWntk r2YnXd}t|EdH|s |Vq dS)zBIterates over nested mapping, depth-first, in sorted order by key.FTN)r2itemsAttributeError deepvalues)mappingvaluesobjrrrr5s r5c@s eZdZdS)AbsentNrrrrrrrr9sr9c@seZdZdZedZedZedZedZ edZ edej Z d3d d Z d d Zd dZddZddZddZddZddZddZddZddZdd Zd!d"Zd#d$Zd4d%d&Zd'd(Zd)d*Zd+d,Zd-d.Zd/d0Z d1d2Z!dS)5rzCollection of HTTP cookies. You may not need to know about this class: try urllib.request.build_opener(HTTPCookieProcessor).open(url). z\Wr{z\.?[^.]*z[^.]*z^\.+z^\#LWP-Cookies-(\d+\.\d+)NcCs(|dkrt}||_t|_i|_dSr)r_policy _threadingRLock _cookies_lock_cookiesrpolicyrrrrs  zCookieJar.__init__cCs ||_dSr)r;r@rrr set_policyszCookieJar.set_policycCsg}|j||sgStd||j|}|D]T}|j||sFq2||}|D].}|j||srtdqVtd||qVq2|S)Nz!Checking %s for cookies to returnz not returning cookiez it's a match) r;rrr?r0rr7rrr)rrrcookiesZcookies_by_pathrZcookies_by_namerrrr_cookies_for_domains     zCookieJar._cookies_for_domaincCs*g}|jD]}||||q|S)z2Return a list of cookies to be returned to server.)r?r0extendrD)rrrCrrrr_cookies_for_requestszCookieJar._cookies_for_requestc Cs<|jddddd}g}|D]}|j}|sHd}|dkrH|d||jdk rz|j|jrz|dkrz|jd |j}n|j}|jdkr||jn|d |j|f|dkr|j r|d |j |j d r|j }|j s| d r|d d}|d||jdk rd}|jr,|d|j}||q|S)zReturn a list of cookie-attributes to be returned to server. like ['foo="bar"; $Path="/"', ...] The $Version attribute is also added when appropriate (currently only once per request). cSs t|jSr)rr)arrrz)CookieJar._cookie_attrs..T)rreverseFr z $Version=%sNr|r}z $Path="%s"rrz $Domain="%s"z$Portz="%s")sortrrrry non_word_rer@quote_rer^rxrrrrsrrr) rrCrattrsrrryrrrrr _cookie_attrssF        zCookieJar._cookie_attrscCstd|jztt|j_|_||}| |}|r^| ds^| dd ||jj r|jjs| ds|D]}|jdkr|| ddqq|W5|jX|dS)zAdd correct Cookie: header to request (urllib.request.Request object). The Cookie2 header is also added unless policy.hide_cookie2 is true. add_cookie_headerrr~ZCookie2rz $Version="1"N)rr>acquirereleaserArMr;r)rFrOZ has_headerZadd_unredirected_headerrrrrclear_expired_cookies)rrrCrNrrrrrPIs*        zCookieJar.add_cookie_headerc Csg}d}d}|D]z}|d\}}d}d} i} i} |ddD]0\} } | }||ks`||krd|} | |krx| dkrxd} | | krq>| dkr| dkrtd d} qr| } | d kr|rq>| dkrtd q>| d kr d}z t| } Wn*tk rtd d} YqrYnXd } |j| } | |ks4| |krh| dkr^| dkr^td| d} qr| | | <q>| | | <q>| rzq|||| | fq|S)aReturn list of tuples containing normalised cookie information. attrs_set is the list of lists of key,value pairs extracted from the Set-Cookie or Set-Cookie2 headers. Tuples are name, value, standard, rest, where name and value are the cookie name and value, standard is a dictionary containing the standard cookie-attributes (discard, secure, version, expires or max-age, domain, path and port) and rest is a dictionary containing the rest of the cookie-attributes. )rr)rrrrrrr commenturlr FrNTrz% missing value for domain attributerzM missing or invalid value for expires attribute: treating as session cookierz? missing or invalid (non-numeric) value for max-age attribute)rrrTz! missing value for %s attribute)rKrrArLr)rr)r attrs_set cookie_tuples boolean_attrs value_attrsZ cookie_attrsrxryZ max_age_setZ bad_cookiestandardrrrrrrr_normalized_cookie_tuplesjsh          z#CookieJar._normalized_cookie_tuplescCs&|\}}}}|dt}|dt}|dt} |dt} |dd} | dk rtz t| } Wntk rrYdSX|dd} |dd} |d d}|d d}|tk r|d krd }t|}nXd}t|}|d }|dkr| dkr|d|}n|d|d}t|dkrd }|tk }d}|r:t| d}|tkrVt |\}}|}n| dsjd|}d}| tk r| dkrt |} nd }t dd | } nd} | tkrd} d } nH| |jkrz||||Wntk rYnXtd|||dSt| ||| ||||||| | | |||S)NrrrrrrFrrrTrWTrrr rrz\s+z2Expiring cookie, domain='%s', path='%s', name='%s')rr9rArLrrrrboolrsrrrtr^r)clearKeyErrorrr)rtuprrxryrYrrrrrrrrrrrrrrrrrrrr_cookie_from_cookie_tuples                      z#CookieJar._cookie_from_cookie_tuplecCs6||}g}|D]}|||}|r||q|Sr)rZr_rr)rrUrrVrCr^rrrr_cookies_from_attrs_set's   z!CookieJar._cookies_from_attrs_setcCsHt|jdd}|dkr |jj }|D]}|jdkr$d|_|r$d|_q$dS)NrrTr )rr;rrr)rrCZ rfc2109_as_nsrrrr_process_rfc2109_cookies0s  z"CookieJar._process_rfc2109_cookiesc Cs:|}|dg}|dg}tt|j_|_|jj}|jj}|sN|rf|sV|rf|s^|rf|sj|sjgSz|t ||}Wnt k rt g}YnX|r6|r6z|t ||} Wnt k rt g} YnX| | |r&i} |D]} d| | j| j| jf<q| fdd} t| | } | r6|| |S)zAReturn sequence of Cookie objects extracted from response object.z Set-Cookie2z Set-CookieNcSs|j|j|jf}||kSr)rrrx)Z ns_cookielookuprrrrno_matching_rfc2965isz3CookieJar.make_cookies..no_matching_rfc2965)rZget_allrArMr;r)rrr`rz ExceptionrrrarrrxfilterrE) rresponserrZ rfc2965_hdrsZns_hdrsrrrCZ ns_cookiesrbrrcrrr make_cookies<s^         zCookieJar.make_cookiescCsN|jz2tt|j_|_|j||r:||W5|jXdS)z-Set a cookie if policy says it's OK to do so.N) r>rQrRrArMr;r)r set_cookierrrrset_cookie_if_okss  zCookieJar.set_cookie_if_okcCsl|j}|jzJ|j|kr&i||j<||j}|j|krDi||j<||j}|||j<W5|jXdS)z?Set a cookie, without checking whether or not it should be set.N)r?r>rQrRrrrx)rrcZc2Zc3rrrrhs     zCookieJar.set_cookiecCsbtd||jz8|||D]&}|j||r&td|||q&W5|jXdS)zAExtract cookies from response, where allowable given the request.zextract_cookies: %sz setting cookie: %sN) rrr>rQrRrgr;rrh)rrfrrrrrextract_cookiess  zCookieJar.extract_cookiescCst|dk r2|dks|dkr td|j|||=n>|dk rX|dkrJtd|j||=n|dk rj|j|=ni|_dS)aClear some cookies. Invoking this method without arguments will clear all cookies. If given a single argument, only cookies belonging to that domain will be removed. If given two arguments, cookies belonging to the specified path within that domain are removed. If given three arguments, then the cookie with the specified name, path and domain is removed. Raises KeyError if no matching cookie exists. Nz8domain and path must be given to remove a cookie by namez.domain must be given to remove cookies by path)rLr?)rrrrxrrrr\s  zCookieJar.clearcCsD|jz(|D]}|jr||j|j|jqW5|jXdS)zDiscard all session cookies. Note that the .save() method won't save session cookies anyway, unless you ask otherwise by passing a true ignore_discard argument. N)r>rQrRrr\rrrx)rrrrrclear_session_cookiess  zCookieJar.clear_session_cookiescCsP|jz4t}|D]"}||r||j|j|jqW5|jXdS)aDiscard all expired cookies. You probably don't need to call this method: expired cookies are never sent back to the server (provided you're using DefaultCookiePolicy), this method is called by CookieJar itself every so often, and the .save() method won't save expired cookies anyway (unless you ask otherwise by passing a true ignore_expires argument). N) r>rQrRrMrr\rrrx)rrrrrrrSs  zCookieJar.clear_expired_cookiescCs t|jSr)r5r?rrrr__iter__szCookieJar.__iter__cCsd}|D] }|d}q|S)z#Return number of contained cookies.r rr)rrrrrr__len__s zCookieJar.__len__cCs2g}|D]}|t|qd|jjd|fSNz<%s[%s]>r)rrrrrrrrrrrrrszCookieJar.__repr__cCs2g}|D]}|t|qd|jjd|fSro)rrr"rrrrprrrrszCookieJar.__str__)N)NNN)"rrrrrtcompilerLrMZstrict_domain_reZ domain_reZdots_reASCIImagic_rerrBrDrFrOrPrZr_r`rargrirhrkr\rlrSrmrnrrrrrrrs8      ;!a\  7   c@s eZdZdS)rNr:rrrrrsc@s8eZdZdZd ddZd ddZddd Zdd d ZdS)rz6CookieJar that can be loaded from and saved to a file.NFcCs2t|||dk rt|}||_t||_dS)z} Cookies are NOT loaded from the named file until either the .load() or .revert() method is called. N)rrosfspathfilenamer[ delayload)rrwrxrArrrrs   zFileCookieJar.__init__cCs tdS)zSave cookies to a file.Nr)rrwignore_discardignore_expiresrrrsaveszFileCookieJar.savec CsJ|dkr"|jdk r|j}nttt|}|||||W5QRXdS)zLoad cookies from a file.N)rwrLMISSING_FILENAME_TEXTopen _really_loadrrwryrzrrrrloads   zFileCookieJar.loadcCs|dkr"|jdk r|j}ntt|jzFt|j}i|_z| |||Wnt k rn||_YnXW5|jXdS)zClear all cookies and reload cookies from a saved file. Raises LoadError (or OSError) if reversion is not successful; the object's state will not be altered if this happens. N) rwrLr|r>rQrRrZdeepcopyr?rOSError)rrwryrzZ old_staterrrrevert s    zFileCookieJar.revert)NFN)NFF)NFF)NFF)rrrrrr{rrrrrrrs  cCs |j|jfd|jfd|jfg}|jdk r8|d|jf|jrH|d|jrX|d|jrh|d|j rx|d|j r|d t t |j f|j r|d |jr|d |jf|jr|d |jft|j}|D]}||t|j|fq|d t|jft|gS)zReturn string representation of Cookie in the LWP cookie file format. Actually, the format is extended a bit -- see module docstring. rrNr) path_specN) port_specN) domain_dotN)rNr)rNrrTr)rxryrrrrrrrrrrr5r[rrrr/rr0r"rr)rrr0rrrrlwp_cookie_str$s:        rc@s,eZdZdZd ddZd ddZd d ZdS) ra[ The LWPCookieJar saves a sequence of "Set-Cookie3" lines. "Set-Cookie3" is the format used by the libwww-perl library, not known to be compatible with any browser, but which is easy to read and doesn't lose information about RFC 2965 cookies. Additional methods as_lwp_str(ignore_discard=True, ignore_expired=True) TcCsTt}g}|D]2}|s |jr q|s0||r0q|dt|qd|dgS)zReturn cookies as a string of "\n"-separated "Set-Cookie3" headers. ignore_discard and ignore_expires: see docstring for FileCookieJar.save zSet-Cookie3: %s rW)rMrrrrrr)rryrzrrqrrrr as_lwp_strMs zLWPCookieJar.as_lwp_strNFc CsX|dkr"|jdk r|j}nttt|d"}|d||||W5QRXdS)Nwz#LWP-Cookies-2.0 )rwrLr|r}writerrrrrr{]s   zLWPCookieJar.savecCs0|}|j|s$d|}t|t}d}d} d} z|} | dkrPq| |s\q<| t|d} t| gD]f} | d\} }i}i}| D] }d||<q| ddD]n\}}|dk r| }nd}|| ks|| kr|}|| kr|dkrd }|||<q|| kr|||<q|||<q|j }|d }|d }|dk rJt |}|dkrXd }|d }|d }t |d| ||d|d|||d|d|d|d|||d|d|}|s|j rqz|s||rqz||qzqq|drT|dd}|ds*|dkrpq*|d\}} } } } } }| dk} | dk} | dkr|} d}|d}d }| dkrd} d }t d | |dd || || d | | |ddi}|s|j rq*|s | |r q*| |q*WnBt k r2Yn,tk r\ttd ||fYnXdS) Nz4%r does not look like a Netscape format cookies filerWrr)#r TRUErFTr z+invalid Netscape format cookies file %r: %r)rMrrtr@rrrrsrrrrrhrrdr)rrrwryrzrrrrrrrrrxryrrrjrrrr~sr     zMozillaCookieJar._really_loadNFc Cs|dkr"|jdk r|j}nttt|d}||jt}|D]}|sV|jrVqF|sf||rfqF|j rrd}nd}|j drd}nd}|j dk rt |j } nd} |jdkrd} |j} n |j} |j} |d|j ||j|| | | gdqFW5QRXdS)NrrZFALSErrWrr)rwrLr|r}rrrMrrrrrsrr"ryrxrr) rrwryrzrrrrrrrxryrrrr{ sH        zMozillaCookieJar.save)NFF) rrrrrtrrrtrr~r{rrrrrs  A)N)N)Xr__all__rurr-rtrMZ urllib.parserZurllib.requestZ threadingr<Z http.clientZhttpZcalendarr r r rr"ZclientZ HTTP_PORTrr|rr%r,r6r7rIr(rrrKr5r8r>rrrsr?rFrTrYIr]Xr_rbrcrerkrmrnrprorzrrrrrrrrrrrrrrrrrrrrrrrr2r5r9rrrrrrrrrrrs     8  8 !    U D'    #b!b7xPKΠ]~!AAserver.cpython-38.pycnu[U e5d@s dZdZdddddgZddlZddlZddlZddlZddlZ ddl Z ddl Z ddl Z ddl Z ddlZddlZddlZddlZddlZddlZddlZddlZddlZdd lmZdd l mZd Zd ZGd ddejZGdddejeZ Gdddej!Z"Gddde"Z#ddZ$da%ddZ&ddZ'Gddde#Z(ddZ)e"e dddfddZ*e+dkrddl,Z,e,-Z.e.j/dd d!d"e.j/d#d$d%d&d'e.j/d(d)e 0d*d+e.j/d,d-de1d.d/d0e.2Z3e3j4re(Z5nee#e3j6d1Z5Gd2d3d3e Z7e*e5e7e3j8e3j9d4dS)5a@HTTP server classes. Note: BaseHTTPRequestHandler doesn't implement any HTTP request; see SimpleHTTPRequestHandler for simple implementations of GET, HEAD and POST, and CGIHTTPRequestHandler for CGI scripts. It does, however, optionally implement HTTP/1.1 persistent connections, as of version 0.3. Notes on CGIHTTPRequestHandler ------------------------------ This class implements GET and POST requests to cgi-bin scripts. If the os.fork() function is not present (e.g. on Windows), subprocess.Popen() is used as a fallback, with slightly altered semantics. In all cases, the implementation is intentionally naive -- all requests are executed synchronously. SECURITY WARNING: DON'T USE THIS CODE UNLESS YOU ARE INSIDE A FIREWALL -- it may execute arbitrary Python code or external programs. Note that status code 200 is sent prior to execution of a CGI script, so scripts cannot send other status codes such as 302 (redirect). XXX To do: - log requests even later (to capture byte count) - log user-agent header and other interesting goodies - send error log to separate file z0.6 HTTPServerThreadingHTTPServerBaseHTTPRequestHandlerSimpleHTTPRequestHandlerCGIHTTPRequestHandlerN)partial) HTTPStatusa Error response

Error response

Error code: %(code)d

Message: %(message)s.

Error code explanation: %(code)s - %(explain)s.

ztext/html;charset=utf-8c@seZdZdZddZdS)rcCs4tj||jdd\}}t||_||_dS)z.Override server_bind to store the server name.N) socketserver TCPServer server_bindZserver_addresssocketZgetfqdn server_name server_port)selfhostportr#/usr/lib64/python3.8/http/server.pyr s  zHTTPServer.server_bindN)__name__ __module__ __qualname__Zallow_reuse_addressr rrrrrsc@seZdZdZdS)rTN)rrrZdaemon_threadsrrrrrsc @sJeZdZdZdejdZdeZ e Z e Z dZddZdd Zd d Zd d ZdFddZdGddZdHddZddZddZddZdIddZddZed d!eed"ed#d$DZ d%e e!d&<d'd(Z"d)d*Z#dJd+d,Z$d-d.Z%d/d0d1d2d3d4d5gZ&dd6d7d8d9d:d;dd?d@dAg Z'dBdCZ(dDZ)e*j+j,Z-dEd!e.j/0DZ1dS)KraHTTP request handler base class. The following explanation of HTTP serves to guide you through the code as well as to expose any misunderstandings I may have about HTTP (so you don't need to read the code to figure out I'm wrong :-). HTTP (HyperText Transfer Protocol) is an extensible protocol on top of a reliable stream transport (e.g. TCP/IP). The protocol recognizes three parts to a request: 1. One line identifying the request type and path 2. An optional set of RFC-822-style headers 3. An optional data part The headers and data are separated by a blank line. The first line of the request has the form where is a (case-sensitive) keyword such as GET or POST, is a string containing path information for the request, and should be the string "HTTP/1.0" or "HTTP/1.1". is encoded using the URL encoding scheme (using %xx to signify the ASCII character with hex code xx). The specification specifies that lines are separated by CRLF but for compatibility with the widest range of clients recommends servers also handle LF. Similarly, whitespace in the request line is treated sensibly (allowing multiple spaces between components and allowing trailing whitespace). Similarly, for output, lines ought to be separated by CRLF pairs but most clients grok LF characters just fine. If the first line of the request has the form (i.e. is left out) then this is assumed to be an HTTP 0.9 request; this form has no optional headers and data part and the reply consists of just the data. The reply form of the HTTP 1.x protocol again has three parts: 1. One line giving the response code 2. An optional set of RFC-822-style headers 3. The data Again, the headers and data are separated by a blank line. The response code line has the form where is the protocol version ("HTTP/1.0" or "HTTP/1.1"), is a 3-digit response code indicating success or failure of the request, and is an optional human-readable string explaining what the response code means. This server parses the request and the headers, and then calls a function specific to the request type (). Specifically, a request SPAM will be handled by a method do_SPAM(). If no such method exists the server sends an error response to the client. If it exists, it is called with no arguments: do_SPAM() Note that the request name is case sensitive (i.e. SPAM and spam are different requests). The various request details are stored in instance variables: - client_address is the client IP address in the form (host, port); - command, path and version are the broken-down request line; - headers is an instance of email.message.Message (or a derived class) containing the header information; - rfile is a file object open for reading positioned at the start of the optional input data part; - wfile is a file object open for writing. IT IS IMPORTANT TO ADHERE TO THE PROTOCOL FOR WRITING! The first thing to be written must be the response line. Then follow 0 or more header lines, then a blank line, and then the actual data (if any). The meaning of the header lines depends on the command executed by the server; in most cases, when data is returned, there should be at least one header line of the form Content-type: / where and should be registered MIME types, e.g. "text/html" or "text/plain". zPython/rz BaseHTTP/HTTP/0.9c Csd|_|j|_}d|_t|jd}|d}||_|}t |dkrLdSt |dkr&|d}zT| d srt |d d d }|d }t |d krt t |dt |d f}Wn,t t fk r|tjd|YdSX|dkr|jdkrd|_|dkr |tjd|dS||_d t |krBdksZn|tjd|dS|dd \}}t |d krd|_|dkr|tjd|dS|||_|_|j drd |jd |_ztjj|j|jd|_Wntjjk r(}z|tjdt|WYdSd}~XYnBtjjk rh}z|tjdt|WYdSd}~XYnX|jdd} | dkrd|_n | dkr|jdkrd|_|jdd} | dkr|jdkr|jdkr| sdSdS) aHParse a request (internal). The request should be stored in self.raw_requestline; the results are in self.command, self.path, self.request_version and self.headers. Return True for success, False for failure; on failure, any relevant error response has already been sent back. NTz iso-8859-1z rFzHTTP//r .r zBad request version (%r))r r zHTTP/1.1)r rzInvalid HTTP version (%s)zBad request syntax (%r)ZGETzBad HTTP/0.9 request type (%r)z//)Z_classz Line too longzToo many headers Connectionclose keep-aliveZExpectz 100-continue)!commanddefault_request_versionrequest_versionclose_connectionstrraw_requestlinerstrip requestlinesplitlen startswith ValueErrorint IndexError send_errorrZ BAD_REQUESTprotocol_versionZHTTP_VERSION_NOT_SUPPORTEDpathlstriphttpclientZ parse_headersrfile MessageClassheadersZ LineTooLongZREQUEST_HEADER_FIELDS_TOO_LARGEZ HTTPExceptiongetlowerhandle_expect_100) rversionr)wordsZbase_version_numberZversion_numberr"r2errZconntypeZexpectrrr parse_requests             z$BaseHTTPRequestHandler.parse_requestcCs|tj|dS)a7Decide what to do with an "Expect: 100-continue" header. If the client is expecting a 100 Continue response, we must respond with either a 100 Continue or a final response before waiting for the request body. The default is to always respond with a 100 Continue. You can behave differently (for example, reject unauthorized requests) by overriding this method. This method should either return True (possibly after sending a 100 Continue response) or send an error response and return False. T)send_response_onlyrZCONTINUE end_headersrrrrr;xs z(BaseHTTPRequestHandler.handle_expect_100c Csz|jd|_t|jdkrBd|_d|_d|_|tj WdS|jsTd|_ WdS| sbWdSd|j}t ||s|tj d|jWdSt||}||jWn<tjk r}z|d|d|_ WYdSd}~XYnXdS) zHandle a single HTTP request. You normally don't need to override this method; see the class __doc__ string for information on how to handle specific HTTP commands such as GET and POST. iirNTZdo_zUnsupported method (%r)zRequest timed out: %r)r6readliner'r+r)r$r"r0rZREQUEST_URI_TOO_LONGr%r?hasattrNOT_IMPLEMENTEDgetattrwfileflushrZtimeout log_error)rZmnamemethoderrrhandle_one_requests6     z)BaseHTTPRequestHandler.handle_one_requestcCs"d|_||js|qdS)z&Handle multiple requests if necessary.TN)r%rLrBrrrhandleszBaseHTTPRequestHandler.handleNcCs z|j|\}}Wntk r.d\}}YnX|dkr<|}|dkrH|}|d||||||ddd}|dkr|tjtjtjfkr|j |t j |ddt j |ddd }| d d }|d |j |d tt|||jdkr|r|j|dS)akSend and log an error reply. Arguments are * code: an HTTP error code 3 digits * message: a simple optional 1 line reason phrase. *( HTAB / SP / VCHAR / %x80-FF ) defaults to short entry matching the response code * explain: a detailed message defaults to the long entry matching the response code. This sends an error response (so it must be called before any output has been generated), logs the error, and finally sends a piece of HTML explaining the error to the user. )???rNNzcode %d, message %srr Fquote)codemessageexplainzUTF-8replacez Content-TypeContent-LengthZHEAD) responsesKeyErrorrI send_response send_headerrZ NO_CONTENTZ RESET_CONTENT NOT_MODIFIEDerror_message_formathtmlescapeencodeerror_content_typer&r+rAr"rGwrite)rrRrSrTZshortmsgZlongmsgZbodyZcontentrrrr0s:     z!BaseHTTPRequestHandler.send_errorcCs:||||||d||d|dS)zAdd the response header to the headers buffer and log the response code. Also send two standard headers with the server software version and the current date. ZServerZDateN) log_requestr@rZversion_stringdate_time_stringrrRrSrrrrYs  z$BaseHTTPRequestHandler.send_responsecCsd|jdkr`|dkr0||jkr,|j|d}nd}t|ds@g|_|jd|j||fdddS) zSend the response header only.rNrr_headers_bufferz %s %d %s latin-1strict)r$rWrDrfappendr1r_rerrrr@s    z)BaseHTTPRequestHandler.send_response_onlycCsl|jdkr6t|dsg|_|jd||fdd|dkrh|dkrVd|_n|d krhd |_d S) z)Send a MIME header to the headers buffer.rrfz%s: %s rgrhZ connectionr Tr!FN)r$rDrfrir_r:r%)rkeywordvaluerrrrZs     z"BaseHTTPRequestHandler.send_headercCs"|jdkr|jd|dS)z,Send the blank line ending the MIME headers.rs N)r$rfri flush_headersrBrrrrAs  z"BaseHTTPRequestHandler.end_headerscCs(t|dr$|jd|jg|_dS)Nrf)rDrGrajoinrfrBrrrrls z$BaseHTTPRequestHandler.flush_headers-cCs.t|tr|j}|d|jt|t|dS)zNLog an accepted request. This is called by send_response(). z "%s" %s %sN) isinstancerrk log_messager)r&)rrRsizerrrrb s z"BaseHTTPRequestHandler.log_requestcGs|j|f|dS)zLog an error. This is called when a request cannot be fulfilled. By default it passes the message on to log_message(). Arguments are the same as for log_message(). XXX This should go to the separate error log. N)rq)rformatargsrrrrI+s z BaseHTTPRequestHandler.log_errorcCsi|]}|d|dqS)z\xZ02xr).0crrr ;sz!BaseHTTPRequestHandler. z\\\cGs2||}tjd||||jfdS)aZLog an arbitrary message. This is used by all other logging functions. Override it if you have specific logging wishes. The first argument, FORMAT, is a format string for the message to be logged. If the format string contains any % escapes requiring parameters, they should be specified as subsequent arguments (it's just like printf!). The client ip and current date/time are prefixed to every message. Unicode control characters are replaced with escaped hex before writing the output to stderr. z%s - - [%s] %s N)sysstderrraaddress_stringlog_date_time_string translate_control_char_table)rrsrtrSrrrrq>s z"BaseHTTPRequestHandler.log_messagecCs|jd|jS)z*Return the server software version string. )server_version sys_versionrBrrrrcXsz%BaseHTTPRequestHandler.version_stringcCs |dkrt}tjj|ddS)z@Return the current date and time formatted for a message header.NT)Zusegmt)timeemailutilsZ formatdate)rZ timestamprrrrd\sz'BaseHTTPRequestHandler.date_time_stringc CsBt}t|\ }}}}}}}} } d||j|||||f} | S)z.Return the current time formatted for logging.z%02d/%3s/%04d %02d:%02d:%02d)r localtime monthname) rZnowZyearZmonthZdayZhhZmmZssxyzsrrrrbsz+BaseHTTPRequestHandler.log_date_time_stringZMonZTueZWedZThuZFriZSatZSunZJanZFebZMarZAprZMayZJunZJulZAugZSepZOctZNovZDeccCs |jdS)zReturn the client address.r)client_addressrBrrrr~psz%BaseHTTPRequestHandler.address_stringHTTP/1.0cCsi|]}||j|jfqSr)phraseZ description)ruvrrrrws)NN)N)N)roro)N)2rrr__doc__r|r<r*r __version__rDEFAULT_ERROR_MESSAGEr\DEFAULT_ERROR_CONTENT_TYPEr`r#r?r;rLrMr0rYr@rZrArlrbrIr& maketrans itertoolschainrangerordrqrcrdrZ weekdaynamerr~r1r4r5Z HTTPMessager7r __members__valuesrWrrrrrs^gj% 5     cseZdZdZdeZddfdd ZddZd d Zd d Z d dZ ddZ ddZ ddZ ejsleejZedddddZS)raWSimple HTTP request handler with GET and HEAD commands. This serves files from the current directory and any of its subdirectories. The MIME type for files is determined by calling the .guess_type() method. The GET and HEAD requests are identical except that the HEAD request omits the actual contents of the file. z SimpleHTTP/N directorycs(|dkrt}||_tj||dSN)osgetcwdrsuper__init__)rrrtkwargs __class__rrrsz!SimpleHTTPRequestHandler.__init__cCs.|}|r*z|||jW5|XdS)zServe a GET request.N) send_headr copyfilerGrfrrrdo_GETs zSimpleHTTPRequestHandler.do_GETcCs|}|r|dS)zServe a HEAD request.N)rr rrrrdo_HEADsz SimpleHTTPRequestHandler.do_HEADc Cs^||j}d}tj|rtj|j}|jds|t j |d|d|dd|d|df}tj |}| d|| dSd D]&}tj||}tj|r|}qq||S||}|dr|t jd dSzt|d }Wn&tk r|t jd YdSXz"t|}d |jkrd |jkrztj|jd } Wnttttfk r|YnzX| j dkr| j!t"j#j$d} | j t"j#j$krt"j"%|j&t"j#j$} | j!dd} | | kr|t j'| |(WdS|t j)| d|| dt*|d| d|+|j&| |WS|(YnXdS)a{Common code for GET and HEAD commands. This sends the response code and MIME headers. Return value is either a file object (which has to be copied to the outputfile by the caller unless the command was HEAD, and must be closed by the caller under all circumstances), or None, in which case the caller has nothing further to do. Nrrr r rZLocation)z index.htmlz index.htmzFile not foundrbzIf-Modified-Sincez If-None-Match)tzinfo)Z microsecond Content-typerVz Last-Modified),translate_pathr2risdirurllibparseZurlsplitendswithrYrZMOVED_PERMANENTLYZ urlunsplitrZrArnexistslist_directory guess_typer0 NOT_FOUNDopenOSErrorfstatfilenor8rrZparsedate_to_datetime TypeErrorr/ OverflowErrorr-rrUdatetimetimezoneZutcZ fromtimestampst_mtimer[r OKr&rd) rr2rpartsZ new_partsZnew_urlindexZctypeZfsZimsZ last_modifrrrrs                  z"SimpleHTTPRequestHandler.send_headc Cszt|}Wn$tk r2|tjdYdSX|jdddg}ztjj |j dd}Wn"t k rtj |j }YnXt j |dd }t}d |}|d |d |d ||d||d||d|D]v}tj ||}|} } tj |r$|d} |d} tj |r:|d} |dtjj| ddt j | dd fq|dd||d} t} | | | d|tj|dd||dtt| || S)zHelper to produce a directory listing (absent index.html). Return value is either a file object, or None (indicating an error). In either case, the headers are sent, making the interface the same as for send_head(). zNo permission to list directoryNcSs|Sr)r:)arrrrmz9SimpleHTTPRequestHandler.list_directory..)key surrogatepasserrorsFrPzDirectory listing for %szZz z@z%s z

%s

z
    r@z
  • %s
  • z

 surrogateescaperrztext/html; charset=%srV) rlistdirrr0rrsortrrunquoter2UnicodeDecodeErrorr]r^r|getfilesystemencodingrirnrislinkrQr_ioBytesIOraseekrYrrZr&r+rA) rr2listrZ displaypathenctitlenamefullnameZ displaynameZlinknameZencodedrrrrrsh          z'SimpleHTTPRequestHandler.list_directorycCs|ddd}|ddd}|d}ztjj|dd}Wn tk rbtj|}YnXt|}|d}t d|}|j }|D]0}t j |s|t jt jfkrqt j ||}q|r|d7}|S) zTranslate a /-separated PATH to the local filename syntax. Components that mean special things to the local file system (e.g. drive or directory names) are ignored. (XXX They should probably be diagnosed.) ?r r#rrrN)r*r(rrrrr posixpathnormpathfilterrrr2dirnamecurdirpardirrn)rr2Ztrailing_slashr=Zwordrrrr:s$    z'SimpleHTTPRequestHandler.translate_pathcCst||dS)aCopy all data between two file objects. The SOURCE argument is a file object open for reading (or anything with a read() method) and the DESTINATION argument is a file object open for writing (or anything with a write() method). The only reason for overriding this would be to change the block size or perhaps to replace newlines by CRLF -- note however that this the default server uses this to copy binary data as well. N)shutilZ copyfileobj)rsourceZ outputfilerrrrXsz!SimpleHTTPRequestHandler.copyfilecCsLt|\}}||jkr"|j|S|}||jkr>|j|S|jdSdS)aGuess the type of a file. Argument is a PATH (a filename). Return value is a string of the form type/subtype, usable for a MIME Content-type header. The default implementation looks the file's extension up in the table self.extensions_map, using application/octet-stream as a default; however it would be permissible (if slow) to look inside the data to make a better guess. rN)rsplitextextensions_mapr:)rr2baseZextrrrrhs    z#SimpleHTTPRequestHandler.guess_typezapplication/octet-streamz text/plain)r.pyz.cz.h)rrrrrrrrrrrrrr mimetypesZinitedZinitZ types_mapcopyrupdate __classcell__rrrrrs&  W: c Cs|d\}}}tj|}|d}g}|ddD],}|dkrL|q6|r6|dkr6||q6|r|}|r|dkr|d}q|dkrd}nd}|rd||f}dd||f}d|}|S)a Given a URL path, remove extra '/'s and '.' path elements and collapse any '..' references and returns a collapsed path. Implements something akin to RFC-2396 5.2 step 6 to parse relative paths. The utility of this function is limited to is_cgi method and helps preventing some security attacks. Returns: The reconstituted URL, which will always start with a '/'. Raises: IndexError if too many '..' occur within the path. rrNrz..rr) partitionrrrr*poprirn) r2_query path_partsZ head_partspartZ tail_partZ splitpathcollapsed_pathrrr_url_collapse_paths.      rcCsrtrtSz ddl}Wntk r*YdSXz|ddaWn.tk rldtdd|DaYnXtS) z$Internal routine to get nobody's uidrNrnobodyr r css|]}|dVqdS)r Nr)rurrrr sznobody_uid..)rpwd ImportErrorgetpwnamrXmaxZgetpwall)rrrr nobody_uids  rcCst|tjS)zTest for executable file.)raccessX_OK)r2rrr executablesrc@sVeZdZdZeedZdZddZddZ dd Z d d gZ d d Z ddZ ddZdS)rzComplete HTTP server with GET, HEAD and POST commands. GET and HEAD also support running CGI scripts. The POST command is *only* implemented for CGI scripts. forkrcCs$|r|n|tjddS)zRServe a POST request. This is only implemented for CGI scripts. zCan only POST to CGI scriptsN)is_cgirun_cgir0rrErBrrrdo_POSTs  zCGIHTTPRequestHandler.do_POSTcCs|r|St|SdS)z-Version of send_head that support CGI scriptsN)rrrrrBrrrrszCGIHTTPRequestHandler.send_headcCsPt|j}|dd}|d|||dd}}||jkrL||f|_dSdS)a3Test whether self.path corresponds to a CGI script. Returns True and updates the cgi_info attribute to the tuple (dir, rest) if self.path requires running a CGI script. Returns False otherwise. If any exception is raised, the caller should assume that self.path was rejected as invalid and act accordingly. The default implementation tests whether the normalized url path begins with one of the strings in self.cgi_directories (and the next character is a '/' or the end of the string). rr NTF)rr2findcgi_directoriescgi_info)rrZdir_sepheadtailrrrrs    zCGIHTTPRequestHandler.is_cgiz/cgi-binz/htbincCst|S)z1Test whether argument path is an executable file.)r)rr2rrr is_executablesz#CGIHTTPRequestHandler.is_executablecCstj|\}}|dkS)z.Test whether argument path is a Python script.)rz.pyw)rr2rr:)rr2r r rrr is_pythonszCGIHTTPRequestHandler.is_pythonc) Cs|j\}}|d|}|dt|d}|dkr|d|}||dd}||}tj|r||}}|dt|d}q*qq*|d\}}} |d}|dkr|d|||d} }n |d} }|d| } || } tj| s | t j d| dStj | s.| t j d| dS|| } |jsF| sh|| sh| t j d | dSttj}||d <|jj|d <d |d <|j|d<t|jj|d<|j|d<tj|}||d<|||d<| |d<| r| |d<|jd|d<|j d}|r|!}t|dkrddl"}ddl#}|d|d<|d$dkrz"|d%d}|&|'d}Wn|j(t)fk rYn&X|!d}t|dkr|d|d<|j ddkr|j*|d<n|jd|d<|j d}|r||d <|j d!}|r||d"<g}|j+d#D]>}|ddd$krR|,|-n||d%d!d&}q,d&.||d'<|j d(}|r||d)<t/d|j0d*g}d+.|}|r||d,<d-D]}|1|dq|2t j3d.|4| 5d/d0}|jr| g}d1|kr|,|t6}|j78t9}|dkrt:|d\}}t;;|jd2|dSz\zt?|Wnt@k rYnXtA|j|jq |$T|%\}&}'|j7U|&|'rj|>d;|'|$jVW|$jXW|$jY}(|(r|>d2|(n |Kd<dS)=zExecute a CGI script.rr rNrrzNo such CGI script (%r)z#CGI script is not a plain file (%r)z!CGI script is not executable (%r)ZSERVER_SOFTWAREZ SERVER_NAMEzCGI/1.1ZGATEWAY_INTERFACEZSERVER_PROTOCOLZ SERVER_PORTZREQUEST_METHODZ PATH_INFOZPATH_TRANSLATEDZ SCRIPT_NAME QUERY_STRINGZ REMOTE_ADDR authorizationr Z AUTH_TYPEZbasicascii:Z REMOTE_USERz content-typeZ CONTENT_TYPEzcontent-lengthCONTENT_LENGTHreferer HTTP_REFERERacceptz ,Z HTTP_ACCEPTz user-agentHTTP_USER_AGENTZcookiez, HTTP_COOKIE)rZ REMOTE_HOSTrrrrzScript output follows+r=zCGI script exit status %#xryzw.exez-uz command: %s)stdinstdoutr}envZpostz%szCGI script exited OK)Zr rr+rrr2rrrr0rrisfileZ FORBIDDENr  have_forkr rZdeepcopyenvironrcZserverrr1r&rr"rrrrr8r9r*base64binasciir:r_Z decodebytesdecodeError UnicodeErrorZget_content_typeZgetallmatchingheadersristriprnrZget_all setdefaultrYrrlrUrrGrHrwaitpidselectr6readrIsetuidrdup2rexecveZ handle_errorZrequest_exit subprocessr|rrrqZ list2cmdliner.rr-PopenPIPEZ_sockZrecvZ communicaterar}r r returncode))rdirrestr2iZnextdirZnextrestZ scriptdirrrZscriptZ scriptnameZ scriptfileZispyr Zuqrestrr$r%ZlengthrrlineZuacoZ cookie_strkZ decoded_queryrtrpidstsr2ZcmdlineZinterpnbytespdatarr}Zstatusrrrrs<                                           zCGIHTTPRequestHandler.run_cgiN)rrrrrDrr"Zrbufsizerrrrr r rrrrrrs cGs4tj|tjtjd}tt|\}}}}}||fS)N)typeflags)rZ getaddrinfoZ SOCK_STREAMZ AI_PASSIVEnextiter)ZaddressZinfosZfamilyrAprotoZ canonnameZsockaddrrrr_get_best_familysrFri@c Cst||\|_}||_|||}|jdd\}}d|krLd|dn|}td|d|d|d|d z |Wn&tk rtd t d YnXW5QRXdS) zmTest the HTTP request handler class. This runs an HTTP server on port 8000 (or the port argument). Nr r[]zServing HTTP on z port z (http://z/) ...z& Keyboard interrupt received, exiting.r) rFZaddress_familyr1rZ getsocknameprintZ serve_foreverKeyboardInterruptr|exit) HandlerClass ServerClassZprotocolrbindZaddrZhttpdrZurl_hostrrrtests  rO__main__z--cgi store_truezRun as CGI Server)actionhelpz--bindz-bZADDRESSz8Specify alternate bind address [default: all interfaces])metavarrSz --directoryz-dz9Specify alternative directory [default:current directory])defaultrSrZstorerz&Specify alternate port [default: 8000])rRrUrAnargsrSrcseZdZfddZZS)DualStackServerc s4tt|jtjtjdW5QRXtS)Nr) contextlibsuppress ExceptionrZ setsockoptZ IPPROTO_IPV6Z IPV6_V6ONLYrr rBrrrr s zDualStackServer.server_bind)rrrr rrrrrrWsrW)rLrMrrN):rr__all__rrZ email.utilsrr]Z http.clientr4rrrrrr,rrr r|rZ urllib.parserrX functoolsrrrrr rZThreadingMixInrZStreamRequestHandlerrrrrrrrrFrOrargparseArgumentParserparser add_argumentrr. parse_argsrtZcgiZ handler_classrrWrrNrrrrsR   s 0     PK]__init__.cpython-36.opt-2.pycnu[3 \@s.dddddddddd d d d d dddddgZdS)ZbuildZbuild_pyZ build_extZ build_clibZ build_scriptsZcleanZinstallZ install_libZinstall_headersZinstall_scriptsZ install_dataZsdistregisterZbdistZ bdist_dumbZ bdist_rpmZ bdist_wininstZcheckZuploadN)__all__rr2/usr/lib64/python3.6/distutils/command/__init__.pys$PK] ""__init__.cpython-36.pycnu[3 s&a@sdZddlZddlZejeZejZiZ iZ iZ iZ xe eD]ZejsLq>eeeZeeeeejdrnq>ejdreeeddeejdree ejdd<ejdree ejdd<ejd ree ejdd<ejd r>eeed deee ed dj<q>WdZZZdgZZZd d ddgZZZddddgZZ Z!d d ddgZ"Z#Z$ddZ%Gdddej&Z&Gdddej'Z'Gdddej(Z(Gdddej)Z)ddZ*d,d d!Z+d-d"d#Z,d$d%Z-d.d&d'Z.d(d)Z/d*d+Z0dS)/aՊ Version contants ---------------- .. data:: VERSION_MAJOR VERSION_MINOR VERSION_PATCH VERSION Constants with version numbers and whole version string. .. _handle-options-label: :class:`~.Handle` options ------------------------- **LRO_** (aka LibRepo Option) prefixed constants are used to set :class:`.Handle` options via :meth:`~.Handle.setopt` method. This options could be also set by :class:`.Handle` attributes with the same names but in lowercase and without ``LRO_`` prefix. Example:: # The command: h.setopt(librepo.LRO_URLS, ["http://ftp.linux.ncsu.edu/pub/fedora/linux/releases/17/Everything/i386/os/"]) # is equivalent to: h.urls = ["http://ftp.linux.ncsu.edu/pub/fedora/linux/releases/17/Everything/i386/os/"] .. note:: For detailed description of this options consult :class:`.Handle` page. .. data:: LRO_UPDATE *Boolean*. Set to ``True`` if only want update localised or downloaded repository represented by :class:`.Result` object. Update mode is meant to download previously omitted repository file(s). .. data:: LRO_URLS *List or None*. Set repository urls (repository url and baseurl are interchangeable terms in this context). .. data:: LRO_MIRRORLIST *String or None*. **DEPRECATED** Set mirrorlist url (url could point to a metalink mirrorlist or to a simple mirrorlist where each line without ``'#'`` is considered as mirror url). .. data:: LRO_MIRRORLISTURL *String or None*. Mirrorlist URL. .. data:: LRO_METALINKURL *String or None*. Metalink URL. .. data:: LRO_LOCAL *Boolean*. If set to True, no local copy of repository is created and repository is just localized in its current location. When True, url of repository MUST be a local address (e.g. '/home/user/repo' or 'file:///home/user/repo'). .. data:: LRO_HTTPAUTH *Boolean*. If True, all supported methods of HTTP authentication are enabled. .. data:: LRO_USERPWD *String or None*. Set username and password for HTTP authentication. Param must be in format 'username:password'. .. data:: LRO_PROXY *String or None*. Set proxy server address. Port could be specified by different option or by the :[port] suffix of this address. Any protocol prefix (``http://``, ...) will be ignored. .. data:: LRO_PROXYPORT *Integer or None*. Set proxy port number to connect unless it is specified in the proxy address string. None sets default value 1080. .. data:: LRO_PROXYTYPE *Long*. Set type of proxy - could be one of :ref:`proxy-type-label` .. data:: LRO_PROXYAUTH *Boolean*. If True, all supported proxy authentication methods are enabled. If False, only basic authentication method is enabled. .. data:: LRO_PROXYUSERPWD *String or None*. Set username and password for proxy authentication in format 'username:password'. .. data:: LRO_PROGRESSCB *Function or None*. (See: :ref:`callback-progresscb-label`) Set progress callback. Callback must be in format: ``callback(userdata, total_to_download, downloaded)``. If total_to_download is 0, then total size is not known. Total size (total_to_download) could change (grow) among two callback calls (if some download failed and another mirror is tried). .. data:: LRO_PROGRESSDATA *Any object*. Set user data for the progress callback. .. data:: LRO_MAXSPEED *Long or None*. Set maximal allowed speed per download in bytes per second. 0 = unlimited speed - the default value. .. data:: LRO_DESTDIR *String or None*. Set destination directory for downloaded data (metadata or packages). .. data:: LRO_REPOTYPE *Integer*. One of :ref:`repotype-constants-label`. See more :meth:`~.Handle.repotype` Set type of repository. .. data:: LRO_CONNECTTIMEOUT *Integer or None. Set maximal timeout in sec for connection phase. Default value is 30. None as *val* sets the default value. .. data:: LRO_IGNOREMISSING *Boolean*. If you want to localize (LRO_LOCAL is True) a incomplete local repository (eg. only primary and filelists are present but repomd.xml contains more files), you could use LRO_YUMDLIST and specify only file that are present, or use LRO_YUMBLIST and specify files that are not present or use this option. .. data:: LRO_INTERRUPTIBLE *Boolean*. Librepo sets up its own SIGTERM handler. If the SIGTERM signal is catched, the current download is interrupted. .. data:: LRO_USERAGENT *String*. String for User-Agent: header in the http request sent to the remote server. .. data:: LRO_FETCHMIRRORS *Boolean*. With this option enabled, only mirrorlist download and parsing will be performed during :meth:`librepo.Handle.perform`. .. data:: LRO_MAXMIRRORTRIES *Integer or None*. If download fails, try at most the specified number of mirrors. 0 (None) means try all available mirrors. .. data:: LRO_MAXPARALLELDOWNLOADS *Integer or None*. Maximum number of parallel downloads. ``None`` sets default value. .. data:: LRO_MAXDOWNLOADSPERMIRROR *Integer or None*. Maximum number of parallel downloads per mirror. ``None`` sets default value. .. data:: LRO_VARSUB *[(String, String), ...] or None*. Set list of substitutions for variables in ulrs (e.g.: "http://foo/$version/"). ``[("releasever", "f18"), ("basearch", "i386")]`` .. data:: LRO_FASTESTMIRROR *Boolean*. If True, internal mirrorlist is sorted by the determined connection speed, after it is constructed. .. data:: LRO_FASTESTMIRRORCACHE *String or None*. Path to the cache file. If cache file it doesn't exists it will be created. .. data:: LRO_FASTESTMIRRORMAXAGE *Integer or None*. Max age of cache record. Older records will not be used. .. data:: LRO_FASTESTMIRRORCB *Function or None*. (See: :ref:`callback-fastestmirrorcb-label`) Fastest mirror status callback. Its prototype looks like ``callback(userdata, stage, data)`` Where *userdata* are data passed by user via LRO_FASTESTMIRRORDATA. *stage* is value from :ref:`fastestmirror-stages-constants-label`. *data* value depends on *stage* value. See the list of available stages. .. data:: LRO_FASTESTMIRRORDATA *Any object*. User data for fastest mirror status callback. .. data:: LRO_LOWSPEEDTIME *Integer or None*. The time in seconds that the transfer should be below the LRO_LOWSPEEDLIMIT for the library to consider it too slow and abort. Default: 30 (sec) .. data:: LRO_LOWSPEEDLIMIT *Integer or None*. The transfer speed in bytes per second that the transfer should be below during LRO_LOWSPEEDTIME seconds for the library to consider it too slow and abort. Default: 1000 (byte/s) .. data:: LRO_GPGCHECK *Boolean*. Set True to enable gpg check (if available) of downloaded repo. .. data:: LRO_CHECKSUM *Boolean*. Set False/True to disable/enable checksum check. .. note:: Checksum check is enabled by default. .. note:: If checksum check is disabled, then even explicitly specified checksum related params e.g. in :meth:`~librepo.Handle.download` method are ignored and checksum is not checked! .. data:: LRO_YUMDLIST *List of strings*. Some predefined list :ref:`predefined-yumdlists-label`. Set list of yum metadata files to download. e.g. ``["primary", "filelists", "other", "primary_db", "prestodelta"]`` If *val* is None, all metadata files will be downloaded. If *val* is ``[]`` or ``[None]`` only ``repomd.xml`` will be downloaded. .. data:: LRO_YUMSLIST *[(String, String), ...] or None*. Set list of substitutions for repomd records. ``[("group_gz", "group")]` .. data:: LRO_RPMMDDLIST See LRO_YUMDLIST .. data:: LRO_YUMBLIST *List of strings*. Set skiplist of yum metadata files. This files will not be downloaded. .. data:: LRO_RPMMDBLIST See LRO_YUMBLIST .. data:: LRO_HMFCB *Function or None* (See: :ref:`callback-handlemirrorfailurecb-label`) The Handle Mirror Failure Callback is called when a metadata download fails. It provides a detailed information about what exactly failed. Call of this callback doesn't mean that whole downloading failed. If there are other mirrors on the list, these mirrors will be tried. .. data:: LRO_SSLVERIFYPEER *Boolean*. This option determines whether librepo verifies the authenticity of the peer's certificate. This trust is based on a chain of digital signatures, rooted in certification authority (CA) certificates. .. data:: LRO_SSLVERIFYSTATUS *Boolean*. This option determines whether librepo verifies the status of the server cert using the 'Certificate Status Request' TLS extension (aka. OCSP stapling). Note that if this option is enabled but the server does not support the TLS extension, the verification will fail. */ .. data:: LRO_SSLVERIFYHOST *Boolean*. This option determines whether librepo verifies that the server cert is for the server it is known as. .. data:: LRO_SSLCLIENTCERT *String or None*. Path to the PEM format SSL client certificate to use when talking to the server. .. data:: LRO_SSLCLIENTKEY *String or None*. Path to the PEM format SSL client key to use when talking to the server. .. data:: LRO_SSLCACERT *String or None*. Path to a file containing the list of PEM format trusted CA certificates. .. data:: LRO_PROXY_SSLVERIFYPEER *Boolean*. This option determines whether librepo verifies the authenticity of the proxy certificate. This trust is based on a chain of digital signatures, rooted in certification authority (CA) certificates. .. data:: LRO_PROXY_SSLVERIFYHOST *Boolean*. This option determines whether librepo verifies the name of the proxy certificate against the host. .. data:: LRO_PROXY_SSLCLIENTCERT *String or None*. Path to the PEM format SSL client certificate to use when talking to the proxy. .. data:: LRO_PROXY_SSLCLIENTKEY *String or None*. Path to the PEM format SSL client key to use when talking to the proxy. .. data:: LRO_PROXY_SSLCACERT *String or None*. Path to a file containing the list of PEM format trusted CA certificates. Used for proxy. .. data:: LRO_IPRESOLVE *Integer or None* Sets kind of IP addresses to use when resolving host names. Could be one of: :ref:`ipresolve-type-label` .. data:: LRO_ALLOWEDMIRRORFAILURES *Integer or None* If all transfers from a mirror failed (no successful transfer from the mirror exists) and the number of failed downloads is higher or equal to this value the mirror will be skipped (ignored) for all next downloads. **Note:** Number of failed transfers for a single mirror can outreach this number! For example, if you set this value to 1 but you allow 3 parallel downloads it is possible that all three downloads start from the mirror, before any of them can fail. Then, if all three transfers fail, the number of failures for the mirror will be 3, even if this option was set to 1. .. data:: LRO_ADAPTIVEMIRRORSORTING *Integer or None* If enabled, internal list of mirrors for each handle is re-sorted after each finished transfer. The the sorting is based on mirror error rate etc. .. data:: LRO_GNUPGHOMEDIR *String or None* set own GNUPG configuration directory (a dir with keyring). .. data:: LRO_FASTESTMIRRORTIMEOUT *Float of None* Max length of fastest mirror measurement in seconds. Default value is 2.0sec. .. data:: LRO_HTTPHEADER *List of strings or None* List of strings that represent http headers. Each header has format "header_name: content". If you add a header with no content as in 'Accept:' (no data on the right side of the colon), the internally used header will get disabled. With this option you can add new headers, replace internal headers and remove internal headers. To add a header with no content (nothing to the right side of the colon), use the form 'MyHeader;' (note the ending semicolon). Note: Headers must not be CRLF-terminated! .. data:: LRO_OFFLINE *Boolean* Make the handle work only locally, all remote URLs are ignored. Remote mirrorlists/metalinks (if they are specified) are ignored. Fastest mirror check (if enabled) is skiped. .. data:: LRO_HTTPAUTHMETHODS *Long (bitmask)* Bitmask which tell Librepo which auth metods to use. See: :ref:`auth-methods-label` .. data:: LRO_PROXYAUTHMETHODS *Long (bitmask)* Bitmask which tell Librepo which auth metods to use for proxy authentication. See: :ref:`auth-methods-label` .. data:: LRO_FTPUSEEPSV *Boolean* Enable/Disable EPSV (Extended Passive mode) for FTP. .. data:: LRO_PRESERVETIME *Boolean* If enabled, librepo will try to keep timestamps of the downloaded files in sync with that on the remote side. .. _handle-info-options-label: :class:`~.Handle` info options ------------------------------ LRI (aka LibRepo Information) constants are used to get information from :class:`.Handle` via :meth:`~.Handle.getinfo` method. .. data:: LRI_UPDATE .. data:: LRI_URLS .. data:: LRI_MIRRORLIST .. data:: LRI_MIRRORLISTURL .. data:: LRI_METALINKURL .. data:: LRI_LOCAL .. data:: LRI_PROGRESSCB .. data:: LRI_PROGRESSDATA .. data:: LRI_DESTDIR .. data:: LRI_REPOTYPE .. data:: LRI_USERAGENT .. data:: LRI_YUMDLIST .. data:: LRI_YUMSLIST .. data:: LRI_RPMMDDLIST .. data:: LRI_YUMBLIST .. data:: LRI_RPMMDBLIST .. data:: LRI_FETCHMIRRORS .. data:: LRI_MAXMIRRORTRIES .. data:: LRI_VARSUB .. data:: LRI_MIRRORS .. data:: LRI_METALINK .. data:: LRI_FASTESTMIRROR .. data:: LRI_FASTESTMIRRORCACHE .. data:: LRI_FASTESTMIRRORMAXAGE .. data:: LRI_HMFCB .. data:: LRI_SSLVERIFYPEER .. data:: LRI_SSLVERIFYSTATUS .. data:: LRI_SSLVERIFYHOST .. data:: LRI_SSLCLIENTCERT .. data:: LRI_SSLCLIENTKEY .. data:: LRI_SSLCACERT .. data:: LRI_PROXY_SSLVERIFYPEER .. data:: LRI_PROXY_SSLVERIFYHOST .. data:: LRI_PROXY_SSLCLIENTCERT .. data:: LRI_PROXY_SSLCLIENTKEY .. data:: LRI_PROXY_SSLCACERT .. data:: LRI_IPRESOLVE .. data:: LRI_ALLOWEDMIRRORFAILURES .. data:: LRI_ADAPTIVEMIRRORSORTING .. data:: LRI_GNUPGHOMEDIR .. data:: LRI_FASTESTMIRRORTIMEOUT .. data:: LRI_HTTPHEADER .. data:: LRI_OFFLINE .. data:: LRI_HTTPAUTHMETHODS .. data:: LRI_PROXYAUTHMETHODS .. data:: LRI_FTPUSEEPSV .. _proxy-type-label: Proxy type constants -------------------- .. data:: PROXY_HTTP (LR_PROXY_HTTP) .. data:: PROXY_HTTP_1_0 (LR_PROXY_HTTP_1_0) .. data:: PROXY_SOCKS4 (LR_PROXY_SOCKS4) .. data:: PROXY_SOCKS5 (LR_PROXY_SOCKS5) .. data:: PROXY_SOCKS4A (LR_PROXY_SOCKS4A) .. data:: PROXY_SOCKS5_HOSTNAME (LR_PROXY_SOCKS5_HOSTNAME) .. _ipresolve-type-label: Supported IP resolving ---------------------- .. data:: IPRESOLVE_WHATEVER Default value, resolves addresses to all IP versions that your system allows. .. data:: IPRESOLVE_V4 Resolve to IPv4 addresses. .. data:: IPRESOLVE_V6 Resolve to IPv6 addresses. .. _repotype-constants-label: Repo type constants ------------------- .. data:: RPMMDREPO (LR_RPMMDREPO) Classical repository in repo-md format with ``repodata/`` directory. .. data:: YUMREPO (LR_YUMREPO) See RPMMDREPO .. data:: SUSEREPO (LR_SUSEREPO) YaST2 repository (http://en.opensuse.org/openSUSE:Standards_YaST2_Repository_Metadata_content). .. note:: This option is not supported yet! .. data:: DEBREPO (LR_DEBREPO) Debian repository .. note:: This option is not supported yet! .. _predefined-yumdlists-label: Predefined yumdlist lists ------------------------- .. data:: RPMMD_FULL (YUM_FULL, LR_YUM_FULL) Download all repodata files .. data:: RPMMD_REPOMDONLY (YUM_REPOMDONLY, LR_YUM_REPOMDONLY) Download only repomd.xml file .. data:: RPMMD_BASEXML (YUM_BASEXML, LR_YUM_BASEXML) Download only primary.xml, filelists.xml and other.xml .. data:: RPMMD_BASEDB (YUM_BASEDB, LR_YUM_BASEDB) Download only primary, filelists and other databases. .. data:: RPMMD_HAWKEY (YUM_HAWKEY, LR_YUM_HAWKEY) Download only files used by Hawkey (https://github.com/akozumpl/hawkey/). (primary, filelists, prestodelta) .. _auth-methods-label: Auth methods ------------ Supported auth methods for :data:`~.LRO_HTTPAUTHMETHODS` and :data:`~.LRO_PROXYAUTHMETHODS` options. .. data:: LR_AUTH_NONE No auth method enabled. .. data:: LR_AUTH_BASIC HTTP Basic authentication (Default). .. data:: LR_AUTH_DIGEST HTTP Digest authentication. .. data:: LR_AUTH_NEGOTIATE HTTP Negotiate (SPNEGO) authentication. .. data:: LR_AUTH_NTLM HTTP NTLM authentication. .. data:: LR_AUTH_DIGEST_IE HTTP Digest authentication with an IE flavor. .. data:: LR_AUTH_NTLM_WB NTLM delegating to winbind helper. .. data:: LR_AUTH_ONLY This is a meta symbol. OR this value together with a single specific auth value to force libcurl to probe for un-restricted auth and if not, only that single auth algorithm is acceptable. .. data:: LR_AUTH_ANY All suitable methods. .. _fastestmirror-stages-constants-label: Fastest mirror stages --------------------- Values used by fastest mirror callback (:data:`~.LRO_FASTESTMIRRORCB`): .. data:: FMSTAGE_INIT (0) Fastest mirror detection just started. *data* is None. .. data:: FMSTAGE_CACHELOADING (1) Cache file is specified. *data* is path to the cache file. .. data:: FMSTAGE_CACHELOADINGSTATUS (2) Cache loading finished. If successful, *data* is None, otherwise *data* is string with error message. .. data:: FMSTAGE_DETECTION (3) Detection in progress. *data* is number of mirrors that will be pinged. If all times were loaded from cache, this stage is skiped. .. data:: FMSTAGE_FINISHING (4) Detection is done, sorting mirrors, updating cache, etc. *data* is None. .. data:: FMSTAGE_STATUS (5) The very last invocation of fastest mirror callback. If fastest mirror detection was successful *data*, otherwise *data* contain string with error message. .. _error-codes-label: Error codes ----------- LibRepo Error codes. .. data:: LRE_OK (0) Everything is ok. .. data:: LRE_BADFUNCARG (1) Bad function argument(s). .. data:: LRE_BADOPTARG (2) Bad argument for the option in :meth:`~.Handle.setopt`. .. data:: LRE_UNKNOWNOPT (3) Unknown option. .. data:: LRE_CURLSETOPT (4) cURL doesn't know an option used by librepo. Probably too old cURL version is used. .. data:: LRE_ALREADYUSEDRESULT (5) :class:`.Result` object is not "clean" (it has been already used). .. data:: LRE_INCOMPLETERESULT (6) :class:`.Result` object doesn't contain all what is needed. .. data:: LRE_CURLDUP (7) Cannot duplicate cURL handle. No free memory? .. data:: LRE_CURL (8) A cURL error. .. data:: LRE_CURLM (9) A multi cURL handle error. .. data:: LRE_BADSTATUS (10) Error HTTP or FTP status code. .. data:: LRE_TEMPORARYERR (11) An error that should be temporary (e.g. HTTP status codes 500, 502-504, ..) .. data:: LRE_NOTLOCAL (12) URL is not a local address. E.g. in case when :data:`~.LRO_UPDATE` option is ``True`` and URL is a remote address. .. data:: LRE_CANNOTCREATEDIR (13) Cannot create directory for downloaded data. Bad permission? .. data:: LRE_IO (14) Input/Output error. .. data:: LRE_MLBAD (15) Bad mirrorlist or metalink file. E.g. metalink doesn't contain reference to target file (repomd.xml), mirrorlist is empty, .. .. data:: LRE_MLXML (16) Cannot parse metalink xml. Non-valid metalink file? E.g. (metalink doesn't contain needed file, mirrorlist doesn't contain urls, ..) .. data:: LRE_BADCHECKSUM (17) Bad checksum. .. data:: LRE_REPOMDXML (18) Cannot parse repomd.xml file. Non-valid repomd.xml file? .. data:: LRE_NOURL (19) No usable URL found. E.g. bad links or no links in metalink. .. data:: LRE_CANNOTCREATETMP (20) Cannot create temporary directory. .. data:: LRE_UNKNOWNCHECKSUM (21) Unknown type of checksum is needed for verification of one or more files. .. data:: LRE_BADURL (22) Bad URL specified. .. data:: LRE_GPGNOTSUPPORTED (23) OpenPGP protocol is not supported. .. data:: LRE_GPGERROR (24) GPG error. .. data:: LRE_BADGPG (25) Bad GPG signature. .. data:: LRE_INCOMPLETEREPO (26) Repository metadata are not complete. .. data:: LRE_INTERRUPTED (27) Download was interrupted by SIGTERM signal. .. data:: LRE_SIGACTION (28) Sigaction system call failed. .. data:: LRE_ALREADYDOWNLOADED (29) The file is already downloaded and its checksum matches. .. data:: LRE_UNFINISHED (30) Download wasn't (or cannot be) finished. .. data:: LRE_SELECT (31) select() call failed. .. data:: LRE_OPENSSL (32) OpenSSL library related error. .. data:: LRE_MEMORY (33) Cannot allocate more memory. .. data:: LRE_XMLPARSER (34) XML parser error. .. data:: LRE_CBINTERRUPTED (35) Interrupted by user cb. .. data:: LRE_UNKNOWNERROR An unknown error. .. _result-options-label: :class:`~.Result` options ------------------------- LibRepo Result options for use in :meth:`~.Result.getinfo` method. .. data:: LRR_YUM_REPO (deprecated - use LRR_RPMMD_REPO instead) Returns a flat dictionary with local paths to downloaded/localised rpmmd repository and basic repository's information.:: {'repomd': u'/tmp/librepotest-jPMmX5/repodata/repomd.xml', 'url': u'http://127.0.0.1:5000/yum/static/01/' 'destdir': u'/tmp/librepotest-jPMmX5', 'metalink': None, 'mirrorlist': None, 'signature': None, 'primary': u'/tmp/librepotest-jPMmX5/repodata/4543ad62e4d86337cd1949346f9aec976b847b58-primary.xml.gz', 'primary_db': u'/tmp/librepotest-jPMmX5/repodata/735cd6294df08bdf28e2ba113915ca05a151118e-primary.sqlite.bz2', 'filelists': u'/tmp/librepotest-jPMmX5/repodata/aeca08fccd3c1ab831e1df1a62711a44ba1922c9-filelists.xml.gz', 'filelists_db': u'/tmp/librepotest-jPMmX5/repodata/4034dcea76c94d3f7a9616779539a4ea8cac288f-filelists.sqlite.bz2', 'other': u'/tmp/librepotest-jPMmX5/repodata/a8977cdaa0b14321d9acfab81ce8a85e869eee32-other.xml.gz', 'other_db': u'/tmp/librepotest-jPMmX5/repodata/fd96942c919628895187778633001cff61e872b8-other.sqlite.bz2', } .. data:: LRR_RPMMD_REPO Returns a dict with local paths to downloaded/localised rpmmd repository and basic repository's information.:: {'repomd': u'/tmp/librepotest-jPMmX5/repodata/repomd.xml', 'url': u'http://127.0.0.1:5000/yum/static/01/' 'destdir': u'/tmp/librepotest-jPMmX5', 'metalink': None, 'mirrorlist': None, 'signature': None, 'paths': {'primary': u'/tmp/librepotest-jPMmX5/repodata/4543ad62e4d86337cd1949346f9aec976b847b58-primary.xml.gz', 'primary_db': u'/tmp/librepotest-jPMmX5/repodata/735cd6294df08bdf28e2ba113915ca05a151118e-primary.sqlite.bz2', 'filelists': u'/tmp/librepotest-jPMmX5/repodata/aeca08fccd3c1ab831e1df1a62711a44ba1922c9-filelists.xml.gz', 'filelists_db': u'/tmp/librepotest-jPMmX5/repodata/4034dcea76c94d3f7a9616779539a4ea8cac288f-filelists.sqlite.bz2', 'other': u'/tmp/librepotest-jPMmX5/repodata/a8977cdaa0b14321d9acfab81ce8a85e869eee32-other.xml.gz', 'other_db': u'/tmp/librepotest-jPMmX5/repodata/fd96942c919628895187778633001cff61e872b8-other.sqlite.bz2'} } .. data:: LRR_YUM_REPOMD (deprecated - use LRR_RPMMD_REPOMD instead) Returns a flat dict representing a repomd.xml file of downloaded rpmmd repository.:: {'revision': u'1347459931', 'repo_tags': [], 'content_tags': [], 'distro_tags': [], 'primary': {'checksum': u'4543ad62e4d86337cd1949346f9aec976b847b58', 'checksum_open': u'68457ceb8e20bda004d46e0a4dfa4a69ce71db48', 'checksum_open_type': u'sha1', 'checksum_type': u'sha1', 'db_version': 0L, 'location_href': u'repodata/4543ad62e4d86337cd1949346f9aec976b847b58-primary.xml.gz', 'size': 936L, 'size_open': 3385L, 'timestamp': 1347459930L}, 'primary_db': {'checksum': u'735cd6294df08bdf28e2ba113915ca05a151118e', 'checksum_open': u'ba636386312e1b597fc4feb182d04c059b2a77d5', 'checksum_open_type': u'sha1', 'checksum_type': u'sha1', 'db_version': 10L, 'location_href': u'repodata/735cd6294df08bdf28e2ba113915ca05a151118e-primary.sqlite.bz2', 'size': 2603L, 'size_open': 23552L, 'timestamp': 1347459931L}, 'filelists': {'checksum': u'aeca08fccd3c1ab831e1df1a62711a44ba1922c9', 'checksum_open': u'52d30ae3162ca863c63c345ffdb7f0e10c1414a5', 'checksum_open_type': u'sha1', 'checksum_type': u'sha1', 'db_version': 0L, 'location_href': u'repodata/aeca08fccd3c1ab831e1df1a62711a44ba1922c9-filelists.xml.gz', 'size': 43310L, 'size_open': 735088L, 'timestamp': 1347459930L}, 'filelists_db': {'checksum': u'4034dcea76c94d3f7a9616779539a4ea8cac288f', 'checksum_open': u'949c6b7b605b2bc66852630c841a5003603ca5b2', 'checksum_open_type': u'sha1', 'checksum_type': u'sha1', 'db_version': 10L, 'location_href': u'repodata/4034dcea76c94d3f7a9616779539a4ea8cac288f-filelists.sqlite.bz2', 'size': 22575L, 'size_open': 201728L, 'timestamp': 1347459931L}, 'other': {'checksum': u'a8977cdaa0b14321d9acfab81ce8a85e869eee32', 'checksum_open': u'4b5b8874fb233a626b03b3260a1aa08dce90e81a', 'checksum_open_type': u'sha1', 'checksum_type': u'sha1', 'db_version': 0L, 'location_href': u'repodata/a8977cdaa0b14321d9acfab81ce8a85e869eee32-other.xml.gz', 'size': 807L, 'size_open': 1910L, 'timestamp': 1347459930L}, 'other_db': {'checksum': u'fd96942c919628895187778633001cff61e872b8', 'checksum_open': u'c5262f62b6b3360722b9b2fb5d0a9335d0a51112', 'checksum_open_type': u'sha1', 'checksum_type': u'sha1', 'db_version': 10L, 'location_href': u'repodata/fd96942c919628895187778633001cff61e872b8-other.sqlite.bz2', 'size': 1407L, 'size_open': 8192L, 'timestamp': 1347459931L}, } .. data:: LRR_RPMMD_REPOMD Returns a dict representing a repomd.xml file of downloaded rpmmd repository.:: {'revision': u'1347459931', 'repo_tags': [], 'content_tags': [], 'distro_tags': [], 'records': {'primary': {'checksum': u'4543ad62e4d86337cd1949346f9aec976b847b58', 'checksum_open': u'68457ceb8e20bda004d46e0a4dfa4a69ce71db48', 'checksum_open_type': u'sha1', 'checksum_type': u'sha1', 'db_version': 0L, 'location_href': u'repodata/4543ad62e4d86337cd1949346f9aec976b847b58-primary.xml.gz', 'size': 936L, 'size_open': 3385L, 'timestamp': 1347459930L}, 'primary_db': {'checksum': u'735cd6294df08bdf28e2ba113915ca05a151118e', 'checksum_open': u'ba636386312e1b597fc4feb182d04c059b2a77d5', 'checksum_open_type': u'sha1', 'checksum_type': u'sha1', 'db_version': 10L, 'location_href': u'repodata/735cd6294df08bdf28e2ba113915ca05a151118e-primary.sqlite.bz2', 'size': 2603L, 'size_open': 23552L, 'timestamp': 1347459931L}}, 'filelists': {'checksum': u'aeca08fccd3c1ab831e1df1a62711a44ba1922c9', 'checksum_open': u'52d30ae3162ca863c63c345ffdb7f0e10c1414a5', 'checksum_open_type': u'sha1', 'checksum_type': u'sha1', 'db_version': 0L, 'location_href': u'repodata/aeca08fccd3c1ab831e1df1a62711a44ba1922c9-filelists.xml.gz', 'size': 43310L, 'size_open': 735088L, 'timestamp': 1347459930L}, 'filelists_db': {'checksum': u'4034dcea76c94d3f7a9616779539a4ea8cac288f', 'checksum_open': u'949c6b7b605b2bc66852630c841a5003603ca5b2', 'checksum_open_type': u'sha1', 'checksum_type': u'sha1', 'db_version': 10L, 'location_href': u'repodata/4034dcea76c94d3f7a9616779539a4ea8cac288f-filelists.sqlite.bz2', 'size': 22575L, 'size_open': 201728L, 'timestamp': 1347459931L}, 'other': {'checksum': u'a8977cdaa0b14321d9acfab81ce8a85e869eee32', 'checksum_open': u'4b5b8874fb233a626b03b3260a1aa08dce90e81a', 'checksum_open_type': u'sha1', 'checksum_type': u'sha1', 'db_version': 0L, 'location_href': u'repodata/a8977cdaa0b14321d9acfab81ce8a85e869eee32-other.xml.gz', 'size': 807L, 'size_open': 1910L, 'timestamp': 1347459930L}, 'other_db': {'checksum': u'fd96942c919628895187778633001cff61e872b8', 'checksum_open': u'c5262f62b6b3360722b9b2fb5d0a9335d0a51112', 'checksum_open_type': u'sha1', 'checksum_type': u'sha1', 'db_version': 10L, 'location_href': u'repodata/fd96942c919628895187778633001cff61e872b8-other.sqlite.bz2', 'size': 1407L, 'size_open': 8192L, 'timestamp': 1347459931L}, } .. data:: LRR_RPMMD_TIMESTAMP (LRR_YUM_TIMESTAMP) Returns the highest timestamp from all records in the repomd. See: http://yum.baseurl.org/gitweb?p=yum.git;a=commitdiff;h=59d3d67f .. _endcb-statuses-label: Transfer statuses for endcb of :class:`~.PackageTarget` ------------------------------------------------------- .. data:: TRANSFER_SUCCESSFUL .. data:: TRANSFER_ALREADYEXISTS .. data:: TRANSFER_ERROR Callbacks prototypes -------------------- Some librepo's functions and classes can take a callbacks in their arguments. This section contain the callbacks prototypes and explanation of their arguments. By default all callbacks should return *None* (this is default behaviour of python function if it doesn't have a specified return statement - it returns None). But there are some callbacks that can return a specific values defined in :ref:`callbacks-return-values`. .. _callback-progresscb-label: Progress callback - progresscb ------------------------------ ``progresscb(userdata, totalsize, downloaded)`` Callback frequently called during a download. :userdata: User specified data or *None* :totalsize: Total size (in bytes) of the target (float). :downloaded: Currently downloaded size (in bytes). :returns: This callback can return values from :ref:`callbacks-return-values` .. _callback-endcb-label: End callback - endcb -------------------- ``endcb(userdata, status, msg)`` Callback called when a transfer is done either successfully or unsuccessfully. :userdata: User specified data or *None* :status: :ref:`endcb-statuses-label` :msg: String with error message or *None* :returns: This callback can return values from :ref:`callbacks-return-values` .. _callback-mirrorfailurecb-label: Mirror Failure Callback - mirrorfailurecb ----------------------------------------- ``mirrorfailurecb(userdata, msg, url)`` Callback called when a transfer failed. :userdata: User specified data or *None* :msg: String with error message :url: String with mirror URL :returns: This callback can return values from :ref:`callbacks-return-values` .. _callback-fastestmirrorcb-label: Fastestmirror callback - fastestmirrorcb ---------------------------------------- ``fastestmirrorcb(userdata, stage, data)`` :userdata: User specified data or *None* :stage: :ref:`fastestmirror-stages-constants-label` :data: Content of *data* is different for different stages. See :ref:`fastestmirror-stages-constants-label` :returns: This callback must return *None* each other value will be ignored. .. _callback-handlemirrorfailurecb-label: Handle Mirror Failure Callback - hmfcb -------------------------------------- ``hmfcb(userdata, msg, url, metadata)`` Callback called when a download of a metadata during :meth:`~.Handle.perform()` fails. :userdata: User specified data or *None* :msg: String with error message :url: String with mirror URL :metadata: String with metadata name ("primary", "filelists", ...) :returns: This callback can return values from :ref:`callbacks-return-values` .. _callbacks-return-values: Callbacks return values ----------------------- Each callback can safely return ``None`` (this is implicit return value when no return statement is defined). ``return None`` is equivalent for ``return librepo.CB_OK``. .. data:: CB_OK Everything is OK .. data:: CB_ABORT Abort just the current transfer. Note: If failfast option for the downloading is enabled, the whole downloading will be aborted. .. data:: CB_ERROR Abort the whole downloading (all transfers). (Note: This code is automatically internally returned when an exception is raised in the callback.) .. _checksum-constants-label: Checksum (hash) type constants ------------------------------ .. data:: MD5 (CHECKSUM_MD5) .. data:: SHA1 (CHECKSUM_SHA1) .. data:: SHA224 (CHECKSUM_SHA224) .. data:: SHA256 (CHECKSUM_SHA256) .. data:: SHA384 (CHECKSUM_SHA384) .. data:: SHA512 (CHECKSUM_SHA512) NZ _SENTINELZLR_ZLRO_ZLRI_ZLRR_Z LR_CHECKSUM_ ZprimaryZ filelistsotherZ primary_dbZ filelists_dbZother_dbZ prestodeltacCs|j}tj|tS)z Convert string with name of hash function to numeric value that represents the hash in createrepo_c. :param name: Checksum name (e.g. "sha256", "sha512", ...) :returns: Integer value (from :ref:`checksum-constants-label`) )lower_CHECKSUM_STR_TO_VAL_MAPgetCHECKSUM_UNKNOWN)namer /usr/lib64/python3.6/__init__.pychecksum_str_to_typesr c@seZdZdddZdS)MetadataTargetNcCstjj|||||||dS)N)_librepor__init__)selfhandlecbdata progresscbmirrorfailurecbendcbZ gnupghomedirr r r rszMetadataTarget.__init__)NNNNNN)__name__ __module__ __qualname__rr r r r rsrc @s4eZdZdZdedddddddddddf ddZdS) PackageTargetzg Represent a single package that will be downloaded by :func:`~librepo.download_packages`. NrFcCs,tjj|| ||||||||| | | | |dS)a_ :param relative_url: Target URL. If *handle* or *base_url* specified, the *url* can be (and logically should be) only a relative part of path. :param dest: Destination filename or directory (file basename will be derived from the relative_url). If *None* current working directory will be used. :param checksum_type: :ref:`checksum-constants-label` :param checksum: Expected checksum value. :param expectedsize: Expected size of the target. If server reports different size, then download won't be performed. :param base_url: Base part of URL :param resume: If True then downloader will try to resume download if the destination file already exists. If the file doesn't exist yet, it will be downloaded. :param progresscb: :ref:`callback-progresscb-label` :param cbdata: User data for the callback. :param handle: :class:`~librepo.Handle` :param endcb: :ref:`callback-endcb-label` :param mirrorfailurecb: See :ref:`callback-mirrorfailurecb-label` :param byterangestart: Start downloading from the specified byte. :param byterangeend: Stop downloading at the specified byte. *Note: If the byterangeend is less or equal to byterangestart, then it is ignored!* N)rrr)r relative_urldest checksum_typechecksum expectedsizebase_urlresumerrrrrZbyterangestartZ byterangeendr r r rs zPackageTarget.__init__)rrr__doc__r rr r r r rs rc@sXeZdZdZddZddZddZdd Zd ed d d d fd d Z dddZ ddZ d S)HandleaLibrepo handle class. Handle hold information about a repository and configuration for downloading from the repository. **Attributes:** .. attribute:: update: See: :data:`.LRO_UPDATE` .. attribute:: urls: See: :data:`.LRO_URLS` .. attribute:: mirrorlist: See: :data:`.LRO_MIRRORLIST` .. attribute:: mirrorlisturl: See: :data:`.LRO_MIRRORLISTURL` .. attribute:: metalinkurl: See: :data:`.LRO_METALINKURL` .. attribute:: local: See: :data:`.LRO_LOCAL` .. attribute:: httpauth: See: :data:`.LRO_HTTPAUTH` .. attribute:: userpwd: See: :data:`.LRO_USERPWD` .. attribute:: proxy: See: :data:`.LRO_PROXY` .. attribute:: proxyport: See: :data:`.LRO_PROXYPORT` .. attribute:: proxytype: See: :data:`.LRO_PROXYTYPE` .. attribute:: proxyauth: See: :data:`.LRO_PROXYAUTH` .. attribute:: proxyuserpwd: See: :data:`.LRO_PROXYUSERPWD` .. attribute:: progresscb: See: :data:`.LRO_PROGRESSCB` .. attribute:: progressdata: See: :data:`.LRO_PROGRESSDATA` .. attribute:: maxspeed: See: :data:`.LRO_MAXSPEED` .. attribute:: destdir: See: :data:`.LRO_DESTDIR` .. attribute:: repotype: See: :data:`.LRO_REPOTYPE` .. attribute:: connecttimeout: See: :data:`.LRO_CONNECTTIMEOUT` .. attribute:: ignoremissing: See: :data:`.LRO_IGNOREMISSING` .. attribute:: interruptible: See: :data:`.LRO_INTERRUPTIBLE` .. attribute:: useragent: See: :data:`.LRO_USERAGENT` .. attribute:: fetchmirrors: See: :data:`.LRO_FETCHMIRRORS` .. attribute:: maxmirrortries: See: :data:`.LRO_MAXMIRRORTRIES` .. attribute:: maxparalleldownloads: See: :data:`.LRO_MAXPARALLELDOWNLOADS` .. attribute:: maxdownloadspermirror: See: :data:`.LRO_MAXDOWNLOADSPERMIRROR` .. attribute:: varsub: See: :data:`.LRO_VARSUB` .. attribute:: fastestmirror: See: :data:`.LRO_FASTESTMIRROR` .. attribute:: fastestmirrorcache: See: :data:`.LRO_FASTESTMIRRORCACHE` .. attribute:: fastestmirrormaxage: See: :data:`.LRO_FASTESTMIRRORMAXAGE` .. attribute:: fastestmirrorcb: See: :data:`.LRO_FASTESTMIRRORCB` .. attribute:: fastestmirrordata: See: :data:`.LRO_FASTESTMIRRORDATA` .. attribute:: lowspeedtime: See: :data:`.LRO_LOWSPEEDTIME` .. attribute:: lowspeedlimit: See: :data:`.LRO_LOWSPEEDLIMIT` .. attribute:: gpgcheck: See: :data:`.LRO_GPGCHECK` .. attribute:: checksum: See: :data:`.LRO_CHECKSUM` .. attribute:: rpmmddlist: See: :data:`.LRO_RPMMDDLIST` .. attribute:: yumdlist: See: :data:`.LRO_YUMDLIST` .. attribute:: yumslist: See: :data:`.LRO_YUMSLIST` .. attribute:: rpmmdblist: See: :data:`.LRO_RPMMDBLIST` .. attribute:: yumblist: See: :data:`.LRO_YUMBLIST` .. attribute:: hmfcb: See: :data:`.LRO_HMFCB` .. attribute:: sslverifypeer: See :data:`.LRO_SSLVERIFYPEER` .. attribute:: sslverifystatus: See :data:`.LRO_SSLVERIFYSTATUS` .. attribute:: sslverifyhost: See :data:`.LRO_SSLVERIFYHOST` .. attribute:: sslclientcert: See :data:`.LRO_SSLCLIENTCERT` .. attribute:: sslclientkey: See :data:`.LRO_SSLCLIENTKEY` .. attribute:: sslcacert: See :data:`.LRO_SSLCACERT` .. attribute:: proxy_sslverifypeer: See :data:`.LRO_PROXY_SSLVERIFYPEER` .. attribute:: proxy_sslverifyhost: See :data:`.LRO_PROXY_SSLVERIFYHOST` .. attribute:: proxy_sslclientcert: See :data:`.LRO_PROXY_SSLCLIENTCERT` .. attribute:: proxy_sslclientkey: See :data:`.LRO_PROXY_SSLCLIENTKEY` .. attribute:: proxy_sslcacert: See :data:`.LRO_PROXY_SSLCACERT` .. attribute:: ipresolve: See :data:`.LRO_IPRESOLVE` .. attribute:: allowedmirrorfailures: See :data:`.LRO_ALLOWEDMIRRORFAILURES` .. attribute:: adaptivemirrorsorting: See :data:`.LRO_ADAPTIVEMIRRORSORTING` .. attribute:: gnupghomedir: See :data:`.LRO_GNUPGHOMEDIR` .. attribute:: fastestmirrortimeout: See :data:`.LRO_FASTESTMIRRORTIMEOUT` .. attribute:: httpheader: See :data:`.LRO_HTTPHEADER` .. attribute:: offline: See :data:`.LRO_OFFLINE` .. attribute:: httpauthmethods See :data:`.LRO_HTTPAUTHMETHODS` .. attribute:: proxyauthmethods See :data:`.LRO_PROXYAUTHMETHODS` .. attribute:: ftpuseepsv See :data:`.LRO_FTPUSEEPSV` .. attribute:: preservetime See :data:`.LRO_PRESERVETIME` cCsJ|tkr6t|t r6|dk r6ddl}|jdt|g}tjj|||dS)aSet option to :class:`.Handle` directly. :param option: One of: :ref:`handle-options-label` :returns: *None* Example:: # The command: h.setopt(librepo.LRO_URLS, ["http://ftp.linux.ncsu.edu/pub/fedora/linux/releases/17/Everything/i386/os/"]) # is equivalent to: h.urls(["http://ftp.linux.ncsu.edu/pub/fedora/linux/releases/17/Everything/i386/os/"]) NrzJUsing string value for LRO_URLS is deprecated, use list of strings instead) ZLRO_URLS isinstancelistwarningswarnDeprecationWarningrr#setopt)roptionvalr&r r r r)s z Handle.setoptcCsN|tkr|tkrtd|n|tkr:td|jj|f|jt||dS)Nz&Set of attribute '%s' is not supportedz!'%s' object has no attribute '%s') ATTR_TO_LRO ATTR_TO_LRIAttributeError __class__rr))rattrr+r r r __setattr__s zHandle.__setattr__cCsL|tkr|tkrtd|n|tkr:td|jj|ftjj|t|S)Nz'Read of attribute '%s' is not supportedz!'%s' object has no attribute '%s')r-r,r.r/rrr#getinfo)rr0r r r __getattr__s zHandle.__getattr__cCstjj||S)zGet information from :class:`.Handle`. :param option: One of :ref:`handle-info-options-label` :returns: Value for the specified option or *None* if the option is not set. )rr#r2)rr*r r r r2szHandle.getinfoNrcCs,t|trt|}|j|||||||dS)a! **This method is deprecated** - Use :func:`~librepo.download_packages` instead. Download package from the repository specified in the :Class:`~librepo.Handle`. If *base_url* is specified, urls and mirrors specified in the Handle are ignored. Note: If resume is True and checksum_type and checksum are specified and downloaded package already exists, then checksum of the existing package is checked. If checksum matches, then no downloading is done and exception with LRE_ALREADYDOWNLOADED return code is raised. :param url: Relative path to the package in the repository. :param dest: Destination for package. Could be absolute/relative path to directory or filename. :param checksum_type: :ref:`checksum-constants-label`. :param checksum: Checksum value. :param expectedsize: Expected size of the file. If server reports different size, then no download is preformed. :param base_url: Instead of repositories specified in ``Handle`` use repository on this url. :param resume: ``True`` enables resume. Resume means that if local destination file exists, just try to resume download, if not or resume download failed than download whole file again. Example:: h = librepo.Handle() h.setopt(librepo.LRO_URLS, ["http://ftp.linux.ncsu.edu/pub/fedora/linux/releases/17/Everything/i386/os/"]) h.setopt(librepo.LRO_REPOTYPE, librepo.LR_YUMREPO) h.download("Packages/s/sl-3.03-12.fc17.i686.rpm", checksum="0ec8535d0fc00b497d8aef491c3f8b3955f2d84846325ee44851d9de8a36d12c", checksum_type=librepo.CHECKSUM_SHA256) .. note:: If checksum check is disabled in the current ``Handle``, then checksum is NOT checked even if *checksum* and *checksum_type* params are specified! N)r$strr Zdownload_package)rurlrrrrr r!r r r downloads,  zHandle.downloadcCs |dkrt}tjj|||S)aM Perform the specified action - download/locate a repository. :param result: :Class:`~librepo.Result` object or *None* :returns: :Class:`~librepo.Result` object that was passed by *result* parameter or the new one if the parameter was not specified or was *None*. N)Resultrr#perform)rresultr r r r80s zHandle.performcKst|fd|i|S)aL Shortcut for creating a new :Class:`~librepo.PackageTarget` objects. Targets created by this way have automatically setted handle to the current :Class:`~librepo.Handle` object. :param relative_url: Relative par of target (package) URL :returns: New :Class:`~librepo.PackageTarget` r)r)rrkwargsr r r new_packagetarget>s zHandle.new_packagetarget)N) rrrr"r)r1r3r2r r6r8r;r r r r r#s  0 r#c@s eZdZdZddZddZdS)r7a'Librepo result class This class holds information about a downloaded/localised repository. **Attributes:** .. attribute:: rpmmd_repo See: :data:`.LRR_RPMMD_REPO` .. attribute:: yum_repo See: :data:`.LRR_YUM_REPO` .. attribute:: rpmmd_repomd See: :data:`.LRR_RPMMD_REPOMD` .. attribute:: yum_repomd See: :data:`.LRR_YUM_REPOMD` .. attribute:: rpmmd_timestamp See: :data:`.LRR_RPMMD_TIMESTAMP` .. attribute:: yum_timestamp See: :data:`.LRR_YUM_TIMESTAMP` cCstjj||S)zReturns information about a downloaded/localised repository. *option* could be one of: :ref:`result-options-label` )rr7r2)rr*r r r r2iszResult.getinfocCs*|tkrtd|jj|f|jt|S)Nz!'%s' object has no attribute '%s') ATTR_TO_LRRr.r/rr2)rr0r r r r3pszResult.__getattr__N)rrrr"r2r3r r r r r7Isr7cCs tj|S)a Download metadata. *list* is a list of :class:`~librepo.MetadataTarget` objects. Exception is raised only if a nonrecoverable error related to the function itself is meet (Errors related to individual downloads are reported via corresponding MetadataTarget objects) :param list: List of :class:`~.librepo.MetadataTarget` objects. :returns: *None* )rdownload_metadata)r%r r r r=xs r=FcCs tj||S)aj Download list of packages. *list* is a list of :class:`~librepo.PackageTarget` objects. If the *failfast* is True, then whole downloading is stopped immediately when any of download fails (and exception is raised). If the failfast is False, then this function returns after all downloads finish (no matter if successfully or unsuccessfully) and exception is raised only if a nonrecoverable error related to the function itself is meet (Errors related to individual downloads are reported via corresponding PackageTarget objects) :param list: List of :class:`~.librepo.PackageTarget` objects. :param failfast: If *True*, stop whole downloading immediately when any of downloads fails. If *False*, ignore failed download(s) and continue with other downloads. :returns: *None* )rdownload_packages)r%Zfailfastr r r r>sr>cCstj|||S)a, Download specified URL and write it content to opened file descriptor. :param url: Target URL :param fd: Opened file descriptor (To get a file descriptor use for example **os.open()**. :param handle: :Class:`~librepo.Handle` object or *None* :returns: *None* )r download_url)r5fdrr r r r?s r?cCs tj|S)z Get the highest timestamp of the repo's repomd.xml. :param result_object: Used (filled) :Class:`~librepo.Result` :returns: The highest timestamp from repomd (Float) or *0.0* on error. )ryum_repomd_get_age)Z result_objectr r r rAsrAcCs tj||S)aQ ONLY FOR DEVELOPMENT (DEBUGGING) PURPOSES! (Deprecated, use :func:`~log_set_file` instead) When python debug log handler is used, the librepo is **THREAD-UNSAFE**! If used, it overrides logging set by :func:`~log_set_file` and vice versa. :param log_function: Function that will handle the debug messages. :param user_data: An data you want to be passed to the log_function during call. :returns: *None* Example:: def debug_function(msg, _): print(msg) librepo.set_debug_log_handler(debug_function) )rset_debug_log_handler)Z log_functionZ user_datar r r rBsrBcCs tj|S)aySet a filename of a file where logs are going to be written. Note: Only one file could be set at a time. Note: If the LIBREPO_DEBUG environ variable is set and this function is used then the LIBREPO_DEBUG effect will be suppressed. (All debug output will be redirected to the specified file) :param filename: Filename :returns: Id of the handler )r log_set_file)filenamer r r rCs rCcCs tj|S)z/Remove handler. :param handler_id: id )rlog_remove_handler)Z handler_idr r r rEsrE)F)N)N)1r"sysZlibrepo._librepoZlibrepomodulesrZcurrent_modulerZLibrepoExceptionr,r-r<rdirr0isuppergetattrr+setattrendswith startswithrZ RPMMD_FULLZYUM_FULLZ LR_YUM_FULLZRPMMD_REPOMDONLYZYUM_REPOMDONLYZLR_YUM_REPOMDONLYZ RPMMD_BASEXMLZ YUM_BASEXMLZLR_YUM_BASEXMLZ RPMMD_BASEDBZ YUM_BASEDBZ LR_YUM_BASEDBZ RPMMD_HAWKEYZ YUM_HAWKEYZ LR_YUM_HAWKEYr rrr#r7r=r>r?rArBrCrEr r r r _s\           )/   PK] ""__init__.cpython-36.opt-1.pycnu[3 s&a@sdZddlZddlZejeZejZiZ iZ iZ iZ xe eD]ZejsLq>eeeZeeeeejdrnq>ejdreeeddeejdree ejdd<ejdree ejdd<ejd ree ejdd<ejd r>eeed deee ed dj<q>WdZZZdgZZZd d ddgZZZddddgZZ Z!d d ddgZ"Z#Z$ddZ%Gdddej&Z&Gdddej'Z'Gdddej(Z(Gdddej)Z)ddZ*d,d d!Z+d-d"d#Z,d$d%Z-d.d&d'Z.d(d)Z/d*d+Z0dS)/aՊ Version contants ---------------- .. data:: VERSION_MAJOR VERSION_MINOR VERSION_PATCH VERSION Constants with version numbers and whole version string. .. _handle-options-label: :class:`~.Handle` options ------------------------- **LRO_** (aka LibRepo Option) prefixed constants are used to set :class:`.Handle` options via :meth:`~.Handle.setopt` method. This options could be also set by :class:`.Handle` attributes with the same names but in lowercase and without ``LRO_`` prefix. Example:: # The command: h.setopt(librepo.LRO_URLS, ["http://ftp.linux.ncsu.edu/pub/fedora/linux/releases/17/Everything/i386/os/"]) # is equivalent to: h.urls = ["http://ftp.linux.ncsu.edu/pub/fedora/linux/releases/17/Everything/i386/os/"] .. note:: For detailed description of this options consult :class:`.Handle` page. .. data:: LRO_UPDATE *Boolean*. Set to ``True`` if only want update localised or downloaded repository represented by :class:`.Result` object. Update mode is meant to download previously omitted repository file(s). .. data:: LRO_URLS *List or None*. Set repository urls (repository url and baseurl are interchangeable terms in this context). .. data:: LRO_MIRRORLIST *String or None*. **DEPRECATED** Set mirrorlist url (url could point to a metalink mirrorlist or to a simple mirrorlist where each line without ``'#'`` is considered as mirror url). .. data:: LRO_MIRRORLISTURL *String or None*. Mirrorlist URL. .. data:: LRO_METALINKURL *String or None*. Metalink URL. .. data:: LRO_LOCAL *Boolean*. If set to True, no local copy of repository is created and repository is just localized in its current location. When True, url of repository MUST be a local address (e.g. '/home/user/repo' or 'file:///home/user/repo'). .. data:: LRO_HTTPAUTH *Boolean*. If True, all supported methods of HTTP authentication are enabled. .. data:: LRO_USERPWD *String or None*. Set username and password for HTTP authentication. Param must be in format 'username:password'. .. data:: LRO_PROXY *String or None*. Set proxy server address. Port could be specified by different option or by the :[port] suffix of this address. Any protocol prefix (``http://``, ...) will be ignored. .. data:: LRO_PROXYPORT *Integer or None*. Set proxy port number to connect unless it is specified in the proxy address string. None sets default value 1080. .. data:: LRO_PROXYTYPE *Long*. Set type of proxy - could be one of :ref:`proxy-type-label` .. data:: LRO_PROXYAUTH *Boolean*. If True, all supported proxy authentication methods are enabled. If False, only basic authentication method is enabled. .. data:: LRO_PROXYUSERPWD *String or None*. Set username and password for proxy authentication in format 'username:password'. .. data:: LRO_PROGRESSCB *Function or None*. (See: :ref:`callback-progresscb-label`) Set progress callback. Callback must be in format: ``callback(userdata, total_to_download, downloaded)``. If total_to_download is 0, then total size is not known. Total size (total_to_download) could change (grow) among two callback calls (if some download failed and another mirror is tried). .. data:: LRO_PROGRESSDATA *Any object*. Set user data for the progress callback. .. data:: LRO_MAXSPEED *Long or None*. Set maximal allowed speed per download in bytes per second. 0 = unlimited speed - the default value. .. data:: LRO_DESTDIR *String or None*. Set destination directory for downloaded data (metadata or packages). .. data:: LRO_REPOTYPE *Integer*. One of :ref:`repotype-constants-label`. See more :meth:`~.Handle.repotype` Set type of repository. .. data:: LRO_CONNECTTIMEOUT *Integer or None. Set maximal timeout in sec for connection phase. Default value is 30. None as *val* sets the default value. .. data:: LRO_IGNOREMISSING *Boolean*. If you want to localize (LRO_LOCAL is True) a incomplete local repository (eg. only primary and filelists are present but repomd.xml contains more files), you could use LRO_YUMDLIST and specify only file that are present, or use LRO_YUMBLIST and specify files that are not present or use this option. .. data:: LRO_INTERRUPTIBLE *Boolean*. Librepo sets up its own SIGTERM handler. If the SIGTERM signal is catched, the current download is interrupted. .. data:: LRO_USERAGENT *String*. String for User-Agent: header in the http request sent to the remote server. .. data:: LRO_FETCHMIRRORS *Boolean*. With this option enabled, only mirrorlist download and parsing will be performed during :meth:`librepo.Handle.perform`. .. data:: LRO_MAXMIRRORTRIES *Integer or None*. If download fails, try at most the specified number of mirrors. 0 (None) means try all available mirrors. .. data:: LRO_MAXPARALLELDOWNLOADS *Integer or None*. Maximum number of parallel downloads. ``None`` sets default value. .. data:: LRO_MAXDOWNLOADSPERMIRROR *Integer or None*. Maximum number of parallel downloads per mirror. ``None`` sets default value. .. data:: LRO_VARSUB *[(String, String), ...] or None*. Set list of substitutions for variables in ulrs (e.g.: "http://foo/$version/"). ``[("releasever", "f18"), ("basearch", "i386")]`` .. data:: LRO_FASTESTMIRROR *Boolean*. If True, internal mirrorlist is sorted by the determined connection speed, after it is constructed. .. data:: LRO_FASTESTMIRRORCACHE *String or None*. Path to the cache file. If cache file it doesn't exists it will be created. .. data:: LRO_FASTESTMIRRORMAXAGE *Integer or None*. Max age of cache record. Older records will not be used. .. data:: LRO_FASTESTMIRRORCB *Function or None*. (See: :ref:`callback-fastestmirrorcb-label`) Fastest mirror status callback. Its prototype looks like ``callback(userdata, stage, data)`` Where *userdata* are data passed by user via LRO_FASTESTMIRRORDATA. *stage* is value from :ref:`fastestmirror-stages-constants-label`. *data* value depends on *stage* value. See the list of available stages. .. data:: LRO_FASTESTMIRRORDATA *Any object*. User data for fastest mirror status callback. .. data:: LRO_LOWSPEEDTIME *Integer or None*. The time in seconds that the transfer should be below the LRO_LOWSPEEDLIMIT for the library to consider it too slow and abort. Default: 30 (sec) .. data:: LRO_LOWSPEEDLIMIT *Integer or None*. The transfer speed in bytes per second that the transfer should be below during LRO_LOWSPEEDTIME seconds for the library to consider it too slow and abort. Default: 1000 (byte/s) .. data:: LRO_GPGCHECK *Boolean*. Set True to enable gpg check (if available) of downloaded repo. .. data:: LRO_CHECKSUM *Boolean*. Set False/True to disable/enable checksum check. .. note:: Checksum check is enabled by default. .. note:: If checksum check is disabled, then even explicitly specified checksum related params e.g. in :meth:`~librepo.Handle.download` method are ignored and checksum is not checked! .. data:: LRO_YUMDLIST *List of strings*. Some predefined list :ref:`predefined-yumdlists-label`. Set list of yum metadata files to download. e.g. ``["primary", "filelists", "other", "primary_db", "prestodelta"]`` If *val* is None, all metadata files will be downloaded. If *val* is ``[]`` or ``[None]`` only ``repomd.xml`` will be downloaded. .. data:: LRO_YUMSLIST *[(String, String), ...] or None*. Set list of substitutions for repomd records. ``[("group_gz", "group")]` .. data:: LRO_RPMMDDLIST See LRO_YUMDLIST .. data:: LRO_YUMBLIST *List of strings*. Set skiplist of yum metadata files. This files will not be downloaded. .. data:: LRO_RPMMDBLIST See LRO_YUMBLIST .. data:: LRO_HMFCB *Function or None* (See: :ref:`callback-handlemirrorfailurecb-label`) The Handle Mirror Failure Callback is called when a metadata download fails. It provides a detailed information about what exactly failed. Call of this callback doesn't mean that whole downloading failed. If there are other mirrors on the list, these mirrors will be tried. .. data:: LRO_SSLVERIFYPEER *Boolean*. This option determines whether librepo verifies the authenticity of the peer's certificate. This trust is based on a chain of digital signatures, rooted in certification authority (CA) certificates. .. data:: LRO_SSLVERIFYSTATUS *Boolean*. This option determines whether librepo verifies the status of the server cert using the 'Certificate Status Request' TLS extension (aka. OCSP stapling). Note that if this option is enabled but the server does not support the TLS extension, the verification will fail. */ .. data:: LRO_SSLVERIFYHOST *Boolean*. This option determines whether librepo verifies that the server cert is for the server it is known as. .. data:: LRO_SSLCLIENTCERT *String or None*. Path to the PEM format SSL client certificate to use when talking to the server. .. data:: LRO_SSLCLIENTKEY *String or None*. Path to the PEM format SSL client key to use when talking to the server. .. data:: LRO_SSLCACERT *String or None*. Path to a file containing the list of PEM format trusted CA certificates. .. data:: LRO_PROXY_SSLVERIFYPEER *Boolean*. This option determines whether librepo verifies the authenticity of the proxy certificate. This trust is based on a chain of digital signatures, rooted in certification authority (CA) certificates. .. data:: LRO_PROXY_SSLVERIFYHOST *Boolean*. This option determines whether librepo verifies the name of the proxy certificate against the host. .. data:: LRO_PROXY_SSLCLIENTCERT *String or None*. Path to the PEM format SSL client certificate to use when talking to the proxy. .. data:: LRO_PROXY_SSLCLIENTKEY *String or None*. Path to the PEM format SSL client key to use when talking to the proxy. .. data:: LRO_PROXY_SSLCACERT *String or None*. Path to a file containing the list of PEM format trusted CA certificates. Used for proxy. .. data:: LRO_IPRESOLVE *Integer or None* Sets kind of IP addresses to use when resolving host names. Could be one of: :ref:`ipresolve-type-label` .. data:: LRO_ALLOWEDMIRRORFAILURES *Integer or None* If all transfers from a mirror failed (no successful transfer from the mirror exists) and the number of failed downloads is higher or equal to this value the mirror will be skipped (ignored) for all next downloads. **Note:** Number of failed transfers for a single mirror can outreach this number! For example, if you set this value to 1 but you allow 3 parallel downloads it is possible that all three downloads start from the mirror, before any of them can fail. Then, if all three transfers fail, the number of failures for the mirror will be 3, even if this option was set to 1. .. data:: LRO_ADAPTIVEMIRRORSORTING *Integer or None* If enabled, internal list of mirrors for each handle is re-sorted after each finished transfer. The the sorting is based on mirror error rate etc. .. data:: LRO_GNUPGHOMEDIR *String or None* set own GNUPG configuration directory (a dir with keyring). .. data:: LRO_FASTESTMIRRORTIMEOUT *Float of None* Max length of fastest mirror measurement in seconds. Default value is 2.0sec. .. data:: LRO_HTTPHEADER *List of strings or None* List of strings that represent http headers. Each header has format "header_name: content". If you add a header with no content as in 'Accept:' (no data on the right side of the colon), the internally used header will get disabled. With this option you can add new headers, replace internal headers and remove internal headers. To add a header with no content (nothing to the right side of the colon), use the form 'MyHeader;' (note the ending semicolon). Note: Headers must not be CRLF-terminated! .. data:: LRO_OFFLINE *Boolean* Make the handle work only locally, all remote URLs are ignored. Remote mirrorlists/metalinks (if they are specified) are ignored. Fastest mirror check (if enabled) is skiped. .. data:: LRO_HTTPAUTHMETHODS *Long (bitmask)* Bitmask which tell Librepo which auth metods to use. See: :ref:`auth-methods-label` .. data:: LRO_PROXYAUTHMETHODS *Long (bitmask)* Bitmask which tell Librepo which auth metods to use for proxy authentication. See: :ref:`auth-methods-label` .. data:: LRO_FTPUSEEPSV *Boolean* Enable/Disable EPSV (Extended Passive mode) for FTP. .. data:: LRO_PRESERVETIME *Boolean* If enabled, librepo will try to keep timestamps of the downloaded files in sync with that on the remote side. .. _handle-info-options-label: :class:`~.Handle` info options ------------------------------ LRI (aka LibRepo Information) constants are used to get information from :class:`.Handle` via :meth:`~.Handle.getinfo` method. .. data:: LRI_UPDATE .. data:: LRI_URLS .. data:: LRI_MIRRORLIST .. data:: LRI_MIRRORLISTURL .. data:: LRI_METALINKURL .. data:: LRI_LOCAL .. data:: LRI_PROGRESSCB .. data:: LRI_PROGRESSDATA .. data:: LRI_DESTDIR .. data:: LRI_REPOTYPE .. data:: LRI_USERAGENT .. data:: LRI_YUMDLIST .. data:: LRI_YUMSLIST .. data:: LRI_RPMMDDLIST .. data:: LRI_YUMBLIST .. data:: LRI_RPMMDBLIST .. data:: LRI_FETCHMIRRORS .. data:: LRI_MAXMIRRORTRIES .. data:: LRI_VARSUB .. data:: LRI_MIRRORS .. data:: LRI_METALINK .. data:: LRI_FASTESTMIRROR .. data:: LRI_FASTESTMIRRORCACHE .. data:: LRI_FASTESTMIRRORMAXAGE .. data:: LRI_HMFCB .. data:: LRI_SSLVERIFYPEER .. data:: LRI_SSLVERIFYSTATUS .. data:: LRI_SSLVERIFYHOST .. data:: LRI_SSLCLIENTCERT .. data:: LRI_SSLCLIENTKEY .. data:: LRI_SSLCACERT .. data:: LRI_PROXY_SSLVERIFYPEER .. data:: LRI_PROXY_SSLVERIFYHOST .. data:: LRI_PROXY_SSLCLIENTCERT .. data:: LRI_PROXY_SSLCLIENTKEY .. data:: LRI_PROXY_SSLCACERT .. data:: LRI_IPRESOLVE .. data:: LRI_ALLOWEDMIRRORFAILURES .. data:: LRI_ADAPTIVEMIRRORSORTING .. data:: LRI_GNUPGHOMEDIR .. data:: LRI_FASTESTMIRRORTIMEOUT .. data:: LRI_HTTPHEADER .. data:: LRI_OFFLINE .. data:: LRI_HTTPAUTHMETHODS .. data:: LRI_PROXYAUTHMETHODS .. data:: LRI_FTPUSEEPSV .. _proxy-type-label: Proxy type constants -------------------- .. data:: PROXY_HTTP (LR_PROXY_HTTP) .. data:: PROXY_HTTP_1_0 (LR_PROXY_HTTP_1_0) .. data:: PROXY_SOCKS4 (LR_PROXY_SOCKS4) .. data:: PROXY_SOCKS5 (LR_PROXY_SOCKS5) .. data:: PROXY_SOCKS4A (LR_PROXY_SOCKS4A) .. data:: PROXY_SOCKS5_HOSTNAME (LR_PROXY_SOCKS5_HOSTNAME) .. _ipresolve-type-label: Supported IP resolving ---------------------- .. data:: IPRESOLVE_WHATEVER Default value, resolves addresses to all IP versions that your system allows. .. data:: IPRESOLVE_V4 Resolve to IPv4 addresses. .. data:: IPRESOLVE_V6 Resolve to IPv6 addresses. .. _repotype-constants-label: Repo type constants ------------------- .. data:: RPMMDREPO (LR_RPMMDREPO) Classical repository in repo-md format with ``repodata/`` directory. .. data:: YUMREPO (LR_YUMREPO) See RPMMDREPO .. data:: SUSEREPO (LR_SUSEREPO) YaST2 repository (http://en.opensuse.org/openSUSE:Standards_YaST2_Repository_Metadata_content). .. note:: This option is not supported yet! .. data:: DEBREPO (LR_DEBREPO) Debian repository .. note:: This option is not supported yet! .. _predefined-yumdlists-label: Predefined yumdlist lists ------------------------- .. data:: RPMMD_FULL (YUM_FULL, LR_YUM_FULL) Download all repodata files .. data:: RPMMD_REPOMDONLY (YUM_REPOMDONLY, LR_YUM_REPOMDONLY) Download only repomd.xml file .. data:: RPMMD_BASEXML (YUM_BASEXML, LR_YUM_BASEXML) Download only primary.xml, filelists.xml and other.xml .. data:: RPMMD_BASEDB (YUM_BASEDB, LR_YUM_BASEDB) Download only primary, filelists and other databases. .. data:: RPMMD_HAWKEY (YUM_HAWKEY, LR_YUM_HAWKEY) Download only files used by Hawkey (https://github.com/akozumpl/hawkey/). (primary, filelists, prestodelta) .. _auth-methods-label: Auth methods ------------ Supported auth methods for :data:`~.LRO_HTTPAUTHMETHODS` and :data:`~.LRO_PROXYAUTHMETHODS` options. .. data:: LR_AUTH_NONE No auth method enabled. .. data:: LR_AUTH_BASIC HTTP Basic authentication (Default). .. data:: LR_AUTH_DIGEST HTTP Digest authentication. .. data:: LR_AUTH_NEGOTIATE HTTP Negotiate (SPNEGO) authentication. .. data:: LR_AUTH_NTLM HTTP NTLM authentication. .. data:: LR_AUTH_DIGEST_IE HTTP Digest authentication with an IE flavor. .. data:: LR_AUTH_NTLM_WB NTLM delegating to winbind helper. .. data:: LR_AUTH_ONLY This is a meta symbol. OR this value together with a single specific auth value to force libcurl to probe for un-restricted auth and if not, only that single auth algorithm is acceptable. .. data:: LR_AUTH_ANY All suitable methods. .. _fastestmirror-stages-constants-label: Fastest mirror stages --------------------- Values used by fastest mirror callback (:data:`~.LRO_FASTESTMIRRORCB`): .. data:: FMSTAGE_INIT (0) Fastest mirror detection just started. *data* is None. .. data:: FMSTAGE_CACHELOADING (1) Cache file is specified. *data* is path to the cache file. .. data:: FMSTAGE_CACHELOADINGSTATUS (2) Cache loading finished. If successful, *data* is None, otherwise *data* is string with error message. .. data:: FMSTAGE_DETECTION (3) Detection in progress. *data* is number of mirrors that will be pinged. If all times were loaded from cache, this stage is skiped. .. data:: FMSTAGE_FINISHING (4) Detection is done, sorting mirrors, updating cache, etc. *data* is None. .. data:: FMSTAGE_STATUS (5) The very last invocation of fastest mirror callback. If fastest mirror detection was successful *data*, otherwise *data* contain string with error message. .. _error-codes-label: Error codes ----------- LibRepo Error codes. .. data:: LRE_OK (0) Everything is ok. .. data:: LRE_BADFUNCARG (1) Bad function argument(s). .. data:: LRE_BADOPTARG (2) Bad argument for the option in :meth:`~.Handle.setopt`. .. data:: LRE_UNKNOWNOPT (3) Unknown option. .. data:: LRE_CURLSETOPT (4) cURL doesn't know an option used by librepo. Probably too old cURL version is used. .. data:: LRE_ALREADYUSEDRESULT (5) :class:`.Result` object is not "clean" (it has been already used). .. data:: LRE_INCOMPLETERESULT (6) :class:`.Result` object doesn't contain all what is needed. .. data:: LRE_CURLDUP (7) Cannot duplicate cURL handle. No free memory? .. data:: LRE_CURL (8) A cURL error. .. data:: LRE_CURLM (9) A multi cURL handle error. .. data:: LRE_BADSTATUS (10) Error HTTP or FTP status code. .. data:: LRE_TEMPORARYERR (11) An error that should be temporary (e.g. HTTP status codes 500, 502-504, ..) .. data:: LRE_NOTLOCAL (12) URL is not a local address. E.g. in case when :data:`~.LRO_UPDATE` option is ``True`` and URL is a remote address. .. data:: LRE_CANNOTCREATEDIR (13) Cannot create directory for downloaded data. Bad permission? .. data:: LRE_IO (14) Input/Output error. .. data:: LRE_MLBAD (15) Bad mirrorlist or metalink file. E.g. metalink doesn't contain reference to target file (repomd.xml), mirrorlist is empty, .. .. data:: LRE_MLXML (16) Cannot parse metalink xml. Non-valid metalink file? E.g. (metalink doesn't contain needed file, mirrorlist doesn't contain urls, ..) .. data:: LRE_BADCHECKSUM (17) Bad checksum. .. data:: LRE_REPOMDXML (18) Cannot parse repomd.xml file. Non-valid repomd.xml file? .. data:: LRE_NOURL (19) No usable URL found. E.g. bad links or no links in metalink. .. data:: LRE_CANNOTCREATETMP (20) Cannot create temporary directory. .. data:: LRE_UNKNOWNCHECKSUM (21) Unknown type of checksum is needed for verification of one or more files. .. data:: LRE_BADURL (22) Bad URL specified. .. data:: LRE_GPGNOTSUPPORTED (23) OpenPGP protocol is not supported. .. data:: LRE_GPGERROR (24) GPG error. .. data:: LRE_BADGPG (25) Bad GPG signature. .. data:: LRE_INCOMPLETEREPO (26) Repository metadata are not complete. .. data:: LRE_INTERRUPTED (27) Download was interrupted by SIGTERM signal. .. data:: LRE_SIGACTION (28) Sigaction system call failed. .. data:: LRE_ALREADYDOWNLOADED (29) The file is already downloaded and its checksum matches. .. data:: LRE_UNFINISHED (30) Download wasn't (or cannot be) finished. .. data:: LRE_SELECT (31) select() call failed. .. data:: LRE_OPENSSL (32) OpenSSL library related error. .. data:: LRE_MEMORY (33) Cannot allocate more memory. .. data:: LRE_XMLPARSER (34) XML parser error. .. data:: LRE_CBINTERRUPTED (35) Interrupted by user cb. .. data:: LRE_UNKNOWNERROR An unknown error. .. _result-options-label: :class:`~.Result` options ------------------------- LibRepo Result options for use in :meth:`~.Result.getinfo` method. .. data:: LRR_YUM_REPO (deprecated - use LRR_RPMMD_REPO instead) Returns a flat dictionary with local paths to downloaded/localised rpmmd repository and basic repository's information.:: {'repomd': u'/tmp/librepotest-jPMmX5/repodata/repomd.xml', 'url': u'http://127.0.0.1:5000/yum/static/01/' 'destdir': u'/tmp/librepotest-jPMmX5', 'metalink': None, 'mirrorlist': None, 'signature': None, 'primary': u'/tmp/librepotest-jPMmX5/repodata/4543ad62e4d86337cd1949346f9aec976b847b58-primary.xml.gz', 'primary_db': u'/tmp/librepotest-jPMmX5/repodata/735cd6294df08bdf28e2ba113915ca05a151118e-primary.sqlite.bz2', 'filelists': u'/tmp/librepotest-jPMmX5/repodata/aeca08fccd3c1ab831e1df1a62711a44ba1922c9-filelists.xml.gz', 'filelists_db': u'/tmp/librepotest-jPMmX5/repodata/4034dcea76c94d3f7a9616779539a4ea8cac288f-filelists.sqlite.bz2', 'other': u'/tmp/librepotest-jPMmX5/repodata/a8977cdaa0b14321d9acfab81ce8a85e869eee32-other.xml.gz', 'other_db': u'/tmp/librepotest-jPMmX5/repodata/fd96942c919628895187778633001cff61e872b8-other.sqlite.bz2', } .. data:: LRR_RPMMD_REPO Returns a dict with local paths to downloaded/localised rpmmd repository and basic repository's information.:: {'repomd': u'/tmp/librepotest-jPMmX5/repodata/repomd.xml', 'url': u'http://127.0.0.1:5000/yum/static/01/' 'destdir': u'/tmp/librepotest-jPMmX5', 'metalink': None, 'mirrorlist': None, 'signature': None, 'paths': {'primary': u'/tmp/librepotest-jPMmX5/repodata/4543ad62e4d86337cd1949346f9aec976b847b58-primary.xml.gz', 'primary_db': u'/tmp/librepotest-jPMmX5/repodata/735cd6294df08bdf28e2ba113915ca05a151118e-primary.sqlite.bz2', 'filelists': u'/tmp/librepotest-jPMmX5/repodata/aeca08fccd3c1ab831e1df1a62711a44ba1922c9-filelists.xml.gz', 'filelists_db': u'/tmp/librepotest-jPMmX5/repodata/4034dcea76c94d3f7a9616779539a4ea8cac288f-filelists.sqlite.bz2', 'other': u'/tmp/librepotest-jPMmX5/repodata/a8977cdaa0b14321d9acfab81ce8a85e869eee32-other.xml.gz', 'other_db': u'/tmp/librepotest-jPMmX5/repodata/fd96942c919628895187778633001cff61e872b8-other.sqlite.bz2'} } .. data:: LRR_YUM_REPOMD (deprecated - use LRR_RPMMD_REPOMD instead) Returns a flat dict representing a repomd.xml file of downloaded rpmmd repository.:: {'revision': u'1347459931', 'repo_tags': [], 'content_tags': [], 'distro_tags': [], 'primary': {'checksum': u'4543ad62e4d86337cd1949346f9aec976b847b58', 'checksum_open': u'68457ceb8e20bda004d46e0a4dfa4a69ce71db48', 'checksum_open_type': u'sha1', 'checksum_type': u'sha1', 'db_version': 0L, 'location_href': u'repodata/4543ad62e4d86337cd1949346f9aec976b847b58-primary.xml.gz', 'size': 936L, 'size_open': 3385L, 'timestamp': 1347459930L}, 'primary_db': {'checksum': u'735cd6294df08bdf28e2ba113915ca05a151118e', 'checksum_open': u'ba636386312e1b597fc4feb182d04c059b2a77d5', 'checksum_open_type': u'sha1', 'checksum_type': u'sha1', 'db_version': 10L, 'location_href': u'repodata/735cd6294df08bdf28e2ba113915ca05a151118e-primary.sqlite.bz2', 'size': 2603L, 'size_open': 23552L, 'timestamp': 1347459931L}, 'filelists': {'checksum': u'aeca08fccd3c1ab831e1df1a62711a44ba1922c9', 'checksum_open': u'52d30ae3162ca863c63c345ffdb7f0e10c1414a5', 'checksum_open_type': u'sha1', 'checksum_type': u'sha1', 'db_version': 0L, 'location_href': u'repodata/aeca08fccd3c1ab831e1df1a62711a44ba1922c9-filelists.xml.gz', 'size': 43310L, 'size_open': 735088L, 'timestamp': 1347459930L}, 'filelists_db': {'checksum': u'4034dcea76c94d3f7a9616779539a4ea8cac288f', 'checksum_open': u'949c6b7b605b2bc66852630c841a5003603ca5b2', 'checksum_open_type': u'sha1', 'checksum_type': u'sha1', 'db_version': 10L, 'location_href': u'repodata/4034dcea76c94d3f7a9616779539a4ea8cac288f-filelists.sqlite.bz2', 'size': 22575L, 'size_open': 201728L, 'timestamp': 1347459931L}, 'other': {'checksum': u'a8977cdaa0b14321d9acfab81ce8a85e869eee32', 'checksum_open': u'4b5b8874fb233a626b03b3260a1aa08dce90e81a', 'checksum_open_type': u'sha1', 'checksum_type': u'sha1', 'db_version': 0L, 'location_href': u'repodata/a8977cdaa0b14321d9acfab81ce8a85e869eee32-other.xml.gz', 'size': 807L, 'size_open': 1910L, 'timestamp': 1347459930L}, 'other_db': {'checksum': u'fd96942c919628895187778633001cff61e872b8', 'checksum_open': u'c5262f62b6b3360722b9b2fb5d0a9335d0a51112', 'checksum_open_type': u'sha1', 'checksum_type': u'sha1', 'db_version': 10L, 'location_href': u'repodata/fd96942c919628895187778633001cff61e872b8-other.sqlite.bz2', 'size': 1407L, 'size_open': 8192L, 'timestamp': 1347459931L}, } .. data:: LRR_RPMMD_REPOMD Returns a dict representing a repomd.xml file of downloaded rpmmd repository.:: {'revision': u'1347459931', 'repo_tags': [], 'content_tags': [], 'distro_tags': [], 'records': {'primary': {'checksum': u'4543ad62e4d86337cd1949346f9aec976b847b58', 'checksum_open': u'68457ceb8e20bda004d46e0a4dfa4a69ce71db48', 'checksum_open_type': u'sha1', 'checksum_type': u'sha1', 'db_version': 0L, 'location_href': u'repodata/4543ad62e4d86337cd1949346f9aec976b847b58-primary.xml.gz', 'size': 936L, 'size_open': 3385L, 'timestamp': 1347459930L}, 'primary_db': {'checksum': u'735cd6294df08bdf28e2ba113915ca05a151118e', 'checksum_open': u'ba636386312e1b597fc4feb182d04c059b2a77d5', 'checksum_open_type': u'sha1', 'checksum_type': u'sha1', 'db_version': 10L, 'location_href': u'repodata/735cd6294df08bdf28e2ba113915ca05a151118e-primary.sqlite.bz2', 'size': 2603L, 'size_open': 23552L, 'timestamp': 1347459931L}}, 'filelists': {'checksum': u'aeca08fccd3c1ab831e1df1a62711a44ba1922c9', 'checksum_open': u'52d30ae3162ca863c63c345ffdb7f0e10c1414a5', 'checksum_open_type': u'sha1', 'checksum_type': u'sha1', 'db_version': 0L, 'location_href': u'repodata/aeca08fccd3c1ab831e1df1a62711a44ba1922c9-filelists.xml.gz', 'size': 43310L, 'size_open': 735088L, 'timestamp': 1347459930L}, 'filelists_db': {'checksum': u'4034dcea76c94d3f7a9616779539a4ea8cac288f', 'checksum_open': u'949c6b7b605b2bc66852630c841a5003603ca5b2', 'checksum_open_type': u'sha1', 'checksum_type': u'sha1', 'db_version': 10L, 'location_href': u'repodata/4034dcea76c94d3f7a9616779539a4ea8cac288f-filelists.sqlite.bz2', 'size': 22575L, 'size_open': 201728L, 'timestamp': 1347459931L}, 'other': {'checksum': u'a8977cdaa0b14321d9acfab81ce8a85e869eee32', 'checksum_open': u'4b5b8874fb233a626b03b3260a1aa08dce90e81a', 'checksum_open_type': u'sha1', 'checksum_type': u'sha1', 'db_version': 0L, 'location_href': u'repodata/a8977cdaa0b14321d9acfab81ce8a85e869eee32-other.xml.gz', 'size': 807L, 'size_open': 1910L, 'timestamp': 1347459930L}, 'other_db': {'checksum': u'fd96942c919628895187778633001cff61e872b8', 'checksum_open': u'c5262f62b6b3360722b9b2fb5d0a9335d0a51112', 'checksum_open_type': u'sha1', 'checksum_type': u'sha1', 'db_version': 10L, 'location_href': u'repodata/fd96942c919628895187778633001cff61e872b8-other.sqlite.bz2', 'size': 1407L, 'size_open': 8192L, 'timestamp': 1347459931L}, } .. data:: LRR_RPMMD_TIMESTAMP (LRR_YUM_TIMESTAMP) Returns the highest timestamp from all records in the repomd. See: http://yum.baseurl.org/gitweb?p=yum.git;a=commitdiff;h=59d3d67f .. _endcb-statuses-label: Transfer statuses for endcb of :class:`~.PackageTarget` ------------------------------------------------------- .. data:: TRANSFER_SUCCESSFUL .. data:: TRANSFER_ALREADYEXISTS .. data:: TRANSFER_ERROR Callbacks prototypes -------------------- Some librepo's functions and classes can take a callbacks in their arguments. This section contain the callbacks prototypes and explanation of their arguments. By default all callbacks should return *None* (this is default behaviour of python function if it doesn't have a specified return statement - it returns None). But there are some callbacks that can return a specific values defined in :ref:`callbacks-return-values`. .. _callback-progresscb-label: Progress callback - progresscb ------------------------------ ``progresscb(userdata, totalsize, downloaded)`` Callback frequently called during a download. :userdata: User specified data or *None* :totalsize: Total size (in bytes) of the target (float). :downloaded: Currently downloaded size (in bytes). :returns: This callback can return values from :ref:`callbacks-return-values` .. _callback-endcb-label: End callback - endcb -------------------- ``endcb(userdata, status, msg)`` Callback called when a transfer is done either successfully or unsuccessfully. :userdata: User specified data or *None* :status: :ref:`endcb-statuses-label` :msg: String with error message or *None* :returns: This callback can return values from :ref:`callbacks-return-values` .. _callback-mirrorfailurecb-label: Mirror Failure Callback - mirrorfailurecb ----------------------------------------- ``mirrorfailurecb(userdata, msg, url)`` Callback called when a transfer failed. :userdata: User specified data or *None* :msg: String with error message :url: String with mirror URL :returns: This callback can return values from :ref:`callbacks-return-values` .. _callback-fastestmirrorcb-label: Fastestmirror callback - fastestmirrorcb ---------------------------------------- ``fastestmirrorcb(userdata, stage, data)`` :userdata: User specified data or *None* :stage: :ref:`fastestmirror-stages-constants-label` :data: Content of *data* is different for different stages. See :ref:`fastestmirror-stages-constants-label` :returns: This callback must return *None* each other value will be ignored. .. _callback-handlemirrorfailurecb-label: Handle Mirror Failure Callback - hmfcb -------------------------------------- ``hmfcb(userdata, msg, url, metadata)`` Callback called when a download of a metadata during :meth:`~.Handle.perform()` fails. :userdata: User specified data or *None* :msg: String with error message :url: String with mirror URL :metadata: String with metadata name ("primary", "filelists", ...) :returns: This callback can return values from :ref:`callbacks-return-values` .. _callbacks-return-values: Callbacks return values ----------------------- Each callback can safely return ``None`` (this is implicit return value when no return statement is defined). ``return None`` is equivalent for ``return librepo.CB_OK``. .. data:: CB_OK Everything is OK .. data:: CB_ABORT Abort just the current transfer. Note: If failfast option for the downloading is enabled, the whole downloading will be aborted. .. data:: CB_ERROR Abort the whole downloading (all transfers). (Note: This code is automatically internally returned when an exception is raised in the callback.) .. _checksum-constants-label: Checksum (hash) type constants ------------------------------ .. data:: MD5 (CHECKSUM_MD5) .. data:: SHA1 (CHECKSUM_SHA1) .. data:: SHA224 (CHECKSUM_SHA224) .. data:: SHA256 (CHECKSUM_SHA256) .. data:: SHA384 (CHECKSUM_SHA384) .. data:: SHA512 (CHECKSUM_SHA512) NZ _SENTINELZLR_ZLRO_ZLRI_ZLRR_Z LR_CHECKSUM_ ZprimaryZ filelistsotherZ primary_dbZ filelists_dbZother_dbZ prestodeltacCs|j}tj|tS)z Convert string with name of hash function to numeric value that represents the hash in createrepo_c. :param name: Checksum name (e.g. "sha256", "sha512", ...) :returns: Integer value (from :ref:`checksum-constants-label`) )lower_CHECKSUM_STR_TO_VAL_MAPgetCHECKSUM_UNKNOWN)namer /usr/lib64/python3.6/__init__.pychecksum_str_to_typesr c@seZdZdddZdS)MetadataTargetNcCstjj|||||||dS)N)_librepor__init__)selfhandlecbdata progresscbmirrorfailurecbendcbZ gnupghomedirr r r rszMetadataTarget.__init__)NNNNNN)__name__ __module__ __qualname__rr r r r rsrc @s4eZdZdZdedddddddddddf ddZdS) PackageTargetzg Represent a single package that will be downloaded by :func:`~librepo.download_packages`. NrFcCs,tjj|| ||||||||| | | | |dS)a_ :param relative_url: Target URL. If *handle* or *base_url* specified, the *url* can be (and logically should be) only a relative part of path. :param dest: Destination filename or directory (file basename will be derived from the relative_url). If *None* current working directory will be used. :param checksum_type: :ref:`checksum-constants-label` :param checksum: Expected checksum value. :param expectedsize: Expected size of the target. If server reports different size, then download won't be performed. :param base_url: Base part of URL :param resume: If True then downloader will try to resume download if the destination file already exists. If the file doesn't exist yet, it will be downloaded. :param progresscb: :ref:`callback-progresscb-label` :param cbdata: User data for the callback. :param handle: :class:`~librepo.Handle` :param endcb: :ref:`callback-endcb-label` :param mirrorfailurecb: See :ref:`callback-mirrorfailurecb-label` :param byterangestart: Start downloading from the specified byte. :param byterangeend: Stop downloading at the specified byte. *Note: If the byterangeend is less or equal to byterangestart, then it is ignored!* N)rrr)r relative_urldest checksum_typechecksum expectedsizebase_urlresumerrrrrZbyterangestartZ byterangeendr r r rs zPackageTarget.__init__)rrr__doc__r rr r r r rs rc@sXeZdZdZddZddZddZdd Zd ed d d d fd d Z dddZ ddZ d S)HandleaLibrepo handle class. Handle hold information about a repository and configuration for downloading from the repository. **Attributes:** .. attribute:: update: See: :data:`.LRO_UPDATE` .. attribute:: urls: See: :data:`.LRO_URLS` .. attribute:: mirrorlist: See: :data:`.LRO_MIRRORLIST` .. attribute:: mirrorlisturl: See: :data:`.LRO_MIRRORLISTURL` .. attribute:: metalinkurl: See: :data:`.LRO_METALINKURL` .. attribute:: local: See: :data:`.LRO_LOCAL` .. attribute:: httpauth: See: :data:`.LRO_HTTPAUTH` .. attribute:: userpwd: See: :data:`.LRO_USERPWD` .. attribute:: proxy: See: :data:`.LRO_PROXY` .. attribute:: proxyport: See: :data:`.LRO_PROXYPORT` .. attribute:: proxytype: See: :data:`.LRO_PROXYTYPE` .. attribute:: proxyauth: See: :data:`.LRO_PROXYAUTH` .. attribute:: proxyuserpwd: See: :data:`.LRO_PROXYUSERPWD` .. attribute:: progresscb: See: :data:`.LRO_PROGRESSCB` .. attribute:: progressdata: See: :data:`.LRO_PROGRESSDATA` .. attribute:: maxspeed: See: :data:`.LRO_MAXSPEED` .. attribute:: destdir: See: :data:`.LRO_DESTDIR` .. attribute:: repotype: See: :data:`.LRO_REPOTYPE` .. attribute:: connecttimeout: See: :data:`.LRO_CONNECTTIMEOUT` .. attribute:: ignoremissing: See: :data:`.LRO_IGNOREMISSING` .. attribute:: interruptible: See: :data:`.LRO_INTERRUPTIBLE` .. attribute:: useragent: See: :data:`.LRO_USERAGENT` .. attribute:: fetchmirrors: See: :data:`.LRO_FETCHMIRRORS` .. attribute:: maxmirrortries: See: :data:`.LRO_MAXMIRRORTRIES` .. attribute:: maxparalleldownloads: See: :data:`.LRO_MAXPARALLELDOWNLOADS` .. attribute:: maxdownloadspermirror: See: :data:`.LRO_MAXDOWNLOADSPERMIRROR` .. attribute:: varsub: See: :data:`.LRO_VARSUB` .. attribute:: fastestmirror: See: :data:`.LRO_FASTESTMIRROR` .. attribute:: fastestmirrorcache: See: :data:`.LRO_FASTESTMIRRORCACHE` .. attribute:: fastestmirrormaxage: See: :data:`.LRO_FASTESTMIRRORMAXAGE` .. attribute:: fastestmirrorcb: See: :data:`.LRO_FASTESTMIRRORCB` .. attribute:: fastestmirrordata: See: :data:`.LRO_FASTESTMIRRORDATA` .. attribute:: lowspeedtime: See: :data:`.LRO_LOWSPEEDTIME` .. attribute:: lowspeedlimit: See: :data:`.LRO_LOWSPEEDLIMIT` .. attribute:: gpgcheck: See: :data:`.LRO_GPGCHECK` .. attribute:: checksum: See: :data:`.LRO_CHECKSUM` .. attribute:: rpmmddlist: See: :data:`.LRO_RPMMDDLIST` .. attribute:: yumdlist: See: :data:`.LRO_YUMDLIST` .. attribute:: yumslist: See: :data:`.LRO_YUMSLIST` .. attribute:: rpmmdblist: See: :data:`.LRO_RPMMDBLIST` .. attribute:: yumblist: See: :data:`.LRO_YUMBLIST` .. attribute:: hmfcb: See: :data:`.LRO_HMFCB` .. attribute:: sslverifypeer: See :data:`.LRO_SSLVERIFYPEER` .. attribute:: sslverifystatus: See :data:`.LRO_SSLVERIFYSTATUS` .. attribute:: sslverifyhost: See :data:`.LRO_SSLVERIFYHOST` .. attribute:: sslclientcert: See :data:`.LRO_SSLCLIENTCERT` .. attribute:: sslclientkey: See :data:`.LRO_SSLCLIENTKEY` .. attribute:: sslcacert: See :data:`.LRO_SSLCACERT` .. attribute:: proxy_sslverifypeer: See :data:`.LRO_PROXY_SSLVERIFYPEER` .. attribute:: proxy_sslverifyhost: See :data:`.LRO_PROXY_SSLVERIFYHOST` .. attribute:: proxy_sslclientcert: See :data:`.LRO_PROXY_SSLCLIENTCERT` .. attribute:: proxy_sslclientkey: See :data:`.LRO_PROXY_SSLCLIENTKEY` .. attribute:: proxy_sslcacert: See :data:`.LRO_PROXY_SSLCACERT` .. attribute:: ipresolve: See :data:`.LRO_IPRESOLVE` .. attribute:: allowedmirrorfailures: See :data:`.LRO_ALLOWEDMIRRORFAILURES` .. attribute:: adaptivemirrorsorting: See :data:`.LRO_ADAPTIVEMIRRORSORTING` .. attribute:: gnupghomedir: See :data:`.LRO_GNUPGHOMEDIR` .. attribute:: fastestmirrortimeout: See :data:`.LRO_FASTESTMIRRORTIMEOUT` .. attribute:: httpheader: See :data:`.LRO_HTTPHEADER` .. attribute:: offline: See :data:`.LRO_OFFLINE` .. attribute:: httpauthmethods See :data:`.LRO_HTTPAUTHMETHODS` .. attribute:: proxyauthmethods See :data:`.LRO_PROXYAUTHMETHODS` .. attribute:: ftpuseepsv See :data:`.LRO_FTPUSEEPSV` .. attribute:: preservetime See :data:`.LRO_PRESERVETIME` cCsJ|tkr6t|t r6|dk r6ddl}|jdt|g}tjj|||dS)aSet option to :class:`.Handle` directly. :param option: One of: :ref:`handle-options-label` :returns: *None* Example:: # The command: h.setopt(librepo.LRO_URLS, ["http://ftp.linux.ncsu.edu/pub/fedora/linux/releases/17/Everything/i386/os/"]) # is equivalent to: h.urls(["http://ftp.linux.ncsu.edu/pub/fedora/linux/releases/17/Everything/i386/os/"]) NrzJUsing string value for LRO_URLS is deprecated, use list of strings instead) ZLRO_URLS isinstancelistwarningswarnDeprecationWarningrr#setopt)roptionvalr&r r r r)s z Handle.setoptcCsN|tkr|tkrtd|n|tkr:td|jj|f|jt||dS)Nz&Set of attribute '%s' is not supportedz!'%s' object has no attribute '%s') ATTR_TO_LRO ATTR_TO_LRIAttributeError __class__rr))rattrr+r r r __setattr__s zHandle.__setattr__cCsL|tkr|tkrtd|n|tkr:td|jj|ftjj|t|S)Nz'Read of attribute '%s' is not supportedz!'%s' object has no attribute '%s')r-r,r.r/rrr#getinfo)rr0r r r __getattr__s zHandle.__getattr__cCstjj||S)zGet information from :class:`.Handle`. :param option: One of :ref:`handle-info-options-label` :returns: Value for the specified option or *None* if the option is not set. )rr#r2)rr*r r r r2szHandle.getinfoNrcCs,t|trt|}|j|||||||dS)a! **This method is deprecated** - Use :func:`~librepo.download_packages` instead. Download package from the repository specified in the :Class:`~librepo.Handle`. If *base_url* is specified, urls and mirrors specified in the Handle are ignored. Note: If resume is True and checksum_type and checksum are specified and downloaded package already exists, then checksum of the existing package is checked. If checksum matches, then no downloading is done and exception with LRE_ALREADYDOWNLOADED return code is raised. :param url: Relative path to the package in the repository. :param dest: Destination for package. Could be absolute/relative path to directory or filename. :param checksum_type: :ref:`checksum-constants-label`. :param checksum: Checksum value. :param expectedsize: Expected size of the file. If server reports different size, then no download is preformed. :param base_url: Instead of repositories specified in ``Handle`` use repository on this url. :param resume: ``True`` enables resume. Resume means that if local destination file exists, just try to resume download, if not or resume download failed than download whole file again. Example:: h = librepo.Handle() h.setopt(librepo.LRO_URLS, ["http://ftp.linux.ncsu.edu/pub/fedora/linux/releases/17/Everything/i386/os/"]) h.setopt(librepo.LRO_REPOTYPE, librepo.LR_YUMREPO) h.download("Packages/s/sl-3.03-12.fc17.i686.rpm", checksum="0ec8535d0fc00b497d8aef491c3f8b3955f2d84846325ee44851d9de8a36d12c", checksum_type=librepo.CHECKSUM_SHA256) .. note:: If checksum check is disabled in the current ``Handle``, then checksum is NOT checked even if *checksum* and *checksum_type* params are specified! N)r$strr Zdownload_package)rurlrrrrr r!r r r downloads,  zHandle.downloadcCs |dkrt}tjj|||S)aM Perform the specified action - download/locate a repository. :param result: :Class:`~librepo.Result` object or *None* :returns: :Class:`~librepo.Result` object that was passed by *result* parameter or the new one if the parameter was not specified or was *None*. N)Resultrr#perform)rresultr r r r80s zHandle.performcKst|fd|i|S)aL Shortcut for creating a new :Class:`~librepo.PackageTarget` objects. Targets created by this way have automatically setted handle to the current :Class:`~librepo.Handle` object. :param relative_url: Relative par of target (package) URL :returns: New :Class:`~librepo.PackageTarget` r)r)rrkwargsr r r new_packagetarget>s zHandle.new_packagetarget)N) rrrr"r)r1r3r2r r6r8r;r r r r r#s  0 r#c@s eZdZdZddZddZdS)r7a'Librepo result class This class holds information about a downloaded/localised repository. **Attributes:** .. attribute:: rpmmd_repo See: :data:`.LRR_RPMMD_REPO` .. attribute:: yum_repo See: :data:`.LRR_YUM_REPO` .. attribute:: rpmmd_repomd See: :data:`.LRR_RPMMD_REPOMD` .. attribute:: yum_repomd See: :data:`.LRR_YUM_REPOMD` .. attribute:: rpmmd_timestamp See: :data:`.LRR_RPMMD_TIMESTAMP` .. attribute:: yum_timestamp See: :data:`.LRR_YUM_TIMESTAMP` cCstjj||S)zReturns information about a downloaded/localised repository. *option* could be one of: :ref:`result-options-label` )rr7r2)rr*r r r r2iszResult.getinfocCs*|tkrtd|jj|f|jt|S)Nz!'%s' object has no attribute '%s') ATTR_TO_LRRr.r/rr2)rr0r r r r3pszResult.__getattr__N)rrrr"r2r3r r r r r7Isr7cCs tj|S)a Download metadata. *list* is a list of :class:`~librepo.MetadataTarget` objects. Exception is raised only if a nonrecoverable error related to the function itself is meet (Errors related to individual downloads are reported via corresponding MetadataTarget objects) :param list: List of :class:`~.librepo.MetadataTarget` objects. :returns: *None* )rdownload_metadata)r%r r r r=xs r=FcCs tj||S)aj Download list of packages. *list* is a list of :class:`~librepo.PackageTarget` objects. If the *failfast* is True, then whole downloading is stopped immediately when any of download fails (and exception is raised). If the failfast is False, then this function returns after all downloads finish (no matter if successfully or unsuccessfully) and exception is raised only if a nonrecoverable error related to the function itself is meet (Errors related to individual downloads are reported via corresponding PackageTarget objects) :param list: List of :class:`~.librepo.PackageTarget` objects. :param failfast: If *True*, stop whole downloading immediately when any of downloads fails. If *False*, ignore failed download(s) and continue with other downloads. :returns: *None* )rdownload_packages)r%Zfailfastr r r r>sr>cCstj|||S)a, Download specified URL and write it content to opened file descriptor. :param url: Target URL :param fd: Opened file descriptor (To get a file descriptor use for example **os.open()**. :param handle: :Class:`~librepo.Handle` object or *None* :returns: *None* )r download_url)r5fdrr r r r?s r?cCs tj|S)z Get the highest timestamp of the repo's repomd.xml. :param result_object: Used (filled) :Class:`~librepo.Result` :returns: The highest timestamp from repomd (Float) or *0.0* on error. )ryum_repomd_get_age)Z result_objectr r r rAsrAcCs tj||S)aQ ONLY FOR DEVELOPMENT (DEBUGGING) PURPOSES! (Deprecated, use :func:`~log_set_file` instead) When python debug log handler is used, the librepo is **THREAD-UNSAFE**! If used, it overrides logging set by :func:`~log_set_file` and vice versa. :param log_function: Function that will handle the debug messages. :param user_data: An data you want to be passed to the log_function during call. :returns: *None* Example:: def debug_function(msg, _): print(msg) librepo.set_debug_log_handler(debug_function) )rset_debug_log_handler)Z log_functionZ user_datar r r rBsrBcCs tj|S)aySet a filename of a file where logs are going to be written. Note: Only one file could be set at a time. Note: If the LIBREPO_DEBUG environ variable is set and this function is used then the LIBREPO_DEBUG effect will be suppressed. (All debug output will be redirected to the specified file) :param filename: Filename :returns: Id of the handler )r log_set_file)filenamer r r rCs rCcCs tj|S)z/Remove handler. :param handler_id: id )rlog_remove_handler)Z handler_idr r r rEsrE)F)N)N)1r"sysZlibrepo._librepoZlibrepomodulesrZcurrent_modulerZLibrepoExceptionr,r-r<rdirr0isuppergetattrr+setattrendswith startswithrZ RPMMD_FULLZYUM_FULLZ LR_YUM_FULLZRPMMD_REPOMDONLYZYUM_REPOMDONLYZLR_YUM_REPOMDONLYZ RPMMD_BASEXMLZ YUM_BASEXMLZLR_YUM_BASEXMLZ RPMMD_BASEDBZ YUM_BASEDBZ LR_YUM_BASEDBZ RPMMD_HAWKEYZ YUM_HAWKEYZ LR_YUM_HAWKEYr rrr#r7r=r>r?rArBrCrEr r r r _s\           )/   PK]G]QQmetadata.cpython-38.pycnu[U e5dD @sddlZddlZddlZddlZddlZddlZddlZddlZddlZddl Z ddl Z ddl Z ddl Z ddl Z ddlmZddlmZddlmZddlmZddl mZddd d d d d dddg ZGdd d eZGddde ddZGdddejZGdddZGdddZGdddeZ GdddZ!GdddZ"Gd d!d!e Z#Gd"d#d#eZ$d$d Z%d%d Z&d&dZ'd'dZ(d(d Z)d)d Z*d*dZ+dS)+N) ConfigParser)suppress) import_module)MetaPathFinder)starmap DistributionDistributionFinderPackageNotFoundError distribution distributions entry_pointsfilesmetadatarequiresversionc@seZdZdZdS)r zThe package was not found.N)__name__ __module__ __qualname____doc__rr*/usr/lib64/python3.8/importlib/metadata.pyr %sc@sVeZdZdZedZddZeddZ e ddZ e d d Z d d Z d dZdS) EntryPointzAn entry point as defined by Python packaging conventions. See `the packaging docs on entry points `_ for more information. zH(?P[\w.]+)\s*(:\s*(?P[\w.]+)\s*)?((?P\[.*\])\s*)?$cCsD|j|j}t|d}td|dp,dd}tt ||S)zLoad the entry point from its definition. If only a module is indicated by the value, return that module. Otherwise, return the named object. moduleNattr.) patternmatchvaluergroupfiltersplit functoolsreducegetattr)selfrrattrsrrrloadGszEntryPoint.loadcCs(|j|j}ttd|dp"dS)Nz\w+extrasr)rrrlistrefinditerr)r%rrrrr(QszEntryPoint.extrascsfddDS)Ncs,g|]$}|D]\}}|||qqSritems).0rnamerclsconfigrr Xs z+EntryPoint._from_config..)sectionsr0rr0r _from_configVs zEntryPoint._from_configcCsNtdd}t|_z||Wn$tk rB|t|YnXt |S)N=)Z delimiters) rstrZ optionxformZ read_stringAttributeErrorZreadfpioStringIOrr5)r1textr2rrr _from_text^s zEntryPoint._from_textcCst|j|fS)zO Supply iter so one may construct dicts of EntryPoints easily. )iterr/r%rrr__iter__jszEntryPoint.__iter__cCs|j|j|j|jffSN) __class__r/rrr>rrr __reduce__pszEntryPoint.__reduce__N)rrrrr*compilerr'propertyr( classmethodr5r<r?rBrrrrr)s    rZEntryPointBasezname value groupc@s*eZdZdZd ddZddZddZd S) PackagePathz"A reference to a path in a packageutf-8c Cs0|j|d}|W5QRSQRXdS)Nencodinglocateopenread)r%rIstreamrrr read_textzszPackagePath.read_textc Cs.|d}|W5QRSQRXdS)NrbrJ)r%rNrrr read_binary~szPackagePath.read_binarycCs |j|S)z'Return a path-like object for this path)dist locate_filer>rrrrKszPackagePath.locateN)rG)rrrrrOrQrKrrrrrFws rFc@seZdZddZddZdS)FileHashcCs|d\|_}|_dS)Nr6) partitionmoder)r%spec_rrr__init__szFileHash.__init__cCsd|j|jS)Nz)formatrVrr>rrr__repr__szFileHash.__repr__N)rrrrYr[rrrrrTsrTc@seZdZdZejddZejddZeddZ edd Z e d d Z e d d Z eddZeddZeddZeddZddZddZeddZddZddZed d!Ze d"d#Ze d$d%Zd&S)'rzA Python distribution package.cCsdS)zAttempt to load metadata file given by the name. :param filename: The name of the file in the distribution info. :return: The text if found, otherwise None. Nrr%filenamerrrrOszDistribution.read_textcCsdS)z[ Given a path to a file in this distribution, return a path to it. Nrr%pathrrrrSszDistribution.locate_filecCsD|D].}|tj|d}t|d}|dk r|Sqt|dS)afReturn the Distribution for the given package name. :param name: The name of the distribution package to search for. :return: The Distribution instance (or subclass thereof) for the named package, if found. :raises PackageNotFoundError: When the named package's distribution metadata cannot be found. r/N)_discover_resolversrContextnextr )r1r/resolverZdistsrRrrr from_names   zDistribution.from_namec sJ|ddr|rtdp*tjf|tjfdd|DS)aReturn an iterable of Distribution objects for all packages. Pass a ``context`` or pass keyword arguments for constructing a context. :context: A ``DistributionFinder.Context`` object. :return: Iterable of Distribution objects for all packages. contextNz cannot accept context and kwargsc3s|]}|VqdSr@r)r.rdrfrr sz(Distribution.discover..)pop ValueErrorrrb itertoolschain from_iterablera)r1kwargsrrgrdiscovers zDistribution.discovercCstt|S)zReturn a Distribution for the indicated metadata path :param path: a string or path-like object :return: a concrete Distribution instance for the path )PathDistributionpathlibPath)r_rrratszDistribution.atcCsddtjD}td|S)z#Search the meta_path for resolvers.css|]}t|ddVqdS)find_distributionsN)r$)r.finderrrrrhsz3Distribution._discover_resolvers..N)sys meta_pathr )Zdeclaredrrrrasz Distribution._discover_resolverscCs(|dp|dp|d}t|S)zReturn the parsed metadata for this Distribution. The returned object will have keys that name the various bits of metadata. See PEP 566 for details. ZMETADATAzPKG-INFOr)rOemailZmessage_from_stringr%r;rrrrs  zDistribution.metadatacCs |jdS)z;Return the 'Version' metadata for the distribution package.ZVersion)rr>rrrrszDistribution.versioncCst|dS)Nzentry_points.txt)rr<rOr>rrrr szDistribution.entry_pointscs6p}dfdd }|o4tt|t|S)aBFiles in this distribution. :return: List of PackagePath for this distribution or None Result is `None` if the metadata file that enumerates files (i.e. RECORD for dist-info or SOURCES.txt for egg-info) is missing. Result may be empty if the metadata exists but is empty. Ncs6t|}|rt|nd|_|r&t|nd|_|_|Sr@)rFrThashintsizerR)r/rzZsize_strresultr>rr make_files z%Distribution.files..make_file)NN)_read_files_distinfo_read_files_egginfor)rcsvreader)r%Z file_linesr~rr>rr s zDistribution.filescCs|d}|o|S)z* Read the lines of RECORD ZRECORD)rO splitlinesryrrrrs z!Distribution._read_files_distinfocCs|d}|otdj|S)z` SOURCES.txt might contain literal commas, so wrap each line in quotes. z SOURCES.txtz"{}")rOmaprZrryrrrrs z Distribution._read_files_egginfocCs|p|}|ot|S)z6Generated requirements specified for this Distribution)_read_dist_info_reqs_read_egg_info_reqsr))r%ZreqsrrrrszDistribution.requirescCs |jdS)Nz Requires-Dist)rZget_allr>rrrrsz!Distribution._read_dist_info_reqscCs|d}|o||S)Nz requires.txt)rO_deps_from_requires_text)r%sourcerrrr s z Distribution._read_egg_info_reqscCs4||}ddt|tdD}||S)NcSs&i|]\}}|tttd|qS)line)r)roperator itemgetter)r.sectionZresultsrrr 'sz9Distribution._deps_from_requires_text..r)_read_sectionsrrkgroupbyrr%_convert_egg_info_reqs_to_simple_reqs)r1rZ section_pairsr4rrrr$s z%Distribution._deps_from_requires_textccs<d}td|D](}td|}|r.|d}qtVqdS)Nz \[(.*)\]$)r r*rrlocals)linesrrZ section_matchrrrr.s  zDistribution._read_sectionsc#sBddfdd}|D] \}}|D]}|||Vq(qdS)a Historically, setuptools would solicit and store 'extra' requirements, including those with environment markers, in separate sections. More modern tools expect each dependency to be defined separately, with any relevant extras and environment markers attached directly to that requirement. This method converts the former to the latter. See _test_deps_from_requires_text for an example. cSs|odj|dS)Nzextra == "{name}"r`)rZr`rrrmake_conditionCszJDistribution._convert_egg_info_reqs_to_simple_reqs..make_conditioncsX|pd}|d\}}}|r,|r,dj|d}ttd||g}|rTdd|SdS)Nr:z ({markers}))markersz; z and )rUrZr)r join)rZextraseprZ conditionsrrrparse_conditionFs  zKDistribution._convert_egg_info_reqs_to_simple_reqs..parse_conditionNr,)r4rrZdepsZdeprrrr8s  z2Distribution._convert_egg_info_reqs_to_simple_reqsN)rrrrabcabstractmethodrOrSrErero staticmethodrsrarDrrr r rrrrrrrrrrrrrsB             c@s2eZdZdZGdddZejefddZdS)rzJ A MetaPathFinder capable of discovering installed distributions. c@s(eZdZdZdZddZeddZdS)zDistributionFinder.Contextaw Keyword arguments presented by the caller to ``distributions()`` or ``Distribution.discover()`` to narrow the scope of a search for distributions in all DistributionFinders. Each DistributionFinder may expect any parameters and should attempt to honor the canonical parameters defined below when appropriate. NcKst||dSr@)varsupdate)r%rnrrrrYjsz#DistributionFinder.Context.__init__cCst|dtjS)z The path that a distribution finder should search. Typically refers to Python package paths and defaults to ``sys.path``. r_)rgetrvr_r>rrrr_mszDistributionFinder.Context.path)rrrrr/rYrDr_rrrrrbXs  rbcCsdS)z Find distributions. Return an iterable of all Distribution instances capable of loading the metadata for packages matching the ``context``, a DistributionFinder.Context instance. Nr)r%rfrrrrtwsz%DistributionFinder.find_distributionsN)rrrrrbrrrtrrrrrSsc@s@eZdZdZddZddZddZdd Zd d Zd d Z dS)FastPathzF Micro-optimized class for searching a path for children. cCs||_tj||_dSr@)rootosr_basenamelowerbase)r%rrrrrYszFastPath.__init__cCst|j|Sr@)rqrrr)r%childrrrjoinpathszFastPath.joinpathc CsTttt|jpdW5QRSQRXtt|W5QRSQRXgS)Nr)r Exceptionrlistdirr zip_childrenr>rrrchildrens  " zFastPath.childrencCs2t|j}|j}|j|_tdd|DS)Ncss |]}|tjddVqdS)rrN)r! posixpathr)r.rrrrrhsz(FastPath.zip_children..)zipfilerrrZnamelistrdictfromkeys)r%Zzip_pathnamesrrrrs    zFastPath.zip_childrencCs&|j}||jkp$||jo$|dS)N.egg)rversionless_egg_name startswithprefixendswith)r%searchrrrris_eggs   zFastPath.is_eggccsZ|D]L}|}||jksH||jr6||jsH||r|dkr||VqdS)Nzegg-info) rr exact_matchesrrrsuffixesrr)r%r/rZn_lowrrrrs    zFastPath.searchN) rrrrrYrrrrrrrrrrs rc@s6eZdZdZdZdZdZdgddZdZddZ dS)PreparedzE A prepared search for metadata on a possibly-named package. r)z .dist-infoz .egg-infoNrcsV|_|dkrdS|dd_jd_fddjD_jd_dS)N-rXcsg|]}j|qSr) normalized)r.suffixr>rrr3sz%Prepared.__init__..r)r/rreplacerrrrr)r%r/rr>rrYs  zPrepared.__init__) rrrrrrrrrrYrrrrrsrc@s,eZdZeefddZeddZdS)MetadataPathFindercCs||j|j}tt|S)a  Find distributions. Return an iterable of all Distribution instances capable of loading the metadata for packages matching ``context.name`` (or all names if ``None`` indicated) along the paths in the list of directories ``context.path``. ) _search_pathsr/r_rrp)r1rffoundrrrrts z%MetadataPathFinder.find_distributionscs tjfddtt|DS)z1Find metadata directories in paths heuristically.c3s|]}|tVqdSr@)rr)r.r_r`rrrhsz3MetadataPathFinder._search_paths..)rkrlrmrr)r1r/pathsrr`rrsz MetadataPathFinder._search_pathsN)rrrrErrbrtrrrrrrs rc@s.eZdZddZddZejje_ddZdS)rpcCs ||_dS)zConstruct a distribution from a path to the metadata directory. :param path: A pathlib.Path or similar object supporting .joinpath(), __div__, .parent, and .read_text(). N)_pathr^rrrrYszPathDistribution.__init__c Cs<tttttt"|j|jddW5QRSQRXdS)NrGrH) rFileNotFoundErrorIsADirectoryErrorKeyErrorNotADirectoryErrorPermissionErrorrrrOr\rrrrOs zPathDistribution.read_textcCs |jj|Sr@)rparentr^rrrrSszPathDistribution.locate_fileN)rrrrYrOrrrSrrrrrps rpcCs t|S)zGet the ``Distribution`` instance for the named package. :param distribution_name: The name of the distribution package as a string. :return: A ``Distribution`` instance (or subclass thereof). )rreZdistribution_namerrrr scKs tjf|S)z|Get all ``Distribution`` instances in the current environment. :return: An iterable of ``Distribution`` instances. )rro)rnrrrr scCs t|jS)zGet the metadata for the named package. :param distribution_name: The name of the distribution package to query. :return: An email.Message containing the parsed metadata. )rrerrrrrrscCs t|jS)zGet the version string for the named package. :param distribution_name: The name of the distribution package to query. :return: The version string for the package as defined in the package's "Version" metadata key. )r rrrrrr scCsHtjddtD}td}t||d}t||}dd|DS)zwReturn EntryPoint objects for all installed packages. :return: EntryPoint objects for all installed packages. css|] }|jVqdSr@)r )r.rRrrrrhszentry_points..r)keycSsi|]\}}|t|qSr)tuple)r.repsrrrrsz entry_points..)rkrlrmr r attrgettersortedr)rZby_groupZorderedZgroupedrrrr s    cCs t|jS)zReturn a list of files for the named package. :param distribution_name: The name of the distribution package to query. :return: List of files composing the distribution. )r r rrrrr %scCs t|jS)z Return a list of requirements for the named package. :return: An iterator of requirements, suitable for packaging.requirement.Requirement. )r rrrrrr.s),r9rr*rrrvrxrqrrr"rkr collectionsZ configparserr contextlibr importlibr importlib.abcrr__all__ModuleNotFoundErrorr namedtuplerZ PurePosixPathrFrTrrrrrrpr r rrr r rrrrrsb       NE/0    PK]?abc.cpython-38.pycnu[U e5dD@sddlTddlmZdS))*)__all__N)_collections_abcrrr'/usr/lib64/python3.8/collections/abc.pysPK]&&util.cpython-38.opt-1.pycnu[U e5d@svdZddlZddddddgZGd ddZd dZd dZdd dZddZddZddddddddhj Z ddZ dS)z$Miscellaneous WSGI-related UtilitiesN FileWrapper guess_schemeapplication_uri request_urishift_path_infosetup_testing_defaultsc@s2eZdZdZd ddZddZddZd d Zd S) rz1Wrapper to convert file-like objects to iterables cCs"||_||_t|dr|j|_dS)Nclose)filelikeblksizehasattrr )selfr r r$/usr/lib64/python3.8/wsgiref/util.py__init__s zFileWrapper.__init__cCs6ddl}|jdtdd|j|j}|r.|StdS)NrzXFileWrapper's __getitem__ method ignores 'key' parameter. Use iterator protocol instead.) stacklevel)warningswarnDeprecationWarningr readr IndexError)r keyrdatarrr __getitem__szFileWrapper.__getitem__cCs|SNr)r rrr__iter__!szFileWrapper.__iter__cCs|j|j}|r|StdSr)r rr StopIteration)r rrrr__next__$szFileWrapper.__next__N)r)__name__ __module__ __qualname____doc__rrrrrrrrr s   cCs|ddkrdSdSdS)zMReturn a guess for whether 'wsgi.url_scheme' should be 'http' or 'https' ZHTTPS)ZyesZon1httpshttpN)get)environrrrr*scCs|dd}ddlm}|dr0||d7}nR||d7}|ddkrf|dd kr|d |d7}n|dd kr|d |d7}|||d pd dd7}|S)z@Return the application's base URI (no PATH_INFO or QUERY_STRING)wsgi.url_schemez://rquote HTTP_HOST SERVER_NAMEr$ SERVER_PORT443:80 SCRIPT_NAME/latin1)encoding) urllib.parser*r&)r'urlr*rrrr2s       TcCspt|}ddlm}||ddddd}|dsF||d d 7}n||7}|rl|d rl|d |d 7}|S) zBReturn the full request URI, optionally including the query stringrr) PATH_INFOz/;=,r3)Zsafer4r1NZ QUERY_STRING?)rr5r*r&)r'Z include_queryr6r* path_inforrrrFs  cCs|dd}|sdS|d}dd|ddD|dd<|d}|d=|d d}t|d|}|dr~|dd}|s|ds|d7}||d <d||d<|d krd}|S) aZShift a name from PATH_INFO to SCRIPT_NAME, returning it If there are no remaining path segments in PATH_INFO, return None. Note: 'environ' is modified in-place; use a copy if you need to keep the original PATH_INFO or SCRIPT_NAME. Note: when PATH_INFO is just a '/', this returns '' and appends a trailing '/' to SCRIPT_NAME, even though empty path segments are normally ignored, and SCRIPT_NAME doesn't normally end in a '/'. This is intentional behavior, to ensure that an application can tell the difference between '/x' and '/x/' when traversing to objects. r7r8Nr2cSsg|]}|r|dkr|qS).r).0prrr esz#shift_path_info..r9r1r<)r&split posixpathnormpathendswithjoin)r'r; path_partsnameZ script_namerrrrSs$     cCs|dd|dd|d|d|ddd|kr\d |kr\|dd |d d |d d |dd|dd|ddddlm}m}|d||d||dt||ddkr|ddn|ddkr|dddS)a:Update 'environ' with trivial defaults for testing purposes This adds various parameters required for WSGI, including HTTP_HOST, SERVER_NAME, SERVER_PORT, REQUEST_METHOD, SCRIPT_NAME, PATH_INFO, and all of the wsgi.* variables. It only supplies default values, and does not replace any existing settings for these variables. This routine is intended to make it easier for unit tests of WSGI servers and applications to set up dummy environments. It should *not* be used by actual WSGI servers or applications, since the data is fake! r,z 127.0.0.1ZSERVER_PROTOCOLzHTTP/1.0r+ZREQUEST_METHODZGETr1r7r8r2z wsgi.version)r9rz wsgi.run_oncerzwsgi.multithreadzwsgi.multiprocess)StringIOBytesIOz wsgi.inputz wsgi.errorsr(r%r-r0r$r.N) setdefaultiorHrIr)r'rHrIrrrr|s&           Z connectionz keep-alivezproxy-authenticatezproxy-authorizationZteZtrailersztransfer-encodingZupgradecCs t|S)z?Return true if 'header_name' is an HTTP/1.1 "Hop-by-Hop" header)_hoppishlower)Z header_namerrr is_hop_by_hopsrN)T) r"rB__all__rrrrrr __contains__rLrNrrrrs0 ))PK]?abc.cpython-38.opt-1.pycnu[U e5dD@sddlTddlmZdS))*)__all__N)_collections_abcrrr'/usr/lib64/python3.8/collections/abc.pysPK];wCC"_bootstrap_external.cpython-38.pycnu[U &.e@sdZddladdlZddladdlZddlZtjdkZerLddlZ ddl Z nddl Z erbddgZ ndgZ e dde Ds~te dZee Zde Z d d e DZd Zd ZeeZd dZddZddZddZerddZnddZddZddZddZddZd d!Z er$d"d#Z!nd$d#Z!dd&d'Z"e#e"j$Z%d(&d)d*d+Z'e()e'd*Z*d,Z+d-Z,d.gZ-d/gZ.e.Z/Z0ddd0d1d2Z1d3d4Z2d5d6Z3d7d8Z4d9d:Z5d;d<Z6d=d>Z7d?d@Z8dAdBZ9dCdDZ:ddEdFZ;ddGdHZe?Z@dde@dNdOdPZAGdQdRdRZBGdSdTdTZCGdUdVdVeCZDGdWdXdXZEGdYdZdZeEeDZFGd[d\d\eEeCZGgZHGd]d^d^eEeCZIGd_d`d`ZJGdadbdbZKGdcddddZLGdedfdfZMddgdhZNdidjZOdkdlZPdmdnZQdodpdqdrdsdtdudvdwdxdydzd{d|d}d~dZRddZSdS)a^Core implementation of path-based import. This module is NOT meant to be directly imported! It has been designed such that it can be bootstrapped into Python as the implementation of import. As such it requires the injection of specific modules and attributes in order to work. One should use importlib as the public-facing version of this module. NZwin32\/ccs|]}t|dkVqdSNlen.0sepr 5/usr/lib64/python3.8/importlib/_bootstrap_external.py +sr cCsh|]}d|qS:r r sr r r /sr)win)cygwindarwincs<tjtr0tjtrdndfdd}ndd}|S)N PYTHONCASEOKs PYTHONCASEOKcs tjkS)5True if filenames must be checked case-insensitively.)_osenvironr keyr r _relax_case@sz%_make_relax_case.._relax_casecSsdS)rFr r r r r rDs)sysplatform startswith_CASE_INSENSITIVE_PLATFORMS#_CASE_INSENSITIVE_PLATFORMS_STR_KEY)rr rr _make_relax_case9s  r#cCst|d@ddS)z*Convert a 32-bit integer to little-endian.little)intto_bytes)xr r r _pack_uint32Jsr*cCst|dkstt|dS)z/Convert 4 bytes in little-endian to an integer.r%r&rAssertionErrorr' from_bytesdatar r r _unpack_uint32Osr0cCst|dkstt|dS)z/Convert 2 bytes in little-endian to an integer.r&r+r.r r r _unpack_uint16Tsr2cGs|sdSt|dkr|dSd}g}ttj|D]z\}}|tsL|trf|tpX|}t |g}q0|dr| | kr|}|g}q| |q0|p|}| |q0dd|D}t|dkr|ds|t S|t |S)Replacement for os.path.join().rrrrcSsg|]}|r|tqSr rstrippath_separatorsr pr r r rs_path_join..) rmapr_path_splitrootr path_sep_tupleendswithr5r6path_sepcasefoldappendjoin) path_partsrootpathZnew_roottailr r r _path_join[s*     rGcGstdd|DS)r3cSsg|]}|r|tqSr r4)r partr r r r9{sr:)r?rB)rCr r r rGys csBtfddtD}|dkr&dfSd||ddfS)z Replacement for os.path.split().c3s|]}|VqdSN)rfindr7rEr r r sz_path_split..rrNr)maxr6)rEir rKr _path_splitsrNcCs t|S)z~Stat the path. Made a separate function to make it easier to override in experiments (e.g. cache stat results). )rstatrKr r r _path_statsrPcCs2z t|}Wntk r"YdSX|jd@|kS)z1Test whether the path is the specified mode type.Fi)rPOSErrorst_mode)rEmode stat_infor r r _path_is_mode_types  rUcCs t|dS)zReplacement for os.path.isfile.i)rUrKr r r _path_isfilesrVcCs|s t}t|dS)zReplacement for os.path.isdir.i@)rgetcwdrUrKr r r _path_isdirsrXcCs>|sdSt|ddd}t|dko<|dp<|dS)Replacement for os.path.isabs.Frrrrz\\)rr<replacerr r>)rErDr r r _path_isabssr[cCs |tS)rY)r r6rKr r r r[sc Csd|t|}t|tjtjBtjB|d@}z2t|d}| |W5QRXt ||Wn:t k rzt |Wnt k rYnXYnXdS)zBest-effort function to write data to a path atomically. Be prepared to handle a FileExistsError if concurrent writing of the temporary file is attempted.{}.{}r\wbN) formatidropenO_EXCLO_CREATO_WRONLY_ioFileIOwriterZrQunlink)rEr/rSpath_tmpfdfiler r r _write_atomicsrliU r1r&s __pycache__zopt-z.pyz.pyc) optimizationc CsX|dk r4tdt|dk r(d}t||r0dnd}t|}t|\}}|d\}}}tj j } | dkrrt dd |r~|n||| g} |dkrtj jdkrd}ntj j}t|}|dkr|std |d | t|} | td} tjdk rLt|stt|}|dd kr8|dtkr8|d d}ttj|t| St|t| S) aGiven the path to a .py file, return the path to its .pyc file. The .py file does not need to exist; this simply returns the path to the .pyc file calculated as if the .py file were imported. The 'optimization' parameter controls the presumed optimization level of the bytecode file. If 'optimization' is not None, the string representation of the argument is taken and verified to be alphanumeric (else ValueError is raised). The debug_override parameter is deprecated. If debug_override is not None, a True value is the same as setting 'optimization' to the empty string while a False value is equivalent to setting 'optimization' to '1'. If sys.implementation.cache_tag is None then NotImplementedError is raised. NzFthe debug_override parameter is deprecated; use 'optimization' insteadz2debug_override or optimization must be set to Nonerr.$sys.implementation.cache_tag is Nonerz{!r} is not alphanumericz{}.{}{}rr1) _warningswarnDeprecationWarning TypeErrorrfspathrN rpartitionrimplementation cache_tagNotImplementedErrorrBflagsoptimizestrisalnum ValueErrorr__OPTBYTECODE_SUFFIXESpycache_prefixr[rGrWr6lstrip_PYCACHE) rEdebug_overridernmessageheadrFbaser resttagalmost_filenamefilenamer r r cache_from_sourcebsH       rc Cs.tjjdkrtdt|}t|\}}d}tjdk rftjt }| |t rf|t |d}d}|st|\}}|t krtt d||d}|dkrtd|n\|d kr|dd d }| tstd t|t td}|std |d|dd} t|| tdS)anGiven the path to a .pyc. file, return the path to its .py file. The .pyc file does not need to exist; this simply returns the path to the .py file calculated to correspond to the .pyc file. If path does not conform to PEP 3147/488 format, ValueError will be raised. If sys.implementation.cache_tag is None then NotImplementedError is raised. NrpFTz not bottom-level directory in ro>r1zexpected only 2 or 3 dots in rr1z5optimization portion of filename does not start with zoptimization level z is not an alphanumeric valuer)rrwrxryrrurNrr5r6r r?rrr~countrsplitrr} partitionrGSOURCE_SUFFIXES) rErpycache_filenamefound_in_pycache_prefix stripped_pathpycache dot_countrn opt_level base_filenamer r r source_from_caches4          rc Cs~t|dkrdS|d\}}}|r8|dddkr<|Sz t|}Wn$ttfk rl|dd}YnXt|rz|S|S)zConvert a bytecode file path to a source path (if possible). This function exists purely for backwards-compatibility for PyImport_ExecCodeModuleWithFilenames() in the C API. rNropy)rrvlowerrryr~rV) bytecode_pathr_ extension source_pathr r r _get_sourcefiles  rcCsJ|ttr0z t|WStk r,YqFXn|ttrB|SdSdSrI)r>tuplerrryr)rr r r _get_cacheds rcCs4zt|j}Wntk r&d}YnX|dO}|S)z3Calculate the mode permissions for a bytecode file.r\)rPrRrQ)rErSr r r _calc_modes  rcsDdfdd }z tj}Wntk r4dd}YnX|||S)zDecorator to verify that the module being requested matches the one the loader can handle. The first argument (self) must define _name which the second argument is compared against. If the comparison fails then ImportError is raised. NcsB|dkr|j}n |j|kr0td|j|f|d||f||S)Nzloader for %s cannot handle %sname)r ImportError)selfrargskwargsmethodr r _check_name_wrappers z(_check_name.._check_name_wrappercSs8dD] }t||rt||t||q|j|jdS)N) __module____name__ __qualname____doc__)hasattrsetattrgetattr__dict__update)newoldrZr r r _wraps z_check_name.._wrap)N) _bootstrapr NameError)rrrr rr _check_names  rcCs<||\}}|dkr8t|r8d}t||dt|S)zTry to find a loader for the specified module by delegating to self.find_loader(). This method is deprecated in favor of finder.find_spec(). Nz,Not importing directory {}: missing __init__r) find_loaderrrqrrr_ ImportWarning)rfullnameloaderportionsmsgr r r _find_module_shims rcCs|dd}|tkrB}|t|t|dks2t|||t||S)z&Produce the data for a hash-based pyc.rr)rrrr*rr,rr)rrcheckedr/rzr r r _code_to_hash_pycs  rcCs>ddl}t|j}||}tdd}|||dS)zyDecode bytes representing source code and return the string. Universal newline support is used in the decoding. rNT)tokenizereBytesIOreadlinedetect_encodingIncrementalNewlineDecoderdecode) source_bytesrsource_bytes_readlineencodingnewline_decoderr r r decode_sources    rrsubmodule_search_locationsc Cs|dkr get_filenameoriginT is_packager)rrrrrur ModuleSpec _set_fileattr_get_supported_file_loadersr>rr _POPULATErrrNrA) rlocationrrspec loader_classsuffixesrdirnamer r r spec_from_file_locations>        rc@sPeZdZdZdZdZdZeddZeddZ edd d Z edd d Z d S)WindowsRegistryFinderz>Meta path finder for modules declared in the Windows registry.z;Software\Python\PythonCore\{sys_version}\Modules\{fullname}zASoftware\Python\PythonCore\{sys_version}\Modules\{fullname}\DebugFcCs8zttj|WStk r2ttj|YSXdSrI)_winregOpenKeyHKEY_CURRENT_USERrQHKEY_LOCAL_MACHINE)clsrr r r _open_registrysz$WindowsRegistryFinder._open_registryc Csr|jr|j}n|j}|j|dtjddd}z&||}t|d}W5QRXWnt k rlYdSX|S)Nz%d.%dr1)r sys_versionr) DEBUG_BUILDREGISTRY_KEY_DEBUG REGISTRY_KEYr_r version_inforr QueryValuerQ)rr registry_keyrhkeyfilepathr r r _search_registrys z&WindowsRegistryFinder._search_registryNcCsz||}|dkrdSz t|Wntk r8YdSXtD]4\}}|t|r@tj|||||d}|Sq@dS)Nr)rrPrQrr>rrspec_from_loader)rrrEtargetrrrrr r r find_specs  zWindowsRegistryFinder.find_speccCs"|||}|dk r|jSdSdS)zlFind module named in the registry. This method is deprecated. Use exec_module() instead. NrrrrrErr r r find_module's z!WindowsRegistryFinder.find_module)NN)N) rrrrr r r  classmethodrrrrr r r r rs   rc@s0eZdZdZddZddZddZdd Zd S) _LoaderBasicszSBase class of common code needed by both SourceLoader and SourcelessFileLoader.cCs@t||d}|ddd}|dd}|dko>|dkS)zConcrete implementation of InspectLoader.is_package by checking if the path returned by get_filename has a filename of '__init__.py'.rrorr1__init__)rNrrrv)rrr filename_base tail_namer r r r:sz_LoaderBasics.is_packagecCsdSz*Use default semantics for module creation.Nr rrr r r create_moduleBsz_LoaderBasics.create_modulecCs8||j}|dkr$td|jtt||jdS)zExecute the module.Nz4cannot load module {!r} when get_code() returns None)get_coderrr_r_call_with_frames_removedexecr)rmodulerr r r exec_moduleEs  z_LoaderBasics.exec_modulecCs t||S)zThis module is deprecated.)r_load_module_shimrrr r r load_moduleMsz_LoaderBasics.load_moduleN)rrrrrr r%r(r r r r r5s rc@sJeZdZddZddZddZddZd d Zd d d dZddZ dS) SourceLoadercCstdS)zOptional method that returns the modification time (an int) for the specified path (a str). Raises OSError when the path cannot be handled. N)rQrrEr r r path_mtimeTszSourceLoader.path_mtimecCsd||iS)aOptional method returning a metadata dict for the specified path (a str). Possible keys: - 'mtime' (mandatory) is the numeric timestamp of last source code modification; - 'size' (optional) is the size in bytes of the source code. Implementing this method allows the loader to read bytecode files. Raises OSError when the path cannot be handled. r)r+r*r r r path_stats\s zSourceLoader.path_statscCs |||S)zOptional method which writes data (bytes) to a file path (a str). Implementing this method allows for the writing of bytecode files. The source path is needed in order to correctly transfer permissions )set_data)rr cache_pathr/r r r _cache_bytecodejszSourceLoader._cache_bytecodecCsdS)zOptional method which writes data (bytes) to a file path (a str). Implementing this method allows for the writing of bytecode files. Nr )rrEr/r r r r-tszSourceLoader.set_datac CsR||}z||}Wn0tk rH}ztd|d|W5d}~XYnXt|S)z4Concrete implementation of InspectLoader.get_source.z'source not available through get_data()rN)rget_datarQrr)rrrErexcr r r get_source{s zSourceLoader.get_sourcer) _optimizecCstjt||dd|dS)zReturn the code object compiled from source. The 'data' argument can be any object type that compile() supports. r#T) dont_inheritr{)rr"compile)rr/rEr3r r r source_to_codes zSourceLoader.source_to_codec Cs"||}d}d}d}d}d}z t|}Wntk rDd}Yn0Xz||} Wntk rjYn Xt| d}z||} Wntk rYnX||d} zt| || } t| dd} | d@dk}|r$| d @dk}t j d kr8|st j d kr8||}t t |}t | ||| nt| || d || Wnttfk rTYn Xtd ||t| |||dS|dkr||}|||}td|tjs|dk r|dk r|r|dkrt |}t|||} nt||t|} z|||| Wntk rYnX|S)zConcrete implementation of InspectLoader.get_code. Reading of bytecode requires path_stats to be implemented. To write bytecode, set_data must also be implemented. NFTrrrrrr1neveralwayssizez {} matches {})rrrzcode object from {})rrryr,rQr'r0r memoryviewrcheck_hash_based_pycsr_RAW_MAGIC_NUMBERrrrrrrrr6rdont_write_bytecoderrrr/)rrrrrr hash_based check_sourcerstr/rrz bytes_data code_objectr r r r!s               zSourceLoader.get_codeN) rrrr+r,r/r-r2r6r!r r r r r)Rs  r)cs|eZdZdZddZddZddZefdd Zed d Z d d Z eddZ ddZ ddZ ddZddZZS) FileLoaderzgBase file loader class which implements the loader protocol methods that require file system usage.cCs||_||_dS)zKCache the module name and the path to the file found by the finder.Nr)rrrEr r r rszFileLoader.__init__cCs|j|jko|j|jkSrI __class__rrotherr r r __eq__s  zFileLoader.__eq__cCst|jt|jASrIhashrrErr r r __hash__szFileLoader.__hash__cstt||S)zdLoad a module from a file. This method is deprecated. Use exec_module() instead. )superrCr(r'rEr r r(s zFileLoader.load_modulecCs|jSz:Return the path to the source file as found by the finder.rKr'r r r rszFileLoader.get_filenamec Csft|ttfr:tt|}|W5QRSQRXn(t|d}|W5QRSQRXdS)z'Return the data from path as raw bytes.rN)rr)ExtensionFileLoaderre open_coder|readrf)rrErkr r r r0s zFileLoader.get_datacCs||r|SdSrI)rrr$r r r get_resource_readers zFileLoader.get_resource_readercCs tt|jd|}t|dS)NrrP)rGrNrErerfrresourcerEr r r open_resourceszFileLoader.open_resourcecCs&||sttt|jd|}|SNr) is_resourceFileNotFoundErrorrGrNrErVr r r resource_paths zFileLoader.resource_pathcCs(t|kr dStt|jd|}t|S)NFr)r?rGrNrErVrrrEr r r rZ szFileLoader.is_resourcecCsttt|jdSrY)iterrlistdirrNrErKr r r contents&szFileLoader.contents)rrrrrrHrLrr(rr0rUrXr\rZr` __classcell__r r rNr rCs    rCc@s.eZdZdZddZddZdddd Zd S) SourceFileLoaderz>Concrete implementation of SourceLoader using the file system.cCst|}|j|jdS)z!Return the metadata for the path.)rr9)rPst_mtimest_size)rrEr@r r r r,.szSourceFileLoader.path_statscCst|}|j|||dS)N_mode)rr-)rrrr/rSr r r r/3sz SourceFileLoader._cache_bytecoder\rec Cst|\}}g}|r4t|s4t|\}}||qt|D]l}t||}zt|Wq<tk rpYq.)rNrEanyEXTENSION_SUFFIXESr'r rpr rs zExtensionFileLoader.is_packagecCsdS)z?Return None as an extension module cannot create a code object.Nr r'r r r r!szExtensionFileLoader.get_codecCsdS)z5Return None as extension modules have no source code.Nr r'r r r r2szExtensionFileLoader.get_sourcecCs|jSrOrKr'r r r rsz ExtensionFileLoader.get_filenameN)rrrrrrHrLr r%rr!r2rrr r r r rQts rQc@sheZdZdZddZddZddZdd Zd d Zd d Z ddZ ddZ ddZ ddZ ddZdS)_NamespacePatha&Represents a namespace package's path. It uses the module name to find its parent module, and from there it looks up the parent's __path__. When this changes, the module's own path is recomputed, using path_finder. For top-level modules, the parent module's path is sys.path.cCs$||_||_t||_||_dSrI)_name_pathr_get_parent_path_last_parent_path _path_finderrrrE path_finderr r r rsz_NamespacePath.__init__cCs&|jd\}}}|dkrdS|dfS)z>Returns a tuple of (parent-module-name, parent-path-attr-name)ror)rrE__path__)rurv)rrjdotmer r r _find_parent_path_namessz&_NamespacePath._find_parent_path_namescCs|\}}ttj||SrI)rrrmodules)rparent_module_namepath_attr_namer r r rws z_NamespacePath._get_parent_pathcCsPt|}||jkrJ||j|}|dk rD|jdkrD|jrD|j|_||_|jSrI)rrwrxryrurrrv)r parent_pathrr r r _recalculates  z_NamespacePath._recalculatecCs t|SrI)r^rrKr r r __iter__sz_NamespacePath.__iter__cCs ||SrIr)rindexr r r __getitem__sz_NamespacePath.__getitem__cCs||j|<dSrI)rv)rrrEr r r __setitem__sz_NamespacePath.__setitem__cCs t|SrI)rrrKr r r __len__sz_NamespacePath.__len__cCs d|jS)Nz_NamespacePath({!r}))r_rvrKr r r __repr__sz_NamespacePath.__repr__cCs ||kSrIrritemr r r __contains__sz_NamespacePath.__contains__cCs|j|dSrI)rvrArr r r rAsz_NamespacePath.appendN)rrrrrrrwrrrrrrrrAr r r r rts  rtc@sPeZdZddZeddZddZddZd d Zd d Z d dZ ddZ dS)_NamespaceLoadercCst||||_dSrI)rtrvrzr r r rsz_NamespaceLoader.__init__cCs d|jS)zsReturn repr for the module. The method is deprecated. The import machinery does the job itself. z)r_r)rr$r r r module_reprsz_NamespaceLoader.module_reprcCsdS)NTr r'r r r rsz_NamespaceLoader.is_packagecCsdS)Nrr r'r r r r2sz_NamespaceLoader.get_sourcecCstdddddS)Nrzr#T)r4)r5r'r r r r!sz_NamespaceLoader.get_codecCsdSrr rr r r r sz_NamespaceLoader.create_modulecCsdSrIr rTr r r r%sz_NamespaceLoader.exec_modulecCstd|jt||S)zbLoad a namespace module. This method is deprecated. Use exec_module() instead. z&namespace module loaded with path {!r})rrrvr&r'r r r r( sz_NamespaceLoader.load_moduleN) rrrrrrrr2r!r r%r(r r r r rs rc@sveZdZdZeddZeddZeddZedd Zedd d Z edd dZ edddZ eddZ d S) PathFinderz>Meta path finder for sys.path and package __path__ attributes.cCs@ttjD],\}}|dkr(tj|=qt|dr|qdS)z}Call the invalidate_caches() method on all path entry finders stored in sys.path_importer_caches (where implemented).Ninvalidate_caches)listrpath_importer_cacheitemsrr)rrfinderr r r rs   zPathFinder.invalidate_cachesc CsTtjdk rtjstdttjD],}z||WStk rLYq"Yq"Xq"dS)z.Search sys.path_hooks for a finder for 'path'.Nzsys.path_hooks is empty)r path_hooksrqrrrr)rrEhookr r r _path_hooks%s   zPathFinder._path_hookscCsh|dkr,z t}Wntk r*YdSXztj|}Wn(tk rb||}|tj|<YnX|S)zGet the finder for the path entry from sys.path_importer_cache. If the path entry is not in the cache, find the appropriate finder and cache it. If no finder is available, store None. rN)rrWr[rrKeyErrorr)rrErr r r _path_importer_cache2s  zPathFinder._path_importer_cachecCsRt|dr||\}}n||}g}|dk r.rorN) r_loadersrEr[rGrrW _path_mtimeset _path_cache_relaxed_path_cache)rrEloader_detailsloadersrr rr rs   zFileFinder.__init__cCs d|_dS)zInvalidate the directory mtime.rN)rrKr r r rszFileFinder.invalidate_cachescCs*||}|dkrdgfS|j|jp&gfS)zTry to find a loader for the specified module, or the namespace package portions. Returns (loader, list-of-portions). This method is deprecated. Use find_spec() instead. N)rrr)rrrr r r rs zFileFinder.find_loadercCs|||}t||||dS)Nr)r)rrrrEsmslrrr r r rs zFileFinder._get_specNc Csd}|dd}zt|jp"tj}Wntk rBd}YnX||jkr\|||_t rr|j }| }n |j }|}||krt |j|}|jD]:\} } d| } t || } t| r|| || |g|Sqt|}|jD]r\} } zt |j|| } Wntk rYdSXtjd| dd|| |krt| r|| || d|Sq|r~td |t|d} |g| _| SdS) zoTry to find a spec for the specified module. Returns the matching spec, or None if not found. Fror1rrNz trying {}) verbosityzpossible namespace for {})rvrPrErrWrcrQr _fill_cacherrrrrGrrVrrXr~rrrr)rrr is_namespace tail_modulercache cache_module base_pathror init_filename full_pathrr r r rsP           zFileFinder.find_specc Cs|j}zt|pt}Wntttfk r:g}YnXtj dsTt ||_ nJt }|D]8}| d\}}}|rd ||}n|}||q^||_ tj trdd|D|_dS)zDFill the cache of potential modules and packages for this directory.rror]cSsh|] }|qSr )r)r fnr r r r*sz)FileFinder._fill_cache..N)rErr_rWr[PermissionErrorNotADirectoryErrorrrr rrrr_raddr!r) rrEr`lower_suffix_contentsrrr}ronew_namer r r r s"     zFileFinder._fill_cachecsfdd}|S)aA class method which returns a closure to use on sys.path_hook which will return an instance using the specified loaders and the path called on the closure. If the path called on the closure is not a directory, ImportError is raised. cs"t|std|d|fS)z-Path hook for importlib.machinery.FileFinder.zonly directories are supportedrK)rXrrKrrr r path_hook_for_FileFinder6s z6FileFinder.path_hook..path_hook_for_FileFinderr )rrrr rr path_hook,s zFileFinder.path_hookcCs d|jS)NzFileFinder({!r}))r_rErKr r r r>szFileFinder.__repr__)N)rrrrrrrrrrrrrrrr r r r rs  3 rcCs|d}|d}|sB|r$|j}n||kr8t||}n t||}|sTt|||d}z$||d<||d<||d<||d<Wntk rYnXdS)N __loader____spec__r__file__ __cached__)getrrkrbr Exception)nsrpathname cpathnamerrr r r _fix_up_moduleDs"     rcCs*tttf}ttf}ttf}|||gS)z_Returns a list of file-based module loaders. Each item is a tuple (loader, suffixes). )rQ_alternative_architecturesrextension_suffixesrbrrkr) extensionssourcebytecoder r r r[src Cs|atjatjatjt}dD]0}|tjkr8t|}n tj|}t|||qddgfdddgff}|D]n\}}tdd|Dst|d}|tjkrtj|}qqjzt|}WqWqjt k rYqjYqjXqjt d t|d |t|d |t|d d |t|ddd|Dtd} t|d| td} t|d| |dkrntd} t|d| t|dt t tt|dkrtddt krdt_dS)zSetup the path-based importers for importlib by importing needed built-in modules and injecting them into the global namespace. Other components are extracted from the core bootstrap module. )rerqbuiltinsrposixrntrcss|]}t|dkVqdSrrrr r r r sz_setup..rzimportlib requires posix or ntrr?r6r_pathseps_with_coloncSsh|]}d|qSrr rr r r rsz_setup.._thread_weakrefwinregrrz.pywz_d.pydTN)rrrrr_builtin_from_namerallr,rrBr#rsrrrrrArr ) _bootstrap_module self_module builtin_namebuiltin_module os_details builtin_osr6r? os_module thread_moduleweakref_module winreg_moduler r r _setupfsN                      rcCs2t|t}tjtj|gtjt dS)z)Install the path-based import components.N) rrrrrrr meta_pathrAr)rsupported_loadersr r r _installsr-arm-linux-gnueabihf.-armeb-linux-gnueabihf.-mips64-linux-gnuabi64.-mips64el-linux-gnuabi64.-powerpc-linux-gnu.-powerpc-linux-gnuspe.-powerpc64-linux-gnu.-powerpc64le-linux-gnu.-arm-linux-gnueabi.-armeb-linux-gnueabi.-mips64-linux-gnu.-mips64el-linux-gnu.-ppc-linux-gnu.-ppc-linux-gnuspe.-ppc64-linux-gnu.-ppc64le-linux-gnu.)rrrrrrrrrrrrrrrrcCsF|D]<}tD].\}}||kr|||||Sqq|S)zAdd a suffix with an alternative architecture name to the list of suffixes so an extension built with the default (upstream) setting is loadable with our Pythons ) _ARCH_MAPrrArZ)rrooriginal alternativer r r rs r)r\)N)NNN)rr)T)N)N)Trrrerrqrr _MS_WINDOWSrrrrr6rr,r?rr=rBrr"%_CASE_INSENSITIVE_PLATFORMS_BYTES_KEYr!r#r*r0r2rGrNrPrUrVrXr[rltype__code__rr(rr'r-r<rrrrDEBUG_BYTECODE_SUFFIXESOPTIMIZED_BYTECODE_SUFFIXESrrrrrrrrrrrrrrobjectrrrrr)rCrbrkrsrQrtrrrrrrrrrr r r r s            G(  !  D@H-:?*  A PK]uaߐQQmetadata.cpython-38.opt-1.pycnu[U e5dD @sddlZddlZddlZddlZddlZddlZddlZddlZddlZddl Z ddl Z ddl Z ddl Z ddl Z ddlmZddlmZddlmZddlmZddl mZddd d d d d dddg ZGdd d eZGddde ddZGdddejZGdddZGdddZGdddeZ GdddZ!GdddZ"Gd d!d!e Z#Gd"d#d#eZ$d$d Z%d%d Z&d&dZ'd'dZ(d(d Z)d)d Z*d*dZ+dS)+N) ConfigParser)suppress) import_module)MetaPathFinder)starmap DistributionDistributionFinderPackageNotFoundError distribution distributions entry_pointsfilesmetadatarequiresversionc@seZdZdZdS)r zThe package was not found.N)__name__ __module__ __qualname____doc__rr*/usr/lib64/python3.8/importlib/metadata.pyr %sc@sVeZdZdZedZddZeddZ e ddZ e d d Z d d Z d dZdS) EntryPointzAn entry point as defined by Python packaging conventions. See `the packaging docs on entry points `_ for more information. zH(?P[\w.]+)\s*(:\s*(?P[\w.]+)\s*)?((?P\[.*\])\s*)?$cCsD|j|j}t|d}td|dp,dd}tt ||S)zLoad the entry point from its definition. If only a module is indicated by the value, return that module. Otherwise, return the named object. moduleNattr.) patternmatchvaluergroupfiltersplit functoolsreducegetattr)selfrrZattrsrrrloadGszEntryPoint.loadcCs(|j|j}ttd|dp"dS)Nz\w+extrasr)rrrlistrefinditerr)r%rrrrr'QszEntryPoint.extrascsfddDS)Ncs,g|]$}|D]\}}|||qqSritems).0rnamerclsconfigrr Xs z+EntryPoint._from_config..)sectionsr/rr/r _from_configVs zEntryPoint._from_configcCsNtdd}t|_z||Wn$tk rB|t|YnXt |S)N=)Z delimiters) rstrZ optionxformZ read_stringAttributeErrorZreadfpioStringIOrr4)r0textr1rrr _from_text^s zEntryPoint._from_textcCst|j|fS)zO Supply iter so one may construct dicts of EntryPoints easily. )iterr.r%rrr__iter__jszEntryPoint.__iter__cCs|j|j|j|jffSN) __class__r.rrr=rrr __reduce__pszEntryPoint.__reduce__N)rrrrr)compilerr&propertyr' classmethodr4r;r>rArrrrr)s    rZEntryPointBasezname value groupc@s*eZdZdZd ddZddZddZd S) PackagePathz"A reference to a path in a packageutf-8c Cs0|j|d}|W5QRSQRXdS)Nencodinglocateopenread)r%rHstreamrrr read_textzszPackagePath.read_textc Cs.|d}|W5QRSQRXdS)NrbrI)r%rMrrr read_binary~szPackagePath.read_binarycCs |j|S)z'Return a path-like object for this path)dist locate_filer=rrrrJszPackagePath.locateN)rF)rrrrrNrPrJrrrrrEws rEc@seZdZddZddZdS)FileHashcCs|d\|_}|_dS)Nr5) partitionmoder)r%spec_rrr__init__szFileHash.__init__cCsd|j|jS)Nz)formatrUrr=rrr__repr__szFileHash.__repr__N)rrrrXrZrrrrrSsrSc@seZdZdZejddZejddZeddZ edd Z e d d Z e d d Z eddZeddZeddZeddZddZddZeddZddZddZed d!Ze d"d#Ze d$d%Zd&S)'rzA Python distribution package.cCsdS)zAttempt to load metadata file given by the name. :param filename: The name of the file in the distribution info. :return: The text if found, otherwise None. Nrr%filenamerrrrNszDistribution.read_textcCsdS)z[ Given a path to a file in this distribution, return a path to it. Nrr%pathrrrrRszDistribution.locate_filecCsD|D].}|tj|d}t|d}|dk r|Sqt|dS)afReturn the Distribution for the given package name. :param name: The name of the distribution package to search for. :return: The Distribution instance (or subclass thereof) for the named package, if found. :raises PackageNotFoundError: When the named package's distribution metadata cannot be found. r.N)_discover_resolversrContextnextr )r0r.resolverZdistsrQrrr from_names   zDistribution.from_namec sJ|ddr|rtdp*tjf|tjfdd|DS)aReturn an iterable of Distribution objects for all packages. Pass a ``context`` or pass keyword arguments for constructing a context. :context: A ``DistributionFinder.Context`` object. :return: Iterable of Distribution objects for all packages. contextNz cannot accept context and kwargsc3s|]}|VqdSr?r)r-rcrerr sz(Distribution.discover..)pop ValueErrorrra itertoolschain from_iterabler`)r0kwargsrrfrdiscovers zDistribution.discovercCstt|S)zReturn a Distribution for the indicated metadata path :param path: a string or path-like object :return: a concrete Distribution instance for the path )PathDistributionpathlibPath)r^rrratszDistribution.atcCsddtjD}td|S)z#Search the meta_path for resolvers.css|]}t|ddVqdS)find_distributionsN)r$)r-finderrrrrgsz3Distribution._discover_resolvers..N)sys meta_pathr )Zdeclaredrrrr`sz Distribution._discover_resolverscCs(|dp|dp|d}t|S)zReturn the parsed metadata for this Distribution. The returned object will have keys that name the various bits of metadata. See PEP 566 for details. ZMETADATAzPKG-INFOr)rNemailZmessage_from_stringr%r:rrrrs  zDistribution.metadatacCs |jdS)z;Return the 'Version' metadata for the distribution package.ZVersion)rr=rrrrszDistribution.versioncCst|dS)Nzentry_points.txt)rr;rNr=rrrr szDistribution.entry_pointscs6p}dfdd }|o4tt|t|S)aBFiles in this distribution. :return: List of PackagePath for this distribution or None Result is `None` if the metadata file that enumerates files (i.e. RECORD for dist-info or SOURCES.txt for egg-info) is missing. Result may be empty if the metadata exists but is empty. Ncs6t|}|rt|nd|_|r&t|nd|_|_|Sr?)rErShashintsizerQ)r.ryZsize_strresultr=rr make_files z%Distribution.files..make_file)NN)_read_files_distinfo_read_files_egginfor(rcsvreader)r%Z file_linesr}rr=rr s zDistribution.filescCs|d}|o|S)z* Read the lines of RECORD ZRECORD)rN splitlinesrxrrrr~s z!Distribution._read_files_distinfocCs|d}|otdj|S)z` SOURCES.txt might contain literal commas, so wrap each line in quotes. z SOURCES.txtz"{}")rNmaprYrrxrrrrs z Distribution._read_files_egginfocCs|p|}|ot|S)z6Generated requirements specified for this Distribution)_read_dist_info_reqs_read_egg_info_reqsr()r%ZreqsrrrrszDistribution.requirescCs |jdS)Nz Requires-Dist)rZget_allr=rrrrsz!Distribution._read_dist_info_reqscCs|d}|o||S)Nz requires.txt)rN_deps_from_requires_text)r%sourcerrrr s z Distribution._read_egg_info_reqscCs4||}ddt|tdD}||S)NcSs&i|]\}}|tttd|qS)line)r(roperator itemgetter)r-sectionZresultsrrr 'sz9Distribution._deps_from_requires_text..r)_read_sectionsrrjgroupbyrr%_convert_egg_info_reqs_to_simple_reqs)r0rZ section_pairsr3rrrr$s z%Distribution._deps_from_requires_textccs<d}td|D](}td|}|r.|d}qtVqdS)Nz \[(.*)\]$)r r)rrlocals)linesrrZ section_matchrrrr.s  zDistribution._read_sectionsc#sBddfdd}|D] \}}|D]}|||Vq(qdS)a Historically, setuptools would solicit and store 'extra' requirements, including those with environment markers, in separate sections. More modern tools expect each dependency to be defined separately, with any relevant extras and environment markers attached directly to that requirement. This method converts the former to the latter. See _test_deps_from_requires_text for an example. cSs|odj|dS)Nzextra == "{name}"r_)rYr_rrrmake_conditionCszJDistribution._convert_egg_info_reqs_to_simple_reqs..make_conditioncsX|pd}|d\}}}|r,|r,dj|d}ttd||g}|rTdd|SdS)Nr:z ({markers}))markersz; z and )rTrYr(r join)rZextraseprZ conditionsrrrparse_conditionFs  zKDistribution._convert_egg_info_reqs_to_simple_reqs..parse_conditionNr+)r3rrZdepsZdeprrrr8s  z2Distribution._convert_egg_info_reqs_to_simple_reqsN)rrrrabcabstractmethodrNrRrDrdrn staticmethodrrr`rCrrr r r~rrrrrrrrrrrrsB             c@s2eZdZdZGdddZejefddZdS)rzJ A MetaPathFinder capable of discovering installed distributions. c@s(eZdZdZdZddZeddZdS)zDistributionFinder.Contextaw Keyword arguments presented by the caller to ``distributions()`` or ``Distribution.discover()`` to narrow the scope of a search for distributions in all DistributionFinders. Each DistributionFinder may expect any parameters and should attempt to honor the canonical parameters defined below when appropriate. NcKst||dSr?)varsupdate)r%rmrrrrXjsz#DistributionFinder.Context.__init__cCst|dtjS)z The path that a distribution finder should search. Typically refers to Python package paths and defaults to ``sys.path``. r^)rgetrur^r=rrrr^mszDistributionFinder.Context.path)rrrrr.rXrCr^rrrrraXs  racCsdS)z Find distributions. Return an iterable of all Distribution instances capable of loading the metadata for packages matching the ``context``, a DistributionFinder.Context instance. Nr)r%rerrrrswsz%DistributionFinder.find_distributionsN)rrrrrarrrsrrrrrSsc@s@eZdZdZddZddZddZdd Zd d Zd d Z dS)FastPathzF Micro-optimized class for searching a path for children. cCs||_tj||_dSr?)rootosr^basenamelowerbase)r%rrrrrXszFastPath.__init__cCst|j|Sr?)rprqr)r%childrrrjoinpathszFastPath.joinpathc CsTttt|jpdW5QRSQRXtt|W5QRSQRXgS)Nr)r Exceptionrlistdirr zip_childrenr=rrrchildrens  " zFastPath.childrencCs2t|j}|j}|j|_tdd|DS)Ncss |]}|tjddVqdS)rrN)r! posixpathr)r-rrrrrgsz(FastPath.zip_children..)zipfilerqrZnamelistrdictfromkeys)r%Zzip_pathnamesrrrrs    zFastPath.zip_childrencCs&|j}||jkp$||jo$|dS)N.egg)rversionless_egg_name startswithprefixendswith)r%searchrrrris_eggs   zFastPath.is_eggccsZ|D]L}|}||jksH||jr6||jsH||r|dkr||VqdS)Nzegg-info) rr exact_matchesrrrsuffixesrr)r%r.rZn_lowrrrrs    zFastPath.searchN) rrrrrXrrrrrrrrrrs rc@s6eZdZdZdZdZdZdgddZdZddZ dS)PreparedzE A prepared search for metadata on a possibly-named package. r)z .dist-infoz .egg-infoNrcsV|_|dkrdS|dd_jd_fddjD_jd_dS)N-rWcsg|]}j|qSr) normalized)r-suffixr=rrr2sz%Prepared.__init__..r)r.rreplacerrrrr)r%r.rr=rrXs  zPrepared.__init__) rrrrrrrrrrXrrrrrsrc@s,eZdZeefddZeddZdS)MetadataPathFindercCs||j|j}tt|S)a  Find distributions. Return an iterable of all Distribution instances capable of loading the metadata for packages matching ``context.name`` (or all names if ``None`` indicated) along the paths in the list of directories ``context.path``. ) _search_pathsr.r^rro)r0refoundrrrrss z%MetadataPathFinder.find_distributionscs tjfddtt|DS)z1Find metadata directories in paths heuristically.c3s|]}|tVqdSr?)rr)r-r^r_rrrgsz3MetadataPathFinder._search_paths..)rjrkrlrr)r0r.pathsrr_rrsz MetadataPathFinder._search_pathsN)rrrrDrrarsrrrrrrs rc@s.eZdZddZddZejje_ddZdS)rocCs ||_dS)zConstruct a distribution from a path to the metadata directory. :param path: A pathlib.Path or similar object supporting .joinpath(), __div__, .parent, and .read_text(). N)_pathr]rrrrXszPathDistribution.__init__c Cs<tttttt"|j|jddW5QRSQRXdS)NrFrG) rFileNotFoundErrorIsADirectoryErrorKeyErrorNotADirectoryErrorPermissionErrorrrrNr[rrrrNs zPathDistribution.read_textcCs |jj|Sr?)rparentr]rrrrRszPathDistribution.locate_fileN)rrrrXrNrrrRrrrrros rocCs t|S)zGet the ``Distribution`` instance for the named package. :param distribution_name: The name of the distribution package as a string. :return: A ``Distribution`` instance (or subclass thereof). )rrdZdistribution_namerrrr scKs tjf|S)z|Get all ``Distribution`` instances in the current environment. :return: An iterable of ``Distribution`` instances. )rrn)rmrrrr scCs t|jS)zGet the metadata for the named package. :param distribution_name: The name of the distribution package to query. :return: An email.Message containing the parsed metadata. )rrdrrrrrrscCs t|jS)zGet the version string for the named package. :param distribution_name: The name of the distribution package to query. :return: The version string for the package as defined in the package's "Version" metadata key. )r rrrrrr scCsHtjddtD}td}t||d}t||}dd|DS)zwReturn EntryPoint objects for all installed packages. :return: EntryPoint objects for all installed packages. css|] }|jVqdSr?)r )r-rQrrrrgszentry_points..r)keycSsi|]\}}|t|qSr)tuple)r-repsrrrrsz entry_points..)rjrkrlr r attrgettersortedr)rZby_groupZorderedZgroupedrrrr s    cCs t|jS)zReturn a list of files for the named package. :param distribution_name: The name of the distribution package to query. :return: List of files composing the distribution. )r r rrrrr %scCs t|jS)z Return a list of requirements for the named package. :return: An iterator of requirements, suitable for packaging.requirement.Requirement. )r rrrrrr.s),r8rr)rrrurwrprrr"rjr collectionsZ configparserr contextlibr importlibr importlib.abcrr__all__ModuleNotFoundErrorr namedtuplerZ PurePosixPathrErSrrrrrror r rrr r rrrrrsb       NE/0    PK]bߓ섲(_bootstrap_external.cpython-38.opt-1.pycnu[U &.e@sdZddladdlZddladdlZddlZtjdkZerLddlZ ddl Z nddl Z erbddgZ ndgZ e dZ ee Zde Z dde DZd Zd ZeeZd d Zd dZddZddZerddZnddZddZddZddZddZddZerd d!Znd"d!Zdd$d%Z e!e j"Z#d&$d'd(d)Z%e&'e%d(Z(d*Z)d+Z*d,gZ+d-gZ,e,Z-Z.ddd.d/d0Z/d1d2Z0d3d4Z1d5d6Z2d7d8Z3d9d:Z4d;d<Z5d=d>Z6d?d@Z7dAdBZ8ddCdDZ9ddEdFZ:ddHdIZ;dJdKZdde>dLdMdNZ?GdOdPdPZ@GdQdRdRZAGdSdTdTeAZBGdUdVdVZCGdWdXdXeCeBZDGdYdZdZeCeAZEgZFGd[d\d\eCeAZGGd]d^d^ZHGd_d`d`ZIGdadbdbZJGdcddddZKddedfZLdgdhZMdidjZNdkdlZOdmdndodpdqdrdsdtdudvdwdxdydzd{d|d}ZPd~dZQdS)a^Core implementation of path-based import. This module is NOT meant to be directly imported! It has been designed such that it can be bootstrapped into Python as the implementation of import. As such it requires the injection of specific modules and attributes in order to work. One should use importlib as the public-facing version of this module. NZwin32\/cCsh|]}d|qS:.0srr5/usr/lib64/python3.8/importlib/_bootstrap_external.py /sr )win)cygwindarwincs<tjtr0tjtrdndfdd}ndd}|S)N PYTHONCASEOKs PYTHONCASEOKcs tjkS)5True if filenames must be checked case-insensitively.)_osenvironrkeyrr _relax_case@sz%_make_relax_case.._relax_casecSsdS)rFrrrrr rDs)sysplatform startswith_CASE_INSENSITIVE_PLATFORMS#_CASE_INSENSITIVE_PLATFORMS_STR_KEY)rrrr _make_relax_case9s  rcCst|d@ddS)z*Convert a 32-bit integer to little-endian.little)intto_bytes)xrrr _pack_uint32Jsr#cCs t|dS)z/Convert 4 bytes in little-endian to an integer.rr from_bytesdatarrr _unpack_uint32Osr(cCs t|dS)z/Convert 2 bytes in little-endian to an integer.rr$r&rrr _unpack_uint16Tsr)cGs|sdSt|dkr|dSd}g}ttj|D]z\}}|tsL|trf|tpX|}t |g}q0|dr| | kr|}|g}q| |q0|p|}| |q0dd|D}t|dkr|ds|t S|t |S)Replacement for os.path.join().rrrcSsg|]}|r|tqSrrstrippath_separatorsr prrr rs_path_join..) lenmapr_path_splitrootrpath_sep_tupleendswithr-r.path_sepcasefoldappendjoin) path_partsrootpathZnew_roottailrrr _path_join[s*     r@cGstdd|DS)r*cSsg|]}|r|tqSrr,)r partrrr r1{sr2)r8r;)r<rrr r@ys csBtfddtD}|dkr&dfSd||ddfS)z Replacement for os.path.split().c3s|]}|VqdSN)rfindr/r>rr sz_path_split..rrNr+)maxr.)r>irrDr _path_splitsrHcCs t|S)z~Stat the path. Made a separate function to make it easier to override in experiments (e.g. cache stat results). )rstatrDrrr _path_statsrJcCs2z t|}Wntk r"YdSX|jd@|kS)z1Test whether the path is the specified mode type.Fi)rJOSErrorst_mode)r>mode stat_inforrr _path_is_mode_types  rOcCs t|dS)zReplacement for os.path.isfile.i)rOrDrrr _path_isfilesrPcCs|s t}t|dS)zReplacement for os.path.isdir.i@)rgetcwdrOrDrrr _path_isdirsrRcCs>|sdSt|ddd}t|dko<|dp<|dS)Replacement for os.path.isabs.Frrrr+z\\)rr5replacer3rr7)r>r=rrr _path_isabssrUcCs |tS)rS)rr.rDrrr rUsc Csd|t|}t|tjtjBtjB|d@}z2t|d}| |W5QRXt ||Wn:t k rzt |Wnt k rYnXYnXdS)zBest-effort function to write data to a path atomically. Be prepared to handle a FileExistsError if concurrent writing of the temporary file is attempted.{}.{}rVwbN) formatidropenO_EXCLO_CREATO_WRONLY_ioFileIOwriterTrKunlink)r>r'rMpath_tmpfdfilerrr _write_atomicsrfiU rs __pycache__zopt-z.pyz.pyc) optimizationc CsX|dk r4tdt|dk r(d}t||r0dnd}t|}t|\}}|d\}}}tj j } | dkrrt dd |r~|n||| g} |dkrtj jdkrd}ntj j}t|}|dkr|std |d | t|} | td} tjdk rLt|stt|}|dd kr8|dtkr8|d d}ttj|t| St|t| S) aGiven the path to a .py file, return the path to its .pyc file. The .py file does not need to exist; this simply returns the path to the .pyc file calculated as if the .py file were imported. The 'optimization' parameter controls the presumed optimization level of the bytecode file. If 'optimization' is not None, the string representation of the argument is taken and verified to be alphanumeric (else ValueError is raised). The debug_override parameter is deprecated. If debug_override is not None, a True value is the same as setting 'optimization' to the empty string while a False value is equivalent to setting 'optimization' to '1'. If sys.implementation.cache_tag is None then NotImplementedError is raised. NzFthe debug_override parameter is deprecated; use 'optimization' insteadz2debug_override or optimization must be set to Nonerr+.$sys.implementation.cache_tag is Nonerz{!r} is not alphanumericz{}.{}{}rrg) _warningswarnDeprecationWarning TypeErrorrfspathrH rpartitionrimplementation cache_tagNotImplementedErrorr;flagsoptimizestrisalnum ValueErrorrY_OPTBYTECODE_SUFFIXESpycache_prefixrUr@rQr.lstrip_PYCACHE) r>debug_overriderimessageheadr?basesepresttagalmost_filenamefilenamerrr cache_from_sourcebsH       rc Cs.tjjdkrtdt|}t|\}}d}tjdk rftjt }| |t rf|t |d}d}|st|\}}|t krtt d||d}|dkrtd|n\|d kr|dd d }| tstd t|t td}|std |d|dd} t|| tdS)anGiven the path to a .pyc. file, return the path to its .py file. The .pyc file does not need to exist; this simply returns the path to the .py file calculated to correspond to the .pyc file. If path does not conform to PEP 3147/488 format, ValueError will be raised. If sys.implementation.cache_tag is None then NotImplementedError is raised. NrkFTz not bottom-level directory in rj>rgzexpected only 2 or 3 dots in rrgz5optimization portion of filename does not start with zoptimization level z is not an alphanumeric valuer)rrrrsrtrrprHr|r-r.rr8r3r~rycountrsplitrzrx partitionr@SOURCE_SUFFIXES) r>rpycache_filenamefound_in_pycache_prefix stripped_pathpycache dot_countri opt_level base_filenamerrr source_from_caches4          rc Cs~t|dkrdS|d\}}}|r8|dddkr<|Sz t|}Wn$ttfk rl|dd}YnXt|rz|S|S)zConvert a bytecode file path to a source path (if possible). This function exists purely for backwards-compatibility for PyImport_ExecCodeModuleWithFilenames() in the C API. rNrjpy)r3rqlowerrrtryrP) bytecode_pathr_ extension source_pathrrr _get_sourcefiles  rcCsJ|ttr0z t|WStk r,YqFXn|ttrB|SdSdSrB)r7tuplerrrtr{)rrrr _get_cacheds rcCs4zt|j}Wntk r&d}YnX|dO}|S)z3Calculate the mode permissions for a bytecode file.rV)rJrLrK)r>rMrrr _calc_modes  rcsDdfdd }z tj}Wntk r4dd}YnX|||S)zDecorator to verify that the module being requested matches the one the loader can handle. The first argument (self) must define _name which the second argument is compared against. If the comparison fails then ImportError is raised. NcsB|dkr|j}n |j|kr0td|j|f|d||f||S)Nzloader for %s cannot handle %sname)r ImportError)selfrargskwargsmethodrr _check_name_wrappers z(_check_name.._check_name_wrappercSs8dD] }t||rt||t||q|j|jdS)N) __module____name__ __qualname____doc__)hasattrsetattrgetattr__dict__update)newoldrTrrr _wraps z_check_name.._wrap)N) _bootstrapr NameError)rrrrrr _check_names  rcCs<||\}}|dkr8t|r8d}t||dt|S)zTry to find a loader for the specified module by delegating to self.find_loader(). This method is deprecated in favor of finder.find_spec(). Nz,Not importing directory {}: missing __init__r) find_loaderr3rlrmrY ImportWarning)rfullnameloaderportionsmsgrrr _find_module_shims rcCs|dd}|tkr) marshalloads isinstance _code_typerr_imp_fix_co_filenamerrY)r'rrrcoderrr _compile_bytecode~s     rcCsFtt}|td|t||t||t||S)z+Produce the data for a timestamp-based pyc.r bytearrayrextendr#rdumps)rmtimerr'rrr _code_to_timestamp_pycs rTcCs@tt}d|d>B}|t||||t||S)z&Produce the data for a hash-based pyc.r+r)rrcheckedr'rurrr _code_to_hash_pycs   rcCs>ddl}t|j}||}tdd}|||dS)zyDecode bytes representing source code and return the string. Universal newline support is used in the decoding. rNT)tokenizer_BytesIOreadlinedetect_encodingIncrementalNewlineDecoderdecode) source_bytesrsource_bytes_readlineencodingnewline_decoderrrr decode_sources    rrsubmodule_search_locationsc Cs|dkr get_filenameoriginT is_packager)rrrrrpr ModuleSpec _set_fileattr_get_supported_file_loadersr7rr _POPULATErrrHr:) rlocationrrspec loader_classsuffixesrdirnamerrr spec_from_file_locations>        rc@sPeZdZdZdZdZdZeddZeddZ edd d Z edd d Z d S)WindowsRegistryFinderz>Meta path finder for modules declared in the Windows registry.z;Software\Python\PythonCore\{sys_version}\Modules\{fullname}zASoftware\Python\PythonCore\{sys_version}\Modules\{fullname}\DebugFcCs8zttj|WStk r2ttj|YSXdSrB)_winregOpenKeyHKEY_CURRENT_USERrKHKEY_LOCAL_MACHINE)clsrrrr _open_registrysz$WindowsRegistryFinder._open_registryc Csr|jr|j}n|j}|j|dtjddd}z&||}t|d}W5QRXWnt k rlYdSX|S)Nz%d.%drg)r sys_versionr) DEBUG_BUILDREGISTRY_KEY_DEBUG REGISTRY_KEYrYr version_inforr QueryValuerK)rr registry_keyrhkeyfilepathrrr _search_registrys z&WindowsRegistryFinder._search_registryNcCsz||}|dkrdSz t|Wntk r8YdSXtD]4\}}|t|r@tj|||||d}|Sq@dS)Nr)rrJrKrr7rrspec_from_loader)rrr>targetrrrrrrr find_specs  zWindowsRegistryFinder.find_speccCs"|||}|dk r|jSdSdS)zlFind module named in the registry. This method is deprecated. Use exec_module() instead. Nrrrrr>rrrr find_module's z!WindowsRegistryFinder.find_module)NN)N) rrrrr rr classmethodrrrrrrrr rs   rc@s0eZdZdZddZddZddZdd Zd S) _LoaderBasicszSBase class of common code needed by both SourceLoader and SourcelessFileLoader.cCs@t||d}|ddd}|dd}|dko>|dkS)zConcrete implementation of InspectLoader.is_package by checking if the path returned by get_filename has a filename of '__init__.py'.r+rjrrg__init__)rHrrrq)rrr filename_base tail_namerrr r:sz_LoaderBasics.is_packagecCsdSz*Use default semantics for module creation.Nrrrrrr create_moduleBsz_LoaderBasics.create_modulecCs8||j}|dkr$td|jtt||jdS)zExecute the module.Nz4cannot load module {!r} when get_code() returns None)get_coderrrYr_call_with_frames_removedexecr)rmodulerrrr exec_moduleEs  z_LoaderBasics.exec_modulecCs t||S)zThis module is deprecated.)r_load_module_shimrrrrr load_moduleMsz_LoaderBasics.load_moduleN)rrrrrrr"r%rrrr r5s rc@sJeZdZddZddZddZddZd d Zd d d dZddZ dS) SourceLoadercCstdS)zOptional method that returns the modification time (an int) for the specified path (a str). Raises OSError when the path cannot be handled. N)rKrr>rrr path_mtimeTszSourceLoader.path_mtimecCsd||iS)aOptional method returning a metadata dict for the specified path (a str). Possible keys: - 'mtime' (mandatory) is the numeric timestamp of last source code modification; - 'size' (optional) is the size in bytes of the source code. Implementing this method allows the loader to read bytecode files. Raises OSError when the path cannot be handled. r)r(r'rrr path_stats\s zSourceLoader.path_statscCs |||S)zOptional method which writes data (bytes) to a file path (a str). Implementing this method allows for the writing of bytecode files. The source path is needed in order to correctly transfer permissions )set_data)rr cache_pathr'rrr _cache_bytecodejszSourceLoader._cache_bytecodecCsdS)zOptional method which writes data (bytes) to a file path (a str). Implementing this method allows for the writing of bytecode files. Nr)rr>r'rrr r*tszSourceLoader.set_datac CsR||}z||}Wn0tk rH}ztd|d|W5d}~XYnXt|S)z4Concrete implementation of InspectLoader.get_source.z'source not available through get_data()rN)rget_datarKrr)rrr>rexcrrr get_source{s zSourceLoader.get_sourcer) _optimizecCstjt||dd|dS)zReturn the code object compiled from source. The 'data' argument can be any object type that compile() supports. r T) dont_inheritrv)rrcompile)rr'r>r0rrr source_to_codes zSourceLoader.source_to_codec Cs"||}d}d}d}d}d}z t|}Wntk rDd}Yn0Xz||} Wntk rjYn Xt| d}z||} Wntk rYnX||d} zt| || } t| dd} | d@dk}|r$| d @dk}t j d kr8|st j d kr8||}t t |}t | ||| nt| || d || Wnttfk rTYn Xtd ||t| |||dS|dkr||}|||}td|tjs|dk r|dk r|r|dkrt |}t|||} nt||t|} z|||| Wntk rYnX|S)zConcrete implementation of InspectLoader.get_code. Reading of bytecode requires path_stats to be implemented. To write bytecode, set_data must also be implemented. NFTrrrr+rrgneveralwayssizez {} matches {})rrrzcode object from {})rrrtr)rKr r-r memoryviewrcheck_hash_based_pycsr_RAW_MAGIC_NUMBERrrrrrrrr3rdont_write_bytecoderrr3r,)rrrrrr hash_based check_sourcerstr'rru bytes_data code_objectrrr rs               zSourceLoader.get_codeN) rrrr(r)r,r*r/r3rrrrr r&Rs  r&cs|eZdZdZddZddZddZefdd Zed d Z d d Z eddZ ddZ ddZ ddZddZZS) FileLoaderzgBase file loader class which implements the loader protocol methods that require file system usage.cCs||_||_dS)zKCache the module name and the path to the file found by the finder.Nr)rrr>rrr rszFileLoader.__init__cCs|j|jko|j|jkSrB __class__rrotherrrr __eq__s  zFileLoader.__eq__cCst|jt|jASrBhashrr>rrrr __hash__szFileLoader.__hash__cstt||S)zdLoad a module from a file. This method is deprecated. Use exec_module() instead. )superr@r%r$rBrr r%s zFileLoader.load_modulecCs|jSz:Return the path to the source file as found by the finder.rDr$rrr rszFileLoader.get_filenamec Csft|ttfr:tt|}|W5QRSQRXn(t|d}|W5QRSQRXdS)z'Return the data from path as raw bytes.rN)rr&ExtensionFileLoaderr_ open_coderwreadr`)rr>rerrr r-s zFileLoader.get_datacCs||r|SdSrB)rrr!rrr get_resource_readers zFileLoader.get_resource_readercCs tt|jd|}t|dS)NrrM)r@rHr>r_r`rresourcer>rrr open_resourceszFileLoader.open_resourcecCs&||sttt|jd|}|SNr) is_resourceFileNotFoundErrorr@rHr>rSrrr resource_paths zFileLoader.resource_pathcCs(t|kr dStt|jd|}t|S)NFr)r8r@rHr>rPrrr>rrr rW szFileLoader.is_resourcecCsttt|jdSrV)iterrlistdirrHr>rHrrr contents&szFileLoader.contents)rrrrrrErIrr%rr-rRrUrYrWr] __classcell__rrrKr r@s    r@c@s.eZdZdZddZddZdddd Zd S) SourceFileLoaderz>Concrete implementation of SourceLoader using the file system.cCst|}|j|jdS)z!Return the metadata for the path.)rr6)rJst_mtimest_size)rr>r=rrr r).szSourceFileLoader.path_statscCst|}|j|||dS)N_mode)rr*)rrrr'rMrrr r,3sz SourceFileLoader._cache_bytecoderVrbc Cst|\}}g}|r4t|s4t|\}}||qt|D]l}t||}zt|Wq<tk rpYqr'rcparentrr<rAr.rrr r*8s0       zSourceFileLoader.set_dataN)rrrrr)r,r*rrrr r_*sr_c@s eZdZdZddZddZdS)SourcelessFileLoaderz-Loader which handles sourceless file imports.cCsD||}||}||d}t|||tt|dd||dS)Nrr)rr)rr-rrr7)rrr>r'rrrr r[s   zSourcelessFileLoader.get_codecCsdS)z'Return None as there is no source code.Nrr$rrr r/kszSourcelessFileLoader.get_sourceN)rrrrrr/rrrr rhWsrhc@s\eZdZdZddZddZddZdd Zd d Zd d Z ddZ ddZ e ddZ dS)rNz]Loader for extension modules. The constructor is designed to work with FileFinder. cCs@||_t|s6ztt|}Wntk r4YnX||_dSrB)rrUr@rrQrKr>rZrrr r|szExtensionFileLoader.__init__cCs|j|jko|j|jkSrBrArCrrr rEs  zExtensionFileLoader.__eq__cCst|jt|jASrBrFrHrrr rIszExtensionFileLoader.__hash__cCs$ttj|}td|j|j|S)z&Create an unitialized extension modulez&extension module {!r} loaded from {!r})rrrcreate_dynamicrrr>)rrr!rrr rsz!ExtensionFileLoader.create_modulecCs$ttj|td|j|jdS)zInitialize an extension modulez(extension module {!r} executed from {!r}N)rrr exec_dynamicrrr>rQrrr r"s zExtensionFileLoader.exec_modulecs$t|jdtfddtDS)z1Return True if the extension module is a package.r+c3s|]}d|kVqdS)rNrr suffix file_namerr rEsz1ExtensionFileLoader.is_package..)rHr>anyEXTENSION_SUFFIXESr$rrmr rs zExtensionFileLoader.is_packagecCsdS)z?Return None as an extension module cannot create a code object.Nrr$rrr rszExtensionFileLoader.get_codecCsdS)z5Return None as extension modules have no source code.Nrr$rrr r/szExtensionFileLoader.get_sourcecCs|jSrLrDr$rrr rsz ExtensionFileLoader.get_filenameN)rrrrrrErIrr"rrr/rrrrrr rNts rNc@sheZdZdZddZddZddZdd Zd d Zd d Z ddZ ddZ ddZ ddZ ddZdS)_NamespacePatha&Represents a namespace package's path. It uses the module name to find its parent module, and from there it looks up the parent's __path__. When this changes, the module's own path is recomputed, using path_finder. For top-level modules, the parent module's path is sys.path.cCs$||_||_t||_||_dSrB)_name_pathr_get_parent_path_last_parent_path _path_finderrrr> path_finderrrr rsz_NamespacePath.__init__cCs&|jd\}}}|dkrdS|dfS)z>Returns a tuple of (parent-module-name, parent-path-attr-name)rjr)rr>__path__)rrrq)rrgdotmerrr _find_parent_path_namessz&_NamespacePath._find_parent_path_namescCs|\}}ttj||SrB)r|rrmodules)rparent_module_namepath_attr_namerrr rts z_NamespacePath._get_parent_pathcCsPt|}||jkrJ||j|}|dk rD|jdkrD|jrD|j|_||_|jSrB)rrtrurvrrrrrs)r parent_pathrrrr _recalculates  z_NamespacePath._recalculatecCs t|SrB)r[rrHrrr __iter__sz_NamespacePath.__iter__cCs ||SrBr)rindexrrr __getitem__sz_NamespacePath.__getitem__cCs||j|<dSrB)rs)rrr>rrr __setitem__sz_NamespacePath.__setitem__cCs t|SrB)r3rrHrrr __len__sz_NamespacePath.__len__cCs d|jS)Nz_NamespacePath({!r}))rYrsrHrrr __repr__sz_NamespacePath.__repr__cCs ||kSrBrritemrrr __contains__sz_NamespacePath.__contains__cCs|j|dSrB)rsr:rrrr r:sz_NamespacePath.appendN)rrrrrr|rtrrrrrrrr:rrrr rqs  rqc@sPeZdZddZeddZddZddZd d Zd d Z d dZ ddZ dS)_NamespaceLoadercCst||||_dSrB)rqrsrwrrr rsz_NamespaceLoader.__init__cCs d|jS)zsReturn repr for the module. The method is deprecated. The import machinery does the job itself. z)rYr)rr!rrr module_reprsz_NamespaceLoader.module_reprcCsdS)NTrr$rrr rsz_NamespaceLoader.is_packagecCsdS)Nrrr$rrr r/sz_NamespaceLoader.get_sourcecCstdddddS)Nrzr T)r1)r2r$rrr rsz_NamespaceLoader.get_codecCsdSrrrrrr rsz_NamespaceLoader.create_modulecCsdSrBrrQrrr r"sz_NamespaceLoader.exec_modulecCstd|jt||S)zbLoad a namespace module. This method is deprecated. Use exec_module() instead. z&namespace module loaded with path {!r})rrrsr#r$rrr r% sz_NamespaceLoader.load_moduleN) rrrrrrrr/rrr"r%rrrr rs rc@sveZdZdZeddZeddZeddZedd Zedd d Z edd dZ edddZ eddZ d S) PathFinderz>Meta path finder for sys.path and package __path__ attributes.cCs@ttjD],\}}|dkr(tj|=qt|dr|qdS)z}Call the invalidate_caches() method on all path entry finders stored in sys.path_importer_caches (where implemented).Ninvalidate_caches)listrpath_importer_cacheitemsrr)rrfinderrrr rs   zPathFinder.invalidate_cachesc CsTtjdk rtjstdttjD],}z||WStk rLYq"Yq"Xq"dS)z.Search sys.path_hooks for a finder for 'path'.Nzsys.path_hooks is empty)r path_hooksrlrmrr)rr>hookrrr _path_hooks%s   zPathFinder._path_hookscCsh|dkr,z t}Wntk r*YdSXztj|}Wn(tk rb||}|tj|<YnX|S)zGet the finder for the path entry from sys.path_importer_cache. If the path entry is not in the cache, find the appropriate finder and cache it. If no finder is available, store None. rN)rrQrXrrKeyErrorr)rr>rrrr _path_importer_cache2s  zPathFinder._path_importer_cachecCsRt|dr||\}}n||}g}|dk rrnamespace_pathentryrrrrrr _get_specWs(      zPathFinder._get_speccCsd|dkrtj}||||}|dkr(dS|jdkr\|j}|rVd|_t|||j|_|SdSn|SdS)zTry to find a spec for 'fullname' on sys.path or 'path'. The search is based on sys.path_hooks and sys.path_importer_cache. N)rr>rrrrrq)rrr>rrrrrr rws zPathFinder.find_speccCs|||}|dkrdS|jS)zfind the module on sys.path or 'path' based on sys.path_hooks and sys.path_importer_cache. This method is deprecated. Use find_spec() instead. Nrrrrr rs zPathFinder.find_modulecOsddlm}|j||S)a  Find distributions. Return an iterable of all Distribution instances capable of loading the metadata for packages matching ``context.name`` (or all names if ``None`` indicated) along the paths in the list of directories ``context.path``. r)MetadataPathFinder)importlib.metadatarfind_distributions)rrrrrrr rs zPathFinder.find_distributions)N)NN)N) rrrrrrrrrrrrrrrrr rs"       rc@sZeZdZdZddZddZeZddZdd Z dd d Z d dZ e ddZ ddZd S) FileFinderzFile-based finder. Interactions with the file system are cached for performance, being refreshed when the directory the finder is handling has been modified. cspg}|D] \}|fdd|Dq||_|p6d|_t|jsVtt|j|_d|_t|_ t|_ dS)zInitialize with the path to search on and a variable number of 2-tuples containing the loader and the file suffixes the loader recognizes.c3s|]}|fVqdSrBrrkrrr rEsz&FileFinder.__init__..rjrN) r_loadersr>rUr@rrQ _path_mtimeset _path_cache_relaxed_path_cache)rr>loader_detailsloadersrrrr rs   zFileFinder.__init__cCs d|_dS)zInvalidate the directory mtime.rN)rrHrrr rszFileFinder.invalidate_cachescCs*||}|dkrdgfS|j|jp&gfS)zTry to find a loader for the specified module, or the namespace package portions. Returns (loader, list-of-portions). This method is deprecated. Use find_spec() instead. N)rrr)rrrrrr rs zFileFinder.find_loadercCs|||}t||||dS)Nr)r)rrrr>smslrrrrr rs zFileFinder._get_specNc Csd}|dd}zt|jp"tj}Wntk rBd}YnX||jkr\|||_t rr|j }| }n |j }|}||krt |j|}|jD]:\} } d| } t || } t| r|| || |g|Sqt|}|jD]r\} } zt |j|| } Wntk rYdSXtjd| dd|| |krt| r|| || d|Sq|r~td |t|d} |g| _| SdS) zoTry to find a spec for the specified module. Returns the matching spec, or None if not found. FrjrgrrNz trying {}) verbosityzpossible namespace for {})rqrJr>rrQr`rKr _fill_cacherrrrr@rrPrrRryrrrr)rrr is_namespace tail_modulercache cache_module base_pathrlr init_filename full_pathrrrr rsP           zFileFinder.find_specc Cs|j}zt|pt}Wntttfk r:g}YnXtj dsTt ||_ nJt }|D]8}| d\}}}|rd ||}n|}||q^||_ tj trdd|D|_dS)zDFill the cache of potential modules and packages for this directory.r rjrWcSsh|] }|qSr)r)r fnrrr r *sz)FileFinder._fill_cache..N)r>rr\rQrXPermissionErrorNotADirectoryErrorrrrrrrrYraddrr) rr>r]lower_suffix_contentsrrrzrlnew_namerrr r s"     zFileFinder._fill_cachecsfdd}|S)aA class method which returns a closure to use on sys.path_hook which will return an instance using the specified loaders and the path called on the closure. If the path called on the closure is not a directory, ImportError is raised. cs"t|std|d|fS)z-Path hook for importlib.machinery.FileFinder.zonly directories are supportedrD)rRrrDrrrr path_hook_for_FileFinder6s z6FileFinder.path_hook..path_hook_for_FileFinderr)rrrrrr path_hook,s zFileFinder.path_hookcCs d|jS)NzFileFinder({!r}))rYr>rHrrr r>szFileFinder.__repr__)N)rrrrrrrrrrrrrrrrrrr rs  3 rcCs|d}|d}|sB|r$|j}n||kr8t||}n t||}|sTt|||d}z$||d<||d<||d<||d<Wntk rYnXdS)N __loader____spec__r__file__ __cached__)getrrhr_r Exception)nsrpathname cpathnamerrrrr _fix_up_moduleDs"     rcCs*tttf}ttf}ttf}|||gS)z_Returns a list of file-based module loaders. Each item is a tuple (loader, suffixes). )rN_alternative_architecturesrextension_suffixesr_rrhr{) extensionssourcebytecoderrr r[src Cs|atjatjatjt}dD]0}|tjkr8t|}n tj|}t|||qddgfdddgff}|D]X\}}|d}|tjkrtj|}qqjzt|}WqWqjtk rYqjYqjXqjtdt|d|t|d |t|d d |t|d d d|Dtd} t|d| td} t|d| |dkrXtd} t|d| t|dt t t t |dkrtddt krdt_dS)zSetup the path-based importers for importlib by importing needed built-in modules and injecting them into the global namespace. Other components are extracted from the core bootstrap module. )r_rlbuiltinsrposixrntrrzimportlib requires posix or ntrr8r.r_pathseps_with_coloncSsh|]}d|qSrrrrrr r sz_setup.._thread_weakrefwinregrrz.pywz_d.pydTN)rrrr}r_builtin_from_namerrr;rrprrrrr:rr) _bootstrap_module self_module builtin_namebuiltin_module os_details builtin_osr.r8 os_module thread_moduleweakref_module winreg_modulerrr _setupfsL                      rcCs2t|t}tjtj|gtjt dS)z)Install the path-based import components.N) rrrrrrr meta_pathr:r)rsupported_loadersrrr _installsr-arm-linux-gnueabihf.-armeb-linux-gnueabihf.-mips64-linux-gnuabi64.-mips64el-linux-gnuabi64.-powerpc-linux-gnu.-powerpc-linux-gnuspe.-powerpc64-linux-gnu.-powerpc64le-linux-gnu.-arm-linux-gnueabi.-armeb-linux-gnueabi.-mips64-linux-gnu.-mips64el-linux-gnu.-ppc-linux-gnu.-ppc-linux-gnuspe.-ppc64-linux-gnu.-ppc64le-linux-gnu.)rrrrrrrrrrrrrrrrcCsF|D]<}tD].\}}||kr|||||Sqq|S)zAdd a suffix with an alternative architecture name to the list of suffixes so an extension built with the default (upstream) setting is loadable with our Pythons ) _ARCH_MAPrr:rT)rrloriginal alternativerrr rs r)rV)N)NNN)rr)T)N)N)Rrrr_rrlrr _MS_WINDOWSrrrrr.r8rr6r;rr%_CASE_INSENSITIVE_PLATFORMS_BYTES_KEYrrr#r(r)r@rHrJrOrPrRrUrftype__code__rr!rr r%r9r~rzrr{DEBUG_BYTECODE_SUFFIXESOPTIMIZED_BYTECODE_SUFFIXESrrrrrrrrrrrrrrobjectrrrrr&r@r_rhrprNrqrrrrrrrrrrrrr s            G(  !  D@H-:?*  A PK]ZBφφ(_bootstrap_external.cpython-38.opt-2.pycnu[U &.e@sddladdlZddladdlZddlZtjdkZerHddlZddl Z nddl Zer^ddgZ ndgZ e dZ e e Zde Z dde DZdZd ZeeZd d Zd d ZddZddZerddZnddZddZddZddZddZddZer dd Znd!d Zdd#d$Ze ej!Z"d%#d&d'd(Z$e%&e$d'Z'd)Z(d*Z)d+gZ*d,gZ+e+Z,Z-ddd-d.d/Z.d0d1Z/d2d3Z0d4d5Z1d6d7Z2d8d9Z3d:d;Z4dd?Z6d@dAZ7ddBdCZ8ddDdEZ9ddGdHZ:dIdJZ;e<Z=dde=dKdLdMZ>GdNdOdOZ?GdPdQdQZ@GdRdSdSe@ZAGdTdUdUZBGdVdWdWeBeAZCGdXdYdYeBe@ZDgZEGdZd[d[eBe@ZFGd\d]d]ZGGd^d_d_ZHGd`dadaZIGdbdcdcZJddddeZKdfdgZLdhdiZMdjdkZNdldmdndodpdqdrdsdtdudvdwdxdydzd{d|ZOd}d~ZPdS)NZwin32\/cCsh|]}d|qS:.0srr5/usr/lib64/python3.8/importlib/_bootstrap_external.py /sr )win)cygwindarwincs<tjtr0tjtrdndfdd}ndd}|S)N PYTHONCASEOKs PYTHONCASEOKcs tjkSN)_osenvironrkeyrr _relax_case@sz%_make_relax_case.._relax_casecSsdS)NFrrrrr rDs)sysplatform startswith_CASE_INSENSITIVE_PLATFORMS#_CASE_INSENSITIVE_PLATFORMS_STR_KEY)rrrr _make_relax_case9s  rcCst|d@ddS)Nlittle)intto_bytes)xrrr _pack_uint32Jsr#cCs t|dSNrr from_bytesdatarrr _unpack_uint32Osr)cCs t|dSr$r%r'rrr _unpack_uint16Tsr*cGs|sdSt|dkr|dSd}g}ttj|D]z\}}|tsL|trf|tpX|}t |g}q0|dr| | kr|}|g}q| |q0|p|}| |q0dd|D}t|dkr|ds|t S|t |S)NrrrcSsg|]}|r|tqSrrstrippath_separatorsr prrr rs_path_join..) lenmapr_path_splitrootrpath_sep_tupleendswithr-r.path_sepcasefoldappendjoin) path_partsrootpathZnew_roottailrrr _path_join[s*     r@cGstdd|DS)NcSsg|]}|r|tqSrr,)r partrrr r1{sr2)r8r;)r<rrr r@ys csBtfddtD}|dkr&dfSd||ddfS)Nc3s|]}|VqdSr)rfindr/r>rr sz_path_split..rrr+)maxr.)r>irrCr _path_splitsrGcCs t|Sr)rstatrCrrr _path_statsrIcCs2z t|}Wntk r"YdSX|jd@|kS)NFi)rIOSErrorst_mode)r>mode stat_inforrr _path_is_mode_types  rNcCs t|dS)Ni)rNrCrrr _path_isfilesrOcCs|s t}t|dS)Ni@)rgetcwdrNrCrrr _path_isdirsrQcCs>|sdSt|ddd}t|dko<|dp<|dS)NFrrrr+z\\)rr5replacer3rr7)r>r=rrr _path_isabssrScCs |tSr)rr.rCrrr rSsc Csd|t|}t|tjtjBtjB|d@}z2t|d}| |W5QRXt ||Wn:t k rzt |Wnt k rYnXYnXdS)N{}.{}rTwb) formatidropenO_EXCLO_CREATO_WRONLY_ioFileIOwriterRrJunlink)r>r(rLpath_tmpfdfilerrr _write_atomicsrdiU rs __pycache__zopt-z.pyz.pyc) optimizationc CsX|dk r4tdt|dk r(d}t||r0dnd}t|}t|\}}|d\}}}tj j } | dkrrt dd |r~|n||| g} |dkrtj jdkrd}ntj j}t|}|dkr|std|d | t|} | td} tjdk rLt|stt|}|dd kr8|dtkr8|d d}ttj|t| St|t| S) NzFthe debug_override parameter is deprecated; use 'optimization' insteadz2debug_override or optimization must be set to Nonerr+.$sys.implementation.cache_tag is Nonerz{!r} is not alphanumericz{}.{}{}rre) _warningswarnDeprecationWarning TypeErrorrfspathrG rpartitionrimplementation cache_tagNotImplementedErrorr;flagsoptimizestrisalnum ValueErrorrW_OPTBYTECODE_SUFFIXESpycache_prefixrSr@rPr.lstrip_PYCACHE) r>debug_overridergmessageheadr?basesepresttagalmost_filenamefilenamerrr cache_from_sourcebsH       rc Cs.tjjdkrtdt|}t|\}}d}tjdk rftjt }| |t rf|t |d}d}|st|\}}|t krtt d||d}|dkrtd|n\|dkr|dd d }| tstd t|t td}|std |d |dd} t|| tdS)NriFTz not bottom-level directory in rh>rezexpected only 2 or 3 dots in rrez5optimization portion of filename does not start with zoptimization level z is not an alphanumeric valuer)rrprqrrrrnrGrzr-r.rr8r3r|rwcountrsplitrxrv partitionr@SOURCE_SUFFIXES) r>rpycache_filenamefound_in_pycache_prefix stripped_pathpycache dot_countrg opt_level base_filenamerrr source_from_caches4          rc Cs~t|dkrdS|d\}}}|r8|dddkr<|Sz t|}Wn$ttfk rl|dd}YnXt|rz|S|S)Nrrhpy)r3rolowerrrrrwrO) bytecode_pathr_ extension source_pathrrr _get_sourcefiles  rcCsJ|ttr0z t|WStk r,YqFXn|ttrB|SdSdSr)r7tuplerrrrry)rrrr _get_cacheds rcCs4zt|j}Wntk r&d}YnX|dO}|S)NrT)rIrKrJ)r>rLrrr _calc_modes  rcsDdfdd }z tj}Wntk r4dd}YnX|||S)NcsB|dkr|j}n |j|kr0td|j|f|d||f||S)Nzloader for %s cannot handle %sname)r ImportError)selfrargskwargsmethodrr _check_name_wrappers z(_check_name.._check_name_wrappercSs8dD] }t||rt||t||q|j|jdS)N) __module____name__ __qualname____doc__)hasattrsetattrgetattr__dict__update)newoldrRrrr _wraps z_check_name.._wrap)N) _bootstrapr NameError)rrrrrr _check_names  rcCs<||\}}|dkr8t|r8d}t||dt|S)Nz,Not importing directory {}: missing __init__r) find_loaderr3rjrkrW ImportWarning)rfullnameloaderportionsmsgrrr _find_module_shims rcCs|dd}|tkr) marshalloads isinstance _code_typerr_imp_fix_co_filenamerrW)r(rrrcoderrr _compile_bytecode~s     rcCsFtt}|td|t||t||t||SNr bytearrayrextendr#rdumps)rmtimerr(rrr _code_to_timestamp_pycs rTcCs@tt}d|d>B}|t||||t||S)Nr+r)rrcheckedr(rsrrr _code_to_hash_pycs   rcCs>ddl}t|j}||}tdd}|||dS)NrT)tokenizer]BytesIOreadlinedetect_encodingIncrementalNewlineDecoderdecode) source_bytesrsource_bytes_readlineencodingnewline_decoderrrr decode_sources    rrsubmodule_search_locationsc Cs|dkr get_filenameoriginT is_packager)rrrrrnr ModuleSpec _set_fileattr_get_supported_file_loadersr7rr _POPULATErrrGr:) rlocationrrspec loader_classsuffixesrdirnamerrr spec_from_file_locations>        rc@sLeZdZdZdZdZeddZeddZed d d Z edd d Z dS)WindowsRegistryFinderz;Software\Python\PythonCore\{sys_version}\Modules\{fullname}zASoftware\Python\PythonCore\{sys_version}\Modules\{fullname}\DebugFcCs8zttj|WStk r2ttj|YSXdSr)_winregOpenKeyHKEY_CURRENT_USERrJHKEY_LOCAL_MACHINE)clsrrrr _open_registrysz$WindowsRegistryFinder._open_registryc Csr|jr|j}n|j}|j|dtjddd}z&||}t|d}W5QRXWnt k rlYdSX|S)Nz%d.%dre)r sys_versionr) DEBUG_BUILDREGISTRY_KEY_DEBUG REGISTRY_KEYrWr version_inforr QueryValuerJ)rr registry_keyrhkeyfilepathrrr _search_registrys z&WindowsRegistryFinder._search_registryNcCsz||}|dkrdSz t|Wntk r8YdSXtD]4\}}|t|r@tj|||||d}|Sq@dS)Nr)rrIrJrr7rrspec_from_loader)rrr>targetr rrrrrr find_specs  zWindowsRegistryFinder.find_speccCs"|||}|dk r|jSdSdSrrrrrr>rrrr find_module's z!WindowsRegistryFinder.find_module)NN)N) rrrrrr classmethodrrrrrrrr rs   rc@s,eZdZddZddZddZddZd S) _LoaderBasicscCs@t||d}|ddd}|dd}|dko>|dkS)Nr+rhrre__init__)rGrrro)rrr filename_base tail_namerrr r:sz_LoaderBasics.is_packagecCsdSrrrrrrr create_moduleBsz_LoaderBasics.create_modulecCs8||j}|dkr$td|jtt||jdS)Nz4cannot load module {!r} when get_code() returns None)get_coderrrWr_call_with_frames_removedexecr)rmodulerrrr exec_moduleEs  z_LoaderBasics.exec_modulecCs t||Sr)r_load_module_shimrrrrr load_moduleMsz_LoaderBasics.load_moduleN)rrrrrr r#rrrr r5src@sJeZdZddZddZddZddZd d Zd d d dZddZ dS) SourceLoadercCstdSr)rJrr>rrr path_mtimeTszSourceLoader.path_mtimecCsd||iS)Nr)r&r%rrr path_stats\s zSourceLoader.path_statscCs |||Sr)set_data)rr cache_pathr(rrr _cache_bytecodejszSourceLoader._cache_bytecodecCsdSrr)rr>r(rrr r(tszSourceLoader.set_datac CsR||}z||}Wn0tk rH}ztd|d|W5d}~XYnXt|S)Nz'source not available through get_data()r)rget_datarJrr)rrr>rexcrrr get_source{s zSourceLoader.get_sourcer) _optimizecCstjt||dd|dS)NrT) dont_inheritrt)rrcompile)rr(r>r.rrr source_to_codes zSourceLoader.source_to_codec Cs"||}d}d}d}d}d}z t|}Wntk rDd}Yn0Xz||} Wntk rjYn Xt| d}z||} Wntk rYnX||d} zt| || } t| dd} | d@dk}|r$| d@dk}t j d kr8|st j d kr8||}t t |}t | ||| nt| || d || Wnttfk rTYn Xtd ||t| |||d S|dkr||}|||}td|tjs|dk r|dk r|r|dkrt |}t|||} nt||t|} z|||| Wntk rYnX|S)NFTrrrr+rreneveralwayssizez {} matches {})rrrzcode object from {})rrrrr'rJr r+r memoryviewrcheck_hash_based_pycsr_RAW_MAGIC_NUMBERrrrrrrrr1rdont_write_bytecoderrr3r*)rrrrrr hash_based check_sourcerstr(rrs bytes_data code_objectrrr rs               zSourceLoader.get_codeN) rrrr&r'r*r(r-r1rrrrr r$Rs  r$csxeZdZddZddZddZefddZed d Zd d Z ed dZ ddZ ddZ ddZ ddZZS) FileLoadercCs||_||_dSrr)rrr>rrr rszFileLoader.__init__cCs|j|jko|j|jkSr __class__rrotherrrr __eq__s  zFileLoader.__eq__cCst|jt|jASrhashrr>rrrr __hash__szFileLoader.__hash__cstt||Sr)superr>r#r"r@rr r#s zFileLoader.load_modulecCs|jSrrCr"rrr rszFileLoader.get_filenamec Csft|ttfr:tt|}|W5QRSQRXn(t|d}|W5QRSQRXdS)Nr)rr$ExtensionFileLoaderr] open_coderureadr^)rr>rcrrr r+s zFileLoader.get_datacCs||r|SdSr)rrrrrr get_resource_readers zFileLoader.get_resource_readercCs tt|jd|}t|dS)NrrJ)r@rGr>r]r^rresourcer>rrr open_resourceszFileLoader.open_resourcecCs&||sttt|jd|}|Sr) is_resourceFileNotFoundErrorr@rGr>rPrrr resource_paths zFileLoader.resource_pathcCs(t|kr dStt|jd|}t|S)NFr)r8r@rGr>rOrrr>rrr rS szFileLoader.is_resourcecCsttt|jdSr)iterrlistdirrGr>rFrrr contents&szFileLoader.contents)rrrrrCrGrr#rr+rOrRrUrSrY __classcell__rrrIr r>s    r>c@s*eZdZddZddZddddZd S) SourceFileLoadercCst|}|j|jdS)N)rr4)rIst_mtimest_size)rr>r;rrr r'.szSourceFileLoader.path_statscCst|}|j|||dS)N_mode)rr()rrrr(rLrrr r*3sz SourceFileLoader._cache_bytecoderTr^c Cst|\}}g}|r4t|s4t|\}}||qt|D]l}t||}zt|Wq<tk rpYqr(r_parentrr<rAr,rrr r(8s0       zSourceFileLoader.set_dataN)rrrr'r*r(rrrr r[*sr[c@seZdZddZddZdS)SourcelessFileLoadercCsD||}||}||d}t|||tt|dd||dS)Nrr)rr)rr+rrr5)rrr>r(rrrr r[s   zSourcelessFileLoader.get_codecCsdSrrr"rrr r-kszSourcelessFileLoader.get_sourceN)rrrrr-rrrr rdWsrdc@sXeZdZddZddZddZddZd d Zd d Zd dZ ddZ e ddZ dS)rKcCs@||_t|s6ztt|}Wntk r4YnX||_dSr)rrSr@rrPrJr>rVrrr r|szExtensionFileLoader.__init__cCs|j|jko|j|jkSrr?rArrr rCs  zExtensionFileLoader.__eq__cCst|jt|jASrrDrFrrr rGszExtensionFileLoader.__hash__cCs$ttj|}td|j|j|S)Nz&extension module {!r} loaded from {!r})rrrcreate_dynamicrrr>)rrrrrr rsz!ExtensionFileLoader.create_modulecCs$ttj|td|j|jdS)Nz(extension module {!r} executed from {!r})rrr exec_dynamicrrr>rNrrr r s zExtensionFileLoader.exec_modulecs$t|jdtfddtDS)Nr+c3s|]}d|kVqdS)rNrr suffix file_namerr rDsz1ExtensionFileLoader.is_package..)rGr>anyEXTENSION_SUFFIXESr"rrir rs zExtensionFileLoader.is_packagecCsdSrrr"rrr rszExtensionFileLoader.get_codecCsdSrrr"rrr r-szExtensionFileLoader.get_sourcecCs|jSrrCr"rrr rsz ExtensionFileLoader.get_filenameN) rrrrrCrGrr rrr-rrrrrr rKts rKc@sdeZdZddZddZddZddZd d Zd d Zd dZ ddZ ddZ ddZ ddZ dS)_NamespacePathcCs$||_||_t||_||_dSr)_name_pathr_get_parent_path_last_parent_path _path_finderrrr> path_finderrrr rsz_NamespacePath.__init__cCs&|jd\}}}|dkrdS|dfS)Nrhr)rr>__path__)rnro)rrcdotmerrr _find_parent_path_namessz&_NamespacePath._find_parent_path_namescCs|\}}ttj||Sr)rxrrmodules)rparent_module_namepath_attr_namerrr rps z_NamespacePath._get_parent_pathcCsPt|}||jkrJ||j|}|dk rD|jdkrD|jrD|j|_||_|jSr)rrprqrrrnrrro)r parent_pathrrrr _recalculates  z_NamespacePath._recalculatecCs t|Sr)rWr}rFrrr __iter__sz_NamespacePath.__iter__cCs ||Srr})rindexrrr __getitem__sz_NamespacePath.__getitem__cCs||j|<dSr)ro)rrr>rrr __setitem__sz_NamespacePath.__setitem__cCs t|Sr)r3r}rFrrr __len__sz_NamespacePath.__len__cCs d|jS)Nz_NamespacePath({!r}))rWrorFrrr __repr__sz_NamespacePath.__repr__cCs ||kSrrritemrrr __contains__sz_NamespacePath.__contains__cCs|j|dSr)ror:rrrr r:sz_NamespacePath.appendN)rrrrrxrpr}r~rrrrrr:rrrr rms  rmc@sPeZdZddZeddZddZddZd d Zd d Z d dZ ddZ dS)_NamespaceLoadercCst||||_dSr)rmrorsrrr rsz_NamespaceLoader.__init__cCs d|jS)Nz)rWr)rrrrr module_reprsz_NamespaceLoader.module_reprcCsdS)NTrr"rrr rsz_NamespaceLoader.is_packagecCsdSNrrr"rrr r-sz_NamespaceLoader.get_sourcecCstdddddS)NrzrT)r/)r0r"rrr rsz_NamespaceLoader.get_codecCsdSrrrrrr rsz_NamespaceLoader.create_modulecCsdSrrrNrrr r sz_NamespaceLoader.exec_modulecCstd|jt||S)Nz&namespace module loaded with path {!r})rrror!r"rrr r# sz_NamespaceLoader.load_moduleN) rrrrrrrr-rrr r#rrrr rs rc@sreZdZeddZeddZeddZeddZedd d Zedd d Z edddZ eddZ d S) PathFindercCs@ttjD],\}}|dkr(tj|=qt|dr|qdS)Ninvalidate_caches)listrpath_importer_cacheitemsrr)rrfinderrrr rs   zPathFinder.invalidate_cachesc CsTtjdk rtjstdttjD],}z||WStk rLYq"Yq"Xq"dS)Nzsys.path_hooks is empty)r path_hooksrjrkrr)rr>hookrrr _path_hooks%s   zPathFinder._path_hookscCsh|dkr,z t}Wntk r*YdSXztj|}Wn(tk rb||}|tj|<YnX|Sr)rrPrTrrKeyErrorr)rr>rrrr _path_importer_cache2s  zPathFinder._path_importer_cachecCsRt|dr||\}}n||}g}|dk rrnamespace_pathentryrrrrrr _get_specWs(      zPathFinder._get_speccCsd|dkrtj}||||}|dkr(dS|jdkr\|j}|rVd|_t|||j|_|SdSn|SdSr)rr>rrrrrm)rrr>rrrrrr rws zPathFinder.find_speccCs|||}|dkrdS|jSrrrrrr rs zPathFinder.find_modulecOsddlm}|j||S)Nr)MetadataPathFinder)importlib.metadatarfind_distributions)rrrrrrr rs zPathFinder.find_distributions)N)NN)N) rrrrrrrrrrrrrrrr rs        rc@sVeZdZddZddZeZddZddZdd d Z d d Z e ddZ ddZ d S) FileFindercspg}|D] \}|fdd|Dq||_|p6d|_t|jsVtt|j|_d|_t|_ t|_ dS)Nc3s|]}|fVqdSrrrgrrr rDsz&FileFinder.__init__..rhr) r_loadersr>rSr@rrP _path_mtimeset _path_cache_relaxed_path_cache)rr>loader_detailsloadersrrrr rs   zFileFinder.__init__cCs d|_dS)Nr)rrFrrr rszFileFinder.invalidate_cachescCs*||}|dkrdgfS|j|jp&gfSr)rrr)rrrrrr rs zFileFinder.find_loadercCs|||}t||||dS)Nr)r)rrrr>smslrrrrr rs zFileFinder._get_specNc Csd}|dd}zt|jp"tj}Wntk rBd}YnX||jkr\|||_t rr|j }| }n |j }|}||krt |j|}|jD]:\} } d| } t || } t| r|| || |g|Sqt|}|jD]r\} } zt |j|| } Wntk rYdSXtjd| dd|| |krt| r|| || d|Sq|r~td|t|d} |g| _| SdS) NFrhrerrz trying {}) verbosityzpossible namespace for {})rorIr>rrPr\rJr _fill_cacherrrrr@rrOrrQrwrrrr)rrr is_namespace tail_modulercache cache_module base_pathrhr init_filename full_pathrrrr rsP           zFileFinder.find_specc Cs|j}zt|pt}Wntttfk r:g}YnXtj dsTt ||_ nJt }|D]8}| d\}}}|rd ||}n|}||q^||_ tj trdd|D|_dS)Nr rhrUcSsh|] }|qSr)r)r fnrrr r *sz)FileFinder._fill_cache..)r>rrXrPrTPermissionErrorNotADirectoryErrorrrrrrrrWraddrr) rr>rYlower_suffix_contentsrrrvrhnew_namerrr r s"     zFileFinder._fill_cachecsfdd}|S)Ncs"t|std|d|fS)Nzonly directories are supportedrC)rQrrCrrrr path_hook_for_FileFinder6s z6FileFinder.path_hook..path_hook_for_FileFinderr)rrrrrr path_hook,s zFileFinder.path_hookcCs d|jS)NzFileFinder({!r}))rWr>rFrrr r>szFileFinder.__repr__)N)rrrrrrrrrrrrrrrrrr rs   3 rcCs|d}|d}|sB|r$|j}n||kr8t||}n t||}|sTt|||d}z$||d<||d<||d<||d<Wntk rYnXdS)N __loader____spec__r__file__ __cached__)getrrdr[r Exception)nsrpathname cpathnamerrrrr _fix_up_moduleDs"     rcCs*tttf}ttf}ttf}|||gSr)rK_alternative_architecturesrextension_suffixesr[rrdry) extensionssourcebytecoderrr r[src Cs|atjatjatjt}dD]0}|tjkr8t|}n tj|}t|||qddgfdddgff}|D]X\}}|d}|tjkrtj|}qqjzt|}WqWqjtk rYqjYqjXqjtdt|d|t|d |t|d d |t|d d d|Dtd} t|d| td} t|d| |dkrXtd} t|d| t|dt t t t |dkrtddt krdt_dS)N)r]rjbuiltinsrposixrntrrzimportlib requires posix or ntrr8r.r_pathseps_with_coloncSsh|]}d|qSrrrrrr r sz_setup.._thread_weakrefwinregrrz.pywz_d.pydT)rrrryr_builtin_from_namerrr;rrlrrrrr:rr) _bootstrap_module self_module builtin_namebuiltin_module os_details builtin_osr.r8 os_module thread_moduleweakref_module winreg_modulerrr _setupfsL                      rcCs2t|t}tjtj|gtjt dSr) rrrrrrr meta_pathr:r)rsupported_loadersrrr _installsr-arm-linux-gnueabihf.-armeb-linux-gnueabihf.-mips64-linux-gnuabi64.-mips64el-linux-gnuabi64.-powerpc-linux-gnu.-powerpc-linux-gnuspe.-powerpc64-linux-gnu.-powerpc64le-linux-gnu.-arm-linux-gnueabi.-armeb-linux-gnueabi.-mips64-linux-gnu.-mips64el-linux-gnu.-ppc-linux-gnu.-ppc-linux-gnuspe.-ppc64-linux-gnu.-ppc64le-linux-gnu.)rrrrrrrrrrrrrrrrcCsF|D]<}tD].\}}||kr|||||Sqq|Sr) _ARCH_MAPrr:rR)rrhoriginal alternativerrr rs r)rT)N)NNN)rr)T)N)N)Qrr]rrjrr _MS_WINDOWSrrrrr.r8rr6r;rr%_CASE_INSENSITIVE_PLATFORMS_BYTES_KEYrrr#r)r*r@rGrIrNrOrQrSrdtype__code__rr!rr r&r7r|rxrryDEBUG_BYTECODE_SUFFIXESOPTIMIZED_BYTECODE_SUFFIXESrrrrrrrrrrrrrrobjectrrrrr$r>r[rdrlrKrmrrrrrrrrrrrrr s            G(  !  D@H-:?*  A PK]/ppresources.cpython-38.pycnu[U e5d@% @sddlZddlZddlmZddlmZmZddlm Z ddl m Z ddl m Z mZddlmZdd lmZdd lmZmZmZmZmZdd lmZdd lmZmZdd lmZdddddddddg Zee efZ!ee ej"fZ#edddZ$e dddZ%eeej&dddZ'dd Z(e!e#ed!d"dZ)d-e!e#e e ed%d&dZ*e!e#e+d!d'dZ,d.e!e#e e e d%d(dZ-ee!e#eed!d)dZ.e!e e/d*d+dZ0e!ee dd,dZ1dS)/N)abc)contextmanagersuppress) import_module)ResourceLoader)BytesIO TextIOWrapper)Path) ModuleType)IterableIteratorOptionalSetUnion)cast)BinaryIOTextIO)ZipImportErrorPackageResourcecontents is_resource open_binary open_textpath read_binary read_text)returncCs\t|dr0|jjdkr*td|jjqX|Sn(t|}|jjdkrTtd|n|SdS)zTake a package name or module object and return the module. If a name, the module is imported. If the passed or imported module object is not a package, raise an exception. __spec__Nz{!r} is not a package)hasattrrsubmodule_search_locations TypeErrorformatnamer)packagemoduler'+/usr/lib64/python3.8/importlib/resources.py _get_package"s   r)cCs,tj|\}}|r$td|n|SdS)zNormalize a path by ensuring it is a string. If the resulting string contains path separators, an exception is raised. z{!r} must be only a file nameN)osrsplit ValueErrorr#)rparent file_namer'r'r(_normalize_path6sr/)r%rcCs,|j}t|jdr(ttj|j|jSdS)Nget_resource_reader)rr loaderr resources_abcResourceReaderr0r$)r%specr'r'r(_get_resource_readerBs   r5cCs&|jjdks|jjs"td|dS)NzPackage has no location )rorigin has_locationFileNotFoundError)r%r'r'r(_check_locationPsr9)r%resourcerc Cst|}t|}t|}|dk r*||St|tj|jj }tj |}tj ||}zt |ddWSt k rtt|jj}d}t|jjdrtt ||}W5QRX|dkr|jj}d||} t| n t|YSYnXdS)zDReturn a file-like object opened for binary reading of the resource.Nrb)modeget_data{!r} resource not found in {!r})r/r)r5 open_resourcer9r*rabspathrr6dirnamejoinopenOSErrorrrr1r rr=r$r#r8r) r%r:readerabsolute_package_path package_path full_pathr1data package_namemessager'r'r(rUs2    utf-8strict)r%r:encodingerrorsrc Cs t|}t|}t|}|dk r2t||||St|tj|j j }tj |}tj ||}zt |d||dWStk rtt|j j}d} t|j jdrtt||} W5QRX| dkr|j j} d|| } t| ntt| ||YSYnXdS)zBReturn a file-like object opened for text reading of the resource.Nr)r<rNrOr=r>)r/r)r5r r?r9r*rr@rr6rArBrCrDrrr1r rr=r$r#r8r) r%r:rNrOrErFrGrHr1rIrJrKr'r'r(rts2   c Cs:t|}t|}t||}|W5QRSQRXdS)z+Return the binary contents of the resource.N)r/r)rread)r%r:fpr'r'r(rs c Cs>t|}t|}t||||}|W5QRSQRXdS)zReturn the decoded string of the resource. The decoding-related arguments have the same semantics as those of bytes.decode(). N)r/r)rrQ)r%r:rNrOrRr'r'r(rs c cst|}t|}t|}|dk rNzt||VWdStk rJYqVXnt|d}|jjdk r|t|jjj }||}|dk r| r|Vnxt ||}| }W5QRXt \}}z$t||t|t|VW5zt|Wntk rYnXXdS)akA context manager providing a file path object to the resource. If the resource does not already exist on its own on the file system, a temporary file will be created. If the file was created, the file will be deleted upon exiting the context manager (no exception is raised if the file was deleted prior to the context manager exiting). N)r/r)r5r resource_pathr8r9rr6r-existsrrQtempfileZmkstempr*removewriteclose) r%r:rEZ file_pathpackage_directoryrRrIfdZraw_pathr'r'r(rs6      )r%r$rc Cs|t|}t|t|}|dk r*||Sztt|}Wnttfk rTYdSX||krbdSt|j j j |}| S)zYTrue if 'name' is a resource inside 'package'. Directories are *not* resources. NF) r)r/r5rsetrNotADirectoryErrorr8r rr6r-is_file)r%r$rEZpackage_contentsrr'r'r(rs cCsTt|}t|}|dk r |S|jjdks4|jjs8dSt|jjj}t |SdS)zReturn an iterable of entries in 'package'. Note that not all entries are resources. Specifically, directories are not considered resources. Use `is_resource()` on each entry returned here to check if it is a resource or not. Nr') r)r5rrr6r7r r-r*listdir)r%rErYr'r'r(rs)rLrM)rLrM)2r*rUrr2 contextlibrr importlibr importlib.abcriorr pathlibr typesr typingr r rrrrZ typing.iorrZ zipimportr__all__strrPathLikerr)r/r3r5r9rrbytesrrrboolrrr'r'r'r(sh          ! "  .PK]gmachinery.cpython-38.opt-1.pycnu[U e5dL@sdZddlZddlmZddlmZddlmZddlmZmZm Z m Z m Z ddlm Z dd lm Z dd lmZdd lmZdd lmZdd lmZddZdS)z9The machinery of importlib: finders, loaders, hooks, etc.N) ModuleSpec)BuiltinImporter)FrozenImporter)SOURCE_SUFFIXESDEBUG_BYTECODE_SUFFIXESOPTIMIZED_BYTECODE_SUFFIXESBYTECODE_SUFFIXESEXTENSION_SUFFIXES)WindowsRegistryFinder) PathFinder) FileFinder)SourceFileLoader)SourcelessFileLoader)ExtensionFileLoadercCs tttS)zAReturns a list of all recognized module suffixes for this process)rr r rr+/usr/lib64/python3.8/importlib/machinery.py all_suffixessr)__doc___imp _bootstraprrr_bootstrap_externalrrrr r r r r rrrrrrrrs         PK]&&util.cpython-38.pycnu[U e5d@svdZddlZddddddgZGd ddZd dZd dZdd dZddZddZddddddddhj Z ddZ dS)z$Miscellaneous WSGI-related UtilitiesN FileWrapper guess_schemeapplication_uri request_urishift_path_infosetup_testing_defaultsc@s2eZdZdZd ddZddZddZd d Zd S) rz1Wrapper to convert file-like objects to iterables cCs"||_||_t|dr|j|_dS)Nclose)filelikeblksizehasattrr )selfr r r$/usr/lib64/python3.8/wsgiref/util.py__init__s zFileWrapper.__init__cCs6ddl}|jdtdd|j|j}|r.|StdS)NrzXFileWrapper's __getitem__ method ignores 'key' parameter. Use iterator protocol instead.) stacklevel)warningswarnDeprecationWarningr readr IndexError)r keyrdatarrr __getitem__szFileWrapper.__getitem__cCs|SNr)r rrr__iter__!szFileWrapper.__iter__cCs|j|j}|r|StdSr)r rr StopIteration)r rrrr__next__$szFileWrapper.__next__N)r)__name__ __module__ __qualname____doc__rrrrrrrrr s   cCs|ddkrdSdSdS)zMReturn a guess for whether 'wsgi.url_scheme' should be 'http' or 'https' ZHTTPS)ZyesZon1httpshttpN)get)environrrrr*scCs|dd}ddlm}|dr0||d7}nR||d7}|ddkrf|dd kr|d |d7}n|dd kr|d |d7}|||d pd dd7}|S)z@Return the application's base URI (no PATH_INFO or QUERY_STRING)wsgi.url_schemez://rquote HTTP_HOST SERVER_NAMEr$ SERVER_PORT443:80 SCRIPT_NAME/latin1)encoding) urllib.parser*r&)r'urlr*rrrr2s       TcCspt|}ddlm}||ddddd}|dsF||d d 7}n||7}|rl|d rl|d |d 7}|S) zBReturn the full request URI, optionally including the query stringrr) PATH_INFOz/;=,r3)Zsafer4r1NZ QUERY_STRING?)rr5r*r&)r'Z include_queryr6r* path_inforrrrFs  cCs|dd}|sdS|d}dd|ddD|dd<|d}|d=|d d}t|d|}|dr~|dd}|s|ds|d7}||d <d||d<|d krd}|S) aZShift a name from PATH_INFO to SCRIPT_NAME, returning it If there are no remaining path segments in PATH_INFO, return None. Note: 'environ' is modified in-place; use a copy if you need to keep the original PATH_INFO or SCRIPT_NAME. Note: when PATH_INFO is just a '/', this returns '' and appends a trailing '/' to SCRIPT_NAME, even though empty path segments are normally ignored, and SCRIPT_NAME doesn't normally end in a '/'. This is intentional behavior, to ensure that an application can tell the difference between '/x' and '/x/' when traversing to objects. r7r8Nr2cSsg|]}|r|dkr|qS).r).0prrr esz#shift_path_info..r9r1r<)r&split posixpathnormpathendswithjoin)r'r; path_partsnameZ script_namerrrrSs$     cCs|dd|dd|d|d|ddd|kr\d |kr\|dd |d d |d d |dd|dd|ddddlm}m}|d||d||dt||ddkr|ddn|ddkr|dddS)a:Update 'environ' with trivial defaults for testing purposes This adds various parameters required for WSGI, including HTTP_HOST, SERVER_NAME, SERVER_PORT, REQUEST_METHOD, SCRIPT_NAME, PATH_INFO, and all of the wsgi.* variables. It only supplies default values, and does not replace any existing settings for these variables. This routine is intended to make it easier for unit tests of WSGI servers and applications to set up dummy environments. It should *not* be used by actual WSGI servers or applications, since the data is fake! r,z 127.0.0.1ZSERVER_PROTOCOLzHTTP/1.0r+ZREQUEST_METHODZGETr1r7r8r2z wsgi.version)r9rz wsgi.run_oncerzwsgi.multithreadzwsgi.multiprocess)StringIOBytesIOz wsgi.inputz wsgi.errorsr(r%r-r0r$r.N) setdefaultiorHrIr)r'rHrIrrrr|s&           Z connectionz keep-alivezproxy-authenticatezproxy-authorizationZteZtrailersztransfer-encodingZupgradecCs t|S)z?Return true if 'header_name' is an HTTP/1.1 "Hop-by-Hop" header)_hoppishlower)Z header_namerrr is_hop_by_hopsrN)T) r"rB__all__rrrrrr __contains__rLrNrrrrs0 ))PK]8#ɴ//resources.cpython-38.opt-2.pycnu[U e5d@% @sddlZddlZddlmZddlmZmZddlm Z ddl m Z ddl m Z mZddlmZdd lmZdd lmZmZmZmZmZdd lmZdd lmZmZdd lmZdddddddddg Zee efZ!ee ej"fZ#edddZ$e dddZ%eeej&dddZ'dd Z(e!e#ed!d"dZ)d-e!e#e e ed%d&dZ*e!e#e+d!d'dZ,d.e!e#e e e d%d(dZ-ee!e#eed!d)dZ.e!e e/d*d+dZ0e!ee dd,dZ1dS)/N)abc)contextmanagersuppress) import_module)ResourceLoader)BytesIO TextIOWrapper)Path) ModuleType)IterableIteratorOptionalSetUnion)cast)BinaryIOTextIO)ZipImportErrorPackageResourcecontents is_resource open_binary open_textpath read_binary read_text)returncCs\t|dr0|jjdkr*td|jjqX|Sn(t|}|jjdkrTtd|n|SdS)N__spec__z{!r} is not a package)hasattrrsubmodule_search_locations TypeErrorformatnamer)packagemoduler'+/usr/lib64/python3.8/importlib/resources.py _get_package"s   r)cCs,tj|\}}|r$td|n|SdS)Nz{!r} must be only a file name)osrsplit ValueErrorr#)rparent file_namer'r'r(_normalize_path6sr/)r%rcCs,|j}t|jdr(ttj|j|jSdS)Nget_resource_reader)rr loaderr resources_abcResourceReaderr0r$)r%specr'r'r(_get_resource_readerBs   r5cCs&|jjdks|jjs"td|dS)NzPackage has no location )rorigin has_locationFileNotFoundError)r%r'r'r(_check_locationPsr9)r%resourcerc Cst|}t|}t|}|dk r*||St|tj|jj }tj |}tj ||}zt |ddWSt k rtt|jj}d}t|jjdrtt ||}W5QRX|dkr|jj}d||} t| n t|YSYnXdS)Nrb)modeget_data{!r} resource not found in {!r})r/r)r5 open_resourcer9r*rabspathrr6dirnamejoinopenOSErrorrrr1r rr=r$r#r8r) r%r:readerabsolute_package_path package_path full_pathr1data package_namemessager'r'r(rUs2    utf-8strict)r%r:encodingerrorsrc Cs t|}t|}t|}|dk r2t||||St|tj|j j }tj |}tj ||}zt |d||dWStk rtt|j j}d} t|j jdrtt||} W5QRX| dkr|j j} d|| } t| ntt| ||YSYnXdS)Nr)r<rNrOr=r>)r/r)r5r r?r9r*rr@rr6rArBrCrDrrr1r rr=r$r#r8r) r%r:rNrOrErFrGrHr1rIrJrKr'r'r(rts2   c Cs:t|}t|}t||}|W5QRSQRXdSN)r/r)rread)r%r:fpr'r'r(rs c Cs>t|}t|}t||||}|W5QRSQRXdSrQ)r/r)rrR)r%r:rNrOrSr'r'r(rs c cst|}t|}t|}|dk rNzt||VWdStk rJYqVXnt|d}|jjdk r|t|jjj }||}|dk r| r|Vnxt ||}| }W5QRXt \}}z$t||t|t|VW5zt|Wntk rYnXXdSrQ)r/r)r5r resource_pathr8r9rr6r-existsrrRtempfileZmkstempr*removewriteclose) r%r:rEZ file_pathpackage_directoryrSrIfdZraw_pathr'r'r(rs6      )r%r$rc Cs|t|}t|t|}|dk r*||Sztt|}Wnttfk rTYdSX||krbdSt|j j j |}| S)NF) r)r/r5rsetrNotADirectoryErrorr8r rr6r-is_file)r%r$rEZpackage_contentsrr'r'r(rs cCsTt|}t|}|dk r |S|jjdks4|jjs8dSt|jjj}t |SdS)Nr') r)r5rrr6r7r r-r*listdir)r%rErZr'r'r(rs)rLrM)rLrM)2r*rVrr2 contextlibrr importlibr importlib.abcriorr pathlibr typesr typingr r rrrrZ typing.iorrZ zipimportr__all__strrPathLikerr)r/r3r5r9rrbytesrrrboolrrr'r'r'r(sh          ! "  .PK]Z˓util.cpython-38.opt-2.pycnu[U e5d@srddlZddddddgZGdddZd dZd dZdd dZd dZddZddddddddhjZ ddZ dS)N FileWrapper guess_schemeapplication_uri request_urishift_path_infosetup_testing_defaultsc@s.eZdZd ddZddZddZdd Zd S) r cCs"||_||_t|dr|j|_dS)Nclose)filelikeblksizehasattrr )selfr r r$/usr/lib64/python3.8/wsgiref/util.py__init__s zFileWrapper.__init__cCs6ddl}|jdtdd|j|j}|r.|StdS)NrzXFileWrapper's __getitem__ method ignores 'key' parameter. Use iterator protocol instead.) stacklevel)warningswarnDeprecationWarningr readr IndexError)r keyrdatarrr __getitem__szFileWrapper.__getitem__cCs|SNr)r rrr__iter__!szFileWrapper.__iter__cCs|j|j}|r|StdSr)r rr StopIteration)r rrrr__next__$szFileWrapper.__next__N)r)__name__ __module__ __qualname__rrrrrrrrr s  cCs|ddkrdSdSdS)NZHTTPS)ZyesZon1httpshttp)get)environrrrr*scCs|dd}ddlm}|dr0||d7}nR||d7}|ddkrf|dd kr|d |d7}n|dd kr|d |d7}|||d pd dd7}|S)Nwsgi.url_schemez://rquote HTTP_HOST SERVER_NAMEr# SERVER_PORT443:80 SCRIPT_NAME/latin1)encoding) urllib.parser)r%)r&urlr)rrrr2s       TcCspt|}ddlm}||ddddd}|dsF||d d7}n||7}|rl|d rl|d |d 7}|S) Nrr( PATH_INFOz/;=,r2)Zsafer3r0Z QUERY_STRING?)rr4r)r%)r&Z include_queryr5r) path_inforrrrFs  cCs|dd}|sdS|d}dd|ddD|dd<|d}|d=|dd}t|d|}|dr~|dd}|s|ds|d7}||d<d||d<|d krd}|S) Nr6r7r1cSsg|]}|r|dkr|qS).r).0prrr esz#shift_path_info..r8r0r;)r%split posixpathnormpathendswithjoin)r&r: path_partsnameZ script_namerrrrSs$     cCs|dd|dd|d|d|ddd|kr\d |kr\|dd |d d |d d |dd|dd|ddddlm}m}|d||d||dt||ddkr|ddn|ddkr|dddS)Nr+z 127.0.0.1ZSERVER_PROTOCOLzHTTP/1.0r*ZREQUEST_METHODZGETr0r6r7r1z wsgi.version)r8rz wsgi.run_oncerzwsgi.multithreadzwsgi.multiprocess)StringIOBytesIOz wsgi.inputz wsgi.errorsr'r$r,r/r#r-) setdefaultiorGrHr)r&rGrHrrrr|s&           Z connectionz keep-alivezproxy-authenticatezproxy-authorizationZteZtrailersztransfer-encodingZupgradecCs t|Sr)_hoppishlower)Z header_namerrr is_hop_by_hopsrM)T) rA__all__rrrrrr __contains__rKrMrrrrs. ))PK]uvkoo_bootstrap.cpython-38.pycnu[U e5dܚ@sdZdaddZddZiZiZGdddeZGdd d ZGd d d Z Gd d d Z ddZ ddZ ddZ ddddZddZddZddZddZGd d!d!Zddd"d#d$Zd^d%d&Zd'd(d)d*Zd+d,Zd-d.Zd/d0Zd1d2Zd3d4Zd5d6ZGd7d8d8ZGd9d:d:ZGd;d<d<Zd=d>Z d?d@Z!d_dAdBZ"dCdDZ#dEZ$e$dFZ%dGdHZ&e'Z(dIdJZ)d`dLdMZ*d'dNdOdPZ+dQdRZ,dadTdUZ-dVdWZ.dXdYZ/dZd[Z0d\d]Z1dS)baSCore implementation of import. This module is NOT meant to be directly imported! It has been designed such that it can be bootstrapped into Python as the implementation of import. As such it requires the injection of specific modules and attributes in order to work. One should use importlib as the public-facing version of this module. NcCs8dD] }t||rt||t||q|j|jdS)z/Simple substitute for functools.update_wrapper.) __module____name__ __qualname____doc__N)hasattrsetattrgetattr__dict__update)newoldreplacer ,/usr/lib64/python3.8/importlib/_bootstrap.py_wraps rcCs tt|SN)typesysnamer r r _new_module#src@s eZdZdS)_DeadlockErrorN)rrrr r r rr0src@s8eZdZdZddZddZddZdd Zd d Zd S) _ModuleLockzA recursive lock implementation which is able to detect deadlocks (e.g. thread 1 trying to take locks A then B, and thread 2 trying to take locks B then A). cCs0t|_t|_||_d|_d|_d|_dSN)_thread allocate_locklockwakeuprownercountwaitersselfrr r r__init__:s   z_ModuleLock.__init__cCs<t}|j}t|}|dkr$dS|j}||krdSqdS)NFT)r get_identr _blocking_onget)r"metidrr r r has_deadlockBs z_ModuleLock.has_deadlockc Cst}|t|<z|jn|jdks.|j|krT||_|jd7_W5QRWVdS|rhtd||j dr|j d7_ W5QRX|j |j qW5t|=XdS)z Acquire the module lock. If a potential deadlock is detected, a _DeadlockError is raised. Otherwise, the lock is always acquired and True is returned. rTzdeadlock detected by %rFN) rr$r%rrrr)rracquirer releaser"r(r r rr+Ns   z_ModuleLock.acquirec Cszt}|jb|j|kr"td|jdks0t|jd8_|jdkrld|_|jrl|jd8_|j W5QRXdS)Ncannot release un-acquired lockrr*) rr$rr RuntimeErrorrAssertionErrorr rr,r-r r rr,gs  z_ModuleLock.releasecCsd|jt|S)Nz_ModuleLock({!r}) at {}formatridr"r r r__repr__tsz_ModuleLock.__repr__N) rrrrr#r)r+r,r5r r r rr4s   rc@s0eZdZdZddZddZddZdd Zd S) _DummyModuleLockzVA simple _ModuleLock equivalent for Python builds without multi-threading support.cCs||_d|_dSr)rrr!r r rr#|sz_DummyModuleLock.__init__cCs|jd7_dS)Nr*T)rr4r r rr+sz_DummyModuleLock.acquirecCs$|jdkrtd|jd8_dS)Nrr.r*)rr/r4r r rr,s z_DummyModuleLock.releasecCsd|jt|S)Nz_DummyModuleLock({!r}) at {}r1r4r r rr5sz_DummyModuleLock.__repr__N)rrrrr#r+r,r5r r r rr6xs r6c@s$eZdZddZddZddZdS)_ModuleLockManagercCs||_d|_dSr)_name_lockr!r r rr#sz_ModuleLockManager.__init__cCst|j|_|jdSr)_get_module_lockr8r9r+r4r r r __enter__s z_ModuleLockManager.__enter__cOs|jdSr)r9r,)r"argskwargsr r r__exit__sz_ModuleLockManager.__exit__N)rrrr#r;r>r r r rr7sr7cCstzjzt|}Wntk r0d}YnX|dkrptdkrLt|}nt|}|fdd}t ||t|<W5tX|S)zGet or create the module lock for a given module name. Acquire/release internally the global import lock to protect _module_locks.NcSs0tzt||krt|=W5tXdSr)_imp acquire_lock release_lock _module_locksr&)refrr r rcbs  z_get_module_lock..cb) r?r@rArBKeyErrorrr6r_weakrefrC)rrrDr r rr:s    r:cCs6t|}z |Wntk r(Yn X|dS)zAcquires then releases the module lock for a given module name. This is used to ensure a module is completely initialized, in the event it is being imported by another thread. N)r:r+rr,)rrr r r_lock_unlock_modules  rGcOs |||S)a.remove_importlib_frames in import.c will always remove sequences of importlib frames that end with a call to this function Use it instead of a normal call in places where including the importlib frames introduces unwanted noise into the traceback (e.g. when executing module code) r )fr<kwdsr r r_call_with_frames_removedsrJr*) verbositycGs6tjj|kr2|dsd|}t|j|tjddS)z=Print the message to stderr if -v/PYTHONVERBOSE is turned on.)#zimport z# )fileN)rflagsverbose startswithprintr2stderr)messagerKr<r r r_verbose_messages  rTcsfdd}t||S)z1Decorator to verify the named module is built-in.cs&|tjkrtd||d||S)N{!r} is not a built-in moduler)rbuiltin_module_names ImportErrorr2r"fullnamefxnr r_requires_builtin_wrappers   z4_requires_builtin.._requires_builtin_wrapperr)r[r\r rZr_requires_builtins  r^csfdd}t||S)z/Decorator to verify the named module is frozen.cs&t|std||d||SNz{!r} is not a frozen moduler)r? is_frozenrWr2rXrZr r_requires_frozen_wrappers   z2_requires_frozen.._requires_frozen_wrapperr])r[rar rZr_requires_frozens  rbcCs>t||}|tjkr2tj|}t||tj|St|SdS)zLoad the specified module into sys.modules and return it. This method is deprecated. Use loader.exec_module instead. N)spec_from_loaderrmodules_exec_load)r"rYspecmoduler r r_load_module_shims      ricCst|dd}t|dr8z ||WStk r6YnXz |j}Wntk rVYnX|dk rht|Sz |j}Wntk rd}YnXz |j}Wn:tk r|dkrd |YSd ||YSYnXd ||SdS)N __loader__ module_repr? ) rrrk Exception__spec__AttributeError_module_repr_from_specr__file__r2)rhloaderrgrfilenamer r r _module_repr s.       rwc@sreZdZdZddddddZddZdd Zed d Zej d d Zed dZ eddZ e j ddZ dS) ModuleSpecaThe specification for a module, used for loading. A module's spec is the source for information about the module. For data associated with the module, including source, use the spec's loader. `name` is the absolute name of the module. `loader` is the loader to use when loading the module. `parent` is the name of the package the module is in. The parent is derived from the name. `is_package` determines if the module is considered a package or not. On modules this is reflected by the `__path__` attribute. `origin` is the specific location used by the loader from which to load the module, if that information is available. When filename is set, origin will match. `has_location` indicates that a spec's "origin" reflects a location. When this is True, `__file__` attribute of the module is set. `cached` is the location of the cached bytecode file, if any. It corresponds to the `__cached__` attribute. `submodule_search_locations` is the sequence of path entries to search when importing submodules. If set, is_package should be True--and False otherwise. Packages are simply modules that (may) have submodules. If a spec has a non-None value in `submodule_search_locations`, the import system will consider modules loaded from the spec as packages. Only finders (see importlib.abc.MetaPathFinder and importlib.abc.PathEntryFinder) should modify ModuleSpec instances. N)origin loader_state is_packagecCs6||_||_||_||_|r gnd|_d|_d|_dSNF)rruryrzsubmodule_search_locations _set_fileattr_cached)r"rruryrzr{r r rr#VszModuleSpec.__init__cCsfd|jd|jg}|jdk r4|d|j|jdk rP|d|jd|jjd|S)Nz name={!r}z loader={!r}z origin={!r}zsubmodule_search_locations={}z{}({})z, ) r2rruryappendr} __class__rjoin)r"r<r r rr5bs    zModuleSpec.__repr__cCsj|j}zH|j|jkoL|j|jkoL|j|jkoL||jkoL|j|jkoL|j|jkWStk rdYdSXdSr|)r}rrurycached has_locationrr)r"othersmslr r r__eq__ls     zModuleSpec.__eq__cCs:|jdkr4|jdk r4|jr4tdkr&tt|j|_|jSr)rryr~_bootstrap_externalNotImplementedError _get_cachedr4r r rrxs  zModuleSpec.cachedcCs ||_dSr)r)r"rr r rrscCs$|jdkr|jddS|jSdS)z The name of the module's parent.N.r)r}r rpartitionr4r r rparents zModuleSpec.parentcCs|jSr)r~r4r r rrszModuleSpec.has_locationcCst||_dSr)boolr~)r"valuer r rrs) rrrrr#r5rpropertyrsetterrrr r r rrx1s $       rxryr{cCst|drJtdkrttj}|dkr0|||dS|r8gnd}||||dS|dkrt|drz||}Wqtk rd}YqXnd}t||||dS)z5Return a module spec based on various loader methods. get_filenameN)ru)rur}r{Fr)rrrspec_from_file_locationr{rWrx)rruryr{rsearchr r rrcs$     rccCs8z |j}Wntk rYnX|dk r,|S|j}|dkrZz |j}Wntk rXYnXz |j}Wntk r|d}YnX|dkr|dkrz |j}Wqtk rd}YqXn|}z |j}Wntk rd}YnXzt|j}Wntk rd}YnXt |||d}|dkr"dnd|_ ||_ ||_ |S)NryFT) rqrrrrjrt_ORIGIN __cached__list__path__rxr~rr})rhruryrgrlocationrr}r r r_spec_from_modulesH         rFoverridecCs|st|dddkr6z |j|_Wntk r4YnX|sJt|dddkr|j}|dkr|jdk rtdkrnttj}| |}|j|_ ||_d|_ z ||_ Wntk rYnX|st|dddkrz |j |_Wntk rYnXz ||_Wntk rYnX|s"t|dddkrR|jdk rRz |j|_Wntk rPYnX|jr|srt|dddkrz |j|_ Wntk rYnX|st|dddkr|jdk rz |j|_Wntk rYnX|S)Nrrj __package__rrtr)rrrrrrur}rr_NamespaceLoader__new___pathrtrjrrrqrrryrr)rgrhrrurr r r_init_module_attrss`            rcCsRd}t|jdr|j|}nt|jdr2td|dkrDt|j}t|||S)z+Create a module based on the provided spec.N create_module exec_modulezBloaders that define exec_module() must also define create_module())rrurrWrrrrgrhr r rmodule_from_spec%s    rcCsj|jdkrdn|j}|jdkrB|jdkr2d|Sd||jSn$|jrVd||jSd|j|jSdS)z&Return the repr to use for the module.Nrlrmrnro)rryrur2r)rgrr r rrs6s   rsc Cs|j}t|tj||k r6d|}t||dzj|jdkrj|j dkrZtd|jdt ||ddn4t ||ddt |jds|j |n |j |W5tj|j}|tj|j<XW5QRX|S)zFExecute the spec's specified module in an existing module's namespace.zmodule {!r} not in sys.modulesrNmissing loaderTrr)rr7rrdr&r2rWpoprur}rr load_moduler)rgrhrmsgr r rreGs"      recCsz|j|jWn4|jtjkr@tj|j}|tj|j<YnXtj|j}|tj|j<t|dddkrz |j|_Wntk rYnXt|dddkrz(|j |_ t |ds|j dd|_ Wntk rYnXt|dddkrz ||_ Wntk rYnX|S)Nrjrrrrrq)rurrrrdrrrjrrrrrrrqrr r r_load_backward_compatiblees6      rc Cs|jdk rt|jdst|St|}d|_z|tj|j<z4|jdkr`|jdkrlt d|jdn |j |Wn2ztj|j=Wnt k rYnXYnXtj |j}|tj|j<t d|j|jW5d|_X|S)NrTFrrzimport {!r} # {!r})rurrr _initializingrrdrr}rWrrErrTrr r r_load_unlockeds.      rc Cs*t|jt|W5QRSQRXdS)zReturn a new module object, loaded by the spec's loader. The module is not added to its parent. If a module is already in sys.modules, that existing module gets clobbered. N)r7rr)rgr r rrfs rfc@seZdZdZeddZedddZedddZed d Z ed d Z ee d dZ ee ddZ ee ddZeeZdS)BuiltinImporterzMeta path import for built-in modules. All methods are either class or static methods to avoid the need to instantiate the class. cCs d|jS)sReturn repr for the module. The method is deprecated. The import machinery does the job itself. z)r2r)rhr r rrkszBuiltinImporter.module_reprNcCs,|dk r dSt|r$t||ddSdSdS)Nzbuilt-inr)r? is_builtinrcclsrYpathtargetr r r find_specs  zBuiltinImporter.find_speccCs|||}|dk r|jSdS)zFind the built-in module. If 'path' is ever specified then the search is considered a failure. This method is deprecated. Use find_spec() instead. N)rru)rrYrrgr r r find_modules zBuiltinImporter.find_modulecCs.|jtjkr"td|j|jdttj|S)zCreate a built-in modulerUr)rrrVrWr2rJr?create_builtin)r"rgr r rrs   zBuiltinImporter.create_modulecCsttj|dS)zExec a built-in moduleN)rJr? exec_builtin)r"rhr r rrszBuiltinImporter.exec_modulecCsdS)z9Return None as built-in modules do not have code objects.Nr rrYr r rget_codeszBuiltinImporter.get_codecCsdS)z8Return None as built-in modules do not have source code.Nr rr r r get_sourceszBuiltinImporter.get_sourcecCsdS)z4Return False as built-in modules are never packages.Fr rr r rr{szBuiltinImporter.is_package)NN)N)rrrr staticmethodrk classmethodrrrrr^rrr{rirr r r rrs*        rc@seZdZdZdZeddZedddZeddd Z ed d Z ed d Z eddZ ee ddZee ddZee ddZdS)FrozenImporterzMeta path import for frozen modules. All methods are either class or static methods to avoid the need to instantiate the class. frozencCsd|jtjS)rr)r2rrr)mr r rrkszFrozenImporter.module_reprNcCs"t|rt|||jdSdSdS)Nr)r?r`rcrrr r rr s zFrozenImporter.find_speccCst|r|SdS)z]Find a frozen module. This method is deprecated. Use find_spec() instead. N)r?r`)rrYrr r rr'szFrozenImporter.find_modulecCsdS)z*Use default semantics for module creation.Nr )rrgr r rr0szFrozenImporter.create_modulecCs@|jj}t|s$td||dttj|}t||j dSr_) rqrr?r`rWr2rJget_frozen_objectexecr)rhrcoder r rr4s   zFrozenImporter.exec_modulecCs t||S)z_Load a frozen module. This method is deprecated. Use exec_module() instead. )rirr r rr=szFrozenImporter.load_modulecCs t|S)z-Return the code object for the frozen module.)r?rrr r rrFszFrozenImporter.get_codecCsdS)z6Return None as frozen modules do not have source code.Nr rr r rrLszFrozenImporter.get_sourcecCs t|S)z.Return True if the frozen module is a package.)r?is_frozen_packagerr r rr{RszFrozenImporter.is_package)NN)N)rrrrrrrkrrrrrrrbrrr{r r r rr s.        rc@s eZdZdZddZddZdS)_ImportLockContextz$Context manager for the import lock.cCs tdS)zAcquire the import lock.N)r?r@r4r r rr;_sz_ImportLockContext.__enter__cCs tdS)zcsz_ImportLockContext.__exit__N)rrrrr;r>r r r rr[srcCs@|d|d}t||kr$td|d}|r= 0z__package__ not set to a stringz6attempted relative import with no known parent packagezEmpty module nameN) isinstancestr TypeErrorr2rrrWrrrr r r _sanity_checks    rzNo module named z{!r}cCsd}|dd}|r|tjkr*t|||tjkr>tj|Stj|}z |j}Wn2tk rtd||}t||ddYnXt ||}|dkrtt||dnt |}|rtj|}t ||dd||S)Nrrz; {!r} is not a packager) rrrdrJrrr_ERR_MSGr2ModuleNotFoundErrorrrr)rimport_rr parent_modulerrgrhr r r_find_and_load_unlockeds*        rc Csjt|2tj|t}|tkr6t||W5QRSW5QRX|dkr^d|}t||dt||S)zFind and load the module.Nz(import of {} halted; None in sys.modulesr) r7rrdr&_NEEDS_LOADINGrr2rrG)rrrhrSr r r_find_and_loads   rrcCs*t||||dkr t|||}t|tS)a2Import and return the module based on its name, the package the call is being made from, and the level adjustment. This function represents the greatest common denominator of functionality between import_module and __import__. This includes setting __package__ if the loader did not. r)rrr _gcd_importrr r rrs  r recursivec Cs|D]}t|tsB|r"|jd}nd}td|dt|jq|dkrl|st|drt||j|ddqt||sd |j|}zt ||Wqt k r}z*|j |krt j |td k rWYqW5d }~XYqXq|S) zFigure out what __import__ should return. The import_ parameter is a callable which takes the name of module to import. It is required to decouple the function from assuming importlib's import implementation is desired. z.__all__z ``from list''zItem in z must be str, not *__all__TrrN)rrrrrr_handle_fromlistrr2rJrrrrdr&r)rhfromlistrrxwhere from_nameexcr r rrs,      rcCs|d}|d}|dk rR|dk rN||jkrNtjd|d|jdtdd|S|dk r`|jStjd tdd|d }d |kr|d d }|S)zCalculate what __package__ should be. __package__ is not guaranteed to be defined or could be set to None to represent that its proper value is unknown. rrqNz __package__ != __spec__.parent (z != )) stacklevelzYcan't resolve package from __spec__ or __package__, falling back on __name__ and __path__rrrr)r&rrrrr)globalsrrgr r r_calc___package__s&  rr c Cs|dkrt|}n$|dk r|ni}t|}t|||}|s|dkrTt|ddS|s\|St|t|dd}tj|jdt|j|Snt|drt||tS|SdS)aImport a module. The 'globals' argument is used to infer where the import is occurring from to handle relative imports. The 'locals' argument is ignored. The 'fromlist' argument specifies what should exist as attributes on the module being imported (e.g. ``from module import ``). The 'level' argument represents the package location to import from in a relative import (e.g. ``from ..pkg import mod`` would have a 'level' of 2). rNrr) rr partitionrrrdrrr) rrlocalsrrrhglobals_rcut_offr r r __import__9s      rcCs&t|}|dkrtd|t|S)Nzno built-in module named )rrrWr)rrgr r r_builtin_from_name^s  rc Cs|a|att}tjD]H\}}t||r|tjkrs^D%   $e -H%*IO   / % %#PK]?y8U8U_bootstrap.cpython-38.opt-2.pycnu[U e5dܚ@sdaddZddZiZiZGdddeZGdddZGd d d ZGd d d Z d dZ ddZ ddZ ddddZ ddZddZddZddZGdd d Zddd!d"d#Zd]d$d%Zd&d'd(d)Zd*d+Zd,d-Zd.d/Zd0d1Zd2d3Zd4d5ZGd6d7d7ZGd8d9d9ZGd:d;d;Zdd?Z d^d@dAZ!dBdCZ"dDZ#e#dEZ$dFdGZ%e&Z'dHdIZ(d_dKdLZ)d&dMdNdOZ*dPdQZ+d`dSdTZ,dUdVZ-dWdXZ.dYdZZ/d[d\Z0dS)aNcCs8dD] }t||rt||t||q|j|jdS)N) __module____name__ __qualname____doc__)hasattrsetattrgetattr__dict__update)newoldreplacer ,/usr/lib64/python3.8/importlib/_bootstrap.py_wraps rcCs tt|SN)typesysnamer r r _new_module#src@s eZdZdS)_DeadlockErrorN)rrrr r r rr0src@s4eZdZddZddZddZddZd d Zd S) _ModuleLockcCs0t|_t|_||_d|_d|_d|_dSN)_thread allocate_locklockwakeuprownercountwaitersselfrr r r__init__:s   z_ModuleLock.__init__cCs<t}|j}t|}|dkr$dS|j}||krdSqdS)NFT)r get_identr _blocking_onget)r"metidrr r r has_deadlockBs z_ModuleLock.has_deadlockc Cst}|t|<z|jn|jdks.|j|krT||_|jd7_W5QRWVdS|rhtd||j dr|j d7_ W5QRX|j |j qW5t|=XdS)NrTzdeadlock detected by %rF) rr$r%rrrr)rracquirer releaser"r(r r rr+Ns   z_ModuleLock.acquirec Cslt}|jT|j|kr"td|jd8_|jdkr^d|_|jr^|jd8_|jW5QRXdS)Ncannot release un-acquired lockr*r) rr$rr RuntimeErrorrr rr,r-r r rr,gs  z_ModuleLock.releasecCsd|jt|S)Nz_ModuleLock({!r}) at {}formatridr"r r r__repr__tsz_ModuleLock.__repr__N)rrrr#r)r+r,r4r r r rr4s   rc@s,eZdZddZddZddZddZd S) _DummyModuleLockcCs||_d|_dSr)rrr!r r rr#|sz_DummyModuleLock.__init__cCs|jd7_dS)Nr*T)rr3r r rr+sz_DummyModuleLock.acquirecCs$|jdkrtd|jd8_dS)Nrr.r*)rr/r3r r rr,s z_DummyModuleLock.releasecCsd|jt|S)Nz_DummyModuleLock({!r}) at {}r0r3r r rr4sz_DummyModuleLock.__repr__N)rrrr#r+r,r4r r r rr5xsr5c@s$eZdZddZddZddZdS)_ModuleLockManagercCs||_d|_dSr)_name_lockr!r r rr#sz_ModuleLockManager.__init__cCst|j|_|jdSr)_get_module_lockr7r8r+r3r r r __enter__s z_ModuleLockManager.__enter__cOs|jdSr)r8r,)r"argskwargsr r r__exit__sz_ModuleLockManager.__exit__N)rrrr#r:r=r r r rr6sr6cCstzjzt|}Wntk r0d}YnX|dkrptdkrLt|}nt|}|fdd}t ||t|<W5tX|S)NcSs0tzt||krt|=W5tXdSr)_imp acquire_lock release_lock _module_locksr&)refrr r rcbs  z_get_module_lock..cb) r>r?r@rAKeyErrorrr5r_weakrefrB)rrrCr r rr9s    r9cCs6t|}z |Wntk r(Yn X|dSr)r9r+rr,)rrr r r_lock_unlock_modules  rFcOs |||Srr )fr;kwdsr r r_call_with_frames_removedsrIr*) verbositycGs6tjj|kr2|dsd|}t|j|tjddS)N)#zimport z# )file)rflagsverbose startswithprintr1stderr)messagerJr;r r r_verbose_messages  rScsfdd}t||S)Ncs&|tjkrtd||d||SNz{!r} is not a built-in moduler)rbuiltin_module_names ImportErrorr1r"fullnamefxnr r_requires_builtin_wrappers   z4_requires_builtin.._requires_builtin_wrapperr)rZr[r rYr_requires_builtins  r]csfdd}t||S)Ncs&t|std||d||SNz{!r} is not a frozen moduler)r> is_frozenrVr1rWrYr r_requires_frozen_wrappers   z2_requires_frozen.._requires_frozen_wrapperr\)rZr`r rYr_requires_frozens  racCs>t||}|tjkr2tj|}t||tj|St|SdSr)spec_from_loaderrmodules_exec_load)r"rXspecmoduler r r_load_module_shims      rhcCst|dd}t|dr8z ||WStk r6YnXz |j}Wntk rVYnX|dk rht|Sz |j}Wntk rd}YnXz |j}Wn:tk r|dkrd |YSd ||YSYnXd ||SdS)N __loader__ module_repr? ) rrrj Exception__spec__AttributeError_module_repr_from_specr__file__r1)rgloaderrfrfilenamer r r _module_repr s.       rvc@sneZdZddddddZddZddZed d Zejd d Zed d Z eddZ e jddZ dS) ModuleSpecN)origin loader_state is_packagecCs6||_||_||_||_|r gnd|_d|_d|_dSNF)rrtrxrysubmodule_search_locations _set_fileattr_cached)r"rrtrxryrzr r rr#VszModuleSpec.__init__cCsfd|jd|jg}|jdk r4|d|j|jdk rP|d|jd|jjd|S)Nz name={!r}z loader={!r}z origin={!r}zsubmodule_search_locations={}z{}({})z, ) r1rrtrxappendr| __class__rjoin)r"r;r r rr4bs    zModuleSpec.__repr__cCsj|j}zH|j|jkoL|j|jkoL|j|jkoL||jkoL|j|jkoL|j|jkWStk rdYdSXdSr{)r|rrtrxcached has_locationrq)r"othersmslr r r__eq__ls     zModuleSpec.__eq__cCs:|jdkr4|jdk r4|jr4tdkr&tt|j|_|jSr)r~rxr}_bootstrap_externalNotImplementedError _get_cachedr3r r rrxs  zModuleSpec.cachedcCs ||_dSr)r~)r"rr r rrscCs$|jdkr|jddS|jSdS)N.r)r|r rpartitionr3r r rparents zModuleSpec.parentcCs|jSr)r}r3r r rrszModuleSpec.has_locationcCst||_dSr)boolr})r"valuer r rrs) rrrr#r4rpropertyrsetterrrr r r rrw1s%       rwrxrzcCst|drJtdkrttj}|dkr0|||dS|r8gnd}||||dS|dkrt|drz||}Wqtk rd}YqXnd}t||||dS)N get_filename)rt)rtr|rzFr)rrrspec_from_file_locationrzrVrw)rrtrxrzrsearchr r rrbs$     rbcCs8z |j}Wntk rYnX|dk r,|S|j}|dkrZz |j}Wntk rXYnXz |j}Wntk r|d}YnX|dkr|dkrz |j}Wqtk rd}YqXn|}z |j}Wntk rd}YnXzt|j}Wntk rd}YnXt |||d}|dkr"dnd|_ ||_ ||_ |S)NrxFT) rprqrrirs_ORIGIN __cached__list__path__rwr}rr|)rgrtrxrfrlocationrr|r r r_spec_from_modulesH         rFoverridecCs|st|dddkr6z |j|_Wntk r4YnX|sJt|dddkr|j}|dkr|jdk rtdkrnttj}| |}|j|_ ||_d|_ z ||_ Wntk rYnX|st|dddkrz |j |_Wntk rYnXz ||_Wntk rYnX|s"t|dddkrR|jdk rRz |j|_Wntk rPYnX|jr|srt|dddkrz |j|_ Wntk rYnX|st|dddkr|jdk rz |j|_Wntk rYnX|S)Nrri __package__rrsr)rrrrqrtr|rr_NamespaceLoader__new___pathrsrirrrprrrxrr)rfrgrrtrr r r_init_module_attrss`            rcCsRd}t|jdr|j|}nt|jdr2td|dkrDt|j}t|||S)N create_module exec_modulezBloaders that define exec_module() must also define create_module())rrtrrVrrrrfrgr r rmodule_from_spec%s    rcCsj|jdkrdn|j}|jdkrB|jdkr2d|Sd||jSn$|jrVd||jSd|j|jSdS)Nrkrlrmrn)rrxrtr1r)rfrr r rrr6s   rrc Cs|j}t|tj||k r6d|}t||dzj|jdkrj|j dkrZtd|jdt ||ddn4t ||ddt |jds|j |n |j |W5tj|j}|tj|j<XW5QRX|S)Nzmodule {!r} not in sys.modulesrmissing loaderTrr)rr6rrcr&r1rVpoprtr|rr load_moduler)rfrgrmsgr r rrdGs"      rdcCsz|j|jWn4|jtjkr@tj|j}|tj|j<YnXtj|j}|tj|j<t|dddkrz |j|_Wntk rYnXt|dddkrz(|j |_ t |ds|j dd|_ Wntk rYnXt|dddkrz ||_ Wntk rYnX|S)Nrirrrrrp)rtrrrrcrrrirqrrrrrprr r r_load_backward_compatiblees6      rc Cs|jdk rt|jdst|St|}d|_z|tj|j<z4|jdkr`|jdkrlt d|jdn |j |Wn2ztj|j=Wnt k rYnXYnXtj |j}|tj|j<t d|j|jW5d|_X|S)NrTFrrzimport {!r} # {!r})rtrrr _initializingrrcrr|rVrrDrrSrr r r_load_unlockeds.      rc Cs*t|jt|W5QRSQRXdSr)r6rr)rfr r rres rec@seZdZeddZedddZedddZedd Zed d Z ee d d Z ee ddZ ee ddZ eeZdS)BuiltinImportercCs d|jS)Nz)r1r)rgr r rrjszBuiltinImporter.module_reprNcCs,|dk r dSt|r$t||ddSdSdS)Nzbuilt-inr)r> is_builtinrbclsrXpathtargetr r r find_specs  zBuiltinImporter.find_speccCs|||}|dk r|jSdSr)rrt)rrXrrfr r r find_modules zBuiltinImporter.find_modulecCs.|jtjkr"td|j|jdttj|SrT)rrrUrVr1rIr>create_builtin)r"rfr r rrs   zBuiltinImporter.create_modulecCsttj|dSr)rIr> exec_builtin)r"rgr r rrszBuiltinImporter.exec_modulecCsdSrr rrXr r rget_codeszBuiltinImporter.get_codecCsdSrr rr r r get_sourceszBuiltinImporter.get_sourcecCsdSr{r rr r rrzszBuiltinImporter.is_package)NN)N)rrr staticmethodrj classmethodrrrrr]rrrzrhrr r r rrs(         rc@seZdZdZeddZedddZedddZed d Z ed d Z ed dZ ee ddZ ee ddZee ddZdS)FrozenImporterfrozencCsd|jtjS)Nr)r1rrr)mr r rrjszFrozenImporter.module_reprNcCs"t|rt|||jdSdSdS)Nr)r>r_rbrrr r rr s zFrozenImporter.find_speccCst|r|SdSr)r>r_)rrXrr r rr'szFrozenImporter.find_modulecCsdSrr )rrfr r rr0szFrozenImporter.create_modulecCs@|jj}t|s$td||dttj|}t||j dSr^) rprr>r_rVr1rIget_frozen_objectexecr)rgrcoder r rr4s   zFrozenImporter.exec_modulecCs t||Sr)rhrr r rr=szFrozenImporter.load_modulecCs t|Sr)r>rrr r rrFszFrozenImporter.get_codecCsdSrr rr r rrLszFrozenImporter.get_sourcecCs t|Sr)r>is_frozen_packagerr r rrzRszFrozenImporter.is_package)NN)N)rrrrrrjrrrrrrrarrrzr r r rr s,         rc@seZdZddZddZdS)_ImportLockContextcCs tdSr)r>r?r3r r rr:_sz_ImportLockContext.__enter__cCs tdSr)r>r@)r"exc_type exc_value exc_tracebackr r rr=csz_ImportLockContext.__exit__N)rrrr:r=r r r rr[srcCs@|d|d}t||kr$td|d}|r= 0z__package__ not set to a stringz6attempted relative import with no known parent packagezEmpty module name) isinstancestr TypeErrorr1rrrVrrrr r r _sanity_checks    rzNo module named z{!r}cCsd}|dd}|r|tjkr*t|||tjkr>tj|Stj|}z |j}Wn2tk rtd||}t||ddYnXt ||}|dkrtt||dnt |}|rtj|}t ||dd||S)Nrrz; {!r} is not a packager) rrrcrIrrq_ERR_MSGr1ModuleNotFoundErrorrrr)rimport_rr parent_modulerrfrgr r r_find_and_load_unlockeds*        rc Csjt|2tj|t}|tkr6t||W5QRSW5QRX|dkr^d|}t||dt||S)Nz(import of {} halted; None in sys.modulesr) r6rrcr&_NEEDS_LOADINGrr1rrF)rrrgrRr r r_find_and_loads   rrcCs*t||||dkr t|||}t|tSr)rrr _gcd_importrr r rrs  r recursivec Cs|D]}t|tsB|r"|jd}nd}td|dt|jq|dkrl|st|drt||j|ddqt||sd |j|}zt ||Wqt k r}z*|j |krt j |tdk rWYqW5d}~XYqXq|S) Nz.__all__z ``from list''zItem in z must be str, not *__all__Trr)rrrrrr_handle_fromlistrr1rIrrrrcr&r)rgfromlistrrxwhere from_nameexcr r rrs,      rcCs|d}|d}|dk rR|dk rN||jkrNtjd|d|jdtdd|S|dk r`|jStjdtdd|d }d |kr|d d }|S) Nrrpz __package__ != __spec__.parent (z != )) stacklevelzYcan't resolve package from __spec__ or __package__, falling back on __name__ and __path__rrrr)r&rrrrr)globalsrrfr r r_calc___package__s&  rr c Cs|dkrt|}n$|dk r|ni}t|}t|||}|s|dkrTt|ddS|s\|St|t|dd}tj|jdt|j|Snt|drt||tS|SdS)Nrrr) rr partitionrrrcrrr) rrlocalsrrrgglobals_rcut_offr r r __import__9s      rcCs&t|}|dkrtd|t|S)Nzno built-in module named )rrrVr)rrfr r r_builtin_from_name^s  rc Cs|a|att}tjD]H\}}t||r|tjkrrrrcitemsrrUrr_rrrrrr) sys_module _imp_module module_typerrgrtrf self_module builtin_namebuiltin_moduler r r_setupes$          rcCs&t||tjttjtdSr)rrrrrr)rrr r r_installs  rcCs ddl}|a|tjtdSr)_frozen_importlib_externalrrrrcr)rr r r_install_external_importerssr)NN)N)Nr)NNr r)1rrrrAr%r/rrr5r6r9rFrIrSr]rarhrvrwrbrrrrrrdrrrerrrrrrr_ERR_MSG_PREFIXrrobjectrrrrrrrrrrr r r rs\D%   $e -H%*IO   / % %#PK] ; ;metadata.cpython-38.opt-2.pycnu[U e5dD @sddlZddlZddlZddlZddlZddlZddlZddlZddlZddl Z ddl Z ddl Z ddl Z ddl Z ddlmZddlmZddlmZddlmZddl mZddd d d d d dddg ZGdd d eZGddde ddZGdddejZGdddZGdddZGdddeZ GdddZ!GdddZ"Gd d!d!e Z#Gd"d#d#eZ$d$d Z%d%d Z&d&dZ'd'dZ(d(d Z)d)d Z*d*dZ+dS)+N) ConfigParser)suppress) import_module)MetaPathFinder)starmap DistributionDistributionFinderPackageNotFoundError distribution distributions entry_pointsfilesmetadatarequiresversionc@s eZdZdS)r N)__name__ __module__ __qualname__rr*/usr/lib64/python3.8/importlib/metadata.pyr %sc@sReZdZedZddZeddZe ddZ e dd Z d d Z d d Z dS) EntryPointzH(?P[\w.]+)\s*(:\s*(?P[\w.]+)\s*)?((?P\[.*\])\s*)?$cCsD|j|j}t|d}td|dp,dd}tt ||S)Nmoduleattr.) patternmatchvaluergroupfiltersplit functoolsreducegetattr)selfrrZattrsrrrloadGszEntryPoint.loadcCs(|j|j}ttd|dp"dS)Nz\w+extrasr)rrrlistrefinditerr)r$rrrrr&QszEntryPoint.extrascsfddDS)Ncs,g|]$}|D]\}}|||qqSritems).0rnamerclsconfigrr Xs z+EntryPoint._from_config..)sectionsr.rr.r _from_configVs zEntryPoint._from_configcCsNtdd}t|_z||Wn$tk rB|t|YnXt |S)N=)Z delimiters) rstrZ optionxformZ read_stringAttributeErrorZreadfpioStringIOrr3)r/textr0rrr _from_text^s zEntryPoint._from_textcCst|j|fSN)iterr-r$rrr__iter__jszEntryPoint.__iter__cCs|j|j|j|jffSr;) __class__r-rrr=rrr __reduce__pszEntryPoint.__reduce__N)rrrr(compilerr%propertyr& classmethodr3r:r>r@rrrrr)s     rZEntryPointBasezname value groupc@s&eZdZd ddZddZddZdS) PackagePathutf-8c Cs0|j|d}|W5QRSQRXdS)Nencodinglocateopenread)r$rGstreamrrr read_textzszPackagePath.read_textc Cs.|d}|W5QRSQRXdS)NrbrH)r$rLrrr read_binary~szPackagePath.read_binarycCs |j|Sr;)dist locate_filer=rrrrIszPackagePath.locateN)rE)rrrrMrOrIrrrrrDws rDc@seZdZddZddZdS)FileHashcCs|d\|_}|_dS)Nr4) partitionmoder)r$spec_rrr__init__szFileHash.__init__cCsd|j|jS)Nz)formatrTrr=rrr__repr__szFileHash.__repr__N)rrrrWrYrrrrrRsrRc@seZdZejddZejddZeddZeddZ e d d Z e d d Z e d dZe ddZe ddZe ddZddZddZe ddZddZddZedd Ze d!d"Ze d#d$Zd%S)&rcCsdSr;rr$filenamerrrrMszDistribution.read_textcCsdSr;rr$pathrrrrQszDistribution.locate_filecCsD|D].}|tj|d}t|d}|dk r|Sqt|dS)Nr-)_discover_resolversrContextnextr )r/r-resolverZdistsrPrrr from_names   zDistribution.from_namec sJ|ddr|rtdp*tjf|tjfdd|DS)Ncontextz cannot accept context and kwargsc3s|]}|VqdSr;r)r,rbrdrr sz(Distribution.discover..)pop ValueErrorrr` itertoolschain from_iterabler_)r/kwargsrrerdiscovers zDistribution.discovercCstt|Sr;)PathDistributionpathlibPath)r]rrratszDistribution.atcCsddtjD}td|S)Ncss|]}t|ddVqdS)find_distributionsN)r#)r,finderrrrrfsz3Distribution._discover_resolvers..)sys meta_pathr)Zdeclaredrrrr_sz Distribution._discover_resolverscCs(|dp|dp|d}t|S)NZMETADATAzPKG-INFOr)rMemailZmessage_from_stringr$r9rrrrs  zDistribution.metadatacCs |jdS)NZVersion)rr=rrrrszDistribution.versioncCst|dS)Nzentry_points.txt)rr:rMr=rrrr szDistribution.entry_pointscs6p}dfdd }|o4tt|t|S)Ncs6t|}|rt|nd|_|r&t|nd|_|_|Sr;)rDrRhashintsizerP)r-rxZsize_strresultr=rr make_files z%Distribution.files..make_file)NN)_read_files_distinfo_read_files_egginfor'rcsvreader)r$Z file_linesr|rr=rr s zDistribution.filescCs|d}|o|S)NZRECORD)rM splitlinesrwrrrr}s z!Distribution._read_files_distinfocCs|d}|otdj|S)Nz SOURCES.txtz"{}")rMmaprXrrwrrrr~s z Distribution._read_files_egginfocCs|p|}|ot|Sr;)_read_dist_info_reqs_read_egg_info_reqsr')r$ZreqsrrrrszDistribution.requirescCs |jdS)Nz Requires-Dist)rZget_allr=rrrrsz!Distribution._read_dist_info_reqscCs|d}|o||S)Nz requires.txt)rM_deps_from_requires_text)r$sourcerrrr s z Distribution._read_egg_info_reqscCs4||}ddt|tdD}||S)NcSs&i|]\}}|tttd|qS)line)r'roperator itemgetter)r,sectionZresultsrrr 'sz9Distribution._deps_from_requires_text..r)_read_sectionsrrigroupbyrr%_convert_egg_info_reqs_to_simple_reqs)r/rZ section_pairsr2rrrr$s z%Distribution._deps_from_requires_textccs<d}td|D](}td|}|r.|d}qtVqdS)Nz \[(.*)\]$)rr(rrlocals)linesrrZ section_matchrrrr.s  zDistribution._read_sectionsc#sBddfdd}|D] \}}|D]}|||Vq(qdS)NcSs|odj|dS)Nzextra == "{name}"r^)rXr^rrrmake_conditionCszJDistribution._convert_egg_info_reqs_to_simple_reqs..make_conditioncsX|pd}|d\}}}|r,|r,dj|d}ttd||g}|rTdd|SdS)Nr:z ({markers}))markersz; z and )rSrXr'rjoin)rZextraseprZ conditionsrrrparse_conditionFs  zKDistribution._convert_egg_info_reqs_to_simple_reqs..parse_conditionr*)r2rrZdepsZdeprrrr8s  z2Distribution._convert_egg_info_reqs_to_simple_reqsN)rrrabcabstractmethodrMrQrCrcrm staticmethodrqr_rBrrr r r}r~rrrrrrrrrrrs@             c@s.eZdZGdddZejefddZdS)rc@s$eZdZdZddZeddZdS)zDistributionFinder.ContextNcKst||dSr;)varsupdate)r$rlrrrrWjsz#DistributionFinder.Context.__init__cCst|dtjS)Nr])rgetrtr]r=rrrr]mszDistributionFinder.Context.path)rrrr-rWrBr]rrrrr`Xs r`cCsdSr;r)r$rdrrrrrwsz%DistributionFinder.find_distributionsN)rrrr`rrrrrrrrrSsc@s<eZdZddZddZddZddZd d Zd d Zd S)FastPathcCs||_tj||_dSr;)rootosr]basenamelowerbase)r$rrrrrWszFastPath.__init__cCst|j|Sr;)rorpr)r$childrrrjoinpathszFastPath.joinpathc CsTttt|jpdW5QRSQRXtt|W5QRSQRXgS)Nr)r Exceptionrlistdirr zip_childrenr=rrrchildrens  " zFastPath.childrencCs2t|j}|j}|j|_tdd|DS)Ncss |]}|tjddVqdS)rrN)r posixpathr)r,rrrrrfsz(FastPath.zip_children..)zipfilerprZnamelistrdictfromkeys)r$Zzip_pathnamesrrrrs    zFastPath.zip_childrencCs&|j}||jkp$||jo$|dS)N.egg)rversionless_egg_name startswithprefixendswith)r$searchrrrris_eggs   zFastPath.is_eggccsZ|D]L}|}||jksH||jr6||jsH||r|dkr||VqdS)Nzegg-info) rr exact_matchesrrrsuffixesrr)r$r-rZn_lowrrrrs    zFastPath.searchN) rrrrWrrrrrrrrrrs  rc@s2eZdZdZdZdZdgddZdZddZdS)Preparedr)z .dist-infoz .egg-infoNrcsV|_|dkrdS|dd_jd_fddjD_jd_dS)N-rVcsg|]}j|qSr) normalized)r,suffixr=rrr1sz%Prepared.__init__..r)r-rreplacerrrrr)r$r-rr=rrWs  zPrepared.__init__) rrrrrrrrrWrrrrrs rc@s,eZdZeefddZeddZdS)MetadataPathFindercCs||j|j}tt|Sr;) _search_pathsr-r]rrn)r/rdfoundrrrrrs z%MetadataPathFinder.find_distributionscs tjfddtt|DS)Nc3s|]}|tVqdSr;)rr)r,r]r^rrrfsz3MetadataPathFinder._search_paths..)rirjrkrr)r/r-pathsrr^rrsz MetadataPathFinder._search_pathsN)rrrrCrr`rrrrrrrrs rc@s.eZdZddZddZejje_ddZdS)rncCs ||_dSr;)_pathr\rrrrWszPathDistribution.__init__c Cs<tttttt"|j|jddW5QRSQRXdS)NrErF) rFileNotFoundErrorIsADirectoryErrorKeyErrorNotADirectoryErrorPermissionErrorrrrMrZrrrrMs zPathDistribution.read_textcCs |jj|Sr;)rparentr\rrrrQszPathDistribution.locate_fileN)rrrrWrMr__doc__rQrrrrrns rncCs t|Sr;)rrcZdistribution_namerrrr scKs tjf|Sr;)rrm)rlrrrr scCs t|jSr;)rrcrrrrrrscCs t|jSr;)r rrrrrr scCsHtjddtD}td}t||d}t||}dd|DS)Ncss|] }|jVqdSr;)r )r,rPrrrrfszentry_points..r)keycSsi|]\}}|t|qSr)tuple)r,repsrrrrsz entry_points..)rirjrkr r attrgettersortedr)rZby_groupZorderedZgroupedrrrr s    cCs t|jSr;)r r rrrrr %scCs t|jSr;)r rrrrrr.s),r7rr(rrrtrvrorrr!rir collectionsZ configparserr contextlibr importlibr importlib.abcrr__all__ModuleNotFoundErrorr namedtuplerZ PurePosixPathrDrRrrrrrrnr r rrr r rrrrrsb       NE/0    PK]/ppresources.cpython-38.opt-1.pycnu[U e5d@% @sddlZddlZddlmZddlmZmZddlm Z ddl m Z ddl m Z mZddlmZdd lmZdd lmZmZmZmZmZdd lmZdd lmZmZdd lmZdddddddddg Zee efZ!ee ej"fZ#edddZ$e dddZ%eeej&dddZ'dd Z(e!e#ed!d"dZ)d-e!e#e e ed%d&dZ*e!e#e+d!d'dZ,d.e!e#e e e d%d(dZ-ee!e#eed!d)dZ.e!e e/d*d+dZ0e!ee dd,dZ1dS)/N)abc)contextmanagersuppress) import_module)ResourceLoader)BytesIO TextIOWrapper)Path) ModuleType)IterableIteratorOptionalSetUnion)cast)BinaryIOTextIO)ZipImportErrorPackageResourcecontents is_resource open_binary open_textpath read_binary read_text)returncCs\t|dr0|jjdkr*td|jjqX|Sn(t|}|jjdkrTtd|n|SdS)zTake a package name or module object and return the module. If a name, the module is imported. If the passed or imported module object is not a package, raise an exception. __spec__Nz{!r} is not a package)hasattrrsubmodule_search_locations TypeErrorformatnamer)packagemoduler'+/usr/lib64/python3.8/importlib/resources.py _get_package"s   r)cCs,tj|\}}|r$td|n|SdS)zNormalize a path by ensuring it is a string. If the resulting string contains path separators, an exception is raised. z{!r} must be only a file nameN)osrsplit ValueErrorr#)rparent file_namer'r'r(_normalize_path6sr/)r%rcCs,|j}t|jdr(ttj|j|jSdS)Nget_resource_reader)rr loaderr resources_abcResourceReaderr0r$)r%specr'r'r(_get_resource_readerBs   r5cCs&|jjdks|jjs"td|dS)NzPackage has no location )rorigin has_locationFileNotFoundError)r%r'r'r(_check_locationPsr9)r%resourcerc Cst|}t|}t|}|dk r*||St|tj|jj }tj |}tj ||}zt |ddWSt k rtt|jj}d}t|jjdrtt ||}W5QRX|dkr|jj}d||} t| n t|YSYnXdS)zDReturn a file-like object opened for binary reading of the resource.Nrb)modeget_data{!r} resource not found in {!r})r/r)r5 open_resourcer9r*rabspathrr6dirnamejoinopenOSErrorrrr1r rr=r$r#r8r) r%r:readerabsolute_package_path package_path full_pathr1data package_namemessager'r'r(rUs2    utf-8strict)r%r:encodingerrorsrc Cs t|}t|}t|}|dk r2t||||St|tj|j j }tj |}tj ||}zt |d||dWStk rtt|j j}d} t|j jdrtt||} W5QRX| dkr|j j} d|| } t| ntt| ||YSYnXdS)zBReturn a file-like object opened for text reading of the resource.Nr)r<rNrOr=r>)r/r)r5r r?r9r*rr@rr6rArBrCrDrrr1r rr=r$r#r8r) r%r:rNrOrErFrGrHr1rIrJrKr'r'r(rts2   c Cs:t|}t|}t||}|W5QRSQRXdS)z+Return the binary contents of the resource.N)r/r)rread)r%r:fpr'r'r(rs c Cs>t|}t|}t||||}|W5QRSQRXdS)zReturn the decoded string of the resource. The decoding-related arguments have the same semantics as those of bytes.decode(). N)r/r)rrQ)r%r:rNrOrRr'r'r(rs c cst|}t|}t|}|dk rNzt||VWdStk rJYqVXnt|d}|jjdk r|t|jjj }||}|dk r| r|Vnxt ||}| }W5QRXt \}}z$t||t|t|VW5zt|Wntk rYnXXdS)akA context manager providing a file path object to the resource. If the resource does not already exist on its own on the file system, a temporary file will be created. If the file was created, the file will be deleted upon exiting the context manager (no exception is raised if the file was deleted prior to the context manager exiting). N)r/r)r5r resource_pathr8r9rr6r-existsrrQtempfileZmkstempr*removewriteclose) r%r:rEZ file_pathpackage_directoryrRrIfdZraw_pathr'r'r(rs6      )r%r$rc Cs|t|}t|t|}|dk r*||Sztt|}Wnttfk rTYdSX||krbdSt|j j j |}| S)zYTrue if 'name' is a resource inside 'package'. Directories are *not* resources. NF) r)r/r5rsetrNotADirectoryErrorr8r rr6r-is_file)r%r$rEZpackage_contentsrr'r'r(rs cCsTt|}t|}|dk r |S|jjdks4|jjs8dSt|jjj}t |SdS)zReturn an iterable of entries in 'package'. Note that not all entries are resources. Specifically, directories are not considered resources. Use `is_resource()` on each entry returned here to check if it is a resource or not. Nr') r)r5rrr6r7r r-r*listdir)r%rErYr'r'r(rs)rLrM)rLrM)2r*rUrr2 contextlibrr importlibr importlib.abcriorr pathlibr typesr typingr r rrrrZ typing.iorrZ zipimportr__all__strrPathLikerr)r/r3r5r9rrbytesrrrboolrrr'r'r'r(sh          ! "  .PK]gmachinery.cpython-38.pycnu[U e5dL@sdZddlZddlmZddlmZddlmZddlmZmZm Z m Z m Z ddlm Z dd lm Z dd lmZdd lmZdd lmZdd lmZddZdS)z9The machinery of importlib: finders, loaders, hooks, etc.N) ModuleSpec)BuiltinImporter)FrozenImporter)SOURCE_SUFFIXESDEBUG_BYTECODE_SUFFIXESOPTIMIZED_BYTECODE_SUFFIXESBYTECODE_SUFFIXESEXTENSION_SUFFIXES)WindowsRegistryFinder) PathFinder) FileFinder)SourceFileLoader)SourcelessFileLoader)ExtensionFileLoadercCs tttS)zAReturns a list of all recognized module suffixes for this process)rr r rr+/usr/lib64/python3.8/importlib/machinery.py all_suffixessr)__doc___imp _bootstraprrr_bootstrap_externalrrrr r r r r rrrrrrrrs         PK]7788machinery.cpython-38.opt-2.pycnu[U e5dL@sddlZddlmZddlmZddlmZddlmZmZmZm Z m Z ddlm Z ddlm Z dd lm Z dd lmZdd lmZdd lmZd dZdS)N) ModuleSpec)BuiltinImporter)FrozenImporter)SOURCE_SUFFIXESDEBUG_BYTECODE_SUFFIXESOPTIMIZED_BYTECODE_SUFFIXESBYTECODE_SUFFIXESEXTENSION_SUFFIXES)WindowsRegistryFinder) PathFinder) FileFinder)SourceFileLoader)SourcelessFileLoader)ExtensionFileLoadercCs tttS)N)rr r rr+/usr/lib64/python3.8/importlib/machinery.py all_suffixessr)_imp _bootstraprrr_bootstrap_externalrrrr r r r r rrrrrrrrs         PK]c$֬oo_bootstrap.cpython-38.opt-1.pycnu[U e5dܚ@sdZdaddZddZiZiZGdddeZGdd d ZGd d d Z Gd d d Z ddZ ddZ ddZ ddddZddZddZddZddZGd d!d!Zddd"d#d$Zd^d%d&Zd'd(d)d*Zd+d,Zd-d.Zd/d0Zd1d2Zd3d4Zd5d6ZGd7d8d8ZGd9d:d:ZGd;d<d<Zd=d>Z d?d@Z!d_dAdBZ"dCdDZ#dEZ$e$dFZ%dGdHZ&e'Z(dIdJZ)d`dLdMZ*d'dNdOdPZ+dQdRZ,dadTdUZ-dVdWZ.dXdYZ/dZd[Z0d\d]Z1dS)baSCore implementation of import. This module is NOT meant to be directly imported! It has been designed such that it can be bootstrapped into Python as the implementation of import. As such it requires the injection of specific modules and attributes in order to work. One should use importlib as the public-facing version of this module. NcCs8dD] }t||rt||t||q|j|jdS)z/Simple substitute for functools.update_wrapper.) __module____name__ __qualname____doc__N)hasattrsetattrgetattr__dict__update)newoldreplacer ,/usr/lib64/python3.8/importlib/_bootstrap.py_wraps rcCs tt|SN)typesysnamer r r _new_module#src@s eZdZdS)_DeadlockErrorN)rrrr r r rr0src@s8eZdZdZddZddZddZdd Zd d Zd S) _ModuleLockzA recursive lock implementation which is able to detect deadlocks (e.g. thread 1 trying to take locks A then B, and thread 2 trying to take locks B then A). cCs0t|_t|_||_d|_d|_d|_dSN)_thread allocate_locklockwakeuprownercountwaitersselfrr r r__init__:s   z_ModuleLock.__init__cCs<t}|j}t|}|dkr$dS|j}||krdSqdS)NFT)r get_identr _blocking_onget)r"metidrr r r has_deadlockBs z_ModuleLock.has_deadlockc Cst}|t|<z|jn|jdks.|j|krT||_|jd7_W5QRWVdS|rhtd||j dr|j d7_ W5QRX|j |j qW5t|=XdS)z Acquire the module lock. If a potential deadlock is detected, a _DeadlockError is raised. Otherwise, the lock is always acquired and True is returned. rTzdeadlock detected by %rFN) rr$r%rrrr)rracquirer releaser"r(r r rr+Ns   z_ModuleLock.acquirec Cslt}|jT|j|kr"td|jd8_|jdkr^d|_|jr^|jd8_|jW5QRXdS)Ncannot release un-acquired lockr*r) rr$rr RuntimeErrorrr rr,r-r r rr,gs  z_ModuleLock.releasecCsd|jt|S)Nz_ModuleLock({!r}) at {}formatridr"r r r__repr__tsz_ModuleLock.__repr__N) rrrrr#r)r+r,r4r r r rr4s   rc@s0eZdZdZddZddZddZdd Zd S) _DummyModuleLockzVA simple _ModuleLock equivalent for Python builds without multi-threading support.cCs||_d|_dSr)rrr!r r rr#|sz_DummyModuleLock.__init__cCs|jd7_dS)Nr*T)rr3r r rr+sz_DummyModuleLock.acquirecCs$|jdkrtd|jd8_dS)Nrr.r*)rr/r3r r rr,s z_DummyModuleLock.releasecCsd|jt|S)Nz_DummyModuleLock({!r}) at {}r0r3r r rr4sz_DummyModuleLock.__repr__N)rrrrr#r+r,r4r r r rr5xs r5c@s$eZdZddZddZddZdS)_ModuleLockManagercCs||_d|_dSr)_name_lockr!r r rr#sz_ModuleLockManager.__init__cCst|j|_|jdSr)_get_module_lockr7r8r+r3r r r __enter__s z_ModuleLockManager.__enter__cOs|jdSr)r8r,)r"argskwargsr r r__exit__sz_ModuleLockManager.__exit__N)rrrr#r:r=r r r rr6sr6cCstzjzt|}Wntk r0d}YnX|dkrptdkrLt|}nt|}|fdd}t ||t|<W5tX|S)zGet or create the module lock for a given module name. Acquire/release internally the global import lock to protect _module_locks.NcSs0tzt||krt|=W5tXdSr)_imp acquire_lock release_lock _module_locksr&)refrr r rcbs  z_get_module_lock..cb) r>r?r@rAKeyErrorrr5r_weakrefrB)rrrCr r rr9s    r9cCs6t|}z |Wntk r(Yn X|dS)zAcquires then releases the module lock for a given module name. This is used to ensure a module is completely initialized, in the event it is being imported by another thread. N)r9r+rr,)rrr r r_lock_unlock_modules  rFcOs |||S)a.remove_importlib_frames in import.c will always remove sequences of importlib frames that end with a call to this function Use it instead of a normal call in places where including the importlib frames introduces unwanted noise into the traceback (e.g. when executing module code) r )fr;kwdsr r r_call_with_frames_removedsrIr*) verbositycGs6tjj|kr2|dsd|}t|j|tjddS)z=Print the message to stderr if -v/PYTHONVERBOSE is turned on.)#zimport z# )fileN)rflagsverbose startswithprintr1stderr)messagerJr;r r r_verbose_messages  rScsfdd}t||S)z1Decorator to verify the named module is built-in.cs&|tjkrtd||d||S)N{!r} is not a built-in moduler)rbuiltin_module_names ImportErrorr1r"fullnamefxnr r_requires_builtin_wrappers   z4_requires_builtin.._requires_builtin_wrapperr)rZr[r rYr_requires_builtins  r]csfdd}t||S)z/Decorator to verify the named module is frozen.cs&t|std||d||SNz{!r} is not a frozen moduler)r> is_frozenrVr1rWrYr r_requires_frozen_wrappers   z2_requires_frozen.._requires_frozen_wrapperr\)rZr`r rYr_requires_frozens  racCs>t||}|tjkr2tj|}t||tj|St|SdS)zLoad the specified module into sys.modules and return it. This method is deprecated. Use loader.exec_module instead. N)spec_from_loaderrmodules_exec_load)r"rXspecmoduler r r_load_module_shims      rhcCst|dd}t|dr8z ||WStk r6YnXz |j}Wntk rVYnX|dk rht|Sz |j}Wntk rd}YnXz |j}Wn:tk r|dkrd |YSd ||YSYnXd ||SdS)N __loader__ module_repr? ) rrrj Exception__spec__AttributeError_module_repr_from_specr__file__r1)rgloaderrfrfilenamer r r _module_repr s.       rvc@sreZdZdZddddddZddZdd Zed d Zej d d Zed dZ eddZ e j ddZ dS) ModuleSpecaThe specification for a module, used for loading. A module's spec is the source for information about the module. For data associated with the module, including source, use the spec's loader. `name` is the absolute name of the module. `loader` is the loader to use when loading the module. `parent` is the name of the package the module is in. The parent is derived from the name. `is_package` determines if the module is considered a package or not. On modules this is reflected by the `__path__` attribute. `origin` is the specific location used by the loader from which to load the module, if that information is available. When filename is set, origin will match. `has_location` indicates that a spec's "origin" reflects a location. When this is True, `__file__` attribute of the module is set. `cached` is the location of the cached bytecode file, if any. It corresponds to the `__cached__` attribute. `submodule_search_locations` is the sequence of path entries to search when importing submodules. If set, is_package should be True--and False otherwise. Packages are simply modules that (may) have submodules. If a spec has a non-None value in `submodule_search_locations`, the import system will consider modules loaded from the spec as packages. Only finders (see importlib.abc.MetaPathFinder and importlib.abc.PathEntryFinder) should modify ModuleSpec instances. N)origin loader_state is_packagecCs6||_||_||_||_|r gnd|_d|_d|_dSNF)rrtrxrysubmodule_search_locations _set_fileattr_cached)r"rrtrxryrzr r rr#VszModuleSpec.__init__cCsfd|jd|jg}|jdk r4|d|j|jdk rP|d|jd|jjd|S)Nz name={!r}z loader={!r}z origin={!r}zsubmodule_search_locations={}z{}({})z, ) r1rrtrxappendr| __class__rjoin)r"r;r r rr4bs    zModuleSpec.__repr__cCsj|j}zH|j|jkoL|j|jkoL|j|jkoL||jkoL|j|jkoL|j|jkWStk rdYdSXdSr{)r|rrtrxcached has_locationrq)r"othersmslr r r__eq__ls     zModuleSpec.__eq__cCs:|jdkr4|jdk r4|jr4tdkr&tt|j|_|jSr)r~rxr}_bootstrap_externalNotImplementedError _get_cachedr3r r rrxs  zModuleSpec.cachedcCs ||_dSr)r~)r"rr r rrscCs$|jdkr|jddS|jSdS)z The name of the module's parent.N.r)r|r rpartitionr3r r rparents zModuleSpec.parentcCs|jSr)r}r3r r rrszModuleSpec.has_locationcCst||_dSr)boolr})r"valuer r rrs) rrrrr#r4rpropertyrsetterrrr r r rrw1s $       rwrxrzcCst|drJtdkrttj}|dkr0|||dS|r8gnd}||||dS|dkrt|drz||}Wqtk rd}YqXnd}t||||dS)z5Return a module spec based on various loader methods. get_filenameN)rt)rtr|rzFr)rrrspec_from_file_locationrzrVrw)rrtrxrzrsearchr r rrbs$     rbcCs8z |j}Wntk rYnX|dk r,|S|j}|dkrZz |j}Wntk rXYnXz |j}Wntk r|d}YnX|dkr|dkrz |j}Wqtk rd}YqXn|}z |j}Wntk rd}YnXzt|j}Wntk rd}YnXt |||d}|dkr"dnd|_ ||_ ||_ |S)NrxFT) rprqrrirs_ORIGIN __cached__list__path__rwr}rr|)rgrtrxrfrlocationrr|r r r_spec_from_modulesH         rFoverridecCs|st|dddkr6z |j|_Wntk r4YnX|sJt|dddkr|j}|dkr|jdk rtdkrnttj}| |}|j|_ ||_d|_ z ||_ Wntk rYnX|st|dddkrz |j |_Wntk rYnXz ||_Wntk rYnX|s"t|dddkrR|jdk rRz |j|_Wntk rPYnX|jr|srt|dddkrz |j|_ Wntk rYnX|st|dddkr|jdk rz |j|_Wntk rYnX|S)Nrri __package__rrsr)rrrrqrtr|rr_NamespaceLoader__new___pathrsrirrrprrrxrr)rfrgrrtrr r r_init_module_attrss`            rcCsRd}t|jdr|j|}nt|jdr2td|dkrDt|j}t|||S)z+Create a module based on the provided spec.N create_module exec_modulezBloaders that define exec_module() must also define create_module())rrtrrVrrrrfrgr r rmodule_from_spec%s    rcCsj|jdkrdn|j}|jdkrB|jdkr2d|Sd||jSn$|jrVd||jSd|j|jSdS)z&Return the repr to use for the module.Nrkrlrmrn)rrxrtr1r)rfrr r rrr6s   rrc Cs|j}t|tj||k r6d|}t||dzj|jdkrj|j dkrZtd|jdt ||ddn4t ||ddt |jds|j |n |j |W5tj|j}|tj|j<XW5QRX|S)zFExecute the spec's specified module in an existing module's namespace.zmodule {!r} not in sys.modulesrNmissing loaderTrr)rr6rrcr&r1rVpoprtr|rr load_moduler)rfrgrmsgr r rrdGs"      rdcCsz|j|jWn4|jtjkr@tj|j}|tj|j<YnXtj|j}|tj|j<t|dddkrz |j|_Wntk rYnXt|dddkrz(|j |_ t |ds|j dd|_ Wntk rYnXt|dddkrz ||_ Wntk rYnX|S)Nrirrrrrp)rtrrrrcrrrirqrrrrrprr r r_load_backward_compatiblees6      rc Cs|jdk rt|jdst|St|}d|_z|tj|j<z4|jdkr`|jdkrlt d|jdn |j |Wn2ztj|j=Wnt k rYnXYnXtj |j}|tj|j<t d|j|jW5d|_X|S)NrTFrrzimport {!r} # {!r})rtrrr _initializingrrcrr|rVrrDrrSrr r r_load_unlockeds.      rc Cs*t|jt|W5QRSQRXdS)zReturn a new module object, loaded by the spec's loader. The module is not added to its parent. If a module is already in sys.modules, that existing module gets clobbered. N)r6rr)rfr r rres rec@seZdZdZeddZedddZedddZed d Z ed d Z ee d dZ ee ddZ ee ddZeeZdS)BuiltinImporterzMeta path import for built-in modules. All methods are either class or static methods to avoid the need to instantiate the class. cCs d|jS)sReturn repr for the module. The method is deprecated. The import machinery does the job itself. z)r1r)rgr r rrjszBuiltinImporter.module_reprNcCs,|dk r dSt|r$t||ddSdSdS)Nzbuilt-inr)r> is_builtinrbclsrXpathtargetr r r find_specs  zBuiltinImporter.find_speccCs|||}|dk r|jSdS)zFind the built-in module. If 'path' is ever specified then the search is considered a failure. This method is deprecated. Use find_spec() instead. N)rrt)rrXrrfr r r find_modules zBuiltinImporter.find_modulecCs.|jtjkr"td|j|jdttj|S)zCreate a built-in modulerTr)rrrUrVr1rIr>create_builtin)r"rfr r rrs   zBuiltinImporter.create_modulecCsttj|dS)zExec a built-in moduleN)rIr> exec_builtin)r"rgr r rrszBuiltinImporter.exec_modulecCsdS)z9Return None as built-in modules do not have code objects.Nr rrXr r rget_codeszBuiltinImporter.get_codecCsdS)z8Return None as built-in modules do not have source code.Nr rr r r get_sourceszBuiltinImporter.get_sourcecCsdS)z4Return False as built-in modules are never packages.Fr rr r rrzszBuiltinImporter.is_package)NN)N)rrrr staticmethodrj classmethodrrrrr]rrrzrhrr r r rrs*        rc@seZdZdZdZeddZedddZeddd Z ed d Z ed d Z eddZ ee ddZee ddZee ddZdS)FrozenImporterzMeta path import for frozen modules. All methods are either class or static methods to avoid the need to instantiate the class. frozencCsd|jtjS)rr)r1rrr)mr r rrjszFrozenImporter.module_reprNcCs"t|rt|||jdSdSdS)Nr)r>r_rbrrr r rr s zFrozenImporter.find_speccCst|r|SdS)z]Find a frozen module. This method is deprecated. Use find_spec() instead. N)r>r_)rrXrr r rr'szFrozenImporter.find_modulecCsdS)z*Use default semantics for module creation.Nr )rrfr r rr0szFrozenImporter.create_modulecCs@|jj}t|s$td||dttj|}t||j dSr^) rprr>r_rVr1rIget_frozen_objectexecr)rgrcoder r rr4s   zFrozenImporter.exec_modulecCs t||S)z_Load a frozen module. This method is deprecated. Use exec_module() instead. )rhrr r rr=szFrozenImporter.load_modulecCs t|S)z-Return the code object for the frozen module.)r>rrr r rrFszFrozenImporter.get_codecCsdS)z6Return None as frozen modules do not have source code.Nr rr r rrLszFrozenImporter.get_sourcecCs t|S)z.Return True if the frozen module is a package.)r>is_frozen_packagerr r rrzRszFrozenImporter.is_package)NN)N)rrrrrrrjrrrrrrrarrrzr r r rr s.        rc@s eZdZdZddZddZdS)_ImportLockContextz$Context manager for the import lock.cCs tdS)zAcquire the import lock.N)r>r?r3r r rr:_sz_ImportLockContext.__enter__cCs tdS)zr@)r"exc_type exc_value exc_tracebackr r rr=csz_ImportLockContext.__exit__N)rrrrr:r=r r r rr[srcCs@|d|d}t||kr$td|d}|r= 0z__package__ not set to a stringz6attempted relative import with no known parent packagezEmpty module nameN) isinstancestr TypeErrorr1rrrVrrrr r r _sanity_checks    rzNo module named z{!r}cCsd}|dd}|r|tjkr*t|||tjkr>tj|Stj|}z |j}Wn2tk rtd||}t||ddYnXt ||}|dkrtt||dnt |}|rtj|}t ||dd||S)Nrrz; {!r} is not a packager) rrrcrIrrq_ERR_MSGr1ModuleNotFoundErrorrrr)rimport_rr parent_modulerrfrgr r r_find_and_load_unlockeds*        rc Csjt|2tj|t}|tkr6t||W5QRSW5QRX|dkr^d|}t||dt||S)zFind and load the module.Nz(import of {} halted; None in sys.modulesr) r6rrcr&_NEEDS_LOADINGrr1rrF)rrrgrRr r r_find_and_loads   rrcCs*t||||dkr t|||}t|tS)a2Import and return the module based on its name, the package the call is being made from, and the level adjustment. This function represents the greatest common denominator of functionality between import_module and __import__. This includes setting __package__ if the loader did not. r)rrr _gcd_importrr r rrs  r recursivec Cs|D]}t|tsB|r"|jd}nd}td|dt|jq|dkrl|st|drt||j|ddqt||sd |j|}zt ||Wqt k r}z*|j |krt j |td k rWYqW5d }~XYqXq|S) zFigure out what __import__ should return. The import_ parameter is a callable which takes the name of module to import. It is required to decouple the function from assuming importlib's import implementation is desired. z.__all__z ``from list''zItem in z must be str, not *__all__TrrN)rrrrrr_handle_fromlistrr1rIrrrrcr&r)rgfromlistrrxwhere from_nameexcr r rrs,      rcCs|d}|d}|dk rR|dk rN||jkrNtjd|d|jdtdd|S|dk r`|jStjd tdd|d }d |kr|d d }|S)zCalculate what __package__ should be. __package__ is not guaranteed to be defined or could be set to None to represent that its proper value is unknown. rrpNz __package__ != __spec__.parent (z != )) stacklevelzYcan't resolve package from __spec__ or __package__, falling back on __name__ and __path__rrrr)r&rrrrr)globalsrrfr r r_calc___package__s&  rr c Cs|dkrt|}n$|dk r|ni}t|}t|||}|s|dkrTt|ddS|s\|St|t|dd}tj|jdt|j|Snt|drt||tS|SdS)aImport a module. The 'globals' argument is used to infer where the import is occurring from to handle relative imports. The 'locals' argument is ignored. The 'fromlist' argument specifies what should exist as attributes on the module being imported (e.g. ``from module import ``). The 'level' argument represents the package location to import from in a relative import (e.g. ``from ..pkg import mod`` would have a 'level' of 2). rNrr) rr partitionrrrcrrr) rrlocalsrrrgglobals_rcut_offr r r __import__9s      rcCs&t|}|dkrtd|t|S)Nzno built-in module named )rrrVr)rrfr r r_builtin_from_name^s  rc Cs|a|att}tjD]H\}}t||r|tjkrrrrcitemsrrUrr_rrrrrr) sys_module _imp_module module_typerrgrtrf self_module builtin_namebuiltin_moduler r r_setupes$          rcCs&t||tjttjtdS)z0Install importers for builtin and frozen modulesN)rrrrrr)rrr r r_installs  rcCs ddl}|a|tjtdS)z9Install importers that require external filesystem accessrN)_frozen_importlib_externalrrrrcr)rr r r_install_external_importerssr)NN)N)Nr)NNr r)2rrrrrAr%r/rrr5r6r9rFrIrSr]rarhrvrwrbrrrrrrdrrrerrrrrrr_ERR_MSG_PREFIXrrobjectrrrrrrrrrrr r r rs^D%   $e -H%*IO   / % %#PK]?abc.cpython-38.opt-2.pycnu[U e5dD@sddlTddlmZdS))*)__all__N)_collections_abcrrr'/usr/lib64/python3.8/collections/abc.pysPK]cO O domreg.cpython-312.opt-2.pycnu[ ֦i{ 6 ddlZdddZiZdZdZd dZdZy) Nzxml.dom.minidomzxml.dom.DOMImplementation)minidom4DOMc |t|<y)N) registered)namefactorys '/usr/lib64/python3.12/xml/dom/domreg.pyregisterDOMImplementationr sJtcB |D]\}}|j||ryy)Nr) hasFeature)domfeaturesfvs r _good_enoughr s)L!~~a" r cR ddl}d}tj|}|rt|iidg}|j S|r t |St jjs'd|jvrt |jdSt|tr t|}t jD]}|}t||s|cStjD]} t |}t||s|cSt#d#t $rY8wxYw)NrgetDOMImplementation PYTHON_DOM)rz$no suitable DOM implementation found)oswell_known_implementationsget __import__rrsysflagsignore_environmentenviron isinstancestr_parse_feature_stringvaluesrkeys Exception ImportError)rrrcreatormodrs r rr's CG $ ( ( .C b"'=&>?'')) $!! YY ) )lbjj.H#2::l+CDD(C (2$$&i X &J' .224 &g6C X &J 5 < ==    s1 D D&%D&cg}|j}d}t|}||krR||}|ddvrtd||dz}d}||kr||}|ddvr|dz}|}|j||f||krRt |S)Nr 0123456789zbad feature name: r )splitlen ValueErrorappendtuple)srpartsilengthfeatureversionrs r r!r!RsH GGIE A ZF f*( 1: %w@A A E v:aAt|#E'*+ f* ?r )N)rrrr rrr!r5r r r6s;>  '   )>Vr PK]'?ffminidom.cpython-312.opt-1.pycnu[ ֦i ZdZddlZddlZddlmZmZmZmZddlddl m Z m Z ejjjejjjfZGddejjZ ee dd ee d d ee d d dZdZdZdZGdde ZGdde Zeedd eed d eedd GddeZeedd eZGd d!eZeddZGd"d#e Zeed$d% eed d& d'ZGd(d)ZGd*d+ee Z Gd,d-ee Z!ee!dd. Gd/d0e!Z"ee"d1d2 ee"d3d4 d5Z#d6Z$Gd7d8e!Z%Gd9d:e"Z&Gd;dd?Z(Gd@dAe(ee Z)GdBdCe(e Z*GdDdEe(ee Z+GdFdGe Z,GdHdIeZ-dJZ.GdKdLe e Z/ee/dMdN dOZ0dPZ1dQZ2dUdRZ3dVdSZ4dVdTZ5y)WacSimple implementation of the Level 1 DOM. Namespaces and other minor Level 2 features are also supported. parse("foo.xml") parseString("") Todo: ===== * convenience methods for getting elements and text. * more testing * bring some of the writer and linearizer code into conformance with this interface * SAX 2 namespaces N)EMPTY_NAMESPACE EMPTY_PREFIXXMLNS_NAMESPACEdomreg)*)DOMImplementationLS DocumentLSceZdZdZdZdZdZdZeZ dZ ddZ ddZ dZ dZdZdZd Zd Zd Zd Zd ZdZdZdZdZdZdZdZdZdZdZdZ y)NodeNcy)NTselfs (/usr/lib64/python3.12/xml/dom/minidom.py__bool__z Node.__bool__+c*|jdd||SN) toprettyxml)rencoding standalones rtoxmlz Node.toxml.sB*==rcv|tj}n+tjtj|dd}|jt j k(r|j|d||||n|j|d||||jS|jjS)Nxmlcharrefreplace )rerrorsnewliner) ioStringIO TextIOWrapperBytesIOnodeTyper DOCUMENT_NODEwritexmlgetvaluedetach)rindentnewlrrwriters rrzNode.toprettyxml1s  [[]F%%bjjl/7-@.24F ==D.. . MM&"fdHj I MM&"fd 3  ??$ $==?++- -rc,t|jSN)bool childNodesrs r hasChildNodeszNode.hasChildNodesDsDOO$$rc|jSr-r/rs r_get_childNodeszNode._get_childNodesG rc:|jr|jdSyNrr2rs r_get_firstChildzNode._get_firstChildJs ????1% % rc:|jr|jdSyNr2rs r_get_lastChildzNode._get_lastChildNs ????2& & rc&|j|jk(r.t|jD]}|j |||S|j|j vr6t jjt|dt||j|jj|||j||S |jj|}|jt vr t#||jj%||||_||_|r!|j|dz }||_||_nd|_||_ |S#t$rt jjwxYw)N cannot be child of )r$DOCUMENT_FRAGMENT_NODEtupler/ insertBefore_child_node_typesxmldomHierarchyRequestErrrepr parentNode removeChild appendChildindex ValueError NotFoundErr_nodeTypes_with_children_clear_id_cacheinsert nextSiblingpreviousSibling)rnewChildrefChildcrJnodes rrAzNode.insertBeforeRsn    ; ; ;8../!!!X.0O   D$:$: :''--.28nd4jIK K    *    + +H 5     X &$! ,--h7  $<<% OO " "5( 3#+H '/H $uQw/#+ +/(+/("&H  ,gg))++ ,s E(((Fc|j|jk(r-t|jD]}|j ||S|j|j vr6t jjt|dt||jtvr t||j|jj|t||d|_|SNr=)r$r?r@r/rIrBrCrDrErFrMrNrGrH _append_childrP)rrUrTs rrIzNode.appendChildrs ==D77 74??+  #,K == 6 6 6''--.24j$t*EG G ]]6 6 D ! ?? & OO ' ' -dD! rc|j|jk(r/|j}|j||j ||S|j|j vr6t jjt|dt|||ury|j|jj| |jj|}||j|<||_ d|_ |jtvs|jtvr t!||j|_|j"|_d|_d|_|j"r||j"_|jr||j_|S#t$rt jjwxYwrW)r$r?rPrHrArBrCrDrErFrGr/rJrKrLrMrNrQ)rrRoldChildrSrJs r replaceChildzNode.replaceChilds    ; ; ;++H   X &$$Xx8 8   D$:$: :''--.28nd4jIK K x      *    + +H 5 (OO))(3E"*""   !9 9  $<< D !'33#+#;#; ##'  # #3;H $ $ 0   3;H 0! (''%%' ' (s F(F?c |jj||j |j|j _|j|j |j_dx|_|_|jtvr t|d|_ |S#t$rtjj wxYwr-) r/removerKrCrDrLrPrQr$rMrNrGrrZs rrHzNode.removeChilds ( OO " "8 ,    +3;3K3KH 0  # # /3;3G3GH $ $ 0:>>x7    8 8 D !" (''%%' ' (s B(Ccg}|jD]M}|jtjk(r|jsN|r|j |d_|j r|j |j _|j{|r~|dj|jk(rb|d}|j|jz|_|j |_|j r||j _|j|j||j||jtjk(s>|jP||jddyr9) r/r$r TEXT_NODEdatarPrQunlinkappend ELEMENT_NODE normalize)rLchildrUs rrezNode.normalizes  __E~~/zz,1,=,=")((>U^^;R5D $ EJJ 6DI','8'8D$((<@))9LLNHHUO>>T%6%66OO%-%.rc8t|||jxs|Sr-) _clone_node ownerDocument)rdeeps r cloneNodezNode.cloneNodes4t'9'9'ATBBrcN|jjj||Sr-)rjimplementation hasFeaturerfeatureversions r isSupportedzNode.isSupporteds!!!00;;GWMMrcyr-r rs r_get_localNamezNode._get_localNamesrc ||uSr-r rothers r isSameNodezNode.isSameNodes u}rc,|j|dr|Syr-)rsrrqs r getInterfacezNode.getInterfaces   GT *KrcR |j|dS#ttf$rYywxYwr6) _user_dataAttributeErrorKeyErrorrkeys r getUserDatazNode.getUserDatas2 ??3'* *)  s &&cd} |j}||vr||d}| d}|||=|S||f||<|S#t$r i}||_Y4wxYwr6)r~r)rrrahandleroldds r setUserDatazNode.setUserDatasy A !8C&)C <GcF G_AcF  ADO s 0AAct|drGt|jjD] \}\}}| |j |||||"yy)Nr~)hasattrlistr~itemshandle)r operationsrcdstrrars r_call_user_data_handlerzNode._call_user_data_handlersQ 4 &(,T__-B-B-D(E$_dG&NN9c4cB)F 'rcdx|_|_|jr0|jD]}|jt |_d|_d|_yr-)rGrjr/rbNodeListrQrP)rrgs rrbz Node.unlinksH/33$, ?? )&jDO#rc|Sr-r rs r __enter__zNode.__enter__s rc$|jyr-)rb)retevtbs r__exit__z Node.__exit__s  rNN) rNN)!__name__ __module__ __qualname__ namespaceURIrGrjrPrQrprefixrrrr0r3r7r;rArIr[rHrerlrsruryr|rrrrbrrr rrr r "sLJMKO F><@#.&%&'@"@ 6CN  $C rr firstChildzFirst child node, or None.)doc lastChildzLast child node, or None. localNamez"Namespace-local name of this node.cv|j}|r|d}||_||_|j|||_yr9)r/rQrPrcrG)rrUr/lasts rrXrXs<J"~#dDOrc|rT|jddjddjddjdd}|j|y y ) zWrites datachars to writer.&z&z>N)replacewrite)r+ras r _write_datar(sM ||C)11#v>GD(+GGC,@  T rc|jD]Q}|jtjk(r%|dk(s|j|k(r|j |t |||S|SNr)r/r$r rdtagNamerc_get_elements_by_tagName_helper)parentnamercrUs rrr/sT!! ==D-- - S[DLLD0 IIdO'dB7 " Irc|jD]g}|jtjk(s!|dk(s|j|k(r%|dk(s|j |k(r|j |t||||i|Sr)r/r$r rdrrrc"_get_elements_by_tagName_ns_helper)rnsURIrrrUs rrr7sk!! ==D-- -c!T^^y%@#!2!2e!; $ .tUIr J " IrceZdZejZdZdZdZdZ ejejejejejejej fZdZy)DocumentFragmentz#document-fragmentNc"t|_yr-)rr/rs r__init__zDocumentFragment.__init__Ns "*r)rrrr r?r$nodeName nodeValue attributesrGrdr`CDATA_SECTION_NODEENTITY_REFERENCE_NODEPROCESSING_INSTRUCTION_NODE COMMENT_NODE NOTATION_NODErBrr rrrr@sk**H#HIJJ**003399**++ -%rrceZdZdZej ZdZdZdZ ejejfZ e ddfdZdZdZdZdZeeexZZd Zd ZeeexZZd Zd ZeeeZd ZdZdZy)Attr)_name_valuer_prefixr/ _localNamerj ownerElementNFcd|_d|_||_||_||_|||_t |_|jjtyr-) rrjrrrrrr/rcText)rqNamerrrs rrz Attr.__init__\sT ! (  'DO"* tv&rcx |jS#t$r"|jjdddcYSwxYwN:r>r:)rrrsplitrs rruzAttr._get_localNamels< 3?? " 3==&&sA.r2 2 3 (99c|jSr-) specifiedrs r_get_specifiedzAttr._get_specifiedr ~~rc|jSr-)rrs r _get_namezAttr._get_nameu zzrcV||_|jt|jyyr-)rrrNrvalues r _set_namezAttr._set_namexs(    ( D-- . )rc|jSr-)rrs r _get_valuezAttr._get_value {{rc||_||jd_|jt |j||jd_yr6)rr/rarrNrs r _set_valuezAttr._set_valuesE "'    ( D-- ."'rc|jSr-)rrs r _get_prefixzAttr._get_prefix ||rc|j}|dk(r*|r(|tk7rtjj d||_| |j }n|d|j }|jrt|j||_ y)Nxmlnsz5illegal use of 'xmlns' prefix for the wrong namespacer) rrrCrD NamespaceErrrrrrNr)rrnsurinewNames r _set_prefixzAttr._set_prefixs|!! W /1gg**KMM >nnG!'8G    D-- . rc|j}||j|j=|j|j|j f=|j r;d|_|xjdzc_|jxjdzc_ |jD]}|j|jdd=y)NFr>) r_attrsr_attrsNSrr_is_id_magic_id_nodesrj_magic_id_countr/rb)relemrgs rrbz Attr.unlinks      DMM* t00$..AB{{# $$)$""22a72__E LLN% OOA rc|jry|j}|j}||y|j|}|y|jr&|j |j|j S|j|jSNTF) rrjr_get_elem_inforisIdNSrisIdrrrrinfos r _get_isIdzAttr._get_isIds} ;;     ;$,!!$' <   ;;t00$..A A99T]]+ +rc|j}|j}||tS|j|}|tS|jr&|j |j|j S|j|jSr-) rjr_no_typerrgetAttributeTypeNSrgetAttributeTyperrs r_get_schemaTypezAttr._get_schemaTypes{     ;$,O!!$' <O   **4+<+6 T]D$6rr-)!rrr__doc__rrrrrrrrr rr$__len__r(r+r.r0r3r5r8r=r@rCrHrKr:rOrQrSrWr rrrrs8I*     ( "$$,GC %%$%$1 $  ( ( ' >?rrlengthz$Number of nodes in the NamedNodeMap.c(eZdZdZdZdZdZdZy)TypeInfo namespacerc ||_||_yr-r])rr^rs rrzTypeInfo.__init__s" rc|jr4d|jjd|jd|jdSd|jjd|jdS)Nr z (from z)>r)r^ __class__rrrs r__repr__zTypeInfo.__repr__sM >>*...*A*A499*...: : !% 7 7C Crc|jSr-)rrs rrzTypeInfo._get_name yyrc|jSr-)r^rs r_get_namespacezTypeInfo._get_namespacerrN)rrrrrrcrrgr rrr\r\|s#IDrr\cjeZdZdZej ZdZeZ dZ ej ejejejejejfZeddfdZdZdZdZdZd Zd Zd Zd Zd ZdZdZeZdZdZ dZ!e!Z"dZ#dZ$dZ%dZ&dZ'ddZ(dZ)dZ*dZ+dZ,dZ-y)Element) rjrGrrrrrr/rrrPrQNrcd|_d|_|x|_|_||_||_t |_dx|_|_ d|_ d|_ yr-) rjrGrrrrrr/rPrQrr)rrrrrs rrzElement.__init__sW!'.. t} ("*2664/  rc:|ji|_i|_yyr-)rrrs r_ensure_attributeszElement._ensure_attributess ;; DKDM rcx |jS#t$r"|jjdddcYSwxYwr)rrrrrs rruzElement._get_localNames< 2?? " 2<<%%c1-b1 1 2rc|jSr-rrs r _get_tagNamezElement._get_tagNamerrc|j8t|jjD]}|jd|_d|_t j|yr-)rrrrbrr )rattrs rrbzElement.unlinksK ;; "T[[//12 3   Drcn|jy |j|jS#t$rYywxYw)aReturns the value of the specified attribute. Returns the value of the element's attribute named attname as a string. An empty string is returned if the element does not have such an attribute. Note that an empty string may also be returned as an explicitly given attribute value, use the hasAttribute method to distinguish these two cases. r)rrr)rr<s r getAttributezElement.getAttributes= ;;  ;;w'-- -  s ( 44cr|jy |j||fjS#t$rYywxYwr)rrrrBs rgetAttributeNSzElement.getAttributeNSs@ ==  ==, !:;AA A  s * 66c|j|}|5t|}||_|j|_|j |y||jk7r ||_|j r t |yyyr-)getAttributeNoderrrjsetAttributeNoderrN)rr<rrrs r setAttributezElement.setAttributeso$$W- <=DDJ!%!3!3D   ! !$ ' djj DJyy%!rcNt|\}}|j||}|8t||||}||_|j|_|j |y||jk7r||_|j r t||j|k7r||_||_ yyr-) _nssplitgetAttributeNodeNSrrrjryrrNrr)rr qualifiedNamerr localnamerrs rsetAttributeNSzElement.setAttributeNSs$]3 &&|Y? < |YGDDJ!%!3!3D   ! !$ ' "" 99#D){{f$$ - %rcR|jy|jj|Sr-r#)rattrnames rrxzElement.getAttributeNodes" ;; {{x((rcV|jy|jj||fSr-)rr$rBs rr}zElement.getAttributeNodeNSs) == }}  , !:;;rc|jd|fvrtjjd|j |j j |jd}||j||jj |j|jfd}|||ur|j|t||||ur|S||ur|Sy)Nzattribute node already owned) rrCrDInuseAttributeErrrlrr$rremoveAttributeNoderrr_set_attribute_node)rrrold1old2s rryzElement.setAttributeNode s   T4L 0''++,JK K !{{tyy$/    $ $T *}}  $"3"3T^^!DdK  D 0  $ $T *D$' t K t K rc|jtjj |j|}|j |y#t $rtjjwxYwr-)rrCrDrLrrr)rrrrs rremoveAttributezElement.removeAttribute"sf == ''%%' ' (;;t$D   & (''%%' ' (s A (A5c|jtjj |j||f}|j |y#t$rtjjwxYwr-)rrCrDrLrr)rrrrrs rremoveAttributeNSzElement.removeAttributeNS+sk == ''%%' ' (==, !:;D   & (''%%' ' (s A(A7c(|tjj |j|jt ||j|j|_|S#t $rtjjwxYwr-) rCrDrLrrrrNrbrjrNs rrzElement.removeAttributeNode4s{ <''%%' ' ( KK "  "//  (''%%' ' (s A))(Bc8|jy||jvS)zChecks whether the element has an attribute with the specified name. Returns True if the element has an attribute with the specified name. Otherwise, returns False. Frr?s r hasAttributezElement.hasAttributeDs ;; t{{""rc<|jy||f|jvSNF)rrBs rhasAttributeNSzElement.hasAttributeNSNs# == i(DMM99rc,t||tS)zReturns all descendant elements with the given tag name. Returns the list of all descendant elements (not direct children only) with the specified tag name. rrr?s rgetElementsByTagNamezElement.getElementsByTagNameSs /tT8:FFrc.t|||tSr-rrrBs rgetElementsByTagNameNSzElement.getElementsByTagNameNS[1 , 8:7 7rc6d|jt|fzS)Nz)rr'rs rrczElement.__repr___s)T\\2d8,DDDrc,|j|dz|jz|j}|jD]@}|jd|zt |||j |jdB|j r|jdt|j dk(r[|j djtjtjfvr"|j dj|dddnJ|j||j D]}|j|||z|||j||jd|jd|y |jd |zy ) zWrite an XML element to a file-like object Write the element to the writer object that must provide a write method (e.g. a file or StringIO object). rz %s="rrr>rrz%sN) rr_get_attributesrrrr/rr$r r`rr&)rr+r) addindentr*r a_namerUs rr&zElement.writexmlbs>  VCZ$,,./$$&jjlF LLF* + f 3 3 4 LL # ?? LL DOO$)"++(?(?0AA"++FBB? T" OODMM&&*:ItL, V$ LLdllD9 : LL 'rcd|jt|j|j|Sr-)rlrrrrs rrzElement._get_attributess% !DKK==rc|jryyrrrs r hasAttributeszElement.hasAttributess ;;rcH|j|}|j|yr-)rxsetIdAttributeNode)rridAttrs rsetIdAttributezElement.setIdAttributes &&t, 'rcJ|j||}|j|yr-)r}r)rrrrs rsetIdAttributeNSzElement.setIdAttributeNSs"((yA 'rcr||j|jstjj t |tjj |jsGd|_|xjdz c_|jxjdz c_ t|yy)NTr>) ryrrCrDrL_get_containing_entrefNoModificationAllowedErrrrrjrrN)rrs rrzElement.setIdAttributeNodes >1D1D!E''%%' ' !$ ' 3''224 4}} FM  A %    . .! 3 . D ! rrrr).rrrrr rdr$rrrrrrr`rrrBrrrlrurprbrtrvrzrrxr}rysetAttributeNodeNSrrrremoveAttributeNodeNSrrrrrcr&rrrrrr rrriris1I  HIJO**99**0033 5.=T* 2   &.") < &*'' 0#: G7E(@>(( "rrirz*NamedNodeMap of attributes on the element.z%Namespace-local name of this element.ct||j||j|j<||j|j |j f<||_yr-)rNrlrrrrrr)elementrrs rrrsQG  $GNN499<@Gd''89  Drc^eZdZdZdZdZeZdZdZ dZ dZ dZ dZ dZd Zd Zd Zy) ChildlesszMixin that makes childless-ness easy to implement and avoids the complexity of the Node methods that deal with children. r Ncyr-r rs rr7zChildless._get_firstChildrrcyr-r rs rr;zChildless._get_lastChildrrcZtjj|jdz)Nz nodes cannot have childrenrCrDrErrNs rrIzChildless.appendChild&gg)) MM9 9; ;rcyrr rs rr0zChildless.hasChildNodesrcZtjj|jdzNz nodes do not have childrenrrrRrSs rrAzChildless.insertBeforerrcZtjj|jdzr)rCrDrLrr^s rrHzChildless.removeChilds&gg!! MM9 9; ;rcyr-r rs rrezChildless.normalizes rcZtjj|jdzrrrrRrZs rr[zChildless.replaceChildrr)rrrrXrr EmptyNodeListr/rrr7r;rIr0rArHrer[r rrrrsLIJJJI;;; ;rrcreZdZejZdZdZdZdZ e ee Z dZ dZ e e e Zd dZy) ProcessingInstructiontargetrac ||_||_yr-r)rrras rrzProcessingInstruction.__init__s  rc|jSr-rars r_get_nodeValuez$ProcessingInstruction._get_nodeValuererc||_yr-rrs r_set_nodeValuez$ProcessingInstruction._set_nodeValues  rc|jSr-rrs r _get_nodeNamez#ProcessingInstruction._get_nodeNamerrc||_yr-rrs r _set_nodeNamez#ProcessingInstruction._set_nodeNames  rc d|j|d|jd|jd|y)Nz)rrrarr+r)rr*s rr&zProcessingInstruction.writexmls t{{DIItLMrNr)rrrr rr$rrrrrrrrrr&r rrrrsI//H"I 8I }5HNrrcfeZdZdZdZdZeZdZdZe eexZ Z dZ dZ dZd Zd Zd Zy ) CharacterData)_datarjrGrQrPctdx|_|_dx|_|_d|_t j |yr)rjrGrQrPrr rrs rrzCharacterData.__init__s4/33T_266t/  drc,t|jSr-)rrars rrzCharacterData._get_length499~rc|jSr-rrs r _get_datazCharacterData._get_datarrc||_yr-rrras r _set_datazCharacterData._set_datas  rc|j}t|dkDrd}nd}d|jjd|dd|dS)N z...rz)rarrbr)rra dotdotdots rrczCharacterData.__repr__ sByy t9r>II NN # #T!BZ< >.."yy) $ 2 2 ??tt'A'AA|++G4,,Wd;IIgv& rc<t|||j|yr-)rrars rr&z Text.writexmlUsF 4@Arc|jg}|j}|Y|jtjtj fvr)|j d|j|j}nn|Y|j}|X|jtjtj fvr(|j|j|j}nn|Xdj|S)Nrr) rarQr$r r`rrOrPrcjoin)rrfrGs r_get_wholeTextzText._get_wholeTextZs YYK  mzzdnnd.E.EFFAFF#%% m   mzzdnnd.E.EFF MM m wwqzrc|j}|j}|P|jtjtj fvr |j}|j ||}nn|P|j}|s|j ||P|jtjtj fvr |j}|j ||}nn|P|r ||_|Syr-) rGrQr$r r`rrHrPra)rcontentrrGrs rreplaceWholeTextzText.replaceWholeTextls  mzzdnnd.E.EFF((""1% m      t $mzzdnnd.E.EFF}}""1% m DIKrc|jjryt|}|y|jj |}|y|j Sr)rastrip_get_containing_elementrjrisElementContent)rrrs r!_get_isWhitespaceInElementContentz&Text._get_isWhitespaceInElementContentsR 99?? &t, <!!006 <((* *rr)rrrrr r`r$rrrr&rrrr rrrr?s4I~~HHJ B $8 +rrisWhitespaceInElementContentzKTrue iff this text node contains only whitespace and is in element content. wholeTextz.The text of all logically-adjacent text nodes.c||j}|.|jtjk(r|S|j}|.yr-)rGr$r rdrUrTs rrrs< A - ::** *H LL - rc||j}|.|jtjk(r|S|j}|.yr-)rGr$r rr s rrrs< A - ::33 3H LL - rc6eZdZejZdZdZddZy)Commentz#commentc<tj|||_yr-)rrrrs rrzComment.__init__st$ rc|d|jvr td|j|d|jd|y)Nz--z%'--' is not allowed in a comment nodez)rarKrrs rr&zComment.writexmls1 499 DE E  4@ArNr) rrrr rr$rrr&r rrrrs  HHBrrc4eZdZdZej ZdZddZy) CDATASectionr z#cdata-sectionc|jjddk\r td|jd|jzy)Nz]]>rz$']]>' not allowed in a CDATA sectionz)rafindrKrrs rr&zCDATASection.writexmls9 99>>% A %CD D % 12rNr) rrrrr rr$rr&r rrrrsI&&HH3rrc`eZdZdZddZdZdZdZdZdZ dZ d Z d Z d Z d Zd ZdZy)ReadOnlySequentialNamedNodeMap_seqc||_yr-r)rseqs rrz'ReadOnlySequentialNamedNodeMap.__init__s  rc,t|jSr-rrrs rrYz&ReadOnlySequentialNamedNodeMap.__len__rrc,t|jSr-rrs rrz*ReadOnlySequentialNamedNodeMap._get_lengthrrcL|jD]}|j|k(s|cSyr-)rrrFs rr@z+ReadOnlySequentialNamedNodeMap.getNamedItems!AzzT!rcl|jD]%}|j|k(s|j|k(s#|cSyr-)rrrrJs rrCz-ReadOnlySequentialNamedNodeMap.getNamedItemNSs,A~~-!++2Jrct|tr|j|}n|j|}| t ||Sr-)rr@rCr@r)r name_or_tuplerUs rr8z*ReadOnlySequentialNamedNodeMap.__getitem__sC mU +&4&& 6D$$]3D <=) ) rcL|dkry |j|S#t$rYywxYwr6)rrrs rrz#ReadOnlySequentialNamedNodeMap.items2 19 99U# #  s  ##c@tjjdNz"NamedNodeMap instance is read-onlyrCrDrr?s rrHz.ReadOnlySequentialNamedNodeMap.removeNamedItemgg.. 02 2rc@tjjdr$r%rBs rrKz0ReadOnlySequentialNamedNodeMap.removeNamedItemNSr&rc@tjjdr$r%rNs rr:z+ReadOnlySequentialNamedNodeMap.setNamedItemr&rc@tjjdr$r%rNs rrOz-ReadOnlySequentialNamedNodeMap.setNamedItemNSr&rc|jgSr-rrs rrSz+ReadOnlySequentialNamedNodeMap.__getstate__s {rc|d|_yr6rrUs rrWz+ReadOnlySequentialNamedNodeMap.__setstate__s !H rN)r )rrrrrrYrr@rCr8rrHrKr:rOrSrWr rrrrsHI  2222rrz&Number of entries in the NamedNodeMap.c&eZdZdZdZdZdZdZy) Identifiedz@Mix-in class that supports the publicId and systemId attributes.publicIdsystemIdc ||_||_yr-r.)rr/r0s r_identified_mixin_initz!Identified._identified_mixin_init s    rc|jSr-)r/rs r _get_publicIdzIdentified._get_publicId }}rc|jSr-)r0rs r _get_systemIdzIdentified._get_systemIdr5rN)rrrrXrr2r4r7r rrr-r-sJ&I!rr-cReZdZejZdZdZdZdZ dZ dZ dZ dZ ddZy) DocumentTypeNct|_t|_|rt|\}}||_|j|_yr-)rentities notationsr|rr)rr~rrs rrzDocumentType.__init__s:68 79  ( 7 FI!DI  rc|jSr-)internalSubsetrs r_get_internalSubsetz DocumentType._get_internalSubset'"""rc|jtd}|j|_|j|_tj j j}|r\g|j_ g|j_ |jjD]e}t|j|j|j}|jjj||j|||g|jjD]}t!|j|j|j|j"}|j$|_|j&|_|j(|_|jjj||j||||j||||Syr-)rjr9rrrCrDUserDataHandler NODE_CLONEDr;rr<Notationr/r0rcrEntity notationNameactualEncodingrrr)rrkclonerrGnotationeentitys rrlzDocumentType.cloneNode*sY    % &EEJ!YYEN//;;I&(#')$,,A' AJJ KHOO((//9--iHE-++A#AJJ AJJ$%NN4F,-,<,rs rr&zDocumentType.writexmlEs \" TYY == LL $--t}}F G ]] LLdDMMB C    * LL  LL,, - LL  SXrr)rrrr DOCUMENT_TYPE_NODEr$rrr/r0r>rr?rlr&r rrr9r9s:&&HI DHHN"#6 rr9cheZdZdZej ZdZdZdZ dZ dZ dZ dZ dZdZdZdZd Zy) rENcb||_||_t|_|j ||yr-)rrFrr/r2)rrr/r0rIs rrzEntity.__init__\s* $"* ##Hh7rc|jSr-rGrs r_get_actualEncodingzEntity._get_actualEncodingbr@rc|jSr-rrs r _get_encodingzEntity._get_encodinger5rc|jSr-rrrs r _get_versionzEntity._get_versionhrrc@tjjd)Nz(cannot append children to an entity noderCrDrE)rrRs rrIzEntity.appendChildksgg)) 68 8rc@tjjd)Nz+cannot insert children below an entity noder\rs rrAzEntity.insertBeforeosgg)) 9; ;rc@tjjd)Nz*cannot remove children from an entity noder\r^s rrHzEntity.removeChildssgg)) 8: :rc@tjjd)Nz)cannot replace children of an entity noder\rs rr[zEntity.replaceChildwsgg)) 79 9r)rrrrr ENTITY_NODEr$rrGrrrrrTrWrZrIrArHr[r rrrErESsNJHINHG8 #8;:9rrEc.eZdZejZdZdZy)rDNc6||_|j||yr-)rr2)rrr/r0s rrzNotation.__init__s  ##Hh7r)rrrr rr$rrr rrrDrD{s!!HI8rrDc2eZdZgdZdZdZdZdZdZy)DOMImplementation))core1.0)re2.0)reN)rCrf)rCrg)rCN)ls-loadz3.0)rhNcL|dk(rd}|j|f|jvSr)lower _featuresrps rrozDOMImplementation.hasFeatures( b=G )T^^;;rcH|r+|jtjjd|j }|duxr |duxr|du }|s!|rtjj d|rt |\}}|dk(r$|dk7rtjjd|r!|stjjd|j||}|r|j||j||r|x|_|_ ||_ ||_ |S)Nz(doctype object owned by another DOM treezElement with no namerCz$http://www.w3.org/XML/1998/namespacezillegal use of 'xml' prefixz(illegal use of prefix without namespaces) rGrCrDWrongDocumentErr_create_documentInvalidCharacterErrr|rcreateElementNSrIrjdoctypern) rrr~rqradd_root_elementrrrs rcreateDocumentz DOMImplementation.createDocuments. w))5''**:< <##% , 4!4$1T$9!4$+tO5!1''--.DE E  ( 7 FI#IIgg**+HIIlgg**>@@)), FG( OOG $ 9< x7"   8 +#'D  (''%%' ' (s A (A1ch|jD]#}|jtjk(s!|cSyr-)r/r$r rdrNs rrzDocument._get_documentElementds'OOD}} 1 11 $rc|j!|jjd|_tj|yr-)rqrbr rs rrbzDocument.unlinkis/ << # LL   !DL Drc|sy|jjddd}|j|_|j|_|j|_|j D]s}t |||}|j j||jtjk(rn$|jtjk(r||_ ||_ u|jtj j"j$|||Sr-)rnrsrrrrr/rircr$r r%rOrqrGrrCrDrBrC)rrkrHrG childclones rrlzDocument.cloneNodeos##224tD??  A$Qe4J    # #J /""d&8&88$$(?(?? * $)J !! $$SWW%<%<%H%H%)5 2 rc(t}||_|Sr-)rrj)rrs rcreateDocumentFragmentzDocument.createDocumentFragments  rc*t|}||_|Sr-)rirj)rrrJs r createElementzDocument.createElements G rclt|ts tdt}||_||_|SNznode contents must be a string)rrr;rrarj)rrats rcreateTextNodezDocument.createTextNodes2$$<= = Frclt|ts tdt}||_||_|Sr)rrr;rrarjrrarTs rcreateCDATASectionzDocument.createCDATASections2$$<= = Nrc*t|}||_|Sr-)rrjrs r createCommentzDocument.createComments DMrc,t||}||_|Sr-)rrj)rrraps rcreateProcessingInstructionz$Document.createProcessingInstructions !&$ /rc8t|}||_d|_|Sr)rrjr)rras rcreateAttributezDocument.createAttributes KrcJt|\}}t|||}||_|Sr-)r|rirj)rrr~rrrJs rrpzDocument.createElementNSs+$]3 M< 8rcZt|\}}t||||}||_d|_|Sr)r|rrjr)rrr~rrrs rcreateAttributeNSzDocument.createAttributeNSs4$]3  i @rc0t||||}||_|Sr-)rErj)rrr/r0rFrJs r_create_entityzDocument._create_entitys 48\ :rc.t|||}||_|Sr-)rDrj)rrr/r0rGs r_create_notationzDocument._create_notations T8X .rc||jvr|j|S|js |jsy|j}||jg}||_n|syd}|r|j }|j |jDcgc]}|jtvr|c}|j|}|r.|jjD]}|jrb|j|j|js7||j|j <|j |k(r|}b|j"ron|j%|j&r:||j|j <|j |k(r|}|j"rn|j(s||j|j <|j |k(r|}|j"dk(snenc|j"rW|jjD]:}|j(s||j|j <|j |k(s9|}<| |S|r|Scc}w)Nr>)rrrrrpopextendr/r$rMrrrrrrrrrrr)rr'stackresultrUrgrrrs rgetElementByIdzDocument.getElementByIds  >>"% %4#7#7%% =))*E$)D !99;D LLT__I_E"^^/GG _I J&&t,D!OO224D((;;t'8'8$..I9=DNN4::6#zzR/)-%)%9%9 %499-59tzz2::+%)F!%!5!5!59tzz2::+%)F!11Q6!'5(%% OO224D{{59tzz2::+%)F 5 ! ON IIs Ic,t||tSr-rr?s rrzDocument.getElementsByTagNames.tT8:FFrc.t|||tSr-rrBs rrzDocument.getElementsByTagNameNSrrc:|jj||Sr-)rnrorps rrszDocument.isSupported s""--gw??rc |jtjk(rtjj d|jtj k(rtjj dt|||S)Nzcannot import document nodesz!cannot import document type nodes)r$r r%rCrDNotSupportedErrrOri)rrUrks r importNodezDocument.importNode sa ==D.. .''))*HI I ]]d55 5''))*MN N4t,,rcg}|r|jd|d||jd|rdndd|jddj|d||jD]}|j ||||y) Nz encoding="rz standalone="yesnozrzillegal use of 'xmlns' prefixz$illegal use of the 'xmlns' attribute)rjrCrDrmr$r rdrrrrrrrrrrrrrrrryr)rrGrrrrris_ids r renameNodezDocument.renameNode#s ??$ &''**,0!//CD D ::d//1D1DE E''))JL L ? *d{$(JJsA$6! '&#''*A*AA''..799go&#''*A*AA**(;(;;''..>@@ FI ::,, ,nnG"++A.G  % ::** *AIAF"((+..q1 r)rrrNN)=rrrrr rdrrrOrBrdrnr%r$rrrrGrQrPrGrrrrrrrrrrrTrrrWrrrrZrIrHrrbrlrrrrrrrrprrrrrrrsrr&rr rrrxrxsE@I**D,L,L**D,C,CE'(N!!HHIJJ$((Ok NHJGLKO%(# !(,   *        8tG7@-KO  ; 3rrxrz#Top-level element of this document.c |jj|r%tjjj }n$tjjj }|jtjk(r|j|j|j}|jjD]j}|j|j|j|j |j#|j|j$}|j&|_l|r|j(D] }t+|||}|j-|"n|jtj.k(rD|j1}|r|j(D] }t+|||}|j-|"n|jtj2k(r|j5|j6}nM|jtj8k(r|j;|j6}n|jtj<k(r(|j?|j@|j6}n|jtjBk(r|jE|j6}n|jtjFk(r@|jI|j|j}d|_|j |_n7|jtjJk(rtjjj }|jLjO|jP|jR|jT}||_|rg|jV_,g|jZ_,|jZjXD]y} t]| j| jR| jT} || _|jZjXj_| ta| dsg| jc|| | {|jVjXD]} te| j| jR| jT| jf} | jh| _4| jj| _5| jl| _6|| _|jVjXj_| ta| ds| jc|| | n+tjjodtq|zta|dr|jc||||S)zo Clone a node and give it the new owner document. Called by Node.cloneNode and Document.importNode TrzCannot clone node %s)9rjryrCrDrBrC NODE_IMPORTEDr$r rdrprrrrrrr}rrr/rirIr?rr`rrarrrrrrrrrrOrnrurr/r0r;rr<rDrcrrrErFrGrrrrrF) rUrknewOwnerDocumentrrHrrrrgrTrGrIrJrKs rriri\s  $$%56GG++77 GG++99  }}))) 001B1B15@OO**,D  !2!2DMM4:: N(():):DNNKA..AK- t-=>!!!$) $55 5 779 t-=>!!!$) $.. ( // : $11 1 33DII> $:: : <r)rr)r~fieldss rr|r|s4  a (F 6{a fQi  rc~||i|}|j\}}|j||j|Sr-)getEvent expandNoder)funcargskwargseventstoktyperootNodes r_do_pulldom_parsers> 4 "6 "F)GX h LLN Orcz||sddlm}|j|Sddlm}t |j|f||dS)z3Parse a file into a DOM by filename or file object.r expatbuilderpulldom)parserbufsize)xml.domrparserr)filerrrrs rrrs? ~g(!!$''# ' 24 4rct|ddlm}|j|Sddlm}t |j|fd|iS)z&Parse a file into a DOM from a string.rrrr)rr parseStringrr)stringrrrs rrrs? ~(''//# !4!4vi"*F!35 5rc|rQt|trtj|}|D]'\}}tj j ||r'ytj Sr-)rrr_parse_feature_stringrxrnro)featuresfvs rgetDOMImplementationrsT h $33H=HDAq**55a;  " ""rrr-)6rXr rrCrrrrxml.dom.minicompatxml.dom.xmlbuilderrr rDr rdrrM defpropertyrXrrrrrobjectr AttributeListr\rrirrrrrrrrrrr-r9rErDrdrzrNrxrir|rrrrr rrrs" JJ > GGLL55GGLL>>@t377<<tl D,$@A D+$?@ D+$HI%t%$z84z8x D&$FG D+$MN D,$EFa?6a?F L(68 v( D$ M"dM"^ G\<> G[79  &;&;RNItN4ECItECN M8)EFS+=S+j D0./ D+@B Bm B 34 3<V<| *H8:  ::y$:x&9Z&9P8z9d8M+M^(&(T2QtZQf  H'57Od!45#rPK]Ɔ77__init__.cpython-312.opt-1.pycnu[ ֦iUp8ddlZddlZddlZddlZddlZddlZddlZddlZddlZddl Z ddl Z ddl Z ddl Z ddl Z ddlZddlZddlZddlmZmZddlmZmZddlmZmZddlmZmZddlmZmZddlmZdd l m!Z!dd l"m#Z#dd l m$Z$dd l%m&Z&m'Z'm(Z(m)Z)gd Z*Gdde+Z,GddZ-GddZ.Gdde.Z/Gdde0Z1GddejdZ3GddZ4GddZ5Gdde5Z6Gd d!e#Z7Gd"d#Z8Gd$d%Z9Gd&d'Z:Gd(d)e7Z;Gd*d+e6Zd.ej:fd/Z?d0Z@e jeejd12ZC d.e1fd3ZDd4ZEd5ZFd.e'eGe&eGffd6ZHd7ZId8ZJy)9N) _adapters_meta)FreezableDefaultDictPair) method_cache pass_none)always_iterableunique_everseen)PackageMetadata SimplePath)suppress) import_module)MetaPathFinder)starmap)ListMappingOptionalcast) DistributionDistributionFinderr PackageNotFoundError distribution distributions entry_pointsfilesmetadatapackages_distributionsrequiresversionc&eZdZdZdZedZy)rzThe package was not found.c d|jS)Nz"No package metadata was found for nameselfs 4/usr/lib64/python3.12/importlib/metadata/__init__.py__str__zPackageNotFoundError.__str__3s3DII;??c"|j\}|SN)argsr&r$s r'r$zPackageNotFoundError.name6s)) r)N)__name__ __module__ __qualname____doc__r(propertyr$r)r'rr0s$@r)rceZdZdZej dj ZedZ e ddZ e dZ y) Sectioneda A simple entry point config parser for performance >>> for item in Sectioned.read(Sectioned._sample): ... print(item) Pair(name='sec1', value='# comments ignored') Pair(name='sec1', value='a = 1') Pair(name='sec1', value='b = 2') Pair(name='sec2', value='a = 2') >>> res = Sectioned.section_pairs(Sectioned._sample) >>> item = next(res) >>> item.name 'sec1' >>> item.value Pair(name='a', value='1') >>> item = next(res) >>> item.value Pair(name='b', value='2') >>> item = next(res) >>> item.name 'sec2' >>> item.value Pair(name='a', value='2') >>> list(res) [] zm [sec1] # comments ignored a = 1 b = 2 [sec2] a = 2 cJd|j||jDS)Nc3K|]?}|j1|jtj|jAyw)N)value)r$_replacerparser8).0sections r' z*Sectioned.section_pairs..gs= <||'   4::gmm#<  =linesr$r8 section_matchs r'r?zSectioned.readmsrwCIIt/@ ABE!,,S1IennS6IM{{4(tU# # sBBc.|xr|jd S)N#)rL)lines r'r@zSectioned.validxs0DOOC000r)r+) r.r/r0r1textwrapdedentlstrip_sample classmethodrC staticmethodr?r@r3r)r'r5r5<sf8hoo   fh   $$11r)r5cVeZdZdZej ejdedZ dZ y)DeprecatedTuplea Provide subscript item access for backward compatibility. >>> recwarn = getfixture('recwarn') >>> ep = EntryPoint(name='name', value='value', group='group') >>> ep[:] ('name', 'value', 'group') >>> ep[0] 'name' >>> len(recwarn) 1 zAEntryPoint tuple interface is deprecated. Access members by name. stacklevelcH|j|j|Sr+)_warn_key)r&items r' __getitem__zDeprecatedTuple.__getitem__s yy{4  r)N) r.r/r0r1 functoolspartialwarningswarnDeprecationWarningr_rbr3r)r'rZrZ}s0  I   K  E!r)rZceZdZUdZej dZ eed<eed<eed<dZ e ded<d Z d Z e d Ze d Ze d ZdZdZdZdZdZdZdZdZy) EntryPointaAn entry point as defined by Python packaging conventions. See `the packaging docs on entry points `_ for more information. >>> ep = EntryPoint( ... name=None, group=None, value='package.module:attr [extra1, extra2]') >>> ep.module 'package.module' >>> ep.attr 'attr' >>> ep.extras ['extra1', 'extra2'] zH(?P[\w.]+)\s*(:\s*(?P[\w.]+)\s*)?((?P\[.*\])\s*)?$r$r8groupNrdistc>t|j|||y)Nr$r8rjvarsupdate)r&r$r8rjs r'__init__zEntryPoint.__init__s T t5>r)c|jj|j}t|j d}t d|j dxsdj d}tjt||S)zLoad the entry point from its definition. If only a module is indicated by the value, return that module. Otherwise, return the named object. moduleNattr.) patternmatchr8rrjrGsplitrcreducegetattr)r&rxrsattrss r'loadzEntryPoint.loadsi  ""4::.u{{845tekk&17R>>sCD77r)cn|jj|j}|jdS)Nrsrwrxr8rjr&rxs r'rszEntryPoint.modules) ""4::.{{8$$r)cn|jj|j}|jdS)Nrtrrs r'rtzEntryPoint.attrs) ""4::.{{6""r)c|jj|j}tjd|j dxsdS)Nz\w+extrasru)rwrxr8refindallrjrs r'rzEntryPoint.extrass9 ""4::.zz&%++h"7"=2>>r)c<t|j||S)Nrkrn)r&rks r'_forzEntryPoint._fors T t$ r)c ~fd|D}tttj|j |S)a$ EntryPoint matches the given parameters. >>> ep = EntryPoint(group='foo', name='bar', value='bing:bong [extra1, extra2]') >>> ep.matches(group='foo') True >>> ep.matches(name='bar', value='bing:bong [extra1, extra2]') True >>> ep.matches(group='foo', name='other') False >>> ep.matches() True >>> ep.matches(extras=['extra1', 'extra2']) True >>> ep.matches(module='bing') True >>> ep.matches(attr='bong') True c36K|]}t|ywr+r{)r;paramr&s r'r=z%EntryPoint.matches..s:6%u%6s)allrHoperatoreqvalues)r&paramsr|s` r'matcheszEntryPoint.matchess-(;6:3x{{FMMOU;<BZZN! % r)c4t|jSr+)hashr`r%s r'__hash__zEntryPoint.__hash__ sDIIK  r))r.r/r0r1rcompilerwrI__annotations__rkrrqr}r2rsrtrrrr`rrrrrr3r)r'riris bjj %G  I J J%)D(> ")?8%%##??=.1*+B !r)ric`eZdZdZdZdZdZedZedZ e dZ e dZ y ) EntryPointszC An immutable collection of selectable EntryPoint objects. r3c| tt|j|S#t$r t |wxYw)z; Get the EntryPoint in self matching name. r#)nextiterselect StopIterationKeyErrorr-s r'rbzEntryPoints.__getitem__s; !T[[d[345 5 !4.  !s#&;c ,tfd|DS)zv Select entry points from self that match the given parameters (typically group and/or name). c3HK|]}|jdis|yw)Nr3)r)r;eprs r'r=z%EntryPoints.select..&s"E"  0DV0D2s"")r)r&rs `r'rzEntryPoints.select!s EEEEr)c@|Dchc]}|jc}Scc}w)zB Return the set of all names of all entry points. r#r&rs r'nameszEntryPoints.names(s #''$B$'''c@|Dchc]}|jc}Scc}w)zC Return the set of all groups of all entry points. )rjrs r'groupszEntryPoints.groups/s $((4R4(((rcD|fd|j|DS)Nc3@K|]}|jywr+)r)r;rrks r'r=z-EntryPoints._from_text_for..8s@+?R2774=+?) _from_text)rArBrks `r'_from_text_forzEntryPoints._from_text_for6s@3>>$+?@@@r)cBdtj|xsdDS)Nc3K|]D}t|jj|jj|jFyw)rmN)rir8r$)r;ras r'r=z)EntryPoints._from_text..<s: ; DJJOO4::3C3C499 U U;sA A ru)r5rC)rBs r'rzEntryPoints._from_text:s# !// ;  r)N)r.r/r0r1 __slots__rbrr2rrrWrrXrr3r)r'rrskI!F(( )) AA  r)rc$eZdZdZddZdZdZy) PackagePathz"A reference to a path in a packagec|jj|5}|jcdddS#1swYyxYw)Nencodinglocateopenr?)r&rstreams r' read_textzPackagePath.read_textEs0 [[]    2f;;=3 2 2s ;Ac|jjd5}|jcdddS#1swYyxYw)Nrbr)r&rs r' read_binaryzPackagePath.read_binaryIs- [[]   %;;=& % %s :Ac8|jj|S)z'Return a path-like object for this path)rk locate_filer%s r'rzPackagePath.locateMsyy$$T**r)N)utf-8)r.r/r0r1rrrr3r)r'rrBs,!!+r)rceZdZdZdZy)FileHashcB|jd\|_}|_y)N=) partitionmoder8)r&spec_s r'rqzFileHash.__init__Ss#'>>##6  1djr)c<d|jd|jdS)Nz)rr8r%s r'rzFileHash.__repr__Vs!$))HTZZLBBr)N)r.r/r0rqrr3r)r'rrRs 7Cr)rceZdZfdZxZS)DeprecatedNonAbstractc .tj|Dchc]}t|D]}|}}}|Dchc]}tt||ddr|}}|rt j d|t dt|!|Scc}}wcc}w)N__isabstractmethod__FzUnimplemented abstract methods r[r\) inspectgetmroror{rerfrgsuper__new__)rAr,kwargssubclassr$ all_namesabstract __class__s r'rzDeprecatedNonAbstract.__new__[s!(!4 !4XhDD!4  " !wsD)+A5I !   MM1(<"  ws##  s B  B)r.r/r0r __classcell__rs@r'rrZs $$r)rcreZdZdZej deefdZej dZ e defdZ e dZ e dZe d Zedej$fd Zed Zed Zed ZedZedZdZdZdZedZdZdZe dZe dZ y)rzA Python distribution package.returncy)zAttempt to load metadata file given by the name. :param filename: The name of the file in the distribution info. :return: The text if found, otherwise None. Nr3r&filenames r'rzDistribution.read_textpr)cy)z[ Given a path to a file in this distribution, return a path to it. Nr3r&paths r'rzDistribution.locate_filexrr)r$c|s td t|j|S#t$r t |wxYw)aReturn the Distribution for the given package name. :param name: The name of the distribution package to search for. :return: The Distribution instance (or subclass thereof) for the named package, if found. :raises PackageNotFoundError: When the named package's distribution metadata cannot be found. :raises ValueError: When an invalid value is supplied for name. z A distribution name is required.r#) ValueErrorrdiscoverrr)rAr$s r' from_namezDistribution.from_namesH?@ @ - $ /0 0 -&t, , -s*?c |jddr |r tdxstjdi|tj j fd|jDS)aReturn an iterable of Distribution objects for all packages. Pass a ``context`` or pass keyword arguments for constructing a context. :context: A ``DistributionFinder.Context`` object. :return: Iterable of Distribution objects for all packages. contextNz cannot accept context and kwargsc3.K|] }|ywr+r3)r;resolverrs r'r=z(Distribution.discover..s- .G(HW .Gsr3)poprrContext itertoolschain from_iterable_discover_resolvers)rArrs @r'rzDistribution.discoversl**Y- v?@ @A/77A&A,,- .1.E.E.G-   r)c>ttj|S)zReturn a Distribution for the indicated metadata path :param path: a string or path-like object :return: a concrete Distribution instance for the path )PathDistributionpathlibPathrs r'atzDistribution.ats  T 233r)cHdtjD}td|S)z#Search the meta_path for resolvers.c36K|]}t|ddyw)find_distributionsNr)r;finders r'r=z3Distribution._discover_resolvers..s FSFGF0$ 7msN)sys meta_pathrG)declareds r'rz Distribution._discover_resolverss$ FImm dH%%r)c|jdxs$|jdxs|jd}tt|}tjt j |S)zReturn the parsed metadata for this Distribution. The returned object will have keys that name the various bits of metadata. See PEP 566 for details. METADATAzPKG-INFOru)rrrIrMessageemailmessage_from_string)r&opt_textrBs r'rzDistribution.metadatasc NN: & "~~j) " ~~b! C"  !:!:4!@AAr)c |jdS)z8Return the 'Name' metadata for the distribution package.Namerr%s r'r$zDistribution.names}}V$$r)c@tj|jS)z(Return a normalized version of the name.)Prepared normalizer$r%s r'_normalized_namezDistribution._normalized_names!!$)),,r)c |jdS)z;Return the 'Version' metadata for the distribution package.Versionrr%s r'r zDistribution.versions}}Y''r)cLtj|jd|S)Nzentry_points.txt)rrrr%s r'rzDistribution.entry_pointss))$..9K*LdSSr)cdfd tfd}td}||jxs"jxsjS)aZFiles in this distribution. :return: List of PackagePath for this distribution or None Result is `None` if the metadata file that enumerates files (i.e. RECORD for dist-info, or installed-files.txt or SOURCES.txt for egg-info) is missing. Result may be empty if the metadata exists but is empty. c|t|}|r t|nd|_|r t|nd|_|_|Sr+)rrrintsizerk)r$rsize_strresultr&s r' make_filez%Distribution.files..make_files7 &F,0(4.dFK+3#h-FKFKMr)cBttj|Sr+)rcsvreader)rNr"s r' make_filesz&Distribution.files..make_filess9cjj&78 8r)c.ttd|S)Nc>|jjSr+)rexistsrs r'z@Distribution.files..skip_missing_files..sDKKM,@,@,Br))listrG) package_pathss r'skip_missing_filesz.Distribution.files..skip_missing_filessBMRS Sr))NN)r _read_files_distinfo_read_files_egginfo_installed_read_files_egginfo_sources)r&r&r-r"s` @r'rzDistribution.filessw   9  9  T  T" ))+65576335   r)cL|jd}|xr|jS)z* Read the lines of RECORD RECORD)rrKr&rBs r'r.z!Distribution._read_files_distinfos$~~h')))r)cjd}tdd|rsyfd|jD}tdj|S)a Read installed-files.txt and return lines in a similar CSV-parsable format as RECORD: each file must be placed relative to the site-packages directory and must also be quoted (since file names can contain literal commas). This file is written when the package is installed by pip, but it might not be written for other installation methods. Assume the file is accurate if it exists. zinstalled-files.txt_pathNc3K|]S}|z jjjdjdjUyw)ruT)walk_upN)resolve relative_toras_posix)r;r$r&subdirs r'r=z=Distribution._read_files_egginfo_installed..sV * d] WY [))"-557[ F XZ *sAA"{}")rr{rKrHformat)r&rBpathsr;s` @r'r/z*Distribution._read_files_egginfo_installedsW~~34w-6  )  6==%((r)ct|jd}|xr$tdj|jS)a Read SOURCES.txt and return lines in a similar CSV-parsable format as RECORD: each file name must be quoted (since it might contain literal commas). Note that SOURCES.txt is not a reliable source for what files are installed by a package. This file is generated for a source archive, and the files that are present there (e.g. setup.py) may not correctly reflect the files that are present after the package has been installed. z SOURCES.txtr<)rrHr=rKr3s r'r0z(Distribution._read_files_egginfo_sourcess/~~m,=FMM4??+<==r)cd|jxs|j}|xr t|S)z6Generated requirements specified for this Distribution)_read_dist_info_reqs_read_egg_info_reqsr+)r&reqss r'rzDistribution.requires.s/((*Hd.F.F.H"T "r)c8|jjdS)Nz Requires-Dist)rget_allr%s r'rAz!Distribution._read_dist_info_reqs4s}}$$_55r)cZ|jd}t|j|S)Nz requires.txt)rr _deps_from_requires_text)r&sources r'rBz Distribution._read_egg_info_reqs7s(/7y667??r)cJ|jtj|Sr+)%_convert_egg_info_reqs_to_simple_reqsr5r?)rArHs r'rGz%Distribution._deps_from_requires_text;s889OPPr)c#Kdfd}d}|D]8}||j}|j|z||jz:yw)a Historically, setuptools would solicit and store 'extra' requirements, including those with environment markers, in separate sections. More modern tools expect each dependency to be defined separately, with any relevant extras and environment markers attached directly to that requirement. This method converts the former to the latter. See _test_deps_from_requires_text for an example. c|xrd|dS)Nz extra == ""r3r#s r'make_conditionzJDistribution._convert_egg_info_reqs_to_simple_reqs..make_conditionKs0ja0 0r)c |xsd}|jd\}}}|r|rd|d}ttd||g}|rddj|zSdS)Nru:(rz; z and )rr+rGjoin)r<extrasepmarkers conditionsrNs r' quoted_markerzIDistribution._convert_egg_info_reqs_to_simple_reqs..quoted_markerNskmG")"3"3C"8 E3gYa.fTG^E5J+KLMJ6@4',,z22 Hb Hr)cdd|vzS)z PEP 508 requires a space between the url_spec and the quoted_marker. Ref python/importlib_metadata#357.  @r3)reqs r' url_req_spacezIDistribution._convert_egg_info_reqs_to_simple_reqs..url_req_spaceVs #*% %r)N)r8r$)sectionsrWr\r<spacerNs @r'rJz2Distribution._convert_egg_info_reqs_to_simple_reqs?sN 1 I & G!'--0E--%'- *EE E sA A N)!r.r/r0r1abcabstractmethodrrIrrrWrrrXrrr2rr rr$rr rrr.r/r0rrArBrGrJr3r)r'rrms~( Xc]     -S--"  "44&&B%//BB"%%--((TT    D*)8 >## 6@QQ F Fr)rcVeZdZdZGddZej efdZy)rzJ A MetaPathFinder capable of discovering installed distributions. c,eZdZdZdZ dZedZy)DistributionFinder.Contextaw Keyword arguments presented by the caller to ``distributions()`` or ``Distribution.discover()`` to narrow the scope of a search for distributions in all DistributionFinders. Each DistributionFinder may expect any parameters and should attempt to honor the canonical parameters defined below when appropriate. Nc 8t|j|yr+rn)r&rs r'rqz#DistributionFinder.Context.__init__zs J  f %r)cTt|jdtjS)z The sequence of directory path that a distribution finder should search. Typically refers to Python installed package paths such as "site-packages" directories and defaults to ``sys.path``. r)rogetr rr%s r'rzDistributionFinder.Context.path}s:>>&#((3 3r))r.r/r0r1r$rqr2rr3r)r'rrchs,   &  4  4r)rcy)z Find distributions. Return an iterable of all Distribution instances capable of loading the metadata for packages matching the ``context``, a DistributionFinder.Context instance. Nr3)r&rs r'rz%DistributionFinder.find_distributionsrr)N)r.r/r0r1rr_r`rr3r)r'rrcs144@ )0  r)rceZdZdZej fdZdZdZdZ dZ dZ e dZ ed ZxZS) FastPathzs Micro-optimized class for searching a path for children. >>> FastPath('').children() ['...'] c"t||Sr+)rr)rArootrs r'rzFastPath.__new__sws##r)c||_yr+)rk)r&rks r'rqzFastPath.__init__s  r)cBtj|j|Sr+)rrrk)r&childs r'joinpathzFastPath.joinpaths||DIIu--r)ctt5tj|jxsdcdddS#1swYnxYwtt5|j cdddS#1swYgSxYwNrv)r Exceptionoslistdirrk zip_childrenr%s r'childrenzFastPath.childrensP i ::dii.3/! i $$&!  s#=AA22A<ctj|j}|jj}|j|_t j d|DS)Nc3bK|]'}|jtjdd)yw)rrN)ry posixpathrT)r;rns r'r=z(FastPath.zip_children..s%Q5%U[[:1=5s-/)zipfilerrknamelistrodictfromkeys)r&zip_pathrs r'ruzFastPath.zip_childrensH<< * &&( )) }}Q5QQQr)cV|j|jj|Sr+)lookupmtimesearchr-s r'rzFastPath.searchs {{4::&--d33r)ctt5tj|jj cdddS#1swYnxYw|j jyr+)rOSErrorrsstatrkst_mtimer cache_clearr%s r'rzFastPath.mtimes< g 77499%..   !s )AA ct|Sr+)Lookup)r&rs r'rzFastPath.lookups d|r))r.r/r0r1rc lru_cacherrqrorvrurr2rrrrrs@r'ririsiY$$.R4"" r)riceZdZdefdZdZy)rrcltjj|jj }|j d}t t|_t t|_ |jD]}|j }|j dri|jddjdd}tj|}|j|j|j!||s|dk(s|jddjdd}tj#|}|j|j|j!||jj%|jj%y)Nz.eggz .dist-infoz .egg-inforvr-zegg-info)rsrbasenamerklowerrMrr+infoseggsrv rpartitionrrrappendrolegacy_normalizefreeze) r&rbase base_is_eggrnlowr$ normalizedlegacy_normalizeds r'rqzLookup.__init__sEww *002mmF+ )$/ (. ]]_E++-C||78~~c*1-77.s- .BdDKK !.Br)rrrrrHri)rAr$r>rs @r'rz MetadataPathFinder._search_pathss9D>,,- .1(E.B-   r)c@tjjyr+)rirr)rAs r'invalidate_cachesz$MetadataPathFinder.invalidate_cachess$$&r)N) r.r/r0rWrrrrrr3r)r'rrsH(:(B(B(D , ,  ''r)rceZdZdefdZdZej je_dZe fdZ e dZ xZ S)rrc||_y)zfConstruct a distribution. :param path: SimplePath indicating the metadata directory. N)r5rs r'rqzPathDistribution.__init__$s  r)ctttttt 5|j j|jdcdddS#1swYyxYw)Nrr) rFileNotFoundErrorIsADirectoryErrorrNotADirectoryErrorPermissionErrorr5rorrs r'rzPathDistribution.read_text+sK        ::&&x0::G:L   s +AA"c4|jj|z Sr+)r5parentrs r'rzPathDistribution.locate_file7szz  4''r)ctjjt|j}t t j|j|xs t|(S)zz Performance optimization: where possible, resolve the normalized name from the file system path. ) rsrrrIr5r rr_name_from_stemrr)r&stemrs r'rz!PathDistribution._normalized_name:sS wwDJJ0 )Ih(( )$*>*>t*D E (w' r)c~tjj|\}}|dvry|jd\}}}|S)a7 >>> PathDistribution._name_from_stem('foo-3.0.egg-info') 'foo' >>> PathDistribution._name_from_stem('CherryPy-3.0.dist-info') 'CherryPy' >>> PathDistribution._name_from_stem('face.egg-info') 'face' >>> PathDistribution._name_from_stem('foo.bar') rNr)rsrsplitextr)rrextr$rTrests r'rz PathDistribution._name_from_stemFsC((. # 1 1 ",,S1c4 r))r.r/r0r rqrrr1rr2rrXrrrs@r'rr#sXZM%..66I(    r)rc,tj|S)zGet the ``Distribution`` instance for the named package. :param distribution_name: The name of the distribution package as a string. :return: A ``Distribution`` instance (or subclass thereof). )rrdistribution_names r'rrXs  ! !"3 44r)c ,tjdi|S)z|Get all ``Distribution`` instances in the current environment. :return: An iterable of ``Distribution`` instances. r3)rr)rs r'rras  *6 **r)rc@tj|jS)zGet the metadata for the named package. :param distribution_name: The name of the distribution package to query. :return: A PackageMetadata containing the parsed metadata. )rrrrs r'rris  ! !"3 4 = ==r)c,t|jS)zGet the version string for the named package. :param distribution_name: The name of the distribution package to query. :return: The version string for the package as defined in the package's "Version" metadata key. )rr rs r'r r rs ) * 2 22r)r)keyc tjjdtt D}t |j di|S)aReturn EntryPoint objects for all installed packages. Pass selection parameters (group or name) to filter the result to entry points matching those properties (see EntryPoints.select()). :return: EntryPoints for all installed packages. c34K|]}|jywr+)r)r;rks r'r=zentry_points..s(&>d&>sr3)rrr_uniquerrr)repss r'rrsI // ' '(&-mo&>( C #;s  " " ,V ,,r)c,t|jS)zReturn a list of files for the named package. :param distribution_name: The name of the distribution package to query. :return: List of files composing the distribution. )rrrs r'rrs ) * 0 00r)c,t|jS)z Return a list of requirements for the named package. :return: An iterator of requirements, suitable for packaging.requirement.Requirement. )rrrs r'rrs ) * 3 33r)ctjt}tD]@}t |xs t |D]#}||j |jd%Bt|S)z Return a mapping of top-level packages to their distributions. >>> import collections.abc >>> pkgs = packages_distributions() >>> all(isinstance(dist, collections.abc.Sequence) for dist in pkgs.values()) True r) collections defaultdictr+r_top_level_declared_top_level_inferredrrr|) pkg_to_distrkpkgs r'rrsg))$/K&t,I0CD0IIC   # #DMM&$9 :J   r)cH|jdxsdjS)Nz top_level.txtru)rryrs r'rrs NN? + 1r 8 8 ::r)ct|jDchc]>}t|jdkDr|jdnt j |@}}t d}t||Scc}w)Nrrc d|vSrqr3r#s r'importable_namez,_top_level_inferred..importable_names $r))r rlenpartsr getmodulenamer rG)rkf opt_namesrs r'rrs|!,,A!''lQ& G,A,A!,DD,  /9 --sAA5)Krsrr_r$r rrrzrrSrercrry contextlibrrrurr _collectionsrr _functoolsrr _itertoolsr r r r r importlibr importlib.abcrrtypingrrrr__all__ModuleNotFoundErrorrr5rZritupler PurePosixPathrrrrrrirrrrrrrr rd attrgetterrrrrrIrrrr3r)r'rs 4/8.#(00  . >1>1B!!6v!v!r. %. b +''' + CC$$&sF(sFl- - `,,^!,!,HD'+'62|2j5+>5#8#8>3 )  ./  -k -14T#Y 7"; .r)PK]$-~AAxmlbuilder.cpython-312.pycnu[ ֦i0dZddlZddlZddlmZgdZGddZGddZd Z Gd d e Z Gd d e Z GddZ [GddZGddZy)z4Implementation of the DOM Level 3 'LS-Load' feature.N) NodeFilter) DOMBuilderDOMEntityResolverDOMInputSourcec\eZdZdZdZdZdZdZdZdZ dZ dZ dZ dZ dZdZdZdZdZdZdZdZdZy)OptionszFeatures object that has variables set for each DOMBuilder feature. The DOMBuilder class uses an instance of this class to pass settings to the ExpatBuilder class. TFN)__name__ __module__ __qualname____doc__ namespacesnamespace_declarations validationexternal_parameter_entitiesexternal_general_entitiesexternal_dtd_subsetvalidate_if_schemavalidatedatatype_normalizationcreate_entity_ref_nodesentitieswhitespace_in_element_contentcdata_sectionscommentscharset_overrides_xml_encodinginfosetsupported_mediatypes_only errorHandlerfilter+/usr/lib64/python3.12/xml/dom/xmlbuilder.pyrr srJ!J"& $H""H$(!NH%)"G %L Fr"rc BeZdZdZdZdZdZdZdZdZ eeee fZ dZ dZ dZ d Zd Zd Zd Zd ZdZdZiddgddgddgddgddgddgddgddgddgddgdddgddgddgddgddgddgd d gd!gd"gd#gggd$d%gd&gd'gd(Zd)Zd*Zd+Zd,Zd-Zy).rNr c"t|_yN)r_optionsselfs r#__init__zDOMBuilder.__init__9s   r"c|jSr)entityResolverr+s r#_get_entityResolverzDOMBuilder._get_entityResolver<s"""r"c||_yr)r/)r,r0s r#_set_entityResolverzDOMBuilder._set_entityResolver>s ,r"c|jSr)rr+s r#_get_errorHandlerzDOMBuilder._get_errorHandlerAs   r"c||_yr)r5)r,rs r#_set_errorHandlerzDOMBuilder._set_errorHandlerCs (r"c|jSr)r r+s r# _get_filterzDOMBuilder._get_filterFs {{r"c||_yr)r:)r,r s r# _set_filterzDOMBuilder._set_filterHs  r"ch|j|rG|xrdxsd} |jt||f}|D]\}}t|j||yt jjdt|z#t $r$t jjd|dwxYw)Nr rzunsupported feature: zunknown feature: ) supportsFeature _settings _name_xformsetattrr*KeyErrorxmldomNotSupportedErr NotFoundErrrepr)r,namestatesettingsvalues r# setFeaturezDOMBuilder.setFeatureKs    %Ka$1E 8>>;t+BC Cs B-B1c@t|jt|Sr))hasattrr*rA)r,rIs r#r?zDOMBuilder.supportsFeatureYst}}k$&788r"cHt||xrdxsdf}||jvS)Nr r)rAr@)r,rIrJkeys r# canSetFeaturezDOMBuilder.canSetFeature\s)4 %+A"23dnn$$r"rr)rr )rr)rr)rr )rr)rr rrrr)rr rr)rr )rrrr rr)rr )rrrr rrrr ) rSrTrUrVrX)rr rWrYr[rrrrrr )rYrZr[)rr)rr r\r]r^ct|} t|j|S#t$r|dk(r|j}|jxro|j xra|j xrS|jxrE|jxs6|jxs(|jxs|jxs |j cYStjjdt!|zwxYw)Nrzfeature %s not known)rAgetattrr*AttributeErrorrrrrrrrrrrDrErGrH)r,rIxnameoptionss r# getFeaturezDOMBuilder.getFeaturesD! K4==%0 0 Ky --66<#AA<#,,<$BB<")!?!?";$+$>$>";$+$C$C";%,$4$4";%,$:$: < =''%%&ddl}|jjSrl)rprq build_opener)r,rus r#rz DOMEntityResolver._create_openers~~**,,r"c~|jj}|jd}||jSy)Ncharset)rninfo get_paramr)r,rrrs r#rz'DOMEntityResolver._guess_media_encodings;  %%'..+  ==? "r"N)r r r __slots__rfrrrr!r"r#rrsI, -r"rcjeZdZdZdZdZdZdZdZdZ dZ d Z d Z d Z d Zd ZdZdZdZy)rrncharacterStream stringDatarrrorcfd|_d|_d|_d|_d|_d|_d|_yr)rr+s r#r-zDOMInputSource.__init__s4#    r"c|jSr)rnr+s r#_get_byteStreamzDOMInputSource._get_byteStream r"c||_yr)r)r,rns r#_set_byteStreamzDOMInputSource._set_byteStreams $r"c|jSr)rr+s r#_get_characterStreamz#DOMInputSource._get_characterStreams###r"c||_yr)r)r,rs r#_set_characterStreamz#DOMInputSource._set_characterStreams .r"c|jSr)rr+s r#_get_stringDatazDOMInputSource._get_stringDatarr"c||_yr)r)r,datas r#_set_stringDatazDOMInputSource._set_stringDatas r"c|jSr)rr+s r# _get_encodingzDOMInputSource._get_encoding }}r"c||_yr)r)r,rs r# _set_encodingzDOMInputSource._set_encoding    r"c|jSr)rr+s r# _get_publicIdzDOMInputSource._get_publicId#rr"c||_yr)r)r,rs r# _set_publicIdzDOMInputSource._set_publicId%rr"c|jSr)ror+s r# _get_systemIdzDOMInputSource._get_systemId(rr"c||_yr)r)r,ros r# _set_systemIdzDOMInputSource._set_systemId*rr"c|jSr)rr+s r# _get_baseURIzDOMInputSource._get_baseURI-s ||r"c||_yr)rr,rhs r# _set_baseURIzDOMInputSource._set_baseURI/s  r"N)r r r rr-rrrrrrrrrrrrrrr!r"r#rrsU@I%$/!!!r"rcJeZdZdZdZdZdZdZejZ dZ dZ dZ y ) DOMBuilderFilterzSElement filter which can be used to tailor construction of a DOM instance. r r%r&r'c|jSr)) whatToShowr+s r#_get_whatToShowz DOMBuilderFilter._get_whatToShowDrr"c|jSr) FILTER_ACCEPTr,elements r# acceptNodezDOMBuilderFilter.acceptNodeG!!!r"c|jSr)rrs r#startContainerzDOMBuilderFilter.startContainerJrr"N)r r r r r FILTER_REJECT FILTER_SKIPFILTER_INTERRUPTrSHOW_ALLrrrrr!r"r#rr3s8MMK$$J""r"rc8eZdZdZdZdZdZdZdZdZ dZ y ) DocumentLSz=Mixin to create documents that conform to the load/save spec.Fcy)NFr!r+s r# _get_asynczDocumentLS._get_asyncUsr"cF|rtjjdy)Nz.asynchronous document loading is not supported)rDrErF)r,flags r# _set_asynczDocumentLS._set_asyncXs& ''))@B B r"ctd)Nz'haven't figured out what this means yetryr+s r#abortzDocumentLS.abort]s" 57 7r"ctdNzhaven't written this yetrrs r#loadzDocumentLS.loadc!"<==r"ctdrr)r,rs r#loadXMLzDocumentLS.loadXMLfrr"c||}|j S|j|urtjj|j Sr)) ownerDocumentrDrEWrongDocumentErrtoxml)r,snodes r#saveXMLzDocumentLS.saveXMLisI =E{{}  ,''**, ,{{}r"N) r r r r async_rrrrrrr!r"r#rrPs)G FB 7 >>r"rc&eZdZdZdZdZdZdZy)DOMImplementationLSr r%c|tjjd||jk(r t S||j k(rtjjdt d)NzschemaType not yet supportedz'asynchronous builders are not supportedzunknown value for mode)rDrErFMODE_SYNCHRONOUSrMODE_ASYNCHRONOUSrx)r,mode schemaTypes r#createDOMBuilderz$DOMImplementationLS.createDOMBuilderusl  !'')).0 0 4(( (<  4)) )''))9; ;122r"ctd)Nz-the writer interface hasn't been written yet!rr+s r#createDOMWriterz#DOMImplementationLS.createDOMWriters! ;= =r"ctSr))rr+s r#createDOMInputSourcez(DOMImplementationLS.createDOMInputSources r"N)r r r rrr r rr!r"r#rrqs 3= r"r)r rmxml.domrDxml.dom.NodeFilterr__all__rrrAobjectrrrrrr!r"r#rst: ) @@a)a)H*++\.V.b""4B  r"PK]!D!Dpulldom.cpython-312.pycnu[ ֦iu-ddlZddlZdZdZdZdZdZdZdZ d Z Gd d ejjZ Gd d ZGddZGdde ZdZddZddZy)N START_ELEMENT END_ELEMENTCOMMENTSTART_DOCUMENT END_DOCUMENTPROCESSING_INSTRUCTIONIGNORABLE_WHITESPACE CHARACTERSc|eZdZdZdZddZdZdZdZdZ dZ dZ d Z d Z d Zd Zd ZdZdZdZdZdZy)PullDOMNc6ddlm}||_ddg|_|j|_g|_|j j |_ |j j|_|dig|_ |jd|_ g|_ y#t$rY1wxYw)Nr) XML_NAMESPACExml) xml.domrdocumentFactory firstEvent lastEvent elementStackappendpushpopAttributeError _ns_contexts_current_contextpending_events)selfrrs (/usr/lib64/python3.12/xml/dom/pulldom.py__init__zPullDOM.__init__s).,%%,,  ((,,DH,E23 $ 1 1" 5     s B BBc>|jd}|jd=|SNr)r)rresults rrz PullDOM.pop!s%""2&   b ! c||_yN)_locator)rlocators rsetDocumentLocatorzPullDOM.setDocumentLocator&s  r#ct|dsg|_|jj|xsd|f|jj|jj |xsd|j|<y)N _xmlns_attrsxmlns)hasattrr*rrrcopy)rprefixuris rstartPrefixMappingzPullDOM.startPrefixMapping)sit^, "D    &"3GS!9:   !6!6!;!;!=>%+^tc"r#cB|jj|_yr%)rrr)rr.s rendPrefixMappingzPullDOM.endPrefixMapping0s $ 1 1 5 5 7r#cd}t|dd}|"|D]\}}||j||f<g|_|\}} |rZ||j|} | r | dz| z}n| }|jr|jj ||} nM|j ||} n:|jr|jj| } n|j d| } |jD]\}}|\} } | |k(r;| dk(r| }nd| z}|jj| |}| j|nx| rJ|j| } | r | dz| z}n| }|jj| |}| j|n,|jj| }| j|||_ t| fdg|jd<|jd|_|j!| y)Nzhttp://www.w3.org/2000/xmlns/r*:r+zxmlns:)getattr_attrsr*rdocumentcreateElementNS buildDocument createElementitemscreateAttributeNSsetAttributeNodeNScreateAttributesetAttributeNodevaluerrr)rnametagNameattrs xmlns_uri xmlns_attrsanamerAr/ localnamer.nodea_uri a_localnameqnameattrs rstartElementNSzPullDOM.startElementNS3s3 dND9  " + u38 i/0!, "D Y ..s3$slY6G'G}}}}44S'B))#w7}}}}229=))$ : ;;=KE%!& E; !')'E${2E}}66ueD''-..u5"SL;6E'E}}66ueD''-}}44[A%%d+DJ)),,T2D9q* $r#cvt|jfdg|jd<|jd|_yNr5rrr)rrBrCs r endElementNSzPullDOM.endElementNSl0)488:6=q*r#c|jr|jj|}n|jd|}|jD]8\}}|jj |}||_|j |:t|fdg|jd<|jd|_|j|yrP) r8r;r:r<r?rAr@rrr)rrBrDrIrGrArMs r startElementzPullDOM.startElementps ====..t4D%%dD1D ;;=KE%==007DDJ  ! !$ ') ,T2D9q* $r#cvt|jfdg|jd<|jd|_yrPrQ)rrBs r endElementzPullDOM.endElementrSr#c|jrG|jj|}t|fdg|jd<|jd|_yt|fdg}|jj |yrP)r8 createCommentrrrr)rsrIevents rcommentzPullDOM.commentsf ====..q1D")4$ 7DNN1 !^^A.DNq\4(E    & &u -r#c|jrH|jj||}t|fdg|jd<|jd|_yt||fdg}|jj |yrP)r8createProcessingInstructionrrrr)rtargetdatarIr[s rprocessingInstructionzPullDOM.processingInstructionsl ====<}}++E22D94@q*r#c|jj|}t|fdg|jd<|jd|_yrP)r8rcr rrds r characterszPullDOM.characterss>}}++E2($/6q*r#c|j4ddl}|jjjj |_yy)Nr)rxml.dom.minidomdomminidomDocumentimplementation)rrs r startDocumentzPullDOM.startDocuments2    ' "#&77??#;#;#J#JD  (r#cR|jj||d}||_t|fdg|jd<|jd|_|j ||j D]}|ddtk(r1|d\}}}|jj||}t|f|d<nN|ddtk(r-|jj|dd}t|f|d<ntd|dd||jd<||_d|_|jS)Nr5rzUnknown pending event ) rcreateDocumentr8rrrrrr^rrYAssertionError firstChild) rr/tagnamerIe_r_r`ns rr:zPullDOM.buildDocuments$##223F ,d3T:q* $$$AtAw00 !! &MM==fdK.2!1aG#MM//!Q8|!$%=ad1gFF !DNN1 DN%#r#cft|jfdg|jd<|jyrP)rr8rrrs r endDocumentzPullDOM.endDocuments'*DMM:DAq  r#cd|_y)z.clear(): Explicitly release parsing structuresN)r8rys rclearz PullDOM.clears  r#r%)__name__ __module__ __qualname__r&r8rrr(r0r2rNrRrUrWr\rarfrhror:rzr|r#rr r scHH!   487r+ +..+ + K 0r#r ceZdZdZdZdZy) ErrorHandlerct|yr%)printr exceptions rwarningzErrorHandler.warnings  ir#c|r%rrs rerrorzErrorHandler.errorr#c|r%rrs r fatalErrorzErrorHandler.fatalErrorrr#N)r}r~rrrrrr#rrrsr#rcBeZdZdZdZdZdZdZdZdZ dZ d Z y ) DOMEventStreamc||_||_||_t|jds|j|_|j y)Nfeed)streamparserbufsizer,_slurpgetEventreset)rrrrs rrzDOMEventStream.__init__s9   t{{F+ KKDM r#ct|_|jjtj j jd|jj|jyrP) r pulldomr setFeaturersaxhandlerfeature_namespacessetContentHandlerrys rrzDOMEventStream.resetsCy  swwAA1E %%dll3r#c6|j}|r|Str%)r StopIterationrrcs r__next__zDOMEventStream.__next__s ]]_ Ir#c|Sr%rrys r__iter__zDOMEventStream.__iter__s r#c|j}|g}|rb|\}}||ury|tk7r|dj||tk(r|j |n |tk(r|d=|j}|rayyr!)rr appendChildrr)rrIr[parentstokencur_nodes r expandNodezDOMEventStream.expandNodesx &#OE84 # ''1 %x(+%BKMMOEr#c@|jjds%|jj|j_|jjdsw|jj |j }|s|j jy|j j||jjdsw|jjdd}|jjdd|jjd<|S)Nr5r) rrrrreadrrcloser)rbufrs rrzDOMEventStream.getEvents||&&q)%)\\%<%sM!"C(&-! $$& &&' 22r#cddlm}t|}||}|stjj }t |||S)Nr)StringIO)iorlenrrrr)stringrrrrs r parseStringrIs<&kG 6 C $$& #vw //r#)NNr%)xml.saxrxml.sax.handlerrrrrrrr r rContentHandlerr rrrrrrrr#rrs  ! 1-  ucgg$$unMM^%g%B! 30r#PK]Y"expatbuilder.cpython-312.opt-1.pycnu[ ֦im dZddlmZmZmZddlmZmZmZddlm Z ddl m Z m Z ddl mZejZej Zej"Zej$j&Zej$j(Zej$j*Zej$j,Zej.Zej2ddej2dd ej2dd ej2dd ej2dd ej2dd ej2ddej2ddej2ddd ZGddeZdZdZGddZeeefZ GddeZ!GddeZ"Gdde"Z#Gdde"Z$d Z%d!e%zZ&Gd"d#eZ'Gd$d%Z(Gd&d'e(eZ)Gd(d)e(e'Z*Gd*d+e+Z,Gd,d-eZ-d3d.Z.d3d/Z/d3d0Z0d3d1Z1d2Z2y)4zFacility to use the Expat parser to load a minidom instance from a string or file. This avoids all the overhead of SAX and pulldom to gain performance. ) xmlbuilderminidomNode)EMPTY_NAMESPACE EMPTY_PREFIXXMLNS_NAMESPACE)expat) _append_child_set_attribute_node) NodeFilterNcdata enumerationentityentitiesididrefidrefsnmtokennmtokens) CDATAENUMENTITYENTITIESIDIDREFIDREFSNMTOKENNMTOKENScHeZdZdZd dZdZdZdZdZdZ d Z d Z d Z y) ElementInfo _attr_info_modeltagNameNc.||_g|_||_yN)r$r"r#)selfr$models -/usr/lib64/python3.12/xml/dom/expatbuilder.py__init__zElementInfo.__init__?s  cH|j|j|jfSr&r!r's r) __getstate__zElementInfo.__getstate__Ds T\\99r+c.|\|_|_|_yr&r!)r'states r) __setstate__zElementInfo.__setstate__Gs5:2dlr+c|jD]0}|d|k(s |d}|ddk(r tdcSt|dcStjS)Nr(r)r" _typeinfo_mapr_no_type)r'anameinfots r)getAttributeTypezElementInfo.getAttributeTypeJsXOODAw%HQ43;(00(b22 $r+c"tjSr&)rr7)r' namespaceURI localNames r)getAttributeTypeNSzElementInfo.getAttributeTypeNSTsr+c|jrE|jd}|tjjtjjfvSyNrF)r#r r( XML_CTYPE_ANYXML_CTYPE_MIXED)r'types r)isElementContentzElementInfo.isElementContentWsF ;;;;q>D 9 9 % ; ; == =r+cp|jr*|jdtjjk(SyrA)r#r r(XML_CTYPE_EMPTYr-s r)isEmptyzElementInfo.isEmpty_s) ;;;;q>U[[%@%@@ @r+cJ|jD]}|d|k(s |ddk(cSy)Nr3r4rF)r")r'r8r9s r)isIdzElementInfo.isIdes0OODAw%Bx4''$r+c(|j||fSr&)rJ)r'eurienameaurir8s r)isIdNSzElementInfo.isIdNSksyy$''r+r&) __name__ __module__ __qualname__ __slots__r*r.r1r;r?rErHrJrOr+r)r r <s41I :;    (r+r c&|j||Sr&)_intern_setdefault)builderss r)_internrYos  % %a ++r+c*|jd}|j}t|dk(r)|\}}}|||}|d|}|||}|||}n3t|dk(r|\}}t}|||x}}nt d|z||||||fS)N :z4Unsupported syntax: spaces in URIs not supported: %r)splitrVlenr ValueError)rWnamepartsinternuri localnameprefixqnames r)_parse_ns_namerirs JJsOE  ' 'F 5zQ!&Y'!9-ue$9i0 UqY"9i88 ORVVWW #s Y 55r+ceZdZdZddZdZdZdZdZdZ d Z d Z d Z d Z d ZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZy) ExpatBuilderzPDocument builder that uses Expat to build a ParsedXML.DOM document instance.Nc|tj}||_|jj%t |jj|_nd|_t |_d|_|jyr&) rOptions_optionsfilterFilterVisibilityController_filterr_finish_start_element_parserreset)r'optionss r)r*zExpatBuilder.__init__sc ? ((*G ==   +5dmm6J6JKDLDL*,D &  r+c*tjS)zCreate a new parser object.)r ParserCreater-s r) createParserzExpatBuilder.createParsers!!##r+cB|js|j|_|jjj|_d|j_d|j_d|j_|j|j|jS)z7Return the parser object, creating a new one if needed.T) rsrxrd setdefaultrV buffer_textordered_attributesspecified_attributesinstallr-s r) getParserzExpatBuilder.getParserso||,,.DL&*ll&9&9&D&DD #'+DLL $.2DLL +04DLL - LL &||r+ctjtdd|_|j|_|jj |_d|_y)z6Free all data structures used during DOM construction.NF)theDOMImplementationcreateDocumentrdocumentcurNode _elem_info_cdatar-s r)rtzExpatBuilder.resets>,;; T4) }} --22 r+c|j|_|j|_|j|_|j |_|jjr|j|_ |j|_ |jjr|j|_|jj"r4|j$|_|j(|_|j,|_n|j0|_|j2|_|j6|_|j:|_|j>|_ y)z>Install the callbacks needed to build the DOM into the parser.N)!start_doctype_decl_handlerStartDoctypeDeclHandlerfirst_element_handlerStartElementHandlerend_element_handlerEndElementHandler pi_handlerProcessingInstructionHandlerrnrentity_decl_handlerEntityDeclHandlernotation_decl_handlerNotationDeclHandlercommentscomment_handlerCommentHandlercdata_sectionsstart_cdata_section_handlerStartCdataSectionHandlerend_cdata_section_handlerEndCdataSectionHandlercharacter_data_handler_cdataCharacterDataHandlercharacter_data_handlerexternal_entity_ref_handlerExternalEntityRefHandlerxml_decl_handlerXmlDeclHandlerelement_decl_handlerElementDeclHandlerattlist_decl_handlerAttlistDeclHandlerr'parsers r)r~zExpatBuilder.installs*.)H)H&%)%?%?"#'#;#; .2oo+ == ! !'+'?'?F $%)%?%?" == ! !$($8$8F ! == ' '.2.N.NF +,0,J,JF )*.*K*KF '*.*E*EF '*.*J*J' $ 5 5$($=$=!$($=$=!r+c||j}d} |jdx}rQ|j|d|r'|jjr|j |d}|jdx}rQ|jdd|j}|jd|_|S#t $rY0wxYw)zIParse a document from a file object, returning the document node.Ti@Fr+N) rreadParserdocumentElement _setup_subset ParseEscapertrs)r'filer first_bufferbufferdocs r) parseFilezExpatBuilder.parseFiles!   IIg..&. VU+DMM$A$A&&v.$ !IIg..&. LLd #mm      sA#B/8B// B;:B;c|j} |j|d|j||j}|j d|_|S#t$rY0wxYw)z*>DLL '48OO 14<<')D $$0r+c|jj||}t|j||jr?|jj |t k(r|jj|yyyr&)rcreateProcessingInstructionr rrqrr removeChild)r'targetdatanodes r)rzExpatBuilder.pi_handler s]}}88FdllD) <DII$EDI <<>DDI!%D dllD)r+c2|jj}|r0|djtk(r|d}|j|z|_yt j }|j|z|_|j|_t|j|yr) rrrrrrrrrr )r'rrrs r)rz#ExpatBuilder.character_data_handler#sv\\,, *R.11Y>b>D D(DI ||~II$ !]]dllD)r+c |ry|jjsy|jj||||}|6|jj |} |j j | |jjjjj ||jrO|jj|tk(r,|jjjjd=yyyr) rnrr_create_entitycreateTextNoderappendrrrqrr) r' entityNameis_parameter_entityrbaserr notationNamerchilds r)rz ExpatBuilder.entity_decl_handler.s  }}%% }}++J,4lD  MM007E OO " "5 ) &&++2248 <.& :O**+ *( *8$9 + %%5 -".* !$" B1r+rkc:eZdZdZdZdZdZdZeje jeje jeje jej e j"ej$e j&ej(e j*ej,e j.ej0e j2ej4e j6ej8e j:ej<e j>ej@e jBi Z"y)rpzoWrapper around a DOMBuilderFilter which implements the checks to make the whatToShow filter attribute work.roc||_yr&r)r'ros r)r*z#FilterVisibilityController.__init__s  r+c|j|j}|jj|zrK|jj |}|t k(rt |tvrtdt|z|StS)Nz)startContainer() returned illegal value: ) _nodetype_maskrro whatToShowrFILTER_INTERRUPTr_ALLOWED_FILTER_RETURNSrareprr)r'rmaskvals r)rz)FilterVisibilityController.startContainersz""4==1 ;; ! !D (++,,T2C&&!!11 ADIMOOJ r+c|j|j}|jj|zr|jj |}|t k(rt |tk(r7|j}|jddD]}|j|tS|tvrtdt|z|StS)Nz%acceptNode() returned illegal value: )rrrorrrrrrr appendChildrr rar!r)r'rr"r#parentrs r)rz%FilterVisibilityController.acceptNodes""4==1 ;; ! !D (++((.C&&!!k!!__Q/E&&u-0%$11 =S IKKJ r+N)#rPrQrRrrSr*rrr ELEMENT_NODEr SHOW_ELEMENTATTRIBUTE_NODESHOW_ATTRIBUTEr SHOW_TEXTrSHOW_CDATA_SECTIONENTITY_REFERENCE_NODESHOW_ENTITY_REFERENCE ENTITY_NODE SHOW_ENTITYPROCESSING_INSTRUCTION_NODESHOW_PROCESSING_INSTRUCTION COMMENT_NODE SHOW_COMMENT DOCUMENT_NODE SHOW_DOCUMENTDOCUMENT_TYPE_NODESHOW_DOCUMENT_TYPEDOCUMENT_FRAGMENT_NODESHOW_DOCUMENT_FRAGMENT NOTATION_NODE SHOW_NOTATIONrrTr+r)rprps5I !!* **A*A **C*C **>*> **G*G ""**J*J **@*@ ((**P*P **A*A **B*B **G*G ##**K*K **B*B  Nr+rpceZdZdZdZy) FilterCrutch)_builder_level _old_start_old_endcd|_||_|j}|j|_|j |_|j|_|j|_yr) r@r?rsrrArrBrr)r'rWrs r)r*zFilterCrutch.__init__sO   4400 %)%?%?"#'#;#; r+N)rPrQrRrSr*rTr+r)r>r>s >Ic"eZdZdZdZdZdZy)rrTcptj|||j}dD]}t||dy)N)rrrrrr)r>r*rssetattr)r'rWrrbs r)r*zRejecter.__init__s5dG,D FD$ 'r+c,|jdz|_yr)r@r'argss r)rzRejecter.start_element_handlerskkAo r+c|jdk(rT|jj}|jj||j|_|j |_y|jdz |_yNrr3)r@r?rsr~rArrBr)r'rIrs r)rzRejecter.end_element_handlersV ;;! ]]**F MM ! !& ))-F &'+}}F $++/DKr+N)rPrQrRrSr*rrrTr+r)rr sI (&*r+rceZdZdZdZdZy)rrTc|jj}|j||jj|ur|jdz|_yyr)r?rrAr@)r'rIrs r)rzSkipper.start_element_handler*sE}}$$ ==  ,++/DK -r+c |jdk(rR|j|jj_|j |jj_d|_y|jdz |_|j |yrK)r@rAr?rsrrBrrHs r)rzSkipper.end_element_handler0s` ;;! 9=DMM ! ! 56:mmDMM ! ! 3 DM++/DK DMM4 r+N)rPrQrRrSrrrTr+r)rr'sI* !r+rz8http://xml.python.org/entities/fragment-builder/internalz %%s ]> &fragment-builder-internal;c<eZdZdZd dZdZdZdZdZdZ d Z y) FragmentBuilderzBuilder which constructs document fragments given XML source text and a context node. The context node is expected to provide information about the namespace declarations which are in scope at the start of the fragment. Nc|jtk(r||_||_n|j|_||_t j ||yr&)rr5originalDocumentrrrkr*)r'rrus r)r*zFragmentBuilder.__init__XsD   } ,$+D !"DL$+$9$9D !"DLdG,r+c<tj|d|_yr&)rkrtfragmentr-s r)rtzFragmentBuilder.resetas4  r+c@|j|jS)zRParse a document fragment from a file object, returning the fragment node.)rrr'rs r)rzFragmentBuilder.parseFilees ,,r+c||_|j}|jj}d}|rd|jxs|j }|j rd|j d|jd}n|jrd|jz}nd}|j}t|||fz} |j|d|j}|j|S#|jxYw)zMParse a document fragment from a string, returning the fragment node.zPUBLIC "z" ""z SYSTEM "%s"T) _sourcerrRrr_getDeclarationsrr _getNSattrs_FRAGMENT_BUILDER_TEMPLATErrtrT) r'rrridentrnsattrsrrTs r)rzFragmentBuilder.parseStringjs !''// ++Ft/D/D/FF#,,g.>.>@!!%(8(88F""$-0HH  LL4 (==    JJL s 5C%%C8c:|jjj}d}|rut|jj D]s}|jj |}|r|dz}|d|j}|jr |d|jd|jd}b|d|jd}ut|jj D]}|jj |}|r|dz}|d|j}|jr |d|jd|jd }n;|jr|d|jd }n|d |jjd }|jr|d |j}|d z}|S) zRe-create the internal subset from the DocumentType node. This is only needed if we don't already have the internalSubset as a string. rXz z z SYSTEM "z )rrrrrlengthitemnodeNamerrr firstChildrr)r'rrXrnotationrs r)r[z FragmentBuilder._getDeclarationssc ,,,,44  7,,334",,11!4F A)*H,=,=>$$h//1B1BDA./0A0ABA57++223 ))..q1F A'(&//:??foov@A__,-v?A%&(9(9(>(>?A&&,-v/B/BCAG4r+cy)NrXrTr-s r)r\zFragmentBuilder._getNSattrssr+c|tk(r|j}|j}|jj |}|j |_|jj |_|j|_ |j|jd||_||_d|_ ytj|||||S#||_||_d|_ wxYw)NTr) $_FRAGMENT_BUILDER_INTERNAL_SYSTEM_IDrrrsExternalEntityParserCreaterRcreateDocumentFragmentrTrrZrkr)r'rrrr old_document old_cur_noders r)rz+FragmentBuilder.external_entity_ref_handlers ; ; ==L<|jj||fy)z/Push this namespace declaration on our storage.N)rqr)r'rgres r)rxz'Namespaces.start_namespace_decl_handlers !!((&#7r+cd|vrt||\}}}}nt}|}d}t}tj||||}|j |_t|j|||_|jr|jD]u\}}|r*tjt|d|zt|d}n tjdtdt}||_ |j |_t||w|jdd=|r|j|j } |j"} t%dt'|dD]} || } || dz} d| vr6t|| \}}}}tj||||}|| |<|| ||f<n0tj| t| t}|| | <|| t| f<|j |_| |_ ||_yy)Nr[xmlns:xmlnsrr^r3)rirrrElementrrr rrqrrYrrr _ensure_attributes_attrs_attrsNSrr` ownerElement)r'rbrrerfrgrhrrrrrr8rs r)rz Namespaces.start_element_handlers $;,:4,F )CFE!CEI!Fuc69=!]]dllD)  $ $#88  WT8f3D%E%4fgGA Wo%,l|j }|rt|S) zNReturn string of namespace attributes from this element and ancestors.rX_ns_prefix_urir|r}z z=''r[)rhasattrritemsrr)r'attrsrr rgredeclnames r)r\zFragmentBuilderNS._getNSattrs2s,, w 01#*#9#9#?#?#AKFC{ HHV$#+f#4#*5:Hc J/7 <$B((G  r+N)rPrQrRrrtr\rTr+r)rr+s4r+rceZdZdZy)rzEException raised to short-circuit parsing in InternalSubsetExtractor.N)rPrQrRrrTr+r)rrPsOr+rc>eZdZdZdZdZdZdZdZdZ dZ d Z y) rzBXML processor which can rip out the internal document type subset.Nc|jS)z'Return the internal subset as a string.)rr-s r)rz!InternalSubsetExtractor.getSubsetYs {{r+cP tj||y#t$rYywxYwr&)rkrrrVs r)rz!InternalSubsetExtractor.parseFile]s)   " "4 .     %%cP tj||y#t$rYywxYwr&)rkrr)r'rs r)rz#InternalSubsetExtractor.parseStringcs)   $ $T6 2   rcH|j|_|j|_yr&)rrrrrs r)r~zInternalSubsetExtractor.installis)-)H)H&%)%?%?"r+c|rD|j}g|_|jj|_|j|_yt r&)rrrDefaultHandlerrrr)r'rbrrrrs r)rz2InternalSubsetExtractor.start_doctype_decl_handlerms@ ^^%FDK$(KK$6$6F !+/+H+HF (- r+cdj|jjddjdd}||_t)NrXz   )joinrreplacer)r'rXs r)rz0InternalSubsetExtractor.end_doctype_decl_handlerws= GGDKK ( ( 6 > >tT J mr+ctr&)r)r'rbrs r)rz-InternalSubsetExtractor.start_element_handler|s mr+) rPrQrRrrrrrr~rrrrTr+r)rrTs.L F  @  r+rc|r t}n t}t|tr(t |d5}|j |}ddd|S|j |}|S#1swYSxYw)z{Parse a document, returning the resulting Document node. 'file' may be either a file name or an open file object. rbN)rrk isinstancestropenr)r namespacesrWfpresults r)parsersl  ".$ $ &&r*F M""4( M  Ms A##A-cR|r t}n t}|j|S)zOParse a document from a string, returning the resulting Document node. )rrkr)rrrWs r)rrs' ".   v &&r+c|r t|}n t|}t|tr(t |d5}|j |}ddd|S|j |}|S#1swYSxYw)zParse a fragment of a document, given the context from which it was originally extracted. context should be the parent of the node(s) which are in the fragment. 'file' may be either a file name or an open file object. rN)rrPrrrr)rrrrWrrs r) parseFragmentrsq#G,!'*$ $ &&r*F M""4( M  Ms A%%A/cV|r t|}n t|}|j|S)zParse a fragment of a document from a string, given the context from which it was originally extracted. context should be the parent of the node(s) which are in the fragment. )rrPr)rrrrWs r)parseFragmentStringrs, #G,!'*   v &&r+cF|jr t|St|S)z,Create a builder based on an Options object.)rrrk)rus r) makeBuilderrs!g&&G$$r+)T)3rxml.domrrrrrr xml.parsersr xml.dom.minidomr r xml.dom.NodeFilterr rrr5DOMBuilderFilterrrrrgetDOMImplementationrTypeInfor6objectr rYrirkr rpr>rrrir]rProrr ExceptionrrrrrrrrTr+r)rs/:.-BB>) NN ,,"" ++99 ++99 ))55 ..??3w335!  w/   }5   x0   z2   t,   w/   x0   y1   z2  1(&1(f,6&y1y1| )-E7 7 t <6 <*|*8!l!2?%*+ +r9lr9j\.\.~Z" O"J ) )l)X$'( '%r+PK]^domreg.cpython-312.pycnu[ ֦i{ 8dZddlZdddZiZdZdZd dZd Zy) zRegistration facilities for DOM. This module should not be used directly. Instead, the functions getDOMImplementation and registerDOMImplementation should be imported from xml.dom.Nzxml.dom.minidomzxml.dom.DOMImplementation)minidom4DOMc|t|<y)aIregisterDOMImplementation(name, factory) Register the factory function with the name. The factory function should return an object which implements the DOMImplementation interface. The factory function can either return the same object, or a new one (e.g. if that implementation supports some customization).N) registered)namefactorys '/usr/lib64/python3.12/xml/dom/domreg.pyregisterDOMImplementationr sJtc@|D]\}}|j||ryy)zF_good_enough(dom, features) -> Return 1 if the dom offers the featuresr) hasFeature)domfeaturesfvs r _good_enoughr s&!~~a" r cPddl}d}tj|}|rt|iidg}|j S|r t |St jjs'd|jvrt |jdSt|tr t|}t jD]}|}t||s|cStjD]} t |}t||s|cSt#d#t $rY8wxYw)aSgetDOMImplementation(name = None, features = ()) -> DOM implementation. Return a suitable DOM implementation. The name is either well-known, the module name of a DOM implementation, or None. If it is not None, imports the corresponding module and returns DOMImplementation object if the import succeeds. If name is not given, consider the available implementations to find one with the required feature set. If no implementation can be found, raise an ImportError. The features list must be a sequence of (feature, version) pairs which are passed to hasFeature.rNgetDOMImplementation PYTHON_DOM)rz$no suitable DOM implementation found)oswell_known_implementationsget __import__rrsysflagsignore_environmentenviron isinstancestr_parse_feature_stringvaluesrkeys Exception ImportError)rrrcreatormodrs r rr'sG $ ( ( .C b"'=&>?'')) $!! YY ) )lbjj.H#2::l+CDD(C (2$$&i X &J' .224 &g6C X &J 5 < ==    s0 D D%$D%cg}|j}d}t|}||krR||}|ddvrtd||dz}d}||kr||}|ddvr|dz}|}|j||f||krRt |S)Nr 0123456789zbad feature name: r )splitlen ValueErrorappendtuple)srpartsilengthfeatureversionrs r r!r!RsH GGIE A ZF f*( 1: %w@A A E v:aAt|#E'*+ f* ?r )N)__doc__rrrr rrr!r5r r r7s;>  '   )>Vr PK]:o7 7 minicompat.cpython-312.pycnu[ ֦i' PdZgdZddlZefZGddeZGddeZ dZ y) zPython version compatibility support for minidom. This module contains internal implementation details and should not be imported; use xml.dom.minidom instead. )NodeList EmptyNodeList StringTypes defpropertyNc>eZdZdZdZdZdZeeedZdZ y) rc:d|cxkrt|kr||SyyNrlenselfindexs +/usr/lib64/python3.12/xml/dom/minicompat.pyitemz NodeList.item5s"  !D !;  "ct|SNr rs r _get_lengthzNodeList._get_length9s 4yrc@tjjdNz.attempt to modify read-only attribute 'length'xmldomNoModificationAllowedErrrvalues r _set_lengthzNodeList._set_length<gg.. <> >r$The number of nodes in the NodeList.docc|g}||ddyrr)rstates r __setstate__zNodeList.__setstate__Ds =EQrN) __name__ __module__ __qualname__ __slots__rrrpropertylengthr&rrrrr2s/I>k;@BFrrcDeZdZdZdZdZdZdZdZe eedZ y ) rrc<t}|j||SrrextendrotherNLs r__add__zEmptyNodeList.__add__M Z % rc<t}|j||Srr/r1s r__radd__zEmptyNodeList.__radd__Rr5rcyrrr s rrzEmptyNodeList.itemWsrcyr rrs rrzEmptyNodeList._get_lengthZsrc@tjjdrrrs rrzEmptyNodeList._set_length]r rr!r"N) r'r(r)r*r4r7rrrr+r,rrrrrJs4I  >k;@BFrrct|d|z}|fd}t|d|zr Jd|zt|||}t|||y)N_get_cXtjjdt|z)Nz&attempt to modify read-only attribute )rrrrepr)rrnames rsetzdefproperty..setgs'gg.. 4tDz AC Cr_set_zexpected not to find _set_r")getattrhasattrr+setattr)klassr?r#getr@props rrresZ %'D. *C"Cugn-/ '$ ./ - C# &D E4r) __doc____all__xml.domrstrrlistrtuplerrrrrrNs<T Ff t0BEB6rPK]=((NodeFilter.cpython-312.pycnu[ ֦iGddZy)cVeZdZdZdZdZdZdZdZdZ dZ dZ dZ d Z d Zd Zd Zd ZdZdZdZy) NodeFilterzL This is the DOM2 NodeFilter interface. It contains only constants. l @iiict)N)NotImplementedError)selfnodes +/usr/lib64/python3.12/xml/dom/NodeFilter.py acceptNodezNodeFilter.acceptNodes!!N)__name__ __module__ __qualname____doc__ FILTER_ACCEPT FILTER_REJECT FILTER_SKIPSHOW_ALL SHOW_ELEMENTSHOW_ATTRIBUTE SHOW_TEXTSHOW_CDATA_SECTIONSHOW_ENTITY_REFERENCE SHOW_ENTITYSHOW_PROCESSING_INSTRUCTION SHOW_COMMENT SHOW_DOCUMENTSHOW_DOCUMENT_TYPESHOW_DOCUMENT_FRAGMENT SHOW_NOTATIONrrrrrscMMK",H",L",N",I",",",K",",L",M",",",M"rrN)rr)rrr*s""rPK];rggminidom.cpython-312.pycnu[ ֦i ZdZddlZddlZddlmZmZmZmZddlddl m Z m Z ejjjejjjfZGddejjZ ee dd ee d d ee d d dZdZdZdZGdde ZGdde Zeedd eed d eedd GddeZeedd eZGd d!eZeddZGd"d#e Zeed$d% eed d& d'ZGd(d)ZGd*d+ee Z Gd,d-ee Z!ee!dd. Gd/d0e!Z"ee"d1d2 ee"d3d4 d5Z#d6Z$Gd7d8e!Z%Gd9d:e"Z&Gd;dd?Z(Gd@dAe(ee Z)GdBdCe(e Z*GdDdEe(ee Z+GdFdGe Z,GdHdIeZ-dJZ.GdKdLe e Z/ee/dMdN dOZ0dPZ1dQZ2dUdRZ3dVdSZ4dVdTZ5y)WacSimple implementation of the Level 1 DOM. Namespaces and other minor Level 2 features are also supported. parse("foo.xml") parseString("") Todo: ===== * convenience methods for getting elements and text. * more testing * bring some of the writer and linearizer code into conformance with this interface * SAX 2 namespaces N)EMPTY_NAMESPACE EMPTY_PREFIXXMLNS_NAMESPACEdomreg)*)DOMImplementationLS DocumentLSceZdZdZdZdZdZdZeZ dZ ddZ ddZ dZ dZdZdZd Zd Zd Zd Zd ZdZdZdZdZdZdZdZdZdZdZdZ y)NodeNcy)NTselfs (/usr/lib64/python3.12/xml/dom/minidom.py__bool__z Node.__bool__+c*|jdd||SN) toprettyxml)rencoding standalones rtoxmlz Node.toxml.sB*==rcv|tj}n+tjtj|dd}|jt j k(r|j|d||||n|j|d||||jS|jjS)Nxmlcharrefreplace )rerrorsnewliner) ioStringIO TextIOWrapperBytesIOnodeTyper DOCUMENT_NODEwritexmlgetvaluedetach)rindentnewlrrwriters rrzNode.toprettyxml1s  [[]F%%bjjl/7-@.24F ==D.. . MM&"fdHj I MM&"fd 3  ??$ $==?++- -rc,t|jSN)bool childNodesrs r hasChildNodeszNode.hasChildNodesDsDOO$$rc|jSr-r/rs r_get_childNodeszNode._get_childNodesG rc:|jr|jdSyNrr2rs r_get_firstChildzNode._get_firstChildJs ????1% % rc:|jr|jdSyNr2rs r_get_lastChildzNode._get_lastChildNs ????2& & rc&|j|jk(r.t|jD]}|j |||S|j|j vr6t jjt|dt||j|jj|||j||S |jj|}|jt vr t#||jj%||||_||_|r!|j|dz }||_||_nd|_||_ |S#t$rt jjwxYw)N cannot be child of )r$DOCUMENT_FRAGMENT_NODEtupler/ insertBefore_child_node_typesxmldomHierarchyRequestErrrepr parentNode removeChild appendChildindex ValueError NotFoundErr_nodeTypes_with_children_clear_id_cacheinsert nextSiblingpreviousSibling)rnewChildrefChildcrJnodes rrAzNode.insertBeforeRsn    ; ; ;8../!!!X.0O   D$:$: :''--.28nd4jIK K    *    + +H 5     X &$! ,--h7  $<<% OO " "5( 3#+H '/H $uQw/#+ +/(+/("&H  ,gg))++ ,s E(((Fc|j|jk(r-t|jD]}|j ||S|j|j vr6t jjt|dt||jtvr t||j|jj|t||d|_|SNr=)r$r?r@r/rIrBrCrDrErFrMrNrGrH _append_childrP)rrUrTs rrIzNode.appendChildrs ==D77 74??+  #,K == 6 6 6''--.24j$t*EG G ]]6 6 D ! ?? & OO ' ' -dD! rc|j|jk(r/|j}|j||j ||S|j|j vr6t jjt|dt|||ury|j|jj| |jj|}||j|<||_ d|_ |jtvs|jtvr t!||j|_|j"|_d|_d|_|j"r||j"_|jr||j_|S#t$rt jjwxYwrW)r$r?rPrHrArBrCrDrErFrGr/rJrKrLrMrNrQ)rrRoldChildrSrJs r replaceChildzNode.replaceChilds    ; ; ;++H   X &$$Xx8 8   D$:$: :''--.28nd4jIK K x      *    + +H 5 (OO))(3E"*""   !9 9  $<< D !'33#+#;#; ##'  # #3;H $ $ 0   3;H 0! (''%%' ' (s F(F?c |jj||j |j|j _|j|j |j_dx|_|_|jtvr t|d|_ |S#t$rtjj wxYwr-) r/removerKrCrDrLrPrQr$rMrNrGrrZs rrHzNode.removeChilds ( OO " "8 ,    +3;3K3KH 0  # # /3;3G3GH $ $ 0:>>x7    8 8 D !" (''%%' ' (s B(Ccg}|jD]M}|jtjk(r|jsN|r|j |d_|j r|j |j _|j{|r~|dj|jk(rb|d}|j|jz|_|j |_|j r||j _|j|j||j||jtjk(s>|jP||jddyr9) r/r$r TEXT_NODEdatarPrQunlinkappend ELEMENT_NODE normalize)rLchildrUs rrezNode.normalizes  __E~~/zz,1,=,=")((>U^^;R5D $ EJJ 6DI','8'8D$((<@))9LLNHHUO>>T%6%66OO%-%.rc8t|||jxs|Sr-) _clone_node ownerDocument)rdeeps r cloneNodezNode.cloneNodes4t'9'9'ATBBrcN|jjj||Sr-)rjimplementation hasFeaturerfeatureversions r isSupportedzNode.isSupporteds!!!00;;GWMMrcyr-r rs r_get_localNamezNode._get_localNamesrc ||uSr-r rothers r isSameNodezNode.isSameNodes u}rc,|j|dr|Syr-)rsrrqs r getInterfacezNode.getInterfaces   GT *KrcR |j|dS#ttf$rYywxYwr6) _user_dataAttributeErrorKeyErrorrkeys r getUserDatazNode.getUserDatas2 ??3'* *)  s &&cd} |j}||vr||d}| d}|||=|S||f||<|S#t$r i}||_Y4wxYwr6)r~r)rrrahandleroldds r setUserDatazNode.setUserDatasy A !8C&)C <GcF G_AcF  ADO s 0AAct|drGt|jjD] \}\}}| |j |||||"yy)Nr~)hasattrlistr~itemshandle)r operationsrcdstrrars r_call_user_data_handlerzNode._call_user_data_handlersQ 4 &(,T__-B-B-D(E$_dG&NN9c4cB)F 'rcdx|_|_|jr0|jD]}|jt |_d|_d|_yr-)rGrjr/rbNodeListrQrP)rrgs rrbz Node.unlinksH/33$, ?? )&jDO#rc|Sr-r rs r __enter__zNode.__enter__s rc$|jyr-)rb)retevtbs r__exit__z Node.__exit__s  rNN) rNN)!__name__ __module__ __qualname__ namespaceURIrGrjrPrQrprefixrrrr0r3r7r;rArIr[rHrerlrsruryr|rrrrbrrr rrr r "sLJMKO F><@#.&%&'@"@ 6CN  $C rr firstChildzFirst child node, or None.)doc lastChildzLast child node, or None. localNamez"Namespace-local name of this node.cv|j}|r|d}||_||_|j|||_yr9)r/rQrPrcrG)rrUr/lasts rrXrXs<J"~#dDOrc|rT|jddjddjddjdd}|j|y y ) zWrites datachars to writer.&z&z>N)replacewrite)r+ras r _write_datar(sM ||C)11#v>GD(+GGC,@  T rc|jD]Q}|jtjk(r%|dk(s|j|k(r|j |t |||S|SNr)r/r$r rdtagNamerc_get_elements_by_tagName_helper)parentnamercrUs rrr/sT!! ==D-- - S[DLLD0 IIdO'dB7 " Irc|jD]g}|jtjk(s!|dk(s|j|k(r%|dk(s|j |k(r|j |t||||i|Sr)r/r$r rdrrrc"_get_elements_by_tagName_ns_helper)rnsURIrrrUs rrr7sk!! ==D-- -c!T^^y%@#!2!2e!; $ .tUIr J " IrceZdZejZdZdZdZdZ ejejejejejejej fZdZy)DocumentFragmentz#document-fragmentNc"t|_yr-)rr/rs r__init__zDocumentFragment.__init__Ns "*r)rrrr r?r$nodeName nodeValue attributesrGrdr`CDATA_SECTION_NODEENTITY_REFERENCE_NODEPROCESSING_INSTRUCTION_NODE COMMENT_NODE NOTATION_NODErBrr rrrr@sk**H#HIJJ**003399**++ -%rrceZdZdZej ZdZdZdZ ejejfZ e ddfdZdZdZdZdZeeexZZd Zd ZeeexZZd Zd ZeeeZd ZdZdZy)Attr)_name_valuer_prefixr/ _localNamerj ownerElementNFcd|_d|_||_||_||_|||_t |_|jjtyr-) rrjrrrrrr/rcText)rqNamerrrs rrz Attr.__init__\sT ! (  'DO"* tv&rcx |jS#t$r"|jjdddcYSwxYwN:r>r:)rrrsplitrs rruzAttr._get_localNamels< 3?? " 3==&&sA.r2 2 3 (99c|jSr-) specifiedrs r_get_specifiedzAttr._get_specifiedr ~~rc|jSr-)rrs r _get_namezAttr._get_nameu zzrcV||_|jt|jyyr-)rrrNrvalues r _set_namezAttr._set_namexs(    ( D-- . )rc|jSr-)rrs r _get_valuezAttr._get_value {{rc||_||jd_|jt |j||jd_yr6)rr/rarrNrs r _set_valuezAttr._set_valuesE "'    ( D-- ."'rc|jSr-)rrs r _get_prefixzAttr._get_prefix ||rc|j}|dk(r*|r(|tk7rtjj d||_| |j }n|d|j }|jrt|j||_ y)Nxmlnsz5illegal use of 'xmlns' prefix for the wrong namespacer) rrrCrD NamespaceErrrrrrNr)rrnsurinewNames r _set_prefixzAttr._set_prefixs|!! W /1gg**KMM >nnG!'8G    D-- . rc|j}||j|j=|j|j|j f=|j r;d|_|xjdzc_|jxjdzc_ |jD]}|j|jdd=y)NFr>) r_attrsr_attrsNSrr_is_id_magic_id_nodesrj_magic_id_countr/rb)relemrgs rrbz Attr.unlinks      DMM* t00$..AB{{# $$)$""22a72__E LLN% OOA rc|jry|j}|j}||y|j|}|y|jr&|j |j|j S|j|jSNTF) rrjr_get_elem_inforisIdNSrisIdrrrrinfos r _get_isIdzAttr._get_isIds} ;;     ;$,!!$' <   ;;t00$..A A99T]]+ +rc|j}|j}||tS|j|}|tS|jr&|j |j|j S|j|jSr-) rjr_no_typerrgetAttributeTypeNSrgetAttributeTyperrs r_get_schemaTypezAttr._get_schemaTypes{     ;$,O!!$' <O   **4+<+6 T]D$6rr-)!rrr__doc__rrrrrrrrr rr$__len__r(r+r.r0r3r5r8r=r@rCrHrKr:rOrQrSrWr rrrrs8I*     ( "$$,GC %%$%$1 $  ( ( ' >?rrlengthz$Number of nodes in the NamedNodeMap.c(eZdZdZdZdZdZdZy)TypeInfo namespacerc ||_||_yr-r])rr^rs rrzTypeInfo.__init__s" rc|jr4d|jjd|jd|jdSd|jjd|jdS)Nr z (from z)>r)r^ __class__rrrs r__repr__zTypeInfo.__repr__sM >>*...*A*A499*...: : !% 7 7C Crc|jSr-)rrs rrzTypeInfo._get_name yyrc|jSr-)r^rs r_get_namespacezTypeInfo._get_namespacerrN)rrrrrrcrrgr rrr\r\|s#IDrr\cjeZdZdZej ZdZeZ dZ ej ejejejejejfZeddfdZdZdZdZdZd Zd Zd Zd Zd ZdZdZeZdZdZ dZ!e!Z"dZ#dZ$dZ%dZ&dZ'ddZ(dZ)dZ*dZ+dZ,dZ-y)Element) rjrGrrrrrr/rrrPrQNrcd|_d|_|x|_|_||_||_t |_dx|_|_ d|_ d|_ yr-) rjrGrrrrrr/rPrQrr)rrrrrs rrzElement.__init__sW!'.. t} ("*2664/  rc:|ji|_i|_yyr-)rrrs r_ensure_attributeszElement._ensure_attributess ;; DKDM rcx |jS#t$r"|jjdddcYSwxYwr)rrrrrs rruzElement._get_localNames< 2?? " 2<<%%c1-b1 1 2rc|jSr-rrs r _get_tagNamezElement._get_tagNamerrc|j8t|jjD]}|jd|_d|_t j|yr-)rrrrbrr )rattrs rrbzElement.unlinksK ;; "T[[//12 3   Drcn|jy |j|jS#t$rYywxYw)aReturns the value of the specified attribute. Returns the value of the element's attribute named attname as a string. An empty string is returned if the element does not have such an attribute. Note that an empty string may also be returned as an explicitly given attribute value, use the hasAttribute method to distinguish these two cases. r)rrr)rr<s r getAttributezElement.getAttributes= ;;  ;;w'-- -  s ( 44cr|jy |j||fjS#t$rYywxYwr)rrrrBs rgetAttributeNSzElement.getAttributeNSs@ ==  ==, !:;AA A  s * 66c|j|}|5t|}||_|j|_|j |y||jk7r ||_|j r t |yyyr-)getAttributeNoderrrjsetAttributeNoderrN)rr<rrrs r setAttributezElement.setAttributeso$$W- <=DDJ!%!3!3D   ! !$ ' djj DJyy%!rcNt|\}}|j||}|8t||||}||_|j|_|j |y||jk7r||_|j r t||j|k7r||_||_ yyr-) _nssplitgetAttributeNodeNSrrrjryrrNrr)rr qualifiedNamerr localnamerrs rsetAttributeNSzElement.setAttributeNSs$]3 &&|Y? < |YGDDJ!%!3!3D   ! !$ ' "" 99#D){{f$$ - %rcR|jy|jj|Sr-r#)rattrnames rrxzElement.getAttributeNodes" ;; {{x((rcV|jy|jj||fSr-)rr$rBs rr}zElement.getAttributeNodeNSs) == }}  , !:;;rc|jd|fvrtjjd|j |j j |jd}||j||jj |j|jfd}|||ur|j|t||||ur|S||ur|Sy)Nzattribute node already owned) rrCrDInuseAttributeErrrlrr$rremoveAttributeNoderrr_set_attribute_node)rrrold1old2s rryzElement.setAttributeNode s   T4L 0''++,JK K !{{tyy$/    $ $T *}}  $"3"3T^^!DdK  D 0  $ $T *D$' t K t K rc|jtjj |j|}|j |y#t $rtjjwxYwr-)rrCrDrLrrr)rrrrs rremoveAttributezElement.removeAttribute"sf == ''%%' ' (;;t$D   & (''%%' ' (s A (A5c|jtjj |j||f}|j |y#t$rtjjwxYwr-)rrCrDrLrr)rrrrrs rremoveAttributeNSzElement.removeAttributeNS+sk == ''%%' ' (==, !:;D   & (''%%' ' (s A(A7c(|tjj |j|jt ||j|j|_|S#t $rtjjwxYwr-) rCrDrLrrrrNrbrjrNs rrzElement.removeAttributeNode4s{ <''%%' ' ( KK "  "//  (''%%' ' (s A))(Bc8|jy||jvS)zChecks whether the element has an attribute with the specified name. Returns True if the element has an attribute with the specified name. Otherwise, returns False. Frr?s r hasAttributezElement.hasAttributeDs ;; t{{""rc<|jy||f|jvSNF)rrBs rhasAttributeNSzElement.hasAttributeNSNs# == i(DMM99rc,t||tS)zReturns all descendant elements with the given tag name. Returns the list of all descendant elements (not direct children only) with the specified tag name. rrr?s rgetElementsByTagNamezElement.getElementsByTagNameSs /tT8:FFrc.t|||tSr-rrrBs rgetElementsByTagNameNSzElement.getElementsByTagNameNS[1 , 8:7 7rc6d|jt|fzS)Nz)rr'rs rrczElement.__repr___s)T\\2d8,DDDrc,|j|dz|jz|j}|jD]@}|jd|zt |||j |jdB|j r|jdt|j dk(r[|j djtjtjfvr"|j dj|dddnJ|j||j D]}|j|||z|||j||jd|jd|y |jd |zy ) zWrite an XML element to a file-like object Write the element to the writer object that must provide a write method (e.g. a file or StringIO object). rz %s="rrr>rrz%sN) rr_get_attributesrrrr/rr$r r`rr&)rr+r) addindentr*r a_namerUs rr&zElement.writexmlbs>  VCZ$,,./$$&jjlF LLF* + f 3 3 4 LL # ?? LL DOO$)"++(?(?0AA"++FBB? T" OODMM&&*:ItL, V$ LLdllD9 : LL 'rcd|jt|j|j|Sr-)rlrrrrs rrzElement._get_attributess% !DKK==rc|jryyrrrs r hasAttributeszElement.hasAttributess ;;rcH|j|}|j|yr-)rxsetIdAttributeNode)rridAttrs rsetIdAttributezElement.setIdAttributes &&t, 'rcJ|j||}|j|yr-)r}r)rrrrs rsetIdAttributeNSzElement.setIdAttributeNSs"((yA 'rcr||j|jstjj t |tjj |jsGd|_|xjdz c_|jxjdz c_ t|yy)NTr>) ryrrCrDrL_get_containing_entrefNoModificationAllowedErrrrrjrrN)rrs rrzElement.setIdAttributeNodes >1D1D!E''%%' ' !$ ' 3''224 4}} FM  A %    . .! 3 . D ! rrrr).rrrrr rdr$rrrrrrr`rrrBrrrlrurprbrtrvrzrrxr}rysetAttributeNodeNSrrrremoveAttributeNodeNSrrrrrcr&rrrrrr rrriris1I  HIJO**99**0033 5.=T* 2   &.") < &*'' 0#: G7E(@>(( "rrirz*NamedNodeMap of attributes on the element.z%Namespace-local name of this element.ct||j||j|j<||j|j |j f<||_yr-)rNrlrrrrrr)elementrrs rrrsQG  $GNN499<@Gd''89  Drc^eZdZdZdZdZeZdZdZ dZ dZ dZ dZ dZd Zd Zd Zy) ChildlesszMixin that makes childless-ness easy to implement and avoids the complexity of the Node methods that deal with children. r Ncyr-r rs rr7zChildless._get_firstChildrrcyr-r rs rr;zChildless._get_lastChildrrcZtjj|jdz)Nz nodes cannot have childrenrCrDrErrNs rrIzChildless.appendChild&gg)) MM9 9; ;rcyrr rs rr0zChildless.hasChildNodesrcZtjj|jdzNz nodes do not have childrenrrrRrSs rrAzChildless.insertBeforerrcZtjj|jdzr)rCrDrLrr^s rrHzChildless.removeChilds&gg!! MM9 9; ;rcyr-r rs rrezChildless.normalizes rcZtjj|jdzrrrrRrZs rr[zChildless.replaceChildrr)rrrrXrr EmptyNodeListr/rrr7r;rIr0rArHrer[r rrrrsLIJJJI;;; ;rrcreZdZejZdZdZdZdZ e ee Z dZ dZ e e e Zd dZy) ProcessingInstructiontargetrac ||_||_yr-r)rrras rrzProcessingInstruction.__init__s  rc|jSr-rars r_get_nodeValuez$ProcessingInstruction._get_nodeValuererc||_yr-rrs r_set_nodeValuez$ProcessingInstruction._set_nodeValues  rc|jSr-rrs r _get_nodeNamez#ProcessingInstruction._get_nodeNamerrc||_yr-rrs r _set_nodeNamez#ProcessingInstruction._set_nodeNames  rc d|j|d|jd|jd|y)Nz)rrrarr+r)rr*s rr&zProcessingInstruction.writexmls t{{DIItLMrNr)rrrr rr$rrrrrrrrrr&r rrrrsI//H"I 8I }5HNrrcfeZdZdZdZdZeZdZdZe eexZ Z dZ dZ dZd Zd Zd Zy ) CharacterData)_datarjrGrQrPctdx|_|_dx|_|_d|_t j |yr)rjrGrQrPrr rrs rrzCharacterData.__init__s4/33T_266t/  drc,t|jSr-)rrars rrzCharacterData._get_length499~rc|jSr-rrs r _get_datazCharacterData._get_datarrc||_yr-rrras r _set_datazCharacterData._set_datas  rc|j}t|dkDrd}nd}d|jjd|dd|dS)N z...rz)rarrbr)rra dotdotdots rrczCharacterData.__repr__ sByy t9r>II NN # #T!BZ< >.."yy) $ 2 2 ??tt'A'AA|++G4,,Wd;IIgv& rc<t|||j|yr-)rrars rr&z Text.writexmlUsF 4@Arc|jg}|j}|Y|jtjtj fvr)|j d|j|j}nn|Y|j}|X|jtjtj fvr(|j|j|j}nn|Xdj|S)Nrr) rarQr$r r`rrOrPrcjoin)rrfrGs r_get_wholeTextzText._get_wholeTextZs YYK  mzzdnnd.E.EFFAFF#%% m   mzzdnnd.E.EFF MM m wwqzrc|j}|j}|P|jtjtj fvr |j}|j ||}nn|P|j}|s|j ||P|jtjtj fvr |j}|j ||}nn|P|r ||_|Syr-) rGrQr$r r`rrHrPra)rcontentrrGrs rreplaceWholeTextzText.replaceWholeTextls  mzzdnnd.E.EFF((""1% m      t $mzzdnnd.E.EFF}}""1% m DIKrc|jjryt|}|y|jj |}|y|j Sr)rastrip_get_containing_elementrjrisElementContent)rrrs r!_get_isWhitespaceInElementContentz&Text._get_isWhitespaceInElementContentsR 99?? &t, <!!006 <((* *rr)rrrrr r`r$rrrr&rrrr rrrr?s4I~~HHJ B $8 +rrisWhitespaceInElementContentzKTrue iff this text node contains only whitespace and is in element content. wholeTextz.The text of all logically-adjacent text nodes.c||j}|.|jtjk(r|S|j}|.yr-)rGr$r rdrUrTs rrrs< A - ::** *H LL - rc||j}|.|jtjk(r|S|j}|.yr-)rGr$r rr s rrrs< A - ::33 3H LL - rc6eZdZejZdZdZddZy)Commentz#commentc<tj|||_yr-)rrrrs rrzComment.__init__st$ rc|d|jvr td|j|d|jd|y)Nz--z%'--' is not allowed in a comment nodez)rarKrrs rr&zComment.writexmls1 499 DE E  4@ArNr) rrrr rr$rrr&r rrrrs  HHBrrc4eZdZdZej ZdZddZy) CDATASectionr z#cdata-sectionc|jjddk\r td|jd|jzy)Nz]]>rz$']]>' not allowed in a CDATA sectionz)rafindrKrrs rr&zCDATASection.writexmls9 99>>% A %CD D % 12rNr) rrrrr rr$rr&r rrrrsI&&HH3rrc`eZdZdZddZdZdZdZdZdZ dZ d Z d Z d Z d Zd ZdZy)ReadOnlySequentialNamedNodeMap_seqc||_yr-r)rseqs rrz'ReadOnlySequentialNamedNodeMap.__init__s  rc,t|jSr-rrrs rrYz&ReadOnlySequentialNamedNodeMap.__len__rrc,t|jSr-rrs rrz*ReadOnlySequentialNamedNodeMap._get_lengthrrcL|jD]}|j|k(s|cSyr-)rrrFs rr@z+ReadOnlySequentialNamedNodeMap.getNamedItems!AzzT!rcl|jD]%}|j|k(s|j|k(s#|cSyr-)rrrrJs rrCz-ReadOnlySequentialNamedNodeMap.getNamedItemNSs,A~~-!++2Jrct|tr|j|}n|j|}| t ||Sr-)rr@rCr@r)r name_or_tuplerUs rr8z*ReadOnlySequentialNamedNodeMap.__getitem__sC mU +&4&& 6D$$]3D <=) ) rcL|dkry |j|S#t$rYywxYwr6)rrrs rrz#ReadOnlySequentialNamedNodeMap.items2 19 99U# #  s  ##c@tjjdNz"NamedNodeMap instance is read-onlyrCrDrr?s rrHz.ReadOnlySequentialNamedNodeMap.removeNamedItemgg.. 02 2rc@tjjdr$r%rBs rrKz0ReadOnlySequentialNamedNodeMap.removeNamedItemNSr&rc@tjjdr$r%rNs rr:z+ReadOnlySequentialNamedNodeMap.setNamedItemr&rc@tjjdr$r%rNs rrOz-ReadOnlySequentialNamedNodeMap.setNamedItemNSr&rc|jgSr-rrs rrSz+ReadOnlySequentialNamedNodeMap.__getstate__s {rc|d|_yr6rrUs rrWz+ReadOnlySequentialNamedNodeMap.__setstate__s !H rN)r )rrrrrrYrr@rCr8rrHrKr:rOrSrWr rrrrsHI  2222rrz&Number of entries in the NamedNodeMap.c&eZdZdZdZdZdZdZy) Identifiedz@Mix-in class that supports the publicId and systemId attributes.publicIdsystemIdc ||_||_yr-r.)rr/r0s r_identified_mixin_initz!Identified._identified_mixin_init s    rc|jSr-)r/rs r _get_publicIdzIdentified._get_publicId }}rc|jSr-)r0rs r _get_systemIdzIdentified._get_systemIdr5rN)rrrrXrr2r4r7r rrr-r-sJ&I!rr-cReZdZejZdZdZdZdZ dZ dZ dZ dZ ddZy) DocumentTypeNct|_t|_|rt|\}}||_|j|_yr-)rentities notationsr|rr)rr~rrs rrzDocumentType.__init__s:68 79  ( 7 FI!DI  rc|jSr-)internalSubsetrs r_get_internalSubsetz DocumentType._get_internalSubset'"""rc|jtd}|j|_|j|_tj j j}|r\g|j_ g|j_ |jjD]e}t|j|j|j}|jjj||j|||g|jjD]}t!|j|j|j|j"}|j$|_|j&|_|j(|_|jjj||j||||j||||Syr-)rjr9rrrCrDUserDataHandler NODE_CLONEDr;rr<Notationr/r0rcrEntity notationNameactualEncodingrrr)rrkclonerrGnotationeentitys rrlzDocumentType.cloneNode*sY    % &EEJ!YYEN//;;I&(#')$,,A' AJJ KHOO((//9--iHE-++A#AJJ AJJ$%NN4F,-,<,rs rr&zDocumentType.writexmlEs \" TYY == LL $--t}}F G ]] LLdDMMB C    * LL  LL,, - LL  SXrr)rrrr DOCUMENT_TYPE_NODEr$rrr/r0r>rr?rlr&r rrr9r9s:&&HI DHHN"#6 rr9cheZdZdZej ZdZdZdZ dZ dZ dZ dZ dZdZdZdZd Zy) rENcb||_||_t|_|j ||yr-)rrFrr/r2)rrr/r0rIs rrzEntity.__init__\s* $"* ##Hh7rc|jSr-rGrs r_get_actualEncodingzEntity._get_actualEncodingbr@rc|jSr-rrs r _get_encodingzEntity._get_encodinger5rc|jSr-rrrs r _get_versionzEntity._get_versionhrrc@tjjd)Nz(cannot append children to an entity noderCrDrE)rrRs rrIzEntity.appendChildksgg)) 68 8rc@tjjd)Nz+cannot insert children below an entity noder\rs rrAzEntity.insertBeforeosgg)) 9; ;rc@tjjd)Nz*cannot remove children from an entity noder\r^s rrHzEntity.removeChildssgg)) 8: :rc@tjjd)Nz)cannot replace children of an entity noder\rs rr[zEntity.replaceChildwsgg)) 79 9r)rrrrr ENTITY_NODEr$rrGrrrrrTrWrZrIrArHr[r rrrErESsNJHINHG8 #8;:9rrEc.eZdZejZdZdZy)rDNc6||_|j||yr-)rr2)rrr/r0s rrzNotation.__init__s  ##Hh7r)rrrr rr$rrr rrrDrD{s!!HI8rrDc2eZdZgdZdZdZdZdZdZy)DOMImplementation))core1.0)re2.0)reN)rCrf)rCrg)rCN)ls-loadz3.0)rhNcL|dk(rd}|j|f|jvSr)lower _featuresrps rrozDOMImplementation.hasFeatures( b=G )T^^;;rcH|r+|jtjjd|j }|duxr |duxr|du }|s!|rtjj d|rt |\}}|dk(r$|dk7rtjjd|r!|stjjd|j||}|r|j||j||r|x|_|_ ||_ ||_ |S)Nz(doctype object owned by another DOM treezElement with no namerCz$http://www.w3.org/XML/1998/namespacezillegal use of 'xml' prefixz(illegal use of prefix without namespaces) rGrCrDWrongDocumentErr_create_documentInvalidCharacterErrr|rcreateElementNSrIrjdoctypern) rrr~rqradd_root_elementrrrs rcreateDocumentz DOMImplementation.createDocuments. w))5''**:< <##% , 4!4$1T$9!4$+tO5!1''--.DE E  ( 7 FI#IIgg**+HIIlgg**>@@)), FG( OOG $ 9< x7"   8 +#'D  (''%%' ' (s A (A1ch|jD]#}|jtjk(s!|cSyr-)r/r$r rdrNs rrzDocument._get_documentElementds'OOD}} 1 11 $rc|j!|jjd|_tj|yr-)rqrbr rs rrbzDocument.unlinkis/ << # LL   !DL Drc|sy|jjddd}|j|_|j|_|j|_|j D]}t |||}|jj|sJ|j j||jtjk(r|j4J|jtjk(r|jJ||_||_|j#t$j&j(j*|||Sr-)rnrsrrrrr/rirjryrcr$r r%rrOrqrGrrCrDrBrC)rrkrHrG childclones rrlzDocument.cloneNodeos##224tD??  A$Qe4J++66u= ==    # #J /""d&8&88,,444$$(?(??}},,, * $)J !! $$SWW%<%<%H%H%)5 2 rc(t}||_|Sr-)rrj)rrs rcreateDocumentFragmentzDocument.createDocumentFragments  rc*t|}||_|Sr-)rirj)rrrJs r createElementzDocument.createElements G rclt|ts tdt}||_||_|SNznode contents must be a string)rrr;rrarj)rrats rcreateTextNodezDocument.createTextNodes2$$<= = Frclt|ts tdt}||_||_|Sr)rrr;rrarjrrarTs rcreateCDATASectionzDocument.createCDATASections2$$<= = Nrc*t|}||_|Sr-)rrjrs r createCommentzDocument.createComments DMrc,t||}||_|Sr-)rrj)rrraps rcreateProcessingInstructionz$Document.createProcessingInstructions !&$ /rc8t|}||_d|_|Sr)rrjr)rras rcreateAttributezDocument.createAttributes KrcJt|\}}t|||}||_|Sr-)r|rirj)rrr~rrrJs rrpzDocument.createElementNSs+$]3 M< 8rcZt|\}}t||||}||_d|_|Sr)r|rrjr)rrr~rrrs rcreateAttributeNSzDocument.createAttributeNSs4$]3  i @rc0t||||}||_|Sr-)rErj)rrr/r0rFrJs r_create_entityzDocument._create_entitys 48\ :rc.t|||}||_|Sr-)rDrj)rrr/r0rGs r_create_notationzDocument._create_notations T8X .rc||jvr|j|S|js |jsy|j}||jg}||_n|syd}|r|j }|j |jDcgc]}|jtvr|c}|j|}|r.|jjD]}|jrb|j|j|js7||j|j <|j |k(r|}b|j"ron|j%|j&r:||j|j <|j |k(r|}|j"rn|j(s||j|j <|j |k(r|}|j"dk(snenc|j"rW|jjD]:}|j(s||j|j <|j |k(s9|}<| |S|r|Scc}w)Nr>)rrrrrpopextendr/r$rMrrrrrrrrrrr)rr'stackresultrUrgrrrs rgetElementByIdzDocument.getElementByIds  >>"% %4#7#7%% =))*E$)D !99;D LLT__I_E"^^/GG _I J&&t,D!OO224D((;;t'8'8$..I9=DNN4::6#zzR/)-%)%9%9 %499-59tzz2::+%)F!%!5!5!59tzz2::+%)F!11Q6!'5(%% OO224D{{59tzz2::+%)F 5 ! ON IIs Ic,t||tSr-rr?s rrzDocument.getElementsByTagNames.tT8:FFrc.t|||tSr-rrBs rrzDocument.getElementsByTagNameNSrrc:|jj||Sr-)rnrorps rrszDocument.isSupported s""--gw??rc |jtjk(rtjj d|jtj k(rtjj dt|||S)Nzcannot import document nodesz!cannot import document type nodes)r$r r%rCrDNotSupportedErrrOri)rrUrks r importNodezDocument.importNode sa ==D.. .''))*HI I ]]d55 5''))*MN N4t,,rcg}|r|jd|d||jd|rdndd|jddj|d||jD]}|j ||||y) Nz encoding="rz standalone="yesnozrzillegal use of 'xmlns' prefixz$illegal use of the 'xmlns' attribute)rjrCrDrmr$r rdrrrrrrrrrrrrrrrryr)rrGrrrrris_ids r renameNodezDocument.renameNode#s ??$ &''**,0!//CD D ::d//1D1DE E''))JL L ? *d{$(JJsA$6! '&#''*A*AA''..799go&#''*A*AA**(;(;;''..>@@ FI ::,, ,nnG"++A.G  % ::** *AIAF"((+..q1 r)rrrNN)=rrrrr rdrrrOrBrdrnr%r$rrrrGrQrPrGrrrrrrrrrrrTrrrWrrrrZrIrHrrbrlrrrrrrrrprrrrrrrsrr&rr rrrxrxsE@I**D,L,L**D,C,CE'(N!!HHIJJ$((Ok NHJGLKO%(# !(,   *        8tG7@-KO  ; 3rrxrz#Top-level element of this document.c |jj|r%tjjj }n$tjjj }|jtjk(r|j|j|j}|jjD]j}|j|j|j|j |j#|j|j$}|j&|_l|r)|j(D] }t+|||}|j-|"n|jtj.k(rD|j1}|r|j(D] }t+|||}|j-|"n|jtj2k(r|j5|j6}n]|jtj8k(r|j;|j6}n#|jtj<k(r(|j?|j@|j6}n|jtjBk(r|jE|j6}n|jtjFk(r@|jI|j|j}d|_|j |_nG|jtjJk(r|j|usJtjjj }|jLjO|jP|jR|jT}||_|rg|jV_,g|jZ_,|jZjXD]y} t]| j| jR| jT} || _|jZjXj_| ta| dsg| jc|| | {|jVjXD]} te| j| jR| jT| jf} | jh| _4| jj| _5| jl| _6|| _|jVjXj_| ta| ds| jc|| | n+tjjodtq|zta|dr|jc||||S)zo Clone a node and give it the new owner document. Called by Node.cloneNode and Document.importNode TrzCannot clone node %s)9rjryrCrDrBrC NODE_IMPORTEDr$r rdrprrrrrrr}rrr/rirIr?rr`rrarrrrrrrrrrOrnrurr/r0r;rr<rDrcrrrErFrGrrrrrF) rUrknewOwnerDocumentrrHrrrrgrTrGrIrJrKs rriri\s   $$%56GG++77 GG++99  }}))) 001B1B15@OO**,D  !2!2DMM4:: N(():):DNNKA..AK- t-=>!!!$) $55 5 779 t-=>!!!$) $.. ( // : $11 1 33DII> $:: : <r)rr)r~fieldss rr|r|s4  a (F 6{a fQi  rc~||i|}|j\}}|j||j|Sr-)getEvent expandNoder)funcargskwargseventstoktyperootNodes r_do_pulldom_parsers> 4 "6 "F)GX h LLN Orcz||sddlm}|j|Sddlm}t |j|f||dS)z3Parse a file into a DOM by filename or file object.r expatbuilderpulldom)parserbufsize)xml.domrparserr)filerrrrs rrrs? ~g(!!$''# ' 24 4rct|ddlm}|j|Sddlm}t |j|fd|iS)z&Parse a file into a DOM from a string.rrrr)rr parseStringrr)stringrrrs rrrs? ~(''//# !4!4vi"*F!35 5rc|rQt|trtj|}|D]'\}}tj j ||r'ytj Sr-)rrr_parse_feature_stringrxrnro)featuresfvs rgetDOMImplementationrsT h $33H=HDAq**55a;  " ""rrr-)6rXr rrCrrrrxml.dom.minicompatxml.dom.xmlbuilderrr rDr rdrrM defpropertyrXrrrrrobjectr AttributeListr\rrirrrrrrrrrrr-r9rErDrdrzrNrxrir|rrrrr rrrs" JJ > GGLL55GGLL>>@t377<<tl D,$@A D+$?@ D+$HI%t%$z84z8x D&$FG D+$MN D,$EFa?6a?F L(68 v( D$ M"dM"^ G\<> G[79  &;&;RNItN4ECItECN M8)EFS+=S+j D0./ D+@B Bm B 34 3<V<| *H8:  ::y$:x&9Z&9P8z9d8M+M^(&(T2QtZQf  H'57Od!45#rPK]=(( NodeFilter.cpython-312.opt-1.pycnu[ ֦iGddZy)cVeZdZdZdZdZdZdZdZdZ dZ dZ dZ d Z d Zd Zd Zd ZdZdZdZy) NodeFilterzL This is the DOM2 NodeFilter interface. It contains only constants. l @iiict)N)NotImplementedError)selfnodes +/usr/lib64/python3.12/xml/dom/NodeFilter.py acceptNodezNodeFilter.acceptNodes!!N)__name__ __module__ __qualname____doc__ FILTER_ACCEPT FILTER_REJECT FILTER_SKIPSHOW_ALL SHOW_ELEMENTSHOW_ATTRIBUTE SHOW_TEXTSHOW_CDATA_SECTIONSHOW_ENTITY_REFERENCE SHOW_ENTITYSHOW_PROCESSING_INSTRUCTION SHOW_COMMENT SHOW_DOCUMENTSHOW_DOCUMENT_TYPESHOW_DOCUMENT_FRAGMENT SHOW_NOTATIONrrrrrscMMK",H",L",N",I",",",K",",L",M",",",M"rrN)rr)rrr*s""rPK]/  minicompat.cpython-312.opt-2.pycnu[ ֦i' N gdZddlZefZGddeZGddeZdZ y))NodeList EmptyNodeList StringTypes defpropertyNc>eZdZdZdZdZdZeeedZdZ y) rc:d|cxkrt|kr||SyyNrlenselfindexs +/usr/lib64/python3.12/xml/dom/minicompat.pyitemz NodeList.item5s"  !D !;  "ct|SNr rs r _get_lengthzNodeList._get_length9s 4yrc@tjjdNz.attempt to modify read-only attribute 'length'xmldomNoModificationAllowedErrrvalues r _set_lengthzNodeList._set_length<gg.. <> >r$The number of nodes in the NodeList.docc|g}||ddyrr)rstates r __setstate__zNodeList.__setstate__Ds =EQrN) __name__ __module__ __qualname__ __slots__rrrpropertylengthr&rrrrr2s/I>k;@BFrrcDeZdZdZdZdZdZdZdZe eedZ y ) rrc<t}|j||SrrextendrotherNLs r__add__zEmptyNodeList.__add__M Z % rc<t}|j||Srr/r1s r__radd__zEmptyNodeList.__radd__Rr5rcyrrr s rrzEmptyNodeList.itemWsrcyr rrs rrzEmptyNodeList._get_lengthZsrc@tjjdrrrs rrzEmptyNodeList._set_length]r rr!r"N) r'r(r)r*r4r7rrrr+r,rrrrrJs4I  >k;@BFrrcbt|d|z}|fd}t|||}t|||y)N_get_cXtjjdt|z)Nz&attempt to modify read-only attribute )rrrrepr)rrnames rsetzdefproperty..setgs'gg.. 4tDz AC Crr")getattrr+setattr)klassr?r#getr@props rrres7 %'D. *C"C C# &D E4r) __all__xml.domrstrrlistrtuplerrrrrrKs<T Ff t0BEB6rPK]0ݶ minicompat.cpython-312.opt-1.pycnu[ ֦i' PdZgdZddlZefZGddeZGddeZ dZ y) zPython version compatibility support for minidom. This module contains internal implementation details and should not be imported; use xml.dom.minidom instead. )NodeList EmptyNodeList StringTypes defpropertyNc>eZdZdZdZdZdZeeedZdZ y) rc:d|cxkrt|kr||SyyNrlenselfindexs +/usr/lib64/python3.12/xml/dom/minicompat.pyitemz NodeList.item5s"  !D !;  "ct|SNr rs r _get_lengthzNodeList._get_length9s 4yrc@tjjdNz.attempt to modify read-only attribute 'length'xmldomNoModificationAllowedErrrvalues r _set_lengthzNodeList._set_length<gg.. <> >r$The number of nodes in the NodeList.docc|g}||ddyrr)rstates r __setstate__zNodeList.__setstate__Ds =EQrN) __name__ __module__ __qualname__ __slots__rrrpropertylengthr&rrrrr2s/I>k;@BFrrcDeZdZdZdZdZdZdZdZe eedZ y ) rrc<t}|j||SrrextendrotherNLs r__add__zEmptyNodeList.__add__M Z % rc<t}|j||Srr/r1s r__radd__zEmptyNodeList.__radd__Rr5rcyrrr s rrzEmptyNodeList.itemWsrcyr rrs rrzEmptyNodeList._get_lengthZsrc@tjjdrrrs rrzEmptyNodeList._set_length]r rr!r"N) r'r(r)r*r4r7rrrr+r,rrrrrJs4I  >k;@BFrrcbt|d|z}|fd}t|||}t|||y)N_get_cXtjjdt|z)Nz&attempt to modify read-only attribute )rrrrepr)rrnames rsetzdefproperty..setgs'gg.. 4tDz AC Crr")getattrr+setattr)klassr?r#getr@props rrres7 %'D. *C"C C# &D E4r) __doc____all__xml.domrstrrlistrtuplerrrrrrLs<T Ff t0BEB6rPK]= BBpulldom.cpython-312.opt-2.pycnu[ ֦iu-ddlZddlZdZdZdZdZdZdZdZ d Z Gd d ejjZ Gd d ZGddZGdde ZdZddZddZy)N START_ELEMENT END_ELEMENTCOMMENTSTART_DOCUMENT END_DOCUMENTPROCESSING_INSTRUCTIONIGNORABLE_WHITESPACE CHARACTERSc|eZdZdZdZddZdZdZdZdZ dZ dZ d Z d Z d Zd Zd ZdZdZdZdZdZy)PullDOMNc6ddlm}||_ddg|_|j|_g|_|j j |_ |j j|_|dig|_ |jd|_ g|_ y#t$rY1wxYw)Nr) XML_NAMESPACExml) xml.domrdocumentFactory firstEvent lastEvent elementStackappendpushpopAttributeError _ns_contexts_current_contextpending_events)selfrrs (/usr/lib64/python3.12/xml/dom/pulldom.py__init__zPullDOM.__init__s).,%%,,  ((,,DH,E23 $ 1 1" 5     s B BBc>|jd}|jd=|SNr)r)rresults rrz PullDOM.pop!s%""2&   b ! c||_yN)_locator)rlocators rsetDocumentLocatorzPullDOM.setDocumentLocator&s  r#ct|dsg|_|jj|xsd|f|jj|jj |xsd|j|<y)N _xmlns_attrsxmlns)hasattrr*rrrcopy)rprefixuris rstartPrefixMappingzPullDOM.startPrefixMapping)sit^, "D    &"3GS!9:   !6!6!;!;!=>%+^tc"r#cB|jj|_yr%)rrr)rr.s rendPrefixMappingzPullDOM.endPrefixMapping0s $ 1 1 5 5 7r#cd}t|dd}|"|D]\}}||j||f<g|_|\}} |rZ||j|} | r | dz| z}n| }|jr|jj ||} nM|j ||} n:|jr|jj| } n|j d| } |jD]\}}|\} } | |k(r;| dk(r| }nd| z}|jj| |}| j|nx| rJ|j| } | r | dz| z}n| }|jj| |}| j|n,|jj| }| j|||_ t| fdg|jd<|jd|_|j!| y)Nzhttp://www.w3.org/2000/xmlns/r*:r+zxmlns:)getattr_attrsr*rdocumentcreateElementNS buildDocument createElementitemscreateAttributeNSsetAttributeNodeNScreateAttributesetAttributeNodevaluerrr)rnametagNameattrs xmlns_uri xmlns_attrsanamerAr/ localnamer.nodea_uri a_localnameqnameattrs rstartElementNSzPullDOM.startElementNS3s3 dND9  " + u38 i/0!, "D Y ..s3$slY6G'G}}}}44S'B))#w7}}}}229=))$ : ;;=KE%!& E; !')'E${2E}}66ueD''-..u5"SL;6E'E}}66ueD''-}}44[A%%d+DJ)),,T2D9q* $r#cvt|jfdg|jd<|jd|_yNr5rrr)rrBrCs r endElementNSzPullDOM.endElementNSl0)488:6=q*r#c|jr|jj|}n|jd|}|jD]8\}}|jj |}||_|j |:t|fdg|jd<|jd|_|j|yrP) r8r;r:r<r?rAr@rrr)rrBrDrIrGrArMs r startElementzPullDOM.startElementps ====..t4D%%dD1D ;;=KE%==007DDJ  ! !$ ') ,T2D9q* $r#cvt|jfdg|jd<|jd|_yrPrQ)rrBs r endElementzPullDOM.endElementrSr#c|jrG|jj|}t|fdg|jd<|jd|_yt|fdg}|jj |yrP)r8 createCommentrrrr)rsrIevents rcommentzPullDOM.commentsf ====..q1D")4$ 7DNN1 !^^A.DNq\4(E    & &u -r#c|jrH|jj||}t|fdg|jd<|jd|_yt||fdg}|jj |yrP)r8createProcessingInstructionrrrr)rtargetdatarIr[s rprocessingInstructionzPullDOM.processingInstructionsl ====<}}++E22D94@q*r#c|jj|}t|fdg|jd<|jd|_yrP)r8rcr rrds r characterszPullDOM.characterss>}}++E2($/6q*r#c|j4ddl}|jjjj |_yy)Nr)rxml.dom.minidomdomminidomDocumentimplementation)rrs r startDocumentzPullDOM.startDocuments2    ' "#&77??#;#;#J#JD  (r#cR|jj||d}||_t|fdg|jd<|jd|_|j ||j D]}|ddtk(r1|d\}}}|jj||}t|f|d<nN|ddtk(r-|jj|dd}t|f|d<ntd|dd||jd<||_d|_|jS)Nr5rzUnknown pending event ) rcreateDocumentr8rrrrrr^rrYAssertionError firstChild) rr/tagnamerIe_r_r`ns rr:zPullDOM.buildDocuments$##223F ,d3T:q* $$$AtAw00 !! &MM==fdK.2!1aG#MM//!Q8|!$%=ad1gFF !DNN1 DN%#r#cft|jfdg|jd<|jyrP)rr8rrrs r endDocumentzPullDOM.endDocuments'*DMM:DAq  r#c d|_yr%)r8rys rclearz PullDOM.clears 8 r#r%)__name__ __module__ __qualname__r&r8rrr(r0r2rNrRrUrWr\rarfrhror:rzr|r#rr r scHH!   487r+ +..+ + K 0r#r ceZdZdZdZdZy) ErrorHandlerct|yr%)printr exceptions rwarningzErrorHandler.warnings  ir#c|r%rrs rerrorzErrorHandler.errorr#c|r%rrs r fatalErrorzErrorHandler.fatalErrorrr#N)r}r~rrrrrr#rrrsr#rcBeZdZdZdZdZdZdZdZdZ dZ d Z y ) DOMEventStreamc||_||_||_t|jds|j|_|j y)Nfeed)streamparserbufsizer,_slurpgetEventreset)rrrrs rrzDOMEventStream.__init__s9   t{{F+ KKDM r#ct|_|jjtj j jd|jj|jyrP) r pulldomr setFeaturersaxhandlerfeature_namespacessetContentHandlerrys rrzDOMEventStream.resetsCy  swwAA1E %%dll3r#c6|j}|r|Str%)r StopIterationrrcs r__next__zDOMEventStream.__next__s ]]_ Ir#c|Sr%rrys r__iter__zDOMEventStream.__iter__s r#c|j}|g}|rb|\}}||ury|tk7r|dj||tk(r|j |n |tk(r|d=|j}|rayyr!)rr appendChildrr)rrIr[parentstokencur_nodes r expandNodezDOMEventStream.expandNodesx &#OE84 # ''1 %x(+%BKMMOEr#c@|jjds%|jj|j_|jjdsw|jj |j }|s|j jy|j j||jjdsw|jjdd}|jjdd|jjd<|SNr5r) rrrrreadrrcloser)rbufrs rrzDOMEventStream.getEvents||&&q)%)\\%<%sM!"C(&-! $$& &&' 22r#cddlm}t|}||}|stjj }t |||S)Nr)StringIO)iorlenrrrr)stringrrrrs r parseStringrIs<&kG 6 C $$& #vw //r#)NNr%)xml.saxrxml.sax.handlerrrrrrrr r rContentHandlerr rrrrrrrr#rrs  ! 1-  ucgg$$unMM^%g%B! 30r#PK]:22expatbuilder.cpython-312.pycnu[ ֦im dZddlmZmZmZddlmZmZmZddlm Z ddl m Z m Z ddl mZejZej Zej"Zej$j&Zej$j(Zej$j*Zej$j,Zej.Zej2ddej2dd ej2dd ej2dd ej2dd ej2dd ej2ddej2ddej2ddd ZGddeZdZdZGddZeeefZ GddeZ!GddeZ"Gdde"Z#Gdde"Z$d Z%d!e%zZ&Gd"d#eZ'Gd$d%Z(Gd&d'e(eZ)Gd(d)e(e'Z*Gd*d+e+Z,Gd,d-eZ-d3d.Z.d3d/Z/d3d0Z0d3d1Z1d2Z2y)4zFacility to use the Expat parser to load a minidom instance from a string or file. This avoids all the overhead of SAX and pulldom to gain performance. ) xmlbuilderminidomNode)EMPTY_NAMESPACE EMPTY_PREFIXXMLNS_NAMESPACE)expat) _append_child_set_attribute_node) NodeFilterNcdata enumerationentityentitiesididrefidrefsnmtokennmtokens) CDATAENUMENTITYENTITIESIDIDREFIDREFSNMTOKENNMTOKENScHeZdZdZd dZdZdZdZdZdZ d Z d Z d Z y) ElementInfo _attr_info_modeltagNameNc.||_g|_||_yN)r$r"r#)selfr$models -/usr/lib64/python3.12/xml/dom/expatbuilder.py__init__zElementInfo.__init__?s  cH|j|j|jfSr&r!r's r) __getstate__zElementInfo.__getstate__Ds T\\99r+c.|\|_|_|_yr&r!)r'states r) __setstate__zElementInfo.__setstate__Gs5:2dlr+c|jD]0}|d|k(s |d}|ddk(r tdcSt|dcStjS)Nr(r)r" _typeinfo_mapr_no_type)r'anameinfots r)getAttributeTypezElementInfo.getAttributeTypeJsXOODAw%HQ43;(00(b22 $r+c"tjSr&)rr7)r' namespaceURI localNames r)getAttributeTypeNSzElementInfo.getAttributeTypeNSTsr+c|jrE|jd}|tjjtjjfvSyNrF)r#r r( XML_CTYPE_ANYXML_CTYPE_MIXED)r'types r)isElementContentzElementInfo.isElementContentWsF ;;;;q>D 9 9 % ; ; == =r+cp|jr*|jdtjjk(SyrA)r#r r(XML_CTYPE_EMPTYr-s r)isEmptyzElementInfo.isEmpty_s) ;;;;q>U[[%@%@@ @r+cJ|jD]}|d|k(s |ddk(cSy)Nr3r4rF)r")r'r8r9s r)isIdzElementInfo.isIdes0OODAw%Bx4''$r+c(|j||fSr&)rJ)r'eurienameaurir8s r)isIdNSzElementInfo.isIdNSksyy$''r+r&) __name__ __module__ __qualname__ __slots__r*r.r1r;r?rErHrJrOr+r)r r <s41I :;    (r+r c&|j||Sr&)_intern_setdefault)builderss r)_internrYos  % %a ++r+c6d|vsJ|jd}|j}t|dk(r)|\}}}|||}|d|}|||}|||}n3t|dk(r|\}}t}|||x}}nt d|z||||||fS)N :z4Unsupported syntax: spaces in URIs not supported: %r)splitrVlenr ValueError)rWnamepartsinternuri localnameprefixqnames r)_parse_ns_namerirs $;; JJsOE  ' 'F 5zQ!&Y'!9-ue$9i0 UqY"9i88 ORVVWW #s Y 55r+ceZdZdZddZdZdZdZdZdZ d Z d Z d Z d Z d ZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZy) ExpatBuilderzPDocument builder that uses Expat to build a ParsedXML.DOM document instance.Nc|tj}||_|jj%t |jj|_nd|_t |_d|_|jyr&) rOptions_optionsfilterFilterVisibilityController_filterr_finish_start_element_parserreset)r'optionss r)r*zExpatBuilder.__init__sc ? ((*G ==   +5dmm6J6JKDLDL*,D &  r+c*tjS)zCreate a new parser object.)r ParserCreater-s r) createParserzExpatBuilder.createParsers!!##r+cB|js|j|_|jjj|_d|j_d|j_d|j_|j|j|jS)z7Return the parser object, creating a new one if needed.T) rsrxrd setdefaultrV buffer_textordered_attributesspecified_attributesinstallr-s r) getParserzExpatBuilder.getParserso||,,.DL&*ll&9&9&D&DD #'+DLL $.2DLL +04DLL - LL &||r+ctjtdd|_|j|_|jj |_d|_y)z6Free all data structures used during DOM construction.NF)theDOMImplementationcreateDocumentrdocumentcurNode _elem_info_cdatar-s r)rtzExpatBuilder.resets>,;; T4) }} --22 r+c|j|_|j|_|j|_|j |_|jjr|j|_ |j|_ |jjr|j|_|jj"r4|j$|_|j(|_|j,|_n|j0|_|j2|_|j6|_|j:|_|j>|_ y)z>Install the callbacks needed to build the DOM into the parser.N)!start_doctype_decl_handlerStartDoctypeDeclHandlerfirst_element_handlerStartElementHandlerend_element_handlerEndElementHandler pi_handlerProcessingInstructionHandlerrnrentity_decl_handlerEntityDeclHandlernotation_decl_handlerNotationDeclHandlercommentscomment_handlerCommentHandlercdata_sectionsstart_cdata_section_handlerStartCdataSectionHandlerend_cdata_section_handlerEndCdataSectionHandlercharacter_data_handler_cdataCharacterDataHandlercharacter_data_handlerexternal_entity_ref_handlerExternalEntityRefHandlerxml_decl_handlerXmlDeclHandlerelement_decl_handlerElementDeclHandlerattlist_decl_handlerAttlistDeclHandlerr'parsers r)r~zExpatBuilder.installs*.)H)H&%)%?%?"#'#;#; .2oo+ == ! !'+'?'?F $%)%?%?" == ! !$($8$8F ! == ' '.2.N.NF +,0,J,JF )*.*K*KF '*.*E*EF '*.*J*J' $ 5 5$($=$=!$($=$=!r+c||j}d} |jdx}rQ|j|d|r'|jjr|j |d}|jdx}rQ|jdd|j}|jd|_|S#t $rY0wxYw)zIParse a document from a file object, returning the document node.Ti@Fr+N) rreadParserdocumentElement _setup_subset ParseEscapertrs)r'filer first_bufferbufferdocs r) parseFilezExpatBuilder.parseFiles!   IIg..&. VU+DMM$A$A&&v.$ !IIg..&. LLd #mm      sA#B/8B// B;:B;c|j} |j|d|j||j}|j d|_|S#t$rY0wxYw)z*>DLL '48OO 14<<')D $$0r+c|jj||}t|j||jr?|jj |t k(r|jj|yyyr&)rcreateProcessingInstructionr rrqrr removeChild)r'targetdatanodes r)rzExpatBuilder.pi_handler s]}}88FdllD) <DII$EDI <<>DDI!%D dllD)r+c2|jj}|r0|djtk(r|d}|j|z|_yt j }|j|z|_|j|_t|j|yr) rrrrrrrrrr )r'rrrs r)rz#ExpatBuilder.character_data_handler#sv\\,, *R.11Y>b>D D(DI ||~II$ !]]dllD)r+c |ry|jjsy|jj||||}|6|jj |} |j j | |jjjjj ||jrO|jj|tk(r,|jjjjd=yyyr) rnrr_create_entitycreateTextNoderappendrrrqrr) r' entityNameis_parameter_entityrbaserr notationNamerchilds r)rz ExpatBuilder.entity_decl_handler.s  }}%% }}++J,4lD  MM007E OO " "5 ) &&++2248 <.& :O**+ *( *8$9 + %%5 -".* !$" B1r+rkc:eZdZdZdZdZdZdZeje jeje jeje jej e j"ej$e j&ej(e j*ej,e j.ej0e j2ej4e j6ej8e j:ej<e j>ej@e jBi Z"y)rpzoWrapper around a DOMBuilderFilter which implements the checks to make the whatToShow filter attribute work.roc||_yr&r)r'ros r)r*z#FilterVisibilityController.__init__s  r+c|j|j}|jj|zrK|jj |}|t k(rt |tvrtdt|z|StS)Nz)startContainer() returned illegal value: ) _nodetype_maskrro whatToShowrFILTER_INTERRUPTr_ALLOWED_FILTER_RETURNSrareprr)r'rmaskvals r)rz)FilterVisibilityController.startContainersz""4==1 ;; ! !D (++,,T2C&&!!11 ADIMOOJ r+c|j|j}|jj|zr|jj |}|t k(rt |tk(r7|j}|jddD]}|j|tS|tvrtdt|z|StS)Nz%acceptNode() returned illegal value: )rrrorrrrrrr appendChildrr rar!r)r'rr"r#parentrs r)rz%FilterVisibilityController.acceptNodes""4==1 ;; ! !D (++((.C&&!!k!!__Q/E&&u-0%$11 =S IKKJ r+N)#rPrQrRrrSr*rrr ELEMENT_NODEr SHOW_ELEMENTATTRIBUTE_NODESHOW_ATTRIBUTEr SHOW_TEXTrSHOW_CDATA_SECTIONENTITY_REFERENCE_NODESHOW_ENTITY_REFERENCE ENTITY_NODE SHOW_ENTITYPROCESSING_INSTRUCTION_NODESHOW_PROCESSING_INSTRUCTION COMMENT_NODE SHOW_COMMENT DOCUMENT_NODE SHOW_DOCUMENTDOCUMENT_TYPE_NODESHOW_DOCUMENT_TYPEDOCUMENT_FRAGMENT_NODESHOW_DOCUMENT_FRAGMENT NOTATION_NODE SHOW_NOTATIONrrTr+r)rprps5I !!* **A*A **C*C **>*> **G*G ""**J*J **@*@ ((**P*P **A*A **B*B **G*G ##**K*K **B*B  Nr+rpceZdZdZdZy) FilterCrutch)_builder_level _old_start_old_endcd|_||_|j}|j|_|j |_|j|_|j|_yr) r@r?rsrrArrBrr)r'rWrs r)r*zFilterCrutch.__init__sO   4400 %)%?%?"#'#;#; r+N)rPrQrRrSr*rTr+r)r>r>s >Ic"eZdZdZdZdZdZy)rrTcptj|||j}dD]}t||dy)N)rrrrrr)r>r*rssetattr)r'rWrrbs r)r*zRejecter.__init__s5dG,D FD$ 'r+c,|jdz|_yr)r@r'argss r)rzRejecter.start_element_handlerskkAo r+c|jdk(rT|jj}|jj||j|_|j |_y|jdz |_yNrr3)r@r?rsr~rArrBr)r'rIrs r)rzRejecter.end_element_handlersV ;;! ]]**F MM ! !& ))-F &'+}}F $++/DKr+N)rPrQrRrSr*rrrTr+r)rr sI (&*r+rceZdZdZdZdZy)rrTc|jj}|j||jj|ur|jdz|_yyr)r?rrAr@)r'rIrs r)rzSkipper.start_element_handler*sE}}$$ ==  ,++/DK -r+c |jdk(rR|j|jj_|j |jj_d|_y|jdz |_|j |yrK)r@rAr?rsrrBrrHs r)rzSkipper.end_element_handler0s` ;;! 9=DMM ! ! 56:mmDMM ! ! 3 DM++/DK DMM4 r+N)rPrQrRrSrrrTr+r)rr'sI* !r+rz8http://xml.python.org/entities/fragment-builder/internalz %%s ]> &fragment-builder-internal;c<eZdZdZd dZdZdZdZdZdZ d Z y) FragmentBuilderzBuilder which constructs document fragments given XML source text and a context node. The context node is expected to provide information about the namespace declarations which are in scope at the start of the fragment. Nc|jtk(r||_||_n|j|_||_t j ||yr&)rr5originalDocumentrrrkr*)r'rrus r)r*zFragmentBuilder.__init__XsD   } ,$+D !"DL$+$9$9D !"DLdG,r+c<tj|d|_yr&)rkrtfragmentr-s r)rtzFragmentBuilder.resetas4  r+c@|j|jS)zRParse a document fragment from a file object, returning the fragment node.)rrr'rs r)rzFragmentBuilder.parseFilees ,,r+c||_|j}|jj}d}|rd|jxs|j }|j rd|j d|jd}n|jrd|jz}nd}|j}t|||fz} |j|d|j}|j|S#|jxYw)zMParse a document fragment from a string, returning the fragment node.zPUBLIC "z" ""z SYSTEM "%s"T) _sourcerrRrr_getDeclarationsrr _getNSattrs_FRAGMENT_BUILDER_TEMPLATErrtrT) r'rrridentrnsattrsrrTs r)rzFragmentBuilder.parseStringjs !''// ++Ft/D/D/FF#,,g.>.>@!!%(8(88F""$-0HH  LL4 (==    JJL s 5C%%C8c:|jjj}d}|rut|jj D]s}|jj |}|r|dz}|d|j}|jr |d|jd|jd}b|d|jd}ut|jj D]}|jj |}|r|dz}|d|j}|jr |d|jd|jd }n;|jr|d|jd }n|d |jjd }|jr|d |j}|d z}|S) zRe-create the internal subset from the DocumentType node. This is only needed if we don't already have the internalSubset as a string. rXz z z SYSTEM "z )rrrrrlengthitemnodeNamerrr firstChildrr)r'rrXrnotationrs r)r[z FragmentBuilder._getDeclarationssc ,,,,44  7,,334",,11!4F A)*H,=,=>$$h//1B1BDA./0A0ABA57++223 ))..q1F A'(&//:??foov@A__,-v?A%&(9(9(>(>?A&&,-v/B/BCAG4r+cy)NrXrTr-s r)r\zFragmentBuilder._getNSattrssr+c|tk(r|j}|j}|jj |}|j |_|jj |_|j|_ |j|jd||_||_d|_ ytj|||||S#||_||_d|_ wxYw)NTr) $_FRAGMENT_BUILDER_INTERNAL_SYSTEM_IDrrrsExternalEntityParserCreaterRcreateDocumentFragmentrTrrZrkr)r'rrrr old_document old_cur_noders r)rz+FragmentBuilder.external_entity_ref_handlers ; ; ==L<|jj||fy)z/Push this namespace declaration on our storage.N)rqr)r'rgres r)rxz'Namespaces.start_namespace_decl_handlers !!((&#7r+cd|vrt||\}}}}nt}|}d}t}tj||||}|j |_t|j|||_|jr|jD]u\}}|r*tjt|d|zt|d}n tjdtdt}||_ |j |_t||w|jdd=|r|j|j } |j"} t%dt'|dD]} || } || dz} d| vr6t|| \}}}}tj||||}|| |<|| ||f<n0tj| t| t}|| | <|| t| f<|j |_| |_ ||_yy)Nr[xmlns:xmlnsrr^r3)rirrrElementrrr rrqrrYrrr _ensure_attributes_attrs_attrsNSrr` ownerElement)r'rbrrerfrgrhrrrrrr8rs r)rz Namespaces.start_element_handlers $;,:4,F )CFE!CEI!Fuc69=!]]dllD)  $ $#88  WT8f3D%E%4fgGA Wo%,lrgrdrrr)r'rbrrerfrgrhs r)rzNamespaces.end_element_handlersllGd{0>tT0J-Y,,3#--:#NNf4???5 ''4/@?@/++>DCD>"--DL  $ $W -r+N) rPrQrRrrrrxr~rxrrrTr+r)roros)A'  38-&^  .r+roceZdZdZdZy)ExpatBuilderNSz*Document builder that supports namespaces.cNtj||jyr&)rkrtrrr-s r)rtzExpatBuilderNS.reset&s4  r+N)rPrQrRrrtrTr+r)rr#s 4r+rceZdZdZdZdZy)FragmentBuilderNSz*Fragment builder that supports namespaces.cNtj||jyr&)rPrtrrr-s r)rtzFragmentBuilderNS.reset.sd# r+cd}|j}g}|rtt|drY|jjD]<\}}||vr |j ||rd|z}nd}|r |d|d|d}4d|d|d}>|j }|rt|S) zNReturn string of namespace attributes from this element and ancestors.rX_ns_prefix_urir|r}z z=''r[)rhasattrritemsrr)r'attrsrr rgredeclnames r)r\zFragmentBuilderNS._getNSattrs2s,, w 01#*#9#9#?#?#AKFC{ HHV$#+f#4#*5:Hc J/7 <$B((G  r+N)rPrQrRrrtr\rTr+r)rr+s4r+rceZdZdZy)rzEException raised to short-circuit parsing in InternalSubsetExtractor.N)rPrQrRrrTr+r)rrPsOr+rc>eZdZdZdZdZdZdZdZdZ dZ d Z y) rzBXML processor which can rip out the internal document type subset.Nc|jS)z'Return the internal subset as a string.)rr-s r)rz!InternalSubsetExtractor.getSubsetYs {{r+cP tj||y#t$rYywxYwr&)rkrrrVs r)rz!InternalSubsetExtractor.parseFile]s)   " "4 .     %%cP tj||y#t$rYywxYwr&)rkrr)r'rs r)rz#InternalSubsetExtractor.parseStringcs)   $ $T6 2   rcH|j|_|j|_yr&)rrrrrs r)r~zInternalSubsetExtractor.installis)-)H)H&%)%?%?"r+c|rD|j}g|_|jj|_|j|_yt r&)rrrDefaultHandlerrrr)r'rbrrrrs r)rz2InternalSubsetExtractor.start_doctype_decl_handlerms@ ^^%FDK$(KK$6$6F !+/+H+HF (- r+cdj|jjddjdd}||_t)NrXz   )joinrreplacer)r'rXs r)rz0InternalSubsetExtractor.end_doctype_decl_handlerws= GGDKK ( ( 6 > >tT J mr+ctr&)r)r'rbrs r)rz-InternalSubsetExtractor.start_element_handler|s mr+) rPrQrRrrrrrr~rrrrTr+r)rrTs.L F  @  r+rc|r t}n t}t|tr(t |d5}|j |}ddd|S|j |}|S#1swYSxYw)z{Parse a document, returning the resulting Document node. 'file' may be either a file name or an open file object. rbN)rrk isinstancestropenr)r namespacesrWfpresults r)parsersl  ".$ $ &&r*F M""4( M  Ms A##A-cR|r t}n t}|j|S)zOParse a document from a string, returning the resulting Document node. )rrkr)rrrWs r)rrs' ".   v &&r+c|r t|}n t|}t|tr(t |d5}|j |}ddd|S|j |}|S#1swYSxYw)zParse a fragment of a document, given the context from which it was originally extracted. context should be the parent of the node(s) which are in the fragment. 'file' may be either a file name or an open file object. rN)rrPrrrr)rrrrWrrs r) parseFragmentrsq#G,!'*$ $ &&r*F M""4( M  Ms A%%A/cV|r t|}n t|}|j|S)zParse a fragment of a document from a string, given the context from which it was originally extracted. context should be the parent of the node(s) which are in the fragment. )rrPr)rrrrWs r)parseFragmentStringrs, #G,!'*   v &&r+cF|jr t|St|S)z,Create a builder based on an Options object.)rrrk)rus r) makeBuilderrs!g&&G$$r+)T)3rxml.domrrrrrr xml.parsersr xml.dom.minidomr r xml.dom.NodeFilterr rrr5DOMBuilderFilterrrrrgetDOMImplementationrTypeInfor6objectr rYrirkr rpr>rrrir]rProrr ExceptionrrrrrrrrTr+r)rs/:.-BB>) NN ,,"" ++99 ++99 ))55 ..??3w335!  w/   }5   x0   z2   t,   w/   x0   y1   z2  1(&1(f,6&y1y1| )-E7 7 t <6 <*|*8!l!2?%*+ +r9lr9j\.\.~Z" O"J ) )l)X$'( '%r+PK]z NodeFilter.cpython-312.opt-2.pycnu[ ֦iGddZy)cTeZdZ dZdZdZdZdZdZdZ dZ dZ dZ d Z d Zd Zd Zd ZdZdZy) NodeFilterl @iiict)N)NotImplementedError)selfnodes +/usr/lib64/python3.12/xml/dom/NodeFilter.py acceptNodezNodeFilter.acceptNodes!!N)__name__ __module__ __qualname__ FILTER_ACCEPT FILTER_REJECT FILTER_SKIPSHOW_ALL SHOW_ELEMENTSHOW_ATTRIBUTE SHOW_TEXTSHOW_CDATA_SECTIONSHOW_ENTITY_REFERENCE SHOW_ENTITYSHOW_PROCESSING_INSTRUCTION SHOW_COMMENT SHOW_DOCUMENTSHOW_DOCUMENT_TYPESHOW_DOCUMENT_FRAGMENT SHOW_NOTATIONrrrrrscMMK",H",L",N",I",",",K",",L",M",",",M"rrN)rr(rrr)s""rPK]1#__init__.cpython-312.opt-2.pycnu[ ֦iUp8ddlZddlZddlZddlZddlZddlZddlZddlZddlZddl Z ddl Z ddl Z ddl Z ddl Z ddlZddlZddlZddlmZmZddlmZmZddlmZmZddlmZmZddlmZmZddlmZdd l m!Z!dd l"m#Z#dd l m$Z$dd l%m&Z&m'Z'm(Z(m)Z)gd Z*Gdde+Z,GddZ-GddZ.Gdde.Z/Gdde0Z1GddejdZ3GddZ4GddZ5Gdde5Z6Gd d!e#Z7Gd"d#Z8Gd$d%Z9Gd&d'Z:Gd(d)e7Z;Gd*d+e6Zd.ej:fd/Z?d0Z@e jeejd12ZC d.e1fd3ZDd4ZEd5ZFd.e'eGe&eGffd6ZHd7ZId8ZJy)9N) _adapters_meta)FreezableDefaultDictPair) method_cache pass_none)always_iterableunique_everseen)PackageMetadata SimplePath)suppress) import_module)MetaPathFinder)starmap)ListMappingOptionalcast) DistributionDistributionFinderr PackageNotFoundError distribution distributions entry_pointsfilesmetadatapackages_distributionsrequiresversionc$eZdZ dZedZy)rc d|jS)Nz"No package metadata was found for nameselfs 4/usr/lib64/python3.12/importlib/metadata/__init__.py__str__zPackageNotFoundError.__str__3s3DII;??c"|j\}|SN)argsr&r$s r'r$zPackageNotFoundError.name6s)) r)N)__name__ __module__ __qualname__r(propertyr$r)r'rr0s$@r)rceZdZ ejdj ZedZe ddZ e dZ y) Sectionedzm [sec1] # comments ignored a = 1 b = 2 [sec2] a = 2 cJd|j||jDS)Nc3K|]?}|j1|jtj|jAyw)N)value)r$_replacerparser7).0sections r' z*Sectioned.section_pairs..gs= <||'   4::gmm#<  =zSectioned.readmsrwCIIt/@ ABE!,,S1IennS6IM{{4(tU# # sBBc.|xr|jd S)N#)rK)lines r'r?zSectioned.validxs0DOOC000r)r+) r.r/r0textwrapdedentlstrip_sample classmethodrB staticmethodr>r?r2r)r'r4r4<sf8hoo   fh   $$11r)r4cTeZdZ ejej dedZdZ y)DeprecatedTuplezAEntryPoint tuple interface is deprecated. Access members by name. stacklevelcH|j|j|Sr+)_warn_key)r&items r' __getitem__zDeprecatedTuple.__getitem__s yy{4  r)N) r.r/r0 functoolspartialwarningswarnDeprecationWarningr^rar2r)r'rYrY}s0  I   K  E!r)rYceZdZU ejdZ eed<eed<eed<dZe ded<dZ d Z e d Z e d Ze d Zd ZdZdZdZdZdZdZdZy) EntryPointzH(?P[\w.]+)\s*(:\s*(?P[\w.]+)\s*)?((?P\[.*\])\s*)?$r$r7groupNrdistc>t|j|||y)Nr$r7rivarsupdate)r&r$r7ris r'__init__zEntryPoint.__init__s T t5>r)c |jj|j}t|j d}t d|j dxsdj d}tjt||S)Nmoduleattr.) patternmatchr7rrirFsplitrbreducegetattr)r&rwrrattrss r'loadzEntryPoint.loadsn  ""4::.u{{845tekk&17R>>sCD77r)cn|jj|j}|jdS)Nrrrvrwr7rir&rws r'rrzEntryPoint.modules) ""4::.{{8$$r)cn|jj|j}|jdS)Nrsr~rs r'rszEntryPoint.attrs) ""4::.{{6""r)c|jj|j}tjd|j dxsdS)Nz\w+extrasrt)rvrwr7refindallrirs r'rzEntryPoint.extrass9 ""4::.zz&%++h"7"=2>>r)c<t|j||S)Nrjrm)r&rjs r'_forzEntryPoint._fors T t$ r)c fd|D}tttj|j |S)Nc36K|]}t|ywr+rz)r:paramr&s r'r<z%EntryPoint.matches..s:6%u%6s)allrGoperatoreqvalues)r&paramsr{s` r'matcheszEntryPoint.matchess2 &;6:3x{{FMMOU;<BZZN! % r)c4t|jSr+)hashr_r%s r'__hash__zEntryPoint.__hash__ sDIIK  r))r.r/r0rcompilervrH__annotations__rjrrpr|r1rrrsrrrr_rrrrrr2r)r'rhrhs bjj %G  I J J%)D(> ")?8%%##??=.1*+B !r)rhc^eZdZ dZdZdZedZedZe dZ e dZ y) EntryPointsr2c~ tt|j|S#t$r t |wxYw)Nr#)nextiterselect StopIterationKeyErrorr-s r'razEntryPoints.__getitem__s@  !T[[d[345 5 !4.  !s#'<c . tfd|DS)Nc3HK|]}|jdis|ywNr2)r)r:eprs r'r<z%EntryPoints.select..&s"E"  0DV0D2s"")r)r&rs `r'rzEntryPoints.select!s EEEEr)cB |Dchc]}|jc}Scc}wr+r#r&rs r'nameszEntryPoints.names(s% #''$B$'''cB |Dchc]}|jc}Scc}wr+)rirs r'groupszEntryPoints.groups/s% $((4R4(((rcD|fd|j|DS)Nc3@K|]}|jywr+)r)r:rrjs r'r<z-EntryPoints._from_text_for..8s@+?R2774=+?) _from_text)r@rArjs `r'_from_text_forzEntryPoints._from_text_for6s@3>>$+?@@@r)cBdtj|xsdDS)Nc3K|]D}t|jj|jj|jFyw)rlN)rhr7r$)r:r`s r'r<z)EntryPoints._from_text..<s: ; DJJOO4::3C3C499 U U;sA A rt)r4rB)rAs r'rzEntryPoints._from_text:s# !// ;  r)N) r.r/r0 __slots__rarr1rrrVrrWrr2r)r'rrskI!F(( )) AA  r)rc"eZdZ ddZdZdZy) PackagePathc|jj|5}|jcdddS#1swYyxYw)Nencodinglocateopenr>)r&rstreams r' read_textzPackagePath.read_textEs0 [[]    2f;;=3 2 2s ;Ac|jjd5}|jcdddS#1swYyxYw)Nrbr)r&rs r' read_binaryzPackagePath.read_binaryIs- [[]   %;;=& % %s :Ac: |jj|Sr+)rj locate_filer%s r'rzPackagePath.locateMs5yy$$T**r)N)utf-8)r.r/r0rrrr2r)r'rrBs,!!+r)rceZdZdZdZy)FileHashcB|jd\|_}|_y)N=) partitionmoder7)r&spec_s r'rpzFileHash.__init__Ss#'>>##6  1djr)c<d|jd|jdS)Nz)rr7r%s r'rzFileHash.__repr__Vs!$))HTZZLBBr)N)r.r/r0rprr2r)r'rrRs 7Cr)rceZdZfdZxZS)DeprecatedNonAbstractc .tj|Dchc]}t|D]}|}}}|Dchc]}tt||ddr|}}|rt j d|t dt|!|Scc}}wcc}w)N__isabstractmethod__FzUnimplemented abstract methods rZr[) inspectgetmrornrzrdrerfsuper__new__)r@r,kwargssubclassr$ all_namesabstract __class__s r'rzDeprecatedNonAbstract.__new__[s!(!4 !4XhDD!4  " !wsD)+A5I !   MM1(<"  ws##  s B  B)r.r/r0r __classcell__rs@r'rrZs $$r)rcpeZdZ ejdeefdZejdZe defdZ e dZ e dZ e dZedej"fd Zed Zed Zed Zed ZedZdZdZdZedZdZdZe dZe dZy)rreturncyr+r2r&filenames r'rzDistribution.read_textps r)cyr+r2r&paths r'rzDistribution.locate_filexs r)r$c |s td t|j|S#t$r t |wxYw)Nz A distribution name is required.r#) ValueErrorrdiscoverrr)r@r$s r' from_namezDistribution.from_namesM ?@ @ - $ /0 0 -&t, , -s +Ac  |jddr |r tdxstjdi|tj j fd|jDS)Ncontextz cannot accept context and kwargsc3.K|] }|ywr+r2)r:resolverrs r'r<z(Distribution.discover..s- .G(HW .Gsr2)poprrContext itertoolschain from_iterable_discover_resolvers)r@rrs @r'rzDistribution.discoversq **Y- v?@ @A/77A&A,,- .1.E.E.G-   r)c@ ttj|Sr+)PathDistributionpathlibPathrs r'atzDistribution.ats   T 233r)cJ dtjD}td|S)Nc36K|]}t|ddyw)find_distributionsNr)r:finders r'r<z3Distribution._discover_resolvers..s FSFGF0$ 7ms)sys meta_pathrF)declareds r'rz Distribution._discover_resolverss'1 FImm dH%%r)c |jdxs$|jdxs|jd}tt|}tjt j |S)NMETADATAzPKG-INFOrt)rrrHrMessageemailmessage_from_string)r&opt_textrAs r'rzDistribution.metadatash NN: & "~~j) " ~~b! C"  !:!:4!@AAr)c" |jdSNNamerr%s r'r$zDistribution.namesF}}V$$r)cB tj|jSr+)Prepared normalizer$r%s r'_normalized_namezDistribution._normalized_names6!!$)),,r)c" |jdS)NVersionrr%s r'r zDistribution.versionsI}}Y''r)cLtj|jd|S)Nzentry_points.txt)rrrr%s r'rzDistribution.entry_pointss))$..9K*LdSSr)c dfd tfd}td}||jxs"jxsjS)Nc|t|}|r t|nd|_|r t|nd|_|_|Sr+)rrrintsizerj)r$rsize_strresultr&s r' make_filez%Distribution.files..make_files7 &F,0(4.dFK+3#h-FKFKMr)cBttj|Sr+)rcsvreader)rMr"s r' make_filesz&Distribution.files..make_filess9cjj&78 8r)c.ttd|S)Nc>|jjSr+)rexistsrs r'z@Distribution.files..skip_missing_files..sDKKM,@,@,Br))listrF) package_pathss r'skip_missing_filesz.Distribution.files..skip_missing_filessBMRS Sr))NN)r _read_files_distinfo_read_files_egginfo_installed_read_files_egginfo_sources)r&r&r-r"s` @r'rzDistribution.filess|    9  9  T  T" ))+65576335   r)cN |jd}|xr|jS)NRECORD)rrJr&rAs r'r.z!Distribution._read_files_distinfos) ~~h')))r)c jd}tdd|rsyfd|jD}tdj|S)Nzinstalled-files.txt_pathc3K|]S}|z jjjdjdjUyw)rtT)walk_upN)resolve relative_toras_posix)r:r$r&subdirs r'r<z=Distribution._read_files_egginfo_installed..sV * d] WY [))"-557[ F XZ *sAA"{}")rrzrJrGformat)r&rApathsr;s` @r'r/z*Distribution._read_files_egginfo_installeds\ ~~34w-6  )  6==%((r)cv |jd}|xr$tdj|jS)Nz SOURCES.txtr<)rrGr=rJr3s r'r0z(Distribution._read_files_egginfo_sourcess4 ~~m,=FMM4??+<==r)cf |jxs|j}|xr t|Sr+)_read_dist_info_reqs_read_egg_info_reqsr+)r&reqss r'rzDistribution.requires.s0D((*Hd.F.F.H"T "r)c8|jjdS)Nz Requires-Dist)rget_allr%s r'rAz!Distribution._read_dist_info_reqs4s}}$$_55r)cZ|jd}t|j|S)Nz requires.txt)rr _deps_from_requires_text)r&sources r'rBz Distribution._read_egg_info_reqs7s(/7y667??r)cJ|jtj|Sr+)%_convert_egg_info_reqs_to_simple_reqsr4r>)r@rHs r'rGz%Distribution._deps_from_requires_text;s889OPPr)c#K dfd}d}|D]8}||j}|j|z||jz:yw)Nc|xrd|dS)Nz extra == ""r2r#s r'make_conditionzJDistribution._convert_egg_info_reqs_to_simple_reqs..make_conditionKs0ja0 0r)c |xsd}|jd\}}}|r|rd|d}ttd||g}|rddj|zSdS)Nrt:(rz; z and )rr+rFjoin)r;extrasepmarkers conditionsrNs r' quoted_markerzIDistribution._convert_egg_info_reqs_to_simple_reqs..quoted_markerNskmG")"3"3C"8 E3gYa.fTG^E5J+KLMJ6@4',,z22 Hb Hr)c dd|vzS)N @r2)reqs r' url_req_spacezIDistribution._convert_egg_info_reqs_to_simple_reqs..url_req_spaceVs  #*% %r))r7r$)sectionsrWr\r;spacerNs @r'rJz2Distribution._convert_egg_info_reqs_to_simple_reqs?sS  1 I & G!'--0E--%'- *EE E sA AN) r.r/r0abcabstractmethodrrHrrrVrrrWrrr1rr rr$rr rrr.r/r0rrArBrGrJr2r)r'rrms~( Xc]     -S--"  "44&&B%//BB"%%--((TT    D*)8 >## 6@QQ F Fr)rcTeZdZ GddZej efdZy)rc*eZdZ dZ dZedZy)DistributionFinder.ContextNc 8t|j|yr+rm)r&rs r'rpz#DistributionFinder.Context.__init__zs J  f %r)cV t|jdtjS)Nr)rngetrrr%s r'rzDistributionFinder.Context.path}s" :>>&#((3 3r))r.r/r0r$rpr1rr2r)r'rrchs,   &  4  4r)rcyr+r2)r&rs r'rz%DistributionFinder.find_distributionss r)N)r.r/r0rr_r`rr2r)r'rrcs144@ )0  r)rceZdZ ejfdZdZdZdZdZ dZ e dZ e dZxZS) FastPathc"t||Sr+)rr)r@rootrs r'rzFastPath.__new__sws##r)c||_yr+)rk)r&rks r'rpzFastPath.__init__s  r)cBtj|j|Sr+)rrrk)r&childs r'joinpathzFastPath.joinpaths||DIIu--r)ctt5tj|jxsdcdddS#1swYnxYwtt5|j cdddS#1swYgSxYwNru)r Exceptionoslistdirrk zip_childrenr%s r'childrenzFastPath.childrensP i ::dii.3/! i $$&!  s#=AA22A<ctj|j}|jj}|j|_t j d|DS)Nc3bK|]'}|jtjdd)yw)rrN)rx posixpathrT)r:rns r'r<z(FastPath.zip_children..s%Q5%U[[:1=5s-/)zipfilerrknamelistrodictfromkeys)r&zip_pathrs r'ruzFastPath.zip_childrensH<< * &&( )) }}Q5QQQr)cV|j|jj|Sr+)lookupmtimesearchr-s r'rzFastPath.searchs {{4::&--d33r)ctt5tj|jj cdddS#1swYnxYw|j jyr+)rOSErrorrsstatrkst_mtimer cache_clearr%s r'rzFastPath.mtimes< g 77499%..   !s )AA ct|Sr+)Lookup)r&rs r'rzFastPath.lookups d|r))r.r/r0rb lru_cacherrprorvrurr1rrrrrs@r'ririsiY$$.R4"" r)riceZdZdefdZdZy)rrcltjj|jj }|j d}t t|_t t|_ |jD]}|j }|j dri|jddjdd}tj|}|j|j|j!||s|dk(s|jddjdd}tj#|}|j|j|j!||jj%|jj%y)Nz.eggz .dist-infoz .egg-inforur-zegg-info)rsrbasenamerklowerrLrr+infoseggsrv rpartitionrrrappendrolegacy_normalizefreeze) r&rbase base_is_eggrnlowr$ normalizedlegacy_normalizeds r'rpzLookup.__init__sEww *002mmF+ )$/ (. ]]_E++-C||78~~c*1-77.s- .BdDKK !.Br)rrrrrGri)r@r$r>rs @r'rz MetadataPathFinder._search_pathss:?D>,,- .1(E.B-   r)c@tjjyr+)rirr)r@s r'invalidate_cachesz$MetadataPathFinder.invalidate_cachess$$&r)N) r.r/r0rVrrrrrr2r)r'rrsH(:(B(B(D , ,  ''r)rceZdZdefdZdZej je_dZe fdZ e dZ xZ S)rrc ||_yr+)r5rs r'rpzPathDistribution.__init__$s  r)ctttttt 5|j j|jdcdddS#1swYyxYw)Nrr) rFileNotFoundErrorIsADirectoryErrorrNotADirectoryErrorPermissionErrorr5rorrs r'rzPathDistribution.read_text+sK        ::&&x0::G:L   s +AA"c4|jj|z Sr+)r5parentrs r'rzPathDistribution.locate_file7szz  4''r)c tjjt|j}t t j|j|xs t|(Sr+) rsrrrHr5r rr_name_from_stemrr)r&stemrs r'rz!PathDistribution._normalized_name:sX wwDJJ0 )Ih(( )$*>*>t*D E (w' r)c tjj|\}}|dvry|jd\}}}|S)Nrr)rsrsplitextr)rrextr$rTrests r'rz PathDistribution._name_from_stemFsH ((. # 1 1 ",,S1c4 r))r.r/r0r rprr__doc__rr1rrWrrrs@r'rr#sXZM%..66I(    r)rc. tj|Sr+)rrdistribution_names r'rrXs  ! !"3 44r)c . tjdi|Sr)rr)rs r'rras  *6 **r)rcB tj|jSr+)rrrrs r'rris!  ! !"3 4 = ==r)c. t|jSr+)rr rs r'r r rs ) * 2 22r)r)keyc tjjdtt D}t |j di|S)Nc34K|]}|jywr+)r)r:rjs r'r<zentry_points..s(&>d&>sr2)rrr_uniquerrr)repss r'rrsN // ' '(&-mo&>( C #;s  " " ,V ,,r)c. t|jSr+)rrrs r'rrs ) * 0 00r)c. t|jSr+)rrrs r'rrs ) * 3 33r)c tjt}tD]@}t |xs t |D]#}||j |jd%Bt|Sr) collections defaultdictr+r_top_level_declared_top_level_inferredrrr|) pkg_to_distrjpkgs r'rrsl))$/K&t,I0CD0IIC   # #DMM&$9 :J   r)cH|jdxsdjS)Nz top_level.txtrt)rrxrs r'rrs NN? + 1r 8 8 ::r)ct|jDchc]>}t|jdkDr|jdnt j |@}}t d}t||Scc}w)Nrrc d|vSrqr2r#s r'importable_namez,_top_level_inferred..importable_names $r))r rlenpartsr getmodulenamer rF)rjf opt_namesrs r'rrs|!,,A!''lQ& G,A,A!,DD,  /9 --sAA5)Krsrr_r$rrrrzrrRrdrbrry contextlibrrrtrr _collectionsrr _functoolsrr _itertoolsr r r r r importlibr importlib.abcrrtypingrrrr__all__ModuleNotFoundErrorrr4rYrhtupler PurePosixPathrrrrrrirrrrrrrr rc attrgetterrrrrrHrrrr2r)r'rs 4/8.#(00  . >1>1B!!6v!v!r. %. b +''' + CC$$&sF(sFl- - `,,^!,!,HD'+'62|2j5+>5#8#8>3 )  ./  -k -14T#Y 7"; .r)PK]\EAA xmlbuilder.cpython-312.opt-1.pycnu[ ֦i0dZddlZddlZddlmZgdZGddZGddZd Z Gd d e Z Gd d e Z GddZ [GddZGddZy)z4Implementation of the DOM Level 3 'LS-Load' feature.N) NodeFilter) DOMBuilderDOMEntityResolverDOMInputSourcec\eZdZdZdZdZdZdZdZdZ dZ dZ dZ dZ dZdZdZdZdZdZdZdZdZy)OptionszFeatures object that has variables set for each DOMBuilder feature. The DOMBuilder class uses an instance of this class to pass settings to the ExpatBuilder class. TFN)__name__ __module__ __qualname____doc__ namespacesnamespace_declarations validationexternal_parameter_entitiesexternal_general_entitiesexternal_dtd_subsetvalidate_if_schemavalidatedatatype_normalizationcreate_entity_ref_nodesentitieswhitespace_in_element_contentcdata_sectionscommentscharset_overrides_xml_encodinginfosetsupported_mediatypes_only errorHandlerfilter+/usr/lib64/python3.12/xml/dom/xmlbuilder.pyrr srJ!J"& $H""H$(!NH%)"G %L Fr"rc BeZdZdZdZdZdZdZdZdZ eeee fZ dZ dZ dZ d Zd Zd Zd Zd ZdZdZiddgddgddgddgddgddgddgddgddgddgdddgddgddgddgddgddgd d gd!gd"gd#gggd$d%gd&gd'gd(Zd)Zd*Zd+Zd,Zd-Zy).rNr c"t|_yN)r_optionsselfs r#__init__zDOMBuilder.__init__9s   r"c|jSr)entityResolverr+s r#_get_entityResolverzDOMBuilder._get_entityResolver<s"""r"c||_yr)r/)r,r0s r#_set_entityResolverzDOMBuilder._set_entityResolver>s ,r"c|jSr)rr+s r#_get_errorHandlerzDOMBuilder._get_errorHandlerAs   r"c||_yr)r5)r,rs r#_set_errorHandlerzDOMBuilder._set_errorHandlerCs (r"c|jSr)r r+s r# _get_filterzDOMBuilder._get_filterFs {{r"c||_yr)r:)r,r s r# _set_filterzDOMBuilder._set_filterHs  r"ch|j|rG|xrdxsd} |jt||f}|D]\}}t|j||yt jjdt|z#t $r$t jjd|dwxYw)Nr rzunsupported feature: zunknown feature: ) supportsFeature _settings _name_xformsetattrr*KeyErrorxmldomNotSupportedErr NotFoundErrrepr)r,namestatesettingsvalues r# setFeaturezDOMBuilder.setFeatureKs    %Ka$1E 8>>;t+BC Cs B-B1c@t|jt|Sr))hasattrr*rA)r,rIs r#r?zDOMBuilder.supportsFeatureYst}}k$&788r"cHt||xrdxsdf}||jvS)Nr r)rAr@)r,rIrJkeys r# canSetFeaturezDOMBuilder.canSetFeature\s)4 %+A"23dnn$$r"rr)rr )rr)rr)rr )rr)rr rrrr)rr rr)rr )rrrr rr)rr )rrrr rrrr ) rSrTrUrVrX)rr rWrYr[rrrrrr )rYrZr[)rr)rr r\r]r^ct|} t|j|S#t$r|dk(r|j}|jxro|j xra|j xrS|jxrE|jxs6|jxs(|jxs|jxs |j cYStjjdt!|zwxYw)Nrzfeature %s not known)rAgetattrr*AttributeErrorrrrrrrrrrrDrErGrH)r,rIxnameoptionss r# getFeaturezDOMBuilder.getFeaturesD! K4==%0 0 Ky --66<#AA<#,,<$BB<")!?!?";$+$>$>";$+$C$C";%,$4$4";%,$:$: < =''%%&ddl}|jjSrl)rprq build_opener)r,rus r#rz DOMEntityResolver._create_openers~~**,,r"c~|jj}|jd}||jSy)Ncharset)rninfo get_paramr)r,rrrs r#rz'DOMEntityResolver._guess_media_encodings;  %%'..+  ==? "r"N)r r r __slots__rfrrrr!r"r#rrsI, -r"rcjeZdZdZdZdZdZdZdZdZ dZ d Z d Z d Z d Zd ZdZdZdZy)rrncharacterStream stringDatarrrorcfd|_d|_d|_d|_d|_d|_d|_yr)rr+s r#r-zDOMInputSource.__init__s4#    r"c|jSr)rnr+s r#_get_byteStreamzDOMInputSource._get_byteStream r"c||_yr)r)r,rns r#_set_byteStreamzDOMInputSource._set_byteStreams $r"c|jSr)rr+s r#_get_characterStreamz#DOMInputSource._get_characterStreams###r"c||_yr)r)r,rs r#_set_characterStreamz#DOMInputSource._set_characterStreams .r"c|jSr)rr+s r#_get_stringDatazDOMInputSource._get_stringDatarr"c||_yr)r)r,datas r#_set_stringDatazDOMInputSource._set_stringDatas r"c|jSr)rr+s r# _get_encodingzDOMInputSource._get_encoding }}r"c||_yr)r)r,rs r# _set_encodingzDOMInputSource._set_encoding    r"c|jSr)rr+s r# _get_publicIdzDOMInputSource._get_publicId#rr"c||_yr)r)r,rs r# _set_publicIdzDOMInputSource._set_publicId%rr"c|jSr)ror+s r# _get_systemIdzDOMInputSource._get_systemId(rr"c||_yr)r)r,ros r# _set_systemIdzDOMInputSource._set_systemId*rr"c|jSr)rr+s r# _get_baseURIzDOMInputSource._get_baseURI-s ||r"c||_yr)rr,rhs r# _set_baseURIzDOMInputSource._set_baseURI/s  r"N)r r r rr-rrrrrrrrrrrrrrr!r"r#rrsU@I%$/!!!r"rcJeZdZdZdZdZdZdZejZ dZ dZ dZ y ) DOMBuilderFilterzSElement filter which can be used to tailor construction of a DOM instance. r r%r&r'c|jSr)) whatToShowr+s r#_get_whatToShowz DOMBuilderFilter._get_whatToShowDrr"c|jSr) FILTER_ACCEPTr,elements r# acceptNodezDOMBuilderFilter.acceptNodeG!!!r"c|jSr)rrs r#startContainerzDOMBuilderFilter.startContainerJrr"N)r r r r r FILTER_REJECT FILTER_SKIPFILTER_INTERRUPTrSHOW_ALLrrrrr!r"r#rr3s8MMK$$J""r"rc8eZdZdZdZdZdZdZdZdZ dZ y ) DocumentLSz=Mixin to create documents that conform to the load/save spec.Fcy)NFr!r+s r# _get_asynczDocumentLS._get_asyncUsr"cF|rtjjdy)Nz.asynchronous document loading is not supported)rDrErF)r,flags r# _set_asynczDocumentLS._set_asyncXs& ''))@B B r"ctd)Nz'haven't figured out what this means yetryr+s r#abortzDocumentLS.abort]s" 57 7r"ctdNzhaven't written this yetrrs r#loadzDocumentLS.loadc!"<==r"ctdrr)r,rs r#loadXMLzDocumentLS.loadXMLfrr"c||}|j S|j|urtjj|j Sr)) ownerDocumentrDrEWrongDocumentErrtoxml)r,snodes r#saveXMLzDocumentLS.saveXMLisI =E{{}  ,''**, ,{{}r"N) r r r r async_rrrrrrr!r"r#rrPs)G FB 7 >>r"rc&eZdZdZdZdZdZdZy)DOMImplementationLSr r%c|tjjd||jk(r t S||j k(rtjjdt d)NzschemaType not yet supportedz'asynchronous builders are not supportedzunknown value for mode)rDrErFMODE_SYNCHRONOUSrMODE_ASYNCHRONOUSrx)r,mode schemaTypes r#createDOMBuilderz$DOMImplementationLS.createDOMBuilderusl  !'')).0 0 4(( (<  4)) )''))9; ;122r"ctd)Nz-the writer interface hasn't been written yet!rr+s r#createDOMWriterz#DOMImplementationLS.createDOMWriters! ;= =r"ctSr))rr+s r#createDOMInputSourcez(DOMImplementationLS.createDOMInputSources r"N)r r r rrr r rr!r"r#rrqs 3= r"r)r rmxml.domrDxml.dom.NodeFilterr__all__rrrAobjectrrrrrr!r"r#rst: ) @@a)a)H*++\.V.b""4B  r"PK]^domreg.cpython-312.opt-1.pycnu[ ֦i{ 8dZddlZdddZiZdZdZd dZd Zy) zRegistration facilities for DOM. This module should not be used directly. Instead, the functions getDOMImplementation and registerDOMImplementation should be imported from xml.dom.Nzxml.dom.minidomzxml.dom.DOMImplementation)minidom4DOMc|t|<y)aIregisterDOMImplementation(name, factory) Register the factory function with the name. The factory function should return an object which implements the DOMImplementation interface. The factory function can either return the same object, or a new one (e.g. if that implementation supports some customization).N) registered)namefactorys '/usr/lib64/python3.12/xml/dom/domreg.pyregisterDOMImplementationr sJtc@|D]\}}|j||ryy)zF_good_enough(dom, features) -> Return 1 if the dom offers the featuresr) hasFeature)domfeaturesfvs r _good_enoughr s&!~~a" r cPddl}d}tj|}|rt|iidg}|j S|r t |St jjs'd|jvrt |jdSt|tr t|}t jD]}|}t||s|cStjD]} t |}t||s|cSt#d#t $rY8wxYw)aSgetDOMImplementation(name = None, features = ()) -> DOM implementation. Return a suitable DOM implementation. The name is either well-known, the module name of a DOM implementation, or None. If it is not None, imports the corresponding module and returns DOMImplementation object if the import succeeds. If name is not given, consider the available implementations to find one with the required feature set. If no implementation can be found, raise an ImportError. The features list must be a sequence of (feature, version) pairs which are passed to hasFeature.rNgetDOMImplementation PYTHON_DOM)rz$no suitable DOM implementation found)oswell_known_implementationsget __import__rrsysflagsignore_environmentenviron isinstancestr_parse_feature_stringvaluesrkeys Exception ImportError)rrrcreatormodrs r rr'sG $ ( ( .C b"'=&>?'')) $!! YY ) )lbjj.H#2::l+CDD(C (2$$&i X &J' .224 &g6C X &J 5 < ==    s0 D D%$D%cg}|j}d}t|}||krR||}|ddvrtd||dz}d}||kr||}|ddvr|dz}|}|j||f||krRt |S)Nr 0123456789zbad feature name: r )splitlen ValueErrorappendtuple)srpartsilengthfeatureversionrs r r!r!RsH GGIE A ZF f*( 1: %w@A A E v:aAt|#E'*+ f* ?r )N)__doc__rrrr rrr!r5r r r7s;>  '   )>Vr PK]kU5"expatbuilder.cpython-312.opt-2.pycnu[ ֦im  ddlmZmZmZddlmZmZmZddlmZddl m Z m Z ddl m Z ejZejZej Zej"j$Zej"j&Zej"j(Zej"j*Zej,Zej0ddej0ddej0dd ej0dd ej0dd ej0dd ej0dd ej0ddej0ddd ZGddeZdZdZGddZeeefZGddeZ GddeZ!Gdde!Z"Gdde!Z#dZ$d e$zZ%Gd!d"eZ&Gd#d$Z'Gd%d&e'eZ(Gd'd(e'e&Z)Gd)d*e*Z+Gd+d,eZ,d2d-Z-d2d.Z.d2d/Z/d2d0Z0d1Z1y)3) xmlbuilderminidomNode)EMPTY_NAMESPACE EMPTY_PREFIXXMLNS_NAMESPACE)expat) _append_child_set_attribute_node) NodeFilterNcdata enumerationentityentitiesididrefidrefsnmtokennmtokens) CDATAENUMENTITYENTITIESIDIDREFIDREFSNMTOKENNMTOKENScHeZdZdZd dZdZdZdZdZdZ d Z d Z d Z y) ElementInfo _attr_info_modeltagNameNc.||_g|_||_yN)r$r"r#)selfr$models -/usr/lib64/python3.12/xml/dom/expatbuilder.py__init__zElementInfo.__init__?s  cH|j|j|jfSr&r!r's r) __getstate__zElementInfo.__getstate__Ds T\\99r+c.|\|_|_|_yr&r!)r'states r) __setstate__zElementInfo.__setstate__Gs5:2dlr+c|jD]0}|d|k(s |d}|ddk(r tdcSt|dcStjS)Nr(r)r" _typeinfo_mapr_no_type)r'anameinfots r)getAttributeTypezElementInfo.getAttributeTypeJsXOODAw%HQ43;(00(b22 $r+c"tjSr&)rr7)r' namespaceURI localNames r)getAttributeTypeNSzElementInfo.getAttributeTypeNSTsr+c|jrE|jd}|tjjtjjfvSyNrF)r#r r( XML_CTYPE_ANYXML_CTYPE_MIXED)r'types r)isElementContentzElementInfo.isElementContentWsF ;;;;q>D 9 9 % ; ; == =r+cp|jr*|jdtjjk(SyrA)r#r r(XML_CTYPE_EMPTYr-s r)isEmptyzElementInfo.isEmpty_s) ;;;;q>U[[%@%@@ @r+cJ|jD]}|d|k(s |ddk(cSy)Nr3r4rF)r")r'r8r9s r)isIdzElementInfo.isIdes0OODAw%Bx4''$r+c(|j||fSr&)rJ)r'eurienameaurir8s r)isIdNSzElementInfo.isIdNSksyy$''r+r&) __name__ __module__ __qualname__ __slots__r*r.r1r;r?rErHrJrOr+r)r r <s41I :;    (r+r c&|j||Sr&)_intern_setdefault)builderss r)_internrYos  % %a ++r+c*|jd}|j}t|dk(r)|\}}}|||}|d|}|||}|||}n3t|dk(r|\}}t}|||x}}nt d|z||||||fS)N :z4Unsupported syntax: spaces in URIs not supported: %r)splitrVlenr ValueError)rWnamepartsinternuri localnameprefixqnames r)_parse_ns_namerirs JJsOE  ' 'F 5zQ!&Y'!9-ue$9i0 UqY"9i88 ORVVWW #s Y 55r+ceZdZ ddZdZdZdZdZdZdZ d Z d Z d Z d Z d ZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZy) ExpatBuilderNc|tj}||_|jj%t |jj|_nd|_t |_d|_|jyr&) rOptions_optionsfilterFilterVisibilityController_filterr_finish_start_element_parserreset)r'optionss r)r*zExpatBuilder.__init__sc ? ((*G ==   +5dmm6J6JKDLDL*,D &  r+c, tjSr&)r ParserCreater-s r) createParserzExpatBuilder.createParsers)!!##r+cD |js|j|_|jjj|_d|j_d|j_d|j_|j|j|jSNT) rsrxrd setdefaultrV buffer_textordered_attributesspecified_attributesinstallr-s r) getParserzExpatBuilder.getParsersrE||,,.DL&*ll&9&9&D&DD #'+DLL $.2DLL +04DLL - LL &||r+c tjtdd|_|j|_|jj |_d|_yNF)theDOMImplementationcreateDocumentrdocumentcurNode _elem_info_cdatar-s r)rtzExpatBuilder.resetsAD,;; T4) }} --22 r+c |j|_|j|_|j|_|j |_|jjr|j|_ |j|_ |jjr|j|_|jj"r4|j$|_|j(|_|j,|_n|j0|_|j2|_|j6|_|j:|_|j>|_ yr&)!start_doctype_decl_handlerStartDoctypeDeclHandlerfirst_element_handlerStartElementHandlerend_element_handlerEndElementHandler pi_handlerProcessingInstructionHandlerrnrentity_decl_handlerEntityDeclHandlernotation_decl_handlerNotationDeclHandlercommentscomment_handlerCommentHandlercdata_sectionsstart_cdata_section_handlerStartCdataSectionHandlerend_cdata_section_handlerEndCdataSectionHandlercharacter_data_handler_cdataCharacterDataHandlercharacter_data_handlerexternal_entity_ref_handlerExternalEntityRefHandlerxml_decl_handlerXmlDeclHandlerelement_decl_handlerElementDeclHandlerattlist_decl_handlerAttlistDeclHandlerr'parsers r)rzExpatBuilder.installsL)-)H)H&%)%?%?"#'#;#; .2oo+ == ! !'+'?'?F $%)%?%?" == ! !$($8$8F ! == ' '.2.N.NF +,0,J,JF )*.*K*KF '*.*E*EF '*.*J*J' $ 5 5$($=$=!$($=$=!r+c~ |j}d} |jdx}rQ|j|d|r'|jjr|j |d}|jdx}rQ|jdd|j}|jd|_|S#t $rY0wxYw)NTi@Fr+) rreadParserdocumentElement _setup_subset ParseEscapertrs)r'filer first_bufferbufferdocs r) parseFilezExpatBuilder.parseFiles !   IIg..&. VU+DMM$A$A&&v.$ !IIg..&. LLd #mm      sA#B09B00 B<;B<c |j} |j|d|j||j}|j d|_|S#t$rY0wxYwrz)rrrrrrtrs)r'stringrrs r) parseStringzExpatBuilder.parseStringsfJ!  LL &   v &mm      s#A A'&A'c |jjrGt}|j||j }||jj_yyr&)rdoctypeInternalSubsetExtractorr getSubsetinternalSubset)r'r extractorsubsets r)rzExpatBuilder._setup_subsetsM= == /1I  ! !& )((*F39DMM ! ! 0 !r+c~|jjj|||}|j|_t |j|||j_|j rn|j j|tk(rLd|j_|jjd=d}d|j_ d|j_ |rb|"g|j_g|j_d|j_d|j_|j$|j_yyN)rimplementationcreateDocumentType ownerDocumentr rrq acceptNode FILTER_REJECT childNodesrsrrr_seq notationsrrend_doctype_decl_handlerEndDoctypeDeclHandler)r' doctypeNamesystemIdpublicIdhas_internal_subsetrs r)rz'ExpatBuilder.start_doctype_decl_handlers--..AA 8- $ dmmW- '  <*>DLL '48OO 14<<')D $$0r+c|jj||}t|j||jr?|jj |t k(r|jj|yyyr&)rcreateProcessingInstructionr rrqrr removeChild)r'targetdatanodes r)rzExpatBuilder.pi_handler s]}}88FdllD) <DII$EDI <<>DDI!%D dllD)r+c2|jj}|r0|djtk(r|d}|j|z|_yt j }|j|z|_|j|_t|j|yr) rrrrrrrrrr )r'rrrs r)rz#ExpatBuilder.character_data_handler#sv\\,, *R.11Y>b>D D(DI ||~II$ !]]dllD)r+c |ry|jjsy|jj||||}|6|jj |} |j j | |jjjjj ||jrO|jj|tk(r,|jjjjd=yyyr) rnrr_create_entitycreateTextNoderappendrrrqrr) r' entityNameis_parameter_entityrbaserr notationNamerchilds r)rz ExpatBuilder.entity_decl_handler.s  }}%% }}++J,4lD  MM007E OO " "5 ) &&++2248 <.& :O**+ *( *8$9 + %%5 -".* !$" B1r+rkc8eZdZ dZdZdZdZeje jeje jeje jeje j ej"e j$ej&e j(ej*e j,ej.e j0ej2e j4ej6e j8ej:e j<ej>e j@i Z!y)rproc||_yr&r)r'ros r)r*z#FilterVisibilityController.__init__s  r+c|j|j}|jj|zrK|jj |}|t k(rt |tvrtdt|z|StS)Nz)startContainer() returned illegal value: ) _nodetype_maskrro whatToShowrFILTER_INTERRUPTr_ALLOWED_FILTER_RETURNSrareprr)r'rmaskvals r)rz)FilterVisibilityController.startContainersz""4==1 ;; ! !D (++,,T2C&&!!11 ADIMOOJ r+c|j|j}|jj|zr|jj |}|t k(rt |tk(r7|j}|jddD]}|j|tS|tvrtdt|z|StS)Nz%acceptNode() returned illegal value: )rrrorrr rrrr appendChildrr!rar"r)r'rr#r$parentrs r)rz%FilterVisibilityController.acceptNodes""4==1 ;; ! !D (++((.C&&!!k!!__Q/E&&u-0%$11 =S IKKJ r+N)"rPrQrRrSr*rrr ELEMENT_NODEr SHOW_ELEMENTATTRIBUTE_NODESHOW_ATTRIBUTEr SHOW_TEXTrSHOW_CDATA_SECTIONENTITY_REFERENCE_NODESHOW_ENTITY_REFERENCE ENTITY_NODE SHOW_ENTITYPROCESSING_INSTRUCTION_NODESHOW_PROCESSING_INSTRUCTION COMMENT_NODE SHOW_COMMENT DOCUMENT_NODE SHOW_DOCUMENTDOCUMENT_TYPE_NODESHOW_DOCUMENT_TYPEDOCUMENT_FRAGMENT_NODESHOW_DOCUMENT_FRAGMENT NOTATION_NODE SHOW_NOTATIONrrTr+r)rprps5I !!* **A*A **C*C **>*> **G*G ""**J*J **@*@ ((**P*P **A*A **B*B **G*G ##**K*K **B*B  Nr+rpceZdZdZdZy) FilterCrutch)_builder_level _old_start_old_endcd|_||_|j}|j|_|j |_|j|_|j|_yr) rAr@rsrrBrrCrr)r'rWrs r)r*zFilterCrutch.__init__sO   4400 %)%?%?"#'#;#; r+N)rPrQrRrSr*rTr+r)r?r?s >I %%s ]> &fragment-builder-internal;c:eZdZ d dZdZdZdZdZdZdZ y) FragmentBuilderNc|jtk(r||_||_n|j|_||_t j ||yr&)rr6originalDocumentrrrkr*)r'rrus r)r*zFragmentBuilder.__init__XsD   } ,$+D !"DL$+$9$9D !"DLdG,r+c<tj|d|_yr&)rkrtfragmentr-s r)rtzFragmentBuilder.resetas4  r+cB |j|jSr&)rrr'rs r)rzFragmentBuilder.parseFilees  ,,r+c ||_|j}|jj}d}|rd|jxs|j }|j rd|j d|jd}n|jrd|jz}nd}|j}t|||fz} |j|d|j}|j|S#|jxYw)NzPUBLIC "z" ""z SYSTEM "%s"T) _sourcerrSrr_getDeclarationsrr _getNSattrs_FRAGMENT_BUILDER_TEMPLATErrtrU) r'rrridentrnsattrsrrUs r)rzFragmentBuilder.parseStringjs  !''// ++Ft/D/D/FF#,,g.>.>@!!%(8(88F""$-0HH  LL4 (==    JJL s 6C&&C9c< |jjj}d}|rut|jj D]s}|jj |}|r|dz}|d|j}|jr |d|jd|jd}b|d|jd}ut|jj D]}|jj |}|r|dz}|d|j}|jr |d|jd|jd }n;|jr|d|jd }n|d |jjd }|jr|d |j}|d z}|S) NrYz z z SYSTEM "z )rrrrrlengthitemnodeNamerrr firstChildrr)r'rrXrnotationrs r)r\z FragmentBuilder._getDeclarationssh ,,,,44  7,,334",,11!4F A)*H,=,=>$$h//1B1BDA./0A0ABA57++223 ))..q1F A'(&//:??foov@A__,-v?A%&(9(9(>(>?A&&,-v/B/BCAG4r+cy)NrYrTr-s r)r]zFragmentBuilder._getNSattrssr+c|tk(r|j}|j}|jj |}|j |_|jj |_|j|_ |j|jd||_||_d|_ ytj|||||S#||_||_d|_ wxYw)NTr) $_FRAGMENT_BUILDER_INTERNAL_SYSTEM_IDrrrsExternalEntityParserCreaterScreateDocumentFragmentrUrr[rkr)r'rrrr old_document old_cur_noders r)rz+FragmentBuilder.external_entity_ref_handlers ; ; ==L<|j }|rt|S) NrY_ns_prefix_urir}r~z z=''r[)rhasattrritemsrr)r'attrsrrrgredeclnames r)r]zFragmentBuilderNS._getNSattrs2s ,, w 01#*#9#9#?#?#AKFC{ HHV$#+f#4#*5:Hc J/7 <$B((G  r+N)rPrQrRrtr]rTr+r)rr+s4r+rceZdZ y)rN)rPrQrRrTr+r)rrPsOr+rc<eZdZ dZdZdZdZdZdZdZ dZ y) rNc |jSr&)rr-s r)rz!InternalSubsetExtractor.getSubsetYs5{{r+cP tj||y#t$rYywxYwr&)rkrrrWs r)rz!InternalSubsetExtractor.parseFile]s)   " "4 .     %%cP tj||y#t$rYywxYwr&)rkrr)r'rs r)rz#InternalSubsetExtractor.parseStringcs)   $ $T6 2   rcH|j|_|j|_yr&)rrrrrs r)rzInternalSubsetExtractor.installis)-)H)H&%)%?%?"r+c|rD|j}g|_|jj|_|j|_yt r&)rrrDefaultHandlerrrr)r'rbrrrrs r)rz2InternalSubsetExtractor.start_doctype_decl_handlerms@ ^^%FDK$(KK$6$6F !+/+H+HF (- r+cdj|jjddjdd}||_t)NrYz   )joinrreplacer)r'rXs r)rz0InternalSubsetExtractor.end_doctype_decl_handlerws= GGDKK ( ( 6 > >tT J mr+ctr&)r)r'rbrs r)rz-InternalSubsetExtractor.start_element_handler|s mr+) rPrQrRrrrrrrrrrTr+r)rrTs.L F  @  r+rc |r t}n t}t|tr(t |d5}|j |}ddd|S|j |}|S#1swYSxYwNrb)rrk isinstancestropenr)r namespacesrWfpresults r)parsersq ".$ $ &&r*F M""4( M  Ms A$$A.cT |r t}n t}|j|Sr&)rrkr)rrrWs r)rrs, ".   v &&r+c |r t|}n t|}t|tr(t |d5}|j |}ddd|S|j |}|S#1swYSxYwr)rrQrrrr)rrrrWrrs r) parseFragmentrsv #G,!'*$ $ &&r*F M""4( M  Ms A&&A0cX |r t|}n t|}|j|Sr&)rrQr)rrrrWs r)parseFragmentStringrs1#G,!'*   v &&r+cH |jr t|St|Sr&)rrrk)rus r) makeBuilderrs$6g&&G$$r+)T)2xml.domrrrrrr xml.parsersr xml.dom.minidomr r xml.dom.NodeFilterr rrr6DOMBuilderFilterrrrr getDOMImplementationrTypeInfor6objectr rYrirkr!rpr?rrrjr^rQrprr ExceptionrrrrrrrrTr+r)rs/:.-BB>) NN ,,"" ++99 ++99 ))55 ..??3w335!  w/   }5   x0   z2   t,   w/   x0   y1   z2  1(&1(f,6&y1y1| )-E7 7 t <6 <*|*8!l!2?%*+ +r9lr9j\.\.~Z" O"J ) )l)X$'( '%r+PK] F @ @ xmlbuilder.cpython-312.opt-2.pycnu[ ֦i0 ddlZddlZddlmZgdZGddZGddZdZGd d e Z Gd d e Z Gd dZ [GddZ GddZy)N) NodeFilter) DOMBuilderDOMEntityResolverDOMInputSourcecZeZdZ dZdZdZdZdZdZdZ dZ dZ dZ dZ dZdZdZdZdZdZdZdZy)OptionsTFN)__name__ __module__ __qualname__ namespacesnamespace_declarations validationexternal_parameter_entitiesexternal_general_entitiesexternal_dtd_subsetvalidate_if_schemavalidatedatatype_normalizationcreate_entity_ref_nodesentitieswhitespace_in_element_contentcdata_sectionscommentscharset_overrides_xml_encodinginfosetsupported_mediatypes_only errorHandlerfilter+/usr/lib64/python3.12/xml/dom/xmlbuilder.pyrr srJ!J"& $H""H$(!NH%)"G %L Fr!rc BeZdZdZdZdZdZdZdZdZ eeee fZ dZ dZ dZ d Zd Zd Zd Zd ZdZdZiddgddgddgddgddgddgddgddgddgddgdddgddgddgddgddgddgd d gd!gd"gd#gggd$d%gd&gd'gd(Zd)Zd*Zd+Zd,Zd-Zy).rNr c"t|_yN)r_optionsselfs r"__init__zDOMBuilder.__init__9s   r!c|jSr(entityResolverr*s r"_get_entityResolverzDOMBuilder._get_entityResolver<s"""r!c||_yr(r.)r+r/s r"_set_entityResolverzDOMBuilder._set_entityResolver>s ,r!c|jSr(rr*s r"_get_errorHandlerzDOMBuilder._get_errorHandlerAs   r!c||_yr(r4)r+rs r"_set_errorHandlerzDOMBuilder._set_errorHandlerCs (r!c|jSr(rr*s r" _get_filterzDOMBuilder._get_filterFs {{r!c||_yr(r9)r+rs r" _set_filterzDOMBuilder._set_filterHs  r!ch|j|rG|xrdxsd} |jt||f}|D]\}}t|j||yt jjdt|z#t $r$t jjd|dwxYw)Nr rzunsupported feature: zunknown feature: ) supportsFeature _settings _name_xformsetattrr)KeyErrorxmldomNotSupportedErr NotFoundErrrepr)r+namestatesettingsvalues r" setFeaturezDOMBuilder.setFeatureKs    %Ka$1E 8>>;t+BC Cs B-B1c@t|jt|Sr()hasattrr)r@)r+rHs r"r>zDOMBuilder.supportsFeatureYst}}k$&788r!cHt||xrdxsdf}||jvS)Nr r)r@r?)r+rHrIkeys r" canSetFeaturezDOMBuilder.canSetFeature\s)4 %+A"23dnn$$r!rr)rr )rr)rr)rr )rr)rr rrrr)rr rr)rr )rrrr rr)rr )rrrr rrrr ) rRrSrTrUrW)rr rVrXrZrrr rr r )rXrYrZ)rr)rr r[r\r]ct|} t|j|S#t$r|dk(r|j}|jxro|j xra|j xrS|jxrE|jxs6|jxs(|jxs|jxs |j cYStjjdt!|zwxYw)Nrzfeature %s not known)r@getattrr)AttributeErrorrrrrrrrrrrCrDrFrG)r+rHxnameoptionss r" getFeaturezDOMBuilder.getFeaturesD! K4==%0 0 Ky --66<#AA<#,,<$BB<")!?!?";$+$>$>";$+$C$C";%,$4$4";%,$:$: < =''%%&rQr?rcrirfr{rrr r!r"rr,sNL FN !$&?)+?AN"#-!) H9%;% )(+; & )(+;   ; ) ,+.; ) ,+.; + .-0; + .-0; " %$';" ' *),#;& ' *),';*  * +;0  1;4 - 0/25;8 - 0/29;<  ! #=;@  ! #A;D  E;J  203 203 3 -+.  s;IzK$!3A )r!rcB|jjddS)N-_)lowerreplace)rHs r"r@r@s ::<  S ))r!c(eZdZdZdZdZdZdZy)r)_openerct}||_||_|jj ||_|j ||_ddl}ddl }|jj|}|\}}} } } } | rM| jds<|j| dz} ||| | | | f}|jj||_|S)Nr/)rpublicIdrn _get_openeropenrm_guess_media_encodingencoding posixpath urllib.parserfurlparseendswithdirname urlunparsebaseURI) r+rrnsourcerrtpartsschemenetlocpathparamsqueryfragments r"rezDOMEntityResolver.resolveEntitys!"" ,,.33H=44V< ' %%h/8=5feX  c*$$T*S0DFD&%AE#\\44U;FN r!c| |jS#t$r$|j|_|jcYSwxYwr()rr`_create_openerr*s r"rzDOMEntityResolver._get_openers: <<  ..0DL<<  s *;;c>ddl}|jjSrk)rorp build_opener)r+rts r"rz DOMEntityResolver._create_openers~~**,,r!c~|jj}|jd}||jSy)Ncharset)rminfo get_paramr)r+rrrs r"rz'DOMEntityResolver._guess_media_encodings;  %%'..+  ==? "r!N)r r r __slots__rerrrr r!r"rrsI, -r!rcjeZdZdZdZdZdZdZdZdZ dZ d Z d Z d Z d Zd ZdZdZdZy)rrmcharacterStream stringDatarrrnrcfd|_d|_d|_d|_d|_d|_d|_yr(rr*s r"r,zDOMInputSource.__init__s4#    r!c|jSr(rmr*s r"_get_byteStreamzDOMInputSource._get_byteStream r!c||_yr(r)r+rms r"_set_byteStreamzDOMInputSource._set_byteStreams $r!c|jSr(rr*s r"_get_characterStreamz#DOMInputSource._get_characterStreams###r!c||_yr(r)r+rs r"_set_characterStreamz#DOMInputSource._set_characterStreams .r!c|jSr(rr*s r"_get_stringDatazDOMInputSource._get_stringDatarr!c||_yr(r)r+datas r"_set_stringDatazDOMInputSource._set_stringDatas r!c|jSr(rr*s r" _get_encodingzDOMInputSource._get_encoding }}r!c||_yr(r)r+rs r" _set_encodingzDOMInputSource._set_encoding    r!c|jSr(rr*s r" _get_publicIdzDOMInputSource._get_publicId#rr!c||_yr(r)r+rs r" _set_publicIdzDOMInputSource._set_publicId%rr!c|jSr(rnr*s r" _get_systemIdzDOMInputSource._get_systemId(rr!c||_yr(r)r+rns r" _set_systemIdzDOMInputSource._set_systemId*rr!c|jSr(rr*s r" _get_baseURIzDOMInputSource._get_baseURI-s ||r!c||_yr(rr+rgs r" _set_baseURIzDOMInputSource._set_baseURI/s  r!N)r r r rr,rrrrrrrrrrrrrrr r!r"rrsU@I%$/!!!r!rcHeZdZ dZdZdZdZejZ dZ dZ dZ y) DOMBuilderFilterr r$r%r&c|jSr() whatToShowr*s r"_get_whatToShowz DOMBuilderFilter._get_whatToShowDrr!c|jSr( FILTER_ACCEPTr+elements r" acceptNodezDOMBuilderFilter.acceptNodeG!!!r!c|jSr(rrs r"startContainerzDOMBuilderFilter.startContainerJrr!N) r r r r FILTER_REJECT FILTER_SKIPFILTER_INTERRUPTrSHOW_ALLrrrrr r!r"rr3s8MMK$$J""r!rc6eZdZ dZdZdZdZdZdZdZ y) DocumentLSFcy)NFr r*s r" _get_asynczDocumentLS._get_asyncUsr!cF|rtjjdy)Nz.asynchronous document loading is not supported)rCrDrE)r+flags r" _set_asynczDocumentLS._set_asyncXs& ''))@B B r!ctd)Nz'haven't figured out what this means yetrxr*s r"abortzDocumentLS.abort]s" 57 7r!ctdNzhaven't written this yetrrs r"loadzDocumentLS.loadc!"<==r!ctdrr)r+rs r"loadXMLzDocumentLS.loadXMLfrr!c||}|j S|j|urtjj|j Sr() ownerDocumentrCrDWrongDocumentErrtoxml)r+snodes r"saveXMLzDocumentLS.saveXMLisI =E{{}  ,''**, ,{{}r!N) r r r async_rrrrrrr r!r"rrPs)G FB 7 >>r!rc&eZdZdZdZdZdZdZy)DOMImplementationLSr r$c|tjjd||jk(r t S||j k(rtjjdt d)NzschemaType not yet supportedz'asynchronous builders are not supportedzunknown value for mode)rCrDrEMODE_SYNCHRONOUSrMODE_ASYNCHRONOUSrw)r+mode schemaTypes r"createDOMBuilderz$DOMImplementationLS.createDOMBuilderusl  !'')).0 0 4(( (<  4)) )''))9; ;122r!ctd)Nz-the writer interface hasn't been written yet!rr*s r"createDOMWriterz#DOMImplementationLS.createDOMWriters! ;= =r!ctSr()rr*s r"createDOMInputSourcez(DOMImplementationLS.createDOMInputSources r!N)r r r rrr r rr r!r"rrqs 3= r!r)rlxml.domrCxml.dom.NodeFilterr__all__rrr@objectrrrrrr r!r"rst: ) @@a)a)H*++\.V.b""4B  r!PK]Gb]b]minidom.cpython-312.opt-2.pycnu[ ֦i X ddlZddlZddlmZmZmZmZddlddlm Z m Z ejjjejjjfZGddejjZ ee dd ee d d ee d d dZdZdZdZGdde ZGdde Zeedd eed d eedd GddeZeedd eZGdd eZeddZGd!d"e Zeed#d$ eed d% d&ZGd'd(ZGd)d*ee ZGd+d,ee Z ee dd- Gd.d/e Z!ee!d0d1 ee!d2d3 d4Z"d5Z#Gd6d7e Z$Gd8d9e!Z%Gd:d;eZ&ee&dd< Gd=d>Z'Gd?d@e'ee Z(GdAdBe'e Z)GdCdDe'ee Z*GdEdFe Z+GdGdHeZ,dIZ-GdJdKe e Z.ee.dLdM dNZ/dOZ0dPZ1dTdQZ2dUdRZ3dUdSZ4y)VN)EMPTY_NAMESPACE EMPTY_PREFIXXMLNS_NAMESPACEdomreg)*)DOMImplementationLS DocumentLSceZdZdZdZdZdZdZeZ dZ ddZ ddZ dZ dZdZdZd Zd Zd Zd Zd ZdZdZdZdZdZdZdZdZdZdZdZ y)NodeNcy)NTselfs (/usr/lib64/python3.12/xml/dom/minidom.py__bool__z Node.__bool__+c*|jdd||SN) toprettyxml)rencoding standalones rtoxmlz Node.toxml.sB*==rcv|tj}n+tjtj|dd}|jt j k(r|j|d||||n|j|d||||jS|jjS)Nxmlcharrefreplace )rerrorsnewliner) ioStringIO TextIOWrapperBytesIOnodeTyper DOCUMENT_NODEwritexmlgetvaluedetach)rindentnewlrrwriters rrzNode.toprettyxml1s  [[]F%%bjjl/7-@.24F ==D.. . MM&"fdHj I MM&"fd 3  ??$ $==?++- -rc,t|jSN)bool childNodesrs r hasChildNodeszNode.hasChildNodesDsDOO$$rc|jSr-r/rs r_get_childNodeszNode._get_childNodesG rc:|jr|jdSyNrr2rs r_get_firstChildzNode._get_firstChildJs ????1% % rc:|jr|jdSyNr2rs r_get_lastChildzNode._get_lastChildNs ????2& & rc&|j|jk(r.t|jD]}|j |||S|j|j vr6t jjt|dt||j|jj|||j||S |jj|}|jt vr t#||jj%||||_||_|r!|j|dz }||_||_nd|_||_ |S#t$rt jjwxYw)N cannot be child of )r$DOCUMENT_FRAGMENT_NODEtupler/ insertBefore_child_node_typesxmldomHierarchyRequestErrrepr parentNode removeChild appendChildindex ValueError NotFoundErr_nodeTypes_with_children_clear_id_cacheinsert nextSiblingpreviousSibling)rnewChildrefChildcrJnodes rrAzNode.insertBeforeRsn    ; ; ;8../!!!X.0O   D$:$: :''--.28nd4jIK K    *    + +H 5     X &$! ,--h7  $<<% OO " "5( 3#+H '/H $uQw/#+ +/(+/("&H  ,gg))++ ,s E(((Fc|j|jk(r-t|jD]}|j ||S|j|j vr6t jjt|dt||jtvr t||j|jj|t||d|_|SNr=)r$r?r@r/rIrBrCrDrErFrMrNrGrH _append_childrP)rrUrTs rrIzNode.appendChildrs ==D77 74??+  #,K == 6 6 6''--.24j$t*EG G ]]6 6 D ! ?? & OO ' ' -dD! rc|j|jk(r/|j}|j||j ||S|j|j vr6t jjt|dt|||ury|j|jj| |jj|}||j|<||_ d|_ |jtvs|jtvr t!||j|_|j"|_d|_d|_|j"r||j"_|jr||j_|S#t$rt jjwxYwrW)r$r?rPrHrArBrCrDrErFrGr/rJrKrLrMrNrQ)rrRoldChildrSrJs r replaceChildzNode.replaceChilds    ; ; ;++H   X &$$Xx8 8   D$:$: :''--.28nd4jIK K x      *    + +H 5 (OO))(3E"*""   !9 9  $<< D !'33#+#;#; ##'  # #3;H $ $ 0   3;H 0! (''%%' ' (s F(F?c |jj||j |j|j _|j|j |j_dx|_|_|jtvr t|d|_ |S#t$rtjj wxYwr-) r/removerKrCrDrLrPrQr$rMrNrGrrZs rrHzNode.removeChilds ( OO " "8 ,    +3;3K3KH 0  # # /3;3G3GH $ $ 0:>>x7    8 8 D !" (''%%' ' (s B(Ccg}|jD]M}|jtjk(r|jsN|r|j |d_|j r|j |j _|j{|r~|dj|jk(rb|d}|j|jz|_|j |_|j r||j _|j|j||j||jtjk(s>|jP||jddyr9) r/r$r TEXT_NODEdatarPrQunlinkappend ELEMENT_NODE normalize)rLchildrUs rrezNode.normalizes  __E~~/zz,1,=,=")((>U^^;R5D $ EJJ 6DI','8'8D$((<@))9LLNHHUO>>T%6%66OO%-%.rc8t|||jxs|Sr-) _clone_node ownerDocument)rdeeps r cloneNodezNode.cloneNodes4t'9'9'ATBBrcN|jjj||Sr-)rjimplementation hasFeaturerfeatureversions r isSupportedzNode.isSupporteds!!!00;;GWMMrcyr-r rs r_get_localNamezNode._get_localNamesrc ||uSr-r rothers r isSameNodezNode.isSameNodes u}rc,|j|dr|Syr-)rsrrqs r getInterfacezNode.getInterfaces   GT *KrcR |j|dS#ttf$rYywxYwr6) _user_dataAttributeErrorKeyErrorrkeys r getUserDatazNode.getUserDatas2 ??3'* *)  s &&cd} |j}||vr||d}| d}|||=|S||f||<|S#t$r i}||_Y4wxYwr6)r~r)rrrahandleroldds r setUserDatazNode.setUserDatasy A !8C&)C <GcF G_AcF  ADO s 0AAct|drGt|jjD] \}\}}| |j |||||"yy)Nr~)hasattrlistr~itemshandle)r operationsrcdstrrars r_call_user_data_handlerzNode._call_user_data_handlersQ 4 &(,T__-B-B-D(E$_dG&NN9c4cB)F 'rcdx|_|_|jr0|jD]}|jt |_d|_d|_yr-)rGrjr/rbNodeListrQrP)rrgs rrbz Node.unlinksH/33$, ?? )&jDO#rc|Sr-r rs r __enter__zNode.__enter__s rc$|jyr-)rb)retevtbs r__exit__z Node.__exit__s  rNN) rNN)!__name__ __module__ __qualname__ namespaceURIrGrjrPrQrprefixrrrr0r3r7r;rArIr[rHrerlrsruryr|rrrrbrrr rrr r "sLJMKO F><@#.&%&'@"@ 6CN  $C rr firstChildzFirst child node, or None.)doc lastChildzLast child node, or None. localNamez"Namespace-local name of this node.cv|j}|r|d}||_||_|j|||_yr9)r/rQrPrcrG)rrUr/lasts rrXrXs<J"~#dDOrc |rT|jddjddjddjdd}|j|yy) N&z&z>)replacewrite)r+ras r _write_datar(sP! ||C)11#v>GD(+GGC,@  T rc|jD]Q}|jtjk(r%|dk(s|j|k(r|j |t |||S|SNr)r/r$r rdtagNamerc_get_elements_by_tagName_helper)parentnamercrUs rrr/sT!! ==D-- - S[DLLD0 IIdO'dB7 " Irc|jD]g}|jtjk(s!|dk(s|j|k(r%|dk(s|j |k(r|j |t||||i|Sr)r/r$r rdrrrc"_get_elements_by_tagName_ns_helper)rnsURIrrrUs rrr7sk!! ==D-- -c!T^^y%@#!2!2e!; $ .tUIr J " IrceZdZejZdZdZdZdZ ejejejejejejej fZdZy)DocumentFragmentz#document-fragmentNc"t|_yr-)rr/rs r__init__zDocumentFragment.__init__Ns "*r)rrrr r?r$nodeName nodeValue attributesrGrdr`CDATA_SECTION_NODEENTITY_REFERENCE_NODEPROCESSING_INSTRUCTION_NODE COMMENT_NODE NOTATION_NODErBrr rrrr@sk**H#HIJJ**003399**++ -%rrceZdZdZej ZdZdZdZ ejejfZ e ddfdZdZdZdZdZeeexZZd Zd ZeeexZZd Zd ZeeeZd ZdZdZy)Attr)_name_valuer_prefixr/ _localNamerj ownerElementNFcd|_d|_||_||_||_|||_t |_|jjtyr-) rrjrrrrrr/rcText)rqNamerrrs rrz Attr.__init__\sT ! (  'DO"* tv&rcx |jS#t$r"|jjdddcYSwxYwN:r>r:)rrrsplitrs rruzAttr._get_localNamels< 3?? " 3==&&sA.r2 2 3 (99c|jSr-) specifiedrs r_get_specifiedzAttr._get_specifiedr ~~rc|jSr-)rrs r _get_namezAttr._get_nameu zzrcV||_|jt|jyyr-)rrrNrvalues r _set_namezAttr._set_namexs(    ( D-- . )rc|jSr-)rrs r _get_valuezAttr._get_value {{rc||_||jd_|jt |j||jd_yr6)rr/rarrNrs r _set_valuezAttr._set_valuesE "'    ( D-- ."'rc|jSr-)rrs r _get_prefixzAttr._get_prefix ||rc|j}|dk(r*|r(|tk7rtjj d||_| |j }n|d|j }|jrt|j||_ y)Nxmlnsz5illegal use of 'xmlns' prefix for the wrong namespacer) rrrCrD NamespaceErrrrrrNr)rrnsurinewNames r _set_prefixzAttr._set_prefixs|!! W /1gg**KMM >nnG!'8G    D-- . rc|j}||j|j=|j|j|j f=|j r;d|_|xjdzc_|jxjdzc_ |jD]}|j|jdd=y)NFr>) r_attrsr_attrsNSrr_is_id_magic_id_nodesrj_magic_id_countr/rb)relemrgs rrbz Attr.unlinks      DMM* t00$..AB{{# $$)$""22a72__E LLN% OOA rc|jry|j}|j}||y|j|}|y|jr&|j |j|j S|j|jSNTF) rrjr_get_elem_inforisIdNSrisIdrrrrinfos r _get_isIdzAttr._get_isIds} ;;     ;$,!!$' <   ;;t00$..A A99T]]+ +rc|j}|j}||tS|j|}|tS|jr&|j |j|j S|j|jSr-) rjr_no_typerrgetAttributeTypeNSrgetAttributeTyperrs r_get_schemaTypezAttr._get_schemaTypes{     ;$,O!!$' <O   **4+<+6 T]D$6rr-) rrrrrrrrrrrr rr$__len__r(r+r.r0r3r5r8r=r@rCrHrKr:rOrQrSrWr rrrrs8I*     ( "$$,GC %%$%$1 $  ( ( ' >?rrlengthz$Number of nodes in the NamedNodeMap.c(eZdZdZdZdZdZdZy)TypeInfo namespacerc ||_||_yr-r\)rr]rs rrzTypeInfo.__init__s" rc|jr4d|jjd|jd|jdSd|jjd|jdS)Nr z (from z)>r)r] __class__rrrs r__repr__zTypeInfo.__repr__sM >>*...*A*A499*...: : !% 7 7C Crc|jSr-)rrs rrzTypeInfo._get_name yyrc|jSr-)r]rs r_get_namespacezTypeInfo._get_namespacerrN)rrrrrrbrrfr rrr[r[|s#IDrr[cjeZdZdZej ZdZeZ dZ ej ejejejejejfZeddfdZdZdZdZdZd Zd Zd Zd Zd ZdZdZeZdZdZ dZ!e!Z"dZ#dZ$dZ%dZ&dZ'ddZ(dZ)dZ*dZ+dZ,dZ-y)Element) rjrGrrrrrr/rrrPrQNrcd|_d|_|x|_|_||_||_t |_dx|_|_ d|_ d|_ yr-) rjrGrrrrrr/rPrQrr)rrrrrs rrzElement.__init__sW!'.. t} ("*2664/  rc:|ji|_i|_yyr-)rrrs r_ensure_attributeszElement._ensure_attributess ;; DKDM rcx |jS#t$r"|jjdddcYSwxYwr)rrrrrs rruzElement._get_localNames< 2?? " 2<<%%c1-b1 1 2rc|jSr-rrs r _get_tagNamezElement._get_tagNamerrc|j8t|jjD]}|jd|_d|_t j|yr-)rrrrbrr )rattrs rrbzElement.unlinksK ;; "T[[//12 3   Drcp |jy |j|jS#t$rYywxYwr)rrr)rr<s r getAttributezElement.getAttributesB  ;;  ;;w'-- -  s ) 55cr|jy |j||fjS#t$rYywxYwr)rrrrBs rgetAttributeNSzElement.getAttributeNSs@ ==  ==, !:;AA A  s * 66c|j|}|5t|}||_|j|_|j |y||jk7r ||_|j r t |yyyr-)getAttributeNoderrrjsetAttributeNoderrN)rr<rrqs r setAttributezElement.setAttributeso$$W- <=DDJ!%!3!3D   ! !$ ' djj DJyy%!rcNt|\}}|j||}|8t||||}||_|j|_|j |y||jk7r||_|j r t||j|k7r||_||_ yyr-) _nssplitgetAttributeNodeNSrrrjrxrrNrr)rr qualifiedNamerr localnamerqs rsetAttributeNSzElement.setAttributeNSs$]3 &&|Y? < |YGDDJ!%!3!3D   ! !$ ' "" 99#D){{f$$ - %rcR|jy|jj|Sr-r#)rattrnames rrwzElement.getAttributeNodes" ;; {{x((rcV|jy|jj||fSr-)rr$rBs rr|zElement.getAttributeNodeNSs) == }}  , !:;;rc|jd|fvrtjjd|j |j j |jd}||j||jj |j|jfd}|||ur|j|t||||ur|S||ur|Sy)Nzattribute node already owned) rrCrDInuseAttributeErrrkrr$rremoveAttributeNoderrr_set_attribute_node)rrqold1old2s rrxzElement.setAttributeNode s   T4L 0''++,JK K !{{tyy$/    $ $T *}}  $"3"3T^^!DdK  D 0  $ $T *D$' t K t K rc|jtjj |j|}|j |y#t $rtjjwxYwr-)rrCrDrLrrr)rrrqs rremoveAttributezElement.removeAttribute"sf == ''%%' ' (;;t$D   & (''%%' ' (s A (A5c|jtjj |j||f}|j |y#t$rtjjwxYwr-)rrCrDrLrr)rrrrqs rremoveAttributeNSzElement.removeAttributeNS+sk == ''%%' ' (==, !:;D   & (''%%' ' (s A(A7c(|tjj |j|jt ||j|j|_|S#t $rtjjwxYwr-) rCrDrLrrrrNrbrjrNs rrzElement.removeAttributeNode4s{ <''%%' ' ( KK "  "//  (''%%' ' (s A))(Bc: |jy||jvSNFrr?s r hasAttributezElement.hasAttributeDs% ;; t{{""rc<|jy||f|jvSr)rrBs rhasAttributeNSzElement.hasAttributeNSNs# == i(DMM99rc. t||tSr-rrr?s rgetElementsByTagNamezElement.getElementsByTagNameSs /tT8:FFrc.t|||tSr-rrrBs rgetElementsByTagNameNSzElement.getElementsByTagNameNS[1 , 8:7 7rc6d|jt|fzS)Nz)rr'rs rrbzElement.__repr___s)T\\2d8,DDDrc. |j|dz|jz|j}|jD]@}|jd|zt |||j |jdB|j r|jdt|j dk(r[|j djtjtjfvr"|j dj|dddnJ|j||j D]}|j|||z|||j||jd|jd|y|jd |zy) Nrz %s="rrr>rrz%s) rr_get_attributesrrrr/rr$r r`rr&)rr+r) addindentr*r a_namerUs rr&zElement.writexmlbsC   VCZ$,,./$$&jjlF LLF* + f 3 3 4 LL # ?? LL DOO$)"++(?(?0AA"++FBB? T" OODMM&&*:ItL, V$ LLdllD9 : LL 'rcd|jt|j|j|Sr-)rkrrrrs rrzElement._get_attributess% !DKK==rc|jryyrrrs r hasAttributeszElement.hasAttributess ;;rcH|j|}|j|yr-)rwsetIdAttributeNode)rridAttrs rsetIdAttributezElement.setIdAttributes &&t, 'rcJ|j||}|j|yr-)r|r)rrrrs rsetIdAttributeNSzElement.setIdAttributeNSs"((yA 'rcr||j|jstjj t |tjj |jsGd|_|xjdz c_|jxjdz c_ t|yy)NTr>) ryrrCrDrL_get_containing_entrefNoModificationAllowedErrrrrjrrN)rrs rrzElement.setIdAttributeNodes >1D1D!E''%%' ' !$ ' 3''224 4}} FM  A %    . .! 3 . D ! rrrr).rrrrr rdr$rrrrrrr`rrrBrrrkrurorbrsruryrrwr|rxsetAttributeNodeNSrrrremoveAttributeNodeNSrrrrrbr&rrrrrr rrrhrhs1I  HIJO**99**0033 5.=T* 2   &.") < &*'' 0#: G7E(@>(( "rrhrz*NamedNodeMap of attributes on the element.z%Namespace-local name of this element.ct||j||j|j<||j|j |j f<||_yr-)rNrkrrrrrr)elementrqs rrrsQG  $GNN499<@Gd''89  Drc\eZdZ dZdZeZdZdZdZ dZ dZ dZ dZ dZd Zd Zy) Childlessr Ncyr-r rs rr7zChildless._get_firstChildrrcyr-r rs rr;zChildless._get_lastChildrrcZtjj|jdz)Nz nodes cannot have childrenrCrDrErrNs rrIzChildless.appendChild&gg)) MM9 9; ;rcyrr rs rr0zChildless.hasChildNodesrcZtjj|jdzNz nodes do not have childrenrrrRrSs rrAzChildless.insertBeforerrcZtjj|jdzr)rCrDrLrr^s rrHzChildless.removeChilds&gg!! MM9 9; ;rcyr-r rs rrezChildless.normalizes rcZtjj|jdzrrrrRrZs rr[zChildless.replaceChildrr)rrrrr EmptyNodeListr/rrr7r;rIr0rArHrer[r rrrrsLIJJJI;;; ;rrcreZdZejZdZdZdZdZ e ee Z dZ dZ e e e Zd dZy) ProcessingInstructiontargetrac ||_||_yr-r)rrras rrzProcessingInstruction.__init__s  rc|jSr-rars r_get_nodeValuez$ProcessingInstruction._get_nodeValuerdrc||_yr-rrs r_set_nodeValuez$ProcessingInstruction._set_nodeValues  rc|jSr-rrs r _get_nodeNamez#ProcessingInstruction._get_nodeNamerrc||_yr-rrs r _set_nodeNamez#ProcessingInstruction._set_nodeNames  rc d|j|d|jd|jd|y)Nz)rrrarr+r)rr*s rr&zProcessingInstruction.writexmls t{{DIItLMrNr)rrrr rr$rrrrrrrrrr&r rrrrsI//H"I 8I }5HNrrcfeZdZdZdZdZeZdZdZe eexZ Z dZ dZ dZd Zd Zd Zy ) CharacterData)_datarjrGrQrPctdx|_|_dx|_|_d|_t j |yr)rjrGrQrPrr rrs rrzCharacterData.__init__s4/33T_266t/  drc,t|jSr-)rrars rrzCharacterData._get_length499~rc|jSr-rrs r _get_datazCharacterData._get_datarrc||_yr-rrras r _set_datazCharacterData._set_datas  rc|j}t|dkDrd}nd}d|jjd|dd|dS)N z...rz)rarrar)rra dotdotdots rrbzCharacterData.__repr__ sByy t9r>II NN # #T!BZ< >.."yy) $ 2 2 ??tt'A'AA|++G4,,Wd;IIgv& rc<t|||j|yr-)rrars rr&z Text.writexmlUsF 4@Arc|jg}|j}|Y|jtjtj fvr)|j d|j|j}nn|Y|j}|X|jtjtj fvr(|j|j|j}nn|Xdj|S)Nrr) rarQr$r r`rrOrPrcjoin)rrfrGs r_get_wholeTextzText._get_wholeTextZs YYK  mzzdnnd.E.EFFAFF#%% m   mzzdnnd.E.EFF MM m wwqzrc|j}|j}|P|jtjtj fvr |j}|j ||}nn|P|j}|s|j ||P|jtjtj fvr |j}|j ||}nn|P|r ||_|Syr-) rGrQr$r r`rrHrPra)rcontentrrGrs rreplaceWholeTextzText.replaceWholeTextls  mzzdnnd.E.EFF((""1% m      t $mzzdnnd.E.EFF}}""1% m DIKrc|jjryt|}|y|jj |}|y|j Sr)rastrip_get_containing_elementrjrisElementContent)rrrs r!_get_isWhitespaceInElementContentz&Text._get_isWhitespaceInElementContentsR 99?? &t, <!!006 <((* *rr)rrrrr r`r$rrrr&rrrr rrrr?s4I~~HHJ B $8 +rrisWhitespaceInElementContentzKTrue iff this text node contains only whitespace and is in element content. wholeTextz.The text of all logically-adjacent text nodes.c||j}|.|jtjk(r|S|j}|.yr-)rGr$r rdrUrTs rrrs< A - ::** *H LL - rc||j}|.|jtjk(r|S|j}|.yr-)rGr$r rr s rrrs< A - ::33 3H LL - rc6eZdZejZdZdZddZy)Commentz#commentc<tj|||_yr-)rrrrs rrzComment.__init__st$ rc|d|jvr td|j|d|jd|y)Nz--z%'--' is not allowed in a comment nodez)rarKrrs rr&zComment.writexmls1 499 DE E  4@ArNr) rrrr rr$rrr&r rrr r s  HHBrr c4eZdZdZej ZdZddZy) CDATASectionr z#cdata-sectionc|jjddk\r td|jd|jzy)Nz]]>rz$']]>' not allowed in a CDATA sectionz)rafindrKrrs rr&zCDATASection.writexmls9 99>>% A %CD D % 12rNr) rrrrr rr$rr&r rrrrsI&&HH3rrc`eZdZdZddZdZdZdZdZdZ dZ d Z d Z d Z d Zd ZdZy)ReadOnlySequentialNamedNodeMap_seqc||_yr-r)rseqs rrz'ReadOnlySequentialNamedNodeMap.__init__s  rc,t|jSr-rrrs rrXz&ReadOnlySequentialNamedNodeMap.__len__rrc,t|jSr-rrs rrz*ReadOnlySequentialNamedNodeMap._get_lengthrrcL|jD]}|j|k(s|cSyr-)rrrFs rr@z+ReadOnlySequentialNamedNodeMap.getNamedItems!AzzT!rcl|jD]%}|j|k(s|j|k(s#|cSyr-)rrrrJs rrCz-ReadOnlySequentialNamedNodeMap.getNamedItemNSs,A~~-!++2Jrct|tr|j|}n|j|}| t ||Sr-)rr@rCr@r)r name_or_tuplerUs rr8z*ReadOnlySequentialNamedNodeMap.__getitem__sC mU +&4&& 6D$$]3D <=) ) rcL|dkry |j|S#t$rYywxYwr6)rrrs rrz#ReadOnlySequentialNamedNodeMap.items2 19 99U# #  s  ##c@tjjdNz"NamedNodeMap instance is read-onlyrCrDrr?s rrHz.ReadOnlySequentialNamedNodeMap.removeNamedItemgg.. 02 2rc@tjjdr#r$rBs rrKz0ReadOnlySequentialNamedNodeMap.removeNamedItemNSr%rc@tjjdr#r$rNs rr:z+ReadOnlySequentialNamedNodeMap.setNamedItemr%rc@tjjdr#r$rNs rrOz-ReadOnlySequentialNamedNodeMap.setNamedItemNSr%rc|jgSr-rrs rrSz+ReadOnlySequentialNamedNodeMap.__getstate__s {rc|d|_yr6rrUs rrWz+ReadOnlySequentialNamedNodeMap.__setstate__s !H rN)r )rrrrrrXrr@rCr8rrHrKr:rOrSrWr rrrrsHI  2222rrz&Number of entries in the NamedNodeMap.c$eZdZ dZdZdZdZy) IdentifiedpublicIdsystemIdc ||_||_yr-r-)rr.r/s r_identified_mixin_initz!Identified._identified_mixin_init s    rc|jSr-)r.rs r _get_publicIdzIdentified._get_publicId }}rc|jSr-)r/rs r _get_systemIdzIdentified._get_systemIdr4rN)rrrrr1r3r6r rrr,r,sJ&I!rr,cReZdZejZdZdZdZdZ dZ dZ dZ dZ ddZy) DocumentTypeNct|_t|_|rt|\}}||_|j|_yr-)rentities notationsr{rr)rr}rr~s rrzDocumentType.__init__s:68 79  ( 7 FI!DI  rc|jSr-)internalSubsetrs r_get_internalSubsetz DocumentType._get_internalSubset'"""rc|jtd}|j|_|j|_tj j j}|r\g|j_ g|j_ |jjD]e}t|j|j|j}|jjj||j|||g|jjD]}t!|j|j|j|j"}|j$|_|j&|_|j(|_|jjj||j||||j||||Syr-)rjr8rrrCrDUserDataHandler NODE_CLONEDr:rr;Notationr.r/rcrEntity notationNameactualEncodingrrr)rrkclonerrGnotationeentitys rrlzDocumentType.cloneNode*sY    % &EEJ!YYEN//;;I&(#')$,,A' AJJ KHOO((//9--iHE-++A#AJJ AJJ$%NN4F,-,<,rlr&r rrr8r8s:&&HI DHHN"#6 rr8cheZdZdZej ZdZdZdZ dZ dZ dZ dZ dZdZdZdZd Zy) rDNcb||_||_t|_|j ||yr-)rrErr/r1)rrr.r/rHs rrzEntity.__init__\s* $"* ##Hh7rc|jSr-rFrs r_get_actualEncodingzEntity._get_actualEncodingbr?rc|jSr-rrs r _get_encodingzEntity._get_encodinger4rc|jSr-rrrs r _get_versionzEntity._get_versionhrrc@tjjd)Nz(cannot append children to an entity noderCrDrE)rrRs rrIzEntity.appendChildksgg)) 68 8rc@tjjd)Nz+cannot insert children below an entity noder[rs rrAzEntity.insertBeforeosgg)) 9; ;rc@tjjd)Nz*cannot remove children from an entity noder[r^s rrHzEntity.removeChildssgg)) 8: :rc@tjjd)Nz)cannot replace children of an entity noder[rs rr[zEntity.replaceChildwsgg)) 79 9r)rrrrr ENTITY_NODEr$rrFrrrrrSrVrYrIrArHr[r rrrDrDSsNJHINHG8 #8;:9rrDc.eZdZejZdZdZy)rCNc6||_|j||yr-)rr1)rrr.r/s rrzNotation.__init__s  ##Hh7r)rrrr rr$rrr rrrCrC{s!!HI8rrCc2eZdZgdZdZdZdZdZdZy)DOMImplementation))core1.0)rd2.0)rdN)rCre)rCrf)rCN)ls-loadz3.0)rgNcL|dk(rd}|j|f|jvSr)lower _featuresrps rrozDOMImplementation.hasFeatures( b=G )T^^;;rcH|r+|jtjjd|j }|duxr |duxr|du }|s!|rtjj d|rt |\}}|dk(r$|dk7rtjjd|r!|stjjd|j||}|r|j||j||r|x|_|_ ||_ ||_ |S)Nz(doctype object owned by another DOM treezElement with no namerCz$http://www.w3.org/XML/1998/namespacezillegal use of 'xml' prefixz(illegal use of prefix without namespaces) rGrCrDWrongDocumentErr_create_documentInvalidCharacterErrr{rcreateElementNSrIrjdoctypern) rrr}rpradd_root_elementrr~rs rcreateDocumentz DOMImplementation.createDocuments. w))5''**:< <##% , 4!4$1T$9!4$+tO5!1''--.DE E  ( 7 FI#IIgg**+HIIlgg**>@@)), FG( OOG $ 9< x7"   8 +#'D  (''%%' ' (s A (A1ch|jD]#}|jtjk(s!|cSyr-)r/r$r rdrNs rrzDocument._get_documentElementds'OOD}} 1 11 $rc|j!|jjd|_tj|yr-)rprbr rs rrbzDocument.unlinkis/ << # LL   !DL Drc|sy|jjddd}|j|_|j|_|j|_|j D]s}t |||}|j j||jtjk(rn$|jtjk(r||_ ||_ u|jtj j"j$|||Sr-)rnrrrrrrr/rircr$r r%rNrprGrrCrDrArB)rrkrGrG childclones rrlzDocument.cloneNodeos##224tD??  A$Qe4J    # #J /""d&8&88$$(?(?? * $)J !! $$SWW%<%<%H%H%)5 2 rc(t}||_|Sr-)rrj)rrs rcreateDocumentFragmentzDocument.createDocumentFragments  rc*t|}||_|Sr-)rhrj)rrrIs r createElementzDocument.createElements G rclt|ts tdt}||_||_|SNznode contents must be a string)rrr;rrarj)rrats rcreateTextNodezDocument.createTextNodes2$$<= = Frclt|ts tdt}||_||_|Sr)rrr;rrarjrrarTs rcreateCDATASectionzDocument.createCDATASections2$$<= = Nrc*t|}||_|Sr-)r rjrs r createCommentzDocument.createComments DMrc,t||}||_|Sr-)rrj)rrraps rcreateProcessingInstructionz$Document.createProcessingInstructions !&$ /rc8t|}||_d|_|Sr)rrjr)rras rcreateAttributezDocument.createAttributes KrcJt|\}}t|||}||_|Sr-)r{rhrj)rrr}rrrIs rrozDocument.createElementNSs+$]3 M< 8rcZt|\}}t||||}||_d|_|Sr)r{rrjr)rrr}rrrs rcreateAttributeNSzDocument.createAttributeNSs4$]3  i @rc0t||||}||_|Sr-)rDrj)rrr.r/rErIs r_create_entityzDocument._create_entitys 48\ :rc.t|||}||_|Sr-)rCrj)rrr.r/rGs r_create_notationzDocument._create_notations T8X .rc||jvr|j|S|js |jsy|j}||jg}||_n|syd}|r|j }|j |jDcgc]}|jtvr|c}|j|}|r.|jjD]}|jrb|j|j|js7||j|j <|j |k(r|}b|j"ron|j%|j&r:||j|j <|j |k(r|}|j"rn|j(s||j|j <|j |k(r|}|j"dk(snenc|j"rW|jjD]:}|j(s||j|j <|j |k(s9|}<| |S|r|Scc}w)Nr>)rrrrrpopextendr/r$rMrrrrrrrrrrr)rr'stackresultrUrgrrqs rgetElementByIdzDocument.getElementByIds  >>"% %4#7#7%% =))*E$)D !99;D LLT__I_E"^^/GG _I J&&t,D!OO224D((;;t'8'8$..I9=DNN4::6#zzR/)-%)%9%9 %499-59tzz2::+%)F!%!5!5!59tzz2::+%)F!11Q6!'5(%% OO224D{{59tzz2::+%)F 5 ! ON IIs Ic,t||tSr-rr?s rrzDocument.getElementsByTagNames.tT8:FFrc.t|||tSr-rrBs rrzDocument.getElementsByTagNameNSrrc:|jj||Sr-)rnrorps rrszDocument.isSupported s""--gw??rc |jtjk(rtjj d|jtj k(rtjj dt|||S)Nzcannot import document nodesz!cannot import document type nodes)r$r r%rCrDNotSupportedErrrNri)rrUrks r importNodezDocument.importNode sa ==D.. .''))*HI I ]]d55 5''))*MN N4t,,rcg}|r|jd|d||jd|rdndd|jddj|d||jD]}|j ||||y) Nz encoding="rz standalone="yesnozrzillegal use of 'xmlns' prefixz$illegal use of the 'xmlns' attribute)rjrCrDrlr$r rdrrrrrrrrrrrrrrrrxr)rrGrrrrris_ids r renameNodezDocument.renameNode#s ??$ &''**,0!//CD D ::d//1D1DE E''))JL L ? *d{$(JJsA$6! '&#''*A*AA''..799go&#''*A*AA**(;(;;''..>@@ FI ::,, ,nnG"++A.G  % ::** *AIAF"((+..q1 r)rrrNN)=rrrrr rdrrrNrBrcrnr%r$rrrrGrQrPrFrrrrrrrrrrrSrrrVrrrrYrIrHrrbrlrrrrrrrrorrrrrrrsrr&rr rrrwrwsE@I**D,L,L**D,C,CE'(N!!HHIJJ$((Ok NHJGLKO%(# !(,   *        8tG7@-KO  ; 3rrwrz#Top-level element of this document.c |jj|r%tjjj }n$tjjj }|jtjk(r|j|j|j}|jjD]j}|j|j|j|j |j#|j|j$}|j&|_l|r|j(D] }t+|||}|j-|"n|jtj.k(rD|j1}|r|j(D] }t+|||}|j-|"n|jtj2k(r|j5|j6}nM|jtj8k(r|j;|j6}n|jtj<k(r(|j?|j@|j6}n|jtjBk(r|jE|j6}n|jtjFk(r@|jI|j|j}d|_|j |_n7|jtjJk(rtjjj }|jLjO|jP|jR|jT}||_|rg|jV_,g|jZ_,|jZjXD]y} t]| j| jR| jT} || _|jZjXj_| ta| dsg| jc|| | {|jVjXD]} te| j| jR| jT| jf} | jh| _4| jj| _5| jl| _6|| _|jVjXj_| ta| ds| jc|| | n+tjjodtq|zta|dr|jc||||S)NTrzCannot clone node %s)9rjryrCrDrArB NODE_IMPORTEDr$r rdrorrrrrrr|rrr/rirIr?rr`rrarrrrrrrrrrNrnrtrr.r/r:rr;rCrcrrrDrErFrrrrrF) rUrknewOwnerDocumentrrGrqrrgrTrGrHrIrJs rriri\s $$%56GG++77 GG++99  }}))) 001B1B15@OO**,D  !2!2DMM4:: N(():):DNNKA..AK- t-=>!!!$) $55 5 779 t-=>!!!$) $.. ( // : $11 1 33DII> $:: : <r)rr)r}fieldss rr{r{s4  a (F 6{a fQi  rc~||i|}|j\}}|j||j|Sr-)getEvent expandNoder)funcargskwargseventstoktyperootNodes r_do_pulldom_parsers> 4 "6 "F)GX h LLN Orc| ||sddlm}|j|Sddlm}t |j|f||dS)Nr expatbuilderpulldom)parserbufsize)xml.domrparserr)filerrrrs rrrsB= ~g(!!$''# ' 24 4rcv |ddlm}|j|Sddlm}t |j|fd|iS)Nrrrr)rr parseStringrr)stringrrrs rrrsB0 ~(''//# !4!4vi"*F!35 5rc|rQt|trtj|}|D]'\}}tj j ||r'ytj Sr-)rrr_parse_feature_stringrwrnro)featuresfvs rgetDOMImplementationrsT h $33H=HDAq**55a;  " ""rrr-)5r rrCrrrrxml.dom.minicompatxml.dom.xmlbuilderrr rDr rdrrM defpropertyrXrrrrrobjectr AttributeListr[rrhrrrrrrrr rrr,r8rDrCrcryrNrwrir{rrrrr rrrs" JJ > GGLL55GGLL>>@t377<<tl D,$@A D+$?@ D+$HI%t%$z84z8x D&$FG D+$MN D,$EFa?6a?F L(68 v( D$ M"dM"^ G\<> G[79  &;&;RNItN4ECItECN M8)EFS+=S+j D0./ D+@B Bm B 34 3<V<| *H8:  ::y$:x&9Z&9P8z9d8M+M^(&(T2QtZQf  H'57Od!45#rPK]Ɔ77__init__.cpython-312.pycnu[ ֦iUp8ddlZddlZddlZddlZddlZddlZddlZddlZddlZddl Z ddl Z ddl Z ddl Z ddl Z ddlZddlZddlZddlmZmZddlmZmZddlmZmZddlmZmZddlmZmZddlmZdd l m!Z!dd l"m#Z#dd l m$Z$dd l%m&Z&m'Z'm(Z(m)Z)gd Z*Gdde+Z,GddZ-GddZ.Gdde.Z/Gdde0Z1GddejdZ3GddZ4GddZ5Gdde5Z6Gd d!e#Z7Gd"d#Z8Gd$d%Z9Gd&d'Z:Gd(d)e7Z;Gd*d+e6Zd.ej:fd/Z?d0Z@e jeejd12ZC d.e1fd3ZDd4ZEd5ZFd.e'eGe&eGffd6ZHd7ZId8ZJy)9N) _adapters_meta)FreezableDefaultDictPair) method_cache pass_none)always_iterableunique_everseen)PackageMetadata SimplePath)suppress) import_module)MetaPathFinder)starmap)ListMappingOptionalcast) DistributionDistributionFinderr PackageNotFoundError distribution distributions entry_pointsfilesmetadatapackages_distributionsrequiresversionc&eZdZdZdZedZy)rzThe package was not found.c d|jS)Nz"No package metadata was found for nameselfs 4/usr/lib64/python3.12/importlib/metadata/__init__.py__str__zPackageNotFoundError.__str__3s3DII;??c"|j\}|SN)argsr&r$s r'r$zPackageNotFoundError.name6s)) r)N)__name__ __module__ __qualname____doc__r(propertyr$r)r'rr0s$@r)rceZdZdZej dj ZedZ e ddZ e dZ y) Sectioneda A simple entry point config parser for performance >>> for item in Sectioned.read(Sectioned._sample): ... print(item) Pair(name='sec1', value='# comments ignored') Pair(name='sec1', value='a = 1') Pair(name='sec1', value='b = 2') Pair(name='sec2', value='a = 2') >>> res = Sectioned.section_pairs(Sectioned._sample) >>> item = next(res) >>> item.name 'sec1' >>> item.value Pair(name='a', value='1') >>> item = next(res) >>> item.value Pair(name='b', value='2') >>> item = next(res) >>> item.name 'sec2' >>> item.value Pair(name='a', value='2') >>> list(res) [] zm [sec1] # comments ignored a = 1 b = 2 [sec2] a = 2 cJd|j||jDS)Nc3K|]?}|j1|jtj|jAyw)N)value)r$_replacerparser8).0sections r' z*Sectioned.section_pairs..gs= <||'   4::gmm#<  =linesr$r8 section_matchs r'r?zSectioned.readmsrwCIIt/@ ABE!,,S1IennS6IM{{4(tU# # sBBc.|xr|jd S)N#)rL)lines r'r@zSectioned.validxs0DOOC000r)r+) r.r/r0r1textwrapdedentlstrip_sample classmethodrC staticmethodr?r@r3r)r'r5r5<sf8hoo   fh   $$11r)r5cVeZdZdZej ejdedZ dZ y)DeprecatedTuplea Provide subscript item access for backward compatibility. >>> recwarn = getfixture('recwarn') >>> ep = EntryPoint(name='name', value='value', group='group') >>> ep[:] ('name', 'value', 'group') >>> ep[0] 'name' >>> len(recwarn) 1 zAEntryPoint tuple interface is deprecated. Access members by name. stacklevelcH|j|j|Sr+)_warn_key)r&items r' __getitem__zDeprecatedTuple.__getitem__s yy{4  r)N) r.r/r0r1 functoolspartialwarningswarnDeprecationWarningr_rbr3r)r'rZrZ}s0  I   K  E!r)rZceZdZUdZej dZ eed<eed<eed<dZ e ded<d Z d Z e d Ze d Ze d ZdZdZdZdZdZdZdZdZy) EntryPointaAn entry point as defined by Python packaging conventions. See `the packaging docs on entry points `_ for more information. >>> ep = EntryPoint( ... name=None, group=None, value='package.module:attr [extra1, extra2]') >>> ep.module 'package.module' >>> ep.attr 'attr' >>> ep.extras ['extra1', 'extra2'] zH(?P[\w.]+)\s*(:\s*(?P[\w.]+)\s*)?((?P\[.*\])\s*)?$r$r8groupNrdistc>t|j|||y)Nr$r8rjvarsupdate)r&r$r8rjs r'__init__zEntryPoint.__init__s T t5>r)c|jj|j}t|j d}t d|j dxsdj d}tjt||S)zLoad the entry point from its definition. If only a module is indicated by the value, return that module. Otherwise, return the named object. moduleNattr.) patternmatchr8rrjrGsplitrcreducegetattr)r&rxrsattrss r'loadzEntryPoint.loadsi  ""4::.u{{845tekk&17R>>sCD77r)cn|jj|j}|jdS)Nrsrwrxr8rjr&rxs r'rszEntryPoint.modules) ""4::.{{8$$r)cn|jj|j}|jdS)Nrtrrs r'rtzEntryPoint.attrs) ""4::.{{6""r)c|jj|j}tjd|j dxsdS)Nz\w+extrasru)rwrxr8refindallrjrs r'rzEntryPoint.extrass9 ""4::.zz&%++h"7"=2>>r)c<t|j||S)Nrkrn)r&rks r'_forzEntryPoint._fors T t$ r)c ~fd|D}tttj|j |S)a$ EntryPoint matches the given parameters. >>> ep = EntryPoint(group='foo', name='bar', value='bing:bong [extra1, extra2]') >>> ep.matches(group='foo') True >>> ep.matches(name='bar', value='bing:bong [extra1, extra2]') True >>> ep.matches(group='foo', name='other') False >>> ep.matches() True >>> ep.matches(extras=['extra1', 'extra2']) True >>> ep.matches(module='bing') True >>> ep.matches(attr='bong') True c36K|]}t|ywr+r{)r;paramr&s r'r=z%EntryPoint.matches..s:6%u%6s)allrHoperatoreqvalues)r&paramsr|s` r'matcheszEntryPoint.matchess-(;6:3x{{FMMOU;<BZZN! % r)c4t|jSr+)hashr`r%s r'__hash__zEntryPoint.__hash__ sDIIK  r))r.r/r0r1rcompilerwrI__annotations__rkrrqr}r2rsrtrrrr`rrrrrr3r)r'riris bjj %G  I J J%)D(> ")?8%%##??=.1*+B !r)ric`eZdZdZdZdZdZedZedZ e dZ e dZ y ) EntryPointszC An immutable collection of selectable EntryPoint objects. r3c| tt|j|S#t$r t |wxYw)z; Get the EntryPoint in self matching name. r#)nextiterselect StopIterationKeyErrorr-s r'rbzEntryPoints.__getitem__s; !T[[d[345 5 !4.  !s#&;c ,tfd|DS)zv Select entry points from self that match the given parameters (typically group and/or name). c3HK|]}|jdis|yw)Nr3)r)r;eprs r'r=z%EntryPoints.select..&s"E"  0DV0D2s"")r)r&rs `r'rzEntryPoints.select!s EEEEr)c@|Dchc]}|jc}Scc}w)zB Return the set of all names of all entry points. r#r&rs r'nameszEntryPoints.names(s #''$B$'''c@|Dchc]}|jc}Scc}w)zC Return the set of all groups of all entry points. )rjrs r'groupszEntryPoints.groups/s $((4R4(((rcD|fd|j|DS)Nc3@K|]}|jywr+)r)r;rrks r'r=z-EntryPoints._from_text_for..8s@+?R2774=+?) _from_text)rArBrks `r'_from_text_forzEntryPoints._from_text_for6s@3>>$+?@@@r)cBdtj|xsdDS)Nc3K|]D}t|jj|jj|jFyw)rmN)rir8r$)r;ras r'r=z)EntryPoints._from_text..<s: ; DJJOO4::3C3C499 U U;sA A ru)r5rC)rBs r'rzEntryPoints._from_text:s# !// ;  r)N)r.r/r0r1 __slots__rbrr2rrrWrrXrr3r)r'rrskI!F(( )) AA  r)rc$eZdZdZddZdZdZy) PackagePathz"A reference to a path in a packagec|jj|5}|jcdddS#1swYyxYw)Nencodinglocateopenr?)r&rstreams r' read_textzPackagePath.read_textEs0 [[]    2f;;=3 2 2s ;Ac|jjd5}|jcdddS#1swYyxYw)Nrbr)r&rs r' read_binaryzPackagePath.read_binaryIs- [[]   %;;=& % %s :Ac8|jj|S)z'Return a path-like object for this path)rk locate_filer%s r'rzPackagePath.locateMsyy$$T**r)N)utf-8)r.r/r0r1rrrr3r)r'rrBs,!!+r)rceZdZdZdZy)FileHashcB|jd\|_}|_y)N=) partitionmoder8)r&spec_s r'rqzFileHash.__init__Ss#'>>##6  1djr)c<d|jd|jdS)Nz)rr8r%s r'rzFileHash.__repr__Vs!$))HTZZLBBr)N)r.r/r0rqrr3r)r'rrRs 7Cr)rceZdZfdZxZS)DeprecatedNonAbstractc .tj|Dchc]}t|D]}|}}}|Dchc]}tt||ddr|}}|rt j d|t dt|!|Scc}}wcc}w)N__isabstractmethod__FzUnimplemented abstract methods r[r\) inspectgetmroror{rerfrgsuper__new__)rAr,kwargssubclassr$ all_namesabstract __class__s r'rzDeprecatedNonAbstract.__new__[s!(!4 !4XhDD!4  " !wsD)+A5I !   MM1(<"  ws##  s B  B)r.r/r0r __classcell__rs@r'rrZs $$r)rcreZdZdZej deefdZej dZ e defdZ e dZ e dZe d Zedej$fd Zed Zed Zed ZedZedZdZdZdZedZdZdZe dZe dZ y)rzA Python distribution package.returncy)zAttempt to load metadata file given by the name. :param filename: The name of the file in the distribution info. :return: The text if found, otherwise None. Nr3r&filenames r'rzDistribution.read_textpr)cy)z[ Given a path to a file in this distribution, return a path to it. Nr3r&paths r'rzDistribution.locate_filexrr)r$c|s td t|j|S#t$r t |wxYw)aReturn the Distribution for the given package name. :param name: The name of the distribution package to search for. :return: The Distribution instance (or subclass thereof) for the named package, if found. :raises PackageNotFoundError: When the named package's distribution metadata cannot be found. :raises ValueError: When an invalid value is supplied for name. z A distribution name is required.r#) ValueErrorrdiscoverrr)rAr$s r' from_namezDistribution.from_namesH?@ @ - $ /0 0 -&t, , -s*?c |jddr |r tdxstjdi|tj j fd|jDS)aReturn an iterable of Distribution objects for all packages. Pass a ``context`` or pass keyword arguments for constructing a context. :context: A ``DistributionFinder.Context`` object. :return: Iterable of Distribution objects for all packages. contextNz cannot accept context and kwargsc3.K|] }|ywr+r3)r;resolverrs r'r=z(Distribution.discover..s- .G(HW .Gsr3)poprrContext itertoolschain from_iterable_discover_resolvers)rArrs @r'rzDistribution.discoversl**Y- v?@ @A/77A&A,,- .1.E.E.G-   r)c>ttj|S)zReturn a Distribution for the indicated metadata path :param path: a string or path-like object :return: a concrete Distribution instance for the path )PathDistributionpathlibPathrs r'atzDistribution.ats  T 233r)cHdtjD}td|S)z#Search the meta_path for resolvers.c36K|]}t|ddyw)find_distributionsNr)r;finders r'r=z3Distribution._discover_resolvers..s FSFGF0$ 7msN)sys meta_pathrG)declareds r'rz Distribution._discover_resolverss$ FImm dH%%r)c|jdxs$|jdxs|jd}tt|}tjt j |S)zReturn the parsed metadata for this Distribution. The returned object will have keys that name the various bits of metadata. See PEP 566 for details. METADATAzPKG-INFOru)rrrIrMessageemailmessage_from_string)r&opt_textrBs r'rzDistribution.metadatasc NN: & "~~j) " ~~b! C"  !:!:4!@AAr)c |jdS)z8Return the 'Name' metadata for the distribution package.Namerr%s r'r$zDistribution.names}}V$$r)c@tj|jS)z(Return a normalized version of the name.)Prepared normalizer$r%s r'_normalized_namezDistribution._normalized_names!!$)),,r)c |jdS)z;Return the 'Version' metadata for the distribution package.Versionrr%s r'r zDistribution.versions}}Y''r)cLtj|jd|S)Nzentry_points.txt)rrrr%s r'rzDistribution.entry_pointss))$..9K*LdSSr)cdfd tfd}td}||jxs"jxsjS)aZFiles in this distribution. :return: List of PackagePath for this distribution or None Result is `None` if the metadata file that enumerates files (i.e. RECORD for dist-info, or installed-files.txt or SOURCES.txt for egg-info) is missing. Result may be empty if the metadata exists but is empty. c|t|}|r t|nd|_|r t|nd|_|_|Sr+)rrrintsizerk)r$rsize_strresultr&s r' make_filez%Distribution.files..make_files7 &F,0(4.dFK+3#h-FKFKMr)cBttj|Sr+)rcsvreader)rNr"s r' make_filesz&Distribution.files..make_filess9cjj&78 8r)c.ttd|S)Nc>|jjSr+)rexistsrs r'z@Distribution.files..skip_missing_files..sDKKM,@,@,Br))listrG) package_pathss r'skip_missing_filesz.Distribution.files..skip_missing_filessBMRS Sr))NN)r _read_files_distinfo_read_files_egginfo_installed_read_files_egginfo_sources)r&r&r-r"s` @r'rzDistribution.filessw   9  9  T  T" ))+65576335   r)cL|jd}|xr|jS)z* Read the lines of RECORD RECORD)rrKr&rBs r'r.z!Distribution._read_files_distinfos$~~h')))r)cjd}tdd|rsyfd|jD}tdj|S)a Read installed-files.txt and return lines in a similar CSV-parsable format as RECORD: each file must be placed relative to the site-packages directory and must also be quoted (since file names can contain literal commas). This file is written when the package is installed by pip, but it might not be written for other installation methods. Assume the file is accurate if it exists. zinstalled-files.txt_pathNc3K|]S}|z jjjdjdjUyw)ruT)walk_upN)resolve relative_toras_posix)r;r$r&subdirs r'r=z=Distribution._read_files_egginfo_installed..sV * d] WY [))"-557[ F XZ *sAA"{}")rr{rKrHformat)r&rBpathsr;s` @r'r/z*Distribution._read_files_egginfo_installedsW~~34w-6  )  6==%((r)ct|jd}|xr$tdj|jS)a Read SOURCES.txt and return lines in a similar CSV-parsable format as RECORD: each file name must be quoted (since it might contain literal commas). Note that SOURCES.txt is not a reliable source for what files are installed by a package. This file is generated for a source archive, and the files that are present there (e.g. setup.py) may not correctly reflect the files that are present after the package has been installed. z SOURCES.txtr<)rrHr=rKr3s r'r0z(Distribution._read_files_egginfo_sourcess/~~m,=FMM4??+<==r)cd|jxs|j}|xr t|S)z6Generated requirements specified for this Distribution)_read_dist_info_reqs_read_egg_info_reqsr+)r&reqss r'rzDistribution.requires.s/((*Hd.F.F.H"T "r)c8|jjdS)Nz Requires-Dist)rget_allr%s r'rAz!Distribution._read_dist_info_reqs4s}}$$_55r)cZ|jd}t|j|S)Nz requires.txt)rr _deps_from_requires_text)r&sources r'rBz Distribution._read_egg_info_reqs7s(/7y667??r)cJ|jtj|Sr+)%_convert_egg_info_reqs_to_simple_reqsr5r?)rArHs r'rGz%Distribution._deps_from_requires_text;s889OPPr)c#Kdfd}d}|D]8}||j}|j|z||jz:yw)a Historically, setuptools would solicit and store 'extra' requirements, including those with environment markers, in separate sections. More modern tools expect each dependency to be defined separately, with any relevant extras and environment markers attached directly to that requirement. This method converts the former to the latter. See _test_deps_from_requires_text for an example. c|xrd|dS)Nz extra == ""r3r#s r'make_conditionzJDistribution._convert_egg_info_reqs_to_simple_reqs..make_conditionKs0ja0 0r)c |xsd}|jd\}}}|r|rd|d}ttd||g}|rddj|zSdS)Nru:(rz; z and )rr+rGjoin)r<extrasepmarkers conditionsrNs r' quoted_markerzIDistribution._convert_egg_info_reqs_to_simple_reqs..quoted_markerNskmG")"3"3C"8 E3gYa.fTG^E5J+KLMJ6@4',,z22 Hb Hr)cdd|vzS)z PEP 508 requires a space between the url_spec and the quoted_marker. Ref python/importlib_metadata#357.  @r3)reqs r' url_req_spacezIDistribution._convert_egg_info_reqs_to_simple_reqs..url_req_spaceVs #*% %r)N)r8r$)sectionsrWr\r<spacerNs @r'rJz2Distribution._convert_egg_info_reqs_to_simple_reqs?sN 1 I & G!'--0E--%'- *EE E sA A N)!r.r/r0r1abcabstractmethodrrIrrrWrrrXrrr2rr rr$rr rrr.r/r0rrArBrGrJr3r)r'rrms~( Xc]     -S--"  "44&&B%//BB"%%--((TT    D*)8 >## 6@QQ F Fr)rcVeZdZdZGddZej efdZy)rzJ A MetaPathFinder capable of discovering installed distributions. c,eZdZdZdZ dZedZy)DistributionFinder.Contextaw Keyword arguments presented by the caller to ``distributions()`` or ``Distribution.discover()`` to narrow the scope of a search for distributions in all DistributionFinders. Each DistributionFinder may expect any parameters and should attempt to honor the canonical parameters defined below when appropriate. Nc 8t|j|yr+rn)r&rs r'rqz#DistributionFinder.Context.__init__zs J  f %r)cTt|jdtjS)z The sequence of directory path that a distribution finder should search. Typically refers to Python installed package paths such as "site-packages" directories and defaults to ``sys.path``. r)rogetr rr%s r'rzDistributionFinder.Context.path}s:>>&#((3 3r))r.r/r0r1r$rqr2rr3r)r'rrchs,   &  4  4r)rcy)z Find distributions. Return an iterable of all Distribution instances capable of loading the metadata for packages matching the ``context``, a DistributionFinder.Context instance. Nr3)r&rs r'rz%DistributionFinder.find_distributionsrr)N)r.r/r0r1rr_r`rr3r)r'rrcs144@ )0  r)rceZdZdZej fdZdZdZdZ dZ dZ e dZ ed ZxZS) FastPathzs Micro-optimized class for searching a path for children. >>> FastPath('').children() ['...'] c"t||Sr+)rr)rArootrs r'rzFastPath.__new__sws##r)c||_yr+)rk)r&rks r'rqzFastPath.__init__s  r)cBtj|j|Sr+)rrrk)r&childs r'joinpathzFastPath.joinpaths||DIIu--r)ctt5tj|jxsdcdddS#1swYnxYwtt5|j cdddS#1swYgSxYwNrv)r Exceptionoslistdirrk zip_childrenr%s r'childrenzFastPath.childrensP i ::dii.3/! i $$&!  s#=AA22A<ctj|j}|jj}|j|_t j d|DS)Nc3bK|]'}|jtjdd)yw)rrN)ry posixpathrT)r;rns r'r=z(FastPath.zip_children..s%Q5%U[[:1=5s-/)zipfilerrknamelistrodictfromkeys)r&zip_pathrs r'ruzFastPath.zip_childrensH<< * &&( )) }}Q5QQQr)cV|j|jj|Sr+)lookupmtimesearchr-s r'rzFastPath.searchs {{4::&--d33r)ctt5tj|jj cdddS#1swYnxYw|j jyr+)rOSErrorrsstatrkst_mtimer cache_clearr%s r'rzFastPath.mtimes< g 77499%..   !s )AA ct|Sr+)Lookup)r&rs r'rzFastPath.lookups d|r))r.r/r0r1rc lru_cacherrqrorvrurr2rrrrrs@r'ririsiY$$.R4"" r)riceZdZdefdZdZy)rrcltjj|jj }|j d}t t|_t t|_ |jD]}|j }|j dri|jddjdd}tj|}|j|j|j!||s|dk(s|jddjdd}tj#|}|j|j|j!||jj%|jj%y)Nz.eggz .dist-infoz .egg-inforvr-zegg-info)rsrbasenamerklowerrMrr+infoseggsrv rpartitionrrrappendrolegacy_normalizefreeze) r&rbase base_is_eggrnlowr$ normalizedlegacy_normalizeds r'rqzLookup.__init__sEww *002mmF+ )$/ (. ]]_E++-C||78~~c*1-77.s- .BdDKK !.Br)rrrrrHri)rAr$r>rs @r'rz MetadataPathFinder._search_pathss9D>,,- .1(E.B-   r)c@tjjyr+)rirr)rAs r'invalidate_cachesz$MetadataPathFinder.invalidate_cachess$$&r)N) r.r/r0rWrrrrrr3r)r'rrsH(:(B(B(D , ,  ''r)rceZdZdefdZdZej je_dZe fdZ e dZ xZ S)rrc||_y)zfConstruct a distribution. :param path: SimplePath indicating the metadata directory. N)r5rs r'rqzPathDistribution.__init__$s  r)ctttttt 5|j j|jdcdddS#1swYyxYw)Nrr) rFileNotFoundErrorIsADirectoryErrorrNotADirectoryErrorPermissionErrorr5rorrs r'rzPathDistribution.read_text+sK        ::&&x0::G:L   s +AA"c4|jj|z Sr+)r5parentrs r'rzPathDistribution.locate_file7szz  4''r)ctjjt|j}t t j|j|xs t|(S)zz Performance optimization: where possible, resolve the normalized name from the file system path. ) rsrrrIr5r rr_name_from_stemrr)r&stemrs r'rz!PathDistribution._normalized_name:sS wwDJJ0 )Ih(( )$*>*>t*D E (w' r)c~tjj|\}}|dvry|jd\}}}|S)a7 >>> PathDistribution._name_from_stem('foo-3.0.egg-info') 'foo' >>> PathDistribution._name_from_stem('CherryPy-3.0.dist-info') 'CherryPy' >>> PathDistribution._name_from_stem('face.egg-info') 'face' >>> PathDistribution._name_from_stem('foo.bar') rNr)rsrsplitextr)rrextr$rTrests r'rz PathDistribution._name_from_stemFsC((. # 1 1 ",,S1c4 r))r.r/r0r rqrrr1rr2rrXrrrs@r'rr#sXZM%..66I(    r)rc,tj|S)zGet the ``Distribution`` instance for the named package. :param distribution_name: The name of the distribution package as a string. :return: A ``Distribution`` instance (or subclass thereof). )rrdistribution_names r'rrXs  ! !"3 44r)c ,tjdi|S)z|Get all ``Distribution`` instances in the current environment. :return: An iterable of ``Distribution`` instances. r3)rr)rs r'rras  *6 **r)rc@tj|jS)zGet the metadata for the named package. :param distribution_name: The name of the distribution package to query. :return: A PackageMetadata containing the parsed metadata. )rrrrs r'rris  ! !"3 4 = ==r)c,t|jS)zGet the version string for the named package. :param distribution_name: The name of the distribution package to query. :return: The version string for the package as defined in the package's "Version" metadata key. )rr rs r'r r rs ) * 2 22r)r)keyc tjjdtt D}t |j di|S)aReturn EntryPoint objects for all installed packages. Pass selection parameters (group or name) to filter the result to entry points matching those properties (see EntryPoints.select()). :return: EntryPoints for all installed packages. c34K|]}|jywr+)r)r;rks r'r=zentry_points..s(&>d&>sr3)rrr_uniquerrr)repss r'rrsI // ' '(&-mo&>( C #;s  " " ,V ,,r)c,t|jS)zReturn a list of files for the named package. :param distribution_name: The name of the distribution package to query. :return: List of files composing the distribution. )rrrs r'rrs ) * 0 00r)c,t|jS)z Return a list of requirements for the named package. :return: An iterator of requirements, suitable for packaging.requirement.Requirement. )rrrs r'rrs ) * 3 33r)ctjt}tD]@}t |xs t |D]#}||j |jd%Bt|S)z Return a mapping of top-level packages to their distributions. >>> import collections.abc >>> pkgs = packages_distributions() >>> all(isinstance(dist, collections.abc.Sequence) for dist in pkgs.values()) True r) collections defaultdictr+r_top_level_declared_top_level_inferredrrr|) pkg_to_distrkpkgs r'rrsg))$/K&t,I0CD0IIC   # #DMM&$9 :J   r)cH|jdxsdjS)Nz top_level.txtru)rryrs r'rrs NN? + 1r 8 8 ::r)ct|jDchc]>}t|jdkDr|jdnt j |@}}t d}t||Scc}w)Nrrc d|vSrqr3r#s r'importable_namez,_top_level_inferred..importable_names $r))r rlenpartsr getmodulenamer rG)rkf opt_namesrs r'rrs|!,,A!''lQ& G,A,A!,DD,  /9 --sAA5)Krsrr_r$r rrrzrrSrercrry contextlibrrrurr _collectionsrr _functoolsrr _itertoolsr r r r r importlibr importlib.abcrrtypingrrrr__all__ModuleNotFoundErrorrr5rZritupler PurePosixPathrrrrrrirrrrrrrr rd attrgetterrrrrrIrrrr3r)r'rs 4/8.#(00  . >1>1B!!6v!v!r. %. b +''' + CC$$&sF(sFl- - `,,^!,!,HD'+'62|2j5+>5#8#8>3 )  ./  -k -14T#Y 7"; .r)PK]!D!Dpulldom.cpython-312.opt-1.pycnu[ ֦iu-ddlZddlZdZdZdZdZdZdZdZ d Z Gd d ejjZ Gd d ZGddZGdde ZdZddZddZy)N START_ELEMENT END_ELEMENTCOMMENTSTART_DOCUMENT END_DOCUMENTPROCESSING_INSTRUCTIONIGNORABLE_WHITESPACE CHARACTERSc|eZdZdZdZddZdZdZdZdZ dZ dZ d Z d Z d Zd Zd ZdZdZdZdZdZy)PullDOMNc6ddlm}||_ddg|_|j|_g|_|j j |_ |j j|_|dig|_ |jd|_ g|_ y#t$rY1wxYw)Nr) XML_NAMESPACExml) xml.domrdocumentFactory firstEvent lastEvent elementStackappendpushpopAttributeError _ns_contexts_current_contextpending_events)selfrrs (/usr/lib64/python3.12/xml/dom/pulldom.py__init__zPullDOM.__init__s).,%%,,  ((,,DH,E23 $ 1 1" 5     s B BBc>|jd}|jd=|SNr)r)rresults rrz PullDOM.pop!s%""2&   b ! c||_yN)_locator)rlocators rsetDocumentLocatorzPullDOM.setDocumentLocator&s  r#ct|dsg|_|jj|xsd|f|jj|jj |xsd|j|<y)N _xmlns_attrsxmlns)hasattrr*rrrcopy)rprefixuris rstartPrefixMappingzPullDOM.startPrefixMapping)sit^, "D    &"3GS!9:   !6!6!;!;!=>%+^tc"r#cB|jj|_yr%)rrr)rr.s rendPrefixMappingzPullDOM.endPrefixMapping0s $ 1 1 5 5 7r#cd}t|dd}|"|D]\}}||j||f<g|_|\}} |rZ||j|} | r | dz| z}n| }|jr|jj ||} nM|j ||} n:|jr|jj| } n|j d| } |jD]\}}|\} } | |k(r;| dk(r| }nd| z}|jj| |}| j|nx| rJ|j| } | r | dz| z}n| }|jj| |}| j|n,|jj| }| j|||_ t| fdg|jd<|jd|_|j!| y)Nzhttp://www.w3.org/2000/xmlns/r*:r+zxmlns:)getattr_attrsr*rdocumentcreateElementNS buildDocument createElementitemscreateAttributeNSsetAttributeNodeNScreateAttributesetAttributeNodevaluerrr)rnametagNameattrs xmlns_uri xmlns_attrsanamerAr/ localnamer.nodea_uri a_localnameqnameattrs rstartElementNSzPullDOM.startElementNS3s3 dND9  " + u38 i/0!, "D Y ..s3$slY6G'G}}}}44S'B))#w7}}}}229=))$ : ;;=KE%!& E; !')'E${2E}}66ueD''-..u5"SL;6E'E}}66ueD''-}}44[A%%d+DJ)),,T2D9q* $r#cvt|jfdg|jd<|jd|_yNr5rrr)rrBrCs r endElementNSzPullDOM.endElementNSl0)488:6=q*r#c|jr|jj|}n|jd|}|jD]8\}}|jj |}||_|j |:t|fdg|jd<|jd|_|j|yrP) r8r;r:r<r?rAr@rrr)rrBrDrIrGrArMs r startElementzPullDOM.startElementps ====..t4D%%dD1D ;;=KE%==007DDJ  ! !$ ') ,T2D9q* $r#cvt|jfdg|jd<|jd|_yrPrQ)rrBs r endElementzPullDOM.endElementrSr#c|jrG|jj|}t|fdg|jd<|jd|_yt|fdg}|jj |yrP)r8 createCommentrrrr)rsrIevents rcommentzPullDOM.commentsf ====..q1D")4$ 7DNN1 !^^A.DNq\4(E    & &u -r#c|jrH|jj||}t|fdg|jd<|jd|_yt||fdg}|jj |yrP)r8createProcessingInstructionrrrr)rtargetdatarIr[s rprocessingInstructionzPullDOM.processingInstructionsl ====<}}++E22D94@q*r#c|jj|}t|fdg|jd<|jd|_yrP)r8rcr rrds r characterszPullDOM.characterss>}}++E2($/6q*r#c|j4ddl}|jjjj |_yy)Nr)rxml.dom.minidomdomminidomDocumentimplementation)rrs r startDocumentzPullDOM.startDocuments2    ' "#&77??#;#;#J#JD  (r#cR|jj||d}||_t|fdg|jd<|jd|_|j ||j D]}|ddtk(r1|d\}}}|jj||}t|f|d<nN|ddtk(r-|jj|dd}t|f|d<ntd|dd||jd<||_d|_|jS)Nr5rzUnknown pending event ) rcreateDocumentr8rrrrrr^rrYAssertionError firstChild) rr/tagnamerIe_r_r`ns rr:zPullDOM.buildDocuments$##223F ,d3T:q* $$$AtAw00 !! &MM==fdK.2!1aG#MM//!Q8|!$%=ad1gFF !DNN1 DN%#r#cft|jfdg|jd<|jyrP)rr8rrrs r endDocumentzPullDOM.endDocuments'*DMM:DAq  r#cd|_y)z.clear(): Explicitly release parsing structuresN)r8rys rclearz PullDOM.clears  r#r%)__name__ __module__ __qualname__r&r8rrr(r0r2rNrRrUrWr\rarfrhror:rzr|r#rr r scHH!   487r+ +..+ + K 0r#r ceZdZdZdZdZy) ErrorHandlerct|yr%)printr exceptions rwarningzErrorHandler.warnings  ir#c|r%rrs rerrorzErrorHandler.errorr#c|r%rrs r fatalErrorzErrorHandler.fatalErrorrr#N)r}r~rrrrrr#rrrsr#rcBeZdZdZdZdZdZdZdZdZ dZ d Z y ) DOMEventStreamc||_||_||_t|jds|j|_|j y)Nfeed)streamparserbufsizer,_slurpgetEventreset)rrrrs rrzDOMEventStream.__init__s9   t{{F+ KKDM r#ct|_|jjtj j jd|jj|jyrP) r pulldomr setFeaturersaxhandlerfeature_namespacessetContentHandlerrys rrzDOMEventStream.resetsCy  swwAA1E %%dll3r#c6|j}|r|Str%)r StopIterationrrcs r__next__zDOMEventStream.__next__s ]]_ Ir#c|Sr%rrys r__iter__zDOMEventStream.__iter__s r#c|j}|g}|rb|\}}||ury|tk7r|dj||tk(r|j |n |tk(r|d=|j}|rayyr!)rr appendChildrr)rrIr[parentstokencur_nodes r expandNodezDOMEventStream.expandNodesx &#OE84 # ''1 %x(+%BKMMOEr#c@|jjds%|jj|j_|jjdsw|jj |j }|s|j jy|j j||jjdsw|jjdd}|jjdd|jjd<|S)Nr5r) rrrrreadrrcloser)rbufrs rrzDOMEventStream.getEvents||&&q)%)\\%<%sM!"C(&-! $$& &&' 22r#cddlm}t|}||}|stjj }t |||S)Nr)StringIO)iorlenrrrr)stringrrrrs r parseStringrIs<&kG 6 C $$& #vw //r#)NNr%)xml.saxrxml.sax.handlerrrrrrrr r rContentHandlerr rrrrrrrr#rrs  ! 1-  ucgg$$unMM^%g%B! 30r#PK]<<util.cpython-36.opt-1.pycnu[3 \5Q@sdZddlZddlZddlZddlZddlZddlmZddl m Z ddl m Z ddl mZddlmZdd Zd d Zd d ZdaddZddZd(ddZdaaaddZddZd)ddZddZd*ddZd d!Zd+d"d#Z d,d$d%Z!Gd&d'd'Z"dS)-zudistutils.util Miscellaneous utility functions -- anything that doesn't fit into one of the other *util.py modules. N)DistutilsPlatformError)newer)spawn)log)DistutilsByteCompileErrorcCstjdkrnd}tjj|}|d)kr(tjStjjd|}tj|t||j}|dkr\dS|dkrhdStjSd tjkrtjd Stjd kst td  rtjStj \}}}}}|jj d d }|j dd}|j d d}|dddkrd||fS|dddkrV|ddkrd}dt |dd|ddf}ddd} |d| tj 7}n|dd d!krtd||fS|ddd"krd#|||fS|dd$d%krd%}tjd&tj} | j|} | r| j}n>|dd$d'krddl} ddl} | j| jj|||\}}}d(|||fS)*aReturn a string that identifies the current platform. This is used mainly to distinguish platform-specific build directories and platform-specific built distributions. Typically includes the OS name and version and the architecture (as supplied by 'os.uname()'), although the exact information included depends on the OS; eg. for IRIX the architecture isn't particularly important (IRIX only runs on SGI hardware), but for Linux the kernel version isn't particularly important. Examples of returned values: linux-i586 linux-alpha (?) solaris-2.6-sun4u irix-5.3 irix64-6.2 Windows will return one of: win-amd64 (64bit Windows on AMD64 (aka x86_64, Intel64, EM64T, etc) win-ia64 (64bit Windows on Itanium) win32 (all others - specifically, sys.platform is returned) For other non-POSIX platforms, currently just returns 'sys.platform'. ntz bit ()amd64z win-amd64itaniumzwin-ia64_PYTHON_HOST_PLATFORMposixuname/ _-Nlinuxz%s-%ssunosr5solarisz%d.%s32bit64bit)ilz.%sirixaixz%s-%s.%scygwinz[\d.]+darwinz%s-%s-%s)osnamesysversionfindplatformlenlowerenvironhasattrrreplaceintmaxsizerecompileASCIImatchgroup _osx_supportZdistutils.sysconfigget_platform_osx sysconfigget_config_vars)prefixijlookosnamehostreleaser'machinebitnessrel_remr6 distutilsrF&/usr/lib64/python3.6/distutils/util.py get_platformsX            rHcCs~tjdkr|S|s|S|ddkr.td||ddkrFtd||jd}xd|krf|jdqRW|srtjStjj|S)aReturn 'pathname' as a name that will work on the native filesystem, i.e. split it on '/' and put it back together again using the current directory separator. Needed because filenames in the setup script are always supplied in Unix style, and have to be converted to the local convention before we can actually use them in the filesystem. Raises ValueError on non-Unix-ish systems if 'pathname' either starts or ends with a slash. rrzpath '%s' cannot be absoluterzpath '%s' cannot end with '/'.r#)r$sep ValueErrorsplitremovecurdirpathjoin)pathnamepathsrFrFrG convert_pathos       rScCstjdkr._substz\$([a-zA-Z_][a-zA-Z_0-9]*)zinvalid variable '$%s'N)r]r1subKeyErrorrK)sr_r`varrFrFrG subst_varss  reerror: cCs |t|S)N)r^)excr:rFrFrGgrok_environment_errorsrhcCs(tjdtjatjdatjdadS)Nz [^\\\'\"%s ]*z'(?:[^'\\]|\\.)*'z"(?:[^"\\]|\\.)*")r1r2string whitespace _wordchars_re _squote_re _dquote_rerFrFrFrG _init_regexs rncCstdkrt|j}g}d}x`|rtj||}|j}|t|kr\|j|d|P||tjkr|j|d|||dj }d}n||dkr|d|||dd}|d}n||dkrt j||}n*||dkrt j||}nt d|||dkr"t d|||j\}}|d|||d|d||d}|jd }|t|kr"|j|Pq"W|S) aSplit a string up according to Unix shell-like rules for quotes and backslashes. In short: words are delimited by spaces, as long as those spaces are not escaped by a backslash, or inside a quoted string. Single and double quotes are equivalent, and the quote characters can be backslash-escaped. The backslash is stripped from any two-character escape sequence, leaving only the escaped character. The quote characters are stripped from any quoted string. Returns a list of words. NrrTr'"z!this can't happen (bad char '%c')z"bad string (mismatched %s quotes?)r)rkrnstripr4endr*appendrirjlstriprlrm RuntimeErrorrKspan)rcZwordsposrDrrZbegrFrFrG split_quoteds@         ,   rxcCsP|dkr6d|j|f}|dddkr6|ddd}tj||sL||dS) aPerform some action that affects the outside world (eg. by writing to the filesystem). Such actions are special because they are disabled by the 'dry_run' flag. This method takes care of all that bureaucracy for you; all you have to do is supply the function to call and an argument tuple for it (to embody the "external action" being performed), and an optional message to print. Nz%s%rrz,)rr ry)__name__rinfo)funcargsmsgverbosedry_runrFrFrGexecutes  rcCs2|j}|dkrdS|dkr dStd|fdS)zConvert a string representation of truth to true (1) or false (0). True values are 'y', 'yes', 't', 'true', 'on', and '1'; false values are 'n', 'no', 'f', 'false', 'off', and '0'. Raises ValueError if 'val' is anything else. yyesttrueon1rnnoffalseoff0rzinvalid truth value %rN)rrrrrr)rrrrrr)r+rK)valrFrFrG strtobool0s rrcCsTddl}tjrtd|dkr*do(|dk}|s8yddlm} | d\} } Wn.tk rzddlm} d| d} } YnXtj d| |s| dk rt j | d } n t | d } | j d | j d jtt|d | j d |||||f| jtjg}|j|j|j| t||dtt j| fd| |dnddlm}x|D]}|dddkrhqL|dkr|dkrdn|}tjj||d}n tjj|}|}|r|dt||krtd||f|t|d}|rt j j||}t j j!|}|rL|st"||r.DistutilsRefactoringToolc_stj|f|dS)N)rerror)selfr~r}kwrFrFrG log_errorsz4run_2to3..DistutilsRefactoringTool.log_errorcWstj|f|dS)N)rr{)rr~r}rFrFrG log_messagesz6run_2to3..DistutilsRefactoringTool.log_messagecWstj|f|dS)N)rr)rr~r}rFrFrG log_debugsz4run_2to3..DistutilsRefactoringTool.log_debugN)rz __module__ __qualname__rrrrFrFrFrGDistutilsRefactoringToolsrz lib2to3.fixes)optionsT)r)Zlib2to3.refactorrrZrefactor)files fixer_namesrexplicitrrrrrFrFrGrun_2to3s  rcCsddlm}ddlm}ddlm}|} tj} tj|z | j Wdtj| X| j | j dd<|rx(|j D]} | j } | sqt| j| qtWg} xV| j D]L} tjj|| }|tjj||tjj|| |dd}|dr| j|qWtdd | D|||d | S) zRecursively copy a directory, only copying new and changed files, running run_2to3 over all newly copied Python modules afterward. If you give a template string, it's parsed like a MANIFEST.in. r)mkpath) copy_file)FileListNr)updatecSsg|]}|jjdr|qS)z.py)r+endswith).0fnrFrFrG sz$copydir_run_2to3..)rrr)Zdistutils.dir_utilrZdistutils.file_utilrZdistutils.filelistrr$getcwdchdirfindallZallfilesr splitlinesrqZprocess_template_linerOrPdirnamersr)srcdesttemplaterrrrrrZfilelistrNlineZcopiedfilenameZoutnameresrFrFrGcopydir_run_2to3s4        rc@s$eZdZdZdZdZdZddZdS) Mixin2to3zMixin class for commands that run 2to3. To configure 2to3, setup scripts may either change the class variables, or inherit from individual commands to override how 2to3 is invoked.NcCst||j|j|jS)N)rrrr)rrrFrFrGr,szMixin2to3.run_2to3)rzrr__doc__rrrrrFrFrFrGrs r)rf)Nrr)rrNNrrN)NNN)NNNN)#rr$r1importlib.utilrrir&Zdistutils.errorsrZdistutils.dep_utilrZdistutils.spawnrrErrrHrSrWrYr]rerhrkrlrmrnrxrrrrrrrrFrFrFrGs@     ]  =    PK]\Q3abc.cpython-36.opt-2.pycnu[3 \D@sddlTddlmZdS))*)__all__N)_collections_abcrrr'/usr/lib64/python3.6/collections/abc.pysPK]:.,,machinery.cpython-36.opt-2.pycnu[3 \L@sddlZddlmZddlmZddlmZddlmZmZmZm Z m Z ddlm Z ddlm Z dd lm Z dd lmZdd lmZdd lmZd dZdS)N) ModuleSpec)BuiltinImporter)FrozenImporter)SOURCE_SUFFIXESDEBUG_BYTECODE_SUFFIXESOPTIMIZED_BYTECODE_SUFFIXESBYTECODE_SUFFIXESEXTENSION_SUFFIXES)WindowsRegistryFinder) PathFinder) FileFinder)SourceFileLoader)SourcelessFileLoader)ExtensionFileLoadercCs tttS)N)rr r rr+/usr/lib64/python3.6/importlib/machinery.py all_suffixessr)_imp _bootstraprrr_bootstrap_externalrrrr r r r r rrrrrrrrs         PK]uTW$$util.cpython-36.opt-2.pycnu[3 \5Q@sddlZddlZddlZddlZddlZddlmZddlm Z ddl m Z ddl m Z ddlmZddZd d Zd d Zdad dZddZd'ddZdaaaddZddZd(ddZddZd)ddZdd Zd*d!d"Zd+d#d$Z Gd%d&d&Z!dS),N)DistutilsPlatformError)newer)spawn)log)DistutilsByteCompileErrorcCstjdkrnd}tjj|}|d(kr(tjStjjd|}tj|t||j}|dkr\dS|dkrhdStjSd tjkrtjd Stjd kst td  rtjStj \}}}}}|jj d d }|j dd}|j d d}|dddkrd||fS|dddkrV|ddkrd}dt |dd|ddf}ddd} |d| tj 7}n|ddd krtd||fS|ddd!krd"|||fS|dd#d$krd$}tjd%tj} | j|} | r| j}n>|dd#d&krddl} ddl} | j| jj|||\}}}d'|||fS))Nntz bit ()amd64z win-amd64itaniumzwin-ia64_PYTHON_HOST_PLATFORMposixuname/ _-linuxz%s-%ssunosr5solarisz%d.%s32bit64bit)ilz.%sirixaixz%s-%s.%scygwinz[\d.]+darwinz%s-%s-%s)osnamesysversionfindplatformlenlowerenvironhasattrrreplaceintmaxsizerecompileASCIImatchgroup _osx_supportZdistutils.sysconfigget_platform_osx sysconfigget_config_vars)prefixijlookosnamehostreleaser'machinebitnessrel_remr6 distutilsrF&/usr/lib64/python3.6/distutils/util.py get_platformsX            rHcCs~tjdkr|S|s|S|ddkr.td||ddkrFtd||jd}xd|krf|jdqRW|srtjStjj|S)Nrrzpath '%s' cannot be absoluterzpath '%s' cannot end with '/'.r#)r$sep ValueErrorsplitremovecurdirpathjoin)pathnamepathsrFrFrG convert_pathos       rScCstjdkr._substz\$([a-zA-Z_][a-zA-Z_0-9]*)zinvalid variable '$%s')r]r1subKeyErrorrK)sr_r`varrFrFrG subst_varss  reerror: cCs |t|S)N)r^)excr:rFrFrGgrok_environment_errorsrhcCs(tjdtjatjdatjdadS)Nz [^\\\'\"%s ]*z'(?:[^'\\]|\\.)*'z"(?:[^"\\]|\\.)*")r1r2string whitespace _wordchars_re _squote_re _dquote_rerFrFrFrG _init_regexs rncCstdkrt|j}g}d}x`|rtj||}|j}|t|kr\|j|d|P||tjkr|j|d|||dj }d}n||dkr|d|||dd}|d}n||dkrt j||}n*||dkrt j||}nt d|||dkr"t d|||j\}}|d|||d|d||d}|jd}|t|kr"|j|Pq"W|S) NrrTr'"z!this can't happen (bad char '%c')z"bad string (mismatched %s quotes?)r)rkrnstripr4endr*appendrirjlstriprlrm RuntimeErrorrKspan)rcZwordsposrDrrZbegrFrFrG split_quoteds@         ,   rxcCsP|dkr6d|j|f}|dddkr6|ddd}tj||sL||dS)Nz%s%rrz,)rr ry)__name__rinfo)funcargsmsgverbosedry_runrFrFrGexecutes  rcCs2|j}|dkrdS|dkr dStd|fdS)Nyyesttrueon1rnnoffalseoff0rzinvalid truth value %r)rrrrrr)rrrrrr)r+rK)valrFrFrG strtobool0s rrcCsTddl}tjrtd|dkr*do(|dk}|s8yddlm} | d\} } Wn.tk rzddlm} d| d} } YnXtj d| |s| dk rt j | d} n t | d} | j d | j d jtt|d | j d |||||f| jtjg}|j|j|j| t||d tt j| fd| |d nddlm}x|D]}|dddkrhqL|dkr|dkrdn|}tjj||d}n tjj|}|}|r|dt||krtd||f|t|d}|rt j j||}t j j!|}|rL|st"||r.DistutilsRefactoringToolc_stj|f|dS)N)rerror)selfr~r}kwrFrFrG log_errorsz4run_2to3..DistutilsRefactoringTool.log_errorcWstj|f|dS)N)rr{)rr~r}rFrFrG log_messagesz6run_2to3..DistutilsRefactoringTool.log_messagecWstj|f|dS)N)rr)rr~r}rFrFrG log_debugsz4run_2to3..DistutilsRefactoringTool.log_debugN)rz __module__ __qualname__rrrrFrFrFrGDistutilsRefactoringToolsrz lib2to3.fixes)optionsT)r)Zlib2to3.refactorrrZrefactor)files fixer_namesrexplicitrrrrrFrFrGrun_2to3s  rcCsddlm}ddlm}ddlm}|} tj} tj|z | j Wdtj| X| j | j dd<|rx(|j D]} | j } | sqt| j| qtWg} xV| j D]L} tjj|| }|tjj||tjj|| |dd}|dr| j|qWtdd| D|||d | S) Nr)mkpath) copy_file)FileListr)updatecSsg|]}|jjdr|qS)z.py)r+endswith).0fnrFrFrG sz$copydir_run_2to3..)rrr)Zdistutils.dir_utilrZdistutils.file_utilrZdistutils.filelistrr$getcwdchdirfindallZallfilesr splitlinesrqZprocess_template_linerOrPdirnamersr)srcdesttemplaterrrrrrZfilelistrNlineZcopiedfilenameZoutnameresrFrFrGcopydir_run_2to3s4        rc@s eZdZdZdZdZddZdS) Mixin2to3NcCst||j|j|jS)N)rrrr)rrrFrFrGr,szMixin2to3.run_2to3)rzrrrrrrrFrFrFrGrsr)rf)Nrr)rrNNrrN)NNN)NNNN)"r$r1importlib.utilrrir&Zdistutils.errorsrZdistutils.dep_utilrZdistutils.spawnrrErrrHrSrWrYr]rerhrkrlrmrnrxrrrrrrrrFrFrFrGs>     ]  =    PK] 'machinery.cpython-36.pycnu[3 \L@sdZddlZddlmZddlmZddlmZddlmZmZm Z m Z m Z ddlm Z dd lm Z dd lmZdd lmZdd lmZdd lmZddZdS)z9The machinery of importlib: finders, loaders, hooks, etc.N) ModuleSpec)BuiltinImporter)FrozenImporter)SOURCE_SUFFIXESDEBUG_BYTECODE_SUFFIXESOPTIMIZED_BYTECODE_SUFFIXESBYTECODE_SUFFIXESEXTENSION_SUFFIXES)WindowsRegistryFinder) PathFinder) FileFinder)SourceFileLoader)SourcelessFileLoader)ExtensionFileLoadercCs tttS)zAReturns a list of all recognized module suffixes for this process)rr r rr+/usr/lib64/python3.6/importlib/machinery.py all_suffixessr)__doc___imp _bootstraprrr_bootstrap_externalrrrr r r r r rrrrrrrrs         PK] 'machinery.cpython-36.opt-1.pycnu[3 \L@sdZddlZddlmZddlmZddlmZddlmZmZm Z m Z m Z ddlm Z dd lm Z dd lmZdd lmZdd lmZdd lmZddZdS)z9The machinery of importlib: finders, loaders, hooks, etc.N) ModuleSpec)BuiltinImporter)FrozenImporter)SOURCE_SUFFIXESDEBUG_BYTECODE_SUFFIXESOPTIMIZED_BYTECODE_SUFFIXESBYTECODE_SUFFIXESEXTENSION_SUFFIXES)WindowsRegistryFinder) PathFinder) FileFinder)SourceFileLoader)SourcelessFileLoader)ExtensionFileLoadercCs tttS)zAReturns a list of all recognized module suffixes for this process)rr r rr+/usr/lib64/python3.6/importlib/machinery.py all_suffixessr)__doc___imp _bootstraprrr_bootstrap_externalrrrr r r r r rrrrrrrrs         PK]еqq_bootstrap.cpython-36.opt-1.pycnu[3 \@sdZdaddZddZiZiZGdddeZGdd d ZGd d d Z Gd d d Z ddZ ddZ ddZ ddddZddZddZddZddZGd d!d!ZGd"d#d#Zddd$d%d&Zd]d'd(Zd)d*d+d,Zd-d.Zd/d0Zd1d2Zd3d4Zd5d6Zd7d8ZGd9d:d:ZGd;d<d<ZGd=d>d>Z d?d@Z!dAdBZ"d^dCdDZ#dEdFZ$dGZ%e%dHZ&dIdJZ'e(Z)dKdLZ*d_dNdOZ+d)dPdQdRZ,dSdTZ-ddfdMfdUdVZ.dWdXZ/dYdZZ0d[d\Z1dS)`aSCore implementation of import. This module is NOT meant to be directly imported! It has been designed such that it can be bootstrapped into Python as the implementation of import. As such it requires the injection of specific modules and attributes in order to work. One should use importlib as the public-facing version of this module. NcCs<x(dD] }t||rt||t||qW|jj|jdS)z/Simple substitute for functools.update_wrapper. __module____name__ __qualname____doc__N)rrrr)hasattrsetattrgetattr__dict__update)newoldreplacer ,/usr/lib64/python3.6/importlib/_bootstrap.py_wraps  rcCs tt|S)N)typesys)namer r r _new_module#src@s eZdZdS)_DeadlockErrorN)rrrr r r rr0src@s8eZdZdZddZddZddZdd Zd d Zd S) _ModuleLockzA recursive lock implementation which is able to detect deadlocks (e.g. thread 1 trying to take locks A then B, and thread 2 trying to take locks B then A). cCs0tj|_tj|_||_d|_d|_d|_dS)N)_thread allocate_locklockwakeuprownercountwaiters)selfrr r r__init__:s   z_ModuleLock.__init__cCs@tj}|j}x,tj|}|dkr&dS|j}||krdSqWdS)NFT)r get_identr _blocking_onget)rmetidrr r r has_deadlockBs z_ModuleLock.has_deadlockcCstj}|t|<zx|j`|jdks0|j|krH||_|jd7_dS|jr\td||jj drv|j d7_ WdQRX|jj |jj qWWdt|=XdS)z Acquire the module lock. If a potential deadlock is detected, a _DeadlockError is raised. Otherwise, the lock is always acquired and True is returned. rTzdeadlock detected by %rFN) rr r!rrrr%rracquirerrelease)rr$r r rr'Ns    z_ModuleLock.acquirec Csltj}|jT|j|kr"td|jd8_|jdkr^d|_|jr^|jd8_|jjWdQRXdS)Nzcannot release un-acquired lockr&r) rr rr RuntimeErrorrrrr()rr$r r rr(gs  z_ModuleLock.releasecCsdj|jt|S)Nz_ModuleLock({!r}) at {})formatrid)rr r r__repr__tsz_ModuleLock.__repr__N) rrrrrr%r'r(r,r r r rr4s   rc@s0eZdZdZddZddZddZdd Zd S) _DummyModuleLockzVA simple _ModuleLock equivalent for Python builds without multi-threading support.cCs||_d|_dS)Nr)rr)rrr r rr|sz_DummyModuleLock.__init__cCs|jd7_dS)Nr&T)r)rr r rr'sz_DummyModuleLock.acquirecCs$|jdkrtd|jd8_dS)Nrzcannot release un-acquired lockr&)rr))rr r rr(s z_DummyModuleLock.releasecCsdj|jt|S)Nz_DummyModuleLock({!r}) at {})r*rr+)rr r rr,sz_DummyModuleLock.__repr__N)rrrrrr'r(r,r r r rr-xs r-c@s$eZdZddZddZddZdS)_ModuleLockManagercCs||_d|_dS)N)_name_lock)rrr r rrsz_ModuleLockManager.__init__cCst|j|_|jjdS)N)_get_module_lockr/r0r')rr r r __enter__s z_ModuleLockManager.__enter__cOs|jjdS)N)r0r()rargskwargsr r r__exit__sz_ModuleLockManager.__exit__N)rrrrr2r5r r r rr.sr.cCstjzjyt|}Wntk r0d}YnX|dkrptdkrLt|}nt|}|fdd}tj||t|<Wdtj X|S)zGet or create the module lock for a given module name. Acquire/release internally the global import lock to protect _module_locks.Nc Ss0tjztj||krt|=WdtjXdS)N)_imp acquire_lock _module_locksr" release_lock)refrr r rcbs  z_get_module_lock..cb) r6r7r8KeyErrorrr-r_weakrefr:r9)rrr;r r rr1s    r1c Cs6t|}y |jWntk r(Yn X|jdS)zAcquires then releases the module lock for a given module name. This is used to ensure a module is completely initialized, in the event it is being imported by another thread. N)r1r'rr()rrr r r_lock_unlock_modules  r>cOs |||S)a.remove_importlib_frames in import.c will always remove sequences of importlib frames that end with a call to this function Use it instead of a normal call in places where including the importlib frames introduces unwanted noise into the traceback (e.g. when executing module code) r )fr3kwdsr r r_call_with_frames_removedsrAr&) verbositycGs6tjj|kr2|jdsd|}t|j|tjddS)z=Print the message to stderr if -v/PYTHONVERBOSE is turned on.#import z# )fileN)rCrD)rflagsverbose startswithprintr*stderr)messagerBr3r r r_verbose_messages  rLcsfdd}t||S)z1Decorator to verify the named module is built-in.cs&|tjkrtdj||d||S)Nz{!r} is not a built-in module)r)rbuiltin_module_names ImportErrorr*)rfullname)fxnr r_requires_builtin_wrappers  z4_requires_builtin.._requires_builtin_wrapper)r)rPrQr )rPr_requires_builtins  rRcsfdd}t||S)z/Decorator to verify the named module is frozen.cs&tj|stdj||d||S)Nz{!r} is not a frozen module)r)r6 is_frozenrNr*)rrO)rPr r_requires_frozen_wrappers  z2_requires_frozen.._requires_frozen_wrapper)r)rPrTr )rPr_requires_frozens  rUcCs>t||}|tjkr2tj|}t||tj|St|SdS)zLoad the specified module into sys.modules and return it. This method is deprecated. Use loader.exec_module instead. N)spec_from_loaderrmodules_exec_load)rrOspecmoduler r r_load_module_shims      r\c#Cst|dd}t|dr6y |j|Stk r4YnXy |j}Wntk rTYnX|dk rft|Sy |j}Wntk rd}YnXy |j}Wn2tk r|dkrdj |Sdj ||SYnXdj ||SdS)N __loader__ module_repr?z zz) rrr^ Exception__spec__AttributeError_module_repr_from_specr__file__r*)r[loaderrZrfilenamer r r _module_repr s.        rgc@s$eZdZddZddZddZdS)_installed_safelycCs||_|j|_dS)N)_modulera_spec)rr[r r rr3sz_installed_safely.__init__cCsd|j_|jtj|jj<dS)NT)rj _initializingrirrWr)rr r rr27sz_installed_safely.__enter__cGsbzR|j}tdd|Dr@ytj|j=WqPtk r<YqPXntd|j|jWdd|j_XdS)Ncss|]}|dk VqdS)Nr ).0argr r r Asz-_installed_safely.__exit__..zimport {!r} # {!r}F) rjanyrrWrr<rLrerk)rr3rZr r rr5>sz_installed_safely.__exit__N)rrrrr2r5r r r rrh1srhc@sreZdZdZddddddZddZdd Zed d Zej d d Zed dZ eddZ e j ddZ dS) ModuleSpecaThe specification for a module, used for loading. A module's spec is the source for information about the module. For data associated with the module, including source, use the spec's loader. `name` is the absolute name of the module. `loader` is the loader to use when loading the module. `parent` is the name of the package the module is in. The parent is derived from the name. `is_package` determines if the module is considered a package or not. On modules this is reflected by the `__path__` attribute. `origin` is the specific location used by the loader from which to load the module, if that information is available. When filename is set, origin will match. `has_location` indicates that a spec's "origin" reflects a location. When this is True, `__file__` attribute of the module is set. `cached` is the location of the cached bytecode file, if any. It corresponds to the `__cached__` attribute. `submodule_search_locations` is the sequence of path entries to search when importing submodules. If set, is_package should be True--and False otherwise. Packages are simply modules that (may) have submodules. If a spec has a non-None value in `submodule_search_locations`, the import system will consider modules loaded from the spec as packages. Only finders (see importlib.abc.MetaPathFinder and importlib.abc.PathEntryFinder) should modify ModuleSpec instances. N)origin loader_state is_packagecCs6||_||_||_||_|r gnd|_d|_d|_dS)NF)rrerqrrsubmodule_search_locations _set_fileattr_cached)rrrerqrrrsr r rrqszModuleSpec.__init__cCsfdj|jdj|jg}|jdk r4|jdj|j|jdk rP|jdj|jdj|jjdj|S)Nz name={!r}z loader={!r}z origin={!r}zsubmodule_search_locations={}z{}({})z, ) r*rrerqappendrt __class__rjoin)rr3r r rr,}s    zModuleSpec.__repr__c Csf|j}yF|j|jkoL|j|jkoL|j|jkoL||jkoL|j|jkoL|j|jkStk r`dSXdS)NF)rtrrerqcached has_locationrb)rothersmslr r r__eq__s      zModuleSpec.__eq__cCs:|jdkr4|jdk r4|jr4tdkr&ttj|j|_|jS)N)rvrqru_bootstrap_externalNotImplementedError _get_cached)rr r rrzs  zModuleSpec.cachedcCs ||_dS)N)rv)rrzr r rrzscCs$|jdkr|jjddS|jSdS)z The name of the module's parent.N.r)rtr rpartition)rr r rparents zModuleSpec.parentcCs|jS)N)ru)rr r rr{szModuleSpec.has_locationcCst||_dS)N)boolru)rvaluer r rr{s) rrrrrr,r~propertyrzsetterrr{r r r rrpLs#     rp)rqrscCst|drJtdkrttj}|dkr0|||dS|r8gnd}||||dS|dkrt|dry|j|}Wqtk rd}YqXnd}t||||dS)z5Return a module spec based on various loader methods. get_filenameN)re)rertrsF)rqrs)rrrspec_from_file_locationrsrNrp)rrerqrsrsearchr r rrVs"     rVc5Cs8y |j}Wntk rYnX|dk r,|S|j}|dkrZy |j}Wntk rXYnXy |j}Wntk r|d}YnX|dkr|dkry |j}Wqtk rd}YqXn|}y |j}Wntk rd}YnXyt|j}Wntk rd}YnXt |||d}|dkr"dnd|_ ||_ ||_ |S)N)rqFT) rarbrr]rd_ORIGIN __cached__list__path__rprurzrt)r[rerqrZrlocationrzrtr r r_spec_from_modulesH         rF)overridec;Cs|st|dddkr6y |j|_Wntk r4YnX|sJt|dddkr|j}|dkr|jdk rtdkrnttj}|j |}|j|_ y ||_ Wntk rYnX|st|dddkry |j |_ Wntk rYnXy ||_Wntk rYnX|st|dddkrD|jdk rDy |j|_Wntk rBYnX|jr|sdt|dddkry |j|_Wntk rYnX|st|dddkr|jdk ry |j|_Wntk rYnX|S)Nrr] __package__rrdr)rrrrbrertrr_NamespaceLoader__new___pathr]rrrarr{rqrdrzr)rZr[rrerr r r_init_module_attrss\           rcCsRd}t|jdr|jj|}nt|jdr2td|dkrDt|j}t|||S)z+Create a module based on the provided spec.N create_module exec_modulezBloaders that define exec_module() must also define create_module())rrerrNrrr)rZr[r r rmodule_from_spec4s    rcCsj|jdkrdn|j}|jdkrB|jdkr2dj|Sdj||jSn$|jrVdj||jSdj|j|jSdS)z&Return the repr to use for the module.Nr_z zzz)rrqrer*r{)rZrr r rrcEs   rcc Cs|j}t|tjj||k r6dj|}t||d|jdkrj|jdkrXtd|jdt ||dd|St ||ddt |jds|jj |n |jj |WdQRXtj|S)zFExecute the spec's specified module in an existing module's namespace.zmodule {!r} not in sys.modules)rNzmissing loaderT)rr) rr.rrWr"r*rNrertrr load_moduler)rZr[rmsgr r rrXVs      rXcCs|jj|jtj|j}t|dddkrLy |j|_Wntk rJYnXt|dddkry(|j|_ t |ds|jj dd|_ Wntk rYnXt|dddkry ||_ Wntk rYnX|S)Nr]rrrrra) rerrrrWrr]rbrrrrra)rZr[r r r_load_backward_compatiblens(    rc Csv|jdk rt|jdst|St|}t|6|jdkrT|jdkr`td|jdn |jj|WdQRXt j |jS)Nrzmissing loader)r) rerrrrhrtrNrrrrW)rZr[r r r_load_unlockeds     rc Cst|j t|SQRXdS)zReturn a new module object, loaded by the spec's loader. The module is not added to its parent. If a module is already in sys.modules, that existing module gets clobbered. N)r.rr)rZr r rrYs rYc@seZdZdZeddZedddZedddZed d Z ed d Z ee d dZ ee ddZ ee ddZeeZdS)BuiltinImporterzMeta path import for built-in modules. All methods are either class or static methods to avoid the need to instantiate the class. cCs dj|jS)zsReturn repr for the module. The method is deprecated. The import machinery does the job itself. z)r*r)r[r r rr^szBuiltinImporter.module_reprNcCs,|dk r dStj|r$t||ddSdSdS)Nzbuilt-in)rq)r6 is_builtinrV)clsrOpathtargetr r r find_specs  zBuiltinImporter.find_speccCs|j||}|dk r|jSdS)zFind the built-in module. If 'path' is ever specified then the search is considered a failure. This method is deprecated. Use find_spec() instead. N)rre)rrOrrZr r r find_modules zBuiltinImporter.find_modulecCs.|jtjkr"tdj|j|jdttj|S)zCreate a built-in modulez{!r} is not a built-in module)r)rrrMrNr*rAr6create_builtin)rrZr r rrs   zBuiltinImporter.create_modulecCsttj|dS)zExec a built-in moduleN)rAr6 exec_builtin)rr[r r rrszBuiltinImporter.exec_modulecCsdS)z9Return None as built-in modules do not have code objects.Nr )rrOr r rget_codeszBuiltinImporter.get_codecCsdS)z8Return None as built-in modules do not have source code.Nr )rrOr r r get_sourceszBuiltinImporter.get_sourcecCsdS)z4Return False as built-in modules are never packages.Fr )rrOr r rrsszBuiltinImporter.is_package)NN)N)rrrr staticmethodr^ classmethodrrrrrRrrrsr\rr r r rrs    rc@seZdZdZeddZedddZedddZed d Z ed d Z ed dZ ee ddZ ee ddZee ddZdS)FrozenImporterzMeta path import for frozen modules. All methods are either class or static methods to avoid the need to instantiate the class. cCs dj|jS)zsReturn repr for the module. The method is deprecated. The import machinery does the job itself. z)r*r)mr r rr^szFrozenImporter.module_reprNcCs tj|rt||ddSdSdS)Nfrozen)rq)r6rSrV)rrOrrr r rr s zFrozenImporter.find_speccCstj|r|SdS)z]Find a frozen module. This method is deprecated. Use find_spec() instead. N)r6rS)rrOrr r rrszFrozenImporter.find_modulecCsdS)z*Use default semantics for module creation.Nr )rrZr r rrszFrozenImporter.create_modulecCs@|jj}tj|s$tdj||dttj|}t||j dS)Nz{!r} is not a frozen module)r) rarr6rSrNr*rAget_frozen_objectexecr)r[rcoder r rr s    zFrozenImporter.exec_modulecCs t||S)z_Load a frozen module. This method is deprecated. Use exec_module() instead. )r\)rrOr r rr)szFrozenImporter.load_modulecCs tj|S)z-Return the code object for the frozen module.)r6r)rrOr r rr2szFrozenImporter.get_codecCsdS)z6Return None as frozen modules do not have source code.Nr )rrOr r rr8szFrozenImporter.get_sourcecCs tj|S)z.Return True if the frozen module is a package.)r6is_frozen_package)rrOr r rrs>szFrozenImporter.is_package)NN)N)rrrrrr^rrrrrrrUrrrsr r r rrs     rc@s eZdZdZddZddZdS)_ImportLockContextz$Context manager for the import lock.cCs tjdS)zAcquire the import lock.N)r6r7)rr r rr2Ksz_ImportLockContext.__enter__cCs tjdS)z= 0z__package__ not set to a stringz6attempted relative import with no known parent packagezEmpty module nameN) isinstancestr TypeErrorr*rrrN)rrrr r r _sanity_checks   rzNo module named z{!r}c Csd}|jdd}|r|tjkr*t|||tjkr>tj|Stj|}y |j}Wn2tk rtdj||}t||ddYnXt ||}|dkrttj||dnt |}|rtj|}t ||jdd||S)Nrrz; {!r} is not a package)r) rrrWrArrb_ERR_MSGr*ModuleNotFoundErrorrrr)rimport_rr parent_modulerrZr[r r r_find_and_load_unlockeds*        rc Cs^t|&tjj|t}|tkr*t||SWdQRX|dkrRdj|}t||dt||S)zFind and load the module.Nz(import of {} halted; None in sys.modules)r) r.rrWr"_NEEDS_LOADINGrr*rr>)rrr[rKr r r_find_and_loads  rrcCs*t||||dkr t|||}t|tS)a2Import and return the module based on its name, the package the call is being made from, and the level adjustment. This function represents the greatest common denominator of functionality between import_module and __import__. This includes setting __package__ if the loader did not. r)rrr _gcd_import)rrrr r rrs  r) recursivecCst|drx|D]}t|tsN|r.|jd}nd}td|dt|jq|dkrz| rt|drt||j|dd qt||sd j|j|}yt ||Wqt k r}z&|j |krt j j|td k rwWYd d }~XqXqW|S) zFigure out what __import__ should return. The import_ parameter is a callable which takes the name of module to import. It is required to decouple the function from assuming importlib's import implementation is desired. rz.__all__z ``from list''zItem in z must be str, not *__all__T)rz{}.{}N)rrrrrr_handle_fromlistrr*rArrrrWr"r)r[fromlistrrxwhere from_nameexcr r rrs*        rcCs|jd}|jd}|dk rR|dk rN||jkrNtjd|d|jdtdd|S|dk r`|jStjd tdd|d }d |kr|jd d }|S)zCalculate what __package__ should be. __package__ is not guaranteed to be defined or could be set to None to represent that its proper value is unknown. rraNz __package__ != __spec__.parent (z != )) stacklevelzYcan't resolve package from __spec__ or __package__, falling back on __name__ and __path__rrrr)r"rrrrr)globalsrrZr r r_calc___package__ s    rc Cs|dkrt|}n$|dk r|ni}t|}t|||}|s|dkrTt|jddS|s\|St|t|jdd}tj|jdt|j|Sn t||tSdS)aImport a module. The 'globals' argument is used to infer where the import is occurring from to handle relative imports. The 'locals' argument is ignored. The 'fromlist' argument specifies what should exist as attributes on the module being imported (e.g. ``from module import ``). The 'level' argument represents the package location to import from in a relative import (e.g. ``from ..pkg import mod`` would have a 'level' of 2). rNr)rr partitionrrrWrr) rrlocalsrrr[globals_rcut_offr r r __import__&s    rcCs&tj|}|dkrtd|t|S)Nzno built-in module named )rrrNr)rrZr r r_builtin_from_nameIs  rc Cs|a|att}xVtjjD]H\}}t||r|tjkr>t}ntj|rt }nqt ||}t ||qWtjt }x6dD].}|tjkrt |} n tj|} t||| qxWy t d} Wntk rd} YnXt|d| t d} t|d| dS)zSetup importlib by importing needed built-in modules and injecting them into the global namespace. As sys is needed for sys.modules access and _imp is needed to load built-in modules, those two modules must be explicitly passed in. rrNr=)r)r6rrrWitemsrrMrrSrrrrrrrN) sys_module _imp_module module_typerr[rerZ self_module builtin_namebuiltin_module thread_moduleweakref_moduler r r_setupPs2             rcCsBt||tjjttjjtddl}|a|jtj t dS)z2Install importlib as the implementation of import.rN) rrrrwrr_frozen_importlib_externalr_installrWr)rrrr r rrs    r)NN)N)Nr)2rrrrr8r!r)rrr-r.r1r>rArLrRrUr\rgrhrprVrrrrcrXrrrYrrrrrrr_ERR_MSG_PREFIXrrobjectrrrrrrrrrr r r rs^D%   $e -<IM   / &#/PK]8M(qq_bootstrap.cpython-36.pycnu[3 \@sdZdaddZddZiZiZGdddeZGdd d ZGd d d Z Gd d d Z ddZ ddZ ddZ ddddZddZddZddZddZGd d!d!ZGd"d#d#Zddd$d%d&Zd]d'd(Zd)d*d+d,Zd-d.Zd/d0Zd1d2Zd3d4Zd5d6Zd7d8ZGd9d:d:ZGd;d<d<ZGd=d>d>Z d?d@Z!dAdBZ"d^dCdDZ#dEdFZ$dGZ%e%dHZ&dIdJZ'e(Z)dKdLZ*d_dNdOZ+d)dPdQdRZ,dSdTZ-ddfdMfdUdVZ.dWdXZ/dYdZZ0d[d\Z1dS)`aSCore implementation of import. This module is NOT meant to be directly imported! It has been designed such that it can be bootstrapped into Python as the implementation of import. As such it requires the injection of specific modules and attributes in order to work. One should use importlib as the public-facing version of this module. NcCs<x(dD] }t||rt||t||qW|jj|jdS)z/Simple substitute for functools.update_wrapper. __module____name__ __qualname____doc__N)rrrr)hasattrsetattrgetattr__dict__update)newoldreplacer ,/usr/lib64/python3.6/importlib/_bootstrap.py_wraps  rcCs tt|S)N)typesys)namer r r _new_module#src@s eZdZdS)_DeadlockErrorN)rrrr r r rr0src@s8eZdZdZddZddZddZdd Zd d Zd S) _ModuleLockzA recursive lock implementation which is able to detect deadlocks (e.g. thread 1 trying to take locks A then B, and thread 2 trying to take locks B then A). cCs0tj|_tj|_||_d|_d|_d|_dS)N)_thread allocate_locklockwakeuprownercountwaiters)selfrr r r__init__:s   z_ModuleLock.__init__cCs@tj}|j}x,tj|}|dkr&dS|j}||krdSqWdS)NFT)r get_identr _blocking_onget)rmetidrr r r has_deadlockBs z_ModuleLock.has_deadlockcCstj}|t|<zx|j`|jdks0|j|krH||_|jd7_dS|jr\td||jj drv|j d7_ WdQRX|jj |jj qWWdt|=XdS)z Acquire the module lock. If a potential deadlock is detected, a _DeadlockError is raised. Otherwise, the lock is always acquired and True is returned. rTzdeadlock detected by %rFN) rr r!rrrr%rracquirerrelease)rr$r r rr'Ns    z_ModuleLock.acquirec Csztj}|jb|j|kr"td|jdks0t|jd8_|jdkrld|_|jrl|jd8_|jj WdQRXdS)Nzcannot release un-acquired lockrr&) rr rr RuntimeErrorrAssertionErrorrrr()rr$r r rr(gs  z_ModuleLock.releasecCsdj|jt|S)Nz_ModuleLock({!r}) at {})formatrid)rr r r__repr__tsz_ModuleLock.__repr__N) rrrrrr%r'r(r-r r r rr4s   rc@s0eZdZdZddZddZddZdd Zd S) _DummyModuleLockzVA simple _ModuleLock equivalent for Python builds without multi-threading support.cCs||_d|_dS)Nr)rr)rrr r rr|sz_DummyModuleLock.__init__cCs|jd7_dS)Nr&T)r)rr r rr'sz_DummyModuleLock.acquirecCs$|jdkrtd|jd8_dS)Nrzcannot release un-acquired lockr&)rr))rr r rr(s z_DummyModuleLock.releasecCsdj|jt|S)Nz_DummyModuleLock({!r}) at {})r+rr,)rr r rr-sz_DummyModuleLock.__repr__N)rrrrrr'r(r-r r r rr.xs r.c@s$eZdZddZddZddZdS)_ModuleLockManagercCs||_d|_dS)N)_name_lock)rrr r rrsz_ModuleLockManager.__init__cCst|j|_|jjdS)N)_get_module_lockr0r1r')rr r r __enter__s z_ModuleLockManager.__enter__cOs|jjdS)N)r1r()rargskwargsr r r__exit__sz_ModuleLockManager.__exit__N)rrrrr3r6r r r rr/sr/cCstjzjyt|}Wntk r0d}YnX|dkrptdkrLt|}nt|}|fdd}tj||t|<Wdtj X|S)zGet or create the module lock for a given module name. Acquire/release internally the global import lock to protect _module_locks.Nc Ss0tjztj||krt|=WdtjXdS)N)_imp acquire_lock _module_locksr" release_lock)refrr r rcbs  z_get_module_lock..cb) r7r8r9KeyErrorrr.r_weakrefr;r:)rrr<r r rr2s    r2c Cs6t|}y |jWntk r(Yn X|jdS)zAcquires then releases the module lock for a given module name. This is used to ensure a module is completely initialized, in the event it is being imported by another thread. N)r2r'rr()rrr r r_lock_unlock_modules  r?cOs |||S)a.remove_importlib_frames in import.c will always remove sequences of importlib frames that end with a call to this function Use it instead of a normal call in places where including the importlib frames introduces unwanted noise into the traceback (e.g. when executing module code) r )fr4kwdsr r r_call_with_frames_removedsrBr&) verbositycGs6tjj|kr2|jdsd|}t|j|tjddS)z=Print the message to stderr if -v/PYTHONVERBOSE is turned on.#import z# )fileN)rDrE)rflagsverbose startswithprintr+stderr)messagerCr4r r r_verbose_messages  rMcsfdd}t||S)z1Decorator to verify the named module is built-in.cs&|tjkrtdj||d||S)Nz{!r} is not a built-in module)r)rbuiltin_module_names ImportErrorr+)rfullname)fxnr r_requires_builtin_wrappers  z4_requires_builtin.._requires_builtin_wrapper)r)rQrRr )rQr_requires_builtins  rScsfdd}t||S)z/Decorator to verify the named module is frozen.cs&tj|stdj||d||S)Nz{!r} is not a frozen module)r)r7 is_frozenrOr+)rrP)rQr r_requires_frozen_wrappers  z2_requires_frozen.._requires_frozen_wrapper)r)rQrUr )rQr_requires_frozens  rVcCs>t||}|tjkr2tj|}t||tj|St|SdS)zLoad the specified module into sys.modules and return it. This method is deprecated. Use loader.exec_module instead. N)spec_from_loaderrmodules_exec_load)rrPspecmoduler r r_load_module_shims      r]c#Cst|dd}t|dr6y |j|Stk r4YnXy |j}Wntk rTYnX|dk rft|Sy |j}Wntk rd}YnXy |j}Wn2tk r|dkrdj |Sdj ||SYnXdj ||SdS)N __loader__ module_repr?z zz) rrr_ Exception__spec__AttributeError_module_repr_from_specr__file__r+)r\loaderr[rfilenamer r r _module_repr s.        rhc@s$eZdZddZddZddZdS)_installed_safelycCs||_|j|_dS)N)_modulerb_spec)rr\r r rr3sz_installed_safely.__init__cCsd|j_|jtj|jj<dS)NT)rk _initializingrjrrXr)rr r rr37sz_installed_safely.__enter__cGsbzR|j}tdd|Dr@ytj|j=WqPtk r<YqPXntd|j|jWdd|j_XdS)Ncss|]}|dk VqdS)Nr ).0argr r r Asz-_installed_safely.__exit__..zimport {!r} # {!r}F) rkanyrrXrr=rMrfrl)rr4r[r r rr6>sz_installed_safely.__exit__N)rrrrr3r6r r r rri1sric@sreZdZdZddddddZddZdd Zed d Zej d d Zed dZ eddZ e j ddZ dS) ModuleSpecaThe specification for a module, used for loading. A module's spec is the source for information about the module. For data associated with the module, including source, use the spec's loader. `name` is the absolute name of the module. `loader` is the loader to use when loading the module. `parent` is the name of the package the module is in. The parent is derived from the name. `is_package` determines if the module is considered a package or not. On modules this is reflected by the `__path__` attribute. `origin` is the specific location used by the loader from which to load the module, if that information is available. When filename is set, origin will match. `has_location` indicates that a spec's "origin" reflects a location. When this is True, `__file__` attribute of the module is set. `cached` is the location of the cached bytecode file, if any. It corresponds to the `__cached__` attribute. `submodule_search_locations` is the sequence of path entries to search when importing submodules. If set, is_package should be True--and False otherwise. Packages are simply modules that (may) have submodules. If a spec has a non-None value in `submodule_search_locations`, the import system will consider modules loaded from the spec as packages. Only finders (see importlib.abc.MetaPathFinder and importlib.abc.PathEntryFinder) should modify ModuleSpec instances. N)origin loader_state is_packagecCs6||_||_||_||_|r gnd|_d|_d|_dS)NF)rrfrrrssubmodule_search_locations _set_fileattr_cached)rrrfrrrsrtr r rrqszModuleSpec.__init__cCsfdj|jdj|jg}|jdk r4|jdj|j|jdk rP|jdj|jdj|jjdj|S)Nz name={!r}z loader={!r}z origin={!r}zsubmodule_search_locations={}z{}({})z, ) r+rrfrrappendru __class__rjoin)rr4r r rr-}s    zModuleSpec.__repr__c Csf|j}yF|j|jkoL|j|jkoL|j|jkoL||jkoL|j|jkoL|j|jkStk r`dSXdS)NF)rurrfrrcached has_locationrc)rothersmslr r r__eq__s      zModuleSpec.__eq__cCs:|jdkr4|jdk r4|jr4tdkr&ttj|j|_|jS)N)rwrrrv_bootstrap_externalNotImplementedError _get_cached)rr r rr{s  zModuleSpec.cachedcCs ||_dS)N)rw)rr{r r rr{scCs$|jdkr|jjddS|jSdS)z The name of the module's parent.N.r)rur rpartition)rr r rparents zModuleSpec.parentcCs|jS)N)rv)rr r rr|szModuleSpec.has_locationcCst||_dS)N)boolrv)rvaluer r rr|s) rrrrrr-rpropertyr{setterrr|r r r rrqLs#     rq)rrrtcCst|drJtdkrttj}|dkr0|||dS|r8gnd}||||dS|dkrt|dry|j|}Wqtk rd}YqXnd}t||||dS)z5Return a module spec based on various loader methods. get_filenameN)rf)rfrurtF)rrrt)rrrspec_from_file_locationrtrOrq)rrfrrrtrsearchr r rrWs"     rWc5Cs8y |j}Wntk rYnX|dk r,|S|j}|dkrZy |j}Wntk rXYnXy |j}Wntk r|d}YnX|dkr|dkry |j}Wqtk rd}YqXn|}y |j}Wntk rd}YnXyt|j}Wntk rd}YnXt |||d}|dkr"dnd|_ ||_ ||_ |S)N)rrFT) rbrcrr^re_ORIGIN __cached__list__path__rqrvr{ru)r\rfrrr[rlocationr{rur r r_spec_from_modulesH         rF)overridec;Cs|st|dddkr6y |j|_Wntk r4YnX|sJt|dddkr|j}|dkr|jdk rtdkrnttj}|j |}|j|_ y ||_ Wntk rYnX|st|dddkry |j |_ Wntk rYnXy ||_Wntk rYnX|st|dddkrD|jdk rDy |j|_Wntk rBYnX|jr|sdt|dddkry |j|_Wntk rYnX|st|dddkr|jdk ry |j|_Wntk rYnX|S)Nrr^ __package__rrer)rrrrcrfrurr_NamespaceLoader__new___pathr^rrrbrr|rrrer{r)r[r\rrfrr r r_init_module_attrss\           rcCsRd}t|jdr|jj|}nt|jdr2td|dkrDt|j}t|||S)z+Create a module based on the provided spec.N create_module exec_modulezBloaders that define exec_module() must also define create_module())rrfrrOrrr)r[r\r r rmodule_from_spec4s    rcCsj|jdkrdn|j}|jdkrB|jdkr2dj|Sdj||jSn$|jrVdj||jSdj|j|jSdS)z&Return the repr to use for the module.Nr`z zzz)rrrrfr+r|)r[rr r rrdEs   rdc Cs|j}t|tjj||k r6dj|}t||d|jdkrj|jdkrXtd|jdt ||dd|St ||ddt |jds|jj |n |jj |WdQRXtj|S)zFExecute the spec's specified module in an existing module's namespace.zmodule {!r} not in sys.modules)rNzmissing loaderT)rr) rr/rrXr"r+rOrfrurr load_moduler)r[r\rmsgr r rrYVs      rYcCs|jj|jtj|j}t|dddkrLy |j|_Wntk rJYnXt|dddkry(|j|_ t |ds|jj dd|_ Wntk rYnXt|dddkry ||_ Wntk rYnX|S)Nr^rrrrrb) rfrrrrXrr^rcrrrrrb)r[r\r r r_load_backward_compatiblens(    rc Csv|jdk rt|jdst|St|}t|6|jdkrT|jdkr`td|jdn |jj|WdQRXt j |jS)Nrzmissing loader)r) rfrrrrirurOrrrrX)r[r\r r r_load_unlockeds     rc Cst|j t|SQRXdS)zReturn a new module object, loaded by the spec's loader. The module is not added to its parent. If a module is already in sys.modules, that existing module gets clobbered. N)r/rr)r[r r rrZs rZc@seZdZdZeddZedddZedddZed d Z ed d Z ee d dZ ee ddZ ee ddZeeZdS)BuiltinImporterzMeta path import for built-in modules. All methods are either class or static methods to avoid the need to instantiate the class. cCs dj|jS)zsReturn repr for the module. The method is deprecated. The import machinery does the job itself. z)r+r)r\r r rr_szBuiltinImporter.module_reprNcCs,|dk r dStj|r$t||ddSdSdS)Nzbuilt-in)rr)r7 is_builtinrW)clsrPpathtargetr r r find_specs  zBuiltinImporter.find_speccCs|j||}|dk r|jSdS)zFind the built-in module. If 'path' is ever specified then the search is considered a failure. This method is deprecated. Use find_spec() instead. N)rrf)rrPrr[r r r find_modules zBuiltinImporter.find_modulecCs.|jtjkr"tdj|j|jdttj|S)zCreate a built-in modulez{!r} is not a built-in module)r)rrrNrOr+rBr7create_builtin)rr[r r rrs   zBuiltinImporter.create_modulecCsttj|dS)zExec a built-in moduleN)rBr7 exec_builtin)rr\r r rrszBuiltinImporter.exec_modulecCsdS)z9Return None as built-in modules do not have code objects.Nr )rrPr r rget_codeszBuiltinImporter.get_codecCsdS)z8Return None as built-in modules do not have source code.Nr )rrPr r r get_sourceszBuiltinImporter.get_sourcecCsdS)z4Return False as built-in modules are never packages.Fr )rrPr r rrtszBuiltinImporter.is_package)NN)N)rrrr staticmethodr_ classmethodrrrrrSrrrtr]rr r r rrs    rc@seZdZdZeddZedddZedddZed d Z ed d Z ed dZ ee ddZ ee ddZee ddZdS)FrozenImporterzMeta path import for frozen modules. All methods are either class or static methods to avoid the need to instantiate the class. cCs dj|jS)zsReturn repr for the module. The method is deprecated. The import machinery does the job itself. z)r+r)mr r rr_szFrozenImporter.module_reprNcCs tj|rt||ddSdSdS)Nfrozen)rr)r7rTrW)rrPrrr r rr s zFrozenImporter.find_speccCstj|r|SdS)z]Find a frozen module. This method is deprecated. Use find_spec() instead. N)r7rT)rrPrr r rrszFrozenImporter.find_modulecCsdS)z*Use default semantics for module creation.Nr )rr[r r rrszFrozenImporter.create_modulecCs@|jj}tj|s$tdj||dttj|}t||j dS)Nz{!r} is not a frozen module)r) rbrr7rTrOr+rBget_frozen_objectexecr)r\rcoder r rr s    zFrozenImporter.exec_modulecCs t||S)z_Load a frozen module. This method is deprecated. Use exec_module() instead. )r])rrPr r rr)szFrozenImporter.load_modulecCs tj|S)z-Return the code object for the frozen module.)r7r)rrPr r rr2szFrozenImporter.get_codecCsdS)z6Return None as frozen modules do not have source code.Nr )rrPr r rr8szFrozenImporter.get_sourcecCs tj|S)z.Return True if the frozen module is a package.)r7is_frozen_package)rrPr r rrt>szFrozenImporter.is_package)NN)N)rrrrrr_rrrrrrrVrrrtr r r rrs     rc@s eZdZdZddZddZdS)_ImportLockContextz$Context manager for the import lock.cCs tjdS)zAcquire the import lock.N)r7r8)rr r rr3Ksz_ImportLockContext.__enter__cCs tjdS)z= 0z__package__ not set to a stringz6attempted relative import with no known parent packagezEmpty module nameN) isinstancestr TypeErrorr+rrrO)rrrr r r _sanity_checks   rzNo module named z{!r}c Csd}|jdd}|r|tjkr*t|||tjkr>tj|Stj|}y |j}Wn2tk rtdj||}t||ddYnXt ||}|dkrttj||dnt |}|rtj|}t ||jdd||S)Nrrz; {!r} is not a package)r) rrrXrBrrc_ERR_MSGr+ModuleNotFoundErrorrrr)rimport_rr parent_modulerr[r\r r r_find_and_load_unlockeds*        rc Cs^t|&tjj|t}|tkr*t||SWdQRX|dkrRdj|}t||dt||S)zFind and load the module.Nz(import of {} halted; None in sys.modules)r) r/rrXr"_NEEDS_LOADINGrr+rr?)rrr\rLr r r_find_and_loads  rrcCs*t||||dkr t|||}t|tS)a2Import and return the module based on its name, the package the call is being made from, and the level adjustment. This function represents the greatest common denominator of functionality between import_module and __import__. This includes setting __package__ if the loader did not. r)rrr _gcd_import)rrrr r rrs  r) recursivecCst|drx|D]}t|tsN|r.|jd}nd}td|dt|jq|dkrz| rt|drt||j|dd qt||sd j|j|}yt ||Wqt k r}z&|j |krt j j|td k rwWYd d }~XqXqW|S) zFigure out what __import__ should return. The import_ parameter is a callable which takes the name of module to import. It is required to decouple the function from assuming importlib's import implementation is desired. rz.__all__z ``from list''zItem in z must be str, not *__all__T)rz{}.{}N)rrrrrr_handle_fromlistrr+rBrrrrXr"r)r\fromlistrrxwhere from_nameexcr r rrs*        rcCs|jd}|jd}|dk rR|dk rN||jkrNtjd|d|jdtdd|S|dk r`|jStjd tdd|d }d |kr|jd d }|S)zCalculate what __package__ should be. __package__ is not guaranteed to be defined or could be set to None to represent that its proper value is unknown. rrbNz __package__ != __spec__.parent (z != )) stacklevelzYcan't resolve package from __spec__ or __package__, falling back on __name__ and __path__rrrr)r"rrrrr)globalsrr[r r r_calc___package__ s    rc Cs|dkrt|}n$|dk r|ni}t|}t|||}|s|dkrTt|jddS|s\|St|t|jdd}tj|jdt|j|Sn t||tSdS)aImport a module. The 'globals' argument is used to infer where the import is occurring from to handle relative imports. The 'locals' argument is ignored. The 'fromlist' argument specifies what should exist as attributes on the module being imported (e.g. ``from module import ``). The 'level' argument represents the package location to import from in a relative import (e.g. ``from ..pkg import mod`` would have a 'level' of 2). rNr)rr partitionrrrXrr) rrlocalsrrr\globals_rcut_offr r r __import__&s    rcCs&tj|}|dkrtd|t|S)Nzno built-in module named )rrrOr)rr[r r r_builtin_from_nameIs  rc Cs|a|att}xVtjjD]H\}}t||r|tjkr>t}ntj|rt }nqt ||}t ||qWtjt }x6dD].}|tjkrt |} n tj|} t||| qxWy t d} Wntk rd} YnXt|d| t d} t|d| dS)zSetup importlib by importing needed built-in modules and injecting them into the global namespace. As sys is needed for sys.modules access and _imp is needed to load built-in modules, those two modules must be explicitly passed in. rrNr>)r)r7rrrXitemsrrNrrTrrrrrrrO) sys_module _imp_module module_typerr\rfr[ self_module builtin_namebuiltin_module thread_moduleweakref_moduler r r_setupPs2             rcCsBt||tjjttjjtddl}|a|jtj t dS)z2Install importlib as the implementation of import.rN) rrrrxrr_frozen_importlib_externalr_installrXr)rrrr r rrs    r)NN)N)Nr)2rrrrr9r!r)rrr.r/r2r?rBrMrSrVr]rhrirqrWrrrrdrYrrrZrrrrrrr_ERR_MSG_PREFIXrrobjectrrrrrrrrrr r r rs^D%   $e -<IM   / &#/PK]goVV_bootstrap.cpython-36.opt-2.pycnu[3 \@sdaddZddZiZiZGdddeZGdddZGd d d ZGd d d Z d dZ ddZ ddZ ddddZ ddZddZddZddZGdd d ZGd!d"d"Zddd#d$d%Zd\d&d'Zd(d)d*d+Zd,d-Zd.d/Zd0d1Zd2d3Zd4d5Zd6d7ZGd8d9d9ZGd:d;d;ZGdd?Z d@dAZ!d]dBdCZ"dDdEZ#dFZ$e$dGZ%dHdIZ&e'Z(dJdKZ)d^dMdNZ*d(dOdPdQZ+dRdSZ,ddfdLfdTdUZ-dVdWZ.dXdYZ/dZd[Z0dS)_NcCs<x(dD] }t||rt||t||qW|jj|jdS)N __module____name__ __qualname____doc__)rrrr)hasattrsetattrgetattr__dict__update)newoldreplacer ,/usr/lib64/python3.6/importlib/_bootstrap.py_wraps  rcCs tt|S)N)typesys)namer r r _new_module#src@s eZdZdS)_DeadlockErrorN)rrrr r r rr0src@s4eZdZddZddZddZddZd d Zd S) _ModuleLockcCs0tj|_tj|_||_d|_d|_d|_dS)N)_thread allocate_locklockwakeuprownercountwaiters)selfrr r r__init__:s   z_ModuleLock.__init__cCs@tj}|j}x,tj|}|dkr&dS|j}||krdSqWdS)NFT)r get_identr _blocking_onget)rmetidrr r r has_deadlockBs z_ModuleLock.has_deadlockcCstj}|t|<zx|j`|jdks0|j|krH||_|jd7_dS|jr\td||jj drv|j d7_ WdQRX|jj |jj qWWdt|=XdS)NrTzdeadlock detected by %rF) rr r!rrrr%rracquirerrelease)rr$r r rr'Ns    z_ModuleLock.acquirec Csltj}|jT|j|kr"td|jd8_|jdkr^d|_|jr^|jd8_|jjWdQRXdS)Nzcannot release un-acquired lockr&r) rr rr RuntimeErrorrrrr()rr$r r rr(gs  z_ModuleLock.releasecCsdj|jt|S)Nz_ModuleLock({!r}) at {})formatrid)rr r r__repr__tsz_ModuleLock.__repr__N)rrrrr%r'r(r,r r r rr4s   rc@s,eZdZddZddZddZddZd S) _DummyModuleLockcCs||_d|_dS)Nr)rr)rrr r rr|sz_DummyModuleLock.__init__cCs|jd7_dS)Nr&T)r)rr r rr'sz_DummyModuleLock.acquirecCs$|jdkrtd|jd8_dS)Nrzcannot release un-acquired lockr&)rr))rr r rr(s z_DummyModuleLock.releasecCsdj|jt|S)Nz_DummyModuleLock({!r}) at {})r*rr+)rr r rr,sz_DummyModuleLock.__repr__N)rrrrr'r(r,r r r rr-xsr-c@s$eZdZddZddZddZdS)_ModuleLockManagercCs||_d|_dS)N)_name_lock)rrr r rrsz_ModuleLockManager.__init__cCst|j|_|jjdS)N)_get_module_lockr/r0r')rr r r __enter__s z_ModuleLockManager.__enter__cOs|jjdS)N)r0r()rargskwargsr r r__exit__sz_ModuleLockManager.__exit__N)rrrrr2r5r r r rr.sr.cCstjzjyt|}Wntk r0d}YnX|dkrptdkrLt|}nt|}|fdd}tj||t|<Wdtj X|S)Nc Ss0tjztj||krt|=WdtjXdS)N)_imp acquire_lock _module_locksr" release_lock)refrr r rcbs  z_get_module_lock..cb) r6r7r8KeyErrorrr-r_weakrefr:r9)rrr;r r rr1s    r1c Cs6t|}y |jWntk r(Yn X|jdS)N)r1r'rr()rrr r r_lock_unlock_modules  r>cOs |||S)Nr )fr3kwdsr r r_call_with_frames_removedsrAr&) verbositycGs6tjj|kr2|jdsd|}t|j|tjddS)N#import z# )file)rCrD)rflagsverbose startswithprintr*stderr)messagerBr3r r r_verbose_messages  rLcsfdd}t||S)Ncs&|tjkrtdj||d||S)Nz{!r} is not a built-in module)r)rbuiltin_module_names ImportErrorr*)rfullname)fxnr r_requires_builtin_wrappers  z4_requires_builtin.._requires_builtin_wrapper)r)rPrQr )rPr_requires_builtins  rRcsfdd}t||S)Ncs&tj|stdj||d||S)Nz{!r} is not a frozen module)r)r6 is_frozenrNr*)rrO)rPr r_requires_frozen_wrappers  z2_requires_frozen.._requires_frozen_wrapper)r)rPrTr )rPr_requires_frozens  rUcCs>t||}|tjkr2tj|}t||tj|St|SdS)N)spec_from_loaderrmodules_exec_load)rrOspecmoduler r r_load_module_shims      r\c#Cst|dd}t|dr6y |j|Stk r4YnXy |j}Wntk rTYnX|dk rft|Sy |j}Wntk rd}YnXy |j}Wn2tk r|dkrdj |Sdj ||SYnXdj ||SdS)N __loader__ module_repr?z zz) rrr^ Exception__spec__AttributeError_module_repr_from_specr__file__r*)r[loaderrZrfilenamer r r _module_repr s.        rgc@s$eZdZddZddZddZdS)_installed_safelycCs||_|j|_dS)N)_modulera_spec)rr[r r rr3sz_installed_safely.__init__cCsd|j_|jtj|jj<dS)NT)rj _initializingrirrWr)rr r rr27sz_installed_safely.__enter__cGsbzR|j}tdd|Dr@ytj|j=WqPtk r<YqPXntd|j|jWdd|j_XdS)Ncss|]}|dk VqdS)Nr ).0argr r r Asz-_installed_safely.__exit__..zimport {!r} # {!r}F) rjanyrrWrr<rLrerk)rr3rZr r rr5>sz_installed_safely.__exit__N)rrrrr2r5r r r rrh1srhc@sneZdZddddddZddZddZed d Zejd d Zed d Z eddZ e jddZ dS) ModuleSpecN)origin loader_state is_packagecCs6||_||_||_||_|r gnd|_d|_d|_dS)NF)rrerqrrsubmodule_search_locations _set_fileattr_cached)rrrerqrrrsr r rrqszModuleSpec.__init__cCsfdj|jdj|jg}|jdk r4|jdj|j|jdk rP|jdj|jdj|jjdj|S)Nz name={!r}z loader={!r}z origin={!r}zsubmodule_search_locations={}z{}({})z, ) r*rrerqappendrt __class__rjoin)rr3r r rr,}s    zModuleSpec.__repr__c Csf|j}yF|j|jkoL|j|jkoL|j|jkoL||jkoL|j|jkoL|j|jkStk r`dSXdS)NF)rtrrerqcached has_locationrb)rothersmslr r r__eq__s      zModuleSpec.__eq__cCs:|jdkr4|jdk r4|jr4tdkr&ttj|j|_|jS)N)rvrqru_bootstrap_externalNotImplementedError _get_cached)rr r rrzs  zModuleSpec.cachedcCs ||_dS)N)rv)rrzr r rrzscCs$|jdkr|jjddS|jSdS)N.r)rtr rpartition)rr r rparents zModuleSpec.parentcCs|jS)N)ru)rr r rr{szModuleSpec.has_locationcCst||_dS)N)boolru)rvaluer r rr{s) rrrrr,r~propertyrzsetterrr{r r r rrpLs%     rp)rqrscCst|drJtdkrttj}|dkr0|||dS|r8gnd}||||dS|dkrt|dry|j|}Wqtk rd}YqXnd}t||||dS)N get_filename)re)rertrsF)rqrs)rrrspec_from_file_locationrsrNrp)rrerqrsrsearchr r rrVs"     rVc5Cs8y |j}Wntk rYnX|dk r,|S|j}|dkrZy |j}Wntk rXYnXy |j}Wntk r|d}YnX|dkr|dkry |j}Wqtk rd}YqXn|}y |j}Wntk rd}YnXyt|j}Wntk rd}YnXt |||d}|dkr"dnd|_ ||_ ||_ |S)N)rqFT) rarbrr]rd_ORIGIN __cached__list__path__rprurzrt)r[rerqrZrlocationrzrtr r r_spec_from_modulesH         rF)overridec;Cs|st|dddkr6y |j|_Wntk r4YnX|sJt|dddkr|j}|dkr|jdk rtdkrnttj}|j |}|j|_ y ||_ Wntk rYnX|st|dddkry |j |_ Wntk rYnXy ||_Wntk rYnX|st|dddkrD|jdk rDy |j|_Wntk rBYnX|jr|sdt|dddkry |j|_Wntk rYnX|st|dddkr|jdk ry |j|_Wntk rYnX|S)Nrr] __package__rrdr)rrrrbrertrr_NamespaceLoader__new___pathr]rrrarr{rqrdrzr)rZr[rrerr r r_init_module_attrss\           rcCsRd}t|jdr|jj|}nt|jdr2td|dkrDt|j}t|||S)N create_module exec_modulezBloaders that define exec_module() must also define create_module())rrerrNrrr)rZr[r r rmodule_from_spec4s    rcCsj|jdkrdn|j}|jdkrB|jdkr2dj|Sdj||jSn$|jrVdj||jSdj|j|jSdS)Nr_z zzz)rrqrer*r{)rZrr r rrcEs   rcc Cs|j}t|tjj||k r6dj|}t||d|jdkrj|jdkrXtd|jdt ||dd|St ||ddt |jds|jj |n |jj |WdQRXtj|S)Nzmodule {!r} not in sys.modules)rzmissing loaderT)rr) rr.rrWr"r*rNrertrr load_moduler)rZr[rmsgr r rrXVs      rXcCs|jj|jtj|j}t|dddkrLy |j|_Wntk rJYnXt|dddkry(|j|_ t |ds|jj dd|_ Wntk rYnXt|dddkry ||_ Wntk rYnX|S)Nr]rrrrra) rerrrrWrr]rbrrrrra)rZr[r r r_load_backward_compatiblens(    rc Csv|jdk rt|jdst|St|}t|6|jdkrT|jdkr`td|jdn |jj|WdQRXt j |jS)Nrzmissing loader)r) rerrrrhrtrNrrrrW)rZr[r r r_load_unlockeds     rc Cst|j t|SQRXdS)N)r.rr)rZr r rrYs rYc@seZdZeddZedddZedddZedd Zed d Z ee d d Z ee ddZ ee ddZ eeZdS)BuiltinImportercCs dj|jS)Nz)r*r)r[r r rr^szBuiltinImporter.module_reprNcCs,|dk r dStj|r$t||ddSdSdS)Nzbuilt-in)rq)r6 is_builtinrV)clsrOpathtargetr r r find_specs  zBuiltinImporter.find_speccCs|j||}|dk r|jSdS)N)rre)rrOrrZr r r find_modules zBuiltinImporter.find_modulecCs.|jtjkr"tdj|j|jdttj|S)Nz{!r} is not a built-in module)r)rrrMrNr*rAr6create_builtin)rrZr r rrs   zBuiltinImporter.create_modulecCsttj|dS)N)rAr6 exec_builtin)rr[r r rrszBuiltinImporter.exec_modulecCsdS)Nr )rrOr r rget_codeszBuiltinImporter.get_codecCsdS)Nr )rrOr r r get_sourceszBuiltinImporter.get_sourcecCsdS)NFr )rrOr r rrsszBuiltinImporter.is_package)NN)N)rrr staticmethodr^ classmethodrrrrrRrrrsr\rr r r rrs    rc@seZdZeddZedddZedddZedd Zed d Z ed d Z ee ddZ ee ddZ ee ddZdS)FrozenImportercCs dj|jS)Nz)r*r)mr r rr^szFrozenImporter.module_reprNcCs tj|rt||ddSdSdS)Nfrozen)rq)r6rSrV)rrOrrr r rr s zFrozenImporter.find_speccCstj|r|SdS)N)r6rS)rrOrr r rrszFrozenImporter.find_modulecCsdS)Nr )rrZr r rrszFrozenImporter.create_modulecCs@|jj}tj|s$tdj||dttj|}t||j dS)Nz{!r} is not a frozen module)r) rarr6rSrNr*rAget_frozen_objectexecr)r[rcoder r rr s    zFrozenImporter.exec_modulecCs t||S)N)r\)rrOr r rr)szFrozenImporter.load_modulecCs tj|S)N)r6r)rrOr r rr2szFrozenImporter.get_codecCsdS)Nr )rrOr r rr8szFrozenImporter.get_sourcecCs tj|S)N)r6is_frozen_package)rrOr r rrs>szFrozenImporter.is_package)NN)N)rrrrr^rrrrrrrUrrrsr r r rrs     rc@seZdZddZddZdS)_ImportLockContextcCs tjdS)N)r6r7)rr r rr2Ksz_ImportLockContext.__enter__cCs tjdS)N)r6r9)rexc_type exc_value exc_tracebackr r rr5Osz_ImportLockContext.__exit__N)rrrr2r5r r r rrGsrcCs@|jd|d}t||kr$td|d}|r= 0z__package__ not set to a stringz6attempted relative import with no known parent packagezEmpty module name) isinstancestr TypeErrorr*rrrN)rrrr r r _sanity_checks   rzNo module named z{!r}c Csd}|jdd}|r|tjkr*t|||tjkr>tj|Stj|}y |j}Wn2tk rtdj||}t||ddYnXt ||}|dkrttj||dnt |}|rtj|}t ||jdd||S)Nrrz; {!r} is not a package)r) rrrWrArrb_ERR_MSGr*ModuleNotFoundErrorrrr)rimport_rr parent_modulerrZr[r r r_find_and_load_unlockeds*        rc Cs^t|&tjj|t}|tkr*t||SWdQRX|dkrRdj|}t||dt||S)Nz(import of {} halted; None in sys.modules)r) r.rrWr"_NEEDS_LOADINGrr*rr>)rrr[rKr r r_find_and_loads  rrcCs*t||||dkr t|||}t|tS)Nr)rrr _gcd_import)rrrr r rrs  r) recursivecCst|drx|D]}t|tsN|r.|jd}nd}td|dt|jq|dkrz| rt|drt||j|dd qt||sd j|j|}yt ||Wqt k r}z&|j |krt j j|tdk rwWYdd}~XqXqW|S) Nrz.__all__z ``from list''zItem in z must be str, not *__all__T)rz{}.{})rrrrrr_handle_fromlistrr*rArrrrWr"r)r[fromlistrrxwhere from_nameexcr r rrs*        rcCs|jd}|jd}|dk rR|dk rN||jkrNtjd|d|jdtdd|S|dk r`|jStjdtdd|d }d |kr|jd d }|S) Nrraz __package__ != __spec__.parent (z != )) stacklevelzYcan't resolve package from __spec__ or __package__, falling back on __name__ and __path__rrrr)r"rrrrr)globalsrrZr r r_calc___package__ s    rc Cs|dkrt|}n$|dk r|ni}t|}t|||}|s|dkrTt|jddS|s\|St|t|jdd}tj|jdt|j|Sn t||tSdS)Nrr)rr partitionrrrWrr) rrlocalsrrr[globals_rcut_offr r r __import__&s    rcCs&tj|}|dkrtd|t|S)Nzno built-in module named )rrrNr)rrZr r r_builtin_from_nameIs  rc Cs|a|att}xVtjjD]H\}}t||r|tjkr>t}ntj|rt }nqt ||}t ||qWtjt }x6dD].}|tjkrt |} n tj|} t||| qxWy t d} Wntk rd} YnXt|d| t d} t|d| dS)Nrrr=)r)r6rrrWitemsrrMrrSrrrrrrrN) sys_module _imp_module module_typerr[rerZ self_module builtin_namebuiltin_module thread_moduleweakref_moduler r r_setupPs2             rcCsBt||tjjttjjtddl}|a|jtj t dS)Nr) rrrrwrr_frozen_importlib_externalr_installrWr)rrrr r rrs    r)NN)N)Nr)1rrrr8r!r)rrr-r.r1r>rArLrRrUr\rgrhrprVrrrrcrXrrrYrrrrrrr_ERR_MSG_PREFIXrrobjectrrrrrrrrrr r r rs\D%   $e -<IM   / &#/PK]\Q3abc.cpython-36.opt-1.pycnu[3 \D@sddlTddlmZdS))*)__all__N)_collections_abcrrr'/usr/lib64/python3.6/collections/abc.pysPK]dS<<util.cpython-36.pycnu[3 \5Q@sdZddlZddlZddlZddlZddlZddlmZddl m Z ddl m Z ddl mZddlmZdd Zd d Zd d ZdaddZddZd(ddZdaaaddZddZd)ddZddZd*ddZd d!Zd+d"d#Z d,d$d%Z!Gd&d'd'Z"dS)-zudistutils.util Miscellaneous utility functions -- anything that doesn't fit into one of the other *util.py modules. N)DistutilsPlatformError)newer)spawn)log)DistutilsByteCompileErrorcCstjdkrnd}tjj|}|d)kr(tjStjjd|}tj|t||j}|dkr\dS|dkrhdStjSd tjkrtjd Stjd kst td  rtjStj \}}}}}|jj d d }|j dd}|j d d}|dddkrd||fS|dddkrV|ddkrd}dt |dd|ddf}ddd} |d| tj 7}n|dd d!krtd||fS|ddd"krd#|||fS|dd$d%krd%}tjd&tj} | j|} | r| j}n>|dd$d'krddl} ddl} | j| jj|||\}}}d(|||fS)*aReturn a string that identifies the current platform. This is used mainly to distinguish platform-specific build directories and platform-specific built distributions. Typically includes the OS name and version and the architecture (as supplied by 'os.uname()'), although the exact information included depends on the OS; eg. for IRIX the architecture isn't particularly important (IRIX only runs on SGI hardware), but for Linux the kernel version isn't particularly important. Examples of returned values: linux-i586 linux-alpha (?) solaris-2.6-sun4u irix-5.3 irix64-6.2 Windows will return one of: win-amd64 (64bit Windows on AMD64 (aka x86_64, Intel64, EM64T, etc) win-ia64 (64bit Windows on Itanium) win32 (all others - specifically, sys.platform is returned) For other non-POSIX platforms, currently just returns 'sys.platform'. ntz bit ()amd64z win-amd64itaniumzwin-ia64_PYTHON_HOST_PLATFORMposixuname/ _-Nlinuxz%s-%ssunosr5solarisz%d.%s32bit64bit)ilz.%sirixaixz%s-%s.%scygwinz[\d.]+darwinz%s-%s-%s)osnamesysversionfindplatformlenlowerenvironhasattrrreplaceintmaxsizerecompileASCIImatchgroup _osx_supportZdistutils.sysconfigget_platform_osx sysconfigget_config_vars)prefixijlookosnamehostreleaser'machinebitnessrel_remr6 distutilsrF&/usr/lib64/python3.6/distutils/util.py get_platformsX            rHcCs~tjdkr|S|s|S|ddkr.td||ddkrFtd||jd}xd|krf|jdqRW|srtjStjj|S)aReturn 'pathname' as a name that will work on the native filesystem, i.e. split it on '/' and put it back together again using the current directory separator. Needed because filenames in the setup script are always supplied in Unix style, and have to be converted to the local convention before we can actually use them in the filesystem. Raises ValueError on non-Unix-ish systems if 'pathname' either starts or ends with a slash. rrzpath '%s' cannot be absoluterzpath '%s' cannot end with '/'.r#)r$sep ValueErrorsplitremovecurdirpathjoin)pathnamepathsrFrFrG convert_pathos       rScCstjdkr._substz\$([a-zA-Z_][a-zA-Z_0-9]*)zinvalid variable '$%s'N)r]r1subKeyErrorrK)sr_r`varrFrFrG subst_varss  reerror: cCs |t|S)N)r^)excr:rFrFrGgrok_environment_errorsrhcCs(tjdtjatjdatjdadS)Nz [^\\\'\"%s ]*z'(?:[^'\\]|\\.)*'z"(?:[^"\\]|\\.)*")r1r2string whitespace _wordchars_re _squote_re _dquote_rerFrFrFrG _init_regexs rncCstdkrt|j}g}d}x`|rtj||}|j}|t|kr\|j|d|P||tjkr|j|d|||dj }d}n||dkr|d|||dd}|d}n||dkrt j||}n*||dkrt j||}nt d|||dkr"t d|||j\}}|d|||d|d||d}|jd }|t|kr"|j|Pq"W|S) aSplit a string up according to Unix shell-like rules for quotes and backslashes. In short: words are delimited by spaces, as long as those spaces are not escaped by a backslash, or inside a quoted string. Single and double quotes are equivalent, and the quote characters can be backslash-escaped. The backslash is stripped from any two-character escape sequence, leaving only the escaped character. The quote characters are stripped from any quoted string. Returns a list of words. NrrTr'"z!this can't happen (bad char '%c')z"bad string (mismatched %s quotes?)r)rkrnstripr4endr*appendrirjlstriprlrm RuntimeErrorrKspan)rcZwordsposrDrrZbegrFrFrG split_quoteds@         ,   rxcCsP|dkr6d|j|f}|dddkr6|ddd}tj||sL||dS) aPerform some action that affects the outside world (eg. by writing to the filesystem). Such actions are special because they are disabled by the 'dry_run' flag. This method takes care of all that bureaucracy for you; all you have to do is supply the function to call and an argument tuple for it (to embody the "external action" being performed), and an optional message to print. Nz%s%rrz,)rr ry)__name__rinfo)funcargsmsgverbosedry_runrFrFrGexecutes  rcCs2|j}|dkrdS|dkr dStd|fdS)zConvert a string representation of truth to true (1) or false (0). True values are 'y', 'yes', 't', 'true', 'on', and '1'; false values are 'n', 'no', 'f', 'false', 'off', and '0'. Raises ValueError if 'val' is anything else. yyesttrueon1rnnoffalseoff0rzinvalid truth value %rN)rrrrrr)rrrrrr)r+rK)valrFrFrG strtobool0s rrcCsTddl}tjrtd|dkr*do(|dk}|s8yddlm} | d\} } Wn.tk rzddlm} d| d} } YnXtj d| |s| dk rt j | d } n t | d } | j d | j d jtt|d | j d |||||f| jtjg}|j|j|j| t||dtt j| fd| |dnddlm}x|D]}|dddkrhqL|dkr|dkrdn|}tjj||d}n tjj|}|}|r|dt||krtd||f|t|d}|rt j j||}t j j!|}|rL|st"||r.DistutilsRefactoringToolc_stj|f|dS)N)rerror)selfr~r}kwrFrFrG log_errorsz4run_2to3..DistutilsRefactoringTool.log_errorcWstj|f|dS)N)rr{)rr~r}rFrFrG log_messagesz6run_2to3..DistutilsRefactoringTool.log_messagecWstj|f|dS)N)rr)rr~r}rFrFrG log_debugsz4run_2to3..DistutilsRefactoringTool.log_debugN)rz __module__ __qualname__rrrrFrFrFrGDistutilsRefactoringToolsrz lib2to3.fixes)optionsT)r)Zlib2to3.refactorrrZrefactor)files fixer_namesrexplicitrrrrrFrFrGrun_2to3s  rcCsddlm}ddlm}ddlm}|} tj} tj|z | j Wdtj| X| j | j dd<|rx(|j D]} | j } | sqt| j| qtWg} xV| j D]L} tjj|| }|tjj||tjj|| |dd}|dr| j|qWtdd | D|||d | S) zRecursively copy a directory, only copying new and changed files, running run_2to3 over all newly copied Python modules afterward. If you give a template string, it's parsed like a MANIFEST.in. r)mkpath) copy_file)FileListNr)updatecSsg|]}|jjdr|qS)z.py)r+endswith).0fnrFrFrG sz$copydir_run_2to3..)rrr)Zdistutils.dir_utilrZdistutils.file_utilrZdistutils.filelistrr$getcwdchdirfindallZallfilesr splitlinesrqZprocess_template_linerOrPdirnamersr)srcdesttemplaterrrrrrZfilelistrNlineZcopiedfilenameZoutnameresrFrFrGcopydir_run_2to3s4        rc@s$eZdZdZdZdZdZddZdS) Mixin2to3zMixin class for commands that run 2to3. To configure 2to3, setup scripts may either change the class variables, or inherit from individual commands to override how 2to3 is invoked.NcCst||j|j|jS)N)rrrr)rrrFrFrGr,szMixin2to3.run_2to3)rzrr__doc__rrrrrFrFrFrGrs r)rf)Nrr)rrNNrrN)NNN)NNNN)#rr$r1importlib.utilrrir&Zdistutils.errorsrZdistutils.dep_utilrZdistutils.spawnrrErrrHrSrWrYr]rerhrkrlrmrnrxrrrrrrrrFrFrFrGs@     ]  =    PK]ŜŜ"_bootstrap_external.cpython-36.pycnu[3 _Vjm@s&dZdnZdoZeeZddZddZdd Zd d Zd d ZddZ ddZ ddZ ddZ dpddZ ee jZdjdddZejedZdZdZdgZd gZeZZdqd!d"d#d$Zd%d&Zd'd(Zd)d*Zd+d,Z d-d.Z!d/d0Z"drd1d2Z#dsd3d4Z$dtd6d7Z%d8d9Z&e'Z(dud!e(d:d;d<Z)Gd=d>d>Z*Gd?d@d@Z+GdAdBdBe+Z,GdCdDdDZ-GdEdFdFe-e,Z.GdGdHdHe-e+Z/gZ0GdIdJdJe-e+Z1GdKdLdLZ2GdMdNdNZ3GdOdPdPZ4GdQdRdRZ5dvdSdTZ6dUdVZ7dWdXZ8dYdZZ9d[d\d]d^d_d`dadbdcdddedfdgdhdidjdkZ:dldmZ;d!S)wa^Core implementation of path-based import. This module is NOT meant to be directly imported! It has been designed such that it can be bootstrapped into Python as the implementation of import. As such it requires the injection of specific modules and attributes in order to work. One should use importlib as the public-facing version of this module. wincygwindarwincs<tjjtr0tjjtrdndfdd}ndd}|S)N PYTHONCASEOKs PYTHONCASEOKcs tjkS)z5True if filenames must be checked case-insensitively.)_osenviron)keyr5/usr/lib64/python3.6/importlib/_bootstrap_external.py _relax_case%sz%_make_relax_case.._relax_casecSsdS)z5True if filenames must be checked case-insensitively.Frrrrr r )s)sysplatform startswith_CASE_INSENSITIVE_PLATFORMS#_CASE_INSENSITIVE_PLATFORMS_STR_KEY)r r)rr _make_relax_cases  rcCst|d@jddS)z*Convert a 32-bit integer to little-endian.llittle)intto_bytes)xrrr _w_long/srcCs tj|dS)z/Convert 4 bytes in little-endian to an integer.r)r from_bytes) int_bytesrrr _r_long4srcGstjdd|DS)zReplacement for os.path.join().cSsg|]}|r|jtqSr)rstrippath_separators).0partrrr ;sz_path_join..)path_sepjoin) path_partsrrr _path_join9s r"cCs`ttdkr$|jt\}}}||fSx2t|D]&}|tkr.|j|dd\}}||fSq.Wd|fS)z Replacement for os.path.split().)maxsplit)lenr rpartitionrreversedrsplit)pathfront_tailrrrr _path_split?s  r.cCs tj|S)z~Stat the path. Made a separate function to make it easier to override in experiments (e.g. cache stat results). )rstat)r*rrr _path_statKsr0c Cs0y t|}Wntk r dSX|jd@|kS)z1Test whether the path is the specified mode type.Fi)r0OSErrorst_mode)r*mode stat_inforrr _path_is_mode_typeUs  r5cCs t|dS)zReplacement for os.path.isfile.i)r5)r*rrr _path_isfile^sr6cCs|s tj}t|dS)zReplacement for os.path.isdir.i@)rgetcwdr5)r*rrr _path_isdircsr8cCsdj|t|}tj|tjtjBtjB|d@}y2tj|d}|j |WdQRXtj ||Wn:t k rytj |Wnt k rYnXYnXdS)zBest-effort function to write data to a path atomically. Be prepared to handle a FileExistsError if concurrent writing of the temporary file is attempted.z{}.{}iwbN) formatidropenO_EXCLO_CREATO_WRONLY_ioFileIOwritereplacer1unlink)r*datar3path_tmpfdfilerrr _write_atomicjsrJi3 rs __pycache__zopt-z.pyz.pycN) optimizationc Cs|dk r4tjdt|dk r(d}t||r0dnd}tj|}t|\}}|jd\}}}tj j } | dkrrt ddj |r~|n||| g} |dkrtj jdkrd}ntj j}t|}|dkr|jstd j|d j| t|} t|t| tdS) aGiven the path to a .py file, return the path to its .pyc file. The .py file does not need to exist; this simply returns the path to the .pyc file calculated as if the .py file were imported. The 'optimization' parameter controls the presumed optimization level of the bytecode file. If 'optimization' is not None, the string representation of the argument is taken and verified to be alphanumeric (else ValueError is raised). The debug_override parameter is deprecated. If debug_override is not None, a True value is the same as setting 'optimization' to the empty string while a False value is equivalent to setting 'optimization' to '1'. If sys.implementation.cache_tag is None then NotImplementedError is raised. NzFthe debug_override parameter is deprecated; use 'optimization' insteadz2debug_override or optimization must be set to Noner%r#.z$sys.implementation.cache_tag is Nonez{!r} is not alphanumericz{}.{}{}) _warningswarnDeprecationWarning TypeErrorrfspathr.r'r implementation cache_tagNotImplementedErrorr flagsoptimizestrisalnum ValueErrorr;_OPTr"_PYCACHEBYTECODE_SUFFIXES) r*debug_overriderMmessageheadr-basesepresttagalmost_filenamerrr cache_from_sources0    rhcCstjjdkrtdtj|}t|\}}t|\}}|tkrNtdj t||j d}|d krptdj |nV|dkr|j ddd }|j t stdj t |tt d}|jstd j ||jdd }t||td S) anGiven the path to a .pyc. file, return the path to its .py file. The .pyc file does not need to exist; this simply returns the path to the .py file calculated to correspond to the .pyc file. If path does not conform to PEP 3147/488 format, ValueError will be raised. If sys.implementation.cache_tag is None then NotImplementedError is raised. Nz$sys.implementation.cache_tag is Nonez%{} not bottom-level directory in {!r}rNrKz!expected only 2 or 3 dots in {!r}z9optimization portion of filename does not start with {!r}z4optimization level {!r} is not an alphanumeric valuerO>rKri)r rUrVrWrrTr.r^r\r;countr)r r]r&r[ partitionr"SOURCE_SUFFIXES)r*rbpycache_filenamepycache dot_countrM opt_level base_filenamerrr source_from_cache4s.        rsc Cst|dkrdS|jd\}}}| s:|jdddkr>|Sy t|}Wn$ttfk rn|dd }YnXt|r||S|S) zConvert a bytecode file path to a source path (if possible). This function exists purely for backwards-compatibility for PyImport_ExecCodeModuleWithFilenames() in the C API. rONrNrir#pyrv)r&r'lowerrsrWr\r6) bytecode_pathrer, extension source_pathrrr _get_sourcefileVs  r{c CsH|jttr.yt|Stk r*YqDXn|jttr@|SdSdS)N)endswithtuplermrhrWr_)filenamerrr _get_cachedisrc Cs4yt|j}Wntk r&d}YnX|dO}|S)z3Calculate the mode permissions for a bytecode file.i)r0r2r1)r*r3rrr _calc_modeus  rc sDdfdd }y tj}Wntk r4dd}YnX|||S)zDecorator to verify that the module being requested matches the one the loader can handle. The first argument (self) must define _name which the second argument is compared against. If the comparison fails then ImportError is raised. NcsB|dkr|j}n |j|kr0td|j|f|d||f||S)Nzloader for %s cannot handle %s)name)r ImportError)selfrargskwargs)methodrr _check_name_wrappers  z(_check_name.._check_name_wrappercSs<x(dD] }t||rt||t||qW|jj|jdS)N __module____name__ __qualname____doc__)rrrr)hasattrsetattrgetattr__dict__update)newoldrDrrr _wraps  z_check_name.._wrap)N) _bootstrapr NameError)rrrr)rr _check_names  rcCs<|j|\}}|dkr8t|r8d}tj|j|dt|S)zTry to find a loader for the specified module by delegating to self.find_loader(). This method is deprecated in favor of finder.find_spec(). Nz,Not importing directory {}: missing __init__rO) find_loaderr&rPrQr; ImportWarning)rfullnameloaderportionsmsgrrr _find_module_shims rc Csi}|dk r||d<nd}|dk r*||d<|dd}|dd}|dd}|tkr|dj||}tjd |t|f|nVt|dkrd j|}tjd |t|n*t|dkrd j|}tjd |t||dk r|yt|d } Wntk rYn2Xt || kr4d j|}tjd |t|f|y|dd@} Wntk rZYn"Xt || kr|td j|f||ddS)azValidate the header of the passed-in bytecode against source_stats (if given) and returning the bytecode that can be compiled by compile(). All other arguments are used to enhance error reporting. ImportError is raised when the magic number is incorrect or the bytecode is found to be stale. EOFError is raised when the data is found to be truncated. Nrz r*r zbad magic number in {!r}: {!r}z{}z+reached EOF while reading timestamp in {!r}z0reached EOF while reading size of source in {!r}mtimezbytecode is stale for {!r}sizel) MAGIC_NUMBERr;r_verbose_messagerr&EOFErrorrKeyErrorr) rF source_statsrr* exc_detailsmagic raw_timestampraw_sizera source_mtime source_sizerrr _validate_bytecode_headersL                   rcCsPtj|}t|tr8tjd||dk r4tj|||Stdj |||ddS)zddl}tj|j}|j|}tjdd}|j|j|dS)zyDecode bytes representing source code and return the string. Universal newline support is used in the decoding. rONT)tokenizerABytesIOreadlinedetect_encodingIncrementalNewlineDecoderdecode) source_bytesrsource_bytes_readlineencodingnewline_decoderrrr decode_sources    r)rsubmodule_search_locationsc Cs|dkr get_filename)originT is_packagerO)rrrrrTr ModuleSpec _set_fileattr_get_supported_file_loadersr|r}r _POPULATErrr.append) rlocationrrspec loader_classsuffixesrdirnamerrr spec_from_file_location s>        rc@sPeZdZdZdZdZdZeddZeddZ edd d Z edd d Z d S)WindowsRegistryFinderz>Meta path finder for modules declared in the Windows registry.z;Software\Python\PythonCore\{sys_version}\Modules\{fullname}zASoftware\Python\PythonCore\{sys_version}\Modules\{fullname}\DebugFc Cs2ytjtj|Stk r,tjtj|SXdS)N)_winregOpenKeyHKEY_CURRENT_USERr1HKEY_LOCAL_MACHINE)clsrrrr _open_registry\sz$WindowsRegistryFinder._open_registrycCsp|jr|j}n|j}|j|dtjddd}y&|j|}tj|d}WdQRXWnt k rjdSX|S)Nz%d.%drK)r sys_versionr%) DEBUG_BUILDREGISTRY_KEY_DEBUG REGISTRY_KEYr;r version_inforr QueryValuer1)rr registry_keyrhkeyfilepathrrr _search_registrycs z&WindowsRegistryFinder._search_registryNcCsx|j|}|dkrdSy t|Wntk r6dSXx:tD]0\}}|jt|r@tj|||||d}|Sq@WdS)N)r)rr0r1rr|r}rspec_from_loader)rrr*targetrrrrrrr find_specrs  zWindowsRegistryFinder.find_speccCs"|j||}|dk r|jSdSdS)zlFind module named in the registry. This method is deprecated. Use exec_module() instead. N)rr)rrr*rrrr find_modules z!WindowsRegistryFinder.find_module)NN)N) rrrrrrr classmethodrrrrrrrr rPs   rc@s0eZdZdZddZddZddZdd Zd S) _LoaderBasicszSBase class of common code needed by both SourceLoader and SourcelessFileLoader.cCs@t|j|d}|jddd}|jdd}|dko>|dkS)zConcrete implementation of InspectLoader.is_package by checking if the path returned by get_filename has a filename of '__init__.py'.r#rNrOrK__init__)r.rr)r')rrr~ filename_base tail_namerrr rsz_LoaderBasics.is_packagecCsdS)z*Use default semantics for module creation.Nr)rrrrr create_modulesz_LoaderBasics.create_modulecCs8|j|j}|dkr$tdj|jtjt||jdS)zExecute the module.Nz4cannot load module {!r} when get_code() returns None)get_coderrr;r_call_with_frames_removedexecr)rmodulerrrr exec_modules   z_LoaderBasics.exec_modulecCs tj||S)zThis module is deprecated.)r_load_module_shim)rrrrr load_modulesz_LoaderBasics.load_moduleN)rrrrrrrrrrrr rs rc@sJeZdZddZddZddZddZd d Zdd d dZddZ dS) SourceLoadercCstdS)zOptional method that returns the modification time (an int) for the specified path, where path is a str. Raises IOError when the path cannot be handled. N)IOError)rr*rrr path_mtimeszSourceLoader.path_mtimecCsd|j|iS)aOptional method returning a metadata dict for the specified path to by the path (str). Possible keys: - 'mtime' (mandatory) is the numeric timestamp of last source code modification; - 'size' (optional) is the size in bytes of the source code. Implementing this method allows the loader to read bytecode files. Raises IOError when the path cannot be handled. r)r)rr*rrr path_statss zSourceLoader.path_statscCs |j||S)zOptional method which writes data (bytes) to a file path (a str). Implementing this method allows for the writing of bytecode files. The source path is needed in order to correctly transfer permissions )set_data)rrz cache_pathrFrrr _cache_bytecodeszSourceLoader._cache_bytecodecCsdS)zOptional method which writes data (bytes) to a file path (a str). Implementing this method allows for the writing of bytecode files. Nr)rr*rFrrr rszSourceLoader.set_datacCsR|j|}y|j|}Wn0tk rH}ztd|d|WYdd}~XnXt|S)z4Concrete implementation of InspectLoader.get_source.z'source not available through get_data())rN)rget_datar1rr)rrr*rexcrrr get_sources zSourceLoader.get_sourcer#) _optimizecCstjt||dd|dS)zReturn the code object compiled from source. The 'data' argument can be any object type that compile() supports. rT) dont_inheritrY)rrcompile)rrFr*rrrr source_to_codes zSourceLoader.source_to_codec +Cs^|j|}d}y t|}Wntk r2d}YnXy|j|}Wntk rVYn~Xt|d}y|j|}Wntk rYnNXyt||||d}Wnt t fk rYn Xt j d||t ||||dS|j|}|j||} t j d|tj rZ|dk rZ|dk rZt| |t|}y|j|||t j d|Wntk rXYnX| S)zConcrete implementation of InspectLoader.get_code. Reading of bytecode requires path_stats to be implemented. To write bytecode, set_data must also be implemented. Nr)rrr*z {} matches {})rrxrzzcode object from {}z wrote {!r})rrhrWrrrrr1rrrrrrrr dont_write_bytecoderr&r) rrrzrrxstrF bytes_datar code_objectrrr rsN          zSourceLoader.get_codeNrv) rrrrrrrrrrrrrr rs   rcsPeZdZdZddZddZddZefdd Zed d Z d d Z Z S) FileLoaderzgBase file loader class which implements the loader protocol methods that require file system usage.cCs||_||_dS)zKCache the module name and the path to the file found by the finder.N)rr*)rrr*rrr r szFileLoader.__init__cCs|j|jko|j|jkS)N) __class__r)rotherrrr __eq__&s zFileLoader.__eq__cCst|jt|jAS)N)hashrr*)rrrr __hash__*szFileLoader.__hash__cstt|j|S)zdLoad a module from a file. This method is deprecated. Use exec_module() instead. )superr r)rr)r rr r-s zFileLoader.load_modulecCs|jS)z:Return the path to the source file as found by the finder.)r*)rrrrr r9szFileLoader.get_filenamec Cs tj|d }|jSQRXdS)z'Return the data from path as raw bytes.rN)rArBread)rr*rIrrr r>szFileLoader.get_data) rrrrrr rrrrr __classcell__rr)r r r s r c@s.eZdZdZddZddZdddd Zd S) SourceFileLoaderz>Concrete implementation of SourceLoader using the file system.cCst|}|j|jdS)z!Return the metadata for the path.)rr)r0st_mtimest_size)rr*rrrr rHszSourceFileLoader.path_statscCst|}|j|||dS)N)_mode)rr)rrzrxrFr3rrr rMsz SourceFileLoader._cache_bytecodei)rc Cst|\}}g}x(|r8t| r8t|\}}|j|qWxlt|D]`}t||}ytj|WqDtk rvwDYqDtk r}zt j d||dSd}~XqDXqDWyt |||t j d|Wn0tk r}zt j d||WYdd}~XnXdS)zWrite bytes data to a file.zcould not create {!r}: {!r}Nz created {!r}) r.r8rr(r"rmkdirFileExistsErrorr1rrrJ) rr*rFrparentr~r!rrrrr rRs*    zSourceFileLoader.set_dataN)rrrrrrrrrrr rDsrc@s eZdZdZddZddZdS)SourcelessFileLoaderz-Loader which handles sourceless file imports.cCs0|j|}|j|}t|||d}t|||dS)N)rr*)rrx)rrrr)rrr*rFrrrr rus  zSourcelessFileLoader.get_codecCsdS)z'Return None as there is no source code.Nr)rrrrr r{szSourcelessFileLoader.get_sourceN)rrrrrrrrrr rqsrc@s\eZdZdZddZddZddZdd Zd d Zd d Z ddZ ddZ e ddZ dS)ExtensionFileLoaderz]Loader for extension modules. The constructor is designed to work with FileFinder. cCs||_||_dS)N)rr*)rrr*rrr rszExtensionFileLoader.__init__cCs|j|jko|j|jkS)N)r r)rr rrr r s zExtensionFileLoader.__eq__cCst|jt|jAS)N)r rr*)rrrr rszExtensionFileLoader.__hash__cCs$tjtj|}tjd|j|j|S)z&Create an unitialized extension modulez&extension module {!r} loaded from {!r})rrrcreate_dynamicrrr*)rrrrrr rs   z!ExtensionFileLoader.create_modulecCs$tjtj|tjd|j|jdS)zInitialize an extension modulez(extension module {!r} executed from {!r}N)rrr exec_dynamicrrr*)rrrrr rszExtensionFileLoader.exec_modulecs$t|jdtfddtDS)z1Return True if the extension module is a package.r#c3s|]}d|kVqdS)rNr)rsuffix) file_namerr sz1ExtensionFileLoader.is_package..)r.r*anyEXTENSION_SUFFIXES)rrr)rr rs zExtensionFileLoader.is_packagecCsdS)z?Return None as an extension module cannot create a code object.Nr)rrrrr rszExtensionFileLoader.get_codecCsdS)z5Return None as extension modules have no source code.Nr)rrrrr rszExtensionFileLoader.get_sourcecCs|jS)z:Return the path to the source file as found by the finder.)r*)rrrrr rsz ExtensionFileLoader.get_filenameN)rrrrrr rrrrrrrrrrrr rsrc@s`eZdZdZddZddZddZdd Zd d Zd d Z ddZ ddZ ddZ ddZ dS)_NamespacePatha&Represents a namespace package's path. It uses the module name to find its parent module, and from there it looks up the parent's __path__. When this changes, the module's own path is recomputed, using path_finder. For top-level modules, the parent module's path is sys.path.cCs$||_||_t|j|_||_dS)N)_name_pathr}_get_parent_path_last_parent_path _path_finder)rrr* path_finderrrr rsz_NamespacePath.__init__cCs&|jjd\}}}|dkrdS|dfS)z>Returns a tuple of (parent-module-name, parent-path-attr-name)rNr%r r*__path__)r r*)r$r')rrdotmerrr _find_parent_path_namessz&_NamespacePath._find_parent_path_namescCs|j\}}ttj||S)N)r-rr modules)rparent_module_namepath_attr_namerrr r&s z_NamespacePath._get_parent_pathcCsPt|j}||jkrJ|j|j|}|dk rD|jdkrD|jrD|j|_||_|jS)N)r}r&r'r(r$rrr%)r parent_pathrrrr _recalculates  z_NamespacePath._recalculatecCs t|jS)N)iterr2)rrrr __iter__sz_NamespacePath.__iter__cCs||j|<dS)N)r%)rindexr*rrr __setitem__sz_NamespacePath.__setitem__cCs t|jS)N)r&r2)rrrr __len__sz_NamespacePath.__len__cCs dj|jS)Nz_NamespacePath({!r}))r;r%)rrrr __repr__sz_NamespacePath.__repr__cCs ||jkS)N)r2)ritemrrr __contains__sz_NamespacePath.__contains__cCs|jj|dS)N)r%r)rr9rrr rsz_NamespacePath.appendN)rrrrrr-r&r2r4r6r7r8r:rrrrr r#s  r#c@sPeZdZddZeddZddZddZd d Zd d Z d dZ ddZ dS)_NamespaceLoadercCst||||_dS)N)r#r%)rrr*r)rrr rsz_NamespaceLoader.__init__cCs dj|jS)zsReturn repr for the module. The method is deprecated. The import machinery does the job itself. z)r;r)rrrrr module_reprsz_NamespaceLoader.module_reprcCsdS)NTr)rrrrr rsz_NamespaceLoader.is_packagecCsdS)Nr%r)rrrrr rsz_NamespaceLoader.get_sourcecCstdddddS)Nr%zrT)r)r)rrrrr rsz_NamespaceLoader.get_codecCsdS)z*Use default semantics for module creation.Nr)rrrrr r sz_NamespaceLoader.create_modulecCsdS)Nr)rrrrr rsz_NamespaceLoader.exec_modulecCstjd|jtj||S)zbLoad a namespace module. This method is deprecated. Use exec_module() instead. z&namespace module loaded with path {!r})rrr%r)rrrrr rsz_NamespaceLoader.load_moduleN) rrrrrr<rrrrrrrrrr r;s r;c@sjeZdZdZeddZeddZeddZedd Zedd d Z edd dZ edddZ d S) PathFinderz>Meta path finder for sys.path and package __path__ attributes.cCs*x$tjjD]}t|dr |jq WdS)z}Call the invalidate_caches() method on all path entry finders stored in sys.path_importer_caches (where implemented).invalidate_cachesN)r path_importer_cachevaluesrr>)rfinderrrr r>#s zPathFinder.invalidate_cachesc CsVtjdk rtj rtjdtx2tjD]$}y||Stk rHw&Yq&Xq&WdSdS)z.Search sys.path_hooks for a finder for 'path'.Nzsys.path_hooks is empty)r path_hooksrPrQrr)rr*hookrrr _path_hooks+s   zPathFinder._path_hookscCsf|dkr*y tj}Wntk r(dSXytj|}Wn(tk r`|j|}|tj|<YnX|S)zGet the finder for the path entry from sys.path_importer_cache. If the path entry is not in the cache, find the appropriate finder and cache it. If no finder is available, store None. r%N)rr7FileNotFoundErrorr r?rrD)rr*rArrr _path_importer_cache8s  zPathFinder._path_importer_cachecCsRt|dr|j|\}}n|j|}g}|dk rrDrFrGrKrrrrrr r=s     r=c@sZeZdZdZddZddZeZddZdd Z dd d Z d dZ e ddZ ddZd S) FileFinderzFile-based finder. Interactions with the file system are cached for performance, being refreshed when the directory the finder is handling has been modified. csXg}x(|D] \}|jfdd|Dq W||_|p:d|_d|_t|_t|_dS)zInitialize with the path to search on and a variable number of 2-tuples containing the loader and the file suffixes the loader recognizes.c3s|]}|fVqdS)Nr)rr)rrr r sz&FileFinder.__init__..rNr#Nrv)r_loadersr* _path_mtimeset _path_cache_relaxed_path_cache)rr*loader_detailsloadersrr)rr rs zFileFinder.__init__cCs d|_dS)zInvalidate the directory mtime.r#Nrv)rO)rrrr r>szFileFinder.invalidate_cachescCs*|j|}|dkrdgfS|j|jp&gfS)zTry to find a loader for the specified module, or the namespace package portions. Returns (loader, list-of-portions). This method is deprecated. Use find_spec() instead. N)rrr)rrrrrr rs zFileFinder.find_loadercCs|||}t||||dS)N)rr)r)rrrr*smslrrrrr rKs zFileFinder._get_specNcCsbd}|jdd}yt|jp"tjj}Wntk rBd }YnX||jkr\|j||_t rr|j }|j }n |j }|}||krt |j|}xH|jD]6\} } d| } t || } t| r|j| || |g|SqWt|}xX|jD]N\} } t |j|| } tjd| dd|| |krt| r|j| || d|SqW|r^tjd |tj|d} |g| _| SdS) zoTry to find a spec for the specified module. Returns the matching spec, or None if not found. FrNrKr#rz trying {}) verbosityNzpossible namespace for {}rv)r'r0r*rr7rr1rO _fill_cacher rRrwrQr"rNr6rKr8rrrr)rrr is_namespace tail_modulercache cache_module base_pathrr init_filename full_pathrrrr rsF          zFileFinder.find_specc Cs|j}ytj|ptj}Wntttfk r:g}YnXtjj dsTt ||_ nNt }x@|D]8}|j d\}}}|rdj ||j}n|}|j|q`W||_ tjj trdd|D|_dS)zDFill the cache of potential modules and packages for this directory.rrNz{}.{}cSsh|] }|jqSr)rw)rfnrrr sz)FileFinder._fill_cache..N)r*rlistdirr7rEPermissionErrorNotADirectoryErrorr r r rPrQrlr;rwaddrrR) rr*contentslower_suffix_contentsr9rr+rnew_namerrr rWs"     zFileFinder._fill_cachecsfdd}|S)aA class method which returns a closure to use on sys.path_hook which will return an instance using the specified loaders and the path called on the closure. If the path called on the closure is not a directory, ImportError is raised. cs"t|std|d|fS)z-Path hook for importlib.machinery.FileFinder.zonly directories are supported)r*)r8r)r*)rrSrr path_hook_for_FileFinder*s z6FileFinder.path_hook..path_hook_for_FileFinderr)rrSrhr)rrSr path_hook s zFileFinder.path_hookcCs dj|jS)NzFileFinder({!r}))r;r*)rrrr r82szFileFinder.__repr__)N)rrrrrr>rrrrKrrWrrir8rrrr rMs  0 rMc Cs|jd}|jd}|sB|r$|j}n||kr8t||}n t||}|sTt|||d}y$||d<||d<||d<||d<Wntk rYnXdS)N __loader____spec__)r__file__ __cached__)getrrrr Exception)nsrpathname cpathnamerrrrr _fix_up_module8s"     rscCs*tttjf}ttf}ttf}|||gS)z_Returns a list of file-based module loaders. Each item is a tuple (loader, suffixes). )r_alternative_architecturesrextension_suffixesrrmrr_) extensionssourcebytecoderrr rOsrc Cs|atjatjatjt}x8dD]0}|tjkr:tj|}n tj|}t|||q Wddgfdddgff}xv|D]f\}}td d |Dst|d }|tjkrtj|}Pqpytj|}PWqpt k rwpYqpXqpWt d t|d |t|d|t|ddj |ytjd} Wnt k r4d} YnXt|d| tjd} t|d| |dkrxtjd} t|d| t|dt t j ttj|dkrtjddt krdt_dS)zSetup the path-based importers for importlib by importing needed built-in modules and injecting them into the global namespace. Other components are extracted from the core bootstrap module. rArPbuiltinsrposix/nt\css|]}t|dkVqdS)r#N)r&)rrdrrr r ssz_setup..rOzimportlib requires posix or ntrrrr%_threadN_weakrefwinregrr z.pywz_d.pydT)rArPryr)rr rr.r_builtin_from_namerallAssertionErrorrr rr"rrtrurmrrr) _bootstrap_module self_module builtin_namebuiltin_module os_details builtin_osrr os_module thread_moduleweakref_module winreg_modulerrr _setupZsR                     rcCs2t|t}tjjtj|gtjjt dS)z)Install the path-based import components.N) rrr rBrrMri meta_pathrr=)rsupported_loadersrrr _installsrz-arm-linux-gnueabihf.z-armeb-linux-gnueabihf.z-mips64-linux-gnuabi64.z-mips64el-linux-gnuabi64.z-powerpc-linux-gnu.z-powerpc-linux-gnuspe.z-powerpc64-linux-gnu.z-powerpc64le-linux-gnu.z-arm-linux-gnueabi.z-armeb-linux-gnueabi.z-mips64-linux-gnu.z-mips64el-linux-gnu.z-ppc-linux-gnu.z-ppc-linux-gnuspe.z-ppc64-linux-gnu.z-ppc64le-linux-gnu.)z-arm-linux-gnueabi.z-armeb-linux-gnueabi.z-mips64-linux-gnu.z-mips64el-linux-gnu.z-ppc-linux-gnu.z-ppc-linux-gnuspe.z-ppc64-linux-gnu.z-ppc64le-linux-gnu.z-arm-linux-gnueabihf.z-armeb-linux-gnueabihf.z-mips64-linux-gnuabi64.z-mips64el-linux-gnuabi64.z-powerpc-linux-gnu.z-powerpc-linux-gnuspe.z-powerpc64-linux-gnu.z-powerpc64le-linux-gnu.cCsFx@|D]8}x2tjD]&\}}||kr|j|j|||SqWqW|S)zAdd a suffix with an alternative architecture name to the list of suffixes so an extension built with the default (upstream) setting is loadable with our Pythons ) _ARCH_MAPitemsrrD)rroriginal alternativerrr rts   rt)r)rr)r9)N)NNN)NNN)rOrO)N)N)s     { -"   7 C@n)-5<*  D PK]p uu(_bootstrap_external.cpython-36.opt-2.pycnu[3 _Vjm@s"dmZdnZeeZddZddZddZd d Zd d Zd dZddZ ddZ ddZ doddZ e e jZdjdddZejedZdZdZdgZdgZeZZdpd d!d"d#Zd$d%Zd&d'Zd(d)Zd*d+Zd,d-Z d.d/Z!dqd0d1Z"drd2d3Z#dsd5d6Z$d7d8Z%e&Z'dtd e'd9d:d;Z(Gdd?d?Z*Gd@dAdAe*Z+GdBdCdCZ,GdDdEdEe,e+Z-GdFdGdGe,e*Z.gZ/GdHdIdIe,e*Z0GdJdKdKZ1GdLdMdMZ2GdNdOdOZ3GdPdQdQZ4dudRdSZ5dTdUZ6dVdWZ7dXdYZ8dZd[d\d]d^d_d`dadbdcdddedfdgdhdidjZ9dkdlZ:d S)vwincygwindarwincs<tjjtr0tjjtrdndfdd}ndd}|S)N PYTHONCASEOKs PYTHONCASEOKcs tjkS)N)_osenviron)keyr5/usr/lib64/python3.6/importlib/_bootstrap_external.py _relax_case%sz%_make_relax_case.._relax_casecSsdS)NFrrrrr r )s)sysplatform startswith_CASE_INSENSITIVE_PLATFORMS#_CASE_INSENSITIVE_PLATFORMS_STR_KEY)r r)rr _make_relax_cases  rcCst|d@jddS)Nllittle)intto_bytes)xrrr _w_long/srcCs tj|dS)Nr)r from_bytes) int_bytesrrr _r_long4srcGstjdd|DS)NcSsg|]}|r|jtqSr)rstrippath_separators).0partrrr ;sz_path_join..)path_sepjoin) path_partsrrr _path_join9s r"cCs`ttdkr$|jt\}}}||fSx2t|D]&}|tkr.|j|dd\}}||fSq.Wd|fS)N)maxsplit)lenr rpartitionrreversedrsplit)pathfront_tailrrrr _path_split?s  r.cCs tj|S)N)rstat)r*rrr _path_statKsr0c Cs0y t|}Wntk r dSX|jd@|kS)NFi)r0OSErrorst_mode)r*mode stat_inforrr _path_is_mode_typeUs  r5cCs t|dS)Ni)r5)r*rrr _path_isfile^sr6cCs|s tj}t|dS)Ni@)rgetcwdr5)r*rrr _path_isdircsr8cCsdj|t|}tj|tjtjBtjB|d@}y2tj|d}|j |WdQRXtj ||Wn:t k rytj |Wnt k rYnXYnXdS)Nz{}.{}iwb) formatidropenO_EXCLO_CREATO_WRONLY_ioFileIOwritereplacer1unlink)r*datar3path_tmpfdfilerrr _write_atomicjsrJi3 rs __pycache__zopt-z.pyz.pycN) optimizationc Cs|dk r4tjdt|dk r(d}t||r0dnd}tj|}t|\}}|jd\}}}tj j } | dkrrt ddj |r~|n||| g} |dkrtj jdkrd}ntj j}t|}|dkr|jstdj|d j| t|} t|t| tdS) NzFthe debug_override parameter is deprecated; use 'optimization' insteadz2debug_override or optimization must be set to Noner%r#.z$sys.implementation.cache_tag is Nonez{!r} is not alphanumericz{}.{}{}) _warningswarnDeprecationWarning TypeErrorrfspathr.r'r implementation cache_tagNotImplementedErrorr flagsoptimizestrisalnum ValueErrorr;_OPTr"_PYCACHEBYTECODE_SUFFIXES) r*debug_overriderMmessageheadr-basesepresttagalmost_filenamerrr cache_from_sources0    rhcCstjjdkrtdtj|}t|\}}t|\}}|tkrNtdj t||j d}|d krptdj |nV|dkr|j ddd }|j t stdj t |tt d}|jstdj ||jdd }t||td S) Nz$sys.implementation.cache_tag is Nonez%{} not bottom-level directory in {!r}rNrKz!expected only 2 or 3 dots in {!r}z9optimization portion of filename does not start with {!r}z4optimization level {!r} is not an alphanumeric valuerO>rKri)r rUrVrWrrTr.r^r\r;countr)r r]r&r[ partitionr"SOURCE_SUFFIXES)r*rbpycache_filenamepycache dot_countrM opt_level base_filenamerrr source_from_cache4s.        rsc Cst|dkrdS|jd\}}}| s:|jdddkr>|Sy t|}Wn$ttfk rn|dd}YnXt|r||S|S) NrOrNrir#pyrv)r&r'lowerrsrWr\r6) bytecode_pathrer, extension source_pathrrr _get_sourcefileVs  r{c CsH|jttr.yt|Stk r*YqDXn|jttr@|SdSdS)N)endswithtuplermrhrWr_)filenamerrr _get_cachedisrc Cs4yt|j}Wntk r&d}YnX|dO}|S)Ni)r0r2r1)r*r3rrr _calc_modeus  rc sDdfdd }y tj}Wntk r4dd}YnX|||S)NcsB|dkr|j}n |j|kr0td|j|f|d||f||S)Nzloader for %s cannot handle %s)name)r ImportError)selfrargskwargs)methodrr _check_name_wrappers  z(_check_name.._check_name_wrappercSs<x(dD] }t||rt||t||qW|jj|jdS)N __module____name__ __qualname____doc__)rrrr)hasattrsetattrgetattr__dict__update)newoldrDrrr _wraps  z_check_name.._wrap)N) _bootstrapr NameError)rrrr)rr _check_names  rcCs<|j|\}}|dkr8t|r8d}tj|j|dt|S)Nz,Not importing directory {}: missing __init__rO) find_loaderr&rPrQr; ImportWarning)rfullnameloaderportionsmsgrrr _find_module_shims rc Csi}|dk r||d<nd}|dk r*||d<|dd}|dd}|dd}|tkr|dj||}tjd|t|f|nVt|dkrd j|}tjd|t|n*t|dkrd j|}tjd|t||dk r|yt|d } Wntk rYn2Xt || kr4d j|}tjd|t|f|y|d d@} Wntk rZYn"Xt || kr|td j|f||ddS)Nrz r*r zbad magic number in {!r}: {!r}z{}z+reached EOF while reading timestamp in {!r}z0reached EOF while reading size of source in {!r}mtimezbytecode is stale for {!r}sizel) MAGIC_NUMBERr;r_verbose_messagerr&EOFErrorrKeyErrorr) rF source_statsrr* exc_detailsmagic raw_timestampraw_sizera source_mtime source_sizerrr _validate_bytecode_headersL                   rcCsPtj|}t|tr8tjd||dk r4tj|||Stdj |||ddS)Nzcode object from {!r}zNon-code object in {!r})rr*) marshalloads isinstance _code_typerr_imp_fix_co_filenamerr;)rFrrxrzcoderrr _compile_bytecodes     rrOcCs8tt}|jt||jt||jtj||S)N) bytearrayrextendrrdumps)rrrrFrrr _code_to_bytecodes rcCs>ddl}tj|j}|j|}tjdd}|j|j|dS)NrOT)tokenizerABytesIOreadlinedetect_encodingIncrementalNewlineDecoderdecode) source_bytesrsource_bytes_readlineencodingnewline_decoderrrr decode_sources    r)rsubmodule_search_locationsc Cs|dkr get_filename)originT is_packagerO)rrrrrTr ModuleSpec _set_fileattr_get_supported_file_loadersr|r}r _POPULATErrr.append) rlocationrrspec loader_classsuffixesrdirnamerrr spec_from_file_location s>        rc@sLeZdZdZdZdZeddZeddZed d d Z edd d Z dS)WindowsRegistryFinderz;Software\Python\PythonCore\{sys_version}\Modules\{fullname}zASoftware\Python\PythonCore\{sys_version}\Modules\{fullname}\DebugFc Cs2ytjtj|Stk r,tjtj|SXdS)N)_winregOpenKeyHKEY_CURRENT_USERr1HKEY_LOCAL_MACHINE)clsrrrr _open_registry\sz$WindowsRegistryFinder._open_registrycCsp|jr|j}n|j}|j|dtjddd}y&|j|}tj|d}WdQRXWnt k rjdSX|S)Nz%d.%drK)r sys_versionr%) DEBUG_BUILDREGISTRY_KEY_DEBUG REGISTRY_KEYr;r version_inforr QueryValuer1)rr registry_keyrhkeyfilepathrrr _search_registrycs z&WindowsRegistryFinder._search_registryNcCsx|j|}|dkrdSy t|Wntk r6dSXx:tD]0\}}|jt|r@tj|||||d}|Sq@WdS)N)r)rr0r1rr|r}rspec_from_loader)rrr*targetrrrrrrr find_specrs  zWindowsRegistryFinder.find_speccCs"|j||}|dk r|jSdSdS)N)rr)rrr*rrrr find_modules z!WindowsRegistryFinder.find_module)NN)N) rrrrrr classmethodrrrrrrrr rPs   rc@s,eZdZddZddZddZddZd S) _LoaderBasicscCs@t|j|d}|jddd}|jdd}|dko>|dkS)Nr#rNrOrK__init__)r.rr)r')rrr~ filename_base tail_namerrr rsz_LoaderBasics.is_packagecCsdS)Nr)rrrrr create_modulesz_LoaderBasics.create_modulecCs8|j|j}|dkr$tdj|jtjt||jdS)Nz4cannot load module {!r} when get_code() returns None)get_coderrr;r_call_with_frames_removedexecr)rmodulerrrr exec_modules   z_LoaderBasics.exec_modulecCs tj||S)N)r_load_module_shim)rrrrr load_modulesz_LoaderBasics.load_moduleN)rrrrrrrrrrr rsrc@sJeZdZddZddZddZddZd d Zdd d dZddZ dS) SourceLoadercCstdS)N)IOError)rr*rrr path_mtimeszSourceLoader.path_mtimecCsd|j|iS)Nr)r)rr*rrr path_statss zSourceLoader.path_statscCs |j||S)N)set_data)rrz cache_pathrFrrr _cache_bytecodeszSourceLoader._cache_bytecodecCsdS)Nr)rr*rFrrr rszSourceLoader.set_datacCsR|j|}y|j|}Wn0tk rH}ztd|d|WYdd}~XnXt|S)Nz'source not available through get_data())r)rget_datar1rr)rrr*rexcrrr get_sources zSourceLoader.get_sourcer#) _optimizecCstjt||dd|dS)NrT) dont_inheritrY)rrcompile)rrFr*rrrr source_to_codes zSourceLoader.source_to_codec +Cs^|j|}d}y t|}Wntk r2d}YnXy|j|}Wntk rVYn~Xt|d}y|j|}Wntk rYnNXyt||||d}Wnt t fk rYn Xt j d||t ||||dS|j|}|j||} t j d|tj rZ|dk rZ|dk rZt| |t|}y|j|||t j d|Wntk rXYnX| S)Nr)rrr*z {} matches {})rrxrzzcode object from {}z wrote {!r})rrhrWrrrrr1rrrrrrrr dont_write_bytecoderr&r) rrrzrrxstrF bytes_datar code_objectrrr rsN          zSourceLoader.get_codeNrv) rrrrrrrrrrrrrr rs   rcsLeZdZddZddZddZefddZed d Zd d Z Z S) FileLoadercCs||_||_dS)N)rr*)rrr*rrr r szFileLoader.__init__cCs|j|jko|j|jkS)N) __class__r)rotherrrr __eq__&s zFileLoader.__eq__cCst|jt|jAS)N)hashrr*)rrrr __hash__*szFileLoader.__hash__cstt|j|S)N)superr r)rr)r rr r-s zFileLoader.load_modulecCs|jS)N)r*)rrrrr r9szFileLoader.get_filenamec Cs tj|d }|jSQRXdS)Nr)rArBread)rr*rIrrr r>szFileLoader.get_data) rrrrr rrrrr __classcell__rr)r r r s  r c@s*eZdZddZddZddddZd S) SourceFileLoadercCst|}|j|jdS)N)rr)r0st_mtimest_size)rr*rrrr rHszSourceFileLoader.path_statscCst|}|j|||dS)N)_mode)rr)rrzrxrFr3rrr rMsz SourceFileLoader._cache_bytecodei)rc Cst|\}}g}x(|r8t| r8t|\}}|j|qWxlt|D]`}t||}ytj|WqDtk rvwDYqDtk r}zt j d||dSd}~XqDXqDWyt |||t j d|Wn0tk r}zt j d||WYdd}~XnXdS)Nzcould not create {!r}: {!r}z created {!r}) r.r8rr(r"rmkdirFileExistsErrorr1rrrJ) rr*rFrparentr~r!rrrrr rRs*    zSourceFileLoader.set_dataN)rrrrrrrrrr rDsrc@seZdZddZddZdS)SourcelessFileLoadercCs0|j|}|j|}t|||d}t|||dS)N)rr*)rrx)rrrr)rrr*rFrrrr rus  zSourcelessFileLoader.get_codecCsdS)Nr)rrrrr r{szSourcelessFileLoader.get_sourceN)rrrrrrrrr rqsrc@sXeZdZddZddZddZddZd d Zd d Zd dZ ddZ e ddZ dS)ExtensionFileLoadercCs||_||_dS)N)rr*)rrr*rrr rszExtensionFileLoader.__init__cCs|j|jko|j|jkS)N)r r)rr rrr r s zExtensionFileLoader.__eq__cCst|jt|jAS)N)r rr*)rrrr rszExtensionFileLoader.__hash__cCs$tjtj|}tjd|j|j|S)Nz&extension module {!r} loaded from {!r})rrrcreate_dynamicrrr*)rrrrrr rs   z!ExtensionFileLoader.create_modulecCs$tjtj|tjd|j|jdS)Nz(extension module {!r} executed from {!r})rrr exec_dynamicrrr*)rrrrr rszExtensionFileLoader.exec_modulecs$t|jdtfddtDS)Nr#c3s|]}d|kVqdS)rNr)rsuffix) file_namerr sz1ExtensionFileLoader.is_package..)r.r*anyEXTENSION_SUFFIXES)rrr)rr rs zExtensionFileLoader.is_packagecCsdS)Nr)rrrrr rszExtensionFileLoader.get_codecCsdS)Nr)rrrrr rszExtensionFileLoader.get_sourcecCs|jS)N)r*)rrrrr rsz ExtensionFileLoader.get_filenameN) rrrrr rrrrrrrrrrrr rsrc@s\eZdZddZddZddZddZd d Zd d Zd dZ ddZ ddZ ddZ dS)_NamespacePathcCs$||_||_t|j|_||_dS)N)_name_pathr}_get_parent_path_last_parent_path _path_finder)rrr* path_finderrrr rsz_NamespacePath.__init__cCs&|jjd\}}}|dkrdS|dfS)NrNr%r r*__path__)r r*)r$r')rrdotmerrr _find_parent_path_namessz&_NamespacePath._find_parent_path_namescCs|j\}}ttj||S)N)r-rr modules)rparent_module_namepath_attr_namerrr r&s z_NamespacePath._get_parent_pathcCsPt|j}||jkrJ|j|j|}|dk rD|jdkrD|jrD|j|_||_|jS)N)r}r&r'r(r$rrr%)r parent_pathrrrr _recalculates  z_NamespacePath._recalculatecCs t|jS)N)iterr2)rrrr __iter__sz_NamespacePath.__iter__cCs||j|<dS)N)r%)rindexr*rrr __setitem__sz_NamespacePath.__setitem__cCs t|jS)N)r&r2)rrrr __len__sz_NamespacePath.__len__cCs dj|jS)Nz_NamespacePath({!r}))r;r%)rrrr __repr__sz_NamespacePath.__repr__cCs ||jkS)N)r2)ritemrrr __contains__sz_NamespacePath.__contains__cCs|jj|dS)N)r%r)rr9rrr rsz_NamespacePath.appendN) rrrrr-r&r2r4r6r7r8r:rrrrr r#s  r#c@sPeZdZddZeddZddZddZd d Zd d Z d dZ ddZ dS)_NamespaceLoadercCst||||_dS)N)r#r%)rrr*r)rrr rsz_NamespaceLoader.__init__cCs dj|jS)Nz)r;r)rrrrr module_reprsz_NamespaceLoader.module_reprcCsdS)NTr)rrrrr rsz_NamespaceLoader.is_packagecCsdS)Nr%r)rrrrr rsz_NamespaceLoader.get_sourcecCstdddddS)Nr%zrT)r)r)rrrrr rsz_NamespaceLoader.get_codecCsdS)Nr)rrrrr r sz_NamespaceLoader.create_modulecCsdS)Nr)rrrrr rsz_NamespaceLoader.exec_modulecCstjd|jtj||S)Nz&namespace module loaded with path {!r})rrr%r)rrrrr rsz_NamespaceLoader.load_moduleN) rrrrrr<rrrrrrrrrr r;s r;c@sfeZdZeddZeddZeddZeddZedd d Zedd d Z edddZ d S) PathFindercCs*x$tjjD]}t|dr |jq WdS)Ninvalidate_caches)r path_importer_cachevaluesrr>)rfinderrrr r>#s zPathFinder.invalidate_cachesc CsVtjdk rtj rtjdtx2tjD]$}y||Stk rHw&Yq&Xq&WdSdS)Nzsys.path_hooks is empty)r path_hooksrPrQrr)rr*hookrrr _path_hooks+s   zPathFinder._path_hookscCsf|dkr*y tj}Wntk r(dSXytj|}Wn(tk r`|j|}|tj|<YnX|S)Nr%)rr7FileNotFoundErrorr r?rrD)rr*rArrr _path_importer_cache8s  zPathFinder._path_importer_cachecCsRt|dr|j|\}}n|j|}g}|dk rrDrFrGrKrrrrrr r=s     r=c@sVeZdZddZddZeZddZddZdd d Z d d Z e ddZ ddZ d S) FileFindercsXg}x(|D] \}|jfdd|Dq W||_|p:d|_d|_t|_t|_dS)Nc3s|]}|fVqdS)Nr)rr)rrr r sz&FileFinder.__init__..rNr#rv)r_loadersr* _path_mtimeset _path_cache_relaxed_path_cache)rr*loader_detailsloadersrr)rr rs zFileFinder.__init__cCs d|_dS)Nr#rv)rO)rrrr r>szFileFinder.invalidate_cachescCs*|j|}|dkrdgfS|j|jp&gfS)N)rrr)rrrrrr rs zFileFinder.find_loadercCs|||}t||||dS)N)rr)r)rrrr*smslrrrrr rKs zFileFinder._get_specNcCsbd}|jdd}yt|jp"tjj}Wntk rBd }YnX||jkr\|j||_t rr|j }|j }n |j }|}||krt |j|}xH|jD]6\} } d| } t || } t| r|j| || |g|SqWt|}xX|jD]N\} } t |j|| } tjd| dd|| |krt| r|j| || d|SqW|r^tjd|tj|d} |g| _| SdS) NFrNrKr#rz trying {}) verbosityzpossible namespace for {}rv)r'r0r*rr7rr1rO _fill_cacher rRrwrQr"rNr6rKr8rrrr)rrr is_namespace tail_modulercache cache_module base_pathrr init_filename full_pathrrrr rsF          zFileFinder.find_specc Cs|j}ytj|ptj}Wntttfk r:g}YnXtjj dsTt ||_ nNt }x@|D]8}|j d\}}}|rdj ||j}n|}|j|q`W||_ tjj trdd|D|_dS)NrrNz{}.{}cSsh|] }|jqSr)rw)rfnrrr sz)FileFinder._fill_cache..)r*rlistdirr7rEPermissionErrorNotADirectoryErrorr r r rPrQrlr;rwaddrrR) rr*contentslower_suffix_contentsr9rr+rnew_namerrr rWs"     zFileFinder._fill_cachecsfdd}|S)Ncs"t|std|d|fS)Nzonly directories are supported)r*)r8r)r*)rrSrr path_hook_for_FileFinder*s z6FileFinder.path_hook..path_hook_for_FileFinderr)rrSrhr)rrSr path_hook s zFileFinder.path_hookcCs dj|jS)NzFileFinder({!r}))r;r*)rrrr r82szFileFinder.__repr__)N)rrrrr>rrrrKrrWrrir8rrrr rMs   0 rMc Cs|jd}|jd}|sB|r$|j}n||kr8t||}n t||}|sTt|||d}y$||d<||d<||d<||d<Wntk rYnXdS)N __loader____spec__)r__file__ __cached__)getrrrr Exception)nsrpathname cpathnamerrrrr _fix_up_module8s"     rscCs*tttjf}ttf}ttf}|||gS)N)r_alternative_architecturesrextension_suffixesrrmrr_) extensionssourcebytecoderrr rOsrc Cs|atjatjatjt}x8dD]0}|tjkr:tj|}n tj|}t|||q Wddgfdddgff}x`|D]P\}}|d }|tjkrtj|}Pqpytj|}PWqptk rwpYqpXqpWtd t|d |t|d |t|d dj|ytjd} Wntk rd} YnXt|d| tjd} t|d| |dkrbtjd} t|d| t|dt t j t tj |dkrtjddt krdt_dS)NrArPbuiltinsrposix/nt\rOzimportlib requires posix or ntrrrr%_thread_weakrefwinregrr z.pywz_d.pydT)rArPryr)rr rr.r_builtin_from_namerrr rr"rrtrurmrrr) _bootstrap_module self_module builtin_namebuiltin_module os_details builtin_osrr os_module thread_moduleweakref_module winreg_modulerrr _setupZsP                     rcCs2t|t}tjjtj|gtjjt dS)N) rrr rBrrMri meta_pathrr=)rsupported_loadersrrr _installsrz-arm-linux-gnueabihf.z-armeb-linux-gnueabihf.z-mips64-linux-gnuabi64.z-mips64el-linux-gnuabi64.z-powerpc-linux-gnu.z-powerpc-linux-gnuspe.z-powerpc64-linux-gnu.z-powerpc64le-linux-gnu.z-arm-linux-gnueabi.z-armeb-linux-gnueabi.z-mips64-linux-gnu.z-mips64el-linux-gnu.z-ppc-linux-gnu.z-ppc-linux-gnuspe.z-ppc64-linux-gnu.z-ppc64le-linux-gnu.)z-arm-linux-gnueabi.z-armeb-linux-gnueabi.z-mips64-linux-gnu.z-mips64el-linux-gnu.z-ppc-linux-gnu.z-ppc-linux-gnuspe.z-ppc64-linux-gnu.z-ppc64le-linux-gnu.z-arm-linux-gnueabihf.z-armeb-linux-gnueabihf.z-mips64-linux-gnuabi64.z-mips64el-linux-gnuabi64.z-powerpc-linux-gnu.z-powerpc-linux-gnuspe.z-powerpc64-linux-gnu.z-powerpc64le-linux-gnu.cCsFx@|D]8}x2tjD]&\}}||kr|j|j|||SqWqW|S)N) _ARCH_MAPitemsrrD)rroriginal alternativerrr rts   rt)r)rr)r9)N)NNN)NNN)rOrO)N)N);r%_CASE_INSENSITIVE_PLATFORMS_BYTES_KEYrrrrr"r.r0r5r6r8rJtype__code__rrrrr_RAW_MAGIC_NUMBERr^r]rmr_DEBUG_BYTECODE_SUFFIXESOPTIMIZED_BYTECODE_SUFFIXESrhrsr{rrrrrrrrobjectrrrrrr rrr"rr#r;r=rMrsrrrrrtrrrr s     { -"   7 C@n)-5<*  D PK]\Q3abc.cpython-36.pycnu[3 \D@sddlTddlmZdS))*)__all__N)_collections_abcrrr'/usr/lib64/python3.6/collections/abc.pysPK]Wq(_bootstrap_external.cpython-36.opt-1.pycnu[3 _Vjm@s&dZdnZdoZeeZddZddZdd Zd d Zd d ZddZ ddZ ddZ ddZ dpddZ ee jZdjdddZejedZdZdZdgZd gZeZZdqd!d"d#d$Zd%d&Zd'd(Zd)d*Zd+d,Z d-d.Z!d/d0Z"drd1d2Z#dsd3d4Z$dtd6d7Z%d8d9Z&e'Z(dud!e(d:d;d<Z)Gd=d>d>Z*Gd?d@d@Z+GdAdBdBe+Z,GdCdDdDZ-GdEdFdFe-e,Z.GdGdHdHe-e+Z/gZ0GdIdJdJe-e+Z1GdKdLdLZ2GdMdNdNZ3GdOdPdPZ4GdQdRdRZ5dvdSdTZ6dUdVZ7dWdXZ8dYdZZ9d[d\d]d^d_d`dadbdcdddedfdgdhdidjdkZ:dldmZ;d!S)wa^Core implementation of path-based import. This module is NOT meant to be directly imported! It has been designed such that it can be bootstrapped into Python as the implementation of import. As such it requires the injection of specific modules and attributes in order to work. One should use importlib as the public-facing version of this module. wincygwindarwincs<tjjtr0tjjtrdndfdd}ndd}|S)N PYTHONCASEOKs PYTHONCASEOKcs tjkS)z5True if filenames must be checked case-insensitively.)_osenviron)keyr5/usr/lib64/python3.6/importlib/_bootstrap_external.py _relax_case%sz%_make_relax_case.._relax_casecSsdS)z5True if filenames must be checked case-insensitively.Frrrrr r )s)sysplatform startswith_CASE_INSENSITIVE_PLATFORMS#_CASE_INSENSITIVE_PLATFORMS_STR_KEY)r r)rr _make_relax_cases  rcCst|d@jddS)z*Convert a 32-bit integer to little-endian.llittle)intto_bytes)xrrr _w_long/srcCs tj|dS)z/Convert 4 bytes in little-endian to an integer.r)r from_bytes) int_bytesrrr _r_long4srcGstjdd|DS)zReplacement for os.path.join().cSsg|]}|r|jtqSr)rstrippath_separators).0partrrr ;sz_path_join..)path_sepjoin) path_partsrrr _path_join9s r"cCs`ttdkr$|jt\}}}||fSx2t|D]&}|tkr.|j|dd\}}||fSq.Wd|fS)z Replacement for os.path.split().)maxsplit)lenr rpartitionrreversedrsplit)pathfront_tailrrrr _path_split?s  r.cCs tj|S)z~Stat the path. Made a separate function to make it easier to override in experiments (e.g. cache stat results). )rstat)r*rrr _path_statKsr0c Cs0y t|}Wntk r dSX|jd@|kS)z1Test whether the path is the specified mode type.Fi)r0OSErrorst_mode)r*mode stat_inforrr _path_is_mode_typeUs  r5cCs t|dS)zReplacement for os.path.isfile.i)r5)r*rrr _path_isfile^sr6cCs|s tj}t|dS)zReplacement for os.path.isdir.i@)rgetcwdr5)r*rrr _path_isdircsr8cCsdj|t|}tj|tjtjBtjB|d@}y2tj|d}|j |WdQRXtj ||Wn:t k rytj |Wnt k rYnXYnXdS)zBest-effort function to write data to a path atomically. Be prepared to handle a FileExistsError if concurrent writing of the temporary file is attempted.z{}.{}iwbN) formatidropenO_EXCLO_CREATO_WRONLY_ioFileIOwritereplacer1unlink)r*datar3path_tmpfdfilerrr _write_atomicjsrJi3 rs __pycache__zopt-z.pyz.pycN) optimizationc Cs|dk r4tjdt|dk r(d}t||r0dnd}tj|}t|\}}|jd\}}}tj j } | dkrrt ddj |r~|n||| g} |dkrtj jdkrd}ntj j}t|}|dkr|jstd j|d j| t|} t|t| tdS) aGiven the path to a .py file, return the path to its .pyc file. The .py file does not need to exist; this simply returns the path to the .pyc file calculated as if the .py file were imported. The 'optimization' parameter controls the presumed optimization level of the bytecode file. If 'optimization' is not None, the string representation of the argument is taken and verified to be alphanumeric (else ValueError is raised). The debug_override parameter is deprecated. If debug_override is not None, a True value is the same as setting 'optimization' to the empty string while a False value is equivalent to setting 'optimization' to '1'. If sys.implementation.cache_tag is None then NotImplementedError is raised. NzFthe debug_override parameter is deprecated; use 'optimization' insteadz2debug_override or optimization must be set to Noner%r#.z$sys.implementation.cache_tag is Nonez{!r} is not alphanumericz{}.{}{}) _warningswarnDeprecationWarning TypeErrorrfspathr.r'r implementation cache_tagNotImplementedErrorr flagsoptimizestrisalnum ValueErrorr;_OPTr"_PYCACHEBYTECODE_SUFFIXES) r*debug_overriderMmessageheadr-basesepresttagalmost_filenamerrr cache_from_sources0    rhcCstjjdkrtdtj|}t|\}}t|\}}|tkrNtdj t||j d}|d krptdj |nV|dkr|j ddd }|j t stdj t |tt d}|jstd j ||jdd }t||td S) anGiven the path to a .pyc. file, return the path to its .py file. The .pyc file does not need to exist; this simply returns the path to the .py file calculated to correspond to the .pyc file. If path does not conform to PEP 3147/488 format, ValueError will be raised. If sys.implementation.cache_tag is None then NotImplementedError is raised. Nz$sys.implementation.cache_tag is Nonez%{} not bottom-level directory in {!r}rNrKz!expected only 2 or 3 dots in {!r}z9optimization portion of filename does not start with {!r}z4optimization level {!r} is not an alphanumeric valuerO>rKri)r rUrVrWrrTr.r^r\r;countr)r r]r&r[ partitionr"SOURCE_SUFFIXES)r*rbpycache_filenamepycache dot_countrM opt_level base_filenamerrr source_from_cache4s.        rsc Cst|dkrdS|jd\}}}| s:|jdddkr>|Sy t|}Wn$ttfk rn|dd }YnXt|r||S|S) zConvert a bytecode file path to a source path (if possible). This function exists purely for backwards-compatibility for PyImport_ExecCodeModuleWithFilenames() in the C API. rONrNrir#pyrv)r&r'lowerrsrWr\r6) bytecode_pathrer, extension source_pathrrr _get_sourcefileVs  r{c CsH|jttr.yt|Stk r*YqDXn|jttr@|SdSdS)N)endswithtuplermrhrWr_)filenamerrr _get_cachedisrc Cs4yt|j}Wntk r&d}YnX|dO}|S)z3Calculate the mode permissions for a bytecode file.i)r0r2r1)r*r3rrr _calc_modeus  rc sDdfdd }y tj}Wntk r4dd}YnX|||S)zDecorator to verify that the module being requested matches the one the loader can handle. The first argument (self) must define _name which the second argument is compared against. If the comparison fails then ImportError is raised. NcsB|dkr|j}n |j|kr0td|j|f|d||f||S)Nzloader for %s cannot handle %s)name)r ImportError)selfrargskwargs)methodrr _check_name_wrappers  z(_check_name.._check_name_wrappercSs<x(dD] }t||rt||t||qW|jj|jdS)N __module____name__ __qualname____doc__)rrrr)hasattrsetattrgetattr__dict__update)newoldrDrrr _wraps  z_check_name.._wrap)N) _bootstrapr NameError)rrrr)rr _check_names  rcCs<|j|\}}|dkr8t|r8d}tj|j|dt|S)zTry to find a loader for the specified module by delegating to self.find_loader(). This method is deprecated in favor of finder.find_spec(). Nz,Not importing directory {}: missing __init__rO) find_loaderr&rPrQr; ImportWarning)rfullnameloaderportionsmsgrrr _find_module_shims rc Csi}|dk r||d<nd}|dk r*||d<|dd}|dd}|dd}|tkr|dj||}tjd |t|f|nVt|dkrd j|}tjd |t|n*t|dkrd j|}tjd |t||dk r|yt|d } Wntk rYn2Xt || kr4d j|}tjd |t|f|y|dd@} Wntk rZYn"Xt || kr|td j|f||ddS)azValidate the header of the passed-in bytecode against source_stats (if given) and returning the bytecode that can be compiled by compile(). All other arguments are used to enhance error reporting. ImportError is raised when the magic number is incorrect or the bytecode is found to be stale. EOFError is raised when the data is found to be truncated. Nrz r*r zbad magic number in {!r}: {!r}z{}z+reached EOF while reading timestamp in {!r}z0reached EOF while reading size of source in {!r}mtimezbytecode is stale for {!r}sizel) MAGIC_NUMBERr;r_verbose_messagerr&EOFErrorrKeyErrorr) rF source_statsrr* exc_detailsmagic raw_timestampraw_sizera source_mtime source_sizerrr _validate_bytecode_headersL                   rcCsPtj|}t|tr8tjd||dk r4tj|||Stdj |||ddS)zddl}tj|j}|j|}tjdd}|j|j|dS)zyDecode bytes representing source code and return the string. Universal newline support is used in the decoding. rONT)tokenizerABytesIOreadlinedetect_encodingIncrementalNewlineDecoderdecode) source_bytesrsource_bytes_readlineencodingnewline_decoderrrr decode_sources    r)rsubmodule_search_locationsc Cs|dkr get_filename)originT is_packagerO)rrrrrTr ModuleSpec _set_fileattr_get_supported_file_loadersr|r}r _POPULATErrr.append) rlocationrrspec loader_classsuffixesrdirnamerrr spec_from_file_location s>        rc@sPeZdZdZdZdZdZeddZeddZ edd d Z edd d Z d S)WindowsRegistryFinderz>Meta path finder for modules declared in the Windows registry.z;Software\Python\PythonCore\{sys_version}\Modules\{fullname}zASoftware\Python\PythonCore\{sys_version}\Modules\{fullname}\DebugFc Cs2ytjtj|Stk r,tjtj|SXdS)N)_winregOpenKeyHKEY_CURRENT_USERr1HKEY_LOCAL_MACHINE)clsrrrr _open_registry\sz$WindowsRegistryFinder._open_registrycCsp|jr|j}n|j}|j|dtjddd}y&|j|}tj|d}WdQRXWnt k rjdSX|S)Nz%d.%drK)r sys_versionr%) DEBUG_BUILDREGISTRY_KEY_DEBUG REGISTRY_KEYr;r version_inforr QueryValuer1)rr registry_keyrhkeyfilepathrrr _search_registrycs z&WindowsRegistryFinder._search_registryNcCsx|j|}|dkrdSy t|Wntk r6dSXx:tD]0\}}|jt|r@tj|||||d}|Sq@WdS)N)r)rr0r1rr|r}rspec_from_loader)rrr*targetrrrrrrr find_specrs  zWindowsRegistryFinder.find_speccCs"|j||}|dk r|jSdSdS)zlFind module named in the registry. This method is deprecated. Use exec_module() instead. N)rr)rrr*rrrr find_modules z!WindowsRegistryFinder.find_module)NN)N) rrrrrrr classmethodrrrrrrrr rPs   rc@s0eZdZdZddZddZddZdd Zd S) _LoaderBasicszSBase class of common code needed by both SourceLoader and SourcelessFileLoader.cCs@t|j|d}|jddd}|jdd}|dko>|dkS)zConcrete implementation of InspectLoader.is_package by checking if the path returned by get_filename has a filename of '__init__.py'.r#rNrOrK__init__)r.rr)r')rrr~ filename_base tail_namerrr rsz_LoaderBasics.is_packagecCsdS)z*Use default semantics for module creation.Nr)rrrrr create_modulesz_LoaderBasics.create_modulecCs8|j|j}|dkr$tdj|jtjt||jdS)zExecute the module.Nz4cannot load module {!r} when get_code() returns None)get_coderrr;r_call_with_frames_removedexecr)rmodulerrrr exec_modules   z_LoaderBasics.exec_modulecCs tj||S)zThis module is deprecated.)r_load_module_shim)rrrrr load_modulesz_LoaderBasics.load_moduleN)rrrrrrrrrrrr rs rc@sJeZdZddZddZddZddZd d Zdd d dZddZ dS) SourceLoadercCstdS)zOptional method that returns the modification time (an int) for the specified path, where path is a str. Raises IOError when the path cannot be handled. N)IOError)rr*rrr path_mtimeszSourceLoader.path_mtimecCsd|j|iS)aOptional method returning a metadata dict for the specified path to by the path (str). Possible keys: - 'mtime' (mandatory) is the numeric timestamp of last source code modification; - 'size' (optional) is the size in bytes of the source code. Implementing this method allows the loader to read bytecode files. Raises IOError when the path cannot be handled. r)r)rr*rrr path_statss zSourceLoader.path_statscCs |j||S)zOptional method which writes data (bytes) to a file path (a str). Implementing this method allows for the writing of bytecode files. The source path is needed in order to correctly transfer permissions )set_data)rrz cache_pathrFrrr _cache_bytecodeszSourceLoader._cache_bytecodecCsdS)zOptional method which writes data (bytes) to a file path (a str). Implementing this method allows for the writing of bytecode files. Nr)rr*rFrrr rszSourceLoader.set_datacCsR|j|}y|j|}Wn0tk rH}ztd|d|WYdd}~XnXt|S)z4Concrete implementation of InspectLoader.get_source.z'source not available through get_data())rN)rget_datar1rr)rrr*rexcrrr get_sources zSourceLoader.get_sourcer#) _optimizecCstjt||dd|dS)zReturn the code object compiled from source. The 'data' argument can be any object type that compile() supports. rT) dont_inheritrY)rrcompile)rrFr*rrrr source_to_codes zSourceLoader.source_to_codec +Cs^|j|}d}y t|}Wntk r2d}YnXy|j|}Wntk rVYn~Xt|d}y|j|}Wntk rYnNXyt||||d}Wnt t fk rYn Xt j d||t ||||dS|j|}|j||} t j d|tj rZ|dk rZ|dk rZt| |t|}y|j|||t j d|Wntk rXYnX| S)zConcrete implementation of InspectLoader.get_code. Reading of bytecode requires path_stats to be implemented. To write bytecode, set_data must also be implemented. Nr)rrr*z {} matches {})rrxrzzcode object from {}z wrote {!r})rrhrWrrrrr1rrrrrrrr dont_write_bytecoderr&r) rrrzrrxstrF bytes_datar code_objectrrr rsN          zSourceLoader.get_codeNrv) rrrrrrrrrrrrrr rs   rcsPeZdZdZddZddZddZefdd Zed d Z d d Z Z S) FileLoaderzgBase file loader class which implements the loader protocol methods that require file system usage.cCs||_||_dS)zKCache the module name and the path to the file found by the finder.N)rr*)rrr*rrr r szFileLoader.__init__cCs|j|jko|j|jkS)N) __class__r)rotherrrr __eq__&s zFileLoader.__eq__cCst|jt|jAS)N)hashrr*)rrrr __hash__*szFileLoader.__hash__cstt|j|S)zdLoad a module from a file. This method is deprecated. Use exec_module() instead. )superr r)rr)r rr r-s zFileLoader.load_modulecCs|jS)z:Return the path to the source file as found by the finder.)r*)rrrrr r9szFileLoader.get_filenamec Cs tj|d }|jSQRXdS)z'Return the data from path as raw bytes.rN)rArBread)rr*rIrrr r>szFileLoader.get_data) rrrrrr rrrrr __classcell__rr)r r r s r c@s.eZdZdZddZddZdddd Zd S) SourceFileLoaderz>Concrete implementation of SourceLoader using the file system.cCst|}|j|jdS)z!Return the metadata for the path.)rr)r0st_mtimest_size)rr*rrrr rHszSourceFileLoader.path_statscCst|}|j|||dS)N)_mode)rr)rrzrxrFr3rrr rMsz SourceFileLoader._cache_bytecodei)rc Cst|\}}g}x(|r8t| r8t|\}}|j|qWxlt|D]`}t||}ytj|WqDtk rvwDYqDtk r}zt j d||dSd}~XqDXqDWyt |||t j d|Wn0tk r}zt j d||WYdd}~XnXdS)zWrite bytes data to a file.zcould not create {!r}: {!r}Nz created {!r}) r.r8rr(r"rmkdirFileExistsErrorr1rrrJ) rr*rFrparentr~r!rrrrr rRs*    zSourceFileLoader.set_dataN)rrrrrrrrrrr rDsrc@s eZdZdZddZddZdS)SourcelessFileLoaderz-Loader which handles sourceless file imports.cCs0|j|}|j|}t|||d}t|||dS)N)rr*)rrx)rrrr)rrr*rFrrrr rus  zSourcelessFileLoader.get_codecCsdS)z'Return None as there is no source code.Nr)rrrrr r{szSourcelessFileLoader.get_sourceN)rrrrrrrrrr rqsrc@s\eZdZdZddZddZddZdd Zd d Zd d Z ddZ ddZ e ddZ dS)ExtensionFileLoaderz]Loader for extension modules. The constructor is designed to work with FileFinder. cCs||_||_dS)N)rr*)rrr*rrr rszExtensionFileLoader.__init__cCs|j|jko|j|jkS)N)r r)rr rrr r s zExtensionFileLoader.__eq__cCst|jt|jAS)N)r rr*)rrrr rszExtensionFileLoader.__hash__cCs$tjtj|}tjd|j|j|S)z&Create an unitialized extension modulez&extension module {!r} loaded from {!r})rrrcreate_dynamicrrr*)rrrrrr rs   z!ExtensionFileLoader.create_modulecCs$tjtj|tjd|j|jdS)zInitialize an extension modulez(extension module {!r} executed from {!r}N)rrr exec_dynamicrrr*)rrrrr rszExtensionFileLoader.exec_modulecs$t|jdtfddtDS)z1Return True if the extension module is a package.r#c3s|]}d|kVqdS)rNr)rsuffix) file_namerr sz1ExtensionFileLoader.is_package..)r.r*anyEXTENSION_SUFFIXES)rrr)rr rs zExtensionFileLoader.is_packagecCsdS)z?Return None as an extension module cannot create a code object.Nr)rrrrr rszExtensionFileLoader.get_codecCsdS)z5Return None as extension modules have no source code.Nr)rrrrr rszExtensionFileLoader.get_sourcecCs|jS)z:Return the path to the source file as found by the finder.)r*)rrrrr rsz ExtensionFileLoader.get_filenameN)rrrrrr rrrrrrrrrrrr rsrc@s`eZdZdZddZddZddZdd Zd d Zd d Z ddZ ddZ ddZ ddZ dS)_NamespacePatha&Represents a namespace package's path. It uses the module name to find its parent module, and from there it looks up the parent's __path__. When this changes, the module's own path is recomputed, using path_finder. For top-level modules, the parent module's path is sys.path.cCs$||_||_t|j|_||_dS)N)_name_pathr}_get_parent_path_last_parent_path _path_finder)rrr* path_finderrrr rsz_NamespacePath.__init__cCs&|jjd\}}}|dkrdS|dfS)z>Returns a tuple of (parent-module-name, parent-path-attr-name)rNr%r r*__path__)r r*)r$r')rrdotmerrr _find_parent_path_namessz&_NamespacePath._find_parent_path_namescCs|j\}}ttj||S)N)r-rr modules)rparent_module_namepath_attr_namerrr r&s z_NamespacePath._get_parent_pathcCsPt|j}||jkrJ|j|j|}|dk rD|jdkrD|jrD|j|_||_|jS)N)r}r&r'r(r$rrr%)r parent_pathrrrr _recalculates  z_NamespacePath._recalculatecCs t|jS)N)iterr2)rrrr __iter__sz_NamespacePath.__iter__cCs||j|<dS)N)r%)rindexr*rrr __setitem__sz_NamespacePath.__setitem__cCs t|jS)N)r&r2)rrrr __len__sz_NamespacePath.__len__cCs dj|jS)Nz_NamespacePath({!r}))r;r%)rrrr __repr__sz_NamespacePath.__repr__cCs ||jkS)N)r2)ritemrrr __contains__sz_NamespacePath.__contains__cCs|jj|dS)N)r%r)rr9rrr rsz_NamespacePath.appendN)rrrrrr-r&r2r4r6r7r8r:rrrrr r#s  r#c@sPeZdZddZeddZddZddZd d Zd d Z d dZ ddZ dS)_NamespaceLoadercCst||||_dS)N)r#r%)rrr*r)rrr rsz_NamespaceLoader.__init__cCs dj|jS)zsReturn repr for the module. The method is deprecated. The import machinery does the job itself. z)r;r)rrrrr module_reprsz_NamespaceLoader.module_reprcCsdS)NTr)rrrrr rsz_NamespaceLoader.is_packagecCsdS)Nr%r)rrrrr rsz_NamespaceLoader.get_sourcecCstdddddS)Nr%zrT)r)r)rrrrr rsz_NamespaceLoader.get_codecCsdS)z*Use default semantics for module creation.Nr)rrrrr r sz_NamespaceLoader.create_modulecCsdS)Nr)rrrrr rsz_NamespaceLoader.exec_modulecCstjd|jtj||S)zbLoad a namespace module. This method is deprecated. Use exec_module() instead. z&namespace module loaded with path {!r})rrr%r)rrrrr rsz_NamespaceLoader.load_moduleN) rrrrrr<rrrrrrrrrr r;s r;c@sjeZdZdZeddZeddZeddZedd Zedd d Z edd dZ edddZ d S) PathFinderz>Meta path finder for sys.path and package __path__ attributes.cCs*x$tjjD]}t|dr |jq WdS)z}Call the invalidate_caches() method on all path entry finders stored in sys.path_importer_caches (where implemented).invalidate_cachesN)r path_importer_cachevaluesrr>)rfinderrrr r>#s zPathFinder.invalidate_cachesc CsVtjdk rtj rtjdtx2tjD]$}y||Stk rHw&Yq&Xq&WdSdS)z.Search sys.path_hooks for a finder for 'path'.Nzsys.path_hooks is empty)r path_hooksrPrQrr)rr*hookrrr _path_hooks+s   zPathFinder._path_hookscCsf|dkr*y tj}Wntk r(dSXytj|}Wn(tk r`|j|}|tj|<YnX|S)zGet the finder for the path entry from sys.path_importer_cache. If the path entry is not in the cache, find the appropriate finder and cache it. If no finder is available, store None. r%N)rr7FileNotFoundErrorr r?rrD)rr*rArrr _path_importer_cache8s  zPathFinder._path_importer_cachecCsRt|dr|j|\}}n|j|}g}|dk rrDrFrGrKrrrrrr r=s     r=c@sZeZdZdZddZddZeZddZdd Z dd d Z d dZ e ddZ ddZd S) FileFinderzFile-based finder. Interactions with the file system are cached for performance, being refreshed when the directory the finder is handling has been modified. csXg}x(|D] \}|jfdd|Dq W||_|p:d|_d|_t|_t|_dS)zInitialize with the path to search on and a variable number of 2-tuples containing the loader and the file suffixes the loader recognizes.c3s|]}|fVqdS)Nr)rr)rrr r sz&FileFinder.__init__..rNr#Nrv)r_loadersr* _path_mtimeset _path_cache_relaxed_path_cache)rr*loader_detailsloadersrr)rr rs zFileFinder.__init__cCs d|_dS)zInvalidate the directory mtime.r#Nrv)rO)rrrr r>szFileFinder.invalidate_cachescCs*|j|}|dkrdgfS|j|jp&gfS)zTry to find a loader for the specified module, or the namespace package portions. Returns (loader, list-of-portions). This method is deprecated. Use find_spec() instead. N)rrr)rrrrrr rs zFileFinder.find_loadercCs|||}t||||dS)N)rr)r)rrrr*smslrrrrr rKs zFileFinder._get_specNcCsbd}|jdd}yt|jp"tjj}Wntk rBd }YnX||jkr\|j||_t rr|j }|j }n |j }|}||krt |j|}xH|jD]6\} } d| } t || } t| r|j| || |g|SqWt|}xX|jD]N\} } t |j|| } tjd| dd|| |krt| r|j| || d|SqW|r^tjd |tj|d} |g| _| SdS) zoTry to find a spec for the specified module. Returns the matching spec, or None if not found. FrNrKr#rz trying {}) verbosityNzpossible namespace for {}rv)r'r0r*rr7rr1rO _fill_cacher rRrwrQr"rNr6rKr8rrrr)rrr is_namespace tail_modulercache cache_module base_pathrr init_filename full_pathrrrr rsF          zFileFinder.find_specc Cs|j}ytj|ptj}Wntttfk r:g}YnXtjj dsTt ||_ nNt }x@|D]8}|j d\}}}|rdj ||j}n|}|j|q`W||_ tjj trdd|D|_dS)zDFill the cache of potential modules and packages for this directory.rrNz{}.{}cSsh|] }|jqSr)rw)rfnrrr sz)FileFinder._fill_cache..N)r*rlistdirr7rEPermissionErrorNotADirectoryErrorr r r rPrQrlr;rwaddrrR) rr*contentslower_suffix_contentsr9rr+rnew_namerrr rWs"     zFileFinder._fill_cachecsfdd}|S)aA class method which returns a closure to use on sys.path_hook which will return an instance using the specified loaders and the path called on the closure. If the path called on the closure is not a directory, ImportError is raised. cs"t|std|d|fS)z-Path hook for importlib.machinery.FileFinder.zonly directories are supported)r*)r8r)r*)rrSrr path_hook_for_FileFinder*s z6FileFinder.path_hook..path_hook_for_FileFinderr)rrSrhr)rrSr path_hook s zFileFinder.path_hookcCs dj|jS)NzFileFinder({!r}))r;r*)rrrr r82szFileFinder.__repr__)N)rrrrrr>rrrrKrrWrrir8rrrr rMs  0 rMc Cs|jd}|jd}|sB|r$|j}n||kr8t||}n t||}|sTt|||d}y$||d<||d<||d<||d<Wntk rYnXdS)N __loader____spec__)r__file__ __cached__)getrrrr Exception)nsrpathname cpathnamerrrrr _fix_up_module8s"     rscCs*tttjf}ttf}ttf}|||gS)z_Returns a list of file-based module loaders. Each item is a tuple (loader, suffixes). )r_alternative_architecturesrextension_suffixesrrmrr_) extensionssourcebytecoderrr rOsrc Cs|atjatjatjt}x8dD]0}|tjkr:tj|}n tj|}t|||q Wddgfdddgff}x`|D]P\}}|d }|tjkrtj|}Pqpytj|}PWqptk rwpYqpXqpWtd t|d |t|d |t|d dj|ytjd} Wntk rd} YnXt|d| tjd} t|d| |dkrbtjd} t|d| t|dt t j t tj |dkrtjddt krdt_dS)zSetup the path-based importers for importlib by importing needed built-in modules and injecting them into the global namespace. Other components are extracted from the core bootstrap module. rArPbuiltinsrposix/nt\rOzimportlib requires posix or ntrrrr%_threadN_weakrefwinregrr z.pywz_d.pydT)rArPryr)rr rr.r_builtin_from_namerrr rr"rrtrurmrrr) _bootstrap_module self_module builtin_namebuiltin_module os_details builtin_osrr os_module thread_moduleweakref_module winreg_modulerrr _setupZsP                     rcCs2t|t}tjjtj|gtjjt dS)z)Install the path-based import components.N) rrr rBrrMri meta_pathrr=)rsupported_loadersrrr _installsrz-arm-linux-gnueabihf.z-armeb-linux-gnueabihf.z-mips64-linux-gnuabi64.z-mips64el-linux-gnuabi64.z-powerpc-linux-gnu.z-powerpc-linux-gnuspe.z-powerpc64-linux-gnu.z-powerpc64le-linux-gnu.z-arm-linux-gnueabi.z-armeb-linux-gnueabi.z-mips64-linux-gnu.z-mips64el-linux-gnu.z-ppc-linux-gnu.z-ppc-linux-gnuspe.z-ppc64-linux-gnu.z-ppc64le-linux-gnu.)z-arm-linux-gnueabi.z-armeb-linux-gnueabi.z-mips64-linux-gnu.z-mips64el-linux-gnu.z-ppc-linux-gnu.z-ppc-linux-gnuspe.z-ppc64-linux-gnu.z-ppc64le-linux-gnu.z-arm-linux-gnueabihf.z-armeb-linux-gnueabihf.z-mips64-linux-gnuabi64.z-mips64el-linux-gnuabi64.z-powerpc-linux-gnu.z-powerpc-linux-gnuspe.z-powerpc64-linux-gnu.z-powerpc64le-linux-gnu.cCsFx@|D]8}x2tjD]&\}}||kr|j|j|||SqWqW|S)zAdd a suffix with an alternative architecture name to the list of suffixes so an extension built with the default (upstream) setting is loadable with our Pythons ) _ARCH_MAPitemsrrD)rroriginal alternativerrr rts   rt)r)rr)r9)N)NNN)NNN)rOrO)N)N)s     { -"   7 C@n)-5<*  D PK]O9FFcookies.cpython-312.opt-2.pycnu[ Wj@T ddlZddlZddlZgdZdjZdjZdjZGddeZ ejejzdzZ e d zZ eed eeee z Dcic]}|d |z c}Zej'ed d eddiej(dej*e zj,Zej(dZdZdZej(dj6ZdZdZgdZgdZ dee fdZ!Gdde"Z#dZ$e$dzZ%ej(de$zdze%zd zejLejNzZ(Gd!d"e"Z)Gd#d$e)Z*ycc}w)%N) CookieError BaseCookie SimpleCookiez;  c eZdZy)rN)__name__ __module__ __qualname__%/usr/lib64/python3.12/http/cookies.pyrrsr rz!#$%&'*+-.^_`|~:z ()/<=>?@[]{}z\%03o"\"\z\\z[%s]+z[\x00-\x1F\x7F]c( td|DS)Nc3XK|]"}tjt|$ywN)_control_character_researchstr).0vs r z)_has_control_character..s!AS$++CF3Ss(*)any)vals r_has_control_characterrs ASA AAr cX | t|r|Sd|jtzdzS)Nr) _is_legal_key translate _Translatorrs r_quoter$s3  {mC( S]];//#55r z\\(?:([0-3][0-7][0-7])|(.))cF|drtt|ddS|dS)N)chrint)ms r_unquote_replacer,s't3qtQ<  t r ct|t|dkr|S|ddk7s|ddk7r|S|dd}tt|S)Nr(rrr&)len _unquote_subr,r#s r_unquoter1sO {c#hl  1v}B3 a)C (# ..r )MonTueWedThuFriSatSun) NJanFebMarAprMayJunJulAugSepOctNovDecc nddlm}m}|}|||z\ }}}} } } } } }d|| ||||| | | fzS)Nr)gmtimetimez#%s, %02d %3s %4d %02d:%02d:%02d GMT)rGrF)future weekdayname monthnamerFrGnowyearmonthdayhhmmsswdyzs r_getdaterUsW! &C-3C&L-A*D%b"b"a 0 OS)E"2D"b" E FFr c eZdZ ddddddddd d Zd d hZd ZedZedZedZ dZ d dZ dZ e jZdZdZdZdZdZdZdZd!dZeZdZd dZd dZeej:Zy)"MorselexpiresPathCommentDomainzMax-AgeSecureHttpOnlyVersionSameSite) rXpathcommentdomainmax-agesecurehttponlyversionsamesiterdrec~dx|_x|_|_|jD]}tj ||dy)Nr)_key_value _coded_value _reserveddict __setitem__)selfkeys r__init__zMorsel.__init__s:6:: :DK$"3>>C   T3 +"r c|jSr)riros rrpz Morsel.key s yyr c|jSr)rjrss rvaluez Morsel.value$s {{r c|jSr)rkrss r coded_valuezMorsel.coded_value(s   r c|j}||jvrtd|t||rtd|d|tj |||yNzInvalid attribute .Control characters are not allowed in cookies r)lowerrlrrrmrn)roKVs rrnzMorsel.__setitem__,s_ GGIDNN";< < !!Q ' NqeSTUVTYZ[ [ q!$r Nc|j}||jvrtd|t||rtd|d|tj |||Sry)r{rlrrrm setdefault)rorprs rrzMorsel.setdefault4sViik dnn $=> > !#s +WZ\_ab btS#..r ct|tstStj ||xrO|j |j k(xr4|j |j k(xr|j|jk(Sr) isinstancerWNotImplementedrm__eq__rjrirkromorsels rrz Morsel.__eq__<sj&&)! ! D&)9 v}},9 V[[(9!!V%8%88 :r ct}tj|||jj|j|Sr)rWrmupdate__dict__rs rcopyz Morsel.copyFs2 FD!t}}- r ci}t|jD]S\}}|j}||jvrt d|t ||rt d|d||||<Utj ||yry)rmitemsr{rlrrr)rovaluesdatarprs rrz Morsel.updateLsV **,HC))+C$..(!C"ABB%c3/!#--0G1SG#=>>DI- D$r c(|j||Sr)r)rors r__ior__zMorsel.__ior__Xs F r c:|j|jvSr)r{rl)ror|s r isReservedKeyzMorsel.isReservedKey\swwyDNN**r c|j|jvrtd|t|std|t |||rtd|d|d|||_||_||_y)NzAttempt to set a reserved key z Illegal key rzr)r{rlrr rrirjrk)rorpr coded_vals rsetz Morsel.set_sw 99;$.. (CIJ JS!#78 8 !#sI 6LOQTV_ac c  %r cJ|j|j|jdS)N)rprurw)rirjrkrss r __getstate__zMorsel.__getstate__ms#99[[,,  r c|d}|d}|d}t|||rtd|d|d|||_||_||_y)Nrprurwrzr)rrrirjrk)rostaterprurws r __setstate__zMorsel.__setstate__tsiElgM* !#uk :N!$q ;/CD D  'r c.|d|j|S)Nr) OutputString)roattrsheaders routputz Morsel.outputs $"3"3E":;;r cXd|jjd|jdS)N<: >) __class__r rrss r__repr__zMorsel.__repr__s !^^44d6G6G6IJJr cz|j|}t|r tdd|jddzS)N-Control characters are not allowed in cookiesz rr)rrrreplace)ror output_strings r js_outputzMorsel.js_outputsG))%0 !- 0MN N $$S%0 2 2r cg}|j}||jd|j| |j}t |j }|D]\}}|dk(r ||vr|dk(r4t |tr$||j|dt|J|dk(r+t |tr|d|j||fzz|dk(r4t |tr$||j|dt|||jvr"|s|t|j|||j|d|t|S)N=rrXrcz%s=%dra) appendrprwrlsortedrrr*rUrr$_flags_semispacejoin)rorresultrrrprus rrzMorsel.OutputStrings8 $((D$4$456 =NNEtzz|$JC{%iJuc$:$.."5xGH !j&<w$.."5u!==> !j&<$.."5ve}EF #3t~~c234$.."5u=> $f%%r r)N Set-Cookie:)r r r rlrrqpropertyrprurwrnrrobject__ne__rrrrrrrr__str__rrr classmethodtypes GenericAlias__class_getitem__r r rrWrWs* I #F,!!%/:]]F  + &  (<GK 2&B$E$6$67r rWz,\w\d!#%&'~_`><@,:/\$\*\+\-\.\^\|\)\(\?\}\{\=z\[\]z \s* # Optional whitespace at start of cookie (?P # Start of group 'key' [ax]+? # Any word of at least one letter ) # End of group 'key' ( # Optional group: there may not be a value. \s*=\s* # Equal Sign (?P # Start of group 'val' "(?:[^\\"]|\\.)*" # Any double-quoted string | # or # Special case for "expires" attr (\w{3,6}day|\w{3}),\s # Day of the week or abbreviated day [\w\d\s-]{9,11}\s[\d:]{8}\sGMT # Date and time in specific format | # or [a-]* # Any word or empty string ) # End of group 'val' )? # End of optional value group \s* # Any number of spaces. (\s+|;|$) # Ending either at space, semicolon, or EOS. cXeZdZ dZdZd dZdZdZd dZeZ dZ d d Z d Z e fd Zy)rc ||fSrr rors r value_decodezBaseCookie.value_decodes Cxr c" t|}||fSrr#rorstrvals r value_encodezBaseCookie.value_encodes Sv~r Nc,|r|j|yyr)load)roinputs rrqzBaseCookie.__init__s  IIe  r c |j|t}|j|||tj |||yr)getrWrrmrn)rorp real_valuerwMs r__setzBaseCookie.__sets99 HHS&( # c:{+ sA&r c t|trtj|||y|j |\}}|j |||yr)rrWrmrnr_BaseCookie__set)rorprurvalcvals rrnzBaseCookie.__setitem__sE* eV $   T3 .**51JD$ JJsD$ 'r c g}t|j}|D]>\}}|j||}t|r t d|j |@|j |S)Nr)rrrrrrjoin) rorrseprrrpru value_outputs rrzBaseCookie.outputsi0tzz|$JC <<v6L%l3!"QRR MM, '  xxr cg}t|j}|D].\}}|j|dt|j0d|j j dt|dS)Nrrrr)rrrreprrurr _spacejoin)rolrrprus rrzBaseCookie.__repr__sX tzz|$JC HHT%++%67 8 !^^44jmDDr c g}t|j}|D]%\}}|j|j|'t |Sr)rrrr _nulljoin)rorrrrprus rrzBaseCookie.js_outputsH6tzz|$JC MM%//%0 1   r c t|tr|j|y|jD] \}}|||< yr)rr_BaseCookie__parse_stringr)rorawdatarprus rrzBaseCookie.load sH gs #    ( &mmo U!S .r cd}t|}g}d}d}d}d|cxkr|kr!nn|j||} | sn| jd| jd} } | jd}| ddk(r|sd|j || dd| fn| j t jvrY|sy| 6| j t jvr|j || dfnHy|j || t| fn)| &|j || |j| fd}nyd|cxkr|krnd} |D].\} } } | |k(r| | | <| \}}|j| |||| } 0y) NrFr&r(rpr$T) r/matchgroupendrr{rWrlrr1rr)rorpattin parsed_items morsel_seenTYPE_ATTRIBUTE TYPE_KEYVALUErrprurtprrs r__parse_stringzBaseCookie.__parse_string.s  H   1jqjJJsA&EU+U[[-?C ! A1v}"##^SWe$DE 0 00"=yy{fmm3$++^S$,GH ''huo(NO"##]C9J9J59Q$RS" E1jqjJ *NBU^### d 3d+I+r r)Nrz )r r r rrrqrrnrrrrr_CookiePatternrr r rrrsD1' (  GE! (6:r rceZdZ dZdZy)rct||fSr)r1rs rrzSimpleCookie.value_decoders}c!!r c2t|}|t|fSr)rr$rs rrzSimpleCookie.value_encodeusSvf~%%r N)r r r rrr r rrrks "&r r)+restringr__all__rrrr Exceptionr ascii_lettersdigits _LegalChars_UnescapedCharsrrangemapordr"rcompileescape fullmatchr rrr$subr0r,r1 _weekdayname _monthnamerUrmrW_LegalKeyChars_LegalValueCharsASCIIVERBOSErrr)rs0rrsNXz 7 GG  XX  ) """V]]25GG /E#J#c#.G*HHJH1(Q,HJ HeIv  7YRYY{%;;<FF " #56B 6rzz89==  /6A 8 <:F@8T@8XB!G+      & BJJ ' 2LL^ &: &MJs F PK] t > >cookiejar.cpython-312.pycnu[ ֦i~.jdZgdZddlZddlZddlZddlZddlZddlZddl Zddl Z ddl Z ddlmZdZdadZdZdZee j,j.Zej2d Zd Zd Zd Zd ZdZgdZ gdZ!e!Dcgc]}|jEc}Z#dKdZ$dKdZ%dddddZ&ej2dejNZ(dZ)dZ*ej2dejNZ+ej2dejXejNzZ-ej2dej\ejNzZ/dZ0ej2dej\ejNzZ1dZ2dZ3ej2dZ4ej2dZ5ej2d Z6ej2d!Z7d"Z8ej2d#Z9d$Z:d%Z;d&Z<ej2d'ejNZ=d(Z>d)Z?d*Z@d+ZAej2d,ejNZBd-ZCd.ZDd/ZEd0ZFd1ZGej2d2ZHd3ZId4ZJd5ZKd6ZLGd7d8ZMGd9d:ZNGd;dd?ZQGd@dAZRGdBdCeSZTGdDdEeRZUdFZVGdGdHeUZWGdIdJeUZXycc}w)LaHTTP cookie handling for web clients. This module has (now fairly distant) origins in Gisle Aas' Perl module HTTP::Cookies, from the libwww-perl library. Docstrings, comments and debug strings in this code refer to the attributes of the HTTP cookie system as cookie-attributes, to distinguish them clearly from Python attributes. Class diagram (note that BSDDBCookieJar and the MSIE* classes are not distributed with the Python standard library, but are available from http://wwwsearch.sf.net/): CookieJar____ / \ \ FileCookieJar \ \ / | \ \ \ MozillaCookieJar | LWPCookieJar \ \ | | \ | ---MSIEBase | \ | / | | \ | / MSIEDBCookieJar BSDDBCookieJar |/ MSIECookieJar )Cookie CookieJar CookiePolicyDefaultCookiePolicy FileCookieJar LWPCookieJar LoadErrorMozillaCookieJarN)timegmFcjtsytsddl}|jdatj|S)Nr zhttp.cookiejar)debugloggerlogging getLogger)argsrs '/usr/lib64/python3.12/http/cookiejar.py_debugr,s.  ""#34 << HTTPOnlyz #HttpOnly_z#( Netscape)? HTTP Cookie FilezQa filename was not supplied (nor was the CookieJar instance initialised with one)zr# Netscape HTTP Cookie File # http://curl.haxx.se/rfc/cookie_spec.html # This is a generated file! Do not edit. cddl}ddl}ddl}|j}|j d||j }|j d|zdy)Nr zhttp.cookiejar bug! %s) stacklevel)iowarnings tracebackStringIO print_excgetvaluewarn)rrrfmsgs r_warn_unhandled_exceptionr"BsF#" A a **,C MM+c1aM@ric|dd\}}}}}}|tk\rPd|cxkrdkrEnyd|cxkrdkr7nyd|cxkrdkr)nyd|cxkrdkrnyd|cxkrdkr t|Syy) N r ;=) EPOCH_YEARr )ttyearmonthmdayhourminsecs r_timegmr3Qs(*2A%D%tS#  !u"2"2 :;db db !C~2~56NNbz5Cr)MonTueWedThuFriSatSun) JanFebMarAprMayJunJulAugSepOctNovDeccP|/tjjtj}n/tjj|tj}d|j|j |j |j|j|jfzS)aHReturn a string representing time in seconds since epoch, t. If the function is called without an argument, it will use the current time. The format of the returned string is like "YYYY-MM-DD hh:mm:ssZ", representing Universal Time (UTC, aka GMT). An example of this format is: 1994-11-24 08:49:37Z tzz%04d-%02d-%02d %02d:%02d:%02dZ) datetimenowUTC fromtimestampr-r.dayr0minutesecondtdts r time2isozrT^s y    " "hll " 3    , ,Q8<< , @ + 266277BIIryy/B BBrc|/tjjtj}n/tjj|tj}dt|j |j t|jdz |j|j|j|jfzS)zReturn a string representing time in seconds since epoch, t. If the function is called without an argument, it will use the current time. The format of the returned string is like this: Wed, DD-Mon-YYYY HH:MM:SS GMT rHz#%s, %02d-%s-%04d %02d:%02d:%02d GMTr%) rJrKrLrMDAYSweekdayrNMONTHSr.r-r0rOrPrQs r time2netscaperYqs y    " "hll " 3    , ,Q8<< , @ 0 RZZ\BFFF288A:$6 "))RYY40 00r)GMTrLUTZz^([-+])?(\d\d?):?(\d\d)?$cd}|tvrd}|Stj|}|redt|j dz}|j dr |dt|j dzz}|j ddk(r| }|S)Nr ir<r%-) UTC_ZONES TIMEZONE_REsearchintgroup)rIoffsetms roffset_from_tz_stringrhs F Y M   r " C O+Fwwqz"s1771:"66wwqzS   Mrc t|}|tjkDry tj |j dz}|d}|d}|d}t|}t|}t|}t|}|dkr\tjtjd}|dz} |} ||z| z }| | z } t| dkDr| dkDr|dz}n|dz }t|||||||f} | '|d}|j}t|} | y| | z } | S#t $r5 t|}n#t $rYYywxYwd|cxkrdkrnYy|}nYyYwxYw)Nr%r&r id2rL) rdrJMAXYEAR MONTHS_LOWERindexlower ValueErrortime localtimeabsr3upperrh) rNmonyrhrr1r2rIimoncur_yrrgtmprRrfs r _str2timer{s RB H     -a/ z2 {!C {!C c(C RB c(C c(C Dy ,Q/ SL &[1_ G q6B;1u28bCx" S#r3R01A} :B XXZ&r* > J H[   s8D   ??C  s;&D E' D32E3 E<E?EEEEzV^[SMTWF][a-z][a-z], (\d\d) ([JFMASOND][a-z][a-z]) (\d\d\d\d) (\d\d):(\d\d):(\d\d) GMT$z+^(?:Sun|Mon|Tue|Wed|Thu|Fri|Sat)[a-z]*,?\s*a^ (\d\d?) # day (?:\s+|[-\/]) (\w+) # month (?:\s+|[-\/]) (\d+) # year (?: (?:\s+|:) # separator before clock (\d\d?):(\d\d) # hour:min (?::(\d\d))? # optional seconds )? # optional clock \s* (?: ([-+]?\d{2,4}|(?![APap][Mm]\b)[A-Za-z]+) # timezone \s* )? (?: \(\w+\) # ASCII representation of timezone in parens. \s* )?$c .tj|}|r|j}tj |dj dz}t |d|t |dt |dt |dt|df}t|S|j}tjd|d}dgd z\}}}}}} } tj|}||j\}}}}}} } nyt|||||| | S) aReturns time in seconds since epoch of time represented by a string. Return value is an integer. None is returned if the format of str is unrecognized, the time is outside the representable range, or the timezone string is not recognized. If the string contains no timezone, UTC is assumed. The timezone in the string may be numerical (like "-0800" or "+0100") or a string timezone (like "UTC", "GMT", "BST" or "EST"). Currently, only the timezone strings equivalent to UTC (zero offset) are known to the function. The function loosely parses the following formats: Wed, 09 Feb 1994 22:23:32 GMT -- HTTP format Tuesday, 08-Feb-94 14:15:29 GMT -- old rfc850 HTTP format Tuesday, 08-Feb-1994 14:15:29 GMT -- broken rfc850 HTTP format 09 Feb 1994 22:23:32 GMT -- HTTP format (no weekday) 08-Feb-94 14:15:29 GMT -- rfc850 format (no weekday) 08-Feb-1994 14:15:29 GMT -- broken rfc850 format (no weekday) The parser ignores leading and trailing whitespace. The time may be absent. If the year is given with only 2 digits, the function will select the century that makes the year closest to the current date. r%rr r^N)STRICT_DATE_RErcgroupsrmrnrordfloatr3lstrip WEEKDAY_REsubLOOSE_HTTP_DATE_REr{) textrggrur,rNrvrwr1r2rIs r http2timers< d#A HHJ  1.2!A$ic!A$i!A$iQqTE!A$K1r{ ;;=D >>"dA &D'+VAX"Cb"c3 !!$'A})*&S"b#sB S#r2sC 44ra^ (\d{4}) # year [-\/]? (\d\d?) # numerical month [-\/]? (\d\d?) # day (?: (?:\s+|[-:Tt]) # separator before clock (\d\d?):?(\d\d) # hour:min (?::?(\d\d(?:\.\d*)?))? # optional seconds (and fractional) )? # optional clock \s* (?: ([-+]?\d\d?:?(:?\d\d)? |Z|z) # timezone (Z is "zero meridian", i.e. GMT) \s* )?$c |j}dgdz\}}}}}}}tj|}||j\}}}}}}}} nyt |||||||S)av As for http2time, but parses the ISO 8601 formats: 1994-02-03 14:15:29 -0100 -- ISO 8601 format 1994-02-03 14:15:29 -- zone is optional 1994-02-03 -- only date 1994-02-03T14:15:29 -- Use T as separator 19940203T141529Z -- ISO 8601 compact format 19940203 -- only date Nr)r ISO_DATE_RErcrr{) rrNrurvrwr1r2rIrg_s riso2timer2sz ;;=D'+VAX"Cb"c3 4 A}-.HHJ)Cb#sB S#r2sC 44rch|jd\}}|jd||j|dzS)z)Return unmatched part of re.Match object.r N)spanstring)matchstartends r unmatchedrSs4AJE3 <<  ST 2 22rz^\s*([^=\s;,]+)z&^\s*=\s*\"([^\"\\]*(?:\\.[^\"\\]*)*)\"z^\s*=\s*([^\s;,]*)z\\(.)c t|trJg}|D]s}|}g}|rTtj|}|rt |}|j d}t j|}|r3t |}|j d}tjd|}nFtj|}|r-t |}|j d}|j}nd}|j||fny|jjdr)|jdd}|r|j|g}n1tjdd|\}} | dkDsJd|d |d ||}|rT|sc|j|v|S) amParse header values into a list of lists containing key,value pairs. The function knows how to deal with ",", ";" and "=" as well as quoted values after "=". A list of space separated tokens are parsed as if they were separated by ";". If the header_values passed as argument contains multiple values, then they are treated as if they were a single value separated by comma ",". This means that this function is useful for parsing header fields that follow this syntax (BNF as from the HTTP/1.1 specification, but we relax the requirement for tokens). headers = #header header = (token | parameter) *( [";"] (token | parameter)) token = 1* separators = "(" | ")" | "<" | ">" | "@" | "," | ";" | ":" | "\" | <"> | "/" | "[" | "]" | "?" | "=" | "{" | "}" | SP | HT quoted-string = ( <"> *(qdtext | quoted-pair ) <"> ) qdtext = > quoted-pair = "\" CHAR parameter = attribute "=" value attribute = token value = token | quoted-string Each header is represented by a list of key/value pairs. The value for a simple token (not part of a parameter) is None. Syntactically incorrect headers will not necessarily be parsed as you would want. This is easier to describe with some examples: >>> split_header_words(['foo="bar"; port="80,81"; discard, bar=baz']) [[('foo', 'bar'), ('port', '80,81'), ('discard', None)], [('bar', 'baz')]] >>> split_header_words(['text/html; charset="iso-8859-1"']) [[('text/html', None), ('charset', 'iso-8859-1')]] >>> split_header_words([r'Basic realm="\"foo\bar\""']) [[('Basic', None), ('realm', '"foobar"')]] r%z\1N,z^[=\s;]*rr zsplit_header_words bug: 'z', 'z', ) isinstancestrHEADER_TOKEN_RErcrreHEADER_QUOTED_VALUE_REHEADER_ESCAPE_RErHEADER_VALUE_RErstripappendr startswithresubn) header_valuesresultr orig_textpairsrgnamevaluenon_junk nr_junk_charss rsplit_header_wordsr\syZ--- - F &&t,A |wwqz*11$7$QE'..t4A(| !  % !% dE]+))#.{{}QR(&--.+-''+r4*H'-$q(.e-.( ?@ &--&GH Mr([\"\\])c*g}|D]|}g}|D]P\}}|8tjd|stjd|}d|z}|d|}|j |R|s]|j dj |~dj |S)aDo the inverse (almost) of the conversion done by split_header_words. Takes a list of lists of (key, value) pairs and produces a single header value. Attribute values are quoted if needed. >>> join_header_words([[("text/plain", None), ("charset", "iso-8859-1")]]) 'text/plain; charset="iso-8859-1"' >>> join_header_words([[("text/plain", None)], [("charset", "iso-8859-1")]]) 'text/plain, charset="iso-8859-1"' z^\w+$\\\1z"%s"=; , )rrcHEADER_JOIN_ESCAPE_RErrjoin)listsheadersrattrkvs rjoin_header_wordsrsGDAq}yy1--11'1=A A !$ KKN   $0 99W rc^|jdr|dd}|jdr|dd}|S)N"r%)rendswithrs r strip_quotesrs5 sABx }}SCRy Krcd}g}|D]}g}d}t|jdD]\}}|j}|jd\}} } |j}|s|dk(rnuE| r| jnd} |dk7rF|j } | |vr| }|dk(r| t | } d}n|d k(r| t t | } |j|| f|s|s|jd |j||S) a5Ad-hoc parser for Netscape protocol cookie-attributes. The old Netscape cookie format for Set-Cookie can for instance contain an unquoted "," in the expires field, so we have to use this ad-hoc parser instead of split_header_words. XXX This may not make the best possible effort to parse all the crap that Netscape Cookie headers contain. Ronald Tschalar's HTTPClient parser is probably better, so could do worse than following that if this ever gives any trouble. Currently, this is also used for parsing RFC 2109 cookies. )expiresdomainpathsecureversionportmax-ageF;rr NrTr)r0) enumeratesplitstrip partitionrorrr) ns_headers known_attrsr ns_headerr version_setiiparamkeysepvallcs rparse_ns_headersrs1KF  #9??3#78IBKKME!OOC0MCc))+C7"%#))+$CQwYY[$C)#*3/"&KI%' S(9: LL#s $=9@  -. MM% W Z Mrz\.\d+$c^tj|ry|dk(ry|ddk(s|ddk(ryy)z*Return True if text is a host domain name.Frr .rTIPV4_RErcrs ris_HDNrs8~~d rz Aw#~bS rc|j}|j}||k(ryt|sy|j|}|dk(s|dk(ry|jdsyt|ddsyy)aReturn True if domain A domain-matches domain B, according to RFC 2965. A and B may be host domain names or IP addresses. RFC 2965, section 1: Host names can be specified either as an IP address or a HDN string. Sometimes we compare one host name with another. (Such comparisons SHALL be case-insensitive.) Host A's name domain-matches host B's if * their host name strings string-compare equal; or * A is a HDN string and has the form NB, where N is a non-empty name string, B has the form .B', and B' is a HDN string. (So, x.y.com domain-matches .Y.com but not Y.com.) Note that domain-match is not a commutative operation: a.b.c.com domain-matches .c.com, but not the reverse. TFrr rr%N)rorrfindr)ABis r domain_matchr&sm.  A  AAv !9  ABw!q& <<  !AB%= rc0tj|ryy)zdReturn True if text is a sort-of-like a host domain name. For accepting/blocking domains. FTrrs rliberal_is_HDNrMs ~~d rc|j}|j}t|r t|s||k(ryy|jd}|r|j|ry|s||k(ryy)z\For blocking/accepting domains. A and B may be host domain names or IP addresses. TFr)rorrr)rr initial_dots ruser_domain_matchrWsc  A  A 1 ."3 6,,s#Kqzz!} 16 rz:\d+$c|j}tjj|d}|dk(r|j dd}t j d|d}|jS)zReturn request-host, as defined by RFC 2965. Variation from RFC: returned value is lowercased, for convenient comparison. r%rHost) get_full_urlurllibparseurlparse get_header cut_port_rerro)requesturlhosts r request_hostrlsd    C <<  %a (D rz!!&"- ??2tQ 'D ::<rc6t|x}}d|vr|dz}||fS)zzReturn a tuple (request-host, effective request-host name). As defined by RFC 2965, except both are lowercased. r.local)r)rerhnreq_hosts reff_request_hostr|s/ #7++D8 ((" T>rc|j}tjj|}t |j }|j dsd|z}|S)z6Path component of request-URI, as defined by RFC 2965./)rrrurlsplit escape_pathrr)rrpartsrs r request_pathrsL    C LL ! !# &E uzz "D ??3 Tz Krc|j}|jd}|dk\r||dzd} t||St }|S#t$rt d|YywxYw)N:r r%znonnumeric port: '%s')rfindrdrprDEFAULT_HTTP_PORT)rrrrs r request_portrsl <>> reach("www.acme.com") '.acme.com' >>> reach("acme.com") 'acme.com' >>> reach("acme.local") '.local' rr r%Nlocal)rr)hrbs rreachrsU4 s AAv acdG FF3K !9!q&ALq5L HrcZt|}t|t|jsyy)z RFC 2965, section 3.3.6: An unverifiable transaction is to a third-party host if its request- host U does not domain-match the reach R of the request-host O in the origin transaction. TF)rrrorigin_req_host)rrs ris_third_partyrs)G$H %(?(?"@ ArcBeZdZdZ d dZdZd dZdZd dZdZ d Z y) raHTTP Cookie. This class represents both Netscape and RFC 2965 cookies. This is deliberately a very simple class. It just holds attributes. It's possible to construct Cookie instances that don't comply with the cookie standards. CookieJar.make_cookies is the factory function for Cookie objects -- it deals with cookie parsing, supplying defaults, and normalising to the representation used in this class. CookiePolicy is responsible for checking them to see whether they should be accepted from and returned to the server. Note that the port may be present in the headers, but unspecified ("Port" rather than"Port=80", for example); if this is the case, port is None. c| t|}| tt| } ||dur td||_||_||_||_||_|j|_ ||_ ||_ | |_ | |_ | |_| |_| |_||_||_||_t)j(||_y)NTz-if port is None, port_specified must be false)rdrrprrrrport_specifiedrordomain_specifieddomain_initial_dotrpath_specifiedrrdiscardcomment comment_urlrfc2109copy_rest)selfrrrrrrrrrrrrrrrrestrs r__init__zCookie.__init__s  #g,  #eGn*= rc|jd}nd|jz}|j|z|jz}|j|jd|j}n |j}d|d|dS)Nrrrz)rrrrr)rplimit namevalues r__str__zCookie.__str__0sd 99 "adii-a a$))+ :: !#'99djj9I I'0%88rc\g}dD]-}t||}|j|dt|/|jdt|jz|jdt|jz|j j ddj|dS)N)rrrrrrrrrrrrrrrrzrest=%sz rfc2109=%s(r))getattrrreprrr __class____name__r)rrrrs r__repr__zCookie.__repr__:sD 4&D KK4d4 5 ITZZ 001 L4 #556>>22DIIdODDr)Fr#) r; __module__ __qualname____doc__r!r%r)r+r.r4r<rrrrs16(%T"-! 9 Errc(eZdZdZdZdZdZdZy)ra Defines which cookies get accepted from and returned to server. May also modify cookies, though this is probably a bad idea. The subclass DefaultCookiePolicy defines the standard rules for Netscape and RFC 2965 cookies -- override that if you want a customized policy. ct)zReturn true if (and only if) cookie should be accepted from server. Currently, pre-expired cookies never get this far -- the CookieJar class deletes such cookies itself. NotImplementedErrorrcookiers rset_okzCookiePolicy.set_okRs "##rct)zAReturn true if (and only if) cookie should be returned to server.rCrEs r return_okzCookiePolicy.return_ok[ !##rcy)zMReturn false if cookies should not be returned, given cookie domain. Tr@)rrrs rdomain_return_okzCookiePolicy.domain_return_ok_rcy)zKReturn false if cookies should not be returned, given cookie path. Tr@)rrrs rpath_return_okzCookiePolicy.path_return_okdrMrN)r;r=r>r?rGrIrLrOr@rrrrIs$$ rrc eZdZdZdZdZdZdZeezZdddddddddeddd f d Z d Z d Z d Z dZ dZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZd Zy)!rzBImplements the standard rules for accepting and returning cookies.r%rr}r NTF)httpswssc||_||_||_||_||_||_| |_| |_| |_| |_ | |_ |t||_ nd|_ | t|}||_ y)zAConstructor arguments should be passed as keyword arguments only.Nr@)netscaperfc2965rfc2109_as_netscape hide_cookie2 strict_domainstrict_rfc2965_unverifiablestrict_ns_unverifiablestrict_ns_domainstrict_ns_set_initial_dollarstrict_ns_set_pathsecure_protocolstuple_blocked_domains_allowed_domains)rblocked_domainsallowed_domainsrTrUrVrWrXrYrZr[r\r]r^s rr!zDefaultCookiePolicy.__init__ts!  #6 (*+F(&<# 0,H)"4 0  &$)/$:D !$&D !  &#O4O /rc|jS)z4Return the sequence of blocked domains (as a tuple).)r`rs rrbz#DefaultCookiePolicy.blocked_domains$$$rc$t||_y)z$Set the sequence of blocked domains.N)r_r`)rrbs rset_blocked_domainsz'DefaultCookiePolicy.set_blocked_domainss %o 6rcB|jD]}t||syyr-)r`r)rrblocked_domains r is_blockedzDefaultCookiePolicy.is_blockeds$"33N 84rc|jS)z=Return None, or the sequence of allowed domains (as a tuple).)rares rrcz#DefaultCookiePolicy.allowed_domainsrfrc,| t|}||_y)z-Set the sequence of allowed domains, or None.N)r_ra)rrcs rset_allowed_domainsz'DefaultCookiePolicy.set_allowed_domainss  &#O4O /rc\|jy|jD]}t||syy)NFT)rar)rrallowed_domains ris_not_allowedz"DefaultCookiePolicy.is_not_alloweds3  ("33N 84rctd|j|j|jJdD]}d|z}t||}|||ryy)z If you override .set_ok(), be sure to call this method. If it returns false, so should your subclass (assuming your subclass wants to be more strict about which cookies to accept).  - checking cookie %s=%s)r verifiabilityrrrrset_ok_FTrrrr8rrFrnfn_namefns rrGzDefaultCookiePolicy.set_oks[ )6;; E{{&&&MAkGw'Bfg& N rc|j"td|j|jy|jdkDr|js tdy|jdk(r|j s tdyy)Nz0 Set-Cookie2 without version attribute (%s=%s)Fr $ RFC 2965 cookies are switched off$ Netscape cookies are switched offT)rrrrrUrTrEs rset_ok_versionz"DefaultCookiePolicy.set_ok_versionsh >> ! E;;  . >>A dll 9 : ^^q  9 :rc|jrYt|rN|jdkDr|jr t dy|jdk(r|j r t dyyNr z> third-party RFC 2965 cookie during unverifiable transactionFz> third-party Netscape cookie during unverifiable transactionT unverifiablerrrYrrZrEs rset_ok_verifiabilityz(DefaultCookiePolicy.set_ok_verifiabilitys]   N7$;~~!d&F&F891$)D)D89rc|jdk(r>|jr2|jjdrt d|jyy)Nr $z' illegal name (starts with '$'): '%s'FT)rr\rrrrEs r set_ok_namezDefaultCookiePolicy.set_ok_names? NNa D$E$E KK " "3 ' >A dll 9 : ^^q  9 :rc|jrYt|rN|jdkDr|jr t dy|jdk(r|j r t dyyrrrEs rreturn_ok_verifiabilityz+DefaultCookiePolicy.return_ok_verifiabilitycs]   N7$;~~!d&F&F%&1$)D)D%&rcd|jr$|j|jvr tdyy)Nz( secure cookie with non-secure requestFT)rtyper^rrEs rreturn_ok_securez$DefaultCookiePolicy.return_ok_secureos) ==W\\1F1FF = >rcR|j|jr tdyy)Nz cookie expiredFT)r._nowrrEs rreturn_ok_expiresz%DefaultCookiePolicy.return_ok_expiresus#   TYY ' & 'rc|jrNt|}|d}|jjdD] }||k(s ytd||jyy)Nrrz0 request port %s does not match cookie port %sFT)rrrrrs rreturn_ok_portz"DefaultCookiePolicy.return_ok_port{sb ;;#G,H[[&&s+= ,I.rct|\}}|j}|r|jdsd|z}n|}|jdk(r6|j|j zr|j s||k7r tdy|jdkDrt||std||y|jdk(r"d|zj|std||yy)Nrr zQ cookie with unspecified domain does not string-compare equal to request domainFzQ effective request-host name %s does not domain-match RFC 2965 cookie domain %sz; request-host %s does not match Netscape cookie domain %sT) rrrrr[DomainStrictNonDomainrrrr)rrFrrrr dotdomains rreturn_ok_domainz$DefaultCookiePolicy.return_ok_domains)'2$ &++C0f II NNa   " "T%?%? ?''FdN - . >>A l4&@ /04f > >>Q D':':9'E !6 +rclt|\}}|jdsd|z}|jdsd|z}|r|jdsd|z}n|}|j|s|j|sy|j|r t d|y|j |r t d|yy)NrFrrT)rrrrkrrq)rrrrrrs rrLz$DefaultCookiePolicy.domain_return_oks*'2$""3'8|Hs#t8D &++C0f II!!), i0H ??6 " 7 @   v & ;V Drctd|t|}t|}||k(ry|j|r|j ds |||dzdk(rytd||y)Nz- checking cookie path=%sTrr%z %s does not path-match %sF)rrrrr)rrrrpathlens rrOz"DefaultCookiePolicy.path_return_oksj*D1(d) t !!$'}}S!Xggai%@C%G,h=r) r;r=r>r?rrr DomainLiberal DomainStrictr!rbrhrkrcrnrqrGr~rrrrrrIrrrrrrrLrOr@rrrrjsLM%&;;L"&t%)#$-1(-"/.3$)"2!0F%7 %0 &   :x*$   64 rrc#Kt|jD]-}d} |jd}t|Ed{|r*|/y7#t$rYwxYww)z)Iterates over nested mapping, depth-firstFTN)listvaluesitems deepvaluesAttributeError)mappingobjs rrrsaGNN$% ' IIG!# & &I& '    s7A AAA AA AAAAc eZdZy)AbsentNr;r=r>r@rrrrrrceZdZdZej dZej dZej dZej dZ ej dZ ej dejZ dd Z d Zd Zd Zd ZdZdZdZdZdZdZdZdZdZddZdZdZdZdZdZ dZ!y) rzCollection of HTTP cookies. You may not need to know about this class: try urllib.request.build_opener(HTTPCookieProcessor).open(url). z\Wrz\.?[^.]*z[^.]*z^\.+z^\#LWP-Cookies-(\d+\.\d+)Ncj| t}||_tj|_i|_yr#)r_policy _threadingRLock _cookies_lock_cookiesrpolicys rr!zCookieJar.__init__s. >(*F '--/ rc||_yr#)rrs r set_policyzCookieJar.set_policys  rcg}|jj||sgStd||j|}|j D]}}|jj ||s ||}|j D]F}|jj||s td+td|j|H|S)Nz!Checking %s for cookies to returnz not returning cookiez it's a match) rrLrrkeysrOrrIr)rrrcookiescookies_by_pathrcookies_by_namerFs r_cookies_for_domainzCookieJar._cookies_for_domains||,,VW=I2F;--/#((*D<<..tW=-d3O)002||--fg>45()v& 3 +rcg}|jjD]#}|j|j||%|S)z2Return a list of cookies to be returned to server.)rrextendr)rrrrs r_cookies_for_requestzCookieJar._cookies_for_request s<mm((*F NN433FGD E+rc|jddd}g}|D]}|j}|sd}|dkDr|jd|z|jQ|jj |jr,|dkDr'|j jd|j}n |j}|j|j|jn |j|jd ||dkDs|jr|jd |jz|jjd rB|j}|js|jd r|d d}|jd |z|jyd}|jr|d|jzz}|j||S)zReturn a list of cookie-attributes to be returned to server. like ['foo="bar"; $Path="/"', ...] The $Version attribute is also added when appropriate (currently only once per request). c,t|jSr#)rr)as rz)CookieJar._cookie_attrs..s 3qvv;rT)rreverseFr z $Version=%sNrrz $Path="%s"rr%z $Domain="%s"z$Portz="%s")sortrrr non_word_rercquote_rerrrrrrrrr) rrrattrsrFrrrr1s r _cookie_attrszCookieJar._cookie_attrss  . = FnnG" Q;LL!89 )  '' 5'A+ ))'6<<@ ||# V[[)  U;<{((LL !;<==++C0#]]F"55))#.!'LL&!89;;*A,,6;;!67LLOQT rctd|jj tt jx|j _|_|j|}|j|}|r2|jds!|jddj||j jrQ|j js;|jds*|D]%}|jdk7s|jddn|jj|j!y#|jjwxYw)zAdd correct Cookie: header to request (urllib.request.Request object). The Cookie2 header is also added unless policy.hide_cookie2 is true. add_cookie_headerrrCookie2r%z $Version="1"N)rracquirerdrqrrrr has_headeradd_unredirected_headerrrUrWrreleaseclear_expired_cookies)rrrrrFs rrzCookieJar.add_cookie_headerLs "# ""$ ),/ ,< R&    & & ( ""$    & & (sCEEEc(g}d}d}|D]}|d\}}d}d} i} i} |ddD]\} } | j}||vs||vr|} | |vr| d} | | vr-| dk(r!| td d} nw| j} | d k(r|r[| td i| d k(rd} t| } d } |j| z} | |vs| |vr| | dvrtd| zd} n | | | <| | | <| r|j ||| | f|S#t$rtd d} Y5wxYw)aReturn list of tuples containing normalised cookie information. attrs_set is the list of lists of key,value pairs extracted from the Set-Cookie or Set-Cookie2 headers. Tuples are name, value, standard, rest, where name and value are the cookie name and value, standard is a dictionary containing the standard cookie-attributes (discard, secure, version, expires or max-age, domain, path and port) and rest is a dictionary containing the rest of the cookie-attributes. )rr)rrrrrrr commenturlr Fr%NTrz% missing value for domain attributerzM missing or invalid value for expires attribute: treating as session cookierz? missing or invalid (non-numeric) value for max-age attribute)rrrz! missing value for %s attribute)rorrdrprr)r attrs_set cookie_tuples boolean_attrs value_attrs cookie_attrsrr max_age_set bad_cookiestandardr rrrs r_normalized_cookie_tuplesz#CookieJar._normalized_cookie_tuplesms + 0 &L&q/KD% KJHD$QR(1WWY$m(;A %!)A==yFG%)  A >" y FG  >"&KF"A A A$!}*< !BBBQFG%) "#HQKDGe)h  $x!> ?Q&T5& 23%)  s C77DDcR|\}}}}|jdt}|jdt}|jdt} |jdt} |jdd} | t| } |jdd} |jdd} |jd d}|jd d}|tur|d k7rd }t |}nFd}t |}|j d }|dk7r| dk(r|d|}n|d|dz}t|dk(rd }|tu}d}|rt|jd}|turt|\}}|}n|jdsd|z}d}| tur(| t|} nd }tjdd | } nd} | turd} d } n2| |jkr# |j|||t#d|||yt%| ||| ||||||| | | |||S#t$rYywxYw#t $rYCwxYw)NrrrrrrFrrrrTrrr r%rz\s+z2Expiring cookie, domain='%s', path='%s', name='%s')r'rrdrprrrrboolrrrrrrclearKeyErrorrr)rtuprrrrr rrrrrrrrrrrrrrrrs r_cookie_from_cookie_tuplez#CookieJar._cookie_from_cookie_tuplesv'*#eXth/||FF+||FF+,,y&1,,y$/   g,h.,,y%0,,y$/ll<6  v $"*!Nt$D"N(D 3ABwa<8D1:D4yA~ct"/" !%f&7&7&.no_matching_rfc2965ls'#**INNINNJCf,,r)rget_allrdrqrrrUrTr r Exceptionr"rrrrrfilterr) rresponserr rfc2965_hdrsns_hdrsrUrTr ns_cookiesrrFrs r make_cookieszCookieJar.make_cookies?sp--/}b9 //,3(+DIIK(88 DI,,&&<<((gh'I 22"<0';G x !99$W-w8  ) )* 5%FHLFFMM6;; DE&;A-$$7D z*C  % 'G  )+  s$'E E% E"!E"%E=<E=cl|jj ttjx|j_|_|jj ||r|j||jjy#|jjwxYw)z-Set a cookie if policy says it's OK to do so.N) rrrdrqrrrG set_cookierrEs rset_cookie_if_okzCookieJar.set_cookie_if_okvs~ ""$ ),/ ,<  |jjy#|jjwxYw)zAExtract cookies from response, where allowable given the request.zextract_cookies: %sz setting cookie: %sN) rrrrrrrGrr)rrrrFs rextract_cookieszCookieJar.extract_cookiess$hmmo6 ""$ )++Hg><<&&vw70&9OOF+?    & & (D   & & (s1B#(B##B?c|#|| td|j|||=y|| td|j||=y||j|=yi|_y)aClear some cookies. Invoking this method without arguments will clear all cookies. If given a single argument, only cookies belonging to that domain will be removed. If given two arguments, cookies belonging to the specified path within that domain are removed. If given three arguments, then the cookie with the specified name, path and domain is removed. Raises KeyError if no matching cookie exists. Nz8domain and path must be given to remove a cookie by namez.domain must be given to remove cookies by path)rpr)rrrrs rrzCookieJar.clears  DL NPP f%d+D1  ~ DFF f%d+   f%DMrc8|jj |D]@}|js|j|j|j |j B |jjy#|jjwxYw)zDiscard all session cookies. Note that the .save() method won't save session cookies anyway, unless you ask otherwise by passing a true ignore_discard argument. N)rrrrrrrr)rrFs rclear_session_cookieszCookieJar.clear_session_cookiesso ""$ )>>JJv}}fkk6;;G    & & (D   & & (sA=3A==Bcj|jj tj}|D]E}|j|s|j |j |j |jG |jjy#|jjwxYw)aDiscard all expired cookies. You probably don't need to call this method: expired cookies are never sent back to the server (provided you're using DefaultCookiePolicy), this method is called by CookieJar itself every so often, and the .save() method won't save expired cookies anyway (unless you ask otherwise by passing a true ignore_expires argument). N) rrrqr.rrrrr)rrKrFs rrzCookieJar.clear_expired_cookiess ""$ )))+C$$S)JJv}}fkk6;;G    & & (D   & & (s*B3BB2c,t|jSr#)rrres r__iter__zCookieJar.__iter__s$--((rc"d}|D]}|dz} |S)z#Return number of contained cookies.r r%r@)rrrFs r__len__zCookieJar.__len__s FAAdrcg}|D]}|jt|d|jjddj |dSN<[rz]>)rr9r:r;rrrrFs rr<zCookieJar.__repr__s: FAHHT&\2d!^^44diilCCrcg}|D]}|jt|d|jjddj |dSr.)rrr:r;rr1s rr4zCookieJar.__str__s: FAHHS[1d!^^44diilCCrr#)NNN)"r;r=r>r?rcompilerrstrict_domain_re domain_redots_reASCIImagic_rer!rrrrrrr r rrrrr$rr'rr*r,r<r4r@rrrrs "**U#Krzz+&H!rzz+. 8$Ibjj!Grzz6AH$9v%B_BZx '5n ) ) )6 ))&) D Drrc eZdZy)rNrr@rrrrrrrc4eZdZdZddZddZddZ ddZy) rz6CookieJar that can be loaded from and saved to a file.Nctj|||tj|}||_t ||_y)z} Cookies are NOT loaded from the named file until either the .load() or .revert() method is called. N)rr!osfspathfilenamer delayload)rr?r@rs rr!zFileCookieJar.__init__s: 4(  yy*H  irct)zSave cookies to a file.rC)rr?ignore_discardignore_expiress rsavezFileCookieJar.saverJrc|(|j |j}nttt|5}|j ||||dddy#1swYyxYw)zLoad cookies from a file.N)r?rpMISSING_FILENAME_TEXTopen _really_loadrr?rBrCr s rloadzFileCookieJar.loadsM  }}(T]]("#899 (^q   a>> J^^s AAc|(|j |j}ntt|jj  t j |j}i|_ |j||| |jjy#t$r ||_wxYw#|jjwxYw)zClear all cookies and reload cookies from a saved file. Raises LoadError (or OSError) if reversion is not successful; the object's state will not be altered if this happens. N) r?rprFrrrdeepcopyrrJOSErrorr)rr?rBrC old_states rrevertzFileCookieJar.revert s  }}(T]]("#899 ""$ ) dmm4IDM  (NNC    & & (   )      & & (s&B1-BB..B11C )NFNNFF)r;r=r>r?r!rDrJrOr@rrrrs"@ )$K#49)rrc|j|jfd|jfd|jfg}|j|j d|jf|j r|j d|jr|j d|jr|j d|jr|j d|jr/|j dtt|jf|jr|j d |jr|j d |jf|jr|j d |jft!|j"j%}|D]+}|j |t'|j"|f-|j d t'|j(ft+|gS) zReturn string representation of Cookie in the LWP cookie file format. Actually, the format is extended a bit -- see module docstring. rrr) path_specN) port_specN) domain_dotN)rNr)rNrrr)rrrrrrrrrrrrTrrrrsortedrrrrr)rFr rrs rlwp_cookie_strrV's ++v|| $ &++  FMM " $A{{&&++)> ? ahh':; ahh':;   !((+?"@ }}ahh/0 ~~qxx(v~~)>?!AB ~~qxx 12 ~~qxxFNN ;< 188\63E3E$FG &,,##% &D  !Sa)*+HHiV^^, -. aS !!rc&eZdZdZddZddZdZy)ra[ The LWPCookieJar saves a sequence of "Set-Cookie3" lines. "Set-Cookie3" is the format used by the libwww-perl library, not known to be compatible with any browser, but which is easy to read and doesn't lose information about RFC 2965 cookies. Additional methods as_lwp_str(ignore_discard=True, ignore_expired=True) ctj}g}|D]B}|s |jr|s|j|r&|jdt |zDdj |dgzS)zReturn cookies as a string of "\n"-separated "Set-Cookie3" headers. ignore_discard and ignore_expires: see docstring for FileCookieJar.save zSet-Cookie3: %s r)rqrr.rrVr)rrBrCrKr2rFs r as_lwp_strzLWPCookieJar.as_lwp_strPsk iik F!fnn!f&7&7&< HH&)?? @  yyB4  rNc|(|j |j}ntttjtj |tj tjztjzdd5}|jd|j|j||dddy#1swYyxYw)Nwz#LWP-Cookies-2.0 ) r?rprFr=fdopenrGO_CREATO_WRONLYO_TRUNCwriterZrIs rrDzLWPCookieJar.save`s  }}(T]]("#899 YY GGHbjj2;;6CU K   GG( ) GGDOONNC D   s 3CC cJ|j}|jj|sd|z}t|t j}d}d} d} |jx} dk7r| j |s(| t |dj} t| gD]0} | d\} }i}i}| D]}d||< | ddD]A\}}||j}nd}|| vs|| vr|}|| vr |d }|||<3|| vr|||<=|||<C|j}|d }|d }| t|}|d }|d }|j d }t|d| ||d|d|||d|d|d|d|||d|d|}|s|jr |s|j|r |j|3|jx} dk7ryy#t $rt"$rt%td|d wxYw)Nz5%r does not look like a Set-Cookie3 (LWP) format filez Set-Cookie3:)rSrRrTrr)rrrrrrrrr Fr%TrrrrrrrSrTrrRrrrz invalid Set-Cookie3 format file : )readliner9rcrrqrrrrror'rrrr.rrMrr")rr r?rBrCmagicr!rKheaderrrlinedatarrrr rrrr rrrrr s rrHzLWPCookieJar._really_loadosf }}##E*$%CC. iik. 0 9 .::<'4B.v.CKL)//1.v6D"&q'KD%!HD*&+ + $QR1=!"B!%B+-23F "A - yd!*+HQK+-*+HQK&'DG!) ! A lG lG*"*7"3"&x[F'-'8'8'=$q|T5 y!K.%'7< y!K. {&& | # %A*aii )all3.? OOA&[7 ::<'4B.f   . % '%t-. . .s FG44.H")TTrP)r;r=r>r?rZrDrHr@rrrrCs ! EJ.rrceZdZdZdZddZy)r a WARNING: you may want to backup your browser's cookies file if you use this class to save cookies. I *think* it works, but there have been bugs in the past! This class differs from CookieJar only in the format it uses to save and load cookies to and from a file. This class uses the Mozilla/Netscape `cookies.txt' format. curl and lynx use this file format, too. Don't expect cookies saved while the browser is running to be noticed by the browser (in fact, Mozilla on unix will overwrite your saved cookies if you change them on disk while it's running; on Windows, you probably can't save at all while the browser is running). Note that the Mozilla/Netscape format will downgrade RFC2965 cookies to Netscape cookies on saving. In particular, the cookie version and port number information is lost, together with information about whether or not Path, Port and Discard were specified by the Set-Cookie2 (or Set-Cookie) header, and whether or not the domain as set in the HTTP header started with a dot (yes, I'm aware some domains in Netscape files start with a dot and some don't -- trust me, you really don't want to know any more about this). Note that though Mozilla and Netscape use the same format, they use slightly different headers. The class saves cookies using the Netscape header by default (Mozilla can cope with that). ctj}tj|jst d|z |jx}dk7r2i}|j t rd|t<|tt d}|jdr|dd}|jj ds|jdk(r|jd\}} } } } } }| dk(} | dk(} | dk(r|} d}|j d}| |k(sJd }| dk(rd} d }td | |dd || || d | | |dd|}|s|jr |s|j|r|j||jx}dk7r1yy#t $rt"$rt%t d |d wxYw)Nz4%r does not look like a Netscape format cookies filerrYr)#r TRUErFTr z%invalid Netscape format cookies file rd)rqNETSCAPE_MAGIC_RGXrrerrHTTPONLY_PREFIX HTTPONLY_ATTRrrrrrrr.rrMrr")rr r?rBrCrKrhr rrrrrrrrrr s rrHzMozillaCookieJar._really_loadsiik!'' 5F < .::<'4B. ???3*,D'O 4 56D==&tCRyJJL++J7JJLB& 4(M($u F*$4$> 2:!D E$//4 ';666b="G"G1dE!#3[!"" !&!))%!,,s*;"i::<'4B.l   . % '%t-. . .s EF.F>Nc |(|j |j}ntttjtj |tj tjztjzdd5}|jttj}|D]}|j}|s |jr|s|j|r3|jrd}nd}|j!drd} nd} |j"t%|j"} nd} |j&d} |j(} n|j(} |j&} |j+t,r t.|z}|jdj1|| |j2|| | | gdz dddy#1swYyxYw) Nr\r]rnFALSErrrmrY)r?rprFr=r^rGr_r`rarbNETSCAPE_HEADER_TEXTrqrrr.rrrrrrr%rqrprr) rr?rBrCr rKrFrrrrrrs rrDzMozillaCookieJar.save"sz  }}(T]]("#899 YY GGHbjj2;;6CU K   GG( )))+C%&..%&*;*;C*@==6&&f$$S);$+k>>-!&..1G G<<'D"KKE!;;D"LLE..}=,v5FIIv{FKK%we=>3    s D2GG rP)r;r=r>r?rHrDr@rrr r s>D.L'rr r#)Yr?__all__r=rrJrrq urllib.parserurllib.request threadingr http.clienthttpcalendarr r rrrqrprclient HTTP_PORTrr4rorFrtr"r+r3rVrXrormrTrYrar8rbrhr{rIrXrrrrrrrrrrrrrrrrrrrrrrrrr r rrrrrrrrrrrMrrrVrr )r.s0rrs6 M  #    --.RZZ @A:A 9 4+126% 62 B&0(T = bjj5rxx@  6 p,-/XX7RZZ2BDD288OE RZZ & DD288O)*65pbjj 44")) # $5B3 $$67#$MN#$9:2::h'Sj# ;/2AH "**Y ) %N(bjj288,    $"**9:+ ! F"_E_EDB_,_B "LDLD`4)I4)n"8v.=v.rM}MA;3sJ0PK]'c client.cpython-312.opt-1.pycnu[ WjfdZddlZddlZddlZddlZddlZddlZddlZddl Z ddl Z ddl m Z gdZdZdZdZdZd Zd Zej-ej.j0ej.j0j3Dcic]}||j4c}Zd Zd Zd Zej>dj@Z!ej>djDZ#ej>dZ$ej>dZ%hdZ&d?dZ'de(de(fdZ)GddejTjVZ,dZ-e,fdZ.e,fdZ/Gddej`Z1dZ2Gdd Z3 ddl4Z4Gd!d"e3Z5ejmd"Gd#d$e8Z9Gd%d&e9Z:Gd'd(e9Z;Gd)d*e9Z<Gd+d,e9Z=Gd-d.e9Z>Gd/d0e9Z?Gd1d2e9Z@Gd3d4e@ZAGd5d6e@ZBGd7d8e@ZCGd9d:e9ZDGd;deFeDZGe9ZHycc}w#e7$rYwxYw)@a HTTP/1.1 client library HTTPConnection goes through a number of "states", which define when a client may legally make another request or fetch the response for a particular request. This diagram details these state transitions: (null) | | HTTPConnection() v Idle | | putrequest() v Request-started | | ( putheader() )* endheaders() v Request-sent |\_____________________________ | | getresponse() raises | response = getresponse() | ConnectionError v v Unread-response Idle [Response-headers-read] |\____________________ | | | response.read() | putrequest() v v Idle Req-started-unread-response ______/| / | response.read() | | ( putheader() )* endheaders() v v Request-started Req-sent-unread-response | | response.read() v Request-sent This diagram presents the following rules: -- a second request may not be started until {response-headers-read} -- a response [object] cannot be retrieved until {request-sent} -- there is no differentiation between an unread response body and a partially read response body Note: this enforcement is applied by the HTTPConnection class. The HTTPResponse class does not enforce this state machine, which implies sophisticated clients may accelerate the request/response pipeline. Caution should be taken, though: accelerating the states beyond the above pattern may imply knowledge of the server's connection-close behavior for certain requests. For example, it is impossible to tell whether the server will close the connection UNTIL the response headers have been read; this means that further requests cannot be placed into the pipeline until it is known that the server will NOT be closing the connection. Logical State __state __response ------------- ------- ---------- Idle _CS_IDLE None Request-started _CS_REQ_STARTED None Request-sent _CS_REQ_SENT None Unread-response _CS_IDLE Req-started-unread-response _CS_REQ_STARTED Req-sent-unread-response _CS_REQ_SENT N)urlsplit) HTTPResponseHTTPConnection HTTPException NotConnectedUnknownProtocolUnknownTransferEncodingUnimplementedFileModeIncompleteRead InvalidURLImproperConnectionStateCannotSendRequestCannotSendHeaderResponseNotReady BadStatusLine LineTooLongRemoteDisconnectederror responsesPiUNKNOWNIdlezRequest-startedz Request-sentidis[^:\s][^:\r\n]*s\n(?![ \t])|\r(?![ \t\n])z[- ]z[-]>PUTPOSTPATCHc  |jdS#t$rl}t|j|j|j|j |j d||j|j dd|ddd}~wwxYw)z|jd\}}}|r|dz }|S)z)Remove interface scope from IPv6 address.%]) partition)r+percent_s r)_strip_ipv6_ifacer3s+#--d3HgqD OceZdZdZy) HTTPMessagec|jdz}t|}g}d}|jD]D}|d|j|k(rd}n|ddjsd}|s4|j |F|S)aFind all header lines matching a given header name. Look through the list of headers and find all lines matching a given header name (and their continuation lines). A list of the lines is returned, without interpretation. If the header does not occur, an empty list is returned. If the header occurs multiple times, all occurrences are returned. Case is not important in the header name. :rN)lowerlenkeysisspaceappend)selfr'nlsthitlines r)getallmatchingheadersz!HTTPMessage.getallmatchingheaderss~zz|c! IIIKDBQx~~4'"1X%%' 4   r4N)__name__ __module__ __qualname__rDr4r)r6r6sr4r6cg} |jtdz}t|tkDr td|j |t|t kDrt dt z|dvr |Sr)zReads potential header lines into a list from a file pointer. Length of line is limited by _MAXLINE, and number of headers is limited by _MAXHEADERS. r9z header linezgot more than %d headers  r4)readline_MAXLINEr;rr> _MAXHEADERSr)fpheadersrCs r) _read_headersrRst G {{8a<( t9x m, ,t w<+ % :[ HI I ( (  N r4cdj|jd}tjj |j |S)aJ Parses only RFC2822 headers from header lines. email Parser wants to see strings rather than bytes. But a TextIOWrapper around self.rfile would buffer too many bytes from the stream, bytes which we later need to read as bytes. So we read the correct bytes here, as bytes, for email Parser to parse. r4 iso-8859-1)_class)joindecodeemailparserParserparsestr) header_linesrUhstrings r)_parse_header_linesr^s@hh|$++L9G <<  f  - 6 6w ??r4c0t|}t||S)z0Parses only RFC2822 headers from a file pointer.)rRr^)rPrUrQs r) parse_headersr`sBG w //r4ceZdZddZdZdZdZdZfdZfdZ dZ d Z d d Z d Z d Zd ZdZd dZdZdZdZd!dZd!dZd!fd ZdZdZdZd dZdZdZdZdZdZ xZ!S)"rc|jd|_||_||_dx|_|_t |_t |_t |_ t |_ t |_ t |_ t |_ y)Nrb)makefilerP debuglevel_methodrQmsg_UNKNOWNversionstatusreasonchunked chunk_leftlength will_close)r?sockremethodurls r)__init__zHTTPResponse.__init__ se--%$ #'& tx     " "r4clt|jjtdzd}t |tkDr t d|j dkDrtdt||s td |jdd\}}}|jd s|jt| t}|d ks|d kDr t| ||fS#t$r- |jdd\}}d}n#t$rd}YnwxYwYwxYw#t$r t|wxYw) Nr9rTz status linerzreply:z-Remote end closed connection without responsezHTTP/ri)strrPrMrNr;rreprintreprrsplit ValueError startswith _close_connrint)r?rCrirjrks r) _read_statuszHTTPResponse._read_status(sD477##HqL1<@ t9x m, , ??Q  (DJ '%&12 2 &*jjq&9 #GVV!!'*    % % &[F|v|#D)) ,&&%  "&**T1"5      &% % &sB<C%? D% D/DD DDDDDD3c|jy |j\}}}|tk7rn2t|j}|j dkDr t d|~P|x|_|_|j|_ |dvrd|_ n$|jdrd|_ n t|t|jx|_|_|j dkDr2|jj!D]\}}t d|d z||jj#d }|r"|j%d k(rd|_d|_nd |_|j+|_d|_|jj#d }|r4|j&s( t1||_|j.dkrd|_nd|_|t4k(s%|t6k(sd|cxkrdksn|j8dk(rd|_|j,s"|j&s|j.d|_yyyy#t2$r d|_YvwxYw)NTrzheaders:)zHTTP/1.0zHTTP/0.9 zHTTP/1. header:r8transfer-encodingrlFcontent-lengthrHEAD)rQrCONTINUErRrPrerxcoderjstriprkrir|rr`rgitemsgetr:rlrm _check_closerornr~r{ NO_CONTENT NOT_MODIFIEDrf) r?rirjrkskipped_headershdrvaltr_encrns r)beginzHTTPResponse.beginIs << # &*&7&7&9 #GVV!+DGG4O"j/2#)( DKlln . .DL    *DL!'* *"/"88 tx ??Q  LL..0SisC01!!"56 flln 1DL"DO DL++- !!"23 $,, '!&k ;;?"&DKDK j Fl$: 6 C  LLF "DK  KK "DO  # #"  #s H22IIcF|jjd}|jdk(r|rd|jvryy|jjdry|rd|jvry|jjd}|rd|jvryy)N connectionrcloseTFz keep-alivezproxy-connection)rQrrir:)r?connpconns r)rzHTTPResponse._check_closes|| - <<2 4::</ <<  L ) LDJJL0   !34 \U[[]2r4cJ|j}d|_|jyN)rPr)r?rPs r)r}zHTTPResponse._close_conns WW  r4c t||jr|jyy#|jr|jwwxYwr)superrrPr}r? __class__s r)rzHTTPResponse.closesB # GMOww  "tww  "s /Acpt||jr|jjyyr)rflushrPrs r)rzHTTPResponse.flushs%   77 GGMMO r4cy)zAlways returns TrueTrHr?s r)readablezHTTPResponse.readablesr4c|jduS)z!True if the connection is closed.N)rPrs r)isclosedzHTTPResponse.isclosedsww$r4c|jy|jdk(r|jy|jr|j |S||dk\r|j ||j kDr |j }|jj |}|s|r|j|S|j :|xj t|zc_|j s|j|S|j |jj }n# |j|j }d|_|j|S#t$r|jwxYw)z?Read and return the response body, or up to the next amt bytes.r4rr) rPrfr}rl _read_chunkedrnreadr; _safe_readr )r?amtss r)rzHTTPResponse.reads8 77? <<6 !     <<%%c* * ?sax{{&3+<kk S!A  " H ( s1v% {{$$&H{{"GGLLN 4A     H &$$&s EE)c|jy|jdk(r|jy|jr|j |S|j 0t ||j kDrt|d|j }|jj|}|s|r|j|S|j 1|xj |zc_|j s|j|S)z^Read up to len(b) bytes into bytearray b and return the number of bytes read. rr) rPrfr}rl_readinto_chunkedrnr; memoryviewreadinto)r?br@s r)rzHTTPResponse.readintos 77? <<6 !     <<))!, , ;; "1v #qM!DKK0 GG  Q Q      [[ $ KK1 K;;  "r4c |jjtdz}t|tkDr t d|j d}|dk\r|d|} t |dS#t$r|jwxYw)Nr9z chunk size;r) rPrMrNr;rfindr~r{r})r?rCis r)_read_next_chunk_sizez"HTTPResponse._read_next_chunk_sizesww1 - t9x l+ + IIdO 68D tR=         s  A((Bc |jjtdz}t|tkDr t d|sy|dvryH)Nr9z trailer linerJ)rPrMrNr;rr?rCs r)_read_and_discard_trailerz&HTTPResponse._read_and_discard_trailer.sO77##HqL1D4y8#!.11,,r4c|j}|sR||jd |j}|dk(r"|j |j d}||_|S#t$r t dwxYw)Nrur4r)rmrrr{r rr})r?rms r)_get_chunk_leftzHTTPResponse._get_chunk_left<s __ %" *!779 Q..0  "! (DO *$S)) *s A##A8c||dkrd}g} |jx}s|0||kr+|j|j|||z |_nA|j|j||||z}d|_|jx}sdj |S#t $r }t dj ||d}~wwxYwNrr4)rr>rrmrVr )r?rvaluermexcs r)rzHTTPResponse._read_chunkedTs ?sQwC ;!%!5!5!77:D?sj'8LL!56&03&6DO T__Z89?:%C"#"&!5!5!77:D88E? " ; %1s : ;sBB#B## C ,CC c<d}t|} |j}||St||kr |j|}||z |_||zS|d|}|j|}||d}||z }d|_j#t $rt t |d|wxYw)Nr)rrr;_safe_readintormr bytes)r?r total_bytesmvbrmr@temp_mvbs r)rzHTTPResponse._readinto_chunkedhs m :!113 %&&s8z)++C0A&01nDO&?*{ +''1!"gq "#  : q;'7!89 9 :sA:-A:(A::!BcTt|t}|jj|}t ||k\r|St ||krt ||t |z t j|}|jdd t|||z }|j|jj||j|k\r|jS||z }|j|kr+t |j||jz )a Read the number of bytes requested. This function should be used when bytes "should" be present for reading. If the bytes are truly not available (due to EOF), then the IncompleteRead exception can be used to detect the problem. rru) min_MIN_READ_BUF_SIZErPrr;r ioBytesIOseekwritetellgetvalue)r?rcursizer&deltas r)rzHTTPResponse._safe_readsc-.ww||G$ t9 K t9w  sSY7 7zz$ !Qw/E JJtww||E* +yy{c!}}& u Gyy{W$$T]]_cDIIK6GHHr4ct|}|jj|}||krtt |d|||z |S)z2Same as _safe_read, but for reading into a buffer.N)r;rPrr r)r?rrr@s r)rzHTTPResponse._safe_readintosF!f GG  Q  s7 q!us1u5 5r4c|j|jdk(ry|jr|j|S|j |dks||jkDr |j}|jj |}|s|r|j |S|j:|xjt|zc_|js|j |S)zvRead with at most one underlying system call. If at least one byte is buffered, return that instead. rr4r)rPrfrl_read1_chunkedrnread1r}r;)r?r@results r)rzHTTPResponse.read1s 77?dllf4 <<&&q) ) ;; "AT[[ Aq!!      [[ $ KK3v; &K;;  " r4c|j|jdk(ry|jr|j|S|jj |S)Nrr4)rPrfrl _peek_chunkedpeek)r?r@s r)rzHTTPResponse.peeksE 77?dllf4 <<%%a( (ww||Ar4c|j|jdk(ry|jrt||S|j |dks||j kDr |j }|jj |}|s|r|j |S|j :|xj t|zc_|j s|j |S)Nrr4r)rPrfrlrrMrnr}r;)r?limitrrs r)rMzHTTPResponse.readlines 77?dllf4 <<7#E* * ;; " UT[[5HKKE!!%(%      [[ $ KK3v; &K;;  " r4c|j}||dk(ryd|cxkr|ksn|}|jj|}|xjt |zc_|s t d|Sr)rrPrrmr;r )r?r@rmrs r)rzHTTPResponse._read1_chunkedsj))+  aQ$*$Aww}}Q 3t9$ % % r4c |j}|y|jj|d|S#t$rYywxYw)Nr4)rr rPr)r?r@rms r)rzHTTPResponse._peek_chunkedsP --/J  ww||J' 44   s 3 ??c6|jjSr)rPfilenors r)rzHTTPResponse.filenosww~~r4c|j t|jj|xs|}t|ts t |ds|Sdj |S)axReturns the value of the header matching *name*. If there are multiple matching headers, the values are combined into a single string separated by commas and spaces. If no matching header is found, returns *default* or None if the *default* is not specified. If the headers are unknown, raises http.client.ResponseNotReady. __iter__z, )rQrget_all isinstancerwhasattrrV)r?r'defaultrQs r) getheaderzHTTPResponse.getheadersW << "$ $,,&&t,7 gs #77J+GN99W% %r4ct|j tt|jjS)z&Return list of (header, value) tuples.)rQrlistrrs r) getheaderszHTTPResponse.getheaderss- << "$ $DLL&&())r4c|SrrHrs r)rzHTTPResponse.__iter__ s r4c|jS)ajReturns an instance of the class mimetools.Message containing meta-information associated with the URL. When the method is HTTP, these headers are those returned by the server at the head of the retrieved HTML page (including Content-Length and Content-Type). When the method is FTP, a Content-Length header will be present if (as is now usual) the server passed back a file length in response to the FTP retrieval request. A Content-Type header will be present if the MIME type can be guessed. When the method is local-file, returned headers will include a Date representing the file's last-modified time, a Content-Length giving file size, and a Content-Type containing a guess at the file's type. See also the description of the mimetools module. )rQrs r)infozHTTPResponse.infos*||r4c|jS)aZReturn the real URL of the page. In some cases, the HTTP server redirects a client to another URL. The urlopen() function handles this transparently, but in some cases the caller needs to know which URL the client was redirected to. The geturl() method can be used to get at this redirected URL. )rrrs r)geturlzHTTPResponse.geturl&s xxr4c|jS)zuReturn the HTTP status code that was sent with the response, or None if the URL is not an HTTP URL. )rjrs r)getcodezHTTPResponse.getcode2s {{r4)rNNr))"rErFrGrsrrrr}rrrrrrrrrrrrrrrrMrrrrrrrrr __classcell__rs@r)rrs#<'BF#P: #  &P D 0;(:0I6&"  5 &(* . r4rctj}|dk(r|jdg|jd|_|S)Nrzhttp/1.1T)ssl_create_default_https_contextset_alpn_protocolspost_handshake_auth) http_versioncontexts r)_create_https_contextr:sC//1Gr""J<0"".&*# Nr4c eZdZdZdZeZeZdZ dZ e dZ e dZ dejddfd Zd"d Zd Zd Zd ZdZdZdZdZdZdZdZd#dZ d$dZdZdZdZ dZ!dZ"d%dddZ#difdddZ$d Z%d!Z&y)&rrzHTTP/1.1r9rc6t|tjS)zFTest whether a file-like object is a text or a binary stream. )rr TextIOBase)streams r) _is_textIOzHTTPConnection._is_textIOQs&"--00r4c||jtvryyt|dry t|}|jS#t $rYnwxYwt |tr t|Sy)aGet the content-length based on the body. If the body is None, we set Content-Length: 0 for methods that expect a body (RFC 7230, Section 3.3.2). We also set the Content-Length for any method if the body is a str or bytes-like object and not a file. Nrr) upper_METHODS_EXPECTING_BODYrrnbytes TypeErrorrrwr;)bodyrqmvs r)_get_content_lengthz"HTTPConnection._get_content_lengthWsq <||~!88 4  D!B99     dC t9 sA A  A N cR||_||_||_d|_g|_d|_t |_d|_d|_ d|_ i|_ d|_ |j||\|_|_|j!|jt"j$|_yr)timeoutsource_address blocksizerp_buffer_HTTPConnection__response_CS_IDLE_HTTPConnection__staterf _tunnel_host _tunnel_port_tunnel_headers_raw_proxy_headers _get_hostporthostport_validate_hostsocketcreate_connection_create_connection)r?rrr r r s r)rszHTTPConnection.__init__ws ,"      !"&!%!3!3D$!?DI DII&#)":":r4c|jr td|j||\|_|_|r|j |_n|j jtd|j DsI|jjdjd}d||jfz|j d<yy)aSet up host and port for HTTP CONNECT tunnelling. In a connection that uses HTTP CONNECT tunnelling, the host passed to the constructor is used as a proxy server that relays all communication to the endpoint passed to `set_tunnel`. This done by sending an HTTP CONNECT request to the proxy server when the connection is established. This method must be called before the HTTP connection has been established. The headers argument should be a mapping of extra HTTP headers to send with the CONNECT request. As HTTP/1.1 is used for HTTP CONNECT tunnelling request, as per the RFC (https://tools.ietf.org/html/rfc7231#section-4.3.6), a HTTP Host: header must be provided, matching the authority-form of the request target provided as the destination for the CONNECT request. If a HTTP Host: header is not provided via the headers argument, one is generated and transmitted automatically. z.Can't set up tunnel for established connectionc3BK|]}|jdk(yw)rNr:).0headers r) z,HTTPConnection.set_tunnel..sO:N6<<>V+:Nsidnaasciiz%s:%dHostN) rp RuntimeErrorrrrcopyrclearanyrrW)r?rrrQ encoded_hosts r) set_tunnelzHTTPConnection.set_tunnels, 99OP P/3/A/A$/M,4, #*<<>D  & & (O$:N:NOO,,33F;BB7KL+2d//61,1D  (Pr4cH|K|jd}|jd}||kDr t||dzd}|d|}n |j}|r|ddk(r |ddk(r|dd}||fS#t$r/||dzddk(r |j}nt d||dzdzYdwxYw) Nr8]r9rvznonnumeric port: '%s'r[r)rfindr~r{ default_portr )r?rrrjs r)rzHTTPConnection._get_hostports < 3A 3A1uOtAaCDz?D BQx(( DGsNtBx3":Dd|"OAaCDzR'#00()@4!:)MNNOsA))5B! B!c||_yr)re)r?levels r)set_debuglevelzHTTPConnection.set_debuglevels r4c.d|vr|ddk7rd|zdzS|S)N:r[[r/rH)r?ips r) _wrap_ipv6zHTTPConnection._wrap_ipv6s( 2:"Q%7*"9t# # r4ctj|jrtd|jd|j |jj d|j |jj dfz}|g}|jjD]o\}}|j d}|j d}t|std|t|rtd||jd||fzq|jd |jd j|~|j|j |j" } |j%\}} } t'|j(|_|j,d kDr+|j*D]}t/d |j1| t2j4j6k7r/|j9t;d| d| j= |j9y#|j9wxYw)Nz-Tunnel host can't contain control characters sCONNECT %s:%d %s r#r$rInvalid header name Invalid header value s%s: %s rKr4rqrrzTunnel connection failed:  )!_contains_disallowed_url_pchar_researchrr{r:rr _http_vsn_strrr_is_legal_header_name_is_illegal_header_valuer>sendrVresponse_classrprfrrRrPrrerxrWhttp HTTPStatusOKrOSErrorr) r?connectrQr!r header_bytes value_bytesresponserirmessages r)_tunnelzHTTPConnection._tunnels , 3 3D4E4E F $ 1 145 5) OOD--44V< =       % %g .-00)!11779MFE!==3L,,y1K(6 \!KLL' 4 k!KLL NN=L++FF G: w #((7#$ &&tyy&F '/'<'<'> $WdG&3HKK&@D #""55F)V]]_56t)))  :4&'--/ARSTT* NN HNN s 4B4H::I cH|jt|jSdS)z Returns a dictionary with the headers of the response received from the proxy server to the CONNECT request sent to set the tunnel. If the CONNECT request was not sent, the method returns None. N)rr^rs r)get_proxy_response_headersz)HTTPConnection.get_proxy_response_headerss/&&2  7 7 8  r4ctjd||j|j|j |j|jf|j |j |_ |jjtjtjd|jr|j!yy#t$r(}|jtjk7rYd}~Jd}~wwxYw)z3Connect to the host and port specified in __init__.zhttp.client.connectr9N)sysauditrrrr r rp setsockoptr IPPROTO_TCP TCP_NODELAYrJerrno ENOPROTOOPTrrPr?es r)rKzHTTPConnection.connects 'tyy$))D++ YYtyy !4<<1D1DF   II !3!3V5G5G K    LLN   ww%+++, s09C C8C33C8ct|_ |j}|rd|_|j|j}|rd|_|jyy#|j}|rd|_|jwwxYw)z(Close the connection to the HTTP server.N)rrrprr)r?rprNs r)rzHTTPConnection.closesr  !99D   H"& H"& s %A(Bc|j'|jr|jn t|jdkDrt dt |t|dr|jdkDr t d|j|}|r|jdkDr t d|j|jx}rc|r|jd}tjd|||jj||j|jx}rcytjd|| |jj|y#t$r`t!|t"j$j&r$|D]}|jj|Yytd t)|zwxYw) zSend `data' to the server. ``data`` can be a string object, a bytes object, an array object, a file-like object that supports a .read() method, or an iterable object. Nrzsend:rzsending a readableencoding file using iso-8859-1rTzhttp.client.sendz9data should be a bytes-like object or an iterable, got %r)rp auto_openrKrrerxryrrrr rrTrUsendallrr collectionsabcIterabletype)r?r&r datablockds r)rEzHTTPConnection.send"s~ 99 ~~ "n$ ??Q  '4: & 4 "*+__T*F$//A-67#yy88)8 ) 0 0 >I ,dI> !!), $yy88)8  $dD1 G II  d # G$  8 89AII%%a( !9;?:!FGG  GsE AG 1G c:|jj|y)zuAdd a line of output to the current request buffer. Assumes that the line does *not* end with \r\n. N)rr>)r?rs r)_outputzHTTPConnection._outputGs Ar4c#@K|jdkDr td|j|}|r|jdkDr td|j|jx}r6|r|j d}||j|jx}r5yyw)Nrzreading a readabler_rT)rerxrrr r)r?rrrfs r)_read_readablezHTTPConnection._read_readableNs ??Q  & '* doo) 2 3#==88i8%,,\: O$==88i8s BBBFc|jjddj|j}|jdd=|j||t |dr|j |}n t ||f}|D]e}|s|jdkDr td |r3|jdk(r$t|d d jd |zdz}|j|g|r"|jdk(r|jd yyyy#t$r4 t|}n$#t$rtdt|zwxYwYwxYw) zSend the currently buffered request and clear the buffer. Appends an extra \r\n to the buffer. A message_body may be specified, to be appended to the request. )r4r4rKNrzAmessage_body should be a bytes-like object or an iterable, got %rrzZero length chunk ignoredrXz r$s0 )rextendrVrErrkrriterrererx _http_vsnr;r)r? message_bodyencode_chunkedrgchunkschunks r) _send_outputzHTTPConnection._send_outputYs` J'll4<<( LLO #  #|V,,,\:- |,+_F*9:!dnn&:"5z!nD188AEI!"E %  $..B"6 ,'#7~O $!>>!%l!3$>')H*.|*<)=>>>>s*8 D E D,+E,!E  EEcz|jr!|jjrd|_|jtk(r t|_nt |j|j |||_|xsd}|j||d|d|j}|j|j||jdk(r&|s d}|jdrt|\}}}}}|r. |jd}|j#d t%|n|j&r|j&} |j(} n|j*} |j,} | jd} |j/| } d | vr t%| } | |j0k(r|j#d | n(| j3d} |j#d | d | |s|j#d d yyy#t $r|jd}Y wxYw#t $r| jd} YwxYw) a`Send a request to the server. `method' specifies an HTTP request method, e.g. 'GET'. `url' specifies the object being requested, e.g. '/index.html'. `skip_host' if True does not add automatically a 'Host:' header `skip_accept_encoding' if True does not add automatically an 'Accept-Encoding:' header N/r?rrvrGr$r#r%r8zAccept-Encodingidentity)rrrr_CS_REQ_STARTEDr_validate_methodrf_validate_pathrBri_encode_requestrpr|rrr putheaderr3rrrrr:r0rW) r?rqrr skip_hostskip_accept_encodingrequestnetlocnil netloc_encrrhost_encs r) putrequestzHTTPConnection.putrequests ??t779"DO* <<8 #*DL#DLL1 1 f% jS C &T-?-?@ T))'23 >>R >>&)19#.Cc3;%+]]7%; NN6+t000vx8#+??7#;v(D/IJ(0*=( c.;%+]]6%: ;.7#';;v#67s$?G<*H<HHH:9H:c$|jdS)Nr$)r)r?rs r)r|zHTTPConnection._encode_requests~~g&&r4crtj|}|r td|d|jdy)z&Validate a method name for putrequest.z)method can't contain control characters.  (found at least )N)$_contains_disallowed_method_pchar_rerAr{group)r?rqmatchs r)rzzHTTPConnection._validate_methodsI5;;FC ?zJ'',{{}&7q:; ; r4crtj|}|r td|d|jdy)zValidate a url for putrequest.&URL can't contain control characters. rrNr@rAr r)r?rrrs r)r{zHTTPConnection._validate_pathsL288= EcWM005 /@CD D r4crtj|}|r td|d|jdy)z9Validate a host so it doesn't contain control characters.rrrNr)r?rrs r)rzHTTPConnection._validate_host#sL288> EdXN005 /@CD D r4c|jtk7r tt|dr|j d}t |st d|t|}t|D]r\}}t|dr|j d||<n-t|trt|j d||<t||sct d||dj|}|dz|z}|j|y) zkSend a request header line to the server. For example: h.putheader('Accept', 'text/html') rr$r<rr=s s: N)rryrrrrCr{r enumeraterr~rwrDrVri)r?r!valuesr one_valuers r)r}zHTTPConnection.putheader+s <.[s )rrrrrrerFrprfrConnectionErrorrrro)r?rNs r) getresponsezHTTPConnection.getresponses  ??t779"DO" <<< '4??"4<<0 0 ??Q **499doo26,,+@H**499T\\*JH   $DL"" O#+O#     NN  s$ D(D-D-D**D--E)NN)NF)FFr)'rErFrGrprBrrF HTTP_PORTr0r`re staticmethodrrr_GLOBAL_DEFAULT_TIMEOUTrsr+rr4r:rPrRrKrrErirkrurr|rzr{rr}rrrrrHr4r)rrGsIM!NLIJ11 >#'0N0N $;."1H(  'R    !#GJ 4(l16(-}~';DD8 Ge G)-bG$G ,=\=r4rcReZdZdZeZdejddddfd ZfdZ xZ S)HTTPSConnectionz(This class allows communication via SSL.Nr )r r rr crtt| ||||||t|j}||_y)N)r )rrrsrrp_context)r?rrr r rr rs r)rszHTTPSConnection.__init__sB /4 1$g2@ >$($$ $ S Sr4rc eZdZy)rNrErFrGrHr4r)rrs r4rc eZdZy)rNrrHr4r)rrr4rc eZdZy)r NrrHr4r)r r rr4r ceZdZdZy)rc"|f|_||_yr)argsri)r?ris r)rszUnknownProtocol.__init__sH  r4NrErFrGrsrHr4r)rrsr4rc eZdZy)r NrrHr4r)r r rr4r c eZdZy)r NrrHr4r)r r rr4r c2eZdZddZdZej Zy)r Nc0|f|_||_||_yr)rpartialexpected)r?rrs r)rszIncompleteRead.__init__sH    r4c|jd|jz}nd}d|jjt|j|fzS)Nz, %i more expectedrvz%s(%i bytes read%s))rrrEr;rr[s r)__repr__zIncompleteRead.__repr__sK == $$t}}4AA$(?(?(+DLL(91(>> >r4r)rErFrGrsrr"__str__rHr4r)r r s!>nnGr4r c eZdZy)r NrrHr4r)r r rr4r c eZdZy)rNrrHr4r)rrrr4rc eZdZy)rNrrHr4r)rrrr4rc eZdZy)rNrrHr4r)rrrr4rceZdZdZy)rc<|s t|}|f|_||_yr)ryrrCrs r)rszBadStatusLine.__init__s:DE  r4NrrHr4r)rrsr4rceZdZdZy)rcBtj|dt|fzy)Nz&got more than %d bytes when reading %s)rrsrN)r? line_types r)rszLineTooLong.__init__!s"t%M(0)'<&= >r4NrrHr4r)rr s>r4rceZdZdZy)rcbtj|dtj|g|i|y)Nrv)rrsConnectionResetError)r?poskws r)rszRemoteDisconnected.__init__&s*tR(%%d7S7B7r4NrrHr4r)rr%s8r4r)r&)Ir email.parserrX email.messagerYrGrrerrTcollections.abcrb urllib.parser__all__rrrhrryrglobalsupdaterH __members__rphraserrNrOrcompile fullmatchrCrArDr@rrr*rr3rOMessager6rRr^r`BufferedIOBaserrrrrr> ImportError Exceptionrrr rr r r r rrrrrrrr)vs0r)rsDL !     #  ,,-#'//"="="D"D"F G"FQQ["F G   8# #67AA%2::&CDKK%/BJJ/@$A!(2rzz-'@$3 E%%--''<$.9 @)0v2$$vr } } ~!&S.S8 NN$% I  =   m  m  M  ]  m  /  .  . M>-> 8-}8 - Hx*  s H#%H((H0/H0PK]//client.cpython-312.pycnu[ WjfdZddlZddlZddlZddlZddlZddlZddlZddl Z ddl Z ddl m Z gdZdZdZdZdZd Zd Zej-ej.j0ej.j0j3Dcic]}||j4c}Zd Zd Zd Zej>dj@Z!ej>djDZ#ej>dZ$ej>dZ%hdZ&d?dZ'de(de(fdZ)GddejTjVZ,dZ-e,fdZ.e,fdZ/Gddej`Z1dZ2Gdd Z3 ddl4Z4Gd!d"e3Z5ejmd"Gd#d$e8Z9Gd%d&e9Z:Gd'd(e9Z;Gd)d*e9Z<Gd+d,e9Z=Gd-d.e9Z>Gd/d0e9Z?Gd1d2e9Z@Gd3d4e@ZAGd5d6e@ZBGd7d8e@ZCGd9d:e9ZDGd;deFeDZGe9ZHycc}w#e7$rYwxYw)@a HTTP/1.1 client library HTTPConnection goes through a number of "states", which define when a client may legally make another request or fetch the response for a particular request. This diagram details these state transitions: (null) | | HTTPConnection() v Idle | | putrequest() v Request-started | | ( putheader() )* endheaders() v Request-sent |\_____________________________ | | getresponse() raises | response = getresponse() | ConnectionError v v Unread-response Idle [Response-headers-read] |\____________________ | | | response.read() | putrequest() v v Idle Req-started-unread-response ______/| / | response.read() | | ( putheader() )* endheaders() v v Request-started Req-sent-unread-response | | response.read() v Request-sent This diagram presents the following rules: -- a second request may not be started until {response-headers-read} -- a response [object] cannot be retrieved until {request-sent} -- there is no differentiation between an unread response body and a partially read response body Note: this enforcement is applied by the HTTPConnection class. The HTTPResponse class does not enforce this state machine, which implies sophisticated clients may accelerate the request/response pipeline. Caution should be taken, though: accelerating the states beyond the above pattern may imply knowledge of the server's connection-close behavior for certain requests. For example, it is impossible to tell whether the server will close the connection UNTIL the response headers have been read; this means that further requests cannot be placed into the pipeline until it is known that the server will NOT be closing the connection. Logical State __state __response ------------- ------- ---------- Idle _CS_IDLE None Request-started _CS_REQ_STARTED None Request-sent _CS_REQ_SENT None Unread-response _CS_IDLE Req-started-unread-response _CS_REQ_STARTED Req-sent-unread-response _CS_REQ_SENT N)urlsplit) HTTPResponseHTTPConnection HTTPException NotConnectedUnknownProtocolUnknownTransferEncodingUnimplementedFileModeIncompleteRead InvalidURLImproperConnectionStateCannotSendRequestCannotSendHeaderResponseNotReady BadStatusLine LineTooLongRemoteDisconnectederror responsesPiUNKNOWNIdlezRequest-startedz Request-sentidis[^:\s][^:\r\n]*s\n(?![ \t])|\r(?![ \t\n])z[- ]z[-]>PUTPOSTPATCHc  |jdS#t$rl}t|j|j|j|j |j d||j|j dd|ddd}~wwxYw)z bytes "should" be present for reading. If the bytes are truly not available (due to EOF), then the IncompleteRead exception can be used to detect the problem. rrw) min_MIN_READ_BUF_SIZErRrr=r ioBytesIOseekwritetellgetvalue)rArcursizer&deltas r)rzHTTPResponse._safe_readsc-.ww||G$ t9 K t9w  sSY7 7zz$ !Qw/E JJtww||E* +yy{c!}}& u Gyy{W$$T]]_cDIIK6GHHr6ct|}|jj|}||krtt |d|||z |S)z2Same as _safe_read, but for reading into a buffer.N)r=rRrr r)rArrrBs r)rzHTTPResponse._safe_readintosF!f GG  Q  s7 q!us1u5 5r6c|j|jdk(ry|jr|j|S|j |dks||jkDr |j}|jj |}|s|r|j |S|j:|xjt|zc_|js|j |S)zvRead with at most one underlying system call. If at least one byte is buffered, return that instead. rr6r)rRrhrn_read1_chunkedrpread1r~r=)rArBresults r)rzHTTPResponse.read1s 77?dllf4 <<&&q) ) ;; "AT[[ Aq!!      [[ $ KK3v; &K;;  " r6c|j|jdk(ry|jr|j|S|jj |S)Nrr6)rRrhrn _peek_chunkedpeek)rArBs r)rzHTTPResponse.peeksE 77?dllf4 <<%%a( (ww||Ar6c|j|jdk(ry|jrt||S|j |dks||j kDr |j }|jj |}|s|r|j |S|j :|xj t|zc_|j s|j |S)Nrr6r)rRrhrnrrOrpr~r=)rAlimitrrs r)rOzHTTPResponse.readlines 77?dllf4 <<7#E* * ;; " UT[[5HKKE!!%(%      [[ $ KK3v; &K;;  " r6c|j}||dk(ryd|cxkr|ksn|}|jj|}|xjt |zc_|s t d|Sr)rrRrror=r )rArBrors r)rzHTTPResponse._read1_chunkedsj))+  aQ$*$Aww}}Q 3t9$ % % r6c |j}|y|jj|d|S#t$rYywxYw)Nr6)rr rRr)rArBros r)rzHTTPResponse._peek_chunkedsP --/J  ww||J' 44   s 3 ??c6|jjSr)rRfilenors r)rzHTTPResponse.filenosww~~r6c|j t|jj|xs|}t|ts t |ds|Sdj |S)axReturns the value of the header matching *name*. If there are multiple matching headers, the values are combined into a single string separated by commas and spaces. If no matching header is found, returns *default* or None if the *default* is not specified. If the headers are unknown, raises http.client.ResponseNotReady. __iter__z, )rSrget_all isinstanceryhasattrrX)rAr'defaultrSs r) getheaderzHTTPResponse.getheadersW << "$ $,,&&t,7 gs #77J+GN99W% %r6ct|j tt|jjS)z&Return list of (header, value) tuples.)rSrlistrrs r) getheaderszHTTPResponse.getheaderss- << "$ $DLL&&())r6c|SrrJrs r)rzHTTPResponse.__iter__ s r6c|jS)ajReturns an instance of the class mimetools.Message containing meta-information associated with the URL. When the method is HTTP, these headers are those returned by the server at the head of the retrieved HTML page (including Content-Length and Content-Type). When the method is FTP, a Content-Length header will be present if (as is now usual) the server passed back a file length in response to the FTP retrieval request. A Content-Type header will be present if the MIME type can be guessed. When the method is local-file, returned headers will include a Date representing the file's last-modified time, a Content-Length giving file size, and a Content-Type containing a guess at the file's type. See also the description of the mimetools module. )rSrs r)infozHTTPResponse.infos*||r6c|jS)aZReturn the real URL of the page. In some cases, the HTTP server redirects a client to another URL. The urlopen() function handles this transparently, but in some cases the caller needs to know which URL the client was redirected to. The geturl() method can be used to get at this redirected URL. )rtrs r)geturlzHTTPResponse.geturl&s xxr6c|jS)zuReturn the HTTP status code that was sent with the response, or None if the URL is not an HTTP URL. )rlrs r)getcodezHTTPResponse.getcode2s {{r6)rNNr))"rGrHrIrurrrr~rrrrrrrrrrrrrrrrOrrrrrrrrr __classcell__rs@r)rrs#<'BF#P: #  &P D 0;(:0I6&"  5 &(* . r6rctj}|dk(r|jdg|jd|_|S)Nrzhttp/1.1T)ssl_create_default_https_contextset_alpn_protocolspost_handshake_auth) http_versioncontexts r)_create_https_contextr:sC//1Gr""J<0"".&*# Nr6c eZdZdZdZeZeZdZ dZ e dZ e dZ dejddfd Zd"d Zd Zd Zd ZdZdZdZdZdZdZdZd#dZ d$dZdZdZdZ dZ!dZ"d%dddZ#difdddZ$d Z%d!Z&y)&rrzHTTP/1.1r;rc6t|tjS)zFTest whether a file-like object is a text or a binary stream. )rr TextIOBase)streams r) _is_textIOzHTTPConnection._is_textIOQs&"--00r6c||jtvryyt|dry t|}|jS#t $rYnwxYwt |tr t|Sy)aGet the content-length based on the body. If the body is None, we set Content-Length: 0 for methods that expect a body (RFC 7230, Section 3.3.2). We also set the Content-Length for any method if the body is a str or bytes-like object and not a file. Nrr) upper_METHODS_EXPECTING_BODYrrnbytes TypeErrorrryr=)bodyrsmvs r)_get_content_lengthz"HTTPConnection._get_content_lengthWsq <||~!88 4  D!B99     dC t9 sA A  A N cR||_||_||_d|_g|_d|_t |_d|_d|_ d|_ i|_ d|_ |j||\|_|_|j!|jt"j$|_yr)timeoutsource_address blocksizerr_buffer_HTTPConnection__response_CS_IDLE_HTTPConnection__staterh _tunnel_host _tunnel_port_tunnel_headers_raw_proxy_headers _get_hostporthostport_validate_hostsocketcreate_connection_create_connection)rArrr r rs r)ruzHTTPConnection.__init__ws ,"      !"&!%!3!3D$!?DI DII&#)":":r6c|jr td|j||\|_|_|r|j |_n|j jtd|j DsI|jjdjd}d||jfz|j d<yy)aSet up host and port for HTTP CONNECT tunnelling. In a connection that uses HTTP CONNECT tunnelling, the host passed to the constructor is used as a proxy server that relays all communication to the endpoint passed to `set_tunnel`. This done by sending an HTTP CONNECT request to the proxy server when the connection is established. This method must be called before the HTTP connection has been established. The headers argument should be a mapping of extra HTTP headers to send with the CONNECT request. As HTTP/1.1 is used for HTTP CONNECT tunnelling request, as per the RFC (https://tools.ietf.org/html/rfc7231#section-4.3.6), a HTTP Host: header must be provided, matching the authority-form of the request target provided as the destination for the CONNECT request. If a HTTP Host: header is not provided via the headers argument, one is generated and transmitted automatically. z.Can't set up tunnel for established connectionc3BK|]}|jdk(yw)rNr<).0headers r) z,HTTPConnection.set_tunnel..sO:N6<<>V+:Nsidnaasciiz%s:%dHostN) rr RuntimeErrorrrrcopyrclearanyrrY)rArrrS encoded_hosts r) set_tunnelzHTTPConnection.set_tunnels, 99OP P/3/A/A$/M,4, #*<<>D  & & (O$:N:NOO,,33F;BB7KL+2d//61,1D  (Pr6cH|K|jd}|jd}||kDr t||dzd}|d|}n |j}|r|ddk(r |ddk(r|dd}||fS#t$r/||dzddk(r |j}nt d||dzdzYdwxYw) Nr:]r;rxznonnumeric port: '%s'r[r)rfindrr} default_portr )rArrrjs r)rzHTTPConnection._get_hostports < 3A 3A1uOtAaCDz?D BQx(( DGsNtBx3":Dd|"OAaCDzR'#00()@4!:)MNNOsA))5B! B!c||_yr)rg)rAlevels r)set_debuglevelzHTTPConnection.set_debuglevels r6c.d|vr|ddk7rd|zdzS|S)N:r[r/r0rJ)rAips r) _wrap_ipv6zHTTPConnection._wrap_ipv6s( 2:"Q%7*"9t# # r6ctj|jrtd|jd|j |jj d|j |jj dfz}|g}|jjD]o\}}|j d}|j d}t|std|t|rtd||jd||fzq|jd |jd j|~|j|j |j" } |j%\}} } t'|j(|_|j,d kDr+|j*D]}t/d |j1| t2j4j6k7r/|j9t;d| d| j= |j9y#|j9wxYw)Nz-Tunnel host can't contain control characters sCONNECT %s:%d %s r$r%rInvalid header name Invalid header value s%s: %s rMr6rsrrzTunnel connection failed:  )!_contains_disallowed_url_pchar_researchrr}r:rr _http_vsn_strrr_is_legal_header_name_is_illegal_header_valuer@sendrXresponse_classrrrhrrTrRrrgrzrYhttp HTTPStatusOKrOSErrorr) rAconnectrSr"r header_bytes value_bytesresponserkrmessages r)_tunnelzHTTPConnection._tunnels , 3 3D4E4E F $ 1 145 5) OOD--44V< =       % %g .-00)!11779MFE!==3L,,y1K(6 \!KLL' 4 k!KLL NN=L++FF G: w #((7#$ &&tyy&F '/'<'<'> $WdG&3HKK&@D #""55F)V]]_56t)))  :4&'--/ARSTT* NN HNN s 4B4H::I cH|jt|jSdS)z Returns a dictionary with the headers of the response received from the proxy server to the CONNECT request sent to set the tunnel. If the CONNECT request was not sent, the method returns None. N)rr`rs r)get_proxy_response_headersz)HTTPConnection.get_proxy_response_headerss/&&2  7 7 8  r6ctjd||j|j|j |j|jf|j |j |_ |jjtjtjd|jr|j!yy#t$r(}|jtjk7rYd}~Jd}~wwxYw)z3Connect to the host and port specified in __init__.zhttp.client.connectr;N)sysauditrrrr r rr setsockoptr IPPROTO_TCP TCP_NODELAYrJerrno ENOPROTOOPTrrPrAes r)rKzHTTPConnection.connects 'tyy$))D++ YYtyy !4<<1D1DF   II !3!3V5G5G K    LLN   ww%+++, s09C C8C33C8ct|_ |j}|rd|_|j|j}|rd|_|jyy#|j}|rd|_|jwwxYw)z(Close the connection to the HTTP server.N)rrrrrr)rArrrNs r)rzHTTPConnection.closesr  !99D   H"& H"& s %A(Bc|j'|jr|jn t|jdkDrt dt |t|dr|jdkDr t d|j|}|r|jdkDr t d|j|jx}rc|r|jd}tjd|||jj||j|jx}rcytjd|| |jj|y#t$r`t!|t"j$j&r$|D]}|jj|Yytd t)|zwxYw) zSend `data' to the server. ``data`` can be a string object, a bytes object, an array object, a file-like object that supports a .read() method, or an iterable object. Nrzsend:rzsending a readableencoding file using iso-8859-1rVzhttp.client.sendz9data should be a bytes-like object or an iterable, got %r)rr auto_openrKrrgrzr{rrrrrrTrUsendallrr collectionsabcIterabletype)rAr&r datablockds r)rEzHTTPConnection.send"s~ 99 ~~ "n$ ??Q  '4: & 4 "*+__T*F$//A-67#yy88)8 ) 0 0 >I ,dI> !!), $yy88)8  $dD1 G II  d # G$  8 89AII%%a( !9;?:!FGG  GsE AG 1G c:|jj|y)zuAdd a line of output to the current request buffer. Assumes that the line does *not* end with \r\n. N)rr@)rArs r)_outputzHTTPConnection._outputGs Ar6c#@K|jdkDr td|j|}|r|jdkDr td|j|jx}r6|r|j d}||j|jx}r5yyw)Nrzreading a readabler_rV)rgrzrrrr)rArrrfs r)_read_readablezHTTPConnection._read_readableNs ??Q  & '* doo) 2 3#==88i8%,,\: O$==88i8s BBBFc|jjddj|j}|jdd=|j||t |dr|j |}n t ||f}|D]e}|s|jdkDr td |r3|jdk(r$t|d d jd |zdz}|j|g|r"|jdk(r|jd yyyy#t$r4 t|}n$#t$rtdt|zwxYwYwxYw) zSend the currently buffered request and clear the buffer. Appends an extra \r\n to the buffer. A message_body may be specified, to be appended to the request. )r6r6rMNrzAmessage_body should be a bytes-like object or an iterable, got %rrzZero length chunk ignoredrXz r%s0 )rextendrXrErrkrriterrergrz _http_vsnr=r)rA message_bodyencode_chunkedrichunkschunks r) _send_outputzHTTPConnection._send_outputYs` J'll4<<( LLO #  #|V,,,\:- |,+_F*9:!dnn&:"5z!nD188AEI!"E %  $..B"6 ,'#7~O $!>>!%l!3$>')H*.|*<)=>>>>s*8 D E D,+E,!E  EEcz|jr!|jjrd|_|jtk(r t|_nt |j|j |||_|xsd}|j||d|d|j}|j|j||jdk(r&|s d}|jdrt|\}}}}}|r. |jd}|j#d t%|n|j&r|j&} |j(} n|j*} |j,} | jd} |j/| } d | vr t%| } | |j0k(r|j#d | n(| j3d} |j#d | d | |s|j#d d yyy#t $r|jd}Y wxYw#t $r| jd} YwxYw) a`Send a request to the server. `method' specifies an HTTP request method, e.g. 'GET'. `url' specifies the object being requested, e.g. '/index.html'. `skip_host' if True does not add automatically a 'Host:' header `skip_accept_encoding' if True does not add automatically an 'Accept-Encoding:' header N/r?rrxrGr%r$r&r:zAccept-Encodingidentity)rrrr_CS_REQ_STARTEDr_validate_methodrh_validate_pathrBri_encode_requestrpr2rrr putheaderr5rrrrr:r1rY) rArsrt skip_hostskip_accept_encodingrequestnetlocnil netloc_encrrhost_encs r) putrequestzHTTPConnection.putrequests ??t779"DO* <<8 #*DL#DLL1 1 f% jS C &T-?-?@ T))'23 >>R >>&)19#.Cc3;%+]]7%; NN6+t000vx8#+??7#;v(D/IJ(0*=( c.;%+]]6%: ;.7#';;v#67s$?G<*H<HHH:9H:c$|jdS)Nr%)r)rArs r)r|zHTTPConnection._encode_requests~~g&&r6crtj|}|r td|d|jdy)z&Validate a method name for putrequest.z)method can't contain control characters.  (found at least )N)$_contains_disallowed_method_pchar_rerAr}group)rArsmatchs r)rzzHTTPConnection._validate_methodsI5;;FC ?zJ'',{{}&7q:; ; r6crtj|}|r td|d|jdy)zValidate a url for putrequest.&URL can't contain control characters. rrNr@rAr r)rArtrs r)r{zHTTPConnection._validate_pathsL288= EcWM005 /@CD D r6crtj|}|r td|d|jdy)z9Validate a host so it doesn't contain control characters.rrrNr)rArrs r)rzHTTPConnection._validate_host#sL288> EdXN005 /@CD D r6c|jtk7r tt|dr|j d}t |st d|t|}t|D]r\}}t|dr|j d||<n-t|trt|j d||<t||sct d||dj|}|dz|z}|j|y) zkSend a request header line to the server. For example: h.putheader('Accept', 'text/html') rr%r<rr=s s: N)rryrrrrCr}r enumeraterrryrDrXri)rAr"valuesr one_valuers r)r}zHTTPConnection.putheader+s <.[s )rrrrrrgrFrrrhrConnectionErrorrrqrjr)rArNs r) getresponsezHTTPConnection.getresponses  ??t779"DO" <<< '4??"4<<0 0 ??Q **499doo26,,+@H**499T\\*JH   &&(2 22#DL"" O#+O#     NN  s$ D$=EE$D??EE)NN)NF)FFr)'rGrHrIrprBrrF HTTP_PORTr1r`rg staticmethodrr r_GLOBAL_DEFAULT_TIMEOUTrur,rr5r:rPrRrKrrErirkrurr|rzr{rr}rrrrrJr6r)rrGsIM!NLIJ11 >#'0N0N $;."1H(  'R    !#GJ 4(l16(-}~';DD8 Ge G)-bG$G ,=\=r6rcReZdZdZeZdejddddfd ZfdZ xZ S)HTTPSConnectionz(This class allows communication via SSL.Nr )r r rrcrtt| ||||||t|j}||_y)N)r)rrrurrp_context)rArrr r rrrs r)ruzHTTPSConnection.__init__sB /4 1$g2@ >$($$ $ S Sr6rc eZdZy)rNrGrHrIrJr6r)rrs r6rc eZdZy)rNrrJr6r)rrr6rc eZdZy)r NrrJr6r)r r rr6r ceZdZdZy)rc"|f|_||_yr)argsrk)rArks r)ruzUnknownProtocol.__init__sH  r6NrGrHrIrurJr6r)rrsr6rc eZdZy)r NrrJr6r)r r rr6r c eZdZy)r NrrJr6r)r r rr6r c2eZdZddZdZej Zy)r Nc0|f|_||_||_yr)rpartialexpected)rArrs r)ruzIncompleteRead.__init__sH    r6c|jd|jz}nd}d|jjt|j|fzS)Nz, %i more expectedrxz%s(%i bytes read%s))rrrGr=rr[s r)__repr__zIncompleteRead.__repr__sK == $$t}}4AA$(?(?(+DLL(91(>> >r6r)rGrHrIrurr"__str__rJr6r)r r s!>nnGr6r c eZdZy)r NrrJr6r)r r rr6r c eZdZy)rNrrJr6r)rrrr6rc eZdZy)rNrrJr6r)rrrr6rc eZdZy)rNrrJr6r)rrrr6rceZdZdZy)rc<|s t|}|f|_||_yr)r{rrErs r)ruzBadStatusLine.__init__s:DE  r6NrrJr6r)rrsr6rceZdZdZy)rcBtj|dt|fzy)Nz&got more than %d bytes when reading %s)rrurP)rA line_types r)ruzLineTooLong.__init__!s"t%M(0)'<&= >r6NrrJr6r)rr s>r6rceZdZdZy)rcbtj|dtj|g|i|y)Nrx)rruConnectionResetError)rAposkws r)ruzRemoteDisconnected.__init__&s*tR(%%d7S7B7r6NrrJr6r)rr%s8r6r)r&)Ir email.parserrZ email.messagerYrGrrerrTcollections.abcrb urllib.parser__all__rrrjrryrglobalsupdaterH __members__rphraserrPrQrcompile fullmatchrCrArDr@rrr*rr5rOMessager8rTr`rbBufferedIOBaserrrrrr@ ImportError Exceptionrrr rr r r r rrrrrrrr)vs0r)rsDL !     #  ,,-#'//"="="D"D"F G"FQQ["F G   8# #67AA%2::&CDKK%/BJJ/@$A!(2rzz-'@$3 E%%--''<$.9 @)0v2$$vr } } ~!&S.S8 NN$% I  =   m  m  M  ]  m  /  .  . M>-> 8-}8 - Hx*  s H#%H((H0/H0PK]+3llcookiejar.cpython-312.opt-2.pycnu[ ֦i~.h gdZddlZddlZddlZddlZddlZddlZddlZddl Z ddl Z ddl mZdZdadZdZdZee j*j,Zej0dZd Zd Zd Zd Zd ZgdZgdZ e Dcgc]}|jCc}Z"dJdZ#dJdZ$dddddZ%ej0dejLZ'dZ(dZ)ej0dejLZ*ej0dejVejLzZ,ej0dejZejLzZ.dZ/ej0dejZejLzZ0dZ1dZ2ej0dZ3ej0dZ4ej0dZ5ej0d Z6d!Z7ej0d"Z8d#Z9d$Z:d%Z;ej0d&ejLZd)Z?d*Z@ej0d+ejLZAd,ZBd-ZCd.ZDd/ZEd0ZFej0d1ZGd2ZHd3ZId4ZJd5ZKGd6d7ZLGd8d9ZMGd:d;eMZNd<ZOGd=d>ZPGd?d@ZQGdAdBeRZSGdCdDeQZTdEZUGdFdGeTZVGdHdIeTZWycc}w)K)Cookie CookieJar CookiePolicyDefaultCookiePolicy FileCookieJar LWPCookieJar LoadErrorMozillaCookieJarN)timegmFcjtsytsddl}|jdatj|S)Nr zhttp.cookiejar)debugloggerlogging getLogger)argsrs '/usr/lib64/python3.12/http/cookiejar.py_debugr,s.  ""#34 << HTTPOnlyz #HttpOnly_z#( Netscape)? HTTP Cookie FilezQa filename was not supplied (nor was the CookieJar instance initialised with one)zr# Netscape HTTP Cookie File # http://curl.haxx.se/rfc/cookie_spec.html # This is a generated file! Do not edit. cddl}ddl}ddl}|j}|j d||j }|j d|zdy)Nr zhttp.cookiejar bug! %s) stacklevel)iowarnings tracebackStringIO print_excgetvaluewarn)rrrfmsgs r_warn_unhandled_exceptionr"BsF#" A a **,C MM+c1aM@ric|dd\}}}}}}|tk\rPd|cxkrdkrEnyd|cxkrdkr7nyd|cxkrdkr)nyd|cxkrdkrnyd|cxkrdkr t|Syy) N r ;=) EPOCH_YEARr )ttyearmonthmdayhourminsecs r_timegmr3Qs(*2A%D%tS#  !u"2"2 :;db db !C~2~56NNbz5Cr)MonTueWedThuFriSatSun) JanFebMarAprMayJunJulAugSepOctNovDeccR |/tjjtj}n/tjj|tj}d|j|j |j |j|j|jfzS)Ntzz%04d-%02d-%02d %02d:%02d:%02dZ) datetimenowUTC fromtimestampr-r.dayr0minutesecondtdts r time2isozrT^s  y    " "hll " 3    , ,Q8<< , @ + 266277BIIryy/B BBrc |/tjjtj}n/tjj|tj}dt|j |j t|jdz |j|j|j|jfzS)NrHz#%s, %02d-%s-%04d %02d:%02d:%02d GMTr%) rJrKrLrMDAYSweekdayrNMONTHSr.r-r0rOrPrQs r time2netscaperYqs  y    " "hll " 3    , ,Q8<< , @ 0 RZZ\BFFF288A:$6 "))RYY40 00r)GMTrLUTZz^([-+])?(\d\d?):?(\d\d)?$cd}|tvrd}|Stj|}|redt|j dz}|j dr |dt|j dzz}|j ddk(r| }|S)Nr ir<r%-) UTC_ZONES TIMEZONE_REsearchintgroup)rIoffsetms roffset_from_tz_stringrhs F Y M   r " C O+Fwwqz"s1771:"66wwqzS   Mrc t|}|tjkDry tj |j dz}|d}|d}|d}t|}t|}t|}t|}|dkr\tjtjd}|dz} |} ||z| z }| | z } t| dkDr| dkDr|dz}n|dz }t|||||||f} | '|d}|j}t|} | y| | z } | S#t $r5 t|}n#t $rYYywxYwd|cxkrdkrnYy|}nYyYwxYw)Nr%r&r id2rL) rdrJMAXYEAR MONTHS_LOWERindexlower ValueErrortime localtimeabsr3upperrh) rNmonyrhrr1r2rIimoncur_yrrgtmprRrfs r _str2timer{s RB H     -a/ z2 {!C {!C c(C RB c(C c(C Dy ,Q/ SL &[1_ G q6B;1u28bCx" S#r3R01A} :B XXZ&r* > J H[   s8D   ??C  s;&D E' D32E3 E<E?EEEEzV^[SMTWF][a-z][a-z], (\d\d) ([JFMASOND][a-z][a-z]) (\d\d\d\d) (\d\d):(\d\d):(\d\d) GMT$z+^(?:Sun|Mon|Tue|Wed|Thu|Fri|Sat)[a-z]*,?\s*a^ (\d\d?) # day (?:\s+|[-\/]) (\w+) # month (?:\s+|[-\/]) (\d+) # year (?: (?:\s+|:) # separator before clock (\d\d?):(\d\d) # hour:min (?::(\d\d))? # optional seconds )? # optional clock \s* (?: ([-+]?\d{2,4}|(?![APap][Mm]\b)[A-Za-z]+) # timezone \s* )? (?: \(\w+\) # ASCII representation of timezone in parens. \s* )?$c 0 tj|}|r|j}tj |dj dz}t |d|t |dt |dt |dt|df}t|S|j}tjd|d}dgdz\}}}}}} } tj|}||j\}}}}}} } nyt|||||| | S) Nr%rr r^)STRICT_DATE_RErcgroupsrmrnrordfloatr3lstrip WEEKDAY_REsubLOOSE_HTTP_DATE_REr{) textrggrur,rNrvrwr1r2rIs r http2timers: d#A HHJ  1.2!A$ic!A$i!A$iQqTE!A$K1r{ ;;=D >>"dA &D'+VAX"Cb"c3 !!$'A})*&S"b#sB S#r2sC 44ra^ (\d{4}) # year [-\/]? (\d\d?) # numerical month [-\/]? (\d\d?) # day (?: (?:\s+|[-:Tt]) # separator before clock (\d\d?):?(\d\d) # hour:min (?::?(\d\d(?:\.\d*)?))? # optional seconds (and fractional) )? # optional clock \s* (?: ([-+]?\d\d?:?(:?\d\d)? |Z|z) # timezone (Z is "zero meridian", i.e. GMT) \s* )?$c  |j}dgdz\}}}}}}}tj|}||j\}}}}}}}} nyt |||||||S)Nr)r ISO_DATE_RErcrr{) rrNrurvrwr1r2rIrg_s riso2timer2s  ;;=D'+VAX"Cb"c3 4 A}-.HHJ)Cb#sB S#r2sC 44rcj |jd\}}|jd||j|dzS)Nr )spanstring)matchstartends r unmatchedrSs73AJE3 <<  ST 2 22rz^\s*([^=\s;,]+)z&^\s*=\s*\"([^\"\\]*(?:\\.[^\"\\]*)*)\"z^\s*=\s*([^\s;,]*)z\\(.)c g}|D]^}|}g}|r?tj|}|rt|}|jd}tj|}|r3t|}|jd}t j d|}nFtj|}|r-t|}|jd}|j}nd}|j||fnd|jjdr)|jdd}|r|j|g}ntjdd|\}} |}|r?|sN|j|a|S)Nr%z\1,z^[=\s;]*r)HEADER_TOKEN_RErcrreHEADER_QUOTED_VALUE_REHEADER_ESCAPE_RErHEADER_VALUE_RErstripappendr startswithresubn) header_valuesresultr orig_textpairsrgnamevaluenon_junk nr_junk_charss rsplit_header_wordsr\sM+ZF &&t,A |wwqz*11$7$QE'..t4A(| !  % !% dE]+))#.{{}QR(&--.+-''+r4*H'- ?@ &--&GH Mr([\"\\])c, g}|D]|}g}|D]P\}}|8tjd|stjd|}d|z}|d|}|j |R|s]|j dj |~dj |S)Nz^\w+$\\\1z"%s"=; , )rrcHEADER_JOIN_ESCAPE_RErrjoin)listsheadersrattrkvs rjoin_header_wordsrs GDAq}yy1--11'1=A A !$ KKN   $0 99W rc^|jdr|dd}|jdr|dd}|S)N"r%)rendswithrs r strip_quotesrs5 sABx }}SCRy Krc d}g}|D]}g}d}t|jdD]\}}|j}|jd\}} } |j}|s|dk(rnuE| r| jnd} |dk7rF|j } | |vr| }|dk(r| t | } d}n|dk(r| t t | } |j|| f|s|s|jd |j||S) N)expiresdomainpathsecureversionportmax-ageF;rr rTr)r0) enumeratesplitstrip partitionrorrr) ns_headers known_attrsr ns_headerr version_setiiparamkeysepvallcs rparse_ns_headersrs$ 1KF  #9??3#78IBKKME!OOC0MCc))+C7"%#))+$CQwYY[$C)#*3/"&KI%' S(9: LL#s $=9@  -. MM% W Z Mrz\.\d+$c` tj|ry|dk(ry|ddk(s|ddk(ryy)NFrr .rTIPV4_RErcrs ris_HDNrs;4 ~~d rz Aw#~bS rc |j}|j}||k(ryt|sy|j|}|dk(s|dk(ry|jdsyt|ddsyy)NTFrr rr%)rorrfindr)ABis r domain_matchr&sr,  A  AAv !9  ABw!q& <<  !AB%= rc2 tj|ryyNFTrrs rliberal_is_HDNrMs ~~d rc |j}|j}t|r t|s||k(ryy|jd}|r|j|ry|s||k(ryy)NTFr)rorrr)rr initial_dots ruser_domain_matchrWsh  A  A 1 ."3 6,,s#Kqzz!} 16 rz:\d+$c |j}tjj|d}|dk(r|j dd}t j d|d}|jS)Nr%rHost) get_full_urlurllibparseurlparse get_header cut_port_rerro)requesturlhosts r request_hostrlsi    C <<  %a (D rz!!&"- ??2tQ 'D ::<rc8 t|x}}d|vr|dz}||fS)Nr.local)r)rerhnreq_hosts reff_request_hostr|s4 #7++D8 ((" T>rc |j}tjj|}t |j }|j dsd|z}|S)N/)rrrurlsplit escape_pathrr)rrpartsrs r request_pathrsO@    C LL ! !# &E uzz "D ??3 Tz Krc|j}|jd}|dk\r||dzd} t||St }|S#t$rt d|YywxYw)N:r r%znonnumeric port: '%s')rfindrdrprDEFAULT_HTTP_PORT)rrrrs r request_portrsl <rc|jd}nd|jz}|j|z|jz}|j|jd|j}n |j}d|d|dS)Nrrrz)rrrrr)r plimit namevalues r__str__zCookie.__str__0sd 99 "adii-a a$))+ :: !#'99djj9I I'0%88rc\g}dD]-}t||}|j|dt|/|jdt|jz|jdt|jz|j j ddj|dS)N)rrrrrrrrrrrrrrrrzrest=%sz rfc2109=%s(r))getattrrreprrr __class____name__r)r rrrs r__repr__zCookie.__repr__:sD 4&D KK4d4 5 ITZZ 001 L4 #556>>22DIIdODDr)Fr) r: __module__ __qualname__r"r%r)r+r-r3r;rrrrs16(%T"-! 9 Errc&eZdZ dZdZdZdZy)rc trNotImplementedErrorr cookiers rset_okzCookiePolicy.set_okRs "##rc trrArCs r return_okzCookiePolicy.return_ok[sO!##rc yNTr>)r rrs rdomain_return_okzCookiePolicy.domain_return_ok_  rc yrIr>)r rrs rpath_return_okzCookiePolicy.path_return_okdrKrN)r:r<r=rErGrJrMr>rrrrIs$$ rrc eZdZ dZdZdZdZeezZdddddddddedddf d Zd Z d Z d Z d Z dZ dZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZy) rr%rr}r NTF)httpswssc ||_||_||_||_||_||_| |_| |_| |_| |_ | |_ |t||_ nd|_ | t|}||_ y)Nr>)netscaperfc2965rfc2109_as_netscape hide_cookie2 strict_domainstrict_rfc2965_unverifiablestrict_ns_unverifiablestrict_ns_domainstrict_ns_set_initial_dollarstrict_ns_set_pathsecure_protocolstuple_blocked_domains_allowed_domains)r blocked_domainsallowed_domainsrRrSrTrUrVrWrXrYrZr[r\s rr"zDefaultCookiePolicy.__init__ts P   #6 (*+F(&<# 0,H)"4 0  &$)/$:D !$&D !  &#O4O /rc |jSr)r^r s rr`z#DefaultCookiePolicy.blocked_domainssB$$$rc& t||_yr)r]r^)r r`s rset_blocked_domainsz'DefaultCookiePolicy.set_blocked_domainss2 %o 6rcB|jD]}t||syyr)r^r)r rblocked_domains r is_blockedzDefaultCookiePolicy.is_blockeds$"33N 84rc |jSr)r_rcs rraz#DefaultCookiePolicy.allowed_domainssK$$$rc. | t|}||_yr)r]r_)r ras rset_allowed_domainsz'DefaultCookiePolicy.set_allowed_domainss;  &#O4O /rc\|jy|jD]}t||syyr)r_r)r rallowed_domains ris_not_allowedz"DefaultCookiePolicy.is_not_alloweds3  ("33N 84rc td|j|jdD]}d|z}t||}|||ryy)N - checking cookie %s=%s)r verifiabilityrrrrset_ok_FTrrrr7r rDrnfn_namefns rrEzDefaultCookiePolicy.set_oksS )6;; ENAkGw'Bfg& N rc|j"td|j|jy|jdkDr|js tdy|jdk(r|j s tdyy)Nz0 Set-Cookie2 without version attribute (%s=%s)Fr $ RFC 2965 cookies are switched off$ Netscape cookies are switched offT)rrrrrSrRrCs rset_ok_versionz"DefaultCookiePolicy.set_ok_versionsh >> ! E;;  . >>A dll 9 : ^^q  9 :rc|jrYt|rN|jdkDr|jr t dy|jdk(r|j r t dyyNr z> third-party RFC 2965 cookie during unverifiable transactionFz> third-party Netscape cookie during unverifiable transactionT unverifiablerrrWrrXrCs rset_ok_verifiabilityz(DefaultCookiePolicy.set_ok_verifiabilitys]   N7$;~~!d&F&F891$)D)D89rc|jdk(r>|jr2|jjdrt d|jyy)Nr $z' illegal name (starts with '$'): '%s'FT)rrZrrrrCs r set_ok_namezDefaultCookiePolicy.set_ok_names? NNa D$E$E KK " "3 ' >A dll 9 : ^^q  9 :rc|jrYt|rN|jdkDr|jr t dy|jdk(r|j r t dyyr}r~rCs rreturn_ok_verifiabilityz+DefaultCookiePolicy.return_ok_verifiabilitycs]   N7$;~~!d&F&F%&1$)D)D%&rcd|jr$|j|jvr tdyy)Nz( secure cookie with non-secure requestFT)rtyper\rrCs rreturn_ok_securez$DefaultCookiePolicy.return_ok_secureos) ==W\\1F1FF = >rcR|j|jr tdyy)Nz cookie expiredFT)r-_nowrrCs rreturn_ok_expiresz%DefaultCookiePolicy.return_ok_expiresus#   TYY ' & 'rc|jrNt|}|d}|jjdD] }||k(s ytd||jyy)Nrrz0 request port %s does not match cookie port %sFT)rrrrrs rreturn_ok_portz"DefaultCookiePolicy.return_ok_port{sb ;;#G,H[[&&s+= ,I.rct|\}}|j}|r|jdsd|z}n|}|jdk(r6|j|j zr|j s||k7r tdy|jdkDrt||std||y|jdk(r"d|zj|std||yy)Nrr zQ cookie with unspecified domain does not string-compare equal to request domainFzQ effective request-host name %s does not domain-match RFC 2965 cookie domain %sz; request-host %s does not match Netscape cookie domain %sT) rrrrrYDomainStrictNonDomainrrrr)r rDrrrr dotdomains rreturn_ok_domainz$DefaultCookiePolicy.return_ok_domains)'2$ &++C0f II NNa   " "T%?%? ?''FdN - . >>A l4&@ /04f > >>Q D':':9'E !6 +rclt|\}}|jdsd|z}|jdsd|z}|r|jdsd|z}n|}|j|s|j|sy|j|r t d|y|j |r t d|yy)NrFrrT)rrrrhrrn)r rrrrrs rrJz$DefaultCookiePolicy.domain_return_oks*'2$""3'8|Hs#t8D &++C0f II!!), i0H ??6 " 7 @   v & ;V Drctd|t|}t|}||k(ry|j|r|j ds |||dzdk(rytd||y)Nz- checking cookie path=%sTrr%z %s does not path-match %sF)rrrrr)r rrrpathlens rrMz"DefaultCookiePolicy.path_return_oksj*D1(d) t !!$'}}S!Xggai%@C%G,h=r)r:r<r=rrr DomainLiberal DomainStrictr"r`rerhrarkrnrEr{rrrrrrGrrrrrrrJrMr>rrrrjsLM%&;;L"&t%)#$-1(-"/.3$)"2!0F%7 %0 &   :x*$   64 rrc#K t|jD]-}d} |jd}t|Ed{|r*|/y7#t$rYwxYwwr)listvaluesitems deepvaluesAttributeError)mappingobjs rrrsd3GNN$% ' IIG!# & &I& '    s8 A AAAAA AAAAc eZdZy)AbsentNr:r<r=r>rrrrrrc~eZdZ ejdZejdZejdZejdZejdZ ejdejZ ddZ d Z d Zd Zd Zd ZdZdZdZdZdZdZdZdZddZdZdZdZdZdZdZ y)rz\Wrz\.?[^.]*z[^.]*z^\.+z^\#LWP-Cookies-(\d+\.\d+)Ncj| t}||_tj|_i|_yr)r_policy _threadingRLock _cookies_lock_cookiesr policys rr"zCookieJar.__init__s. >(*F '--/ rc||_yr)rrs r set_policyzCookieJar.set_policys  rcg}|jj||sgStd||j|}|j D]}}|jj ||s ||}|j D]F}|jj||s td+td|j|H|S)Nz!Checking %s for cookies to returnz not returning cookiez it's a match) rrJrrkeysrMrrGr)r rrcookiescookies_by_pathrcookies_by_namerDs r_cookies_for_domainzCookieJar._cookies_for_domains||,,VW=I2F;--/#((*D<<..tW=-d3O)002||--fg>45()v& 3 +rc g}|jjD]#}|j|j||%|Sr)rrextendr)r rrrs r_cookies_for_requestzCookieJar._cookies_for_request s?@mm((*F NN433FGD E+rc |jddd}g}|D]}|j}|sd}|dkDr|jd|z|jQ|jj |jr,|dkDr'|j jd|j}n |j}|j|j|jn |j|jd||dkDs|jr|jd |jz|jjd rB|j}|js|jd r|d d}|jd |z|jyd }|jr|d|jzz}|j||S)Nc,t|jSr)rr)as rz)CookieJar._cookie_attrs..s 3qvv;rT)rreverseFr z $Version=%srrz $Path="%s"rr%z $Domain="%s"z$Portz="%s")sortrrr non_word_rercquote_rerrrrrrrrr) r rrattrsrDrrrr0s r _cookie_attrszCookieJar._cookie_attrss   . = FnnG" Q;LL!89 )  '' 5'A+ ))'6<<@ ||# V[[)  U;<{((LL !;<==++C0#]]F"55))#.!'LL&!89;;*A,,6;;!67LLOQT rc td|jj tt jx|j _|_|j|}|j|}|r2|jds!|jddj||j jrQ|j js;|jds*|D]%}|jdk7s|jddn|jj|j!y#|jjwxYw)Nadd_cookie_headerrrCookie2r%z $Version="1")rracquirerdrqrrrr has_headeradd_unredirected_headerrrSrUrreleaseclear_expired_cookies)r rrrrDs rrzCookieJar.add_cookie_headerLs "# ""$ ),/ ,< R&    & & ( ""$    & & (sCEEEc* g}d}d}|D]}|d\}}d}d} i} i} |ddD]\} } | j}||vs||vr|} | |vr| d} | | vr-| dk(r!| tdd} nw| j} | d k(r|r[| td i| d k(rd} t| } d } |j| z} | |vs| |vr| | d vrtd| zd} n | | | <| | | <| r|j ||| | f|S#t$rtd d} Y5wxYw)N)rr)rrrrrrr commenturlr Fr%Trz% missing value for domain attributerzM missing or invalid value for expires attribute: treating as session cookierz? missing or invalid (non-numeric) value for max-age attribute)rrrz! missing value for %s attribute)rorrdrprr)r  attrs_set cookie_tuples boolean_attrs value_attrs cookie_attrsrr max_age_set bad_cookiestandardr!rrrs r_normalized_cookie_tuplesz#CookieJar._normalized_cookie_tuplesms  + 0 &L&q/KD% KJHD$QR(1WWY$m(;A %!)A==yFG%)  A >" y FG  >"&KF"A A A$!}*< !BBBQFG%) "#HQKDGe)h  $x!> ?Q&T5& 23%)  s C88DDcR|\}}}}|jdt}|jdt}|jdt} |jdt} |jdd} | t| } |jdd} |jdd} |jd d}|jd d}|tur|d k7rd }t |}nFd}t |}|j d }|dk7r| dk(r|d|}n|d|dz}t|dk(rd }|tu}d}|rt|jd}|turt|\}}|}n|jdsd|z}d}| tur(| t|} nd }tjdd | } nd} | turd} d } n2| |jkr# |j|||t#d|||yt%| ||| ||||||| | | |||S#t$rYywxYw#t $rYCwxYw)NrrrrrrFrrrrTrrr r%rz\s+z2Expiring cookie, domain='%s', path='%s', name='%s')r'rrdrprrrrboolrrrrrrclearKeyErrorrr)r tuprrrrr!rrrrrrrrrrrrrrrrs r_cookie_from_cookie_tuplez#CookieJar._cookie_from_cookie_tuplesv'*#eXth/||FF+||FF+,,y&1,,y$/   g,h.,,y%0,,y$/ll<6  v $"*!Nt$D"N(D 3ABwa<8D1:D4yA~ct"/" !%f&7&7&.no_matching_rfc2965ls'#**INNINNJCf,,r)rget_allrdrqrrrSrRr r Exceptionr"rr rrrfilterr) r responserr rfc2965_hdrsns_hdrsrSrRr ns_cookiesrrDrs r make_cookieszCookieJar.make_cookies?sqO--/}b9 //,3(+DIIK(88 DI,,&&<<((gh'I 22"<0';G x !99$W-w8  ) )* 5%FHLFFMM6;; DE&;A-$$7D z*C  % 'G  )+  s$(E E& E#"E#&E>=E>cn |jj ttjx|j_|_|jj ||r|j||jjy#|jjwxYwr) rrrdrqrrrE set_cookierrCs rset_cookie_if_okzCookieJar.set_cookie_if_okvs; ""$ ),/ ,<  |jjy#|jjwxYw)Nzextract_cookies: %sz setting cookie: %s) rrrrrrrErr)r rrrDs rextract_cookieszCookieJar.extract_cookiessO$hmmo6 ""$ )++Hg><<&&vw70&9OOF+?    & & (D   & & (s1B$)B$$Cc |#|| td|j|||=y|| td|j||=y||j|=yi|_y)Nz8domain and path must be given to remove a cookie by namez.domain must be given to remove cookies by path)rpr)r rrrs rrzCookieJar.clears   DL NPP f%d+D1  ~ DFF f%d+   f%DMrc: |jj |D]@}|js|j|j|j |j B |jjy#|jjwxYwr)rrrrrrrr)r rDs rclear_session_cookieszCookieJar.clear_session_cookiesst ""$ )>>JJv}}fkk6;;G    & & (D   & & (sA>3A>>Bcl |jj tj}|D]E}|j|s|j |j |j |jG |jjy#|jjwxYwr) rrrqr-rrrrr)r rKrDs rrzCookieJar.clear_expired_cookiess  ""$ )))+C$$S)JJv}}fkk6;;G    & & (D   & & (s*B3BB3c,t|jSr)rrrcs r__iter__zCookieJar.__iter__s$--((rc$ d}|D]}|dz} |S)Nr r%r>)r rrDs r__len__zCookieJar.__len__s1 FAAdrcg}|D]}|jt|d|jjddj |dSN<[rz]>)rr8r9r:rr rrDs rr;zCookieJar.__repr__s: FAHHT&\2d!^^44diilCCrcg}|D]}|jt|d|jjddj |dSr,)rrr9r:rr/s rr3zCookieJar.__str__s: FAHHS[1d!^^44diilCCrr)NNN)!r:r<r=rcompilerrstrict_domain_re domain_redots_reASCIImagic_rer"rrrrrrrr r rrrr"rr%rr(r*r;r3r>rrrrs "**U#Krzz+&H!rzz+. 8$Ibjj!Grzz6AH$9v%B_BZx '5n ) ) )6 ))&) D Drrc eZdZy)rNrr>rrrrrrrc2eZdZ ddZddZddZ ddZy)rNc tj|||tj|}||_t ||_yr)rr"osfspathfilenamer delayload)r r=r>rs rr"zFileCookieJar.__init__s? 4(  yy*H  irc trrA)r r=ignore_discardignore_expiress rsavezFileCookieJar.saves%!##rc |(|j |j}nttt|5}|j ||||dddy#1swYyxYwr)r=rpMISSING_FILENAME_TEXTopen _really_loadr r=r@rAr s rloadzFileCookieJar.loadsP'  }}(T]]("#899 (^q   a>> J^^s AAc |(|j |j}ntt|jj  t j |j}i|_ |j||| |jjy#t$r ||_wxYw#|jjwxYwr) r=rprDrrrdeepcopyrrHOSErrorr)r r=r@rA old_states rrevertzFileCookieJar.revert s  }}(T]]("#899 ""$ ) dmm4IDM  (NNC    & & (   )      & & (s&B2.BB//B22C)NFNNFF)r:r<r=r"rBrHrMr>rrrrs"@ )$K#49)rrc |j|jfd|jfd|jfg}|j|j d|jf|j r|j d|jr|j d|jr|j d|jr|j d|jr/|j dtt|jf|jr|j d |jr|j d |jf|jr|j d |jft!|j"j%}|D]+}|j |t'|j"|f-|j d t'|j(ft+|gS) Nrrr) path_specN) port_specN) domain_dotN)rNr)rNrrr)rrrrrrrrrrrrTrrrrsortedrrrrr)rDr rrs rlwp_cookie_strrT's ++v|| $ &++  FMM " $A{{&&++)> ? ahh':; ahh':;   !((+?"@ }}ahh/0 ~~qxx(v~~)>?!AB ~~qxx 12 ~~qxxFNN ;< 188\63E3E$FG &,,##% &D  !Sa)*+HHiV^^, -. aS !!rc$eZdZ ddZddZdZy)rc tj}g}|D]B}|s |jr|s|j|r&|jdt |zDdj |dgzS)NzSet-Cookie3: %s r)rqrr-rrTr)r r@rArKr0rDs r as_lwp_strzLWPCookieJar.as_lwp_strPsp iik F!fnn!f&7&7&< HH&)?? @  yyB4  rNc|(|j |j}ntttjtj |tj tjztjzdd5}|jd|j|j||dddy#1swYyxYw)Nwz#LWP-Cookies-2.0 ) r=rprDr;fdopenrEO_CREATO_WRONLYO_TRUNCwriterXrGs rrBzLWPCookieJar.save`s  }}(T]]("#899 YY GGHbjj2;;6CU K   GG( ) GGDOONNC D   s 3CC cJ|j}|jj|sd|z}t|t j}d}d} d} |jx} dk7r| j |s(| t |dj} t| gD]0} | d\} }i}i}| D]}d||< | ddD]A\}}||j}nd}|| vs|| vr|}|| vr |d }|||<3|| vr|||<=|||<C|j}|d }|d }| t|}|d }|d }|j d }t|d| ||d|d|||d|d|d|d|||d|d|}|s|jr |s|j|r |j|3|jx} dk7ryy#t $rt"$rt%td|d wxYw)Nz5%r does not look like a Set-Cookie3 (LWP) format filez Set-Cookie3:)rQrPrRrr)rrrrrrrrr Fr%TrrrrrrrQrRrrPrrrz invalid Set-Cookie3 format file : )readliner7rcrrqrrrrror'rrrr-rrKrr")r r r=r@rAmagicr!rKheaderrrlinedatarrrr!rrrr rrrrrs rrFzLWPCookieJar._really_loadosf }}##E*$%CC. iik. 0 9 .::<'4B.v.CKL)//1.v6D"&q'KD%!HD*&+ + $QR1=!"B!%B+-23F "A - yd!*+HQK+-*+HQK&'DG!) ! A lG lG*"*7"3"&x[F'-'8'8'=$q|T5 y!K.%'7< y!K. {&& | # %A*aii )all3.? OOA&[7 ::<'4B.f   . % '%t-. . .s FG44.H")TTrN)r:r<r=rXrBrFr>rrrrCs ! EJ.rrceZdZ dZddZy)r cttj}tj|jst d|z |jx}dk7r+i}|j t rd|t<|tt d}|jdr|dd}|jj ds|jdk(r|jd\}} } } } } }| dk(} | dk(} | dk(r|} d}|j d}d }| dk(rd} d }td | |dd || || d | | |dd|}|s|jr|s|j|r|j||jx}dk7r*yy#t $rt"$rt%t d |d wxYw)Nz4%r does not look like a Netscape format cookies filerrWr)#r TRUErFTr z%invalid Netscape format cookies file rb)rqNETSCAPE_MAGIC_RGXrrcrrHTTPONLY_PREFIX HTTPONLY_ATTRrrrrrrr-rrKrr")r r r=r@rArKrfr!rrrrrrrrrrs rrFzMozillaCookieJar._really_loadsiik!'' 5F < .::<'4B. ???3*,D'O 4 56D==&tCRyJJL++J7JJLB& 4(M($u F*$4$> 2:!D E$//4  b="G"G1dE!#3[!"" !&!))%!,,s*;"i::<'4B.l   . % '%t-. . .s D>F .F7Nc |(|j |j}ntttjtj |tj tjztjzdd5}|jttj}|D]}|j}|s |jr|s|j|r3|jrd}nd}|j!drd} nd} |j"t%|j"} nd} |j&d} |j(} n|j(} |j&} |j+t,r t.|z}|jdj1|| |j2|| | | gdz dddy#1swYyxYw) NrZr[rlFALSErrrkrW)r=rprDr;r\rEr]r^r_r`NETSCAPE_HEADER_TEXTrqrrr-rrrrrrr%rornrr) r r=r@rAr rKrDrrrrrrs rrBzMozillaCookieJar.save"sz  }}(T]]("#899 YY GGHbjj2;;6CU K   GG( )))+C%&..%&*;*;C*@==6&&f$$S);$+k>>-!&..1G G<<'D"KKE!;;D"LLE..}=,v5FIIv{FKK%we=>3    s D2GG rN)r:r<r=rFrBr>rrr r s>D.L'rr r)X__all__r;rrJrrq urllib.parserurllib.request threadingr http.clienthttpcalendarr r rrrornrclient HTTP_PORTrr2rmrDrrr"r+r3rVrXrormrTrYrar6rbrhr{rIrXrrrrrrrrrrrrrrrrrrrrrrrrr r rrrrrrrrrrrKrrrTrr )r.s0rr~s6 M  #    --.RZZ @A:A 9 4+126% 62 B&0(T = bjj5rxx@  6 p,-/XX7RZZ2BDD288OE RZZ & DD288O)*65pbjj 44")) # $5B3 $$67#$MN#$9:2::h'Sj# ;/2AH "**Y ) %N(bjj288,    $"**9:+ ! F"_E_EDB_,_B "LDLD`4)I4)n"8v.=v.rM}MA;3sJ/PK]WJfWWcookies.cpython-312.opt-1.pycnu[ Wj@T dZddlZddlZddlZgdZdj Zdj Zdj ZGdde Z ejejzd zZ e d zZeed eeeez Dcic]}|d |z c}Zej)ed deddiej*dej,e zj.Zej*dZdZdZej*dj8ZdZdZgdZ gdZ!de e!fdZ"Gdde#Z$dZ%e%dzZ&ej*de%zd ze&zd!zejNejPzZ)Gd"d#e#Z*Gd$d%e*Z+ycc}w)&a% Here's a sample session to show how to use this module. At the moment, this is the only documentation. The Basics ---------- Importing is easy... >>> from http import cookies Most of the time you start by creating a cookie. >>> C = cookies.SimpleCookie() Once you've created your Cookie, you can add values just as if it were a dictionary. >>> C = cookies.SimpleCookie() >>> C["fig"] = "newton" >>> C["sugar"] = "wafer" >>> C.output() 'Set-Cookie: fig=newton\r\nSet-Cookie: sugar=wafer' Notice that the printable representation of a Cookie is the appropriate format for a Set-Cookie: header. This is the default behavior. You can change the header and printed attributes by using the .output() function >>> C = cookies.SimpleCookie() >>> C["rocky"] = "road" >>> C["rocky"]["path"] = "/cookie" >>> print(C.output(header="Cookie:")) Cookie: rocky=road; Path=/cookie >>> print(C.output(attrs=[], header="Cookie:")) Cookie: rocky=road The load() method of a Cookie extracts cookies from a string. In a CGI script, you would use this method to extract the cookies from the HTTP_COOKIE environment variable. >>> C = cookies.SimpleCookie() >>> C.load("chips=ahoy; vienna=finger") >>> C.output() 'Set-Cookie: chips=ahoy\r\nSet-Cookie: vienna=finger' The load() method is darn-tootin smart about identifying cookies within a string. Escaped quotation marks, nested semicolons, and other such trickeries do not confuse it. >>> C = cookies.SimpleCookie() >>> C.load('keebler="E=everybody; L=\\"Loves\\"; fudge=;";') >>> print(C) Set-Cookie: keebler="E=everybody; L=\"Loves\"; fudge=;" Each element of the Cookie also supports all of the RFC 2109 Cookie attributes. Here's an example which sets the Path attribute. >>> C = cookies.SimpleCookie() >>> C["oreo"] = "doublestuff" >>> C["oreo"]["path"] = "/" >>> print(C) Set-Cookie: oreo=doublestuff; Path=/ Each dictionary element has a 'value' attribute, which gives you back the value associated with the key. >>> C = cookies.SimpleCookie() >>> C["twix"] = "none for you" >>> C["twix"].value 'none for you' The SimpleCookie expects that all values should be standard strings. Just to be sure, SimpleCookie invokes the str() builtin to convert the value to a string, when the values are set dictionary-style. >>> C = cookies.SimpleCookie() >>> C["number"] = 7 >>> C["string"] = "seven" >>> C["number"].value '7' >>> C["string"].value 'seven' >>> C.output() 'Set-Cookie: number=7\r\nSet-Cookie: string=seven' Finis. N) CookieError BaseCookie SimpleCookiez;  c eZdZy)rN)__name__ __module__ __qualname__%/usr/lib64/python3.12/http/cookies.pyrrsr rz!#$%&'*+-.^_`|~:z ()/<=>?@[]{}z\%03o"\"\z\\z[%s]+z[\x00-\x1F\x7F]c&td|DS)zhDetects control characters within a value. Supports any type, as header values can be any type. c3XK|]"}tjt|$ywN)_control_character_researchstr).0vs r z)_has_control_character..s!AS$++CF3Ss(*)any)vals r_has_control_characterrs ASA AAr cV| t|r|Sd|jtzdzS)zQuote a string for use in a cookie header. If the string does not need to be double-quoted, then just return the string. Otherwise, surround the string in doublequotes and quote (with a \) special characters. r) _is_legal_key translate _Translatorrs r_quoter$s. {mC( S]];//#55r z\\(?:([0-3][0-7][0-7])|(.))cF|drtt|ddS|dS)N)chrint)ms r_unquote_replacer,s't3qtQ<  t r ct|t|dkr|S|ddk7s|ddk7r|S|dd}tt|S)Nr(rrr&)len _unquote_subr,r#s r_unquoter1sO {c#hl  1v}B3 a)C (# ..r )MonTueWedThuFriSatSun) NJanFebMarAprMayJunJulAugSepOctNovDecc nddlm}m}|}|||z\ }}}} } } } } }d|| ||||| | | fzS)Nr)gmtimetimez#%s, %02d %3s %4d %02d:%02d:%02d GMT)rGrF)future weekdayname monthnamerFrGnowyearmonthdayhhmmsswdyzs r_getdaterUsW! &C-3C&L-A*D%b"b"a 0 OS)E"2D"b" E FFr c eZdZdZdddddddd d d Zd d hZdZedZedZ edZ dZ d!dZ dZ ejZdZdZdZdZdZdZdZd"dZeZdZd!dZd!d Zeej<Zy)#MorselaCA class to hold ONE (key, value) pair. In a cookie, each such pair may have several attributes, so this class is used to keep the attributes associated with the appropriate key,value pair. This class also includes a coded_value attribute, which is used to hold the network representation of the value. expiresPathCommentDomainzMax-AgeSecureHttpOnlyVersionSameSite) rXpathcommentdomainmax-agesecurehttponlyversionsamesiterdrec~dx|_x|_|_|jD]}tj ||dy)Nr)_key_value _coded_value _reserveddict __setitem__)selfkeys r__init__zMorsel.__init__s:6:: :DK$"3>>C   T3 +"r c|jSr)riros rrpz Morsel.key s yyr c|jSr)rjrss rvaluez Morsel.value$s {{r c|jSr)rkrss r coded_valuezMorsel.coded_value(s   r c|j}||jvrtd|t||rtd|d|tj |||yNzInvalid attribute .Control characters are not allowed in cookies r)lowerrlrrrmrn)roKVs rrnzMorsel.__setitem__,s_ GGIDNN";< < !!Q ' NqeSTUVTYZ[ [ q!$r Nc|j}||jvrtd|t||rtd|d|tj |||Sry)r{rlrrrm setdefault)rorprs rrzMorsel.setdefault4sViik dnn $=> > !#s +WZ\_ab btS#..r ct|tstStj ||xrO|j |j k(xr4|j |j k(xr|j|jk(Sr) isinstancerWNotImplementedrm__eq__rjrirkromorsels rrz Morsel.__eq__<sj&&)! ! D&)9 v}},9 V[[(9!!V%8%88 :r ct}tj|||jj|j|Sr)rWrmupdate__dict__rs rcopyz Morsel.copyFs2 FD!t}}- r ci}t|jD]S\}}|j}||jvrt d|t ||rt d|d||||<Utj ||yry)rmitemsr{rlrrr)rovaluesdatarprs rrz Morsel.updateLsV **,HC))+C$..(!C"ABB%c3/!#--0G1SG#=>>DI- D$r c(|j||Sr)r)rors r__ior__zMorsel.__ior__Xs F r c:|j|jvSr)r{rl)ror|s r isReservedKeyzMorsel.isReservedKey\swwyDNN**r c|j|jvrtd|t|std|t |||rtd|d|d|||_||_||_y)NzAttempt to set a reserved key z Illegal key rzr)r{rlrr rrirjrk)rorpr coded_vals rsetz Morsel.set_sw 99;$.. (CIJ JS!#78 8 !#sI 6LOQTV_ac c  %r cJ|j|j|jdS)N)rprurw)rirjrkrss r __getstate__zMorsel.__getstate__ms#99[[,,  r c|d}|d}|d}t|||rtd|d|d|||_||_||_y)Nrprurwrzr)rrrirjrk)rostaterprurws r __setstate__zMorsel.__setstate__tsiElgM* !#uk :N!$q ;/CD D  'r c.|d|j|S)Nr) OutputString)roattrsheaders routputz Morsel.outputs $"3"3E":;;r cXd|jjd|jdS)N<: >) __class__r rrss r__repr__zMorsel.__repr__s !^^44d6G6G6IJJr cz|j|}t|r tdd|jddzS)N-Control characters are not allowed in cookiesz rr)rrrreplace)ror output_strings r js_outputzMorsel.js_outputsG))%0 !- 0MN N $$S%0 2 2r cg}|j}||jd|j| |j}t |j }|D]\}}|dk(r ||vr|dk(r4t |tr$||j|dt|J|dk(r+t |tr|d|j||fzz|dk(r4t |tr$||j|dt|||jvr"|s|t|j|||j|d|t|S)N=rrXrcz%s=%dra) appendrprwrlsortedrrr*rUrr$_flags_semispacejoin)rorresultrrrprus rrzMorsel.OutputStrings8 $((D$4$456 =NNEtzz|$JC{%iJuc$:$.."5xGH !j&<w$.."5u!==> !j&<$.."5ve}EF #3t~~c234$.."5u=> $f%%r r)N Set-Cookie:) r r r __doc__rlrrqpropertyrprurwrnrrobject__ne__rrrrrrrr__str__rrr classmethodtypes GenericAlias__class_getitem__r r rrWrWs* I #F,!!%/:]]F  + &  (<GK 2&B$E$6$67r rWz,\w\d!#%&'~_`><@,:/\$\*\+\-\.\^\|\)\(\?\}\{\=z\[\]z \s* # Optional whitespace at start of cookie (?P # Start of group 'key' [ax]+? # Any word of at least one letter ) # End of group 'key' ( # Optional group: there may not be a value. \s*=\s* # Equal Sign (?P # Start of group 'val' "(?:[^\\"]|\\.)*" # Any double-quoted string | # or # Special case for "expires" attr (\w{3,6}day|\w{3}),\s # Day of the week or abbreviated day [\w\d\s-]{9,11}\s[\d:]{8}\sGMT # Date and time in specific format | # or [a-]* # Any word or empty string ) # End of group 'val' )? # End of optional value group \s* # Any number of spaces. (\s+|;|$) # Ending either at space, semicolon, or EOS. cZeZdZdZdZdZd dZdZdZddZ e Z d Z d d Z d Z efd Zy)rz'A container class for a set of Morsels.c ||fS)a real_value, coded_value = value_decode(STRING) Called prior to setting a cookie's value from the network representation. The VALUE is the value read from HTTP header. Override this function to modify the behavior of cookies. r rors r value_decodezBaseCookie.value_decodes Cxr c t|}||fS)zreal_value, coded_value = value_encode(VALUE) Called prior to setting a cookie's value from the dictionary representation. The VALUE is the value being assigned. Override this function to modify the behavior of cookies. r#rorstrvals r value_encodezBaseCookie.value_encodes Sv~r Nc,|r|j|yyr)load)roinputs rrqzBaseCookie.__init__s  IIe  r c|j|t}|j|||tj |||y)z+Private method for setting a cookie's valueN)getrWrrmrn)rorp real_valuerwMs r__setzBaseCookie.__sets6 HHS&( # c:{+ sA&r ct|trtj|||y|j |\}}|j |||y)zDictionary style assignment.N)rrWrmrnr_BaseCookie__set)rorprurvalcvals rrnzBaseCookie.__setitem__sB eV $   T3 .**51JD$ JJsD$ 'r cg}t|j}|D]>\}}|j||}t|r t d|j |@|j |S)z"Return a string suitable for HTTP.r)rrrrrrjoin) rorrseprrrpru value_outputs rrzBaseCookie.outputsftzz|$JC <<v6L%l3!"QRR MM, '  xxr cg}t|j}|D].\}}|j|dt|j0d|j j dt|dS)Nrrrr)rrrreprrurr _spacejoin)rolrrprus rrzBaseCookie.__repr__sX tzz|$JC HHT%++%67 8 !^^44jmDDr cg}t|j}|D]%\}}|j|j|'t |S)z(Return a string suitable for JavaScript.)rrrr _nulljoin)rorrrrprus rrzBaseCookie.js_outputsEtzz|$JC MM%//%0 1   r ct|tr|j|y|jD] \}}|||< y)zLoad cookies from a string (presumably HTTP_COOKIE) or from a dictionary. Loading cookies from a dictionary 'd' is equivalent to calling: map(Cookie.__setitem__, d.keys(), d.values()) N)rr_BaseCookie__parse_stringr)rorawdatarprus rrzBaseCookie.load sC gs #    ( &mmo U!S .r cd}t|}g}d}d}d}d|cxkr|kr!nn|j||} | sn| jd| jd} } | jd}| ddk(r|sd|j || dd| fn| j t jvrY|sy| 6| j t jvr|j || dfnHy|j || t| fn)| &|j || |j| fd}nyd|cxkr|krnd} |D].\} } } | |k(r| | | <| \}}|j| |||| } 0y) NrFr&r(rpr$T) r/matchgroupendrr{rWrlrr1rr)rorpattin parsed_items morsel_seenTYPE_ATTRIBUTE TYPE_KEYVALUErrprurtprrs r__parse_stringzBaseCookie.__parse_string.s  H   1jqjJJsA&EU+U[[-?C ! A1v}"##^SWe$DE 0 00"=yy{fmm3$++^S$,GH ''huo(NO"##]C9J9J59Q$RS" E1jqjJ *NBU^### d 3d+I+r r)Nrz )r r r rrrrqrrnrrrrr_CookiePatternrr r rrrsD1' (  GE! (6:r rceZdZdZdZdZy)rz SimpleCookie supports strings as cookie values. When setting the value using the dictionary assignment notation, SimpleCookie calls the builtin str() to convert the value to a string. Values received from HTTP are kept as strings. ct||fSr)r1rs rrzSimpleCookie.value_decoders}c!!r c2t|}|t|fSr)rr$rs rrzSimpleCookie.value_encodeusSvf~%%r N)r r r rrrr r rrrks "&r r),rrestringr__all__rrrr Exceptionr ascii_lettersdigits _LegalChars_UnescapedCharsrrangemapordr"rcompileescape fullmatchr rrr$subr0r,r1 _weekdayname _monthnamerUrmrW_LegalKeyChars_LegalValueCharsASCIIVERBOSErrr)rs0rrsNXz 7 GG  XX  ) """V]]25GG /E#J#c#.G*HHJH1(Q,HJ HeIv  7YRYY{%;;<FF " #56B 6rzz89==  /6A 8 <:F@8T@8XB!G+      & BJJ ' 2LL^ &: &MJs F PK]#\server.cpython-312.pycnu[ ֦i2ldZdZgdZddlZddlZddlZddlZddlZ ddl Z ddl Z ddl Z ddl Z ddlZddlZddlZddlZddlZddlZddlZddlZddl mZdZdZdZGd d ej6ZGd d ej:eZGd dej>Z Gdde Z!dZ"da#dZ$dZ%Gdde!Z&dZ'e edddfdZ(e)dk(rddl*Z*ddl+Z+e*jXZ-e-j]ddde-j]dd d!d"#e-j]d$d%e j^d&'e-j]d(d)d*dd+,e-j]d-de0d.d/0e-jcZ2e2jfre&Z4ne!Z4Gd1d2eZ5e(e4e5e2jle2jne2jp3yy)4a@HTTP server classes. Note: BaseHTTPRequestHandler doesn't implement any HTTP request; see SimpleHTTPRequestHandler for simple implementations of GET, HEAD and POST, and CGIHTTPRequestHandler for CGI scripts. It does, however, optionally implement HTTP/1.1 persistent connections, as of version 0.3. Notes on CGIHTTPRequestHandler ------------------------------ This class implements GET and POST requests to cgi-bin scripts. If the os.fork() function is not present (e.g. on Windows), subprocess.Popen() is used as a fallback, with slightly altered semantics. In all cases, the implementation is intentionally naive -- all requests are executed synchronously. SECURITY WARNING: DON'T USE THIS CODE UNLESS YOU ARE INSIDE A FIREWALL -- it may execute arbitrary Python code or external programs. Note that status code 200 is sent prior to execution of a CGI script, so scripts cannot send other status codes such as 302 (redirect). XXX To do: - log requests even later (to capture byte count) - log user-agent header and other interesting goodies - send error log to separate file z0.6) HTTPServerThreadingHTTPServerBaseHTTPRequestHandlerSimpleHTTPRequestHandlerCGIHTTPRequestHandlerN) HTTPStatusaD Error response

Error response

Error code: %(code)d

Message: %(message)s.

Error code explanation: %(code)s - %(explain)s.

ztext/html;charset=utf-8iceZdZdZdZy)rctjj||jdd\}}t j ||_||_y)z.Override server_bind to store the server name.N) socketserver TCPServer server_bindserver_addresssocketgetfqdn server_name server_port)selfhostports $/usr/lib64/python3.12/http/server.pyrzHTTPServer.server_bindsE**40((!, d!>>$/N)__name__ __module__ __qualname__allow_reuse_addressrrrrrs  rrceZdZdZy)rTN)rrrdaemon_threadsrrrrrsNrrc NeZdZdZdej j dzZdezZ e Z e Z dZdZdZdZd Zd"d Zd#d Zd#d ZdZdZdZd$dZdZej9ej<ededdDcic] }|d|d c}}Z de e!d<dZ"dZ#d#dZ$dZ%gdZ&gdZ'd Z(d!Z)e*jVjXZ-e.j^jaDcic]}||jb|jdfc}}Z3y cc}}wcc}}w)%raHTTP request handler base class. The following explanation of HTTP serves to guide you through the code as well as to expose any misunderstandings I may have about HTTP (so you don't need to read the code to figure out I'm wrong :-). HTTP (HyperText Transfer Protocol) is an extensible protocol on top of a reliable stream transport (e.g. TCP/IP). The protocol recognizes three parts to a request: 1. One line identifying the request type and path 2. An optional set of RFC-822-style headers 3. An optional data part The headers and data are separated by a blank line. The first line of the request has the form where is a (case-sensitive) keyword such as GET or POST, is a string containing path information for the request, and should be the string "HTTP/1.0" or "HTTP/1.1". is encoded using the URL encoding scheme (using %xx to signify the ASCII character with hex code xx). The specification specifies that lines are separated by CRLF but for compatibility with the widest range of clients recommends servers also handle LF. Similarly, whitespace in the request line is treated sensibly (allowing multiple spaces between components and allowing trailing whitespace). Similarly, for output, lines ought to be separated by CRLF pairs but most clients grok LF characters just fine. If the first line of the request has the form (i.e. is left out) then this is assumed to be an HTTP 0.9 request; this form has no optional headers and data part and the reply consists of just the data. The reply form of the HTTP 1.x protocol again has three parts: 1. One line giving the response code 2. An optional set of RFC-822-style headers 3. The data Again, the headers and data are separated by a blank line. The response code line has the form where is the protocol version ("HTTP/1.0" or "HTTP/1.1"), is a 3-digit response code indicating success or failure of the request, and is an optional human-readable string explaining what the response code means. This server parses the request and the headers, and then calls a function specific to the request type (). Specifically, a request SPAM will be handled by a method do_SPAM(). If no such method exists the server sends an error response to the client. If it exists, it is called with no arguments: do_SPAM() Note that the request name is case sensitive (i.e. SPAM and spam are different requests). The various request details are stored in instance variables: - client_address is the client IP address in the form (host, port); - command, path and version are the broken-down request line; - headers is an instance of email.message.Message (or a derived class) containing the header information; - rfile is a file object open for reading positioned at the start of the optional input data part; - wfile is a file object open for writing. IT IS IMPORTANT TO ADHERE TO THE PROTOCOL FOR WRITING! The first thing to be written must be the response line. Then follow 0 or more header lines, then a blank line, and then the actual data (if any). The meaning of the header lines depends on the command executed by the server; in most cases, when data is returned, there should be at least one header line of the form Content-type: / where and should be registered MIME types, e.g. "text/html" or "text/plain". zPython/rz BaseHTTP/HTTP/0.9c.d|_|jx|_}d|_t |j d}|j d}||_|j}t|dk(ryt|dk\r|d} |jd st|jd d d }|jd }t|d k7rttd|Dr tdtd|Dr tdt|dt|d f}|dk\r|j$dk\rd|_|dk\r$|jt j&d|zy||_d t|cxkrdks&n|jt j"d|zy|dd \}}t|d k(r0d|_|dk7r$|jt j"d|zy||c|_|_|j(jdr#d |j(j+d z|_ t,j.j1|j2|j4|_|j6j?dd} | jAd k(rd|_n)| jAd!k(r|j$dk\rd|_|j6j?d"d} | jAd#k(r/|j$dk\r |jdk\r|jCsyy#ttf$r&|jt j"d|zYywxYw#t,j.j8$r4}|jt j:dt |Yd}~yd}~wt,j.j<$r4}|jt j:dt |Yd}~yd}~wwxYw)$aHParse a request (internal). The request should be stored in self.raw_requestline; the results are in self.command, self.path, self.request_version and self.headers. Return True for success, False for failure; on failure, any relevant error response has already been sent back. NTz iso-8859-1 rFzHTTP//r .r c3>K|]}|j ywN)isdigit.0 components r z7BaseHTTPRequestHandler.parse_request..3sO99,,..sznon digit in http versionc38K|]}t|dkDyw) N)lenr,s rr/z7BaseHTTPRequestHandler.parse_request..5sKNys9~*Nsz unreasonable length http versionzBad request version (%r))r r zHTTP/1.1)r rzInvalid HTTP version (%s)zBad request syntax (%r)GETzBad HTTP/0.9 request type (%r)z//)_classz Line too longzToo many headers Connectionclose keep-aliveExpectz 100-continue)"commanddefault_request_versionrequest_versionclose_connectionstrraw_requestlinerstrip requestlinesplitr2 startswith ValueErroranyint IndexError send_errorr BAD_REQUESTprotocol_versionHTTP_VERSION_NOT_SUPPORTEDpathlstriphttpclient parse_headersrfile MessageClassheaders LineTooLongREQUEST_HEADER_FIELDS_TOO_LARGE HTTPExceptiongetlowerhandle_expect_100) rversionrAwordsbase_version_numberversion_numberr:rLerrconntypeexpects r parse_requestz$BaseHTTPRequestHandler.parse_requests )-)E)EEw $$.. = !((0 &!!# u:? u:?BiG ))'2$$&-mmC&;A&>#!4!:!:3!?~&!+$$OOO$%@AAKNKK$%GHH!$^A%6!7^A=N9O!O 'D,A,AZ,O(-%'99/2EEG#*D CJ#!# OO&&)K7 9bq  u:?$(D !%**4w>@")4 di 99   %dii..s33DI ;;44TZZ<@> w &$(D !nn,.##z1$)D !!!(B/ LLNn ,%%3$$ 2))+G + **.8:  P{{&&  OO::C {{((  OO::"C    s7B'L<:M4<2M10M14P*O P *PPcb|jtj|jy)a7Decide what to do with an "Expect: 100-continue" header. If the client is expecting a 100 Continue response, we must respond with either a 100 Continue or a final response before waiting for the request body. The default is to always respond with a 100 Continue. You can behave differently (for example, reject unauthorized requests) by overriding this method. This method should either return True (possibly after sending a 100 Continue response) or send an error response and return False. T)send_response_onlyrCONTINUE end_headersrs rrYz(BaseHTTPRequestHandler.handle_expect_100}s'  3 34 rct |jjd|_t|jdkDr5d|_d|_d|_|jtjy|jsd|_ y|jsyd|j z}t||s.|jtjd|j zyt||}||jj!y#t"$r#}|j%d|d|_ Yd}~yd}~wwxYw) zHandle a single HTTP request. You normally don't need to override this method; see the class __doc__ string for information on how to handle specific HTTP commands such as GET and POST. iir6NTdo_zUnsupported method (%r)zRequest timed out: %r)rQreadliner?r2rAr<r:rHrREQUEST_URI_TOO_LONGr=rahasattrNOT_IMPLEMENTEDgetattrwfileflush TimeoutError log_error)rmnamemethodes rhandle_one_requestz)BaseHTTPRequestHandler.handle_one_requests  #'::#6#6u#=D 4''(50#% ')$!  ? ?@''(,%%%'DLL(E4'..- <>T5)F H JJ     NN2A 6$(D !   s1A,D /D D AD -D D7D22D7cd|_|j|js|j|jsyy)z&Handle multiple requests if necessary.TN)r=rurfs rhandlezBaseHTTPRequestHandler.handles6 $ !''  # # %''rNc |j|\}}||}||}|jd|||j|||j ddd}|dk\r|t j t jt jfvr|j|tj|dtj|dd z}|jd d }|j d |j|j d tt||j!|j"dk7r|r|j$j'|yyy#t$r d\}}YVwxYw)akSend and log an error reply. Arguments are * code: an HTTP error code 3 digits * message: a simple optional 1 line reason phrase. *( HTAB / SP / VCHAR / %x80-FF ) defaults to short entry matching the response code * explain: a detailed message defaults to the long entry matching the response code. This sends an error response (so it must be called before any output has been generated), logs the error, and finally sends a piece of HTML explaining the error to the user. )???ryNzcode %d, message %sr5r7Fquote)codemessageexplainzUTF-8replacez Content-TypeContent-LengthHEAD) responsesKeyErrorrq send_response send_headerr NO_CONTENT RESET_CONTENT NOT_MODIFIEDerror_message_formathtmlescapeencodeerror_content_typer>r2rer:rnwrite)rr}r~rshortmsglongmsgbodycontents rrHz!BaseHTTPRequestHandler.send_errors\$ - $t 4 Hg ?G ?G ,dG< 4) w/  CK ..#11#002 2 00;;we<;;we<4G >>'95D   ^T-D-D E   -s3t9~ >  <<6 !d JJ  T "'+ != - , Hg -sEE+*E+c|j||j|||jd|j|jd|j y)zAdd the response header to the headers buffer and log the response code. Also send two standard headers with the server software version and the current date. ServerDateN) log_requestrcrversion_stringdate_time_stringrr}r~s rrz$BaseHTTPRequestHandler.send_responsesT  g. 4#6#6#89 !6!6!89rc |jdk7rt|#||jvr|j|d}nd}t|dsg|_|jj d|j ||fzj ddyy) zSend the response header only.r"Nrr6_headers_bufferz %s %d %s latin-1strict)r<rrkrappendrJrrs rrcz)BaseHTTPRequestHandler.send_response_onlys   : -4>>)"nnT215G G4!23')$  ' '**D':*;|jdk7rDt|dsg|_|jj|d|dj dd|j dk(r7|j dk(rd |_y |j d k(rd |_y y y ) z)Send a MIME header to the headers buffer.r"rz: r$rr connectionr7Tr8FN)r<rkrrrrXr=)rkeywordvalues rrz"BaseHTTPRequestHandler.send_header s   : -4!23')$  ' '!(%088HM O ==?l *{{}'(,%,.(-%/ +rcz|jdk7r,|jjd|jyy)z,Send the blank line ending the MIME headers.r"s N)r<rr flush_headersrfs rrez"BaseHTTPRequestHandler.end_headerss5   : -  ' ' 0     .rct|dr<|jjdj|jg|_yy)Nrr)rkrnrjoinrrfs rrz$BaseHTTPRequestHandler.flush_headers s; 4* + JJ  SXXd&:&:; <#%D  ,rct|tr |j}|jd|jt |t |y)zNLog an accepted request. This is called by send_response(). z "%s" %s %sN) isinstancerr log_messagerAr>)rr}sizes rrz"BaseHTTPRequestHandler.log_request%s= dJ '::D ))3t9c$i Arc*|j|g|y)zLog an error. This is called when a request cannot be fulfilled. By default it passes the message on to log_message(). Arguments are the same as for log_message(). XXX This should go to the separate error log. N)r)rformatargss rrqz BaseHTTPRequestHandler.log_error0s '$'r z\x02xz\\\c ||z}tjj|jd|j d|j |j dy)aZLog an arbitrary message. This is used by all other logging functions. Override it if you have specific logging wishes. The first argument, FORMAT, is a format string for the message to be logged. If the format string contains any % escapes requiring parameters, they should be specified as subsequent arguments (it's just like printf!). The client ip and current date/time are prefixed to every message. Unicode control characters are replaced with escaped hex before writing the output to stderr. z - - [z]  N)sysstderrraddress_stringlog_date_time_string translate_control_char_table)rrrr~s rrz"BaseHTTPRequestHandler.log_messageCsR(4- --/335!++D,D,DEG Hrc:|jdz|jzS)z*Return the server software version string. )server_version sys_versionrfs rrz%BaseHTTPRequestHandler.version_string]s""S(4+;+;;;rcp|tj}tjj|dS)z@Return the current date and time formatted for a message header.T)usegmt)timeemailutils formatdate)r timestamps rrz'BaseHTTPRequestHandler.date_time_stringas-   I{{%%i%==rc tj}tj|\ }}}}}}}} } d||j|||||fz} | S)z.Return the current time formatted for logging.z%02d/%3s/%04d %02d:%02d:%02d)r localtime monthname) rnowyearmonthdayhhmmssxyzss rrz+BaseHTTPRequestHandler.log_date_time_stringgsXiik04s0C-eS"b"aA *T^^E*D"b".> >r)MonTueWedThuFriSatSun) NJanFebMarAprMayJunJulAugSepOctNovDecc |jdS)zReturn the client address.r)client_addressrfs rrz%BaseHTTPRequestHandler.address_stringus""1%%rHTTP/1.0)NNr*)-r)4rrr__doc__rrZrBr __version__rDEFAULT_ERROR_MESSAGErDEFAULT_ERROR_CONTENT_TYPErr;rarYrurwrHrrcrrerrrqr> maketrans itertoolschainrangerordrrrr weekdaynamerrrJrNrO HTTPMessagerRr __members__valuesphrase descriptionr)r-cvs000rrrsqdNckk//1!44K !;.N03 )l\$#J&3#j : . .! & A (--'6yuT{E$tDT'U V'U!Q2aW 'U VX%*D "H4<> DK;I&";;**L ''..00A AHHamm $$0II WHs D 6 D!rcreZdZdZdezZdZdddddxZZd d fd Z d Z d Z dZ dZ dZdZdZxZS)raWSimple HTTP request handler with GET and HEAD commands. This serves files from the current directory and any of its subdirectories. The MIME type for files is determined by calling the .guess_type() method. The GET and HEAD requests are identical except that the HEAD request omits the actual contents of the file. z SimpleHTTP/)z index.htmlz index.htmzapplication/gzipapplication/octet-streamzapplication/x-bzip2zapplication/x-xz)z.gzz.Zz.bz2z.xzN directoryc|tj}tj||_t ||i|yr*)osgetcwdfspathrsuper__init__)rrrkwargs __class__s rrz!SimpleHTTPRequestHandler.__init__s6   I9- $)&)rc|j}|r. |j||j|jyy#|jwxYw)zServe a GET request.N) send_headcopyfilernr7rfs rdo_GETzSimpleHTTPRequestHandler.do_GETsC NN    a,  s AAcJ|j}|r|jyy)zServe a HEAD request.N)r r7r s rdo_HEADz SimpleHTTPRequestHandler.do_HEADs NN  GGI rc.|j|j}d}tjj|r5tj j |j}|jjds|jtj|d|d|ddz|d|df}tj j|}|jd||jd d |jy|jD]E}tjj||}tjj!|sC|}n|j#|S|j%|}|jdr!|j'tj(d y t+|d } tj.|j1}d |j2vr1d|j2vr" t4j6j9|j2d } | j:*| j=t>j@jB} | j:t>j@jBurt>j>jE|jFt>j@jB} | j=d} | | kr@|jtjH|j|jKy|jtjT|jd||jd tW|d|jd|jY|jF|j|S#t,$r#|j'tj(d YywxYw#tLtNtPtRf$rYwxYw#|jKxYw)a{Common code for GET and HEAD commands. This sends the response code and MIME headers. Return value is either a file object (which has to be copied to the outputfile by the caller unless the command was HEAD, and must be closed by the caller under all circumstances), or None, in which case the caller has nothing further to do. Nr'rr r r%Locationr0zFile not foundrbzIf-Modified-Sincez If-None-Match)tzinfo) microsecond Content-typez Last-Modified)-translate_pathrLrisdirurllibparseurlsplitendswithrrMOVED_PERMANENTLY urlunsplitrre index_pagesrisfilelist_directory guess_typerH NOT_FOUNDopenOSErrorfstatfilenorSrrparsedate_to_datetimerrdatetimetimezoneutc fromtimestampst_mtimerr7 TypeErrorrG OverflowErrorrDOKr>r) rrLr parts new_partsnew_urlindexctypefsims last_modifs rr z"SimpleHTTPRequestHandler.send_headsB""499-  77== LL))$))4E::&&s+"":#?#?@"1XuQxqC"1XuQx1  ,,11)<  W5  !137  ")) T5177>>%( D * **400% ==  OOJ002B C T4 A ' !((*%B#t||3't||;(++;; %89;C zz)"kk1B1B1F1FkGzzX%6%6%:%::%-%6%6%D%DKK):):)>)>&@ &0%7%7A%7%F %, ..z/F/FG ,,.GGI#'   z}} -   ^U 3   -s2a5z :   _%%bkk2 4    HQ  OOJ002B C ":}jI8  GGI sK7 N3AP,O"2C4P'B P3)OO"O>;P=O>>PPc  tj|}|j dg} tjj|jd}tj|d}tj}d |}|j!d |j!d |j!d |j!d |d|j!d|d|j!d|d|j!d|D]}tjj#||}|x} } tjj%|r |dz} |dz} tjj'|r|dz} |j!dtjj)| ddtj| dd|j!ddj#|j+|d} t-j.} | j1| | j3d|j5tj6|j9dd|z|j9dt;t=| |j?| S#t$r#|jtj dYywxYw#t$r-tjj|j}YwxYw)zHelper to produce a directory listing (absent index.html). Return value is either a file object, or None (indicating an error). In either case, the headers are sent, making the interface the same as for send_head(). zNo permission to list directoryNc"|jSr*)rX)as rz9SimpleHTTPRequestHandler.list_directory..s  r)key surrogatepasserrorsFr{zDirectory listing for zzzzzz z

z

z