Skip to content

Commit

Permalink
🐛 Fix get_optional method in ConfigSubView
Browse files Browse the repository at this point in the history
  • Loading branch information
mnixry committed Apr 23, 2024
1 parent e59b477 commit a8a4108
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion hibiapi/utils/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,10 @@ def get(self, template: type[_T] | None = None) -> Any | _T: # type: ignore
return object_

def get_optional(self, template: type[_T]) -> _T | None:
return self.get(Optional[template]) # type: ignore
try:
return self.get(template)
except Exception:
return None

def as_str(self) -> str:
return self.get(str)
Expand Down

0 comments on commit a8a4108

Please sign in to comment.