diff options
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_ |
