Skip to content

Commit 531a430

Browse files
authored
Replaced .format with f- strings (#31660)
1 parent a1e0752 commit 531a430

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

pandas/tests/tseries/frequencies/test_to_offset.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ def test_to_offset_invalid(freqstr):
8686

8787
# We escape string because some of our
8888
# inputs contain regex special characters.
89-
msg = re.escape("Invalid frequency: {freqstr}".format(freqstr=freqstr))
89+
msg = re.escape(f"Invalid frequency: {freqstr}")
9090
with pytest.raises(ValueError, match=msg):
9191
frequencies.to_offset(freqstr)
9292

pandas/util/_print_versions.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,8 @@ def get_sys_info() -> List[Tuple[str, Optional[Union[str, int]]]]:
4343
("python-bits", struct.calcsize("P") * 8),
4444
("OS", f"{sysname}"),
4545
("OS-release", f"{release}"),
46-
# ("Version", "{version}".format(version=version)),
46+
# FIXME: dont leave commented-out
47+
# ("Version", f"{version}"),
4748
("machine", f"{machine}"),
4849
("processor", f"{processor}"),
4950
("byteorder", f"{sys.byteorder}"),
@@ -114,14 +115,13 @@ def show_versions(as_json=False):
114115

115116
else:
116117
maxlen = max(len(x) for x in deps)
117-
tpl = "{{k:<{maxlen}}}: {{stat}}".format(maxlen=maxlen)
118118
print("\nINSTALLED VERSIONS")
119119
print("------------------")
120120
for k, stat in sys_info:
121-
print(tpl.format(k=k, stat=stat))
121+
print(f"{{k:<{maxlen}}}: {{stat}}")
122122
print("")
123123
for k, stat in deps_blob:
124-
print(tpl.format(k=k, stat=stat))
124+
print(f"{{k:<{maxlen}}}: {{stat}}")
125125

126126

127127
def main() -> int:

0 commit comments

Comments
 (0)