o
    h>                     @  s   d Z ddlmZ ddlZddlZzddlmZ W n! ey9   zddlmZ W n ey6   ddlmZ Y nw Y nw ddd
dZ	e
dkrLee	  dS dS )zlPrint or replace ImageDescription in first page of TIFF file.

Usage: ``tiffcomment [--set comment] file``

    )annotationsN   )tiffcommentargvlist[str] | Nonereturnintc                 C  s~  | du rt j} t| dkr| d dv r| d }| dd }nd}| dd }t|dks5tdd |D r@t  tt  dS |du rEnJtj	|ret
|d	}| }W d   n1 s_w   Y  n*z|d
}W n" ty } zt|  t|tsJ | }W Y d}~nd}~ww |D ]+}zt||}W n ty } zt| d|  W Y d}~qd}~ww |rt| qdS )z-Tiffcomment command line usage main function.N   r   z--set   r   c                 s  s    | ]}| d V  qdS )-N)
startswith).0f r   O/var/www/html/scripts/venv/lib/python3.10/site-packages/tifffile/tiffcomment.py	<genexpr>&   s    zmain.<locals>.<genexpr>rbasciiz: )sysr   lenanyprint__doc__stripospathexistsopenreadencodeUnicodeEncodeError
isinstancestrr   	Exception)r   commentfilesfhexcfileresultr   r   r   main   sJ   

r*   __main__)N)r   r   r   r   )r   
__future__r   r   r   tifffiler   ImportErrortifffile.tifffiler*   __name__exitr   r   r   r   <module>   s$   +