File tree Expand file tree Collapse file tree 1 file changed +17
-1
lines changed Expand file tree Collapse file tree 1 file changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -106,6 +106,22 @@ def array(
106106Block = dict [str , Attribute ]
107107
108108
109+ def _block_sort_key (item ) -> int :
110+ k , _ = item
111+ if k == "options" :
112+ return 0
113+ elif k == "dimensions" :
114+ return 1
115+ elif k == "griddata" :
116+ return 2
117+ elif k == "packagedata" :
118+ return 3
119+ elif k == "perioddata" :
120+ return 4
121+ else :
122+ return 5
123+
124+
109125def blocks (cls ) -> list [list [Attribute ]]:
110126 """Return an ordered list of blocks for a component class."""
111127 return [list (v .values ()) for v in blocks_dict (cls ).values ()]
@@ -125,4 +141,4 @@ def blocks_dict(cls) -> dict[str, Block]:
125141 if block not in blocks :
126142 blocks [block ] = {}
127143 blocks [block ][k ] = v
128- return blocks
144+ return dict ( sorted ( blocks . items (), key = _block_sort_key ))
You can’t perform that action at this time.
0 commit comments