
    6bi                        S r SSKrSSKrSSKrSSKJr  SSKJr  SSKJ	r	  \R                  " 5       r\R                  \l        \	" S5      S 5       r\	" S5      S	 5       r\	" S
5      S 5       r\R"                  SS j5       rS rS rg)zUtilities related to disk I/O.    N)logging)keras_logging)keras_exportz&keras.utils.enable_interactive_loggingc                      S[         l        g)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/home/james-whalen/.local/lib/python3.13/site-packages/tf_keras/src/utils/io_utils.pyenable_interactive_loggingr   !   s     "&r   z'keras.utils.disable_interactive_loggingc                      S[         l        g)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                  @    [        [        S[        R                  5      $ )a!  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                    [        5       (       ah  U(       a#  [        R                  R                  U S-   5        O[        R                  R                  U 5        [        R                  R	                  5         g[
        R                  " U 5        g)z,Print the message to absl logging or stdout.
N)r   sysstdoutwriteflushr   info)message
line_breaks     r   	print_msgr   I   sT     &''JJWt^,JJW%

Wr   c                 p    [        U [        R                  5      (       a  [        R                  " U 5      $ U $ )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                     [        SU  S35      R                  5       R                  5       nUS;  a/  [        S5      R                  5       R                  5       nUS;  a  M/  US:X  a  g[        S5        g)	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     % 	 
   , :oo' *FF   67& 8& 78' 9' :; <" 		 	*r   