Your IP : 216.73.216.213


Current Path : /opt/alt/python37/lib64/python3.7/Doc/tools/__pycache__/
Upload File :
Current File : //opt/alt/python37/lib64/python3.7/Doc/tools/__pycache__/rstlint.cpython-37.pyc

B

� f��h@s�ddlZddlZddlZddlZddlmZmZmZmZddl	m
Z
dddddd	d
ddd
ddddddddddddddddddd d!d"d#d$d%d&d'd(d)d*d+d,d-d.d/d0d1d2d3d4d5d6d7d8dd9d:d;d<d=d>d?d@dAdBdCdDdEdFdGdHdIdJdKdLdMdNdOdPdQdRdSdTdUdVdWdXdYdZd[d\d"d]d^d_d`dadbdcdddedfdgdhdighZdjdk�e�dlZe�
dme�Ze�
dn�Ze�
do�ZiZdpdqdr�Zdsdt�Zedudvdw�dxdy��Zedzd{dw�d|d}��Zedudz�d~d��Zedzddw�d�d���Zed�d{d�dr�d�d���Zd�d��Zed�k�r�e�eej��dS)��N)�join�splitext�abspath�exists)�defaultdictZ
admonitionZ	attentionZcaution�classZcompoundZ	container�contentsz	csv-tableZdangerZdatezdefault-roleZepigraph�errorZfigureZfooter�headerZ
highlightsZhintZimageZ	importantZincludez
line-blockz
list-table�metaZnotezparsed-literalz
pull-quote�raw�replacezrestructuredtext-test-directiveZroleZrubricZsectnumZsidebar�tableztarget-notesZtip�titleZtopicZunicodeZwarningZacksZ	attributeZ
autoattributeZ	autoclassZautodataZ
autoexceptionZautofunctionZ
automethodZ
automoduleZavailabilityZcenteredZ	cfunction�classmethodZcmacroZ	cmdoptionZcmemberz
code-blockZconfvalZcssclassZctypeZ
currentmoduleZcvar�dataZ	decoratorZdecoratormethodzdeprecated-removedzdeprecated(?!-removed)ZdescribeZ	directiveZdoctestZenvvarZeventZ	exceptionZfunctionZglossaryZ	highlightZ
highlightlangzimpl-detail�indexZliteralinclude�methodZmiscnews�moduleZmoduleauthorZopcodeZ
pdbcommandZproductionlistZprogramZ
sectionauthorZseealsoZ
sourcecode�staticmethodZtabularcolumnsZtestcodeZ
testoutputZ	testsetupZtoctreeZtodoZtodolistZversionaddedZversionchanged�(�|�)z(?<!\.)\.\. %s([^a-z:]|:(?!:))z(^| )`\w([^`]*?\w)?`($| )z[a-z]::\s|`|\.\.\s*\w+:�F)�severity�falsepositivescs��fdd�}|S)z.Decorator to register a function as a checker.c	sJx�D]}t�|g��|�qWx$tD]}t||��|t|��q&W|S)N)�checkers�
setdefault�append�
checker_props�setattr�get)�func�suffixZprop)�kwds�suffixes��6/opt/alt/python37/lib64/python3.7/Doc/tools/rstlint.py�deco9s


zchecker.<locals>.decor&)r%r$r(r&)r$r%r'�checker7sr)z.py�)rc
csvd�|�}d|kr.tjdkr"dV|�dd�}yt||d�Wn2tk
rp}z|jd|fVWdd}~XYnXdS)z'Check Python examples for valid syntax.��
�nt)rz\r in code file�execznot compilable: %sN)r�os�namer
�compile�SyntaxError�lineno)�fn�lines�code�errr&r&r'�check_syntaxBs

r8z.rst�ccsrd}xht|�D]\\}}t�|�r.|ddfVd|kr<d}q|sZt�|�rZ|ddfVq|r|��sd}qWdS)z%Check for suspicious reST constructs.Frz+comment seems to be intended as a directivez.. productionlist::Tzdefault role usedN)�	enumerate�seems_directive_re�search�default_role_re�strip)r4r5Zinprod�lno�liner&r&r'�check_suspicious_constructsPs
rAccsrxlt|�D]`\}}d|kr(|ddfVd|kr>|ddfV|dd��d�|dd�kr
|dd	fVq
WdS)
z,Check for whitespace and line length issues.r,rz
\r in line�	zOMG TABS!!!1N���z 	ztrailing whitespace)r:�rstrip)r4r5r?r@r&r&r'�check_whitespace_srEccsZxTt|�D]H\}}t|�dkr
|��ddkr
d|kr
|���d�s
|ddfVq
WdS)	z:Check for line length; this checker is not run by default.�Qrz+|zhttp://)z.. functionz	.. methodz.. cfunctionrz
line too longN)r:�len�lstrip�
startswith)r4r5r?r@r&r&r'�check_line_lengthksrJz.htmlTccs6x0t|�D]$\}}t�|�r
|dd|fVq
WdS)zdCheck HTML files for leaked reST markup; this only works if
    the HTML files have been built.
    rzpossibly leaked markup: %rN)r:�leaked_markup_rer<)r4r5r?r@r&r&r'�check_leaked_markupys
rLcCs"d|d}yt�|dd�d�\}}Wntjk
rFt|�dSXd}d}g}d}xT|D]L\}}	|dkrtd}q^|d	kr�d}q^|d
kr�t|	�}q^|dkr^|�t|	��q^Wt|�dkr�d}
n"t|�dkr�|d}
nt|�dSt|
�s�td
|
�dStt�}�x�t	�
|
�D�]�\}}
}t|�|k�r8|
dd�=�q�xb|D�]X}t||�}|dd�dk�rn|dd�}t|�|k�r��q@t|�d}t
�|d�}|�s��q@|�r�td|�y&t|ddd��}t|�}WdQRXWnLttfk
�r&}z(td||f�|dd7<�w@Wdd}~XYnXxn|D]f}|j�rD|�sD�q.|j}||k�r.x<|||�D].\}}td||||f�||d7<�q`W�q.W�q@W�qW|�r�t�|�s�|dk�r�td|�ntd�n>x<t|�D]0}||}td||dk�rd�pd|f��q�Wtt|��S)NaUsage: %s [-v] [-f] [-s sev] [-i path]* [path]

Options:  -v       verbose (print all checked file names)
          -f       enable checkers that yield many false positives
          -s sev   only show problems with severity >= sev
          -i path  ignore subdir or file path
rrzvfs:i:r9Fz-vTz-fz-sz-i�.zError: path %s does not existz./zChecking %s...�rzutf-8)�encodingz%s: cannot open: %sr*z[%d] %s:%d: %sz&No problems with severity >= %d found.zNo problems found.z$%d problem%s with severity %d found.�sr+)�getoptZGetoptError�print�intrrrGrrr/�walkrrrr!�open�list�IOError�OSErrorrr�sorted�bool)�argvZusageZgopts�args�verboser�ignoreZfalseposZopt�val�path�count�root�dirs�filesr4ZextZcheckerlist�fr5r7r)Zcsevr?�msgZnumberr&r&r'�main�s�





(

$rg�__main__)r/�re�sysrQZos.pathrrrr�collectionsrZ
directivesZall_directivesr1r;r=rKrrr)r8rArErJrLrg�__name__�exitr[r&r&r&r'�<module>sP










a