U
    }gZ	                     @   sj   d Z ddlZddlZddlmZmZ eeedddZeeeeegef ddd	Zeeed
ddZ	dS )a  Helper functions for deprecation.

This interface is itself unstable and may change without warning. Do
not use these functions yourself, even as a joke. The underscores are
there for a reason. No support will be given.

In particular, most of this will go away without warning once
Beautiful Soup drops support for Python 3.11, since Python 3.12
defines a `@typing.deprecated()
decorator. <https://peps.python.org/pep-0702/>`_
    N)AnyCallable)old_namenew_nameversionc                    s<   t td fdd}|jtdd fdd}|S )zWAlias one attribute name to another for backward compatibility

    :meta private:
    )returnc                    s.   t jd d  d dtdd t|  S ):meta private:zAccess to deprecated property . (Replaced by ) -- Deprecated since version .   
stacklevelwarningswarnDeprecationWarninggetattr)selfr   r   r    4/tmp/pip-unpacked-wheel-kgiupv3k/bs4/_deprecation.pyalias   s    z _deprecated_alias.<locals>.aliasN)valuer   c                    s0   t jd d  d dtdd t|  |S )r   zWrite to deprecated property r	   r
   r   r   r   )r   r   r   setattr)r   r   r   r   r   r   &   s    )propertyr   setterstrr   r   r   r   r   r   r   _deprecated_alias   s
    		r   )r   r   r   r   c                    s   t t t d fdd}|S )Nargskwargsr   c                    s4   t jd d  d dtdd t|  ||S r   zCall to deprecated method r	   r
   r   r   r   r   )r   r!   r"   r   r   r   r   6   s    z)_deprecated_function_alias.<locals>.alias)r   r   r   r   r   _deprecated_function_alias3   s    	r$   )replaced_byr   r   c                    s   t t d fdd}|S )N)funcr   c                    s(   t  tttd fdd}|S )Nr    c                     s0   t jd j d d dtdd  | |S r#   )r   r   __name__r   )r!   r"   )r&   r%   r   r   r   with_warningD   s    z4_deprecated.<locals>.deprecate.<locals>.with_warning)	functoolswrapsr   )r&   r(   r%   r   )r&   r   	deprecateC   s    	z_deprecated.<locals>.deprecate)r   )r%   r   r,   r   r+   r   _deprecatedB   s    r-   )
__doc__r)   r   typingr   r   r   r   r$   r-   r   r   r   r   <module>   s     