
    E^e                     F   d Z ddlZddlZddlZddlZddlZddlmZmZ  ej	        e
          Zej                            d          ZddddZej                            d	          ej                            d
           ej        g           edZd Zd Zd ZddZdS )zGlobal configuration handling.    N)ConfigDoesNotExistExceptionInvalidConfigurationz~/.cookiecutterrczhttps://github.com/{0}.gitzhttps://gitlab.com/{0}.gitzhttps://bitbucket.org/{0})ghglbbz~/.cookiecutters/z~/.cookiecutter_replay/)cookiecutters_dir
replay_dirdefault_contextabbreviationsc                     t           j                            |           } t           j                            |           } | S )zBExpand both environment variables and user home in the given path.)ospath
expandvars
expanduser)r   s    3lib/python3.11/site-packages/cookiecutter/config.py_expand_pathr      s1    7d##D7d##DK    c                     t          j        |           }|                                D ]G\  }}t          |t                    r(t          |                     |i           |          ||<   B|||<   H|S )zRecursively update a dict with the key/value pair of another.

    Dict values that are dictionaries themselves will be updated, whilst
    preserving existing keys.
    )copydeepcopyitems
isinstancedictmerge_configsget)default	overwrite
new_configkvs        r   r   r   $   sx     w''J!!  1 a 	)'++a*<*<a@@JqMMJqMMr   c                    t           j                            |           st          d|  d          t                              d|            t          | d          5 }	 t          j        |          }n+# t          j	        $ r}t          d|  d          |d}~ww xY w	 ddd           n# 1 swxY w Y   t          t          |          }|d	         }t          |          |d	<   |d
         }t          |          |d
<   |S )zERetrieve the config from the specified path, returning a config dict.zConfig file z does not exist.zconfig_path is %szutf-8)encodingzUnable to parse YAML file .Nr	   r   )r   r   existsr   loggerdebugopenyaml	safe_load	YAMLErrorr   r   DEFAULT_CONFIGr   )config_pathfile_handle	yaml_dicteconfig_dictraw_replay_dirraw_cookies_dirs          r   
get_configr3   7   s]   7>>+&& X)*V*V*V*VWWW
LL$k222	kG	,	,	, 	{33II~ 	 	 	&;[;;; 	                 	::K .N ,^ < <K!"56O'3O'D'DK#$s6   B.!A65B.6BBBB..B25B2Fc                    |r*t          |t                    rt          t          |          S |r3t                              d           t          j        t                    S | r3| t          ur*t                              d|            t          |           S 	 t          j
        d         }t                              d           t          |          S # t          $ r t          j                            t                    r6t                              dt                     t          t                    cY S t                              d           t          j        t                    cY S w xY w)a  Return the user config as a dict.

    If ``default_config`` is True, ignore ``config_file`` and return default
    values for the config parameters.

    If ``default_config`` is a dict, merge values with default values and return them
    for the config parameters.

    If a path to a ``config_file`` is given, that is different from the default
    location, load the user config from that.

    Otherwise look up the config file path in the ``COOKIECUTTER_CONFIG``
    environment variable. If set, load the config from this path. This will
    raise an error if the specified path is not valid.

    If the environment variable is not set, try the default config file path
    before falling back to the default config values.
    z6Force ignoring user config with default_config switch.zLoading custom config from %s.COOKIECUTTER_CONFIGz?User config not found or not specified. Loading default config.zLoading config from %s.z.User config not found. Loading default config.)r   r   r   r+   r%   r&   r   USER_CONFIG_PATHr3   r   environKeyErrorr   r$   )config_filedefault_configenv_config_files      r   get_user_configr<   P   sQ   (  =*^T:: =^^<<<  )MNNNy(((  '{*:::5{CCC+&&&+*%:; 	VWWW/***  - - - 7>>*++ 	-LL24DEEE./////LLIJJJ9^,,,,,-s   C A"E-73E-,E-)NF)__doc__collectionsr   loggingr   r(   cookiecutter.exceptionsr   r   	getLogger__name__r%   r   r   r6   BUILTIN_ABBREVIATIONSOrderedDictr+   r   r   r3   r<    r   r   <module>rF      s(   $ $       				  U U U U U U U U		8	$	$7%%&9::  '
&
%   ++,?@@'$$%>??.{.r22*	     &  21+ 1+ 1+ 1+ 1+ 1+r   