o
    Ö­jp&  ã                   @   sŽ   d dl mZmZ d dlZd dlZd dlmZ d dlmZ dgZ	e
ƒ Zdddœdd	„Zddd„ZG dd„ dƒZddd„Zdddddœdd„ZdS )é    )Ú	ParameterÚ	signatureN)Úimport_module)ÚFunctionDocÚ_deprecatedz1.16.0)Úcorrect_moduleÚdep_versionc                 C   sF  |durd| › d|› �}nd| › �}||vr*t d| › d|› d|› d| › d|› d�ƒ‚tt|ƒ|dƒ}|durFd|› d	|› d
| › d|› d�	}	n$d| › d|› d|› d| › d|› d| › d|› d|› d|› d| › d|› d�}	tj|	tdd� |D ],}zttd| › d|› �ƒ|ƒW   S  t y  }
 z||d kr–|
‚W Y d}
~
qtd}
~
ww dS )aM  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``.
    dep_version : str, optional
        Version in which deprecated attributes will be removed.
    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.z` will be removed in SciPy z, and the `scipy.z+` namespace will be removed in SciPy 2.0.0.é   ©ÚcategoryÚ
stackleveléÿÿÿÿ)ÚAttributeErrorÚgetattrr   ÚwarningsÚwarnÚDeprecationWarning)Úsub_packageÚmoduleÚprivate_modulesÚallÚ	attributer   r   Úcorrect_importÚattrÚmessageÚe© r   úS/var/www/html/CropPilot/venv/lib/python3.10/site-packages/scipy/_lib/deprecation.pyÚ_sub_module_deprecation   s`   
ÿÿÿÿÿÿÿÿþþþýýýÿ €ûý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   ÚcallZ   s   ÿz'_deprecated.<locals>.wrap.<locals>.call)Ú
isinstanceÚtyper   r   ÚRuntimeWarningÚ	functoolsÚwrapsÚ__doc__)r#   r%   ©r$   r   )r#   r   ÚwrapS   s   
þz_deprecated.<locals>.wrapr   )r$   r   r-   r   r,   r   r   Q   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__i   s   
z_DeprecationHelperStr.__init__c                 C   s
   t | jƒS r/   )Úhashr0   )r2   r   r   r   Ú__hash__m   s   
z_DeprecationHelperStr.__hash__c                 C   s$   | j |k}|rtj| jtdd� |S )Nr    r   )r0   r   r   r1   r   )r2   ÚotherÚresr   r   r   Ú__eq__p   s   

ÿz_DeprecationHelperStr.__eq__N)Ú__name__Ú
__module__Ú__qualname__r+   r4   r6   r9   r   r   r   r   r.   e   s
    r.   c           
      C   s¸   | j › d|› �}|du rd|› d�}n	d|› d|› d�}|dur&|d| 7 }| j}d}d	}	 d|› |› �}	|	|v rJd
}| |	¡|t|	|ƒ< |d7 }nnq.|sZ| |¡|t||ƒ< dS 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	   Nú`z` is deprecated!z` is deprecated, use `z
` instead!Ú
r   FTÚ__pyx_fuse_é   )r:   Ú__pyx_capi__Úpopr.   )
r   Úroutine_nameÚnew_namer   Úold_nameÚdepdocÚdÚjÚ	has_fusedÚ
fused_namer   r   r   Údeprecate_cython_apix   s(   !
ù
ÿrK   Ú )ÚversionÚdeprecated_argsÚcustom_messagec                   sN   ˆdu r
d}t |ƒ‚ˆdu rtƒ ntˆƒ‰‡ ‡‡fdd„}| dur%|| ƒ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.
    deprecated_args : set of str, optional
        Arguments to deprecate - whether passed by position or keyword.
    custom_message : str, optional
        Custom message to add to deprecation warning and documentation.
    Nz9Need to specify a version where signature will be changedc                    s  t ˆƒ‰g ‰g ‰ ˆj ¡ D ]\}}|jtjkrˆ  |¡ q|jtjkr(ˆ |¡ q‡‡‡fdd„‰t 	ˆ¡‡ ‡‡‡‡‡‡fdd„ƒ}t
|ƒ}tˆƒˆ }dˆ› d|› dˆ› d�}ˆre|d	ˆ› d
ˆ› d�7 }|ˆ7 }|d  |g7  < t|ƒ dd¡d }t|ƒ|_|S )Nc                    s@   ˆ  | ¡}|rd|› dˆ› d�}|ˆ 7 }tj|tdd� d S d S )Nz
Arguments zV are deprecated, whether passed by position or keyword. They will be removed in SciPy ú. r
   r   )Úintersectionr   r   r   )r"   rQ   r   ©rO   rN   rM   r   r   Úwarn_deprecated_argsÛ   s   
þûzb_deprecate_positional_args.<locals>._inner_deprecate_positional_args.<locals>.warn_deprecated_argsc                     s’   t | ƒt ˆ ƒ }|dkrˆ|ƒ ˆ| i |¤ŽS tˆd |… ƒˆ }d |¡}tjd|› dˆ› d�tdd� | tˆj| ƒ¡ ˆ|ƒ ˆdi |¤ŽS )	Nr   z, z)You are passing as positional arguments: zE. Please change your invocation to use keyword arguments. From SciPy z@, passing these as positional arguments will result in an error.r    )r   r   )	ÚlenÚsetÚjoinr   r   r   ÚupdateÚzipÚ
parameters)r!   r"   Ú
extra_argsÚkwonly_extra_argsÚargs_msg)Úall_argsrN   ÚfÚkwonly_argsÚsigrM   rS   r   r   Úinner_fä   s    
þø
zU_deprecate_positional_args.<locals>._inner_deprecate_positional_args.<locals>.inner_fz
.. deprecated:: z
    Use of argument(s) ``z6`` by position is deprecated; beginning in 
    SciPy z, these will be keyword-only. zArgument(s) ``zX`` are deprecated, whether passed by position or keyword; they will be removed in SciPy rP   zExtended Summaryr>   r@   )r   rY   ÚitemsÚkindr   ÚPOSITIONAL_OR_KEYWORDÚappendÚKEYWORD_ONLYr)   r*   r   rU   ÚstrÚsplitr+   )r^   ÚnameÚparamra   Údocr[   Ú
admonitionrR   )r]   r^   r_   r`   rS   r   Ú _inner_deprecate_positional_argsÐ   s<   
€	ÿþý

þ
zD_deprecate_positional_args.<locals>._inner_deprecate_positional_args)Ú
ValueErrorrU   )ÚfuncrM   rN   rO   r$   rm   r   rR   r   Ú_deprecate_positional_args¸   s   ?rp   )r    )NNr/   )Úinspectr   r   r)   r   Ú	importlibr   Úscipy._lib._docscraper   Ú__all__ÚobjectÚ_NoValuer   r   r.   rK   rp   r   r   r   r   Ú<module>   s    ÿ
B
@ÿ