Modernize the code base with f-strings (#1068)

This commit is contained in:
Mickaël Schoentgen
2021-05-25 20:49:07 +02:00
committed by GitHub
parent 39314887c4
commit 0ff0874fa3
9 changed files with 43 additions and 63 deletions

View File

@ -62,7 +62,7 @@ def humanize_bytes(n, precision=2):
break
# noinspection PyUnboundLocalVariable
return '%.*f %s' % (precision, n / factor, suffix)
return f'{n / factor:.{precision}f} {suffix}'
class ExplicitNullAuth(requests.auth.AuthBase):
@ -85,7 +85,7 @@ def get_content_type(filename):
if mime:
content_type = mime
if encoding:
content_type = '%s; charset=%s' % (mime, encoding)
content_type = f'{mime}; charset={encoding}'
return content_type