U
    Ì6{iËƒ  ã                   @   sl  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m	Z	 d dl
mZ d dlmZmZmZ d dlZddddd	d
ddddddgZdd
„ Zdd„ ZG dd„ dƒZdd„ Zdd„ Zdd	„ Zdd„ Zd3dd„Zdd„ Zdadad4dd „Zd5d!d"„Zedƒd6d$d„ƒZ edƒej!fd%d„ƒZ"i Z#e $d&ej%¡Z&edƒd7d)d„ƒZ'd*d+„ Z(d,d-„ Z)d.d„ Z*d/d0„ Z+d1d2„ Z,dS )8é    N)Úissubclass_ÚissubsctypeÚ
issubdtype)Ú
set_module)ÚndarrayÚufuncÚasarrayr   r   r   Ú	deprecateÚdeprecate_with_docÚget_includeÚinfoÚsourceÚwhoÚlookforÚbyte_boundsÚ	safe_evalc                  C   sV   ddl } | jdkr.tj tj | j¡dd¡}n$ddlm} tj tj |j¡d¡}|S )a¬  
    Return the directory that contains the NumPy \*.h header files.

    Extension modules that need to compile against NumPy should use this
    function to locate the appropriate include directory.

    Notes
    -----
    When using ``distutils``, for example in ``setup.py``::

        import numpy as np
        ...
        Extension('extension_name', ...
                include_dirs=[np.get_include()])
        ...

    r   NÚcoreÚinclude)	ÚnumpyZshow_configÚosÚpathÚjoinÚdirnameÚ__file__Ú
numpy.corer   )r   Údr   © r   ú3/tmp/pip-unpacked-wheel-dv5xso59/numpy/lib/utils.pyr      s    
c                 C   s
   || _ | S ©N)Ú__name__)ÚfuncÚnamer   r   r   Ú_set_function_name0   s    r"   c                   @   s"   e Zd ZdZddd„Zdd„ ZdS )Ú
_Deprecatez†
    Decorator class to deprecate old functions.

    Refer to `deprecate` for details.

    See Also
    --------
    deprecate

    Nc                 C   s   || _ || _|| _d S r   )Úold_nameÚnew_nameÚmessage)Úselfr$   r%   r&   r   r   r   Ú__init__A   s    z_Deprecate.__init__c                    s~  | j }| j}| j}|dkr@z
ˆj}W n tk
r>   ˆj}Y nX |dkrRd| ‰ nd||f ‰ |dk	rrˆ d| 7 ‰ ‡ ‡fdd„}t||ƒ}ˆj}|dkržˆ }n¨| ¡  d¡}	t	|	dd… ƒ}
|	d  
¡ rÖ|
d	 | }nRt|	d ƒd }|	dd… D ](}t|ƒ|
k�r
 �q|t|ƒd 7 }qò||d… }t ˆ d	|
 ¡‰ d
 ˆ |g¡}||_z
ˆj}W n tk
�rl   Y nX |j |¡ |S )z:
        Decorator call.  Refer to ``decorate``.

        Nz`%s` is deprecated!z%`%s` is deprecated, use `%s` instead!Ú
c                     s   t jˆ tdd� ˆ| |ŽS )z1`arrayrange` is deprecated, use `arange` instead!é   )Ú
stacklevel)ÚwarningsÚwarnÚDeprecationWarning)ÚargsÚkwds©Zdepdocr    r   r   Únewfunc]   s    z$_Deprecate.__call__.<locals>.newfuncé   r   ú z

)r$   r%   r&   r   ÚAttributeErrorr"   Ú__doc__Ú
expandtabsÚsplitÚ_get_indentÚlstripÚlenÚtextwrapÚindentr   Ú__dict__Úupdate)r'   r    r/   Úkwargsr$   r%   r&   r2   ÚdocÚlinesr=   ÚskipÚliner   r   r1   r   Ú__call__F   sN    

ÿ

z_Deprecate.__call__)NNN)r   Ú
__module__Ú__qualname__r6   r(   rE   r   r   r   r   r#   5   s   
r#   c                 C   sD   t j}| D ]&}t| ¡ ƒ}|r
t|t|ƒ| ƒ}q
|t jkr@d}|S )zU
    Determines the leading whitespace that could be removed from all the lines.
    r   )ÚsysÚmaxsizer;   r:   Úmin)rB   r=   rD   Úcontentr   r   r   r9   �   s    
r9   c                  O   s4   | r&| d }| dd… } t | |Ž|ƒS t | |ŽS dS )aœ  
    Issues a DeprecationWarning, adds warning to `old_name`'s
    docstring, rebinds ``old_name.__name__`` and returns the new
    function object.

    This function may also be used as a decorator.

    Parameters
    ----------
    func : function
        The function to be deprecated.
    old_name : str, optional
        The name of the function to be deprecated. Default is None, in
        which case the name of `func` is used.
    new_name : str, optional
        The new name for the function. Default is None, in which case the
        deprecation message is that `old_name` is deprecated. If given, the
        deprecation message is that `old_name` is deprecated and `new_name`
        should be used instead.
    message : str, optional
        Additional explanation of the deprecation.  Displayed in the
        docstring after the warning.

    Returns
    -------
    old_func : function
        The deprecated function.

    Examples
    --------
    Note that ``olduint`` returns a value after printing Deprecation
    Warning:

    >>> olduint = np.deprecate(np.uint)
    DeprecationWarning: `uint64` is deprecated! # may vary
    >>> olduint(6)
    6

    r   r3   N©r#   )r/   r@   Úfnr   r   r   r	   �   s
    ,c                 C   s
   t | d�S )a�  
    Deprecates a function and includes the deprecation in its docstring.

    This function is used as a decorator. It returns an object that can be
    used to issue a DeprecationWarning, by passing the to-be decorated
    function as argument, this adds warning to the to-be decorated function's
    docstring and returns the new function object.

    See Also
    --------
    deprecate : Decorate a function such that it issues a `DeprecationWarning`

    Parameters
    ----------
    msg : str
        Additional explanation of the deprecation. Displayed in the
        docstring after the warning.

    Returns
    -------
    obj : object

    )r&   rL   )Úmsgr   r   r   r
   Ä   s    c           
      C   sœ   | j }|d d }|d }|d }t| ƒjj}| }}|dkrN|| j| 7 }nFt||ƒD ]2\}}	|	dk rz||d |	 7 }qX||d |	 7 }qX||7 }||fS )a#  
    Returns pointers to the end-points of an array.

    Parameters
    ----------
    a : ndarray
        Input array. It must conform to the Python-side of the array
        interface.

    Returns
    -------
    (low, high) : tuple of 2 integers
        The first integer is the first byte of the array, the second
        integer is just past the last byte of the array.  If `a` is not
        contiguous it will not use every byte between the (`low`, `high`)
        values.

    Examples
    --------
    >>> I = np.eye(2, dtype='f'); I.dtype
    dtype('float32')
    >>> low, high = np.byte_bounds(I)
    >>> high - low == I.size*I.itemsize
    True
    >>> I = np.eye(2); I.dtype
    dtype('float64')
    >>> low, high = np.byte_bounds(I)
    >>> high - low == I.size*I.itemsize
    True

    Údatar   ÚstridesÚshapeNr3   )Z__array_interface__r   ÚdtypeÚitemsizeÚsizeÚzip)
ÚaZaiZa_dataZastridesZashapeZbytes_aZa_lowZa_highrQ   Zstrider   r   r   r   ã   s     c                 C   s$  | dkrt  ¡ j}|j} g }i }|  ¡ D ]ˆ}t| | tƒr(| | }t|ƒ}|| ¡ krl|d||   }d}n|||< |}d}d t	t
|jƒ¡}	t
|jƒ}
| ||	|
|jj|g¡ q(d}d}d}d}|D ]t}|t|d ƒk ræt|d ƒ}|t|d ƒk �rt|d ƒ}|t|d ƒk �r"t|d ƒ}|d rÆ|t|d ƒ7 }qÆt|ƒdk�r¢td|ƒ}td|ƒ}td|ƒ}d	|d
 |d
 |d
 f }t|d dt|ƒd   d ƒ |D ]l}td|d d
|t|d ƒ d  |d d
|t|d ƒ d  |d d
|t|d ƒ d  |d f ƒ �q¦td| ƒ dS )a%  
    Print the NumPy arrays in the given dictionary.

    If there is no dictionary passed in or `vardict` is None then returns
    NumPy arrays in the globals() dictionary (all NumPy arrays in the
    namespace).

    Parameters
    ----------
    vardict : dict, optional
        A dictionary possibly containing ndarrays.  Default is globals().

    Returns
    -------
    out : None
        Returns 'None'.

    Notes
    -----
    Prints out the name, shape, bytes and type of all of the ndarrays
    present in `vardict`.

    Examples
    --------
    >>> a = np.arange(10)
    >>> b = np.ones(20)
    >>> np.who()
    Name            Shape            Bytes            Type
    ===========================================================
    a               10               80               int64
    b               20               160              float64
    Upper bound on total bytes  =       240

    >>> d = {'x': np.arange(2.0), 'y': np.arange(3.0), 'txt': 'Some str',
    ... 'idx':5}
    >>> np.who(d)
    Name            Shape            Bytes            Type
    ===========================================================
    x               2                16               float64
    y               3                24               float64
    Upper bound on total bytes  =       40

    Nz (%s)r   r3   z x r*   é   é
   zName %s Shape %s Bytes %s Typer4   r)   ú=é   z%s %s %s %s %s %s %sé   z'
Upper bound on total bytes  =       %d)rH   Ú	_getframeÚf_backÚ	f_globalsÚkeysÚ
isinstancer   Úidr   ÚmapÚstrrQ   ÚnbytesÚappendrR   r!   r;   ÚintÚmaxÚprint)ÚvardictÚframeZstaÚcacher!   ÚvarZidvÚnamestrÚoriginalZshapestrZbytestrZmaxnameZmaxshapeZmaxbyteZ
totalbytesÚvalZsp1Zsp2Zsp3Zprvalr   r   r   r     sb    ,

ÿ


    ýc           
      C   s�   t | ƒ}|}| }d}| |¡}|D ]h}||kr4d}	n|}	|t |ƒ t |	ƒ }||kr~|d t |ƒ }|d d|d   | }q"||	 | }q"|S )Nz, Ú r3   z,
r4   r*   )r;   r8   )
r!   Ú	argumentsÚwidthZ
firstwidthÚkZnewstrZsepstrZarglistÚargumentZaddstrr   r   r   Ú_split_lineƒ  s    
ru   r   c                 C   s¦   t | tƒ tƒ g ƒ} | j| ji}| jg}| jg}t|ƒdkr<qž| d¡}| ¡ D ]L}t|| t	j
ƒrN|| j}||krN|| j}| |¡ | |¡ |||< qNq.||fS )Nr   )Ú
__import__ÚglobalsÚlocalsr   r>   r;   Úpopr_   r`   ÚtypesÚ
ModuleTypere   )ÚmoduleZthedictZdictlistZ
totraverseZthisdictÚxÚmodnameZmoddictr   r   r   Ú_makenamedict›  s     




r   c           
      C   s†  d}d}dd„ }t | dt| ƒƒ}t |d|ƒ}| j}| jj}|dkrHtj}td||d� td	| j|d� td
||d� td| j	|d� td|| j
jƒ|d� td|| j
jƒ|d� td| j
j|d� tdt| jjjƒ|f |d� tdd|d� |dk�rtd|tj|f |d� d}	nH|dk�r@td||f |d� tjdk}	ntd||f |d� tjdk}	td||	ƒ|d� td| j |d� dS )aO  Provide information about ndarray obj.

    Parameters
    ----------
    obj : ndarray
        Must be ndarray, not checked.
    output
        Where printed output goes.

    Notes
    -----
    Copied over from the numarray module prior to its removal.
    Adapted somewhat as only numpy is an option now.

    Called by info.

    rp   c                 S   s   | S r   r   )r}   r   r   r   Ú<lambda>Ã  ó    z_info.<locals>.<lambda>Ú	__class__r   Nzclass: ©Úfilezshape: z	strides: z
itemsize: z	aligned: zcontiguous: z	fortran: zdata pointer: %s%szbyteorder: r4   )Úendr„   )ú|rY   z%s%s%sFú>z%sbig%sÚbigz
%slittle%sÚlittlez
byteswap: ztype: %s)ÚgetattrÚtyperP   rR   Ú	byteorderrH   Ústdoutrh   rQ   rS   ÚflagsZalignedÚ
contiguousZfortranÚhexÚctypesZ_as_parameter_Úvalue)
ÚobjÚoutputÚextraZticZbpÚclsÚnmrP   ZendianZbyteswapr   r   r   Ú_info¯  s>    þ


r˜   éL   c              	   C   s^  ddl }ddl}t| dƒs$t| dƒr,| j} nt| dƒr<| j} |dkrJtj}| dkr^ttƒ �nüt| t	ƒrxt
| |d� �nât| tƒ�r^tdkr˜t|ƒ\aad}g }tD ]ˆ}zlt| |  }	t|	ƒ|krÔtd| |d� n6| t|	ƒ¡ td	| |d� t|	ƒ td
| |d� |d7 }W q¤ tk
�r*   Y q¤X q¤|dk�rJtd|  |d� ntd| |d� �nü| | ¡�sv| | ¡�rü| j}
zt| | ¡ƒ}W n tk
�r¨   d}Y nX t|
| ƒ|k�rÊt|
||ƒ}n|
| }td| d |d� t| | ¡|d� �n^| | ¡�r<| j}
zt| | ¡ƒ}W n tk
�r:   d}Y nX t|
| ƒ|k�r\t|
||ƒ}n|
| }td| d |d� | | ¡}|dk�r®t| dƒ�rÀt| | j¡|d� nt| | ¡|d� | | ¡}dd„ |D ƒ}|�rZtd|d� |D ]J}t| |dƒ}|dk	�r"| | |¡�pd¡\}}td||f |d� �qînt| dƒ�rZt| | ¡|d� dS )a¼  
    Get help information for a function, class, or module.

    Parameters
    ----------
    object : object or str, optional
        Input object or name to get information about. If `object` is a
        numpy object, its docstring is given. If it is a string, available
        modules are searched for matching objects.  If None, information
        about `info` itself is returned.
    maxwidth : int, optional
        Printing width.
    output : file like object, optional
        File like object that the output is written to, default is
        ``None``, in which case ``sys.stdout`` will be used.
        The object has to be opened in 'w' or 'a' mode.
    toplevel : str, optional
        Start search at this level.

    See Also
    --------
    source, lookfor

    Notes
    -----
    When used interactively with an object, ``np.info(obj)`` is equivalent
    to ``help(obj)`` on the Python prompt or ``obj?`` on the IPython
    prompt.

    Examples
    --------
    >>> np.info(np.polyval) # doctest: +SKIP
       polyval(p, x)
         Evaluate the polynomial p at x.
         ...

    When using a string for `object` it is possible to get multiple results.

    >>> np.info('fft') # doctest: +SKIP
         *** Found in numpy ***
    Core FFT routines
    ...
         *** Found in numpy.fft ***
     fft(a, n=None, axis=-1)
    ...
         *** Repeat reference found in numpy.fft.fftpack ***
         *** Total of 3 references found. ***

    r   NZ_ppimport_importerÚ_ppimport_moduleÚ_ppimport_attr)r”   z+
     *** Repeat reference found in %s *** rƒ   z     *** Found in %s ***ú-r3   zHelp for %s not found.z+
     *** Total of %d references found. ***z()r4   r)   r(   c                 S   s   g | ]}|d  dkr|‘qS )r   Ú_r   )Ú.0Úmethr   r   r   Ú
<listcomp>l  s      zinfo.<locals>.<listcomp>z

Methods:
ÚNonez  %s  --  %sr6   ) ÚpydocÚinspectÚhasattrrš   r›   rH   r�   r   r`   r   r˜   rc   Ú	_namedictr   Ú	_dictlistra   rh   re   ÚKeyErrorÚ
isfunctionÚismethodr   Ú	signatureÚ	Exceptionr;   ru   ÚgetdocÚisclassr(   Z
allmethodsrŠ   Zsplitdoc)ÚobjectZmaxwidthr”   Útoplevelr¢   r£   ZnumfoundZobjlistrm   r“   r!   rq   ZargstrZdoc1ÚmethodsZpublic_methodsrŸ   ZthisobjZmethstrÚotherr   r   r   r   å  s¢    5
ÿ

ÿþ
ÿþ






ÿc                 C   sZ   ddl }z,td| | ¡ |d� t| | ¡|d� W n  tk
rT   td|d� Y nX dS )aí  
    Print or write to a file the source code for a NumPy object.

    The source code is only returned for objects written in Python. Many
    functions and classes are defined in C and will therefore not return
    useful information.

    Parameters
    ----------
    object : numpy object
        Input object. This can be any object (function, class, module,
        ...).
    output : file object, optional
        If `output` not supplied then source code is printed to screen
        (sys.stdout).  File object must be created with either write 'w' or
        append 'a' modes.

    See Also
    --------
    lookfor, info

    Examples
    --------
    >>> np.source(np.interp)                        #doctest: +SKIP
    In file: /usr/lib/python2.6/dist-packages/numpy/lib/function_base.py
    def interp(x, xp, fp, left=None, right=None):
        """.... (full docstring printed)"""
        if isinstance(x, (float, int, number)):
            return compiled_interp([x], xp, fp, left, right).item()
        else:
            return compiled_interp(x, xp, fp, left, right)

    The source code is only returned for objects written in Python.

    >>> np.source(np.array)                         #doctest: +SKIP
    Not available for this object.

    r   NzIn file: %s
rƒ   zNot available for this object.)r£   rh   ÚgetsourcefileÚ	getsourcer«   )r®   r”   r£   r   r   r   r   {  s    )z[a-z0-9_]+\(.*[,=].*\)TFc              	      sÂ  ddl }t|||ƒ‰ g }t| ƒ ¡  ¡ ‰ˆs0dS ˆ  ¡ D ]@\}\}}	}
|	dkrPq8| ¡ ‰t‡fdd„ˆD ƒƒr8| |¡ q8dddddœ‰‡‡fd	d
„‰‡ ‡fdd„}|j|d� dd 	ˆ¡ }|dt
|ƒ g}|ddd… D ]€}ˆ | \‰}	}dd„ ˆ ¡  d¡D ƒ}z(|d  ¡ }t |¡�r,|d  ¡ }W n tk
�rH   d}Y nX | d||f ¡ qÜ|�sn| d¡ |dk	�rŠ| d 	|¡¡ n4t
|ƒdk�r°| ¡ }|d 	|¡ƒ ntd 	|¡ƒ dS )aº  
    Do a keyword search on docstrings.

    A list of objects that matched the search is displayed,
    sorted by relevance. All given keywords need to be found in the
    docstring for it to be returned as a result, but the order does
    not matter.

    Parameters
    ----------
    what : str
        String containing words to look for.
    module : str or list, optional
        Name of module(s) whose docstrings to go through.
    import_modules : bool, optional
        Whether to import sub-modules in packages. Default is True.
    regenerate : bool, optional
        Whether to re-generate the docstring cache. Default is False.
    output : file-like, optional
        File-like object to write the output to. If omitted, use a pager.

    See Also
    --------
    source, info

    Notes
    -----
    Relevance is determined only roughly, by checking if the keywords occur
    in the function name, at the start of a docstring, etc.

    Examples
    --------
    >>> np.lookfor('binary representation') # doctest: +SKIP
    Search results for 'binary representation'
    ------------------------------------------
    numpy.binary_repr
        Return the binary representation of the input number as a string.
    numpy.core.setup_common.long_double_representation
        Given a binary dump as given by GNU od -b, look for long double
    numpy.base_repr
        Return a string representation of a number in the given base system.
    ...

    r   N)r|   r®   c                 3   s   | ]}|ˆ kV  qd S r   r   ©rž   Úw)rA   r   r   Ú	<genexpr>ö  s     zlookfor.<locals>.<genexpr>iè  éüÿÿ)r    Úclassr|   r®   c                    s¦   d}d  | ¡  ¡  d¡d d… ¡‰ |t‡ fdd„ˆD ƒƒ7 }|t‡fdd„ˆD ƒƒ7 }|tˆƒ d 7 }|ˆ |d¡7 }|ˆ d	¡ d
 7 }|t| d dƒ7 }|S )Nr   r)   r[   c                    s   g | ]}|ˆ krd ‘qS )éÈ   r   r´   )Ú	first_docr   r   r      s      z.lookfor.<locals>.relevance.<locals>.<listcomp>c                    s   g | ]}|ˆ krd ‘qS )é   r   r´   )r!   r   r   r      s      rZ   r·   Ú.rX   éd   iœÿÿÿ)	r   ÚlowerÚstripr8   Úsumr;   ÚgetÚcountrg   )r!   ZdocstrÚkindÚindexÚr)Úkind_relevanceÚwhats)rº   r!   r   Ú	relevance   s     zlookfor.<locals>.relevancec                    s   ˆ| fˆ |  žŽ S r   r   )rV   )rk   rÈ   r   r   Úrelevance_value  s    z lookfor.<locals>.relevance_value)ÚkeyzSearch results for '%s'r4   rœ   éÿÿÿÿc                 S   s   g | ]}|  ¡ r|  ¡ ‘qS r   )r¿   )rž   rD   r   r   r   r      s    ÿzlookfor.<locals>.<listcomp>r)   r3   rp   z	%s
    %szNothing found.rX   )r¢   Ú_lookfor_generate_cacherc   r¾   r8   ÚitemsÚallre   Úsortr   r;   r¿   Ú_function_signature_reÚsearchÚ
IndexErrorÚwriteZgetpagerrh   )Úwhatr|   Úimport_modulesÚ
regenerater”   r¢   Úfoundr!   Z	docstringrÃ   rÄ   rÉ   ÚsÚ	help_textÚixZdoclinesrº   Zpagerr   )rk   rA   rÆ   rÈ   rÇ   r   r   ¶  sN    / ÿ


c              
   C   sÈ  ddl }ddlm} | dkr d} t| tƒr\zt| ƒ W n tk
rN   i  Y S X tj|  } n8t| t	ƒspt| t
ƒr”i }| D ]}| t|||ƒ¡ qx|S t| ƒtkr°|s°tt| ƒ S i }|tt| ƒ< i }d}| j| fg}	|	�rÄ|	 d¡\}
}t|ƒ|kröqÔd|t|ƒ< |d7 }d}| |¡�r6d}z
|j}W n tk
�rB   d}Y nX |�rZt|d	ƒ�rZ|jD ]ü}t |¡D ]ê}tj ||¡}tj ||d
¡}tj |¡�r´| d¡�r´|dd… }ntj |¡�rj|}n�qj|dk�rÚ�qjzDtj}tj}z$|ƒ t_|ƒ t_td|
|f ƒ W 5 |t_|t_X W n2 tk
�r6   ‚ Y n tk
�rP   Y �qjY nX �qj�q\t |ƒD ]Ð\}}z$t!|dd|
|f ƒ}t!|ddƒ}W n& t"k
�r´   d|
|f }d}Y nX d|k�rÒ|�rÒd||f }| #|
d ¡�söt|t$ƒ�rbn�qbn$| |¡�s|dk�s||k�s�qb|	 %d|
|f |f¡ �qbnL| &|¡�rrd}t |ƒD ] \}}|	 %d|
|f |f¡ �qNnt|dƒ�r‚d}z| '|¡}W n t"k
�rª   d}Y nX |dk	rÔ|||f||
< qÔ|S )aõ  
    Generate docstring cache for given module.

    Parameters
    ----------
    module : str, None, module
        Module for which to generate docstring cache
    import_modules : bool
        Whether to import sub-modules in packages.
    regenerate : bool
        Re-generate the docstring cache

    Returns
    -------
    cache : dict {obj_full_name: (docstring, kind, index), ...}
        Docstring cache for the module, either cached one (regenerate=False)
        or newly generated.

    r   N)ÚStringIOr   Tr3   r®   r|   Ú__path__z__init__.pyz.pyéýÿÿÿr(   z%s.%sr   rF   r¼   r¸   rE   r    )(r£   ÚiorÛ   r`   rc   rv   ÚImportErrorrH   ÚmodulesÚlistÚtupler?   rÌ   ra   Ú_lookfor_cachesr   ry   ÚismoduleÚ__all__r5   r¤   rÜ   r   Úlistdirr   r   ÚisfileÚendswithr�   ÚstderrÚKeyboardInterruptÚBaseExceptionÚ_getmembersrŠ   Ú	NameErrorÚ
startswithr   re   r­   r¬   )r|   rÕ   rÖ   r£   rÛ   rk   ÚmodÚseenrÄ   Ústackr!   ÚitemrÃ   Z_allÚpthZmod_pathZthis_pyZinit_pyZ	to_importZ
old_stdoutZ
old_stderrÚnÚvZ	item_nameÚmod_namerA   r   r   r   rÌ   2  sº    


ÿ


ÿ

 
rÌ   c                    sF   dd l }z| ˆ ¡}W n* tk
r@   ‡ fdd„tˆ ƒD ƒ}Y nX |S )Nr   c                    s$   g | ]}t ˆ |ƒr|tˆ |ƒf‘qS r   )r¤   rŠ   )rž   r}   ©rò   r   r   r    Â  s    
ÿz_getmembers.<locals>.<listcomp>)r£   Ú
getmembersr«   Údir)rò   r£   Úmembersr   r÷   r   rì   ½  s    rì   c                 C   s   ddl }| | ¡S )au  
    Protected string evaluation.

    Evaluate a string containing a Python literal expression without
    allowing the execution of arbitrary non-literal code.

    .. warning::

        This function is identical to :py:meth:`ast.literal_eval` and
        has the same security implications.  It may not always be safe
        to evaluate large input strings.

    Parameters
    ----------
    source : str
        The string to evaluate.

    Returns
    -------
    obj : object
       The result of evaluating `source`.

    Raises
    ------
    SyntaxError
        If the code has invalid Python syntax, or if it contains
        non-literal code.

    Examples
    --------
    >>> np.safe_eval('1')
    1
    >>> np.safe_eval('[1, 2, 3]')
    [1, 2, 3]
    >>> np.safe_eval('{"foo": ("bar", 10.0)}')
    {'foo': ('bar', 10.0)}

    >>> np.safe_eval('import os')
    Traceback (most recent call last):
      ...
    SyntaxError: invalid syntax

    >>> np.safe_eval('open("/home/user/.ssh/id_dsa").read()')
    Traceback (most recent call last):
      ...
    ValueError: malformed node or string: <_ast.Call object at 0x...>

    r   N)ÚastÚliteral_eval)r   rû   r   r   r   r   Ç  s    2c                 C   sr   | j dkr|S t | jd|d�¡}tj |¡r8| d¡}t | ¡ ¡dkrnt	|tj
ƒrd| j tj¡S tj||< |S )a{  
    Utility function to check median result from data for NaN values at the end
    and return NaN in that case. Input result can also be a MaskedArray.

    Parameters
    ----------
    data : array
        Sorted input data to median function
    result : Array or MaskedArray
        Result of median function.
    axis : int
        Axis along which the median was computed.

    Returns
    -------
    result : scalar or ndarray
        Median or NaN in axes which contained NaN in the input.  If the input
        was an array, NaN will be inserted in-place.  If a scalar, either the
        input itself or a scalar NaN.
    r   rË   )ÚaxisF)rT   ÚnpÚisnanZtakeÚmaZisMaskedArrayZfilledZcount_nonzeroZravelr`   ZgenericrR   r‹   Únan)rO   Úresultrý   rô   r   r   r   Ú_median_nanchecký  s    


r  c                  C   sr   ddl m} m}m} t|ƒdkr0t|ƒdkr0dS d |¡}|D ].}| | r\|d|› d�7 }q>|d|› d�7 }q>|S )a‰  
    Returns a string contains the supported CPU features by the current build.

    The string format can be explained as follows:
        - dispatched features that are supported by the running machine
          end with `*`.
        - dispatched features that are "not" supported by the running machine
          end with `?`.
        - remained features are representing the baseline.
    r   )Ú__cpu_features__Ú__cpu_baseline__Ú__cpu_dispatch__rp   r4   Ú*ú?)Znumpy.core._multiarray_umathr  r  r  r;   r   )r  r  r  Zenabled_featuresZfeaturer   r   r   Ú	_opt_info!  s    
r	  )N)r   )N)Nr™   Nr   )NTFN)-r   rH   r<   rz   Úrer,   Znumpy.core.numerictypesr   r   r   Znumpy.core.overridesr   r   r   r   r   r   rþ   rå   r   r"   r#   r9   r	   r
   r   r   ru   r¥   r¦   r   r˜   r   r�   r   rã   ÚcompileÚIrÐ   r   rÌ   rì   r   r  r	  r   r   r   r   Ú<module>   sh            ýL59
g

6 3  ÿ{ 
6$