+
    åûjJ  ã                  ób   € ^ RI Ht ^ RIt^ RIt^ RIHt ^ RIHt ^ RIH	t	 ^ RI
Ht R	R R lltR# )
é    )ÚannotationsN)ÚOptional)Úurlparse)Ú
HASH_REGEX)Údownloadc               ó4   € V ^8„  d   QhRRRRRRRRRRR	R
RR/# )é   ÚurlÚstrÚ	model_dirzOptional[str]ÚprogressÚboolÚ
check_hashÚ	file_nameÚtimeoutzOptional[float]Úreturn© )Úformats   "ÚhC:\Ai_Coding\apps\studio\ComfyUI\.venv\Lib\site-packages\kornia\feature\lightglue_onnx\utils\download.pyÚ__annotate__r      sW   € ÷ @ñ @Ø	ð@àð@ð ð@ð ð	@ð
 ð@ð ð@ð 	ñ@ó    c           	     ó&  a
€ \        V 4      p\        P                  P                  VP                  4      pVe   TpRpV'       d5   \        P
                  ! V4      p	V	e   V	P                  ^4      o
R V
3R llp\        P                  ! WWW…R7      # )a  Download the ONNX model at the given URL into the cache and return its path.

A file already present in ``model_dir`` is returned without a request.
The default value of ``model_dir`` is ``<hub_dir>/checkpoints`` where
``hub_dir`` is the directory returned by :func:`~torch.hub.get_dir`.
The transfer goes through :func:`~kornia.core.download_file_from_url`,
which bounds a stalled server, retries transient failures and leaves no
partial file in the cache.

Args:
    url (str): URL of the object to download
    model_dir (str, optional): directory in which to save the object; a leading ``~`` is expanded
    progress (bool, optional): whether or not to display a progress bar to stderr.
        Default: True
    check_hash(bool, optional): If True, the filename part of the URL should follow the naming convention
        ``filename-<sha256>.ext`` where ``<sha256>`` is the first eight or more
        digits of the SHA256 hash of the contents of the file. The hash is used to
        ensure unique names and to verify the contents of the file. A file already in the cache
        is checked too, and fetched again if it does not match.
        Default: False
    file_name (str, optional): name for the downloaded file. Filename from ``url`` will be used if not set.
    timeout (float, optional): maximum seconds a connection or read may stall. Defaults to the
        ``KORNIA_DOWNLOAD_TIMEOUT`` environment variable or 30 seconds.

Returns:
    The path of the cached file.

Raises:
    RuntimeError: if the download fails, or with ``check_hash`` the file does not match its hash. The
        original error is chained as the cause.

Example:
    >>> model = download_onnx_from_url('https://github.com/fabio-sim/LightGlue-ONNX/releases/download/v1.0.0/disk_lightglue_fused_fp16.onnx')

Nc               ó    € V ^8„  d   QhRRRR/# )r	   Ú	file_pathr   r   ÚNoner   )r   s   "r   r   Ú,download_onnx_from_url.<locals>.__annotate__S   s   € ÷ nñ n Cð n¨Dñ nr   c                óN  <a€ \         P                  ! 4       p\        V R 4      ;_uu_ 4       o\        V3R lR4       F  pVP	                  V4       K  	  RRR4       VP                  4       pVR\        S4       S8w  d   \        RS RV R24      hR#   + '       g   i     LG; i)Úrbc                 ó&   <€ S P                  R4      # )é€   i   )Úread)Úfiles   €r   Ú<lambda>Ú:download_onnx_from_url.<locals>.validate.<locals>.<lambda>V   s   ø€ ¨d¯i©i¸
Ô.Cr   r   Nzinvalid hash value (expected "z", got "z"))ÚhashlibÚsha256ÚopenÚiterÚupdateÚ	hexdigestÚlenÚRuntimeError)r   ÚdigestÚchunkÚactual_hashr"   Úhash_prefixs   &   @€r   ÚvalidateÚ(download_onnx_from_url.<locals>.validateS   s•   ù€ Ü ŸšÓ)�Ü˜) T×*Ô*¨dÜ!%Ô&CÀSÖ!I˜ØŸ™ eÖ,ñ "J÷ +ð %×.Ñ.Ó0�ØÐ1¤ [Ó!1Ð2°kÔAÜ&Ð)GÈÀ}ÐT\Ð]hÐ\iÐikÐ'lÓmÐmñ B÷	 +×*ús   ¬)BÂB$	)r   r   r   r1   r   )	r   ÚosÚpathÚbasenamer   ÚsearchÚgroupÚcore_downloadÚdownload_file_from_url)r
   r   r   r   r   r   ÚpartsÚfilenamer1   Úmatchr0   s   &&&&&&    @r   Údownload_onnx_from_urlr=      s†   ø€ ôV �S‹M€EÜ�w‰w×Ñ §
¡
Ó+€HØÒØˆØ€HßÜ×!Ò! (Ó+ˆØÒØŸ+™+ a›.ˆK÷nð nô ×/Ò/Ø¨9ÐRZôð r   )NTFNN)Ú
__future__r   r%   r3   Útypingr   Úurllib.parser   Ú	torch.hubr   Úkornia.corer   r8   r=   r   r   r   Ú<module>rC      s(   ðõ$ #ã Û 	Ý Ý !å  å 1÷@ñ @r   