Skip to content

Commit ce7c7d2

Browse files
gtkaczmahmoud
authored andcommitted
fix(human_readable_list): altering f-string syntax to have backwards compatibility with Python <3.12
1 parent 1b1d378 commit ce7c7d2

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

boltons/strutils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1304,7 +1304,7 @@ def human_readable_list(items: typing.Sequence[str], delimiter: str = ',', conju
13041304
if not items:
13051305
return ''
13061306

1307-
delimiter = f'{delimiter.strip()} '
1307+
delimiter = delimiter and delimiter.strip() + ' '
13081308
conjunction = conjunction.strip()
13091309

13101310
if len(items) == 1:
@@ -1313,4 +1313,4 @@ def human_readable_list(items: typing.Sequence[str], delimiter: str = ',', conju
13131313
if len(items) == 2:
13141314
return f'{items[0]} {conjunction} {items[1]}'
13151315

1316-
return f'{delimiter.join(items[:-1])}{delimiter if oxford else ' '}{conjunction} {items[-1]}'
1316+
return f'{delimiter.join(items[:-1])}{delimiter if oxford else " "}{conjunction} {items[-1]}'

0 commit comments

Comments
 (0)