ó
mÜJ]c           @` sQ  d  Z  d d l m Z m Z m Z d d l Z e j e ƒ Z d d l	 Z	 d Z
 y d d l j Z Wn e k
 r d d l Z n Xd „  Z d d l m Z m Z m Z y e e e ƒ ƒ e ƒ Wn, e k
 rï e e ƒ e e d	 „ ƒ Z n X[ [ e	 j d
  d k  r'd „  Z d „  Z d „  Z n& d d l m Z e d „  Z d „  Z d S(   s!    Utilities for Py2/Py3 interop.

i    (   t   absolute_importt   divisiont   print_functionNt   format_signaturet   get_param_infot   with_metaclassc         ` s/   d ˆ f ‡  ‡ f d †  ƒ  Y} | d d i  ƒ S(   s!   Add metaclasses in both Python 2 and Python 3.

    Function from jinja2/_compat.py. License: BSD.

    Use it like this::

        class BaseForm(object):
            pass

        class FormType(type):
            pass

        class Form(with_metaclass(FormType, BaseForm)):
            pass

    This requires a bit of explanation: the basic idea is to make a
    dummy metaclass for one level of class instantiation that replaces
    itself with the actual metaclass.  Because of internal type checks
    we also need to make sure that we downgrade the custom metaclass
    for one level to something closer to type (that's why __call__ and
    __init__ comes back from type etc.).

    This has the advantage over six.with_metaclass of not introducing
    dummy classes into the final MRO.
    t	   metaclassc           ` s,   e  Z e j Z e j Z ‡  ‡ f d  †  Z RS(   c         ` s2   | d  k r" t j |  | d | ƒ Sˆ | ˆ  | ƒ S(   N(    (   t   Nonet   typet   __new__(   t   clst   namet
   this_basest   d(   t   basest   meta(    s0   lib/python2.7/site-packages/bokeh/util/future.pyR	   P   s    (   t   __name__t
   __module__R   t   __call__t   __init__R	   (    (   R   R   (    s0   lib/python2.7/site-packages/bokeh/util/future.pyR   M   s   		t   temporary_classN(   R   (   R   R   R   (    (   R   R   s0   lib/python2.7/site-packages/bokeh/util/future.pyR   3   s    (   t   wrapst   partialt   WRAPPER_ASSIGNMENTSc         ` s    | ˆ  d ‡  f d †  | Dƒ ƒS(   Nt   assignedc         3` s$   |  ] } t  ˆ  | ƒ r | Vq d  S(   N(   t   hasattr(   t   .0R   (   t   obj(    s0   lib/python2.7/site-packages/bokeh/util/future.pys	   <genexpr>q   s    (    (   R   t
   attr_namesR   (    (   R   s0   lib/python2.7/site-packages/bokeh/util/future.pyR   o   s    i   i   i   c         C` s8  d d l  m } m } m } d d l m } | |  ƒ sD | |  ƒ rs | |  ƒ } | |  ƒ ro | j j d ƒ n  | St |  | ƒ r| |  j	 ƒ } d | j k r³ | j j d ƒ n  |  j
 d  k	 rï x* |  j
 j ƒ  D] } | j j | ƒ qÒ Wn  x |  j D] } | j d =qù W| S| |  j ƒ } | j j d ƒ | Sd  S(   Ni    (   t
   getargspect
   isfunctiont   ismethod(   R   t   self(   t   inspectR   R   R   t	   functoolsR   t   argst   removet
   isinstancet   funct   keywordsR   t   keysR   (   R&   R   R   R   R   t   sigR   t   val(    (    s0   lib/python2.7/site-packages/bokeh/util/future.pyt	   signature{   s(     c         C` s   d d l  m } | |  Œ  S(   Ni    (   t   formatargspec(   R!   R,   (   R)   R,   (    (    s0   lib/python2.7/site-packages/bokeh/util/future.pyR   ˜   s    c         C` s   |  j  |  j p g  f S(   N(   R#   t   defaults(   R)   (    (    s0   lib/python2.7/site-packages/bokeh/util/future.pyR   œ   s    (   R+   c         C` s
   t  |  ƒ S(   N(   t   str(   R)   (    (    s0   lib/python2.7/site-packages/bokeh/util/future.pyR   ¢   s    c         C` sX   g  } x< |  j  j ƒ  D]+ } | j | j k	 r | j | j ƒ q q Wt |  j  ƒ | f S(   N(   t
   parameterst   valuest   defaultt   emptyt   appendt   list(   R)   R-   t   param(    (    s0   lib/python2.7/site-packages/bokeh/util/future.pyR   ¥   s
    (   R   R   R   (   i   i   (   t   __doc__t
   __future__R    R   R   t   loggingt	   getLoggerR   t   logt   syst   __all__t   collections.abct   abct   collections_abct   ImportErrort   collectionsR   R"   R   R   R   t   AttributeErrort   version_infoR+   R   R   R!   (    (    (    s0   lib/python2.7/site-packages/bokeh/util/future.pyt   <module>	   s6     	7			 	