eladrich / pyrallis

Pyrallis is a framework for structured configuration parsing from both cmd and files. Simply define your desired configuration structure as a dataclass and let pyrallis do the rest!
https://eladrich.github.io/pyrallis/
MIT License
189 stars 7 forks source link

Changed enum parsing mechanism to be name based #9

Closed eladrich closed 2 years ago

eladrich commented 2 years ago

Changed enum parsing to be based on enum field names instead of values.

As discussed in #8, this allows one to support enums with non-string values such as

class LRMethod1(Enum):
    onecycle: torch.optim.lr_scheduler = OneCycleLR
    lambdalr: torch.optim.lr_scheduler = LambdaLR

Instead of allowing only enums of the form:

class LRMethod2(Enum):
    onecycle: str = "onecycle"
    constant: str = "constant"