[Mlir-commits] [mlir] Remove mixins left (PR #68850)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Wed Oct 11 23:19:53 PDT 2023


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 9dd15f7486a30c4269b183f72c13006eb8c929f4..585d43cf0aa866279df3e5a4f67e70ebff24a613 mlir/python/mlir/dialects/arith.py mlir/python/mlir/dialects/bufferization.py mlir/python/mlir/dialects/builtin.py mlir/python/mlir/dialects/func.py mlir/python/mlir/dialects/memref.py mlir/python/mlir/dialects/ml_program.py mlir/python/mlir/dialects/pdl.py mlir/python/mlir/dialects/scf.py mlir/python/mlir/dialects/tensor.py mlir/python/mlir/dialects/transform/__init__.py mlir/python/mlir/dialects/transform/bufferization.py mlir/python/mlir/dialects/transform/gpu.py mlir/python/mlir/dialects/transform/loop.py mlir/python/mlir/dialects/transform/memref.py mlir/python/mlir/dialects/transform/pdl.py mlir/python/mlir/dialects/transform/structured.py mlir/python/mlir/dialects/transform/tensor.py
``````````

</details>

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

``````````diff
--- transform/pdl.py	2023-10-12 06:08:15.000000 +0000
+++ transform/pdl.py	2023-10-12 06:19:45.577879 +0000
@@ -1,55 +1,49 @@
 #  Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
 #  See https://llvm.org/LICENSE.txt for license information.
 #  SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 
 try:
-  from ..ir import *
-  from ._ods_common import (
-      get_op_result_or_value as _get_op_result_or_value,
-      get_op_results_or_values as _get_op_results_or_values,
-  )
+    from ..ir import *
+    from ._ods_common import (
+        get_op_result_or_value as _get_op_result_or_value,
+        get_op_results_or_values as _get_op_results_or_values,
+    )
 except ImportError as e:
-  raise RuntimeError("Error loading imports from extension module") from e
+    raise RuntimeError("Error loading imports from extension module") from e
 
 from typing import Union
 
+
 class PDLMatchOp:
-
-  def __init__(
-      self,
-      result_type: Type,
-      target: Union[Operation, Value],
-      pattern_name: Union[Attribute, str],
-      *,
-      loc=None,
-      ip=None,
-  ):
-    super().__init__(
-        result_type,
-        _get_op_result_or_value(target),
-        pattern_name,
-        loc=loc,
-        ip=ip,
-    )
+    def __init__(
+        self,
+        result_type: Type,
+        target: Union[Operation, Value],
+        pattern_name: Union[Attribute, str],
+        *,
+        loc=None,
+        ip=None,
+    ):
+        super().__init__(
+            result_type,
+            _get_op_result_or_value(target),
+            pattern_name,
+            loc=loc,
+            ip=ip,
+        )
 
 
 class WithPDLPatternsOp:
+    def __init__(self, target: Union[Operation, Value, Type], *, loc=None, ip=None):
+        root = _get_op_result_or_value(target) if not isinstance(target, Type) else None
+        root_type = target if isinstance(target, Type) else root.type
+        super().__init__(root=root, loc=loc, ip=ip)
+        self.regions[0].blocks.append(root_type)
 
-  def __init__(self,
-               target: Union[Operation, Value, Type],
-               *,
-               loc=None,
-               ip=None):
-    root = _get_op_result_or_value(target) if not isinstance(target,
-                                                             Type) else None
-    root_type = target if isinstance(target, Type) else root.type
-    super().__init__(root=root, loc=loc, ip=ip)
-    self.regions[0].blocks.append(root_type)
+    @property
+    def body(self) -> Block:
+        return self.regions[0].blocks[0]
 
-  @property
-  def body(self) -> Block:
-    return self.regions[0].blocks[0]
-
-  @property
-  def bodyTarget(self) -> Value:
-    return self.body.arguments[0]
+    @property
+    def bodyTarget(self) -> Value:
+        return self.body.arguments[0]

``````````

</details>


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


More information about the Mlir-commits mailing list