
    YPi                        d Z ddlZddlmZ ddlmZmZmZm	Z	m
Z
mZ ddlmZ ddlmZ ddlmZmZ erddlmZ dd	lmZmZ  e	d
      Zdeee      deedf   fdZed%d       Zede
eeej:                  f   dej:                  fd       Zdee
eeej:                  f      deej:                     fdZdee   dee   dee   fdZ e	ded      Z  e	ddd      Z!ere G d de             Z"dee   de#e    ded   dee    fdZ$dee   de#e!   ded   d e%d!   dee!   f
d"Z&dee%e      de#e    ded   dee df   fd#Z'dee%e      de#e!   ded   d e%d!   dee!df   f
d$Z(y)&a:  This module contains helper functions related to parsing arguments for classes and methods.

Warning:
    Contents of this module are intended to be used internally by the library and *not* by the
    user. Changes to this module are not considered breaking changes and may not be documented in
    the changelog.
    N)Sequence)TYPE_CHECKINGOptionalProtocolTypeVarUnionoverload)LinkPreviewOptions)TelegramObject)JSONDictODVInput)type_check_only)BotFileCredentialsTargreturn.c                      | rt        |       S dS )zParses an optional sequence into a tuple

    Args:
        arg (:obj:`Sequence`): The sequence to parse.

    Returns:
        :obj:`Tuple`: The sequence converted to a tuple or an empty tuple.
     )tupler   s    U/root/twitch_bot/venv/lib/python3.12/site-packages/telegram/_utils/argumentparsing.pyparse_sequence_argr   +   s     5:$"$    c                      y Nr   r   s    r   to_timedeltar   7   s    %(r   c                      y r   r   r   s    r   r   r   ;   s    
 r   c                 d    | yt        | t        t        f      rt        j                  |       S | S )a  Parses an optional time period in seconds into a timedelta

    Args:
        arg (:obj:`int` | :class:`datetime.timedelta`, optional): The time period to parse.

    Returns:
        :obj:`timedelta`: The time period converted to a timedelta object or :obj:`None`.
    N)seconds)
isinstanceintfloatdtm	timedeltar   s    r   r   r   C   s.     {#U|$}}S))Jr   disable_web_page_previewlink_preview_optionsc                 @    | r|rt        d      | t        |       }|S )zWrapper around warn_about_deprecated_arg_return_new_arg. Takes care of converting
    disable_web_page_preview to LinkPreviewOptions.
    zXParameters `disable_web_page_preview` and `link_preview_options` are mutually exclusive.)is_disabled)
ValueErrorr
   )r&   r'   s     r   parse_lpo_and_dwppr+   S   s6      $8
 	

  +1>VWr   Tele_coT)bound	covariantTeleCrypto_coHasDecryptMethodc                       e Zd ZdZedee   deded   de	d   def
d	       Z
edee   de	e   ded   de	d   deed
f   f
d       Zy)r0   r   clsdatabotr   credentialsr   r   c                      y r   r   r2   r3   r4   r5   s       r   de_json_decryptedz"HasDecryptMethod.de_json_decryptedn   s      r   .c                      y r   r   r7   s       r   de_list_decryptedz"HasDecryptMethod.de_list_decryptedv   s     ),r   N)__name__
__module____qualname__	__slots__classmethodtyper/   r   r   listr8   r   r:   r   r   r   r0   r0   j   s    			 m$	 	  %	  /0		 
 	  
	  
	,m$	,x.	, %	, /0		,
 =#%&	, 
	,r   r3   r2   r4   r   c                 ,    | y|j                  | |      S )z<Wrapper around TO.de_json that returns None if data is None.N)de_jsonr3   r2   r4   s      r   de_json_optionalrE      s     |;;tS!!r   r5   r   c                 .    | y|j                  | ||      S )zFWrapper around TO.de_json_decrypted that returns None if data is None.N)r8   r3   r2   r4   r5   s       r   de_json_decrypted_optionalrH      s!     |  sK88r   c                 ,    | y|j                  | |      S )zEWrapper around TO.de_list that returns an empty list if data is None.r   )de_listrD   s      r   de_list_optionalrK      s     |;;tS!!r   c                 .    | y|j                  | ||      S )zOWrapper around TO.de_list_decrypted that returns an empty list if data is None.r   )r:   rG   s       r   de_list_decrypted_optionalrM      s!     |  sK88r   )r   Nr   N))__doc__datetimer$   collections.abcr   typingr   r   r   r   r   r	   telegram._linkpreviewoptionsr
   telegram._telegramobjectr   telegram._utils.typesr   r   r   telegramr   r   r   r   r   r   r"   r#   r%   boolr+   r,   r/   r0   r@   rE   rA   rH   rK   rM   r   r   r   <module>rW      sT  &  $ N N ; 3 4&-CL	%HXa[1 	%eAsFm 	% 
 ( 
 ( 
	UCMM!
 	]]	 
huS%%>?@ XcmmE\   &tn DLM_D`  ! $ )>T
B/ATR,8 , ,("
8
"#'="7?"g"
9
8

9	m	
9 
%
9 '(	
9
 m
9"
4>
"")-g"=Ee_"
7C<"
9
4>
"
9	m	
9 
%
9 '(	
9
 =#
9r   