diff options
Diffstat (limited to 'numpy/lib/_datasource.py')
-rw-r--r-- | numpy/lib/_datasource.py | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/numpy/lib/_datasource.py b/numpy/lib/_datasource.py index 96d9af905..495bec49e 100644 --- a/numpy/lib/_datasource.py +++ b/numpy/lib/_datasource.py @@ -33,14 +33,13 @@ Example:: """ from __future__ import division, absolute_import, print_function -__docformat__ = "restructuredtext en" - import os import sys -from shutil import rmtree, copyfile, copyfileobj +import shutil _open = open + # Using a class instead of a module-level dictionary # to reduce the inital 'import numpy' overhead by # deferring the import of bz2 and gzip until needed @@ -209,7 +208,7 @@ class DataSource (object): def __del__(self): # Remove temp directories if self._istmpdest: - rmtree(self._destpath) + shutil.rmtree(self._destpath) def _iszip(self, filename): """Test if the filename is a zip file by looking at the file extension. @@ -294,7 +293,7 @@ class DataSource (object): openedurl = urlopen(path) f = _open(upath, 'wb') try: - copyfileobj(openedurl, f) + shutil.copyfileobj(openedurl, f) finally: f.close() openedurl.close() |