
    f                         d 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 G d de             Zy)	z9Implementation of configuration-related magic functions.
    N)
UsageError)Magicsmagics_class
line_magic)errorz
^\w+\.\w+$c                   .     e Zd Z fdZed        Z xZS )ConfigMagicsc                 :    t         t        |   |       g | _        y N)superr	   __init__configurables)selfshell	__class__s     U/var/www/cvtools/html/venv/lib/python3.12/site-packages/IPython/core/magics/config.pyr   zConfigMagics.__init__   s    lD*51    c           
      b   ddl m} t        t        | j                  j
                  D cg c]   }|j                  j                  d      r|" c}      d       }|D cg c]  }|j                  j                   }}|j                         }|st        d       |D ]  }t        d|        y	||v rv||j                  |         }|j                  }|j                  |      }	t        j                  t        j                  d
t        j                         d|	      }	t        |	       y	t"        j%                  |      r2|j'                  d      \  }}
t)        ||j                  |         |
      S d|vrDd}|j+                         }|D ]  }||j+                         k(  s|d|z  z   } n t-        ||z         |       }t/        d|z   | j                  j0                  t3                      |D ]  }	 |j5                  |        y	c c}w c c}w # t6        $ r}t9        |       Y d	}~;d	}~ww xY w)a  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:
                AliasManager
                DisplayFormatter
                HistoryManager
                IPCompleter
                LoggingMagics
                MagicsManager
                OSMagics
                PrefilterManager
                ScriptMagics
                TerminalInteractiveShell

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

            In [2]: %config LoggingMagics
            LoggingMagics(Magics) options
            ---------------------------
            LoggingMagics.quiet=<Bool>
                Suppress output of log state when logging is enabled
                Current: False

        but the real use is in setting values::

            In [3]: %config LoggingMagics.quiet = True

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

            In [4]: feeling_quiet=False

            In [5]: %config LoggingMagics.quiet = feeling_quiet

        r   )ConfigT)configc                 .    | j                   j                  S r   )r   __name__)xs    r   <lambda>z%ConfigMagics.config.<locals>.<lambda>_   s    q{{7K7K r   )keyzAvailable objects for config:z   Nz^-- .=z>Invalid config statement: %r, should be `Class.trait = value`.z!
Did you mean %s (note the case)?zcfg.)traitlets.config.loaderr   sortedsetr   r   r   class_traitsr   stripprintindexclass_get_helpresubcompile	MULTILINEregmatchsplitgetattrlowerr   execuser_nslocalsupdate_config	Exceptionr   )r   sr   cr   
classnameslinenameclshelpattrmsgll	classnamecfgconfigurablees                    r   r   zConfigMagics.config#   s   l 	3 s

0H0H $'1()(@(@(@(M &' $'  (-KM 6CDq{{++D
Dwwy12" #eT"#Z j..t45A++C%%a(D66"**VR\\:BED$KYYt_

3IC=)9)9#)>?EE_5C B' 	** Dy PPC
 cDj))
 hVD[$**,,fh7) 	L**3/	W$' EV  as#   %H H2H	H.H))H.)r   
__module____qualname__r   r   r   __classcell__)r   s   @r   r	   r	      s      h hr   r	   )__doc__r'   IPython.core.errorr   IPython.core.magicr   r   r   loggingr   r)   r+   r	    r   r   <module>rK      sK    
 * ? ?  bjjo6 o or   