Last active
June 12, 2021 12:36
-
-
Save cassioeskelsen/244064c3376df57fa1b6345ff1758b43 to your computer and use it in GitHub Desktop.
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
| from dataclasses import dataclass | |
| @dataclass(eq=True) | |
| class State: | |
| name: str | |
| Id: str = None # actually, state abbreviation | |
| def __hash__(self) -> int: | |
| return hash(self.Id) | |
| @dataclass(eq=True, unsafe_hash=True) | |
| class Address: | |
| address: str | |
| complement: str | |
| zip_code: int | |
| city: str | |
| state: State | |
| @dataclass(eq=True) | |
| class Customer: | |
| name: str | |
| address: Address | |
| document: str | |
| Id: str = None | |
| def __hash__(self) -> int: | |
| return hash(self.Id) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment