o
    h,                  
   @   s  U d Z ddlZddlZddlZddlZddlZddlmZm	Z	 ddl
mZmZ ej d dZeed< i Zi ddhd	d	hd
d
hddhddhddhddhddhddhddhddhddhddhddhddhddhddddhiZe D ]#\ZZdee< eD ]Zzejeee< W  n ejjy   Y qw qded efd!d"Zded efd#d$Zd efd%d&Zd efd'd(Zd efd)d*Z d efd+d,Z!d efd-d.Z"d efd/d0Z#d efd1d2Z$d efd3d4Z%d efd5d6Z&d efd7d8Z'd efd9d:Z(d efd;d<Z)d efd=d>Z*d efd?d@Z+d efdAdBZ,d efdCdDZ-d efdEdFZ.d efdGdHZ/d efdIdJZ0d efdKdLZ1d efdMdNZ2d efdOdPZ3d efdQdRZ4d efdSdTZ5d efdUdVZ6d efdWdXZ7d efdYdZZ8d efd[d\Z9d efd]d^Z:d efd_d`Z;d efdadbZ<d efdcddZ=d efdedfZ>d efdgdhZ?d efdidjZ@d efdkdlZAd efdmdnZBz	doeeC v ZDW n eEy   dpZDY nw d efdqdrZFd efdsdtZGd efdudvZHd e	eef fdwdxZIdS )yz0Check presence of installed packages at runtime.    N)AnyDict   )__version__	constants+_PY_VERSIONaiohttpfastaifastapifastcoregradiographvizhf_transferhf_xetjinjaJinja2kerasnumpypillowPillowpydanticpydotsafetensorstensorboardtensorboardX
tensorflow)
r   ztensorflow-cpuztensorflow-gpuz
tf-nightlyztf-nightly-cpuztf-nightly-gpuzintel-tensorflowzintel-tensorflow-avx512ztensorflow-rocmztensorflow-macostorchN/Apackage_namereturnc                 C   s   t | dS Nr   )_package_versionsgetr    r%   r/var/www/html/construction_image-detection-poc/venv/lib/python3.10/site-packages/huggingface_hub/utils/_runtime.py_get_versionJ      r'   c                 C   s   t | dkS r!   r'   r$   r%   r%   r&   is_package_availableN   r(   r*   c                   C      t S N)r   r%   r%   r%   r&   get_python_versionS      r-   c                   C   r+   r,   )r   r%   r%   r%   r&   get_hf_hub_versionX   r.   r/   c                   C      t dS Nr	   r*   r%   r%   r%   r&   is_aiohttp_available]      r3   c                   C   r0   r1   r)   r%   r%   r%   r&   get_aiohttp_versiona   r4   r5   c                   C   r0   Nr
   r2   r%   r%   r%   r&   is_fastai_availablef   r4   r7   c                   C   r0   r6   r)   r%   r%   r%   r&   get_fastai_versionj   r4   r8   c                   C   r0   Nr   r2   r%   r%   r%   r&   is_fastapi_availableo   r4   r:   c                   C   r0   r9   r)   r%   r%   r%   r&   get_fastapi_versions   r4   r;   c                   C   r0   Nr   r2   r%   r%   r%   r&   is_fastcore_availablex   r4   r=   c                   C   r0   r<   r)   r%   r%   r%   r&   get_fastcore_version|   r4   r>   c                   C   r0   Nr   r2   r%   r%   r%   r&   is_gradio_available   r4   r@   c                   C   r0   r?   r)   r%   r%   r%   r&   get_gradio_version   r4   rA   c                   C   r0   Nr   r2   r%   r%   r%   r&   is_graphviz_available   r4   rC   c                   C   r0   rB   r)   r%   r%   r%   r&   get_graphviz_version   r4   rD   c                   C   r0   Nr   r2   r%   r%   r%   r&   is_hf_transfer_available   r4   rF   c                   C   r0   rE   r)   r%   r%   r%   r&   get_hf_transfer_version   r4   rG   c                   C   r0   Nr   r2   r%   r%   r%   r&   is_xet_available   r4   rI   c                   C   r0   rH   r)   r%   r%   r%   r&   get_xet_version   r4   rJ   c                   C   r0   Nr   r2   r%   r%   r%   r&   is_keras_available   r4   rL   c                   C   r0   rK   r)   r%   r%   r%   r&   get_keras_version   r4   rM   c                   C   r0   Nr   r2   r%   r%   r%   r&   is_numpy_available   r4   rO   c                   C   r0   rN   r)   r%   r%   r%   r&   get_numpy_version   r4   rP   c                   C   r0   Nr   r2   r%   r%   r%   r&   is_jinja_available   r4   rR   c                   C   r0   rQ   r)   r%   r%   r%   r&   get_jinja_version   r4   rS   c                   C   r0   Nr   r2   r%   r%   r%   r&   is_pillow_available   r4   rU   c                   C   r0   rT   r)   r%   r%   r%   r&   get_pillow_version   r4   rV   c                  C   s>   t dsdS z	ddlm}  W dS  ty   td Y dS w )Nr   Fr   	validatorzPydantic is installed but cannot be imported. Please check your installation. `huggingface_hub` will default to not using Pydantic. Error message: '{e}'T)r*   r   rX   ImportErrorwarningswarnrW   r%   r%   r&   is_pydantic_available   s   
r\   c                   C   r0   )Nr   r)   r%   r%   r%   r&   get_pydantic_version   r4   r]   c                   C   r0   Nr   r2   r%   r%   r%   r&   is_pydot_available   r4   r_   c                   C   r0   r^   r)   r%   r%   r%   r&   get_pydot_version   r4   r`   c                   C   r0   Nr   r2   r%   r%   r%   r&   is_tensorboard_available   r4   rb   c                   C   r0   ra   r)   r%   r%   r%   r&   get_tensorboard_version   r4   rc   c                   C   r0   Nr   r2   r%   r%   r%   r&   is_tf_available   r4   re   c                   C   r0   rd   r)   r%   r%   r%   r&   get_tf_version   r4   rf   c                   C   r0   Nr   r2   r%   r%   r%   r&   is_torch_available  r4   rh   c                   C   r0   rg   r)   r%   r%   r%   r&   get_torch_version  r4   ri   c                   C   r0   )Nr   r2   r%   r%   r%   r&   is_safetensors_available
  r4   rj   zgoogle.colabFc                  C   sB   zt  j} | jD ]}|jdkr W dS qW dS  ty    Y dS w )zReturn `True` if code is executed in a notebook (Jupyter, Colab, QTconsole).

    Taken from https://stackoverflow.com/a/39662359.
    Adapted to make it work with Google colab as well.
    ZMQInteractiveShellTF)get_ipython	__class____mro____name__	NameError)shell_classparent_classr%   r%   r&   is_notebook  s   

rs   c                   C   r+   )zoReturn `True` if code is executed in a Google colab.

    Taken from https://stackoverflow.com/a/63519730.
    )_is_google_colabr%   r%   r%   r&   is_google_colab*  s   ru   c                   C   s   t jddkS )zKReturn `True` if code is executed in a Google Colab Enterprise environment.VERTEX_PRODUCTCOLAB_ENTERPRISE)osenvironr#   r%   r%   r%   r&   is_colab_enterprise2  s   rz   c                  C   s`  ddl m} m} ddlm} |  }t t t d}zt j	}d|d< |j
|d< W n ty7   d|d< Y nw t r=dnd|d	< t rFdnd|d
< t rOdnd|d< tj|d< |du|d< |duruz	| d |d< W n	 tyt   Y nw z
d| |d< W n	 ty   Y nw t |d< t |d< t |d< t |d< t |d< t |d< t |d< t |d< t |d< t |d< t |d< t |d< t |d< t  |d < t! |d!< tj"|d"< tj#|d#< tj$|d$< tj|d%< tj%|d&< tj&|d'< tj'|d(< tj(|d)< tj)|d*< tj*|d+< tj+|d,< tj,|d-< tj-|d.< tj.|d/< t/d0 t/d1d2d3 |0 D d1  |S )4a  Dump information about the machine to help debugging issues.

    Similar helper exist in:
    - `datasets` (https://github.com/huggingface/datasets/blob/main/src/datasets/commands/env.py)
    - `diffusers` (https://github.com/huggingface/diffusers/blob/main/src/diffusers/commands/env.py)
    - `transformers` (https://github.com/huggingface/transformers/blob/main/src/transformers/commands/env.py)
    r   )	get_tokenwhoami)list_credential_helpers)zhuggingface_hub versionPlatformzPython versionYeszRunning in iPython ?ziPython shellNozRunning in notebook ?zRunning in Google Colab ?z$Running in Google Colab Enterprise ?zToken path ?NzHas saved token ?namez
Who am I ?z, z!Configured git credential helpersFastAI
TensorflowTorchr   Graphvizr   Pydotr   r   r   r   r   r   r	   r   ENDPOINTHF_HUB_CACHEHF_ASSETS_CACHEHF_TOKEN_PATHHF_STORED_TOKENS_PATHHF_HUB_OFFLINEHF_HUB_DISABLE_TELEMETRYHF_HUB_DISABLE_PROGRESS_BARSHF_HUB_DISABLE_SYMLINKS_WARNING#HF_HUB_DISABLE_EXPERIMENTAL_WARNINGHF_HUB_DISABLE_IMPLICIT_TOKENHF_HUB_ENABLE_HF_TRANSFERHF_HUB_ETAG_TIMEOUTHF_HUB_DOWNLOAD_TIMEOUTz5
Copy-and-paste the text below in your GitHub issue.

c                 S   s    g | ]\}}d | d| qS )z- z: r%   ).0propvalr%   r%   r&   
<listcomp>  s     z)dump_environment_info.<locals>.<listcomp>)1huggingface_hubr{   r|   huggingface_hub.utilsr}   r/   platformr-   rl   rm   ro   rp   rs   ru   rz   r   r   	Exceptionjoinr8   rf   ri   rS   rD   rM   r`   rV   rG   rA   rc   rP   r]   r5   rJ   r   r   r   r   r   r   r   r   r   r   r   r   r   printitems)r{   r|   r}   tokeninforq   r%   r%   r&   dump_environment_info7  s|   





























 r   )J__doc__importlib.metadata	importlibrx   r   sysrZ   typingr   r    r   r   versionsplitrstripr   str__annotations__r"   _CANDIDATESr   candidate_namepackage_namesr   metadataPackageNotFoundErrorr'   boolr*   r-   r/   r3   r5   r7   r8   r:   r;   r=   r>   r@   rA   rC   rD   rF   rG   rI   rJ   rL   rM   rO   rP   rR   rS   rU   rV   r\   r]   r_   r`   rb   rc   re   rf   rh   ri   rj   rl   rt   rp   rs   ru   rz   r   r%   r%   r%   r&   <module>   s   	
!