Created
October 15, 2019 13:02
-
-
Save TheLittleNaruto/cb9b9b3860caae75f1959b045cd18eb5 to your computer and use it in GitHub Desktop.
helper methods to serialize and deserialize objects
This file contains 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
def user_from_dict(s: Dict[str, Any]) -> User: | |
return User(**s) | |
def user_to_dict(x: User) -> Dict[str, Any]: | |
return vars(x) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment