From 6fc19ce5746fef228def5fbd55f8aeae0e28686f Mon Sep 17 00:00:00 2001 From: Ali Khosravi Date: Mon, 21 Oct 2024 17:05:48 +0200 Subject: [PATCH] Update path.py (#124) firecrest does not support `exist_ok`, it's somehow blended into `parents` --- firecrest/path.py | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/firecrest/path.py b/firecrest/path.py index eea34c5..d36a795 100644 --- a/firecrest/path.py +++ b/firecrest/path.py @@ -533,16 +533,11 @@ def mkdir( """Create a new directory at this given path.""" if mode is not None: raise NotImplementedError("mode is not supported yet") - try: - with self.convert_header_exceptions( - { - "X-Invalid-Path": FileExistsError # Note see: https://github.com/eth-cscs/firecrest/issues/172 - } - ): - self._client.mkdir(self._machine, self.path, p=parents) - except FileExistsError: - if not exist_ok: - raise + with self.convert_header_exceptions(): + # Note see: https://github.com/eth-cscs/firecrest/issues/172 + # Also see: https://github.com/eth-cscs/firecrest/issues/202 + # firecrest does not support `exist_ok`, it's somehow blended into `parents` + self._client.mkdir(self._machine, self.path, p=parents if not exist_ok else True) def touch(self, mode: None = None, exist_ok: bool = True) -> None: """Create a file at this given path.