From fcf7bca4ccb3e1422d0400a7f8171fdbf708ee88 Mon Sep 17 00:00:00 2001 From: alsmith Date: Fri, 17 May 2024 14:32:46 +0100 Subject: [PATCH] Refactor FastqFile model to handle resolved and absolute paths --- seqnado/design.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/seqnado/design.py b/seqnado/design.py index ce278c8b..59d2595f 100644 --- a/seqnado/design.py +++ b/seqnado/design.py @@ -29,9 +29,13 @@ def is_path(path: Optional[Union[str, pathlib.Path]]) -> Optional[pathlib.Path]: class FastqFile(BaseModel): path: pathlib.Path + use_resolved_name: bool = False def model_post_init(self, *args): - self.path = pathlib.Path(self.path).resolve() + if self.use_resolved_name: + self.path = pathlib.Path(self.path).resolve() + else: + self.path = pathlib.Path(self.path).absolute() if not self.path.exists() or str(self.path) in ["-", ".", "", None]: raise FileNotFoundError(f"{self.path} does not exist.")