Ñò
n‘’Oc           @   s*  d  d k  Z  d  d k l Z d  d k l Z d  d k l Z l Z d „  Z d „  Z	 d „  Z
 d „  Z d	 „  Z d
 „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z e d „ Z  d „  Z! d S(   iÿÿÿÿN(   t   wraps(   t   warn_explicit(   t   IS_DEVELOPMENTt	   IS_CLIENTc         G   sN   t  d t i d ƒ ƒ G|  G| GHt o d d  k } | i ƒ  n t i ƒ  d  S(   Ns   CRITICAL ERRORi   iÿÿÿÿ(   t   _makeMsgHeadert   syst	   _getframeR   t   BigWorldt   quitt   exit(   t   msgt   kargsR   (    (    s   scripts/common/debug_utils.pyt   CRITICAL_ERROR	   s
    c          C   s2   t  d t i d ƒ ƒ GHd d k l }  |  ƒ  d  S(   Nt	   EXCEPTIONi   iÿÿÿÿ(   t	   print_exc(   R   R   R   t	   tracebackR   (   R   (    (    s   scripts/common/debug_utils.pyt   LOG_CURRENT_EXCEPTION   s    c      	   C   sõ   d d | | f GHd d k  l } d d k l } l } | ƒ  \ } } }	 |	 o d g }
 |
 | |	 ƒ }
 n g  }
 |
 }
 x8 |
 D]0 } | i |  ƒ d j o t  i i | ƒ q� q� W| | | ƒ }
 x* |
 D]" } t  i i | i |  | ƒ ƒ qË Wd  S(   Ns   [%s] (%s, %d):R   iÿÿÿÿ(   t   exc_info(   t	   format_tbt   format_exception_onlys#   Traceback (most recent call last):
(	   R   R   R   R   R   t   findt   stderrt   writet   replace(   t   wrapperNamet   orgNamet	   orgSourcet	   orgLinenoR   R   R   t   etypet   valuet   tbt   listt   ln(    (    s   scripts/common/debug_utils.pyt   LOG_WRAPPED_CURRENT_EXCEPTION   s"    	  c          G   s   t  d d |  ƒ d  S(   Nt   WARNINGs.   this code point should have never been reached(   t   _doLog(   R   (    (    s   scripts/common/debug_utils.pyt   LOG_CODEPOINT_WARNING0   s    c         G   s   t  d |  | ƒ d  S(   Nt   ERROR(   R#   (   R
   R   (    (    s   scripts/common/debug_utils.pyt	   LOG_ERROR4   s    c         G   s   t  d |  | ƒ d  S(   NR"   (   R#   (   R
   R   (    (    s   scripts/common/debug_utils.pyt   LOG_WARNING8   s    c         G   s   t  d |  | ƒ d  S(   Nt   NOTE(   R#   (   R
   R   (    (    s   scripts/common/debug_utils.pyt   LOG_NOTE<   s    c         G   s'   t  p t o t d |  | ƒ n d  S(   Nt   DEBUG(   R   R   R#   (   R
   R   (    (    s   scripts/common/debug_utils.pyt	   LOG_DEBUG@   s    c         G   s   t  o t d |  | ƒ n d  S(   NR*   (   R   R#   (   R
   R   (    (    s   scripts/common/debug_utils.pyt   LOG_DEBUG_DEVE   s    c         G   s'   t  p t o t d |  | ƒ n d  S(   Nt   NESTE(   R   R   R#   (   R
   R   (    (    s   scripts/common/debug_utils.pyt	   LOG_NESTEK   s    c         G   s'   t  p t o t d |  | ƒ n d  S(   Nt   MX(   R   R   R#   (   R
   R   (    (    s   scripts/common/debug_utils.pyt   LOG_MXQ   s    c         G   s   t  o t d |  | ƒ n d  S(   NR/   (   R   R#   (   R
   R   (    (    s   scripts/common/debug_utils.pyt
   LOG_MX_DEVX   s    c         G   s   t  o t d |  | ƒ n d  S(   Nt   DZ(   R   R#   (   R
   R   (    (    s   scripts/common/debug_utils.pyt   LOG_DZ^   s    c         G   s   t  o t d |  | ƒ n d  S(   Nt   TU(   R   R#   (   R
   R   (    (    s   scripts/common/debug_utils.pyt   LOG_TUd   s    c         G   s'   t  p t o t d |  | ƒ n d  S(   Nt   RF(   R   R   R#   (   R
   R   (    (    s   scripts/common/debug_utils.pyt   LOG_RFj   s    c         G   s'   t  p t o t d |  | ƒ n d  S(   Nt   GUI(   R   R   R#   (   R
   R   (    (    s   scripts/common/debug_utils.pyt   LOG_GUIq   s    c         G   s   t  d |  | ƒ d  S(   Nt   LOG_UNEXPECTED(   R#   (   R
   R   (    (    s   scripts/common/debug_utils.pyR:   w   s    c         G   s@   t  |  d ƒ o |  i }  n t d t i d ƒ ƒ G|  G| GHd  S(   Nt   idt   WRONG_CLIENTi   (   t   hasattrR;   R   R   R   (   t   entityR   (    (    s   scripts/common/debug_utils.pyt   LOG_WRONG_CLIENT€   s    c         C   s=   t  |  t i d ƒ ƒ } | o | G| G| GHn
 | G| GHd  S(   Ni   (   R   R   R   (   t   sR
   t   argst   header(    (    s   scripts/common/debug_utils.pyR#   ‡   s    c         C   s   d |  | i  i | i f S(   Ns   [%s] (%s, %d):(   t   f_codet   co_filenamet   f_lineno(   R@   t   frame(    (    s   scripts/common/debug_utils.pyR   �   s    c            sV   ˆ  i  i ˆ  i  i  ‰ ˆ  i ‰ t i d ƒ ‰ t ˆ  ƒ ‡  ‡ ‡ ‡ f d †  ƒ } | S(   Ni   c             s‹   d d ˆ i  i ˆ i ˆ f Gd Gd i d „  t ˆ |  ƒ | i ƒ  Dƒ ƒ GHˆ  |  | Ž  } d d ˆ i  i ˆ i ˆ f Gd Gt | ƒ GH| S(   Ns   [%s] (%s, %d) call %s:R*   t   :s   , c         s   s   x |  ] } d  | Vq Wd S(   s   %s=%rN(    (   t   .0t   entry(    (    s   scripts/common/debug_utils.pys	   <genexpr>�   s   	 s   [%s] (%s, %d) return from %s:(   RC   RD   RE   t   joint   zipt   itemst   repr(   RA   t   kwdst   ret(   t   funcRF   t   argnamest   fname(    s   scripts/common/debug_utils.pyt   wrapper›   s    L,(   t	   func_codet   co_varnamest   co_argcountt	   func_nameR   R   R    (   RP   RS   (    (   RP   RF   RQ   RR   s   scripts/common/debug_utils.pyt   trace—   s
    	$c            s   t  ˆ  ƒ ‡  f d †  ƒ } | S(   Nc       	      sG   t  d h ˆ  i d 6d t d ˆ  i i d ˆ  i i d ƒˆ  |  | Ž  S(   Ns)   Call to deprecated function %(funcname)s.t   funcnamet   categoryt   filenamet   linenoi   (   R   t   __name__t   DeprecationWarningRT   RD   t   co_firstlineno(   RA   t   kwargs(   RP   (    s   scripts/common/debug_utils.pyRS   ¬   s
    (   R    (   RP   RS   (    (   RP   s   scripts/common/debug_utils.pyt
   deprecated«   s    c         C   s   d „  } | S(   Nc          _   s   d  S(   N(    (   RA   R   (    (    s   scripts/common/debug_utils.pyt
   empty_func¸   s    (    (   RP   Rb   (    (    s   scripts/common/debug_utils.pyt   disabled·   s    	c      
   C   s>  d d k  } d d k } d GH| i ƒ  d GH| i ƒ  d GHxü | i D]ñ } yá t | ƒ } t | ƒ d j o d | d  } n d G| GHd Gt | ƒ GHd	 Gt | i | ƒ ƒ GHd
 G| i t | ƒ ƒ GHd G| i	 | ƒ GH|  oK | i
 t | ƒ ƒ \ } } d G| GHx$ | D] } d G| i d ƒ GHqWn WqE qE XqE Wd S(   s$   
	show us what's the garbage about
	iÿÿÿÿNs   
Collecting GARBAGE:s   
GARBAGE OBJECTS:iP   s   %s...s   ::s           type:s      referrers:s       is class:s         module:s       line num:s           line:s   
(   t   inspectt   gct   collectt   garbaget   strt   lent   typet   get_referrerst   isclasst	   getmodulet   getsourcelinest   rstrip(   t   sourceRd   Re   t   xR@   t   linest   line_numt   l(    (    s   scripts/common/debug_utils.pyt   dump_garbage½   s2    


  		 c         C   s3   y |  p t  ‚ Wn t  j
 o t ƒ  n Xd  S(   N(   t   AssertionErrorR   (   t
   expression(    (    s   scripts/common/debug_utils.pyt   verifyâ   s    ("   R   t	   functoolsR    t   warningsR   t	   constantsR   R   R   R   R!   R$   R&   R'   R)   R+   R,   R.   R0   R1   R3   R5   R7   R9   R:   R?   R#   R   RX   Ra   Rc   t   FalseRu   Rx   (    (    (    s   scripts/common/debug_utils.pyt   <module>   s8   																								%