
    h	                    p    S r SSKJr  SSKrSSKrSSKrSSKJr  SSKJ	r	  SSK
Jr  S
S jr " S S	\	5      rg)z6Manager to read and modify config data in JSON files.
    )annotationsN)Any)LoggingConfigurable)Unicodec                    UR                  5        H[  u  p#[        U[        5      (       a&  X ;  a  0 X'   [        X   U5        X   (       d  X	 M>  M@  Uc  U R	                  US5        MW  X0U'   M]     g)zVRecursively update one dictionary using another.

None values will delete their keys.
N)items
isinstancedictrecursive_updatepop)targetnewkvs       kC:\Users\julio\OneDrive\Documentos\Trabajo\Ideas Frescas\venv\Lib\site-packages\traitlets/config/manager.pyr   r      sh    
 		a	VY*9I  YJJq$ 1I     c                  Z    \ rS rSrSr\" S5      rSS jrSS jrSS jr	SS jr
SS jrS	rg
)BaseJSONConfigManager%   zQGeneral JSON config manager

Deals with persisting/storing config in a json file
.c                     [         R                  " U R                  S5        g ! [         a)  nUR                  [        R
                  :w  a  e  S nAg S nAff = f)Ni  )osmakedirs
config_dirOSErrorerrnoEEXIST)selfes     r   ensure_config_dir_exists.BaseJSONConfigManager.ensure_config_dir_exists-   sA    	KK/ 	ww%,,& '	s   !$ 
AAAc                \    [         R                  R                  U R                  US-   5      $ )Nz.json)r   pathjoinr   )r   section_names     r   	file_nameBaseJSONConfigManager.file_name4   s     ww||DOO\G-CDDr   c                    U R                  U5      n[        R                  R                  U5      (       a*  [	        USS9 n[
        R                  " U5      sSSS5        $ 0 $ ! , (       d  f       g= f)zRetrieve the config data for the specified section.

Returns the data as a dictionary, or an empty dictionary if the file
doesn't exist.
utf-8encodingN)r&   r   r#   isfileopenjsonload)r   r%   filenamefs       r   getBaseJSONConfigManager.get7   sT     >>,/77>>(##h1Qyy| 21 I 21s    A""
A0c                    U R                  U5      nU R                  5         [        USSS9 n[        R                  " X$SS9  SSS5        g! , (       d  f       g= f)zStore the given config data.wr)   r*      )indentN)r&   r    r-   r.   dump)r   r%   datar0   r1   s        r   setBaseJSONConfigManager.setD   sD    >>,/%%'(C'2aIIda( 322s   A
Ac                `    U R                  U5      n[        X25        U R                  X5        U$ )zwModify the config section by recursively updating it with new_data.

Returns the modified config data as a dictionary.
)r2   r   r:   )r   r%   new_datar9   s       r   updateBaseJSONConfigManager.updateL   s+    
 xx%($r    N)returnNone)r%   strrA   rC   )r%   rC   rA   r   )r%   rC   r9   r   rA   rB   )r%   rC   r=   r   rA   r   )__name__
__module____qualname____firstlineno____doc__r   r   r    r&   r2   r:   r>   __static_attributes__r@   r   r   r   r   %   s,    
 JE)r   r   )r   dict[Any, Any]r   rJ   rA   rB   )rH   
__future__r   r   r.   r   typingr   traitlets.configr   traitlets.traitletsr   r   r   r@   r   r   <module>rO      s3    #   	  0 '*// /r   