Skip to content

Commit 1a23f94

Browse files
Update build.py
The logic for truncating the URL for logging is unnecessarily verbose and inefficient. It can be simplified using a single string slice and a conditional expression, which is more idiomatic in Python. Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
1 parent 54fe94e commit 1a23f94

1 file changed

Lines changed: 1 addition & 6 deletions

File tree

build.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -75,12 +75,7 @@ def get_platform_suffix() -> str:
7575

7676
def download_file(url: str, dest: str):
7777
"""Download a file from URL to destination."""
78-
chars = []
79-
for i, c in enumerate(url):
80-
if i >= 60: break
81-
chars.append(c)
82-
short_url = "".join(chars)
83-
if len(url) > 60: short_url += "..."
78+
short_url = (url[:60] + "...") if len(url) > 60 else url
8479
log.info(" Downloading from %s", short_url)
8580
urllib.request.urlretrieve(url, dest)
8681

0 commit comments

Comments
 (0)