#NEWLINE# def remove( self ) : #NEWLINE# #INDENT# if ( not self . enabled ) : #NEWLINE# #INDENT# self . _ydl . to_screen ( 'Cache is disabled (Did you combine --no-cache-dir and --rm-cache-dir?)' ) #NEWLINE# return #NEWLINE# #UNINDENT# cachedir = self . _get_root_dir ( ) #NEWLINE# if ( not any ( ( ( term in cachedir ) for term in ( 'cache' , 'tmp' ) ) ) ) : #NEWLINE# #INDENT# raise Exception ( ( 'Not removing directory %s - this does not look like a cache dir' % cachedir ) ) #NEWLINE# #UNINDENT# self . _ydl . to_screen ( ( 'Removing cache dir %s .' % cachedir ) , skip_eol = True ) #NEWLINE# if os . path . exists ( cachedir ) : #NEWLINE# #INDENT# self . _ydl . to_screen ( '.' , skip_eol = True ) #NEWLINE# shutil . rmtree ( cachedir ) #NEWLINE# #UNINDENT# self . _ydl . to_screen ( '.' )