mirror of
https://github.com/GNS3/gns3-server.git
synced 2026-11-03 14:01:15 +02:00
refactor: use f-strings in controller modules
This commit is contained in:
9 files changed
+47
-86
No files matched your search
@@ -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>"
|
||||
|
||||
Reference in new issue
Block a user