Skip to content

Commit 0a2bc44

Browse files
committed
Do not call str inside f-string
1 parent 8cb64c4 commit 0a2bc44

File tree

3 files changed

+7
-12
lines changed

3 files changed

+7
-12
lines changed

beets/ui/commands.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -113,13 +113,11 @@ def _parse_logfiles(logfiles):
113113
yield from _paths_from_logfile(syspath(normpath(logfile)))
114114
except ValueError as err:
115115
raise ui.UserError(
116-
f"malformed logfile {util.displayable_path(logfile)}:"
117-
f" {str(err)}"
116+
f"malformed logfile {util.displayable_path(logfile)}: {err}"
118117
) from err
119118
except OSError as err:
120119
raise ui.UserError(
121-
f"unreadable logfile {util.displayable_path(logfile)}:"
122-
f" {str(err)}"
120+
f"unreadable logfile {util.displayable_path(logfile)}: {err}"
123121
) from err
124122

125123

@@ -212,7 +210,7 @@ def get_singleton_disambig_fields(info: hooks.TrackInfo) -> Sequence[str]:
212210
out = []
213211
chosen_fields = config["match"]["singleton_disambig_fields"].as_str_seq()
214212
calculated_values = {
215-
"index": f"Index {str(info.index)}",
213+
"index": f"Index {info.index}",
216214
"track_alt": f"Track {info.track_alt}",
217215
"album": (
218216
f"[{info.album}]"

beets/util/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ def _reasonstr(self):
112112
elif hasattr(self.reason, "strerror"): # i.e., EnvironmentError
113113
return self.reason.strerror
114114
else:
115-
return f'"{str(self.reason)}"'
115+
return f'"{self.reason}"'
116116

117117
def get_message(self):
118118
"""Create the human-readable description of the error, sans

beetsplug/bpd/__init__.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1138,7 +1138,7 @@ def _item_info(self, item):
11381138
pass
11391139

11401140
for tagtype, field in self.tagtype_map.items():
1141-
info_lines.append(f"{tagtype}: {str(getattr(item, field))}")
1141+
info_lines.append(f"{tagtype}: {getattr(item, field)}")
11421142

11431143
return info_lines
11441144

@@ -1297,15 +1297,12 @@ def cmd_status(self, conn):
12971297

12981298
yield (
12991299
f"bitrate: {item.bitrate / 1000}",
1300-
(
1301-
"audio:"
1302-
f" {str(item.samplerate)}:{str(item.bitdepth)}:{str(item.channels)}"
1303-
),
1300+
f"audio: {item.samplerate}:{item.bitdepth}:{item.channels}",
13041301
)
13051302

13061303
(pos, total) = self.player.time()
13071304
yield (
1308-
f"time: {str(int(pos))}:{str(int(total))}",
1305+
f"time: {int(pos)}:{int(total)}",
13091306
"elapsed: {pos:.3f}",
13101307
"duration: {total:.3f}",
13111308
)

0 commit comments

Comments
 (0)