5068: Support async python function detection in webview diffs

ghayushe-ampere

What version are you running?

7.0.6

What steps will reproduce the problem?

  1. Look at a diff containig async python functions

What is the expected output? What do you see instead?

The function name will be correctly indentified

Please provide any additional information below.

The following code change fixed the issue for me:

diff --git a/reviewboard/diffviewer/filetypes.py b/reviewboard/diffviewer/filetypes.py
index 69631fc0d..b1ce82c71 100644
--- a/reviewboard/diffviewer/filetypes.py
+++ b/reviewboard/diffviewer/filetypes.py
@@ -90,7 +90,7 @@ HEADER_REGEXES = {
         re.compile(r'^\s*sub [A-Za-z0-9_]+'),
     ],
     '.py': [
-        re.compile(r'^\s*(def|class) [A-Za-z0-9_]+\s*\(?'),
+        re.compile(r'^\s*(?:async\s+)?(def|class) [A-Za-z0-9_]+\s*\(?'),
     ],
     '.rb': [
         re.compile(r'^\s*(def|class) [A-Za-z0-9_]+\s*\(?'),