a
    Sic—  ã                   @   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   s
   dt _dS )zãTurn 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   úP/var/www/html/django/DPS/env/lib/python3.9/site-packages/keras/utils/io_utils.pyÚenable_interactive_logging!   s    r
   z'keras.utils.disable_interactive_loggingc                   C   s
   dt _dS )zõTurn 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,   s    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   sB   t ƒ r4|rtj | d ¡ ntj | ¡ tj ¡  n
t | ¡ dS )z,Print the message to absl logging or stdout.Ú
N)r   ÚsysÚstdoutÚwriteÚflushr   Úinfo)ÚmessageÚ
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   sF   t d|  ƒ ¡  ¡ }|dvr.t dƒ ¡  ¡ }q|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Úlowerr   )ÚfilepathÚ	overwriter   r   r	   Úask_to_proceed_with_overwritej   s    
ÿÿr%   )T)Ú__doc__r   r   Ú	threadingÚabslr   Úkeras.utilsr   Ú tensorflow.python.util.tf_exportr   Úlocalr   r   r   r
   r   r   r   r   r%   r   r   r   r	   Ú<module>   s"   





