mò
­fIc           @   s%  d  Z  d k Z d k Z d k Z d d d d d g Z g  Z d Z h  Z d d d	 „ Z	 d d d
 „ Z
 d d „ Z d „  Z d e d d d d „ Z e d d d „ Z d „  Z d e f d „  ƒ  YZ d „  Z d „  Z d „  Z d „  Z e e i ƒ e d d e d d ƒe d d e d d ƒd S(   s&   Python part of the warnings subsystem.Nt   warnt   showwarningt   formatwarningt   filterwarningst   resetwarningst   defaulti   c   
      C   sq  t  |  t ƒ o |  i } n | d j o
 t } n y t i | ƒ } Wn" t j
 o t i } d } n X| i } | i } d | j o | d } n d } | i d ƒ } | o> | i ƒ  } | i d ƒ p | i d ƒ o | d  } qBnP | d j o1 y t i d	 } Wq1t j
 o d } q1Xn | p
 | } n | i d
 h  ƒ }	 t |  | | | | |	 ƒ d S(   s:   Issue a warning, or maybe ignore it or raise an exception.i   t   __name__s   <string>t   __file__s   .pycs   .pyoiÿÿÿÿt   __main__i    t   __warningregistry__N(   t
   isinstancet   messaget   Warningt	   __class__t   categoryt   Nonet   UserWarningt   syst	   _getframet
   stacklevelt   callert
   ValueErrort   __dict__t   globalst   linenot	   f_globalst   f_linenot   modulet   gett   filenamet   lowert   fnlt   endswitht   argvt   AttributeErrort
   setdefaultt   registryt   warn_explicit(
   R   R   R   R   R   R   R   R   R   R$   (    (    t%   /mit/python/lib/python2.4/warnings.pyR       s<     
 			 
c         C   su  | d  j o6 | p d } | d i ƒ  d j o | d  } qC n | d  j o
 h  } n t |  t ƒ o t |  ƒ } |  i
 } n |  } | |  ƒ }  | | | f }	 | i |	 ƒ o d  Sn x’ t D]„ } | \ } } } }
 } | d  j p | i | ƒ oL t | | ƒ o< |
 d  j p |
 i | ƒ o | d j p | | j o PqÃ qÃ Wt } | d j o d | |	 <d  Sn | d j o
 |  ‚ n | d j o< d | |	 <| | f } t i | ƒ o d  Sn d t | <n | d	 j o n~ | d
 j o? d | |	 <| | d f } | i | ƒ o d  Sn d | | <n2 | d j o d | |	 <n t d | | f ƒ ‚ t |  | | | ƒ d  S(   Ns	   <unknown>iýÿÿÿs   .pyi    t   ignorei   t   errort   oncet   alwaysR   R   s1   Unrecognized action (%r) in warnings.filters:
 %s(   R   R   R   R   R$   R
   R   R   t   strt   textR   R   R   t   keyR   t   filterst   itemt   actiont   msgt   catt   modt   lnt   matcht
   issubclasst   defaultactiont   oncekeyt   onceregistryt   altkeyt   RuntimeErrorR   (   R   R   R   R   R   R$   R,   R4   R1   R-   R3   R2   R:   R/   R0   R8   (    (    R&   R%   ?   sV    
 d	



c         C   sT   | d j o t i } n y  | i t |  | | | ƒ ƒ Wn t
 j
 o n Xd S(   s7   Hook to write a warning to a file; replace if you like.N(   t   fileR   R   t   stderrt   writeR   R   R   R   R   t   IOError(   R   R   R   R   R<   (    (    R&   R   z   s      c         C   sR   d | | | i |  f } t i | | ƒ i ƒ  } | o | d | d } n | S(   s.   Function to format a warning the standard way.s   %s:%s: %s: %s
s     s   
N(
   R   R   R   R   R   t   st	   linecachet   getlinet   stript   line(   R   R   R   R   R@   RD   (    (    R&   R   ƒ   s     t    i    c         C   sb   d k  } |  | i | | i ƒ | | i | ƒ | f } | o t
 i	 | ƒ n t
 i d | ƒ d S(   s†   Insert an entry into the list of warnings filters (at the front).

    Use assertions to check that all arguments have the right type.Ni    (   t   reR0   t   compileR   t   IR   R   R   R/   t   appendR.   t   insert(   R0   R   R   R   R   RI   R/   RF   (    (    R&   R   ‹   s     	      -c         C   sA   |  d | d | f } | o t i | ƒ n t i d | ƒ d S(   sƒ   Insert a simple entry into the list of warnings filters (at the front).

    A simple filter matches all modules and messages.
    i    N(   R0   R   R   R   R/   RI   R.   RJ   (   R0   R   R   RI   R/   (    (    R&   t   simplefilter    s       c           C   s   g  t  (d S(   sA   Clear the list of warning filters, so that no filters are active.N(   R.   (    (    (    R&   R   ¯   s     t   _OptionErrorc           B   s   t  Z d  Z RS(   s,   Exception used by option processing helpers.(   R   t
   __module__t   __doc__(    (    (    R&   RL   ³   s   c         C   sN   xG |  D]? } y t | ƒ Wq t j
 o } t i d I| IJq Xq Wd  S(   Ns   Invalid -W option ignored:(   t   argst   argt
   _setoptionRL   R1   R   R=   (   RO   R1   RP   (    (    R&   t   _processoptions¸   s     c   
      C   sl  d  k  } |  i d ƒ } t | ƒ d j o t d |  f ƒ ‚ n x% t | ƒ d j  o | i d ƒ qE Wg  } | D] } | | i	 ƒ  qu ~ \ } } } } }	 t | ƒ } | i | ƒ } t | ƒ } | i | ƒ } | o | d } n |	 oZ y' t |	 ƒ }	 |	 d j  o
 t ‚ n WqRt t f j
 o t d |	 f ƒ ‚ qRXn d }	 t | | | | |	 ƒ d  S(   Nt   :i   s   too many fields (max 5): %rRE   t   $i    s   invalid lineno %r(   RF   RP   t   splitt   partst   lenRL   RI   t   _[1]R@   RC   R0   R   R   R   R   t
   _getactiont   escapet   _getcategoryt   intR   t   OverflowErrorR   (
   RP   R   R@   RX   RF   RV   R   R0   R   R   (    (    R&   RQ   À   s.    	 6c         C   sv   |  p d Sn |  d j o d Sn x8 d d d d d d g D] } | i |  ƒ o | Sq= q= Wt d |  f ƒ ‚ d  S(	   NR   t   allR*   R'   R   R)   R(   s   invalid action: %r(   R0   t   at
   startswithRL   (   R0   R_   (    (    R&   RY   Û   s      c         C   sP  d  k  } |  p t Sn | i d |  ƒ o= y t |  ƒ } Wqt j
 o t d |  f ƒ ‚ qXn© |  i d ƒ } |  |  } |  | d } y t | d  d  | g ƒ } Wn& t j
 o t d | f ƒ ‚ n Xy t | | ƒ } Wn& t j
 o t d |  f ƒ ‚ n Xt | t i ƒ p t | t ƒ o t d |  f ƒ ‚ n | S(   Ns   ^[a-zA-Z0-9_]+$s   unknown warning category: %rt   .i   s   invalid module name: %rs   invalid warning category: %r(   RF   R   R   R5   t   evalR2   t	   NameErrorRL   t   rfindt   iR   t   klasst
   __import__R   t   mt   ImportErrort   getattrR"   R
   t   typest	   ClassTypeR6   (   R   Re   Rh   R   R2   RF   Rf   (    (    R&   R[   å   s,    	
%R'   R   RI   (   RN   R   Rk   RA   t   __all__R.   R7   R9   R   R    R%   R   R   R   R   RK   R   t	   ExceptionRL   RR   RQ   RY   R[   t   warnoptionst   OverflowWarningt   PendingDeprecationWarning(   R   R.   RQ   R   Rm   R9   RK   R[   R7   R%   Rk   R   RR   R    RA   RL   R   R   RY   (    (    R&   t   ?   s*   	';						
	