a
    ¨º”h
  ã                   @  sh   d dl mZ d dlZddlmZmZ dd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ÚbytesÚbool)ÚprefixÚreturnc                 C  s   |   tj¡S ©N)Ú
startswithÚolefileÚMAGIC)r   © r   ú@/var/www/auris/lib/python3.9/site-packages/PIL/MicImagePlugin.pyÚ_accept   s    r   c                      sn   e Zd ZdZdZdZddœdd„Zddd	œd
d„Zddœdd„Zddœ‡ fdd„Z	dddœ‡ fdd„Z
‡  ZS )ÚMicImageFileZMICzMicrosoft Image ComposerFÚNone)r	   c              
   C  s¢   zt  | j¡| _W n2 tyD } zd}t|ƒ|‚W Y d }~n
d }~0 0 dd„ | j ¡ D ƒ| _| jsnd}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 entrieséÿÿÿÿr   r   )r   Z	OleFileIOÚfpÚoleÚOSErrorÚSyntaxErrorÚlistdirÚimagesÚframeÚlenZ	_n_framesZis_animatedÚ_MicImageFile__fpÚseek)ÚselfÚeÚmsgr   r   r   Ú_open)   s      þzMicImageFile._openÚint)r   r	   c                 C  s<   |   |¡sd S | j| }| j |¡| _tj | ¡ || _d S r
   )	Z_seek_checkr   r   Z
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   r+   V   s    

zMicImageFile.closeÚobject)Úargsr	   c                   s"   | j  ¡  | j ¡  tƒ  ¡  d S r
   )r    r+   r   r,   Ú__exit__)r"   r0   r-   r   r   r1   [   s    

zMicImageFile.__exit__)Ú__name__Ú
__module__Ú__qualname__ÚformatÚformat_descriptionZ!_close_exclusive_fp_after_loadingr%   r!   r*   r+   r1   Ú__classcell__r   r   r-   r   r   $   s    
r   z.mic)Ú
__future__r   r   Ú r   r   r   r'   r   Zregister_openr5   Zregister_extensionr   r   r   r   Ú<module>   s   @