ó
±éRc           @  sÒ  d  Z  d d l m 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 Z d d l Z d d l m Z m Z d d l Z d d l j Z d e f d „  ƒ  YZ e Z d d d e d	 d
 „ Z d d d e d	 d „ Z d d d e d d „ Z  e j! d d k r‚d „  Z" n	 d „  Z" d e# f d „  ƒ  YZ$ d e$ f d „  ƒ  YZ% d e$ f d „  ƒ  YZ& d e$ f d „  ƒ  YZ' d e$ f d „  ƒ  YZ( d e$ f d „  ƒ  YZ) d e# f d „  ƒ  YZ* d  d| d! „  ƒ  YZ+ d" e j, f d# „  ƒ  YZ- d$ e- f d% „  ƒ  YZ. d& e- f d' „  ƒ  YZ/ d( e0 f d) „  ƒ  YZ1 d* „  Z2 d+ d} d, „  ƒ  YZ3 d- „  Z4 d. „  Z5 d/ „  Z6 d0 „  Z7 d1 „  Z8 d2 „  Z9 d3 „  Z: d4 e d5 „ Z; d6 „  Z< e= d7 „ Z> e< d8 „ Z? d9 d~ d: „  ƒ  YZ@ d; eA f d< „  ƒ  YZB d= d> „ ZC d? d d@ „  ƒ  YZD dA dB „ ZE dC d€ dD „  ƒ  YZF eF ƒ  ZG dE „  ZH dF d� dG „  ƒ  YZI dH „  ZJ dI „  ZK e jL dJ ƒ ZM i  ZN dK „  ZO dL dM d dN „ ZP dO „  ZQ dP dQ „ ZR d dR „ ZT dS „  ZU dT „  ZV dU „  ZW dV „  ZX dW eA f dX „  ƒ  YZY dY e# f dZ „  ƒ  YZZ d[ „  Z[ e d\ „ Z\ d] „  Z] d^ „  Z^ d d_ „ Z_ d` Z` da „  Za db „  Zb dc „  Zc dd d‚ de „  ƒ  YZd e je e df „ Zf dg e# f dh „  ƒ  YZg di „  Zh dj „  Zi dk „  Zj e= dl „ Zk dƒ d„ d… d† g Zl eA el ƒ Zm em jn g  el D] Zo eo dM eo d f ^ q>ƒ du „  Zp dv „  Zq dw e# f dx „  ƒ  YZr dy e# f dz „  ƒ  YZs y e jt Wn eu k
 rÄe jv Zw n
 Xd{ „  Zw 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   print_functionN(   t   reduce(   t   reft   WeakKeyDictionaryt   MatplotlibDeprecationWarningc           B  s   e  Z d  Z RS(   s”  
    A class for issuing deprecation warnings for Matplotlib users.

    In light of the fact that Python builtin DeprecationWarnings are ignored
    by default as of Python 2.7 (see link below), this class was put in to
    allow for the signaling of deprecation, but via UserWarnings which are not
    ignored by default.

    http://docs.python.org/dev/whatsnew/2.7.html#the-future-for-python-2-x
    (   t   __name__t
   __module__t   __doc__(    (    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/cbook.pyR       s   
t    t	   attributec         C  sl   | sh d } | r d } n d } | r4 d | } n  | i | d 6| d 6| d 6| d 6|  d	 6| } n  | S(
   NR   sA   The %(func)s %(obj_type)s will be deprecated in a future version.s>   The %(func)s %(obj_type)s was deprecated in version %(since)s.s    Use %s instead.t   funct   namet   alternativet   obj_typet   since(    (   R   t   messageR   R   t   pendingR   t
   altmessage(    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/cbook.pyt   _generate_deprecation_message0   s    	
c         C  s5   t  |  | | | | | ƒ } t j | t d d ƒd S(   s‘  
    Used to display deprecation warning in a standard way.

    Parameters
    ------------
    since : str
        The release at which this API became deprecated.

    message : str, optional
        Override the default deprecation message.  The format
        specifier `%(func)s` may be used for the name of the function,
        and `%(alternative)s` may be used in the deprecation message
        to insert the name of an alternative to the deprecated
        function.  `%(obj_type)` may be used to insert a friendly name
        for the type of object being deprecated.

    name : str, optional
        The name of the deprecated function; if not provided the name
        is automatically determined from the passed in function,
        though this is useful in the case of renamed functions, where
        the new function is just assigned to the name of the
        deprecated function.  For example::

            def new_function():
                ...
            oldFunction = new_function

    alternative : str, optional
        An alternative function that the user may use in place of the
        deprecated function.  The deprecation warning will tell the user about
        this alternative if provided.

    pending : bool, optional
        If True, uses a PendingDeprecationWarning instead of a
        DeprecationWarning.

    obj_type : str, optional
        The object type being deprecated.
    t
   stackleveli   N(   R   t   warningst   warnt   mplDeprecation(   R   R   R   R   R   R   (    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/cbook.pyt   warn_deprecatedM   s    *t   functionc           s"   | | | | ‡  ‡ f d † } | S(   sT  
    Used to mark a function as deprecated.

    Parameters
    ------------
    since : str
        The release at which this API became deprecated.  This is
        required.

    message : str, optional
        Override the default deprecation message.  The format
        specifier `%(func)s` may be used for the name of the function,
        and `%(alternative)s` may be used in the deprecation message
        to insert the name of an alternative to the deprecated
        function.  `%(obj_type)` may be used to insert a friendly name
        for the type of object being deprecated.

    name : str, optional
        The name of the deprecated function; if not provided the name
        is automatically determined from the passed in function,
        though this is useful in the case of renamed functions, where
        the new function is just assigned to the name of the
        deprecated function.  For example::

            def new_function():
                ...
            oldFunction = new_function

    alternative : str, optional
        An alternative function that the user may use in place of the
        deprecated function.  The deprecation warning will tell the user about
        this alternative if provided.

    pending : bool, optional
        If True, uses a PendingDeprecationWarning instead of a
        DeprecationWarning.
    c           s~  d d  l  } d d  l } t ˆ  t ƒ r� y ˆ  j ‰  Wn] t k
 r“ ˆ  j d  t ƒ } t	 | d ƒ rq | j ‰  q” t	 | d ƒ rŒ | j
 ‰  q” ˆ  Sn Xt } n t } | sµ ˆ  j } n  t ˆ ˆ | | | ˆ ƒ ‰ | j ˆ  ƒ ‡  ‡ f d †  ƒ }	 |	 j }
 |
 s	d }
 n  | j |
 ƒ j d ƒ }
 ˆ j ƒ  ‰ d i ˆ d 6ˆ d	 6|
 } |
 s\| d
 7} n  | |	 _ | rzt |	 ƒ }	 n  |	 S(   Niÿÿÿÿt   __func__t   im_funcc            s#   t  j ˆ t d d ƒˆ  |  | Ž  S(   NR   i   (   R   R   R   (   t   argst   kwargs(   R
   R   (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/cbook.pyt   deprecated_funcÂ   s    R   s   
s,   
.. deprecated:: %(since)s
    %(message)s

R   R   s   \ (   t	   functoolst   textwrapt
   isinstancet   classmethodR   t   AttributeErrort   __get__t   Nonet   objectt   hasattrR   t   Truet   FalseR   R   t   wrapsR   t   dedentt   strip(   R
   R   R   R   R   R   R   t   methodt   is_classmethodR   t   old_doct   new_doc(   R   R   (   R
   R   sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/cbook.pyt	   deprecate¤   s@    	!			(    (   R   R   R   R   R   R   R0   (    (   R   R   sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/cbook.pyt
   deprecated}   s    '	6i    i   c         C  s—   d d  l  } y/ t j | j d ƒ j ƒ  } | s: d  } n  Wn  t t t f k
 r] d  } n Xt	 |  t
 ƒ r“ | d  k rƒ t |  ƒ St |  | ƒ Sn  |  S(   Niÿÿÿÿs   axes.formatter.use_locale(   t
   matplotlibt   localet   getpreferredencodingt   rcParamsR+   R$   t
   ValueErrort   ImportErrorR"   R    t   bytest   unicode(   t   sR2   t   preferredencoding(    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/cbook.pyt   unicode_safeè   s    

c         C  s…   d d  l  } y/ t j | j d ƒ j ƒ  } | s: d  } n  Wn  t t t f k
 r] d  } n X| d  k rt t	 |  ƒ St	 |  | ƒ Sd  S(   Niÿÿÿÿs   axes.formatter.use_locale(
   R2   R3   R4   R5   R+   R$   R6   R7   R"   R9   (   R:   R2   R;   (    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/cbook.pyR<   ü   s    

t	   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@   (    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/cbook.pyt   __init__  s    	c         C  s   | |  j  k r |  j S| S(   N(   R?   R@   (   RA   R:   (    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/cbook.pyt   __call__  s    c         C  s   | j  ƒ  p | |  j k S(   N(   R+   R?   (   RA   R:   (    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/cbook.pyt
   is_missing  s    N(   R   R   R   R$   RB   RC   RD   (    (    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/cbook.pyR=     s   	t   tostrc           B  s   e  Z d  Z d d d „ Z RS(   s   convert to string or NoneR>   R   c         C  s   t  j |  d | d | ƒd  S(   NR?   R@   (   R=   RB   (   RA   R?   R@   (    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/cbook.pyRB   !  s    (   R   R   R   RB   (    (    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/cbook.pyRE     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=   RB   t   fmt(   RA   RG   R?   R@   (    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/cbook.pyRB   '  s    c         C  s<   |  j  | ƒ r |  j St j | |  j ƒ } t j | d  Œ  S(   Ni   (   RD   R@   t   timet   strptimeRG   t   datetime(   RA   R:   t   tup(    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/cbook.pyRC   ,  s    N(   R   R   R   R$   RB   RC   (    (    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/cbook.pyRF   %  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=   RB   RG   (   RA   RG   R?   R@   (    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/cbook.pyRB   5  s    c         C  s<   |  j  | ƒ r |  j St j | |  j ƒ } t j | d  Œ  S(   Ni   (   RD   R@   RH   RI   RG   RJ   t   date(   RA   R:   RK   (    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/cbook.pyRC   :  s    N(   R   R   R   R$   RB   RC   (    (    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/cbook.pyRL   3  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=   RB   R@   (   RA   R?   R@   (    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/cbook.pyRB   C  s    c         C  s    |  j  | ƒ r |  j St | ƒ S(   N(   RD   R@   t   float(   RA   R:   (    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/cbook.pyRC   G  s    N(   R   R   R   R$   RB   RC   (    (    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/cbook.pyRN   A  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=   RB   (   RA   R?   R@   (    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/cbook.pyRB   O  s    c         C  s    |  j  | ƒ r |  j St | ƒ S(   N(   RD   R@   t   int(   RA   R:   (    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/cbook.pyRC   R  s    N(   R   R   R   R$   RB   RC   (    (    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/cbook.pyRP   M  s   t   _BoundMethodProxyc           B  sD   e  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‚   yO y t  | j ƒ |  _ Wn t k
 r5 d  |  _ n X| j |  _ | j |  _ Wn, t	 k
 r} d  |  _ | |  _ d  |  _ n Xd  S(   N(
   R   t   im_selft   instt	   TypeErrorR$   R   R
   t   im_classt   klassR"   (   RA   t   cb(    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/cbook.pyRB   e  s    		c         C  s9   |  j  j ƒ  } | d } | d  k	 r5 | ƒ  | d <n  | S(   NRT   (   t   __dict__t   copyR$   (   RA   t   dRT   (    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/cbook.pyt   __getstate__r  s
    
c         C  s5   | |  _  | d } | d  k	 r1 t | ƒ |  _ n  d  S(   NRT   (   RY   R$   R   RT   (   RA   t	   statedictRT   (    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/cbook.pyt   __setstate__z  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(   RT   R$   t   ReferenceErrort   typest
   MethodTypeR
   (   RA   R   R   t   mtd(    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/cbook.pyRC   �  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(   RT   R$   R
   t	   ExceptionR(   (   RA   t   other(    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/cbook.pyt   __eq__—  s    ,c         C  s   |  j  | ƒ S(   s$   
        Inverse of __eq__.
        (   Re   (   RA   Rd   (    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/cbook.pyt   __ne__¤  s    (	   R   R   R   RB   R\   R^   RC   Re   Rf   (    (    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/cbook.pyRR   X  s   					t   CallbackRegistryc           B  sD   e  Z 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/articles/python-weak-references/>`_.
    c         G  sA   t  | ƒ r t d d d ƒn  t ƒ  |  _ d |  _ i  |  _ d  S(   Ns   1.3R   sn   CallbackRegistry no longer requires a list of callback types. Ignoring arguments. *args will be removed in 1.5i    (   t   lenR   t   dictt	   callbackst   _cidt   _func_cid_map(   RA   R   (    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/cbook.pyRB   Ñ  s    	
	c         C  s   i  S(   N(    (   RA   (    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/cbook.pyR\   Ú  s    c         C  s   |  j  ƒ  d  S(   N(   RB   (   RA   t   state(    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/cbook.pyR^   ß  s    c         C  s˜   |  j  j | t ƒ  ƒ | |  j  | k r8 |  j  | | S|  j d 7_ |  j } | |  j  | | <|  j j | t ƒ  ƒ t | ƒ } | |  j | | <| S(   si   
        register *func* to be called when a signal *s* is generated
        func will be called
        i   (   Rl   t
   setdefaultR   Rk   Rj   Ri   RR   (   RA   R:   R
   t   cidt   proxy(    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/cbook.pyt   connectã  s    	c         C  s�   x– |  j  j ƒ  D]… \ } } y | | =Wn t k
 r= q q XxP |  j j ƒ  D]? \ } } x0 | j ƒ  D]" \ } } | | k rg | | =qg qg WqN Wd Sq Wd S(   sK   
        disconnect the callback registered with callback id *cid*
        N(   Rj   t   itemst   KeyErrorRl   (   RA   Ro   t	   eventnamet	   callbackdt   categoryt	   functionsR   t   value(    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/cbook.pyt
   disconnectô  s    c         O  sy   | |  j  k ru xc |  j  | j ƒ  D]K \ } } | j d k	 ra | j ƒ  d k ra |  j  | | =q# | | | Ž  q# 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(   Rj   Rr   RT   R$   (   RA   R:   R   R   Ro   Rp   (    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/cbook.pyt   process  s
     !(	   R   R   R   RB   R\   R^   Rq   Ry   Rz   (    (    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/cbook.pyRg   «  s   %						t	   Schedulerc           B  s2   e  Z d  Z e j ƒ  Z d Z d „  Z d „  Z RS(   s4   
    Base class for timeout and idle scheduling
    i    c         C  sG   t  j j |  ƒ t j |  _ t |  _ t j d 7_ t  j ƒ  |  _ d  S(   Ni   (	   t	   threadingt   ThreadRB   R{   t   idR(   t   _stoppedt   Eventt
   _stopevent(   RA   (    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/cbook.pyRB     s
    	c         C  s1   |  j  r d  S|  j j ƒ  |  j ƒ  t |  _  d  S(   N(   R   R�   t   sett   joinR'   (   RA   (    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/cbook.pyt   stop   s
    	
(	   R   R   R   R|   t   Lockt   idlelockR~   RB   R„   (    (    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/cbook.pyR{     s
   	t   Timeoutc           B  s    e  Z d  Z d „  Z d „  Z RS(   s?   
    Schedule recurring events with a wait time in seconds
    c         C  s#   t  j |  ƒ | |  _ | |  _ d  S(   N(   R{   RB   t   waitR
   (   RA   Rˆ   R
   (    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/cbook.pyRB   ,  s    	c         C  s`   xY |  j  j ƒ  s[ |  j  j |  j ƒ t j j ƒ  |  j |  ƒ } t j j ƒ  | s Pq q Wd  S(   N(   R�   t   isSetRˆ   R{   R†   t   acquireR
   t   release(   RA   t   b(    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/cbook.pyt   run1  s    (   R   R   R   RB   R�   (    (    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/cbook.pyR‡   (  s   	t   Idlec           B  s&   e  Z d  Z d Z d „  Z d „  Z RS(   s3   
    Schedule callbacks when scheduler is idle
    gš™™™™™©?c         C  s   t  j |  ƒ | |  _ d  S(   N(   R{   RB   R
   (   RA   R
   (    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/cbook.pyRB   E  s    c         C  s`   xY |  j  j ƒ  s[ |  j  j t j ƒ t j j ƒ  |  j |  ƒ } t j j	 ƒ  | s Pq q Wd  S(   N(
   R�   R‰   Rˆ   RŽ   t   waittimeR{   R†   RŠ   R
   R‹   (   RA   RŒ   (    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/cbook.pyR�   I  s    (   R   R   R   R�   RB   R�   (    (    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/cbook.pyRŽ   <  s   	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(   RA   R‘   t   seq(    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/cbook.pyRB   Z  s    	c         C  s   d t  |  ƒ |  j f S(   Ns   <a list of %d %s objects>(   Rh   R‘   (   RA   (    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/cbook.pyt   __repr___  s    c         C  s
   t  |  ƒ S(   N(   t   repr(   RA   (    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/cbook.pyt   __str__b  s    c         C  s   i |  j  d 6|  d 6S(   NR‘   R“   (   R‘   (   RA   (    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/cbook.pyR\   e  s    c         C  s"   | d |  _  |  j | d ƒ d  S(   NR‘   R“   (   R‘   R’   (   RA   Rm   (    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/cbook.pyR^   i  s    N(	   R   R   R   R$   RB   R”   R–   R\   R^   (    (    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/cbook.pyR�   T  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   iÿÿÿÿR   (   s   \mathdefaults   \rms   \cals   \tts   \its   \R—   R˜   (   t   replace(   R:   t   removet   r(    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/cbook.pyt
   strip_mathn  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: http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/52308
    c         K  s   |  j  j | ƒ d  S(   N(   RY   t   update(   RA   t   kwds(    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/cbook.pyRB   „  s    c         C  sD   |  j  j ƒ  } d d j g  | D] } d | |  j  | f ^ q ƒ S(   Ns	   Bunch(%s)s   , s   %s=%s(   RY   t   iterkeysRƒ   (   RA   t   keyst   k(    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/cbook.pyR”   ‡  s    (   R   R   R   RB   R”   (    (    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/cbook.pyR�   w  s   	c         C  s)   t  g  |  D] } | d f ^ q
 ƒ j ƒ  S(   s'   Return a list of unique elements of *x*i   (   Ri   R¡   (   t   xt   val(    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/cbook.pyt   uniqueŽ  s    c         C  s'   y t  |  ƒ Wn t k
 r" t SXt S(   s    return true if *obj* is iterable(   t   iterRU   R(   R'   (   t   obj(    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/cbook.pyt   iterable“  s
    c         C  so   t  |  t t f ƒ r t St j |  ƒ rT |  j d k rM |  j j d k rM t St	 Sn  y |  d Wn t	 SXt S(   s(   Return True if *obj* looks like a stringi    t   SUR   (
   R    t   strR9   R'   t   mat   isMaskedArrayt   ndimt   dtypet   kindR(   (   R§   (    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/cbook.pyt   is_string_likeœ  s    !c         C  sE   t  |  ƒ s t St |  ƒ r  t Sx |  D] } t | ƒ s' t Sq' Wt S(   s@   
    Returns true if *obj* is iterable and contains strings
    (   R¨   R(   R°   R'   (   R§   t   o(    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/cbook.pyt   is_sequence_of_strings­  s    c         C  s   t  |  d ƒ o t |  j ƒ S(   sC   return true if *obj* looks like a file object with a *write* methodt   write(   R&   t   callableR³   (   R§   (    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/cbook.pyt   is_writable_file_like»  s    c         C  s   t  |  ƒ o t |  ƒ S(   s;   return true if *obj* is not string like and is not iterable(   R°   R¨   (   R§   (    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/cbook.pyt	   is_scalarÀ  s    c         C  s   y |  d Wn t  SXt Sd S(   s(   return true if *obj* looks like a numberi   N(   R(   R'   (   R§   (    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/cbook.pyt
   is_numlikeÅ  s
    t   rUc         C  sÚ   t  |  ƒ rœ |  j d ƒ rB | j d d ƒ } t j |  | ƒ } nQ |  j d ƒ r„ | j d d ƒ } d d l } | j |  | ƒ } n t |  | ƒ } t } n* t |  d ƒ rº |  } t	 } n t
 d ƒ ‚ | rÖ | | f S| S(	   s±   
    *fname* can be a filename 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`
    s   .gzt   UR   s   .bz2iÿÿÿÿNt   seeks%   fname must be a string or file handle(   R°   t   endswithR™   t   gzipt   opent   bz2t   BZ2FileR'   R&   R(   R6   (   t   fnamet   flagt   return_openedt   fhR¾   t   opened(    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/cbook.pyt   to_filehandleÏ  s"    		
c         C  s   t  |  ƒ p t |  ƒ S(   s;   Return whether the given object is a scalar or string like.(   R°   R¨   (   R¤   (    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/cbook.pyt   is_scalar_or_stringì  s    c         C  så   d d l  } | j d r) | j d } n$ t j j t j j t ƒ d 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.
    iÿÿÿÿNs   examples.directorys   mpl-datat   sample_datas   .csvs   .xrcs   .txtR›   t   rbs   .gz(   s   .csvs   .xrcs   .txt(   R2   R5   t   ost   pathRƒ   t   dirnamet   __file__t   splitextt   lowerR¼   R½   (   RÀ   t	   asfileobjR2   t   rootRÊ   t   modet   baset   ext(    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/cbook.pyt   get_sample_datañ  s     		c         c  sH   xA |  D]9 } | | ƒ r! | Vq x t  | | ƒ D] } | Vq1 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: http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/121294
    and Recipe 1.12 in cookbook
    N(   t   flatten(   R“   t   scalarpt   itemt   subitem(    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/cbook.pyRÕ     s
    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(   RA   t   datat   auxt   inplacet   junkt   it   result(    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/cbook.pyt   _helperA  s
    
#
i   c         C  s„   | d  k r: | r% | j ƒ  | } n | } | j ƒ  | Sg  t t | ƒ ƒ D] } | | | | f ^ qM } |  j | | | ƒ Sd  S(   N(   R$   RÚ   t   rangeRh   Rá   (   RA   RÛ   t	   itemindexRÝ   Rà   Rß   RÜ   (    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/cbook.pyt   byItemH  s    
	
3c         C  sK   g  t  t | ƒ ƒ D] } t | | | ƒ | f ^ q } |  j | | | ƒ S(   N(   Râ   Rh   t   getattrRá   (   RA   RÛ   t   attributenameRÝ   Rß   RÜ   (    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/cbook.pyt   byAttributeU  s    8N(	   R   R   R   Rá   R$   Rä   Rç   RÚ   RC   (    (    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/cbook.pyRÙ   .  s   	t   Xlatorc           B  s)   e  Z d  Z d „  Z d „  Z d „  Z RS(   sm  
    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 |  j ƒ  ƒ ƒ ƒ S(   s=    Build re object based on the keys of the current dictionary t   |(   t   ret   compileRƒ   t   mapt   escapeR    (   RA   (    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/cbook.pyt   _make_regexq  s    c         C  s   |  | j  d ƒ S(   s(    Handler invoked for each regex *match* i    (   t   group(   RA   t   match(    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/cbook.pyRC   u  s    c         C  s   |  j  ƒ  j |  | ƒ S(   s.    Translate *text*, returns the modified text. (   Rî   t   sub(   RA   t   text(    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/cbook.pyt   xlaty  s    (   R   R   R   Rî   RC   Ró   (    (    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/cbook.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   Aiÿÿÿÿi   t   0(   t   uppert   isalphat   ordR™   (   R   Rh   t   soundex_digitst   sndxt   fct   cR[   (    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/cbook.pyt   soundex~  s    	R>   c           B  sV   e  Z d  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z	 d „  Z
 RS(	   s0    Null objects always and reliably "do nothing." c         O  s   d  S(   N(    (   RA   R   R   (    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/cbook.pyRB   �  s    c         O  s   |  S(   N(    (   RA   R   R   (    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/cbook.pyRC      s    c         C  s   d S(   Ns   Null()(    (   RA   (    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/cbook.pyR–   £  s    c         C  s   d S(   Ns   Null()(    (   RA   (    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/cbook.pyR”   ¦  s    c         C  s   d S(   Ni    (    (   RA   (    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/cbook.pyt   __nonzero__©  s    c         C  s   |  S(   N(    (   RA   R   (    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/cbook.pyt   __getattr__¬  s    c         C  s   |  S(   N(    (   RA   R   Rx   (    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/cbook.pyt   __setattr__¯  s    c         C  s   |  S(   N(    (   RA   R   (    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/cbook.pyt   __delattr__²  s    (   R   R   R   RB   RC   R–   R”   Rÿ   R   R  R  (    (    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/cbook.pyR>   š  s   							iÿ  c         C  sÏ   yŠ t  j j |  ƒ s‰ t  j j |  ƒ } x_ t d t | ƒ d ƒ D]A } t  j j | |  Œ  } t  j j | ƒ sA t  j | | ƒ qA qA Wn  Wn> t k
 rÊ } | j	 t	 j
 k sÁ t  j j |  ƒ rË ‚  qË n Xd S(   s‡   
    make directory *newdir* recursively, and set *mode*.  Equivalent to ::

        > mkdir -p NEWDIR
        > chmod MODE NEWDIR
    i   N(   RÉ   RÊ   t   existst   splitRâ   Rh   Rƒ   t   makedirst   OSErrort   errnot   EEXISTt   isdir(   t   newdirRÑ   t   partsRß   t   thispartt   err(    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/cbook.pyt   mkdirs¶  s     %t   GetRealpathAndStatc           B  s   e  Z d  „  Z d „  Z RS(   c         C  s   i  |  _  d  S(   N(   t   _cache(   RA   (    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/cbook.pyRB   Ì  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(   RA   RÊ   Rà   R  t   stat_keyR  (    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/cbook.pyRC   Ï  s    	(   R   R   RB   RC   (    (    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/cbook.pyR  Ë  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(   Rs   (   R[   R¡   t   key(    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/cbook.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Û   (   RA   t   size_max(    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/cbook.pyRB   é  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  (   RA   R£   (    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/cbook.pyt   appendï  s    c         C  s   |  j  |  j |  j  |  j  S(   s*    return list of elements in correct order (   RÛ   R   (   RA   (    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/cbook.pyR  ô  s    (   R   R   R   R!  R  (    (    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/cbook.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Û   R!  Rh   R  R   t   _RingBuffer__Fullt	   __class__(   RA   R£   (    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/cbook.pyR!  ø  s    	c         C  s   |  j  S(   s:    Return a list of elements from the oldest to the newest. (   RÛ   (   RA   (    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/cbook.pyR     s    c         C  s   |  j  | t |  j  ƒ S(   N(   RÛ   Rh   (   RA   Rß   (    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/cbook.pyt   __get_item__  s    (    (   R   R   R   RB   R"  R!  R  R$  (    (    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/cbook.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   (   t   zipt   xrangeRh   (   R“   t   Nt   sLent   wordt   ind(    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/cbook.pyt   get_split_ind  s    	(c         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   (   Rh   t
   expandtabsR  R+  R!  Rƒ   (   t   prefixRò   t   colst   padt	   availableR“   t   NseqR*  t   linest   lastIndt   rett   line(    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/cbook.pyt   wrap  s    s   (?:(?:
?)|^)( *)\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à   (    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/cbook.pyR*   6  s    t   *i   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   isfileR!  (   RÐ   t   patternst   recurset   return_foldersRÉ   RA  t   pattern_listt   resultsRË   t   dirst   filesR   t   fullnamet   pattern(    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/cbook.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
    RF  i   RG  (   RÉ   RÊ   RD  R!  R	  RN  R’   t   islink(   R   RK  t   argt   newfilest   f(    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/cbook.pyt   get_recursive_filelistz  s    i   c         c  s@   d } x3 |  | | | !} t  | ƒ s* Pn  | V| | 7} q	 d S(   s$   Break up the *seq* into *num* tuplesi    N(   Rh   (   R“   t   numR:  R×   (    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/cbook.pyt   piecesŒ  s    c         C  sg   t  j d d k  r" t j ƒ  } n t j ƒ  } |  d  k	 rM t |  d | ƒn  t j d | ƒ | j	 ƒ  S(   Ni    i   t   file(
   R  t   version_infot   iot   BytesIOt   StringIOR$   t   printt	   tracebackt	   print_exct   getvalue(   R:   t   sh(    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/cbook.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   (   Rh   R'   R&  R(   (   R“   R¤   Rß   t   thisval(    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/cbook.pyt   allequal¢  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*.
    (   Rh   R(   R'   (   R“   R¤   (    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/cbook.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*.
    (   Rh   R(   R'   (   R“   R¤   (    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/cbook.pyt   onetrue¾  s    c         C  s>   g  t  |  ƒ D]- \ } } |  | d D] } | | f ^ q% q S(   s  
    return all possible pairs in sequence *x*

    Condensed by Alex Martelli from this thread_ on c.l.python

    .. _thread: http://groups.google.com/groups?q=all+pairs+group:*python*&hl=en&lr=&ie=UTF-8&selm=mailman.4028.1096403649.5135.python-list%40python.org&rnum=1
    i   (   t	   enumerate(   R£   Rß   RR  R:   (    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/cbook.pyt   allpairsË  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 contrain size, just setitem, so use with
    caution
    c         C  s#   t  j |  ƒ | |  _ g  |  _ d  S(   N(   Ri   RB   t   maxsizet	   _killkeys(   RA   Rh  (    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/cbook.pyRB   Ü  s    	c         C  sf   | |  k rO t  |  ƒ |  j k r< |  |  j d =|  j d =n  |  j j | ƒ n  t j |  | | ƒ d  S(   Ni    (   Rh   Rh  Ri  R!  Ri   t   __setitem__(   RA   R¢   t   v(    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/cbook.pyRj  á  s    (   R   R   R   RB   Rj  (    (    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/cbook.pyRg  Ö  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(   RA   t   default(    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/cbook.pyRB   ñ  s    
c         C  s(   t  |  j ƒ s |  j S|  j |  j Sd S(   s#   return the current element, or NoneN(   Rh   t	   _elementsRn  t   _pos(   RA   (    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/cbook.pyRC   õ  s    c         C  s   |  j  j ƒ  S(   N(   Rp  t   __len__(   RA   (    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/cbook.pyRr  ü  s    c         C  s   |  j  j | ƒ S(   N(   Rp  t   __getitem__(   RA   R*  (    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/cbook.pyRs  ÿ  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   (   Rh   Rp  Rq  (   RA   R'  (    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/cbook.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   (   Rq  (   RA   (    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/cbook.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   (   Rp  Rq  R!  Rh   (   RA   R±   (    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/cbook.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    (   Rh   Rp  Rv  (   RA   (    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/cbook.pyt   home  s    c         C  s   t  |  j ƒ d k S(   Ni    (   Rh   Rp  (   RA   (    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/cbook.pyt   empty   s    c         C  s   d |  _  g  |  _ d S(   s   empty the stackiÿÿÿÿN(   Rq  Rp  (   RA   (    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/cbook.pyRm  #  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(   Rp  R6   Rm  R!  Rv  (   RA   R±   t   oldt   bubblest   thiso(    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/cbook.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(   Rp  R6   Rm  Rv  (   RA   R±   Ry  R{  (    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/cbook.pyRš   <  s    

N(   R   R   R   R$   RB   RC   Rr  Rs  Rt  Ru  Rv  Rw  Rx  Rm  R|  Rš   (    (    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/cbook.pyRl  ê  s   						
				c         C  s+   x$ t  t |  ƒ ƒ D] } |  j ƒ  q Wd S(   s   empty a listN(   R&  Rh   t   pop(   R“   Rß   (    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/cbook.pyt   popallI  s    c         C  s¯   | r: g  t  |  ƒ D] } t | ƒ r | | f ^ q } nC g  t  |  ƒ D]$ } t | ƒ rG | j ƒ  | f ^ qG } | 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Î   t   find(   R±   Rð   t   caseR   t   namest   orig(    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/cbook.pyt   finddirO  s    4$c         C  s/   t  g  |  j ƒ  D] \ } } | | f ^ q ƒ S(   sA   reverse the dictionary -- may lose data if values are not unique!(   Ri   t	   iteritems(   R[   R¢   Rk  (    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/cbook.pyt   reverse_dict]  s    c         C  s;   t  g  |  j ƒ  D]$ \ } } | | k r | | f ^ q ƒ S(   sn   
    Return a dictionary that contains those keys that appear in both
    d and keys, with values from d.
    (   Ri   R…  (   R[   R¡   R¢   Rk  (    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/cbook.pyt   restrict_dictb  s    c         C  s&  d d l  m } m } t j ƒ  } t j d k r“ y) | d | d t d | ƒj j	 ƒ  } Wn t
 k
 ry t d ƒ ‚ n Xt | d j ƒ  ƒ } n�t j j d ƒ ry) | d	 | d t d | ƒj j	 ƒ  } Wn t
 k
 rí t d
 ƒ ‚ n Xt | d j ƒ  d ƒ } nt j j d ƒ rƒy) | d | d t d | ƒj j	 ƒ  } Wn t
 k
 ret d ƒ ‚ n Xt | d j ƒ  d ƒ } nŸ t j j d ƒ ry/ | 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   sunos5s   ps -p %d -o oszt   shellt   stdouts?   report_memory works on Sun OS only if the 'ps' program is foundt   linuxs   ps -p %d -o rss,szs>   report_memory works on Linux only if the 'ps' program is foundi   t   darwins   ps -p %d -o rss,vszs?   report_memory works on Mac OS only if the 'ps' program is foundi    t   wint   tasklists   /nhs   /fis	   pid eq %dsF   report_memory works on Windows only if the 'tasklist' program is foundiþÿÿÿt   ,R   s%   We don't have a memory monitor for %s(   t   matplotlib.compat.subprocessRˆ  R‰  RÉ   t   getpidR  R  R'   RŒ  t	   readlinesR  t   NotImplementedErrorRQ   R+   t
   startswithR  t   readR™   (   Rß   Rˆ  R‰  t   pidt   a2t   mem(    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/cbook.pyt   report_memoryj  sJ    +s0   In safezip, len(args[0])=%d but len(args[%d])=%dc          G  ss   t  |  d ƒ } xV t |  d ƒ D]D \ } } t  | ƒ | k r! t t | | d t  | ƒ f ƒ ‚ q! q! Wt |  Œ  S(   s-   make sure *args* are equal len before zippingi    i   (   Rh   Re  R6   t   _safezip_msgR%  (   R   t   NxRß   RP  (    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/cbook.pyt   safezipš  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
   issubclassRU   R(   (   R£   RW   (    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/cbook.pyt   issubclass_safe£  s    c         C  sN   t  j |  ƒ }  y& t  j j |  d t ƒ} | j ƒ  Wn t k
 rI |  SX| S(   NRZ   (   t   npt
   asanyarrayR«   t   masked_invalidR(   t   shrink_maskRU   (   R£   t   xm(    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/cbook.pyt   safe_masked_invalid¬  s    t   MemoryMonitorc           B  sS   e  Z d  d „ Z d „  Z d „  Z d d „ Z d d d „ Z d d d
 d	 „ Z RS(   i N  c         C  s5   | |  _  t j |  j  f t j ƒ |  _ |  j ƒ  d  S(   N(   t   _nmaxR¡  t   zerost   int32t   _memRm  (   RA   t   nmax(    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/cbook.pyRB   ·  s    	c         C  s   d |  _  t |  _ d  S(   Ni    (   t   _nR(   t	   _overflow(   RA   (    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/cbook.pyRm  ¼  s    	c         C  sJ   t  ƒ  } |  j |  j k  r= | |  j |  j <|  j d 7_ n	 t |  _ | S(   Ni   (   R›  R­  R¨  R«  R'   R®  (   RA   Rš  (    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/cbook.pyRC   À  s    		i   c      	   C  s&  |  j  } t | | ƒ } t | | ƒ } t d | | ƒ } | d | d <t ƒ  t d ƒ t d |  j d ƒ xœ t d t | ƒ ƒ D]… } | | | | d } | d k r± qƒ n  |  j | | |  j | | d } t d | | |  j | | | | t | ƒ f ƒ qƒ W|  j r"t d ƒ n  d  S(   Ni    i   iÿÿÿÿs(   memory report: i, mem, dmem, dmem/nloopss   %5d %5d %3d %8.3fs:   Warning: array size was too small for the number of calls.(	   R­  t   minRQ   Râ   R[  R«  Rh   RO   R®  (   RA   t   segmentst   nt   dnt   iiRß   t   dit   dm(    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/cbook.pyt   reportÉ  s"    	
$	i    i   c         C  s5   t  j | |  j | ƒ } | |  j | |  j | … f S(   N(   R¡  t   arangeR­  R«  (   RA   t   i0t   isubR£   (    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/cbook.pyt   xyÜ  s    c         C  sa   | d  k r( d d l m } | ƒ  } n  | j d ƒ } | j |  j | | ƒ Œ  | j j ƒ  d  S(   Niÿÿÿÿ(   t   figureio   (   R$   t   pylabR»  t   add_subplott   plotRº  t   canvast   draw(   RA   R¸  R¹  t   figR»  t   ax(    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/cbook.pyR¾  à  s    N(	   R   R   RB   Rm  RC   R¶  Rº  R$   R¾  (    (    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/cbook.pyR§  ¶  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           sK  x7t  |  ƒ D])\ } } |  | d t |  ƒ } ˆ  j d t t | ƒ ƒ ƒ t | t ƒ rË xÉ | j ƒ  D]Z \ } } | | k r� ˆ  j d t | ƒ ƒ Pn  | | k rj ˆ  j d t | ƒ ƒ Pqj qj 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   
(   Re  Rh   R³   Rª   R‘   R    Ri   R…  R•   t   listt   indext   tuple(   RÊ   Rß   t   stept   nextR  R¤   (   t	   outstream(    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/cbook.pyt
   print_pathú  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³   Rh   R$   R~   t   get_referentsR    (   R§   R:  t   allt   current_patht	   referentst   referent(   RÃ  t   gct   objectsRÉ  RÊ  RF  t   show_progress(    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/cbook.pyRF    s    s   Examining: %r
(   RÐ  R`   RÃ  R³   (   RÑ  RÉ  RÒ  R§   (    (   RÃ  RÐ  RÑ  RÉ  RÊ  RF  RÒ  sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/cbook.pyt   print_cyclesê  s    !t   Grouperc           B  sP   e  Z d  Z g  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 retreived 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   (   RA   t   initt   mappingR£   (    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/cbook.pyRB   Q  s    c         C  s   t  | ƒ |  j k S(   N(   R   RÕ  (   RA   R×   (    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/cbook.pyt   __contains__V  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š   (   RA   R×  R  t   to_dropR¤   (    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/cbook.pyt   cleanY  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Õ  Rn   R   R  R$   R!  Rh   R’   RÚ  (   RA   t   aR   R×  t   set_aRP  t   set_bt   elem(    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/cbook.pyRƒ   c  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   Rs   R(   (   RA   RÛ  RŒ   R×  (    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/cbook.pyt   joinedy  s    
	"c         c  s³   |  j  ƒ  d d d „  ƒ  Y} | ƒ  } xR |  j j ƒ  D]A } | d | k	 r6 g  | D] } | ƒ  ^ qS V| j | ƒ q6 q6 Wx1 |  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().
        t   Tokenc           B  s   e  Z RS(    (   R   R   (    (    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/cbook.pyRà  �  s   iÿÿÿÿN(    (   RÚ  RÕ  t
   itervaluesR!  (   RA   Rà  t   tokenRï   R£   (    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/cbook.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   (   RA   RÛ  t   siblingsR£   (    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/cbook.pyt   get_siblings�  s    
$(
   R   R   R   RB   RØ  RÚ  Rƒ   Rß  Rã  Rå  (    (    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/cbook.pyRÔ  -  s   #		
			c   	      C  sð   | d k r |  St  j | ƒ } t |  ƒ d | d } t |  j ƒ } | | d <t  j | |  j ƒ } |  d | d <|  d d !} |  d } | | | } t | ƒ } x2 t d | ƒ D]! } | | | | | d  | … <q´ W| | | d  | … <| S(   Ni   i    iÿÿÿÿ(	   R¡  t   floorRh   RÄ  t   shapeR©  R®   RQ   Râ   (	   RÛ  t   stepst
   new_lengtht	   new_shapeRà   t   a0t   a1t   deltaRß   (    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/cbook.pyt   simple_linear_interpolation§  s     

c         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(   NR>  s   .*(   RÉ   RÊ   R	  t   globRƒ   t   recursive_removet
   removedirsRš   (   RÊ   RÀ   (    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/cbook.pyRð  ½  s    #
c    
      G  sœ  t  |  ƒ s d St |  d ƒ s1 t |  d ƒ r@ t d ƒ ‚ n  t  |  d ƒ } g  } t g t  |  ƒ } xž t |  ƒ D]� \ } } t | ƒ rù t | ƒ rù t  | ƒ | k rù t | | <t j | ƒ rç | j	 d k rö t d ƒ ‚ qö qù t
 j | ƒ } n  | j | ƒ qv Wg  } x³ t | ƒ D]¥ \ } } | | r| j	 d k rHqn  t j | ƒ rz| j t j | ƒ ƒ | j } n | } y5 t
 j | ƒ } t | t
 j ƒ r´| j | ƒ n  WqÂqÂXqqWt  | ƒ rOt t
 j | ƒ } | j ƒ  d }	 t  |	 ƒ | k  rOxC t | ƒ D]2 \ } } | | r| j |	 d d ƒ| | <qqWqOn  xF t | ƒ D]8 \ } } | | r\t j | ƒ r\| j ƒ  | | <q\q\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(    (   Rh   R°   R¨   R6   R(   Re  R'   R«   t   isMAR­   R¡  t   asarrayR!  t   getmaskarrayRÛ   t   isfiniteR    t   ndarrayR   t   logical_andt   nonzerot   taket   filled(
   R   t   nrecst   margst   seqlistRß   R£   t   maskst   xdt   maskt   igood(    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/cbook.pyt   delete_masked_pointsË  sR     !+


&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   iÿÿÿÿi    NRò  (   i   (   i   (   i    (   t   reshapet   sizeR¡  t   concatenateR·  Rh   t   compresst   AssertionErrorR$   t   newaxist   cumsum(   R  t
   compressedt   mt   indicest   mdifR¸  t   i1t
   seglengthst   breakpointst   ic0t   ic1(    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/cbook.pyt   unmasked_index_ranges  s      ?
t   -t   solids   --t   dasheds   -.t   dashdott   :t   dottedc         '  s»   d d ‡  f d †  ƒ  Y} g  | D] } | | ƒ ^ q  } t  } } xr g  g  | D] } | j ^ qO D] } | rb | ^ qb } | r³ t | ƒ } | g  | D] } | | ƒ ^ q– f VqE PqE d 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  Rx   t   iternext(   RA   R  (    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/cbook.pyRB   ^  s    	c           sP   y( t  |  j ƒ |  _ ˆ  |  j ƒ |  _ Wn! t k
 rK d  |  _ |  _ n Xd  S(   N(   RÈ  R  Rx   R  t   StopIterationR$   (   RA   (   R
   (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/cbook.pyR  c  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  Rx   R  R6   (   RA   R  t   retval(    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/cbook.pyRC   j  s    	(   R   R   RB   R  RC   (    (   R
   (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/cbook.pyR  ]  s   	N(    (   R'   R  R¯  (   R
   t	   iterablesR  R  t   iterst   minvalst   minkeyt   _f(    (   R
   sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/cbook.pyt   align_iteratorsT  s    	
5'c         C  sl   y t  |  ƒ }  Wn t k
 r/ t d ƒ ‚ n X|  j d ƒ |  j d ƒ } | d k oe | d d k } | S(   NsN   matplotlib display text must have all code points < 128 or use Unicode stringst   $s   \$i    i   (   R9   t   UnicodeDecodeErrorR6   t   count(   R:   t   dollar_countt   even_dollars(    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/cbook.pyt   is_math_text€  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å   R,  R#  (   RA   t   containing_classt
   class_namet   nested_classt   nested_instance(    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/cbook.pyRC   —  s    		(   R   R   R   RC   (    (    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/cbook.pyR,  �  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  s   | j  |  _ | j j |  _ d S(   s-   Takes an instancemethod as its only argument.N(   RS   t
   parent_objR   R   t   instancemethod_name(   RA   t   instancemethod(    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/cbook.pyRB   ©  s    c         C  s   t  |  j |  j ƒ S(   N(   Rå   R2  R3  (   RA   (    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/cbook.pyt   get_instancemethod®  s    (   R   R   R   RB   R5  (    (    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/cbook.pyR1  ¤  s   	c         C  s   t  j |  | d | ƒS(   Nt   where(   R¡  t   copyto(   RÛ  R  t   values(    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/cbook.pyt   _putmaskÀ  s    (    (    (    (    (    (    (    (   R  R  (   s   --R  (   s   -.R  (   R  R  (x   R   t
   __future__R    RJ   R  R   R   Rï  R¼   RX  R3   RÉ   Rê   R  R|   RH   R\  R`   R   t   weakrefR   R   t   numpyR¡  t   numpy.maR«   t   UserWarningR   R   R(   R   R   R1   RW  R<   R%   R=   RE   RF   RL   RN   RP   RR   Rg   R}   R{   R‡   RŽ   RÄ  R�   Rœ   R�   R¥   R¨   R°   R²   Rµ   R¶   R·   RÅ   RÆ   R'   RÔ   RÕ   RÙ   Ri   Rè   Rþ   R>   R  R  t   get_realpath_and_statR  R  R+  R7  Rë   R8  R;  R*   RN  RS  RU  R$   R`  Rb  Rc  Rd  Rf  Rg  Rl  R~  R„  R†  R‡  R›  Rœ  Rž  R   R¦  R§  RŒ  RÓ  RÔ  Rî  Rð  R  R  t   _linestylest	   ls_mapperRž   t   lsR%  R+  R,  R1  R7  R"   t   putmaskR9  (    (    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/cbook.pyt   <module>   sÜ   .i	Sg										
	&0 			!			(					_			-					
4Cz			N2	.	,	