o
    Uj
                     @  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!   M/opt/telega-widget/.venv/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 )NzThis 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    	