o
    Ne                     @   s   d Z ddlZddlZddlZddlmZ ddlmZ ddlm	Z	 e
 Zeje_e	ddd Ze	d	d
d Ze	ddd ZdddZdd Zdd ZdS )zUtilities related to disk I/O.    N)logging)keras_logging)keras_exportz&keras.utils.enable_interactive_loggingc                   C   
   dt _dS )zTurn on interactive logging.

    When interactive logging is enabled, Keras displays logs via stdout.
    This provides the best experience when using Keras in an interactive
    environment such as a shell or a notebook.
    TNINTERACTIVE_LOGGINGenable r	   r	   DD:\Projects\ConvertPro\env\Lib\site-packages\keras/utils/io_utils.pyenable_interactive_logging!      
r   z'keras.utils.disable_interactive_loggingc                   C   r   )zTurn off interactive logging.

    When interactive logging is disabled, Keras sends logs to `absl.logging`.
    This is the best option when using Keras in a non-interactive
    way, such as running a training or inference job on a server.
    FNr   r	   r	   r	   r
   disable_interactive_logging,   r   r   z*keras.utils.is_interactive_logging_enabledc                   C   s   t tdtjS )a8  Check if interactive logging is enabled.

    To switch between writing logs to stdout and `absl.logging`, you may use
    `keras.utils.enable_interactive_logging()` and
    `keras.utils.disable_interactie_logging()`.

    Returns:
      Boolean (True if interactive logging is enabled and False otherwise).
    r   )getattrr   r   INTERACTIVE_LOGGING_DEFAULTr	   r	   r	   r
   is_interactive_logging_enabled7   s   r   Tc                 C   sD   t  r|rtj| d  ntj|  tj  dS t|  dS )z,Print the message to absl logging or stdout.
N)r   sysstdoutwriteflushr   info)messageZ
line_breakr	   r	   r
   	print_msgI   s   r   c                 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)pathr	   r	   r
   path_to_stringU   s   
r   c                 C   sP   t d|  d  }|dvrt d  }|dvs|dkr"dS td dS )	zProduces 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] z" already exists - overwrite? [y/n])ynz&Enter "y" (overwrite) or "n" (cancel).r    Fz'[TIP] Next time specify overwrite=True!T)inputstriplowerr   )filepath	overwriter	   r	   r
   ask_to_proceed_with_overwritej   s   
r&   )T)__doc__r   r   	threadingZabslr   Zkeras.utilsr   Z tensorflow.python.util.tf_exportr   localr   r   r   r   r   r   r   r   r&   r	   r	   r	   r
   <module>   s$   





