a
    Lªf–
  ã                   @   s    d Z ddlZdgZddd„ZdS )z!
Introspection helper functions.
é    NÚopt_func_infoc           	         s²   ddl m}m‰  | dur:t | ¡‰‡fdd„| ¡ D ƒ}n|}|durªt |¡‰i }| ¡ D ]J\}}i }| ¡ D ](\}}t‡ ‡fdd„|D ƒƒrp|||< qp|r\|||< q\n|}|S )aR  
    Returns a dictionary containing the currently supported CPU dispatched
    features for all optimized functions.

    Parameters
    ----------
    func_name : str (optional)
        Regular expression to filter by function name.

    signature : str (optional)
        Regular expression to filter by data type.

    Returns
    -------
    dict
        A dictionary where keys are optimized function names and values are
        nested dictionaries indicating supported targets based on data types.

    Examples
    --------
    Retrieve dispatch information for functions named 'add' or 'sub' and
    data types 'float64' or 'float32':

    >>> dict = np.lib.introspect.opt_func_info(
    ...     func_name="add|abs", signature="float64|complex64"
    ... )
    >>> import json
    >>> print(json.dumps(dict, indent=2))
        {
          "absolute": {
            "dd": {
              "current": "SSE41",
              "available": "SSE41 baseline(SSE SSE2 SSE3)"
            },
            "Ff": {
              "current": "FMA3__AVX2",
              "available": "AVX512F FMA3__AVX2 baseline(SSE SSE2 SSE3)"
            },
            "Dd": {
              "current": "FMA3__AVX2",
              "available": "AVX512F FMA3__AVX2 baseline(SSE SSE2 SSE3)"
            }
          },
          "add": {
            "ddd": {
              "current": "FMA3__AVX2",
              "available": "FMA3__AVX2 baseline(SSE SSE2 SSE3)"
            },
            "FFF": {
              "current": "FMA3__AVX2",
              "available": "FMA3__AVX2 baseline(SSE SSE2 SSE3)"
            }
          }
        }

    r   )Ú__cpu_targets_info__ÚdtypeNc                    s    i | ]\}}ˆ   |¡r||“qS © )Úsearch)Ú.0ÚkÚv)Úfunc_patternr   úM/var/www/ai-form-bot/venv/lib/python3.9/site-packages/numpy/lib/introspect.pyÚ
<dictcomp>H   s   
ÿz!opt_func_info.<locals>.<dictcomp>c                    s&   g | ]}ˆ  |¡p ˆ  ˆ |ƒj¡‘qS r   )r   Úname)r   Úc)r   Úsig_patternr   r   Ú
<listcomp>U   s   þ
z!opt_func_info.<locals>.<listcomp>)Znumpy._core._multiarray_umathr   r   ÚreÚcompileÚitemsÚany)	Ú	func_nameÚ	signatureÚtargetsZmatching_funcsZmatching_sigsr   r	   Zmatching_charsÚcharsr   )r   r
   r   r   r   	   s*    9

ÿ
ý
)NN)Ú__doc__r   Ú__all__r   r   r   r   r   Ú<module>   s   