
    AVh)              
          d Z ddlZddlZddl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 ddlmZ ddlmZ ddlZddlmZ da ej*                         Zefd	ZdAdZej2                  j4                  d
k\  rej2                  j6                  dk\  rdBdZn:ej2                  j4                  d
k\  rej2                  j6                  dk\  rdCdZnd Z ed      d        Z edg      d        Z edg      d        Z edg      d        Z  edg      d        Z! edg      d        Z" edg      d         Z# ed!g      d"        Z$ed#ed$ed%ed&ed'ia%dejL                  z  dz   Z'dZ(i a) ed(g      d)        Z* ed*g      d+        Z+ ed,g      d-        Z,d. Z- ed/g      d0        Z. ed1g      d2        Z/ ed3g      d4        Z0d5 Z1dDd6Z2 ed7g      d8        Z3 ed9g      d:        Z4d; Z5e2Z( ed<g      jm                  e7d'        ed=g      jm                  e7d$        ed>g      jm                  e7d#        ed?g      jm                  e7d&        ed@g      jm                  e7d%       y)EzLogging utilities.    N)DEBUG)ERROR)FATAL)INFO)WARN)	tf_exportc                      ~ ~y)zEmpty helper method.N )	error_msglevels     U/home/dcms/DCMS/lib/python3.12/site-packages/tensorflow/python/platform/tf_logging.py	error_logr   (   s           c                     t        j                  |       }|j                  j                  }|j                  }|r.|j                  }|j                  |k7  r||fS |j                  }|r.y)zGReturns a code and frame object for the lowest non-logging stack frame.NN)_sys	_getframef_codeco_filenamef_back)offsetfour_filecodes       r   _get_callerr   -   s`     nnV!XX!!(hh!	88D8#1Wn	A	 	

 
r         c                     t        d      \  }}d }| r#dj                  t        j                               }|r$|j                  |j
                  |j                  |fS ddd|fS N   
(unknown file)r   (unknown function)r   join
_tracebackformat_stackr   f_linenoco_name)
stack_info
stacklevelr   framesinfos        r   _logger_find_callerr/   @   ^    a.KD%Eii
//12eeDDq"6==r      c                     t        d      \  }}d }| r#dj                  t        j                               }|r$|j                  |j
                  |j                  |fS ddd|fS r    r%   )r+   r   r-   r.   s       r   r/   r/   K   r0   r   c                  j    t        d      \  } }| r#| j                  |j                  | j                  fS y)Nr!   )r#   r   r$   )r   r   r)   r*   )r   r-   s     r   r/   r/   U   s0    a.KD%==6r   
get_loggerc                     t         rt         S t        j                          	 t         rt         t        j                          S t	        j
                  d      } t        | _        t	        j
                         j                  sd}	 t        j                  rd}|r&| j                  t               t        j                   }nt        j"                  }t	        j$                  |      }|j'                  t	        j(                  t        j*                  d             | j-                  |       | a t         t        j                          S # t        $ r t        j                  j                  }Y w xY w# t        j                          w xY w)a  Return TF logger instance.

  Returns:
    An instance of the Python logging library Logger.

  See Python documentation (https://docs.python.org/3/library/logging.html)
  for detailed API. Below is only a summary.

  The logger has 5 levels of logging from the most serious to the least:

  1. FATAL
  2. ERROR
  3. WARN
  4. INFO
  5. DEBUG

  The logger has the following methods, based on these logging levels:

  1. fatal(msg, *args, **kwargs)
  2. error(msg, *args, **kwargs)
  3. warn(msg, *args, **kwargs)
  4. info(msg, *args, **kwargs)
  5. debug(msg, *args, **kwargs)

  The `msg` can contain string formatting.  An example of logging at the `ERROR`
  level
  using string formating is:

  >>> tf.get_logger().error("The value %d is invalid.", 3)

  You can also specify the logging verbosity.  In this case, the
  WARN level log will not be emitted:

  >>> tf.get_logger().setLevel(ERROR)
  >>> tf.get_logger().warn("This is a warning.")
  
tensorflowFTN)_logger_logger_lockacquirerelease_logging	getLoggerr/   
findCallerhandlersr   ps1AttributeErrorflagsinteractivesetLevelr   stdoutstderrStreamHandlersetFormatter	FormatterBASIC_FORMAT
addHandler)logger_interactive_logging_target_handlers       r   r4   r4   ]   s#   R N(L G -F ,F ((l.88, 
++++ ''8hH..x/D/DdKL!G +  .zz--.* s7   E+ A E+ E BE+ #E(%E+ 'E((E+ +Fzlogging.log)v1c                 B     t               j                  | |g|i | y Nr4   logr   msgargskwargss       r   rS   rS           *,5#///r   zlogging.debugc                 @     t               j                  | g|i | y rQ   )r4   debugrU   rV   rW   s      r   rZ   rZ          *,S*4*6*r   zlogging.errorc                 @     t               j                  | g|i | y rQ   )r4   errorr[   s      r   r^   r^      r\   r   zlogging.fatalc                 @     t               j                  | g|i | y rQ   )r4   fatalr[   s      r   r`   r`      r\   r   zlogging.infoc                 @     t               j                  | g|i | y rQ   )r4   infor[   s      r   rb   rb      s    *,C)$)&)r   zlogging.warnc                 @     t               j                  | g|i | y rQ   r4   warningr[   s      r   warnrf          *,s,T,V,r   zlogging.warningc                 @     t               j                  | g|i | y rQ   rd   r[   s      r   re   re      rg   r   r   r   r   r   r   zlogging.TaskLevelStatusMessagec                     t        |        y rQ   )r^   )rU   s    r   TaskLevelStatusMessagerj      s	    *r   zlogging.flushc                      t               rQ   )NotImplementedErrorr
   r   r   flushrm      s    r   zlogging.vlogc                 B     t               j                  | |g|i | y rQ   rR   rT   s       r   vlogro      rX   r   c                 T    dt         j                  | d      z   t         | <   t         |    S )zWrapper for _log_counter_per_token.

  Args:
    token: The token for which to look up the count.

  Returns:
    The number of times this function has been called with
    *token* as an argument (starting at 0)
  r   )_log_counter_per_tokenget)tokens    r   _GetNextLogCountPerTokenru      s-     #$&<&@&@&K"K		&&r   zlogging.log_every_nc                 N    t        t                     }t        | |||z   g|  y)aO  Log 'msg % args' at level 'level' once per 'n' times.

  Logs the 1st call, (N+1)st call, (2N+1)st call,  etc.
  Not threadsafe.

  Args:
    level: The level at which to log.
    msg: The message to be logged.
    n: The number of times this should be called before it is logged.
    *args: The args to be substituted into the msg.
  Nru   _GetFileAndLinelog_ifr   rU   nrV   counts        r   log_every_nr}   
  s(     #?#4
5%%!)_,t,r   zlogging.log_first_nc                 L    t        t                     }t        | |||k  g|  y)a  Log 'msg % args' at level 'level' only first 'n' times.

  Not threadsafe.

  Args:
    level: The level at which to log.
    msg: The message to be logged.
    n: The number of times this should be called before it is logged.
    *args: The args to be substituted into the msg.
  Nrw   rz   s        r   log_first_nr     s&     #?#4
5%UQY&&r   zlogging.log_ifc                 $    |rt        | |g|  yy)zALog 'msg % args' at level 'level' only if condition is fulfilled.N)ro   )r   rU   	conditionrV   s       r   ry   ry   +  s     d r   c                  R    t               \  } }| sy| j                  |j                  fS )z3Returns (filename, linenumber) for the stack frame.)z	<unknown>r   )r   r   r)   )r   r   s     r   rx   rx   2  s(    M'$	


AJJ	''r   c                 Z   |xs t        j                         }t        j                  |      }t        d|dz  z        }|xs
 t	               \  }}t
        j                  j                  |      }d}	| t        v rt        |    d   }	d|	|d   |d   |d   |d	   |d
   |t               ||f
z  }
|
S )z3Assemble a logline prefix using the google2 format.g    .Ag      ?Ir   z*%c%02d%02d %02d:%02d:%02d.%06d %5d %s:%d] r   r1   r   r!      )
_timetime	localtimeintrx   _ospathbasename_level_names_get_thread_id)r   	timestampfile_and_linenow	now_tuplenow_microsecondfilenameliner   severityss              r   google2_log_prefixr   :  s     	!UZZ\#ooc")sSy)*/"7o&78TXXx(( (
lE"1%H2lllll

6 
! 
(r   zlogging.get_verbosityc                  2    t               j                         S )z0Return how much logging output will be produced.)r4   getEffectiveLevelr
   r   r   get_verbosityr   \  s     
	'	'	))r   zlogging.set_verbosityc                 6    t               j                  |        y)z4Sets the threshold for what messages will be logged.N)r4   rC   )vs    r   set_verbosityr   b  s     ,r   c                  <    t        j                         } | t        z  S )zGGet id of current thread, suitable for logging as an unsigned quantity.)_thread	get_ident_THREAD_ID_MASK)	thread_ids    r   r   r   h  s    !)	_	$$r   zlogging.DEBUGzlogging.ERRORzlogging.FATALzlogging.INFOzlogging.WARN)r   )Fr   )Fr   )8__doc__loggingr;   osr   sysr   r   r   r   	tracebackr'   r   r   r   r   r   	threading tensorflow.python.util.tf_exportr   r7   Lockr8   r   r   version_infomajorminorr/   r4   rS   rZ   r^   r`   rb   rf   re   r   maxsizer   _log_prefixrr   rj   rm   ro   ru   r}   r   ry   rx   r   r   r   r   export_constant__name__r
   r   r   <module>r      sV                 6 y~~  % 
" aD$5$5$;$;q$@> 
!d&7&7&=&=&B>7 <U Up }o0 0  + !+  + !+  + !+ ~*  * ~-  -  !"- #-
 
7	7&&	7 dll"Q&   /01 2   !
 ~0  0' $%&- '-  $%&' ''  ! "(D &'(* )*
 &'( )
% ! 	o  / /' B 	o  / /' B 	o  / /' B 	n  . .x @ 	n  . .x @r   