From edceb8e22bc7027a25d3673224c67cfa4cfdd0ef Mon Sep 17 00:00:00 2001 From: jstit Date: Fri, 17 Jan 2025 16:36:14 +0700 Subject: [PATCH] fix import err --- utils/__init__.py | 1 + utils/download.py | 11 +++++++++++ 2 files changed, 12 insertions(+) create mode 100644 utils/__init__.py diff --git a/utils/__init__.py b/utils/__init__.py new file mode 100644 index 0000000..ea76c8e --- /dev/null +++ b/utils/__init__.py @@ -0,0 +1 @@ +# This file can be empty - it just marks the directory as a Python package diff --git a/utils/download.py b/utils/download.py index aedb731..9458f30 100644 --- a/utils/download.py +++ b/utils/download.py @@ -305,6 +305,17 @@ def download_file_temp( chunk_size_in_mb=16, file_integrity_check_callback=None, ): + """ + Downloads a file from a URL to a temporary location and yields the path. + Automatically cleans up the temporary file after use. + + Args: + url (str): The URL to download from + + Yields: + str: Path to the temporary downloaded file + """ + file_name = _parse_filename(url, None) with tempfile.TemporaryDirectory() as temp_dir: