B
    't\V                 @   sF   d Z ddlmZmZ ddlmZ dddgZdd Zd	d Zd
d Z	dS )z
Adaptor for building prompt_toolkit styles, starting from a Pygments style.

Usage::

    from pygments.styles.tango import TangoStyle
    style = style_from_pygments_cls(pygments_style_cls=TangoStyle)
    )unicode_literalsabsolute_import   )Stylestyle_from_pygments_clsstyle_from_pygments_dictpygments_token_to_classnamec             C   s$   ddl m} t| |stt| jS )a  
    Shortcut to create a :class:`.Style` instance from a Pygments style class
    and a style dictionary.

    Example::

        from prompt_toolkit.styles.from_pygments import style_from_pygments_cls
        from pygments.styles import get_style_by_name
        style = style_from_pygments_cls(get_style_by_name('monokai'))

    :param pygments_style_cls: Pygments style class to start from.
    r   )r   )Zpygments.styler   
issubclassAssertionErrorr   Zstyles)Zpygments_style_clsZpygments_Style r   =lib/python3.7/site-packages/prompt_toolkit/styles/pygments.pyr      s    c             C   sB   t | dstg }x&|  D ]\}}|t||f qW t|S )z
    Create a :class:`.Style` instance from a Pygments style dictionary.
    (One that maps Token objects to style strings.)
    items)hasattrr
   r   appendr   r   )Zpygments_dictZpygments_styletokenstyler   r   r   r   '   s
    c             C   s   d|  }d | S )z
    Turn e.g. `Token.Name.Exception` into `'pygments.name.exception'`.

    (Our Pygments lexer will also turn the tokens that pygments produces in a
    prompt_toolkit list of fragments that match these styling rules.)
    )Zpygments.)joinlower)r   partsr   r   r   r   5   s    N)
__doc__Z
__future__r   r   r   r   __all__r   r   r   r   r   r   r   <module>   s   