Return .model lines for netlist export; values are auto-wrapped in {}.
(self)
| 203 | ) |
| 204 | |
| 205 | def netlist_lines(self) -> list: |
| 206 | """Return .model lines for netlist export; values are auto-wrapped in {}.""" |
| 207 | def _wrap(v: str) -> str: |
| 208 | v = v.strip() |
| 209 | if v and not (v.startswith("{") and v.endswith("}")): |
| 210 | return "{" + v + "}" |
| 211 | return v |
| 212 | |
| 213 | header = f".model {self.model_name} {self.model_type}" |
| 214 | filled = [(n.strip(), _wrap(v)) for n, v in self.params if n.strip()] |
| 215 | if filled: |
| 216 | return [header] + [f"+ {n}={v}" for n, v in filled] |
| 217 | return [header] |