
    9in
                     2    S r SSKrSSKJr   " S S\5      rg)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                   x    \ rS rSrSrS rS r " S S\R                  5      r " S S\R                  5      r	S	r
g
)	NpzFormat   zSee :mod:`imageio.plugins.npz`c                 4    UR                   U R                  ;   $ N	extension
extensionsselfrequests     S/var/www/html/land-doc-ocr/venv/lib/python3.13/site-packages/imageio/plugins/npz.py	_can_readNpzFormat._can_read!         DOO33    c                 4    UR                   U R                  ;   $ r	   r
   r   s     r   
_can_writeNpzFormat._can_write%   r   r   c                   2    \ rS rSrS rS rS rS rS rSr	g)	NpzFormat.Reader+   c                 0   [         R                  " U R                  R                  5       5      U l        [        U R                  [         R                  R                  R                  5      (       d   e[        U R                  R                  S S9U l        g )Nc                 *    U R                  S5      S   $ )N_)split)xs    r   <lambda>(NpzFormat.Reader._open.<locals>.<lambda>1   s    R@Pr   )key)nploadr   get_file_npz
isinstancelibnpyioNpzFilesortedfiles_namesr   s    r   _openNpzFormat.Reader._open,   s[     5 5 78DIdii)=)=>>>> 6PQDKr   c                 8    U R                   R                  5         g r	   )r'   closer/   s    r   _closeNpzFormat.Reader._close3   s    IIOOr   c                 ,    [        U R                  5      $ r	   )lenr.   r/   s    r   _get_lengthNpzFormat.Reader._get_length6   s    t{{##r   c                     US:  d  U[        U R                  5      :  a  [        S5      eU R                  U R                  U      nU0 4$ )Nr   z)Index out of range while reading from nzp)r7   r.   
IndexErrorr'   )r   indexims      r   	_get_dataNpzFormat.Reader._get_data9   sE    qyES%55 !LMM4;;u-.Br6Mr   c                     [        S5      eNz*The npz format does not support meta data.RuntimeError)r   r<   s     r   _get_meta_dataNpzFormat.Reader._get_meta_dataA   s    KLLr   )r.   r'   N)
__name__
__module____qualname____firstlineno__r0   r4   r8   r>   rD   __static_attributes__ r   r   Readerr   +   s    	R		$		Mr   rL   c                   ,    \ rS rSrS rS rS rS rSrg)NpzFormat.WriterG   c                     / U l         g r	   _imagesr/   s    r   r0   NpzFormat.Writer._openH   s     DLr   c                 v    [         R                  " U R                  R                  5       /U R                  Q76   g r	   )r$   savez_compressedr   r&   rR   r/   s    r   r4   NpzFormat.Writer._closeM   s&     5 5 7G$,,Gr   c                 :    U R                   R                  U5        g r	   )rR   append)r   r=   metas      r   _append_dataNpzFormat.Writer._append_dataQ   s    LL#r   c                     [        S5      erA   rB   )r   rY   s     r   set_meta_dataNpzFormat.Writer.set_meta_dataT   s    KLLr   rQ   N)	rF   rG   rH   rI   r0   r4   rZ   r]   rJ   rK   r   r   WriterrN   G   s    	
	H	$	Mr   r_   rK   N)rF   rG   rH   rI   __doc__r   r   r   rL   r_   rJ   rK   r   r   r   r      s3    (44M M8M Mr   r   )r`   numpyr$   corer   r   rK   r   r   <module>rc      s    *  7M 7Mr   