Skip to content

Commit

Permalink
Configget (#250)
Browse files Browse the repository at this point in the history
* added get method to config object

* add default for config.get
  • Loading branch information
jreadey authored Jan 24, 2025
1 parent 8734376 commit 5f4c48c
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions h5pyd/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,13 @@ def __getitem__(self, name):
return None
return Config._cfg[name]

def get(self, name, default):
""" return option for name if found, otherwise default """
val = self.__getitem__(name)
if val is None:
val = default
return val

def __setitem__(self, name, obj):
""" set config item """
Config._cfg[name] = obj
Expand Down

0 comments on commit 5f4c48c

Please sign in to comment.