(block_num, block_size, total_size)
| 25 | total_truncated = 0 # only print download progress every 2MB to avoid spamming logs |
| 26 | |
| 27 | def report_progress(block_num, block_size, total_size): |
| 28 | nonlocal total_downloaded |
| 29 | nonlocal total_truncated |
| 30 | total_downloaded += block_size |
| 31 | if total_downloaded // (1024 * 1024) > total_truncated: |
| 32 | total_truncated = total_downloaded // (1024 * 1024) |
| 33 | if total_truncated % 2 == 0: |
| 34 | print(f"\rDownloaded {total_downloaded // (1024 * 1024)} MB", end="") |
| 35 | |
| 36 | try: |
| 37 | ssl._create_default_https_context = ssl._create_stdlib_context |
nothing calls this directly
no outgoing calls
no test coverage detected