Your IP : 216.73.216.134


Current Path : /opt/rh/rh-python35/root/lib64/python3.5/__pycache__/
Upload File :
Current File : //opt/rh/rh-python35/root/lib64/python3.5/__pycache__/pydoc.cpython-35.pyc



���\7��@s:dZdgZdZdZdZddlZddlZddlZddl	Zddl
ZddlZddlZddl
Z
ddlZddlZddlZddlZddlZddlZddlZddlZddlmZddlmZdd	lmZd
d�Zdd
�Zdd�Zdd�Z dd�Z!dd�Z"dd�Z#ej$dej%�Z&dd�Z'dd�Z(dd�Z)dd �Z*d!d"�Z+ddd#d$�Z,d%d&�Z-d'd(�Z.d)d*�Z/id+d,�Z0Gd-d.�d.e1�Z2d/d0�Z3did1d2�Z4Gd3d4�d4�Z5Gd5d6�d6e�Z6Gd7d8�d8e5�Z7Gd9d:�d:e�Z8Gd;d<�d<e5�Z9Gd=d>�d>e9�Z:d?d@�a;dAdB�Z<dCdD�Z=dEdF�Z>dGdH�Z?dIdJ�Z@dKdL�ZAdMdN�ZBdOdP�ZCddQdR�ZDe9�ZEe:�ZFe7�ZGddSdT�ZHdUdddVdW�ZIdUdddXdY�ZJddZd[�ZKd\dd]d^�ZLGd_d`�d`�ZMeM�ZNGdadb�db�ZOdcdd�ZPdedf�ZQdgdhdi�ZRddjdkdldm�ZSdndo�ZTdpdq�ZUeVdrkr6eU�dS)sa�Generate 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 <name>" to show documentation on something.  <name> 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 <keyword>" to search for a keyword in the synopsis lines
of all available modules.

Run "pydoc -p <port>" 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.  The -p option
can be used with the -b option to explicitly specify the server port.

Run "pydoc -w <name>" to write out the HTML documentation for a module
to a file named "<name>.html".

Module docs for core modules are assumed to be in

    http://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 <ping@lfw.org>z26 February 2001z�Guido 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}xstjD]h}tjj|p.d�}tjj|�}||krtjj|�r|j|�|j|�qW|S)zAConvert sys.path into a list of absolute, existing, unique paths.�.)�sys�path�os�abspath�normcase�isdir�append)�dirsZnormdirs�dirZnormdir�r�5/opt/rh/rh-python35/root/usr/lib64/python3.5/pydoc.py�pathdirsMs
rcCsCtj|�ptj|�}|r?tjdd|j��pBdS)z-Get the doc string or comments for an object.z^ *
�)�inspect�getdocZgetcomments�re�sub�rstrip)�object�resultrrrrYsrcCs�|j�jd�}t|�dkr5|ddfSt|�dkry|dj�ry|ddj|dd��fSddj|�fS)z>Split a doc string into a synopsis line (if any) and the rest.�
�rr�N)�strip�split�lenr�join)�doc�linesrrr�splitdoc^s#!r$cCs-|j}|j|kr)|jd|}|S)z@Get a class name and qualify it with a module name if necessary.r)�__name__�
__module__)r�modname�namerrr�	classnamegs	r)cCsYtj|�pWtj|�pWtj|�pWtj|�pWtj|�pWtj|�S)z>Check if an object is of a type that probably means it's data.)r�ismodule�isclass�	isroutineZisframeZistracebackZiscode)rrrr�isdatansr-cGsAx:|r<|dj|j|d��}|dd�}qW|S)z/Do a series of global replacements on a string.rrrN)r!r)�textZpairsrrr�replacets	 r/cCsnt|�|krjtd|dd�}td|d|�}|d|�d|t|�|d�S|S)zCOmit part of a string if needed to make it fit in a maximum length.r�rNz...)r �max)r.�maxlenZpreZpostrrr�cram{s
*r3z at 0x[0-9a-f]{6,16}(>+)$cCstjd|�S)z>Remove the hexadecimal id from a Python object representation.z\1)�_re_stripidr)r.rrr�stripid�sr5cCs:tj|�p9tj|�p9tj|�p9tj|�S)N)r�
isfunction�ismethod�	isbuiltinZismethoddescriptor)�objrrr�_is_some_method�sr:cCsRtj|�rdStj|�rNt|dd�}tj|�pL|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)rr7r8�getattrr*)�fn�selfrrr�_is_bound_method�sr?cCs�i}x*tj|t�D]\}}d||<qWx$|jD]}|jt|��q=Wx'|j�D]}t||�||<qgW|S)Nr)r�
getmembersr:�	__bases__�update�
allmethods�keysr<)�cl�methods�key�value�baserrrrC�srCcCsPg}g}x7|D]/}||�r5|j|�q|j|�qW||fS)z�Split 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�	predicate�yes�no�xrrr�_split_list�s
rOcCs||dkrdS|jd�r2|jd�r2dS|jd�rTt|d�rTdS|dk	rj||kS|jd�SdS)z3Decide whether to show documentation on a variable.�
__author__�__builtins__�
__cached__�__credits__�__date__�__doc__�__file__�__spec__�
__loader__r&r%�__package__�__path__�__qualname__�	__slots__�__version__r�__r�_�_fieldsTN>�
__cached__�__doc__�
__author__�
__loader__�__package__�__date__�__file__�__qualname__�__credits__�__spec__�__version__�
__module__�	__slots__�__name__�__builtins__�__path__)�
startswith�endswith�hasattr)r(�allr9rrr�visiblename�s	
rucCs^g}xQtj|�D]@\}}}}tj|�r=d}|j||||f�qW|S)zCWrap inspect.classify_class_attrs, with fixup for data descriptors.zdata descriptor)r�classify_class_attrs�isdatadescriptorr
)r�resultsr(�kind�clsrHrrrrv�s"rvcCsPtjj|�rLx7dD]/}tjjtjj|d|��rdSqWdS)z3Guess whether a path refers to a package directory.�.py�.pyc�__init__TF)r{r|)r	rr�isfiler!)r�extrrr�	ispackage�s

%r�cCs|j�}x:|dd�dks2|j�rH|j�}|sPqW|j�}|dd�dkr{|dd�}|dd�dkr	|dd�}|d	d�dkr�|dd
�}x#|j�s�|j�}|s�Pq�W|jd�dj�}nd}|S)Nr�#�zr"""r0z"""�\r���r�)�readlinerr)�file�linerrrr�source_synopsis�s&&r�c
Cs�tj|�j}|j|d�\}}|dksB||kr||jttjj��rltjj	}n0|jttjj
��r�tjj}nd}|dkr�ytj
|�}Wntk
r�dSYnX|�t|�}WdQRXn{|d|�}tjjd|d|�}ytjj|�}	WndSYnXtjd=|	jrf|	jj�dnd}||f||<|S)z.Get the one-line summary out of a module file.NZ__temp__�loaderr)NN)r	�stat�st_mtime�getrr�tuple�	importlib�	machinery�BYTECODE_SUFFIXES�SourcelessFileLoader�EXTENSION_SUFFIXES�ExtensionFileLoader�tokenize�open�OSErrorr��util�spec_from_file_location�
_bootstrap�_loadr�modulesrU�
splitlines)
�filename�cache�mtimeZ
lastupdaterZ
loader_clsr�r��spec�modulerrr�synopsis�s4
			
"r�c@s.eZdZdZdd�Zdd�ZdS)�ErrorDuringImportzEErrors that occurred while trying to import something to document it.cCs%||_|\|_|_|_dS)N)r��excrH�tb)r>r��exc_inforrrr}s	zErrorDuringImport.__init__cCs#|jj}d|j||jfS)Nzproblem in %s - %s: %s)r�r%r�rH)r>r�rrr�__str__szErrorDuringImport.__str__N)r%r&r[rUr}r�rrrrr�sr�c	Cs�tjj}t|d��"}||jt|��k}WdQRXtjj|�}tjj	|�\}}|r�tj
j||�}ntj
j||�}tjj
||d|�}ytjj|�SWnt|tj���YnXdS)z<Import a Python source file or compiled file given its path.�rbNr�)r�r��MAGIC_NUMBERr��readr r	r�basename�splitext�_bootstrap_externalr��SourceFileLoaderr�r�r�r�rr�)	r�magicr�Zis_bytecoder�r(rr�r�rrr�
importfile s"r�cs{y�|rv�tjkrv�tjkrv�fdd�tjD�}x0�g|D]!}tj|||<tj|=qQWt��}Wn�tj�\}}}}	�tjkr�ttj�j|	��nU|tkr�t|j|	��n4|t	kr
|j
�kr
dSt�tj���YnXxM�jd�dd�D]2}
yt||
�}WqAt
k
rrdSYqAXqAW|S)a�Import 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).cs)g|]}|j�d�r|�qS)r)rq)�.0�m)rrr�
<listcomp>Fs	zsafeimport.<locals>.<listcomp>Nrr)rr��builtin_module_names�
__import__r�r�rV�SyntaxErrorr��ImportErrorr(rr<�AttributeError)r�	forceloadr�ZsubsrGr�r�rHr��info�partr)rr�
safeimport2s. 

r�c@szeZdZejjddejdd��Zddd�Z	ddd�Z
e
ZZZ
ZZZd	d
�ZdS)�Doc�
PYTHONDOCSz$http://docs.python.org/%d.%d/libraryNrcGs�||f|}tj|�r,|j|�Stj|�rH|j|�SyXtj|�rg|j|�Stj|�r�|j|�Stj|�r�|j	|�SWnt
k
r�YnXt|t�r�|j
|�S|j|�S)z%Generate documentation for an object.)r�isgetsetdescriptor�docdata�ismemberdescriptorr*�	docmoduler+�docclassr,�
docroutiner��
isinstance�property�docproperty�docother)r>rr(�argsrrr�documenths"





zDoc.documentcGs9d|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)�repr�typer%�	TypeError)r>rr(r��messagerrr�failzs&zDoc.failcCs*ytj|�}Wntk
r-d}YnXtjjd|j�}tjjt	j
ddt	jdd��}t|t
t��r |jdks�|j|�r |jtjj|d��r |jdkr |jd�rd|jd�|jf}q&tjj||jd�}nd}|S)z*Return the location of module docs or Nonez
(built-in)r��libzpython%d.%dNr�errno�
exceptions�gc�imp�marshal�posix�signalr�_thread�	zipimportz
site-packages�	xml.etree�test.pydoc_modzhttp://z%s/%s�/z.html)
zerrnoz
exceptionszgcr�zmarshalzposixzsignalzsysz_threadr�)r�r�)r�
getabsfiler�r	�environr�r�rr!r�base_exec_prefix�version_infor�r�r%rqr)r>rr��doclocZbasedirrrr�	getdocloc�s&
	z
Doc.getdocloc)r%r&r[r	r�r�rr�r�r�r�r�r�r�r�r�r�r�rrrrr�bsr�c@sjeZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�ZeZ	dd
�Z
eZdS)�HTMLReprzBClass for safely making an HTML representation of a Python object.cCs:tj|�d|_|_d|_d|_|_dS)N��
�d)rr}�maxlist�maxtuple�maxdict�	maxstring�maxother)r>rrrr}�s
	zHTMLRepr.__init__cCst|dddddd�S)N�&z&amp;�<z&lt;�>z&gt;)r/)r>r.rrr�escape�szHTMLRepr.escapecCstj||�S)N)rr�)r>rrrrr��sz
HTMLRepr.reprcCs�tt|�d�r\ddjt|�jj��}t||�r\t||�||�S|jttt	|��|j
��S)Nr%�repr_r_)rsr�r!r%rr<r�r3r5r�r�)r>rN�level�
methodnamerrr�repr1�s
"zHTMLRepr.repr1cCst||j�}t|�}d|krcdt|dd�krcd|d|j|�|dStjdd|j|��S)Nr�z\\r�rrz-((\\[\\abfnrtv\'"]|\\[0-9]..|\\x..|\\u....)+)z<font color="#c040c0">\1</font>)r3r�r�r/r�rr)r>rNr��test�testreprrrr�repr_string�s$!	zHTMLRepr.repr_stringcCsOy)|jttt|��|j��SWn|jd|jj�SYnXdS)Nz
<%s instance>)r�r3r5r�r��	__class__r%)r>rNr�rrr�
repr_instance�s)zHTMLRepr.repr_instanceN)r%r&r[rUr}r�r�r�r��repr_strr�Zrepr_unicoderrrrr��sr�c@s�eZdZdZe�ZejZejZdd�Zddd�Z	dddd	d
d�Z
dd
�Zdd�Zddd�Z
dd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdiiidd �Zdd!d"�Zddd#d$�Zddiid%d&�Zd'd(�Zddiiidd)d*�Zd+d,�Zdddd-d.�Zddd/d0�Zdddd1d2�Zdd3d4�ZdS)5�HTMLDocz'Formatter class for HTML documentation.cCsd||fS)zFormat an HTML page.z�<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html><head><title>Python: %s</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head><body bgcolor="#f0f0f8">
%s
</body></html>r)r>�title�contentsrrr�page�szHTMLDoc.pagercCsd|||||pdfS)zFormat a page heading.a'
<table width="100%%" cellspacing=0 cellpadding=2 border=0 summary="heading">
<tr bgcolor="%s">
<td valign=bottom>&nbsp;<br>
<font color="%s" face="helvetica, arial">&nbsp;<br>%s</font></td
><td align=right valign=bottom
><font color="%s" face="helvetica, arial">%s</font></td></tr></table>
    z&nbsp;r)r>r��fgcol�bgcolZextrasrrr�heading�s	zHTMLDoc.heading�Nz&nbsp;c	
Csw|dkrdd|d}d|||f}	|rT|	d||||f}	n|	d|||f}	|	d|S)	z Format a section with a heading.Nz<tt>z&nbsp;z</tt>z�<p>
<table width="100%%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="%s">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="%s" face="helvetica, arial">%s</font></td></tr>
    zR
<tr bgcolor="%s"><td rowspan=2>%s</td>
<td colspan=2>%s</td></tr>
<tr><td>%s</td>z(
<tr><td bgcolor="%s">%s</td><td>%s</td>z'
<td width="100%%">%s</td></tr></table>r)
r>r�rrr��widthZpreludeZ
marginaliaZgaprrrr�section�szHTMLDoc.sectioncGsd|}|j||�S)z$Format a section with a big heading.z<big><strong>%s</strong></big>)r)r>r�r�rrr�
bigsection�s
zHTMLDoc.bigsectionc
Cs7|j|j��}t|dddddddd�	S)z!Format literal preformatted text.z

z
 
r�z&nbsp;rz<br>
)r��
expandtabsr/)r>r.rrr�	preformatszHTMLDoc.preformatr�cCs�d}t|�|d|}x�t|�D]r}|dd|}xMt|||||�D]0}|t|�kr_||||�d}q_W|d}q+Wd|S)z0Format a list of items into a multi-column list.rrz<td width="%d%%" valign=top>r�z<br>
z</td>z7<table width="100%%" summary="list"><tr>%s</tr></table>)r �range)r>�list�formatZcolsr�rows�col�irrr�multicolumns"zHTMLDoc.multicolumncCsd|S)Nz<font color="#909090">%s</font>r)r>r.rrr�greyszHTMLDoc.greycGs3x,|D]$}||krd|||fSqW|S)z:Make a link for an identifier, given name-to-URL mappings.z<a href="%s">%s</a>r)r>r(Zdicts�dictrrr�namelinks
zHTMLDoc.namelinkcCsm|jtjj|j�}}t||�r`t||�|kr`d|j|t||�fSt||�S)zMake a link for a class.z<a href="%s.html#%s">%s</a>)r%rr�r�r&rsr<r))r>rr'r(r�rrr�	classlinks
$zHTMLDoc.classlinkcCsd|j|jfS)zMake a link for a module.z<a href="%s.html">%s</a>)r%)r>rrrr�
modulelink%szHTMLDoc.modulelinkcCso|\}}}}|r%|j|�S|r>d||f}n
d|}|r[d|}n|}d||fS)z;Make a link for a module or package to display in an index.z
%s.%s.htmlz%s.htmlz"<strong>%s</strong>&nbsp;(package)z<a href="%s">%s</a>)r)r>Z
modpkginfor(rr��shadowed�urlr.rrr�
modpkglink)s


zHTMLDoc.modpkglinkcCsd||fS)zMake a link to source file.z<a href="file:%s">%s</a>r)r>rrrrr�filelink8szHTMLDoc.filelinkcCs|p|j}g}d}tjd�}x�|j||�}	|	sFP|	j�\}
}|j||||
���|	j�\}}
}}}}|
r�||�jdd�}|jd||f�n|rdt|�}|jd|||�f�n�|r7dt|�}|jd|||�f�n�|r�|||d�d	krw|jd
|j	||��q�|jd|�nU|||d�d	kr�|j|j	||||��n|j|j	||��|}q-W|j|||d���d
j
|�S)z�Mark 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&quot;z<a href="%s">%s</a>z'http://www.rfc-editor.org/rfc/rfc%d.txtz(http://www.python.org/dev/peps/pep-%04d/r�(zself.zself.<strong>%s</strong>Nr)r�r�compile�search�spanr
�groupsr/�intrr!)r>r.r��funcs�classesrFrx�here�pattern�match�start�endrt�schemeZrfcZpepZselfdotr(rrrr�markup<s<   "
zHTMLDoc.markupc
Csd}x�|D]�}t|�tf�kr�|\}}|d}||j||�}|r�||fkr�g}x'|D]}	|j|j|	|��qyW|ddj|�d}|d}q
t|�tg�kr
|d|j|||�}q
Wd|S)	zAProduce HTML for a class tree as given by inspect.getclasstree().rz"<dt><font face="helvetica, arial">rz, �)z
</font></dt>z
<dd>
%s</dd>
z
<dl>
%s</dl>
)r�rr
r!�
formattree)
r>�treer'�parentr�entry�c�bases�parentsrIrrrr*gs 



zHTMLDoc.formattreec#s�|j}y
|j}Wntk
r0d}YnX|jd�}g}xPtt|�d�D]8}|jddj|d|d��||f�q]Wdj||d.d��}	d|	}
y7tj	|�}t
jj|�}�j
||�}
Wntk
rd}
YnXg}t|d�r�t|j�}|dd�d/krx|d0d�d	krx|dd1�j�}|jd�j|��t|d�r�|j�jt|j���|r�|
d
dj|�}
�j|�}|dk	rdt�}nd}�j|
ddd|
|�}tj|tj�}gi}}x�tj|tj�D]n\}}|dk	s�tj|�p�||krft|||�rf|j||f�d|||<||<qfWx�|D]�\}}x�|jD]�}|j|j}}tj j!|�}||kr�|r�t||�r�t"||�|kr�||kr�|d|||<||<q�Wq�Wgi}}x�tj|tj#�D]�\}}|dk	s�tj$|�s�tj|�|kr�t|||�r�|j||f�d|||<tj%|�r�||||<q�Wg}xEtj|t&�D]1\}}t|||�rP|j||f�qPW�j't(|��j)||�}|o�d|}|d|}t|d�rVg}x<t*j+|j,�D](\}}} |j||| df�q�W|j-��j.|�j/�}!|�j0ddd|!�}n@|r��j.|�fdd��}!|�j0ddd|!�}|r.d d!�|D�}"�j1tj2|"d�|�g}!x6|D].\}}|!j�j3|||||��q�W|�j0d"dd#d$j|!��}|r�g}!x6|D].\}}|!j�j3|||||��qAW|�j0d%dd&d$j|!��}|r�g}!x-|D]%\}}|!j�j3||��q�W|�j0d'dd(d)j|!��}t|d*�rB�j't|j4��j)�}!|�j0d+dd|!�}t|d,�r��j't|j5��j)�}!|�j0d-dd|!�}|S)2z/Produce HTML documentation for a module object.Nrrz5<a href="%s.html"><font color="#ffffff">%s</font></a>z)<big><big><strong>%s</strong></big></big>z
(built-in)r]��$z
Revision: z
version %srTz (%s)z, z-<br><a href="%(docloc)s">Module Reference</a>rz#ffffffz#7799eez<a href=".">index</a><br>r�z.html#z#-z<tt>%s</tt>z
<p>%s</p>
rZrzPackage Contentsz#aa55cccs�j|d�S)Nr)r)�t)r>rr�<lambda>�sz#HTMLDoc.docmodule.<locals>.<lambda>�ModulescSsg|]\}}|�qSrr)r�rGrHrrrr��s	z%HTMLDoc.docmodule.<locals>.<listcomp>ZClassesz#ee77aar�Z	Functionsz#eeaa77ZDataz#55aa55z<br>
rPZAuthorrSZCreditsr�z$Revision: r�r�)6r%�__all__r�rr	r r
r!rr��urllib�parseZquoterr�rs�strr]rr�rTr��localsrr@r*r+�	getmodulerurAr&rr�r�r<r,r8r6r-r(rr�pkgutil�iter_modulesrZ�sortrrrr*�getclasstreer�rPrS)#r>rr(�mod�ignoredrt�partsZlinksrZ
linkedname�headrrrr��versionr�rr�r!ZcdictrGrHrIr'r�r Zfdict�datar"�modpkgs�importer�ispkgr��	classlistr)r>rr�zs�	

-

,	
"!"
"$!"
		!&	&				zHTMLDoc.docmodulecs�j}|p|}�j}g}	|	j�G�fdd�d�}
|
��ttj���}t|�dkr��j��d�x+|D]#}�d�j|�j	��q�W�d���������fdd�}
����fd	d
�}��������fdd�}�fd
d�t
��D�}i�x|D]w\}}}}d|d|�|<}yt�|�}Wntk
r�YnXy|�|<WqWt
k
r�YqWXqWWx[|r/|r�|j��n|dd�t|�fdd��\}}�tjkr:|}q�n.��krOd}nd�j��j	�}|d7}|jddd��|
d||dd��}|
d||dd��}|
d||dd��}|d||d d��}|d!||d"d��}|gks&t�|}q�Wd#j|	�}	||kr^d$||f}nd%|||f}|r�g}x*|D]"}|j�j|�j	��q�W|d&d'j|�}�jt���j����}|o�d(|}�j|d)d*|	d+|�S),z.Produce HTML documentation for a class object.cs.eZdZdd�Z�fdd�ZdS)z(HTMLDoc.docclass.<locals>.HorizontalRulecSs
d|_dS)Nr)�needone)r>rrrr}�sz1HTMLDoc.docclass.<locals>.HorizontalRule.__init__cs |jr�d�d|_dS)Nz<hr>
r)rJ)r>)�pushrr�maybes	
z.HTMLDoc.docclass.<locals>.HorizontalRule.maybeN)r%r&r[r}rLr)rKrr�HorizontalRule�srMrz&<dl><dt>Method resolution order:</dt>
z<dd>%s</dd>
z</dl>
cs�t||�\}}|r��j��|�x�|D]�\}}}}yt�|�}Wn+tk
r���j||���Yn&X��j||��������d�q6W|S)Nr)rOrLr<�	Exception�_docdescriptorr�)�msg�attrsrK�okr(ry�homeclsrH)r!r �hr�mdictr@rrKr>rr�spills


zHTMLDoc.docclass.<locals>.spillcsit||�\}}|re�j��|�x3|D]+\}}}}��j||���q6W|S)N)rOrLrO)rPrQrKrRr(ryrSrH)rTr@rKr>rr�spilldescriptors#s

z*HTMLDoc.docclass.<locals>.spilldescriptorsc
s
t||�\}}|r	�j��|�x�|D]�\}}}}�jt�|�|��}t|�s�tj|�r�t|dd�}	nd}	|	dkr��d|�nB�jt|��j	����}	d|	}	�d||	f��d�q6W|S)NrUz<dl><dt>%s</dl>
z<dd><tt>%s</tt>z<dl><dt>%s%s</dl>
r)
rOrLr�r<�callablerrwr(rr)
rPrQrKrRr(ryrSrHrIr")r!r rTrUr@rrKr>rr�	spilldata,s"


z#HTMLDoc.docclass.<locals>.spilldatacs@g|]6\}}}}t|d��r||||f�qS)r9)ru)r�r(ryrzrH)rrrr�As	z$HTMLDoc.docclass.<locals>.<listcomp>r��-rcs|d�kS)Nrr)r3)�	thisclassrrr4Zsz"HTMLDoc.docclass.<locals>.<lambda>zdefined herezinherited from %sz:<br>
rGcSs|dS)Nrr)r3rrrr4gsz
Methods %scSs|ddkS)Nr�methodr)r3rrrr4kszClass methods %scSs|ddkS)Nrzclass methodr)r3rrrr4mszStatic methods %scSs|ddkS)Nrz
static methodr)r3rrrr4oszData descriptors %scSs|ddkS)Nrzdata descriptorr)r3rrrr4qszData and other attributes %scSs|ddkS)NrrEr)r3rrrr4ssrz*<a name="%s">class <strong>%s</strong></a>z/<strong>%s</strong> = <a name="%s">class %s</a>z(%s)z, z<tt>%s<br>&nbsp;</tt>z#000000z#ffc8d8r0)r%rAr
rr�getmror rLrr&rvr<rNr��popleftrO�builtinsrr>�AssertionErrorr!r(rrr)r>rr(r@r r!rA�realnamer/r�rM�mrorIrVrWrYrQrGryrSrH�anchor�	inherited�tagr�r0r"r)	r!r rTrUr@rrKr>r[rr��s�				



'	'

		!	








 $zHTMLDoc.docclasscCs|jd|j|��S)z)Format an argument default value as text.�=)rr�)r>rrrr�formatvalue�szHTMLDoc.formatvaluecCsT|j}|p|}|r$|jp'dd|}	d}
d}t|�r�|jj}|r�||k	r�d|j||�}
nD|jdk	r�d|j|jj|�}
nd|j||�}
||kr�d|	|f}
ne|r0||jkr0|j||kr0d	|jd||f}d
}n|}d|	||f}
d}tj|�r�ytj|�}Wnt	t
fk
r�d}YnX|r�t|�}|dkr�d
|}
|d
d�}|s�d}|
|j|�|
o�|j
d|
�}|rd|S|jt|�|j|||�}|o?d|}d||fSdS)z;Produce HTML documentation for a function or method object.rrZrz from Nz method of %s instancez unbound %s methodz$<a name="%s"><strong>%s</strong></a>z<a href="#%s">%s</a>rz)<a name="%s"><strong>%s</strong></a> = %sz<lambda>z$<strong>%s</strong> <em>lambda</em> z(...)z'<font face="helvetica, arial">%s</font>z<dl><dt>%s</dt></dl>
z<dd><tt>%s</tt></dd>z<dl><dt>%s</dt>%s</dl>
r�)r%r?r;r�r�__dict__rr,�	signature�
ValueErrorr�r9r�rr(rr)r>rr(r@r r!rFrErarc�note�skipdocs�imclassr�Zreallink�argspecri�declr"rrrr��sZ			
zHTMLDoc.docroutinecCsrg}|j}|r#|d|�|jdk	r[|jt|�|j�}|d|�|d�dj|�S)Nz!<dl><dt><strong>%s</strong></dt>
z<dd><tt>%s</tt></dd>
z</dl>
r)r
rUr(rrr!)r>r(rHr@rxrKr"rrrrO�s	
zHTMLDoc._docdescriptorcCs|j|||�S)z*Produce html documentation for a property.)rO)r>rr(r@rErrrr��szHTMLDoc.docpropertycGs'|rd|pd}||j|�S)z-Produce HTML documentation for a data object.z<strong>%s</strong> = r)r�)r>rr(r@rAZlhsrrrr��szHTMLDoc.docothercCs|j|||�S)z1Produce html documentation for a data descriptor.)rO)r>rr(r@rErrrr��szHTMLDoc.docdatacCs�g}|dkri}xhtj|g�D]T\}}}tdd�|D��rVq+|j|d|||kf�d||<q+W|j�|j||j�}|j|dd|�S)z2Generate an HTML index for a directory of modules.Ncss1|]'}dt|�ko&dknVqdS)i�i��N)�ord)r��chrrr�	<genexpr>�sz HTMLDoc.index.<locals>.<genexpr>rrz#ffffffz#ee77aa)r<r=�anyr
r>rrr)r>rrrFrGr(rHr�rrr�index�s"
z
HTMLDoc.index)r%r&r[rUr��_repr_instancer�r�r�rrrrrrrrrrrr(r*r�r�rgr�rOr�r�r�rtrrrrr��s:			
+y�;
r�c@sLeZdZdZdd�Zdd�Zdd�ZeZdd	�Zd
S)�TextReprzAClass for safely making a text representation of a Python object.cCs:tj|�d|_|_d|_d|_|_dS)Nr�r�r�)rr}r�r�r�r�r�)r>rrrr}�s
	zTextRepr.__init__cCsxtt|�d�r\ddjt|�jj��}t||�r\t||�||�Sttt|��|j	�S)Nr%r�r_)
rsr�r!r%rr<r3r5r�r�)r>rNr�r�rrrr��s
"zTextRepr.repr1cCs^t||j�}t|�}d|krZdt|dd�krZd|d||dS|S)Nr�z\\rr�r)r3r�r�r/)r>rNr�r�r�rrrr�s
$zTextRepr.repr_stringc
Cs=y ttt|��|j�SWnd|jjSYnXdS)Nz
<%s instance>)r3r5r�r�r�r%)r>rNr�rrrr�s zTextRepr.repr_instanceN)	r%r&r[rUr}r�r�r�r�rrrrrv�s	rvc@s�eZdZdZe�ZejZdd�Zddd�Zdd�Z	d	d
dd�Z
d	d	d
d�Zd	d	dd�Zdd�Z
d	d	d	dd�Zdd�Zd	d	d	dd�Zd	d	d	dd�Zd	d	d	d	d	dd�Zd	S)�TextDocz'Formatter class for text documentation.cCsdjdd�|D��S)z(Format a string in bold by overstriking.rcss|]}|d|VqdS)�Nr)r�rqrrrrrszTextDoc.bold.<locals>.<genexpr>)r!)r>r.rrr�boldszTextDoc.boldz    csS|s
dS�fdd�|jd�D�}|rF|dj�|d<dj|�S)z6Indent text by prepending a given prefix to each line.rcsg|]}�|�qSrr)r�r�)�prefixrrr�#s	z"TextDoc.indent.<locals>.<listcomp>rrr�r�)rrr!)r>r.rzr#r)rzr�indent s"zTextDoc.indentcCs.|j|�j�}|j|�d|dS)z&Format a section with a given heading.rz

)r{rry)r>r�r�Zclean_contentsrrrr'szTextDoc.sectionNrc
s�d}x�|D]�}t|�tf�kr�|\}}||t|��}|r�||fkr��fdd�|D�}	|ddj|	�}|d}q
t|�tg�kr
||j|�||d�}q
W|S)zBRender in text a class tree as returned by inspect.getclasstree().rc3s|]}t|��VqdS)N)r))r�r.)r'rrrr6sz%TextDoc.formattree.<locals>.<genexpr>z(%s)z, rz    )r�r)r!r*)
r>r+r'r,rzrr-r.r/r0r)r'rr*.s

	zTextDoc.formattreecCs�|j}tt|��\}}|jd||o:d|�}t|dd�}|j|�}|dk	r�||jd|d�}|r�||jd|�}g}	xotj|tj�D]X\}
}|dk	s�tj	|�p�||kr�t
|
||�r�|	j|
|f�q�Wg}xxtj|tj�D]a\}
}|dk	sttj
|�sttj	|�|kr8t
|
||�r8|j|
|f�q8Wg}
xEtj|t�D]1\}
}t
|
||�r�|
j|
|f�q�Wg}t�}t|d�r�xWtj|j�D]C\}}}|j|�|rR|j|d	�q|j|�qW|j�||jd
dj|��}g}xRtj|tj�D];\}
}|jj|d�r�|
|kr�|j|
�q�W|r|j�||jd
dj|��}|	r�dd�|	D�}|jtj|d�|�g}x0|	D](\}
}|j|j||
|��qWW||jddj|��}|rg}x0|D](\}
}|j|j||
|��q�W||jddj|��}|
rdg}x6|
D].\}
}|j|j||
|dd��qW||jddj|��}t|d�r�t|j�}|dd�d#kr�|d$d�dkr�|dd%�j�}||jd|�}t|d�r||jdt|j ��}t|d�r6||jdt|j!��}t|d�rd||jd t|j"��}ytj#|�}Wnt$k
r�d!}YnX||jd"|�}|S)&z5Produce text documentation for a given module object.�NAMEz - r6NzMODULE 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.
ZDESCRIPTIONrZz
 (package)zPACKAGE CONTENTSrrZ
SUBMODULEScSsg|]\}}|�qSrr)r�rGrHrrrr�~s	z%TextDoc.docmodule.<locals>.<listcomp>r�CLASSES�	FUNCTIONSr2�FZDATAr]r1r2z
Revision: �VERSIONrTZDATErPZAUTHORrSZCREDITSz
(built-in)ZFILEz$Revision: r�r�)%r%r$rrr<r�rr@r+r;rur
r,r8r-�setrsr<r=rZ�addr>r!r*rqr*r?r�r�r9r]rrTrPrSr�r�)r>rr(r@Zsynop�descrrtr�r!rGrHr rErFZ
modpkgs_namesrGr'rHZ
submodulesrIr�rDr�rrrr�>s�	 ""$	"

	""
	  &,
zTextDoc.docmodulecs?�j}|p|}�j}�jdd�}||krRd�j|�}n�j|�d|}|r�t||�}	|ddj|	�}t��}
|
r�|
dgp�g}|j�tt	j
���}t|�dkr#�d	�x"|D]}
�d
||
��q�W�d�G�fdd
�d
�}|�������fdd�}����fdd�}�����fdd�}�fdd�t��D�}xB|r�|r�|j
��n|dd�t|�fdd��\}}�tjkr#|}q�n+��kr8d}ndt��j�}|j�|d||dd��}|d||dd��}|d||d d��}|d!||d"d��}|d#||d$d��}|gks�t�|}q�Wdj|�}|s|dS|d�j|j�d%�dS)&z4Produce text documentation for a given class object.cSs
t||�S)N)r))r.r�rrr�makename�sz"TextDoc.docclass.<locals>.makenamezclass z	 = class z(%s)z, rrzMethod resolution order:z    rcs.eZdZdd�Z�fdd�ZdS)z(TextDoc.docclass.<locals>.HorizontalRulecSs
d|_dS)Nr)rJ)r>rrrr}�sz1TextDoc.docclass.<locals>.HorizontalRule.__init__cs$|jr�dd�d|_dS)NrZrr)rJ)r>)rKrrrL�s	z.TextDoc.docclass.<locals>.HorizontalRule.maybeN)r%r&r[r}rLr)rKrrrM�srMcs�t||�\}}|r��j��|�xw|D]o\}}}}yt�|�}Wn+tk
r���j||���Yq6X��j||����q6W|S)N)rOrLr<rNrOr�)rPrQrKrRr(ryrSrH)rTr@rrKr>rrrV�s


zTextDoc.docclass.<locals>.spillcsit||�\}}|re�j��|�x3|D]+\}}}}��j||���q6W|S)N)rOrLrO)rPrQrKrRr(ryrSrH)rTr@rKr>rrrW�s

z*TextDoc.docclass.<locals>.spilldescriptorsc
s�t||�\}}|r��j��|�x�|D]�\}}}}t|�sctj|�rrt|�}nd}yt�|�}	Wntk
r�|j|}	YnX��j	|	|�ddd|�d�q6W|S)Nr2rr"r)
rOrLrXrrwrr<r�rhr�)
rPrQrKrRr(ryrSrHr"r9)rTr@rrKr>rrrY�s


!z#TextDoc.docclass.<locals>.spilldatacs@g|]6\}}}}t|d��r||||f�qS)r9)ru)r�r(ryrzrH)rrrr��s	z$TextDoc.docclass.<locals>.<listcomp>rcs|d�kS)Nrr)r3)r[rrr4�sz"TextDoc.docclass.<locals>.<lambda>zdefined herezinherited from %szMethods %s:
cSs|ddkS)Nrr\r)r3rrrr4szClass methods %s:
cSs|ddkS)Nrzclass methodr)r3rrrr4szStatic methods %s:
cSs|ddkS)Nrz
static methodr)r3rrrr4szData descriptors %s:
cSs|ddkS)Nrzdata descriptorr)r3rrrr4szData and other attributes %s:
cSs|ddkS)NrrEr)r3rrrr4sz |  )r%rAr&ry�mapr!rr
rrr]r rvr^rOr_rr)r>r`r{r)r>rr(r@rArar/r�r�r0r"r�rbrIrMrVrWrYrQrdrer)rTr@rrKr>r[rr��sn			


			!		







zTextDoc.docclasscCsd|j|�S)z)Format an argument default value as text.rf)r�)r>rrrrrg szTextDoc.formatvaluecCs�|j}|p|}d}d}t|�r�|jj}|ra||k	r�dt||�}n>|jdk	r�dt|jj|�}ndt||�}||kr�|j|�}	nE|r�||jkr�|j||kr�d}|j|�d|}	d}
tj|�r�ytj	|�}Wnt
tfk
rJd}YnX|r�t|�}
|d	kr�|j|�d
}	|
dd
�}
|
s�d}
|	|
|}|r�|dSt
|�p�d}
|d|
o�|j|
�j�dSdS)z;Produce text documentation for a function or method object.rrz from Nz method of %s instancez unbound %s methodrz = z<lambda>z lambda z(...)rr�)r%r?r;r�r)ryrhrr,rirjr�r9rr{r)r>rr(r@rErarkrlrmr�rnriror"rrrr�$sJ	zTextDoc.docroutinecCstg}|j}|r2||j|��|d�t|�pAd}|rg||j|��|d�dj|�S)Nrr)r
ryrr{r!)r>r(rHr@rxrKr"rrrrOVs	

zTextDoc._docdescriptorcCs|j|||�S)z*Produce text documentation for a property.)rO)r>rr(r@rErrrr�cszTextDoc.docpropertycCs|j|||�S)z1Produce text documentation for a data descriptor.)rO)r>rr(r@rErrrr�gszTextDoc.docdatac
Cs�|j|�}|r_|r%|dp(d|}|t|�}	|	dkr_|d|	�d}|rx|j|�dp{d|}|dk	r�|d|jt|��7}|S)z-Produce text documentation for a data object.z = rrNz...r)r�r ryr{r9)
r>rr(r@r,r2r"r�r�Zchoprrrr�ks#zTextDoc.docother)r%r&r[rUrvrur�ryr{rr*r�r�rgr�rOr�r�r�rrrrrws		e}2
rwc@s"eZdZdZdd�ZdS)�
_PlainTextDocz2Subclass of TextDoc which overrides string stylingcCs|S)Nr)r>r.rrrryysz_PlainTextDoc.boldN)r%r&r[rUryrrrrr�wsr�cCst�at|�dS)zCThe first time this is called, determine what kind of pager to use.N)�getpager�pager)r.rrrr�~s	r�cCs�ttjd�stSttjd�s,tStjj�sLtjj�rPtSdtjkr�tjdkrxdd�Stjj	d�dkr�d	d�Sd
d�Stjj	d�dkr�tStjdkr�dd�Sttd�rtj
d
�dkrdd�Sddl}|j�\}}tj
|�z:ttd�rgtj
d|�dkrgdd�StSWdtj|�XdS)z2Decide what method to use for paging through text.�isatty�PAGER�win32cSstt|�tjd�S)Nr�)�
tempfilepager�plainr	r�)r.rrrr4�szgetpager.<locals>.<lambda>ZTERM�dumb�emacscSstt|�tjd�S)Nr�)�	pipepagerr�r	r�)r.rrrr4�scSst|tjd�S)Nr�)r�r	r�)r.rrrr4�scSstt|�d�S)Nzmore <)r�r�)r.rrrr4�s�systemz(less) 2>/dev/nullrcSs
t|d�S)NZless)r�)r.rrrr4�sNz	more "%s"cSs
t|d�S)NZmore)r�)r.rrrr4�s)r�r�)r�r�)rsr�stdin�
plainpager�stdoutr�r	r��platformr�r��tempfileZmkstemp�close�ttypager�unlink)r��fdr�rrrr��s4 



$

(
r�cCstjdd|�S)z%Remove boldface formatting from text.z.r)rr)r.rrrr��sr�c Cs�ddl}|j|ddd|j�}yLtj|jdd��-}y|j|�Wntk
rmYnXWdQRXWntk
r�YnXx(y|j	�PWq�tk
r�Yq�Xq�WdS)z3Page through text by feeding it to another program.rN�shellTr��errors�backslashreplace)
�
subprocess�Popen�PIPE�io�
TextIOWrapperr��write�KeyboardInterruptr��wait)r.�cmdr��proc�piperrrr��s 



r�cCsvddl}|j�}t|ddd��}|j|�WdQRXztj|d|d�Wdtj|�XdS)z<Page through text by invoking a program on a temporary file.rN�wr�r�z "r)r�Zmktempr�r�r	r�r�)r.r�r�r�r�rrrr��sr�cCs4ttjdd�pd}|j|d�j|�S)N�encodingzutf-8r�)r<rr��encode�decode)r.r�rrr�_escape_stdout�sr�c
Cs5tt|��jd�}yGddl}tjj�}|j|�}|j|�dd�}Wn0t	t
tjfk
r�d}dd�}YnXz|yt
tjjdd��}Wntk
r�d}YnX|dkr�d	}|d}}tjjdj|d|��d�x�||d�rtjjd
�tjj�|�}	|	dkrrtjjd
�Pn5|	dkr�tjjd
||d�|d}q|	dkr�|||}|dkr�d}tjjddj||||��d�||}qWWd|r0|j||j|�XdS)z%Page through text on a text terminal.rrNcSstjjd�S)Nr)rr�r�rrrrr4�szttypager.<locals>.<lambda>cSs!tjj�dd�dd�S)Nrr�)rr�r�rrrrr4�sZLINESr�z
-- more --�q�Qz
          
�
�b�B�)r�r�)r�r)r�r�r�)r�r�r�ttyrr��filenoZ	tcgetattrZ	setcbreakr�r�r��UnsupportedOperationrr	r�r�rjr�r�r!�flushZ	tcsetattrZ	TCSAFLUSH)
r.r#r�r��oldZgetchar�hr�Zincr.rrrr��sL

'
	
/r�cCs tjjtt|���dS)z>Simply print unformatted text.  This is the ultimate fallback.N)rr�r�r�r�)r.rrrr��sr�cCs$tj|�rQ|jtjkr,d|jSt|d�rFd|jSd|jStj|�rkd|jStj|�r�d|jj	|jj|jfStj
|�r�d|jj	|jj|jfStj|�r�d|jStj|�r�d	|jStj
|�rd
|jSt|�jS)z/Produce a short description of the given thing.zbuilt-in module rZzpackage zmodule zbuilt-in function zgetset descriptor %s.%s.%szmember descriptor %s.%s.%szclass z	function zmethod )rr*r%rr�rsr8r��__objclass__r&r�r+r6r7r�)�thingrrr�describes.r�cCs�dd�|jd�D�}d\}}xW|t|�kr�tdj|d|d��|�}|r}||d}}q+Pq+W|r�|}nt}xD||d�D]2}yt||�}Wq�tk
r�dSYq�Xq�W|S)z@Locate an object by name or dotted path, importing as necessary.cSsg|]}|r|�qSrr)r�r�rrrr�s	zlocate.<locals>.<listcomp>rNrr)Nr)rr r�r!r_r<r�)rr�rBr��nZ
nextmodulerr�rrr�locates &	

r�cCsyt|t�rDt||�}|dkr:td|��||fSt|dd�}|t|t�rn|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%)r�r9r�r�r<)r�r�rr(rrr�resolve4s

r�z Python Library Documentation: %scCs'|dkrt}t||�\}}t|�}tj|�}|rxd|krx|d|d|jd��7}n#|r�||k	r�|d|j7}tj|�p�tj|�p�tj	|�p�tj
|�p�tj|�p�t|t
�st|�}|d7}||d|j||�S)zBRender text documentation, given an object or a path to an object.Nrz in z in module z objectz

)r.r�r�rr;�rfindr%r*r+r,r�r�r�r�r�r�)r�r�r�Zrendererrr(r�r�rrr�
render_docBs$$
r�cCs�yE|dkr(tt|||��n|jt|||t��Wn5ttfk
r|}zt|�WYdd}~XnXdS)zCDisplay text documentation, given an object or a path to an object.N)r�r�r��	plaintextr�r��print)r�r�r��outputrHrrrr"[s r"cCs�y~t||�\}}tjt|�tj||��}t|dddd��}|j|�WdQRXtd|d�Wn5tt	fk
r�}zt|�WYdd}~XnXdS)z<Write HTML documentation to a file in the current directory.z.htmlr�r�zutf-8NZwrote)
r��htmlr�r�r�r�r�r�r�r�)r�r�rr(r�r�rHrrr�writedocfs$r�rcCsI|dkri}x0tj|g|�D]\}}}t|�q(WdS)zAWrite out HTML documentation for all modules in a directory tree.N)r<�
walk_packagesr�)r�pkgpath�donerGr'rHrrr�	writedocsqs
%r�c�@s�eZdZddddddddddd	d5d
d6dd7dd8dd9dd:dddd;dddddd<dddd=dd>dd?d!d@d#d$d%dAd'dBd)dd*dd+dCd,dDd.dEddFd/dGddHd2dIi!Zd3dJd<dKd$dLdQdMdRdNd_dOd`dPiZdCdcd@dddedfdgdhdidjdkdldmdndod3dpdqdrdsdtdudvdwdxdwdydzd{dziZxaej�D]S\ZZxDeD]<Z	ej
e	e�Zeekr�ed|eZeee	<q�WquWd}dQd3dRd�dSd�dTd�dUd�dVd�dWd�dXd`dYd�dZd�d�d&d[d�d\d�d]d�d^d�d}d�d}d�d_djd`d�dad�dbd dcd�dd�ddd<d�d�d�d�ded�dfddgd�dhd�did"djd�dkd�dld�dmd�dnd�dod�d�d�d�d-dpd�dqd�drd�dsdqdtd�dud�d�d�dvd�dwd�dxd�dyd�dzd�d{d�d|d�d}d�d~ddddQd�d�d�d�d�d_d�d$d�dd�d�d	dd�dRd�dddd.dddddd�dd�dd�dd�iIZdddd�Ze
dd��Ze
dd��Zdd�Ze�Zedd�Zdd�Zdd�Zdd �Zd!d"�Zd#d$d%d&�Zd'd(�Zd)d*�Zd+d,�Zdd-d.�Zdd/d0�Zd1d2�Zdd3d4�ZdS(��Helper�Falser�None�True�andZBOOLEAN�as�with�assert�break�	while for�class�CLASSES SPECIALMETHODS�continue�def�function�del�BASICMETHODS�elif�if�else�except�try�finally�for�break continue while�from�import�global�nonlocal NAMESPACES�
TRUTHVALUE�MODULES�in�SEQUENCEMETHODS�isZ
COMPARISON�lambdar~�nonlocal�global NAMESPACES�not�or�pass�raise�
EXCEPTIONS�return�while�break continue if TRUTHVALUE� CONTEXTMANAGERS EXCEPTIONS yield�yieldZSTRINGS�'�'''�r'�b'�"""r�r"�b"�	OPERATORS�+rZ�*�**r��//�%�<<�>>r��|�^�~r�r��<=�>=�==�!=�<>ZUNARY�AUGMENTEDASSIGNMENT�+=�-=�*=�/=�%=�&=�|=�^=�<<=�>>=�**=�//=ZBITWISEZCOMPLEX�j�JzOPERATORS FORMATTINGZPOWER�,zTUPLES LISTS FUNCTIONSrz ATTRIBUTES FLOAT MODULES OBJECTSz...�ELLIPSIS�:zSLICINGS DICTIONARYLITERALS�@z	def classr�r_ZPRIVATENAMESr^zPRIVATENAMES SPECIALMETHODS�`Z
BACKQUOTESrzTUPLES FUNCTIONS CALLSr)�[zLISTS SUBSCRIPTS SLICINGS�]r��TYPES�types�RSTRINGS UNICODE NUMBERS SEQUENCES MAPPINGS FUNCTIONS CLASSES MODULES FILES inspect�strings�4str UNICODE SEQUENCES STRINGMETHODS FORMATTING TYPESZ
STRINGMETHODS�string-methods�STRINGS FORMATTINGZ
FORMATTING�
formatstrings�UNICODE�:encodings unicode SEQUENCES STRINGMETHODS FORMATTING TYPESZNUMBERS�numbers�INTEGER FLOAT COMPLEX TYPESZINTEGER�integers�	int rangeZFLOAT�floating�
float math�	imaginary�
complex cmathZ	SEQUENCES�typesseq�$STRINGMETHODS FORMATTING range LISTSZMAPPINGSZDICTIONARIES�typesfunctions�	def TYPESZMETHODS�typesmethods�class def CLASSES TYPESZCODEOBJECTS�bltin-code-objects�compile FUNCTIONS TYPESZTYPEOBJECTS�bltin-type-objects�types TYPESZFRAMEOBJECTSZ
TRACEBACKSZNONE�bltin-null-object�bltin-ellipsis-object�SLICINGSZSPECIALATTRIBUTES�specialattrsr}�!class SPECIALMETHODS PRIVATENAMES�typesmodulesZPACKAGES�EXPRESSIONS�operator-summary��lambda or and not in is BOOLEAN COMPARISON BITWISE SHIFTING BINARY FORMATTING POWER UNARY ATTRIBUTES SUBSCRIPTS SLICINGS CALLS TUPLES LISTS DICTIONARIESZ
PRECEDENCEZOBJECTS�objectsZSPECIALMETHODS�specialnames�bBASICMETHODS ATTRIBUTEMETHODS CALLABLEMETHODS SEQUENCEMETHODS MAPPINGMETHODS NUMBERMETHODS CLASSES�
customization�hash repr str SPECIALMETHODSZATTRIBUTEMETHODS�attribute-access�ATTRIBUTES SPECIALMETHODSZCALLABLEMETHODS�callable-types�CALLS SPECIALMETHODS�sequence-types�(SEQUENCES SEQUENCEMETHODS SPECIALMETHODSZMAPPINGMETHODS�MAPPINGS SPECIALMETHODS�
NUMBERMETHODS�
numeric-types�*NUMBERS AUGMENTEDASSIGNMENT SPECIALMETHODSZ	EXECUTION�	execmodel�%NAMESPACES DYNAMICFEATURES EXCEPTIONSZ
NAMESPACES�naming�3global nonlocal ASSIGNMENT DELETION DYNAMICFEATURESZDYNAMICFEATURES�dynamic-featuresZSCOPINGZFRAMESr��try except finally raiseZCONVERSIONS�conversionsZIDENTIFIERS�identifiers�keywords SPECIALIDENTIFIERSZSPECIALIDENTIFIERS�
id-classes�atom-identifiersZLITERALS�
atom-literals�=STRINGS NUMBERS TUPLELITERALS LISTLITERALS DICTIONARYLITERALSZTUPLESZ
TUPLELITERALS�	exprlists�TUPLES LITERALSZLISTS�typesseq-mutable�LISTLITERALS�lists�LISTS LITERALS�typesmapping�DICTIONARYLITERALSr�DICTIONARIES LITERALSZ
ATTRIBUTES�attribute-references�(getattr hasattr setattr ATTRIBUTEMETHODSZ
SUBSCRIPTS�
subscriptions�slicingsZCALLS�calls�power�unaryZBINARY�binaryZSHIFTING�shifting�bitwise�comparisons�EXPRESSIONS BASICMETHODS�booleans�EXPRESSIONS TRUTHVALUEZ	ASSERTIONZ
ASSIGNMENT�
assignment�	augassignZDELETIONZ	RETURNINGZ	IMPORTINGZCONDITIONALZLOOPING�compound�for while break continue�truth� if while and or not BASICMETHODSZ	DEBUGGING�debugger�pdbZCONTEXTMANAGERS�context-managersNcCs||_||_dS)N)�_input�_output)r>�inputr�rrrr}$s	zHelper.__init__cCs|jptjS)N)r�rr�)r>rrrr4(szHelper.<lambda>cCs|jptjS)N)r�rr�)r>rrrr4)scCs?tj�dddkr%|�dSd|jj|jjfS)Nrr0�?rz<%s.%s instance>)r�stackr�r&r[)r>rrr�__repr__+s
zHelper.__repr__cCsG||jk	r|j|�n$|j�|j�|jjd�dS)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.
)�_GoInteractiver�intro�interactr�r�)r>�requestrrr�__call__3s

	zHelper.__call__cCs�|jjd�x�y|jd�}|s,PWnttfk
rHPYnXt|dddd�j�}|j�d	krzP|dkr�|j�q|j	|�qWdS)
Nrzhelp> rrr�r��quitr)r�zquit)
r�r��getliner��EOFErrorr/r�lowerr�r)r>r�rrrr�@s
zHelper.interactcCsJ|jtjkrt|�S|jj|�|jj�|jj�SdS)z.Read one line, using input() when appropriate.N)r�rr�r�r�r�r�)r>�promptrrrr�Os


zHelper.getlinecCs�t|�td�kro|j�}|dkr=|j�q�|dkrV|j�q�|dkro|j�q�|dkr�|j�q�|dd�dkr�|j|j�d�q�||jkr�|j|�q�|dkr�t	t
|�d�q�||jkr|j|�q�||j
kr7|j|�q�|rVt	|dd
|j�q�t	tdd
|j�n/t|t�r�|�nt	|dd
|j�|jjd�dS)Nr�keywords�symbols�topicsr��zmodules rr�r�r�zHelp on %s:r�r)zTruezFalsezNone)r�r�listkeywords�listsymbols�
listtopics�listmodulesrr��
showsymbolr"�evalr��	showtopicr�r�r9r�r�r�r�)r>r�rrrrXs6




zHelper.helpcCs2|jjdttjdd�gd��dS)Na�
Welcome to Python %s's help utility!

If this is your first time using Python, you should definitely check out
the tutorial on the Internet at http://docs.python.org/%s/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".
r0r)r�r�r�rrD)r>rrrr�ms	zHelper.intror��Pc		Cs�tt|��}||}t|�|d|}x�t|�D]�}x�t|�D]t}|||}|t|�krT|jj||�||dkrT|jjdd|dt||��qTW|jjd�qAWdS)Nrr�r)r
�sortedr r	r�r�)	r>�items�columnsrZcolwr�rowr
rrrrr
~s
.zHelper.listcCs*|jjd�|j|jj��dS)NzN
Here is a list of the Python keywords.  Enter any keyword to get more help.

)r�r�r
r�rD)r>rrrr��s	zHelper.listkeywordscCs*|jjd�|j|jj��dS)Nzx
Here is a list of the punctuation symbols which Python assigns special meaning
to. Enter any symbol to get more help.

)r�r�r
r�rD)r>rrrr��s	zHelper.listsymbolscCs*|jjd�|j|jj��dS)NzN
Here is a list of available topics.  Enter any topic name to get more help.

)r�r�r
r�rD)r>rrrr��s	zHelper.listtopicscCs�yddl}Wn&tk
r8|jjd�dSYnX|jj||jj|��}|s~|jjdt|��dSt|�td�kr�|j	||�S|\}}y|jj|}Wn0t
k
r�|jjdt|��dSYnXt|j�d�|r'|pdd|}|r�ddl
}ddj|j��d}	|j|	d	�}
|jjd
dj|
��dS)Nrzt
Sorry, topic and keyword documentation is not available because the
module "pydoc_data.topics" could not be found.
zno documentation found for %s
rrr�zRelated help topics: z, �Hz
%s
)�pydoc_data.topicsr�r�r�r�r�r�r�r�r��KeyErrorr�r�textwrapr!rZwrap)r>�topic�
more_xrefs�
pydoc_data�target�label�xrefsr"r�r.Zwrapped_textrrrr��s4
		!
	zHelper.showtopiccCs�yddl}Wntk
r(dSYnX|jj||jj|��}|s\td��t|t�r{|j||�S|\}}|jj|}|r�|p�dd|}||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�t
Sorry, topic and keyword documentation is not available because the
module "pydoc_data.topics" could not be found.
rzcould not find topicr�)r�r)	r�r�r�r�r�rjr�r9�	_gettopic)r>r�r�r�r�r�r�r"rrrr��s	
	!zHelper._gettopiccCs9|j|}|jd�\}}}|j||�dS)Nr�)r��	partitionr�)r>�symbolr�r�r_r�rrrr��s
zHelper.showsymbolcs�|r,|jjdj|��t|�np|jjd�i}|dd���fdd�}t�j�d|�|j|j��|jjd�dS)	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...

cSsS|r0|dd�dkr0|dd�d}|jd�dkrOd||<dS)	N�	z	.__init__z
 (package)rrri����i����)�find)rr'r�r�rrr�callback�sz$Helper.listmodules.<locals>.callbackcs�d|d�dS)Nr)r')r�rr�onerror�sz#Helper.listmodules.<locals>.onerrorr�z�
Enter any module name to get more help.  Or, type "modules spam" to search
for modules whose name or summary contain the string "spam".
)r�r�r�apropos�
ModuleScanner�runr
rD)r>rGr�r�r)r�rr��s	
		zHelper.listmodules)zassertr)zbreakr�)zclassr�)zcontinuer�)r�r)zdelr�)zelser�)zforr�)zglobalr�)zifr�)�importr�)zinr�)zlambda�	FUNCTIONS)znonlocalr�)zpassr)zraiser�)zreturnr�)ztryr�)zwhiler�)�withr�)zyieldr)r�r�r�r�r�rrr)rrZrrr�rrrr	r�r
rrr�r�r
rrrr)r�r�r
rrrr)rZr)rrrrrrrrrrrr)rr	r�r
rr)rr )�typesr*)r+r,)r-r.)r/r)r+r1)r2r3)r4r5)r6r7)r8r9)r:r;)r<r=)r>r?)r@rA)rBrC)rDr)rErF)rGr)r�rH)rIr�)rKrL)rMr()rNrO)rPrQ)rRrS)rTrU)rVrW)rVrX)rZr[)r\r])r^r_)r`r)z
exceptionsra)rbr)rcrd)rer)rfr)rgrh)rirj)rkrl)rmrn)rorp)zdictrq)rrrs)rtr�)rur�)rvrJ)rwrJ)rxrJ)ryrJ)rzrJ)r{rJ)r|r})r~r)r�r)r�rY)r�r�)ztruthr�)r�r�)r�r�) r%r&r[r�Z_symbols_inverser�r�r�Zsymbols_r�r�r�r}r�r�r�r�rr�r�r�r�rr�r
r�r�r�r�r�r�r�rrrrr�xs4
	
	
r�c@s+eZdZdZddddd�ZdS)r�z7An interruptible scanner that searches module synopses.NcCs�|r|j�}d|_i}x�tjD]�}|dkr+d||<|dkrf|d|d�q+t|�jpxd}|jd�d}|d|}|j�j|�dkr+|d||�q+Wx�tj	d|�D]�\}	}}
|jr�P|dkr|d|d�q�ytj
|	|�}Wntk
rCw�YnX|j}t
|d	�r�y|j|�}
Wn%tk
r�|r�||�w�YnXttj|
��p�d}t
|d
�r�|j|�}qNd}nrytjj|�}Wn%tk
r|r||�w�YnX|jr6|jj�dnd}t|dd�}|d|}|j�j|�dkr�||||�q�W|r�|�dS)NF�__main__rrrrz - r��
get_source�get_filenamerV)r�r�rr�r�rUrr�r<r��	_get_specr�r�rsr�rNr�r��StringIOr�r�r�r�r�r�r<)r>r�rGZ	completerr��seenr'r(r�rGrHr�r��sourcerr�rrrr�s`	
"	
	

	

"zModuleScanner.run)r%r&r[rUr�rrrrr��sr�cCsVdd�}dd�}tj��+tjd�t�j||d|�WdQRXdS)zAPrint all the one-line module summaries that contain a substring.cSsE|dd�dkr*|dd�d}t||o=d|�dS)Nr�z	.__init__z
 (package)z- i����i����)r�)rr'r�rrrr�=szapropos.<locals>.callbackcSsdS)Nr)r'rrrr�Aszapropos.<locals>.onerror�ignorer�N)�warnings�catch_warnings�filterwarningsr�r�)rGr�r�rrrr�;s


r�cs�ddl�ddl�ddl�ddl�Gdd�d�jj��G�fdd�d�jj��G�����fdd�d�j�}|||�}|j�x%|j	r�|j
r�tjd	�q�W|S)
a7Start 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.time()
        >>> timeout = 1                    #seconds

        This is a short timeout for testing purposes.

        >>> while serverthread.serving:
        ...     time.sleep(.01)
        ...     if serverthread.serving and time.time() - starttime > timeout:
        ...          serverthread.stop()
        ...          break

        Print any errors that may have occurred.

        >>> print(serverthread.error)
        None
   rNc@s(eZdZdd�Zdd�ZdS)z!_start_server.<locals>.DocHandlercSsx|jjd�rd}nd}|jd�|jdd|�|j�|jj|j|j|�jd��dS)	z�Process a request from an HTML browser.

            The URL received is in self.path.
            Get an HTML page from self.urlhandler and send it.
            z.cssztext/cssz	text/html��zContent-Typez%s; charset=UTF-8zutf-8N)	rrrZ
send_responseZsend_headerZend_headersZwfiler��
urlhandlerr�)r>�content_typerrr�do_GET�s	

z(_start_server.<locals>.DocHandler.do_GETcWsdS)Nr)r>r�rrr�log_message�sz-_start_server.<locals>.DocHandler.log_messageN)r%r&r[r�r�rrrr�
DocHandler�sr�cs:eZdZdd�Z�fdd�Zdd�ZdS)z _start_server.<locals>.DocServercSsMd|_|j|f|_||_|jj||j|j�d|_dS)NZ	localhostF)�hostZaddressr�rIr}�handlerr�)r>�portr�rrrr}�s
		z)_start_server.<locals>.DocServer.__init__cs[xJ|jsL�j|jj�gggd�\}}}|r|j�qW|j�dS)Nr)r��selectZsocketr�Zhandle_requestZserver_close)r>Zrd�wrZex)r�rr�serve_until_quit�s
-z1_start_server.<locals>.DocServer.serve_until_quitcSs*|jj|�|jr&|j|�dS)N)rI�server_activater�)r>rrrr��s	z0_start_server.<locals>.DocServer.server_activateN)r%r&r[r}r�r�r)r�rr�	DocServer�sr�csUeZdZ�fdd�Z����fdd�Zdd�Zdd�Zd	S)
z#_start_server.<locals>.ServerThreadcs>||_t|�|_�jj|�d|_d|_dS)NF)r�rr��Threadr}�serving�error)r>r�r�)�	threadingrrr}�s
		z,_start_server.<locals>.ServerThread.__init__cs�ye�jj�_��_�jj�_t|j��_�|j	|j
�}||_|j�Wn.t
k
r�}z||_WYdd}~XnXdS)zStart the server.N)�server�
HTTPServerrIr�r�ZMessageZMessageClass�staticmethodr�r��ready�	docserverr�rNr�)r>Zdocsvr�e)r�r��email�httprrr��s		z'_start_server.<locals>.ServerThread.runcSs>d|_|j|_|j|_d|j|jf|_dS)NTz
http://%s:%d/)r�r�Zserver_portr�r)r>r�rrrr��s	z)_start_server.<locals>.ServerThread.readycSs"d|j_d|_d|_dS)z&Stop the server and this thread nicelyTFN)r�r�r�r)r>rrr�stop�s	z(_start_server.<locals>.ServerThread.stopN)r%r&r[r}r�r�r�r)r�r�r�r�r�rr�ServerThread�s
r�g{�G�z�?)
Zhttp.serverZ
email.messager�r�r�ZBaseHTTPRequestHandlerr�r�r%r�r��timeZsleep)r�r�r�Zthreadr)r�r�r�r�r�r�r�
_start_serverIs8"+"
r�z	text/htmlcs�G�fdd�dt�}|���fdd���fdd���fdd���fd	d
���fdd��	�fd
d���fdd���fdd���fdd�����������	f	dd�}|jd�r|dd�}|dkr{tjjtjjt��}tjj||�}t|��}dj|j	��SWdQRXn|dkr�||�St
d||f��dS)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.eZdZ�fdd�Zdd�ZdS)z_url_handler.<locals>._HTMLDoccs'd}d|}d||��|fS)zFormat an HTML page.zpydoc_data/_pydoc.cssz1<link rel="stylesheet" type="text/css" href="%s">a<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html><head><title>Pydoc: %s</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
%s</head><body bgcolor="#f0f0f8">%s<div style="clear:both;padding-top:.5em;">%s</div>
</body></html>r)r>r�r��css_pathZcss_link)�html_navbarrrr��sz#_url_handler.<locals>._HTMLDoc.pagecSsd||fS)Nz<a href="getfile?key=%s">%s</a>r)r>rrrrrr�sz'_url_handler.<locals>._HTMLDoc.filelinkN)r%r&r[r�rr)r�rr�_HTMLDoc�s
r�csU�jdtj�tj�dtj�f�}d|�jtjdd��fS)Nz%s [%s, %s]raZ
            <div style='float:left'>
                Python %s<br>%s
            </div>
            <div style='float:right'>
                <div style='text-align:center'>
                  <a href="index.html">Module Index</a>
                  : <a href="topics.html">Topics</a>
                  : <a href="keywords.html">Keywords</a>
                </div>
                <div>
                    <form action="get" style='display:inline;'>
                      <input type=text name=key size=15>
                      <input type=submit value="Get">
                    </form>&nbsp;
                    <form action="search" style='display:inline;'>
                      <input type=text name=key size=15>
                      <input type=submit value="Search">
                    </form>
                </div>
            </div>
            ZterseT)r�r�Zpython_versionZpython_buildZpython_compiler)rD)r�rrr��s
z!_url_handler.<locals>.html_navbarcs�dd�}�jddd�}dd�tjD�}�j||�}|d�jd	dd
|�g}i}x*tjD]}|j�j||��q{W|jd�dd
j|�fS)zModule Index page.cSsd||fS)Nz<a href="%s.html">%s</a>r)r(rrr�	bltinlink	sz3_url_handler.<locals>.html_index.<locals>.bltinlinkz7<big><big><strong>Index of Modules</strong></big></big>z#ffffffz#7799eecSs"g|]}|dkr|�qS)r�r)r�r(rrrr�	s	z4_url_handler.<locals>.html_index.<locals>.<listcomp>z<p>zBuilt-in Modulesz#ee77aaz|<p align=right><font color="#909090" face="helvetica,arial"><strong>pydoc</strong> by Ka-Ping Yee&lt;ping@lfw.org&gt;</font>zIndex of Modulesr)	rrr�rrrr
rtr!)r�r�namesr�r�r)r�rr�
html_index	sz _url_handler.<locals>.html_indexc	s�g��fdd�}tj��7tjd�dd�}t�j||d|�WdQRXdd	�}g}�jd
dd�}x+�D]#\}}|j||�|�q�W|�jd
|dddj|��}d|fS)zSearch results page.csK|dd�dkr*|dd�d}�j||o@d|f�dS)Nr�z	.__init__z
 (package)z- i����i����)r
)rr'r�)�
search_resultrrr�3	sz3_url_handler.<locals>.html_search.<locals>.callbackr�cSsdS)Nr)r'rrrr�:	sz2_url_handler.<locals>.html_search.<locals>.onerrorr�NcSsd||fS)Nz<a href="%s.html">%s</a>r)r(rrrr�?	sz4_url_handler.<locals>.html_search.<locals>.bltinlinkz5<big><big><strong>Search Results</strong></big></big>z#ffffffz#7799eezkey = %sz#ee77aaz<br>zSearch Results)	r�r�r�r�r�rr
rr!)	rGr�r�r�rxrr(r�r�)r�)r�r�html_search.	s 

 	 z!_url_handler.<locals>.html_searchc
s�tjj|�}tj|��}�j|j��}WdQRXd|}�jddd�}|�jd|dd|�}d||fS)	z-Get and display a source file listing safely.Nz
<pre>%s</pre>z3<big><big><strong>File Listing</strong></big></big>z#ffffffz#7799eezFile: %sz#ee77aaz
getfile %s)	r7r8Zunquoter�r�r�r�rr)r�fpr#Zbodyrr�)r�rr�html_getfileL	s
	z"_url_handler.<locals>.html_getfilecsndd�}�jddd�}ttjj��}�j||�}|�jddd|�}d|fS)zIndex of topic texts available.cSsd||fS)Nz<a href="topic?key=%s">%s</a>r)r(rrrr�\	sz4_url_handler.<locals>.html_topics.<locals>.bltinlinkz,<big><big><strong>INDEX</strong></big></big>z#ffffffz#7799eeZTopicsz#ee77aa)rr�r�r�rDrr)r�rr�r�)r�rr�html_topicsY	s	z!_url_handler.<locals>.html_topicscsn�jddd�}ttjj��}dd�}�j||�}|�jddd|�}d|fS)zIndex of keywords.z,<big><big><strong>INDEX</strong></big></big>z#ffffffz#7799eecSsd||fS)Nz<a href="topic?key=%s">%s</a>r)r(rrrr�p	sz6_url_handler.<locals>.html_keywords.<locals>.bltinlinkZKeywordsz#ee77aa)rr�r�r�rDrr)rr�r�r�)r�rr�
html_keywordsi	s	z#_url_handler.<locals>.html_keywordscstj�}t||�}|j|�\}}||jkrHd}nd}�jd|dd�}d�j|�}�j|dd|�}|r�t|j	��}dd	�}�j
||�}�jd
dd|�}d||fdj|||f�fS)
zTopic or keyword help page.ZKEYWORDZTOPICz)<big><big><strong>%s</strong></big></big>z#ffffffz#7799eez
<pre>%s</pre>z#ee77aacSsd||fS)Nz<a href="topic?key=%s">%s</a>r)r(rrrr��	sz7_url_handler.<locals>.html_topicpage.<locals>.bltinlinkzRelated help topics: z%s %sr)
r�r�r�r�r�rr(rr�rrrr!)r�ZbufZhtmlhelpr�r�r�rr�)r�rr�html_topicpagex	s&		
z$_url_handler.<locals>.html_topicpagecs^t|dd�}|dkr6|dkr6td��t|�}�j||�}||fS)Nr�rr�zcould not find object)r�rjr�r�)rr9r��content)r�rr�html_getobj�	sz!_url_handler.<locals>.html_getobjcsp�jddd�}dj�fdd�tt|�|�D��}|�j|dd|�}d||fS)	Nz,<big><big><strong>Error</strong></big></big>z#ffffffz#7799eez<br>c3s|]}�j|�VqdS)N)r�)r�r�)r�rrrr�	sz3_url_handler.<locals>.html_error.<locals>.<genexpr>z#bb0000z
Error - %s)rr!rr�r)rr�rr�)r�rr�
html_error�	s
z _url_handler.<locals>.html_errorcs
|}|jd�r%|dd�}y�|dkrF��\}}ny|dkrd��\}}n[|dkr���\}}n=d|kr�|jd�\}}}|d	kr��|�\}}q�|d
kr��|�\}}q�|dkr4y�|�\}}Wq�tk
r0�|�\}}Yq�Xq�|dkr�|dkr^��\}}q�y�|�\}}Wq�tk
r��|�\}}Yq�Xq�td
��n�|�\}}Wn:tk
r�}z�||�\}}WYdd}~XnX�j||�S)zGenerate an HTML page for url.z.htmlN�rrtr�r�rfz
search?keyzgetfile?keyz	topic?keyzget?keyz
bad pydoc url���)r�index)rr�)rrr�rjrNr�)rZcomplete_urlr�r��opr_r�)	r�r�r�r�r�r�r�r�r�rr�
get_html_page�	sB

(z#_url_handler.<locals>.get_html_pager�rNztext/cssrz	text/htmlz"unknown content type %r for url %s)r�rqr	r�dirname�realpathrVr!r��	readlinesr�)rr�r�r�Z	path_herer�r�r)
r�r�r�r�r�r�r�r�r�r�r�_url_handler�s,		

**
r�open_browserTcCs$ddl}tt|�}|jr5t|j�dS|jr d}|rZ|j|j�z�ytd|j�t|�x^|jr�td�}|j	�}|dkr�Pq}|dkr�|j|j�q}t|�q}WWnt
tfk
r�t�YnXWd|jr|j�td�XdS)	z�Start 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 ready atzserver> r�r�zServer stopped)
�
webbrowserr�rr�r�r�r�rr�r�r�r�r�)r�rrZserverthreadZserver_help_msgr�rrr�browse�	s2	
	
	
rcCs%t|t�o$|jtj�dkS)Nr)r�r9r�r	�sep)rNrrr�ispath
srcCs�ddl}Gdd�dt�}dtjkr|tjjtjd�}|tjkritjj|�tjjdd�y�|jtjdd�d�\}}d	}d	}d	}d}xp|D]h\}	}
|	d
kr�d}d}|	dkrt	|
�dS|	d
krd}|
}|	dkr�d}q�W|r[|dkrGd}t
|d|�dS|sg|�x�|D]�}t|�r�tjj|�r�t
d|�Pyyt|�r�tjj|�r�t|�}|r
t|�rtjj|�rt|�qt|�n
tj|�Wqntk
rL}zt
|�WYdd}~XqnXqnWWnc|j|fk
r�tjjtjjtjd��d}
t
djd|
dtj��YnXdS)z@Command-line interface (looks at sys.argv to decide what to do).rNc@seZdZdS)zcli.<locals>.BadUsageN)r%r&r[rrrr�BadUsage
sr	rrrzbk:p:wFz-bTz-kz-pz-wrzfile %r does not exista�pydoc - the Python documentation tool

{cmd} <name> ...
    Show text documentation on something.  <name> 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 <name> 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 <keyword>
    Search for a keyword in the synopsis lines of all available modules.

{cmd} -p <port>
    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.  The -p option can be used with
    the -b option to explicitly specify the server port.

{cmd} -w <name> ...
    Write out the HTML documentation for a module to a file in the current
    directory.  If <name> contains a '{sep}', it is treated as a filename; if
    it names a directory, documentation is written for all the contents.
r�r)�getoptrNrrr	r�argv�remove�insertr�rr�existsr�r~r�rr�r�rr�r�r�r�rr)r
r	Z	scriptdirZoptsr�ZwritingZstart_serverrr��opt�val�argrHr�rrr�cli
sd%




%)rr�)WrUr6rPrTrSr_Zimportlib._bootstrapr�Zimportlib._bootstrap_external�importlib.machinery�importlib.utilrr�r	r<r�rrr�r�Zurllib.parser7r��collectionsr�reprlibr�	tracebackrrrr$r)r-r/r3r�
IGNORECASEr4r5r:r?rCrOrurvr�r�r�rNr�r�r�r�r�r�rvrwr�r�r�r�r�r�r�r�r�r�r�r.r�r�r�r�r"r�r�r�rr�r�r�rrrrr%rrrr�<module>$s�			

'
0=*��- �d!,			
��	=��%V

Rosenblum TV: Video training, virtual workshops, classes, tutorials
logologologologo
  • About
  • What We Do
  • Our Clients
  • Case Studies
    • The BBC
    • CBS News
    • New York Times Television
    • Spectrum News
    • The Newark Star-Ledger
    • The United Nations
    • McGraw/Hill
    • Oyster Yachts
    • Scottish Environmental Protection Agency
  • The Power of Storytelling
  • Why iPhones?
  • Michael on Media
  • Books
  • Contact
  • About
  • What We Do
  • Our Clients
  • Case Studies
    • The BBC
    • CBS News
    • New York Times Television
    • Spectrum News
    • The Newark Star-Ledger
    • The United Nations
    • McGraw/Hill
    • Oyster Yachts
    • Scottish Environmental Protection Agency
  • The Power of Storytelling
  • Why iPhones?
  • Michael on Media
  • Books
  • Contact

RE-INVENTING THE TELEVISION NEWS BUSINESS*

A revolution in video storytelling

Creating entirely new & cost-effective production methods

From the world leaders in video production training and the creators of Character Driven Storytelling™

*and every other business that uses video

WHAT WE DO

Over the past 35 years, we have designed, built or restructured some of the most powerful news and journalism companies in the world.

We replace the traditional TV news ‘crew’ with one highly trained journalist, working alone with nothing but an iPhone.

No more TV news ‘crews’, no editors and no field producers.

This is television news done the way newspaper journalism is done – one reporter with their electronic pad and pencil.

In doing this, we can cut the cost of production by as much as 75% while increasing ratings and audience engagement.

In the place of conventional TV news ‘packages’ – ie, reporter stand up, interview, b-roll, man on the street, we marry great journalism with Netflix and Hollywood storytelling.

It’s a combination that works.

We have taken most of our clients to #1 in their respective markets.

And it’s not just for news. Any company, any profit, any NGO and anyone else who is online needs to tell their story in compelling yet cost-effective video. We can teach you to do that. Either in person or virtually.

EXAMPLES OF WHAT WE CAN TEACH YOUR STAFF TO PRODUCE

ITAY HOD

Itay Hod, MMJ with KPIX/CBS in San Francisco, took the 5-Day Intensive Video Storytelling Bootcamp in 2018.

Because he works alone, with only an iPhone, he was able to embed himself with a homeless family.

Here’s the story he produced in a one-day turn.

KIET DO

Kiet Do, an MMJ with KPIX/CBS in San Francisco, took the 5-Day Intensive Video Storytelling Bootcamp in 2021.

Here is a story he produced, all on his own, with only an iPhone and in a one-day turn.

TAYLOR SCHAUB

Taylor Schaub, an MMJ with Spectrum News 1 in LA, took the 5-Day Intensive Video Storytelling Bootcamp in 2023.

Here is a story he turned in only one day, using only an iPhone. It was the first video story he ever did and it was nominated for an Emmy.

THE BOOTCAMP

How do we convert stations and whole networks to working in this way?

Since 1988, we have run intensive 5-Day Video Storytelling Bootcamps

We have done these all over the world.

These are hands-on bootcamps, and participants learn an entirely new way of creating TV news stories.

-We shoot at a 3:1 ratio or lower, so turnaround times are fast.

-We go directly from camera to timelilne and edit – no written scripts.  We work in the medium of pictures and sound.

-We are entirely character-driven.

-We are driven by pictures and real events.

-We are focused almost entirely on ’the viewer experience’.

Since 1988, more than 70,000 journalists around the world have taken our bootcamps, either in person on virtualy.

Case Studies

CBS Case Study Logos
CBS News

We have started to work with CBS News, bringing our ideas of character-driven storytelling to one of the most successful and biggest networks in the United States. Since beginning to work with them ratings have climbed and more importantly, audience engagement is through the ceiling.

Learn More
NYT Case Study Logos
New York Times Television

We started New York Times Television in 1990 and it was the first paper to be brought into the world of TV. It quickly became one of the most successful non-fiction production companies in the United States. The series and documentaries we produced won many awards including multiple Emmys.

Learn More
BBC Case Study Logos
The BBC

We have been working with the BBC since the year 2000 helping to convert their national news network to our visual storytelling technique. Most recently we have trained teams from their sports, documentaries, and comedy divisions to make character-driven stories using only smartphones.

Learn More
Spectrum Case Study Logos
Spectrum News

For the past five years we have worked with Spectrum News to introduce and train their journalists on visual, character driven storytelling using smartphones helping to create a different kind of local news for their network of 24-Hour News Stations across the United States.

Learn More
UN Case Study Logos
The United Nations

In 2006, we were approached by the United Nations. Rather than rely on news outlets, it would be much easier to train the field operatives to produce their own stories. We spent two years working with the UN, training more than 100 of their staff in bootcamps in Geneva and Nairobi.

Learn More
Star Ledger Case Study Logos
The Newark Star-Ledger

We trained 50 print reporters at the paper to shoot and tell their own stories, in conjunction with their print work. We built a TV newsroom in their existing print newsroom – you could not ask for a better set and they began to live stream their stories in conjunction with their print work.

Learn More
Mcgraw Hill Case Study Logos
Mcgraw Hill

We spent two years with McGraw Hill, training more than 150 of their staffers, making them completely video literate. McGraw/Hill media properties we transit included Business Week, Aviation Week, (what was the name of the architecture magazine), and JD Power and Associates.

Learn More
VOA Case Study Logos
Voice of America

In 1990, we were approached by The Voice of America, the official broadcasting agency for the United States Government. When we met with VOA, they were only a short wave radio broadcaster, but working with them, we took them into television, launching VOA-TV.

Learn More
Oyster Case Study Logos
Oyster Yachts

British based Oyster Yachts makes some of the finest yachts in the world. Like every other company, they had to find a way to feed the never-ending video demands of social media – sites like Instagram and TikTok. We trained the Oyster staff to tell their own stories, using only iPhones.

Learn More
SEPA Case Study Logos
Scottish Environmental Protection Agency

We were approached by SEPA, the Scottish Environmental Protection Agency because they had to continually find a way to ‘feed the media beast’. The result was that SEPA was able to tell their own stories, whenever they wanted, and at almost no additional cost.

Learn More
Image 11-11-22 at 6.25 PM

Michael on Media

Michael Rosenblum has been writing about the media since 1988. His work and ideas have appeared in The Guardian, The Huffington Post, Ilkeston Life and many other publications.

He has been blogging regularly for the past 35 years on this subject. Having taught media studies at Columbia University, NYU and now the University of Oxford, he is considered an expert on this subject.

Continue reading this post or look back at previous posts.

Read More

Do You Have Questions About Learning Video Skills?

If you would like to know more about our courses contact us and one of our training advisors will be happy to call you.

Contact Us

Copyright 2024. All rights reserved.