ó
O'^c           @@  sL   d  d l  m Z d  d l Z d e f d     YZ d e f d     YZ d S(   i    (   t   absolute_importNt   WarningMessagec           B@  s,   e  Z d  Z d	 Z d
 d
 d  Z d   Z RS(   s0   Holds the result of a single showwarning() call.t   messaget   categoryt   filenamet   linenot   filet   linec   	      C@  sM   t    } x% |  j D] } t |  | | |  q W| r@ | j pC d  |  _ d  S(   N(   t   localst   _WARNING_DETAILSt   setattrt   __name__t   Nonet   _category_name(	   t   selfR   R   R   R   R   R   t   local_valuest   attr(    (    s7   /tmp/pip-unpacked-wheel-40MfcW/billiard/tests/compat.pyt   __init__   s    	c         C@  s&   d |  j  |  j |  j |  j |  j f S(   NsD   {message : %r, category : %r, filename : %r, lineno : %s, line : %r}(   R   R   R   R   R   (   R   (    (    s7   /tmp/pip-unpacked-wheel-40MfcW/billiard/tests/compat.pyt   __str__   s    (   R   R   R   R   R   R   N(   R   t
   __module__t   __doc__R	   R   R   R   (    (    (    s7   /tmp/pip-unpacked-wheel-40MfcW/billiard/tests/compat.pyR      s    t   catch_warningsc           B@  s8   e  Z d  Z e d d  Z d   Z d   Z d   Z RS(   s  A context manager that copies and restores the warnings filter upon
    exiting the context.

    The 'record' argument specifies whether warnings should be captured by a
    custom implementation of warnings.showwarning() and be appended to a list
    returned by the context manager. Otherwise None is returned by the context
    manager. The objects appended to the list are arguments whose attributes
    mirror the arguments to showwarning().

    The 'module' argument is to specify an alternative module to the module
    named 'warnings' and imported under that name. This argument is only
    useful when testing the warnings module itself.

    c         C@  s8   | |  _  | d k r" t j d p% | |  _ t |  _ d S(   sę   Specify whether to record warnings and if an alternative module
        should be used other than sys.modules['warnings'].

        For compatibility with Python 3.0, please consider all arguments to be
        keyword-only.

        t   warningsN(   t   _recordR   t   syst   modulest   _modulet   Falset   _entered(   R   t   recordt   module(    (    s7   /tmp/pip-unpacked-wheel-40MfcW/billiard/tests/compat.pyR   ,   s    	"c         C@  sr   g  } |  j  r | j d  n  |  j t j d k	 rL | j d |  j  n  t |   j } d | d j |  f S(   Ns   record=TrueR   s	   module=%rs   %s(%s)s   , (   R   t   appendR   R   R   t   typeR   t   join(   R   t   argst   name(    (    s7   /tmp/pip-unpacked-wheel-40MfcW/billiard/tests/compat.pyt   __repr__8   s    	c         @  s   |  j  r t d |    n  t |  _  |  j j |  _ |  j |  j _ |  j j |  _ |  j r g      f d   } | |  j _   Sd  S(   Ns   Cannot enter %r twicec          @  s     j  t |  |    d  S(   N(   R   R   (   R"   t   kwargs(   t   log(    s7   /tmp/pip-unpacked-wheel-40MfcW/billiard/tests/compat.pyt   showwarningK   s    (	   R   t   RuntimeErrort   TrueR   t   filterst   _filtersR'   t   _showwarningR   (   R   R'   (    (   R&   s7   /tmp/pip-unpacked-wheel-40MfcW/billiard/tests/compat.pyt	   __enter__A   s    			c         G@  s>   |  j  s t d |    n  |  j |  j _ |  j |  j _ d  S(   Ns%   Cannot exit %r without entering first(   R   R(   R+   R   R*   R,   R'   (   R   t   exc_info(    (    s7   /tmp/pip-unpacked-wheel-40MfcW/billiard/tests/compat.pyt   __exit__Q   s    	N(	   R   R   R   R   R   R   R$   R-   R/   (    (    (    s7   /tmp/pip-unpacked-wheel-40MfcW/billiard/tests/compat.pyR      s
   			(   t
   __future__R    R   t   objectR   R   (    (    (    s7   /tmp/pip-unpacked-wheel-40MfcW/billiard/tests/compat.pyt   <module>   s   