Skip to content

Commit

Permalink
Merge pull request #632 from fastai/path-minor
Browse files Browse the repository at this point in the history
add Path to `untar` dest
  • Loading branch information
hamelsmu authored Oct 3, 2024
2 parents cc75f59 + c7a75f8 commit 2164542
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions fastcore/xtras.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
1 change: 1 addition & 0 deletions nbs/03_xtras.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit 2164542

Please sign in to comment.