voxel51/eta

Add an `eta.core.config.Config.parse_categorical_value` method to parse categorical config fields

brimoor opened this issue · 1 comments

It would be useful to have an eta.core.config.Config.parse_categorical_value() method that enforces that the user must provide one of a certain set of values:

class MyConfig(Config):

    def __init__(self, d);
        self.value = self.parse_categorical_value(d, "value", ["a", "b", "c"])

This is similar to #57 but the value is returned directly, not a key-value pair lookup.