"" is clearer than str()

This commit is contained in:
Hugo van Kemenade 2020-12-22 16:38:25 +02:00
parent d509a27ad4
commit 2426744203
1 changed files with 3 additions and 3 deletions

View File

@ -35,8 +35,8 @@ def _select_progress_class(preferred, fallback):
# Collect all of the possible characters we want to use with the preferred
# bar.
characters = [
getattr(preferred, "empty_fill", str()),
getattr(preferred, "fill", str()),
getattr(preferred, "empty_fill", ""),
getattr(preferred, "fill", ""),
]
characters += list(getattr(preferred, "phases", []))
@ -44,7 +44,7 @@ def _select_progress_class(preferred, fallback):
# of the given file, if this works then we'll assume that we can use the
# fancier bar and if not we'll fall back to the plaintext bar.
try:
str().join(characters).encode(encoding)
"".join(characters).encode(encoding)
except UnicodeEncodeError:
return fallback
else: