fix calls to deprecated function in deltatar.py
authorPhilipp Gesang <philipp.gesang@intra2net.com>
Thu, 3 Nov 2016 16:02:54 +0000 (17:02 +0100)
committerPhilipp Gesang <philipp.gesang@intra2net.com>
Thu, 3 Nov 2016 16:03:01 +0000 (17:03 +0100)
Fixes warning mandating “.warning()” over “.warn()”:

    DeprecationWarning: The 'warn' method is deprecated, use 'warning' instead

deltatar/deltatar.py

index c1000fd..91b938c 100644 (file)
@@ -325,7 +325,7 @@ class DeltaTar(object):
                         match = MATCH
                         break
                 else:
-                    self.logger.warn('Invalid pattern in included_files: %s' % str(i))
+                    self.logger.warning('Invalid pattern in included_files: %s' % str(i))
 
             if match == NO_MATCH:
                 return NO_MATCH
@@ -356,7 +356,7 @@ class DeltaTar(object):
                     if e.match(path):
                         return NO_MATCH
                 else:
-                    self.logger.warn('Invalid pattern in excluded_files: %s' % str(e))
+                    self.logger.warning('Invalid pattern in excluded_files: %s' % str(e))
 
         if self.filter_func:
             return self.filter_func(path)
@@ -391,7 +391,7 @@ class DeltaTar(object):
                 if status == NO_MATCH:
                     continue
                 if not os.access(child, os.R_OK):
-                    self.logger.warn('Error accessing possibly locked file %s' % child)
+                    self.logger.warning('Error accessing possibly locked file %s' % child)
                     continue
 
                 if status == MATCH:
@@ -851,7 +851,7 @@ class DeltaTar(object):
                 self.logger.debug("[UNCHANGED] %s" % path)
             else:
                 # should not happen
-                self.logger.warn('unknown action in create_diff_backup: {0}'
+                self.logger.warning('unknown action in create_diff_backup: {0}'
                                  ''.format(action))
                 stat = None
 
@@ -944,7 +944,7 @@ class DeltaTar(object):
 
                 # check input
                 if op_type not in ['directory', 'file', 'link']:
-                    self.delta_tar.logger.warn('unrecognized type to be '
+                    self.delta_tar.logger.warning('unrecognized type to be '
                                         'restored: %s, line %d' % (op_type, l_no))
                     # iterate again
                     return self.__next__()
@@ -1507,13 +1507,13 @@ class RestoreHelper(object):
             while True:
                 d, l_no, dpath = self.find_path_in_index(data, upath)
                 if not d:
-                    self._deltatar.logger.warn('Error restoring file %s from '
+                    self._deltatar.logger.warning('Error restoring file %s from '
                                                'index, not found in index %s' % (path, data['path']))
                     return
 
                 cur_path = d.get('path', '')
                 if cur_path.startswith('delete://'):
-                    self._deltatar.logger.warn(('Strange thing happened, file '
+                    self._deltatar.logger.warning(('Strange thing happened, file '
                                                 '%s was listed in first index but deleted by another '
                                                 'one. Path was ignored and untouched.') % path)
                     return
@@ -1524,7 +1524,7 @@ class RestoreHelper(object):
                     os.utime(parent_dir, (parent_dir_mtime, parent_dir_mtime))
                     return
 
-        self._deltatar.logger.warn(('Error restoring file %s from index, '
+        self._deltatar.logger.warning(('Error restoring file %s from index, '
                                     'snapshot not found in any index') % path)
 
     def find_path_in_index(self, data, upath):
@@ -1598,7 +1598,7 @@ class RestoreHelper(object):
                         raise tarfile.ExtractError("could not change owner")
 
             except tarfile.ExtractError as e:
-                self._deltatar.logger.warn('tarfile: %s' % e)
+                self._deltatar.logger.warning('tarfile: %s' % e)
 
     @staticmethod
     def new_volume_handler(deltarobj, cwd, is_full, backup_path, tarobj, base_name, volume_number):
@@ -1628,7 +1628,7 @@ class RestoreHelper(object):
             vol_no = file_data.get('volume', -1)
             # sanity check
             if not isinstance(vol_no, int) or vol_no < 0:
-                self._deltatar.logger.warn('unrecognized type to be restored: '
+                self._deltatar.logger.warning('unrecognized type to be restored: '
                                         '%s, line %d' % (op_type, l_no))
 
             # setup the volume that needs to be read. only needed when member is