Commit 7a4efd5
fix(types): annotate the shared _to_price helper for mypy
CI's mypy step failed on the new helper with 8 errors across both clients:
'Missing type parameters for generic type dict' and incompatible argument
types for commodity/value/timestamp.
The errors are real but not new behaviour — the previous Price(**mapped_data)
form passed a dict of kwargs, which mypy cannot check, so the same looseness
was always there and simply invisible. Writing the call out explicitly exposed
it.
Typed the parameter as Dict[str, Any] and cast the three fields pydantic
validates anyway, with a comment saying why the casts are there. Not silenced
with type: ignore — the shape is genuinely Any coming off JSON, and pydantic
raises on anything actually wrong.
mypy on both files: 0 errors.
Full suite still 645 passed. Live smoke re-run after the change:
5 codes -> 1 request, 5 prices, BRENT_CRUDE_USD $93.60
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JKAExynd9zoKwt6rYA66EA1 parent af0f6a4 commit 7a4efd5
2 files changed
Lines changed: 23 additions & 13 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
12 | | - | |
| 12 | + | |
| 13 | + | |
13 | 14 | | |
14 | 15 | | |
15 | 16 | | |
| |||
375 | 376 | | |
376 | 377 | | |
377 | 378 | | |
378 | | - | |
379 | | - | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
380 | 385 | | |
381 | | - | |
382 | | - | |
| 386 | + | |
| 387 | + | |
383 | 388 | | |
384 | | - | |
385 | | - | |
| 389 | + | |
| 390 | + | |
386 | 391 | | |
387 | 392 | | |
388 | 393 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | | - | |
| 10 | + | |
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
30 | | - | |
| 30 | + | |
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
34 | 39 | | |
35 | 40 | | |
36 | | - | |
37 | | - | |
| 41 | + | |
| 42 | + | |
38 | 43 | | |
39 | 44 | | |
40 | 45 | | |
41 | | - | |
42 | | - | |
| 46 | + | |
| 47 | + | |
43 | 48 | | |
44 | 49 | | |
45 | 50 | | |
| |||
0 commit comments