[PyYAML] Use Incomplete instead of Any - #16197
Conversation
In general a type alias would also double as documentation and would make the comment for |
|
Since any object can be passed as input (to 'dump' functions), I used the same type alias for it as well. It looks like we do need to use Any for both input and output types after all, just for different reasons. |
|
Diff from mypy_primer, showing the effect of this PR on open source code: operator (https://github.com/canonical/operator)
- ops/storage.py:361: error: Unused "type: ignore" comment [unused-ignore]
schemathesis (https://github.com/schemathesis/schemathesis)
+ src/schemathesis/core/deserialization.py:149: error: Unused "type: ignore" comment [unused-ignore]
+ src/schemathesis/core/deserialization.py:157: error: Unused "type: ignore" comment [unused-ignore]
|
In some places,
Anywas intended to represent a Python object corresponding to aYAMLvalue.I think we could be more precise than simply using
Anyhere for example, by defining aTypeAliasfor the possible types (list,dict, etc.) and adding a comment explaining the choice.