c3
c3 copied to clipboard
Reoccurring pattern of usage `try-except`
Describe the issue
I just came across the extensive usage of the following pattern, see screenshot, try-except to check whether a key exists in a dictionary. I want to propose the usage of configuration validators or use strictly defined record types such as dataclasses-json.
This can be re-written to the following to be more explicit and readable to the user.
if not "algorithm" in cfg:
raise ...
algorithm_name = cfg["algorithm"]
if not algorithm_name in algorithms:
raise ...
There is also a typo: Unkown should be Unknown in C3:ERROR:Unkown sampling method
Screenshots
