a
    t‡d`›
  ã                   @   s0   d Z ddlZddlZG dd„ deƒZdd„ ZdS )z
Provide the Reporter class.
é    Nc                   @   s0   e Zd ZdZdd„ Zdd„ Zdd„ Zdd	„ Zd
S )ÚReporterz:
    Formats the results of pyflakes checks to users.
    c                 C   s   || _ || _dS )a©  
        Construct a L{Reporter}.

        @param warningStream: A file-like object where warnings will be
            written to.  The stream's C{write} method must accept unicode.
            C{sys.stdout} is a good value.
        @param errorStream: A file-like object where error output will be
            written to.  The stream's C{write} method must accept unicode.
            C{sys.stderr} is a good value.
        N)Ú_stdoutÚ_stderr)ÚselfZwarningStreamZerrorStream© r   ú0lib/python3.9/site-packages/pyflakes/reporter.pyÚ__init__   s    zReporter.__init__c                 C   s   | j  d||f ¡ dS )a  
        An unexpected error occurred trying to process C{filename}.

        @param filename: The path to a file that we could not process.
        @ptype filename: C{unicode}
        @param msg: A message explaining the problem.
        @ptype msg: C{unicode}
        z%s: %s
N)r   Úwrite)r   ÚfilenameÚmsgr   r   r   ÚunexpectedError   s    	zReporter.unexpectedErrorc              
   C   s°   |  ¡ d }|durPtjdk r6|t|ƒt|ƒ  d }| j d||||f ¡ n| j d|||f ¡ | j |¡ | j d¡ |dur¬| j t dd	|d|d … ¡d
 ¡ dS )a0  
        There was a syntax error in C{filename}.

        @param filename: The path to the file with the syntax error.
        @ptype filename: C{unicode}
        @param msg: An explanation of the syntax error.
        @ptype msg: C{unicode}
        @param lineno: The line number where the syntax error occurred.
        @ptype lineno: C{int}
        @param offset: The column on which the syntax error occurred, or None.
        @ptype offset: C{int}
        @param text: The source code containing the syntax error.
        @ptype text: C{unicode}
        éÿÿÿÿN)é   é   é   z%s:%d:%d: %s
z
%s:%d: %s
Ú
z\Sú z^
)Ú
splitlinesÚsysÚversion_infoÚlenr   r	   ÚreÚsub)r   r
   r   ÚlinenoÚoffsetÚtextÚliner   r   r   ÚsyntaxError'   s    

ÿÿzReporter.syntaxErrorc                 C   s    | j  t|ƒ¡ | j  d¡ dS )zp
        pyflakes found something wrong with the code.

        @param: A L{pyflakes.messages.Message}.
        r   N)r   r	   Ústr)r   Úmessager   r   r   ÚflakeD   s    zReporter.flakeN)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r   r   r    r   r   r   r   r   	   s
   r   c                   C   s   t tjtjƒS )zI
    Make a reporter that can be used when no reporter is specified.
    )r   r   ÚstdoutÚstderrr   r   r   r   Ú_makeDefaultReporterN   s    r'   )r$   r   r   Úobjectr   r'   r   r   r   r   Ú<module>   s   E