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

Function wrap_braces

SLiCAP/schematic/component_item.py:244–255  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

242
243
244def 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

Callers 2

update_labelsMethod · 0.85
_element_linesFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected