diff --git a/altamisa/isatab/parse_assay_study.py b/altamisa/isatab/parse_assay_study.py index 61414b7..5b8af47 100644 --- a/altamisa/isatab/parse_assay_study.py +++ b/altamisa/isatab/parse_assay_study.py @@ -817,7 +817,7 @@ def from_stream(cls, study_id: str, input_file: TextIO, filename: Optional[str] def __init__(self, study_id: str, input_file: TextIO, filename: Optional[str]): self.study_id = study_id self.input_file = input_file - self.filename = filename or getattr(input_file, "name", "") + self._filename = filename or getattr(input_file, "name", "") self.unique_rows = set() self.duplicate_rows = [] self._reader = csv.reader(input_file, delimiter="\t", quotechar='"') @@ -849,7 +849,7 @@ def _read_next_line(self): except StopIteration: self._line = None except UnicodeDecodeError as e: # pragma: no cover - msg = f"Invalid encoding of study file '{self.input_file.name}' (use Unicode/UTF-8)." + msg = f"Invalid encoding of study file '{self._filename}' (use Unicode/UTF-8)." raise ParseIsatabException(msg) from e return prev_line @@ -859,7 +859,7 @@ def read(self): :returns: Nodes per row of the study file """ - builder = _StudyRowBuilder(self.header, self.filename, self.study_id) + builder = _StudyRowBuilder(self.header, self._filename, self.study_id) while True: line = self._read_next_line() if line: @@ -942,7 +942,7 @@ def __init__(self, study_id: str, assay_id: str, input_file: TextIO, filename: O self.study_id = study_id self.assay_id = assay_id self.input_file = input_file - self.filename = filename or getattr(input_file, "name", "") + self._filename = filename or getattr(input_file, "name", "") self.unique_rows = set() self.duplicate_rows = [] self._reader = csv.reader(input_file, delimiter="\t", quotechar='"') @@ -974,7 +974,7 @@ def _read_next_line(self): except StopIteration: self._line = None except UnicodeDecodeError as e: # pragma: no cover - msg = f"Invalid encoding of assay file '{self.input_file.name}' (use Unicode/UTF-8)." + msg = f"Invalid encoding of assay file '{self._filename}' (use Unicode/UTF-8)." raise ParseIsatabException(msg) from e return prev_line @@ -984,7 +984,7 @@ def read(self): :return: Nodes per row of the assay file """ - builder = _AssayRowBuilder(self.header, self.filename, self.study_id, self.assay_id) + builder = _AssayRowBuilder(self.header, self._filename, self.study_id, self.assay_id) while True: line = self._read_next_line() if line: