[Mlir-commits] [mlir] Fix references of attributes which are not defined earlier (PR #134364)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Fri Apr 4 04:00:31 PDT 2025


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {darker}-->


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

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
darker --check --diff -r HEAD~1...HEAD mlir/utils/generate-test-checks.py
``````````

</details>

<details>
<summary>
View the diff from darker here.
</summary>

``````````diff
--- generate-test-checks.py	2025-04-04 10:56:54.000000 +0000
+++ generate-test-checks.py	2025-04-04 11:00:04.660506 +0000
@@ -145,11 +145,16 @@
         return attribute_name
 
     # Get the saved substitution name for the given attribute name. If no name
     # has been generated for the given attribute yet, None is returned.
     def get_name(self, source_attribute_name):
-        return self.map[source_attribute_name] if source_attribute_name in self.map else None
+        return (
+            self.map[source_attribute_name]
+            if source_attribute_name in self.map
+            else None
+        )
+
 
 # Return the number of SSA results in a line of type
 #   %0, %1, ... = ...
 # The function returns 0 if there are no results.
 def get_num_ssa_results(input_line):
@@ -226,11 +231,11 @@
     components = ATTR_RE.split(line)
     for component in components:
         m = ATTR_RE.match(component)
         attribute_name = attribute_namer.get_name(m.group(1)) if m else None
         if attribute_name:
-            output_line += f'#[[{attribute_name}]]{component[len(m.group()):]}'
+            output_line += f"#[[{attribute_name}]]{component[len(m.group()):]}"
         else:
             output_line += component
     return output_line
 
 # Pre-process a line of input to remove any character sequences that will be

``````````

</details>


https://github.com/llvm/llvm-project/pull/134364


More information about the Mlir-commits mailing list