add-determinism 0.7.3

RPM buildroot helper to strip nondeterministic bits in files
Documentation
B

�/g^�-c@s�dZddlmZddlmZmZmZmZddlm	Z	ddl
mZmZm
Z
mZddlmZmZddl
mZddlmZGd	d
�d
e�ZGdd�de
�ZGd
d�de�ZGdd�de�Zdd�Zdd�Zedkr�ddlmZedddd�ddlm Z e e�dS)a help.py: Implement the Idle help menu.
Contents are subject to revision at any time, without notice.


Help => About IDLE: display About Idle dialog

<to be moved here from help_about.py>


Help => IDLE Help: Display help.html with proper formatting.
Doc/library/idle.rst (Sphinx)=> Doc/build/html/library/idle.html
(help.copy_strip)=> Lib/idlelib/help.html

HelpParser - Parse help.html and render to tk Text.

HelpText - Display formatted help.html.

HelpFrame - Contain text, scrollbar, and table-of-contents.
(This will be needed for display in a future tabbed window.)

HelpWindow - Display HelpFrame in a standalone window.

copy_strip - Copy idle.html to help.html, rstripping each line.

show_idlehelp - Create HelpWindow.  Called in EditorWindow.help_dialog.
�)�
HTMLParser)�abspath�dirname�isfile�join)�python_version)�Toplevel�Frame�Text�Menu)�
Menubutton�	Scrollbar��font)�idleConfc@s:eZdZdZdd�Zddd�Zdd�Zd	d
�Zdd�Zd
S)�
HelpParsera~Render help.html into a text widget.

    The overridden handle_xyz methods handle a subset of html tags.
    The supplied text should have the needed tag configurations.
    The behavior for unsupported tags, such as table, is undefined.
    If the tags generated by Sphinx change, this class, especially
    the handle_starttag and handle_endtags methods, might have to also.
    cCs`tj|dd�||_d|_d|_d|_d|_d|_d|_d|_	d|_
d|_g|_d|_
d|_dS)NT)Zconvert_charrefs�Fr)r�__init__�text�tags�chartags�show�hdrlink�level�pre�hprefix�	nested_dl�
simplelist�toc�header�prevtag)�selfr�r!�$/usr/lib64/python3.7/idlelib/help.pyr3szHelpParser.__init__�cCs0|j|7_|jdkrdndt|j�|_dS)z#Change indent (+1, 0, -1) and tags.rrZlN)rZstrr)r Zamtr!r!r"�indentCszHelpParser.indentcCs>d}x|D]\}}|dkr
|}q
Wd}|dkr@|dkr@d|_�n�|dkrZ|dkrZd|_�n�|dkr�|jr�|jd	s�|j�d
d�}|r�|��s�dnd
}�nx|dkr�|dkr�d|_�n^|dkr�|dkr�d|_�nD|dkr�d|_�n2|dk�r|�d�dk�rd
}d|_nd|_|��n�|dk�r2|j	d	k�rd|_
n�|dk�rN|j�rHdnd}n�|dk�rp|j
�sddnd
}d|_
n�|dk�r�|��d
}n�|dk�r�d|_|j�r�|j�dd�d|_
nZ|dk�r�|dk�r�d|_n>|dk�r�||_
n,|d k�r|j�r
d|_|j�dd�||_
|j�r0|j�d||j
|jf�d|f|_d!S)"zHandle starttags in help.html.rZclassZdivZsectionTZ
sphinxsidebarFZprzend-1c linestartzend-1cz

�
�spanrZversionmodified�em)�ul�olZsimple�����ZdlZliz
* z

* Zdt�dd�end�preblock�aZ
headerlink�h1)�h2�h3N)rrrZgetZisspacerZfindrr$rrr�insertrrr)r �tagZattrsZclass_r.ZvZsZlastliner!r!r"�handle_starttagHsh













zHelpParser.handle_starttagcCs�|dkr^|jdkst�|jrV|dkr(dn|dkr4dnd}|j�||j|j�d�f�d|_nH|d	krnd|_	n8|d
kr~d|_
n(|dkr�d|_d|_n|d
kr�|�d�d|f|_
dS)zHandle endtags in help.html.�r/r0r1rr1z        r0z    rr2)r&r'r.Fr)r(r+r)r*N)rZAssertionErrorrrZappendrr�indexrrrrr$r)r r3r$r!r!r"�
handle_endtag�s$
zHelpParser.handle_endtagcCs�|jr�|js�|jr|n
|�dd�}|jdkr`y|d|�d��|_Wntk
r^d|_YnX|jdkr�|jdkr�|dt|j��|jkr�|t|j�d�}|j	|�
�7_	|j�d||j|j
f�dS)	z"Handle date segments in help.html.r%z r/rrr5Nr,)rrrZreplacerr6rZ
ValueErrorZlenrZstriprr2r)r ZdataZdr!r!r"�handle_data�s


zHelpParser.handle_dataN)r#)	�__name__�
__module__�__qualname__�__doc__rr$r4r7r8r!r!r!r"r*s
:rc@� eZdZdZdd�Zdd�ZdS)�HelpTextzDisplay help.html.c	
Csvtjddddd�}tjddddd�}d|d}tj||d	d
dd
||d�|�d
ddg�}|�dddg�}|df|d<|jd|ddfd�|jd|ddfd�|jd|ddfd�|jd|ddfd�|jd|dfd d!�|jd"|d#fd$d%d&d'd(�|jd)d$d$d*�|jd+d,d,d*�|jd-d.d.d*�|jd/d0d0d*�t|�|_t|d1d2��}|�	�}Wd3QRX|j�
|�d4|d5<d3S)6z'Configure tags and feed file to parser.�mainZEditorWindow�widthZint)Ztype�heightiiZwordri)ZwrapZhighlightthicknessZpadx�borderwidthr@rAZ
TkDefaultFontZarialZ	helveticaZTkFixedFontZmonacoZcourierirr'Zitalicr
r/iZboldr0ir1irz#f6f6ff)r�
backgroundr-i
ir#Zsolidz#eeffcc)r�lmargin1rBZreliefrCZl1)rDZlmargin2Zl2i2Zl3iKZl4idzutf-8)ZencodingNZdisabledZstate)rZ	GetOptionr	r�findfontZ
tag_configurer�parser�openZreadZfeed)	r �parent�filenameZuwideZuhighZ
normalfontZ	fixedfontZfZcontentsr!r!r"r�s0
zHelpText.__init__cCsnxh|D]`}|��dd�tj|d�D�krDtj|d|d�}|��dS|��dd�tj|d�D�kr|SqWdS)	z4Return name of first font family derived from names.cs�|]}|��VqdS�N��lower�Z.0Zxr!r!r"�	<genexpr>�sz$HelpText.findfont.<locals>.<genexpr>)�rootT)�nameZexistsrPZfamilycsrJrKrLrNr!r!r"rO�sN)rM�tkfont�namesZFontZactualZfamilies)r rSrQrr!r!r"rE�s
zHelpText.findfontN)r9r:r;r<rrEr!r!r!r"r>�sr>c@r=)�	HelpFramez&Display html text, scrollbar, and toc.cCs�t�||�t||�|_}|d|d<|�|�|_}t||jd�|_}|j	|d<|j
ddd�|jddd�|jdddd�|jddd	d�|jdd
dd�dS)NrC)�commandZyscrollcommandrr#�ZweightZnw)�row�column�sticky�nsew�Zns)
rrr>r�toc_menurr�yview�scrollZsetZrowconfigureZcolumnconfigure�grid)r rHrIrrr^r!r!r"r�s
zHelpFrame.__init__csTt|dd�}t|dd�}x.�jjD]"\}}|j||f�fdd�	d�q"W||d<|S)	z+Create table of contents as drop-down menu.ZTOC�rF)Ztearoffcs
��|�SrK)r])�dexr`r!r"Z<lambda>�sz$HelpFrame.toc_menu.<locals>.<lambda>)ZlabelrUZmenu)rr
rFrZadd_command)r rrZdropZlblrar!r`r"r\�szHelpFrame.toc_menuN)r9r:r;r<rr\r!r!r!r"rT�srTc@seZdZdZdd�ZdS)�
HelpWindowz!Display frame with rendered html.cCsZt�||�|�|�|�d|j�t||�jdddd�|jddd�|jddd�dS)NZWM_DELETE_WINDOWrrZ)rXrWrYr#rV)	rrZwm_titleZprotocolZdestroyrTr_Zgrid_columnconfigureZgrid_rowconfigure)r rHrIZtitler!r!r"r�s
zHelpWindow.__init__N)r9r:r;r<rr!r!r!r"rb�srbc
Cs�tttttt����ddddd�}tttt��d�}t|d��<}t|d��&}x|D]}|�|��d	�qRWWd
QRXWd
QRXt|�d|���d
S)a^Copy idle.html to idlelib/help.html, stripping trailing whitespace.

    Files with trailing whitespace cannot be pushed to the git cpython
    repository.  For 3.x (on Windows), help.html is generated, after
    editing idle.rst on the master branch, with
      sphinx-build -bhtml . build/html
      python_d.exe -c "from idlelib.help import copy_strip; copy_strip()"
    Check build/html/library/idle.html, the help.html diff, and the text
    displayed by Help => IDLE Help.  Add a blurb and create a PR.

    It can be worthwhile to occasionally generate help.html without
    touching idle.rst.  Changes to the master version and to the doc
    build system may result in changes that should not changed
    the displayed text, but might break HelpParser.

    As long as master and maintenance versions of idle.rst remain the
    same, help.html can be backported.  The internal Python version
    number is not displayed.  If maintenance idle.rst diverges from
    the master version, then instead of backporting help.html from
    master, repeat the procedure above to generate a maintenance
    version.
    ZDocZbuildZhtmlZlibraryz	idle.html�	help.htmlZrbZwbs
Nz copied to )rrr�__file__rGZwriteZrstripZprint)ZsrcZdstZinnZoutZliner!r!r"�
copy_strip�s
*recCs4tttt��d�}t|�sdSt||dt��dS)z7Create HelpWindow; called from Idle Help event handler.rcNzIDLE Help (%s))rrrrdrrbr)rHrIr!r!r"�
show_idlehelpsrfZ__main__)r?zidlelib.idle_test.test_helpr[F)Z	verbosityZexit)�runN)!r<Zhtml.parserrZos.pathrrrrZplatformrZtkinterrrr	r
Ztkinter.ttkrrrrRZidlelib.configrrr>rTrbrerfr9Zunittestr?Zidlelib.idle_test.htestrgr!r!r!r"Z<module>s$~*