refactor: use f-strings in controller modules

This commit is contained in:
Mark Paronyan committed 2026-10-03 19:44:01 +03:00
1 parent 552c0ca3e0
commit 7a9c600f54
9 files changed
+47 -86

No files matched your search

+1 -3
View File
@@ -72,9 +72,7 @@ class Drawing:
return data.decode()
except UnicodeError:
width, height, filetype = get_size(data)
return '<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" height="{height}" width="{width}">\n<image height="{height}" width="{width}" xlink:href="data:image/{filetype};base64,{b64}" />\n</svg>'.format(
b64=base64.b64encode(data).decode(), filetype=filetype, width=width, height=height
)
return f'<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" height="{height}" width="{width}">\n<image height="{height}" width="{width}" xlink:href="data:image/{filetype};base64,{base64.b64encode(data).decode()}" />\n</svg>'
except OSError:
log.warning("Image file %s missing", filename)
return "<svg></svg>"