Skip to content

Commit

Permalink
Reduce string object creation by using a single string formatting ope…
Browse files Browse the repository at this point in the history
…ration
  • Loading branch information
bpepple committed Dec 19, 2024
1 parent 3e5d7d0 commit a0cd288
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions metrontagger/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ def create_print_title(txt: str) -> str:
Returns:
str: The formatted title string, including newlines and dashes.
"""
result = f"\n{txt}\n"
return result + "-" * len(txt)
return f"\n{txt}\n{txt.replace(txt, '-' * len(txt))}"


def cleanup_string(path_name: int | str | None) -> str | None:
Expand Down

0 comments on commit a0cd288

Please sign in to comment.