Skip to content

[mlir][python] Fix some mypy violations (NFC) #110606

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

keith
Copy link
Member

@keith keith commented Oct 1, 2024

No description provided.

@llvmbot
Copy link
Member

llvmbot commented Oct 1, 2024

@llvm/pr-subscribers-mlir

Author: Keith Smiley (keith)

Changes

Full diff: https://github.com/llvm/llvm-project/pull/110606.diff

1 Files Affected:

  • (modified) mlir/python/mlir/dialects/_ods_common.py (+7-6)
diff --git a/mlir/python/mlir/dialects/_ods_common.py b/mlir/python/mlir/dialects/_ods_common.py
index d40d936cdc83d6..87adc1f90cad06 100644
--- a/mlir/python/mlir/dialects/_ods_common.py
+++ b/mlir/python/mlir/dialects/_ods_common.py
@@ -3,6 +3,7 @@
 #  SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 
 from typing import (
+    Any as _Any,
     List as _List,
     Optional as _Optional,
     Sequence as _Sequence,
@@ -12,7 +13,7 @@
 )
 
 from .._mlir_libs import _mlir as _cext
-from ..ir import (
+from ..ir import ( # type: ignore
     ArrayAttr,
     Attribute,
     BoolAttr,
@@ -143,7 +144,7 @@ def get_op_result_or_op_results(
         else op
     )
 
-ResultValueTypeTuple = _cext.ir.Operation, _cext.ir.OpView, _cext.ir.Value
+ResultValueTypeTuple = _Tuple[_cext.ir.Operation, _cext.ir.OpView, _cext.ir.Value]
 ResultValueT = _Union[ResultValueTypeTuple]
 VariadicResultValueT = _Union[ResultValueT, _Sequence[ResultValueT]]
 
@@ -244,8 +245,8 @@ def _dispatch_mixed_values(
 
 
 def _get_value_or_attribute_value(
-    value_or_attr: _Union[any, Attribute, ArrayAttr]
-) -> any:
+    value_or_attr: _Union[_Any, Attribute, ArrayAttr]
+) -> _Any:
     if isinstance(value_or_attr, Attribute) and hasattr(value_or_attr, "value"):
         return value_or_attr.value
     if isinstance(value_or_attr, ArrayAttr):
@@ -254,8 +255,8 @@ def _get_value_or_attribute_value(
 
 
 def _get_value_list(
-    sequence_or_array_attr: _Union[_Sequence[any], ArrayAttr]
-) -> _Sequence[any]:
+    sequence_or_array_attr: _Union[_Sequence[_Any], ArrayAttr]
+) -> _Sequence[_Any]:
     return [_get_value_or_attribute_value(v) for v in sequence_or_array_attr]
 
 

Copy link

github-actions bot commented Oct 1, 2024

✅ With the latest revision this PR passed the Python code formatter.

@keith keith force-pushed the ks/mlir-python-fix-some-mypy-violations-nfc branch from 3e67cd8 to c84c143 Compare October 1, 2024 19:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
mlir:python MLIR Python bindings mlir
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants