Repository navigation
Commit 0500a37
docs(zarr-metadata): the narrow configuration type is sound, not a compromise
The previous wording justified keeping `Mapping[str, JSONValue]` by what
widening did to this package's Hypothesis strategies. That is backwards:
a test utility's behaviour is a fact about the utility, not an argument
about a type.
The real reason is that the conversion mypy refuses is sound here. Mypy's
rule exists because an ordinary TypedDict may carry extra items of
undeclared types, so the union of declared value types does not bound the
mapping. Every TypedDict in this package is `closed` (PEP 728), which
forbids that; pyright implements PEP 728 and accepts the assignment, and
mypy has not implemented it yet (python/mypy#8994, python/mypy#18439).
So the annotation is accurate and stays accurate, one checker needs a
`cast` until it catches up, and widening would buy mypy's silence by
making the type say something false.
Assisted-by: ClaudeCode:claude-opus-5
Co-Authored-By: Claude Opus 5 <[email protected]>1 parent cb4e2b0 commit 0500a37
2 files changed
Lines changed: 29 additions & 15 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
26 | | - | |
27 | | - | |
28 | | - | |
29 | | - | |
30 | | - | |
31 | | - | |
32 | | - | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
42 | | - | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | | - | |
47 | | - | |
48 | | - | |
49 | | - | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
50 | 59 | | |
51 | 60 | | |
52 | 61 | | |
| |||
0 commit comments