o
    5˜Žj´
  ã                	   @   sÊ   d dl mZ d dlmZ d dlmZ d dlmZ d dlm	Z	 d dl
mZ d dlmZ dd	e	dB d
efdd„ZeG dd„ dƒƒZ		dded	e	dB ded
efdd„Z		dded	e	dB ded
efdd„ZdS )é    )Ú	dataclass)ÚAny)Ú	BaseModel)ÚBot)ÚDefaultBotProperties)ÚTelegramMethod)Ú	InputFileNÚdefaultÚreturnc                 C   s   | d u rt ƒ } td| d�S )Nz42:Fake)Útokenr	   )r   r   ©r	   © r   úX/var/www/kodo/Anonymous/send/lib/python3.10/site-packages/aiogram/utils/serialization.pyÚ_get_fake_bot   s   r   c                   @   s*   e Zd ZU dZeed< eeef ed< dS )ÚDeserializedTelegramObjecta"  
    Represents a dumped Telegram object.

    :param data: The dumped data of the Telegram object.
    :type data: Any
    :param files: The dictionary containing the file names as keys
        and the corresponding `InputFile` objects as values.
    :type files: dict[str, InputFile]
    ÚdataÚfilesN)	Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   Ú__annotations__ÚdictÚstrr   r   r   r   r   r      s   
 
r   TÚobjÚinclude_api_method_namec                 C   sv   i }|rt | tƒr| j|d< t | tƒr| jddd�} t|d�}i }|jj| ||dd�}t |tƒr5| 	|¡ t
||d�S )am  
    Deserialize Telegram Object to JSON compatible Python object.

    :param obj: The object to be deserialized.
    :param default: Default bot properties
        should be passed only if you want to use custom defaults.
    :param include_api_method_name: Whether to include the API method name in the result.
    :return: The deserialized Telegram object.
    ÚmethodÚpythonF)ÚmodeÚwarningsr   )Úbotr   Ú_dumps_json)r   r   )Ú
isinstancer   Ú__api_method__r   Ú
model_dumpr   ÚsessionÚprepare_valuer   Úupdater   )r   r	   r   ÚextendsÚfake_botr   Úpreparedr   r   r   Údeserialize_telegram_object"   s    


ü

r+   c                 C   s   t | ||d�jS )a†  
    Deserialize telegram object to JSON compatible Python object excluding files.

    :param obj: The telegram object to be deserialized.
    :param default: Default bot properties
        should be passed only if you want to use custom defaults.
    :param include_api_method_name: Whether to include the API method name in the result.
    :return: The deserialized telegram object.
    )r	   r   )r+   r   )r   r	   r   r   r   r   Ú%deserialize_telegram_object_to_pythonG   s   ýür,   )N)NT)Údataclassesr   Útypingr   Úpydanticr   Úaiogramr   Úaiogram.client.defaultr   Úaiogram.methodsr   Úaiogram.typesr   r   r   Úboolr+   r,   r   r   r   r   Ú<module>   s@    ýÿþý
ü'ýÿþýü