(fix) SyntaxWarning with python 3.12
Changelog of python : - Invalid backslash escape sequences in strings now warn with SyntaxWarning instead of DeprecationWarning, making them more visible. (They will become syntax errors in the future.)
This commit is contained in:
committed by
Simon Fonteneau
parent
fcdda7826c
commit
338497eb21
@@ -152,7 +152,7 @@ class backup_mysql(backup_generic):
|
|||||||
|
|
||||||
filelist = os.listdir(self.backup_dir)
|
filelist = os.listdir(self.backup_dir)
|
||||||
filelist.sort()
|
filelist.sort()
|
||||||
p = re.compile('^\d{8,8}-\d{2,2}h\d{2,2}m\d{2,2}$')
|
p = re.compile(r'^\d{8,8}-\d{2,2}h\d{2,2}m\d{2,2}$')
|
||||||
for item in filelist:
|
for item in filelist:
|
||||||
if p.match(item):
|
if p.match(item):
|
||||||
dir_name = os.path.join(self.backup_dir,item)
|
dir_name = os.path.join(self.backup_dir,item)
|
||||||
|
|||||||
@@ -131,7 +131,7 @@ class backup_oracle(backup_generic):
|
|||||||
|
|
||||||
filelist = os.listdir(self.backup_dir)
|
filelist = os.listdir(self.backup_dir)
|
||||||
filelist.sort()
|
filelist.sort()
|
||||||
p = re.compile('^\d{8,8}-\d{2,2}h\d{2,2}m\d{2,2}$')
|
p = re.compile(r'^\d{8,8}-\d{2,2}h\d{2,2}m\d{2,2}$')
|
||||||
for item in filelist:
|
for item in filelist:
|
||||||
if p.match(item):
|
if p.match(item):
|
||||||
dir_name = os.path.join(self.backup_dir,item)
|
dir_name = os.path.join(self.backup_dir,item)
|
||||||
|
|||||||
@@ -138,7 +138,7 @@ class backup_pgsql(backup_generic):
|
|||||||
|
|
||||||
filelist = os.listdir(self.backup_dir)
|
filelist = os.listdir(self.backup_dir)
|
||||||
filelist.sort()
|
filelist.sort()
|
||||||
p = re.compile('^\d{8,8}-\d{2,2}h\d{2,2}m\d{2,2}$')
|
p = re.compile(r'^\d{8,8}-\d{2,2}h\d{2,2}m\d{2,2}$')
|
||||||
for item in filelist:
|
for item in filelist:
|
||||||
if p.match(item):
|
if p.match(item):
|
||||||
dir_name = os.path.join(self.backup_dir,item)
|
dir_name = os.path.join(self.backup_dir,item)
|
||||||
|
|||||||
@@ -128,8 +128,8 @@ class backup_rsync(backup_generic):
|
|||||||
if (not self.rsync_module and not self.private_key):
|
if (not self.rsync_module and not self.private_key):
|
||||||
raise Exception('If you don''t use SSH, you must specify a rsync module')
|
raise Exception('If you don''t use SSH, you must specify a rsync module')
|
||||||
|
|
||||||
#rsync_re = re.compile('(?P<server>[^:]*)::(?P<export>[^/]*)/(?P<path>.*)')
|
#rsync_re = re.compile(r'(?P<server>[^:]*)::(?P<export>[^/]*)/(?P<path>.*)')
|
||||||
#ssh_re = re.compile('((?P<user>.*)@)?(?P<server>[^:]*):(?P<path>/.*)')
|
#ssh_re = re.compile(r'((?P<user>.*)@)?(?P<server>[^:]*):(?P<path>/.*)')
|
||||||
|
|
||||||
# Add ssh connection params
|
# Add ssh connection params
|
||||||
if self.rsync_module:
|
if self.rsync_module:
|
||||||
@@ -170,8 +170,8 @@ class backup_rsync(backup_generic):
|
|||||||
|
|
||||||
log = monitor_stdout(process,ondata,self)
|
log = monitor_stdout(process,ondata,self)
|
||||||
|
|
||||||
reg_total_files = re.compile('Number of files: (?P<file>\d+)')
|
reg_total_files = re.compile(r'Number of files: (?P<file>\d+)')
|
||||||
reg_transferred_files = re.compile('Number of .*files transferred: (?P<file>\d+)')
|
reg_transferred_files = re.compile(r'Number of .*files transferred: (?P<file>\d+)')
|
||||||
for l in log.splitlines():
|
for l in log.splitlines():
|
||||||
line = l.replace(',','').replace('.','')
|
line = l.replace(',','').replace('.','')
|
||||||
m = reg_total_files.match(line)
|
m = reg_total_files.match(line)
|
||||||
@@ -225,8 +225,8 @@ class backup_rsync(backup_generic):
|
|||||||
filelist.sort()
|
filelist.sort()
|
||||||
filelist.reverse()
|
filelist.reverse()
|
||||||
full = ''
|
full = ''
|
||||||
r_full = re.compile('^\d{8,8}-\d{2,2}h\d{2,2}m\d{2,2}$')
|
r_full = re.compile(r'^\d{8,8}-\d{2,2}h\d{2,2}m\d{2,2}$')
|
||||||
r_partial = re.compile('^\d{8,8}-\d{2,2}h\d{2,2}m\d{2,2}.rsync$')
|
r_partial = re.compile(r'^\d{8,8}-\d{2,2}h\d{2,2}m\d{2,2}.rsync$')
|
||||||
# we take all latest partials younger than the latest full and the latest full
|
# we take all latest partials younger than the latest full and the latest full
|
||||||
for item in filelist:
|
for item in filelist:
|
||||||
if r_partial.match(item) and item<current:
|
if r_partial.match(item) and item<current:
|
||||||
@@ -245,7 +245,7 @@ class backup_rsync(backup_generic):
|
|||||||
|
|
||||||
filelist = os.listdir(self.backup_dir)
|
filelist = os.listdir(self.backup_dir)
|
||||||
filelist.sort()
|
filelist.sort()
|
||||||
p = re.compile('^\d{8,8}-\d{2,2}h\d{2,2}m\d{2,2}$')
|
p = re.compile(r'^\d{8,8}-\d{2,2}h\d{2,2}m\d{2,2}$')
|
||||||
for item in filelist:
|
for item in filelist:
|
||||||
if p.match(item):
|
if p.match(item):
|
||||||
dir_name = os.path.join(self.backup_dir,item)
|
dir_name = os.path.join(self.backup_dir,item)
|
||||||
|
|||||||
@@ -138,8 +138,8 @@ class backup_rsync_btrfs(backup_generic):
|
|||||||
if (not self.rsync_module and not self.private_key):
|
if (not self.rsync_module and not self.private_key):
|
||||||
raise Exception('If you don''t use SSH, you must specify a rsync module')
|
raise Exception('If you don''t use SSH, you must specify a rsync module')
|
||||||
|
|
||||||
#rsync_re = re.compile('(?P<server>[^:]*)::(?P<export>[^/]*)/(?P<path>.*)')
|
#rsync_re = re.compile(r'(?P<server>[^:]*)::(?P<export>[^/]*)/(?P<path>.*)')
|
||||||
#ssh_re = re.compile('((?P<user>.*)@)?(?P<server>[^:]*):(?P<path>/.*)')
|
#ssh_re = re.compile(r'((?P<user>.*)@)?(?P<server>[^:]*):(?P<path>/.*)')
|
||||||
|
|
||||||
# Add ssh connection params
|
# Add ssh connection params
|
||||||
if self.rsync_module:
|
if self.rsync_module:
|
||||||
@@ -178,8 +178,8 @@ class backup_rsync_btrfs(backup_generic):
|
|||||||
|
|
||||||
log = monitor_stdout(process,ondata,self)
|
log = monitor_stdout(process,ondata,self)
|
||||||
|
|
||||||
reg_total_files = re.compile('Number of files: (?P<file>\d+)')
|
reg_total_files = re.compile(r'Number of files: (?P<file>\d+)')
|
||||||
reg_transferred_files = re.compile('Number of .*files transferred: (?P<file>\d+)')
|
reg_transferred_files = re.compile(r'Number of .*files transferred: (?P<file>\d+)')
|
||||||
for l in log.splitlines():
|
for l in log.splitlines():
|
||||||
line = l.replace(',','').replace('.','')
|
line = l.replace(',','').replace('.','')
|
||||||
m = reg_total_files.match(line)
|
m = reg_total_files.match(line)
|
||||||
@@ -244,8 +244,8 @@ class backup_rsync_btrfs(backup_generic):
|
|||||||
filelist.sort()
|
filelist.sort()
|
||||||
filelist.reverse()
|
filelist.reverse()
|
||||||
full = ''
|
full = ''
|
||||||
r_full = re.compile('^\d{8,8}-\d{2,2}h\d{2,2}m\d{2,2}$')
|
r_full = re.compile(r'^\d{8,8}-\d{2,2}h\d{2,2}m\d{2,2}$')
|
||||||
r_partial = re.compile('^\d{8,8}-\d{2,2}h\d{2,2}m\d{2,2}.rsync$')
|
r_partial = re.compile(r'^\d{8,8}-\d{2,2}h\d{2,2}m\d{2,2}.rsync$')
|
||||||
# we take all latest partials younger than the latest full and the latest full
|
# we take all latest partials younger than the latest full and the latest full
|
||||||
for item in filelist:
|
for item in filelist:
|
||||||
if r_partial.match(item) and item<current:
|
if r_partial.match(item) and item<current:
|
||||||
@@ -263,7 +263,7 @@ class backup_rsync_btrfs(backup_generic):
|
|||||||
|
|
||||||
filelist = os.listdir(self.backup_dir)
|
filelist = os.listdir(self.backup_dir)
|
||||||
filelist.sort()
|
filelist.sort()
|
||||||
p = re.compile('^\d{8,8}-\d{2,2}h\d{2,2}m\d{2,2}$')
|
p = re.compile(r'^\d{8,8}-\d{2,2}h\d{2,2}m\d{2,2}$')
|
||||||
for item in filelist:
|
for item in filelist:
|
||||||
if p.match(item):
|
if p.match(item):
|
||||||
dir_name = os.path.join(self.backup_dir,item)
|
dir_name = os.path.join(self.backup_dir,item)
|
||||||
|
|||||||
@@ -139,7 +139,7 @@ class backup_samba4(backup_generic):
|
|||||||
|
|
||||||
filelist = os.listdir(self.backup_dir)
|
filelist = os.listdir(self.backup_dir)
|
||||||
filelist.sort()
|
filelist.sort()
|
||||||
p = re.compile('^\d{8,8}-\d{2,2}h\d{2,2}m\d{2,2}$')
|
p = re.compile(r'^\d{8,8}-\d{2,2}h\d{2,2}m\d{2,2}$')
|
||||||
for item in filelist:
|
for item in filelist:
|
||||||
if p.match(item):
|
if p.match(item):
|
||||||
dir_name = os.path.join(self.backup_dir,item)
|
dir_name = os.path.join(self.backup_dir,item)
|
||||||
|
|||||||
@@ -139,7 +139,7 @@ class backup_sqlserver(backup_generic):
|
|||||||
|
|
||||||
filelist = os.listdir(self.backup_dir)
|
filelist = os.listdir(self.backup_dir)
|
||||||
filelist.sort()
|
filelist.sort()
|
||||||
p = re.compile('^%s-(?P<date>\d{8,8}-\d{2,2}h\d{2,2}m\d{2,2}).bak.gz$' % self.db_name)
|
p = re.compile(r'^%s-(?P<date>\d{8,8}-\d{2,2}h\d{2,2}m\d{2,2}).bak.gz$' % self.db_name)
|
||||||
for item in filelist:
|
for item in filelist:
|
||||||
sr = p.match(item)
|
sr = p.match(item)
|
||||||
if sr:
|
if sr:
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ class backup_xcp_metadata(backup_generic):
|
|||||||
|
|
||||||
filelist = os.listdir(self.backup_dir)
|
filelist = os.listdir(self.backup_dir)
|
||||||
filelist.sort()
|
filelist.sort()
|
||||||
p = re.compile('^%s-(?P<date>\d{8,8}-\d{2,2}h\d{2,2}m\d{2,2}).dump.gz$' % self.server_name)
|
p = re.compile(r'^%s-(?P<date>\d{8,8}-\d{2,2}h\d{2,2}m\d{2,2}).dump.gz$' % self.server_name)
|
||||||
for item in filelist:
|
for item in filelist:
|
||||||
sr = p.match(item)
|
sr = p.match(item)
|
||||||
if sr:
|
if sr:
|
||||||
|
|||||||
Reference in New Issue
Block a user