B
    Ó»ˆd¬  ã               @   s    d Z ddlZdd„ Zdd„ ZdS )zUtilities related to disk I/O.é    Nc             C   s   t | tjƒrt | ¡S | S )aÊ  Convert `PathLike` objects to their string representation.

  If given a non-string typed path object, converts it to its string
  representation.

  If the object passed to `path` is not among the above, then it is
  returned unchanged. This allows e.g. passthrough of file objects
  through this function.

  Args:
    path: `PathLike` object that represents a path

  Returns:
    A string representation of the path argument, if Python support exists.
  )Ú
isinstanceÚosÚPathLikeÚfspath)Úpath© r   úX/var/www/html/venv/lib/python3.7/site-packages/tensorflow/python/keras/utils/io_utils.pyÚpath_to_string   s    
r	   c             C   sJ   t d|  ƒ ¡  ¡ }x|dkr0t dƒ ¡  ¡ }qW |dkr>dS tdƒ dS )zÀProduces a prompt asking about overwriting a file.

  Args:
      filepath: the path to the file to be overwritten.

  Returns:
      True if we can proceed with overwrite, False otherwise.
  z.[WARNING] %s already exists - overwrite? [y/n])ÚyÚnz&Enter "y" (overwrite) or "n" (cancel).r   Fz'[TIP] Next time specify overwrite=True!T)ÚinputÚstripÚlowerÚprint)ÚfilepathÚ	overwriter   r   r   Úask_to_proceed_with_overwrite*   s    	
r   )Ú__doc__r   r	   r   r   r   r   r   Ú<module>   s   