aboutsummaryrefslogtreecommitdiff
path: root/quality_control/standard_error.py
diff options
context:
space:
mode:
authorFrederick Muriuki Muriithi2024-02-20 10:57:56 +0300
committerFrederick Muriuki Muriithi2024-02-20 10:57:56 +0300
commitce243a57b24d6adecb169487e706290d91b22d19 (patch)
tree6b0b06a444c16ffb8be1c65fa4e5b78ced6a0615 /quality_control/standard_error.py
parenta4324cd24b5a14fbcf19a6e04d2b76fb2838038e (diff)
downloadgn-uploader-ce243a57b24d6adecb169487e706290d91b22d19.tar.gz
Track filename in the errors
R/qtl2 bundles can contain more than one file, of the same type. When errors are encountered in any of the files, we need to be able to inform the user which file it is, in addition to the line and column number.
Diffstat (limited to 'quality_control/standard_error.py')
-rw-r--r--quality_control/standard_error.py11
1 files changed, 6 insertions, 5 deletions
diff --git a/quality_control/standard_error.py b/quality_control/standard_error.py
index 90beb8a..00b1ac6 100644
--- a/quality_control/standard_error.py
+++ b/quality_control/standard_error.py
@@ -4,17 +4,18 @@ from typing import Union
from .utils import cell_error
from .errors import InvalidValue
-def invalid_value(
- line_number: int, column_number: int, val: str) -> Union[
- InvalidValue, None]:
+def invalid_value(filename: str,
+ line_number: int,
+ column_number: int,
+ val: str) -> Union[InvalidValue, None]:
"""
Returns a `quality_control.errors.InvalidValue` object in the case where
`val` is not a valid input for standard error files, otherwise, it returns
`None`.
"""
return cell_error(
- r"^([0-9]+\.[0-9]{6,}|[0-9]+\.?0*)$", val, line=line_number,
- column=column_number, value=val, message=(
+ r"^([0-9]+\.[0-9]{6,}|[0-9]+\.?0*)$", val, filename=filename,
+ line=line_number, column=column_number, value=val, message=(
f"Invalid value '{val}'. "
"Expected string representing a number with at least six "
"decimal places."))