Wrap a parameter value in {…} unless already wrapped; empty stays empty. In a SLiCAP netlist every parameter value/expression is enclosed in curly braces. The user enters the bare expression; the netlist writer and LaTeX renderer add the braces via this helper.
(value: str)
| 242 | |
| 243 | |
| 244 | def wrap_braces(value: str) -> str: |
| 245 | """Wrap a parameter value in {…} unless already wrapped; empty stays empty. |
| 246 | |
| 247 | In a SLiCAP netlist every parameter value/expression is enclosed in curly |
| 248 | braces. The user enters the bare expression; the netlist writer and LaTeX |
| 249 | renderer add the braces via this helper.""" |
| 250 | s = value.strip() |
| 251 | # A bare "?" is an unset-value reminder, not an expression — never brace it |
| 252 | # (and netlist generation rejects it before output anyway). |
| 253 | if not s or s == "?" or (s.startswith("{") and s.endswith("}")): |
| 254 | return s |
| 255 | return "{" + s + "}" |
| 256 | |
| 257 | _LABEL_FONT = COMP_LABEL_FONT # refdes font (also used for LaTeX-mode prefix text) |
| 258 | _LABEL_SVG_HEIGHT = COMP_LABEL_SVG_HEIGHT |
no outgoing calls
no test coverage detected