MCPcopy Create free account
hub / github.com/SLiCAP/SLiCAP_python / _parse_svg_length

Function _parse_svg_length

SLiCAP/schematic/export.py:37–45  ·  view source on GitHub ↗

Parse an SVG length string, stripping any unit suffix (mm, pt, px …).

(s, fallback: float)

Source from the content-addressed store, hash-verified

35
36
37def _parse_svg_length(s, fallback: float) -> float:
38 """Parse an SVG length string, stripping any unit suffix (mm, pt, px …)."""
39 m = _SVG_LENGTH_RE.match(str(s)) if s else None
40 if m:
41 try:
42 return float(m.group(1))
43 except ValueError:
44 pass
45 return fallback
46
47
48def _svg_length_to_px(s, fallback: float) -> float:

Callers

nothing calls this directly

Calls 1

groupMethod · 0.80

Tested by

no test coverage detected