o
    Fh
                  	   @   s   d dl mZ d dlmZmZ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e d
e	fddZeG dd dZ		dded	ee ded
efddZ		dded	ee ded
efddZdS )    )	dataclass)AnyDictOptional)	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   N/var/www/html/venv/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__r   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_valuedict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   r   r   pydanticr   aiogramr   aiogram.client.defaultr   aiogram.methodsr	   aiogram.typesr
   r   r   boolr-   r.   r   r   r   r   <module>   s@    
'