diff options
-rw-r--r-- | r_qtl/r_qtl2.py | 17 |
1 files changed, 5 insertions, 12 deletions
diff --git a/r_qtl/r_qtl2.py b/r_qtl/r_qtl2.py index ec70c5c..b1eae90 100644 --- a/r_qtl/r_qtl2.py +++ b/r_qtl/r_qtl2.py @@ -6,7 +6,7 @@ import json from pathlib import Path from functools import reduce, partial from zipfile import ZipFile, is_zipfile -from typing import Union, Iterator, Iterable, Callable, Optional, Sequence +from typing import Union, Iterator, Iterable, Callable, Optional import yaml @@ -572,21 +572,14 @@ def read_text_file(filepath: Union[str, Path]) -> Iterator[str]: yield line -def read_csv_file( - filepath: Union[str, Path], - separator: str = ",", - comment_char: str = "#", - na_strings: Sequence[str] = ["NA"] -) -> Iterator[tuple[str, ...]]: +def read_csv_file(filepath: Union[str, Path], + separator: str = ",", + comment_char: str = "#") -> Iterator[tuple[str, ...]]: """Read a file as a csv file.""" - def __none_if_na__(val): - return None if val in na_strings else val - for line in read_text_file(filepath): if line.startswith(comment_char): continue - yield tuple(__none_if_na__(field.strip()) - for field in line.split(separator)) + yield tuple(field.strip() for field in line.split(separator)) def read_csv_file_headers( |