Team Ai
Apppublic

delsj/function-gemma

sourceHugging Faceupdated 10mo agoView on Hugging Face
0likes
utils.cpython-312.pyc27 linesDownload Raw Back to __pycache__
1�

2LIi����ddlZddlmZ	ddlmZdeezddfd�Zd
d�Z				dded	edzd3e4dzdeezdzdef5d�Zy#e$r	ddlmZY�;wxYw)�N)�Path)�	MEDIA_DIR�	file_path�returnc���t|�}|jj�s	|jjdd��yy#t$r }td|j�d|����d}~wwxYw)z6Raise an error if the parent directory does not exist.T��parents�exist_okz"Failed to create parent directory z: N)r�parent�exists�mkdir�OSError�6ValueError)r�es  �>/usr/local/lib/python3.12/dist-packages/trackio/media/utils.py�7check_pathr8sv���Y��I����"�"�$�	����"�"�4�$�"�?�%���	��4�Y�5E�5E�4F�b���L��
��	�s�A�	A/�A*�*A/c�D�tjd��td��y)z=Raise an error if ffmpeg is not available on the system PATH.�ffmpegNz�ffmpeg is required to write video but was not found on your system. Please install ffmpeg and ensure it is available on your PATH.)�shutil�which�RuntimeError��r�check_ffmpeg_installedrs)��
�|�|�H��%��
M�9�	10�&r�project�run�step�
relative_pathc��|�
|�td��t|z}|r||z}|�|t|�z}n|dz}|r||z}|jdd��|S)a�11    Get the full path where uploaded files are stored for a Trackio project (and create the directory if it doesn't exist).12    If a run is not provided, the files are stored in a project-level directory with the given relative path.13 14    Args:15        project: The project name16        run: The run name17        step: The step number18        relative_path: The relative path within the directory (only used if run is not provided)19 20    Returns:21        The full path to the media file22    z1Uploading files at a specific step requires a run�filesTr)rr�strr
)rrrr�paths     r�get_project_media_pathr#so��&��C�K��L�M�M��w��D�23��������C��I��D�������M�!�D��J�J�t�d�J�+��Kr)rN)NNN)r�pathlibr�
trackio.utilsr�ImportError�utilsr!rr�intr#rrr�<module>r)s���
�� �'�24	�#��*�	��	�25���'+�	 �
� �	�t�� ���*� ���:��$�	 �2627� ��3� �� �s�A�A�
A