def quarantine_renamer(device_path, corrupted_file_path):
 from_dir = dirname(corrupted_file_path)
 to_dir = join(device_path, 'quarantined', 'objects', basename(from_dir))
 invalidate_hash(dirname(from_dir))
 try:
  renamer(from_dir, to_dir)
 except OSError as e:
  if (e.errno not in (errno.EEXIST, errno.ENOTEMPTY)):
   raise
  to_dir = ('%s-%s' % (to_dir, uuid.uuid4().hex))
  renamer(from_dir, to_dir)
 return to_dir

def quarantine_renamer ( device_path , corrupted_file_path ) : from_dir = dirname ( corrupted_file_path ) to_dir = join ( device_path , 'quarantined' , 'objects' , basename ( from_dir ) ) invalidate_hash ( dirname ( from_dir ) ) try : renamer ( from_dir , to_dir ) except OSError as e : if ( e . errno not in ( errno . EEXIST , errno . ENOTEMPTY ) ) : raise to_dir = ( '%s-%s' % ( to_dir , uuid . uuid4 ( ) . hex ) ) renamer ( from_dir , to_dir ) return to_dir
in the case that a file is corrupted .