Skip to content

Commit 2fbf89c

Browse files
committed
Fix readability
1 parent 259daed commit 2fbf89c

File tree

1 file changed

+5
-12
lines changed

1 file changed

+5
-12
lines changed

astroquery/query.py

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -385,11 +385,8 @@ def _download_file(self, url, local_filepath, timeout=None, auth=None,
385385
if length is not None:
386386
statinfo = os.stat(local_filepath)
387387
if statinfo.st_size != length:
388-
log.warning("Found cached file {0} with size {1} that is "
389-
"different from expected size {2}"
390-
.format(local_filepath,
391-
statinfo.st_size,
392-
length))
388+
log.warning(f"Found cached file {local_filepath} with size {statinfo.st_size} "
389+
f"that is different from expected size {length}")
393390
open_mode = 'wb'
394391
else:
395392
log.info("Found cached file {0} with expected size {1}."
@@ -421,20 +418,16 @@ def _download_file(self, url, local_filepath, timeout=None, auth=None,
421418
else:
422419
progress_stream = io.StringIO()
423420

424-
with ProgressBarOrSpinner(
425-
length, ('Downloading URL {0} to {1} ...'
426-
.format(url, local_filepath)),
427-
file=progress_stream) as pb:
421+
with ProgressBarOrSpinner(length, f'Downloading URL {url} to {local_filepath} ...',
422+
file=progress_stream) as pb:
428423
with open(local_filepath, open_mode) as f:
429424
for block in response.iter_content(blocksize):
430425
f.write(block)
431426
bytes_read += blocksize
432427
if length is not None:
433-
pb.update(bytes_read if bytes_read <= length else
434-
length)
428+
pb.update(bytes_read if bytes_read <= length else length)
435429
else:
436430
pb.update(bytes_read)
437-
438431
response.close()
439432
return response
440433

0 commit comments

Comments
 (0)