+
    ÁFñjÆ=  ã                   ó¼   € R t ^ RIt^ RIHt ^ RIHt ^ RIHt ^ RI	H
t
Ht ^ RIHt ^ RIHt ^ RIHt ^ RIHt ^ R	IHtHtHt ]
'       d   ^ R
IHt  ! R R]4      tR# )z?This module contains an object that represents a Telegram File.N)Ú	b64decode)ÚPath)ÚTYPE_CHECKINGÚBinaryIO)Údecrypt)ÚTelegramObject)ÚDEFAULT_NONE)Úis_local_file)ÚFilePathInputÚJSONDictÚODVInput)ÚFileCredentialsc            	       ó  a a€ ] tR t^%t oRtRtRRR/V3R lV 3R lllltV3R lR ltV3R lR	 ltRR
]	R]	R]	R]	/V3R lR lllt
R
]	R]	R]	R]	/V3R lR lltRR
]	R]	R]	R]	/V3R lR llltV3R lR ltRtVtV ;t# )ÚFilea4  
This object represents a file ready to be downloaded. The file can be e.g. downloaded with
:attr:`download_to_drive`. It is guaranteed that the link will be valid for at least 1 hour.
When the link expires, a new one can be requested by calling :meth:`telegram.Bot.get_file`.

Objects of this class are comparable in terms of equality. Two objects of this class are
considered equal, if their :attr:`file_unique_id` is equal.

.. versionchanged:: 20.0
    ``download`` was split into :meth:`download_to_drive` and :meth:`download_to_memory`.

Note:
    * Maximum file size to download is
      :tg-const:`telegram.constants.FileSizeLimit.FILESIZE_DOWNLOAD`.
    * If you obtain an instance of this class from :attr:`telegram.PassportFile.get_file`,
      then it will automatically be decrypted as it downloads when you call e.g.
      :meth:`download_to_drive`.

Args:
    file_id (:obj:`str`): Identifier for this file, which can be used to download
        or reuse the file.
    file_unique_id (:obj:`str`): Unique identifier for this file, which
        is supposed to be the same over time and for different bots.
        Can't be used to download or reuse the file.
    file_size (:obj:`int`, optional): File size in bytes, if known.
    file_path (:obj:`str`, optional): File path. Use e.g. :meth:`download_to_drive` to get the
        file.

Attributes:
    file_id (:obj:`str`): Identifier for this file, which can be used to download
        or reuse the file.
    file_unique_id (:obj:`str`): Unique identifier for this file, which
        is supposed to be the same over time and for different bots.
        Can't be used to download or reuse the file.
    file_size (:obj:`int`): Optional. File size in bytes, if known.
    file_path (:obj:`str`): Optional. File path. Use e.g. :meth:`download_to_drive` to get the
        file.
NÚ
api_kwargsc                ób   <€ V ^8„  d   QhRS[ RS[ RS[R,          RS[ R,          RS[R,          /# )é   Úfile_idÚfile_unique_idÚ	file_sizeNÚ	file_pathr   )ÚstrÚintr   )ÚformatÚ__classdict__s   "€ÚJ/opt/hermes-site/venv/lib/python3.14/site-packages/telegram/_files/file.pyÚ__annotate__ÚFile.__annotate__U   sI   ø€ ÷ ñ áðñ ðñ ˜•:ð	ñ
 ˜•:ðñ ˜t•Oñó    c               óÒ   <€ \         SV `  VR 7       \        V4      V n        \        V4      V n        W0n        W@n        RV n        V P                  3V n        V P                  4        R# ))r   N)
ÚsuperÚ__init__r   r   r   r   r   Ú_credentialsÚ	_id_attrsÚ_freeze)Úselfr   r   r   r   r   Ú	__class__s   &&&&&$€r   r!   ÚFile.__init__U   sZ   ø€ ô 	‰Ñ JÐÔ/ô   ›LˆŒÜ#& ~Ó#6ˆÔà%.ŒØ%.Œà48ˆÔà×-Ñ-Ð/ˆŒà�‰Žr   c                ó    <€ V ^8„  d   QhRS[ /# )r   Úreturn)r   )r   r   s   "€r   r   r   m   s   ø€ ÷ 
ñ 
¡#ñ 
r   c           	     ó<  € \         P                  ! \        V P                  4      4      p\         P                  ! \         P
                  ! VP                  VP                  \         P                  ! VP                  4      VP                  VP                  4      4      # )zPConvert any UTF-8 char in :obj:`File.file_path` into a url encoded ASCII string.)Úurllib_parseÚurlsplitr   r   Ú
urlunsplitÚSplitResultÚschemeÚnetlocÚquoteÚpathÚqueryÚfragment)r%   Úsress   & r   Ú_get_encoded_urlÚFile._get_encoded_urlm   si   € ä×$Ò$¤S¨¯©Ó%8Ó9ˆÜ×&Ò&Ü×$Ò$Ø—‘˜TŸ[™[¬,×*<Ò*<¸T¿Y¹YÓ*GÈÏÉÐUY×UbÑUbóó
ð 	
r   c                ó&   <€ V ^8„  d   QhRS[ RS[ /# )r   Úbufr)   )Úbytes)r   r   s   "€r   r   r   v   s   ø€ ÷ dñ d¡Eð d©eñ dr   c                ó�   € \        \        V P                  P                  4      \        V P                  P                  4      V4      # ©N)r   r   r"   ÚsecretÚhash)r%   r9   s   &&r   Ú_prepare_decryptÚFile._prepare_decryptv   s4   € Ü”y ×!2Ñ!2×!9Ñ!9Ó:¼IÀd×FWÑFW×F\ÑF\Ó<]Ð_bÓcÐcr   Úread_timeoutÚwrite_timeoutÚconnect_timeoutÚpool_timeoutc                óŒ   <€ V ^8„  d   QhRS[ R,          RS[S[,          RS[S[,          RS[S[,          RS[S[,          RS[/# )r   Úcustom_pathNrA   rB   rC   rD   r)   )r
   r   Úfloatr   )r   r   s   "€r   r   r   y   sd   ø€ ÷ hñ há" TÕ)ðhñ ™u•oð	hñ
  ¡•ðhñ "¡%�ðhñ ™u•oðhñ 
ñhr   c             ƒ  ó   "  € V P                   '       g   \        R4      h\        V P                   4      pV'       d   RMV P                  4       pV'       d    V P                  '       dŽ   \        V P                   4      pV P                  VP                  4       4      p	Ve   \        V4      p
M6\        \        VP                  4      R,           VP                  ,           4      p
V
P                  V	4       V
# Ve>   V'       d6   \        P                  ! V P                   \        V4      4       \        V4      # V'       d   \        V4      pMEV'       d   \        V P                   4      # \        \        V P                   4      P                  4      pV P                  4       P                  P!                  VVVVVR7      G Rj  x€L
 p	V P                  '       d   V P                  V	4      p	VP                  V	4       V#  L:5i)a‹
  
Download this file. By default, the file is saved in the current working directory with
:attr:`file_path` as file name. If :paramref:`custom_path` is supplied as a :obj:`str` or
:obj:`pathlib.Path`, it will be saved to that path.

Note:
    If :paramref:`custom_path` isn't provided and :attr:`file_path` is the path of a
    local file (which is the case when a Bot API Server is running in local mode), this
    method will just return the path.

    The only exception to this are encrypted files (e.g. a passport file). For these, a
    file with the prefix `decrypted_` will be created in the same directory as the
    original file in order to decrypt the file without changing the existing one
    in-place.

.. seealso:: :wiki:`Working with Files and Media <Working-with-Files-and-Media>`

.. versionchanged:: 20.0

    * :paramref:`custom_path` parameter now also accepts :class:`pathlib.Path` as argument.
    * Returns :class:`pathlib.Path` object in cases where previously a :obj:`str` was
      returned.
    * This method was previously called ``download``. It was split into
      :meth:`download_to_drive` and :meth:`download_to_memory`.

.. versionchanged:: 21.7
    Raises :exc:`RuntimeError` if :attr:`file_path` is not set. Note that files without
    a :attr:`file_path` could never be downloaded, as this attribute is mandatory for that
    operation.

Args:
    custom_path (:class:`pathlib.Path` | :obj:`str` , optional): The path where the file
        will be saved to. If not specified, will be saved in the current working directory
        with :attr:`file_path` as file name or the :attr:`file_id` if :attr:`file_path`
        is not set.

Keyword Args:
    read_timeout (:obj:`float` | :obj:`None`, optional): Value to pass to
        :paramref:`telegram.request.BaseRequest.post.read_timeout`. Defaults to
        :attr:`~telegram.request.BaseRequest.DEFAULT_NONE`.
    write_timeout (:obj:`float` | :obj:`None`, optional): Value to pass to
        :paramref:`telegram.request.BaseRequest.post.write_timeout`. Defaults to
        :attr:`~telegram.request.BaseRequest.DEFAULT_NONE`.
    connect_timeout (:obj:`float` | :obj:`None`, optional): Value to pass to
        :paramref:`telegram.request.BaseRequest.post.connect_timeout`. Defaults to
        :attr:`~telegram.request.BaseRequest.DEFAULT_NONE`.
    pool_timeout (:obj:`float` | :obj:`None`, optional): Value to pass to
        :paramref:`telegram.request.BaseRequest.post.pool_timeout`. Defaults to
        :attr:`~telegram.request.BaseRequest.DEFAULT_NONE`.

Returns:
    :class:`pathlib.Path`: Returns the Path object the file was downloaded to.

Raises:
    RuntimeError: If :attr:`file_path` is not set.

ú9No `file_path` available for this file. Can not download.Nz/decrypted_©rA   rB   rC   rD   )r   ÚRuntimeErrorr	   r6   r"   r   r?   Ú
read_bytesr   ÚparentÚnameÚwrite_bytesÚshutilÚcopyfileÚget_botÚrequestÚretrieve)r%   rF   rA   rB   rC   rD   Ú
local_fileÚurlÚfile_to_decryptr9   r2   Úfilenames   &&$$$$      r   Údownload_to_driveÚFile.download_to_drivey   s‰  é € ðD �~�~ˆ~ÜÐZÓ[Ð[ä" 4§>¡>Ó2ˆ
ß ‰d d×&;Ñ&;Ó&=ˆ÷ ˜$×+×+Ð+Ü" 4§>¡>Ó2ˆOØ×'Ñ'¨×(BÑ(BÓ(DÓEˆCØÒ&Ü˜KÓ(‘äœC × 6Ñ 6Ó7¸-ÕGÈ/×J^ÑJ^Õ^Ó_�Ø×Ñ˜SÔ!ØˆKàÒ"§zÜ�OŠO˜DŸN™N¬C°Ó,<Ô=Ü˜Ó$Ð$çÜ˜KÓ(‰HßÜ˜Ÿ™Ó'Ð'äœD §¡Ó0×5Ñ5Ó6ˆHà—L‘L“N×*Ñ*×3Ñ3ØØ%Ø'Ø+Ø%ð 4ó 
÷ 
ˆð ××ÐØ×'Ñ'¨Ó,ˆCØ×Ñ˜SÔ!Øˆñ
ùs8   ‚AG>ÁG>Á)BG>Ä<G>Ä?G>ÅA.G>ÇG<ÇG>Ç%G>c                ó|   <€ V ^8„  d   QhRS[ RS[S[,          RS[S[,          RS[S[,          RS[S[,          RR/# )r   ÚoutrA   rB   rC   rD   r)   N)r   r   rG   )r   r   s   "€r   r   r   ã   s_   ø€ ÷ Bñ BáðBñ ™u•oð	Bñ
  ¡•ðBñ "¡%�ðBñ ™u•oðBð 
ñBr   c             ƒ  óî  "  € V P                   '       g   \        R4      h\        V P                   4      pV'       d   RMV P                  4       pV'       d   \	        V P                   4      MRpV'       d   VP                  4       p	M6V P                  4       P                  P                  VVVVVR7      G Rj  x€L
 p	V P                  '       d   V P                  V	4      p	VP                  V	4       R#  L:5i)aÝ  
Download this file into memory. :paramref:`out` needs to be supplied with a
:obj:`io.BufferedIOBase`, the file contents will be saved to that object using the
:obj:`out.write<io.BufferedIOBase.write>` method.

.. seealso:: :wiki:`Working with Files and Media <Working-with-Files-and-Media>`

Hint:
    If you want to immediately read the data from ``out`` after calling this method, you
    should call ``out.seek(0)`` first. See also :meth:`io.IOBase.seek`.

.. versionadded:: 20.0

.. versionchanged:: 21.7
    Raises :exc:`RuntimeError` if :attr:`file_path` is not set. Note that files without
    a :attr:`file_path` could never be downloaded, as this attribute is mandatory for that
    operation.

Args:
    out (:obj:`io.BufferedIOBase`): A file-like object. Must be opened for writing in
        binary mode.

Keyword Args:
    read_timeout (:obj:`float` | :obj:`None`, optional): Value to pass to
        :paramref:`telegram.request.BaseRequest.post.read_timeout`. Defaults to
        :attr:`~telegram.request.BaseRequest.DEFAULT_NONE`.
    write_timeout (:obj:`float` | :obj:`None`, optional): Value to pass to
        :paramref:`telegram.request.BaseRequest.post.write_timeout`. Defaults to
        :attr:`~telegram.request.BaseRequest.DEFAULT_NONE`.
    connect_timeout (:obj:`float` | :obj:`None`, optional): Value to pass to
        :paramref:`telegram.request.BaseRequest.post.connect_timeout`. Defaults to
        :attr:`~telegram.request.BaseRequest.DEFAULT_NONE`.
    pool_timeout (:obj:`float` | :obj:`None`, optional): Value to pass to
        :paramref:`telegram.request.BaseRequest.post.pool_timeout`. Defaults to
        :attr:`~telegram.request.BaseRequest.DEFAULT_NONE`.

Raises:
    RuntimeError: If :attr:`file_path` is not set.
rI   NrJ   )r   rK   r	   r6   r   rL   rR   rS   rT   r"   r?   Úwrite)
r%   r\   rA   rB   rC   rD   rU   rV   r2   r9   s
   &&$$$$    r   Údownload_to_memoryÚFile.download_to_memoryã   sÁ   é € ð` �~�~ˆ~ÜÐZÓ[Ð[ä" 4§>¡>Ó2ˆ
ß ‰d d×&;Ñ&;Ó&=ˆß'1Œt�D—N‘NÔ#°tˆßØ—/‘/Ó#‰CàŸ™›×.Ñ.×7Ñ7ØØ)Ø+Ø /Ø)ð 8ó ÷ ˆCð ××ÐØ×'Ñ'¨Ó,ˆCØ�	‰	�#Žñùs%   ‚AC5ÁC5Á6AC5Â8C3Â9C5Ã%C5c                óŒ   <€ V ^8„  d   QhRS[ R,          RS[S[,          RS[S[,          RS[S[,          RS[S[,          RS[ /# )r   r9   NrA   rB   rC   rD   r)   )Ú	bytearrayr   rG   )r   r   s   "€r   r   r   '  sd   ø€ ÷ Eñ Eá˜ÕðEñ ™u•oð	Eñ
  ¡•ðEñ "¡%�ðEñ ™u•oðEñ 
ñEr   c             ƒ  óø  "  € V P                   '       g   \        R4      hVf   \        4       p\        V P                   4      '       d%   \	        V P                   4      P                  4       pMDV P                  4       P                  P                  V P                  4       VVVVR7      G Rj  x€L
 pV P                  '       d#   VP                  V P                  V4      4       V# VP                  V4       V#  LK5i)a%  Download this file and return it as a bytearray.

.. versionchanged:: 21.7
    Raises :exc:`RuntimeError` if :attr:`file_path` is not set. Note that files without
    a :attr:`file_path` could never be downloaded, as this attribute is mandatory for that
    operation.

Args:
    buf (:obj:`bytearray`, optional): Extend the given bytearray with the downloaded data.

Keyword Args:
    read_timeout (:obj:`float` | :obj:`None`, optional): Value to pass to
        :paramref:`telegram.request.BaseRequest.post.read_timeout`. Defaults to
        :attr:`~telegram.request.BaseRequest.DEFAULT_NONE`.

        .. versionadded:: 20.0
    write_timeout (:obj:`float` | :obj:`None`, optional): Value to pass to
        :paramref:`telegram.request.BaseRequest.post.write_timeout`. Defaults to
        :attr:`~telegram.request.BaseRequest.DEFAULT_NONE`.

        .. versionadded:: 20.0
    connect_timeout (:obj:`float` | :obj:`None`, optional): Value to pass to
        :paramref:`telegram.request.BaseRequest.post.connect_timeout`. Defaults to
        :attr:`~telegram.request.BaseRequest.DEFAULT_NONE`.

        .. versionadded:: 20.0
    pool_timeout (:obj:`float` | :obj:`None`, optional): Value to pass to
        :paramref:`telegram.request.BaseRequest.post.pool_timeout`. Defaults to
        :attr:`~telegram.request.BaseRequest.DEFAULT_NONE`.

        .. versionadded:: 20.0

Returns:
    :obj:`bytearray`: The same object as :paramref:`buf` if it was specified. Otherwise a
    newly allocated :obj:`bytearray`.

Raises:
    RuntimeError: If :attr:`file_path` is not set.

rI   NrJ   )r   rK   rb   r	   r   rL   rR   rS   rT   r6   r"   Úextendr?   )r%   r9   rA   rB   rC   rD   Ú
bytes_datas   &&$$$$ r   Údownload_as_bytearrayÚFile.download_as_bytearray'  sÑ   é € ðb �~�~ˆ~ÜÐZÓ[Ð[àŠ;Ü“+ˆCä˜Ÿ™×(Ò(Ü˜dŸn™nÓ-×8Ñ8Ó:‰Jà#Ÿ|™|›~×5Ñ5×>Ñ>Ø×%Ñ%Ó'Ø)Ø+Ø /Ø)ð  ?ó  ÷ ˆJð ××ÐØ�J‰J�t×,Ñ,¨ZÓ8Ô9ð ˆ
ð �J‰J�zÔ"Øˆ
ñùs   ‚B*C:Â,C8Â-C:Ã6C:c                ó"   <€ V ^8„  d   QhRRRR/# )r   Úcredentialsr   r)   N© )r   r   s   "€r   r   r   n  s   ø€ ÷ (ñ (Ð+<ð (Àñ (r   c                ó   € Wn         R# )zySets the passport credentials for the file.

Args:
    credentials (:class:`telegram.FileCredentials`): The credentials.
N)r"   )r%   ri   s   &&r   Úset_credentialsÚFile.set_credentialsn  s
   € ð (Ör   )r"   r#   r   r   r   r   )r"   r   r   r   r   )NNr<   )Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__Ú	__slots__r!   r6   r?   r   rY   r_   rf   rl   Ú__static_attributes__Ú__classdictcell__Ú__classcell__)r&   r   s   @@r   r   r   %   sö   ù‡ € ñ%ðN€Iñð '+÷ö ÷0
ð 
÷dð dñhð )5ð	hð
 *6ðhð ,8ðhð )5÷hó hðTBð )5ð	Bð
 *6ðBð ,8ðBð )5÷Bò BñHEð )5ð	Eð
 *6ðEð ,8ðEð )5÷Eó E÷N(÷ (ð (r   r   )rr   rP   Úurllib.parseÚparser+   Úbase64r   Úpathlibr   Útypingr   r   Útelegram._passport.credentialsr   Útelegram._telegramobjectr   Útelegram._utils.defaultvaluer   Útelegram._utils.filesr	   Útelegram._utils.typesr
   r   r   Útelegramr   r   rj   r   r   Ú<module>r‚      s@   ðñ& Fã Ý #Ý Ý ß *å 2Ý 3Ý 5Ý /ß CÑ CçÝ(ôO(ˆ>ö O(r   