diff options
| author | Frederick Muriuki Muriithi <fredmanglis@gmail.com> | 2026-10-02 09:17:12 -0500 |
|---|---|---|
| committer | Frederick Muriuki Muriithi <fredmanglis@gmail.com> | 2026-10-02 09:24:23 -0500 |
| commit | 8555c7d6a78519ee0d95482d9cd52f67ebab3ee0 (patch) | |
| tree | 2f9757e088c98e1daaf57376197a6cc6a10f4175 /uploader/csvprocessing.py | |
| parent | de616375f1c006c34e6cefed83e5dba7136f670e (diff) | |
| download | gn-uploader-8555c7d6a78519ee0d95482d9cd52f67ebab3ee0.tar.gz | |
Initialise module for common CSV processing utilities.
Diffstat (limited to 'uploader/csvprocessing.py')
| -rw-r--r-- | uploader/csvprocessing.py | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/uploader/csvprocessing.py b/uploader/csvprocessing.py new file mode 100644 index 0000000..3b46515 --- /dev/null +++ b/uploader/csvprocessing.py @@ -0,0 +1,31 @@ +"""Utilities for processing CSV files.""" +from typing import Callable + + +def is_blank_line(line: str) -> bool: + """Is the given line a blank line? + + :param line: The line to check for blankness. + :type line: str + :rtype bool + """ + return line.strip() == "" + + +def make_comment_line_checker(comment_char: str) -> Callable[[str], bool]: + """Make function that checks whether a line is a comment line. + + :param comment_char: The character indicating the line is a comment. + :type comment_char: str + :rtype Callable[[str], bool] + """ + def _is_comment_line_(line: str) -> bool: + """Check whether the line is a comment. + + :param line: The line to check. + :type line: str + :rtype bool + """ + return line.startswith(comment_char) + + return _is_comment_line_ |
