+
    ÁFñj`  ã                   óâ   € R t ^ RIHt ^ RIHtHtHtHtHt ^ RI	H
t
Ht ]'       d   ^ RIHt ^ RIHtHt ]! RRR7      t]R	 R
 l4       t]R R l4       tR R ltR R ltR R ltRR R lltR# )a¾  This module contains helper functions related to handling of files.

.. versionchanged:: 20.0
   Previously, the contents of this module were available through the (no longer existing)
   module ``telegram._utils.helpers``.

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.
)ÚPath)ÚIOÚTYPE_CHECKINGÚTypeVarÚcastÚoverload)Ú	FileInputÚFilePathInput)ÚAny)Ú	InputFileÚTelegramObjectÚ_Tú%bytes | InputFile | str | Path | None)Úboundc                óv   € V ^8„  d   QhR\         \        ,          R\        \        R,          \        3,          /# ©é   ÚobjÚreturnN)r   ÚbytesÚtupleÚstr)Úformats   "ÚK/opt/hermes-site/venv/lib/python3.14/site-packages/telegram/_utils/files.pyÚ__annotate__r   -   s$   € × >Ñ >”2”e•9Ð >¤¤s¨T¥z´5Ð'8Õ!9Ñ >ó    c                 ó   € R # ©N© ©r   s   &r   Ú	load_filer    ,   s   € Ù;>r   c                óJ   € V ^8„  d   QhR\         R\        R\         3,          /# r   )r   r   )r   s   "r   r   r   1   s   € × .Ñ .”2Ð .œ% ¤b �/Ñ .r   c                 ó   € R # r   r   r   s   &r   r    r    0   s   € Ù+.r   c                óP   € V ^8„  d   QhRRR\         \        R,          R3,          /# )r   r   zFileInput | Noner   Nr   )r   r   )r   s   "r   r   r   4   s+   € ÷ ñ Ø	ðä
Œ3��:Ð>Ð>Õ?ñr   c                óŠ   € V f   R#  V P                  4       p\        T 4      pY!3#   \         d    R\        RT 4      3u # i ; i)zlIf the input is a file handle, read the data and name and return it. Otherwise, return
the input unchanged.
Nzbytes | InputFile | str | Path)NN)ÚreadÚAttributeErrorr   Úguess_file_name)r   ÚcontentsÚfilenames   &  r   r    r    4   s[   € ð ‚{ØÐðAØ—8‘8“:ˆô ˜sÓ#€HàÐÐøô ô AØ”TÐ:¸CÓ@Ð@Ò@ðAús   ˆ& ¦AÁAc                ó>   € V ^8„  d   QhR\         R\        R,          /# r   )r   r   )r   s   "r   r   r   G   s   € ÷ ñ œð ¤s¨T¥zñ r   c                ó¨   € \        V R4      '       d@   \        V P                  \        4      '       g    \	        V P                  4      P                  # R# )z_If the input is a file handle, read name and return it. Otherwise, return
the input unchanged.
ÚnameN)ÚhasattrÚ
isinstancer,   Úintr   r   s   &r   r'   r'   G   s8   € ô ˆs�F×Ò¤J¨s¯x©x¼×$=Ò$=Ü�C—H‘H‹~×"Ñ"Ð"ár   c                ó>   € V ^8„  d   QhR\         R,          R\        /# )r   r   Nr   )r	   Úbool)r   s   "r   r   r   Q   s   € ÷ ñ ”} tÕ+ð ´ñ r   c                ój   € V f   R# \        V 4      p VP                  4       #   \         d     R# i ; i)zg
Checks if a given string is a file on local system.

Args:
    obj (:obj:`str`): The string to check.
F)r   Úis_fileÚ	Exception)r   Úpaths   & r   Úis_local_filer6   Q   s8   € ð ‚{Ùä�‹9€DðØ�|‰|‹~ÐøÜô Úðús   “# £2±2Nc                óz   € V ^8„  d   QhRRR\         R,          R,          R\        R,          R\        R\        R	R
/# )r   Ú
file_inputzFileInput | TelegramObjectÚtg_typer   Nr)   ÚattachÚ
local_moder   zstr | InputFile | Any)Útyper   r1   )r   s   "r   r   r   b   sS   € ÷ >ñ >Ø,ð>äÐ"Õ# dÕ*ð>ô �D�jð>ô ð	>ô
 ð>ð ñ>r   c                ó¼  € ^ RI Hp \        V \        4      '       d-   V P	                  R4      '       d   V'       g   \        R4      hV # \        V \        \        ,          4      '       dt   \        V 4      '       da   \        V 4      pV'       d   VP                  4       P                  4       # VP                  RR7      ;_uu_ 4       pV! WrVR7      uuRRR4       # V # \        V \        4      '       d   V! WVR7      # \        V R4      '       d   V! \        R	V 4      W#R7      # V'       d   \        W4      '       d   V P                  # V #   + '       g   i     T # ; i)
aq  
Parses input for sending files:

* For string input, if the input is an absolute path of a local file:

    * if ``local_mode`` is ``True``, adds the ``file://`` prefix. If the input is a relative
    path of a local file, computes the absolute path and adds the ``file://`` prefix.
    * if ``local_mode`` is ``False``, loads the file as binary data and builds an
      :class:`InputFile` from that

  Returns the input unchanged, otherwise.
* :class:`pathlib.Path` objects are treated the same way as strings.
* For IO and bytes input, returns an :class:`telegram.InputFile`.
* If :attr:`tg_type` is specified and the input is of that type, returns the ``file_id``
  attribute.

Args:
    file_input (:obj:`str` | :obj:`bytes` | :term:`file object` | :class:`~telegram.InputFile`            | Telegram media object): The input to parse.
    tg_type (:obj:`type`, optional): The Telegram media type the input can be. E.g.
        :class:`telegram.Animation`.
    filename (:obj:`str`, optional): The filename. Only relevant in case an
        :class:`telegram.InputFile` is returned.
    attach (:obj:`bool`, optional): Pass :obj:`True` if the parameter this file belongs to in
        the request to Telegram should point to the multipart data via an ``attach://`` URI.
        Defaults to `False`. Only relevant if an :class:`telegram.InputFile` is returned.
    local_mode (:obj:`bool`, optional): Pass :obj:`True` if the bot is running an api server
        in ``--local`` mode.

Returns:
    :obj:`str` | :class:`telegram.InputFile` | :obj:`object`: The parsed input or the untouched
    :attr:`file_input`, in case it's no valid file input.
)r   zfile://zBSpecified file input is a file URI, but local mode is not enabled.Úrb)Úmode)r)   r:   Nr%   r   )Útelegramr   r.   r   Ú
startswithÚ
ValueErrorr   r6   ÚabsoluteÚas_uriÚopenr   r-   r   Úfile_id)r8   r9   r)   r:   r;   r   r5   Úfile_handles   &&&&&   r   Úparse_file_inputrH   b   s  € õR #ä�*œc×"Ò" z×'<Ñ'<¸Y×'GÒ'GßÜÐaÓbÐbØÐÜ�*œc¤D�j×)Ò)Ü˜×$Ò$Ü˜
Ó#ˆDßØ—}‘}“×-Ñ-Ó/Ð/Ø—‘ �×%Ô%¨Ù  ÈÔO÷ &Ò%ð ÐÜ�*œe×$Ò$Ù˜¸vÔFÐFÜˆz˜6×"Ò"Ùœ˜d JÓ/¸(ÔRÐRß”:˜j×2Ò2Ø×!Ñ!Ð!ØÐ÷ &Ö%ð Ðús   Ã
E
Å
E	)NNFF)Ú__doc__Úpathlibr   Útypingr   r   r   r   r   Útelegram._utils.typesr   r	   r
   r@   r   r   r   r    r'   r6   rH   r   r   r   Ú<module>rM      sg   ðñ&
õ ß =Õ =ç :çÝç2áˆTÐ@ÔA€ð 
Ü >ó 
Ø >ð 
Ü .ó 
Ø .õõ&õ÷">ñ >r   