ó
æNXc           @  s   d  Z  d d l m Z d d l Z d d l m Z d d l m Z m Z m	 Z	 d d l
 m Z e j d ƒ Z e d e f d	 „  ƒ  Yƒ Z d S(
   s9   Implementation of configuration-related magic functions.
iÿÿÿÿ(   t   print_functionN(   t
   UsageError(   t   Magicst   magics_classt
   line_magic(   t   errors
   ^\w+\.\w+$t   ConfigMagicsc           B  s    e  Z d  „  Z e d „  ƒ Z RS(   c         C  s#   t  t |  ƒ j | ƒ g  |  _ d  S(   N(   t   superR   t   __init__t   configurables(   t   selft   shell(    (    sR   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/core/magics/config.pyR       s    c         B  s  d d l  m } g  |  j j D]! } | j j d e ƒ r | ^ q } g  | D] } | j j ^ qK } | j ƒ  } | s¡ e	 d ƒ x | D] } e	 d | ƒ q† Wd S| | k r
| | j
 | ƒ } | j } | j | ƒ }	 e j e j d e j ƒ d |	 ƒ }	 e	 |	 ƒ d Se j | ƒ rH| j d	 ƒ \ } }
 e | | j
 | ƒ |
 ƒ Sd
 | k r®d } | j ƒ  } x2 | D]* } | | j ƒ  k rm| d | } PqmqmWe | | ƒ ‚ n  | ƒ  } d | e ƒ  |  j j f d Ux? | D]7 } y | j | ƒ WqÜe k
 r} e | ƒ qÜXqÜWd S(   se
  configure IPython

            %config Class[.trait=value]

        This magic exposes most of the IPython config system. Any
        Configurable class should be able to be configured with the simple
        line::

            %config Class.trait=value

        Where `value` will be resolved in the user's namespace, if it is an
        expression or variable name.

        Examples
        --------

        To see what classes are available for config, pass no arguments::

            In [1]: %config
            Available objects for config:
                TerminalInteractiveShell
                HistoryManager
                PrefilterManager
                AliasManager
                IPCompleter
                PromptManager
                DisplayFormatter

        To view what is configurable on a given class, just pass the class
        name::

            In [2]: %config IPCompleter
            IPCompleter options
            -----------------
            IPCompleter.omit__names=<Enum>
                Current: 2
                Choices: (0, 1, 2)
                Instruct the completer to omit private method names
                Specifically, when completing on ``object.<tab>``.
                When 2 [default]: all names that start with '_' will be excluded.
                When 1: all 'magic' names (``__foo__``) will be excluded.
                When 0: nothing will be excluded.
            IPCompleter.merge_completions=<CBool>
                Current: True
                Whether to merge completion results into a single list
                If False, only the completion results from the first non-empty
                completer will be returned.
            IPCompleter.limit_to__all__=<CBool>
                Current: False
                Instruct the completer to use __all__ for the completion
                Specifically, when completing on ``object.<tab>``.
                When True: only those names in obj.__all__ will be included.
                When False [default]: the __all__ attribute is ignored
            IPCompleter.greedy=<CBool>
                Current: False
                Activate greedy completion
                This will enable completion on elements of lists, results of
                function calls, etc., but can be unsafe because the code is
                actually evaluated on TAB.

        but the real use is in setting values::

            In [3]: %config IPCompleter.greedy = True

        and these values are read from the user_ns if they are variables::

            In [4]: feeling_greedy=False

            In [5]: %config IPCompleter.greedy = feeling_greedy

        iÿÿÿÿ(   t   Configt   configs   Available objects for config:s       Ns   ^--t    t   .t   =s>   Invalid config statement: %r, should be `Class.trait = value`.s!   
Did you mean %s (note the case)?s   cfg.(   t   traitlets.config.loaderR   R   R	   t	   __class__t   class_traitst   Truet   __name__t   stript   printt   indext   class_get_helpt   ret   subt   compilet	   MULTILINEt   regt   matcht   splitt   getattrt   lowerR   t   localst   user_nst   update_configt	   ExceptionR   (   R
   t   sR   t   cR	   t
   classnamest   linet   namet   clst   helpt   attrt   msgt   llt	   classnamet   cfgt   configurablet   e(    (    sR   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/core/magics/config.pyR   $   sF    I!
	$
	(   R   t
   __module__R   R   R   (    (    (    sR   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/core/magics/config.pyR      s   	(   t   __doc__t
   __future__R    R   t   IPython.core.errorR   t   IPython.core.magicR   R   R   t   IPython.utils.warnR   R   R   R   (    (    (    sR   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/core/magics/config.pyt   <module>   s   