Used to represent configuration values that must be validated against constraints.
| 47 | |
| 48 | |
| 49 | class ValidatedValue(ABC): |
| 50 | """Used to represent configuration values that must be validated against constraints.""" |
| 51 | |
| 52 | @property |
| 53 | @abstractmethod |
| 54 | def value(self) -> ty.Any: |
| 55 | """Get the value after validation.""" |
| 56 | ... |
| 57 | |
| 58 | @staticmethod |
| 59 | @abstractmethod |
| 60 | def from_config(config_value: str, default: "ValidatedValue") -> "ValidatedValue": |
| 61 | """Validate and get the user-specified configuration option. |
| 62 | |
| 63 | Raises: |
| 64 | OptionParseFailure: Value from config file did not meet validation constraints. |
| 65 | """ |
| 66 | ... |
| 67 | |
| 68 | def __repr__(self) -> str: |
| 69 | return str(self.value) |
| 70 | |
| 71 | def __str__(self) -> str: |
| 72 | return str(self.value) |
| 73 | |
| 74 | |
| 75 | class TimecodeValue(ValidatedValue): |
nothing calls this directly
no outgoing calls
no test coverage detected