more pydantic way of forcing SETTINGS.external.count to None

This commit is contained in:
Jörn-Michael Miehe 2023-09-02 16:22:58 +00:00
parent 71b8fe7454
commit e1797f61ec

View file

@ -89,14 +89,11 @@ class ExternalMS(MetricSettings):
enabled: bool = False enabled: bool = False
threshold: float = 0 threshold: float = 0
# always include all defined external values!
count: None = None
# path to executable files # path to executable files
executables: list[FilePath] = [] executables: list[FilePath] = []
# wait at most this many seconds for each executable # wait at most this many seconds for each executable
timeout: int = 60 timeout: int = 60
@field_validator("count", mode="after")
@classmethod
def force_none(cls, _) -> int | None:
"""Don't accept a `count` value for the external metric!"""
return None