U
    a+dlO                  )   @   s  d dl Z ddlmZ G dd dZe Zedddd	ed< ed
ddd	ed
< edddd	ed< edddd	ed< edddddddddded< ddddd d!d"d#d$d%d&d'd(d)d*d+d,d-d.d/d0d1d2d3d4d5d6d7d8d9d:d;d<d=d>d?d@dAdBdCdDg)ZeD ]N\ZZZ	Z
ee dE e
dFddedG e	e
dHkr dIndJedKdZeeej< qedLdMdNddOdPdQdRddedL< edSdTdUddVdWdXdddedS< edYdZd[dd\d]d^dddedY< ed_d`daddbdcdddegdfdded_< edgdhdiddjdkdldddedg< edmdndoddpdqdrdddedm< edsdtduddvdwdxdydddeds< edzd{d|dd}d~ddddedz< edddddddddded< eddddddddRdded< eddddddg dJdded< eddddddg dJdded< ddddgZeD ]:\ZZZ	ZZ
ee e
dddee	eddZeeej< qddddddddddddddddddddddddddddddddddddg$ZeD ]D\ZZZZ	ZZ
Zee d e
eddee	eeddZeeej< q`dd e D ZdS )    N   LegacyPluginc                   @   s<   e Zd ZdZdddddddZedd Zed	d
 ZdS )PluginConfiga  Plugin Configuration Metadata

    This class holds the information needed to lazy-import plugins.

    Parameters
    ----------
    name : str
        The name of the plugin.
    class_name : str
        The name of the plugin class inside the plugin module.
    module_name : str
        The name of the module/package from which to import the plugin.
    is_legacy : bool
        If True, this plugin is a v2 plugin and will be wrapped in a
        LegacyPlugin. Default: False.
    package_name : str
        If the given module name points to a relative module, then the package
        name determines the package it is relative to.
    install_name : str
        The name of the optional dependency that can be used to install this
        plugin if it is missing.
    legacy_args : Dict
        A dictionary of kwargs to pass to the v2 plugin (Format) upon construction.

    Examples
    --------
    >>> PluginConfig(
            name="TIFF",
            class_name="TiffFormat",
            module_name="imageio.plugins.tifffile",
            is_legacy=True,
            install_name="tifffile",
            legacy_args={
                "description": "TIFF format",
                "extensions": ".tif .tiff .stk .lsm",
                "modes": "iIvV",
            },
        )
    >>> PluginConfig(
            name="pillow",
            class_name="PillowPlugin",
            module_name="imageio.plugins.pillow"
        )

    FN)	is_legacypackage_nameinstall_namelegacy_argsc                C   sP   |pt  }|| _|| _|| _|| _|| _|p0| j| _|dd| _| j| d S )NzA legacy plugin)namedescription)	dictr
   
class_namemodule_namer   r   r   r	   update)selfr
   r   r   r   r   r   r	    r   :/tmp/pip-unpacked-wheel-xbmu82vq/imageio/config/plugins.py__init__5   s    
zPluginConfig.__init__c                 C   s6   | j stdt| j| j}t|| j}|f | jS )z\For backwards compatibility with FormatManager

        Delete when migrating to v3
        z'Can only get format for legacy plugins.)	r   RuntimeError	importlibimport_moduler   r   getattrr   r	   )r   moduleclazzr   r   r   formatL   s
    zPluginConfig.formatc                    sB   t | j| j}t|| j}| jr>|f | j  fdd}|}|S )zGet the plugin class (import if needed)

        Returns
        -------
        plugin_class : Any
            The class that can be used to instantiate plugins.

        c                    s
   t |  S )Nr   )requestZlegacy_pluginr   r   partial_legacy_pluginj   s    z8PluginConfig.plugin_class.<locals>.partial_legacy_plugin)r   r   r   r   r   r   r   r	   )r   r   r   r   r   r   r   plugin_classY   s    zPluginConfig.plugin_class)__name__
__module____qualname____doc__r   propertyr   r   r   r   r   r   r      s   4
r   ZpillowZPillowPluginzimageio.plugins.pillow)r
   r   r   ZpyavZ
PyAVPluginzimageio.plugins.pyavZopencvZOpenCVPluginzimageio.plugins.opencvZtifffileZTifffilePluginzimageio.plugins.tifffile_v3TIFFZ
TiffFormatzimageio.plugins.tifffileTzTIFF formatz.tif .tiff .stk .lsmZiIvV)r   
extensionsmodes)r
   r   r   r   r   r	   )BMPWindows Bitmap.bmpPillowFormat)BUFRr+   z.bufrr*   )ZCURzWindows Cursorz.curr*   )ZDCXz	Intel DCXz.dcxr*   )DDSzDirectDraw Surface.ddsr*   )ZDIBr(    r*   )ZEPSzEncapsulated Postscriptz.ps .epsr*   )FITSr/   z
.fit .fitsr*   )ZFLIzAutodesk FLI/FLC Animationz	.fli .flcr*   )ZFPXZFlashPixz.fpxr*   )ZFTEXzTexture File Format (IW2:EOC)z	.ftc .ftur*   )ZGBRzGIMP brush filez.gbrr*   )GIFzCompuserve GIF.gif	GIFFormat)GRIBr3   z.gribr*   )HDF5r4   z.h5 .hdfr*   )ZICNSzMac OS icns resourcez.icnsr*   )ICOWindows Icon.icor*   )ZIMzIFUNC Image Memoryz.imr*   )ZIMTzIM Toolsr.   r*   )ZIPTCzIPTC/NAAz.iimr*   )JPEGzJPEG (ISO 10918)z.jfif .jpe .jpg .jpegZ
JPEGFormat)ZJPEG2000zJPEG 2000 (ISO 15444)z.jp2 .j2k .jpc .jpf .jpx .j2cZJPEG2000Format)ZMCIDASzMcIdas area filer.   r*   )ZMICzMicrosoft Image Composerz.micr*   )ZMPOzMPO (CIPA DC-007)z.mpor*   )ZMSPzWindows Paintz.mspr*   )PCDKodak PhotoCD.pcdr*   )PCXZ
Paintbrush.pcxr*   )ZPIXARzPIXAR raster imagez.pxrr*   )PNGzPortable network graphics.pngZ	PNGFormat)PPMzPbmplus imagez.pbm .pgm .ppmr*   )PSDAdobe Photoshop.psdr*   )SGIzSGI Image File Formatz.bw .rgb .rgba .sgir*   )ZSPIDERzSpider 2D imager.   r*   )ZSUNzSun Raster File.rasr*   )ZTGAZTargaz.tgar*   )r$   z
Adobe TIFF
.tif .tiffZ
TIFFFormat)ZWMFzWindows Metafilez	.wmf .emfr*   )XBMz
X11 Bitmap.xbmr*   )XPMzX11 Pixel Map.xpmr*   )ZXVTHUMBzXV thumbnail imager.   r*   z-PILzimageio.plugins.pillow_legacyz via Pillowr2   iIi)r   r%   r&   Z	plugin_idZFFMPEGZFfmpegFormatzimageio.plugins.ffmpegZffmpegz+Many video formats and cameras (via ffmpeg)z/.mov .avi .mpg .mpeg .mp4 .mkv .webm .wmv .h264IZBSDFZ
BsdfFormatzimageio.plugins.bsdfZbsdfz1Format based on the Binary Structured Data Formatz.bsdfZDICOMZDicomFormatzimageio.plugins.dicomZdicomz.Digital Imaging and Communications in Medicinez.dcm .ct .mriZFEIZFEISEMFormatzimageio.plugins.feisemZfeisemzFEI-SEM TIFF format.tif.tiffZivr/   Z
FitsFormatzimageio.plugins.fitsZfitsz-Flexible Image Transport System (FITS) formatz.fits .fit .fts .fzZGDALZ
GdalFormatzimageio.plugins.gdalZgdalz#Geospatial Data Abstraction Libraryz .tiff  .tif .img .ecw .jpg .jpegZITKZ	ItkFormatzimageio.plugins.simpleitkZ	simpleitkz:Insight Segmentation and Registration Toolkit (ITK) format )z.giplz.iplz.mhaz.mhdz.nhdrz.nia.hdrz.nrrdz.niiz.nii.gzz.imgz.img.gzz.vtkz.hdf5z.lsm.mncz.mnc2z.mghrR   z.picr)   z.jpegz.jpgr?   rO   rN   z.dicomz.dcmz.gdcmZNPZZ	NpzFormatzimageio.plugins.npzZnumpyzNumpy's compressed array formatz.npzZSPEZ	SpeFormatzimageio.plugins.speZspezSPE file formatz.speZSWFZ	SWFFormatzimageio.plugins.swfZswfzShockwave flashz.swfZ
SCREENGRABZScreenGrabFormatzimageio.plugins.grabz(Grab screenshots (Windows and OS X only)ZCLIPBOARDGRABZClipboardGrabFormatz"Grab from clipboard (Windows only))z	lytro-lfrzLytro Illum lfr image filez.lfrrL   ZLytroLfrFormat)zlytro-illum-rawzLytro Illum raw image file.rawrL   ZLytroIllumRawFormat)z	lytro-lfpzLytro F01 lfp image filez.lfprL   ZLytroLfpFormat)zlytro-f01-rawzLytro F01 raw image filerS   rL   ZLytroF01RawFormatzimageio.plugins.lytroZlytro)r'   r   zWindows or OS/2 Bitmapr)   rL   ZFreeimageBmpFormatimageio.plugins.freeimage)ZCUT   zDr. Haloz.cutrL   FreeimageFormatrT   )r,      zDirectX Surfacer-   rL   rV   rT   )ZEXR   zILM OpenEXRz.exrrL   rV   rT   )ZG3   zRaw fax format CCITT G.3z.g3rL   rV   rT   )r0      z#Static and animated gif (FreeImage)r1   rK   Z	GifFormatimageio.plugins.freeimagemulti)ZHDR   zHigh Dynamic Range ImagerQ   rL   rV   rT   )r5      r6   r7   rK   Z	IcoFormatr[   )ZIFF   zIFF Interleaved Bitmapz	.iff .lbmrL   rV   rT   )ZJ2K   zJPEG-2000 codestreamz	.j2k .j2crL   rV   rT   )ZJNG   zJPEG Network Graphicsz.jngrL   rV   rT   )ZJP2   zJPEG-2000 File Formatz.jp2rL   rV   rT   )r8   r   zJPEG - JFIF Compliantz.jpg .jif .jpeg .jperL   ZFreeimageJpegFormatrT   )zJPEG-XR$   zJPEG XR image formatz.jxr .wdp .hdprL   rV   rT   )ZKOALA   zC64 Koala Graphicsz.koarL   rV   rT   )ZPBM   zPortable Bitmap (ASCII).pbmrL   rV   rT   )ZPBMRAW   zPortable Bitmap (RAW)re   rL   rV   rT   )r9   	   r:   r;   rL   rV   rT   )r<   
   zZsoft Paintbrushr=   rL   rV   rT   )ZPFM    zPortable floatmapz.pfmrL   rV   rT   )ZPGM   zPortable Greymap (ASCII).pgmrL   rV   rT   )ZPGMRAW   zPortable Greymap (RAW)rk   rL   rV   rT   )ZPICT!   zMacintosh PICTz.pct .pict .picrL   rV   rT   )r>      zPortable Network Graphicsr?   rL   ZFreeimagePngFormatrT   )r@      zPortable Pixelmap (ASCII).ppmrL   FreeimagePnmFormatrT   )ZPPMRAW   zPortable Pixelmap (RAW)rp   rL   rq   rT   )rA      rB   rC   rL   rV   rT   )ZRAS   zSun Raster ImagerE   rL   rV   rT   )ZRAW"   zRAW camera imagez.3fr .arw .bay .bmq .cap .cine .cr2 .crw .cs1 .dc2 .dcr .drf .dsc .dng .erf .fff .ia .iiq .k25 .kc2 .kdc .mdc .mef .mos .mrw .nef .nrw .orf .pef .ptx .pxn .qtk .raf .raw .rdc .rw2 .rwl .rwz .sr2 .srf .srw .stirL   rV   rT   )rD      zSGI Image Formatz.sgi .rgb .rgba .bwrL   rV   rT   )ZTARGA   zTruevision Targaz.tga .targarL   rV   rT   )r$      zTagged Image File FormatrF   rL   rV   rT   )ZWBMP   zWireless Bitmapz.wap .wbmp .wbmrL   rV   rT   )ZWebP#   zGoogle WebP image formatz.webprL   rV   rT   )rG      zX11 Bitmap FormatrH   rL   rV   rT   )rI      zX11 Pixmap FormatrJ   rL   rV   rT   z-FIZ	freeimage)r   r%   r&   Zfifc                 C   s   g | ]\}}|j r|qS r   )r   ).0xconfigr   r   r   
<listcomp>  s      r   )r   Zcore.legacy_plugin_wrapperr   r   r   Zknown_pluginsZPILLOW_FORMATSidsummaryextr   upperr   r
   joinZlytro_formatsZdesmodeZFREEIMAGE_FORMATSrL   r   itemsZ_original_orderr   r   r   r   <module>   sT  l  
  
  


2






!
-




																																	    L
