Use black with -l 120 param.

This commit is contained in:
grossmj committed 2021-04-13 18:46:50 +09:30
1 parent f928738bd5
commit c021e21309
194 files changed
+6034 -4564

No files matched your search

+8 -5
View File
@@ -27,6 +27,7 @@ from gns3server.utils.picture import get_size
import logging
log = logging.getLogger(__name__)
@@ -74,7 +75,9 @@ 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 '<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
)
except OSError:
log.warning("Image file %s missing", filename)
return "<svg></svg>"
@@ -99,8 +102,8 @@ class Drawing:
log.error(f"Can't parse SVG: {e}")
return
# SVG is the default namespace no need to prefix it
ET.register_namespace('xmlns', "http://www.w3.org/2000/svg")
ET.register_namespace('xmlns:xlink', "http://www.w3.org/1999/xlink")
ET.register_namespace("xmlns", "http://www.w3.org/2000/svg")
ET.register_namespace("xmlns:xlink", "http://www.w3.org/1999/xlink")
if len(root.findall("{http://www.w3.org/2000/svg}image")) == 1:
href = "{http://www.w3.org/1999/xlink}href"
@@ -208,7 +211,7 @@ class Drawing:
"z": self._z,
"locked": self._locked,
"rotation": self._rotation,
"svg": self._svg
"svg": self._svg,
}
return {
"project_id": self._project.id,
@@ -218,7 +221,7 @@ class Drawing:
"z": self._z,
"locked": self._locked,
"rotation": self._rotation,
"svg": self.svg
"svg": self.svg,
}
def __repr__(self):