U .e̠@sdgZdZdZdZddlZddlZddlZddlZddl Zddl Z ddl Z ddl Z ddl Z ddlZddlZddlZddlZddlZddlZddlZddlZddlmZddlmZddlmZd d Zd d Zd dZddZ ddZ!ddZ"ddZ#e$dej%Z&ddZ'ddZ(ddZ)ddZ*dwd d!Z+d"d#Z,d$d%Z-d&d'Z.d(d)Z/ifd*d+Z0Gd,d-d-e1Z2d.d/Z3difd0d1Z4Gd2d3d3Z5Gd4d5d5eZ6Gd6d7d7e5Z7Gd8d9d9eZ8Gd:d;d;e5Z9Gdd?a;d@dAZdFdGZ?dHdIZ@dJdKZAdLdMZBdNdOZCdxdPdQZDe9ZEe:ZFe7ZGdydRdSZHdzdUdVZId{dWdXZJd|dYdZZKd}d\d]ZLGd^d_d_ZMeMZNGd`dadaZOdbdcZPdddeZQd~dgdhZRddidjdkdldmZSdndoZTdpdqZUdrdsZVdtduZWeXdvkreWdS)helpzKa-Ping Yee z26 February 2001zGuido van Rossum, for an excellent programming language. Tommy Burnette, the original creator of manpy. Paul Prescod, for all his work on onlinehelp. Richard Chamberlain, for the first implementation of textdoc. N)deque)Repr)format_exception_onlycCs\g}g}tjD]H}tj|pd}tj|}||krtj|r||||q|SN.)syspathosabspathnormcaseisdirappend)dirsZnormdirsdirZnormdirr/usr/lib64/python3.8/pydoc.pypathdirsPs    rcCs.t|pt|}|r*tdd|p,dS)Nz^ * )inspectgetdocZ getcommentsresubrstrip)objectresultrrrr\srcCsf|d}t|dkr&|ddfSt|dkrX|dsX|dd|ddfSdd|fS)N rr)stripsplitlenrjoin)doclinesrrrsplitdocas   r%cCs"|j}|j|kr|jd|}|Sr)__name__ __module__)rmodnamenamerrr classnamejs r*cCs>t|p:t|p:t|p:t|p:t|p:t| SN)rismoduleisclass isroutineZisframeZ istracebackZiscoderrrrisdataqsr0cGs.|r*|d||d}|dd}q|S)Nrrr)r"r )textZpairsrrrreplacewsr2cCsXt||krTtd|dd}td|d|}|d|d|t||dS|S)Nrr...)r!max)r1maxlenZpreZpostrrrcram~s  $r7z at 0x[0-9a-f]{6,16}(>+)$cCs td|S)Nz\1) _re_stripidrr1rrrstripidsr:cCs<t|rdSt|r8t|dd}t|p4|dk SdS)NT__self__F)rismethod isbuiltingetattrr,)fnselfrrr_is_bound_methods    rAcCs^i}t|tjD]\}}d||<q|jD]}|t|q*|D]}t||||<qF|SNr)r getmembersr. __bases__update allmethodskeysr>)clmethodskeyvaluebaserrrrFs   rFcCs8g}g}|D]"}||r$||q ||q ||fSr+r)s predicateZyesZnoxrrr _split_lists  rQcCs\|dkr dS|dr$|dr$dS|dr __slots____date____path__ __qualname__ __builtins__ __credits____doc__ __author__ __version____file__r& __cached__r' __loader____spec__ __package__r__r__fieldsT) startswithendswithhasattr)r)allobjrrr visiblenamesrhcCsXg}t|D]D\}}}}t|r@d}t|tr@|jdkr@d}|||||fq|S)Ndata descriptorreadonly property)rclassify_class_attrsisdatadescriptor isinstancepropertyfsetr)rresultsr)kindclsrKrrrrks rkcs\t|dgzfddtDWntk r>iYnXfdd}|j|ddS)Nrbcsi|]\}}||tqSr)r!).0ir))fieldsrr sz#sort_attributes..cs|dd|dfSNr)get)attr) field_orderrrz!sort_attributes..rJ)r> enumerate TypeErrorsort)attrsrZkeyfuncr)rzrursort_attributess   rcCs:tj|r6dD]$}tjtj|d|rdSqdS)N)z.pyz.pyc__init__TF)r r r isfiler")r extrrr ispackages  rcCs|}|dddks |s0|}|sq0q|}|dddkrT|dd}|dddkr|dd}|dddkr|dd}|s|}|sqq|dd }nd}|S) Nr#zr"""r3"""\r)readlinerr )filelinerrrrsource_synopsiss&   rc Cs t|j}||d\}}|dks.||kr|ttjjrJtjj }n |ttjj rftjj }nd}|dkrzt |}Wntk rYdSX|t|}W5QRXn^|d|}tjjd||d}ztj|} WnYdSXtjd=| jr | jdnd}||f||<|S)N)NNZ__temp__loaderr)r statst_mtimerxrdtuple importlib machineryBYTECODE_SUFFIXESSourcelessFileLoaderEXTENSION_SUFFIXESExtensionFileLoadertokenizeopenOSErrorrutilspec_from_file_location _bootstrap_loadrmodulesrX splitlines) filenamecachemtimeZ lastupdaterZ loader_clsrrspecmodulerrrsynopsiss6      rc@seZdZddZddZdS)ErrorDuringImportcCs||_|\|_|_|_dSr+)rexcrKtb)r@rexc_inforrrr#szErrorDuringImport.__init__cCs|jj}d|j||jfS)Nzproblem in %s - %s: %s)rr&rrK)r@rrrr__str__'szErrorDuringImport.__str__N)r&r'rUrrrrrrr!src Cstjj}t|d}||t|k}W5QRXtj|}tj |\}}|r`tj ||}ntj ||}tjj |||d}ztj|WSt|tYnXdS)Nrbr)rr MAGIC_NUMBERrreadr!r r basenamesplitext_bootstrap_externalrSourceFileLoaderrrrrrr) r magicrZ is_bytecoderr)rrrrrr importfile+s  rc s z^|rTtjkrTtjkrTfddtjD}g|D]}tj|||<tj|=q8t}Wnzt\}}}} tjkrttjj| n>|tkrt|j| n(t |t r|j krYdSttYnX dddD].} zt || }Wqtk rYdSXq|S)Ncsg|]}|dr|qS)r)rc)rsmr rr Qszsafeimport..rr)rrbuiltin_module_names __import__rrr[ SyntaxErrorr issubclass ImportErrorr)r r>AttributeError) r forceloadrZsubsrJrrrKrinfopartrrr safeimport=s.     rc@sfeZdZejddejddZd ddZ d ddZ e Z Z Z ZZZed fd d ZdS)Doc PYTHONDOCSz%https://docs.python.org/%d.%d/libraryNrcGs||f|}zFt|r$|j|WSt|r:|j|WSt|rP|j|WSWntk rfYnXt|r||j |S|j |Sr+) rr, docmoduler-docclassr. docroutinerrldocdatadocother)r@rr)argsrrrdocumentss     z Doc.documentcGs*d|odt|t|jf}t|dS)Nz.don't know how to document object%s of type %s )reprtyper&r)r@rr)rmessagerrrfails zDoc.failZstdlibcCszt|}Wntk r&d}YnXtjd|j}tj|}t |t tr|j dksz| |r| tj |ds|j dkr| drd|d|j f}qtj ||j d }nd}|S) N (built-in)r) errno exceptionsZgcZimpmarshalposixsignalr_threadZ zipimportz site-packages)z xml.etreeztest.pydoc_mod)zhttp://zhttps://z%s/%s/.html)r getabsfilerr environrxrr r rmrr&rcr"rlower)r@rZbasedirrdoclocrrr getdoclocs(   z Doc.getdocloc)N)N)r&r'rUr rrxr version_inforrrrrrr docpropertyr sysconfigZget_pathrrrrrrms   rc@sDeZdZddZddZddZddZd d ZeZd d Z eZ d S)HTMLReprcCs,t|d|_|_d|_d|_|_dSN drrmaxlistmaxtuplemaxdict maxstringmaxotherr@rrrrs  zHTMLRepr.__init__cCst|ddddddS)N&z&z>)r2r@r1rrrescapeszHTMLRepr.escapecCs t||Sr+)rrr@rrrrrsz HTMLRepr.reprcCsZtt|dr@ddt|j}t||r@t||||S|ttt ||j SNr&repr_ra) rerr"r&r r>rr7r:rrr@rPlevelZ methodnamerrrrepr1s  zHTMLRepr.repr1cCs^t||j}t|}d|krJdt|ddkrJd|d|||dStdd||S)Nr\\rrrz-((\\[\\abfnrtv\'"]|\\[0-9]..|\\x..|\\u....)+)z\1)r7rrr2rrrr@rPrZtestZtestreprrrr repr_strings zHTMLRepr.repr_stringcCs@z|ttt||jWS|d|jjYSXdSNz <%s instance>)rr7r:rr __class__r&r@rPrrrr repr_instanceszHTMLRepr.repr_instanceN) r&r'rUrrrrrrepr_strrZ repr_unicoderrrrrs rc@seZdZeZejZejZddZd0ddZd1d d Z d d Z d dZ d2ddZ ddZ ddZddZddZddZddZdiiifddZd3d d!Zd4d"d#Zddiifd$d%Zd&d'Zddiiidfd(d)Zd5d*d+ZeZd6d,d-Zd7d.d/ZdS)8HTMLDoccCs d||fS)Nz Python: %s %s r)r@titlecontentsrrrpagesz HTMLDoc.pagercCsd|||||pdfS)Na'
 
 
%s
%s
 r)r@rfgcolbgcolZextrasrrrheadingszHTMLDoc.headingNrc Cs^|dkrdd|d}d|||f} |r@| d||||f} n| d|||f} | d|S)Nzrzz

zR z( z'
 
%s
%s %s
%s
%s%s%s
r) r@rr r rwidthZpreludeZ marginaliaZgaprrrrsections zHTMLDoc.sectioncGsd|}|j|f|S)Nz%s)r)r@rrrrr bigsectionszHTMLDoc.bigsectionc Cs&||}t|dddddddd S)N z rrr
)r expandtabsr2rrrr preformat s zHTMLDoc.preformatrcCsd}t||d|}t|D]X}|dd|}t|||||D]$}|t|krJ||||d}qJ|d}q d|S)Nrrzrrzz7%s
)r!range)r@listformatZcolsrrowscolrtrrr multicolumns   zHTMLDoc.multicolumncCsd|S)Nz%srrrrrgreyr|z HTMLDoc.greycGs*|D] }||krd|||fSq|S)N%sr)r@r)ZdictsdictrrrnamelinkszHTMLDoc.namelinkcCsN|jtj|j}}t||rDt|||krDd|j|t||fSt||S)Nz%s)r&rrrxr'rer>r*)r@rr(r)rrrr classlink%szHTMLDoc.classlinkcCsd|j|jfSNz%s)r&rrrr modulelink-szHTMLDoc.modulelinkcCsR|\}}}}|r||S|r,d||f}nd|}|rBd|}n|}d||fS)Nz %s.%s.htmlz%s.htmlz"%s (package)r)r)r@Z modpkginfor)r rshadowedurlr1rrr modpkglink1s   zHTMLDoc.modpkglinkcCs d||fS)Nz%sr)r@r"r rrrfilelink@szHTMLDoc.filelinkcCs|p|j}g}d}td}|||} | s0qh| \} } ||||| | \} } }}}}| r|| dd}|d||fn|rdt|}|d||| fn|rdt|}|d||| fn|r"|| | dd kr|d | ||n|d |n@|| | dd krP|| ||||n|| ||| }q||||dd |S) NrzD\b((http|ftp)://\S+[\w/]|RFC[- ]?(\d+)|PEP[- ]?(\d+)|(self\.)?(\w+))"z"rz'http://www.rfc-editor.org/rfc/rfc%d.txtz(http://www.python.org/dev/peps/pep-%04d/r(zself.zself.%sr) rrcompilesearchspanrgroupsr2intrr")r@r1rfuncsclassesrIrpherepatternmatchstartendrfZschemeZrfcZpepZselfdotr)r"rrrmarkupDs:      zHTMLDoc.markupc Csd}|D]}t|tdkr|\}}|d}||||}|r||fkrg}|D]} ||| |qR|dd|d}|d}qt|tgkr|d||||}qd |S) Nrrz"

r&, )z
z
%s
z
%s
)rrrr" formattree) r@treer(parentrentrycbasesparentsrLrrrr6os&  zHTMLDoc.formattreec# s|j}z |j}Wntk r(d}YnX|d}g}tt|dD],}|dd|d|d||fqHd||dd} d| } z&t |} t j | } | | } Wntk rd} YnXg}t|dr6t|j}|ddd kr"|ddd kr"|dd}|d |t|d rX|t|j|rp| d d|} |}|dk rdt}nd}| ddd| |}t|tj}gi}}t|tjD]Z\}}|dk st|p||krt|||r|||fd|||<||<q|D]\}}|jD]n}|j|j}}tj !|}||kr@|r@t||r@t"|||kr@||kr@|d|||<||<q@q2gi}}t|tj#D]p\}}|dk st$|st||krt|||r|||fd|||<t%|r||||<qg}t|t&D]&\}}t|||rN|||fqN't(|j)||}|od|}|d|}t|drg}t*+|j,D]\}}} |||| dfq|-.|j/}!|0ddd|!}n.|r<.|fdd}!|0ddd|!}|rd d!|D}"1t2|"d|g}!|D]"\}}|!3|||||qj|0d"dd#d$|!}|rg}!|D]"\}}|!3|||||q|0d%dd&d$|!}|r:g}!|D]\}}|!3||q|0d'dd(d)|!}t|d*rn't|j4j)}!|0d+dd|!}t|d,r't|j5j)}!|0d-dd|!}|S).Nrrz5%sr)%srrZ $Revision: $z version %srSz (%s)r4z-
Module Referencer#ffffff#7799eezindex
rz.html#z#-z %sz

%s

rTrzPackage Contentsz#aa55cccs|dSrB)r trrrr{r|z#HTMLDoc.docmodule..ZModulescSsg|] \}}|qSrrrsrJrKrrrrsz%HTMLDoc.docmodule..ZClasses#ee77aarZ Functionsz#eeaa77ZDataz#55aa55rrYZAuthorrWZCredits)6r&__all__rr rr!rr"rrurllibparseZquoter$rrestrrZrrrSrlocalsr rCr,r- getmodulerhrDr'rrrxr>r.r= isfunctionr0r3rrpkgutil iter_modulesrTrrr#rr6 getclasstreerrYrW)#r@rr)modignoredrfpartsZlinksrtZ linkednameheadr r"r$rversionrrrr-ZcdictrJrKrLr(rr,Zfdictdatar#modpkgsimporterispkgr classlistrrrrs*        $                         zHTMLDoc.docmodulec sj}|p |}j}g} | jGfddd} | tt} t| dkrd| D]} d| j qddfdd} fd d }fd d }fd dt D}i|D]n\}}}}d|d||<}zt |}Wnt k r4YnXz ||<Wqt k rXYqXq|rj| rr| n |ddt|fdd\}}tjk rtjkr|}q\n"krd}ndj }|d7}t|| d||dd}| d||dd}| d||dd}|d||dd}|d||d d}|d!||d"d}|}q\d#| } ||krd$||f}nd%|||f}|rg}|D]} || j q|d&d'|}d#}zt}Wntt fk rd}YnX|r8t|}|r8|d(kr8||d)}t}|rT||pPd#}|j}|otd*|}|d+d,| d-|S).Ncs eZdZddZfddZdS)z(HTMLDoc.docclass..HorizontalRulecSs d|_dSrwZneedonerrrrrsz1HTMLDoc.docclass..HorizontalRule.__init__cs|jrdd|_dS)Nz
rr[rpushrrmaybe sz.HTMLDoc.docclass..HorizontalRule.maybeNr&r'rUrr^rr\rrHorizontalRulesr`rz&
Method resolution order:
z
%s

c st||\}}|r||D]d\}}}}zt|}Wn&tk rf||YnX||dq&|S)NrrQr^r> ExceptionrrmsgrrOokr)rqhomeclsrKr-r,hrmdictrQrr]r@rrspills"  zHTMLDoc.docclass..spillcsJt||\}}|rF||D]\}}}}||q&|Sr+rQr^rrdrirQr]r@rrspilldescriptors+sz*HTMLDoc.docclass..spilldescriptorsc st||\}}|r||D]\}}}}t||}t|sXt|rft|dd} nd} | dkrd|n0t|j } d| } d|| fdq&|S)NrXz
%s
z
%sz
%s%s
r) rQr^rr>callablerrlr3rr) rerrOrfr)rqrgrKrLr#rhrr spilldata4s( z#HTMLDoc.docclass..spilldatacs,g|]$\}}}}t|dr||||fqS)rgrhrsr)rqrrrKr/rrrIs  z$HTMLDoc.docclass..r-rcs |dkSNrrrC thisclassrrr{br|z"HTMLDoc.docclass.. defined hereinherited from %sz:
z Methods %scSs |ddkSNrmethodrrCrrrr{rr|zClass methods %scSs |ddkSNrz class methodrrCrrrr{tr|zStatic methods %scSs |ddkSNrz static methodrrCrrrr{vr|zReadonly properties %scSs |ddkSNrrjrrCrrrr{xr|zData descriptors %scSs |ddkSNrrirrCrrrr{zr|zData and other attributes %scSs |ddkSNrrVrrCrrrr{|r|rz*class %sz/%s = class %s(%s)r4()rz%s
 
z#000000z#ffc8d8r3)r&rDrrrgetmror!r^rr'rkr>rcrpopleftrQbuiltinsrrr" signature ValueErrorrJrrr3rr)r@rr)rQr,r-rRrealnamer;rr`mrorLrkrnrprrJrqrgrKanchor inheritedtagrr<declrargspecr#r) r-r,rirjrQrr]r@rwrrs                   zHTMLDoc.docclasscCs|d||SN=)rrrrrr formatvalueszHTMLDoc.formatvaluec Cs|j}|p |}|r|jpdd|} d} d} t|r|jj} |rZ| |k rd|| |} n0|jdk rzd||jj|} nd|| |} t|st|rd} nd} ||krd| |f}nD|rt||g|krd |jd||f}d } n|}d | ||f}d}t |rlzt |}Wnt t fk r>d}YnX|rlt |}|d krld |}|d d}|svd}| |||| o|d| }| rd|S|t||j|||}|od|}d||fSdS)Nrrtr from  method of %s instance unbound %s methodasync z$%sz%srz)%s = %sz$%s lambda r(...)z'%sz
%s
z
%s
z
%s
%s
)r&rAr;rrriscoroutinefunctionisasyncgenfunctiongetattr_staticr.rrrrJrrr3rr)r@rr)rQr,r-rIrHrrnoteskipdocsimclassasyncqualifierrZreallinkrrrr#rrrrs|        zHTMLDoc.docroutinecCsNg}|j}|r|d||t||j}|r<|d||dd|S)Nz!
%s
z
%s
rar)rr3rrr"r@rr)rQrHrpr]r#rrrrs  zHTMLDoc.docdatacGs|r d|pd}|||S)Nz%s = rr)r@rr)rQrRZlhsrrrrszHTMLDoc.docothercCsg}|dkri}t|gD]<\}}}tdd|Dr:q||d|||kfd||<q||||j}||dd|S)Ncss*|]"}dt|kodknVqdS)iiN)ordrsZchrrr sz HTMLDoc.index..rrrArF)rNrOanyrrrr#r)r@rr!rWrXr)rYrrrrindexs z HTMLDoc.index)r)r rNr)r)N)NN)NNN)NN)N)r&r'rUr_repr_instancerrrr rrrrrrrr r#r$r3r6rrrrrrrrrrrrrsF   +  y& A  rc@s0eZdZddZddZddZeZddZd S) TextReprcCs,t|d|_|_d|_d|_|_dSrrrrrrr s  zTextRepr.__init__cCsTtt|dr@ddt|j}t||r@t||||Sttt||j Sr) rerr"r&r r>r7r:rrrrrrrs  zTextRepr.repr1cCsHt||j}t|}d|krDdt|ddkrDd|d||dS|S)Nrrrrr)r7rrr2rrrrrs  zTextRepr.repr_stringcCs4zttt||jWSd|jjYSXdSr)r7r:rrrr&rrrrr%szTextRepr.repr_instanceN)r&r'rUrrrrrrrrrr s  rc@szeZdZeZejZddZdddZddZdd d Z dd d Z dddZ ddZ dddZ dddZeZdddZdS)TextDoccCsddd|DS)Nrcss|]}|d|VqdS)Nrrrrrr5szTextDoc.bold..)r"rrrrbold3sz TextDoc.bold cs>|sdSfdd|dD}|r4|d|d<d|S)Nrcsg|] }|qSrrrsrprefixrrr:sz"TextDoc.indent..rr)r rr")r@r1rr$rrrindent7s zTextDoc.indentcCs$||}||d|dS)Nrr)rrr)r@rrZclean_contentsrrrr>szTextDoc.sectionNrc sd}|D]}t|tdkrr|\}}||t|}|rh||fkrhfdd|D} |dd| }|d}qt|tgkr|||||d}q|S) Nrrc3s|]}t|VqdSr+r*)rsr:r(rrrMsz%TextDoc.formattree..rr4rr)rr*r"r6) r@r7r(r8rrr9r:r;r<rrrr6Es" zTextDoc.formattreec Cs$|j}tt|\}}|d||o(d|}t|dd}||}|dk r`||d|d}|rt||d|}g} t|tjD]<\} } |dk st | p||krt | ||r| | | fqg} t|tj D]F\} } |dk st | st | |krt | ||r| | | fqg} t|tD]&\} } t | ||r.| | | fq.g}t}t|drt|jD]6\}}}|||r| |dn | |qx|||d d |}g}t|tjD]0\} } | j|d r| |kr| | q|r6|||d d |}| rd d| D}|t|d|g}| D]\} } | || | |qd||dd |}| rg}| D]\} } | || | |q||dd |}| r&g}| D]"\} } | |j| | |ddq||dd |}t|drt|j}|dddkrp|dddkrp|dd}||d|}t|dr||dt|j }t|dr||dt|j!}t|dr||d t|j"}zt#|}Wnt$k rd!}YnX||d"|}|S)#NNAME - rGzMODULE REFERENCEa. The following documentation is automatically generated from the Python source files. It may be incomplete, incorrect or include features that are considered implementation detail and may vary between Python implementations. When in doubt, consult the module reference at the location listed above. Z DESCRIPTIONrT (package)zPACKAGE CONTENTSrrZ SUBMODULEScSsg|] \}}|qSrrrErrrrsz%TextDoc.docmodule..rCLASSES FUNCTIONSF)r6ZDATArZr>r?rr@ZVERSIONrSZDATErYZAUTHORrWZCREDITSrZFILE)%r&r%rrr>rrrCr-rLrhrr.r=r0setrerNrOrTaddrr"r,rcr6rPrrrJrZrrSrYrWrr)r@rr)rQZsynopdescrrfrr-rJrKr,rVrWZ modpkgs_namesrXr(rYZ submodulesrZrrUrrrrrUs               $    zTextDoc.docmodulec sLj}|p |}j}jfdd}||kr:d|}n|d|}|rlt||} |dd| }g} | jzt} Wnt t fk rd} YnX| rt | } | r| dkrʈ|| dt } | r| dt t}t|d kr*d |D]}d ||q d td dtDt jd}t|}d}|rd|d|D]}d |qn||krdt ||dd Gfddd}|fdd}fdd}fdd}fddtD}|r|r*|n |dd t|fdd \}}tjk rntjkrn|}qn kr~d!}nd"tj}t||d#||d$d }|d%||d&d }|d'||d(d }|d)||d*d }|d+||d,d }|d-||d.d }|}qd| } | s0|dS|d| d/dS)0NcSs t||Sr+r)r:rrrrmakenamesz"TextDoc.docclass..makenameclass z = class rr4rrrzMethod resolution order:rrcss.|]&}|jds|jdkrt|jVqdS)rarN)r&rcr'rJ)rsrrrrrrs z#TextDoc.docclass..r}rzBuilt-in subclasses:z ... and z other subclassescs eZdZddZfddZdS)z(TextDoc.docclass..HorizontalRulecSs d|_dSrwr[rrrrrsz1TextDoc.docclass..HorizontalRule.__init__cs|jrdd|_dS)NzF----------------------------------------------------------------------rr[rr\rrr^sz.TextDoc.docclass..HorizontalRule.maybeNr_rr\rrr`sr`c st||\}}|r~||D]V\}}}}zt|}Wn&tk rf||Yq&X||q&|Sr+rbrdrirQrr]r@rrrkszTextDoc.docclass..spillcsJt||\}}|rF||D]\}}}}||q&|Sr+rlrdrmrrrnsz*TextDoc.docclass..spilldescriptorsc st||\}}|r||D]v\}}}}t|sDt|rNt|}nd}zt|} Wntk r~|j|} YnXj | |d|ddq&|S)Nr)r6r#r) rQr^rorrlrr>r__dict__r) rerrOrfr)rqrgrKr#rgrrrrps  z#TextDoc.docclass..spilldatacs,g|]$\}}}}t|dr||||fqSrqrrrsr/rrr+s  z$TextDoc.docclass..rcs |dkSrurrCrvrrr{4r|z"TextDoc.docclass..rxryz Methods %s: cSs |ddkSrzrrCrrrr{Cr|zClass methods %s: cSs |ddkSr|rrCrrrr{Er|zStatic methods %s: cSs |ddkSr}rrCrrrr{Gr|zReadonly properties %s: cSs |ddkSr~rrCrrrr{Ir|zData descriptors %s: cSs |ddkSrrrCrrrr{Kr|zData and other attributes %s: cSs |ddkSrrrCrrrr{Mr|z | )r&rDr'rmapr"rrrrrrJrrrr!sortedr__subclasses__rrkrrQrrr*rrr)r@rr)rQrRrr;rrr<rrrr#rrLZ subclassesZno_of_subclassesZMAX_SUBCLASSES_TO_DISPLAYZ subclassnamer`rkrnrprrrr)rirQrr]r@rwrrs                   zTextDoc.docclasscCsd||SrrrrrrrWszTextDoc.formatvaluec Cs|j}|p |}d}d}t|rn|jj}|rB||k rndt||}n,|jdk r`dt|jj|}ndt||}t|st|rd} nd} ||kr||} n,|rt ||g|krd}||d|} d} t |r.ZTERM)ZdumbZemacscstt|Sr+) pipepagerrr9rrrr{r|cs t|Sr+rr9rrrr{r|cSstt|dS)Nzmore /dev/nullrcSs t|dS)NZlessrr9rrrr{r|z more "%s"cSs t|dS)NZmorerr9rrrr{r|)rerstdin plainpagerstdoutrr rrxplatformrtempfileZmkstempcloseunlinkttypager)rfdrrrrrs6            rcCstdd|S)Nz.r)rrr9rrrrsrc Csddl}|j|d|jd}zDtj|jdd*}z||Wntk rPYnXW5QRXWntk rrYnXz| WqWqttk rYqtXqtdS)NrT)shellrbackslashreplace)errors) subprocessPopenPIPEio TextIOWrapperrwriteKeyboardInterruptrwait)r1cmdrprocpiperrrrsrc Cs~ddl}|d}tj|d}t|ddtjdkrrrencodedecode)r1rrrr_escape_stdoutsrc Cstt|d}z2ddl}tj}||}||dd}Wn(t t t j fk rld}dd}YnXz0zttjdd}Wntk rd}YnX|dkrd}|d}}tjd|d|d||drtjd tj|} | d krtjd qn,| d krJtjd ||d|d}q| d krn|||}|dkrnd}tjdd||||d||}qW5|r| ||j|XdS)NrrcSs tjdSrB)rrrrrrrr{r|zttypager..cSstjddddS)Nrr)rrrrrrrr{r|ZLINESrz -- more --)qQz ) r)bB)rrr ttyrrfilenoZ tcgetattrZ setcbreakrrrUnsupportedOperationZ tcsetattrZ TCSAFLUSHr+r rrxrrrr"flush) r1r$rroldZgetcharhrZincr:rrrr sL              &rcCstjtt|dSr+)rrrrrr9rrrr5srcCst|r>|jtjkr d|jSt|dr4d|jSd|jSt|rRd|jSt|rtd|jj |jj|jfSt |rd|jj |jj|jfSt |rd|jSt |rd |jSt |rd |jSt|jS) Nzbuilt-in module rTzpackage zmodule zbuilt-in function zgetset descriptor %s.%s.%szmember descriptor %s.%s.%srz function zmethod )rr,r&rrrer=Zisgetsetdescriptor __objclass__r'Zismemberdescriptorr-rMr<r)thingrrrdescribe9s6                rc Csdd|dD}d\}}|t|kr\td|d|d|}|r\||d}}qq\q|rf|}nt}||dD],}zt||}Wqvtk rYdSXqv|S)NcSsg|] }|r|qSrr)rsrrrrrVszlocate..rrwr)r r!rr"rr>r)r rrSrnZ nextmodulerrrrrlocateTs   rcCsVt|tr0t||}|dkr(td|||fSt|dd}|t|trL|ndfSdS)Nz~No Python documentation found for %r. Use help() to get the interactive help utility. Use help(str) for help on the str class.r&)rmrJrrr>)rrrr)rrrresolvems   r Python Library Documentation: %scCs|dkr t}t||\}}t|}t|}|rTd|krT|d|d|d7}n|rn||k rn|d|j7}t|st|st |st |st |}|d7}||d| ||S)Nrz in z in module z objectr) r1rrrrLrfindr&r,r-r.rlrr)rrrZrendererrr)rrrrr render_doc{s&    rc Csfz2|dkrtt|||n|t|||tWn.ttfk r`}z t|W5d}~XYnXdSr+)rrr plaintextrrprint)rrroutputrKrrrr#s r#c Csz`t||\}}tt|t||}t|dddd}||W5QRXtd|dWn.tt fk r}z t|W5d}~XYnXdS)Nrrr)rZwrote) rhtmlrrrrrrrr)rrrr)rrrKrrrwritedocsrrcCs2|dkr i}t|g|D]\}}}t|qdSr+)rN walk_packagesr)rpkgpathZdonerXr(rYrrr writedocss  r cJ@s"eZdZddddddddddd d d d d ddddddddddddddddddddd#Zd d!d"DZded'd(d)d*d+d,d-Zd.d/d0d1d2d3d4d5d6d7d8d9d9d:d:d;ZeD]:\ZZ e D],Z e e eZ ee kre d<eZ e ee <qqd=d>d?d@dAdBdCdDdEdFdGdHdIdJdKdLdLdMdNdOdPdQddRdSdSdTdUdVdWdXdYdZd[d\d]d^d_d_d`dadbdcdddedfdgdhdidjdkdldmdndodpdqdrdsdtdudvdwdxdydzd{dd d|d}d~ddIZ dddZ eddZeddZddZeZefddZddZddZddZddZdddZddZddZddZdddZdddZddZdddZ dS)HelperrBOOLEANwith)assertr)asyncr)awaitr)break while for)classzCLASSES SPECIALMETHODS)continuer)Zfunctionr)del BASICMETHODSif)elsertry)forzbreak continue whileimport)globalznonlocal NAMESPACES)r TRUTHVALUE)rMODULES)inSEQUENCEMETHODS COMPARISON)lambdar)nonlocalzglobal NAMESPACES)passr)raise EXCEPTIONS)returnr)rr&)whilezbreak continue if TRUTHVALUE)r z CONTEXTMANAGERS EXCEPTIONS yield)yieldr)#FalseNoneTrueandasrrrrrrdefrelifrexceptfinallyrfromrrrrisr"r#notorr$r%r'rr(r r)cCsg|]}dD] }||q qS)'r%r)rsprrrrrszHelper.)rfrur8'''r%r)+rt***rz//%<<>>r|^~rr<=>===!=<>)rrrFrGrHrIrJ)rtrE) z+=z-=z*=z/=z%=z&=z|=z^=z<<=z>>=z**=z//=)rArBrrCrDrE)jJ)STRINGS OPERATORSr!UNARYAUGMENTEDASSIGNMENTBITWISECOMPLEXzOPERATORS FORMATTINGPOWERzTUPLES LISTS FUNCTIONSz ATTRIBUTES FLOAT MODULES OBJECTSELLIPSISzSLICINGS DICTIONARYLITERALSz def classrM PRIVATENAMESzPRIVATENAMES SPECIALMETHODSZ BACKQUOTESzTUPLES FUNCTIONS CALLSzLISTS SUBSCRIPTS SLICINGS)r@r?,rr4:@rrar``r&r5[]r)typeszRSTRINGS UNICODE NUMBERS SEQUENCES MAPPINGS FUNCTIONS CLASSES MODULES FILES inspect)stringsz4str UNICODE SEQUENCES STRINGMETHODS FORMATTING TYPES)zstring-methodszSTRINGS FORMATTING)Z formatstringsrN)r]z:encodings unicode SEQUENCES STRINGMETHODS FORMATTING TYPES)ZnumberszINTEGER FLOAT COMPLEX TYPES)Zintegersz int range)Zfloatingz float math)Z imaginaryz complex cmath)Ztypesseqz$STRINGMETHODS FORMATTING range LISTS DICTIONARIES)Ztypesfunctionsz def TYPES)Z typesmethodszclass def CLASSES TYPES)zbltin-code-objectszcompile FUNCTIONS TYPES)zbltin-type-objectsz types TYPESTYPES)zbltin-null-objectr)zbltin-ellipsis-objectSLICINGS)Z specialattrsr)r\z!class SPECIALMETHODS PRIVATENAMES)Z typesmodulesr)zoperator-summaryzlambda or and not in is BOOLEAN COMPARISON BITWISE SHIFTING BINARY FORMATTING POWER UNARY ATTRIBUTES SUBSCRIPTS SLICINGS CALLS TUPLES LISTS DICTIONARIES EXPRESSIONS)Zobjectsr_)Z specialnameszbBASICMETHODS ATTRIBUTEMETHODS CALLABLEMETHODS SEQUENCEMETHODS MAPPINGMETHODS NUMBERMETHODS CLASSES)Z customizationzhash repr str SPECIALMETHODS)zattribute-accesszATTRIBUTES SPECIALMETHODS)zcallable-typeszCALLS SPECIALMETHODS)sequence-typesz(SEQUENCES SEQUENCEMETHODS SPECIALMETHODS)rbzMAPPINGS SPECIALMETHODS)z numeric-typesz*NUMBERS AUGMENTEDASSIGNMENT SPECIALMETHODS)Z execmodelz%NAMESPACES DYNAMICFEATURES EXCEPTIONS)Znamingz3global nonlocal ASSIGNMENT DELETION DYNAMICFEATURES)zdynamic-featuresr NAMESPACES)rztry except finally raise)Z conversionsr)Z identifierszkeywords SPECIALIDENTIFIERS)z id-classesr)zatom-identifiersr)z atom-literalsz=STRINGS NUMBERS TUPLELITERALS LISTLITERALS DICTIONARYLITERALS SEQUENCES)Z exprlistszTUPLES LITERALS)ztypesseq-mutable LISTLITERALS)ZlistszLISTS LITERALS)Z typesmappingDICTIONARYLITERALS)rzDICTIONARIES LITERALS)zattribute-referencesz(getattr hasattr setattr ATTRIBUTEMETHODS)Z subscriptionsr )Zslicingsr )Zcallsra)Zpowerra)Zunaryra)Zbinaryra)Zshiftingra)Zbitwisera)Z comparisonszEXPRESSIONS BASICMETHODS)ZbooleanszEXPRESSIONS TRUTHVALUEr)Z assignmentrP)Z augassign NUMBERMETHODSrr')Zcompoundzfor while break continue)truthz if while and or not BASICMETHODS)ZdebuggerZpdb)zcontext-managersr )Ir_rMZ STRINGMETHODSZ FORMATTINGUNICODEZNUMBERSZINTEGERZFLOATrRrdZMAPPINGSrZMETHODSZ CODEOBJECTSZ TYPEOBJECTSZ FRAMEOBJECTSZ TRACEBACKSZNONErTZSPECIALATTRIBUTESrrZPACKAGESrarNZ PRECEDENCEZOBJECTSZSPECIALMETHODSrZATTRIBUTEMETHODSZCALLABLEMETHODSr ZMAPPINGMETHODSrgZ EXECUTIONrcZDYNAMICFEATURESZSCOPINGZFRAMESr&Z CONVERSIONSZ IDENTIFIERSZSPECIALIDENTIFIERSrUZLITERALSZTUPLESZ TUPLELITERALSZLISTSrer^rfZ ATTRIBUTESZ SUBSCRIPTSr`ZCALLSrSrOZBINARYZSHIFTINGrQr!r Z ASSERTIONZ ASSIGNMENTrPZDELETIONZ RETURNINGZ IMPORTINGZ CONDITIONALZLOOPINGrZ DEBUGGINGZCONTEXTMANAGERSNcCs||_||_dSr+)_input_output)r@inputrrrrr^szHelper.__init__cCs |jp tjSr+)rjrrrrrrrlbsz Helper.inputcCs |jp tjSr+)rkrrrrrrrfsz Helper.outputcCs2tdddkr|dSd|jj|jjfS)Nrr3?rz<%s.%s instance>)rstackrr'rUrrrr__repr__js zHelper.__repr__cCs6||jk r||n|||jddS)Na You are now leaving help and returning to the Python interpreter. If you want to ask for help on a particular object directly from the interpreter, you can type "help(object)". Executing "help('string')" has the same effect as typing a particular string at the help> prompt. )_GoInteractiverintrointeractrrr@Zrequestrrr__call__rs   zHelper.__call__c Cs|jdz|d}|s WqWnttfk r>YqYnX|}t|dkr|d|dkrpdkrnn |d|ddkr|dd}|dkrq|d kr|q | |q dS) Nrzhelp> rrrr7r)rquitr) rrgetlinerEOFErrorrr!rrqrrsrrrrrs"   ,   zHelper.interactcCs8|jtjkrt|S|j||j|jSdSr+)rlrrrrrr)r@promptrrrrvs    zHelper.getlinecCs<t|tdkr|}|dkr,|n|dkr>|n|dkrP|n|dkrb|n|dddkr||dn||jkr||nj|d krt t |d nR||j kr| |n<||j kr| |n&|rt |d |jd nt td |jd n$t|tr|nt |d |jd |jd dS) Nrkeywordssymbolstopicsrzmodules r)r,r*r+z Help on %s:)rr)rr listkeywords listsymbols listtopics listmodulesr rz showsymbolr#evalry showtopicr{rkrJrmr rrrsrrrrs6        z Helper.helpcCs$|jddtjdddS)Na Welcome to Python {0}'s help utility! If this is your first time using Python, you should definitely check out the tutorial on the Internet at https://docs.python.org/{0}/tutorial/. Enter the name of any module, keyword, or topic to get help on writing Python programs and using Python modules. To quit this help utility and return to the interpreter, just type "quit". To get a list of available modules, keywords, symbols, or topics, type "modules", "keywords", "symbols", or "topics". Each module also comes with a one-line summary of what it does; to list the modules whose name or summary contain a given string such as "spam", type "modules spam". z%d.%dr)rrrrrrrrrrqs z Helper.introrPc Cstt|}||}t||d|}t|D]v}t|D]\}|||}|t|kr<|j||||dkr<|jdd|dt||q<|jdq0dS)Nrrr)rrr!rrr) r@itemscolumnsr Zcolwrrowrrtrrrrs      &z Helper.listcCs |jd||jdS)NzN Here is a list of the Python keywords. Enter any keyword to get more help. )rrrryrGrrrrr}s zHelper.listkeywordscCs |jd||jdS)Nzx Here is a list of the punctuation symbols which Python assigns special meaning to. Enter any symbol to get more help. )rrrrzrGrrrrr~s zHelper.listsymbolscCs |jd||jdS)NzN Here is a list of available topics. Enter any topic name to get more help. )rrrr{rGrrrrrs zHelper.listtopicsc Cs0z ddl}Wn"tk r.|jdYdSX|j||j|}|sb|jdt|dSt|tdkr~| ||S|\}}z|jj|}Wn*t k r|jdt|YdSX| d}|r|pdd|}|r$ddl }dd |d} || d } |d d | 7}t|dS) Nrt Sorry, topic and keyword documentation is not available because the module "pydoc_data.topics" could not be found. zno documentation found for %s rrrRelated help topics: r4Hz %s )pydoc_data.topicsrrrr{rxryrrrKeyErrorrtextwrapr"r Zwrapr) r@topic more_xrefs pydoc_datatargetlabelxrefsr#rr1Z wrapped_textrrrrs4     zHelper.showtopiccCsz ddl}Wntk r"YdSX|j||j|}|sFtdt|tr\|||S|\}}|jj|}|r|pzdd|}||fS)Nr)rrzcould not find topicrr) rrr{rxryrrmrJ _gettopic)r@rrrrrrr#rrrrs     zHelper._gettopiccCs*|j|}|d\}}}|||dS)Nr)rz partitionr)r@symbolrrrarrrrr!s zHelper.showsymbolcsv|r |jd|t|nR|jdi}|fddfdd}tj|d|||jddS) Nzy Here is a list of modules whose name or summary contains '{}'. If there are any, enter a module name to get more help. zI Please wait a moment while I gather a list of all available modules... cSs>|r$|dddkr$|ddd}|ddkr:d||<dS)N .__init__rrrr)find)r r(rrrrrcallback4sz$Helper.listmodules..callbackcsd|ddSr+rrrrronerror9sz#Helper.listmodules..onerrorrz Enter any module name to get more help. Or, type "modules spam" to search for modules whose name or summary contain the string "spam". )rrrapropos ModuleScannerrunrrG)r@rJrrrrrr&s     zHelper.listmodules)r8r<r%r)NN)rr)r)r)r)!r&r'rUryZ _strprefixesZ_symbols_inverserzrrZsymbols_rrxr{rrnrlrrorrprtrrrvrrqrr}r~rrrrrrrrrr sB'    W       r c@seZdZdddZdS)rNc Cs |r |}d|_i}tjD]p}|dkrd||<|dkrF|d|dqt|jpRd}|dd}|d|}||dkr|d||qtj |dD]\\} }} |jrq|dkr|d|dqzt | |} Wnt k rYqYnX| j } t | d rnz| |} Wn(tk r:|r2||YqYnXtt| pNd}t | d rh| |}nd}n`ztj| }Wn(tk r|r||YqYnX|jr|jdnd}t|d d}|d|}||dkr||||q|r|dS) NF__main__rrrrrr get_source get_filenamer[)rrurrrrXr rrNr _get_specrrrerrcrrStringIOrrrrrrr>)r@rrJZ completerrseenr(r)rrXrYrrsourcer rrrrrGs`          zModuleScanner.run)NNN)r&r'rUrrrrrrDsrc CsDdd}dd}t"tdtj|||dW5QRXdS)NcSs6|dddkr |ddd}t||o.d|dSNrrrz- )rr r(rrrrrszapropos..callbackcSsdSr+rrrrrrszapropos..onerrorignorer)warningscatch_warningsfilterwarningsrr)rJrrrrrrs   rcsddlddlddlddlGdddjjGfdddjjGfdddj}||||}||j s|j st dq~|S) Nrc@seZdZddZddZdS)z!_start_server..DocHandlercSsX|jdrd}nd}|d|dd|||j||j|ddS)Nz.csstext/css text/htmlz Content-Typez%s; charset=UTF-8r) r rdZ send_responseZ send_headerZ end_headersZwfiler urlhandlerr)r@ content_typerrrdo_GETs   z(_start_server..DocHandler.do_GETcWsdSr+r)r@rrrr log_messagesz-_start_server..DocHandler.log_messageN)r&r'rUrrrrrr DocHandlersrcs(eZdZddZfddZddZdS)z _start_server..DocServercSs6||_|j|f|_||_|j||j|jd|_dSNF)hostZaddressrrLrhandlerru)r@rportrrrrrs  z)_start_server..DocServer.__init__cs>|js2|jgggd\}}}|r|q|dSrB)ruselectZsocketrZhandle_requestZ server_close)r@ZrdZwrZexrrrserve_until_quits  z1_start_server..DocServer.serve_until_quitcSs |j||jr||dSr+)rLserver_activaterrrrrrs z0_start_server..DocServer.server_activateN)r&r'rUrrrrrrr DocServers rcs:eZdZfddZfddZddZddZd S) z#_start_server..ServerThreadcs2||_||_t||_j|d|_d|_dSr)rrr+rThreadrservingerror)r@rrr) threadingrrrs   z,_start_server..ServerThread.__init__c sxzJjj__jj_t|j_|j |j |j }||_ | Wn(tk rr}z ||_W5d}~XYnXdSr+)server HTTPServerrLrrZMessageZ MessageClass staticmethodrrrready docserverrrcr)r@Zdocsvre)rremailhttprrr s    z'_start_server..ServerThread.runcSs,d|_|j|_|j|_d|j|jf|_dS)NTz http://%s:%d/)rrZ server_portrr")r@rrrrr sz)_start_server..ServerThread.readycSs&d|j_|d|_d|_d|_dS)NTF)rrur"rr"rrrrstop s z(_start_server..ServerThread.stopN)r&r'rUrrrrr)rrrrrrr ServerThreads  rg{Gz?) Z http.serverZ email.messagerrrZBaseHTTPRequestHandlerrrr1rrtimesleep)rhostnamerrthreadr)rrrrrrr _start_servers8'   rrc s(Gfdddt}|fddfddfddfd d fd d fd dfddfddfdd}|dr|dd}|dkrtjtjt}tj||}t|}d| W5QRSQRXn|dkr||St d||fdS)NcseZdZfddZdS)z_url_handler.._HTMLDoccsd}d|}d|||fS)Nzpydoc_data/_pydoc.cssz1a  Pydoc: %s %s%s
%s
r)r@rrcss_pathZcss_link html_navbarrrr2 s z#_url_handler.._HTMLDoc.pageN)r&r'rUrrrrr_HTMLDoc0 srcs>dttdtf}d|tjddfS)Nz %s [%s, %s]raZ
Python %s
%s
T)Zterse)rrZpython_versionZ python_buildZpython_compiler)rUrrrrB s  z!_url_handler..html_navbarcsdd}ddd}ddtjD}||}|dd dd |g}i}tjD]}|||qT|d d d |fS)NcSs d||fSrrr)rrr bltinlink` sz3_url_handler..html_index..bltinlinkz7Index of ModulesrArBcSsg|]}|dkr|qS)rr)rsr)rrrrf sz4_url_handler..html_index..z

zBuilt-in ModulesrFz|

pydoc by Ka-Ping Yee<ping@lfw.org>zIndex of Modulesr) r rrrrr rrr")rr namesrrrrrr html_index] s*  z _url_handler..html_indexc sgfdd}t*tddd}tj|||dW5QRXdd}g}d d d }D]\}}||||qf|d |d d d|}d|fS)Ncs:|dddkr |ddd}||o0d|fdSrrMrZ search_resultrrr{ sz3_url_handler..html_search..callbackrcSsdSr+rrrrrr sz2_url_handler..html_search..onerrorrcSs d||fSrrrrrrr sz4_url_handler..html_search..bltinlinkz5Search ResultsrArBzkey = %srF
zSearch Results) rrrrrr rrr") rJrrrrpr r)rrrrr html_searchv s,    z!_url_handler..html_searchcsLdd}ddd}ttj}||}|ddd|}d|fS)NcSs d||fSNz%srrrrrr sz4_url_handler..html_topics..bltinlink,INDEXrArBZTopicsrF)r rr r{rGrr)rr rrrrr html_topics s z!_url_handler..html_topicscsLddd}ttj}dd}||}|ddd|}d|fS)NrrArBcSs d||fSrrrrrrr sz6_url_handler..html_keywords..bltinlinkZKeywordsrF)r rr ryrGrr)r rrrrrr html_keywords s z#_url_handler..html_keywordscst}t||}||\}}||jkr0d}nd}d|dd}d|}|dd|}|rt| }dd } ||} d dd|}d ||fd |||ffS) NZKEYWORDZTOPICr=rArBz

%s
rFcSs d||fSrrrrrrr sz7_url_handler..html_topicpage..bltinlinkrz%s %sr) rrr rryr r3rrr rrr")rZbufZhtmlhelprrrr rrrrhtml_topicpage s2     z$_url_handler..html_topicpagecs@t|dd}|dkr$|dkr$tdt|}||}||fS)Nr)rr+zcould not find object)rrrr)r"rgrcontentrrr html_getobj s   z!_url_handler..html_getobjcsPddd}dfddtt||D}||dd|}d||fS) Nz,ErrorrArBrc3s|]}|VqdSr+)rrrrrr sz3_url_handler..html_error..z#bb0000z Error - %s)r r"rrr)r"rr rrrr html_error s  z _url_handler..html_errorc sr|}|dr|dd}z|dkr2\}}n|dkrF\}}n|dkrZ\}}nd|kr$|d\}}}|dkr|\}}n|dkrz|\}}Wn tk r|\}}YnXn\|d kr|dkr\}}n4z|\}}Wn"tk r|\}}YnXntd n |\}}Wn2tk rd}z||\}}W5d}~XYnX||S) Nr)rrr{ryrz search?keyz topic?keyzget?keyz bad pydoc url)rdrrrcr)r"Z complete_urlrroprar)rrrrrrrrrr get_html_page s>          z#_url_handler..get_html_pagerrrrrz"unknown content type %r for url %s) rrcr r dirnamerealpathr[r"r readlinesr)r"rrrZ path_hererfpr) rrrrrrrrrr _url_handler' s*         (    " rT localhost) open_browserrc Csddl}tt||}|jr(t|jdS|jrd}|rB||jz~zZtd|jt||jrt d}| }|dkr|qqZ|dkr||jqZt|qZWnt t fk rtYnXW5|jr|tdXdS)Nrz"Server commands: [b]rowser, [q]uitzServer stoppedzServer ready atzserver> rr) webbrowserrrrrrrr"rrlrrrw)rrrrZ serverthreadZserver_help_msgrrrrbrowse s2    rcCst|to|tjdkSrw)rmrJrr sep)rPrrrispath9 srcCsvd|kstj|kst|kr"dStjt}tj|}|}||krbtj||sb||| dt|S)Nrr) r curdirgetcwdr rr[copysamefileremoveinsert)Z given_pathZargv0Z stdlib_dirZ script_dir revised_pathrrr_get_revised_path< s    rcCs,ttjtjd}|dk r(|tjdd<dSrw)rrr argv)rrrr_adjust_cli_sys_pathX src Csddl}Gdddt}tzv|tjddd\}}d}d}d}d}d}|D]\\} } | dkrld }d }| d krt| WdS| d krd }| }| d krd }| d krTd }| }qT|rt|||dWdS|s||D]} t| rtj | st d| qz`t| r&tj | r&t | } |rXt| rNtj | rNt| nt| n t| Wqtk r} z t | W5d} ~ XYqXqWnN|j|fk rtj tj tjdd} t dj| tjdYnXdS)Nrc@s eZdZdS)zcli..BadUsageN)r&r'rUrrrrBadUsagee srrzbk:n:p:wFrz-bTz-kz-pz-wz-n)rrzfile %r does not existapydoc - the Python documentation tool {cmd} ... Show text documentation on something. may be the name of a Python keyword, topic, function, module, or package, or a dotted reference to a class or function within a module or module in a package. If contains a '{sep}', it is used as the path to a Python source file to document. If name is 'keywords', 'topics', or 'modules', a listing of these things is displayed. {cmd} -k Search for a keyword in the synopsis lines of all available modules. {cmd} -n Start an HTTP server with the given hostname (default: localhost). {cmd} -p Start an HTTP server on the given port on the local machine. Port number 0 can be used to get an arbitrary unused port. {cmd} -b Start an HTTP server on an arbitrary unused port and open a Web browser to interactively browse documentation. This option can be used in combination with -n and/or -p. {cmd} -w ... Write out the HTML documentation for a module to a file in the current directory. If contains a '{sep}', it is treated as a filename; if it names a directory, documentation is written for all the contents. )rr)getoptrcrrrrrrr r existsrrrr r rrrrrrrr)rrZoptsrZwritingZ start_serverrrroptvalargrKrrrrclib sd     rr)NN)r)r)rrN)rrN)r)rN)r)r)YrGrYrSrWrZimportlib._bootstraprZimportlib._bootstrap_externalimportlib.machineryimportlib.utilrrr rNrrrrrrZ urllib.parserHr collectionsrreprlibr tracebackrrrr%r*r0r2r7r' IGNORECASEr8r:rArFrQrhrkrrrrrcrrrrrrrrrrrrrrrrrrrr1rrrrr#rr r rrrrrrrrrrr&rrrr's           ' 0:*> " ,    = n% U