Commit 5ff8d7f
authored
fix(dfns): remove fkeys/ref; add DfnSpec.dump/s() (#305)
Add DfnSpec.dump() and DfnSpec.dumps() methods to serialize the full spec to a single hierarchical TOML blob. This standalone representation might be more convenient than a directory of files for some use cases. E.g., MF6 could emit the entire spec as a TOML blob (MODFLOW-ORG/modflow6#2777) for flopy to generate an MF6 module from, e.g.
mf6 --spec | flopy.mf6.utils.generate_classes -
Also remove the fkeys attribute/concept (field-level foreign keys encoding subpackage attachment) and Ref dataclass. Represent "floating" subpackage relationships (i.e., a subpackage may be attached to one of several possible parent components) instead via the existing Dfn.subcomponents field, which lists the string names of component types a given component can accept as subpackages. This is simpler and more consistent with how fixed-parent hierarchy is already handled via Dfn.children. Also normalize subcomponent abbreviations to lowercase to match component name conventions elsewhere.1 parent 4e8ff99 commit 5ff8d7f
3 files changed
Lines changed: 30 additions & 24 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
32 | | - | |
33 | 32 | | |
34 | 33 | | |
35 | 34 | | |
| |||
61 | 60 | | |
62 | 61 | | |
63 | 62 | | |
64 | | - | |
65 | 63 | | |
66 | 64 | | |
67 | 65 | | |
| |||
106 | 104 | | |
107 | 105 | | |
108 | 106 | | |
109 | | - | |
110 | | - | |
111 | | - | |
112 | 107 | | |
113 | 108 | | |
114 | 109 | | |
| |||
125 | 120 | | |
126 | 121 | | |
127 | 122 | | |
128 | | - | |
129 | 123 | | |
130 | 124 | | |
131 | 125 | | |
| |||
258 | 252 | | |
259 | 253 | | |
260 | 254 | | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
261 | 272 | | |
262 | 273 | | |
263 | 274 | | |
| |||
563 | 574 | | |
564 | 575 | | |
565 | 576 | | |
566 | | - | |
567 | 577 | | |
568 | 578 | | |
569 | 579 | | |
570 | 580 | | |
571 | 581 | | |
572 | 582 | | |
| 583 | + | |
| 584 | + | |
| 585 | + | |
| 586 | + | |
| 587 | + | |
| 588 | + | |
| 589 | + | |
| 590 | + | |
| 591 | + | |
| 592 | + | |
| 593 | + | |
573 | 594 | | |
574 | 595 | | |
575 | 596 | | |
| |||
618 | 639 | | |
619 | 640 | | |
620 | 641 | | |
621 | | - | |
622 | 642 | | |
623 | 643 | | |
624 | 644 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
101 | 101 | | |
102 | 102 | | |
103 | 103 | | |
104 | | - | |
| 104 | + | |
105 | 105 | | |
106 | 106 | | |
107 | 107 | | |
108 | 108 | | |
109 | | - | |
110 | 109 | | |
111 | 110 | | |
112 | 111 | | |
113 | 112 | | |
114 | | - | |
| 113 | + | |
115 | 114 | | |
116 | 115 | | |
117 | 116 | | |
| |||
This file was deleted.
0 commit comments