Skip to content

Commit

Permalink
A few tweaks to the MLIR .pyi files (llvm#110488)
Browse files Browse the repository at this point in the history
  • Loading branch information
superbobry authored Oct 1, 2024
1 parent a889018 commit 91ef1f7
Show file tree
Hide file tree
Showing 7 changed files with 197 additions and 211 deletions.
3 changes: 1 addition & 2 deletions mlir/python/mlir/_mlir_libs/_mlir/__init__.pyi
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
from typing import List

globals: "_Globals"

class _Globals:
dialect_search_modules: List[str]
dialect_search_modules: list[str]
def _register_dialect_impl(self, dialect_namespace: str, dialect_class: type) -> None: ...
def _register_operation_impl(self, operation_name: str, operation_class: type) -> None: ...
def append_dialect_search_prefix(self, module_name: str) -> None: ...
Expand Down
9 changes: 4 additions & 5 deletions mlir/python/mlir/_mlir_libs/_mlir/dialects/pdl.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
# See https://llvm.org/LICENSE.txt for license information.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

from typing import Optional

from mlir.ir import Type, Context

Expand All @@ -26,15 +25,15 @@ class AttributeType(Type):
def isinstance(type: Type) -> bool: ...

@staticmethod
def get(context: Optional[Context] = None) -> AttributeType: ...
def get(context: Context | None = None) -> AttributeType: ...


class OperationType(Type):
@staticmethod
def isinstance(type: Type) -> bool: ...

@staticmethod
def get(context: Optional[Context] = None) -> OperationType: ...
def get(context: Context | None = None) -> OperationType: ...


class RangeType(Type):
Expand All @@ -53,12 +52,12 @@ class TypeType(Type):
def isinstance(type: Type) -> bool: ...

@staticmethod
def get(context: Optional[Context] = None) -> TypeType: ...
def get(context: Context | None = None) -> TypeType: ...


class ValueType(Type):
@staticmethod
def isinstance(type: Type) -> bool: ...

@staticmethod
def get(context: Optional[Context] = None) -> ValueType: ...
def get(context: Context | None = None) -> ValueType: ...
7 changes: 3 additions & 4 deletions mlir/python/mlir/_mlir_libs/_mlir/dialects/quant.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
# See https://llvm.org/LICENSE.txt for license information.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

from typing import List

from mlir.ir import Type

Expand Down Expand Up @@ -94,15 +93,15 @@ class UniformQuantizedPerAxisType(QuantizedType):

@classmethod
def get(cls, flags: int, storage_type: Type, expressed_type: Type,
scales: List[float], zero_points: List[int], quantized_dimension: int,
scales: list[float], zero_points: list[int], quantized_dimension: int,
storage_type_min: int, storage_type_max: int):
...

@property
def scales(self) -> List[float]: ...
def scales(self) -> list[float]: ...

@property
def zero_points(self) -> List[float]: ...
def zero_points(self) -> list[float]: ...

@property
def quantized_dimension(self) -> int: ...
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
# See https://llvm.org/LICENSE.txt for license information.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

from typing import Optional

from mlir.ir import Type, Context

Expand All @@ -12,15 +11,15 @@ class AnyOpType(Type):
def isinstance(type: Type) -> bool: ...

@staticmethod
def get(context: Optional[Context] = None) -> AnyOpType: ...
def get(context: Context | None = None) -> AnyOpType: ...


class OperationType(Type):
@staticmethod
def isinstance(type: Type) -> bool: ...

@staticmethod
def get(operation_name: str, context: Optional[Context] = None) -> OperationType: ...
def get(operation_name: str, context: Context | None = None) -> OperationType: ...

@property
def operation_name(self) -> str: ...
Loading

0 comments on commit 91ef1f7

Please sign in to comment.