???<!-- GIF89;a -->
123123123123
.....................................................................................................................................???<!-- GIF89;a -->
123123123123
.....................................................................................................................................ó
¿öYc           @@  s–  d  d l  m Z d  d l Z d  d l Z d  d l Z d  d l m Z d  d l m Z m	 Z	 m
 Z
 m Z d  d l m Z g  Z i  Z e j d ƒ Z d „  Z d e f d	 „  ƒ  YZ d
 e f d „  ƒ  YZ e d „ Z d „  Z d d d d d d d d „ Z d „  Z d d „ Z d „  Z e d „  ƒ Z d d „ Z d „  Z  d „  Z! i  Z" d „  Z# e# d ƒ d „  ƒ Z$ e# d ƒ d „  ƒ Z% d „  Z& d  d l' Z( d S(   i    (   t   absolute_importN(   t   FunctionType(   t	   iteritemst   get_codet	   text_typet   string_types(   t   oncet   ravenc         C@  sb   |  d | d k oa |  d | d k oa |  d | d k oa |  d | d k oa |  d | d k S(   Nt   typet   levelt   messaget   categoryt   data(    (   t   at   b(    (    sB   /opt/alt/python27/lib/python2.7/site-packages/raven/breadcrumbs.pyt   event_payload_considered_equal   s
    t   BreadcrumbBufferc           B@  sD   e  Z d  d „ Z d d d d d d d d „ Z d „  Z d „  Z RS(   id   c         C@  s   g  |  _  | |  _ d  S(   N(   t   buffert   limit(   t   selfR   (    (    sB   /opt/alt/python27/lib/python2.7/site-packages/raven/breadcrumbs.pyt   __init__   s    	c         C@  s”   | p | p | s! t  d ƒ ‚ n  | d  k r< t j ƒ  } n  |  j j i | pQ d d 6| d 6| d 6| d 6| d 6| d 6| f ƒ |  j |  j 4d  S(	   Ns6   You must pass either `message`, `data`, or `processor`t   defaultR   t	   timestampR	   R
   R   R   (   t
   ValueErrort   Nonet   timeR   t   appendR   (   R   R   R	   R
   R   R   R   t	   processor(    (    sB   /opt/alt/python27/lib/python2.7/site-packages/raven/breadcrumbs.pyt   record#   s    
c         C@  s   |  j  2d  S(   N(   R   (   R   (    (    sB   /opt/alt/python27/lib/python2.7/site-packages/raven/breadcrumbs.pyt   clear4   s    c         C@  s¾   g  } x± t  |  j ƒ D]  \ } \ } } | d  k	 r y | | ƒ Wn$ t k
 rh t j d ƒ d  } n X| d  f |  j | <n  | d  k	 r | s¦ t | d | ƒ r | j | ƒ q q W| S(   Ns&   Failed to process breadcrumbs. Ignorediÿÿÿÿ(   t	   enumerateR   R   t	   Exceptiont   loggert	   exceptionR   R   (   R   t   rvt   idxt   payloadR   (    (    sB   /opt/alt/python27/lib/python2.7/site-packages/raven/breadcrumbs.pyt
   get_buffer7   s    "
N(   t   __name__t
   __module__R   R   R   R   R%   (    (    (    sB   /opt/alt/python27/lib/python2.7/site-packages/raven/breadcrumbs.pyR      s
   		t   BlackholeBreadcrumbBufferc           B@  s   e  Z d  „  Z RS(   c         O@  s   d  S(   N(    (   R   t   argst   kwargs(    (    sB   /opt/alt/python27/lib/python2.7/site-packages/raven/breadcrumbs.pyR   H   s    (   R&   R'   R   (    (    (    sB   /opt/alt/python27/lib/python2.7/site-packages/raven/breadcrumbs.pyR(   G   s   c         C@  s   |  r t  ƒ  St ƒ  S(   N(   R   R(   (   t   enabled(    (    sB   /opt/alt/python27/lib/python2.7/site-packages/raven/breadcrumbs.pyt   make_bufferL   s    c         O@  s   |  | d <t  | | Ž  S(   NR   (   R   (   R   R)   R*   (    (    sB   /opt/alt/python27/lib/python2.7/site-packages/raven/breadcrumbs.pyt   record_breadcrumbR   s    
c      	   C@  s[   | d k r t j ƒ  } n  x9 t j j ƒ  D]( } | j j | | |  | | | | ƒ q+ Wd S(   s­   Records a breadcrumb for all active clients.  This is what integration
    code should use rather than invoking the `captureBreadcrumb` method
    on a specific client.
    N(   R   R   R   t   contextt   get_active_contextst   breadcrumbsR   (   R
   R   R	   R   R   R   R   t   ctx(    (    sB   /opt/alt/python27/lib/python2.7/site-packages/raven/breadcrumbs.pyR   X   s
    c         @  s¢   x0 t  D]( } | ˆ ˆ ˆ ˆ  ˆ ƒ } | r d  Sq Wt j ˆ j ƒ } | d  k	 rv | ˆ ˆ ˆ ˆ  ˆ ƒ } | rv d  Sn  ‡  ‡ ‡ ‡ ‡ f d †  } t d | ƒ d  S(   Nc         @  sŒ   ˆ } y# t  ˆ ƒ } ˆ  r( ˆ ˆ  } n  Wn t k
 r< n Xˆ j d d  ƒ |  j i | d 6ˆ j d 6t j ˆ ƒ j ƒ  d 6ˆ d 6ƒ d  S(   Nt   exc_infoR
   R   R	   R   (	   R   R   t   popR   t   updatet   namet   loggingt   getLevelNamet   lower(   R   t   formatted_msg(   R)   R*   R	   R    t   msg(    sB   /opt/alt/python27/lib/python2.7/site-packages/raven/breadcrumbs.pyR   q   s    	
R   (   t   special_logging_handlerst   special_logger_handlerst   getR5   R   R   (   R    R	   R:   R)   R*   t   handlerR"   R   (    (   R)   R*   R	   R    R:   sB   /opt/alt/python27/lib/python2.7/site-packages/raven/breadcrumbs.pyt   _record_log_breadcrumbe   s    c   	      C@  sn  t  |  t ƒ s |  j } n |  } t | d t ƒ r7 d  S| d  k rR d } d } n d } d | } t | ƒ } t j } | d  k r¡ t	 j
 j t j j j ƒ } n  i  } t t d i d | j d d	 6| j d
 6d j | ƒ d 6| d 6| d 6| d ƒ t j | ƒ | d |  t ƒ } | j | _ | j t | ƒ j k sAt ‚ | j | j k | j | j k t | _ | S(   Nt   __patched_for_raven__R	   R:   s
   level, msgs   %d, msgs  %(offset)sif 1:
    def factory(original, record_crumb):
        def %(name)s(self, %(args)s, *args, **kwargs):
            record_crumb(self, %(fwd)s, *args, **kwargs)
            return original(self, %(args)s, *args, **kwargs)
        return %(name)s
    
s   
i   t   offsetR5   s   , R)   t   fwdt   exect   factory(   R	   R:   (   R:   (   t
   isinstanceR   t   im_funct   getattrt   FalseR   R   R6   t   _srcfilet   ost   patht   normpatht   currentframet   __code__t   co_filenamet   evalt   compilet   co_firstlinenoR&   t   joint   __dict__R?   t   __doc__t   AssertionErrorR'   t   TrueR@   (	   t   methR	   t   funcR)   RB   t   codet   logging_srcfilet   nst   new_func(    (    sB   /opt/alt/python27/lib/python2.7/site-packages/raven/breadcrumbs.pyt   _wrap_logging_method‹   s>    	
		
	c          C@  sÃ   t  j }  i t  j d 6t  j d 6t  j d 6t  j d 6t  j d 6t  j d 6t  j d 6t  j d 6} xE t	 | ƒ D]7 \ } } t
 t |  | ƒ | ƒ } t t  j | | ƒ ql Wt
 t  j j ƒ t  j _ d  S(	   Nt   debugt   infot   warningt   warnt   errorR!   t   criticalt   fatal(   R6   t   Loggert   DEBUGt   INFOt   WARNINGt   WARNt   ERRORt   CRITICALt   FATALR   R^   RG   t   setattrt   log(   t   clst   methodst   method_nameR	   R]   (    (    sB   /opt/alt/python27/lib/python2.7/site-packages/raven/breadcrumbs.pyt   _patch_loggerÑ   s     	






c           C@  s   t  ƒ  d S(   sX   Installs the logging hook if it was not installed yet.  Otherwise
    does nothing.
    N(   Rs   (    (    (    sB   /opt/alt/python27/lib/python2.7/site-packages/raven/breadcrumbs.pyt   install_logging_hookè   s    c         @  s    ‡  f d †  } t  |  | ƒ d S(   s¢   Ignores a logger for the regular breadcrumb code.  This is useful
    for framework integration code where some log messages should be
    specially handled.
    c         @  s    ˆ  d  k	 r | ˆ  k r t St S(   N(   R   RH   RW   (   R    R	   R:   R)   R*   (   t   allow_level(    sB   /opt/alt/python27/lib/python2.7/site-packages/raven/breadcrumbs.pyR>   õ   s    N(   t   register_special_log_handler(   t   name_or_loggerRu   R>   (    (   Ru   sB   /opt/alt/python27/lib/python2.7/site-packages/raven/breadcrumbs.pyt   ignore_loggerð   s    c         C@  s/   t  |  t ƒ r |  } n	 |  j } | t | <d S(   s  Registers a callback for log handling.  The callback is invoked
    with give arguments: `logger`, `level`, `msg`, `args` and `kwargs`
    which are the values passed to the logging system.  If the callback
    returns `True` the default handling is disabled.
    N(   RE   R   R5   R<   (   Rw   t   callbackR5   (    (    sB   /opt/alt/python27/lib/python2.7/site-packages/raven/breadcrumbs.pyRv   ý   s    		c         C@  s   t  j |  ƒ d S(   s  Registers a callback for log handling.  The callback is invoked
    with give arguments: `logger`, `level`, `msg`, `args` and `kwargs`
    which are the values passed to the logging system.  If the callback
    returns `True` the default handling is disabled.
    N(   R;   R   (   Ry   (    (    sB   /opt/alt/python27/lib/python2.7/site-packages/raven/breadcrumbs.pyt   register_logging_handler
  s    c         @  s   ‡  f d †  } | S(   Nc         @  s   t  |  ƒ }  |  t ˆ  <|  S(   N(   R   t   hooked_libraries(   t   f(   R5   (    sB   /opt/alt/python27/lib/python2.7/site-packages/raven/breadcrumbs.pyt	   decorator  s    
(    (   R5   R}   (    (   R5   sB   /opt/alt/python27/lib/python2.7/site-packages/raven/breadcrumbs.pyt   libraryhook  s    t   requestsc          @  sa   y d d l  m }  Wn t k
 r( d  SX|  j ‰  ‡  f d †  } | |  _ t d d t j ƒd  S(   Ni    (   t   Sessionc         @  sW   ‡  f d †  } y ˆ |  ˆ  | | Ž } Wn t  k
 rH | d  ƒ ‚  n X| | ƒ | S(   Nc      	   @  s]   t  d d d d d i ˆ  j d 6ˆ  j d 6|  r8 |  j p; d  d 6|  rN |  j pQ d  d	 6ƒ d  S(
   NR   t   httpR   R   R   t   urlt   methodt   status_codet   reason(   R   R‚   Rƒ   R„   R   R…   (   t   response(   t   request(    sB   /opt/alt/python27/lib/python2.7/site-packages/raven/breadcrumbs.pyt   _record_request(  s
    

(   R   R   (   R   R‡   R)   R*   Rˆ   t   resp(   t	   real_send(   R‡   sB   /opt/alt/python27/lib/python2.7/site-packages/raven/breadcrumbs.pyt   send'  s    

s(   requests.packages.urllib3.connectionpoolRu   (   t   requests.sessionsR€   t   ImportErrorR‹   Rx   R6   Ri   (   R€   R‹   (    (   RŠ   sB   /opt/alt/python27/lib/python2.7/site-packages/raven/breadcrumbs.pyt   _hook_requests  s    			t   httplibc          @  s~   y d d l  m }  Wn! t k
 r7 d d l m }  n X|  j ‰ |  j ‰  ‡ f d †  } ‡  f d †  } | |  _ | |  _ d  S(   Ni    (   t   HTTPConnectionc         @  su   i  |  _  ‰ |  j ‰ |  j ‰ |  j ‰  ‡  ‡ ‡ ‡ ‡ ‡ f d †  } t d d d d d | ƒ ˆ |  ˆ ˆ | | Ž S(   Nc         @  sƒ   ˆ } | j  d ƒ sV d ˆ  d k r* d p- d ˆ ˆ ˆ  k rF d ˆ pI d ˆ f } n  i | d	 6ˆ d
 6|  d <|  d j ˆ ƒ |  S(   Ns   http://s   https://s   %s://%s%s%si»  t   httpsR   s   :%st    R‚   Rƒ   R   (   s   http://s   https://(   t
   startswithR4   (   R   t   real_url(   t   default_portt   hostRƒ   t   portt   statusR‚   (    sB   /opt/alt/python27/lib/python2.7/site-packages/raven/breadcrumbs.pyR   N  s    R   R   R   R   R   (   t   _raven_status_dictR–   R—   R•   R   (   R   Rƒ   R‚   R)   R*   R   (   t   real_putrequest(   R•   R–   Rƒ   R—   R˜   R‚   sB   /opt/alt/python27/lib/python2.7/site-packages/raven/breadcrumbs.pyt
   putrequestH  s    			c         @  s]   ˆ  |  | | Ž } t  |  d d  ƒ } | d  k	 rY d | k rY | j | d <| j | d <n  | S(   NR™   R„   R…   (   RG   R   R˜   R…   (   R   R)   R*   R"   R˜   (   t   real_getresponse(    sB   /opt/alt/python27/lib/python2.7/site-packages/raven/breadcrumbs.pyt   getresponse`  s    (   R   R   R   t   http.clientR›   R   (   R   R›   R   (    (   Rœ   Rš   sB   /opt/alt/python27/lib/python2.7/site-packages/raven/breadcrumbs.pyt   _install_httplib>  s    			c         C@  se   |  d  k r t j ƒ  }  n  xC |  D]; } t j | ƒ } | d  k rV t d | ƒ ‚ n  | ƒ  q" Wd  S(   Ns   Unknown library %r for hooking(   R   R{   t   keysR=   t   RuntimeError(   t	   librariest   libRY   (    (    sB   /opt/alt/python27/lib/python2.7/site-packages/raven/breadcrumbs.pyt   hook_librariesl  s    ()   t
   __future__R    RJ   R   R6   t   typesR   t   raven.utils.compatR   R   R   R   t   raven.utilsR   R;   R<   t	   getLoggerR    R   t   objectR   R(   RW   R,   R-   R   R   R?   R^   Rs   Rt   Rx   Rv   Rz   R{   R~   RŽ   RŸ   R¤   t   raven.contextR   (    (    (    sB   /opt/alt/python27/lib/python2.7/site-packages/raven/breadcrumbs.pyt   <module>   s:   "	
*		&F					 .	
