@@ -246,8 +246,8 @@ def get_filepath_or_buffer(
246
246
return _expand_user (filepath_or_buffer ), None , compression , False
247
247
248
248
if not is_file_like (filepath_or_buffer ):
249
- msg = "Invalid file path or buffer object type: {_type }"
250
- raise ValueError (msg . format ( _type = type ( filepath_or_buffer )) )
249
+ msg = f "Invalid file path or buffer object type: { type ( filepath_or_buffer ) } "
250
+ raise ValueError (msg )
251
251
252
252
return filepath_or_buffer , None , compression , False
253
253
@@ -355,9 +355,9 @@ def _infer_compression(
355
355
if compression in _compression_to_extension :
356
356
return compression
357
357
358
- msg = "Unrecognized compression type: {}" . format ( compression )
358
+ msg = f "Unrecognized compression type: { compression } "
359
359
valid = ["infer" , None ] + sorted (_compression_to_extension )
360
- msg += "\n Valid compression types are {}" . format ( valid )
360
+ msg += f "\n Valid compression types are { valid } "
361
361
raise ValueError (msg )
362
362
363
363
@@ -454,13 +454,11 @@ def _get_handle(
454
454
if len (zip_names ) == 1 :
455
455
f = zf .open (zip_names .pop ())
456
456
elif len (zip_names ) == 0 :
457
- raise ValueError (
458
- "Zero files found in ZIP file {}" .format (path_or_buf )
459
- )
457
+ raise ValueError (f"Zero files found in ZIP file { path_or_buf } " )
460
458
else :
461
459
raise ValueError (
462
460
"Multiple files found in ZIP file."
463
- " Only one file per ZIP: {}" . format ( zip_names )
461
+ f " Only one file per ZIP: { zip_names } "
464
462
)
465
463
466
464
# XZ Compression
@@ -469,7 +467,7 @@ def _get_handle(
469
467
470
468
# Unrecognized Compression
471
469
else :
472
- msg = "Unrecognized compression type: {}" . format ( compression )
470
+ msg = f "Unrecognized compression type: { compression } "
473
471
raise ValueError (msg )
474
472
475
473
handles .append (f )
0 commit comments