From 72147393d3b39477723f7b368ca3dfcc9bf22e38 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philip=20M=C3=BCller?= <147368808+philip-paul-mueller@users.noreply.github.com> Date: Wed, 29 May 2024 09:39:33 +0200 Subject: [PATCH] `SDFG.save()` now performs tilde expansion. (#1578) I noticed that it would be cool if I could write `sdfg.save("~/tmp/faulty.sdfg")` and it would save it into my home directory, instead in a directory `./~` in some random directory. --- dace/sdfg/sdfg.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/dace/sdfg/sdfg.py b/dace/sdfg/sdfg.py index f10e728607..b43ff2a7bf 100644 --- a/dace/sdfg/sdfg.py +++ b/dace/sdfg/sdfg.py @@ -1520,6 +1520,8 @@ def save(self, filename: str, use_pickle=False, hash=None, exception=None, compr :param compress: If True, uses gzip to compress the file upon saving. :return: The hash of the SDFG, or None if failed/not requested. """ + filename = os.path.expanduser(filename) + if compress: fileopen = lambda file, mode: gzip.open(file, mode + 't') else: