Skip to content

Commit 341aef0

Browse files
committed
[mlir][python] Fix some mypy violations (NFC)
1 parent 9c28432 commit 341aef0

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

mlir/python/mlir/dialects/_ods_common.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
44

55
from typing import (
6+
Any as _Any,
67
List as _List,
78
Optional as _Optional,
89
Sequence as _Sequence,
@@ -12,7 +13,7 @@
1213
)
1314

1415
from .._mlir_libs import _mlir as _cext
15-
from ..ir import (
16+
from ..ir import ( # type: ignore
1617
ArrayAttr,
1718
Attribute,
1819
BoolAttr,
@@ -143,7 +144,7 @@ def get_op_result_or_op_results(
143144
else op
144145
)
145146

146-
ResultValueTypeTuple = _cext.ir.Operation, _cext.ir.OpView, _cext.ir.Value
147+
ResultValueTypeTuple = _Tuple[_cext.ir.Operation, _cext.ir.OpView, _cext.ir.Value]
147148
ResultValueT = _Union[ResultValueTypeTuple]
148149
VariadicResultValueT = _Union[ResultValueT, _Sequence[ResultValueT]]
149150

@@ -244,8 +245,8 @@ def _dispatch_mixed_values(
244245

245246

246247
def _get_value_or_attribute_value(
247-
value_or_attr: _Union[any, Attribute, ArrayAttr]
248-
) -> any:
248+
value_or_attr: _Union[_Any, Attribute, ArrayAttr]
249+
) -> _Any:
249250
if isinstance(value_or_attr, Attribute) and hasattr(value_or_attr, "value"):
250251
return value_or_attr.value
251252
if isinstance(value_or_attr, ArrayAttr):
@@ -254,8 +255,8 @@ def _get_value_or_attribute_value(
254255

255256

256257
def _get_value_list(
257-
sequence_or_array_attr: _Union[_Sequence[any], ArrayAttr]
258-
) -> _Sequence[any]:
258+
sequence_or_array_attr: _Union[_Sequence[_Any], ArrayAttr]
259+
) -> _Sequence[_Any]:
259260
return [_get_value_or_attribute_value(v) for v in sequence_or_array_attr]
260261

261262

0 commit comments

Comments
 (0)