-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Various fixes w/ help from mypy's type checking
I made `_get_matching_entity_no_optional` as a workaround to enable `get_matching_entities` to construct its entity views without having to check for `None` every time-- I'm not even sure *how* it would do that, considering the structure of the dict comprehension. So that means `get_matching_entity` no longer takes `_checked` as a keyword argument because the code for checked entities has been delegated to `_get_matching_entity_no_optional`. I also made a bunch of other changes: - Various type annotation changes to accomodate the complaints of the type checker (mypy in this case) - Changed `Aspect.__eq__`s type annotation and implementation-- Turns out that I should return `NotImplemented` if the object doesn't support operations (==, >, etc.) with its input. BUT mypy complains when it sees that `NotImplemented` is able to be returned, rather than a value of type `bool`. So I made a hack to trick mypy into thinking that the operator (method) doesn't return `NotImplemented`, but actually does so at runtime-- though it seems that the mypy team recognises this and are working on a fix/whatever. Issue Reference: - python/mypy#4534
- Loading branch information
Showing
2 changed files
with
58 additions
and
45 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