(feat) Set regex to raw to avoid futur SyntaxWarning
This commit is contained in:
committed by
Simon Fonteneau
parent
338497eb21
commit
fd9bead6ee
@@ -86,7 +86,7 @@ class backup_oracle(backup_generic):
|
||||
|
||||
file = open(localpath)
|
||||
for line in file:
|
||||
if re.search('EXP-[0-9]+:', line) and not re.match('EXP-[0-9]+:', line).group(0).replace(':','') in self.ignore_error_oracle_code:
|
||||
if re.search(r'EXP-[0-9]+:', line) and not re.match(r'EXP-[0-9]+:', line).group(0).replace(':','') in self.ignore_error_oracle_code:
|
||||
stats['status']='RMTemp'
|
||||
self.clean_dumpfiles(dumpfile,dumplog)
|
||||
raise Exception('Aborting, Not null exit code (%s) for "%s"' % (re.match('EXP-[0-9]+:', line).group(0).replace(':',''),cmd))
|
||||
|
||||
@@ -199,7 +199,7 @@ class backup_switch(backup_generic):
|
||||
child.expect('#--')
|
||||
child.expect("#")
|
||||
child.close()
|
||||
myre = re.compile("#--+")
|
||||
myre = re.compile(r"#--+")
|
||||
config = myre.split(open(filename).read())[2]
|
||||
with open(filename,'w') as f:
|
||||
f.write(config)
|
||||
|
||||
@@ -60,7 +60,7 @@ class backup_xva(backup_generic):
|
||||
tar = tarfile.open(filename)
|
||||
members = tar.getmembers()
|
||||
for tarinfo in members:
|
||||
if re.search('^[0-9]*$',os.path.basename(tarinfo.name)):
|
||||
if re.search(r'^[0-9]*$',os.path.basename(tarinfo.name)):
|
||||
sha1sum = hashlib.sha1(tar.extractfile(tarinfo).read()).hexdigest()
|
||||
sha1sum2 = tar.extractfile(tarinfo.name+'.checksum').read()
|
||||
if not sha1sum == sha1sum2:
|
||||
|
||||
@@ -526,7 +526,7 @@ class backup_generic(ABC):
|
||||
ssh_port=22
|
||||
|
||||
def __init__(self,backup_name, backup_dir,dbstat=None,dry_run=False):
|
||||
if not re.match('^[A-Za-z0-9_\-\.]*$',backup_name):
|
||||
if not re.match(r'^[A-Za-z0-9_\-\.]*$',backup_name):
|
||||
raise Exception('The backup name %s should contain only alphanumerical characters' % backup_name)
|
||||
self.backup_name = backup_name
|
||||
self.backup_dir = backup_dir
|
||||
@@ -889,7 +889,7 @@ class backup_generic(ABC):
|
||||
|
||||
for l in log.splitlines():
|
||||
if l.startswith('Number of files:'):
|
||||
stats['total_files_count'] += int(re.findall('[0-9]+', l.split(':')[1])[0])
|
||||
stats['total_files_count'] += int(re.findall(r'[0-9]+', l.split(':')[1])[0])
|
||||
if l.startswith('Number of files transferred:'):
|
||||
stats['written_files_count'] += int(l.split(':')[1])
|
||||
if l.startswith('Total file size:'):
|
||||
|
||||
@@ -357,7 +357,7 @@ class INISection(config.ConfigNamespace):
|
||||
else:
|
||||
raise
|
||||
if del_empty:
|
||||
value = re.sub('\n+', '\n', value)
|
||||
value = re.sub(r'\n+', r'\n', value)
|
||||
return value
|
||||
|
||||
def _getitem(self, key):
|
||||
|
||||
+1
-1
@@ -286,7 +286,7 @@ def check_usb_disk():
|
||||
usb_disk_list = []
|
||||
for name in glob.glob('/dev/sd[a-z]'):
|
||||
for line in os.popen("udevadm info -q env -n %s" % name):
|
||||
if re.match("ID_PATH=.*usb.*", line):
|
||||
if re.match(r"ID_PATH=.*usb.*", line):
|
||||
usb_disk_list += [ name ]
|
||||
|
||||
if len(usb_disk_list) == 0:
|
||||
|
||||
Reference in New Issue
Block a user