o
    h
                     @  sb   d dl mZ d dlZddlmZmZ dd	d
ZG dd dejZe	ej
ee eej
d dS )    )annotationsN   )ImageTiffImagePluginprefixbytesreturnboolc                 C  s   |  tjS N)
startswitholefileMAGIC)r    r   T/var/www/html/optinet_system/venv/lib/python3.10/site-packages/PIL/MicImagePlugin.py_accept   s   r   c                      sV   e Zd ZdZdZdZdddZdd
dZdddZd fddZ	d fddZ
  ZS )MicImageFileMICzMicrosoft Image ComposerFr   Nonec              
   C  s   z	t | j| _W n ty } zd}t||d }~ww dd | j D | _| js1d}t|d| _t	| j| _
| j
dk| _| j| _| d d S )Nz!not an MIC file; invalid OLE filec                 S  s6   g | ]}|d d r|d  dr|d  dkr|qS )r   Nr   z.ACIr   )endswith).0pathr   r   r   
<listcomp>6   s    
z&MicImageFile._open.<locals>.<listcomp>z!not an MIC file; no image entriesr   r   )r   	OleFileIOfpoleOSErrorSyntaxErrorlistdirimagesframelen	_n_framesis_animated_MicImageFile__fpseek)selfemsgr   r   r   _open)   s$   
zMicImageFile._openr    intc                 C  s<   |  |sd S | j| }| j|| _tj|  || _d S r
   )	_seek_checkr   r   
openstreamr   r   TiffImageFiler)   r    )r&   r    filenamer   r   r   r%   I   s   


zMicImageFile.seekc                 C  s   | j S r
   )r    r&   r   r   r   tellS   s   zMicImageFile.tellc                   s"   | j   | j  t   d S r
   )r$   closer   superr/   	__class__r   r   r1   V      

zMicImageFile.closeargsobjectc                   s"   | j   | j  t   d S r
   )r$   r1   r   r2   __exit__)r&   r6   r3   r   r   r8   [   r5   zMicImageFile.__exit__)r   r   )r    r*   r   r   )r   r*   )r6   r7   r   r   )__name__
__module____qualname__formatformat_description!_close_exclusive_fp_after_loadingr)   r%   r0   r1   r8   __classcell__r   r   r3   r   r   $   s    

 

r   z.mic)r   r   r   r	   )
__future__r   r    r   r   r   r-   r   register_openr<   register_extensionr   r   r   r   <module>   s   
@