
    E^e                     F    d Z ddlZddlZddlmZ d Zdddedefd	Zd
 Z	dS )z+
cookiecutter.replay.

-------------------
    N)make_sure_path_existsc                     |                     d          sdnd}| | }t          j                            | |          S )zGet the name of file.z.json )endswithospathjoin)
replay_dirtemplate_namesuffix	file_names       3lib/python3.11/site-packages/cookiecutter/replay.pyget_file_namer      sD    )227;;CWWF *&**I7<<
I...    r
   zos.PathLike[str]r   contextc                 ~   t          |            t          |t                    st          d          t          |t                    st          d          d|vrt          d          t          | |          }t          |dd          5 }t          j	        ||d	           d
d
d
           d
S # 1 swxY w Y   d
S )zWrite json data to file.+Template name is required to be of type strz&Context is required to be of type dictcookiecutter1Context is required to contain a cookiecutter keywutf-8encoding   )indentN)
r   
isinstancestr	TypeErrordict
ValueErrorr   openjsondump)r
   r   r   replay_fileoutfiles        r   r#   r#      s
   *%%%mS)) GEFFFgt$$ B@AAAW$$LMMM
M::K	k3	1	1	1 .W	'71----. . . . . . . . . . . . . . . . . .s   B22B69B6c                    t          |t                    st          d          t          | |          }t	          |d          5 }t          j        |          }ddd           n# 1 swxY w Y   d|vrt          d          |S )zRead json data from file.r   r   r   Nr   r   )r   r   r   r   r!   r"   loadr    )r
   r   r$   infiler   s        r   r'   r'   &   s    mS)) GEFFF
M::K	kG	,	,	, $)F##$ $ $ $ $ $ $ $ $ $ $ $ $ $ $ W$$LMMMNs   A''A+.A+)
__doc__r"   r   cookiecutter.utilsr   r   r   r   r#   r'    r   r   <module>r,      s    
  				 4 4 4 4 4 4/ / /.' . .d . . . .&    r   