DirectXShaderCompiler icon indicating copy to clipboard operation
DirectXShaderCompiler copied to clipboard

Fix python warnings

Open hekota opened this issue 1 year ago • 1 comments

hekota avatar Feb 22 '24 19:02 hekota

:warning: Python code formatter, darker found issues in your code. :warning:

You can test this locally with the following command:
darker --check --diff -r fdbecd30f80b9538dae8fee1efd48612c5c6a703..1ebf5ec58c47fe43741118d3194c547fae4db46f utils/lit/lit/TestRunner.py
View the diff from darker here.
--- TestRunner.py	2024-02-22 19:20:14.000000 +0000
+++ TestRunner.py	2024-02-22 19:23:03.639532 +0000
@@ -436,15 +436,14 @@
             ('%/t', tmpBase.replace('\\', '/') + '.tmp'),
             ('%/T', tmpDir.replace('\\', '/')),
             ])
 
     # re for %if
-    re_cond_end = re.compile('%{')
-    re_if = re.compile('(.*?)(?:%if)')
-    re_nested_if = re.compile('(.*?)(?:%if|%})')
-    re_else = re.compile('^\\s*%else\\s*(%{)?')
-
+    re_cond_end = re.compile("%{")
+    re_if = re.compile("(.*?)(?:%if)")
+    re_nested_if = re.compile("(.*?)(?:%if|%})")
+    re_else = re.compile("^\\s*%else\\s*(%{)?")
 
     # Collect the test lines from the script.
     script = []
     requires = []
     unsupported = []
@@ -453,17 +452,19 @@
         if command_type == 'RUN':
             # Trim trailing whitespace.
             ln = ln.rstrip()
 
             # Substitute line number expressions
-            ln = re.sub('%\\(line\\)', str(line_number), ln)
+            ln = re.sub("%\\(line\\)", str(line_number), ln)
+
             def replace_line_number(match):
                 if match.group(1) == '+':
                     return str(line_number + int(match.group(2)))
                 if match.group(1) == '-':
                     return str(line_number - int(match.group(2)))
-            ln = re.sub('%\\(line *([\+-]) *(\d+)\\)', replace_line_number, ln)
+
+            ln = re.sub("%\\(line *([\+-]) *(\d+)\\)", replace_line_number, ln)
 
             # Collapse lines with trailing '\\'.
             if script and script[-1][-1] == '\\':
                 script[-1] = script[-1][:-1] + ln
             else:

  • [ ] Check this box to apply formatting changes to this branch.

github-actions[bot] avatar Feb 22 '24 19:02 github-actions[bot]