o
    –h  ã                   @   s   d dl Z dd„ ZdS )é    Nc                     s²   d} zddl m} tt|ƒ ƒƒ} W n	 ty   Y nw d| v r'ddlm‰  ˆ S d| v r3ddlm‰  ˆ S tjdurKt	tjd	ƒrKtj 
¡ rKddlm‰  ˆ S ddlm‰  ‡ fd
d„}|S )a'  
    Return a tqdm appropriate for the situation

    imports tqdm depending on if we're at a console, redir to a file, notebook, etc

    from @tcrimi at https://github.com/tqdm/tqdm/issues/506

    This replaces `import tqdm`, so for example, you do this:
      from stanza.utils.get_tqdm import get_tqdm
      tqdm = get_tqdm()
    then do this when you want a scroll bar or regular iterator depending on context:
      tqdm(list)

    If there is no tty, the returned tqdm will always be disabled
    unless disable=False is specifically set.
    Ú r   )Úget_ipythonÚzmqshell)Útqdm_notebookÚterminal©ÚtqdmNÚisattyc                     s,   d|v rˆ | i |¤ŽS d|d< ˆ | i |¤ŽS )NÚdisableT© )ÚargsÚkwargsr   r   úP/var/www/html/env_mimamsha/lib/python3.10/site-packages/stanza/utils/get_tqdm.pyÚhidden_tqdm'   s   zget_tqdm.<locals>.hidden_tqdm)ÚIPythonr   ÚstrÚtypeÚImportErrorr   r   ÚsysÚstderrÚhasattrr	   )Úipy_strr   r   r   r   r   Úget_tqdm   s&   ÿ r   )r   r   r   r   r   r   Ú<module>   s    