ó
±xYc           @  s¬   d  Z  d d l m Z d d l m Z d d l m Z d Z y$ d d l m Z	 d d l
 m Z Wn e k
 r d Z	 d Z n Xe d e d	 „ Z d
 e f d „  ƒ  YZ d S(   uÇ   
Adaptor for building prompt_toolkit styles, starting from a Pygments style.

Usage::

    from pygments.styles.tango import TangoStyle
    style = style_from_pygments(pygments_style_cls=TangoStyle)
iÿÿÿÿ(   t   unicode_literalsi   (   t   Style(   t   style_from_dictu   PygmentsStyleu   style_from_pygments(   t   DefaultStylec         C  s“   | d k s! t | t ƒ s! t ‚ |  d k sB t |  t ƒ sB t ‚ i  } |  d k	 rg | j |  j ƒ n  | d k	 rƒ | j | ƒ n  t | d | ƒS(   u  
    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
        from pygments.styles import get_style_by_name
        style = style_from_pygments(get_style_by_name('monokai'))

    :param style_cls: Pygments style class to start from.
    :param style_dict: Dictionary for this style. `{Token: style}`.
    :param include_defaults: (`bool`) Include prompt_toolkit extensions.
    t   include_defaultsN(	   t   Nonet
   isinstancet   dictt   AssertionErrort
   issubclasst   pygments_Stylet   updatet   stylesR   (   t	   style_clst
   style_dictR   t   styles_dict(    (    sB   lib/python2.7/site-packages/prompt_toolkit/styles/from_pygments.pyt   style_from_pygments   s    !!t   PygmentsStylec           B  s8   e  Z d  Z d „  Z d „  Z e d e e d „ ƒ Z	 RS(   u    Deprecated. c         C  s"   t  | t ƒ s t ‚ t | j ƒ S(   N(   R	   R
   R   R   R   (   t   clst   pygments_style_cls(    (    sB   lib/python2.7/site-packages/prompt_toolkit/styles/from_pygments.pyt   __new__>   s    c         C  s   d  S(   N(    (   t   self(    (    sB   lib/python2.7/site-packages/prompt_toolkit/styles/from_pygments.pyt   invalidation_hashB   s    c         C  s   t  d | d | d | ƒ S(   u    Deprecated. R   R   R   (   R   (   R   R   R   t   include_extensions(    (    sB   lib/python2.7/site-packages/prompt_toolkit/styles/from_pygments.pyt   from_defaultsE   s    N(
   t   __name__t
   __module__t   __doc__R   R   t   classmethodR   t   pygments_DefaultStylet   TrueR   (    (    (    sB   lib/python2.7/site-packages/prompt_toolkit/styles/from_pygments.pyR   <   s   		N(   u   PygmentsStyleu   style_from_pygments(   R   t
   __future__R    t   baseR   t	   from_dictR   t   __all__t   pygments.styleR
   t   pygments.styles.defaultR   R   t   ImportErrorR   R   R   R   (    (    (    sB   lib/python2.7/site-packages/prompt_toolkit/styles/from_pygments.pyt   <module>   s    
