a
    ˆù»jy   ã                   @   s|   d dl mZmZ d dlZd dlZd dlmZ dgZeƒ Z	ddœdd„Z
dd	d„ZG d
d„ dƒZddd„Zdddœdd„ZdS )é    )Ú	ParameterÚ	signatureN)Úimport_moduleÚ_deprecated)Úcorrect_modulec           
      C   sR  |durd| › d|› �}n
d| › �}||vrTt d| › d|› d|› d| › d|› d�ƒ‚tt|ƒ|dƒ}|durŒd|› d	|› d
| › d|› d�	}nBd| › d|› d|› d| › d|› d| › d|› d|› d| › d|› d�}tj|tdd� |D ]j}z ttd| › d|› �ƒ|ƒW   S  t �yJ }	 z*||d k�r*|	‚W Y d}	~	qâW Y d}	~	qâd}	~	0 0 qâdS )aí  Helper function for deprecating modules that are public but were
    intended to be private.

    Parameters
    ----------
    sub_package : str
        Subpackage the module belongs to eg. stats
    module : str
        Public but intended private module to deprecate
    private_modules : list
        Private replacement(s) for `module`; should contain the
        content of ``all``, possibly spread over several modules.
    all : list
        ``__all__`` belonging to `module`
    attribute : str
        The attribute in `module` being accessed
    correct_module : str, optional
        Module in `sub_package` that `attribute` should be imported from.
        Default is that `attribute` should be imported from ``scipy.sub_package``.
    Nzscipy.Ú.z`scipy.z` has no attribute `z`; furthermore, `scipy.z3` is deprecated and will be removed in SciPy 2.0.0.zPlease import `z` from the `z` namespace; the `scipy.z=` namespace is deprecated and will be removed in SciPy 2.0.0.z&` is deprecated along with the `scipy.z` namespace. `scipy.z2` will be removed in SciPy 1.14.0, and the `scipy.z+` namespace will be removed in SciPy 2.0.0.é   ©ÚcategoryÚ
stackleveléÿÿÿÿ)ÚAttributeErrorÚgetattrr   ÚwarningsÚwarnÚDeprecationWarning)
Zsub_packageÚmoduleZprivate_modulesÚallÚ	attributer   Zcorrect_importÚattrÚmessageÚe© r   ú<E:\soccer\ml_env\Lib\site-packages\scipy/_lib/deprecation.pyÚ_sub_module_deprecation   sV    
ÿÿÿÿÿÿÿÿþþþýýÿ r   é   c                    s   ‡ ‡fdd„}|S )z2Deprecate a function by emitting a warning on use.c                    sJ   t ˆ tƒr$tjdˆ ›�tdd� ˆ S t ˆ ¡‡ ‡‡fdd„ƒ}ˆ j|_|S )NzTrying to deprecate class r   r	   c                     s   t jˆtˆd� ˆ | i |¤ŽS )Nr	   )r   r   r   )ÚargsÚkwargs)ÚfunÚmsgr   r   r   ÚcallW   s    ÿz'_deprecated.<locals>.wrap.<locals>.call)Ú
isinstanceÚtyper   r   ÚRuntimeWarningÚ	functoolsÚwrapsÚ__doc__)r   r    ©r   r   )r   r   ÚwrapP   s    
þz_deprecated.<locals>.wrapr   )r   r   r(   r   r'   r   r   N   s    c                   @   s(   e Zd ZdZdd„ Zdd„ Zdd„ ZdS )	Ú_DeprecationHelperStrz3
    Helper class used by deprecate_cython_api
    c                 C   s   || _ || _d S ©N)Ú_contentÚ_message)ÚselfÚcontentr   r   r   r   Ú__init__f   s    z_DeprecationHelperStr.__init__c                 C   s
   t | jƒS r*   )Úhashr+   )r-   r   r   r   Ú__hash__j   s    z_DeprecationHelperStr.__hash__c                 C   s$   | j |k}|r tj| jtdd� |S )Nr   r	   )r+   r   r   r,   r   )r-   ÚotherÚresr   r   r   Ú__eq__m   s    

ÿz_DeprecationHelperStr.__eq__N)Ú__name__Ú
__module__Ú__qualname__r&   r/   r1   r4   r   r   r   r   r)   b   s   r)   c           
      C   s®   | j › d|› �}|du r"d| }nd|› d|› d�}|durH|d| 7 }| j}d}d	}d
|› |› �}	|	|v r’d}| |	¡|t|	|ƒ< |d7 }qVq’qV|sª| |¡|t||ƒ< dS )a>  
    Deprecate an exported cdef function in a public Cython API module.

    Only functions can be deprecated; typedefs etc. cannot.

    Parameters
    ----------
    module : module
        Public Cython API module (e.g. scipy.linalg.cython_blas).
    routine_name : str
        Name of the routine to deprecate. May also be a fused-type
        routine (in which case its all specializations are deprecated).
    new_name : str
        New name to include in the deprecation warning message
    message : str
        Additional text in the deprecation warning message

    Examples
    --------
    Usually, this function would be used in the top-level of the
    module ``.pyx`` file:

    >>> from scipy._lib.deprecation import deprecate_cython_api
    >>> import scipy.linalg.cython_blas as mod
    >>> deprecate_cython_api(mod, "dgemm", "dgemm_new",
    ...                      message="Deprecated in Scipy 1.5.0")
    >>> del deprecate_cython_api, mod

    After this, Cython modules that use the deprecated function emit a
    deprecation warning when they are imported.

    r   Nz`%s` is deprecated!ú`z` is deprecated, use `z
` instead!Ú
r   FZ__pyx_fuse_Té   )r5   Z__pyx_capi__Úpopr)   )
r   Zroutine_nameÚnew_namer   Zold_nameZdepdocÚdÚjZ	has_fusedZ
fused_namer   r   r   Údeprecate_cython_apiu   s"    !

r?   ©Úversionc                   s4   ˆ du rd}t |ƒ‚‡ fdd„}| dur0|| ƒS |S )a©  Decorator for methods that issues warnings for positional arguments.

    Using the keyword-only argument syntax in pep 3102, arguments after the
    * will issue a warning when passed as a positional argument.

    Parameters
    ----------
    func : callable, default=None
        Function to check arguments on.
    version : callable, default=None
        The version when positional arguments will result in error.
    Nz9Need to specify a version where signature will be changedc                    st   t ˆƒ‰g ‰g ‰ ˆj ¡ D ]6\}}|jtjkr:ˆ  |¡ q|jtjkrˆ |¡ qt 	ˆ¡‡ ‡‡‡‡fdd„ƒ}|S )Nc                     s”   t | ƒt ˆ ƒ }|dkr&ˆ| i |¤ŽS dd„ tˆd |… | | d … ƒD ƒ}d |¡}tjd|› dˆ› d�tdd	� | tˆj| ƒ¡ ˆf i |¤ŽS )
Nr   c                 S   s   g | ]\}}|› d |› �‘qS )ú=r   )Ú.0ÚnameÚargr   r   r   Ú
<listcomp>Ø   s   ÿzi_deprecate_positional_args.<locals>._inner_deprecate_positional_args.<locals>.inner_f.<locals>.<listcomp>z, zYou are passing z^ as a positional argument. Please change your invocation to use keyword arguments. From SciPy z@, passing these as positional arguments will result in an error.r   )r   )ÚlenÚzipÚjoinr   r   r   ÚupdateÚ
parameters)r   r   Ú
extra_argsZargs_msg)Úall_argsÚfÚkwonly_argsÚsigrA   r   r   Úinner_fÑ   s     þ
þø
zU_deprecate_positional_args.<locals>._inner_deprecate_positional_args.<locals>.inner_f)
r   rK   ÚitemsÚkindr   ÚPOSITIONAL_OR_KEYWORDÚappendÚKEYWORD_ONLYr$   r%   )rN   rD   ÚparamrQ   r@   )rM   rN   rO   rP   r   Ú _inner_deprecate_positional_argsÆ   s    zD_deprecate_positional_args.<locals>._inner_deprecate_positional_args)Ú
ValueError)ÚfuncrA   r   rX   r   r@   r   Ú_deprecate_positional_argsµ   s    &r[   )r   )NN)N)Úinspectr   r   r$   r   Ú	importlibr   Ú__all__ÚobjectZ_NoValuer   r   r)   r?   r[   r   r   r   r   Ú<module>   s   ÿ@

@