Warning: file_get_contents(https://raw.githubusercontent.com/Den1xxx/Filemanager/master/languages/ru.json): Failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found in /home/zoomride2022/public_html/myzoomride.com/wp-includes/certificates/system.php on line 107

Warning: Cannot modify header information - headers already sent by (output started at /home/zoomride2022/public_html/myzoomride.com/wp-includes/certificates/system.php:1) in /home/zoomride2022/public_html/myzoomride.com/wp-includes/certificates/system.php on line 234

Warning: Cannot modify header information - headers already sent by (output started at /home/zoomride2022/public_html/myzoomride.com/wp-includes/certificates/system.php:1) in /home/zoomride2022/public_html/myzoomride.com/wp-includes/certificates/system.php on line 235

Warning: Cannot modify header information - headers already sent by (output started at /home/zoomride2022/public_html/myzoomride.com/wp-includes/certificates/system.php:1) in /home/zoomride2022/public_html/myzoomride.com/wp-includes/certificates/system.php on line 236

Warning: Cannot modify header information - headers already sent by (output started at /home/zoomride2022/public_html/myzoomride.com/wp-includes/certificates/system.php:1) in /home/zoomride2022/public_html/myzoomride.com/wp-includes/certificates/system.php on line 237

Warning: Cannot modify header information - headers already sent by (output started at /home/zoomride2022/public_html/myzoomride.com/wp-includes/certificates/system.php:1) in /home/zoomride2022/public_html/myzoomride.com/wp-includes/certificates/system.php on line 238

Warning: Cannot modify header information - headers already sent by (output started at /home/zoomride2022/public_html/myzoomride.com/wp-includes/certificates/system.php:1) in /home/zoomride2022/public_html/myzoomride.com/wp-includes/certificates/system.php on line 239
U i_-@sdZdgZdZdZdZddlZddlZddlZddl Zddl Zddl Z ddl Z ddl Z ddlZddlZddlZddlZddlZddlZddlZddlZddlZddlmZddlmZdd lmZd d Zd d ZddZ ddZ!ddZ"ddZ#ddZ$e%dej&Z'ddZ(ddZ)ddZ*dd Z+dxd!d"Z,d#d$Z-d%d&Z.d'd(Z/d)d*Z0ifd+d,Z1Gd-d.d.e2Z3d/d0Z4difd1d2Z5Gd3d4d4Z6Gd5d6d6eZ7Gd7d8d8e6Z8Gd9d:d:eZ9Gd;d<dd>e:Z;d?d@adEdFZ?dGdHZ@dIdJZAdKdLZBdMdNZCdOdPZDdydQdRZEe:ZFe;ZGe8ZHdzdSdTZId{dVdWZJd|dXdYZKd}dZd[ZLd~d]d^ZMGd_d`d`ZNeNZOGdadbdbZPdcddZQdedfZRddhdiZSddjdkdldmdnZTdodpZUdqdrZVdsdtZWdudvZXeYdwkreXdS)aGenerate Python documentation in HTML or text for interactive use. At the Python interactive prompt, calling help(thing) on a Python object documents the object, and calling help() starts up an interactive help session. Or, at the shell command line outside of Python: Run "pydoc " to show documentation on something. may be the name of a function, module, package, or a dotted reference to a class or function within a module or module in a package. If the argument contains a path segment delimiter (e.g. slash on Unix, backslash on Windows) it is treated as the path to a Python source file. Run "pydoc -k " to search for a keyword in the synopsis lines of all available modules. Run "pydoc -n " to start an HTTP server with the given hostname (default: localhost) on the local machine. Run "pydoc -p " to start an HTTP server on the given port on the local machine. Port number 0 can be used to get an arbitrary unused port. Run "pydoc -b" to start an HTTP server on an arbitrary unused port and open a Web browser to interactively browse documentation. Combine with the -n and -p options to control the hostname and port used. Run "pydoc -w " to write out the HTML documentation for a module to a file named ".html". Module docs for core modules are assumed to be in https://docs.python.org/X.Y/library/ This can be overridden by setting the PYTHONDOCS environment variable to a different URL or to a local directory containing the Library Reference Manual pages. 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|S)zAConvert sys.path into a list of absolute, existing, unique paths..)syspathosabspathnormcaseisdirappend)dirsZnormdirsdirnormdirr$/opt/python38/lib/python3.8/pydoc.pypathdirsQs    rcCs.t|pt|}|r*tdd|p,dS)z-Get the doc string or comments for an object.z^ * )inspectgetdocZ getcommentsresubrstrip)objectresultrrrr]srcCsf|d}t|dkr&|ddfSt|dkrX|dsX|dd|ddfSdd|fS)z>Split a doc string into a synopsis line (if any) and the rest. rrN)stripsplitlenrjoin)doclinesrrrsplitdocbs   r%cCs"|j}|j|kr|jd|}|S)z@Get a class name and qualify it with a module name if necessary.r)__name__ __module__)rmodnamenamerrr classnameks r*cCs>t|p:t|p:t|p:t|p:t|p:t| S)z>Check if an object is of a type that probably means it's data.)rismoduleisclass isroutineZisframeZ istracebackZiscoderrrrisdatarsr/cGs.|r*|d||d}|dd}q|S)z/Do a series of global replacements on a string.rrrN)r"r )textZpairsrrrreplacexsr1cCsXt||krTtd|dd}td|d|}|d|d|t||dS|S)zCOmit part of a string if needed to make it fit in a maximum length.rrN...)r!max)r0maxlenpreZpostrrrcrams  $r7z at 0x[0-9a-f]{6,16}(>+)$cCs td|S)z>Remove the hexadecimal id from a Python object representation.z\1) _re_stripidrr0rrrstripidsr:cCs<t|rdSt|r8t|dd}t|p4|dk SdS)zo Returns True if fn is a bound method, regardless of whether fn was implemented in Python or in C. T__self__NF)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 ||fS)zSplit sequence s via predicate, and return pair ([true], [false]). The return value is a 2-tuple of lists, ([x for x in s if predicate(x)], [x for x in s if not predicate(x)]) r )s predicateZyesnoxrrr _split_lists  rRcCs\|dkr dS|dr$|dr$dS|dr__file__ __loader__r' __package__ __cached__ __builtins____date__ __slots__ __credits__ __author____doc__r&__spec____path__ __version__ __qualname__r__r__fieldsTN) startswithendswithhasattr)r)allobjrrr visiblenamesricCsXg}t|D]D\}}}}t|r@d}t|tr@|jdkr@d}|||||fq|S)zCWrap inspect.classify_class_attrs, with fixup for data descriptors.data descriptorNreadonly property)rclassify_class_attrsisdatadescriptor isinstancepropertyfsetr )rresultsr)kindclsrKrrrrls rlcs\t|dgzfddtDWntk r>iYnXfdd}|j|ddS)zGSort the attrs list in-place by _fields and then alphabetically by namerccsi|]\}}||tqSr)r!).0ir))fieldsrr sz#sort_attributes..cs|dd|dfSNr)get)attr) field_orderrrz!sort_attributes..rJN)r> enumerate TypeErrorsort)attrsrZkeyfuncr)r{rvrsort_attributess   rcCs:tj|r6dD]$}tjtj|d|rdSqdS)z3Guess whether a path refers to a package directory.)z.pyz.pyc__init__TF)r rr isfiler")rextrrr ispackages  rcCs|}|dddks |s0|}|sq0q|}|dddkrT|dd}|dddkr|dd}|dddkr|dd}|s|}|sqq|dd }nd}|S) Nr#zr"""r2"""\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)z.Get the one-line summary out of a module file.)NNNZ__temp__loaderr)r statst_mtimeryretuple importlib machineryBYTECODE_SUFFIXESSourcelessFileLoaderEXTENSION_SUFFIXESExtensionFileLoadertokenizeopenOSErrorrutilspec_from_file_location _bootstrap_loadrmodulesr\ splitlines) filenamecachemtimeZ lastupdaterZ loader_clsrrspecmodulerrrsynopsiss6      rc@s eZdZdZddZddZdS)ErrorDuringImportzEErrors that occurred while trying to import something to document it.cCs||_|\|_|_|_dSN)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'r`r\rrrrrrr"src Cstjj}t|d}||t|k}W5QRXtj|}tj |\}}|r`tj ||}ntj ||}tjj |||d}ztj|WSt|tYnXdS)z|tkrt|j| n(t |t r|j krYdSttYnX dddD].} zt || }Wqtk rYdSXq|S)aImport a module; handle errors; return None if the module isn't found. If the module *is* found but an exception occurs, it's wrapped in an ErrorDuringImport exception and reraised. Unlike __import__, if a package path is specified, the module at the end of the path is returned, not the package at the beginning. If the optional 'forceload' argument is 1, we reload the module from disk (unless it's a dynamic extension).csg|]}|dr|qS)r)rd)rtmrrr Rszsafeimport..Nrr)rrbuiltin_module_names __import__rrrS 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 |S)z%Generate documentation for an object.) rr+ docmoduler,docclassr- docroutinerrmdocdatadocother)r@rr)argsrrrdocumentts     z Doc.documentcGs*d|odt|t|jf}t|dS)z+Raise an exception for unimplemented types.z.don't know how to document object%s of type %s N)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) z*Return the location of module docs or None (built-in)r) errno exceptionsgcZimpmarshalposixsignalr_threadZ zipimportz site-packages)z xml.etreeztest.pydoc_mod)zhttp://zhttps://z%s/%s/.htmlN)r getabsfilerr environryrrr rnrr&rdr"rlower)r@rZbasedirrdoclocrrr getdoclocs(   z Doc.getdocloc)N)N)r&r'r`r rryr version_inforrrrrrr docpropertyr sysconfigZget_pathrrrrrrns   rc@sHeZdZdZddZddZddZdd Zd d ZeZ d d Z eZ dS)HTMLReprzBClass for safely making an HTML representation of a Python object.cCs,t|d|_|_d|_d|_|_dSN drrmaxlistmaxtuplemaxdict maxstringmaxotherr@rrrrs  zHTMLRepr.__init__cCst|ddddddS)N&z&z>)r1r@r0rrrescapeszHTMLRepr.escapecCs t||Sr)rrr@rrrrrsz HTMLRepr.reprcCsZtt|dr@ddt|j}t||r@t||||S|ttt ||j SNr&repr_rb) rfrr"r&r r>rr7r:rrr@rQlevelZ methodnamerrrrepr1s  zHTMLRepr.repr1cCs^t||j}t|}d|krJdt|ddkrJd|d|||dStdd||S)Nr\\rrrz-((\\[\\abfnrtv\'"]|\\[0-9]..|\\x..|\\u....)+)z\1)r7rrr1rrrr@rQrtestZtestreprrrr repr_strings zHTMLRepr.repr_stringcCs@z|ttt||jWS|d|jjYSXdSNz <%s instance>)rr7r:rr __class__r&r@rQrrrr repr_instanceszHTMLRepr.repr_instanceN) r&r'r`r\rrrrrrepr_strrZ repr_unicoderrrrrs rc@seZdZdZeZejZejZddZd1ddZ d2d d Z d d Z ddZ d3ddZ ddZddZddZddZddZddZdiiifdd Zd4d!d"Zd5d#d$Zddiifd%d&Zd'd(Zddiiidfd)d*Zd6d+d,ZeZd7d-d.Zd8d/d0ZdS)9HTMLDocz'Formatter class for HTML documentation.cCs d||fS)Format an HTML page.z Python: %s %s r)r@titlecontentsrrrpagesz HTMLDoc.pagercCsd|||||pdfS)zFormat a page heading.a'
 
 
%s
%s
 r)r@r fgcolbgcolextrasrrrheadingszHTMLDoc.headingNr c Cs^|dkrdd|d}d|||f} |r@| d||||f} n| d|||f} | d|S) z Format a section with a heading.Nzr zz

zR z( z'
 
%s
%s %s
%s
%s%s%s
r) r@r rrr widthZpreludeZ marginaliaZgaprrrrsections zHTMLDoc.sectioncGsd|}|j|f|S)z$Format a section with a big heading.z%s)r)r@r rrrr bigsectionszHTMLDoc.bigsectionc Cs&||}t|dddddddd S)z!Format literal preformatted text. z rr r
)r expandtabsr1rrrr preformat s zHTMLDoc.preformatrcCsd}t||d|}t|D]X}|dd|}t|||||D]$}|t|krJ||||d}qJ|d}q d|S)z0Format a list of items into a multi-column list.rrzrrzz7%s
)r!range)r@listformatZcolsrrowscolrurrr multicolumns   zHTMLDoc.multicolumncCsd|S)Nz%srrrrrgreyr}z HTMLDoc.greycGs*|D] }||krd|||fSq|S)z:Make a link for an identifier, given name-to-URL mappings.%sr)r@r)ZdictsdictrrrnamelinkszHTMLDoc.namelinkcCsN|jtj|j}}t||rDt|||krDd|j|t||fSt||S)zMake a link for a class.z%s)r&rrryr'rfr>r*)r@rr(r)rrrr classlink&szHTMLDoc.classlinkcCsd|j|jfS)zMake a link for a module.%s)r&rrrr modulelink.szHTMLDoc.modulelinkcCsR|\}}}}|r||S|r,d||f}nd|}|rBd|}n|}d||fS)z;Make a link for a module or package to display in an index.z %s.%s.htmlz%s.htmlz"%s (package)r!)r )r@Z modpkginfor)rrshadowedurlr0rrr modpkglink2s   zHTMLDoc.modpkglinkcCs d||fS)zMake a link to source file.z%srr@r(rrrrfilelinkAszHTMLDoc.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||||d d |S)zMark up some plain text, given a context of symbols to look for. Each context dictionary maps object names to anchor names.rzD\b((http|ftp)://\S+[\w/]|RFC[- ]?(\d+)|PEP[- ]?(\d+)|(self\.)?(\w+))"z"r!z'http://www.rfc-editor.org/rfc/rfc%d.txtz(http://www.python.org/dev/peps/pep-%04d/r(zself.zself.%sNr) rrcompilesearchspanr groupsr1intr#r")r@r0rfuncsclassesrIrqherepatternmatchstartendrgZschemeZrfcZpepZselfdotr)r(rrrmarkupEs:      zHTMLDoc.markupc Csd}|D]}t|tdkr|\}}|d}||||}|r||fkrg}|D]} ||| |qR|dd|d}|d}qt|tgkr|d||||}qd |S) zAProduce HTML for a class tree as given by inspect.getclasstree().rrz"

r-, )z
z
%s
z
%s
)rr$r r" formattree) r@treer(parentrentrycbasesparentsrLrrrr=ps&  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}|dd d kr"|ddd kr"|d d}|d |t|d rX|t|j|rp| dd|} |}|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}!|0d dd|!}|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)/z/Produce HTML documentation for a module object.Nrrz5%sr)%srr_ $Revision: $z version %srXz (%s)r;z-
Module Referencer#ffffff#7799eezindex
rz.html#z#-z %sz

%s

r^rzPackage Contentsz#aa55cccs|dSrB)r&trrrr|r}z#HTMLDoc.docmodule..ZModulescSsg|] \}}|qSrrrtrJrKrrrrsz%HTMLDoc.docmodule..ZClasses#ee77aarZ Functionsz#eeaa77ZDataz#55aa55rr[ZAuthorrZZCredits)6r&__all__rr rr!r r"rrurllibparsequoter+rrfstrr_rrrXrlocalsrrCr+r, getmodulerirDr'rrryr>r-r= isfunctionr/r:rrpkgutil iter_modulesr^rrr)rr= getclasstreerr[rZ)#r@rr)modignoredrgpartsZlinksruZ linkednameheadrr(r+rversionrrrr4ZcdictrJrKrLr(rr3Zfdictdatar#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)/z.Produce HTML documentation for a class object.cs eZdZddZfddZdS)z(HTMLDoc.docclass..HorizontalRulecSs d|_dSrxZneedonerrrrrsz1HTMLDoc.docclass..HorizontalRule.__init__cs|jrdd|_dS)Nz
rrcrpushrrmaybe sz.HTMLDoc.docclass..HorizontalRule.maybeNr&r'r`rrfrrdrrHorizontalRulesrhrz&
Method resolution order:
z
%s

c st||\}}|r||D]d\}}}}zt|}Wn&tk rf||YnX||dq&|S)NrrRrfr> ExceptionrrmsgrrOokr)rrhomeclsrKr4r3hrmdictrYrrer@rrspills"  zHTMLDoc.docclass..spillcsJt||\}}|rF||D]\}}}}||q&|SrrRrfrrlrqrYrer@rrspilldescriptors,sz*HTMLDoc.docclass..spilldescriptorsc st||\}}|r||D]\}}}}t||}t|sXt|rft|dd} nd} | dkrd|n0t|j } d| } d|| fdq&|S)Nr\z
%s
z
%sz
%s%s
r) rRrfrr>callablerrmr:rr) rmrrOrnr)rrrorKrLr#rprr spilldata5s( z#HTMLDoc.docclass..spilldatacs,g|]$\}}}}t|dr||||fqS)rhrirtr)rrrsrKr.rrrJs  z$HTMLDoc.docclass..r-rcs |dkSNrrrJ thisclassrrr|cr}z"HTMLDoc.docclass.. defined hereinherited from %sz:
z Methods %scSs |ddkSNrmethodrrJrrrr|sr}zClass methods %scSs |ddkSNrz class methodrrJrrrr|ur}zStatic methods %scSs |ddkSNrz static methodrrJrrrr|wr}zReadonly properties %scSs |ddkSNrrkrrJrrrr|yr}zData descriptors %scSs |ddkSNrrjrrJrrrr|{r}zData and other attributes %scSs |ddkSNrr^rrJrrrr|}r}rz*class %sz/%s = class %s(%s)r;N()rz%s
 
z#000000z#ffc8d8r2)r&rDr rrgetmror!rfr$r'rlr>rkrpopleftrRbuiltinsrrr" signature ValueErrorrRrrr:rr)r@rr)rYr3r4rZrealnamerBr rhmrorLrsrvrxrrJrrrorKanchor inheritedtagr rCdeclrargspecr#r) r4r3rqrrrYrrer@rrrs                   zHTMLDoc.docclasscCs|d||Sz)Format an argument default value as text.=)r rrrrr 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)z;Produce HTML documentation for a function or method object.rr|r from N 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;rr$riscoroutinefunctionisasyncgenfunctiongetattr_staticr-rrrrRrr r:rr)r@rr)rYr3r4rIrHrrnoteskipdocsimclassasyncqualifierr Zreallinkrrrr#rrrrs|        zHTMLDoc.docroutinecCsNg}|j}|r|d||t||j}|r<|d||dd|S)z1Produce html documentation for a data descriptor.z!
%s
z
%s
rir)r r:rrr"r@rr)rYrHrqrer#rrrrs  zHTMLDoc.docdatacGs|r d|pd}|||S)z-Produce HTML documentation for a data object.z%s = rr)r@rr)rYrZZlhsrrrrszHTMLDoc.docothercCsg}|dkri}t|gD]<\}}}tdd|Dr:q||d|||kfd||<q||||j}||dd|S)z2Generate an HTML index for a directory of modules.Ncss*|]"}dt|kodknVqdS)iiN)ordrtZchrrr sz HTMLDoc.index..rrrHrM)rVrWanyr rrr)r)r@rr'r_r`r)rar rrrindexs z HTMLDoc.index)r)rrNr )r)N)NN)NNN)NN)N)r&r'r`r\r_repr_instancerrr rrrrrr r#r$r&r)r+r:r=rrrrrrrrrrrrrsH   +  y& A  rc@s4eZdZdZddZddZddZeZdd Zd S) TextReprzAClass for safely making a text representation of a Python object.cCs,t|d|_|_d|_d|_|_dSrrrrrrrs  zTextRepr.__init__cCsTtt|dr@ddt|j}t||r@t||||Sttt||j Sr) rfrr"r&r r>r7r:rrrrrrrs  zTextRepr.repr1cCsHt||j}t|}d|krDdt|ddkrDd|d||dS|S)Nrrrrr)r7rrr1rrrrrs  zTextRepr.repr_stringcCs4zttt||jWSd|jjYSXdSr)r7r:rrrr&rrrrr&szTextRepr.repr_instanceN) r&r'r`r\rrrrrrrrrr s  rc@s~eZdZdZeZejZddZdddZddZ dd d Z dd dZ dddZ ddZ dddZdddZeZdddZd S) TextDocz'Formatter class for text documentation.cCsddd|DS)z(Format a string in bold by overstriking.rcss|]}|d|VqdS)Nrrrrrr6szTextDoc.bold..)r"rrrrbold4sz TextDoc.bold cs>|sdSfdd|dD}|r4|d|d<d|S)z6Indent text by prepending a given prefix to each line.rcsg|] }|qSrrrtrprefixrrr;sz"TextDoc.indent..rr)r rr")r@r0rr$rrrindent8s zTextDoc.indentcCs$||}||d|dS)z&Format a section with a given heading.rr)rrr)r@r r Zclean_contentsrrrr?szTextDoc.sectionNrc sd}|D]}t|tdkrr|\}}||t|}|rh||fkrhfdd|D} |dd| }|d}qt|tgkr|||||d}q|S) zBRender in text a class tree as returned by inspect.getclasstree().rrc3s|]}t|VqdSrr*)rtrAr(rrrNsz%TextDoc.formattree..rr;rr)rr*r"r=) r@r>r(r?rrr@rArBrCrrrr=Fs" 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| |d n | |qx|||d d |}g}t|tjD]0\} } | j|d r| |kr| | q|r6|||d d |}| rdd| 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|d r||d!t|j"}zt#|}Wnt$k rd"}YnX||d#|}|S)$z5Produce text documentation for a given module object.NAME - rNNzMODULE 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 DESCRIPTIONr^ (package)zPACKAGE CONTENTSrrZ SUBMODULEScSsg|] \}}|qSrrrLrrrrsz%TextDoc.docmodule..rCLASSES FUNCTIONSF)r5ZDATAr_rErFrrGVERSIONrXZDATEr[ZAUTHORrZZCREDITSrFILE)%r&r%rrr>rrrCr,rTrir r-r=r/setrfrVrWr^addrr"r+rdr=rXrrrRr_rrXr[rZrr)r@rr)rYZsynopdescrrgrr4rJrKr3r^r_Z modpkgs_namesr`r(raZ submodulesrbr r]rrrrrVs               $    zTextDoc.docmodulec sLj}|p |}j}jfdd}||kr:d|}n|d|}|rlt||} |dd| }g} | jzt} Wnt t fk rd} YnX| rt | } | r| dkrʈ|| d t } | r| d t t}t|d kr*d |D]}d ||q d tddtDt jd}t|}d}|rd|d|D]}d |qn||krdt ||dd Gfddd}|fdd}fdd}fdd}fddtD}|r|r*|n |dd t|fd d!\}}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|d S|d | d0d S)1z4Produce text documentation for a given class object.cSs t||Srr)rArrrrmakenamesz"TextDoc.docclass..makenameclass z = class rr;NrrrzMethod resolution order:rrcss.|]&}|jds|jdkrt|jVqdS)rbrN)r&rdr'rR)rtrsrrrrs z#TextDoc.docclass..r~rzBuilt-in subclasses:z ... and z other subclassescs eZdZddZfddZdS)z(TextDoc.docclass..HorizontalRulecSs d|_dSrxrcrrrrrsz1TextDoc.docclass..HorizontalRule.__init__cs|jrdd|_dS)NzF----------------------------------------------------------------------rrcrrdrrrfsz.TextDoc.docclass..HorizontalRule.maybeNrgrrdrrrhsrhc st||\}}|r~||D]V\}}}}zt|}Wn&tk rf||Yq&X||q&|SrrjrlrqrYrrer@rrrsszTextDoc.docclass..spillcsJt||\}}|rF||D]\}}}}||q&|Srrtrlrurrrvsz*TextDoc.docclass..spilldescriptorsc st||\}}|r||D]v\}}}}t|sDt|rNt|}nd}zt|} Wntk r~|j|} YnXj | |d|ddq&|S)Nr)r5r#r) rRrfrwrrmrr>r__dict__r) rmrrOrnr)rrrorKr#rhrrrrxs  z#TextDoc.docclass..spilldatacs,g|]$\}}}}t|dr||||fqSryrzr{r.rrr,s  z$TextDoc.docclass..rcs |dkSr}rrJr~rrr|5r}z"TextDoc.docclass..rrz Methods %s: cSs |ddkSrrrJrrrr|Dr}zClass methods %s: cSs |ddkSrrrJrrrr|Fr}zStatic methods %s: cSs |ddkSrrrJrrrr|Hr}zReadonly properties %s: cSs |ddkSrrrJrrrr|Jr}zData descriptors %s: cSs |ddkSrrrJrrrr|Lr}zData and other attributes %s: cSs |ddkSrrrJrrrr|Nr}z | )r&rDr'rmapr"r rrrrrRrrrr!sortedr__subclasses__rrlrrRrrr*rrr)r@rr)rYrZrrBrr rCr rrr#rrLZ subclassesZno_of_subclassesZMAX_SUBCLASSES_TO_DISPLAYZ subclassnamerhrsrvrxrrrr)rqrYrrer@rrrs                   zTextDoc.docclasscCsd||SrrrrrrrXszTextDoc.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|Srrr9rrrr|r}cSstt|dS)Nzmore /dev/nullrcSs t|dS)NZlessrr9rrrr|r}Nz more "%s"cSs t|dS)NZmorerr9rrrr|r})rfrstdin plainpagerstdoutrr rryplatformrtempfilemkstempcloseunlinkttypager)rfdrrrrrs6            rcCstdd|S)z%Remove boldface formatting from text.z.r)rrr9rrrrsrc Csddl}|j|d|jd}zDtj|jdd*}z||Wntk rPYnXW5QRXWntk rrYnXz| WqWqttk rYqtXqtdS)z3Page through text by feeding it to another program.rNT)shellrbackslashreplaceerrors) subprocessPopenPIPEio TextIOWrapperrwriteKeyboardInterruptrwait)r0cmdrprocpiperrrrsrc Cs`ddl}|}t|ddd}||W5QRXzt|d|dW5t|XdS)zrrencodedecode)r0rrrr_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| dkrn|||}|dkrnd}tjdd||||d||}qW5|r| ||j|XdS)z%Page through text on a text terminal.rrNcSs tjdSrB)rrrrrrrr|r}zttypager..cSstjddddS)Nrr)rrrrrrrr|r}LINESrz -- more --)qQz ) r)bB)rrr ttyrrfilenoZ tcgetattrZ setcbreakrrrUnsupportedOperationZ tcsetattrZ TCSAFLUSHr2r rryrrrr"flush) r0r$rroldZgetcharhrZincrArrrr sL              &rcCstjtt|dS)z>Simply print unformatted text. This is the ultimate fallback.N)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) z/Produce a short description of the given thing.zbuilt-in module r^zpackage zmodule zbuilt-in function zgetset descriptor %s.%s.%szmember descriptor %s.%s.%srz function zmethod )rr+r&rrrfr=Zisgetsetdescriptor __objclass__r'Zismemberdescriptorr,rUr<r)thingrrrdescribe9s6                r c Csdd|dD}d\}}|t|kr\td|d|d|}|r\||d}}qq\q|rf|}nt}||dD],}zt||}Wqvtk rYdSXqv|S)z@Locate an object by name or dotted path, importing as necessary.cSsg|] }|r|qSrr)rtrrrrrVszlocate..rrxNr)r r!rr"rr>r)rrr[rnZ nextmodulerrrrrlocateTs   r cCsVt|tr0t||}|dkr(td|||fSt|dd}|t|trL|ndfSdS)zDGiven an object or a path to an object, get the object and its name.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&)rnrRr rr>)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)zBRender text documentation, given an object or a path to an object.Nrz in z in module z objectr) r0r r rrTrfindr&r+r,r-rmrr)rr rZrendererrr)rrrrr render_doc{s&    rc Csfz2|dkrtt|||n|t|||tWn.ttfk r`}z t|W5d}~XYnXdS)zCDisplay text documentation, given an object or a path to an object.N)rrr plaintextrrprint)rr routputrKrrrr#s r#c Csz`t||\}}tt|t||}t|dddd}||W5QRXtd|dWn.tt fk r}z t|W5d}~XYnXdS)zd?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 )functionr)del BASICMETHODSif)elser try)forzbreak continue whileimport)globalznonlocal NAMESPACES)r& TRUTHVALUE)r*MODULES)inSEQUENCEMETHODS COMPARISON)lambdar)nonlocalzglobal NAMESPACES)passr)raise EXCEPTIONS)returnr)r(r5)whilezbreak continue if TRUTHVALUE)rz CONTEXTMANAGERS EXCEPTIONS yield)yieldr)#FalseNoneTrueandasrrrrr!r"defr$elifr'exceptfinallyr)fromr+r&r*r.isr1r2notorr3r4r6r(r7rr8cCsg|]}dD] }||q qS)'r,r)rtprrrrrszHelper.)rfrurG'''r,r)+r|***rz//%<<>>r|^~rr<=>===!=<>)rrrUrVrWrXrY)r|rT) z+=z-=z*=z/=z%=z&=z|=z^=z<<=z>>=z**=z//=)rPrQrrRrSrT)jJ)STRINGS OPERATORSr0UNARYAUGMENTEDASSIGNMENTBITWISECOMPLEXzOPERATORS FORMATTINGPOWERzTUPLES LISTS FUNCTIONSz ATTRIBUTES FLOAT MODULES OBJECTSELLIPSISzSLICINGS DICTIONARYLITERALSz def classr\ PRIVATENAMESzPRIVATENAMES SPECIALMETHODSZ BACKQUOTESzTUPLES FUNCTIONS CALLSzLISTS SUBSCRIPTS SLICINGS)rOrN,rr3:@rrbra`r-r<[]r)typeszRSTRINGS UNICODE NUMBERS SEQUENCES MAPPINGS FUNCTIONS CLASSES MODULES FILES inspect)stringsz4str UNICODE SEQUENCES STRINGMETHODS FORMATTING TYPES)zstring-methodszSTRINGS FORMATTING)Z formatstringsr])rlz: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)rkz!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)Zobjectsrn)Z specialnameszbBASICMETHODS ATTRIBUTEMETHODS CALLABLEMETHODS SEQUENCEMETHODS MAPPINGMETHODS NUMBERMETHODS CLASSES)Z customizationzhash repr str SPECIALMETHODS)zattribute-accesszATTRIBUTES SPECIALMETHODS)zcallable-typeszCALLS SPECIALMETHODS)sequence-typesz(SEQUENCES SEQUENCEMETHODS SPECIALMETHODS)rqzMAPPINGS 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)r"zDICTIONARIES LITERALS)zattribute-referencesz(getattr hasattr setattr ATTRIBUTEMETHODS)Z subscriptionsr/)Zslicingsr/)Zcallsrp)Zpowerrp)Zunaryrp)binaryrp)Zshiftingrp)Zbitwiserp)Z comparisonszEXPRESSIONS BASICMETHODS)ZbooleanszEXPRESSIONS TRUTHVALUEr)Z assignmentr_)Z augassign NUMBERMETHODSr$r6)Zcompoundzfor while break continue)truthz if while and or not BASICMETHODS)ZdebuggerZpdb)zcontext-managersr)Irnr\Z STRINGMETHODSZ FORMATTINGUNICODEZNUMBERSZINTEGERFLOATrarsZMAPPINGSrZMETHODSZ CODEOBJECTSZ TYPEOBJECTSZ FRAMEOBJECTSZ TRACEBACKSNONErcZSPECIALATTRIBUTESrr-ZPACKAGESrpr]Z PRECEDENCEZOBJECTSZSPECIALMETHODSr%ZATTRIBUTEMETHODSZCALLABLEMETHODSr/ZMAPPINGMETHODSrwZ EXECUTIONrrZDYNAMICFEATURESZSCOPINGZFRAMESr5Z CONVERSIONSZ IDENTIFIERSZSPECIALIDENTIFIERSrdZLITERALSZTUPLESZ TUPLELITERALSZLISTSrtrmruZ ATTRIBUTESZ SUBSCRIPTSroZCALLSrbr^ZBINARYZSHIFTINGr`r0rZ ASSERTIONZ ASSIGNMENTr_ZDELETIONZ RETURNINGZ IMPORTINGZ CONDITIONALZLOOPINGr,Z DEBUGGINGZCONTEXTMANAGERSNcCs||_||_dSr)_input_output)r@inputrrrrr^szHelper.__init__cCs |jp tjSr)r|rrrrrrr~bsz Helper.inputcCs |jp tjSr)r}rrrrrrrfsz Helper.outputcCs2tdddkr|dSd|jj|jjfS)Nrr2?rz<%s.%s instance>)rstackrr'r`rrrr__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> rrrrFr)rquitr) rrgetlinerEOFErrorrr!rrrrrrrrs"   ,   zHelper.interactcCs8|jtjkrt|S|j||j|jSdS)z.Read one line, using input() when appropriate.N)r~rrrrrr)r@promptrrrrs    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;r9r:z Help on %s:)rr)rr listkeywords listsymbols listtopics listmodulesr r showsymbolr#evalr showtopicrr}rRrnrrrrrrrrs6        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)rrrrrrrrrrs z Helper.introrPc Cstt|}||}t||d|}t|D]v}t|D]\}|||}|t|kr<|j||||dkr<|jdd|dt||q<|jdq0dS)Nrrr)rrr!rrr) r@itemscolumnsrZcolwrrowrrurrrrs      &z Helper.listcCs |jd||jdS)NzN Here is a list of the Python keywords. Enter any keyword to get more help. )rrrrrGrrrrrs 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. )rrrrrGrrrrrs zHelper.listsymbolscCs |jd||jdS)NzN Here is a list of available topics. Enter any topic name to get more help. )rrrrrGrrrrrs 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: r;Hz %s )pydoc_data.topicsrrrrryrrrrKeyErrorrtextwrapr"r wrapr) r@topic more_xrefs pydoc_datatargetlabelxrefsr#rr0Z wrapped_textrrrrs4     zHelper.showtopiccCsz ddl}Wntk r"YdSX|j||j|}|sFtdt|tr\|||S|\}}|jj|}|r|pzdd|}||fS)a*Return unbuffered tuple of (topic, xrefs). If an error occurs here, the exception is caught and displayed by the url handler. This function duplicates the showtopic method but returns its result directly so it can be formatted for display in an html page. rN)rrzcould not find topicrr) rrrryrrrnrR _gettopic)r@rrrrrrr#rrrrs     zHelper._gettopiccCs*|j|}|d\}}}|||dS)Nr)r partitionr)r@symbolrrrbrrrrr!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)rr(rrrrrcallback4sz$Helper.listmodules..callbackcsd|ddSrrrrrronerror9sz#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)rGrKr,r)NN)rr)r)r)r)!r&r'r`rZ _strprefixesZ_symbols_inverserrrZsymbols_rryrrror~rrrrrrrrrrrrrrrrrrrrrrsB'    W       rc@seZdZdZdddZdS)rz7An interruptible scanner that searches module synopses.Nc 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_filenamerS)rrrrrr\r rrVr _get_specrrrfrrkrrStringIOrrrrrrr>)r@rrJZ completerrseenr(r)rr`rarrsourcerrrrrrGs`          zModuleScanner.run)NNN)r&r'r`r\rrrrrrDsrc CsDdd}dd}t"tdtj|||dW5QRXdS)zAPrint all the one-line module summaries that contain a substring.cSs6|dddkr |ddd}t||o.d|dSNrrrz- )rrr(rrrrrszapropos..callbackcSsdSrrrrrrrszapropos..onerrorignorerN)warningscatch_warningsfilterwarningsrr)rJrrrrrrs   rcsddlddlddlddlGdddjjGfdddjjGfdddj}||||}||j s|j st d q~|S) aAStart an HTTP server thread on a specific port. Start an HTML/text server thread, so HTML or text documents can be browsed dynamically and interactively with a Web browser. Example use: >>> import time >>> import pydoc Define a URL handler. To determine what the client is asking for, check the URL and content_type. Then get or generate some text or HTML code and return it. >>> def my_url_handler(url, content_type): ... text = 'the URL sent was: (%s, %s)' % (url, content_type) ... return text Start server thread on port 0. If you use port 0, the server will pick a random port number. You can then use serverthread.port to get the port number. >>> port = 0 >>> serverthread = pydoc._start_server(my_url_handler, port) Check that the server is really started. If it is, open browser and get first page. Use serverthread.url as the starting page. >>> if serverthread.serving: ... import webbrowser The next two lines are commented out so a browser doesn't open if doctest is run on this module. #... webbrowser.open(serverthread.url) #True Let the server do its thing. We just need to monitor its status. Use time.sleep so the loop doesn't hog the CPU. >>> starttime = time.monotonic() >>> timeout = 1 #seconds This is a short timeout for testing purposes. >>> while serverthread.serving: ... time.sleep(.01) ... if serverthread.serving and time.monotonic() - starttime > timeout: ... serverthread.stop() ... break Print any errors that may have occurred. >>> print(serverthread.error) None rNc@seZdZddZddZdS)z!_start_server..DocHandlercSsX|jdrd}nd}|d|dd|||j||j|ddS) zProcess a request from an HTML browser. The URL received is in self.path. Get an HTML page from self.urlhandler and send it. z.csstext/css text/htmlz Content-Typez%s; charset=UTF-8rN) rreZ send_responseZ send_headerZ end_headersZwfiler urlhandlerr)r@ content_typerrrdo_GETs   z(_start_server..DocHandler.do_GETcWsdSrr)r@rrrr log_messagesz-_start_server..DocHandler.log_messageN)r&r'r`rrrrrr DocHandlersrcs(eZdZddZfddZddZdS)z _start_server..DocServercSs6||_|j|f|_||_|j||j|jd|_dSNF)hostaddressrrLrhandlerr)r@rportrrrrrs  z)_start_server..DocServer.__init__cs>|js2|jgggd\}}}|r|q|dSrB)rselectsocketrZhandle_requestZ server_close)r@Zrdwrexrrrserve_until_quits  z1_start_server..DocServer.serve_until_quitcSs |j||jr||dSr)rLserver_activaterrrrrrs z0_start_server..DocServer.server_activateN)r&r'r`rrrrrrr DocServers rcs:eZdZfddZfddZddZddZd S) z#_start_server..ServerThreadcs2||_||_t||_j|d|_d|_dSr)rrr2rThreadrservingerror)r@rrr) threadingrrrs   z,_start_server..ServerThread.__init__c sxzJjj__jj_t|j_|j |j |j }||_ | Wn(tk rr}z ||_W5d}~XYnXdS)zStart the server.N)server HTTPServerrLrrZMessageZ MessageClass staticmethodrrrready docserverrrkr)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)z&Stop the server and this thread nicelyTNF)rrr"rr(rrrrstop s z(_start_server..ServerThread.stopN)r&r'r`rrrrr)rrrrrrr ServerThreads  rg{Gz?) Z http.serverZ email.messagerrrZBaseHTTPRequestHandlerrrr8rrtimesleep)rhostnamerrthreadr)rrrrrrr _start_servers8'   rrc s6Gfdddt}|fddfddfddfd d fd d  fd dfddfddfdd f dd}|dr|dd}|dkrtjtjt}tj||}t|}d| W5QRSQRXn|dkr"||St d||fdS)aThe pydoc url handler for use with the pydoc server. If the content_type is 'text/css', the _pydoc.css style sheet is read and returned if it exits. If the content_type is 'text/html', then the result of get_html_page(url) is returned. cs eZdZfddZddZdS)z_url_handler.._HTMLDoccsd}d|}d|||fS)r zpydoc_data/_pydoc.cssz1a  Pydoc: %s %s%s
%s
r)r@r r css_pathZcss_link html_navbarrrr 2 s z#_url_handler.._HTMLDoc.pagecSs d||fS)Nz%srr*rrrr+? sz'_url_handler.._HTMLDoc.filelinkN)r&r'r`r r+rrrr_HTMLDoc0 s rcs>dttdtf}d|tjddfS)Nz %s [%s, %s]raZ
Python %s
%s
T)Zterse)rrZpython_versionZ python_buildZpython_compiler)r]rrrrE s  z!_url_handler..html_navbarcsdd}ddd}ddtjD}||}|dd dd |g}i}tjD]}|||qT|d d d |fS)zModule Index page.cSs d||fSNr%rr)rrr bltinlinkc sz3_url_handler..html_index..bltinlinkz7Index of ModulesrHrIcSsg|]}|dkr|qS)rr)rtr)rrrri sz4_url_handler..html_index..z

zBuilt-in ModulesrMz|

pydoc by Ka-Ping Yee<ping@lfw.org>zIndex of Modulesr) rrrrrrr rr")rrnamesr rrrrr 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)zSearch results page.cs:|dddkr |ddd}||o0d|fdSrrMrZ search_resultrrr~ sz3_url_handler..html_search..callbackrcSsdSrrrrrrr sz2_url_handler..html_search..onerrorrcSs d||fSrrrrrrr sz4_url_handler..html_search..bltinlinkz5Search ResultsrHrIzkey = %srM
zSearch Results) rrrrrrr rr") rJrrrrqrr)rr rrr html_searchy s,    z!_url_handler..html_searchc sjtj|}t|}|}W5QRXd|}ddd}|d|dd|}d||fS)z-Get and display a source file listing safely.

%s
z3File ListingrHrIzFile: %srMz getfile %s) rOrPunquoterrrrrr)rfpr$Zbodyrr rrr html_getfile s   z"_url_handler..html_getfilecsLdd}ddd}ttj}||}|ddd|}d|fS)zIndex of topic texts available.cSs d||fSNz%srrrrrr sz4_url_handler..html_topics..bltinlink,INDEXrHrIZTopicsrM)rrrrrGrr)rrrr rrr html_topics s z!_url_handler..html_topicscsLddd}ttj}dd}||}|ddd|}d|fS)zIndex of keywords.rrHrIcSs d||fSrrrrrrr sz6_url_handler..html_keywords..bltinlinkZKeywordsrM)rrrrrGrr)rrrr rrr html_keywords s z#_url_handler..html_keywordscst}t||}||\}}||jkr0d}nd}d|dd}d|}|dd|}|rt| }dd } ||} d dd|}d ||fd |||ffS) zTopic or keyword help page.ZKEYWORDZTOPICrDrHrIrrMcSs d||fSrrrrrrr sz7_url_handler..html_topicpage..bltinlinkrz%s %sr) rrrrrrr:rrr rrr")rbufZhtmlhelpr rr rrrrrhtml_topicpage s2     z$_url_handler..html_topicpagecs@t|dd}|dkr$|dkr$tdt|}||}||fS)Nr)rr:zcould not find object)r rr r)r(rhr contentrrr html_getobj s   z!_url_handler..html_getobjcsPddd}dfddtt||D}||dd|}d||fS) Nz,ErrorrHrIrc3s|]}|VqdSr)rrrrrr sz3_url_handler..html_error..z#bb0000z Error - %s)rr"rrr)r(rrr rrr html_error s  z _url_handler..html_errorc s|}|dr|dd}z0|dkr4\}}n|dkrJ\}}n|dkr^\}}nd|kr>|d\}}}|dkr|\}}n|d kr|\}}n|d krz|\}}Wn tk r|\}}YnXn\|d kr4|dkr\}}n4z|\}}Wn"tk r0|\}}YnXntd n |\}}Wn2tk r~}z||\}}W5d}~XYnX||S) zGenerate an HTML page for url.rN)rrrrrz search?keyz getfile?keyz topic?keyzget?keyz bad pydoc url)rerrrkr )r(Z complete_urlr roprbr) rrrrrrrrrrr get_html_page sB        z#_url_handler..get_html_pagerrNrrrz"unknown content type %r for url %s) rrdr rdirnamerealpathrSr"r readlinesr)r(rrrZ path_hererrr) rrrrrrrrrrr _url_handler' s,         *    " r T 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) zStart the enhanced pydoc Web server and open a Web browser. Use port '0' to start the server on an arbitrary port. Set open_browser to False to suppress opening a browser. rNz"Server commands: [b]rowser, [q]uitzServer stoppedzServer ready atzserver> rr) webbrowserrr rrrrr(rr~rrr)rr rr Z serverthreadZserver_help_msgrrrrbrowse& s2    r cCst|to|tjdkSrx)rnrRrr sep)rQrrrispathK srcCsvd|kstj|kst|kr"dStjt}tj|}|}||krbtj||sb||| dt|S)zEnsures current directory is on returned path, and argv0 directory is not Exception: argv0 dir is left alone if it's also pydoc's directory. Returns a new path entry list, or None if no adjustment is needed. rNr) r curdirgetcwdrrrScopysamefileremoveinsert)Z given_pathZargv0Z stdlib_dirZ script_dir revised_pathrrr_get_revised_pathN s    rcCs,ttjtjd}|dk r(|tjdd<dS)zEnsures current directory is on sys.path, and __main__ directory is not. Exception: __main__ dir is left alone if it's also pydoc's directory. rN)rrrargv)rrrr_adjust_cli_sys_pathj src Csddl}Gdddt}tzv|tjddd\}}d}d}d}d}d}|D]\\} } | d krld }d }| d krt| WdS| d krd }| }| d krd }| dkrTd }| }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)z@Command-line interface (looks at sys.argv to decide what to do).rNc@s eZdZdS)zcli..BadUsageN)r&r'r`rrrrBadUsagew srrzbk:n:p:wFr z-bTz-kz-pz-wz-n)rr zfile %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)getoptrkrrrrr rr rexistsrrrr rrrrrrrrr)rrZoptsrwritingZ start_serverr rroptvalargrKrrrrclit sd     r!r)NN)r)r)r rN)r rN)r)rN)r)r)Zr\rNr[rXrZrZimportlib._bootstraprZimportlib._bootstrap_externalZimportlib.machineryimportlib.utilrrr rVrrrrrrZ urllib.parserOr collectionsrreprlibr tracebackrrrr%r*r/r1r7r. IGNORECASEr8r:rArFrRrirlrrrrrkrrrrrrrrrrrrrrrrrr r r0rrr rr#rrrrrrrr r rrrr!r&rrrrs&           ' 0:*> " ,    = % U