
\K]c           @` s]  d  d l  m Z m Z m 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
 Z
 d  d l m Z d  d l m Z m Z m Z m Z m Z m Z d  d l m Z d  d l m Z m Z m Z d  d l m Z d  d l m Z m Z d  d	 l m Z d  d
 l  m! Z! m" Z" d d l# m$ Z$ m% Z% d e& f d     YZ' d e& f d     YZ( d e( f d     YZ) e j* d d d d f  Z+ d e& f d     YZ, d e j- f d     YZ. d e. f d     YZ- d e. f d     YZ/ d e/ f d      YZ0 d! e/ f d"     YZ1 d# e1 f d$     YZ2 e j3 e' e4 d%   e j5 D   d S(&   i    (   t   print_functiont   divisiont   absolute_importN(   t   deepcopy(   t   _dispatchert   compilert   utilst   typest   configt   errors(   t   default_type_manager(   t   sigutilst	   serializet   typing(   t   fold_arguments(   t   Purposet   typeof(   t   get_code_object(   t   create_bound_methodt   reraisei   (   t	   NullCachet   FunctionCachet
   OmittedArgc           B` s/   e  Z d  Z d   Z d   Z e d    Z RS(   sC   
    A placeholder for omitted arguments with a default value.
    c         C` s   | |  _  d  S(   N(   t   value(   t   selfR   (    (    s/   lib/python2.7/site-packages/numba/dispatcher.pyt   __init__   s    c         C` s   d |  j  f S(   Ns   omitted arg(%r)(   R   (   R   (    (    s/   lib/python2.7/site-packages/numba/dispatcher.pyt   __repr__    s    c         C` s   t  j |  j  S(   N(   R   t   OmittedR   (   R   (    (    s/   lib/python2.7/site-packages/numba/dispatcher.pyt   _numba_type_#   s    (   t   __name__t
   __module__t   __doc__R   R   t   propertyR   (    (    (    s/   lib/python2.7/site-packages/numba/dispatcher.pyR      s   		t   _FunctionCompilerc           B` sP   e  Z d    Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z	 RS(   c         C` sO   | |  _  | |  _ | |  _ | |  _ t j |  j   |  _ | |  _ i  |  _ d  S(   N(	   t   py_funct   targetdescrt   targetoptionst   localsR   t   pysignaturet   pysigt   pipeline_classt   _failed_cache(   R   R"   R#   R$   R%   R(   (    (    s/   lib/python2.7/site-packages/numba/dispatcher.pyR   )   s    					c         C` sF   d   } d   } d   } t  |  j | | | | |  } |  j | f S(   s   
        Given positional and named argument types, fold keyword arguments
        and resolve defaults by inserting types.Omitted() instances.

        A (pysig, argument types) tuple is returned.
        c         S` s   | S(   N(    (   t   indext   paramR   (    (    s/   lib/python2.7/site-packages/numba/dispatcher.pyt   normal_handler=   s    c         S` s   t  j |  S(   N(   R   R   (   R*   R+   t   default(    (    s/   lib/python2.7/site-packages/numba/dispatcher.pyt   default_handler?   s    c         S` s   t  j |  S(   N(   R   t   Tuple(   R*   R+   t   values(    (    s/   lib/python2.7/site-packages/numba/dispatcher.pyt   stararg_handlerA   s    (   R   R'   (   R   t   argst   kwsR,   R.   R1   (    (    s/   lib/python2.7/site-packages/numba/dispatcher.pyt   fold_argument_types6   s    				c         C` s,   |  j  | |  \ } } | r" | S|  d  S(   N(   t   _compile_cached(   R   R2   t   return_typet   statust   retval(    (    s/   lib/python2.7/site-packages/numba/dispatcher.pyt   compileK   s    c         C` s   t  |  | f } y t |  j | f SWn t k
 r: n Xy |  j | |  } Wn* t j k
 r} } | |  j | <t | f SXt | f Sd  S(   N(   t   tuplet   FalseR)   t   KeyErrort   _compile_coreR	   t   TypingErrort   True(   R   R2   R6   t   keyR8   t   e(    (    s/   lib/python2.7/site-packages/numba/dispatcher.pyR5   R   s    c         C` s   t  j   } |  j j j | |  j  |  j |  } |  j | i   } t  j |  j j	 |  j j
 | d | d | d | d |  j d |  j } | j d  k	 r | j r | j  n  | S(   NR2   R6   t   flagsR%   R(   (   R   t   FlagsR#   t   optionst   parse_as_flagsR$   t   _customize_flagst   _get_implementationt   compile_extrat   typing_contextt   target_contextR%   R(   t   typing_errort   Nonet   enable_pyobject(   R   R2   R6   RB   t   implt   cres(    (    s/   lib/python2.7/site-packages/numba/dispatcher.pyR=   a   s    	c         C` s   t  j |  j  S(   N(   R   t#   _get_function_globals_for_reductionR"   (   R   (    (    s/   lib/python2.7/site-packages/numba/dispatcher.pyt   get_globals_for_reductionr   s    c         C` s   |  j  S(   N(   R"   (   R   R2   R3   (    (    s/   lib/python2.7/site-packages/numba/dispatcher.pyRG   u   s    c         C` s   | S(   N(    (   R   RB   (    (    s/   lib/python2.7/site-packages/numba/dispatcher.pyRF   x   s    (
   R   R   R   R4   R9   R5   R=   RQ   RG   RF   (    (    (    s/   lib/python2.7/site-packages/numba/dispatcher.pyR!   (   s   							t   _GeneratedFunctionCompilerc           B` s#   e  Z d    Z d   Z d   Z RS(   c         C` s2   t  t |   j | | | | |  t   |  _ d  S(   N(   t   superRR   R   t   sett   impls(   R   R"   R#   R$   R%   R(   (    (    s/   lib/python2.7/site-packages/numba/dispatcher.pyR   ~   s    c         C` s   t  j |  j  S(   N(   R   RP   R"   (   R   (    (    s/   lib/python2.7/site-packages/numba/dispatcher.pyRQ      s    c   	      C` s  |  j  | |   } t j |  j   } t j |  } t | j  t | j  k } | r x t | j j   | j j    D]] \ } } | j | j k s | j | j k s | j	 | j
 k	 ry | j	 | j	 k ry t } qy qy Wn  | s t d | | | f   n  |  j j |  | S(   Ns\   generated implementation %s should be compatible with signature '%s', but has signature '%s'(   R"   R   R&   t   lent
   parameterst   zipR0   t   namet   kindR-   t   emptyR;   t	   TypeErrorRU   t   add(	   R   R2   R3   RN   R'   t   implsigt   okt   pyparamt	   implparam(    (    s/   lib/python2.7/site-packages/numba/dispatcher.pyRG      s"    (   R   R   R   RQ   RG   (    (    (    s/   lib/python2.7/site-packages/numba/dispatcher.pyRR   |   s   		t   _CompileStatst
   cache_patht
   cache_hitst   cache_missest   _CompilingCounterc           B` s8   e  Z d  Z d   Z d   Z d   Z d   Z e Z RS(   sQ   
    A simple counter that increment in __enter__ and decrement in __exit__.
    c         C` s   d |  _  d  S(   Ni    (   t   counter(   R   (    (    s/   lib/python2.7/site-packages/numba/dispatcher.pyR      s    c         C` s(   |  j  d k s t  |  j  d 7_  d  S(   Ni    i   (   Rg   t   AssertionError(   R   (    (    s/   lib/python2.7/site-packages/numba/dispatcher.pyt	   __enter__   s    c         O` s(   |  j  d 8_  |  j  d k s$ t  d  S(   Ni   i    (   Rg   Rh   (   R   R2   t   kwargs(    (    s/   lib/python2.7/site-packages/numba/dispatcher.pyt   __exit__   s    c         C` s   |  j  d k S(   Ni    (   Rg   (   R   (    (    s/   lib/python2.7/site-packages/numba/dispatcher.pyt   __bool__   s    (   R   R   R   R   Ri   Rk   Rl   t   __nonzero__(    (    (    s/   lib/python2.7/site-packages/numba/dispatcher.pyRf      s   				t   _DispatcherBasec           B` s  e  Z d  Z d Z d   Z d   Z d   Z e d    Z e d    Z	 e
 d  Z d   Z d	   Z d
   Z d   Z e d    Z d   Z d d  Z d d  Z d d d  Z d d d  Z d d  Z d   Z d   Z d   Z d   Z d   Z RS(   s;   
    Common base class for dispatcher Implementations.
    R"   c      
   C` s"  t  |  _ t j   |  _ | |  _ t |  |  _ |  j |  _ t	 | j
  } |  j j pZ d } t	 d   | D  } y t | j
 j    d }	 Wn t k
 r t }
 n X|	 j |	 j k }
 t j j |  |  j j   | |  j | | | |
 | 	 | j |  _ t   |  _ t j |  |  j    d  S(   Nc         s` s   |  ] } t  |  Vq d  S(   N(   R   (   t   .0t   val(    (    s/   lib/python2.7/site-packages/numba/dispatcher.pys	   <genexpr>   s    i(    (   R
   t   _tmt   collectionst   OrderedDictt	   overloadsR"   R   t	   func_codet   __code__R:   RW   t   __defaults__t   listR0   t
   IndexErrorR;   RZ   t   VAR_POSITIONALR   t
   DispatcherR   t   get_pointert
   _fold_argsR   t   docRf   t   _compiling_counterR   t   finalizet   _make_finalizer(   R   t	   arg_countR"   R'   t   can_fallbackt   exact_match_requiredt   argnamest   default_valuest   defargst   lastargt   has_stararg(    (    s/   lib/python2.7/site-packages/numba/dispatcher.pyR      s,    		
	c         C` s   |  j    |  j j   d  S(   N(   t   _clearRt   t   clear(   R   (    (    s/   lib/python2.7/site-packages/numba/dispatcher.pyt   _reset_overloads   s    
c         ` s.   |  j    |  j  t j    f d  } | S(   sq   
        Return a finalizer function that will release references to
        related compiled functions.
        c         ` sP   |    r d  Sx<   j    D]. } y  j | j  Wq t k
 rG q Xq Wd  S(   N(   R0   t   remove_user_functiont   entry_pointR<   (   t   shutting_downRO   (   Rt   t	   targetctx(    s/   lib/python2.7/site-packages/numba/dispatcher.pyt	   finalizer   s    	(   Rt   R   R   R   (   R   R   (    (   Rt   R   s/   lib/python2.7/site-packages/numba/dispatcher.pyR      s    		c         C` s   t  |  j  S(   sA   
        Returns a list of compiled function signatures.
        (   Rx   Rt   (   R   (    (    s/   lib/python2.7/site-packages/numba/dispatcher.pyt
   signatures  s    c         C` s7   g  |  j  j   D]# } | j r | j r | j ^ q S(   N(   Rt   R0   t
   objectmodet
   interpmodet	   signature(   R   RO   (    (    s/   lib/python2.7/site-packages/numba/dispatcher.pyt   nopython_signatures  s    c         C` s0   | s" t  |  j  d k s" t  | |  _ d S(   s@   Disable the compilation of new signatures at call time.
        i    N(   RV   R   Rh   t   _can_compile(   R   Rp   (    (    s/   lib/python2.7/site-packages/numba/dispatcher.pyt   disable_compile  s    "c         C` s^   t  | j j  } g  | D] } | j ^ q } |  j | | j | j | j  | |  j | <d  S(   N(	   R:   R   R2   t   _codet   _insertR   R   R   Rt   (   R   RO   R2   t   at   sig(    (    s/   lib/python2.7/site-packages/numba/dispatcher.pyt   add_overload  s    c         C` s   |  j  j | |  S(   N(   t	   _compilerR4   (   R   R2   R3   (    (    s/   lib/python2.7/site-packages/numba/dispatcher.pyR4     s    c         C` s   |  j  j | |  \ } } i  } |  j r@ |  j t |   n  |  j j } d j |  } t j	 | d | d |  j
 } | | | | f S(   s   
        Get a typing.ConcreteTemplate for this dispatcher and the given
        *args* and *kws* types.  This allows to resolve the return type.

        A (template, pysig, args, kws) tuple is returned.
        s   CallTemplate({0})R@   R   (   R   R4   R   R9   R:   R"   R   t   formatR   t   make_concrete_templateR   (   R   R2   R3   R'   t	   func_nameRY   t   call_template(    (    s/   lib/python2.7/site-packages/numba/dispatcher.pyt   get_call_template  s    	c         C` s)   t  j |  \ } } |  j t |  j S(   sG   
        Return the compiled function for the given signature.
        (   R   t   normalize_signatureRt   R:   R   (   R   R   R2   R6   (    (    s/   lib/python2.7/site-packages/numba/dispatcher.pyt   get_overload7  s    c         C` s   |  j  S(   sG   
        Whether a specialization is currently being compiled.
        (   R   (   R   (    (    s/   lib/python2.7/site-packages/numba/dispatcher.pyt   is_compiling>  s    c         O` sv  | s t   d   } g  } xO | D]G } t | t  rT | j t j | j   q# | j |  j |   q# Wy |  j t	 |   SWnt
 j k
 r} g  } x t |  D] \ } }	 t |	 t  r |	 j n |	 }
 y t |
 t j  } Wn, t k
 r} | j | t |  f  q X| d k r | j | d |
 f f  q q W| rt |  j   d d j d   | D  } | j |  n  | | d  n t
 j k
 r} | | d  n t
 j t
 j t
 j f k
 r} | | d  n t
 j k
 r} | | d	  na t k
 rq} t j rht | d
  rht
 j d } | j d j | j   |  qhn  |  n Xd S(   s   
        For internal use.  Compile a specialized version of the function
        for the given *args* and *kws*, and return the resulting callable.
        c         S` sb   t  j r6 t j | } |  j d j |  j  |  n  t  j rH |   n t t	 |   |  d  d S(   s{   
            Rewrite and raise Exception `e` with help supplied based on the
            specified issue_type.
            t    N(   R   t	   SHOW_HELPR	   t   error_extrast   patch_messaget   joinR2   t   FULL_TRACEBACKSR   t   typeRL   (   RA   t
   issue_typet   help_msg(    (    s/   lib/python2.7/site-packages/numba/dispatcher.pyt   error_rewriteL  s    	 		s'   cannot determine Numba type of value %rsC   

This error may have been caused by the following argument(s):
%s
s   
c         s` s%   |  ] \ } } d  | | f Vq d S(   s   - argument %d: %sN(    (   Ro   t   it   err(    (    s/   lib/python2.7/site-packages/numba/dispatcher.pys	   <genexpr>t  s   R   t   unsupported_errort   interpretert   constant_inferenceR   t
   reportableR   N(!   Rh   t
   isinstanceR   t   appendR   R   R   t   typeof_pyvalR9   R:   R	   R>   t	   enumerateR   R   t   argumentt
   ValueErrort   strRL   t   rstripR   R   t   UnsupportedErrort   NotDefinedErrort   RedefinedErrort   VerificationErrort   ConstantInferenceErrort	   ExceptionR   R   t   hasattrR   R2   (   R   R2   R3   R   t   argtypesR   RA   t   failed_argsR   t   argRp   t   tpt
   typeof_exct   msgR   (    (    s/   lib/python2.7/site-packages/numba/dispatcher.pyt   _compile_for_argsE  sR    		#c         ` sC   | d  k	 r&   j | j } | j   St   f d     j D  S(   Nc         3` s$   |  ] } |   j  |  f Vq d  S(   N(   t   inspect_llvm(   Ro   R   (   R   (    s/   lib/python2.7/site-packages/numba/dispatcher.pys	   <genexpr>  s    (   RL   Rt   t   libraryt   get_llvm_strt   dictR   (   R   R   t   lib(    (   R   s/   lib/python2.7/site-packages/numba/dispatcher.pyR     s    
c         ` sC   | d  k	 r&   j | j } | j   St   f d     j D  S(   Nc         3` s$   |  ] } |   j  |  f Vq d  S(   N(   t   inspect_asm(   Ro   R   (   R   (    s/   lib/python2.7/site-packages/numba/dispatcher.pys	   <genexpr>  s    (   RL   Rt   R   t   get_asm_strR   R   (   R   R   R   (    (   R   s/   lib/python2.7/site-packages/numba/dispatcher.pyR     s    
c   
      K` s1  | j  d t  } | j  d d  } |  j } | d k	 rP i |  j | | 6} n  | s | d k rn t j } n  x t j |  D]g \ } } t d |  j	 j
 | f d | t d d d | t | j d | t d d d | q~ WnA | d k	 rt d	   n  d
 d l m }	 |	 |  d | d | Sd S(   s"  
        print or return annotated source with Numba intermediate IR

        Pass `pretty=True` to attempt color highlighting, and HTML rendering in
        Jupyter and IPython by returning an Annotate Object. `file` must be
        None if used in conjunction with `pretty=True`.
        t   prettyt   styleR-   s   %s %st   filet   -iP   t   =s$   `file` must be None if `pretty=True`i   (   t   AnnotateR   N(   t   getR;   Rt   RL   t   syst   stdoutR   t	   iteritemst   printR"   R   t   type_annotationR   t   pretty_annotateR   (
   R   R   R   Rj   R   R   Rt   t   vert   resR   (    (    s/   lib/python2.7/site-packages/numba/dispatcher.pyt   inspect_types  s"    	 c         ` s   | d k	 rq   j | } | j }  d k r= | j j } n'  d k rX | j j } n | j j } | j |  St    f d     j	 D  S(   s  
        For inspecting the CFG of the function.

        By default the CFG of the user function is showed.  The *show_wrapper*
        option can be set to "python" or "cfunc" to show the python wrapper
        function or the *cfunc* wrapper function, respectively.
        t   pythont   cfuncc         3` s*   |  ]  } |   j  | d   f Vq d S(   t   show_wrapperN(   t   inspect_cfg(   Ro   R   (   R   R   (    s/   lib/python2.7/site-packages/numba/dispatcher.pys	   <genexpr>  s   N(
   RL   Rt   R   t   fndesct   llvm_cpython_wrapper_namet   llvm_cfunc_wrapper_namet   mangled_namet   get_function_cfgR   R   (   R   R   R   RO   R   t   fname(    (   R   R   s/   lib/python2.7/site-packages/numba/dispatcher.pyR     s    	c         C` s   | d k r |  j n | g } t j   } xe | D]] } |  j | } | j } | j j d t | j j	 d  | j
 f } | j   | | | <q1 W| S(   s   
        Gets the annotation information for the function specified by
        signature. If no signature is supplied a dictionary of signature to
        annotation information is returned.
        t   :i   N(   RL   R   Rr   Rs   Rt   R   t   func_idt   filenameR   t   firstlinenoR   t   annotate_raw(   R   R   R   t   outR   RO   t   taR@   (    (    s/   lib/python2.7/site-packages/numba/dispatcher.pyt   get_annotation_info  s    	!c         O` sj   | s t  d   t g  | D] } |  j |  ^ q  } |  j } |  j j |  j | | | d t d S(   s8   
        Callback for the C _Dispatcher object.
        s   kwargs not handledt   allow_ambiguousN(   Rh   R:   R   R   t	   typingctxt   resolve_overloadR"   R;   (   R   R2   R3   R   t   sigs(    (    s/   lib/python2.7/site-packages/numba/dispatcher.pyt   _explain_ambiguous  s
    (	c         O` sa   | s t  d   g  | D] } |  j |  ^ q } d d j t t |   } t |   d S(   s8   
        Callback for the C _Dispatcher object.
        s   kwargs not handleds.   No matching definition for argument type(s) %ss   , N(   Rh   R   R   t   mapR   R\   (   R   R2   R3   R   R   (    (    s/   lib/python2.7/site-packages/numba/dispatcher.pyt   _explain_matching_error  s
    "c         O` sz   | s t  d   g  | D] } |  j |  ^ q } t } x8 |  j D]- } |  j j | | j  } | rE t } qE qE W| S(   s   
        Callback for the C _Dispatcher object.
        Search for approximately matching signatures for the given arguments,
        and ensure the corresponding conversions are registered in the C++
        type manager.
        s   kwargs not handled(   Rh   R   R;   R   R   t   install_possible_conversionsR2   R?   (   R   R2   R3   R   t   foundR   t   conv(    (    s/   lib/python2.7/site-packages/numba/dispatcher.pyt   _search_new_conversions  s    "c         C` s   d t  |   j |  j f S(   Ns   %s(%s)(   R   R   R"   (   R   (    (    s/   lib/python2.7/site-packages/numba/dispatcher.pyR     s    c         C` sO   y t  | t j  } Wn t k
 r2 t j } n X| d k rK t j } n  | S(   s   
        Resolve the Numba type of Python value *val*.
        This is called from numba._dispatcher as a fallback if the native code
        cannot decide the type.
        N(   R   R   R   R   R   t   pyobjectRL   (   R   Rp   R   (    (    s/   lib/python2.7/site-packages/numba/dispatcher.pyR   	  s    N(   R   R   R   t	   __numba__R   R   R   R    R   R   R?   R   R   R4   R   R   R   R   RL   R   R   R   R   R   R   R   R   R   R   (    (    (    s/   lib/python2.7/site-packages/numba/dispatcher.pyRn      s0   	!							H		
		R{   c           B` s  e  Z d  Z e Z i e d 6e d 6Z e j	   Z
 e j d e j  Z d Z d Z i  i  d e j d  Z e d    Z d   Z d d  Z d	   Z e d
    Z e d    Z d   Z e j d    Z  d   Z! e d    Z" d d d  Z# d d  Z$ RS(   s   
    Implementation of user-facing dispatcher objects (i.e. created using
    the @jit decorator).
    This is an abstract base class. Subclasses should define the targetdescr
    class attribute.
    t   directt	   generatedt   maxlenR"   c   
      C` s  |  j  j |  _ |  j  j |  _ t j |  } t | j  } | j	 d t
  } t j |  | | | | d t
 t j |  |  | |  _ | |  _ t   |  _ |  j | }	 | |  _ |	 | |  j  | | |  |  _ t j   |  _ t j   |  _ t j |   |  _ |  j j |  |  j  d S(   s  
        Parameters
        ----------
        py_func: function object to be compiled
        locals: dict, optional
            Mapping of local variable names to Numba types.  Used to override
            the types deduced by the type inference engine.
        targetoptions: dict, optional
            Target-specific config options.
        impl_kind: str
            Select the compiler mode for `@jit` and `@generated_jit`
        pipeline_class: type numba.compiler.BasePipeline
            The compiler pipeline type.
        t   nopythonR   N(   R#   RI   R   RJ   R   R   R&   RV   RW   R   R;   Rn   R   t	   functoolst   update_wrapperR$   R%   R   t   _cachet   _impl_kindst
   _impl_kindR   Rr   t   Countert   _cache_hitst   _cache_missesR   R{   t   _typet   insert_global(
   R   R"   R%   R$   t	   impl_kindR(   R'   R   R   t   compiler_class(    (    s/   lib/python2.7/site-packages/numba/dispatcher.pyR   /  s&    			c         C` s   t  j |   S(   N(   R   R{   (   R   (    (    s/   lib/python2.7/site-packages/numba/dispatcher.pyR   X  s    c         C` s   t  |  j  |  _ d  S(   N(   R   R"   R	  (   R   (    (    s/   lib/python2.7/site-packages/numba/dispatcher.pyt   enable_caching\  s    c         C` s!   | d k r |  St |  |  Sd S(   s9   Allow a JIT function to be bound as a method to an objectN(   RL   R   (   R   t   objt   objtype(    (    s/   lib/python2.7/site-packages/numba/dispatcher.pyt   __get___  s    c      	   C` s   |  j  r g  } n% g  |  j j   D] } | j ^ q" } |  j j   } t j |  j t	 |  j
  t j |  j |  |  j |  j |  j |  j  | f f S(   s   
        Reduce the instance for pickling.  This will serialize
        the original function as well the compilation options and
        compiled signatures, but not the compiled code itself.
        (   R   Rt   R0   R   R   RQ   R   t   _rebuild_reductiont	   __class__R   t   _uuidt   _reduce_functionR"   R%   R$   R  (   R   R   t   crt   globs(    (    s/   lib/python2.7/site-packages/numba/dispatcher.pyt
   __reduce__f  s    		%c         C` s   y |  j  | SWn t k
 r" n Xt j |   } |  | | | |  }	 |	 j |  x | D] }
 |	 j |
  q[ W| |	 _ |	 S(   sK   
        Rebuild an Dispatcher instance after it was __reduce__'d.
        (   t   _memoR<   R   t   _rebuild_functiont	   _set_uuidR9   R   (   t   clst   uuidt   func_reducedR%   R$   R  t   can_compileR   R"   R   R   (    (    s/   lib/python2.7/site-packages/numba/dispatcher.pyt   _rebuildw  s    	c         C` s;   |  j  } | d k r7 t t j    } |  j |  n  | S(   s   
        An instance-specific UUID, to avoid multiple deserializations of
        a given instance.

        Note this is lazily-generated, for performance reasons.
        N(   t   _Dispatcher__uuidRL   R   R"  t   uuid1R   (   R   t   u(    (    s/   lib/python2.7/site-packages/numba/dispatcher.pyR    s
    	c         C` s?   |  j  d  k s t  | |  _  |  |  j | <|  j j |   d  S(   N(   R&  RL   Rh   R  t   _recentR   (   R   R(  (    (    s/   lib/python2.7/site-packages/numba/dispatcher.pyR     s    	c         C` s?  |  j  s t d   n  |  j t j |  \ } } |  j j t |   } | d  k	 rb | j	 S|  j
 j | |  j  } | d  k	 r |  j | c d 7<| j r | j r |  j j | j	 | j | j g  n  |  j |  | j	 S|  j | c d 7<|  j j | |  } |  j |  |  j
 j | |  | j	 SWd  QXd  S(   Ns   compilation disabledi   (   R   t   RuntimeErrorR   R   R   Rt   R   R:   RL   R   R	  t   load_overloadR   R  R   R   t   insert_user_functionR   R   R   R  R   R9   t   save_overload(   R   R   R2   R6   t   existingRO   (    (    s/   lib/python2.7/site-packages/numba/dispatcher.pyR9     s(    	
c         C` sx   t  |  j  } |  j } |  j     |  j   |  j j   t |  _ z" x | D] } |  j |  qO WWd | |  _ Xd S(   s2   
        Recompile all signatures afresh.
        N(	   Rx   Rt   R   R   R   R	  t   flushR?   R9   (   R   R   t   old_can_compileR   (    (    s/   lib/python2.7/site-packages/numba/dispatcher.pyt	   recompile  s    	
	c         C` s%   t  d |  j j d |  j d |  j  S(   NRc   Rd   Re   (   Rb   R	  Rc   R  R  (   R   (    (    s/   lib/python2.7/site-packages/numba/dispatcher.pyt   stats  s    	i   c         ` sO      f d   } | d k	 r+ | |  n  g   j D] } | |  ^ q5 d S(   s2  
        Print parallel diagnostic information for the given signature. If no
        signature is present it is printed for all known signatures. level is
        used to adjust the verbosity, level=1 (default) is minimal verbosity,
        and 2, 3, and 4 provide increasing levels of verbosity.
        c         ` sT    j  |  } | j j d d   } | d  k rC d } t |   n  | j    d  S(   Nt   parfor_diagnosticss8   No parfors diagnostic available, is 'parallel=True' set?(   Rt   t   metadataR   RL   R   t   dump(   R   t   olt   pfdiagR   (   t   levelR   (    s/   lib/python2.7/site-packages/numba/dispatcher.pyR5    s    N(   RL   R   (   R   R   R8  R5  R   (    (   R8  R   s/   lib/python2.7/site-packages/numba/dispatcher.pyt   parallel_diagnostics  s    c         ` s;   | d k	 r   j | j St   f d     j D  Sd S(   sH   
        Obtain the compilation metadata for a given signature.
        c         3` s%   |  ] } |   j  | j f Vq d  S(   N(   Rt   R4  (   Ro   R   (   R   (    s/   lib/python2.7/site-packages/numba/dispatcher.pys	   <genexpr>  s    N(   RL   Rt   R4  R   R   (   R   R   (    (   R   s/   lib/python2.7/site-packages/numba/dispatcher.pyt   get_metadata  s    N(%   R   R   R   R?   R}   R!   RR   R
  t   weakreft   WeakValueDictionaryR  Rr   t   dequeR   t   FUNCTION_CACHE_SIZER)  RL   R&  R  R   t   PipelineR   R    R   R  R  R  t   classmethodR%  R  R   t   global_compiler_lockR9   R1  R2  R9  R:  (    (    (    s/   lib/python2.7/site-packages/numba/dispatcher.pyR{     s.   
(				t
   LiftedCodec           B` sA   e  Z d  Z e Z d   Z d   Z d   Z e j	 d    Z
 RS(   s   
    Implementation of the hidden dispatcher objects used for lifted code
    (a lifted loop is really compiled as a separate function).
    c      	   C` st   | |  _  d  |  _ | |  _ | |  _ | |  _ | |  _ t j |  |  j  j	 |  j  j
 j |  j  j
 j d t d t d  S(   NR   R   (   t   func_irRL   t   lifted_fromR   R   RB   R%   Rn   R   R   R   t   funcR'   R?   R;   (   R   RC  R   R   RB   R%   (    (    s/   lib/python2.7/site-packages/numba/dispatcher.pyR     s    						c         C` s   |  j  j j S(   s5   Return the starting line number of the loop.
        (   RC  t   loct   line(   R   (    (    s/   lib/python2.7/site-packages/numba/dispatcher.pyt   get_source_location  s    c         C` s   d S(   s   Pre-compile actions
        N(    (   R   R2   R6   RB   (    (    s/   lib/python2.7/site-packages/numba/dispatcher.pyt   _pre_compile  s    c         C` s  |  j   |  j } t j |  \ } } |  j j t |   } | d  k	 rS | j S|  j	 | | |  |  j
 j   } t j d |  j d |  j d | d | d | d | d |  j d d d	 |  j d
 t  
} | j d  k	 r | j r | j  n  |  j |  | j SWd  QXd  S(   NR   R   RC  R2   R6   RB   R%   t   liftedRD  t   is_lifted_loop(    (   R   RB   R   R   Rt   R   R:   RL   R   RI  RC  t   copyR   t
   compile_irR   R   R%   RD  R?   RK   RM   R   (   R   R   RB   R2   R6   R.  t   cloned_func_irRO   (    (    s/   lib/python2.7/site-packages/numba/dispatcher.pyR9     s(    
				(   R   R   R   R;   R}   R   RH  RI  R   RA  R9   (    (    (    s/   lib/python2.7/site-packages/numba/dispatcher.pyRB    s   			t
   LiftedLoopc           B` s   e  Z d    Z RS(   c         C` s   | j  s t d   d  S(   Ns   Enable looplift flags is on(   t   enable_loopliftRh   (   R   R2   R6   RB   (    (    s/   lib/python2.7/site-packages/numba/dispatcher.pyRI  4  s    (   R   R   RI  (    (    (    s/   lib/python2.7/site-packages/numba/dispatcher.pyRO  3  s   t
   LiftedWithc           B` s    e  Z e d     Z d   Z RS(   c         C` s   t  j |   S(   N(   R   R{   (   R   (    (    s/   lib/python2.7/site-packages/numba/dispatcher.pyR   9  s    c         C` sn   |  j  r |  j t |   n  d } |  j j } d j |  } t j | d | d |  j	 } | | | | f S(   s   
        Get a typing.ConcreteTemplate for this dispatcher and the given
        *args* and *kws* types.  This enables the resolving of the return type.

        A (template, pysig, args, kws) tuple is returned.
        s   CallTemplate({0})R@   R   N(
   R   R9   R:   RL   R"   R   R   R   R   R   (   R   R2   R3   R'   R   RY   R   (    (    s/   lib/python2.7/site-packages/numba/dispatcher.pyR   =  s    	(   R   R   R    R   R   (    (    (    s/   lib/python2.7/site-packages/numba/dispatcher.pyRQ  8  s   t   ObjModeLiftedWithc           B` s2   e  Z d    Z e d    Z d   Z d   Z RS(   c         O` sk   | j  d d   |  _ t t |   j | |   |  j j sI t d   n  |  j d  k rg t	 d   n  d  S(   Nt   output_typess    expecting `flags.force_pyobject`s   `output_types` must be provided(
   t   popRL   RS  RS   RQ  R   RB   t   force_pyobjectR   R\   (   R   R2   Rj   (    (    s/   lib/python2.7/site-packages/numba/dispatcher.pyR   T  s    c         C` s   t  j |   S(   N(   R   t   ObjModeDispatcher(   R   (    (    s/   lib/python2.7/site-packages/numba/dispatcher.pyR   \  s    c         C` s   | s t   |  j |  t j g t |  } |  j rO |  j t |   n  t j	 |  j
 |  g } d } |  j j } d j |  } t j | d | d | } | | | | f S(   s   
        Get a typing.ConcreteTemplate for this dispatcher and the given
        *args* and *kws* types.  This enables the resolving of the return type.

        A (template, pysig, args, kws) tuple is returned.
        s   CallTemplate({0})R@   R   N(   Rh   t   _legalize_arg_typesR   t   ffi_forced_objectRV   R   R9   R:   R   R   RS  RL   R"   R   R   R   (   R   R2   R3   R   R'   R   RY   R   (    (    s/   lib/python2.7/site-packages/numba/dispatcher.pyR   `  s    	c         C` s   x t  | d d D]r \ } } t | t j  rR d } t j | j |    q t | t j  r d } t j | j |    q q Wd  S(   Nt   starti   s>   Does not support list type inputs into with-context for arg {}sB   Does not support function type inputs into with-context for arg {}(   R   R   R   t   ListR	   R>   R   R{   (   R   R2   R   R   R   (    (    s/   lib/python2.7/site-packages/numba/dispatcher.pyRW  x  s    (   R   R   R   R    R   R   RW  (    (    (    s/   lib/python2.7/site-packages/numba/dispatcher.pyRR  S  s   		c         c` s$   |  ] } t  |  | j f Vq d  S(   N(   R   R   (   Ro   t   t(    (    s/   lib/python2.7/site-packages/numba/dispatcher.pys	   <genexpr>  s    (6   t
   __future__R    R   R   Rr   R  t   ost   structR   R"  R;  RL  R   t   numbaR   R   R   R   R   R	   t   numba.typeconv.rulesR
   R   R   R   t   numba.typing.templatesR   t   numba.typing.typeofR   R   t   numba.bytecodeR   t	   numba.sixR   R   t   cachingR   R   t   objectR   R!   RR   t
   namedtupleRb   Rf   R{   Rn   RB  RO  RQ  RR  t   typeof_initR   t   number_domain(    (    (    s/   lib/python2.7/site-packages/numba/dispatcher.pyt   <module>   s@   .T& `C6