Conversation
|
would be nice indeed! |
D-stefaang
reviewed
Jun 1, 2021
| t: str | ||
|
|
||
| def from_dict(data_class, data, config): | ||
| data["t"] = "prefix {}".format(data["t"]) |
There was a problem hiding this comment.
This prefix can be done with the builtin __post_init__ too
Author
There was a problem hiding this comment.
Yes, but this is just an example. The main goal is to have a place to reshape the dictionary before we create a data class from it.
|
Is there any plan to land these changes? I would very much like this feature to be landed. Or is there a good workaround to achieve the same behavior? |
Author
|
@mwerlberger you can use my fork for now https://pypi.org/project/tonalite/ |
Author
|
@konradhalas I've updated the MR as I can see some life in this repository again. |
Author
|
@mciszczon can we merge this feature? |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In some cases when loading a nested structure of data classes you might need to do a customization for some of them. This change allows customizing a
from_dictmethod for each data class.Code sample from the test