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
While working on this, I have been frustrated by model diffs producing unexpected results because they have tried to compare a list of E-mail addresses with a tuple of E-mail addresses, and finding that they differ.
There are, broadly, 2 possible ways to fix this:
Use mypy, a static type checker for python, to check that we're using appropriate types.
I don't think type_enforced will work. While trying to use it, its type enforcer complains about how dataclasses implements generating default values, i.e.
TypeError: (User.__init__): Type mismatch for typed variable `email`. Expected one of the following `[tuple[str]]` but got `<class 'dataclasses._HAS_DEFAULT_FACTORY_CLASS'>` instead.
If that doesn't work: give up and just add a __post_init() method to the User and Group classes which tries to convert the emails and groups fields into tuples.
While working on this, I have been frustrated by model diffs producing unexpected results because they have tried to compare a list of E-mail addresses with a tuple of E-mail addresses, and finding that they differ.
There are, broadly, 2 possible ways to fix this:
The text was updated successfully, but these errors were encountered: