Use f-strings in place of .format()

Code transformed like so:

    pip install flynt
    flynt .
    black .
This commit is contained in:
Simon Willison 2020-11-15 15:24:22 -08:00 committed by GitHub
commit 30e64c8d3b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
35 changed files with 213 additions and 277 deletions

View file

@ -82,7 +82,7 @@ def json_renderer(args, data, view_name):
status_code = 400
data = {
"ok": False,
"error": "Invalid _shape: {}".format(shape),
"error": f"Invalid _shape: {shape}",
"status": 400,
"title": None,
}
@ -96,7 +96,7 @@ def json_renderer(args, data, view_name):
content_type = "application/json; charset=utf-8"
headers = {}
if next_url:
headers["link"] = '<{}>; rel="next"'.format(next_url)
headers["link"] = f'<{next_url}>; rel="next"'
return Response(
body, status=status_code, headers=headers, content_type=content_type
)