Skip to content

Commit

Permalink
Checking required arguments in AttrDict does not work in the nested s…
Browse files Browse the repository at this point in the history
…etting. Removed the check, will need to be added back in main.py.
  • Loading branch information
fredericpoitevin committed Apr 14, 2022
1 parent 4622d77 commit 07b410f
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 11 deletions.
11 changes: 0 additions & 11 deletions btx/misc/shortcuts.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ def __init__(self, mapping=None, *args, **kwargs):
if mapping is not None:
for key, value in mapping.items():
self.__setitem__(key, value)
self.check_required_arguments()

def __setitem__(self, key, value):
if isinstance(value, dict):
Expand All @@ -37,13 +36,3 @@ def __getattr__(self, item):
return self.__getitem__(item)
except KeyError:
raise AttributeError(item)

def check_required_arguments(self):
"""Check that the config object has required attributes."""
if not hasattr(self, 'setup'):
print(f"Error: required argument 'global' is not configured.")
return -1
else:
if not hasattr(self.setup, 'root_dir'):
print(f"Error: required argument 'global.root_dir' is not configured.")
return -1
1 change: 1 addition & 0 deletions scripts/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ def main():
task = parser.parse_args().task
with open(config_filepath, "r") as config_file:
config = AttrDict(yaml.safe_load(config_file))
#TODO: check required arguments in config dictionary here.

# Create output directory.
if not conditional_mkdir(config.setup.root_dir):
Expand Down

0 comments on commit 07b410f

Please sign in to comment.