-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: Improve typing of classify_field() (#132)
This addresses a part of the code base that had a lot of type ignores. This was due to how the return type of the `classify_field()` function did not maintain the relationship of its two values, and not having precise enough information for the case when the inner type is a subtype of `Entity`. By introducing specialized types for each four cases in conjunction with a union return type, mypy is able to much better keep track of the relationship that a field classified as an "entity field" must carry a type that is a subtype of `Entity`. As can be seen in the diff, test_introspect.py is the only changed test module, this only has fallout on the internal introspection API. The improvement and intent of this commit is to reduce the amount of type ignores in `get_field_reader()` and `get_field_writer()`. Co-authored-by: Anton Agestam <anton.agestam@aiven.io>
- Loading branch information
1 parent
5262430
commit c30f54b
Showing
4 changed files
with
112 additions
and
80 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters