
    hx                         S r SSKrSSKrSSKrSSKrSSKJr  SSKJ	r	J
r
  SSKJr  SSKJrJrJrJr  SS	KJr  SS
KJr  \rS r " S S\5      r " S S\5      rg)a  

.. note::
    imageio is under construction, some details with regard to the
    Reader and Writer classes may change.

These are the main classes of imageio. They expose an interface for
advanced users and plugin developers. A brief overview:

  * imageio.FormatManager - for keeping track of registered formats.
  * imageio.Format - representation of a file format reader/writer
  * imageio.Format.Reader - object used during the reading of a file.
  * imageio.Format.Writer - object used during saving a file.
  * imageio.Request - used to store the filename and other info.

Plugins need to implement a Format class and register
a format object using ``imageio.formats.add_format()``.

    N)Path   )Arrayasarray)	ImageMode   )known_pluginsknown_extensionsPluginConfigFileExtension)_original_order)imopenc                 b   Sn[        U 5      R                  R                  5       [        ;   a$  [        U 5      R                  R                  5       nOrU [        ;   a  OgU R                  5       [        ;   a  U R                  5       nO>SU R                  5       -   [        ;   a  SU R                  5       -   nO[        SU  S35      eUb[  [        U    VVs/ s H  nUR                    H  nUPM     M     snn H'  n[        U   R                  (       d  M  Un   [        U    $    [        U    $ s  snnf )zLOld Plugin resolution logic.

Remove once we remove the old format manager.
N.zNo format known by name `z`.)r   suffixlowerr
   r	   
IndexErrorpriority	is_legacy)pluginextension_namefile_extensionxplugin_names        M/var/www/fran/franai/venv/lib/python3.13/site-packages/imageio/core/format.py_get_configr   4   s    NF|  "&66f,,224	=	 	+	+	v||~	!1	1v||~-4VHB?@@! #3>"B
"B#,, , "B
K
 [)333$  
   
s    D+c                       \ rS rSrSrSS jrS rS r\S 5       r	\S 5       r
\S	 5       r\S
 5       r\S 5       rS rS rS rS rS rS r " S S\5      r " S S\5      r " S S\5      rSrg)FormatT   u  Represents an implementation to read/write a particular file format

A format instance is responsible for 1) providing information about
a format; 2) determining whether a certain file can be read/written
with this format; 3) providing a reader/writer class.

Generally, imageio will select the right format and use that to
read/write an image. A format can also be explicitly chosen in all
read/write functions. Use ``print(format)``, or ``help(format_name)``
to see its documentation.

To implement a specific format, one should create a subclass of
Format and the Format.Reader and Format.Writer classes. See
:class:`imageio.plugins` for details.

Parameters
----------
name : str
    A short name of this format. Users can select a format using its name.
description : str
    A one-line description of the format.
extensions : str | list | None
    List of filename extensions that this format supports. If a
    string is passed it should be space or comma separated. The
    extensions are used in the documentation and to allow users to
    select a format by file extension. It is not used to determine
    what format to use for reading/saving a file.
modes : str
    A string containing the modes that this format can handle ('iIvV'),
    “i” for an image, “I” for multiple images, “v” for a volume,
    “V” for multiple volumes.
    This attribute is used in the documentation and to select the
    formats when reading/saving a file.
Nc           	      X   UR                  5       U l        X l        Uc  / nO6[        U[        5      (       a!  UR                  SS5      R                  S5      n[        U[        [        45      (       aJ  [        U Vs/ s H-  oU(       d  M  SUR                  S5      R                  5       -   PM/     sn5      U l        O[        S5      eU=(       d    SU l        [        U R                  [        5      (       d  [        S5      eU R                   H  nUS;  d  M  [        S	5      e   gs  snf )
uD  Initialize the Plugin.

Parameters
----------
name : str
    A short name of this format. Users can select a format using its name.
description : str
    A one-line description of the format.
extensions : str | list | None
    List of filename extensions that this format supports. If a
    string is passed it should be space or comma separated. The
    extensions are used in the documentation and to allow users to
    select a format by file extension. It is not used to determine
    what format to use for reading/saving a file.
modes : str
    A string containing the modes that this format can handle ('iIvV'),
    “i” for an image, “I” for multiple images, “v” for a volume,
    “V” for multiple volumes.
    This attribute is used in the documentation and to select the
    formats when reading/saving a file.
N, r   z#Invalid value for extensions given. zInvalid value for modes given.ziIvV?zInvalid value for mode given.)upper_name_description
isinstancestrreplacesplittupleliststripr   _extensions
ValueError_modes)selfnamedescription
extensionsmodesems          r   __init__Format.__init__x   s    0 ZZ\
' J
C((#++C5;;C@Jj5$-00$5?EZ1+qwws|))++ZE D BCC kr$++s++=>>A !@AA  Fs   <
D'
&D'c                 @    SU R                   < SU R                  < S3$ )Nz<Format  - >)r2   r3   r1   s    r   __repr__Format.__repr__   s    %)YY0@0@AA    c                     U R                   $ N)docr=   s    r   __str__Format.__str__   s    xxr@   c                 v    U R                   < SU R                  < SU R                  R                  5       < S3$ )zCThe documentation for this format (name + description + docstring).r;   z

    
)r2   r3   __doc__r-   r=   s    r   rC   
Format.doc   s.     IILL 
 	
r@   c                     U R                   $ )zThe name of this format.)r%   r=   s    r   r2   Format.name   s     zzr@   c                     U R                   $ )z#A short description of this format.)r&   r=   s    r   r3   Format.description   s        r@   c                     U R                   $ )z`A list of file extensions supported by this plugin.
These are all lowercase with a leading dot.
)r.   r=   s    r   r4   Format.extensions   s    
 r@   c                     U R                   $ )z:A string specifying the modes that this format can handle.)r0   r=   s    r   r5   Format.modes   s     {{r@   c                     UR                   S   S;   a  UR                   S   OSnX R                  ;  a0  [        SU R                   SUR                   R                   S35      eU R                  X5      $ )zget_reader(request)

Return a reader object that can be used to read data and info
from the given file. Users are encouraged to use
imageio.get_reader() instead.
r   iIvVr#   Format z cannot read in  mode)moder5   RuntimeErrorr2   
image_modeReaderr1   requestselect_modes      r   
get_readerFormat.get_reader   sl     *1aF)Bgll1ojj($))$4W\\5L5L4MUS  {{4))r@   c                     UR                   S   S;   a  UR                   S   OSnX R                  ;  a0  [        SU R                   SUR                   R                   S35      eU R                  X5      $ )zget_writer(request)

Return a writer object that can be used to write data and info
to the given file. Users are encouraged to use
imageio.get_writer() instead.
r   rS   r#   rT   z cannot write in rU   )rV   r5   rW   r2   rX   WriterrZ   s      r   
get_writerFormat.get_writer   sl     *1aF)Bgll1ojj($))$5gll6M6M5NeT  {{4))r@   c                 $    U R                  U5      $ )zQcan_read(request)

Get whether this format can read data from the specified uri.
)	_can_readr1   r[   s     r   can_readFormat.can_read   s    
 ~~g&&r@   c                 $    U R                  U5      $ )zQcan_write(request)

Get whether this format can write data to the speciefed uri.
)
_can_writere   s     r   	can_writeFormat.can_write   s    
 w''r@   c                     g)a  Check if Plugin can read from ImageResource.

This method is called when the format manager is searching for a format
to read a certain image. Return True if this format can do it.

The format manager is aware of the extensions and the modes that each
format can handle. It will first ask all formats that *seem* to be able
to read it whether they can. If none can, it will ask the remaining
formats if they can: the extension might be missing, and this allows
formats to provide functionality for certain extensions, while giving
preference to other plugins.

If a format says it can, it should live up to it. The format would
ideally check the request.firstbytes and look for a header of some kind.

Parameters
----------
request : Request
    A request that can be used to access the ImageResource and obtain
    metadata about it.

Returns
-------
can_read : bool
    True if the plugin can read from the ImageResource, False otherwise.

N re   s     r   rd   Format._can_read   s    8 r@   c                     g)a  Check if Plugin can write to ImageResource.

Parameters
----------
request : Request
    A request that can be used to access the ImageResource and obtain
    metadata about it.

Returns
-------
can_read : bool
    True if the plugin can write to the ImageResource, False otherwise.

Nrm   re   s     r   ri   Format._can_write  s     r@   c                   |    \ rS rSrSrS r\S 5       r\S 5       rS r	S r
S rS	 r\S
 5       rSS jrS rS rSrg)Format._BaseReaderWriteri,  zBase class for the Reader and Writer class to implement common
functionality. It implements a similar approach for opening/closing
and context management as Python's file objects.
c                     SU l         SU l        Xl        X l        U R                  " S0 U R
                  R                  R                  5       D6  g )NFrm   )_BaseReaderWriter__closed_BaseReaderWriter_last_index_format_request_openr[   kwargscopy)r1   formatr[   s      r   r8   !Format._BaseReaderWriter.__init__2  s=    !DM02D-!L#MJJ4,,1134r@   c                     U R                   $ )zOThe :class:`.Format` object corresponding to the current
read/write operation.
)rw   r=   s    r   r|   Format._BaseReaderWriter.format:  s    
 <<r@   c                     U R                   $ )zPThe :class:`.Request` object corresponding to the
current read/write operation.
)rx   r=   s    r   r[    Format._BaseReaderWriter.requestA  s    
 == r@   c                 &    U R                  5         U $ rB   )_checkClosedr=   s    r   	__enter__"Format._BaseReaderWriter.__enter__H  s    Kr@   c                 ,    Uc  U R                  5         g g rB   )close)r1   typevalue	tracebacks       r   __exit__!Format._BaseReaderWriter.__exit__L  s    }

 r@   c                 F     U R                  5         g ! [         a     g f = frB   )r   	Exceptionr=   s    r   __del__ Format._BaseReaderWriter.__del__Q  s"    

 s    
  c                     U R                   (       a  gSU l         U R                  5         U R                  R                  5         g)zVFlush and close the reader/writer.
This method has no effect if it is already closed.
NT)ru   _closer[   finishr=   s    r   r   Format._BaseReaderWriter.closeW  s.     }} DMKKMLL!r@   c                     U R                   $ )z$Whether the reader/writer is closed.)ru   r=   s    r   closedFormat._BaseReaderWriter.closedb  s     == r@   Nc                     U R                   (       a/  U R                  R                  nU=(       d    SU-  n[        U5      eg)z8Internal: raise an ValueError if reader/writer is closedzI/O operation on closed %s.N)r   	__class____name__rW   )r1   msgwhats      r   r   %Format._BaseReaderWriter._checkClosedg  s8    {{~~..C;dB"3'' r@   c                     [        5       e)z_open(**kwargs)

Plugins should probably implement this.

It is called when reader/writer is created. Here the
plugin can do its initialization. The given keyword arguments
are those that were given by the user at imageio.read() or
imageio.write().
NotImplementedErrorr1   rz   s     r   ry   Format._BaseReaderWriter._openp  s     &''r@   c                     [        5       e)z_close()

Plugins should probably implement this.

It is called when the reader/writer is closed. Here the plugin
can do a cleanup, flush, etc.

r   r=   s    r   r   Format._BaseReaderWriter._close|       &''r@   )rv   __closedrw   rx   rB   )r   
__module____qualname____firstlineno__rH   r8   propertyr|   r[   r   r   r   r   r   r   ry   r   __static_attributes__rm   r@   r   _BaseReaderWriterrr   ,  sk    	
	5 
	  
	  
	! 
	!		
			" 
	! 
	!	(
	(		(r@   r   c                   ^    \ rS rSrSrS rS rS rS rSS jr	S	 r
S
 rS rS rS rS rSrg)Format.Readeri  a  
The purpose of a reader object is to read data from an image
resource, and should be obtained by calling :func:`.get_reader`.

A reader can be used as an iterator to read multiple images,
and (if the format permits) only reads data from the file when
new data is requested (i.e. streaming). A reader can also be
used as a context manager so that it is automatically closed.

Plugins implement Reader's for different formats. Though rare,
plugins may provide additional functionality (beyond what is
provided by the base reader class).
c                 "    U R                  5       $ )a%  get_length()

Get the number of images in the file. (Note: you can also
use ``len(reader_object)``.)

The result can be:
    * 0 for files that only have meta data
    * 1 for singleton images (e.g. in PNG, JPEG, etc.)
    * N for image series
    * inf for streams (series of unknown length)
)_get_lengthr=   s    r   
get_lengthFormat.Reader.get_length  s     ##%%r@   c                     U R                  5         Xl         U R                  " U40 UD6u  p4[        X45      $ ! [         a    [	        U5      ef = f)a/  get_data(index, **kwargs)

Read image data from the file, using the image index. The
returned image has a 'meta' attribute with the meta data.
Raises IndexError if the index is out of range.

Some formats may support additional keyword arguments. These are
listed in the documentation of those formats.
)r   rv   	_get_dataStopIterationr   r   )r1   indexrz   immetas        r   get_dataFormat.Reader.get_data  sX     05-(>>%:6: ?" ! ( ''(s	   8 Ac                 B    U R                   " U R                  S-   40 UD6$ )zget_next_data(**kwargs)

Read the next image from the series.

Some formats may support additional keyword arguments. These are
listed in the documentation of those formats.
r   )r   rv   r   s     r   get_next_dataFormat.Reader.get_next_data  s#     ==!B!BQ!FQ&QQr@   c                     U R                  5         U R                  5       n[        [        US-
  S5      U5      U l        g)zset_image_index(index)

Set the internal pointer such that the next call to
get_next_data() returns the image specified by the index
r   rt   N)r   r   minmaxrv   )r1   r   rz   ns       r   set_image_indexFormat.Reader.set_image_index  s6     !A03C	24F0JD-r@   Nc                     U R                  5         U R                  U5      n[        U[        5      (       d"  [	        SUR
                  R                  -  5      eU$ )a  get_meta_data(index=None)

Read meta data from the file. using the image index. If the
index is omitted or None, return the file's (global) meta data.

Note that ``get_data`` also provides the meta data for the returned
image as an attribute of that image.

The meta data is a dict, which shape depends on the format.
E.g. for JPEG, the dict maps group names to subdicts and each
group is a dict with name-value pairs. The groups represent
the different metadata formats (EXIF, XMP, etc.).
z Meta data must be a dict, not %r)r   _get_meta_datar'   dictr/   r   r   )r1   r   r   s      r   get_meta_dataFormat.Reader.get_meta_data  sS     &&u-DdD)) 69P9PP  Kr@   c              #     #    U R                  5         U R                  5       nSnX!:  a.   U R                  U5      u  p4[        X45      v   US-  nX!:  a  M-  gg! [         a     g[         a    U[        S5      :X  a   ge f = f7f)zjiter_data()

Iterate over all images in the series. (Note: you can also
iterate over the reader object.)

r   Ninfr   )r   r   r   r   r   floatr   )r1   r   ir   r   s        r   	iter_dataFormat.Reader.iter_data  s      !AA%#~~a0HB Bo%Q % % ! E%L(s9   (BA BB
B#B%B=B?BBc                 "    U R                  5       $ rB   )r   r=   s    r   __iter__Format.Reader.__iter__  s    >>##r@   c                 d    U R                  5       nU[        S5      :X  a  [        R                  nU$ )Nr   )r   r   sysmaxsize)r1   r   s     r   __len__Format.Reader.__len__  s(    !AE%L KKHr@   c                     [        5       e)z_get_length()

Plugins must implement this.

The returned scalar specifies the number of images in the series.
See Reader.get_length for more information.
r   r=   s    r   r   Format.Reader._get_length       &''r@   c                     [        5       e)z_get_data()

Plugins must implement this, but may raise an IndexError in
case the plugin does not support random access.

It should return the image and meta data: (ndarray, dict).
r   r1   r   s     r   r   Format.Reader._get_data  r   r@   c                     [        5       e)z_get_meta_data(index)

Plugins must implement this.

It should return the meta data as a dict, corresponding to the
given index, or to the file's (global) meta data if index is
None.
r   r   s     r   r   Format.Reader._get_meta_data  r   r@   )rv   rB   )r   r   r   r   rH   r   r   r   r   r   r   r   r   r   r   r   r   rm   r@   r   rY   r     s@    		&	#$	R	K	,	0	$		(	(		(r@   rY   c                   4    \ rS rSrSrS	S jrS rS rS rSr	g)
Format.Writeri&  a  
The purpose of a writer object is to write data to an image
resource, and should be obtained by calling :func:`.get_writer`.

A writer will (if the format permits) write data to the file
as soon as new data is provided (i.e. streaming). A writer can
also be used as a context manager so that it is automatically
closed.

Plugins implement Writer's for different formats. Though rare,
plugins may provide additional functionality (beyond what is
provided by the base writer class).
Nc                    U R                  5         [        U[        R                  5      (       d  [	        S5      e0 n[        US5      (       a:  [        UR                  [        5      (       a  UR                  UR                  5        Uc  O1[        U[        5      (       d  [	        S5      eUR                  U5        [        U5      nU R                  X5      $ )zappend_data(im, meta={})

Append an image (and meta data) to the file. The final meta
data that is used consists of the meta data on the given
image (if applicable), updated with the given meta data.
z)append_data requires ndarray as first argr   Meta must be a dict.)r   r'   npndarrayr/   hasattrr   r   updater   _append_data)r1   r   r   
total_metas       r   append_dataFormat.Writer.append_data5  s     b"**-- !LMMJr6""z"''4'@'@!!"''*|d++ !788!!$' B$$R44r@   c                     U R                  5         [        U[        5      (       d  [        S5      eU R	                  U5      $ )a  set_meta_data(meta)

Sets the file's (global) meta data. The meta data is a dict which
shape depends on the format. E.g. for JPEG the dict maps
group names to subdicts, and each group is a dict with
name-value pairs. The groups represents the different
metadata formats (EXIF, XMP, etc.).

Note that some meta formats may not be supported for
writing, and individual fields may be ignored without
warning if they are invalid.
r   )r   r'   r   r/   _set_meta_datar1   r   s     r   set_meta_dataFormat.Writer.set_meta_dataP  s:     dD)) !788**400r@   c                     [        5       erB   r   )r1   r   r   s      r   r   Format.Writer._append_datae      %''r@   c                     [        5       erB   r   r   s     r   r   Format.Writer._set_meta_datai  r   r@   rm   rB   )
r   r   r   r   rH   r   r   r   r   r   rm   r@   r   r`   r   &  s    		56	1*	(	(r@   r`   )r&   r.   r0   r%   )NN)r   r   r   r   rH   r8   r>   rD   r   rC   r2   r3   r4   r5   r]   ra   rf   rj   rd   ri   objectr   rY   r`   r   rm   r@   r   r   r   T   s    !F/BbB 
 
   ! !      **'(<&Y(F Y(zY(" Y(zE(" E(r@   r   c                   n    \ rS rSrSr\S 5       rS rS rS r	S r
S rS	 rSS
 jrS rS rS rS rSrg)FormatManagerin  z
The FormatManager is a singleton plugin factory.

The format manager supports getting a format object using indexing (by
format name or extension). When used as an iterator, this object
yields all registered format objects.

See also :func:`.help`.
c                    [        5       n[        R                  " 5        HU  n[        R                  " [
        5         UR                  (       a  UR                  b  UR                  U5        S S S 5        MW     U$ ! , (       d  f       Mj  = frB   )	r,   r	   values
contextlibsuppressImportErrorr   r|   append)r1   available_formatsconfigs      r   _formatsFormatManager._formatsy  sd     F#**,F$$[1##(A%,,V4 21 - !  21s   0A;;
B
	c                 4    S[        U R                  5       S3$ )Nz<imageio.FormatManager with z registered formats>lenr   r=   s    r   r>   FormatManager.__repr__  s    -c$--.@-AAUVVr@   c                 :    [        S U R                   5       5      $ )Nc              3   8   #    U  H  oR                   v   M     g 7frB   )r|   ).0r   s     r   	<genexpr>)FormatManager.__iter__.<locals>.<genexpr>  s     4mHHms   )iterr   r=   s    r   r   FormatManager.__iter__  s    4dmm444r@   c                 ,    [        U R                  5      $ rB   r  r=   s    r   r   FormatManager.__len__  s    4==!!r@   c                     / nU R                    HG  nUR                  S   nUR                  S   nUR                   SU SU S3nUR                  U5        MI     SR	                  U5      $ )Nr4   r3   r;   z []rG   )r   legacy_argsr2   r   join)r1   ssr   extdescss         r   rD   FormatManager.__str__  sl    mmF$$\2C%%m4D;;-s4&3%q1AIIaL	 $
 yy}r@   c                    [         R                  " S[        SS9  [        U[        5      (       d  [        S5      eUS:X  a  [        S5      e[        U5      R                  5       (       a   [        USSS	9R                  $ [        UR                  5       5      n UR                  $ ! [
         a     N2f = f! [         a'    [        S
UR                   SUR                   S35      ef = f)NzjThe usage of `FormatManager` is deprecated and it will be removed in Imageio v3. Use `iio.imopen` instead.r   
stacklevelz;Looking up a format should be done by name or by extension.r#   z#No format matches the empty string.rTlegacy_modezThe `z4` format is not installed. Use `pip install imageio[z]` to install it.)warningswarnDeprecationWarningr'   r(   r/   r   is_filer   rw   r   r$   r|   r   r2   install_name)r1   r2   r   s      r   __getitem__FormatManager.__getitem__  s    ?		
 $$$M  2:BCC :dCT:BBB
 TZZ\*	==     	} %,,2,?,?+@@QS 	s   +B& B6 &
B32B361C'c                   ^ [         R                  " S[        SS9  U HH  m[        T[        5      (       d  [        S5      e[        U4S jS 5       5      (       d  M?  [        S5      e   [        U5      S:H  nU(       a  [        nU Vs/ s H(  o3S	:w  d  M
  UR                  5       R                  5       PM*     nn[        R                  " 5        VVs/ s H  oU  H  ofPM     M     nnnU H  nU(       a  UR                  5         M  [        U5       Hu  mUR                    V	s/ s H  oPM     sn	 HR  n
U
R#                  T5      (       d  M  UR$                  R'                  U
5        UR$                  R)                  SU
5        MT     Mw     M     [*        R,                  " 5       n[*        R.                  " 5         U H#  mUR1                  TS
5      n
U
c  M  U
[*        T'   M%     [*        R2                  " U5        g
s  snf s  snnf s  sn	f )a  sort(name1, name2, name3, ...)

Sort the formats based on zero or more given names; a format with
a name that matches one of the given names will take precedence
over other formats. A match means an equal name, or ending with
that name (though the former counts higher). Case insensitive.

Format preference will match the order of the given names: using
``sort('TIFF', '-FI', '-PIL')`` would prefer the FreeImage formats
over the Pillow formats, but prefer TIFF even more. Each time
this is called, the starting point is the default format order,
and calling ``sort()`` with no arguments will reset the order.

Be aware that using the function can affect the behavior of
other code that makes use of imageio.

Also see the ``IMAGEIO_FORMAT_ORDER`` environment variable.
a6  `FormatManager` is deprecated and it will be removed in ImageIO v3. Migrating `FormatManager.sort` depends on your use-case:
	- modify `iio.config.known_plugins` to specify the search order for unrecognized formats.
	- modify `iio.config.known_extensions[<extension>].priority` to control a specific extension.r   r  z)formats.sort() accepts only string names.c              3   ,   >#    U  H	  oT;   v   M     g 7frB   rm   )r  cr2   s     r   r	  %FormatManager.sort.<locals>.<genexpr>  s     +d9ds   z.,zHNames given to formats.sort() should not contain dots `.` or commas `,`.r   r#   N)r  r  r   r'   r(   	TypeErroranyr/   r  r   r-   r$   r
   r   resetreverseddefault_priorityendswithr   removeinsertr	   r{   clearpopr   )r1   namesshould_resetr2   
sane_namesext_listr  flat_extensions	extensionr   r   	old_orders      `        r   sortFormatManager.sort  s   ( 	0 		
 DdC(( KLL+d+++ 6 	  5zQ#E7<Kut
*djjl((*u
K !1 7 7 9
 9HXcCXC 9 	 
 )I! ,*3*D*DE*DQq*DEFt,,!**11&9!**11!V< F - ) "&&(	D]]4.F!&,d# 
 	Y'3 L
 Fs   		G9"G9G>#Hc                    [         R                  " S[        SS9  [        U[        5      (       d  [        S5      eU(       d7  UR                  U R                  5       ;   a  [        SUR                   S35      e[        UR                  R                  5       UR                  R                  UR                  R                  SSUR                  UR                  S	R                  UR                  5      UR                   S
.S9nU["        UR                  '   UR                   HV  n[%        UUR                  /SSUR                   S3S9n[&        R(                  " U[+        5       5      R-                  U5        MX     g)zadd_format(format, overwrite=False)

Register a format, so that imageio can use it. If a format with the
same name already exists, an error is raised, unless overwrite is True,
in which case the current format is replaced.
z`FormatManager` is deprecated and it will be removed in ImageIO v3.To migrate `FormatManager.add_format` add the plugin directly to `iio.config.known_plugins`.r   r  z/add_format needs argument to be a Format objectzA Format named z8 is already registered, use `overwrite=True` to replace.Tunknownr"   )r2   r3   r4   r5   )r2   
class_namemodule_namer   r"  r  zUnique Formatz7A format inserted at runtime. It is being read by the `z	` plugin.)r8  r   r2   r3   N)r  r  r   r'   r   r/   r2   get_format_namesr   r$   r   r   r   r3   r  r4   r5   r	   r   r
   
setdefaultr,   r   )r1   
iio_format	overwriter   r8  r  s         r   
add_formatFormatManager.add_format  sP    	* 	
 *f--NOOz$2G2G2II!*//!2 30 0 
 &&(!++44",,77"")55!hhz'<'<=#))	
 &,fkk"#..I# ++$--3[[MD	C ''	46:AA#F /r@   c                      [        XR                  R                  SS9R                  $ ! [         a    [
        R                  " S[        SS9   g[         a     gf = f)zsearch_read_format(request)

Search a format that can read a file according to the given request.
Returns None if no appropriate format was found. (used internally)
Tr  zrImageIO now uses a v3 plugin when reading this format. Please migrate to the v3 API (preferred) or use imageio.v2.r   r  N	r   rV   io_moderw   AttributeErrorr  r  r   r/   re   s     r   search_read_format FormatManager.search_read_format5  ]    	'<<#7#7TJRRR 	MMO"	  	 	   '* $A	AAc                      [        XR                  R                  SS9R                  $ ! [         a    [
        R                  " S[        SS9   g[         a     gf = f)zsearch_write_format(request)

Search a format that can write a file according to the given request.
Returns None if no appropriate format was found. (used internally)
Tr  zrImageIO now uses a v3 plugin when writing this format. Please migrate to the v3 API (preferred) or use imageio.v2.r   r  NrG  re   s     r   search_write_format!FormatManager.search_write_formatL  rL  rM  c                     [         R                  " S[        SS9  U R                   Vs/ s H  oR                  PM     sn$ s  snf )z(Get the names of all registered formats.z`FormatManager` is deprecated and it will be removed in ImageIO v3.To migrate `FormatManager.get_format_names` use `iio.config.known_plugins.keys()` instead.r   r  )r  r  r   r   r2   )r1   fs     r   r@  FormatManager.get_format_namesc  s<     	i		
 !%.1...s   Ac                     [        U 5        g)z1Show a nicely formatted list of available formatsN)printr=   s    r   showFormatManager.showo  s	    dr@   rm   N)F)r   r   r   r   rH   r   r   r>   r   r   rD   r#  r:  rD  rJ  rO  r@  rV  r   rm   r@   r   r   r   n  sX     	! 	!W5"!FF(P1Gf..
/r@   r   )rH   r   r  r   numpyr   pathlibr   r#   r   r   r[   r   r   r	   r
   r   r   config.pluginsr   r   	MODENAMESr   r   r   r   rm   r@   r   <module>r\     sW   8        Q Q ,  	!@W(V W(tCF Cr@   