o
    Zzj	  ã                   @   sÊ   d Z ddlmZ ddlmZ ddlmZ ddlmZm	Z	 de
de
de
d	e
d
e
f
dd„Zdefdedede
de
d	e
de
dedee
e	B ee egdf d
efdd„Z	dde
de
d	e
de
ded
dfdd„ZdS )zÞThis module contains functionality used for transition warnings issued by this library.

It was created to prevent circular imports that would be caused by creating the warnings
inside warnings.py.

.. versionadded:: 20.2
é    )ÚCallable)ÚAny)Úwarn)ÚPTBDeprecationWarningÚPTBUserWarningÚdeprecated_nameÚnew_nameÚobject_typeÚbot_api_versionÚreturnc                 C   s*   d|› d| › d|› d|› d|› d| › d�S )zŸBuilds a warning message for the transition in API when an object is renamed/replaced.

    Returns a warning message that can be used in `warn` function.
    zThe z 'z' was replaced by 'z' in Bot API z. We recommend using 'z' instead of 'ú'.© ©r   r   r	   r
   r   r   ú^/var/www/kodo/tsheker/venv/lib/python3.10/site-packages/telegram/_utils/warnings_transition.pyÚ!build_deprecation_warning_message"   s   ÿÿþÿr   é   Údeprecated_argÚnew_argÚdeprecated_arg_nameÚnew_arg_nameÚptb_versionÚ
stacklevelÚwarn_callbackNc           	   
   C   sp   | r|r| |krt ||d|d�}td|› d|› d|› �ƒ‚| r6|t|d|› d|› d|› d	�ƒ|d
 d� | S |S )aª  A helper function for the transition in API when argument is renamed.

    Checks the `deprecated_arg` and `new_arg` objects; warns if non-None `deprecated_arg` object
    was passed. Returns `new_arg` object (either the one originally passed by the user or the one
    that user passed as `deprecated_arg`).

    Raises `ValueError` if both `deprecated_arg` and `new_arg` objects were passed, and they are
    different.
    Ú	parameterr   z"You passed different entities as 'z' and 'z'. úBot API z renamed the argument 'ú' to 'r   é   ©r   )r   Ú
ValueErrorr   )	r   r   r   r   r
   r   r   r   Úbase_messager   r   r   Ú(warn_about_deprecated_arg_return_new_arg5   s0   üÿÿÿþúr    Údeprecated_attr_nameÚnew_attr_namec              
   C   s.   t t|d|› d| › d|› d�ƒ|d d� dS )zÄA helper function for the transition in API when attribute is renamed. Call from properties.

    The properties replace deprecated attributes in classes and issue these deprecation warnings.
    r   z renamed the attribute 'r   r   r   r   N)r   r   )r!   r"   r
   r   r   r   r   r   Ú&warn_about_deprecated_attr_in_propertyb   s   ÿþ
úr#   )r   )Ú__doc__Úcollections.abcr   Útypingr   Útelegram._utils.warningsr   Útelegram.warningsr   r   Ústrr   ÚintÚtypeÚWarningr    r#   r   r   r   r   Ú<module>   sf   ÿþýü
ûøÿþýüûúùø	
÷2ûÿþýüûú