summaryrefslogtreecommitdiff
path: root/numpy/lib/_datasource.py
diff options
context:
space:
mode:
authorAaron Meurer <asmeurer@gmail.com>2021-06-14 14:07:18 -0600
committerAaron Meurer <asmeurer@gmail.com>2021-06-14 14:07:18 -0600
commit8c78b84968e580f24b3705378fb35705a434cdf1 (patch)
treec9f82beeb5a2c3f0301f7984d4b6d19539c35d23 /numpy/lib/_datasource.py
parent8bf3a4618f1de951c7a4ccdb8bc3e36825a1b744 (diff)
parent75f852edf94a7293e7982ad516bee314d7187c2d (diff)
downloadnumpy-8c78b84968e580f24b3705378fb35705a434cdf1.tar.gz
Merge branch 'main' into matrix_rank-doc-fix
Diffstat (limited to 'numpy/lib/_datasource.py')
-rw-r--r--numpy/lib/_datasource.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/numpy/lib/_datasource.py b/numpy/lib/_datasource.py
index 7a23b1651..c790a6462 100644
--- a/numpy/lib/_datasource.py
+++ b/numpy/lib/_datasource.py
@@ -35,7 +35,6 @@ Example::
"""
import os
-import shutil
import io
from numpy.core.overrides import set_module
@@ -257,6 +256,8 @@ class DataSource:
def __del__(self):
# Remove temp directories
if hasattr(self, '_istmpdest') and self._istmpdest:
+ import shutil
+
shutil.rmtree(self._destpath)
def _iszip(self, filename):
@@ -319,8 +320,9 @@ class DataSource:
Creates a copy of the file in the datasource cache.
"""
- # We import these here because importing urllib is slow and
+ # We import these here because importing them is slow and
# a significant fraction of numpy's total import time.
+ import shutil
from urllib.request import urlopen
from urllib.error import URLError