Ë
    Eü´jn
  ã                   ó2   — d Z ddlZddlmZ  G d„ de«      Zy)a;  Read/Write NPZ files.

Backend: `Numpy <https://numpy.org/doc/stable/reference/generated/numpy.savez.html>`_

NPZ is a file format by numpy that provides storage of array data using gzip
compression. This imageio plugin supports data of any shape, and also supports
multiple images per file. However, the npz format does not provide streaming;
all data is read/written at once. Further, there is no support for meta data.

See the BSDF format for a similar (but more fully featured) format.

Parameters
----------
None

Notes
-----
This format is not available on Pypy.

é    Né   )ÚFormatc                   óp   — e Zd ZdZd„ Zd„ Z G d„ dej                  «      Z G d„ dej                  «      Zy)	Ú	NpzFormatzSee :mod:`imageio.plugins.npz`c                 ó2   — |j                   | j                  v S ©N©Ú	extensionÚ
extensions©ÚselfÚrequests     úQ/root/workspace/ytshorts/venv/lib/python3.12/site-packages/imageio/plugins/npz.pyÚ	_can_readzNpzFormat._can_read!   ó   € à× Ñ  D§O¡OÐ3Ð3ó    c                 ó2   — |j                   | j                  v S r   r	   r   s     r   Ú
_can_writezNpzFormat._can_write%   r   r   c                   ó*   — e Zd Zd„ Zd„ Zd„ Zd„ Zd„ Zy)úNpzFormat.Readerc                 ó*  — t        j                  | j                  j                  «       «      | _        t        | j                  t         j                  j                  j                  «      sJ ‚t        | j                  j                  d„ ¬«      | _        y )Nc                 ó*   — | j                  d«      d   S )NÚ_éÿÿÿÿ)Úsplit)Úxs    r   ú<lambda>z(NpzFormat.Reader._open.<locals>.<lambda>1   s   € ÀÇÁÈÃÈRÑ@P€ r   )Úkey)ÚnpÚloadr   Úget_fileÚ_npzÚ
isinstanceÚlibÚnpyioÚNpzFileÚsortedÚfilesÚ_names©r   s    r   Ú_openzNpzFormat.Reader._open,   sX   € äŸ™ §¡× 5Ñ 5Ó 7Ó8ˆDŒIÜ˜dŸi™i¬¯©¯©×)=Ñ)=Ô>Ð>Ð>ä  §¡§¡Ñ6PÔQˆD�Kr   c                 ó8   — | j                   j                  «        y r   )r"   Úcloser*   s    r   Ú_closezNpzFormat.Reader._close3   s   € Ø�I‰I�O‰OÕr   c                 ó,   — t        | j                  «      S r   )Úlenr)   r*   s    r   Ú_get_lengthzNpzFormat.Reader._get_length6   s   € Ü�t—{‘{Ó#Ð#r   c                 ó’   — |dk  s|t        | j                  «      k\  rt        d«      ‚| j                  | j                  |      }|i fS )Nr   z)Index out of range while reading from nzp)r0   r)   Ú
IndexErrorr"   )r   ÚindexÚims      r   Ú	_get_datazNpzFormat.Reader._get_data9   sE   € à�qŠy˜E¤S¨¯©Ó%5Ò5Ü Ð!LÓMÐMØ—‘˜4Ÿ;™; uÑ-Ñ.ˆBà�r�6ˆMr   c                 ó   — t        d«      ‚©Nz*The npz format does not support meta data.©ÚRuntimeError)r   r4   s     r   Ú_get_meta_datazNpzFormat.Reader._get_meta_dataA   s   € äÐKÓLÐLr   N)Ú__name__Ú
__module__Ú__qualname__r+   r.   r1   r6   r;   © r   r   ÚReaderr   +   s   „ ò	Rò	ò	$ò	ó	Mr   r@   c                   ó$   — e Zd Zd„ Zd„ Zd„ Zd„ Zy)úNpzFormat.Writerc                 ó   — g | _         y r   )Ú_imagesr*   s    r   r+   zNpzFormat.Writer._openH   s   € ð ˆD�Lr   c                 ót   — t        j                  | j                  j                  «       g| j                  ¢­Ž  y r   )r   Úsavez_compressedr   r!   rD   r*   s    r   r.   zNpzFormat.Writer._closeM   s&   € ä×Ñ §¡× 5Ñ 5Ó 7ÐG¸$¿,¹,ÔGr   c                 ó:   — | j                   j                  |«       y r   )rD   Úappend)r   r5   Úmetas      r   Ú_append_datazNpzFormat.Writer._append_dataQ   s   € Ø�L‰L×Ñ Õ#r   c                 ó   — t        d«      ‚r8   r9   )r   rI   s     r   Úset_meta_datazNpzFormat.Writer.set_meta_dataT   s   € ÜÐKÓLÐLr   N)r<   r=   r>   r+   r.   rJ   rL   r?   r   r   ÚWriterrB   G   s   „ ò	ò
	Hò	$ó	Mr   rM   N)	r<   r=   r>   Ú__doc__r   r   r   r@   rM   r?   r   r   r   r      s3   „ Ù(ò4ò4ôM�—‘ô Mô8M�—‘õ Mr   r   )rN   Únumpyr   Úcorer   r   r?   r   r   ú<module>rQ      s    ðñó* å ô7M�õ 7Mr   