diff --git a/undouble/__init__.py b/undouble/__init__.py index 382ce24..7f7670e 100644 --- a/undouble/__init__.py +++ b/undouble/__init__.py @@ -12,7 +12,7 @@ __author__ = 'Erdogan Tasksen' __email__ = 'erdogant@gmail.com' -__version__ = '1.2.4' +__version__ = '1.2.5' # module level doc-string __doc__ = """ diff --git a/undouble/examples.py b/undouble/examples.py index 9b837bd..ec7ea93 100644 --- a/undouble/examples.py +++ b/undouble/examples.py @@ -35,7 +35,7 @@ # Plot hash # model.plot_hash([4]) -model.clean_files() +model.clean_files(clean_tempdir=True) # %% # Import library diff --git a/undouble/undouble.py b/undouble/undouble.py index 8afae81..aa4514a 100644 --- a/undouble/undouble.py +++ b/undouble/undouble.py @@ -347,7 +347,7 @@ def clean_init(self, params=True, results=True): # Store results # self.results = {'img':None, 'feat':None, 'xycoord':None, 'pathnames':None, 'labels': None} - def clean_files(self): + def clean_files(self, clean_tempdir=False): """Remove the entire temp directory with all its contents.""" # Cleaning temp directory @@ -360,6 +360,11 @@ def clean_files(self): os.remove(self.results['pathnames'][i]) self.results['filenames'][i]=None self.results['pathnames'][i]=None + if clean_tempdir: + logger.info('Removing the entire temp directory %s', self.clustimage.params['tempdir']) + shutil.rmtree(self.clustimage.params['tempdir']) + self.results['filenames'] = None + self.results['pathnames'] = None def import_example(self, data='flowers', url=None): """Import example dataset from github source.