You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
mypy gives example.py:8: error: Invalid type alias for the Age assignment that I can't seem to work around, but otherwise continues scanning the code and gives example.py:11: error: Invalid type "example.Age".
The real problem lies in changing the definition of Person to use Bounded directly.
classPerson:
age: Bounded[int, 0:150]
mypy gives: example.py:9: error: syntax error in type comment when run on this code. Notably, it gives this error even if this has # type: ignore after the line.
I'd like to be able to use these pseudo-types with mypy, or at least have a means of telling mypy to ignore them everywhere so that library consumers don't get mypy errors using it, but at a minimum, I'd expect consistency between the two examples.
The text was updated successfully, but these errors were encountered:
I see the value in such possibility (for example custom extensions to type system, documentation). But it is not easy to fix this. I think the right strategy is to just make this a non-blocking error, so that # type: ignore will work. I think we already have a similar request, but can't find the issue.
I've created a library with some pseudo-types that I'm using for validation, but I've run into some problems with using them with mypy.
Here's a trimmed down example to recreate the issue:
mypy gives
example.py:8: error: Invalid type alias
for theAge
assignment that I can't seem to work around, but otherwise continues scanning the code and givesexample.py:11: error: Invalid type "example.Age"
.The real problem lies in changing the definition of
Person
to useBounded
directly.mypy gives:
example.py:9: error: syntax error in type comment
when run on this code. Notably, it gives this error even if this has# type: ignore
after the line.I'd like to be able to use these pseudo-types with mypy, or at least have a means of telling mypy to ignore them everywhere so that library consumers don't get mypy errors using it, but at a minimum, I'd expect consistency between the two examples.
The text was updated successfully, but these errors were encountered: