Skip to content

Commit 9b6657d

Browse files
committed
f string in io.common
1 parent ed20822 commit 9b6657d

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

pandas/io/common.py

+8-8
Original file line numberDiff line numberDiff line change
@@ -249,8 +249,8 @@ def get_filepath_or_buffer(
249249
return _expand_user(filepath_or_buffer), None, compression, False
250250

251251
if not is_file_like(filepath_or_buffer):
252-
msg = "Invalid file path or buffer object type: {_type}"
253-
raise ValueError(msg.format(_type=type(filepath_or_buffer)))
252+
msg = f"Invalid file path or buffer object type: {type(filepath_or_buffer)}"
253+
raise ValueError(msg)
254254

255255
return filepath_or_buffer, None, compression, False
256256

@@ -358,9 +358,9 @@ def _infer_compression(
358358
if compression in _compression_to_extension:
359359
return compression
360360

361-
msg = "Unrecognized compression type: {}".format(compression)
361+
msg = f"Unrecognized compression type: {compression}"
362362
valid = ["infer", None] + sorted(_compression_to_extension)
363-
msg += "\nValid compression types are {}".format(valid)
363+
msg += f"\nValid compression types are {valid}"
364364
raise ValueError(msg)
365365

366366

@@ -458,12 +458,12 @@ def _get_handle(
458458
f = zf.open(zip_names.pop())
459459
elif len(zip_names) == 0:
460460
raise ValueError(
461-
"Zero files found in ZIP file {}".format(path_or_buf)
461+
f"Zero files found in ZIP file {path_or_buf}"
462462
)
463463
else:
464464
raise ValueError(
465-
"Multiple files found in ZIP file."
466-
" Only one file per ZIP: {}".format(zip_names)
465+
f"Multiple files found in ZIP file."
466+
" Only one file per ZIP: {zip_names}"
467467
)
468468

469469
# XZ Compression
@@ -472,7 +472,7 @@ def _get_handle(
472472

473473
# Unrecognized Compression
474474
else:
475-
msg = "Unrecognized compression type: {}".format(compression)
475+
msg = f"Unrecognized compression type: {compression}"
476476
raise ValueError(msg)
477477

478478
handles.append(f)

0 commit comments

Comments
 (0)