aboutsummaryrefslogtreecommitdiff
path: root/quality_control/utils.py
diff options
context:
space:
mode:
authorFrederick Muriuki Muriithi2022-06-15 09:36:18 +0300
committerFrederick Muriuki Muriithi2022-06-15 09:36:18 +0300
commitd2605cb72d7cdbc7d3cc633b94a451c0acd2edbb (patch)
tree8bf992967a750bf4dc71290b78285f6239823816 /quality_control/utils.py
parent6760d322637a3d875242a66e9c1a784866d7df1d (diff)
downloadgn-uploader-d2605cb72d7cdbc7d3cc633b94a451c0acd2edbb.tar.gz
Fix linting and type errors
Diffstat (limited to 'quality_control/utils.py')
-rw-r--r--quality_control/utils.py12
1 files changed, 11 insertions, 1 deletions
diff --git a/quality_control/utils.py b/quality_control/utils.py
index 0072608..67301d6 100644
--- a/quality_control/utils.py
+++ b/quality_control/utils.py
@@ -1,7 +1,9 @@
"""Utilities that might be useful elsewhere."""
-
+import re
from collections import namedtuple
+from .errors import InvalidValue
+
ProgressIndicator = namedtuple(
"ProgressIndicator", ("filesize", "processedsize", "currentline", "percent"))
@@ -19,3 +21,11 @@ def make_progress_calculator(filesize: int):
((processedsize/filesize) * 100))
return __calculator__
+
+def cell_error(pattern, val, **error_kwargs):
+ "Return the error in the cell"
+ if re.search(pattern, val):
+ return None
+ if re.search(r"^0\.0+$", val) or re.search("^0+$", val):
+ return None
+ return InvalidValue(**error_kwargs)