3
tûœ]X  ã               @   sN   d dl Z d dlmZ d dlmZ d dlmZmZ G dd„ dejƒZ	dd„ Z
dS )	é    N)Úcheckers)Úcheck_messages)ÚHIGHÚIAstroidCheckerc               @   sP   e Zd ZdZeZdZddd	œZeddƒd
d„ ƒZ	dd„ Z
dd„ ZeZdd„ ZdS )ÚDocStringStyleCheckerz-Checks format of docstrings based on PEP 0257Zdocstyleú2Bad docstring quotes in %s, expected """, given %súbad-docstring-quotesú9Used when a docstring does not have triple double quotes.ú First line empty in %s docstringúdocstring-first-line-emptyú@Used when a blank line is found at the beginning of a docstring.)ZC0198ZC0199c             C   s   | j d|ƒ d S )NÚmodule)Ú_check_docstring)ÚselfÚnode© r   ú</tmp/pip-build-fn42xldr/pylint/pylint/extensions/docstyle.pyÚvisit_module#   s    z"DocStringStyleChecker.visit_modulec             C   s   | j d|ƒ d S )NÚclass)r   )r   r   r   r   r   Úvisit_classdef'   s    z$DocStringStyleChecker.visit_classdefc             C   s    |j ƒ rdnd}| j||ƒ d S )NÚmethodÚfunction)Z	is_methodr   )r   r   Zftyper   r   r   Úvisit_functiondef*   s    z'DocStringStyleChecker.visit_functiondefc             C   sÄ   |j }|r*|d dkr*| jd||ftd� |rÀ|jd }tj|jƒ j|ƒjƒ }|rd|j	dƒdkrdd S |rvd|krvd}n0|rŒ|d dkrŒd}n|r¢|d d	kr¢d	}nd
}|rÀ| jd|||ftd� d S )Nr   Ú
zdocstring-first-line-empty)r   ÚargsÚ
confidenceé   z"""z'''ú"ú'Fzbad-docstring-quotes)
ÚdocZadd_messager   Z
fromlinenoÚ	linecacheÚgetlineÚrootÚfileÚlstripÚfind)r   Z	node_typer   Z	docstringÚlinenoÚlineÚquotesr   r   r   r   0   s2    
z&DocStringStyleChecker._check_docstringN)r   r   r	   )r
   r   r   )Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   Z__implements__ÚnameZmsgsr   r   r   r   Zvisit_asyncfunctiondefr   r   r   r   r   r      s       r   c             C   s   | j t| ƒƒ dS )z�Required method to auto register this checker.

    :param linter: Main interface object for Pylint plugins
    :type linter: Pylint object
    N)Zregister_checkerr   )Zlinterr   r   r   ÚregisterS   s    r.   )r    Zpylintr   Zpylint.checkers.utilsr   Zpylint.interfacesr   r   ZBaseCheckerr   r.   r   r   r   r   Ú<module>	   s
   C