ó
 m[c           @@  so   d  d l  m Z d  d l Z d  d l Z d  d l Z e j e j Bd d  Z	 d   Z
 d   Z e d  Z d S(   i    (   t   absolute_importNc         @  s   d   } t  j j    r2 |   |  r.   Sd S| d k rY t  j j d t  j  } n  | sc d S| j t  j  } t	 j
 d k rt  j | k rĐ | j d t  j  n  t  j j d d  j t  j  } t   f d   | D  rō   g } qg  | D] }   | ^ qų } n	   g } t   } xu | D]m } t  j j |  }	 |	 | k r+| j |	  x9 | D]. }
 t  j j | |
  } | | |  rc| SqcWq+q+Wd S(	   s3  Given a command, mode, and a PATH string, return the path which
    conforms to the given mode on the PATH, or None if there is no such
    file.

    `mode` defaults to os.F_OK | os.X_OK. `path` defaults to the result
    of os.environ.get("PATH"), or can be overridden with a custom search
    path.

    c         S@  s5   t  j j |   o4 t  j |  |  o4 t  j j |   S(   N(   t   ost   patht   existst   accesst   isdir(   t   fnt   mode(    (    s:   lib/python2.7/site-packages/matplotlib/cbook/_backports.pyt   _access_check   s    $t   PATHt   win32i    t   PATHEXTt    c         3@  s*   |  ]  }   j    j | j     Vq d  S(   N(   t   lowert   endswith(   t   .0t   ext(   t   cmd(    s:   lib/python2.7/site-packages/matplotlib/cbook/_backports.pys	   <genexpr>4   s    N(   R   R   t   dirnamet   Nonet   environt   gett   defpatht   splitt   pathsept   syst   platformt   curdirt   insertt   anyt   sett   normcaset   addt   join(   R   R   R   R   t   pathextt   filesR   t   seent   dirt   normdirt   thefilet   name(    (   R   s:   lib/python2.7/site-packages/matplotlib/cbook/_backports.pyt   which
   s8    	! 		c         C@  sP   t  |   t  |  k	 rL | j d t  |    } | j rL | j |   qL n  | S(   Nt   type(   R*   t   viewt   __array_finalize__(   t   original_arrayt	   new_array(    (    s:   lib/python2.7/site-packages/matplotlib/cbook/_backports.pyt   _maybe_view_as_subclassJ   s
    	c   	   
   C@  s3  t  j |  r t |  n | f } t  j |  d t d | }  | r^ |  j r^ t d   n  t d   | D  r t d   n  | o |  j j	 } | rĨ d g n g  } | r· d n d } t  j
 |  f d	 d
 d d g | d | g d | d d j d } t |  |  } | r/| j j	 r/t | j _	 n  | S(   Nt   copyt   suboks/   cannot broadcast a non-scalar to a scalar arrayc         s@  s   |  ] } | d  k  Vq d S(   i    N(    (   R   t   size(    (    s:   lib/python2.7/site-packages/matplotlib/cbook/_backports.pys	   <genexpr>]   s    s4   all elements of broadcast shape must be non-negativet	   reduce_okt	   readwritet   readonlyt   flagst   multi_indext   refs_okt   zerosize_okt   op_flagst	   itershapet   ordert   Ci    (   t   npt   iterablet   tuplet   arrayt   Falset   shapet
   ValueErrorR   R6   t	   writeablet   nditert   itviewsR/   t   True(	   RA   RC   R1   R5   t   needs_writeablet   extrast   op_flagt	   broadcastt   result(    (    s:   lib/python2.7/site-packages/matplotlib/cbook/_backports.pyt   _broadcast_toX   s     $c         C@  s   t  |  | d | d t S(   sĖ  Broadcast an array to a new shape.

    Parameters
    ----------
    array : array_like
        The array to broadcast.
    shape : tuple
        The shape of the desired array.
    subok : bool, optional
        If True, then sub-classes will be passed-through, otherwise
        the returned array will be forced to be a base-class array (default).

    Returns
    -------
    broadcast : array
        A readonly view on the original array with the given shape. It is
        typically not contiguous. Furthermore, more than one element of a
        broadcasted array may refer to a single memory location.

    Raises
    ------
    ValueError
        If the array is not compatible with the new shape according to NumPy's
        broadcasting rules.

    Notes
    -----
    .. versionadded:: 1.10.0

    Examples
    --------
    >>> x = np.array([1, 2, 3])
    >>> np.broadcast_to(x, (3, 3))
    array([[1, 2, 3],
           [1, 2, 3],
           [1, 2, 3]])
    R1   R5   (   RN   RH   (   RA   RC   R1   (    (    s:   lib/python2.7/site-packages/matplotlib/cbook/_backports.pyt   broadcast_tom   s    &(   t
   __future__R    R   R   t   numpyR>   t   F_OKt   X_OKR   R)   R/   RN   RB   RO   (    (    (    s:   lib/python2.7/site-packages/matplotlib/cbook/_backports.pyt   <module>   s   @		