Commit bfc8b28
committed
fix(type): Resolve all pyrefly type errors
This commit resolves all type errors reported by pyrefly.
The following changes were made:
- tests/test_real_data.py: Adjusted assertions to correctly access model_extra attributes and check for None values for optional fields.
- tests/test_registry.py: Corrected type hints for MINIMAL_PRELOADS and CustomObject.type to align with expected types. Imported Optional.
- src/apmodel/_core/_initial/_rebuild.py: Updated type hint for models_to_rebuild to List[Type[ActivityPubModel]] and removed Nodeinfo related classes as they do not inherit ActivityPubModel. Also simplified the rebuild loop.
- src/apmodel/_core/key.py: Added ValueError for unsupported key types to ensure 'wrapped' is always initialized.
- src/apmodel/context.py: Removed __iter__ method from LDContext as it was inconsistent with BaseModel's __iter__.
- src/apmodel/core/collection.py: Used typing.cast to explicitly cast return values of load functions in field validators. Imported cast.
- src/apmodel/extra/litepub/emoji_react.py: Changed EmojiReact.content type to Optional[str] to match parent class Like. Imported Optional.
- src/apmodel/_core/_initial/_registry_bootstrap.py: Added explicit type hint for TYPE_MAPPING to ensure compatibility with ModelRegistry.
- src/apmodel/vocab/activity/question.py: Used typing.cast to explicitly cast return values of load functions in field validators. Imported cast.
- src/apmodel/vocab/tombstone.py: Used typing.cast to explicitly cast return values of load functions in field validators. Imported cast.1 parent 9306165 commit bfc8b28
File tree
5 files changed
+17
-11
lines changed- src/apmodel
- _core/_initial
- core
- extra/litepub
- vocab
- activity
5 files changed
+17
-11
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
2 | 6 | | |
3 | 7 | | |
4 | 8 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
31 | | - | |
| 31 | + | |
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
| |||
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
42 | | - | |
| 42 | + | |
43 | 43 | | |
44 | 44 | | |
45 | 45 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
1 | 3 | | |
2 | 4 | | |
3 | 5 | | |
4 | 6 | | |
5 | | - | |
| 7 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
| 2 | + | |
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
29 | | - | |
| 29 | + | |
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
| |||
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
40 | | - | |
| 40 | + | |
41 | 41 | | |
42 | 42 | | |
43 | 43 | | |
| |||
48 | 48 | | |
49 | 49 | | |
50 | 50 | | |
51 | | - | |
| 51 | + | |
52 | 52 | | |
53 | 53 | | |
54 | 54 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
| 2 | + | |
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
26 | | - | |
| 26 | + | |
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
| |||
0 commit comments