Your IP : 216.73.216.213


Current Path : /opt/alt/python35/lib64/python3.5/Doc/tools/__pycache__/
Upload File :
Current File : //opt/alt/python35/lib64/python3.5/Doc/tools/__pycache__/rstlint.cpython-35.opt-1.pyc



��Yf��g@s�ddlmZddlZddlZddlZddlZddlmZmZm	Z	m
Z
ddlmZddddd	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`dadbdcdddedfdgdhdiggZ
djdkje
�dlZejdme�Zejdn�Zejdo�ZiZdpdqdrdsiZdtdu�Zedvdpdw�dxdy��Zedzdpd{�d|d}��Zedvdz�d~d��Zedzdpd�d�d���Zed�dpd{drd��d�d���Zd�d��Zed�kr�ejeej��dS)��)�with_statementN)�join�splitext�abspath�exists)�defaultdictZ
admonitionZ	attentionZcaution�classZcompoundZ	container�contentsz	csv-tableZdangerZdatezdefault-roleZepigraph�errorZfigureZfooter�headerZ
highlightsZhintZimageZ	important�includez
line-blockz
list-table�metaZnotezparsed-literalz
pull-quote�raw�replacezrestructuredtext-test-directiveZroleZrubricZsectnumZsidebar�tableztarget-notesZtip�titleZtopicZunicodeZwarningZacksZ	attributeZ
autoattributeZ	autoclassZautodataZ
autoexceptionZautofunctionZ
automethodZ
automoduleZcenteredZ	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+:�severity��falsepositivesFcs��fdd�}|S)z.Decorator to register a function as a checker.cs_x'�D]}tj|g�j|�qWx.tD]&}t||�j|t|��q1W|S)N)�checkers�
setdefault�append�
checker_props�setattr�get)�func�suffixZprop)�kwds�suffixes��6/opt/alt/python35/lib64/python3.5/Doc/tools/rstlint.py�deco:s


$zchecker.<locals>.decor()r'r&r*r()r&r'r)�checker8sr+z.py�ccs�dj|�}d|krAtjdkr/d	V|jdd�}yt||d�Wn7tk
r�}z|jd|fVWYdd}~XnXdS)
z'Check Python examples for valid syntax.��
�ntr�\r in code file�execznot compilable: %sN)rr0)r�os�namer�compile�SyntaxError�lineno)�fn�lines�code�errr(r(r)�check_syntaxCsr;z.rst�ccs�d}x�t|�D]�\}}tj|�r=|ddfVd|krRd}q|rztj|�rz|ddfVq|r|j�rd}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)r7r8Zinprod�lno�liner(r(r)�check_suspicious_constructsQs	rDccs�x�t|�D]z\}}d|kr4|ddfVd|krO|ddfV|dd	�jd�|dd
�kr
|ddfVq
WdS)z,Check for whitespace and line length issues.r.rz
\r in line�	zOMG TABS!!!1Nz 	ztrailing whitespace���rF)r=�rstrip)r7r8rBrCr(r(r)�check_whitespace`s)rHccszxst|�D]e\}}t|�dkr
|j�ddkr
d|kr
|j�jd�r
|dd	fVq
Wd
S)z:Check for line length; this checker is not run by default.�Qrz+|zhttp://�.. function�	.. method�.. cfunctionrz
line too longN)rJrKrL)r=�len�lstrip�
startswith)r7r8rBrCr(r(r)�check_line_lengthls
rPz.htmlTccsCx<t|�D].\}}tj|�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?)r7r8rBrCr(r(r)�check_leaked_markupzsrRc Cs�d|d}y&tj|dd�d�\}}Wn#tjk
rYt|�dSYnXd}d}g}d}xx|D]p\}}	|dkr�d}qy|d	kr�d}qy|d
kr�t|	�}qy|dkry|jt|	��qyWt|�dkrd}
n-t|�dkr'|d}
nt|�dSt|
�sStd
|
�dStt�}x�t	j
|
�D]�\}}
}t|�|kr�|
dd�=qox�|D]�}t||�}|dd�dkr�|dd�}t|�|kr�q�t|�d}t
j|d�}|s"q�|r6td|�y/t|ddd��}t|�}WdQRXWnPttfk
r�}z*td||f�|dd7<w�WYdd}~XnXx~|D]v}|jr�|r�q�|j}||kr�xE|||�D]4\}}td||||f�||d7<q�Wq�Wq�WqoW|rNt�|s~|dkrqtd|�q�td�nJxGt|�D]9}||}td||dkr�dp�d|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:r<Fz-vTz-fz-sz-i�.zError: path %s does not existz./zChecking %s...�r�encodingzutf-8z%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�intr rrMrrr2�walkrrrr#�open�list�IOError�OSErrorrr�sorted�bool)�argvZusageZgopts�args�verboser�ignoreZfalseposZopt�val�path�count�root�dirs�filesr7ZextZcheckerlist�fr8r:r+ZcsevrB�msgZnumberr(r(r)�main�s�&
				




	

'rm�__main__)Z
__future__rr2�re�sysrWZos.pathrrrr�collectionsrZ
directivesZall_directivesr4r>r@rQrr!r+r;rDrHrPrRrm�__name__�exitrar(r(r(r)�<module>sP"$
a