Commit e0a547a
committed
Refactor: unify suews-convert under a single entry point (gh#1304)
The yaml-upgrade subcommand introduced in #1306 was a false split: all
three converter paths (legacy tables, df_state, older YAML) produce the
same artefact - a current-schema YAML - so the CLI only needs one
entry. Per Ting: "output 永远是 current-schema YAML, 没必要分子命令."
* `src/supy/cmd/table_converter.py`: drop the `yaml-upgrade`
subcommand; the root `suews-convert -i <in> -o <out> [-f <from>]`
now auto-detects by file extension and dispatches to
`upgrade_yaml` for `*.yml`/`*.yaml` inputs in addition to the
existing table / df_state paths.
* `-f/--from` loses the hard `click.Choice(list_ver_from)` so it can
carry a table release, a supy release tag, or a schema version;
per-input validation now lives in the command body (clear error for
unknown table releases on nml input).
* `src/supy/util/converter/__init__.py::detect_input_type` learns
the `yaml` category so the dispatcher stays ignorant of filename
conventions.
* `src/supy/util/converter/yaml_upgrade.py`: drop the unused
`assume_yes` parameter (YAGNI) and retune the log / error
messages to reference `-f/--from` instead of the old
`-f/--from-ver` flag name.
* `src/supy/data_model/core/config.py`: update the schema-drift hint
to point at `suews-convert -i <old.yml> -o <new.yml>` (bare
command when a signature is present, `+ -f <release-tag>` when
not) - matches the new CLI shape and avoids directing users at a
command that no longer exists.
Tests updated to exercise the unified path: `test_yaml_upgrade.py::
TestSuewsConvertYamlPath` invokes the root command with a YAML input
(with and without `-f`); `test_from_yaml_errors.py` asserts the
updated hint text. 25 tests in `test/data_model/test_yaml_upgrade.py`
+ `test_release_compat.py` + `test_from_yaml_errors.py` pass; full
`test/data_model/` suite stays at 423 passed / 4 skipped. CLI-surface
tests in `test/core/test_cli_conversion.py` + `test_cli_run.py` still
green (21 passed).
#1306 hadn't been in any release, so no external users are touching
the removed subcommand - the consolidation is pure simplification.
Refs #1301, #1304.1 parent 166c584 commit e0a547a
File tree
7 files changed
+150
-155
lines changed- src/supy
- cmd
- data_model/core
- util/converter
- test/data_model
7 files changed
+150
-155
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
56 | 56 | | |
57 | 57 | | |
58 | 58 | | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
59 | 63 | | |
60 | 64 | | |
61 | 65 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
18 | | - | |
19 | | - | |
| 18 | + | |
20 | 19 | | |
21 | 20 | | |
22 | | - | |
23 | | - | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | | - | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
28 | 29 | | |
29 | 30 | | |
30 | 31 | | |
31 | 32 | | |
32 | 33 | | |
33 | 34 | | |
34 | | - | |
35 | | - | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
36 | 40 | | |
37 | 41 | | |
38 | 42 | | |
39 | 43 | | |
40 | 44 | | |
41 | 45 | | |
42 | 46 | | |
43 | | - | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
44 | 51 | | |
45 | 52 | | |
46 | 53 | | |
| |||
56 | 63 | | |
57 | 64 | | |
58 | 65 | | |
59 | | - | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
60 | 70 | | |
61 | 71 | | |
62 | 72 | | |
| |||
66 | 76 | | |
67 | 77 | | |
68 | 78 | | |
69 | | - | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
70 | 83 | | |
71 | 84 | | |
72 | 85 | | |
| |||
77 | 90 | | |
78 | 91 | | |
79 | 92 | | |
80 | | - | |
| 93 | + | |
81 | 94 | | |
82 | | - | |
83 | | - | |
84 | | - | |
85 | | - | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
86 | 98 | | |
87 | 99 | | |
88 | | - | |
| 100 | + | |
89 | 101 | | |
90 | 102 | | |
91 | | - | |
| 103 | + | |
92 | 104 | | |
93 | 105 | | |
94 | | - | |
95 | | - | |
96 | | - | |
97 | | - | |
98 | | - | |
99 | | - | |
100 | | - | |
| 106 | + | |
| 107 | + | |
101 | 108 | | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
102 | 112 | | |
103 | 113 | | |
104 | 114 | | |
| |||
126 | 136 | | |
127 | 137 | | |
128 | 138 | | |
129 | | - | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
130 | 159 | | |
131 | 160 | | |
132 | 161 | | |
| |||
144 | 173 | | |
145 | 174 | | |
146 | 175 | | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
147 | 184 | | |
148 | 185 | | |
149 | 186 | | |
150 | 187 | | |
151 | 188 | | |
152 | 189 | | |
153 | 190 | | |
154 | | - | |
155 | | - | |
156 | | - | |
| 191 | + | |
157 | 192 | | |
158 | | - | |
| 193 | + | |
159 | 194 | | |
160 | 195 | | |
161 | 196 | | |
| |||
171 | 206 | | |
172 | 207 | | |
173 | 208 | | |
174 | | - | |
175 | | - | |
176 | | - | |
177 | | - | |
178 | | - | |
179 | | - | |
180 | | - | |
181 | | - | |
182 | | - | |
183 | | - | |
184 | | - | |
185 | | - | |
186 | | - | |
187 | | - | |
188 | | - | |
189 | | - | |
190 | | - | |
191 | | - | |
192 | | - | |
193 | | - | |
194 | | - | |
195 | | - | |
196 | | - | |
197 | | - | |
198 | | - | |
199 | | - | |
200 | | - | |
201 | | - | |
202 | | - | |
203 | | - | |
204 | | - | |
205 | | - | |
206 | | - | |
207 | | - | |
208 | | - | |
209 | | - | |
210 | | - | |
211 | | - | |
212 | | - | |
213 | | - | |
214 | | - | |
215 | | - | |
216 | | - | |
217 | | - | |
218 | | - | |
219 | | - | |
220 | | - | |
221 | | - | |
222 | | - | |
223 | | - | |
224 | | - | |
225 | | - | |
226 | | - | |
227 | | - | |
228 | | - | |
229 | | - | |
230 | | - | |
231 | | - | |
232 | | - | |
233 | | - | |
234 | | - | |
235 | | - | |
236 | | - | |
237 | | - | |
238 | | - | |
239 | | - | |
240 | | - | |
241 | | - | |
242 | | - | |
243 | | - | |
244 | 209 | | |
245 | 210 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3667 | 3667 | | |
3668 | 3668 | | |
3669 | 3669 | | |
3670 | | - | |
3671 | | - | |
| 3670 | + | |
| 3671 | + | |
3672 | 3672 | | |
3673 | 3673 | | |
3674 | 3674 | | |
| |||
3765 | 3765 | | |
3766 | 3766 | | |
3767 | 3767 | | |
3768 | | - | |
3769 | | - | |
3770 | | - | |
| 3768 | + | |
3771 | 3769 | | |
3772 | 3770 | | |
3773 | 3771 | | |
3774 | 3772 | | |
3775 | 3773 | | |
3776 | 3774 | | |
3777 | | - | |
3778 | | - | |
| 3775 | + | |
3779 | 3776 | | |
3780 | 3777 | | |
3781 | 3778 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
| 30 | + | |
30 | 31 | | |
31 | 32 | | |
32 | 33 | | |
| |||
40 | 41 | | |
41 | 42 | | |
42 | 43 | | |
43 | | - | |
| 44 | + | |
| 45 | + | |
44 | 46 | | |
45 | 47 | | |
46 | 48 | | |
47 | 49 | | |
48 | 50 | | |
49 | 51 | | |
50 | 52 | | |
| 53 | + | |
| 54 | + | |
51 | 55 | | |
52 | 56 | | |
53 | 57 | | |
54 | | - | |
| 58 | + | |
| 59 | + | |
55 | 60 | | |
56 | 61 | | |
57 | 62 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
206 | 206 | | |
207 | 207 | | |
208 | 208 | | |
209 | | - | |
210 | 209 | | |
211 | 210 | | |
212 | 211 | | |
| |||
219 | 218 | | |
220 | 219 | | |
221 | 220 | | |
222 | | - | |
223 | | - | |
224 | | - | |
225 | 221 | | |
226 | 222 | | |
227 | 223 | | |
| |||
235 | 231 | | |
236 | 232 | | |
237 | 233 | | |
238 | | - | |
| 234 | + | |
239 | 235 | | |
240 | 236 | | |
241 | 237 | | |
| |||
244 | 240 | | |
245 | 241 | | |
246 | 242 | | |
247 | | - | |
| 243 | + | |
248 | 244 | | |
249 | 245 | | |
250 | 246 | | |
251 | 247 | | |
252 | | - | |
| 248 | + | |
253 | 249 | | |
254 | 250 | | |
255 | 251 | | |
| |||
0 commit comments