3
.ßL]…  ã            5   @   s  d Z ddlZddlmZ ddlmZmZmZmZm	Z	m
Z
mZmZmZmZ ddlmZ ddlmZ dgZeded ed!ejd"ed#ejd$ejd%ejd&ejd'ejd(ejd)ejd*ejd+ejd,ejd-ejd.ej d/ed0e
d1ej!d2ej"d3ej#d4ej$d5ej%d6ej	d7e	d8iZ&G dd„ deƒZ'dS )9zï
    pygments.formatters.terminal
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    Formatter for terminal output with ANSI sequences.

    :copyright: Copyright 2006-2019 by the Pygments team, see AUTHORS.
    :license: BSD, see LICENSE for details.
é    N)Ú	Formatter)
ÚKeywordÚNameÚCommentÚStringÚErrorÚNumberÚOperatorÚGenericÚTokenÚ
Whitespace)Ú
ansiformat)Úget_choice_optÚTerminalFormatterÚ ÚgrayÚbrightblackÚcyanÚ
brightcyanÚblueÚ
brightblueÚmagentaÚbrightmagentaÚgreenÚbrightgreenÚ_cyan_Ú_brightcyan_Ú_green_Ú_brightgreen_ÚredÚ	brightredÚyellowú**ú	*magenta*ú*brightmagenta*Ú_brightred_c               @   sH   e Zd ZdZdZddgZg Zdd„ Zdd„ Zd	d
„ Z	dd„ Z
dd„ ZdS )r   aÛ  
    Format tokens with ANSI color sequences, for output in a text console.
    Color sequences are terminated at newlines, so that paging the output
    works correctly.

    The `get_style_defs()` method doesn't do anything special since there is
    no support for common styles.

    Options accepted:

    `bg`
        Set to ``"light"`` or ``"dark"`` depending on the terminal's background
        (default: ``"light"``).

    `colorscheme`
        A dictionary mapping token types to (lightbg, darkbg) color names or
        ``None`` (default: ``None`` = use builtin colorscheme).

    `linenos`
        Set to ``True`` to have line numbers on the terminal output as well
        (default: ``False`` = no line numbers).
    ZTerminalZterminalÚconsolec             K   sP   t j| f|Ž t|dddgdƒdk| _|jdd ƒp4t| _|jddƒ| _d| _d S )NÚbgÚlightZdarkÚcolorschemeÚlinenosFr   )	r   Ú__init__r   ÚdarkbgÚgetÚTERMINAL_COLORSr)   r*   Ú_lineno)ÚselfÚoptions© r2   úB/tmp/pip-install-5sebvq2j/pygments/pygments/formatters/terminal.pyr+   V   s    zTerminalFormatter.__init__c             C   sD   | j  r6t|dƒr6t|dƒr6|jƒ r6tjdk r6|j | _ tj| ||ƒS )NÚencodingÚisattyé   )r6   )r4   Úhasattrr5   ÚsysÚversion_infor   Úformat)r0   ÚtokensourceÚoutfiler2   r2   r3   r:   ^   s
    
zTerminalFormatter.formatc             C   s4   |  j d7  _ |jd| j dkr"dp$d| j f ƒ d S )Né   z%s%04d: Ú
r   )r/   Úwrite)r0   r<   r2   r2   r3   Ú_write_linenog   s    zTerminalFormatter._write_linenoc             C   s6   | j j|ƒ}x|d kr*|j}| j j|ƒ}qW || j S )N)r)   r-   Úparentr,   )r0   ÚttypeÚcolorsr2   r2   r3   Ú
_get_colork   s
    
zTerminalFormatter._get_colorc             C   s¦   | j r| j|ƒ x€|D ]x\}}| j|ƒ}xd|jdƒD ]V}|rT|jt||jdƒƒƒ n|j|jdƒƒ |jdƒr4| j r€| j|ƒ q4|jdƒ q4W qW | j r¢|jdƒ d S )NTr>   )r*   r@   rD   Ú
splitlinesr?   r   ÚrstripÚendswith)r0   r;   r<   rB   ÚvalueÚcolorÚliner2   r2   r3   Úformat_unencodedu   s    


z"TerminalFormatter.format_unencodedN)Ú__name__Ú
__module__Ú__qualname__Ú__doc__ÚnameÚaliasesÚ	filenamesr+   r:   r@   rD   rK   r2   r2   r2   r3   r   ;   s   	
)r   r   )r   r   )r   r   )r   r   )r   r   )r   r   )r   r   )r   r   )r   r   )r   r   )r   r   )r   r   )r   r   )r   r    )r   r    )r   r   )r   r   )r!   r!   )r   r   )r    r    )r   r   )r"   r"   )r#   r$   )r"   r"   )r    r    )r%   r%   )(rO   r8   Zpygments.formatterr   Zpygments.tokenr   r   r   r   r   r   r	   r
   r   r   Zpygments.consoler   Zpygments.utilr   Ú__all__ZPreprocÚTypeÚWordZBuiltinZFunctionÚ	NamespaceZClassÚ	ExceptionZ	DecoratorÚVariableÚConstantÚ	AttributeZTagZDeletedZInsertedZHeadingZ
SubheadingZPromptr.   r   r2   r2   r2   r3   Ú<module>
   sB   0