U
    ?h}                     @   sP   d Z ddlZddlmZ ddlmZ G dd deZedd	d
dZe	e dS )zE Example plugin. You can use this as a template for your own plugin.
    N   )formats)Formatc                   @   sD   e Zd ZdZdd Zdd ZG dd dejZG dd	 d	ejZd
S )DummyFormata  The dummy format is an example format that does nothing.
    It will never indicate that it can read or write a file. When
    explicitly asked to read, it will simply read the bytes. When
    explicitly asked to write, it will raise an error.

    This documentation is shown when the user does ``help('thisformat')``.

    Parameters for reading
    ----------------------
    Specify arguments in numpy doc style here.

    Parameters for saving
    ---------------------
    Specify arguments in numpy doc style here.

    c                 C   s   |j | jkrdS d S NT	extension
extensionsselfrequest r   I/var/www/html/venv/lib/python3.8/site-packages/imageio/plugins/example.py	_can_read   s    zDummyFormat._can_readc                 C   s   |j | jkrdS d S r   r   r
   r   r   r   
_can_write8   s    	zDummyFormat._can_writec                   @   s6   e Zd ZdddZdd Zdd Zd	d
 Zdd ZdS )zDummyFormat.ReaderF   c                 C   s   | j  | _|| _d | _d S N)r   get_file_fp_length_data)r   Zsome_optionlengthr   r   r   _openG   s    zDummyFormat.Reader._openc                 C   s   d S r   r   r   r   r   r   _closeS   s    zDummyFormat.Reader._closec                 C   s   | j S r   )r   r   r   r   r   _get_lengthX   s    zDummyFormat.Reader._get_lengthc                 C   sV   || j krtd|| j f | jd kr2| j | _t| jd}t|df|_|i fS )NzImage index %i > %iZuint8r   )	r   
IndexErrorr   r   readnpZ
frombufferlenshape)r   indeximr   r   r   	_get_data\   s    

zDummyFormat.Reader._get_datac                 C   s   i S r   r   )r   r!   r   r   r   _get_meta_datai   s    z!DummyFormat.Reader._get_meta_dataN)Fr   )__name__
__module____qualname__r   r   r   r#   r$   r   r   r   r   ReaderF   s
   
r(   c                   @   s.   e Zd ZdddZdd Zdd Zdd	 Zd
S )zDummyFormat.Writerr   c                 C   s   | j  | _d S r   )r   r   r   )r   flagsr   r   r   r   q   s    zDummyFormat.Writer._openc                 C   s   d S r   r   r   r   r   r   r   {   s    zDummyFormat.Writer._closec                 C   s   t dd S )Nz)The dummy format cannot write image data.RuntimeError)r   r"   metar   r   r   _append_data   s    zDummyFormat.Writer._append_datac                 C   s   t dd S )Nz(The dummy format cannot write meta data.r*   )r   r,   r   r   r   set_meta_data   s    z DummyFormat.Writer.set_meta_dataN)r   )r%   r&   r'   r   r   r-   r.   r   r   r   r   Writerp   s   

r/   N)	r%   r&   r'   __doc__r   r   r   r(   r/   r   r   r   r   r      s
   *r   dummyz$An example format that does nothing.z.foobar .nonexistentextZiI)
r0   numpyr    r   corer   r   formatZ
add_formatr   r   r   r   <module>   s   ~