From c7a75f8126bafa0829c0249200958ea46e9de9a5 Mon Sep 17 00:00:00 2001 From: Hamel Husain Date: Thu, 3 Oct 2024 12:30:02 -0700 Subject: [PATCH] add Path --- fastcore/xtras.py | 1 + nbs/03_xtras.ipynb | 1 + 2 files changed, 2 insertions(+) diff --git a/fastcore/xtras.py b/fastcore/xtras.py index cfadcda7..e1dadb77 100644 --- a/fastcore/xtras.py +++ b/fastcore/xtras.py @@ -171,6 +171,7 @@ def _unpack(fname, out): def untar_dir(fname, dest, rename=False, overwrite=False): "untar `file` into `dest`, creating a directory if the root contains more than one item" import tempfile,shutil + dest = Path(dest) with tempfile.TemporaryDirectory() as d: out = Path(d)/remove_suffix(Path(fname).stem, '.tar') out.mkdir() diff --git a/nbs/03_xtras.ipynb b/nbs/03_xtras.ipynb index 54ab49fd..40882d13 100644 --- a/nbs/03_xtras.ipynb +++ b/nbs/03_xtras.ipynb @@ -536,6 +536,7 @@ "def untar_dir(fname, dest, rename=False, overwrite=False):\n", " \"untar `file` into `dest`, creating a directory if the root contains more than one item\"\n", " import tempfile,shutil\n", + " dest = Path(dest)\n", " with tempfile.TemporaryDirectory() as d:\n", " out = Path(d)/remove_suffix(Path(fname).stem, '.tar')\n", " out.mkdir()\n",