blob: 2907b9c7a4605169b6617ad9141ac9375cd8253d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
|
"""Contain logic for checking average files"""
import re
from .errors import InvalidCellValue
def valid_value(val):
"""Checks whether `val` is a valid value for averages"""
if re.search(r"^[0-9]+\.[0-9]{3}$", val):
return float(val)
raise InvalidCellValue(
f"Invalid value '{val}'. "
"Expected string representing a number with exactly three decimal "
"places.")
|