mirror of
https://github.com/GNS3/gns3-server.git
synced 2026-10-12 05:25:31 +03:00
style: apply ruff format to drawing builder files
This commit is contained in:
parent
cff42e32e8
commit
23f117de51
@ -245,9 +245,7 @@ def generate_ellipse_svg(
|
||||
svg_height: int,
|
||||
) -> str:
|
||||
"""Generate SVG for ellipse (delegates to the shared Web UI compatible builder)."""
|
||||
svg, _, _ = build_ellipse_svg(
|
||||
rx * 2, ry * 2, fill=color_scheme["fill"], fill_opacity=color_scheme["fill_opacity"]
|
||||
)
|
||||
svg, _, _ = build_ellipse_svg(rx * 2, ry * 2, fill=color_scheme["fill"], fill_opacity=color_scheme["fill_opacity"])
|
||||
return svg
|
||||
|
||||
|
||||
@ -257,9 +255,7 @@ def generate_rectangle_svg(
|
||||
color_scheme: dict[str, Any],
|
||||
) -> str:
|
||||
"""Generate SVG for rectangle (delegates to the shared Web UI compatible builder)."""
|
||||
svg, _, _ = build_rectangle_svg(
|
||||
width, height, fill=color_scheme["fill"], fill_opacity=color_scheme["fill_opacity"]
|
||||
)
|
||||
svg, _, _ = build_rectangle_svg(width, height, fill=color_scheme["fill"], fill_opacity=color_scheme["fill_opacity"])
|
||||
return svg
|
||||
|
||||
|
||||
|
||||
@ -203,7 +203,7 @@ def build_rectangle_svg(
|
||||
|
||||
svg = (
|
||||
f'<svg height="{height}" width="{width}">'
|
||||
f'<rect {_style_attrs(fill, fill_opacity, stroke, stroke_width, dash)} '
|
||||
f"<rect {_style_attrs(fill, fill_opacity, stroke, stroke_width, dash)} "
|
||||
f'height="{height}" width="{width}" rx="{rx}" ry="{rx}"/></svg>'
|
||||
)
|
||||
ET.fromstring(svg)
|
||||
@ -241,7 +241,7 @@ def build_ellipse_svg(
|
||||
|
||||
svg = (
|
||||
f'<svg height="{2 * ry}" width="{2 * rx}">'
|
||||
f'<ellipse {_style_attrs(fill, fill_opacity, stroke, stroke_width, dash)} '
|
||||
f"<ellipse {_style_attrs(fill, fill_opacity, stroke, stroke_width, dash)} "
|
||||
f'cx="{rx}" cy="{ry}" rx="{rx}" ry="{ry}"/></svg>'
|
||||
)
|
||||
ET.fromstring(svg)
|
||||
|
||||
@ -108,7 +108,9 @@ class TestBuildRectangleSvg:
|
||||
assert "stroke" not in svg
|
||||
|
||||
def test_stroke_and_dashed(self):
|
||||
svg, _, _ = build_rectangle_svg(80, 50, fill="none", fill_opacity=0.5, stroke="#333333", stroke_width=2, dashed=True)
|
||||
svg, _, _ = build_rectangle_svg(
|
||||
80, 50, fill="none", fill_opacity=0.5, stroke="#333333", stroke_width=2, dashed=True
|
||||
)
|
||||
assert 'fill="none"' in svg
|
||||
assert 'fill-opacity="0.5"' in svg
|
||||
assert 'stroke="#333333" stroke-width="2" stroke-dasharray="10,6"' in svg
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user