
 m[c           @` s  d  Z  d d l m Z m Z m Z d d l Z d d l 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 Z d d l 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 Z d d l Z d d l Z d d l m Z m Z d d l  Z! d d l" Z" d d l# m$ Z$ m% Z% d d	 l# m& Z& m' Z' d
   Z( e$ d  d e) f d     Y Z* e$ d  d e* f d     Y Z+ e$ d  d e* f d     Y Z, e$ d  d e* f d     Y Z- e$ d  d e* f d     Y Z. e$ d  d e* f d     Y Z/ d e) f d     YZ0 d   Z1 d e) f d     YZ2 d e3 f d     YZ4 d e5 f d      YZ6 d!   Z7 d"   Z8 d# e) f d$     YZ9 e$ d  d%    Z: d&   Z; e$ d  d'    Z< e$ d  d(    Z= d)   Z> d*   Z? d+   Z@ e$ d  d,    ZA d-   ZB d. eC d d/  ZE e
 jF d0 d d1   ZG d2   ZH d3   ZI eJ d4  ZK eH d5  ZL e$ d d6  d7 e) f d8     Y ZM e$ d  d9 eN f d:     Y ZO e$ d  d; d<   ZP e$ d  d= e) f d>     Y ZQ d? d@  ZR dA e) f dB     YZS eS   ZT e$ d  dC    ZU e$ d  dD e) f dE     Y ZV e$ d  dF    ZW e$ d dG dH dI    ZX e jY dJ  ZZ i  Z[ dK   Z\ dL d d dM  Z] e$ d  dN    Z^ e$ d  dO dP   Z_ e$ d  d dQ   Z` e$ d  dR    Za e$ d  dS    Zb e$ d  dT    Zc e$ d  dU    Zd dV eN f dW     YZe dX e) f dY     YZf e$ d  eC dZ   Zg e$ d  d[    Zh e$ d  d\    Zi d d]  Zj d^ Zk d_   Zl e$ d  d`    Zm eC da  Zn e jo eC db  Zp dc e) f dd     YZq de   Zr e$ d dG df dg    Zs dh   Zt di d d eC dj  Zu e$ d  eJ dk   Zv i dl dm 6dn do 6dp dq 6dr ds 6Zw dt   e jx ew  D Zy e$ du  dv    Zz dw   Z{ dx   Z| dy   Z} dz   Z~ d{   Z d| d}  Z d~ e) f d     YZ d e) f d     YZ d   Z d   Z d   Z i d   d 6e d 6e d 6e d 6e d 6Z d   Z d   Z d   Z d d d d d  Z d   Z d Z d e) f d     YZ d e) f d     YZ d e) f d     YZ e j e d e j d  d  Z d   Z d   Z e
 jF d    Z d S(   s   
A collection of utility functions and classes.  Originally, many
(but not all) were from the Python Cookbook -- hence the name cbook.

This module is safe to import from anywhere within matplotlib;
it imports matplotlib only at runtime.
i    (   t   absolute_importt   divisiont   print_functionN(   t   xranget   zip(   t   repeat(   t   reft   WeakKeyDictionaryi   (   t
   deprecatedt   warn_deprecated(   t   mplDeprecationt   MatplotlibDeprecationWarningc         C` s   t  |  t  r y/ t j t j d  j   } | s= d  } n  Wn  t t	 t
 f k
 r` d  } n X| d  k rz t j |   St j |  |  Sn  |  S(   Ns   axes.formatter.use_locale(   t
   isinstancet   bytest   localet   getpreferredencodingt
   matplotlibt   rcParamst   stript   Nonet
   ValueErrort   ImportErrort   AttributeErrort   sixt	   text_type(   t   st   preferredencoding(    (    s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pyt   unicode_safe)   s    
s   2.1t	   converterc           B` s/   e  Z d  Z d d d  Z d   Z d   Z RS(   s[   
    Base class for handling string -> python type with support for
    missing values
    t   Nullc         C` s   | |  _  | |  _ d  S(   N(   t   missingt
   missingval(   t   selfR   R   (    (    s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pyt   __init__H   s    	c         C` s   | |  j  k r |  j S| S(   N(   R   R   (   R    R   (    (    s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pyt   __call__L   s    c         C` s   | j    p | |  j k S(   N(   R   R   (   R    R   (    (    s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pyt
   is_missingQ   s    N(   t   __name__t
   __module__t   __doc__R   R!   R"   R#   (    (    (    s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pyR   B   s   	t   tostrc           B` s   e  Z d  Z d d d  Z RS(   s   convert to string or NoneR   t    c         C` s   t  j |  d | d | d  S(   NR   R   (   R   R!   (   R    R   R   (    (    s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pyR!   X   s    (   R$   R%   R&   R!   (    (    (    s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pyR'   U   s   t
   todatetimec           B` s)   e  Z d  Z d d d d  Z d   Z RS(   s   convert to a datetime or Nones   %Y-%m-%dR   c         C` s    t  j |  | |  | |  _ d S(   s8   use a :func:`time.strptime` format string for conversionN(   R   R!   t   fmt(   R    R*   R   R   (    (    s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pyR!   _   s    c         C` s<   |  j  |  r |  j St j | |  j  } t j | d    S(   Ni   (   R#   R   t   timet   strptimeR*   t   datetime(   R    R   t   tup(    (    s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pyR"   d   s    N(   R$   R%   R&   R   R!   R"   (    (    (    s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pyR)   \   s   t   todatec           B` s)   e  Z d  Z d d d d  Z d   Z RS(   s   convert to a date or Nones   %Y-%m-%dR   c         C` s    t  j |  | |  | |  _ d S(   s8   use a :func:`time.strptime` format string for conversionN(   R   R!   R*   (   R    R*   R   R   (    (    s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pyR!   n   s    c         C` s<   |  j  |  r |  j St j | |  j  } t j | d    S(   Ni   (   R#   R   R+   R,   R*   R-   t   date(   R    R   R.   (    (    s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pyR"   s   s    N(   R$   R%   R&   R   R!   R"   (    (    (    s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pyR/   k   s   t   tofloatc           B` s&   e  Z d  Z d d d  Z d   Z RS(   s   convert to a float or NoneR   c         C` s   t  j |  |  | |  _ d  S(   N(   R   R!   R   (   R    R   R   (    (    s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pyR!   }   s    c         C` s    |  j  |  r |  j St |  S(   N(   R#   R   t   float(   R    R   (    (    s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pyR"      s    N(   R$   R%   R&   R   R!   R"   (    (    (    s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pyR1   z   s   t   tointc           B` s&   e  Z d  Z d d d  Z d   Z RS(   s   convert to an int or NoneR   c         C` s   t  j |  |  d  S(   N(   R   R!   (   R    R   R   (    (    s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pyR!      s    c         C` s    |  j  |  r |  j St |  S(   N(   R#   R   t   int(   R    R   (    (    s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pyR"      s    N(   R$   R%   R&   R   R!   R"   (    (    (    s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pyR3      s   t   _BoundMethodProxyc           B` s_   e  Z d  Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z	 d   Z
 d	   Z RS(
   s  
    Our own proxy object which enables weak references to bound and unbound
    methods and arbitrary callables. Pulls information about the function,
    class, and instance out of a bound method. Stores a weak reference to the
    instance to support garbage collection.

    @organization: IBM Corporation
    @copyright: Copyright (c) 2005, 2006 IBM Corporation
    @license: The BSD License

    Minor bugfixes by Michael Droettboom
    c         C` s   t  |  |  _ g  |  _ y y@ t j rB t | j |  j  |  _ n t | j	 |  j  |  _ Wn t
 k
 rw d  |  _ n Xt j r | j |  _ | j j |  _ n | j |  _ | j |  _ Wn, t k
 r d  |  _ | |  _ d  |  _ n Xd  S(   N(   t   hasht   _hasht   _destroy_callbacksR   t   PY3R   t   __self__t   _destroyt   instt   im_selft	   TypeErrorR   t   __func__t   funct	   __class__t   klasst   im_funct   im_classR   (   R    t   cb(    (    s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pyR!      s$    					c         C` s   |  j  j t |   d  S(   N(   R8   t   appendR5   (   R    t   callback(    (    s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pyt   add_destroy_callback   s    c         C` s:   x3 |  j  D]( } y | |   Wq
 t k
 r1 q
 Xq
 Wd  S(   N(   R8   t   ReferenceError(   R    t   wkRG   (    (    s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pyR;      s
    c         C` s9   |  j  j   } | d } | d  k	 r5 |   | d <n  | S(   NR<   (   t   __dict__t   copyR   (   R    t   dR<   (    (    s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pyt   __getstate__   s
    
c         C` s5   | |  _  | d } | d  k	 r1 t |  |  _ n  d  S(   NR<   (   RK   R   R   R<   (   R    t	   statedictR<   (    (    s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pyt   __setstate__   s    	
c         O` sm   |  j  d k	 r* |  j    d k r* t  n6 |  j  d k	 rW t j |  j |  j     } n	 |  j } | | |   S(   s   
        Proxy for a call to the weak referenced object. Take
        arbitrary params to pass to the callable.

        Raises `ReferenceError`: When the weak reference refers to
        a dead object
        N(   R<   R   RI   t   typest
   MethodTypeR@   (   R    t   argst   kwargst   mtd(    (    s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pyR"      s    !		c         C` ss   yZ |  j  d k r1 |  j | j k o0 | j  d k S|  j | j k oX |  j    | j    k SWn t k
 rn t SXd S(   sa   
        Compare the held function and instance with that held by
        another proxy.
        N(   R<   R   R@   t	   Exceptiont   False(   R    t   other(    (    s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pyt   __eq__   s    ,c         C` s   |  j  |  S(   s$   
        Inverse of __eq__.
        (   RY   (   R    RX   (    (    s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pyt   __ne__   s    c         C` s   |  j  S(   N(   R7   (   R    (    (    s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pyt   __hash__   s    (   R$   R%   R&   R!   RH   R;   RN   RP   R"   RY   RZ   R[   (    (    (    s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pyR5      s   								c         C` s   t  j   d  S(   N(   t	   tracebackt	   print_exc(   t   exc(    (    s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pyt   _exception_printer   s    t   CallbackRegistryc           B` sP   e  Z d  Z e d  Z d   Z d   Z d   Z d   Z d   Z	 d   Z
 RS(   s  Handle registering and disconnecting for a set of signals and callbacks:

        >>> def oneat(x):
        ...    print('eat', x)
        >>> def ondrink(x):
        ...    print('drink', x)

        >>> from matplotlib.cbook import CallbackRegistry
        >>> callbacks = CallbackRegistry()

        >>> id_eat = callbacks.connect('eat', oneat)
        >>> id_drink = callbacks.connect('drink', ondrink)

        >>> callbacks.process('drink', 123)
        drink 123
        >>> callbacks.process('eat', 456)
        eat 456
        >>> callbacks.process('be merry', 456) # nothing will be called
        >>> callbacks.disconnect(id_eat)
        >>> callbacks.process('eat', 456)      # nothing will be called

    In practice, one should always disconnect all callbacks when they
    are no longer needed to avoid dangling references (and thus memory
    leaks).  However, real code in matplotlib rarely does so, and due
    to its design, it is rather difficult to place this kind of code.
    To get around this, and prevent this class of memory leaks, we
    instead store weak references to bound methods only, so when the
    destination object needs to die, the CallbackRegistry won't keep
    it alive.  The Python stdlib weakref module can not create weak
    references to bound methods directly, so we need to create a proxy
    object to handle weak references to bound methods (or regular free
    functions).  This technique was shared by Peter Parente on his
    `"Mindtrove" blog
    <http://mindtrove.info/python-weak-references/>`_.


    Parameters
    ----------
    exception_handler : callable, optional
       If provided must have signature ::

          def handler(exc: Exception) -> None:

       If not None this function will be called with any `Exception`
       subclass raised by the callbacks in `CallbackRegistry.process`.
       The handler may either consume the exception or re-raise.

       The callable must be pickle-able.

       The default handler is ::

          def h(exc):
              traceback.print_exc()

    c         C` s+   | |  _  t   |  _ d |  _ i  |  _ d  S(   Ni    (   t   exception_handlert   dictt	   callbackst   _cidt   _func_cid_map(   R    Ra   (    (    s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pyR!   8  s    		c         C` s   i |  j  d 6S(   NRa   (   Ra   (   R    (    (    s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pyRN   F  s    c         C` s   |  j  |   d  S(   N(   R!   (   R    t   state(    (    s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pyRP   I  s    c         C` s   |  j  j | t    t |  } | |  j  | k rD |  j  | | S| j |  j  |  j d 7_ |  j } | |  j  | | <|  j j | t    | |  j | | <| S(   sC   Register *func* to be called when signal *s* is generated.
        i   (	   Re   t
   setdefaultR   R5   RH   t   _remove_proxyRd   Rc   Rb   (   R    R   R@   t   proxyt   cid(    (    s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pyt   connectL  s    	c         C` s   x t  t j |  j   D]f \ } } y |  j | | | =Wn t k
 rN n Xt |  j |  d k r |  j | =|  j | =q q Wd  S(   Ni    (   t   listR   t	   iteritemsRe   Rc   t   KeyErrort   len(   R    Ri   t   signalt   proxies(    (    s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pyRh   ^  s    %
c         C` s   x t  t j |  j   D] \ } } y | | =Wn t k
 rF q q Xxb t  t j |  j   D]H \ } } x9 t  t j |   D]" \ } } | | k r | | =q q Wq` Wd Sq Wd S(   sC   Disconnect the callback registered with callback id *cid*.
        N(   Rl   R   Rm   Rc   Rn   Re   (   R    Rj   t	   eventnamet	   callbackdRp   t	   functionst   functiont   value(    (    s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pyt
   disconnecti  s    %"c         O` s   | |  j  k r x t t j |  j  |   D]r \ } } y | | |   Wq, t k
 ri |  j |  q, t k
 r } |  j d k	 r |  j |  q   q, Xq, Wn  d S(   s   
        Process signal *s*.

        All of the functions registered to receive callbacks on *s* will be
        called with ``*args`` and ``**kwargs``.
        N(	   Rc   Rl   R   Rm   RI   Rh   RV   Ra   R   (   R    R   RS   RT   Rj   Ri   R^   (    (    s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pyt   processy  s    )(   R$   R%   R&   R_   R!   RN   RP   Rk   Rh   Rw   Rx   (    (    (    s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pyR`      s   7					t   silent_listc           B` s>   e  Z d  Z d d  Z d   Z d   Z d   Z d   Z RS(   s   
    override repr when returning a list of matplotlib artists to
    prevent long, meaningless output.  This is meant to be used for a
    homogeneous list of a given type
    c         C` s)   | |  _  | d  k	 r% |  j |  n  d  S(   N(   t   typeR   t   extend(   R    Rz   t   seq(    (    s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pyR!     s    	c         C` s   d t  |   |  j f S(   Ns   <a list of %d %s objects>(   Ro   Rz   (   R    (    (    s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pyt   __repr__  s    c         C` s
   t  |   S(   N(   t   repr(   R    (    (    s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pyt   __str__  s    c         C` s   i |  j  d 6|  d 6S(   NRz   R|   (   Rz   (   R    (    (    s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pyRN     s    c         C` s"   | d |  _  |  j | d  d  S(   NRz   R|   (   Rz   R{   (   R    Rf   (    (    s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pyRP     s    N(	   R$   R%   R&   R   R!   R}   R   RN   RP   (    (    (    s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pyRy     s   			t   IgnoredKeywordWarningc           B` s   e  Z d  Z RS(   se   
    A class for issuing warnings about keyword arguments that will be ignored
    by matplotlib
    (   R$   R%   R&   (    (    (    s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pyR     s   c         G` se   |  } xX | D]P } | j  | d  } | d k	 r | d k rF | } q] t j d | t  q q W| S(   s  
    Enforces the priority of a local variable over potentially conflicting
    argument(s) from a kwargs dict. The following possible output values are
    considered in order of priority:

        local_var > kwargs[keys[0]] > ... > kwargs[keys[-1]]

    The first of these whose value is not None will be returned. If all are
    None then None will be returned. Each key in keys will be removed from the
    kwargs dict in place.

    Parameters
    ----------
        local_var: any object
            The local variable (highest priority)

        kwargs: dict
            Dictionary of keyword arguments; modified in place

        keys: str(s)
            Name(s) of keyword arguments to process, in descending order of
            priority

    Returns
    -------
        out: any object
            Either local_var or one of kwargs[key] for key in keys

    Raises
    ------
        IgnoredKeywordWarning
            For each key in keys that is removed from kwargs but not used as
            the output value

    s%   "%s" keyword argument will be ignoredN(   t   popR   t   warningst   warnR   (   t	   local_varRT   t   keyst   outt   keyt	   kwarg_val(    (    s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pyt   local_over_kwdict  s    $	c         C` s:   d } |  d	 d
 !}  x  | D] } |  j  | d  }  q W|  S(   s%   remove latex formatting from mathtexts   \mathdefaults   \rms   \cals   \tts   \its   \t   {t   }i   iR(   (   s   \mathdefaults   \rms   \cals   \tts   \its   \R   R   (   t   replace(   R   t   removet   r(    (    s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pyt
   strip_math  s
    t   Bunchc           B` s    e  Z d  Z d   Z d   Z RS(   s  
    Often we want to just collect a bunch of stuff together, naming each
    item of the bunch; a dictionary's OK for that, but a small do- nothing
    class is even handier, and prettier to use.  Whenever you want to
    group a few variables::

      >>> point = Bunch(datum=2, squared=4, coord=12)
      >>> point.datum

      By: Alex Martelli
      From: https://code.activestate.com/recipes/121294/
    c         K` s   |  j  j |  d  S(   N(   RK   t   update(   R    t   kwds(    (    s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pyR!     s    c         C` s*   d d j  d   t j t |    D  S(   Ns	   Bunch(%s)s   , c         s` s   |  ] } d  | Vq d S(   s   %s=%sN(    (   t   .0t   kv(    (    s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pys	   <genexpr>  s    (   t   joinR   Rm   t   vars(   R    (    (    s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pyR}     s    	(   R$   R%   R&   R!   R}   (    (    (    s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pyR     s   	c         C` s   t  t |    S(   s'   Return a list of unique elements of *x*(   Rl   t   set(   t   x(    (    s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pyt   unique  s    c         C` s'   y t  |   Wn t k
 r" t SXt S(   s    return true if *obj* is iterable(   t   iterR>   RW   t   True(   t   obj(    (    s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pyt   iterable  s
    c         C` s   t  |  t j t j t j f  S(   s(   Return True if *obj* looks like a string(   R   R   t   string_typest   npt   str_t   unicode_(   R   (    (    s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pyt   is_string_like  s    c         C` sy   t  |   s t St |   rT t |  t j  rT y |  j }  WqT t k
 rP t SXn  x |  D] } t |  s[ t Sq[ Wt S(   s6   Returns true if *obj* is iterable and contains strings(	   R   RW   R   R   R   t   ndarrayt   valuesR   R   (   R   t   o(    (    s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pyt   is_sequence_of_strings  s    c         C` s'   y t  |   Wn t k
 r" t SXt S(   s#   Returns true if *obj* can be hashed(   R6   R>   RW   R   (   R   (    (    s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pyt   is_hashable&  s
    c         C` s   t  t |  d d   S(   sC   return true if *obj* looks like a file object with a *write* methodt   writeN(   t   callablet   getattrR   (   R   (    (    s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pyt   is_writable_file_like/  s    c         C` s.   y |  j  d  Wn t k
 r% t SXt Sd S(   si   
    Returns `True` if the given writable file-like object requires Unicode
    to be written to it.
    R(   N(   R   R>   R   RW   (   R   (    (    s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pyt   file_requires_unicode4  s
    c         C` s   t  |  t j  o t |   S(   s;   return true if *obj* is not string like and is not iterable(   R   R   R   R   (   R   (    (    s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pyt	   is_scalarA  s    c         C` s   t  |  t j t j f  S(   s(   return true if *obj* looks like a number(   R   t   numberst   NumberR   t   number(   R   (    (    s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pyt
   is_numlikeG  s    t   rUc         C` s/  t  t d  rF t |  t j  rF t t j |   d | d | d | St |  t j  r |  j d  r | j	 d d  } t
 j |  |  } nZ |  j d  r d	 d
 l } | j	 d d  } | j |  |  } n t j |  | d | } t } n* t  |  d  r|  } t } n t d   | r+| | f S| S(   s   
    *fname* can be an `os.PathLike` or a file handle.  Support for gzipped
    files is automatic, if the filename ends in .gz.  *flag* is a
    read/write flag for :func:`file`
    t   PathLiket   flagt   return_openedt   encodings   .gzt   UR(   s   .bz2i    Nt   seeks'   fname must be a PathLike or file handle(   t   hasattrt   osR   R   t   to_filehandlet   fspathR   R   t   endswithR   t   gzipt   opent   bz2t   BZ2Filet   ioR   RW   R   (   t   fnameR   R   R   t   fhR   t   opened(    (    s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pyR   L  s*    !		
R   c         c` s?   t  |  | t |  \ } } | r6 | 
 | VWd QXn | Vd S(   s;   Pass through file objects and context-manage `.PathLike`\s.N(   R   R   (   t   path_or_filet   modeR   R   R   (    (    s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pyt   open_file_cmo  s
    c         C` s   t  |  t j  p t |   S(   s;   Return whether the given object is a scalar or string like.(   R   R   R   R   (   t   val(    (    s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pyt   is_scalar_or_stringz  s    c         C` si   t  |  t j  s t |   St d d  |  j   d	 k r? t S|  j   d
 k rU t St d |    d S(   s'   Parses the string argument as a booleans   2.2ss   Passing one of 'on', 'true', 'off', 'false' as a boolean is deprecated; use an actual boolean (True/False) instead.t   ont   truet   offt   falses;   String "%s" must be one of: "on", "off", "true", or "false"N(   R   R   (   R   R   (	   R   R   R   t   boolR	   t   lowerR   RW   R   (   R   (    (    s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pyt   _string_to_bool  s    
c         C` s   t  j d r t  j d } n t j j t  j   d  } t j j | |   } | r t j j |   d j   d k r~ d } n d } t j j |   \ } } | d	 k r t j	 | |  St	 | |  Sn | Sd
 S(   s  
    Return a sample data file.  *fname* is a path relative to the
    `mpl-data/sample_data` directory.  If *asfileobj* is `True`
    return a file object, otherwise just a file path.

    Set the rc parameter examples.directory to the directory where we should
    look, if sample_data files are stored in a location different than
    default (which is 'mpl-data/sample_data` at the same level of 'matplotlib`
    Python module files).

    If the filename ends in .gz, the file is implicitly ungzipped.
    s   examples.directoryt   sample_datais   .csvs   .xrcs   .txtR   t   rbs   .gzN(   s   .csvs   .xrcs   .txt(
   R   R   R   t   pathR   t   _get_data_patht   splitextR   R   R   (   R   t	   asfileobjt   rootR   R   t   baset   ext(    (    s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pyt   get_sample_data  s    		c         c` sT   xM |  D]E } | |  s% | d k r- | Vq x t | |  D] } | Vq= Wq Wd S(   s  
    Returns a generator of flattened nested containers

    For example:

        >>> from matplotlib.cbook import flatten
        >>> l = (('John', ['Hunter']), (1, 23), [[([42, (5, 23)], )]])
        >>> print(list(flatten(l)))
        ['John', 'Hunter', 1, 23, 42, 5, 23]

    By: Composite of Holger Krekel and Luther Blissett
    From: https://code.activestate.com/recipes/121294/
    and Recipe 1.12 in cookbook
    N(   R   t   flatten(   R|   t   scalarpt   itemt   subitem(    (    s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pyR     s
    s    sorted(..., key=itemgetter(...))t   Sorterc           B` s>   e  Z d  Z d   Z d d d  Z d d  Z e Z e Z RS(   se  
    Sort by attribute or item

    Example usage::

      sort = Sorter()

      list = [(1, 2), (4, 8), (0, 3)]
      dict = [{'a': 3, 'b': 4}, {'a': 5, 'b': 2}, {'a': 0, 'b': 0},
              {'a': 9, 'b': 9}]


      sort(list)       # default sort
      sort(list, 1)    # sort by index 1
      sort(dict, 'a')  # sort a list of dicts by key 'a'

    c         C` sA   | j    g  | D] \ } } | | ^ q } | r= | | (n  | S(   N(   t   sort(   R    t   datat   auxt   inplacet   junkt   it   result(    (    s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pyt   _helper  s
    
#
i   c         C` s   | d  k r5 | r% | j   | } n t |  } | Sg  t t |   D] } | | | | f ^ qH } |  j | | |  Sd  S(   N(   R   R   t   sortedt   rangeRo   R   (   R    R   t	   itemindexR   R   R   R   (    (    s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pyt   byItem  s    
	3c         C` sK   g  t  t |   D] } t | | |  | f ^ q } |  j | | |  S(   N(   R   Ro   R   R   (   R    R   t   attributenameR   R   R   (    (    s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pyt   byAttribute  s    8N(	   R$   R%   R&   R   R   R   R   R   R"   (    (    (    s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pyR     s   	t   Xlatorc           B` s)   e  Z d  Z d   Z d   Z d   Z RS(   so  
    All-in-one multiple-string-substitution class

    Example usage::

      text = "Larry Wall is the creator of Perl"
      adict = {
      "Larry Wall" : "Guido van Rossum",
      "creator" : "Benevolent Dictator for Life",
      "Perl" : "Python",
      }

      print(multiple_replace(adict, text))

      xlat = Xlator(adict)
      print(xlat.xlat(text))
    c         C` s"   t  j d j t t  j |     S(   s=    Build re object based on the keys of the current dictionary t   |(   t   ret   compileR   t   mapt   escape(   R    (    (    s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pyt   _make_regex  s    c         C` s   |  | j  d  S(   s(    Handler invoked for each regex *match* i    (   t   group(   R    t   match(    (    s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pyR"     s    c         C` s   |  j    j |  |  S(   s.    Translate *text*, returns the modified text. (   R   t   sub(   R    t   text(    (    s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pyt   xlat  s    (   R$   R%   R&   R   R"   R   (    (    (    s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pyR     s   		i   c         C` s   d } d } d } xp |  j    D]b } | j   r | s@ | } n  | t |  t d  } | sq | | d k r | | 7} q q q W| | d } | j d d  } | | d |  S(   s6    soundex module conforming to Odell-Russell algorithm t   01230120022455012623010202R(   t   Aii   t   0(   t   uppert   isalphat   ordR   (   t   nameRo   t   soundex_digitst   sndxt   fct   cRM   (    (    s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pyt   soundex  s    	R   c           B` sk   e  Z d  Z d   Z d   Z d   Z d   Z e j rE d   Z	 n	 d   Z
 d   Z d   Z d	   Z RS(
   s0    Null objects always and reliably "do nothing." c         O` s   d  S(   N(    (   R    RS   RT   (    (    s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pyR!   :  s    c         O` s   |  S(   N(    (   R    RS   RT   (    (    s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pyR"   =  s    c         C` s   d S(   Ns   Null()(    (   R    (    (    s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pyR   @  s    c         C` s   d S(   Ns   Null()(    (   R    (    (    s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pyR}   C  s    c         C` s   d S(   Ni    (    (   R    (    (    s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pyt   __bool__G  s    c         C` s   d S(   Ni    (    (   R    (    (    s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pyt   __nonzero__J  s    c         C` s   |  S(   N(    (   R    R  (    (    s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pyt   __getattr__M  s    c         C` s   |  S(   N(    (   R    R  Rv   (    (    s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pyt   __setattr__P  s    c         C` s   |  S(   N(    (   R    R  (    (    s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pyt   __delattr__S  s    (   R$   R%   R&   R!   R"   R   R}   R   R9   R  R  R	  R
  R  (    (    (    s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pyR   6  s   								i  c         C` sn   t  j r% t j |  d | d t nE y t j |  d | Wn+ t k
 ri } | j t j k rj   qj n Xd S(   s   
    make directory *newdir* recursively, and set *mode*.  Equivalent to ::

        > mkdir -p NEWDIR
        > chmod MODE NEWDIR
    R   t   exist_okN(   R   R9   R   t   makedirsR   t   OSErrort   errnot   EEXIST(   t   newdirR   t	   exception(    (    s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pyt   mkdirsW  s    		t   GetRealpathAndStatc           B` s   e  Z d    Z d   Z RS(   c         C` s   i  |  _  d  S(   N(   t   _cache(   R    (    (    s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pyR!   k  s    c         C` s   |  j  j |  } | d  k r t j j |  } t j d k rH | } n! t j |  } | j	 | j
 f } | | f } | |  j  | <n  | S(   Nt   win32(   R  t   getR   R   R   t   realpatht   syst   platformt   statt   st_inot   st_dev(   R    R   R   R  t   stat_keyR  (    (    s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pyR"   n  s    	(   R$   R%   R!   R"   (    (    (    s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pyR  j  s   	c         C` s4   x- | D]% } y |  | =Wq t  k
 r+ q Xq Wd S(   s3   delete all of the *keys* from the :class:`dict` *d*N(   Rn   (   RM   R   R   (    (    s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pyt   dict_delall  s
    t
   RingBufferc           B` sE   e  Z d  Z d   Z d d d     YZ d   Z d   Z d   Z RS(   s-    class that implements a not-yet-full buffer c         C` s   | |  _  g  |  _ d  S(   N(   t   maxR   (   R    t   size_max(    (    s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pyR!     s    	t   __Fullc           B` s    e  Z d  Z d   Z d   Z RS(   s%    class that implements a full buffer c         C` s+   | |  j  |  j <|  j d |  j |  _ d S(   s/    Append an element overwriting the oldest one. i   N(   R   t   curR!  (   R    R   (    (    s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pyRF     s    c         C` s   |  j  |  j |  j  |  j  S(   s*    return list of elements in correct order (   R   R$  (   R    (    (    s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pyR    s    (   R$   R%   R&   RF   R  (    (    (    s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pyR#    s   	c         C` sA   |  j  j |  t |  j   |  j k r= d |  _ t |  _ n  d S(   s*   append an element at the end of the bufferi    N(   R   RF   Ro   R!  R$  t   _RingBuffer__FullRA   (   R    R   (    (    s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pyRF     s    	c         C` s   |  j  S(   s:    Return a list of elements from the oldest to the newest. (   R   (   R    (    (    s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pyR    s    c         C` s   |  j  | t |  j   S(   N(   R   Ro   (   R    R   (    (    s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pyt   __get_item__  s    (    (   R$   R%   R&   R!   R%  RF   R  R&  (    (    (    s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pyR     s   			c         C` s`   d } xM t  |  t t |     D]0 \ } } | t |  d 7} | | k r" | Sq" Wt |   S(   su   
    *seq* is a list of words.  Return the index into seq such that::

        len(' '.join(seq[:ind])<=N

    .
    i    i   (   R   R   Ro   (   R|   t   Nt   s_lent   wordt   ind(    (    s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pyt   get_split_ind  s    
(t   alternatives   textwrap.TextWrapperc         C` s   d t  |  j    } | t  |  } | j d  } t  |  } d } g  } xA | | k  r | }	 | t | | |  7} | j | |	 | ! qP W|  d j | d  d }
 x- | d D]! } |
 | d j |  d 7}
 q W|
 S(   s*   wrap *text* with *prefix* at length *cols*t    i    s   
i   (   Ro   t
   expandtabst   splitR+  RF   R   (   t   prefixR   t   colst   padt	   availableR|   t   NseqR*  t   linest   lastIndt   rett   line(    (    s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pyt   wrap  s    s   (?:(?:\n\r?)|^)( *)\Sc         C` s   |  s
 d St  j |   } | d k r) |  S| j d  | j d  } | d k rU |  St j | d  } | d k r t j d |  } | t | <n  | j	 d |   j
   } | S(   s  
    Remove excess indentation from docstring *s*.

    Discards any leading blank lines, then removes up to n whitespace
    characters from each line, where n is the number of leading
    whitespace characters in the first line. It differs from
    textwrap.dedent in its deletion of leading blank lines and its use
    of the first non-blank line to determine the indentation.

    It is also faster in most cases.
    R(   i   i    s
   
? {0,%d}s   
N(   t   _find_dedent_regexR   R   t   endt   startt   _dedent_regexR  R   R   R   R   (   R   R   t   nshiftt   unindentR   (    (    s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pyt   dedent  s    t   *c         C` s   d d l  } d d l } | j d  } g  } x | j |   D] \ } }	 }
 x~ |
 D]v } | j j | j j | |   } | s | j j |  rS x4 | D]) } | j | |  r | j |  Pq q WqS qS W| s= Pq= q= W| S(   sU   
    Recursively list files

    from Parmar and Martelli in the Python Cookbook
    i    Nt   ;(	   t   os.patht   fnmatchR/  t   walkR   t   normpathR   t   isfileRF   (   R   t   patternst   recurset   return_foldersR   RD  t   pattern_listt   resultst   dirnamet   dirst   filesR  t   fullnamet   pattern(    (    s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pyt	   listFiles  s    !c         C` s   g  } xm |  D]e } t  j j |  r8 | j |  q n  t  j j |  r t | d d d d } | j |  q q Wg  | D] } t  j j |  s} | ^ q} S(   sx   
    Recurse all the files and dirs in *args* ignoring symbolic links
    and return the files as a list of strings
    RI  i   RJ  (   R   R   RG  RF   t   isdirRR  R{   t   islink(   RS   RO  t   argt   newfilest   f(    (    s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pyt   get_recursive_filelist   s    i   c         c` sA   d } x4 |  | | | !} t  |  s* Pn  | V| | 7} q	 Wd S(   s$   Break up the *seq* into *num* tuplesi    N(   Ro   (   R|   t   numR<  R   (    (    s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pyt   pieces3  s    c         C` s]   t  j r t j   } n t j   } |  d  k	 rC t |  d | n  t j d |  | j	   S(   Nt   file(
   R   R9   R   t   StringIOt   BytesIOR   t   printR\   R]   t   getvalue(   R   t   sh(    (    s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pyt   exception_to_str?  s    	c         C` s^   t  |   d k  r t S|  d } x7 t d t  |    D]  } |  | } | | k r6 t Sq6 Wt S(   sm   
    Return *True* if all elements of *seq* compare equal.  If *seq* is
    0 or 1 length, return *True*
    i   i    i   (   Ro   R   R   RW   (   R|   R   R   t   thisval(    (    s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pyt   allequalK  s    

c         C` s/   t  |   s t Sx |  D] } | s t Sq Wt S(   sl   
    Return *True* if all elements of *seq* evaluate to *True*.  If
    *seq* is empty, return *False*.
    (   Ro   RW   R   (   R|   R   (    (    s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pyt   alltrue[  s    c         C` s/   t  |   s t Sx |  D] } | r t Sq Wt S(   sb   
    Return *True* if one element of *seq* is *True*.  It *seq* is
    empty, return *False*.
    (   Ro   RW   R   (   R|   R   (    (    s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pyt   onetruei  s    c         C` s>   g  t  |   D]- \ } } |  | d D] } | | f ^ q% q S(   s3   
    return all possible pairs in sequence *x*
    i   (   t	   enumerate(   R   R   RW  R   (    (    s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pyt   allpairsw  s    t   maxdictc           B` s    e  Z d  Z d   Z d   Z RS(   s   
    A dictionary with a maximum size; this doesn't override all the
    relevant methods to constrain the size, just setitem, so use with
    caution
    c         C` s#   t  j |   | |  _ g  |  _ d  S(   N(   Rb   R!   t   maxsizet	   _killkeys(   R    Ri  (    (    s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pyR!     s    	c         C` sf   | |  k rO t  |   |  j k r< |  |  j d =|  j d =n  |  j j |  n  t j |  | |  d  S(   Ni    (   Ro   Ri  Rj  RF   Rb   t   __setitem__(   R    t   kt   v(    (    s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pyRk    s    (   R$   R%   R&   R!   Rk  (    (    (    s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pyRh    s   	t   Stackc           B` s}   e  Z d  Z d d  Z d   Z d   Z d   Z d   Z d   Z	 d   Z
 d   Z d	   Z d
   Z d   Z d   Z RS(   s   
    Implement a stack where elements can be pushed on and you can move
    back and forth.  But no pop.  Should mimic home / back / forward
    in a browser
    c         C` s   |  j    | |  _ d  S(   N(   t   cleart   _default(   R    t   default(    (    s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pyR!     s    
c         C` s(   t  |  j  s |  j S|  j |  j Sd S(   s#   return the current element, or NoneN(   Ro   t	   _elementsRp  t   _pos(   R    (    (    s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pyR"     s    c         C` s   |  j  j   S(   N(   Rr  t   __len__(   R    (    (    s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pyRt    s    c         C` s   |  j  j |  S(   N(   Rr  t   __getitem__(   R    R*  (    (    s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pyRu    s    c         C` s;   t  |  j  } |  j | d k  r4 |  j d 7_ n  |    S(   s8   move the position forward and return the current elementi   (   Ro   Rr  Rs  (   R    t   n(    (    s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pyt   forward  s    c         C` s(   |  j  d k r! |  j  d 8_  n  |    S(   s5   move the position back and return the current elementi    i   (   Rs  (   R    (    (    s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pyt   back  s    c         C` sD   |  j  |  j d  |  _  |  j  j |  t |  j   d |  _ |    S(   s   
        push object onto stack at current position - all elements
        occurring later than the current position are discarded
        i   (   Rr  Rs  RF   Ro   (   R    R   (    (    s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pyt   push  s    c         C` s.   t  |  j  s d S|  j |  j d  |    S(   s0   push the first element onto the top of the stackNi    (   Ro   Rr  Ry  (   R    (    (    s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pyt   home  s    c         C` s   t  |  j  d k S(   Ni    (   Ro   Rr  (   R    (    (    s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pyt   empty  s    c         C` s   d |  _  g  |  _ d S(   s   empty the stackiN(   Rs  Rr  (   R    (    (    s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pyRo    s    	c         C` s   | |  j  k r t d   n  |  j  } |  j   g  } x7 | D]/ } | | k ra | j |  q? |  j |  q? Wx | D] } |  j |  qy W| S(   se   
        raise *o* to the top of the stack and return *o*.  *o* must be
        in the stack
        s   Unknown element o(   Rr  R   Ro  RF   Ry  (   R    R   t   oldt   bubblest   thiso(    (    s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pyt   bubble  s    

c         C` sf   | |  j  k r t d   n  |  j  } |  j   x- | D]% } | | k rQ q9 q9 |  j |  q9 Wd S(   s!   remove element *o* from the stacks   Unknown element oN(   Rr  R   Ro  Ry  (   R    R   R|  R~  (    (    s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pyR     s    

N(   R$   R%   R&   R   R!   R"   Rt  Ru  Rw  Rx  Ry  Rz  R{  Ro  R  R   (    (    (    s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pyRn    s   						
				c         C` s   | r@ g  t  |   D]$ } t | t j  r | | f ^ q } nI g  t  |   D]* } t | t j  rM | j   | f ^ qM } | j   } g  | D]' \ } } | j |  d k r | ^ q S(   su   
    return all attributes of *o* which match string in match.  if case
    is True require an exact case match.
    i    (   t   dirR   R   R   R   t   find(   R   R   t   caseR  t   namest   orig(    (    s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pyt   finddir  s    '*c         C` s   d   t  j |   D S(   sA   reverse the dictionary -- may lose data if values are not unique!c         S` s   i  |  ] \ } } | |  q S(    (    (   R   Rl  Rm  (    (    s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pys
   <dictcomp>  s   	 (   R   Rm   (   RM   (    (    s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pyt   reverse_dict  s    c         ` s     f d   t  j |   D S(   sn   
    Return a dictionary that contains those keys that appear in both
    d and keys, with values from d.
    c         ` s+   i  |  ]! \ } } |   k r | |  q S(    (    (   R   Rl  Rm  (   R   (    s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pys
   <dictcomp>  s   	 (   R   Rm   (   RM   R   (    (   R   s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pyt   restrict_dict  s    c         C` sG  d d l  m } m } t j   } t j d k r y2 | d d d | d d g d	 | j j   } Wn t	 k
 r t
 d
   n Xt | d j    } nt j j d  ry2 | d d d | d d g d	 | j j   } Wn t	 k
 r t
 d   n Xt | d j   d  } n&t j j d  ry2 | d d d | d d g d	 | j j   } Wn t	 k
 rt
 d   n Xt | d j   d  } n t j j d  r0y5 | t d  d d d | g d	 | j j   } Wn t	 k
 rt
 d   n Xt | j   j   d j d d   } n t
 d t j   | S(   s%   return the memory consumed by processi    (   t   Popent   PIPEt   sunos5t   pss   -ps   %ds   -ot   oszt   stdouts?   report_memory works on Sun OS only if the 'ps' program is foundit   linuxs   rss,szs>   report_memory works on Linux only if the 'ps' program is foundi   t   darwins   rss,vszs?   report_memory works on Mac OS only if the 'ps' program is foundt   wint   tasklists   /nhs   /fis	   pid eq %dsF   report_memory works on Windows only if the 'tasklist' program is foundit   ,R(   s%   We don't have a memory monitor for %s(   t   matplotlib.compat.subprocessR  R  R   t   getpidR  R  R  t	   readlinesR  t   NotImplementedErrorR4   R   t
   startswithR/  t   strt   readR   (   R   R  R  t   pidt   a2t   mem(    (    s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pyt   report_memory  sJ    +s0   In safezip, len(args[0])=%d but len(args[%d])=%dc          G` sy   t  |  d  } xV t |  d  D]D \ } } t  |  | k r! t t | | d t  |  f   q! q! Wt t |     S(   s-   make sure *args* are equal len before zippingi    i   (   Ro   Rf  R   t   _safezip_msgRl   R   (   RS   t   NxR   RU  (    (    s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pyt   safezipB  s
    *c         C` s*   y t  |  |  SWn t k
 r% t SXd S(   s;   return issubclass(x, klass) and return False on a TypeErrorN(   t
   issubclassR>   RW   (   R   RB   (    (    s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pyt   issubclass_safeK  s    c         C` s   t  j |  d t d | }  |  j j sB |  j |  j d  }  n  y& t  j j |  d t	 } | j
   Wn t k
 r| |  SX| S(   Nt   subokRL   t   S(   R   t   arrayR   t   dtypet   isnativet   byteswapt   newbyteordert   mat   masked_invalidRW   t   shrink_maskR>   (   R   RL   t   xm(    (    s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pyt   safe_masked_invalidU  s    c         ` s   d d l   d d l m    f d            f d    x5  D]- }  j d | f   | | i  g   qS Wd S(   sY  
    *objects*
        A list of objects to find cycles in.  It is often useful to
        pass in gc.garbage to find the cycles that are preventing some
        objects from being garbage collected.

    *outstream*
        The stream for output.

    *show_progress*
        If True, print the number of objects reached as they are found.
    i    N(   t	   FrameTypec         ` sN  x:t  |   D],\ } } |  | d t |   }   j d t t |    t | t  r x t j |  D]Z \ } } | | k r   j d t	 |   Pn  | | k rm   j d t	 |   Pqm qm Wn^ t | t
  r   j d | j |   n2 t | t  r  j d  n   j t	 |     j d  q W  j d  d  S(	   Ni   s	      %s -- s   [%s]s
   [key] = %ss   [%d]s	   ( tuple )s    ->
s   
(   Rf  Ro   R   R  Rz   R   Rb   R   Rm   R~   Rl   t   indext   tuple(   R   R   t   stept   nextR   R   (   t	   outstream(    s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pyt
   print_pathv  s$    c         ` s    r   j  d t |   n  d  | t |   < j |   } xw | D]o } | | k re  |  qF |  k sF t |    r qF qF t |  | k rF  | | | | |  g  qF qF Wd  S(   Ns   %d(   R   Ro   R   t   idt   get_referentsR   (   R   R<  t   allt   current_patht	   referentst   referent(   R  t   gct   objectsR  R  RI  t   show_progress(    s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pyRI    s    s   Examining: %r
(   R  RQ   R  R   (   R  R  R  R   (    (   R  R  R  R  R  RI  R  s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pyt   print_cyclesf  s    !t   Grouperc           B` sY   e  Z d  Z d	 d  Z d   Z d   Z d   Z d   Z d   Z d   Z	 d   Z
 RS(
   s  
    This class provides a lightweight way to group arbitrary objects
    together into disjoint sets when a full-blown graph data structure
    would be overkill.

    Objects can be joined using :meth:`join`, tested for connectedness
    using :meth:`joined`, and all disjoint sets can be retrieved by
    using the object as an iterator.

    The objects being joined must be hashable and weak-referenceable.

    For example:

        >>> from matplotlib.cbook import Grouper
        >>> class Foo(object):
        ...     def __init__(self, s):
        ...         self.s = s
        ...     def __repr__(self):
        ...         return self.s
        ...
        >>> a, b, c, d, e, f = [Foo(x) for x in 'abcdef']
        >>> grp = Grouper()
        >>> grp.join(a, b)
        >>> grp.join(b, c)
        >>> grp.join(d, e)
        >>> sorted(map(tuple, grp))
        [(a, b, c), (d, e)]
        >>> grp.joined(a, b)
        True
        >>> grp.joined(a, c)
        True
        >>> grp.joined(a, d)
        False

    c         C` s;   i  } |  _  x' | D] } t |  g | t |  <q Wd  S(   N(   t   _mappingR   (   R    t   initt   mappingR   (    (    s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pyR!     s    c         C` s   t  |  |  j k S(   N(   R   R  (   R    R   (    (    s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pyt   __contains__  s    c         C` sb   |  j  } g  | D] } |   d k r | ^ q } x* | D]" } | j |  } | j |  q8 Wd S(   s@   
        Clean dead weak references from the dictionary
        N(   R  R   R   R   (   R    R  R   t   to_dropR   (    (    s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pyt   clean  s
    	(c         G` s   |  j  } | j t |  t |  g  } x | D] } | j t |   } | d k r~ | j t |   | | t |  <q1 | | k	 r1 t |  t |  k r | | } } n  | j |  x | D] } | | | <q Wq1 q1 W|  j   d S(   sa   
        Join given arguments into the same set.  Accepts one or more
        arguments.
        N(	   R  Rg   R   R  R   RF   Ro   R{   R  (   R    t   aRS   R  t   set_aRU  t   set_bt   elem(    (    s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pyR     s    	!c         C` sN   |  j    |  j } y" | t |  | t |  k SWn t k
 rI t SXd S(   sJ   
        Returns True if *a* and *b* are members of the same set.
        N(   R  R  R   Rn   RW   (   R    R  t   bR  (    (    s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pyt   joined  s    
	"c         C` sQ   |  j    |  j } | j t |  d   } | d  k	 rM | j t |   n  d  S(   N(   R  R  R   R   R   R   (   R    R  R  t   seta(    (    s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pyR     s
    
	c         c` s   |  j    t   } xU t j |  j  D]A } | d | k	 r& g  | D] } |   ^ qC V| j |  q& q& Wx4 t j |  j  D]  } | d | k r~ | d =q~ q~ Wd S(   s   
        Iterate over each of the disjoint sets as a list.

        The iterator is invalid if interleaved with calls to join().
        iN(   R  t   objectR   t
   itervaluesR  RF   (   R    t   tokenR   R   (    (    s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pyt   __iter__	  s    
	c         C` sH   |  j    |  j j t |  t |  g  } g  | D] } |   ^ q5 S(   sM   
        Returns all of the items joined with *a*, including itself.
        (   R  R  R  R   (   R    R  t   siblingsR   (    (    s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pyt   get_siblings  s    
$(    (   R$   R%   R&   R!   R  R  R   R  R   R  R  (    (    (    s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pyR    s   #		
				c         C` s   |  j  t |   d f  } t j t |    | } t j t |   d | d  } t j g  | j D] } t j | | |  ^ qe  j  t |  f |  j d  S(   sv  
    Resample an array with ``steps - 1`` points between original point pairs.

    Parameters
    ----------
    a : array, shape (n, ...)
    steps : int

    Returns
    -------
    array, shape ``((n - 1) * steps + 1, ...)``

    Along each column of *a*, ``(steps - 1)`` points are introduced between
    each original values; the values are linearly interpolated.
    ii   (   t   reshapeRo   R   t   aranget   column_stackt   Tt   interpt   shape(   R  t   stepst   fpst   xpR   t   fp(    (    s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pyt   simple_linear_interpolation(  s
    !4s   shutil.rmtreec         C` s   t  j j |   r x t j t  j j |  d   t j t  j j |  d   D]? } t  j j |  r t |  t  j |  qM t  j |  qM Wn t  j |   d  S(   NRA  s   .*(   R   R   RS  t   globR   t   recursive_removet
   removedirsR   (   R   R   (    (    s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pyR  ?  s    #
c    
      G` s  t  |   s d St |  d t j  s7 t |  d  rF t d   n  t  |  d  } g  } t g t  |   } x t |   D] \ } } t | t j  rt |  rt  |  | k rt | | <t | t	 j
 j  r | j d k rt d   qqt	 j |  } n  | j |  q| Wg  } x t |  D] \ } } | | r/| j d k rZq/n  t | t	 j
 j  r| j t	 j
 j |   | j } n | } y5 t	 j |  } t | t	 j  r| j |  n  WqqXq/q/Wt  |  rjt	 j j |  } | j   d }	 t  |	  | k  rjxC t |  D]2 \ } } | | r.| j |	 d d | | <q.q.Wqjn  xL t |  D]> \ } } | | rwt | t	 j
 j  rw| j   | | <qwqwW| S(   sn  
    Find all masked and/or non-finite points in a set of arguments,
    and return the arguments with only the unmasked points remaining.

    Arguments can be in any of 5 categories:

    1) 1-D masked arrays
    2) 1-D ndarrays
    3) ndarrays with more than one dimension
    4) other non-string iterables
    5) anything else

    The first argument must be in one of the first four categories;
    any argument with a length differing from that of the first
    argument (and hence anything in category 5) then will be
    passed through unchanged.

    Masks are obtained from all arguments of the correct length
    in categories 1, 2, and 4; a point is bad if masked in a masked
    array or if it is a nan or inf.  No attempt is made to
    extract a mask from categories 2, 3, and 4 if :meth:`np.isfinite`
    does not yield a Boolean array.

    All input arguments that are not passed unchanged are returned
    as ndarrays after removing the points or rows corresponding to
    masks in any of the arguments.

    A vastly simpler version of this function was originally
    written as a helper for Axes.scatter().

    i    s!   First argument must be a sequencei   s   Masked arrays must be 1-Dt   axis(    (   Ro   R   R   R   R   R   RW   Rf  R   R   R  t   MaskedArrayt   ndimt   asarrayRF   t   getmaskarrayR   t   isfiniteR   t   logical_andt   reducet   nonzerot   taket   filled(
   RS   t   nrecst   margst   seqlistR   R   t   maskst   xdt   maskt   igood(    (    s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pyt   delete_masked_pointsN  sT     '


&g      ?c         ` s  d d      f d   } g  } t  |  d  }  t |   } | d k rW t d  } n! t |  | k rx t d   n  | } xkt t |  |  d d D]N\ }	 \ }
 } i  } | d k	 r | | d <n  | } | j |  t |
  d k r~t j	 g   | d	 <t j
 | d
 <t j
 | d <t j
 | d <t j
 | d <t j
 | d <t j
 | d <t j
 | d <t j
 | d <t j
 | d <q n  t j |
  }
 t j |
  | d
 <t j |
 d d d g  \ } } } | | | d <| d d k r| rd } n  | |
 | | d |  \ | d <| d <t j |  rt j |  r]| | | d } | | | d } q| d k rt j |
  } t j |
  } qt d   n, t j |
 | d  } t j |
 | d  } t j |
 | k |
  } t |  d k st j |  | k  r| | d <n t j |  | d <t j |
 | k |
  } t |  d k sct j |  | k rp| | d <n t j |  | d <t j t j |
 | d k  |
  t j |
 | d k |
  g  | d	 <| | | | d <| d <| d <q W| S(   s]  
    Returns list of dictionaries of statistics used to draw a series
    of box and whisker plots. The `Returns` section enumerates the
    required keys of the dictionary. Users can skip this function and
    pass a user-defined set of dictionaries to the new `axes.bxp` method
    instead of relying on MPL to do the calculations.

    Parameters
    ----------
    X : array-like
        Data that will be represented in the boxplots. Should have 2 or
        fewer dimensions.

    whis : float, string, or sequence (default = 1.5)
        As a float, determines the reach of the whiskers to the beyond the
        first and third quartiles. In other words, where IQR is the
        interquartile range (`Q3-Q1`), the upper whisker will extend to last
        datum less than `Q3 + whis*IQR`). Similarly, the lower whisker will
        extend to the first datum greater than `Q1 - whis*IQR`.
        Beyond the whiskers, data are considered outliers
        and are plotted as individual points. This can be set this to an
        ascending sequence of percentile (e.g., [5, 95]) to set the
        whiskers at specific percentiles of the data. Finally, `whis`
        can be the string ``'range'`` to force the whiskers to the
        minimum and maximum of the data. In the edge case that the 25th
        and 75th percentiles are equivalent, `whis` can be automatically
        set to ``'range'`` via the `autorange` option.

    bootstrap : int, optional
        Number of times the confidence intervals around the median
        should be bootstrapped (percentile method).

    labels : array-like, optional
        Labels for each dataset. Length must be compatible with
        dimensions of `X`.

    autorange : bool, optional (False)
        When `True` and the data are distributed such that the  25th and
        75th percentiles are equal, ``whis`` is set to ``'range'`` such
        that the whisker ends are at the minimum and maximum of the
        data.

    Returns
    -------
    bxpstats : list of dict
        A list of dictionaries containing the results for each column
        of data. Keys of each dictionary are the following:

        ========   ===================================
        Key        Value Description
        ========   ===================================
        label      tick label for the boxplot
        mean       arithemetic mean value
        med        50th percentile
        q1         first quartile (25th percentile)
        q3         third quartile (75th percentile)
        cilo       lower notch around the median
        cihi       upper notch around the median
        whislo     end of the lower whisker
        whishi     end of the upper whisker
        fliers     outliers
        ========   ===================================

    Notes
    -----
    Non-bootstrapping approach to confidence interval uses Gaussian-
    based asymptotic approximation:

    .. math::

        \mathrm{med} \pm 1.57 \times \frac{\mathrm{iqr}}{\sqrt{N}}

    General approach from:
    McGill, R., Tukey, J.W., and Larsen, W.A. (1978) "Variations of
    Boxplots", The American Statistician, 32:12-16.

    i  c         S` sq   t  |   } d d g } t j j | d | | f } |  | } t j | d d d t } t j | |  } | S(   Ng      @g     `X@t   sizeR  i   t   overwrite_input(   Ro   R   t   randomt   randintt   medianR   t
   percentile(   R   R'  t   Mt   percentilest   bs_indext   bsDatat   estimatet   CI(    (    s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pyt   _bootstrap_median  s    
c         ` s   | d  k	 r5   |  d | } | d } | d } nB t |   } | d | t j |  } | d | t j |  } | | f S(   NR'  i    i   gQ?(   R   Ro   R   t   sqrt(   R   t   medt   iqrt	   bootstrapR   t	   notch_mint	   notch_maxR'  (   R  (    s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pyt   _compute_conf_interval  s    
t   Xs-   Dimensions of labels and X must be compatibleR<  i    t   labelt   flierst   meanR  t   q1t   q3t   cilot   cihit   whislot   whishii   i2   iK   R  R   t   limitt   limitss   min/maxs:   whis must be a float, valid string, or list of percentilesi   N(   R   R  R  s   min/max(   t   _reshape_2DRo   R   R   R   Rf  R   RF   R   R  t   nanR  R  R  t   isscalart   isrealt   minR!  t   compresst   hstack(   R	  t   whisR  t   labelst	   autorangeR  t   bxpstatst   ncolst
   input_whist   iiR   R
  t   statsR  R  R  t   lovalt   hivalt   wiskhit   wisklo(    (   R  s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pyt   boxplot_stats  sv    P.$	$''&$c         C` su  |  j  |  j  }  t j d |  d f  } t j t |   d  } | d | d  } t j | d k |  } t j | d k |  } t |  t |  k s t  t |  d k r d S| s t j | d d  t j	 f | d d  t j	 f f d d S| | } t j
 |  } t j d | d  f  }	 | }
 t j |	 d d  t j	 f |
 d d  t j	 f f d d S(	   s  
    Find index ranges where *mask* is *False*.

    *mask* will be flattened if it is not already 1-D.

    Returns Nx2 :class:`numpy.ndarray` with each row the start and stop
    indices for slices of the compressed :class:`numpy.ndarray`
    corresponding to each of *N* uninterrupted runs of unmasked
    values.  If optional argument *compressed* is *False*, it returns
    the start and stop indices into the original :class:`numpy.ndarray`,
    not the compressed :class:`numpy.ndarray`.  Returns *None* if there
    are no unmasked values.

    Example::

      y = ma.array(np.arange(5), mask = [0,0,1,0,0])
      ii = unmasked_index_ranges(ma.getmaskarray(y))
      # returns array [[0,2,] [2,4,]]

      y.compressed()[ii[1,0]:ii[1,1]]
      # returns array [3,4,]

      ii = unmasked_index_ranges(ma.getmaskarray(y), compressed=False)
      # returns array [[0, 2], [3, 5]]

      y.filled()[ii[1,0]:ii[1,1]]
      # returns array [3,4,]

    Prior to the transforms refactoring, this was used to support
    masked arrays in Line2D.
    i   ii    NR  (   i   (   i   (   i    (   R  R  R   t   concatenateR  Ro   R  t   AssertionErrorR   t   newaxist   cumsum(   R  t
   compressedt   mt   indicest   mdift   i0t   i1t
   seglengthst   breakpointst   ic0t   ic1(    (    s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pyt   unmasked_index_rangesl  s     !?
t   solidt   -t   dasheds   --t   dashdots   -.t   dottedt   :c         C` s   i  |  ] \ } } | |  q S(    (    (   R   Rl  Rm  (    (    s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pys
   <dictcomp>  s   	 s   2.2c         '` s   d d   f d     Y} g  | D] } | |  ^ q  } t  } } xy t  r g  g  | D] } | j ^ qU D] } | rh | ^ qh } | r t |  } | g  | D] } | |  ^ q f VqE PqE Wd S(   s   
    This generator takes a bunch of iterables that are ordered by func
    It sends out ordered tuples::

       (func(row), [rows from all iterators matching func(row)])

    It is used by :func:`matplotlib.mlab.recs_join` to join record arrays
    t   myiterc           ` s)   e  Z d    Z   f d   Z d   Z RS(   c         S` s'   | |  _  d  |  _ |  _ |  j   d  S(   N(   t   itR   R   Rv   t   iternext(   R    R?  (    (    s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pyR!     s    	c         ` sP   y( t  |  j  |  _   |  j  |  _ Wn! t k
 rK d  |  _ |  _ n Xd  S(   N(   R  R?  Rv   R   t   StopIterationR   (   R    (   R@   (    s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pyR@    s
    c         S` sV   d  } | |  j k r+ |  j } |  j   n' |  j rR | |  j k rR t d   n  | S(   Ns   Iterator has been left behind(   R   R   Rv   R@  R   (   R    R   t   retval(    (    s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pyR"     s    	(   R$   R%   R!   R@  R"   (    (   R@   (    s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pyR>    s   	N(    (   R   R   R  (   R@   t	   iterablesR>  R?  t   iterst   minvalst   minkeyt   _f(    (   R@   s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pyt   align_iterators  s    

	5'c         C` s   t  j |  d t }  |  j s" g  St  j |  d  |  d k  \ } | d 7} | j   } |  d rr d g | } n  |  d r | j t |    n  t t	 | d d d  | d d d    S(   sq   
    Return a list of (ind0, ind1) such that mask[ind0:ind1].all() is
    True and we cover all such regions
    R  ii   i    Ni   (
   R   R  R   R  R  t   tolistRF   Ro   Rl   R   (   R  t   idx(    (    s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pyt   contiguous_regions  s    	 


c         C` so   y t  j |   }  Wn t k
 r2 t d   n X|  j d  |  j d  } | d k oh | d d k } | S(   NsN   matplotlib display text must have all code points < 128 or use Unicode stringst   $s   \$i    i   (   R   R   t   UnicodeDecodeErrorR   t   count(   R   t   dollar_countt   even_dollars(    (    s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pyt   is_math_text  s    c         C` sB   t  |  d  r. t j j |  t  j t j  St j |  t  Sd S(   st   
    Convert a sequence to a float array; if input was a masked array, masked
    values are converted to nans.
    R  N(   R   R   R  R  R2   R  R  (   R   (    (    s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pyt   _to_unmasked_float_array  s    c         C` sv   t  |  d  s% t |  j  d k  r2 t j |   Sy |  d d  d f |  SWn! t t f k
 rq t j |   SXd S(   sy   
    Converts a sequence of less than 1 dimension, to an array of 1
    dimension; leaves everything else untouched.
    R  i   N(   R   Ro   R  R   t
   atleast_1dR   t
   IndexErrorR>   (   R   (    (    s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pyt	   _check_1d  s    %c         C` s   t  j t |  t  j  r! |  j n t  j |    }  |  j d k r^ |  j j t  j	 k r^ |  g S|  j d k r g  |  D] } t  j
 | d  ^ qt St d j |    d S(   s  
    Use Fortran ordering to convert ndarrays and lists of iterables to lists of
    1D arrays.

    Lists of iterables are converted by applying `np.asarray` to each of their
    elements.  1D ndarrays are returned in a singleton list containing them.
    2D ndarrays are converted to the list of their *columns*.

    *name* is used to generate the error message for invalid inputs.
    i   i   is"   {} must have 2 or fewer dimensionsN(   i   i   (   R   RS  R   R   R  R  R  R  Rz   t   object_R  R   t   format(   R	  R  R   (    (    s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pyR    s    3$#id   c   	      C` s   g  } t  |  d  }  x |  D] } i  } t j |  } t j |  } t j | | |  } | | |  | d <| | d <t j |  | d <t j |  | d <| | d <| | d <| j |  q W| S(   s7  
    Returns a list of dictionaries of data which can be used to draw a series
    of violin plots. See the `Returns` section below to view the required keys
    of the dictionary. Users can skip this function and pass a user-defined set
    of dictionaries to the `axes.vplot` method instead of using MPL to do the
    calculations.

    Parameters
    ----------
    X : array-like
        Sample data that will be used to produce the gaussian kernel density
        estimates. Must have 2 or fewer dimensions.

    method : callable
        The method used to calculate the kernel density estimate for each
        column of data. When called via `method(v, coords)`, it should
        return a vector of the values of the KDE evaluated at the values
        specified in coords.

    points : scalar, default = 100
        Defines the number of points to evaluate each of the gaussian kernel
        density estimates at.

    Returns
    -------

    A list of dictionaries containing the results for each column of data.
    The dictionaries contain at least the following:

        - coords: A list of scalars containing the coordinates this particular
          kernel density estimate was evaluated at.
        - vals: A list of scalars containing the values of the kernel density
          estimate at each of the coordinates given in `coords`.
        - mean: The mean value for this column of data.
        - median: The median value for this column of data.
        - min: The minimum value for this column of data.
        - max: The maximum value for this column of data.
    R	  t   valst   coordsR  R  R  R!  (   R  R   R  R!  t   linspaceR  R  RF   (	   R	  t   methodt   pointst   vpstatsR   R#  t   min_valt   max_valRY  (    (    s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pyt   violin_stats-  s    )


t   _NestedClassGetterc           B` s   e  Z d  Z d   Z RS(   s   
    When called with the containing class as the first argument,
    and the name of the nested class as the second argument,
    returns an instance of the nested class.
    c         C` s%   t  | |  } t   } | | _ | S(   N(   R   Ra  RA   (   R    t   containing_classt
   class_namet   nested_classt   nested_instance(    (    s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pyR"   {  s    		(   R$   R%   R&   R"   (    (    (    s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pyRa  t  s   t   _InstanceMethodPicklerc           B` s    e  Z d  Z d   Z d   Z RS(   sm   
    Pickle cannot handle instancemethod saving. _InstanceMethodPickler
    provides a solution to this.
    c         C` sF   t  j r' | j |  _ | j j |  _ n | j |  _ | j j |  _ d S(   s-   Takes an instancemethod as its only argument.N(	   R   R9   R:   t
   parent_objR?   R$   t   instancemethod_nameR=   RC   (   R    t   instancemethod(    (    s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pyR!     s
    	c         C` s   t  |  j |  j  S(   N(   R   Rg  Rh  (   R    (    (    s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pyt   get_instancemethod  s    (   R$   R%   R&   R!   Rj  (    (    (    s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pyRf    s   		c         G` s   t  j d t |  t d t |   d d  f  } |  | d d d d  f <| d d d d  f | d d d d  f <| | d d  d d d  f <| d d  d d d  f | d d  d d d  f <| S(   s-  
    Convert continuous line to pre-steps.

    Given a set of ``N`` points, convert to ``2N - 1`` points, which when
    connected linearly give a step function which changes values at the
    beginning of the intervals.

    Parameters
    ----------
    x : array
        The x location of the steps. May be empty.

    y1, ..., yp : array
        y arrays to be turned into steps; all must be the same length as ``x``.

    Returns
    -------
    out : array
        The x and y values converted to steps in the same order as the input;
        can be unpacked as ``x_out, y1_out, ..., yp_out``.  If the input is
        length ``N``, each of these arrays will be length ``2N + 1``. For
        ``N=0``, the length will be 0.

    Examples
    --------
    >> x_s, y1_s, y2_s = pts_to_prestep(x, y1, y2)
    i   i   i    Ni(   R   t   zerosRo   R!  (   R   RS   R  (    (    s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pyt   pts_to_prestep  s    6,8c         G` s   t  j d t |  t d t |   d d  f  } |  | d d d d  f <| d d d d  f | d d d d  f <| | d d  d d d  f <| d d  d d d  f | d d  d d d  f <| S(   s(  
    Convert continuous line to post-steps.

    Given a set of ``N`` points convert to ``2N + 1`` points, which when
    connected linearly give a step function which changes values at the end of
    the intervals.

    Parameters
    ----------
    x : array
        The x location of the steps. May be empty.

    y1, ..., yp : array
        y arrays to be turned into steps; all must be the same length as ``x``.

    Returns
    -------
    out : array
        The x and y values converted to steps in the same order as the input;
        can be unpacked as ``x_out, y1_out, ..., yp_out``.  If the input is
        length ``N``, each of these arrays will be length ``2N + 1``. For
        ``N=0``, the length will be 0.

    Examples
    --------
    >> x_s, y1_s, y2_s = pts_to_poststep(x, y1, y2)
    i   i   i    Ni(   R   Rk  Ro   R!  (   R   RS   R  (    (    s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pyt   pts_to_poststep  s    6,8c         G` s  t  j d t |  d t |   f  } t  j |   }  |  d  |  d d | d d d d  f <| d d d d  f <|  d  | d d d  f <|  d | d d d  f <| | d d  d d d  f <| d d  d d d  f | d d  d d d  f <| S(   s  
    Convert continuous line to mid-steps.

    Given a set of ``N`` points convert to ``2N`` points which when connected
    linearly give a step function which changes values at the middle of the
    intervals.

    Parameters
    ----------
    x : array
        The x location of the steps. May be empty.

    y1, ..., yp : array
        y arrays to be turned into steps; all must be the same length as ``x``.

    Returns
    -------
    out : array
        The x and y values converted to steps in the same order as the input;
        can be unpacked as ``x_out, y1_out, ..., yp_out``.  If the input is
        length ``N``, each of these arrays will be length ``2N``.

    Examples
    --------
    >> x_s, y1_s, y2_s = pts_to_midstep(x, y1, y2)
    i   i   ii    N(   R   Rk  Ro   t
   asanyarray(   R   RS   R  (    (    s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pyt   pts_to_midstep  s    )@8c         C` s
   |  | f S(   N(    (   R   t   y(    (    s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pyt   <lambda>		  s    Rq  R  s	   steps-pres
   steps-posts	   steps-midc         C` sX   y |  j  j |  j f SWn: t k
 rS t |   }  t j |  j d d t |  f SXd S(   s  
    A helper function to get the index of an input to plot
    against if x values are not explicitly given.

    Tries to get `y.index` (works if this is a pd.Series), if that
    fails, return np.arange(y.shape[0]).

    This will be extended in the future to deal with more types of
    labeled data.

    Parameters
    ----------
    y : scalar or array-like
        The proposed y-value

    Returns
    -------
    x, y : ndarray
       The x and y values to plot.
    i    R  N(   R  R   R   RU  R   R  R  R2   (   Rp  (    (    s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pyt   index_of	  s
    c         C` sQ   t  |  t j  rA y |  d SWn t k
 r1 n Xt d   n  t t |    S(   Ni    s/   matplotlib does not support generators as input(   R   t   collectionst   IteratorR>   t   RuntimeErrorR  R   (   R   (    (    s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pyt   safe_first_element,	  s    c         C` s    t  |  t j  r t |   S|  S(   s    Converts dictview object to list(   R   Rs  t   MappingViewRl   (   R   (    (    s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pyt   sanitize_sequence<	  s    c      
   C` sX  | d k r t   } n  t |   }  t   } xt j |  D]\ } } g  } g  }	 xI | D]A }
 y' | j |  j |
   |	 j |
  Wq\ t k
 r q\ Xq\ W| | k r y' | j |  j |   |	 j |  Wq t k
 r q Xn  | r= | d | | <t |  d k r@t j	 d j
 d |	 d | d |	 d   q@q= q= W| j |   g  | D] } | | k rX| ^ qX} | rt d j
 d |    n  g  | D] } | | k r| ^ q} | rt d	 j
 d |    n  | d k	 rTt |  t |  B} g  | D] } | | k r| ^ q} | rTt d
 j
 d | d | d |    qTn  | S(   sR  Helper function to normalize kwarg inputs

    The order they are resolved are:

     1. aliasing
     2. required
     3. forbidden
     4. allowed

    This order means that only the canonical names need appear in
    `allowed`, `forbidden`, `required`

    Parameters
    ----------

    alias_mapping, dict, optional
        A mapping between a canonical name to a list of
        aliases, in order of precedence from lowest to highest.

        If the canonical value is not in the list it is assumed to have
        the highest priority.

    required : iterable, optional
        A tuple of fields that must be in kwargs.

    forbidden : iterable, optional
        A list of keys which may not be in kwargs

    allowed : tuple, optional
        A tuple of allowed fields.  If this not None, then raise if
        `kw` contains any keys not in the union of `required`
        and `allowed`.  To allow only the required fields pass in
        ``()`` for `allowed`

    Raises
    ------
    TypeError
        To match what python raises if invalid args/kwargs are passed to
        a callable.

    ii   sR   Saw kwargs {seen!r} which are all aliases for {canon!r}.  Kept value from {used!r}t   seent   canont   useds,   The required keys {keys!r} are not in kwargsR   s)   The forbidden keys {keys!r} are in kwargssX   kwargs contains {keys!r} which are not in the required {req!r} or allowed {allow!r} keyst   reqt   allowN(   R   Rb   R   Rm   RF   R   Rn   Ro   R   R   RW  R   R>   R   (   t   kwt   alias_mappingt   requiredt	   forbiddent   allowedR7  t	   canonicalt
   alias_listt   tmpRy  R  Rl  t	   fail_keyst   allowed_set(    (    s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pyt   normalize_kwargsA	  sR    ,	$%%%c         C` s$   y |  j  SWn t k
 r | SXd  S(   N(   R  R   (   Rp  t   default_name(    (    s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pyt	   get_label	  s    s   LOCKERROR: matplotlib is trying to acquire the lock
    {!r}
and has failed.  This maybe due to any other process holding this
lock.  If you are sure no other matplotlib process is running try
removing these folders and trying again.
t   Lockedc           B` sE   e  Z d  Z d Z d e f d     YZ d   Z d   Z d   Z RS(   s<  
    Context manager to handle locks.

    Based on code from conda.

    (c) 2012-2013 Continuum Analytics, Inc. / https://www.continuum.io/
    All Rights Reserved

    conda is distributed under the terms of the BSD 3-clause license.
    Consult LICENSE_CONDA or https://opensource.org/licenses/BSD-3-Clause.
    s   .matplotlib_lockt   TimeoutErrorc           B` s   e  Z RS(    (   R$   R%   (    (    (    s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pyR  	  s   c         C` sv   | |  _  d t t j    |  _ t j  j |  j  |  j |  j  |  _ t j  j |  j  |  j d  |  _ t	 |  _
 d  S(   NR9  s   -*(   R   R  R   R  R;  R   t   LOCKFNt	   lock_pathRQ  R   R   (   R    R   (    (    s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pyR!   	  s
    	%"c         C` s   d } d } xu | rb t  j  |  j  } | r^ | d j |  j  r^ t j |  | d 8} q Pq Wt j |  j  } |  j |   | s y t	 j
 |  j  Wq t k
 r q Xn	 t |  _ d  S(   Ni2   g?i    i   (   R  RQ  R   R;  R+   t   sleept   _lockstrRW  R  R   R  R  R  RW   R   (   R    t   retriest	   sleeptimeRO  t   err_str(    (    s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pyt	   __enter__	  s     	c         C` sR   |  j  rN xB |  j |  j f D]+ } y t j |  Wq t k
 rF q Xq Wn  d  S(   N(   R   R  R   R   t   rmdirR  (   R    t   exc_typet	   exc_valueR\   R   (    (    s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pyt   __exit__	  s    	(	   R$   R%   R&   R  Ru  R  R!   R  R  (    (    (    s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pyR  	  s   		t	   _FuncInfoc           B` s5   e  Z d  Z e d d  Z d d  Z d d  Z RS(   s*   
    Class used to store a function.

    c         ` s   | |  _  | |  _ t    r*   |  _ n   f d   |  _ | d k rW d   |  _ n$ t |  ro | |  _ n t d   d S(   s  
        Parameters
        ----------

        function : callable
            A callable implementing the function receiving the variable as
            first argument and any additional parameters in a list as second
            argument.
        inverse : callable
            A callable implementing the inverse function receiving the variable
            as first argument and any additional parameters in a list as
            second argument. It must satisfy 'inverse(function(x, p), p) == x'.
        bounded_0_1: bool or callable
            A boolean indicating whether the function is bounded in the [0,1]
            interval, or a callable taking a list of values for the additional
            parameters, and returning a boolean indicating whether the function
            is bounded in the [0,1] interval for that combination of
            parameters. Default True.
        check_params: callable or None
            A callable taking a list of values for the additional parameters
            and returning a boolean indicating whether that combination of
            parameters is valid. It is only required if the function has
            additional parameters and some of them are restricted.
            Default None.

        c         ` s     S(   N(    (   R   (   t   bounded_0_1(    s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pyRq  
  s    c         S` s   t  S(   N(   R   (   R   (    (    s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pyRq  
  s    s    Invalid 'check_params' argument.N(   Ru   t   inverseR   t   _bounded_0_1R   t   _check_paramsR   (   R    Ru   R  R  t   check_params(    (   R  s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pyR!   	  s    		c         C` s   |  j  |  S(   s  
        Returns a boolean indicating if the function is bounded in the [0,1]
        interval for a particular set of additional parameters.

        Parameters
        ----------

        params : list
            The list of additional parameters. Default None.

        Returns
        -------

        out : bool
            True if the function is bounded in the [0,1] interval for
            parameters 'params'. Otherwise False.

        (   R  (   R    t   params(    (    s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pyt   is_bounded_0_1%
  s    c         C` s   |  j  |  S(   s  
        Returns a boolean indicating if the set of additional parameters is
        valid.

        Parameters
        ----------

        params : list
            The list of additional parameters. Default None.

        Returns
        -------

        out : bool
            True if 'params' is a valid set of additional parameters for the
            function. Otherwise False.

        (   R  (   R    R  (    (    s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pyR  ;
  s    N(   R$   R%   R&   R   R   R!   R  R  (    (    (    s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pyR  	  s   +t   _StringFuncParserc           B` s  e  Z d  Z i  Z e d   d   e  e d <e e j e j e  e d <e d   d   e  e d <e e j e j e  e d <e d	   d
   e  e d <e e j	 d   e
  e d <e e j e j e
  e d <e e j d   e
  e d <e d   d   e  e d <e d   d   e  e d <e d   d   e
 d    e d <e d   d   d    e d <e d   d    d!    e d" <e d#   d$   d%   d&    e d' <d(   Z d)   Z e d*    Z e d+    Z e d,    Z e d-    Z d.   Z RS(/   s   
    A class used to convert predefined strings into
    _FuncInfo objects, or to directly obtain _FuncInfo
    properties.

    c         C` s   |  S(   N(    (   R   (    (    s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pyRq  [
  s    c         C` s   |  S(   N(    (   R   (    (    s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pyRq  \
  s    t   lineart	   quadraticc         C` s   |  d S(   Ni   (    (   R   (    (    s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pyRq  a
  s    c         C` s   |  d S(   Ng      ?i   gUUUUUU?(    (   R   (    (    s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pyRq  b
  s    t   cubicR  c         C` s   |  d S(   Ng      ?i   gUUUUUU?(    (   R   (    (    s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pyRq  g
  s    c         C` s   |  d S(   Ni   (    (   R   (    (    s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pyRq  h
  s    t   cbrtc         C` s   d |  S(   Ni
   (    (   R   (    (    s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pyRq  k
  s    t   log10t   logc         C` s   d |  S(   Ni   (    (   R   (    (    s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pyRq  q
  s    t   log2c         C` s   |  | d S(   Ni    (    (   R   t   p(    (    s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pyRq  s
  s    c         C` s   |  d | d S(   Ng      ?i    (    (   R   R  (    (    s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pyRq  t
  s    s   x**{p}c         C` s   |  d | d S(   Ng      ?i    (    (   R   R  (    (    s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pyRq  v
  s    c         C` s   |  | S(   N(    (   R   R  (    (    s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pyRq  w
  s    s
   root{p}(x)c         C` s   t  j |   t  j | d  S(   Ni    (   R   R  (   R   R  (    (    s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pyRq  y
  s   c         C` s   | d |  S(   Ni    (    (   R   R  (    (    s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pyRq  {
  s    c         C` s   |  d d k S(   Ni    (    (   R  (    (    s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pyRq  }
  s    s	   log{p}(x)c         C` s   t  j |  | d  S(   Ni    (   R   R  (   R   R  (    (    s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pyRq  ~
  s    c         C` s   d |  | d S(   Ni
   i    (    (   R   R  (    (    s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pyRq  
  s    c         C` s   |  d d k S(   Ni    (    (   R  (    (    s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pyRq  
  s    s   log10(x+{p})c         C` s   t  j |  | d  S(   Ni    (   R   R  (   R   R  (    (    s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pyRq  
  s    c         C` s   t  j |   | d S(   Ni    (   R   t   exp(   R   R  (    (    s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pyRq  
  s    c         C` s   |  d d k S(   Ni    (    (   R  (    (    s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pyRq  
  s    s
   log(x+{p})c         C` s&   t  j |  | d  t  j | d  S(   Ni   i    (   R   R  (   R   R  (    (    s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pyRq  
  s   c         C` s   | d |  | d S(   Ni    i   (    (   R   R  (    (    s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pyRq  
  s    c         C` s   |  d d k S(   Ni   i    (    (   R  (    (    s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pyRq  
  s    c         C` s   |  d d k S(   Ni    (    (   R  (    (    s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pyRq  
  s    s   log{p}(x+{p})c         C` sb   t  | t j  s% t d |   n  t j |  |  _ |  j   \ |  _ |  _ |  j	   |  _
 d S(   sk   
        Parameters
        ----------
        str_func : string
            String to be parsed.

        s   '%s' must be a string.N(   R   R   R   R   R   t	   _str_funct   _get_key_paramst   _keyt   _paramst   _parse_funct   _func(   R    t   str_func(    (    s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pyR!   
  s
    	c         ` s     j    j }   j s: t | j | j | j    } nZ | j } |   f d  } | j } |   f d  } | j   j  } t | | |  } | S(   s   
        Parses the parameters to build a new _FuncInfo object,
        replacing the relevant parameters if necessary in the lambda
        functions.

        c         ` s   | |    j   S(   N(   R  (   R   R.  (   R    (    s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pyRq  
  s    c         ` s   | |    j   S(   N(   R  (   R   R.  (   R    (    s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pyRq  
  s    (   t   _funcsR  R  R  Ru   R  R  (   R    R@   R.  Ru   R  R  (    (   R    s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pyR  
  s    					c         C` s   |  j  S(   s0   
        Returns the _FuncInfo object.

        (   R  (   R    (    (    s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pyt	   func_info
  s    c         C` s
   |  j  j S(   s@   
        Returns the callable for the direct function.

        (   R  Ru   (   R    (    (    s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pyRu   
  s    c         C` s
   |  j  j S(   sA   
        Returns the callable for the inverse function.

        (   R  R  (   R    (    (    s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pyR  
  s    c         C` s   |  j  j   S(   si   
        Returns a boolean indicating if the function is bounded
        in the [0-1 interval].

        (   R  R  (   R    (    (    s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pyR  
  s    c         C` s  |  j  } d } t j | |  } xX t |  D]J \ } } y t |  | | <Wq. t k
 rw t d | | f   q. Xq. Wt j | d |  } y |  j | } Wn6 t t f k
 r t d | t	 |  j  f   n X| j
 |  st d | | f   n  | | f S(   Ns	   \{(.*?)\}s,   Parameter %i is '%s', which is not a number.s   {p}sK   '%s' is an invalid string. The only strings recognized as functions are %s.s/   %s are invalid values for the parameters in %s.(   R  R   t   findallRf  R2   R   R   R  Rn   Rl   R  (   R    R  t   regexR  R   t   paramR@   (    (    s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pyR  
  s&    	(   R$   R%   R&   R  R  R   R   t   squareR  R  RW   R  R  R  R!   R  t   propertyR  Ru   R  R  R  (    (    (    s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pyR  R
  sj   																	R   t   zorderc         C` s   | t  |    S(   s(  Get the topmost artist of a list.

    In case of a tie, return the *last* of the tied artists, as it will be
    drawn on top of the others. `max` returns the first maximum in case of ties
    (on Py2 this is undocumented but true), so we need to iterate over the list
    in reverse order.
    (   t   reversed(   t   artistst   _cached_max(    (    s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pyt   _topmost_artist
  s    
c         C` s   t  |  t j  o |  | k S(   s   Return whether *obj* is a string equal to string *s*.

    This helper solely exists to handle the case where *obj* is a numpy array,
    because in such cases, a naive ``obj == s`` would yield an array, which
    cannot be used in a boolean context.
    (   R   R   R   (   R   R   (    (    s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pyt
   _str_equal  s    c         C` s"   t  |  t j  o! |  j   | k S(   s  Return whether *obj* is a string equal, when lowercased, to string *s*.

    This helper solely exists to handle the case where *obj* is a numpy array,
    because in such cases, a naive ``obj == s`` would yield an array, which
    cannot be used in a boolean context.
    (   R   R   R   R   (   R   R   (    (    s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pyt   _str_lower_equal  s    c         k` s   t    } g  | D] } | t |  | |  f ^ q } z6 x* | j   D] \ } } t |  | |  qD Wd VWd x@ | D]8 \ } } | | k r t |  |  qt t |  | |  qt WXd S(   sM   Temporarily set some attributes; restore original state at context exit.
    N(   R  R   t   itemst   setattrt   delattr(   R   RT   t   sentinelt   attrt   origsR   R  (    (    s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pyt   _setattr_cm  s    	+	(    (    (   R&   t
   __future__R    R   R   R   t	   six.movesR   R   Rs  t
   contextlibR-   R  t	   functoolsR  R   R   t	   itertoolsR   R   R   t   operatorR   R   R  R+   R\   RQ   R   t   weakrefR   R   t   numpyR   R   t   deprecationR   R	   R
   R   R   R  R   R'   R)   R/   R1   R3   R5   R_   R`   Rl   Ry   t   UserWarningR   R   R   R   R   R   R   R   R   R   R   R   R   RW   R   R   t   contextmanagerR   R   R   R   R   R   R   Rb   R   R  R   R  R  t   get_realpath_and_statR  R   R+  R9  R   R:  R=  R@  RR  RX  RZ  Ra  Rc  Rd  Re  Rg  Rh  Rn  R  R  R  R  R  R  R  R  R  R  R  R  R  R  R(  R7  t	   ls_mapperRm   t   ls_mapper_rRH  RK  RQ  RR  RU  R  R`  Ra  Rf  Rl  Rm  Ro  t   STEP_LOOKUP_MAPRr  Rv  Rx  R  R  R  R  R  R  t   partialR!  t
   attrgetterR  R  R  R  (    (    (    s8   lib/python2.7/site-packages/matplotlib/cbook/__init__.pyt   <module>   s$  	i		0									#
		#/ 	 	
!	(		_		.		
C		N		4"-					G	&	$	%
				k	7^$	
	
