(config_value: str, default: "RangeValue")
| 135 | |
| 136 | @staticmethod |
| 137 | def from_config(config_value: str, default: "RangeValue") -> "RangeValue": |
| 138 | try: |
| 139 | return RangeValue( |
| 140 | value=int(config_value) if isinstance(default.value, int) else float(config_value), |
| 141 | min_val=default.min_val, |
| 142 | max_val=default.max_val, |
| 143 | ) |
| 144 | except ValueError as ex: |
| 145 | raise OptionParseFailure( |
| 146 | f"Value must be between {default.min_val} and {default.max_val}." |
| 147 | ) from ex |
| 148 | |
| 149 | |
| 150 | class CropValue(ValidatedValue): |
nothing calls this directly
no test coverage detected