o
    4˜Žj˜
  ã                   @  sè   d dl mZ d dlmZmZ d dlmZ d dlmZm	Z	m
Z
mZmZ d dlmZmZ d dlmZ d dlmZ dd	lmZmZ dd
lmZ erLddlmZ ede	d�ZG dd„ deƒZG dd„ deee ƒZG dd„ deeee eƒZdS )é    )Úannotations)ÚABCÚabstractmethod)Ú	Generator)ÚTYPE_CHECKINGÚAnyÚClassVarÚGenericÚTypeVar)Ú	BaseModelÚ
ConfigDict)Úmodel_validator)ÚBotContextControlleré   )Ú	InputFileÚResponseParameters)Ú
UNSET_TYPE)ÚBotÚTelegramType)Úboundc                   @  s0   e Zd ZU edd�Zded< ded< ded< d	S )
ÚRequestT)Úarbitrary_types_allowedÚstrÚmethodzdict[str, Any | None]Údatazdict[str, InputFile] | NoneÚfilesN)Ú__name__Ú
__module__Ú__qualname__r   Úmodel_configÚ__annotations__© r!   r!   úQ/var/www/kodo/Anonymous/send/lib/python3.10/site-packages/aiogram/methods/base.pyr      s
   
 
r   c                   @  sF   e Zd ZU ded< dZded< dZded< dZded	< dZd
ed< dS )ÚResponseÚboolÚokNzTelegramType | NoneÚresultz
str | NoneÚdescriptionz
int | NoneÚ
error_codezResponseParameters | NoneÚ
parameters)r   r   r   r    r&   r'   r(   r)   r!   r!   r!   r"   r#   $   s   
 r#   c                   @  s‚   e Zd ZU edddd�Zedd�edd	d
„ƒƒZer#de	d< de	d< ne
eddd„ƒƒZe
ed dd„ƒƒZd!dd„Zd"dd„ZdS )#ÚTelegramMethodÚallowT)ÚextraÚpopulate_by_namer   Úbefore)ÚmodeÚvaluesúdict[str, Any]Úreturnc                 C  s    t |tƒs|S dd„ | ¡ D ƒS )a‚  
        Remove UNSET before fields validation.

        We use UNSET as a sentinel value for `parse_mode` and replace it to real value later.
        It isn't a problem when it's just default value for a model field,
        but UNSET might be passing to a model initialization from `Bot.method_name`,
        so we must take care of it and remove it before fields validation.
        c                 S  s    i | ]\}}t |tƒs||“qS r!   )Ú
isinstancer   )Ú.0ÚkÚvr!   r!   r"   Ú
<dictcomp>@   s     z/TelegramMethod.remove_unset.<locals>.<dictcomp>)r3   ÚdictÚitems)Úclsr0   r!   r!   r"   Úremove_unset3   s   
zTelegramMethod.remove_unsetzClassVar[Any]Ú__returning__zClassVar[str]Ú__api_method__Útypec                 C  ó   d S ©Nr!   ©Úselfr!   r!   r"   r<   G   ó   zTelegramMethod.__returning__r   c                 C  r?   r@   r!   rA   r!   r!   r"   r=   L   rC   zTelegramMethod.__api_method__Úbotr   r   c                 Ã  s   �|| ƒI d H S r@   r!   ©rB   rD   r!   r!   r"   ÚemitQ   s   €zTelegramMethod.emitú"Generator[Any, None, TelegramType]c                 C  s    | j }|s	tdƒ‚|  |¡ ¡ S )NzÅThis method is not mounted to a any bot instance, please call it explicilty with bot instance `await bot(method)`
or mount method to a bot instance `method.as_(bot)` and then call it `await method`)Ú_botÚRuntimeErrorrF   Ú	__await__rE   r!   r!   r"   rJ   T   s   ÿzTelegramMethod.__await__N)r0   r1   r2   r1   )r2   r>   )r2   r   )rD   r   r2   r   )r2   rG   )r   r   r   r   r   r   Úclassmethodr;   r   r    Úpropertyr   r<   r=   rF   rJ   r!   r!   r!   r"   r*   ,   s(   
 ý

r*   N)Ú
__future__r   Úabcr   r   Úcollections.abcr   Útypingr   r   r   r	   r
   Úpydanticr   r   Úpydantic.functional_validatorsr   Ú!aiogram.client.context_controllerr   Útypesr   r   Ú
types.baser   Ú
client.botr   r   r   r#   r*   r!   r!   r!   r"   Ú<module>   s    	