+
    åûj((  ã                  óò   a € 0 t $ R t^ RIHt ^ RIt^ RIt^ RIt^ RIt^ RIH	t	H
t
HtHtHtHt ^ RIHt ^ RIHt ^ RIt^ RIHt ^ RIHt ^RIHt R	.t. ROtR
]R&   R R ltRR R lltR]RRRR3R R lltR# )zßDownload, cache and load the sample images of kornia's examples.

Which function to use:

- The sample images, or images from your own paths and URLs, as a list or one resized batch:
  :func:`~kornia.io.get_sample_images`.
)ÚannotationsN)ÚAnyÚCallableÚListÚOptionalÚTupleÚUnion)Úurlparse)Úurlopen)Úkornia_config)Ú_resolve_timeout)Ú
load_imageÚget_sample_imagesú	List[str]Ú_IMAGE_URLSc               ó$   € V ^8„  d   QhRRRRRR/# )é   ÚurlÚstrÚsave_toÚreturnÚNone© )Úformats   "ÚLC:\Ai_Coding\apps\studio\ComfyUI\.venv\Lib\site-packages\kornia\io\sample.pyÚ__annotate__r   9   s!   € ÷ ñ ˜ð  cð ¨dñ ó    c                ó   € \        W4       R# )ar  Download a file and save its bytes unchanged, so a JPEG is not decoded and re-encoded.

Each call writes the bytes to a temporary file of its own next to ``save_to`` and renames it onto ``save_to`` only
once the write is complete, removing it if the write fails. An interrupted download therefore never leaves a
partial file at ``save_to``, and concurrent downloads of the same file each leave a complete copy there. Windows
cannot replace a file that is open, for example one that another call is reading; a call whose replacement is
refused keeps the copy already there only if its bytes match the download, and removes its own temporary file. A
refused replacement with a missing, unreadable, or different destination still raises the replacement error.

The download fails once the server goes ``KORNIA_DOWNLOAD_TIMEOUT`` seconds (30 s when it is unset) without
answering, as kornia's other downloads do.

Args:
    url: The URL of the image to download.
    save_to: The file path where the downloaded image will be saved.

Raises:
    ValueError: If ``KORNIA_DOWNLOAD_TIMEOUT`` is set to anything but a positive number of seconds.

N)Ú	_download)r   r   s   &&r   Údownload_imager   9   s   € ô* ˆcÖr   c               ó(   € V ^8„  d   QhRRRRRRRR/# )r   r   r   r   Úloadz'Optional[Callable[[str], torch.Tensor]]r   zOptional[torch.Tensor]r   )r   s   "r   r   r   Q   s*   € ÷ %ñ %�3ð % ð %Ð,Sð %Ð_uñ %r   c                ó
  € \        V \        R4      R7      ;_uu_ 4       pVP                  4       pRRR4       Ve'   \        P                  P                  V4      ^,          MRpV R\        P                  ! 4       P                   RV 2p \        VR4      ;_uu_ 4       pVP                  X4       RRR4       Vf   RMV! V4      p \        P                  ! Wa4       V#   + '       g   i     L¹; i  + '       g   i     LJ; i  \         d�    Rp	 \        TR4      ;_uu_ 4       p
T
P                  \        X4      ^,           4      T8H  p	RRR4       M$  + '       g   i     M; i  \         d     Mi ; iT	'       g   h \        P                  ! T4        T# i ; i  \          dW    \"        P$                  ! \&        4      ;_uu_ 4        \        P                  ! T4       RRR4       h   + '       g   i     h ; ii ; i)	aº  Download ``url`` to ``save_to`` as :func:`download_image` does; return ``load`` of the download, or ``None``.

``load`` reads the call's own temporary file before it is renamed onto ``save_to``, so the call does not load
``save_to``, which a concurrent call may be replacing (Windows refuses to open a file while it is replaced). A body
that ``load`` rejects never reaches ``save_to``: the temporary file is removed and the error propagates.
N)ÚtimeoutÚ Ú.z.partÚxbFÚrb)r
   r   ÚreadÚosÚpathÚsplitextÚuuidÚuuid4ÚhexÚopenÚwriteÚreplaceÚPermissionErrorÚlenÚOSErrorÚremoveÚBaseExceptionÚ
contextlibÚsuppressÚFileNotFoundError)r   r   r!   ÚrespÚdataÚsuffixÚpartÚfÚimageÚmatchesÚexistings   &&&        r   r   r   Q   sˆ  € ô 
�Ô.¨tÓ4×	5Õ	5¸Ø�y‰y‹{ˆ÷ 
6ð
 .2Ò-=ŒR�W‰W×Ñ˜gÓ& qÖ)À2€FØˆY�aœŸ
š
›×(Ñ(Ð)¨¨v¨hÐ7€DðÜ�$˜×Ô Ø�G‰G�DŒM÷ àš‘©$¨t«*ˆð	Ü�JŠJ�tÔ%ð  €L÷9 
6×	5ú÷ ×ûô
 ô 
	àˆGðÜ˜' 4×(Ô(¨HØ&Ÿm™m¬C°«I¸­MÓ:¸dÑB�G÷ )×(×(Ð(ûäô ÙðúçØÜ�IŠI�d�Oð
 €Lð
	ûô ô Ü× Ò Ô!2×3Õ3Ü�IŠI�dŒO÷ 4à÷ 4Ö3àúðús³   ŸC!ÂF! Â C4Â2F! Ã	D Ã!C1	Ã4D	Ã?F! ÄFÄE*Ä)%EÅE*ÅFÅE'Å"E*Å&FÅ'E*Å*E8Å5FÅ7E8Å8
FÆFÆF! ÆFÆF! Æ!-HÇG.Ç%	HÇ.G>Ç9	HTc               ó8   € V ^8„  d   QhRRRRRRRRR	R
RRRRRR/# )r   ÚresizezOptional[Tuple[int, int]]Úpathsr   ÚdownloadÚboolÚ	cache_dirzOptional[str]Úas_listzOptional[bool]Údivisible_factorzOptional[int]Úkwargsr   r   z'Union[torch.Tensor, List[torch.Tensor]]r   )r   s   "r   r   r   y   sb   € ÷ Vñ VØ%ðVàðVð ðVð ð	Vð
 ðVð $ðVð ðVð -ñVr   c                ó–  € ^ RI pVf/   \        P                  P                  \        P
                  R4      p. pV EFá  p	Rp
\        V	4      pVP                  R9   Ed   \        P                  P                  VP                  4      pV'       g   \        RV	 R24      h\        P                  P                  W<4      p\        P                  P                  V4      '       gO   V'       dG   \        P                  ! VRR7       \        P                  ! RV	 RV R	24       \        W�\        4      p
MM\        P                  P                  V4      '       g&   V'       g   \        P                   ! R
V	 RV R24       MT	pV
f   \        V4      p
V e   VP"                  P$                  ! W 3/ VB p
Ve[   V f   TM,VP'                  4        UUu/ uF  w  rïVR8w  g   K  WïbK  	  upppVP"                  P(                  P*                  ! W¥3/ VB p
VP-                  V
4       EKä  	  V'       g   V e   \.        P0                  ! V4      # V# u uppi )a  Load kornia's sample images, or given paths and URLs, as a list or one batch.

``images = get_sample_images()`` downloads kornia's sample images from the ``kornia/data`` GitHub repository
unless they are already cached, and returns a list of ``(3, H, W)`` tensors, each in its own size. Each image is
loaded as ``RGB32`` by :func:`load_image`, ``float32`` in :math:`[0, 1]`. ``paths`` replaces the samples with local
files or ``http(s)`` URLs. With ``resize=(height, width)`` the result is one ``(B, 3, H, W)`` tensor, unless
``as_list=True``.

Convention:
    - A path is a URL only when its scheme is ``http`` or ``https``. A URL is cached under ``cache_dir`` with the
      file name of its path, byte for byte as downloaded, and a cached file is loaded without downloading it
      again. With ``download=False``, a URL that is not cached logs an error and raises ``FileNotFoundError``.
      A download fails once the server goes ``KORNIA_DOWNLOAD_TIMEOUT`` seconds (30 s when it is unset) without
      answering, and an unusable value of that variable raises ``ValueError``.
    - ``resize`` is ``(height, width)`` and goes to :func:`~kornia.geometry.transform.resize`; ``divisible_factor``
      is applied after it by :func:`~kornia.geometry.transform.resize_to_be_divisible`, so the final size can
      differ from ``resize``. ``**kwargs`` reach both resizes, except ``side``, which reaches only
      :func:`~kornia.geometry.transform.resize` when ``resize`` is given.

Args:
    paths: A list of path or URL from which to load or download images.
          Defaults to the pre-defined sample image URLs if not provided.
    resize: Optional target size ``(height, width)`` for every image. If not provided, the images keep their
        sizes unless ``divisible_factor`` is given.
    download: Whether to download the images if they are not already cached. Defaults to True.
    cache_dir: The directory where the downloaded images will be cached.
        Defaults to ``<kornia_config.hub_cache_dir>/images``, relative to the working directory unless configured
        otherwise. Created when an image has to be downloaded. A download is loaded from a temporary file of its
        own before it is renamed into the cache, so a download that does not load as an image never reaches the
        cache: its temporary file is removed and the error propagates.
    as_list: ``True`` to return a list even when ``resize`` is given.
    divisible_factor:
        If not None, each side of every image is resized to a multiple of ``divisible_factor``.
    **kwargs: Additional keyword arguments for the resizes; see the Convention.

Returns:
    torch.Tensor | list[torch.Tensor]: the images, stacked or as a list.

See Also:
    - :func:`load_image`: loads one file, with a choice of :class:`ImageLoadType` and device.

NÚimagesz*Cannot derive a cache file name from URL `z`: its path names no file.T)Úexist_okzDownloading `z` to `z`.zImage `z` not found at `z6`. You may want to set `download=True` to download it.Úside)ÚhttpÚhttps)Úkornia.geometryr)   r*   Újoinr   Úhub_cache_dirr	   ÚschemeÚbasenameÚ
ValueErrorÚexistsÚmakedirsÚloggingÚinfor   r   ÚerrorÚgeometryrC   ÚitemsÚ	transformÚresize_to_be_divisibleÚappendÚtorchÚstack)rC   rD   rE   rG   rH   rI   rJ   ÚkorniaÚtensorsr*   Ú
img_tensorr   ÚnameÚfnameÚkeyÚvalueÚ
div_kwargss   &&&&&&,          r   r   r   y   sÖ  € óf àÒÜ—G‘G—L‘L¤×!<Ñ!<¸hÓGˆ	Ø€GÜˆØ-1ˆ
Ü�t‹nˆØ�:‰:Ð*Õ*Ü—7‘7×#Ñ# C§H¡HÓ-ˆDßÜ Ð#MÈdÈVÐSmÐ!nÓoÐoÜ—G‘G—L‘L Ó1ˆEÜ—7‘7—>‘> %×(Ò(¯XÜ—’˜I°Õ5Ü—’˜}¨T¨F°&¸¸¸rÐBÔCÜ& t´JÓ?‘
Ü—W‘W—^‘^ E×*Ò*·8Ü—’Ø˜d˜VÐ#3°E°7Ð:pÐqôøð ˆEØÒÜ# EÓ*ˆJØÒØŸ™×/Ò/°
ÑMÀfÑMˆJØÒ'Ø#)¢>™ÐU[×UaÑUaÔUcÔ7uÑUcÁzÀsÐgjÐntÑgt¼
¸º
ÑUcÒ7uˆJØŸ™×2Ñ2×IÒIÈ*ÑuÐjtÑuˆJØ�‰�z×"ñ3 ÷6 �vÒ)Ü�{Š{˜7Ó#Ð#à€Nùó 8vs   Ç
IÇI)z<https://raw.githubusercontent.com/kornia/data/main/panda.jpgz<https://raw.githubusercontent.com/kornia/data/main/simba.pngz=https://raw.githubusercontent.com/kornia/data/main/girona.pngzChttps://raw.githubusercontent.com/kornia/data/main/baby_giraffe.pngzKhttps://raw.githubusercontent.com/kornia/data/main/persistencia_memoria.jpgz?https://raw.githubusercontent.com/kornia/data/main/delorean.png)N) Ú__conditional_annotations__Ú__doc__Ú
__future__r   r7   rY   r)   r,   Útypingr   r   r   r   r   r   Úurllib.parser	   Úurllib.requestr
   ra   Úkornia.configr   Úkornia.core.downloadr   Úior   Ú__all__r   Ú__annotations__r   r   r   )rk   s   @r   Ú<module>rv      sy   øðô$õ #ã Û Û 	Û ß >× >Ý !Ý "ã å 'Ý 1å ð ð€ò€ˆYó õ÷0%ðR )-Ø"ØØ#Ø"Ø&*÷Vñ Vr   