Registers a custom config field validator. Args: match_fn: A function that returns True if the value should be validated by `validate_fn`. validate_fn: A function that raises `InvalidConfigValueError` if a value is not a valid config field value.
(*, match_fn: Callable[[Any], bool], validate_fn: Callable[[Any], None])
| 296 | |
| 297 | |
| 298 | def register_validator(*, match_fn: Callable[[Any], bool], validate_fn: Callable[[Any], None]): |
| 299 | """Registers a custom config field validator. |
| 300 | |
| 301 | Args: |
| 302 | match_fn: A function that returns True if the value should be validated by `validate_fn`. |
| 303 | validate_fn: A function that raises `InvalidConfigValueError` if a value is not a valid |
| 304 | config field value. |
| 305 | """ |
| 306 | _config_field_validators[match_fn] = validate_fn |
| 307 | |
| 308 | |
| 309 | def validate_config_field_name(name: str) -> None: |
no outgoing calls
no test coverage detected