(cls, text: str)
| 350 | |
| 351 | @classmethod |
| 352 | def from_json(cls, text: str) -> SchematicData: |
| 353 | data = json.loads(text) |
| 354 | components = [ |
| 355 | ComponentData( |
| 356 | symbol_name=_SYMBOL_NAME_MIGRATION.get(c["symbol_name"], c["symbol_name"]), |
| 357 | instance_id=c["instance_id"], |
| 358 | x=c["x"], |
| 359 | y=c["y"], |
| 360 | rotation=c.get("rotation", 0.0), |
| 361 | h_flip=c.get("h_flip", False), |
| 362 | v_flip=c.get("v_flip", False), |
| 363 | params=c.get("params", {}), |
| 364 | model=c.get("model", ""), |
| 365 | refs=c.get("refs", []), |
| 366 | prop_display=c.get("prop_display", {"refdes": [True, False]}), |
| 367 | prop_offsets=c.get("prop_offsets", {}), |
| 368 | ) |
| 369 | for c in data.get("components", []) |
| 370 | ] |
| 371 | wires = [ |
| 372 | WireData( |
| 373 | points=[tuple(p) for p in w["points"]], |
| 374 | net_name=w.get("net_name"), |
| 375 | display_name=w.get("display_name", False), |
| 376 | label_offset=tuple(w.get("label_offset", [0.0, -3.0])), |
| 377 | net_locked=w.get("net_locked", False), |
| 378 | user_net_name=w.get("user_net_name"), |
| 379 | ) |
| 380 | for w in data.get("wires", []) |
| 381 | ] |
| 382 | junctions = [ |
| 383 | JunctionData(x=j["x"], y=j["y"]) |
| 384 | for j in data.get("junctions", []) |
| 385 | ] |
| 386 | free_texts = [ |
| 387 | FreeTextData(x=t["x"], y=t["y"], text=t.get("text", "")) |
| 388 | for t in data.get("free_texts", []) |
| 389 | ] |
| 390 | hyperlinks = [ |
| 391 | HyperlinkData(x=h["x"], y=h["y"], |
| 392 | url=h.get("url", ""), label=h.get("label", "")) |
| 393 | for h in data.get("hyperlinks", []) |
| 394 | ] |
| 395 | commands = [ |
| 396 | CommandData(x=c["x"], y=c["y"], text=c.get("text", "")) |
| 397 | for c in data.get("commands", []) |
| 398 | ] |
| 399 | libs = [ |
| 400 | LibraryData( |
| 401 | x=l["x"], y=l["y"], file_path=l["file_path"], |
| 402 | directive=l.get("directive", "lib"), |
| 403 | simulator=l.get("simulator", "SLiCAP"), |
| 404 | corner=l.get("corner", ""), |
| 405 | ) |
| 406 | for l in data.get("libs", []) |
| 407 | ] |
| 408 | images = [ |
| 409 | ImageData( |
no test coverage detected