Commit ae2616e
@
refactor: simplify female sprite fallback per review
The sprites model field is a JSONField, so it is always decoded to a
python dict on read: drop the string/json.loads/json.dumps branch which
would have returned an escaped JSON string in the response.
Simplify get_pokemon_sprites to a positive guard and narrow its return
type to dict[str, Any]. In _fill_female_sprites, type the parameter as
dict[str, Any] and move the isinstance check into the recursion loop
instead of guarding at the function entry, which also removes a cast.
Align the test fixture with data/v2/build.py: it double-encoded the
sprites dict with json.dumps before storing it in the JSONField.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@1 parent 457211b commit ae2616e
2 files changed
Lines changed: 11 additions & 19 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | | - | |
7 | 6 | | |
8 | 7 | | |
9 | 8 | | |
| |||
2942 | 2941 | | |
2943 | 2942 | | |
2944 | 2943 | | |
2945 | | - | |
| 2944 | + | |
2946 | 2945 | | |
2947 | 2946 | | |
2948 | 2947 | | |
2949 | | - | |
2950 | | - | |
2951 | | - | |
2952 | | - | |
2953 | | - | |
2954 | | - | |
2955 | | - | |
2956 | | - | |
| 2948 | + | |
| 2949 | + | |
| 2950 | + | |
2957 | 2951 | | |
2958 | 2952 | | |
2959 | | - | |
2960 | | - | |
2961 | | - | |
2962 | | - | |
| 2953 | + | |
2963 | 2954 | | |
2964 | 2955 | | |
2965 | 2956 | | |
2966 | 2957 | | |
2967 | | - | |
| 2958 | + | |
| 2959 | + | |
2968 | 2960 | | |
2969 | 2961 | | |
2970 | 2962 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1631 | 1631 | | |
1632 | 1632 | | |
1633 | 1633 | | |
1634 | | - | |
| 1634 | + | |
1635 | 1635 | | |
1636 | 1636 | | |
1637 | 1637 | | |
| |||
4523 | 4523 | | |
4524 | 4524 | | |
4525 | 4525 | | |
4526 | | - | |
| 4526 | + | |
4527 | 4527 | | |
4528 | | - | |
| 4528 | + | |
4529 | 4529 | | |
4530 | 4530 | | |
4531 | 4531 | | |
| |||
4660 | 4660 | | |
4661 | 4661 | | |
4662 | 4662 | | |
4663 | | - | |
| 4663 | + | |
4664 | 4664 | | |
4665 | 4665 | | |
4666 | 4666 | | |
| |||
0 commit comments