
    0h                        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j                         Zej                  e_         e	d      d        Z e	d      d	        Z e	d
      d        Zej"                  dd       Zd Zd Zy)zUtilities related to disk I/O.    N)logging)keras_logging)keras_exportz&keras.utils.enable_interactive_loggingc                      dt         _        y)zTurn on interactive logging.

    When interactive logging is enabled, TF-Keras displays logs via stdout.
    This provides the best experience when using TF-Keras in an interactive
    environment such as a shell or a notebook.
    TNINTERACTIVE_LOGGINGenable     U/var/www/html/engine/venv/lib/python3.12/site-packages/tf_keras/src/utils/io_utils.pyenable_interactive_loggingr   !   s     "&r   z'keras.utils.disable_interactive_loggingc                      dt         _        y)zTurn off interactive logging.

    When interactive logging is disabled, TF-Keras sends logs to `absl.logging`.
    This is the best option when using TF-Keras in a non-interactive
    way, such as running a training or inference job on a server.
    FNr   r
   r   r   disable_interactive_loggingr   ,   s     "'r   z*keras.utils.is_interactive_logging_enabledc                  @    t        t        dt        j                        S )a9  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_interactive_logging()`.

    Returns:
      Boolean (True if interactive logging is enabled and False otherwise).
    r	   )getattrr   r   INTERACTIVE_LOGGING_DEFAULTr
   r   r   is_interactive_logging_enabledr   7   s     X}'P'P r   c                    t               rc|r#t        j                  j                  | dz          nt        j                  j                  |        t        j                  j	                          yt        j                  |        y)z,Print the message to absl logging or stdout.
N)r   sysstdoutwriteflushr   info)message
line_breaks     r   	print_msgr   I   sQ     &'JJWt^,JJW%

Wr   c                 d    t        | t        j                        rt        j                  |       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)paths    r   path_to_stringr$   V   s%      $$yyKr   c                     t        d|  d      j                         j                         }|dvr,t        d      j                         j                         }|dvr,|dk(  ryt        d       y)	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	overwrites     r   ask_to_proceed_with_overwriter-   k   sv     	
8*$FGH		 
 :
%:;AACIIK 	 :
% C78r   )T)__doc__r    r   	threadingabslr   tf_keras.src.utilsr    tensorflow.python.util.tf_exportr   localr   r   r	   r   r   r   skip_log_prefixr   r$   r-   r
   r   r   <module>r5      s     % 	 
   , :%ioo' *FF   67& 8& 78' 9' :; <" 		 	*r   