Skip to content

Commit

Permalink
Use raw strings for additional regex
Browse files Browse the repository at this point in the history
Fixes >=python-3.12 SyntaxWarning (gh-98401)
  • Loading branch information
voyageur committed Jun 4, 2024
1 parent 4b5e52c commit c9f076b
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions checkrestart
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ def deb_fQuery(programs, packages):
if line.startswith('local diversion'):
continue

m = re.match('^diversion by (\S+) (from|to): (.*)$', line)
m = re.match(r'^diversion by (\S+) (from|to): (.*)$', line)
if m:
if m.group(2) == 'from':
diverted = m.group(3)
Expand Down Expand Up @@ -405,7 +405,7 @@ def delmaps (pid):

class SysProcess:
re_name = re.compile('Name:\t(.*)$')
re_uids = re.compile('Uid:\t(\d+)\t(\d+)\t(\d+)\t(\d+)$')
re_uids = re.compile(r'Uid:\t(\d+)\t(\d+)\t(\d+)\t(\d+)$')
processes = {}
def get (pid):
try:
Expand Down Expand Up @@ -506,7 +506,7 @@ class Process:
null = f.find('\0')
if null != -1:
f = f[:null]
return re.sub('( \(deleted\)|.dpkg-new).*$','',f)
return re.sub(r'( \(deleted\)|.dpkg-new).*$','',f)

# Check if a process needs to be restarted, previously we would
# just check if it used libraries named '.dpkg-new' since that's
Expand All @@ -532,7 +532,7 @@ class Process:
if f.endswith(' (deleted)'):
return 1

if re.compile("\(path inode=[0-9]+\)$").search(f):
if re.compile(r"\(path inode=[0-9]+\)$").search(f):
return 1

return 0
Expand Down

0 comments on commit c9f076b

Please sign in to comment.