Skip to content

Commit 2a0bbdf

Browse files
committed
fixes #412
1 parent fc0ed57 commit 2a0bbdf

File tree

2 files changed

+11
-29
lines changed

2 files changed

+11
-29
lines changed

fastcore/xtras.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ def untar_dir(fname, dest, rename=False, overwrite=False):
223223
src = _unpack(fname, out)
224224
dest = dest/src.name
225225
if dest.exists():
226-
if overwrite: shutil.rmtree(dest)
226+
if overwrite: shutil.rmtree(dest) if dest.is_dir() else dest.unlink()
227227
else: return dest
228228
if rename: src = _unpack(fname, out)
229229
shutil.move(str(src), dest)

nbs/03_xtras.ipynb

Lines changed: 10 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -93,31 +93,6 @@
9393
"test_eq(d2.b['c'], 2)"
9494
]
9595
},
96-
{
97-
"cell_type": "code",
98-
"execution_count": null,
99-
"metadata": {},
100-
"outputs": [
101-
{
102-
"data": {
103-
"text/plain": [
104-
"\u001b[0;31mSignature:\u001b[0m \u001b[0md2\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_repr_markdown_\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
105-
"\u001b[0;31mDocstring:\u001b[0m Return repr(self).\n",
106-
"\u001b[0;31mSource:\u001b[0m \n",
107-
"\u001b[0;34m@\u001b[0m\u001b[0mpatch\u001b[0m\u001b[0;34m\u001b[0m\n",
108-
"\u001b[0;34m\u001b[0m\u001b[0;32mdef\u001b[0m \u001b[0m__repr__\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0mAttrDict\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0mrepr_dict\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
109-
"\u001b[0;31mFile:\u001b[0m ~/github/fastcore/nbs/fastcore/xtras.py\n",
110-
"\u001b[0;31mType:\u001b[0m method\n"
111-
]
112-
},
113-
"metadata": {},
114-
"output_type": "display_data"
115-
}
116-
],
117-
"source": [
118-
"??d2._repr_markdown_"
119-
]
120-
},
12196
{
12297
"cell_type": "markdown",
12398
"metadata": {},
@@ -577,7 +552,7 @@
577552
{
578553
"data": {
579554
"text/plain": [
580-
"['d', 'c', 'h', 'a', 'b', 'f', 'g', 'e']"
555+
"['b', 'h', 'd', 'a', 'g', 'c', 'f', 'e']"
581556
]
582557
},
583558
"execution_count": null,
@@ -701,7 +676,7 @@
701676
{
702677
"data": {
703678
"text/plain": [
704-
"(#8) ['./08_script.ipynb','./04_dispatch.ipynb','./06_docments.ipynb','./01_basics.ipynb','./fastcore/docments.py','./fastcore/dispatch.py','./fastcore/basics.py','./fastcore/script.py']"
679+
"(#9) ['./04_dispatch.ipynb','./08_script.ipynb','./06_docments.ipynb','./01_basics.ipynb','./fastcore/docscrape.py','./fastcore/dispatch.py','./fastcore/script.py','./fastcore/basics.py','./fastcore/docments.py']"
705680
]
706681
},
707682
"execution_count": null,
@@ -1066,7 +1041,7 @@
10661041
" src = _unpack(fname, out)\n",
10671042
" dest = dest/src.name\n",
10681043
" if dest.exists():\n",
1069-
" if overwrite: shutil.rmtree(dest)\n",
1044+
" if overwrite: shutil.rmtree(dest) if dest.is_dir() else dest.unlink()\n",
10701045
" else: return dest\n",
10711046
" if rename: src = _unpack(fname, out)\n",
10721047
" shutil.move(str(src), dest)\n",
@@ -2282,6 +2257,13 @@
22822257
"from nbdev.export import notebook2script\n",
22832258
"notebook2script()"
22842259
]
2260+
},
2261+
{
2262+
"cell_type": "code",
2263+
"execution_count": null,
2264+
"metadata": {},
2265+
"outputs": [],
2266+
"source": []
22852267
}
22862268
],
22872269
"metadata": {

0 commit comments

Comments
 (0)