Ñò
ÎÑAHc        
   @   s²   d  Z  d d k l Z d e i d Z e i Z d d k Z d d k Z d d k	 l	 Z	 d d k l
 Z
 d d k l Z d d	 k Td
 e i f d „  ƒ  YZ d d d „  ƒ  YZ d S(   sM   Configuration loader

$Id: ConfigLoader.py 1005 2006-01-12 08:39:26Z fperez $iÿÿÿÿ(   t   Releases   %s <%s>t   FernandoN(   t   pprint(   t   ultraTB(   t   Struct(   t   *t   ConfigLoaderErrorc           B   s   e  Z d  Z d d „ Z RS(   s!   Exception for ConfigLoader class.c         C   s   | |  _  d  S(   N(   t   args(   t   selfR   (    (    sL   /u/d/b/dbachman/web/work/lib/python2.3/site-packages/IPython/ConfigLoader.pyt   __init__   s    N(   t   __name__t
   __module__t   __doc__t   NoneR	   (    (    (    sL   /u/d/b/dbachman/web/work/lib/python2.3/site-packages/IPython/ConfigLoader.pyR      s   t   ConfigLoaderc           B   s>   e  Z d  Z d d d d „ Z d d „ Z d d d d „ Z RS(   s‰   Configuration file loader capable of handling recursive inclusions and
    with parametrized conflict resolution for multiply found keys.i   c         C   s#   | |  _  | |  _ |  i | ƒ d S(   s3  The reclimit parameter controls the number of recursive
        configuration file inclusions. This way we can stop early on (before
        python's own recursion limit is hit) if there is a circular
        inclusion.

        - conflict: dictionary for conflict resolutions (see Struct.merge())

        N(   t   conflictt	   field_sept   reset(   R   R   R   t   reclimit(    (    sL   /u/d/b/dbachman/web/work/lib/python2.3/site-packages/IPython/ConfigLoader.pyR	   $   s    
		c         C   s   | |  _  d |  _ g  |  _ d  S(   Ni    (   R   t   recdeptht   included(   R   R   (    (    sL   /u/d/b/dbachman/web/work/lib/python2.3/site-packages/IPython/ConfigLoader.pyR   2   s    		t    t   .c         K   s  |  i  |  i j o t d d |  i  d ‚ n |  i  d 7_  t | | ƒ } t ƒ  } | |  i j o | St i ƒ  } | d j o | o h | t	 6} n | i
 t | | d |  i d d d d d	 d | ƒ |  i i | ƒ | | i ƒ  j ox| | D]} d }	 y t | | ƒ }
 Wnl t j
 o` t i d j oC y | d 7} t | | ƒ }
 Wn t j
 o d }	 qˆXd }	 q“d }	 n Xd }	 |	 oT y, | i
 |  i |
 | | | |  |  i ƒ Wq| ƒ  t d | d ƒ qXqÿ t d | | f ƒ qÿ Wn | S(   sU  Load a configuration file, return the resulting Struct.

        Call: load_config(fname,convert=None,conflict=None,recurse_key='')

         - fname: file to load from.
         - convert: dictionary of type conversions (see read_dict())
         - recurse_key: keyword in dictionary to trigger recursive file
         inclusions.
         s'   maximum recursive inclusion of rcfiles s
   exceeded: s0   .
Maybe you have a circular chain of inclusions?i   t   fst   stript   warni    t   no_emptyt   ntt   doss   .inis   Problem loading included file: s   . Ignoring it...s#   File `%s` not found. Included by %sN(   s   nts   dos(   R   R   R   t   filefindR   R   R   t   AutoFormattedTBR   t   qwflatt   merget	   read_dictR   t   appendt   keyst   IOErrort   ost   namet   loadR   R   (   R   t   fnamet   convertt   recurse_keyt   incpatht   kwt   datat   Xinfot   incfilenamet   foundt   incfile(    (    sL   /u/d/b/dbachman/web/work/lib/python2.3/site-packages/IPython/ConfigLoader.pyR'   7   sT    	 ! 

	N(   R
   R   R   R   R	   R   R'   (    (    (    sL   /u/d/b/dbachman/web/work/lib/python2.3/site-packages/IPython/ConfigLoader.pyR      s   (    (   R   t   IPythonR    t   authorst
   __author__t   licenset   __license__t
   exceptionsR%   R   R   t   IPython.ipstructR   t   IPython.genutilst	   ExceptionR   R   (    (    (    sL   /u/d/b/dbachman/web/work/lib/python2.3/site-packages/IPython/ConfigLoader.pyt   <module>   s   		
