Skip to content

Commit 7c3a050

Browse files
committed
Rename download function's Callable argument
Rename from progress_consumer to progress_subscriber, for two reasons: 1. Consistency with Builder's subscribe_output, subscribe_error, and subscribe_progress functions, which accept "subscriber" objects. 2. There is an existing type alias ProgressConsumer used by the Builder#subscribe_progress reporting, but the Callable argument of download is *not* the same type as this type alias: it's Callable[[int, int], None], not Callable[[str, int, int], None]. See also apposed/appose-java@ac5bb38
1 parent 9c226be commit 7c3a050

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/appose/util/download.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,15 @@
2727
def download(
2828
name: str,
2929
url_path: str,
30-
progress_consumer: Callable[[int, int], None] | None = None,
30+
progress_subscriber: Callable[[int, int], None] | None = None,
3131
) -> Path:
3232
"""
3333
Download a file from a URL to a temporary file.
3434
3535
Args:
3636
name: Base name for the temporary file.
3737
url_path: The URL to download from.
38-
progress_consumer: Optional callback to track download progress (current, total).
38+
progress_subscriber: Optional callback to track download progress (current, total).
3939
4040
Returns:
4141
Path to the downloaded temporary file.
@@ -97,8 +97,8 @@ def download(
9797
f.write(chunk)
9898
downloaded += len(chunk)
9999

100-
if progress_consumer:
101-
progress_consumer(downloaded, file_size)
100+
if progress_subscriber:
101+
progress_subscriber(downloaded, file_size)
102102

103103
# Verify download completed
104104
if temp_file.stat().st_size < file_size:

0 commit comments

Comments
 (0)