Included typing in message factory#189
Conversation
Pytest Test failed! Click here |
|
|
||
| import faust | ||
| from typing import Tuple | ||
| import typing |
There was a problem hiding this comment.
One final note: when adding types, the convention is to import types using the form
from typing import Iterable(as opposed to doing justimport typingorimport typing as torfrom typing import *).
https://mypy.readthedocs.io/en/stable/getting_started.html#the-typing-module
There was a problem hiding this comment.
The reason we import typing here is to allow more flexibility in terms of what they user can pass as message types. So that they can pass something like [("name", "str"), ("meta", "typing.Dict[str, typing.Any])]
There was a problem hiding this comment.
You mean for message_contents? Is the typing import necessary in that case?
There was a problem hiding this comment.
Yes, because we use exec() it is exactly the same as:
MessageContents(...):
a: str
b: typing.Dict(str, typing.Any)
and it needs any classes used in the type annotation to be present upon execution.
|
/retest |
Pytest Test failed! Click here |
|
/retest |
Pytest Test failed! Click here |
…nto add_typing
|
/retest |
|
/approve |
1 similar comment
|
/approve |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: fridex, KPostOffice, saisankargochhayat The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Related Issues and Dependencies
Added typing to test single messages locally