We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I only want attributes to be ephemeral . I want to have them as part of the data class, but only used at run time, and I don't want them serialized.
How can I do that?
The text was updated successfully, but these errors were encountered:
You can use hooks to exclude attributes from a dictionary or mark the fields as init-only variables.
Sorry, something went wrong.
Ultimately I did end up using 'hooks', I used a post serialization hook to exclude my ivars from the resulting dict:
def __post_serialize__(self, d: Dict[Any, Any]) -> Dict[Any, Any]: d.pop('kills') d.pop('wins') d.pop('damage') return d
You can also use __pre_deserialize__ hook and fields with defaults if you want to skip specific keys on deserializarion.
__pre_deserialize__
No branches or pull requests
I only want attributes to be ephemeral . I want to have them as part of the data class, but only used at run time, and I don't want them serialized.
How can I do that?
The text was updated successfully, but these errors were encountered: