Skip to content

Commit

Permalink
Add public get method to the base class
Browse files Browse the repository at this point in the history
  • Loading branch information
oz123 committed Mar 18, 2024
1 parent 8b371ea commit cf7e9d2
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/plette/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,12 @@ def __getitem__(self, key):
value = self.__dict__[key]
return value

def get(self, key, default=None):
try:
return self[key]
except KeyError:
return default


@dataclass
class Hash(BaseModel):
Expand Down

0 comments on commit cf7e9d2

Please sign in to comment.