marshmallow
marshmallow copied to clipboard
Add return type to `fields.Email.__init__` so that it's not untyped
This merge request adds a type hint to fields.Email
's `init method to avoid no untyped call errors in mypy for library consumers.
Is this specific to Email
field?
This was the only field
from marshmallow
in my codebase that was triggering this mypy behavior. I'm not sure if any others do though
From those discussions
- https://github.com/python/mypy/issues/3358
- https://github.com/python/mypy/issues/604
- https://github.com/python/mypy/pull/5677
Explicit -> None
is needed if init func has no argument. I guess *args
and **kwargs
don't count.
Form a quick check, Email
is the only concerned field. Although IPInterface.__init__
lacks typing (fixed in #2036).
Thank you :) I can look at expanding types if you are interested in a future PR, I just wasn't sure what the responsiveness of the team was, so I was rather hesitant to expand the scope too far.
Well, don't expect us to be quick to review and merge (see current backlog), but quality PRs are absolutely welcome.
(And if you're good at type hinting, I wouldn't mind a helping hand for #1896.)
Thanks!
Course, I'll take a look when I have a few moments. I've been trying to work a lot more lately with the typeshed team to get feedback from the source about how to use type hints correctly and effectively, so I'm happy to see if I may be able to assist with that. I'll need to pull it down and run mypy against it as currently it looks like the build log was deleted, so can't view the historic error from mypy