§
    ¶¯¸j]
  ã                   ón   — d dl Z d dlZd dlZd dlmZmZmZ d dlmZ dddœde	de	dee	         d	e
d
e	f
d„ZdS )é    N)ÚCallableÚListÚOptional)ÚrequestT)ÚfilenameÚprogressÚurlÚdirr   r   Úreturnc                óš  — t          j        |d¬¦  «         |€G|                      d¦  «        d         }t          |¦  «        sJ d                     | ¦  «        ¦   «         ‚t           j                             ||¦  «        }t          j        t          ¦  «        }t           j         
                    |¦  «        r*|                     d                     |¦  «        ¦  «         |S |dz   }	 |                     d	                     | ¦  «        ¦  «         |r‘d
dl}d|j        dt          t          t          t          t                   gdf         fd„}|                     ddd|d¬¦  «        5 }	t!          j        | | ||	¦  «        ¬¦  «        \  }}
ddd¦  «         n# 1 swxY w Y   nt!          j        | |¬¦  «        \  }}
t          j        |¦  «        }|j        }|d
k    r"t)          d                     | ¦  «        ¦  «        ‚t+          j        ||¦  «         n7# t(          $ r* |                     d                     | ¦  «        ¦  «         ‚ w xY w	 	 t          j        |¦  «         n:# t(          $ r Y n.w xY w# 	 t          j        |¦  «         w # t(          $ r Y w w xY wxY w|                     d|z   dz   t3          |¦  «        z   dz   ¦  «         |S )a×  
    Download a file from a given URL to a directory. If file exists, will not
        overwrite the existing file.

    Args:
        url (str):
        dir (str): the directory to download the file
        filename (str or None): the basename to save the file.
            Will use the name in the URL if not given.
        progress (bool): whether to use tqdm to draw a progress bar.

    Returns:
        str: the path to the downloaded file or the existing one.
    T)Úexist_okNú/éÿÿÿÿz"Cannot obtain filename from url {}z"File {} exists! Skipping download.z.tmpzDownloading from {} ...r   Útr   c           	      ód   ‡ ‡— dgŠddt           dt           dt          t                    dd fˆˆ fd„}|S )Nr   ÚbÚbsizeÚtsizer   c                 óf   •— |�|‰_         ‰                     | ‰d         z
  |z  ¦  «         | ‰d<   d S )Nr   )ÚtotalÚupdate)r   r   r   Úlast_br   s      €€úf/root/private/project/pallet_detection_v2/.venv/lib/python3.11/site-packages/iopath/common/download.pyÚinnerz%download.<locals>.hook.<locals>.inner/   s<   ø€ ØÐ(Ø"'˜œØ—H’H˜a &¨¤)™m¨uÑ4Ñ5Ô5Ð5Ø !�F˜1‘I�I�Ió    )N)Úintr   )r   r   r   s   ` @r   Úhookzdownload.<locals>.hook,   sZ   øø€ Ø%& C�ð"ð "�Sð "­ð "µX½c´]ð "Èdð "ð "ð "ð "ð "ð "ð "ð �r   ÚBé   )ÚunitÚ
unit_scaleÚminitersÚdescÚleave)r   Ú
reporthook)r   z!Downloaded an empty file from {}!zFailed to download {}zSuccessfully downloaded z. z bytes.)ÚosÚmakedirsÚsplitÚlenÚformatÚpathÚjoinÚloggingÚ	getLoggerÚ__name__ÚisfileÚinfoÚtqdmr   r   r   r   ÚurlretrieveÚstatÚst_sizeÚIOErrorÚshutilÚmoveÚerrorÚunlinkÚstr)r	   r
   r   r   ÚfpathÚloggerÚtmpr2   r   r   Ú_ÚstatinfoÚsizes                r   ÚdownloadrB   
   s4  € õ" „K�˜dÐ#Ñ#Ô#Ð#ØÐØ—9’9˜S‘>”> "Ô%ˆÝ�8‰}Œ}ÐNÐNÐB×IÒIÈ#ÑNÔNÑNÔNˆ}ÝŒG�LŠL˜˜hÑ'Ô'€EÝÔ�xÑ(Ô(€Få	„w‡~‚~�eÑÔð Ø�ŠÐ8×?Ò?ÀÑIÔIÑJÔJÐJØˆà
�&‰.€Cð%Ø�ŠÐ-×4Ò4°SÑ9Ô9Ñ:Ô:Ð:Øð 	<ØˆKˆKˆKð	˜œ	ð 	¥hµµS½(Å3¼-Ð/HÈ$Ð/NÔ&Oð 	ð 	ð 	ð 	ð —’Ø T°A¸HÈDð ñ ô ð TàÝ Ô,¨S¸3È4È4ÐPQÉ7Ì7ÐSÑSÔS‘��QðTð Tð Tñ Tô Tð Tð Tð Tð Tð Tð Tøøøð Tð Tð Tð Tøõ Ô(¨°sÐ;Ñ;Ô;‰FˆC�Ý”7˜3‘<”<ˆØÔˆØ�1Š9ˆ9ÝÐ=×DÒDÀSÑIÔIÑJÔJÐJõ 	Œ�C˜ÑÔÐÐøÝð ð ð Ø�ŠÐ,×3Ò3°CÑ8Ô8Ñ9Ô9Ð9Øðøøøð 	 ð
	ÝŒI�c‰NŒNˆNˆNøÝð 	ð 	ð 	ØˆDð	øøøøð	ÝŒI�c‰NŒNˆNˆNøÝð 	ð 	ð 	ØˆDð	øøøøøøð ‡K‚KÐ*¨UÑ2°TÑ9½CÀ¹I¼IÑEÈ	ÑQÑRÔRÐRØ€Lsz   Ã(A?H Å'$FÆH ÆFÆH ÆFÆA5H ÈI3 È4I	É	I3 ÉI# É#
I0É/I0É3JÉ5J
Ê	JÊ

JÊJÊJÊJ)r-   r&   r7   Útypingr   r   r   Úurllibr   r;   ÚboolrB   © r   r   ú<module>rG      sº   ðð €€€Ø 	€	€	€	Ø €€€Ø +Ð +Ð +Ð +Ð +Ð +Ð +Ð +Ð +Ð +Ø Ð Ð Ð Ð Ð ð 6:ÈDðEð Eð EØ	ðEØðEØ%-¨c¤]ðEØEIðEàðEð Eð Eð Eð Eð Er   