From 82422bf9363c74f2a7cc0f50ef6acf91ca355603 Mon Sep 17 00:00:00 2001 From: Mohan Boddu Date: Mar 24 2020 00:57:21 +0000 Subject: RegEx pattern as raw string Removing some deprecated stuff Signed-off-by: Mohan Boddu --- diff --git a/compose_tracker.py b/compose_tracker.py index e6df999..333c144 100755 --- a/compose_tracker.py +++ b/compose_tracker.py @@ -103,7 +103,7 @@ class Consumer(object): # then we'll get: # [FAIL] Image build (variant AtomicHost, arch *, subvariant AtomicHost) failed, but going on anyway. # ImageBuild task failed: 35659757. See /mnt/koji/compose/updates/Fedora-29-updates-testing-20190620.1/ - r = re.search('.*failed: (\d{8}).*', line) + r = re.search(r'.*failed: (\d{8}).*', line) if r: taskid = r.group(1) text = "- [%s](%s%s)" % (taskid, KOJI_TASK_URL, taskid) @@ -116,7 +116,7 @@ class Consumer(object): # [IMAGE_BUILD ] [INFO ] Hardlinking /mnt/koji/packages/Fedora-AtomicHost/29_Update/20190620.1/... # [IMAGE_BUILD ] [INFO ] Hardlinking /mnt/koji/packages/Fedora-AtomicHost/29_Update/20190620.1/... # [IMAGE_BUILD ] [INFO ] [DONE ] Creating image (formats: qcow2-raw-xz, arches: aarch64-ppc64le-x86_64, variant: AtomicHost, subvariant: AtomicHost) (task id: 35659753) - r = re.search('.*\[DONE \].*task id: (\d{8}).*', line) + r = re.search(r'.*\[DONE \].*task id: (\d{8}).*', line) if r: taskid = r.group(1) text = "- [%s](%s%s)" % (taskid, KOJI_TASK_URL, taskid) @@ -124,7 +124,7 @@ class Consumer(object): # If we get to an end of a phase then stop searching # [INFO ] [DONE ] ---------- PHASE: IMAGE_BUILD ---------- - r = re.search('.*\[DONE \] ---------- PHASE.*', line) + r = re.search(r'.*\[DONE \] ---------- PHASE.*', line) if r: break @@ -206,12 +206,12 @@ class Consumer(object): line = lines[x-1][20:] # trim date off log lines nextline = lines[x][20:] # trim date off log lines - r = re.search('.*\[BEGIN\] ---------- PHASE: (\w+) .*', line) + r = re.search(r'.*\[BEGIN\] ---------- PHASE: (\w+) .*', line) if r: name = r.group(1) phases[name] = [dt.datetime.fromisoformat(linedate)] - r = re.search('.*\[DONE \] ---------- PHASE: (\w+) .*', line) + r = re.search(r'.*\[DONE \] ---------- PHASE: (\w+) .*', line) if r: name = r.group(1) phase = phases.get(name) @@ -220,7 +220,7 @@ class Consumer(object): # If this is a [FAIL] line then we take it and the # next line and add them in markdown format. Also grab # the taskid if we can and print a hyperlink to koji - if re.search('\[FAIL\]', line): + if re.search(r'\[FAIL\]', line): kojitaskline, text = self.get_supporting_text(lines[x-1:]) content+=f'{text}\n' content+= "```\n%s\n%s\n```\n\n" % \