U
    M8ÚcN  ã                   @   s2   d dl Z d dlmZ d	dd„Zdd„ Zdd„ ZdS )
é    N)Úmerge_dictsc                 C   sV   |  | i ¡}t||ƒ dt |  di ¡¡i}t||ƒ t||ƒ |d k	rRt||ƒ |S )NÚ__default__)ÚgetÚresolve_referencesÚcopyÚdeepcopyr   Ú_merge_client_retry_config)Zendpoint_prefixZretry_modelÚdefinitionsÚclient_retry_configZservice_configZfinal_retry_config© r   ú6/tmp/pip-unpacked-wheel-ozje0y8b/botocore/translate.pyÚbuild_retry_config   s    
	 ÿ


r   c                 C   s&   |  d¡}|d k	r"|d | d d< d S )NZmax_attemptsé   r   )r   )Zretry_configr
   Zmax_retry_attempts_overrider   r   r   r   *   s    
ÿr   c                 C   sd   |   ¡ D ]V\}}t|tƒrt|ƒdkrTt| ¡ ƒd dkrT|t| ¡ ƒd  | |< qt||ƒ qdS )aJ  Recursively replace $ref keys.

    To cut down on duplication, common definitions can be declared
    (and passed in via the ``definitions`` attribute) and then
    references as {"$ref": "name"}, when this happens the reference
    dict is placed with the value from the ``definition`` dict.

    This is recursively done.

    r   r   z$refN)ÚitemsÚ
isinstanceÚdictÚlenÚlistÚkeysÚvaluesr   )Úconfigr	   ÚkeyÚvaluer   r   r   r   =   s
    
 r   )N)r   Zbotocore.utilsr   r   r   r   r   r   r   r   Ú<module>   s
    ÿ
